@dxc-technology/halstack-react 0.0.0-d238e47 → 0.0.0-d291075
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BackgroundColorContext.d.ts +10 -0
- package/BackgroundColorContext.js +1 -4
- package/HalstackContext.d.ts +12 -0
- package/HalstackContext.js +295 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +15 -47
- package/accordion/Accordion.stories.tsx +307 -0
- package/accordion/Accordion.test.js +72 -0
- package/accordion/types.d.ts +8 -8
- package/accordion-group/AccordionGroup.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +15 -17
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/AccordionGroup.test.js +151 -0
- package/accordion-group/types.d.ts +8 -8
- package/alert/Alert.js +6 -3
- package/alert/Alert.test.js +92 -0
- package/badge/Badge.d.ts +4 -0
- package/badge/Badge.js +6 -4
- package/badge/types.d.ts +5 -0
- package/{radio → badge}/types.js +0 -0
- package/bleed/Bleed.d.ts +3 -0
- package/bleed/Bleed.js +51 -0
- package/bleed/Bleed.stories.tsx +341 -0
- package/bleed/types.d.ts +37 -0
- package/bleed/types.js +5 -0
- package/box/Box.js +24 -34
- package/box/Box.test.js +18 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +21 -26
- package/button/Button.stories.tsx +6 -8
- package/button/Button.test.js +35 -0
- package/button/types.d.ts +3 -7
- package/card/Card.js +25 -28
- package/card/Card.stories.tsx +1 -1
- package/card/Card.test.js +50 -0
- package/checkbox/Checkbox.d.ts +1 -1
- package/checkbox/Checkbox.js +45 -41
- package/checkbox/Checkbox.stories.tsx +124 -128
- package/checkbox/Checkbox.test.js +78 -0
- package/checkbox/types.d.ts +8 -4
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +16 -76
- package/chip/Chip.stories.tsx +6 -8
- package/chip/Chip.test.js +56 -0
- package/chip/types.d.ts +45 -0
- package/chip/types.js +5 -0
- package/common/variables.js +234 -341
- package/date-input/DateInput.js +63 -52
- package/date-input/DateInput.stories.tsx +7 -7
- package/date-input/DateInput.test.js +479 -0
- package/date-input/types.d.ts +16 -9
- package/dialog/Dialog.js +8 -35
- package/dialog/Dialog.test.js +40 -0
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +22 -48
- package/dropdown/Dropdown.stories.tsx +249 -0
- package/dropdown/Dropdown.test.js +189 -0
- package/dropdown/types.d.ts +6 -15
- package/file-input/FileInput.d.ts +1 -1
- package/file-input/FileInput.js +165 -83
- package/file-input/FileInput.stories.tsx +507 -0
- package/file-input/FileInput.test.js +457 -0
- package/file-input/FileItem.js +12 -8
- package/file-input/types.d.ts +32 -7
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +32 -113
- package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
- package/footer/Footer.test.js +109 -0
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +4 -4
- package/footer/types.d.ts +21 -17
- package/header/Header.js +29 -50
- package/header/Header.stories.tsx +46 -36
- package/header/Header.test.js +79 -0
- package/header/Icons.d.ts +2 -0
- package/heading/Heading.js +1 -1
- package/heading/Heading.stories.tsx +3 -2
- package/heading/Heading.test.js +186 -0
- package/inline/Inline.d.ts +4 -0
- package/inline/Inline.js +54 -0
- package/inline/Inline.stories.tsx +240 -0
- package/inline/types.d.ts +32 -0
- package/inline/types.js +5 -0
- package/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +51 -0
- package/inset/Inset.stories.tsx +229 -0
- package/inset/types.d.ts +37 -0
- package/inset/types.js +5 -0
- package/layout/ApplicationLayout.d.ts +11 -0
- package/layout/ApplicationLayout.js +84 -120
- package/layout/ApplicationLayout.stories.tsx +126 -0
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +13 -2
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +52 -0
- package/layout/types.js +5 -0
- package/link/Link.d.ts +3 -2
- package/link/Link.js +61 -86
- package/link/Link.stories.tsx +91 -51
- package/link/Link.test.js +83 -0
- package/link/types.d.ts +9 -29
- package/list/List.d.ts +4 -0
- package/list/List.js +47 -0
- package/list/List.stories.tsx +89 -0
- package/list/types.d.ts +7 -0
- package/list/types.js +5 -0
- package/main.d.ts +13 -9
- package/main.js +80 -42
- package/number-input/NumberInput.js +14 -24
- package/number-input/NumberInput.stories.tsx +5 -5
- package/number-input/NumberInput.test.js +506 -0
- package/number-input/types.d.ts +17 -10
- package/package.json +10 -6
- package/paginator/Paginator.js +19 -46
- package/paginator/Paginator.test.js +308 -0
- package/password-input/PasswordInput.js +23 -19
- package/password-input/PasswordInput.stories.tsx +3 -3
- package/password-input/PasswordInput.test.js +180 -0
- package/password-input/types.d.ts +26 -21
- package/progress-bar/ProgressBar.js +5 -5
- package/progress-bar/ProgressBar.stories.jsx +11 -11
- package/progress-bar/ProgressBar.test.js +65 -0
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +112 -0
- package/quick-nav/QuickNav.stories.tsx +237 -0
- package/quick-nav/types.d.ts +21 -0
- package/quick-nav/types.js +5 -0
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +141 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +282 -0
- package/radio-group/RadioGroup.stories.tsx +100 -0
- package/radio-group/RadioGroup.test.js +695 -0
- package/radio-group/types.d.ts +114 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/ResultsetTable.d.ts +1 -1
- package/resultsetTable/ResultsetTable.js +9 -4
- package/resultsetTable/ResultsetTable.stories.tsx +275 -0
- package/resultsetTable/ResultsetTable.test.js +348 -0
- package/resultsetTable/types.d.ts +6 -2
- package/row/Row.d.ts +3 -0
- package/row/Row.js +127 -0
- package/row/Row.stories.tsx +237 -0
- package/row/types.d.ts +28 -0
- package/row/types.js +5 -0
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +93 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +175 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +110 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +161 -366
- package/select/Select.stories.tsx +230 -176
- package/select/Select.test.js +2162 -0
- package/select/types.d.ts +212 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.d.ts +1 -1
- package/sidenav/Sidenav.js +22 -11
- package/sidenav/Sidenav.stories.tsx +18 -1
- package/sidenav/Sidenav.test.js +56 -0
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +4 -3
- package/slider/Slider.stories.tsx +8 -8
- package/slider/Slider.test.js +150 -0
- package/slider/types.d.ts +4 -0
- package/spinner/Spinner.js +3 -3
- package/spinner/Spinner.stories.jsx +1 -0
- package/spinner/Spinner.test.js +64 -0
- package/stack/Stack.d.ts +4 -0
- package/stack/Stack.js +50 -0
- package/stack/Stack.stories.tsx +203 -0
- package/stack/types.d.ts +28 -0
- package/stack/types.js +5 -0
- package/switch/Switch.d.ts +1 -1
- package/switch/Switch.js +37 -21
- package/switch/Switch.stories.tsx +15 -15
- package/switch/Switch.test.js +98 -0
- package/switch/types.d.ts +6 -2
- package/table/Table.js +2 -2
- package/table/Table.stories.jsx +2 -1
- package/table/Table.test.js +26 -0
- package/tabs/Tabs.d.ts +1 -1
- package/tabs/Tabs.js +17 -19
- package/tabs/Tabs.stories.tsx +112 -0
- package/tabs/Tabs.test.js +140 -0
- package/tabs/types.d.ts +27 -15
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +170 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +132 -0
- package/tabs-nav/types.d.ts +53 -0
- package/tabs-nav/types.js +5 -0
- package/tag/Tag.d.ts +1 -1
- package/tag/Tag.js +18 -28
- package/tag/Tag.stories.tsx +26 -29
- package/tag/Tag.test.js +60 -0
- package/tag/types.d.ts +23 -14
- package/text/Text.d.ts +7 -0
- package/text/Text.js +30 -0
- package/text/Text.stories.tsx +19 -0
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +55 -0
- package/text-input/TextInput.js +88 -103
- package/text-input/TextInput.stories.tsx +474 -0
- package/text-input/TextInput.test.js +1712 -0
- package/text-input/types.d.ts +44 -23
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +39 -79
- package/textarea/Textarea.stories.jsx +37 -15
- package/textarea/Textarea.test.js +437 -0
- package/textarea/types.d.ts +137 -0
- package/textarea/types.js +5 -0
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +18 -46
- package/toggle-group/ToggleGroup.stories.tsx +27 -32
- package/toggle-group/ToggleGroup.test.js +156 -0
- package/toggle-group/types.d.ts +105 -0
- package/toggle-group/types.js +5 -0
- package/useTheme.d.ts +2 -0
- package/useTheme.js +2 -2
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.d.ts +1 -1
- package/wizard/Wizard.js +107 -46
- package/wizard/{Wizard.stories.jsx → Wizard.stories.tsx} +13 -23
- package/wizard/Wizard.test.js +141 -0
- package/wizard/types.d.ts +9 -9
- package/ThemeContext.js +0 -246
- package/V3Select/V3Select.js +0 -455
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -260
- package/V3Textarea/index.d.ts +0 -27
- package/chip/index.d.ts +0 -22
- package/date/Date.js +0 -373
- package/date/index.d.ts +0 -27
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -611
- package/input-text/index.d.ts +0 -36
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -174
- package/radio/Radio.stories.tsx +0 -192
- package/radio/types.d.ts +0 -54
- package/select/index.d.ts +0 -131
- package/textarea/index.d.ts +0 -117
- package/toggle/Toggle.js +0 -186
- package/toggle/index.d.ts +0 -21
- package/toggle-group/index.d.ts +0 -21
- package/upload/Upload.js +0 -201
- package/upload/buttons-upload/ButtonsUpload.js +0 -111
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -115
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -109
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -104
- package/upload/transactions/Transactions.js +0 -94
- package/wizard/Icons.js +0 -65
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
2
|
import { userEvent, within, waitFor } from "@storybook/testing-library";
|
|
4
|
-
import { fireEvent } from "@testing-library/react";
|
|
5
|
-
|
|
6
3
|
import Title from "../../.storybook/components/Title";
|
|
7
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
8
|
-
|
|
9
5
|
import DxcSelect from "./Select";
|
|
6
|
+
import Listbox from "./Listbox";
|
|
7
|
+
import DxcButton from "../button/Button";
|
|
8
|
+
import DxcCheckbox from "../checkbox/Checkbox";
|
|
10
9
|
|
|
11
10
|
export default {
|
|
12
11
|
title: "Select",
|
|
13
12
|
component: DxcSelect,
|
|
14
13
|
};
|
|
15
|
-
const one_option = [{ label: "Option 01", value: "1" }];
|
|
16
14
|
|
|
15
|
+
const one_option = [{ label: "Option 01", value: "1" }];
|
|
17
16
|
const single_options = [
|
|
18
17
|
{ label: "Option 01", value: "1" },
|
|
19
18
|
{ label: "Option 02", value: "2" },
|
|
@@ -224,10 +223,12 @@ const optionsWithEllipsisMedium = [
|
|
|
224
223
|
{ label: "Optiond1234567890123456789012345678901234", value: "1" },
|
|
225
224
|
{ label: "Optiond12345678901234567890123456789012345", value: "2" },
|
|
226
225
|
{ label: "Option 031111111111111111111111111111222", value: "3" },
|
|
227
|
-
{ label: "Option
|
|
226
|
+
{ label: "Option 03111111111111111111111111111222", value: "4" },
|
|
228
227
|
];
|
|
228
|
+
|
|
229
229
|
const Select = () => (
|
|
230
230
|
<>
|
|
231
|
+
<Title title="States" theme="light" level={2} />
|
|
231
232
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
232
233
|
<Title title="Hovered" theme="light" level={4} />
|
|
233
234
|
<DxcSelect label="Hovered" options={single_options} />
|
|
@@ -242,115 +243,210 @@ const Select = () => (
|
|
|
242
243
|
</ExampleContainer>
|
|
243
244
|
<ExampleContainer>
|
|
244
245
|
<Title title="Disabled with value" theme="light" level={4} />
|
|
245
|
-
<DxcSelect label="Disabled with value" disabled options={single_options}
|
|
246
|
+
<DxcSelect label="Disabled with value" disabled options={single_options} defaultValue="1" />
|
|
246
247
|
</ExampleContainer>
|
|
247
248
|
<ExampleContainer>
|
|
248
|
-
<Title title="With label" theme="light" level={4} />
|
|
249
|
-
<DxcSelect label="Label" options={single_options} />
|
|
250
|
-
<Title title="Label and placeholder" theme="light" level={4} />
|
|
251
|
-
<DxcSelect label="Label" options={single_options} placeholder="Placeholder" />
|
|
252
|
-
<Title title="Label, placeholder and helper text" theme="light" level={4} />
|
|
253
|
-
<DxcSelect label="Label" options={single_options} helperText="Helper text" placeholder="Placeholder" />
|
|
254
249
|
<Title title="Error" theme="light" level={4} />
|
|
255
250
|
<DxcSelect
|
|
256
251
|
label="Label"
|
|
257
252
|
options={single_options}
|
|
258
|
-
error="Error message"
|
|
253
|
+
error="Error message."
|
|
254
|
+
helperText="Helper text"
|
|
255
|
+
placeholder="Placeholder"
|
|
256
|
+
/>
|
|
257
|
+
</ExampleContainer>
|
|
258
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
259
|
+
<Title title="Hovered error" theme="light" level={4} />
|
|
260
|
+
<DxcSelect
|
|
261
|
+
label="Label"
|
|
262
|
+
options={single_options}
|
|
263
|
+
error="Error message."
|
|
259
264
|
helperText="Helper text"
|
|
260
265
|
placeholder="Placeholder"
|
|
261
266
|
/>
|
|
267
|
+
</ExampleContainer>
|
|
268
|
+
<Title title="Anatomy" theme="light" level={2} />
|
|
269
|
+
<ExampleContainer>
|
|
270
|
+
<Title title="Label, placeholder and helper text" theme="light" level={4} />
|
|
271
|
+
<DxcSelect label="Label" options={single_options} helperText="Helper text" placeholder="Placeholder" />
|
|
272
|
+
</ExampleContainer>
|
|
273
|
+
<Title title="Variants" theme="light" level={2} />
|
|
274
|
+
<ExampleContainer>
|
|
262
275
|
<Title title="Simple selection" theme="light" level={4} />
|
|
263
|
-
<DxcSelect label="Simple selection" searchable options={single_options}
|
|
276
|
+
<DxcSelect label="Simple selection" searchable options={single_options} defaultValue="2" />
|
|
277
|
+
</ExampleContainer>
|
|
278
|
+
<ExampleContainer>
|
|
264
279
|
<Title title="Multiple selection" theme="light" level={4} />
|
|
265
|
-
<DxcSelect label="Multiple select" searchable options={single_options} multiple
|
|
280
|
+
<DxcSelect label="Multiple select" searchable options={single_options} multiple defaultValue={["1", "2"]} />
|
|
266
281
|
</ExampleContainer>
|
|
267
|
-
|
|
268
282
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
269
283
|
<Title title="Multiple clear hovered" theme="light" level={4} />
|
|
270
|
-
<DxcSelect label="Multiple select" options={single_options} multiple
|
|
284
|
+
<DxcSelect label="Multiple select" options={single_options} multiple defaultValue={["1", "2"]} />
|
|
271
285
|
</ExampleContainer>
|
|
272
|
-
|
|
273
286
|
<ExampleContainer pseudoState="pseudo-active">
|
|
274
287
|
<Title title="Multiple clear actived" theme="light" level={4} />
|
|
275
|
-
<DxcSelect label="Multiple select" options={single_options} multiple
|
|
288
|
+
<DxcSelect label="Multiple select" options={single_options} multiple defaultValue={["1", "2"]} />
|
|
289
|
+
</ExampleContainer>
|
|
290
|
+
<Title title="Sizes" theme="light" level={2} />
|
|
291
|
+
<ExampleContainer>
|
|
292
|
+
<Title title="Small size" theme="light" level={4} />
|
|
293
|
+
<DxcSelect label="Small" options={single_options} size="small" />
|
|
294
|
+
</ExampleContainer>
|
|
295
|
+
<ExampleContainer>
|
|
296
|
+
<Title title="Medium size" theme="light" level={4} />
|
|
297
|
+
<DxcSelect label="Medium" options={single_options} size="medium" />
|
|
298
|
+
</ExampleContainer>
|
|
299
|
+
<ExampleContainer>
|
|
300
|
+
<Title title="Large size" theme="light" level={4} />
|
|
301
|
+
<DxcSelect label="Large" options={single_options} size="large" />
|
|
302
|
+
</ExampleContainer>
|
|
303
|
+
<ExampleContainer>
|
|
304
|
+
<Title title="Fillparent size" theme="light" level={4} />
|
|
305
|
+
<DxcSelect label="Fillparent" options={single_options} size="fillParent" />
|
|
306
|
+
</ExampleContainer>
|
|
307
|
+
<Title title="Margins" theme="light" level={2} />
|
|
308
|
+
<ExampleContainer>
|
|
309
|
+
<Title title="xxsmall margin" theme="light" level={4} />
|
|
310
|
+
<DxcSelect label="xxSmall" options={single_options} margin="xxsmall" />
|
|
311
|
+
</ExampleContainer>
|
|
312
|
+
<ExampleContainer>
|
|
313
|
+
<Title title="xsmall margin" theme="light" level={4} />
|
|
314
|
+
<DxcSelect label="xSmall" options={single_options} margin="xsmall" />
|
|
315
|
+
</ExampleContainer>
|
|
316
|
+
<ExampleContainer>
|
|
317
|
+
<Title title="small margin" theme="light" level={4} />
|
|
318
|
+
<DxcSelect label="Small" options={single_options} margin="small" />
|
|
319
|
+
</ExampleContainer>
|
|
320
|
+
<ExampleContainer>
|
|
321
|
+
<Title title="medium margin" theme="light" level={4} />
|
|
322
|
+
<DxcSelect label="Medium" options={single_options} margin="medium" />
|
|
323
|
+
</ExampleContainer>
|
|
324
|
+
<ExampleContainer>
|
|
325
|
+
<Title title="large margin" theme="light" level={4} />
|
|
326
|
+
<DxcSelect label="Large" options={single_options} margin="large" />
|
|
327
|
+
</ExampleContainer>
|
|
328
|
+
<ExampleContainer>
|
|
329
|
+
<Title title="xlarge margin" theme="light" level={4} />
|
|
330
|
+
<DxcSelect label="xLarge" options={single_options} margin="xlarge" />
|
|
331
|
+
</ExampleContainer>
|
|
332
|
+
<ExampleContainer>
|
|
333
|
+
<Title title="xxlarge margin" theme="light" level={4} />
|
|
334
|
+
<DxcSelect label="xxLarge" options={single_options} margin="xxlarge" />
|
|
276
335
|
</ExampleContainer>
|
|
277
|
-
<>
|
|
278
|
-
<Title title="Sizes" theme="light" level={2} />
|
|
279
|
-
<ExampleContainer>
|
|
280
|
-
<Title title="Small size" theme="light" level={4} />
|
|
281
|
-
<DxcSelect label="Small" options={single_options} size="small" />
|
|
282
|
-
</ExampleContainer>
|
|
283
|
-
<ExampleContainer>
|
|
284
|
-
<Title title="Medium size" theme="light" level={4} />
|
|
285
|
-
<DxcSelect label="Medium" options={single_options} size="medium" />
|
|
286
|
-
</ExampleContainer>
|
|
287
|
-
<ExampleContainer>
|
|
288
|
-
<Title title="Large size" theme="light" level={4} />
|
|
289
|
-
<DxcSelect label="Large" options={single_options} size="large" />
|
|
290
|
-
</ExampleContainer>
|
|
291
|
-
<ExampleContainer>
|
|
292
|
-
<Title title="Fillparent size" theme="light" level={4} />
|
|
293
|
-
<DxcSelect label="Fillparent" options={single_options} size="fillParent" />
|
|
294
|
-
</ExampleContainer>
|
|
295
|
-
</>
|
|
296
|
-
<>
|
|
297
|
-
<Title title="Margins" theme="light" level={2} />
|
|
298
|
-
<ExampleContainer>
|
|
299
|
-
<Title title="xxsmall margin" theme="light" level={4} />
|
|
300
|
-
<DxcSelect label="xxSmall" options={single_options} margin="xxsmall" />
|
|
301
|
-
</ExampleContainer>
|
|
302
|
-
<ExampleContainer>
|
|
303
|
-
<Title title="xsmall margin" theme="light" level={4} />
|
|
304
|
-
<DxcSelect label="xSmall" options={single_options} margin="xsmall" />
|
|
305
|
-
</ExampleContainer>
|
|
306
|
-
<ExampleContainer>
|
|
307
|
-
<Title title="small margin" theme="light" level={4} />
|
|
308
|
-
<DxcSelect label="Small" options={single_options} margin="small" />
|
|
309
|
-
</ExampleContainer>
|
|
310
|
-
<ExampleContainer>
|
|
311
|
-
<Title title="medium margin" theme="light" level={4} />
|
|
312
|
-
<DxcSelect label="Medium" options={single_options} margin="medium" />
|
|
313
|
-
</ExampleContainer>
|
|
314
|
-
<ExampleContainer>
|
|
315
|
-
<Title title="large margin" theme="light" level={4} />
|
|
316
|
-
<DxcSelect label="Large" options={single_options} margin="large" />
|
|
317
|
-
</ExampleContainer>
|
|
318
|
-
<ExampleContainer>
|
|
319
|
-
<Title title="xlarge margin" theme="light" level={4} />
|
|
320
|
-
<DxcSelect label="xLarge" options={single_options} margin="xlarge" />
|
|
321
|
-
</ExampleContainer>
|
|
322
|
-
<ExampleContainer>
|
|
323
|
-
<Title title="xxlarge margin" theme="light" level={4} />
|
|
324
|
-
<DxcSelect label="xxLarge" options={single_options} margin="xxlarge" />
|
|
325
|
-
</ExampleContainer>
|
|
326
|
-
</>
|
|
327
336
|
<ExampleContainer expanded>
|
|
328
337
|
<Title title="Ellipsis" theme="light" level={2} />
|
|
329
338
|
<Title title="Multiple selection with ellipsis" theme="light" level={4} />
|
|
330
|
-
<DxcSelect label="Label" options={single_options} multiple
|
|
339
|
+
<DxcSelect label="Label" options={single_options} multiple defaultValue={["1", "2", "3", "4"]} />
|
|
331
340
|
<Title title="Value with ellipsis" theme="light" level={4} />
|
|
332
|
-
<DxcSelect label="Label" options={optionsWithEllipsisMedium}
|
|
333
|
-
<Title title="
|
|
341
|
+
<DxcSelect label="Label" options={optionsWithEllipsisMedium} defaultValue="1" size="medium" />
|
|
342
|
+
<Title title="Options with ellipsis" theme="light" level={4} />
|
|
334
343
|
<DxcSelect
|
|
335
344
|
label="Label"
|
|
336
345
|
placeholder="Choose an option"
|
|
337
|
-
|
|
346
|
+
defaultValue="1"
|
|
338
347
|
options={optionsWithEllipsisMedium}
|
|
339
348
|
size="medium"
|
|
340
349
|
/>
|
|
341
350
|
</ExampleContainer>
|
|
342
351
|
</>
|
|
343
352
|
);
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
353
|
+
const SelectListbox = () => (
|
|
354
|
+
<>
|
|
355
|
+
<Title title="Listbox" theme="light" level={2} />
|
|
356
|
+
<Title title="Default with opened listbox" theme="light" level={3} />
|
|
357
|
+
<ExampleContainer>
|
|
358
|
+
<div style={{ display: "flex", gap: "30px", flexDirection: "column", marginBottom: "80px" }}>
|
|
359
|
+
<DxcSelect label="Label" options={single_options} optional placeholder="Choose an option" />
|
|
360
|
+
<DxcCheckbox
|
|
361
|
+
label="You understand the selection and give your consent"
|
|
362
|
+
onChange={() => {}}
|
|
363
|
+
labelPosition="after"
|
|
364
|
+
/>
|
|
365
|
+
<DxcButton label="Submit" onClick={() => {}} size="medium" />
|
|
366
|
+
</div>
|
|
367
|
+
</ExampleContainer>
|
|
368
|
+
<Title title="Listbox option states" theme="light" level={3} />
|
|
369
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
370
|
+
<Title title="Hovered option" theme="light" level={4} />
|
|
371
|
+
<Listbox
|
|
372
|
+
id="x"
|
|
373
|
+
currentValue=""
|
|
374
|
+
options={one_option}
|
|
375
|
+
visualFocusIndex={-1}
|
|
376
|
+
lastOptionIndex={0}
|
|
377
|
+
multiple={false}
|
|
378
|
+
optional={false}
|
|
379
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
380
|
+
searchable={false}
|
|
381
|
+
handleOptionOnClick={() => {}}
|
|
382
|
+
styles={{ width: 360 }}
|
|
383
|
+
/>
|
|
384
|
+
</ExampleContainer>
|
|
385
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
386
|
+
<Title title="Active option" theme="light" level={4} />
|
|
387
|
+
<Listbox
|
|
388
|
+
id="x"
|
|
389
|
+
currentValue=""
|
|
390
|
+
options={one_option}
|
|
391
|
+
visualFocusIndex={-1}
|
|
392
|
+
lastOptionIndex={0}
|
|
393
|
+
multiple={false}
|
|
394
|
+
optional={false}
|
|
395
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
396
|
+
searchable={false}
|
|
397
|
+
handleOptionOnClick={() => {}}
|
|
398
|
+
styles={{ width: 360 }}
|
|
399
|
+
/>
|
|
400
|
+
</ExampleContainer>
|
|
401
|
+
<ExampleContainer>
|
|
402
|
+
<Title title="Focused option" theme="light" level={4} />
|
|
403
|
+
<Listbox
|
|
404
|
+
id="x"
|
|
405
|
+
currentValue=""
|
|
406
|
+
options={one_option}
|
|
407
|
+
visualFocusIndex={0}
|
|
408
|
+
lastOptionIndex={0}
|
|
409
|
+
multiple={false}
|
|
410
|
+
optional={false}
|
|
411
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
412
|
+
searchable={false}
|
|
413
|
+
handleOptionOnClick={() => {}}
|
|
414
|
+
styles={{ width: 360 }}
|
|
415
|
+
/>
|
|
416
|
+
</ExampleContainer>
|
|
417
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
418
|
+
<Title title="Hovered selected option" theme="light" level={4} />
|
|
419
|
+
<Listbox
|
|
420
|
+
id="x"
|
|
421
|
+
currentValue="1"
|
|
422
|
+
options={single_options}
|
|
423
|
+
visualFocusIndex={-1}
|
|
424
|
+
lastOptionIndex={3}
|
|
425
|
+
multiple={false}
|
|
426
|
+
optional={false}
|
|
427
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
428
|
+
searchable={false}
|
|
429
|
+
handleOptionOnClick={() => {}}
|
|
430
|
+
styles={{ width: 360 }}
|
|
431
|
+
/>
|
|
432
|
+
</ExampleContainer>
|
|
433
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
434
|
+
<Title title="Active selected option" theme="light" level={4} />
|
|
435
|
+
<Listbox
|
|
436
|
+
id="x"
|
|
437
|
+
currentValue="2"
|
|
438
|
+
options={single_options}
|
|
439
|
+
visualFocusIndex={0}
|
|
440
|
+
lastOptionIndex={3}
|
|
441
|
+
multiple={false}
|
|
442
|
+
optional={false}
|
|
443
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
444
|
+
searchable={false}
|
|
445
|
+
handleOptionOnClick={() => {}}
|
|
446
|
+
styles={{ width: 360 }}
|
|
447
|
+
/>
|
|
448
|
+
</ExampleContainer>
|
|
449
|
+
</>
|
|
354
450
|
);
|
|
355
451
|
const SearchableSelect = () => (
|
|
356
452
|
<ExampleContainer expanded>
|
|
@@ -358,13 +454,18 @@ const SearchableSelect = () => (
|
|
|
358
454
|
<DxcSelect label="Select Label" searchable options={single_options} placeholder="Choose an option" />
|
|
359
455
|
</ExampleContainer>
|
|
360
456
|
);
|
|
361
|
-
const
|
|
457
|
+
const SearchValue = () => (
|
|
362
458
|
<ExampleContainer expanded>
|
|
363
459
|
<Title title="Searchable select with value" theme="light" level={4} />
|
|
364
|
-
<DxcSelect
|
|
460
|
+
<DxcSelect
|
|
461
|
+
label="Select Label"
|
|
462
|
+
searchable
|
|
463
|
+
defaultValue="1"
|
|
464
|
+
options={single_options}
|
|
465
|
+
placeholder="Choose an option"
|
|
466
|
+
/>
|
|
365
467
|
</ExampleContainer>
|
|
366
468
|
);
|
|
367
|
-
|
|
368
469
|
const MultipleSelect = () => (
|
|
369
470
|
<>
|
|
370
471
|
<ExampleContainer expanded>
|
|
@@ -372,7 +473,7 @@ const MultipleSelect = () => (
|
|
|
372
473
|
<DxcSelect
|
|
373
474
|
label="Select label"
|
|
374
475
|
options={single_options}
|
|
375
|
-
|
|
476
|
+
defaultValue={["1", "4"]}
|
|
376
477
|
multiple
|
|
377
478
|
placeholder="Choose an option"
|
|
378
479
|
/>
|
|
@@ -382,31 +483,37 @@ const MultipleSelect = () => (
|
|
|
382
483
|
const DefaultGroupedOptionsSelect = () => (
|
|
383
484
|
<ExampleContainer expanded>
|
|
384
485
|
<Title title="Grouped options simple select" theme="light" level={4} />
|
|
385
|
-
<DxcSelect label="Label" options={group_options}
|
|
486
|
+
<DxcSelect label="Label" options={group_options} defaultValue="9" placeholder="Choose an option" />
|
|
386
487
|
</ExampleContainer>
|
|
387
488
|
);
|
|
388
489
|
const MultipleGroupedOptionsSelect = () => (
|
|
389
490
|
<ExampleContainer expanded>
|
|
390
491
|
<Title title="Grouped options multiple select" theme="light" level={4} />
|
|
391
|
-
<DxcSelect
|
|
492
|
+
<DxcSelect
|
|
493
|
+
label="Label"
|
|
494
|
+
options={group_options}
|
|
495
|
+
defaultValue={["0", "2"]}
|
|
496
|
+
multiple
|
|
497
|
+
placeholder="Choose an option"
|
|
498
|
+
/>
|
|
392
499
|
</ExampleContainer>
|
|
393
500
|
);
|
|
394
501
|
const RescaledIcons = () => (
|
|
395
502
|
<ExampleContainer expanded>
|
|
396
503
|
<Title title="Rescaled icons displayed" theme="light" level={4} />
|
|
397
|
-
<DxcSelect label="Label" options={url_options}
|
|
504
|
+
<DxcSelect label="Label" options={url_options} defaultValue="facebook" placeholder="Choose an option" />
|
|
398
505
|
</ExampleContainer>
|
|
399
506
|
);
|
|
400
507
|
const SelectWithIcons = () => (
|
|
401
508
|
<ExampleContainer expanded>
|
|
402
509
|
<Title title="Normal icons displayed" theme="light" level={4} />
|
|
403
|
-
<DxcSelect label="Label" options={icon_options}
|
|
510
|
+
<DxcSelect label="Label" options={icon_options} defaultValue="3" placeholder="Choose an option" />
|
|
404
511
|
</ExampleContainer>
|
|
405
512
|
);
|
|
406
513
|
const SelectMultipleWithIcons = () => (
|
|
407
514
|
<ExampleContainer expanded>
|
|
408
515
|
<Title title="Multiple select with icons" theme="light" level={4} />
|
|
409
|
-
<DxcSelect label="Label" options={icon_options} multiple
|
|
516
|
+
<DxcSelect label="Label" options={icon_options} multiple defaultValue={["1", "3"]} placeholder="Choose an option" />
|
|
410
517
|
</ExampleContainer>
|
|
411
518
|
);
|
|
412
519
|
const MultipleGroupedOptionsSelectWithIcons = () => (
|
|
@@ -416,41 +523,12 @@ const MultipleGroupedOptionsSelectWithIcons = () => (
|
|
|
416
523
|
label="Label"
|
|
417
524
|
options={icon_options_grouped}
|
|
418
525
|
multiple
|
|
419
|
-
|
|
526
|
+
defaultValue={["3", "2"]}
|
|
420
527
|
placeholder="Choose an option"
|
|
421
528
|
/>
|
|
422
529
|
</ExampleContainer>
|
|
423
530
|
);
|
|
424
|
-
|
|
425
|
-
<ExampleContainer pseudoState="pseudo-hover" expanded>
|
|
426
|
-
<Title title="Hovered Option" theme="light" level={4} />
|
|
427
|
-
<DxcSelect label="Hovered" options={one_option} placeholder="Choose an option" />
|
|
428
|
-
</ExampleContainer>
|
|
429
|
-
);
|
|
430
|
-
const OnlyOneOptionFocused = () => (
|
|
431
|
-
<ExampleContainer pseudoState="pseudo-focus" expanded>
|
|
432
|
-
<Title title="Focused Option" theme="light" level={4} />
|
|
433
|
-
<DxcSelect label="Focused" options={one_option} placeholder="Choose an option" />
|
|
434
|
-
</ExampleContainer>
|
|
435
|
-
);
|
|
436
|
-
const OnlyOneOptionActived = () => (
|
|
437
|
-
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
438
|
-
<Title title="Actived Option" theme="light" level={4} />
|
|
439
|
-
<DxcSelect label="Actived" options={one_option} placeholder="Choose an option" />
|
|
440
|
-
</ExampleContainer>
|
|
441
|
-
);
|
|
442
|
-
const SelectedOptionHovered = () => (
|
|
443
|
-
<ExampleContainer pseudoState="pseudo-hover" expanded>
|
|
444
|
-
<Title title="Hovered Selected Option" theme="light" level={4} />
|
|
445
|
-
<DxcSelect label="Hovered" value="1" options={one_option} placeholder="Choose an option" />
|
|
446
|
-
</ExampleContainer>
|
|
447
|
-
);
|
|
448
|
-
const SelectedOptionActived = () => (
|
|
449
|
-
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
450
|
-
<Title title="Actived Selected Option" theme="light" level={4} />
|
|
451
|
-
<DxcSelect label="Actived" value="1" options={one_option} placeholder="Choose an option" />
|
|
452
|
-
</ExampleContainer>
|
|
453
|
-
);
|
|
531
|
+
|
|
454
532
|
const MultipleSearchable = () => (
|
|
455
533
|
<ExampleContainer expanded>
|
|
456
534
|
<Title title="Searchable multiple select with value" theme="light" level={4} />
|
|
@@ -458,18 +536,26 @@ const MultipleSearchable = () => (
|
|
|
458
536
|
label="Select Label"
|
|
459
537
|
searchable
|
|
460
538
|
multiple
|
|
461
|
-
|
|
539
|
+
defaultValue={["1", "4"]}
|
|
462
540
|
options={single_options}
|
|
463
541
|
placeholder="Choose an option"
|
|
464
542
|
/>
|
|
465
543
|
</ExampleContainer>
|
|
466
544
|
);
|
|
467
|
-
|
|
468
|
-
|
|
545
|
+
|
|
546
|
+
export const Chromatic = Select.bind({});
|
|
547
|
+
Chromatic.play = async ({ canvasElement }) => {
|
|
548
|
+
const canvas = within(canvasElement);
|
|
549
|
+
await userEvent.click(canvas.getAllByRole("combobox")[24]);
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
export const ListboxStates = SelectListbox.bind({});
|
|
553
|
+
ListboxStates.play = async ({ canvasElement }) => {
|
|
469
554
|
const canvas = within(canvasElement);
|
|
470
555
|
const select = canvas.getByRole("combobox");
|
|
471
556
|
await userEvent.click(select);
|
|
472
557
|
};
|
|
558
|
+
|
|
473
559
|
export const Searchable = SearchableSelect.bind({});
|
|
474
560
|
Searchable.play = async ({ canvasElement }) => {
|
|
475
561
|
const canvas = within(canvasElement);
|
|
@@ -478,14 +564,15 @@ Searchable.play = async ({ canvasElement }) => {
|
|
|
478
564
|
userEvent.type(canvas.getByRole("combobox"), "r");
|
|
479
565
|
});
|
|
480
566
|
};
|
|
481
|
-
|
|
482
|
-
|
|
567
|
+
|
|
568
|
+
export const SearchableWithValue = SearchValue.bind({});
|
|
569
|
+
SearchableWithValue.play = async ({ canvasElement }) => {
|
|
483
570
|
const canvas = within(canvasElement);
|
|
484
571
|
await userEvent.click(canvas.getByRole("combobox"));
|
|
485
572
|
};
|
|
486
573
|
|
|
487
|
-
export const
|
|
488
|
-
|
|
574
|
+
export const MultipleSearchableWithValue = MultipleSearchable.bind({});
|
|
575
|
+
MultipleSearchableWithValue.play = async ({ canvasElement }) => {
|
|
489
576
|
const canvas = within(canvasElement);
|
|
490
577
|
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
491
578
|
};
|
|
@@ -497,75 +584,42 @@ GroupOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
|
497
584
|
await userEvent.click(select);
|
|
498
585
|
};
|
|
499
586
|
|
|
500
|
-
export const
|
|
501
|
-
|
|
587
|
+
export const MultipleOptionsDisplayed = MultipleSelect.bind({});
|
|
588
|
+
MultipleOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
502
589
|
const canvas = within(canvasElement);
|
|
503
590
|
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
504
591
|
};
|
|
505
592
|
|
|
506
|
-
export const
|
|
507
|
-
|
|
508
|
-
const canvas = within(canvasElement);
|
|
509
|
-
const select = canvas.getByRole("combobox");
|
|
510
|
-
await userEvent.click(select);
|
|
511
|
-
};
|
|
512
|
-
export const SelectWithIconsDisplayed = SelectWithIcons.bind({});
|
|
513
|
-
SelectWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
593
|
+
export const MultipleGroupedOptionsDisplayed = MultipleGroupedOptionsSelect.bind({});
|
|
594
|
+
MultipleGroupedOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
514
595
|
const canvas = within(canvasElement);
|
|
515
596
|
const select = canvas.getByRole("combobox");
|
|
516
597
|
await userEvent.click(select);
|
|
517
598
|
};
|
|
518
599
|
|
|
519
|
-
export const
|
|
520
|
-
|
|
521
|
-
const canvas = within(canvasElement);
|
|
522
|
-
const select = canvas.getByRole("combobox");
|
|
523
|
-
await userEvent.click(select);
|
|
524
|
-
};
|
|
525
|
-
export const SelectMultipleWithIconsDisplayed = SelectMultipleWithIcons.bind({});
|
|
526
|
-
SelectMultipleWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
600
|
+
export const WithIconsDisplayed = SelectWithIcons.bind({});
|
|
601
|
+
WithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
527
602
|
const canvas = within(canvasElement);
|
|
528
603
|
const select = canvas.getByRole("combobox");
|
|
529
604
|
await userEvent.click(select);
|
|
530
605
|
};
|
|
531
606
|
|
|
532
|
-
export const
|
|
533
|
-
|
|
607
|
+
export const WithRescaledIconsDisplayed = RescaledIcons.bind({});
|
|
608
|
+
WithRescaledIconsDisplayed.play = async ({ canvasElement }) => {
|
|
534
609
|
const canvas = within(canvasElement);
|
|
535
610
|
const select = canvas.getByRole("combobox");
|
|
536
611
|
await userEvent.click(select);
|
|
537
612
|
};
|
|
538
613
|
|
|
539
|
-
export const
|
|
540
|
-
|
|
614
|
+
export const MultipleWithIconsDisplayed = SelectMultipleWithIcons.bind({});
|
|
615
|
+
MultipleWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
541
616
|
const canvas = within(canvasElement);
|
|
542
617
|
const select = canvas.getByRole("combobox");
|
|
543
618
|
await userEvent.click(select);
|
|
544
619
|
};
|
|
545
620
|
|
|
546
|
-
export const
|
|
547
|
-
|
|
548
|
-
const canvas = within(canvasElement);
|
|
549
|
-
const select = canvas.getByRole("combobox");
|
|
550
|
-
await userEvent.click(select);
|
|
551
|
-
await waitFor(async () => {
|
|
552
|
-
fireEvent.keyDown(select, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
|
|
553
|
-
});
|
|
554
|
-
};
|
|
555
|
-
export const OptionActived = OnlyOneOptionActived.bind({});
|
|
556
|
-
OptionActived.play = async ({ canvasElement }) => {
|
|
557
|
-
const canvas = within(canvasElement);
|
|
558
|
-
const select = canvas.getByRole("combobox");
|
|
559
|
-
await userEvent.click(select);
|
|
560
|
-
};
|
|
561
|
-
export const OptionSelectedHovered = SelectedOptionHovered.bind({});
|
|
562
|
-
OptionSelectedHovered.play = async ({ canvasElement }) => {
|
|
563
|
-
const canvas = within(canvasElement);
|
|
564
|
-
const select = canvas.getByRole("combobox");
|
|
565
|
-
await userEvent.click(select);
|
|
566
|
-
};
|
|
567
|
-
export const OptionSelectedActived = SelectedOptionActived.bind({});
|
|
568
|
-
OptionSelectedActived.play = async ({ canvasElement }) => {
|
|
621
|
+
export const MultipleGroupedWithIconsDisplayed = MultipleGroupedOptionsSelectWithIcons.bind({});
|
|
622
|
+
MultipleGroupedWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
569
623
|
const canvas = within(canvasElement);
|
|
570
624
|
const select = canvas.getByRole("combobox");
|
|
571
625
|
await userEvent.click(select);
|