From b3c4e4eb2213d116d7b9638f4a7cc5bdc2b94329 Mon Sep 17 00:00:00 2001 From: Miki Date: Wed, 10 Jul 2024 14:48:10 -0700 Subject: [PATCH] Add aliases for compressed form family Signed-off-by: Miki --- src/components/form/checkbox/checkbox.tsx | 9 +++++++++ src/components/form/checkbox/checkbox_group.tsx | 11 +++++++++++ src/components/form/checkbox/index.ts | 10 +++++++++- .../form/field_number/field_number.tsx | 9 +++++++++ src/components/form/field_number/index.ts | 7 ++++++- .../form/field_password/field_password.tsx | 9 +++++++++ src/components/form/field_password/index.ts | 7 ++++++- .../form/field_search/field_search.tsx | 12 ++++++++++++ src/components/form/field_search/index.ts | 7 ++++++- src/components/form/field_text/field_text.tsx | 6 ++++++ src/components/form/field_text/index.ts | 7 ++++++- src/components/form/file_picker/file_picker.tsx | 12 ++++++++++++ src/components/form/file_picker/index.ts | 7 ++++++- .../form/form_fieldset/form_legend.tsx | 9 +++++++++ src/components/form/form_fieldset/index.ts | 7 ++++++- src/components/form/form_row/form_row.tsx | 12 ++++++++++++ src/components/form/form_row/index.ts | 7 ++++++- src/components/form/radio/index.ts | 9 ++++++++- src/components/form/radio/radio.tsx | 11 +++++++++++ src/components/form/radio/radio_group.tsx | 12 ++++++++++++ src/components/form/range/dual_range.tsx | 9 +++++++++ src/components/form/range/index.ts | 15 +++++++++++++-- src/components/form/range/range.tsx | 9 +++++++++ src/components/form/select/index.ts | 8 +++++++- src/components/form/select/select.tsx | 6 ++++++ src/components/form/super_select/index.ts | 8 +++++++- .../form/super_select/super_select.tsx | 14 ++++++++++++++ src/components/form/switch/index.ts | 8 +++++++- src/components/form/switch/switch.tsx | 6 ++++++ src/components/form/text_area/index.ts | 7 ++++++- src/components/form/text_area/text_area.tsx | 6 ++++++ src/components/index.js | 17 +++++++++++++++++ 32 files changed, 278 insertions(+), 15 deletions(-) diff --git a/src/components/form/checkbox/checkbox.tsx b/src/components/form/checkbox/checkbox.tsx index 4eb083ec8b..bb2b56bded 100644 --- a/src/components/form/checkbox/checkbox.tsx +++ b/src/components/form/checkbox/checkbox.tsx @@ -161,3 +161,12 @@ export class OuiCheckbox extends Component { } } } + +export type OuiCompressedCheckboxProps = Omit; + +export class OuiCompressedCheckbox extends OuiCheckbox { + static defaultProps = { + ...OuiCheckbox.defaultProps, + compressed: true, + }; +} diff --git a/src/components/form/checkbox/checkbox_group.tsx b/src/components/form/checkbox/checkbox_group.tsx index 515a5c2ac1..8db3916807 100644 --- a/src/components/form/checkbox/checkbox_group.tsx +++ b/src/components/form/checkbox/checkbox_group.tsx @@ -121,3 +121,14 @@ export const OuiCheckboxGroup: FunctionComponent = ({ ); }; + +export type OuiCompressedCheckboxGroupProps = CommonProps & { + options: OuiCheckboxGroupOption[]; + idToSelectedMap: OuiCheckboxGroupIdToSelectedMap; + onChange: (optionId: string) => void; + disabled?: boolean; +} & ExclusiveUnion; + +export const OuiCompressedCheckboxGroup: FunctionComponent = ( + props +) => ; diff --git a/src/components/form/checkbox/index.ts b/src/components/form/checkbox/index.ts index 0af047faca..90fca7c9b6 100644 --- a/src/components/form/checkbox/index.ts +++ b/src/components/form/checkbox/index.ts @@ -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'; diff --git a/src/components/form/field_number/field_number.tsx b/src/components/form/field_number/field_number.tsx index d2a14ceaa5..382fe8e677 100644 --- a/src/components/form/field_number/field_number.tsx +++ b/src/components/form/field_number/field_number.tsx @@ -149,3 +149,12 @@ export const OuiFieldNumber: FunctionComponent = ({ ); }; + +export type OuiCompressedFieldNumberProps = Omit< + OuiFieldNumberProps, + 'compressed' +>; + +export const OuiCompressedFieldNumber: FunctionComponent = ( + props +) => ; diff --git a/src/components/form/field_number/index.ts b/src/components/form/field_number/index.ts index b75d97a6cd..afc314df24 100644 --- a/src/components/form/field_number/index.ts +++ b/src/components/form/field_number/index.ts @@ -28,4 +28,9 @@ * under the License. */ -export { OuiFieldNumber, OuiFieldNumberProps } from './field_number'; +export { + OuiFieldNumber, + OuiFieldNumberProps, + OuiCompressedFieldNumber, + OuiCompressedFieldNumberProps, +} from './field_number'; diff --git a/src/components/form/field_password/field_password.tsx b/src/components/form/field_password/field_password.tsx index 6044102d5f..00096b81b9 100644 --- a/src/components/form/field_password/field_password.tsx +++ b/src/components/form/field_password/field_password.tsx @@ -200,3 +200,12 @@ OuiFieldPassword.defaultProps = { isLoading: false, compressed: false, }; + +export type OuiCompressedFieldPasswordProps = Omit< + OuiFieldPasswordProps, + 'compressed' +>; + +export const OuiCompressedFieldPassword: FunctionComponent = ( + props +) => ; diff --git a/src/components/form/field_password/index.ts b/src/components/form/field_password/index.ts index f36e5fbe6c..d5c124be9b 100644 --- a/src/components/form/field_password/index.ts +++ b/src/components/form/field_password/index.ts @@ -28,4 +28,9 @@ * under the License. */ -export { OuiFieldPassword, OuiFieldPasswordProps } from './field_password'; +export { + OuiFieldPassword, + OuiFieldPasswordProps, + OuiCompressedFieldPassword, + OuiCompressedFieldPasswordProps, +} from './field_password'; diff --git a/src/components/form/field_search/field_search.tsx b/src/components/form/field_search/field_search.tsx index 55e7400fd1..1277198351 100644 --- a/src/components/form/field_search/field_search.tsx +++ b/src/components/form/field_search/field_search.tsx @@ -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, + }; +} diff --git a/src/components/form/field_search/index.ts b/src/components/form/field_search/index.ts index b50c406a09..5539ca0a4f 100644 --- a/src/components/form/field_search/index.ts +++ b/src/components/form/field_search/index.ts @@ -28,4 +28,9 @@ * under the License. */ -export { OuiFieldSearch, OuiFieldSearchProps } from './field_search'; +export { + OuiFieldSearch, + OuiFieldSearchProps, + OuiCompressedFieldSearch, + OuiCompressedFieldSearchProps, +} from './field_search'; diff --git a/src/components/form/field_text/field_text.tsx b/src/components/form/field_text/field_text.tsx index bb02673367..faae353e4d 100644 --- a/src/components/form/field_text/field_text.tsx +++ b/src/components/form/field_text/field_text.tsx @@ -130,3 +130,9 @@ export const OuiFieldText: FunctionComponent = ({ ); }; + +export type OuiCompressedFieldTextProps = Omit; + +export const OuiCompressedFieldText: FunctionComponent = ( + props +) => ; diff --git a/src/components/form/field_text/index.ts b/src/components/form/field_text/index.ts index 35ab55177e..3dd3a6591b 100644 --- a/src/components/form/field_text/index.ts +++ b/src/components/form/field_text/index.ts @@ -28,4 +28,9 @@ * under the License. */ -export { OuiFieldText, OuiFieldTextProps } from './field_text'; +export { + OuiFieldText, + OuiFieldTextProps, + OuiCompressedFieldText, + OuiCompressedFieldTextProps, +} from './field_text'; diff --git a/src/components/form/file_picker/file_picker.tsx b/src/components/form/file_picker/file_picker.tsx index 79f64bee5d..a5a0dec195 100644 --- a/src/components/form/file_picker/file_picker.tsx +++ b/src/components/form/file_picker/file_picker.tsx @@ -263,3 +263,15 @@ export class OuiFilePicker extends Component { ); } } + +export type OuiCompressedFilePickerProps = Omit< + OuiFilePickerProps, + 'compressed' +>; + +export class OuiCompressedFilePicker extends OuiFilePicker { + static defaultProps = { + ...OuiFilePicker.defaultProps, + compressed: true, + }; +} diff --git a/src/components/form/file_picker/index.ts b/src/components/form/file_picker/index.ts index 36779fcdfe..af79d15e84 100644 --- a/src/components/form/file_picker/index.ts +++ b/src/components/form/file_picker/index.ts @@ -28,4 +28,9 @@ * under the License. */ -export { OuiFilePicker, OuiFilePickerProps } from './file_picker'; +export { + OuiFilePicker, + OuiFilePickerProps, + OuiCompressedFilePicker, + OuiCompressedFilePickerProps, +} from './file_picker'; diff --git a/src/components/form/form_fieldset/form_legend.tsx b/src/components/form/form_fieldset/form_legend.tsx index 4404ec0b6c..015a740739 100644 --- a/src/components/form/form_fieldset/form_legend.tsx +++ b/src/components/form/form_fieldset/form_legend.tsx @@ -75,3 +75,12 @@ export const OuiFormLegend: FunctionComponent = ({ ); }; + +export type OuiCompressedFormLegendProps = Omit< + OuiFormLegendProps, + 'compressed' +>; + +export const OuiCompressedFormLegend: FunctionComponent = ( + props +) => ; diff --git a/src/components/form/form_fieldset/index.ts b/src/components/form/form_fieldset/index.ts index c4092a2373..e3f18b3de8 100644 --- a/src/components/form/form_fieldset/index.ts +++ b/src/components/form/form_fieldset/index.ts @@ -29,4 +29,9 @@ */ export { OuiFormFieldset, OuiFormFieldsetProps } from './form_fieldset'; -export { OuiFormLegend, OuiFormLegendProps } from './form_legend'; +export { + OuiFormLegend, + OuiFormLegendProps, + OuiCompressedFormLegend, + OuiCompressedFormLegendProps, +} from './form_legend'; diff --git a/src/components/form/form_row/form_row.tsx b/src/components/form/form_row/form_row.tsx index e654909df1..d1a248f839 100644 --- a/src/components/form/form_row/form_row.tsx +++ b/src/components/form/form_row/form_row.tsx @@ -328,3 +328,15 @@ export class OuiFormRow extends Component { ); } } + +export type OuiCompressedFormRowProps = ExclusiveUnion< + Omit, + Omit +>; + +export class OuiCompressedFormRow extends OuiFormRow { + static defaultProps = { + ...OuiFormRow.defaultProps, + display: 'rowCompressed', + }; +} diff --git a/src/components/form/form_row/index.ts b/src/components/form/form_row/index.ts index ebc2fb85c2..2a3606a2e8 100644 --- a/src/components/form/form_row/index.ts +++ b/src/components/form/form_row/index.ts @@ -28,4 +28,9 @@ * under the License. */ -export { OuiFormRow, OuiFormRowProps } from './form_row'; +export { + OuiFormRow, + OuiFormRowProps, + OuiCompressedFormRow, + OuiCompressedFormRowProps, +} from './form_row'; diff --git a/src/components/form/radio/index.ts b/src/components/form/radio/index.ts index b36bd20698..309ce14182 100644 --- a/src/components/form/radio/index.ts +++ b/src/components/form/radio/index.ts @@ -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'; diff --git a/src/components/form/radio/radio.tsx b/src/components/form/radio/radio.tsx index 619010618d..cb6c2f1548 100644 --- a/src/components/form/radio/radio.tsx +++ b/src/components/form/radio/radio.tsx @@ -120,3 +120,14 @@ export const OuiRadio: FunctionComponent = ({ ); }; + +export type OuiCompressedRadioProps = CommonProps & + Omit, 'onChange' | 'id'> & + ExclusiveUnion< + ExclusiveUnion, idWithLabel>, + withId + >; + +export const OuiCompressedRadio: FunctionComponent = ( + props +) => ; diff --git a/src/components/form/radio/radio_group.tsx b/src/components/form/radio/radio_group.tsx index 4b1f22bad4..06d9e6d2f5 100644 --- a/src/components/form/radio/radio_group.tsx +++ b/src/components/form/radio/radio_group.tsx @@ -126,3 +126,15 @@ export const OuiRadioGroup: FunctionComponent = ({ ); }; + +export type OuiCompressedRadioGroupProps = CommonProps & { + disabled?: boolean; + name?: string; + options: OuiRadioGroupOption[]; + idSelected?: string; + onChange: OuiRadioGroupChangeCallback; +} & ExclusiveUnion; + +export const OuiCompressedRadioGroup: FunctionComponent = ( + props +) => ; diff --git a/src/components/form/range/dual_range.tsx b/src/components/form/range/dual_range.tsx index 03e5cd2804..a9a14b01af 100644 --- a/src/components/form/range/dual_range.tsx +++ b/src/components/form/range/dual_range.tsx @@ -794,3 +794,12 @@ export class OuiDualRange extends Component { return thePopover || theRange; } } + +export type OuiCompressedDualRangeProps = Omit; + +export class OuiCompressedDualRange extends OuiDualRange { + static defaultProps = { + ...OuiDualRange.defaultProps, + compressed: true, + }; +} diff --git a/src/components/form/range/index.ts b/src/components/form/range/index.ts index 761232419a..5cbb294d45 100644 --- a/src/components/form/range/index.ts +++ b/src/components/form/range/index.ts @@ -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'; diff --git a/src/components/form/range/range.tsx b/src/components/form/range/range.tsx index 1f9be802af..fcc39fb999 100644 --- a/src/components/form/range/range.tsx +++ b/src/components/form/range/range.tsx @@ -357,3 +357,12 @@ export class OuiRange extends Component { return thePopover ? thePopover : theRange; } } + +export type OuiCompressedRangeProps = Omit; + +export class OuiCompressedRange extends OuiRange { + static defaultProps = { + ...OuiRange.defaultProps, + compressed: true, + }; +} diff --git a/src/components/form/select/index.ts b/src/components/form/select/index.ts index 83feff2be4..6a126b75ba 100644 --- a/src/components/form/select/index.ts +++ b/src/components/form/select/index.ts @@ -28,4 +28,10 @@ * under the License. */ -export { OuiSelect, OuiSelectProps, OuiSelectOption } from './select'; +export { + OuiSelect, + OuiSelectProps, + OuiSelectOption, + OuiCompressedSelect, + OuiCompressedSelectProps, +} from './select'; diff --git a/src/components/form/select/select.tsx b/src/components/form/select/select.tsx index ce31ae86e8..9bfb3daaa0 100644 --- a/src/components/form/select/select.tsx +++ b/src/components/form/select/select.tsx @@ -178,3 +178,9 @@ export const OuiSelect: FunctionComponent = ({ ); }; + +export type OuiCompressedSelectProps = Omit; + +export const OuiCompressedSelect: FunctionComponent = ( + props +) => ; diff --git a/src/components/form/super_select/index.ts b/src/components/form/super_select/index.ts index 2309754441..628f189ce8 100644 --- a/src/components/form/super_select/index.ts +++ b/src/components/form/super_select/index.ts @@ -28,7 +28,13 @@ * under the License. */ -export { OuiSuperSelect, OuiSuperSelectProps } from './super_select'; +export { + OuiSuperSelect, + OuiSuperSelectProps, + OuiCompressedSuperSelect, + OuiCompressedSuperSelectProps, +} from './super_select'; + export { OuiSuperSelectControl, OuiSuperSelectControlProps, diff --git a/src/components/form/super_select/super_select.tsx b/src/components/form/super_select/super_select.tsx index 710f67c1f5..8386a2a0e9 100644 --- a/src/components/form/super_select/super_select.tsx +++ b/src/components/form/super_select/super_select.tsx @@ -346,3 +346,17 @@ export class OuiSuperSelect extends Component< ); } } + +export type OuiCompressedSuperSelectProps = Omit< + OuiSuperSelectProps, + 'compressed' +>; + +export class OuiCompressedSuperSelect extends OuiSuperSelect< + T +> { + static defaultProps = { + ...OuiSuperSelect.defaultProps, + compressed: true, + }; +} diff --git a/src/components/form/switch/index.ts b/src/components/form/switch/index.ts index cab5b4abd9..6518ec9f01 100644 --- a/src/components/form/switch/index.ts +++ b/src/components/form/switch/index.ts @@ -28,4 +28,10 @@ * under the License. */ -export { OuiSwitch, OuiSwitchProps, OuiSwitchEvent } from './switch'; +export { + OuiSwitch, + OuiSwitchProps, + OuiSwitchEvent, + OuiCompressedSwitch, + OuiCompressedSwitchProps, +} from './switch'; diff --git a/src/components/form/switch/switch.tsx b/src/components/form/switch/switch.tsx index bdc13cd255..f7ca664bc6 100644 --- a/src/components/form/switch/switch.tsx +++ b/src/components/form/switch/switch.tsx @@ -163,3 +163,9 @@ export const OuiSwitch: FunctionComponent = ({ ); }; + +export type OuiCompressedSwitchProps = Omit; + +export const OuiCompressedSwitch: FunctionComponent = ( + props +) => ; diff --git a/src/components/form/text_area/index.ts b/src/components/form/text_area/index.ts index 2daecd57e8..99b94f715a 100644 --- a/src/components/form/text_area/index.ts +++ b/src/components/form/text_area/index.ts @@ -28,4 +28,9 @@ * under the License. */ -export { OuiTextArea, OuiTextAreaProps } from './text_area'; +export { + OuiTextArea, + OuiTextAreaProps, + OuiCompressedTextArea, + OuiCompressedTextAreaProps, +} from './text_area'; diff --git a/src/components/form/text_area/text_area.tsx b/src/components/form/text_area/text_area.tsx index 9b5ac4a131..87cdbdebd5 100644 --- a/src/components/form/text_area/text_area.tsx +++ b/src/components/form/text_area/text_area.tsx @@ -105,3 +105,9 @@ export const OuiTextArea: FunctionComponent = ({ ); }; + +export type OuiCompressedTextAreaProps = Omit; + +export const OuiCompressedTextArea: FunctionComponent = ( + props +) => ; diff --git a/src/components/index.js b/src/components/index.js index cb3502e908..f0e234a0f6 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -162,6 +162,23 @@ export { OuiSwitch, OuiTextArea, OuiValidatableControl, + OuiCompressedCheckbox, + OuiCompressedCheckboxGroup, + OuiCompressedDualRange, + OuiCompressedFieldNumber, + OuiCompressedFieldPassword, + OuiCompressedFieldSearch, + OuiCompressedFieldText, + OuiCompressedFilePicker, + OuiCompressedFormLegend, + OuiCompressedFormRow, + OuiCompressedRadio, + OuiCompressedRadioGroup, + OuiCompressedRange, + OuiCompressedSelect, + OuiCompressedSuperSelect, + OuiCompressedSwitch, + OuiCompressedTextArea, } from './form'; export {