Skip to content

Commit

Permalink
Add aliases for compressed form family
Browse files Browse the repository at this point in the history
Signed-off-by: Miki <miki@amazon.com>
  • Loading branch information
AMoo-Miki committed Jul 11, 2024
1 parent 14e82c2 commit b3c4e4e
Show file tree
Hide file tree
Showing 32 changed files with 278 additions and 15 deletions.
9 changes: 9 additions & 0 deletions src/components/form/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,12 @@ export class OuiCheckbox extends Component<OuiCheckboxProps> {
}
}
}

export type OuiCompressedCheckboxProps = Omit<OuiCheckboxProps, 'compressed'>;

export class OuiCompressedCheckbox extends OuiCheckbox {
static defaultProps = {
...OuiCheckbox.defaultProps,
compressed: true,
};
}
11 changes: 11 additions & 0 deletions src/components/form/checkbox/checkbox_group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,14 @@ export const OuiCheckboxGroup: FunctionComponent<OuiCheckboxGroupProps> = ({
</div>
);
};

export type OuiCompressedCheckboxGroupProps = CommonProps & {
options: OuiCheckboxGroupOption[];
idToSelectedMap: OuiCheckboxGroupIdToSelectedMap;
onChange: (optionId: string) => void;
disabled?: boolean;
} & ExclusiveUnion<AsDivProps, WithLegendProps>;

export const OuiCompressedCheckboxGroup: FunctionComponent<OuiCompressedCheckboxGroupProps> = (
props
) => <OuiCheckboxGroup {...props} compressed />;
10 changes: 9 additions & 1 deletion src/components/form/checkbox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,17 @@
* under the License.
*/

export { OuiCheckbox, OuiCheckboxProps } from './checkbox';
export {
OuiCheckbox,
OuiCheckboxProps,
OuiCompressedCheckbox,
OuiCompressedCheckboxProps,
} from './checkbox';

export {
OuiCheckboxGroup,
OuiCheckboxGroupProps,
OuiCheckboxGroupOption,
OuiCompressedCheckboxGroup,
OuiCompressedCheckboxGroupProps,
} from './checkbox_group';
9 changes: 9 additions & 0 deletions src/components/form/field_number/field_number.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,12 @@ export const OuiFieldNumber: FunctionComponent<OuiFieldNumberProps> = ({
</OuiFormControlLayout>
);
};

export type OuiCompressedFieldNumberProps = Omit<
OuiFieldNumberProps,
'compressed'
>;

export const OuiCompressedFieldNumber: FunctionComponent<OuiCompressedFieldNumberProps> = (
props
) => <OuiFieldNumber {...props} compressed />;
7 changes: 6 additions & 1 deletion src/components/form/field_number/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@
* under the License.
*/

export { OuiFieldNumber, OuiFieldNumberProps } from './field_number';
export {
OuiFieldNumber,
OuiFieldNumberProps,
OuiCompressedFieldNumber,
OuiCompressedFieldNumberProps,
} from './field_number';
9 changes: 9 additions & 0 deletions src/components/form/field_password/field_password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,12 @@ OuiFieldPassword.defaultProps = {
isLoading: false,
compressed: false,
};

export type OuiCompressedFieldPasswordProps = Omit<
OuiFieldPasswordProps,
'compressed'
>;

export const OuiCompressedFieldPassword: FunctionComponent<OuiFieldPasswordProps> = (
props
) => <OuiFieldPassword {...props} compressed />;
7 changes: 6 additions & 1 deletion src/components/form/field_password/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@
* under the License.
*/

export { OuiFieldPassword, OuiFieldPasswordProps } from './field_password';
export {
OuiFieldPassword,
OuiFieldPasswordProps,
OuiCompressedFieldPassword,
OuiCompressedFieldPasswordProps,
} from './field_password';
12 changes: 12 additions & 0 deletions src/components/form/field_search/field_search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,15 @@ export class OuiFieldSearch extends Component<
);
}
}

export type OuiCompressedFieldSearchProps = Omit<
OuiFieldSearchProps,
'compressed'
>;

export class OuiCompressedFieldSearch extends OuiFieldSearch {
static defaultProps = {
...OuiFieldSearch.defaultProps,
compressed: true,
};
}
7 changes: 6 additions & 1 deletion src/components/form/field_search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@
* under the License.
*/

export { OuiFieldSearch, OuiFieldSearchProps } from './field_search';
export {
OuiFieldSearch,
OuiFieldSearchProps,
OuiCompressedFieldSearch,
OuiCompressedFieldSearchProps,
} from './field_search';
6 changes: 6 additions & 0 deletions src/components/form/field_text/field_text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,9 @@ export const OuiFieldText: FunctionComponent<OuiFieldTextProps> = ({
</OuiFormControlLayout>
);
};

export type OuiCompressedFieldTextProps = Omit<OuiFieldTextProps, 'compressed'>;

export const OuiCompressedFieldText: FunctionComponent<OuiCompressedFieldTextProps> = (
props
) => <OuiFieldText {...props} compressed />;
7 changes: 6 additions & 1 deletion src/components/form/field_text/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@
* under the License.
*/

export { OuiFieldText, OuiFieldTextProps } from './field_text';
export {
OuiFieldText,
OuiFieldTextProps,
OuiCompressedFieldText,
OuiCompressedFieldTextProps,
} from './field_text';
12 changes: 12 additions & 0 deletions src/components/form/file_picker/file_picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,3 +263,15 @@ export class OuiFilePicker extends Component<OuiFilePickerProps> {
);
}
}

export type OuiCompressedFilePickerProps = Omit<
OuiFilePickerProps,
'compressed'
>;

export class OuiCompressedFilePicker extends OuiFilePicker {
static defaultProps = {
...OuiFilePicker.defaultProps,
compressed: true,
};
}
7 changes: 6 additions & 1 deletion src/components/form/file_picker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@
* under the License.
*/

export { OuiFilePicker, OuiFilePickerProps } from './file_picker';
export {
OuiFilePicker,
OuiFilePickerProps,
OuiCompressedFilePicker,
OuiCompressedFilePickerProps,
} from './file_picker';
9 changes: 9 additions & 0 deletions src/components/form/form_fieldset/form_legend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,12 @@ export const OuiFormLegend: FunctionComponent<OuiFormLegendProps> = ({
</legend>
);
};

export type OuiCompressedFormLegendProps = Omit<
OuiFormLegendProps,
'compressed'
>;

export const OuiCompressedFormLegend: FunctionComponent<OuiCompressedFormLegendProps> = (
props
) => <OuiFormLegend {...props} compressed />;
7 changes: 6 additions & 1 deletion src/components/form/form_fieldset/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@
*/

export { OuiFormFieldset, OuiFormFieldsetProps } from './form_fieldset';
export { OuiFormLegend, OuiFormLegendProps } from './form_legend';
export {
OuiFormLegend,
OuiFormLegendProps,
OuiCompressedFormLegend,
OuiCompressedFormLegendProps,
} from './form_legend';
12 changes: 12 additions & 0 deletions src/components/form/form_row/form_row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,15 @@ export class OuiFormRow extends Component<OuiFormRowProps, OuiFormRowState> {
);
}
}

export type OuiCompressedFormRowProps = ExclusiveUnion<
Omit<LabelProps, 'display'>,
Omit<LegendProps, 'display'>
>;

export class OuiCompressedFormRow extends OuiFormRow {
static defaultProps = {
...OuiFormRow.defaultProps,
display: 'rowCompressed',
};
}
7 changes: 6 additions & 1 deletion src/components/form/form_row/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@
* under the License.
*/

export { OuiFormRow, OuiFormRowProps } from './form_row';
export {
OuiFormRow,
OuiFormRowProps,
OuiCompressedFormRow,
OuiCompressedFormRowProps,
} from './form_row';
9 changes: 8 additions & 1 deletion src/components/form/radio/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,16 @@
* under the License.
*/

export { OuiRadio, OuiRadioProps } from './radio';
export {
OuiRadio,
OuiRadioProps,
OuiCompressedRadio,
OuiCompressedRadioProps,
} from './radio';
export {
OuiRadioGroup,
OuiRadioGroupProps,
OuiRadioGroupOption,
OuiCompressedRadioGroup,
OuiCompressedRadioGroupProps,
} from './radio_group';
11 changes: 11 additions & 0 deletions src/components/form/radio/radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,14 @@ export const OuiRadio: FunctionComponent<OuiRadioProps> = ({
</div>
);
};

export type OuiCompressedRadioProps = CommonProps &
Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'id'> &
ExclusiveUnion<
ExclusiveUnion<Omit<RadioProps, 'compressed'>, idWithLabel>,
withId
>;

export const OuiCompressedRadio: FunctionComponent<OuiCompressedRadioProps> = (
props
) => <OuiRadio {...props} compressed />;
12 changes: 12 additions & 0 deletions src/components/form/radio/radio_group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,15 @@ export const OuiRadioGroup: FunctionComponent<OuiRadioGroupProps> = ({
</div>
);
};

export type OuiCompressedRadioGroupProps = CommonProps & {
disabled?: boolean;
name?: string;
options: OuiRadioGroupOption[];
idSelected?: string;
onChange: OuiRadioGroupChangeCallback;
} & ExclusiveUnion<AsDivProps, WithLegendProps>;

export const OuiCompressedRadioGroup: FunctionComponent<OuiCompressedRadioGroupProps> = (
props
) => <OuiRadioGroup {...props} compressed />;
9 changes: 9 additions & 0 deletions src/components/form/range/dual_range.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -794,3 +794,12 @@ export class OuiDualRange extends Component<OuiDualRangeProps> {
return thePopover || theRange;
}
}

export type OuiCompressedDualRangeProps = Omit<OuiDualRangeProps, 'compressed'>;

export class OuiCompressedDualRange extends OuiDualRange {
static defaultProps = {
...OuiDualRange.defaultProps,
compressed: true,
};
}
15 changes: 13 additions & 2 deletions src/components/form/range/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,16 @@
* under the License.
*/

export { OuiDualRange, OuiDualRangeProps } from './dual_range';
export { OuiRange, OuiRangeProps } from './range';
export {
OuiDualRange,
OuiDualRangeProps,
OuiCompressedDualRange,
OuiCompressedDualRangeProps,
} from './dual_range';

export {
OuiRange,
OuiRangeProps,
OuiCompressedRange,
OuiCompressedRangeProps,
} from './range';
9 changes: 9 additions & 0 deletions src/components/form/range/range.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -357,3 +357,12 @@ export class OuiRange extends Component<OuiRangeProps> {
return thePopover ? thePopover : theRange;
}
}

export type OuiCompressedRangeProps = Omit<OuiRangeProps, 'compressed'>;

export class OuiCompressedRange extends OuiRange {
static defaultProps = {
...OuiRange.defaultProps,
compressed: true,
};
}
8 changes: 7 additions & 1 deletion src/components/form/select/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,10 @@
* under the License.
*/

export { OuiSelect, OuiSelectProps, OuiSelectOption } from './select';
export {
OuiSelect,
OuiSelectProps,
OuiSelectOption,
OuiCompressedSelect,
OuiCompressedSelectProps,
} from './select';
6 changes: 6 additions & 0 deletions src/components/form/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,9 @@ export const OuiSelect: FunctionComponent<OuiSelectProps> = ({
</OuiFormControlLayout>
);
};

export type OuiCompressedSelectProps = Omit<OuiSelectProps, 'compressed'>;

export const OuiCompressedSelect: FunctionComponent<OuiCompressedSelectProps> = (
props
) => <OuiSelect {...props} compressed />;
8 changes: 7 additions & 1 deletion src/components/form/super_select/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@
* under the License.
*/

export { OuiSuperSelect, OuiSuperSelectProps } from './super_select';
export {
OuiSuperSelect,
OuiSuperSelectProps,
OuiCompressedSuperSelect,
OuiCompressedSuperSelectProps,
} from './super_select';

export {
OuiSuperSelectControl,
OuiSuperSelectControlProps,
Expand Down
14 changes: 14 additions & 0 deletions src/components/form/super_select/super_select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -346,3 +346,17 @@ export class OuiSuperSelect<T extends string> extends Component<
);
}
}

export type OuiCompressedSuperSelectProps<T extends string> = Omit<
OuiSuperSelectProps<T>,
'compressed'
>;

export class OuiCompressedSuperSelect<T extends string> extends OuiSuperSelect<
T
> {
static defaultProps = {
...OuiSuperSelect.defaultProps,
compressed: true,
};
}
8 changes: 7 additions & 1 deletion src/components/form/switch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,10 @@
* under the License.
*/

export { OuiSwitch, OuiSwitchProps, OuiSwitchEvent } from './switch';
export {
OuiSwitch,
OuiSwitchProps,
OuiSwitchEvent,
OuiCompressedSwitch,
OuiCompressedSwitchProps,
} from './switch';
6 changes: 6 additions & 0 deletions src/components/form/switch/switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,9 @@ export const OuiSwitch: FunctionComponent<OuiSwitchProps> = ({
</div>
);
};

export type OuiCompressedSwitchProps = Omit<OuiSwitchProps, 'compressed'>;

export const OuiCompressedSwitch: FunctionComponent<OuiCompressedSwitchProps> = (
props
) => <OuiSwitch {...props} compressed />;
Loading

0 comments on commit b3c4e4e

Please sign in to comment.