@dxc-technology/halstack-react 0.0.0-dcd93c4 → 0.0.0-dcee34a
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/HalstackContext.js +98 -50
- package/accordion/Accordion.js +117 -104
- package/accordion/Accordion.stories.tsx +103 -15
- package/accordion/Accordion.test.js +9 -10
- package/accordion/types.d.ts +5 -4
- package/accordion-group/AccordionGroup.js +1 -21
- package/accordion-group/AccordionGroup.stories.tsx +27 -1
- package/accordion-group/AccordionGroup.test.js +20 -45
- package/accordion-group/types.d.ts +10 -3
- package/alert/Alert.js +1 -1
- package/alert/Alert.stories.tsx +28 -0
- package/bleed/Bleed.stories.tsx +63 -63
- package/box/Box.js +1 -1
- package/box/Box.stories.tsx +15 -0
- package/box/types.d.ts +1 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +123 -0
- package/bulleted-list/BulletedList.stories.tsx +200 -0
- package/bulleted-list/types.d.ts +11 -0
- package/button/Button.js +50 -70
- package/button/Button.stories.tsx +159 -8
- package/button/types.d.ts +7 -7
- package/card/types.d.ts +1 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +92 -99
- package/checkbox/Checkbox.stories.tsx +131 -59
- package/checkbox/Checkbox.test.js +93 -16
- package/checkbox/types.d.ts +6 -2
- package/chip/Chip.js +16 -22
- package/chip/Chip.stories.tsx +96 -9
- package/chip/types.d.ts +1 -1
- package/common/variables.js +328 -260
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +134 -237
- package/date-input/DateInput.stories.tsx +199 -33
- package/date-input/DateInput.test.js +494 -138
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +146 -0
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +75 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +126 -0
- package/date-input/types.d.ts +51 -0
- package/dialog/Dialog.js +50 -28
- package/dialog/Dialog.stories.tsx +99 -22
- package/dialog/Dialog.test.js +34 -4
- package/dialog/types.d.ts +3 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +246 -249
- package/dropdown/Dropdown.stories.tsx +245 -56
- package/dropdown/Dropdown.test.js +504 -108
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +70 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +81 -0
- package/dropdown/types.d.ts +25 -5
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +177 -219
- package/file-input/FileInput.stories.tsx +122 -11
- package/file-input/FileInput.test.js +53 -12
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +38 -63
- package/file-input/types.d.ts +17 -0
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +69 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +32 -0
- package/footer/Footer.stories.tsx +99 -1
- package/footer/types.d.ts +2 -1
- package/header/Header.js +87 -87
- package/header/Header.stories.tsx +152 -9
- package/header/Icons.js +2 -2
- package/header/types.d.ts +3 -2
- package/inset/Inset.stories.tsx +4 -4
- package/layout/ApplicationLayout.d.ts +15 -6
- package/layout/ApplicationLayout.js +36 -64
- package/layout/ApplicationLayout.stories.tsx +80 -44
- package/layout/types.d.ts +17 -27
- package/link/Link.js +2 -2
- package/link/Link.stories.tsx +72 -5
- package/link/types.d.ts +1 -1
- package/main.d.ts +6 -10
- package/main.js +28 -60
- package/{tabs-nav → nav-tabs}/NavTabs.js +6 -6
- package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +96 -6
- package/{tabs-nav → nav-tabs}/Tab.js +37 -20
- package/{tabs-nav → nav-tabs}/types.d.ts +1 -1
- package/number-input/NumberInput.test.js +43 -7
- package/package.json +16 -21
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +6 -12
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +18 -11
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.test.js +13 -12
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +59 -53
- package/progress-bar/ProgressBar.stories.jsx +38 -3
- package/progress-bar/ProgressBar.test.js +67 -22
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.js +18 -17
- package/quick-nav/QuickNav.stories.tsx +145 -26
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +43 -28
- package/radio-group/RadioGroup.js +24 -24
- package/radio-group/RadioGroup.stories.tsx +132 -18
- package/radio-group/RadioGroup.test.js +123 -96
- package/radio-group/types.d.ts +2 -2
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.js +48 -107
- package/resultsetTable/ResultsetTable.stories.tsx +50 -25
- package/resultsetTable/ResultsetTable.test.js +40 -63
- package/resultsetTable/types.d.ts +2 -2
- package/select/Listbox.js +4 -10
- package/select/Option.js +11 -24
- package/select/Select.js +54 -50
- package/select/Select.stories.tsx +494 -149
- package/select/Select.test.js +338 -272
- package/select/types.d.ts +3 -5
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +174 -55
- package/sidenav/Sidenav.stories.tsx +249 -149
- package/sidenav/Sidenav.test.js +25 -37
- package/sidenav/types.d.ts +50 -27
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +120 -95
- package/slider/Slider.stories.tsx +64 -1
- package/slider/Slider.test.js +121 -21
- package/slider/types.d.ts +6 -2
- package/spinner/Spinner.js +2 -2
- package/spinner/Spinner.stories.jsx +27 -1
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +135 -68
- package/switch/Switch.stories.tsx +41 -30
- package/switch/Switch.test.js +144 -17
- package/switch/types.d.ts +6 -2
- package/table/Table.js +1 -1
- package/table/Table.stories.jsx +80 -1
- package/table/Table.test.js +1 -1
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +133 -0
- package/tabs/Tabs.js +360 -104
- package/tabs/Tabs.stories.tsx +119 -5
- package/tabs/Tabs.test.js +217 -6
- package/tabs/types.d.ts +15 -5
- package/tag/Tag.js +1 -1
- package/tag/Tag.stories.tsx +14 -1
- package/tag/types.d.ts +1 -1
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.js +38 -9
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.js +195 -292
- package/text-input/TextInput.stories.tsx +280 -185
- package/text-input/TextInput.test.js +737 -725
- package/text-input/types.d.ts +22 -3
- package/textarea/Textarea.stories.jsx +60 -1
- package/toggle-group/ToggleGroup.stories.tsx +42 -0
- package/toggle-group/types.d.ts +1 -1
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +131 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/wizard/Wizard.js +9 -16
- package/wizard/Wizard.stories.tsx +40 -1
- package/wizard/types.d.ts +5 -4
- package/common/RequiredComponent.js +0 -32
- package/inline/Inline.d.ts +0 -4
- package/inline/Inline.js +0 -60
- package/inline/Inline.stories.tsx +0 -319
- package/inline/types.d.ts +0 -36
- package/list/List.d.ts +0 -4
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -89
- package/list/types.d.ts +0 -7
- package/row/Row.d.ts +0 -3
- package/row/Row.js +0 -127
- package/row/Row.stories.tsx +0 -237
- package/row/types.d.ts +0 -28
- package/stack/Stack.d.ts +0 -4
- package/stack/Stack.js +0 -56
- package/stack/Stack.stories.tsx +0 -263
- package/stack/types.d.ts +0 -32
- package/tabs-nav/types.js +0 -5
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
- /package/{inline → bulleted-list}/types.js +0 -0
- /package/{list → flex}/types.js +0 -0
- /package/{tabs-nav → nav-tabs}/NavTabs.d.ts +0 -0
- /package/{tabs-nav → nav-tabs}/NavTabs.test.js +0 -0
- /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
- /package/{row → nav-tabs}/types.js +0 -0
- /package/{stack → typography}/types.js +0 -0
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { userEvent, within
|
|
3
|
-
import { fireEvent } from "@testing-library/react";
|
|
2
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
4
3
|
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
5
4
|
import Title from "../../.storybook/components/Title";
|
|
6
5
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
7
6
|
import DarkContainer from "../../.storybook/components/DarkSection";
|
|
8
7
|
import DxcTextInput from "./TextInput";
|
|
8
|
+
import DxcButton from "../button/Button";
|
|
9
|
+
import DxcCheckbox from "../checkbox/Checkbox";
|
|
10
|
+
import DxcFlex from "../flex/Flex";
|
|
11
|
+
import Suggestions from "./Suggestions";
|
|
12
|
+
import { ThemeProvider } from "styled-components";
|
|
13
|
+
import useTheme from "../useTheme";
|
|
14
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
9
15
|
|
|
10
16
|
export default {
|
|
11
17
|
title: "Text input",
|
|
@@ -22,7 +28,7 @@ const action = {
|
|
|
22
28
|
),
|
|
23
29
|
};
|
|
24
30
|
|
|
25
|
-
const
|
|
31
|
+
const actionLargeIconSVG = {
|
|
26
32
|
onClick: () => {},
|
|
27
33
|
icon: (
|
|
28
34
|
<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
|
|
@@ -32,6 +38,11 @@ const actionLargeIcon = {
|
|
|
32
38
|
),
|
|
33
39
|
};
|
|
34
40
|
|
|
41
|
+
const actionLargeIconURL = {
|
|
42
|
+
onClick: () => {},
|
|
43
|
+
icon: "https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png",
|
|
44
|
+
};
|
|
45
|
+
|
|
35
46
|
const country = ["Afghanistan"];
|
|
36
47
|
const countries = [
|
|
37
48
|
"Afghanistan",
|
|
@@ -56,8 +67,16 @@ const countries = [
|
|
|
56
67
|
"Dominica",
|
|
57
68
|
"Denmark",
|
|
58
69
|
"Djibouti",
|
|
70
|
+
"*",
|
|
59
71
|
];
|
|
60
72
|
|
|
73
|
+
const opinionatedTheme = {
|
|
74
|
+
textInput: {
|
|
75
|
+
fontColor: "#000000",
|
|
76
|
+
hoverBorderColor: "#a46ede",
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
61
80
|
export const Chromatic = () => (
|
|
62
81
|
<>
|
|
63
82
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
@@ -72,6 +91,14 @@ export const Chromatic = () => (
|
|
|
72
91
|
<Title title="Hovered action" theme="light" level={4} />
|
|
73
92
|
<DxcTextInput label="Text input" defaultValue="Text" clearable />
|
|
74
93
|
</ExampleContainer>
|
|
94
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
95
|
+
<Title title="Actived action" theme="light" level={4} />
|
|
96
|
+
<DxcTextInput label="Text input" action={action} clearable />
|
|
97
|
+
</ExampleContainer>
|
|
98
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
99
|
+
<Title title="Focused action" theme="light" level={4} />
|
|
100
|
+
<DxcTextInput label="Text input" action={action} clearable />
|
|
101
|
+
</ExampleContainer>
|
|
75
102
|
<ExampleContainer>
|
|
76
103
|
<Title title="Without label" theme="light" level={4} />
|
|
77
104
|
<DxcTextInput />
|
|
@@ -85,12 +112,21 @@ export const Chromatic = () => (
|
|
|
85
112
|
<DxcTextInput label="Text input" clearable defaultValue="Text" helperText="Help message" optional />
|
|
86
113
|
</ExampleContainer>
|
|
87
114
|
<ExampleContainer>
|
|
88
|
-
<Title title="Clearable and large icon action" theme="light" level={4} />
|
|
115
|
+
<Title title="Clearable and large icon action (SVG)" theme="light" level={4} />
|
|
89
116
|
<DxcTextInput
|
|
90
117
|
label="Text input"
|
|
91
118
|
defaultValue="Text text text text text text text text text text"
|
|
92
119
|
clearable
|
|
93
|
-
action={
|
|
120
|
+
action={actionLargeIconSVG}
|
|
121
|
+
/>
|
|
122
|
+
</ExampleContainer>
|
|
123
|
+
<ExampleContainer>
|
|
124
|
+
<Title title="Clearable and large icon action (URL)" theme="light" level={4} />
|
|
125
|
+
<DxcTextInput
|
|
126
|
+
label="Text input"
|
|
127
|
+
defaultValue="Text text text text text text text text text text"
|
|
128
|
+
clearable
|
|
129
|
+
action={actionLargeIconURL}
|
|
94
130
|
/>
|
|
95
131
|
</ExampleContainer>
|
|
96
132
|
<ExampleContainer>
|
|
@@ -152,7 +188,7 @@ export const Chromatic = () => (
|
|
|
152
188
|
</ExampleContainer>
|
|
153
189
|
<BackgroundColorProvider color="#333333">
|
|
154
190
|
<DarkContainer>
|
|
155
|
-
<Title title="Dark" theme="dark" level={2} />
|
|
191
|
+
<Title title="Dark theme" theme="dark" level={2} />
|
|
156
192
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
157
193
|
<Title title="Hovered" theme="dark" level={4} />
|
|
158
194
|
<DxcTextInput label="Text input" />
|
|
@@ -165,6 +201,14 @@ export const Chromatic = () => (
|
|
|
165
201
|
<Title title="Hovered action" theme="dark" level={4} />
|
|
166
202
|
<DxcTextInput label="Text input" defaultValue="Text" clearable />
|
|
167
203
|
</ExampleContainer>
|
|
204
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
205
|
+
<Title title="Actived action" theme="dark" level={4} />
|
|
206
|
+
<DxcTextInput label="Text input" action={action} clearable />
|
|
207
|
+
</ExampleContainer>
|
|
208
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
209
|
+
<Title title="Focused action" theme="dark" level={4} />
|
|
210
|
+
<DxcTextInput label="Text input" action={action} clearable />
|
|
211
|
+
</ExampleContainer>
|
|
168
212
|
<ExampleContainer>
|
|
169
213
|
<Title title="Helper text, placeholder, optional and action" theme="dark" level={4} />
|
|
170
214
|
<DxcTextInput
|
|
@@ -276,199 +320,250 @@ export const Chromatic = () => (
|
|
|
276
320
|
<Title title="FillParent size" theme="light" level={4} />
|
|
277
321
|
<DxcTextInput label="FillParent" size="fillParent" />
|
|
278
322
|
</ExampleContainer>
|
|
323
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
324
|
+
<ExampleContainer>
|
|
325
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
326
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
327
|
+
<Title title="Hovered input" theme="light" level={4} />
|
|
328
|
+
<DxcTextInput label="Text input" helperText="Help message" />
|
|
329
|
+
</ExampleContainer>
|
|
330
|
+
<ExampleContainer pseudoState="pseudo-focus-within">
|
|
331
|
+
<Title title="Focused input" theme="light" level={4} />
|
|
332
|
+
<DxcTextInput label="Text input" helperText="Help message" />
|
|
333
|
+
</ExampleContainer>
|
|
334
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
335
|
+
<Title title="Hovered action" theme="light" level={4} />
|
|
336
|
+
<DxcTextInput label="Text input" helperText="Help message" defaultValue="Text" clearable />
|
|
337
|
+
</ExampleContainer>
|
|
338
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
339
|
+
<Title title="Actived action" theme="light" level={4} />
|
|
340
|
+
<DxcTextInput label="Text input" helperText="Help message" action={action} clearable />
|
|
341
|
+
</ExampleContainer>
|
|
342
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
343
|
+
<Title title="Focused action" theme="light" level={4} />
|
|
344
|
+
<DxcTextInput label="Text input" helperText="Help message" action={action} clearable />
|
|
345
|
+
</ExampleContainer>
|
|
346
|
+
<ExampleContainer>
|
|
347
|
+
<Title title="Prefix" theme="light" level={4} />
|
|
348
|
+
<DxcTextInput label="With prefix" prefix="+34" helperText="Help message" />
|
|
349
|
+
</ExampleContainer>
|
|
350
|
+
<ExampleContainer>
|
|
351
|
+
<Title title="Suffix and action" theme="light" level={4} />
|
|
352
|
+
<DxcTextInput label="With suffix" helperText="Help message" suffix="USD" action={action} />
|
|
353
|
+
</ExampleContainer>
|
|
354
|
+
<ExampleContainer>
|
|
355
|
+
<Title title="Invalid" theme="light" level={4} />
|
|
356
|
+
<DxcTextInput
|
|
357
|
+
label="Error text input"
|
|
358
|
+
helperText="Help message"
|
|
359
|
+
error="Error message."
|
|
360
|
+
defaultValue="Text"
|
|
361
|
+
clearable
|
|
362
|
+
optional
|
|
363
|
+
action={action}
|
|
364
|
+
/>
|
|
365
|
+
</ExampleContainer>
|
|
366
|
+
<ExampleContainer>
|
|
367
|
+
<Title title="Disabled and placeholder" theme="light" level={4} />
|
|
368
|
+
<DxcTextInput label="Disabled text input" disabled placeholder="Placeholder" prefix="+34" suffix="USD" />
|
|
369
|
+
</ExampleContainer>
|
|
370
|
+
<ExampleContainer>
|
|
371
|
+
<Title title="Disabled, helper text, optional, value and action" theme="light" level={4} />
|
|
372
|
+
<DxcTextInput
|
|
373
|
+
label="Disabled text input"
|
|
374
|
+
helperText="Help message"
|
|
375
|
+
disabled
|
|
376
|
+
optional
|
|
377
|
+
defaultValue="Text"
|
|
378
|
+
action={action}
|
|
379
|
+
/>
|
|
380
|
+
</ExampleContainer>
|
|
381
|
+
</HalstackProvider>
|
|
382
|
+
</ExampleContainer>
|
|
279
383
|
</>
|
|
280
384
|
);
|
|
281
385
|
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
<Title title="Focused action" theme="light" level={4} />
|
|
285
|
-
<DxcTextInput label="Text input" action={action} clearable />
|
|
286
|
-
</ExampleContainer>
|
|
287
|
-
);
|
|
288
|
-
|
|
289
|
-
const ActivedActionTextInput = () => (
|
|
290
|
-
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
291
|
-
<Title title="Actived action" theme="light" level={4} />
|
|
292
|
-
<DxcTextInput label="Text input" action={action} clearable />
|
|
293
|
-
</ExampleContainer>
|
|
294
|
-
);
|
|
295
|
-
|
|
296
|
-
const ShowOptionsAutosuggest = () => (
|
|
297
|
-
<ExampleContainer expanded>
|
|
298
|
-
<Title title="Show options" theme="light" level={4} />
|
|
299
|
-
<DxcTextInput label="Text input" suggestions={countries} clearable />
|
|
300
|
-
</ExampleContainer>
|
|
301
|
-
);
|
|
302
|
-
|
|
303
|
-
const HoveredOptionAutosuggest = () => (
|
|
304
|
-
<ExampleContainer expanded pseudoState="pseudo-hover">
|
|
305
|
-
<Title title="Hovered option" theme="light" level={4} />
|
|
306
|
-
<DxcTextInput label="Text input" suggestions={country} clearable />
|
|
307
|
-
</ExampleContainer>
|
|
308
|
-
);
|
|
309
|
-
|
|
310
|
-
const FocusedOptionAutosuggest = () => (
|
|
311
|
-
<ExampleContainer expanded>
|
|
312
|
-
<Title title="Focused option" theme="light" level={4} />
|
|
313
|
-
<DxcTextInput label="Text input" suggestions={country} clearable />
|
|
314
|
-
</ExampleContainer>
|
|
315
|
-
);
|
|
316
|
-
|
|
317
|
-
const ActivedOptionAutosuggest = () => (
|
|
318
|
-
<ExampleContainer expanded pseudoState="pseudo-active">
|
|
319
|
-
<Title title="Actived option" theme="light" level={4} />
|
|
320
|
-
<DxcTextInput label="Text input" suggestions={country} clearable />
|
|
321
|
-
</ExampleContainer>
|
|
322
|
-
);
|
|
323
|
-
|
|
324
|
-
const FocusedActionTextInputOnDark = () => (
|
|
325
|
-
<BackgroundColorProvider color="#333333">
|
|
326
|
-
<DarkContainer>
|
|
327
|
-
<ExampleContainer expanded>
|
|
328
|
-
<Title title="Focused action" theme="dark" level={4} />
|
|
329
|
-
<DxcTextInput label="Text input" action={action} clearable />
|
|
330
|
-
</ExampleContainer>
|
|
331
|
-
</DarkContainer>
|
|
332
|
-
</BackgroundColorProvider>
|
|
333
|
-
);
|
|
386
|
+
const AutosuggestListbox = () => {
|
|
387
|
+
const colorsTheme: any = useTheme();
|
|
334
388
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
<
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
389
|
+
return (
|
|
390
|
+
<ThemeProvider theme={colorsTheme.textInput}>
|
|
391
|
+
<ExampleContainer>
|
|
392
|
+
<Title title="Autosuggest listbox" theme="light" level={2} />
|
|
393
|
+
<ExampleContainer>
|
|
394
|
+
<Title
|
|
395
|
+
title="List dialog uses a Radix Popover to appear over elements with a certain z-index"
|
|
396
|
+
theme="light"
|
|
397
|
+
level={3}
|
|
398
|
+
/>
|
|
399
|
+
<div
|
|
400
|
+
style={{
|
|
401
|
+
display: "flex",
|
|
402
|
+
flexDirection: "column",
|
|
403
|
+
gap: "20px",
|
|
404
|
+
height: "150px",
|
|
405
|
+
width: "500px",
|
|
406
|
+
marginBottom: "250px",
|
|
407
|
+
padding: "20px",
|
|
408
|
+
border: "1px solid black",
|
|
409
|
+
borderRadius: "4px",
|
|
410
|
+
overflow: "auto",
|
|
411
|
+
zIndex: "1300",
|
|
412
|
+
position: "relative",
|
|
413
|
+
}}
|
|
414
|
+
>
|
|
415
|
+
<DxcTextInput
|
|
416
|
+
label="Label"
|
|
417
|
+
suggestions={countries}
|
|
418
|
+
optional
|
|
419
|
+
placeholder="Choose an option"
|
|
420
|
+
size="fillParent"
|
|
421
|
+
/>
|
|
422
|
+
<button style={{ zIndex: "1", width: "100px" }}>Submit</button>
|
|
423
|
+
</div>
|
|
424
|
+
</ExampleContainer>
|
|
425
|
+
<Title title="Listbox suggestion states" theme="light" level={3} />
|
|
426
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
427
|
+
<Title title="Hovered suggestion" theme="light" level={4} />
|
|
428
|
+
<Suggestions
|
|
429
|
+
id="x"
|
|
430
|
+
value=""
|
|
431
|
+
suggestions={country}
|
|
432
|
+
visualFocusIndex={-1}
|
|
433
|
+
highlightedSuggestions={false}
|
|
434
|
+
searchHasErrors={false}
|
|
435
|
+
isSearching={false}
|
|
436
|
+
suggestionOnClick={() => {}}
|
|
437
|
+
getTextInputWidth={() => 350}
|
|
438
|
+
/>
|
|
439
|
+
</ExampleContainer>
|
|
440
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
441
|
+
<Title title="Active suggestion" theme="light" level={4} />
|
|
442
|
+
<Suggestions
|
|
443
|
+
id="x"
|
|
444
|
+
value=""
|
|
445
|
+
suggestions={country}
|
|
446
|
+
visualFocusIndex={-1}
|
|
447
|
+
highlightedSuggestions={false}
|
|
448
|
+
searchHasErrors={false}
|
|
449
|
+
isSearching={false}
|
|
450
|
+
suggestionOnClick={(suggestion) => {}}
|
|
451
|
+
getTextInputWidth={() => 350}
|
|
452
|
+
/>
|
|
453
|
+
</ExampleContainer>
|
|
454
|
+
<ExampleContainer>
|
|
455
|
+
<Title title="Focused suggestion" theme="light" level={4} />
|
|
456
|
+
<Suggestions
|
|
457
|
+
id="x"
|
|
458
|
+
value=""
|
|
459
|
+
suggestions={country}
|
|
460
|
+
visualFocusIndex={0}
|
|
461
|
+
highlightedSuggestions={false}
|
|
462
|
+
searchHasErrors={false}
|
|
463
|
+
isSearching={false}
|
|
464
|
+
suggestionOnClick={(suggestion) => {}}
|
|
465
|
+
getTextInputWidth={() => 350}
|
|
466
|
+
/>
|
|
467
|
+
</ExampleContainer>
|
|
468
|
+
<ExampleContainer>
|
|
469
|
+
<Title title="Highlighted suggestion" theme="light" level={4} />
|
|
470
|
+
<Suggestions
|
|
471
|
+
id="x"
|
|
472
|
+
value="Afgh"
|
|
473
|
+
suggestions={country}
|
|
474
|
+
visualFocusIndex={-1}
|
|
475
|
+
highlightedSuggestions={true}
|
|
476
|
+
searchHasErrors={false}
|
|
477
|
+
isSearching={false}
|
|
478
|
+
suggestionOnClick={(suggestion) => {}}
|
|
479
|
+
getTextInputWidth={() => 350}
|
|
480
|
+
/>
|
|
481
|
+
</ExampleContainer>
|
|
352
482
|
</ExampleContainer>
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
483
|
+
<ExampleContainer>
|
|
484
|
+
<Title title="Autosuggest Error" theme="light" level={3} />
|
|
485
|
+
<Suggestions
|
|
486
|
+
id="x"
|
|
487
|
+
value=""
|
|
488
|
+
suggestions={country}
|
|
489
|
+
visualFocusIndex={-1}
|
|
490
|
+
highlightedSuggestions={false}
|
|
491
|
+
searchHasErrors={true}
|
|
492
|
+
isSearching={false}
|
|
493
|
+
suggestionOnClick={(suggestion) => {}}
|
|
494
|
+
getTextInputWidth={() => 350}
|
|
495
|
+
/>
|
|
363
496
|
</ExampleContainer>
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
497
|
+
<ExampleContainer>
|
|
498
|
+
<Title title="Autosuggest Searching message" theme="light" level={3} />
|
|
499
|
+
<Suggestions
|
|
500
|
+
id="x"
|
|
501
|
+
value=""
|
|
502
|
+
suggestions={country}
|
|
503
|
+
visualFocusIndex={-1}
|
|
504
|
+
highlightedSuggestions={false}
|
|
505
|
+
searchHasErrors={false}
|
|
506
|
+
isSearching={true}
|
|
507
|
+
suggestionOnClick={(suggestion) => {}}
|
|
508
|
+
getTextInputWidth={() => 350}
|
|
509
|
+
/>
|
|
374
510
|
</ExampleContainer>
|
|
375
|
-
</
|
|
376
|
-
|
|
377
|
-
);
|
|
378
|
-
|
|
379
|
-
const ActivedOptionAutosuggestOnDark = () => (
|
|
380
|
-
<BackgroundColorProvider color="#333333">
|
|
381
|
-
<DarkContainer>
|
|
382
|
-
<ExampleContainer expanded pseudoState="pseudo-active">
|
|
383
|
-
<Title title="Actived option" theme="dark" level={4} />
|
|
384
|
-
<DxcTextInput label="Text input" suggestions={country} clearable />
|
|
385
|
-
</ExampleContainer>
|
|
386
|
-
</DarkContainer>
|
|
387
|
-
</BackgroundColorProvider>
|
|
388
|
-
);
|
|
389
|
-
|
|
390
|
-
export const FocusedAction = FocusedActionTextInput.bind({});
|
|
391
|
-
FocusedAction.play = async ({ canvasElement }) => {
|
|
392
|
-
const canvas = within(canvasElement);
|
|
393
|
-
const action = canvas.getByRole("button");
|
|
394
|
-
await action.focus();
|
|
511
|
+
</ThemeProvider>
|
|
512
|
+
);
|
|
395
513
|
};
|
|
396
514
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
const canvas = within(canvasElement);
|
|
400
|
-
const action = canvas.getByRole("button");
|
|
401
|
-
await userEvent.click(action);
|
|
402
|
-
};
|
|
515
|
+
const DarkAutosuggestListbox = () => {
|
|
516
|
+
const colorsTheme: any = useTheme();
|
|
403
517
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
ActivedActionOnDark.play = async ({ canvasElement }) => {
|
|
442
|
-
const canvas = within(canvasElement);
|
|
443
|
-
const action = canvas.getByRole("button");
|
|
444
|
-
await userEvent.click(action);
|
|
445
|
-
};
|
|
446
|
-
|
|
447
|
-
export const ShowOptionsOnDark = ShowOptionsAutosuggestOnDark.bind({});
|
|
448
|
-
ShowOptionsOnDark.play = async ({ canvasElement }) => {
|
|
449
|
-
const canvas = within(canvasElement);
|
|
450
|
-
const autosuggest = canvas.getByRole("combobox");
|
|
451
|
-
await userEvent.click(autosuggest);
|
|
452
|
-
};
|
|
453
|
-
|
|
454
|
-
export const HoveredActionOnDark = HoveredActionAutosuggestOnDark.bind({});
|
|
455
|
-
HoveredActionOnDark.play = async ({ canvasElement }) => {
|
|
456
|
-
const canvas = within(canvasElement);
|
|
457
|
-
const autosuggest = canvas.getByRole("combobox");
|
|
458
|
-
await userEvent.click(autosuggest);
|
|
518
|
+
return (
|
|
519
|
+
<ThemeProvider theme={colorsTheme.textInput}>
|
|
520
|
+
<BackgroundColorProvider color="#333333">
|
|
521
|
+
<DarkContainer>
|
|
522
|
+
<Title title="Dark theme" theme="dark" level={2} />
|
|
523
|
+
<ExampleContainer>
|
|
524
|
+
<Title title="Default with opened suggestions" theme="dark" level={3} />
|
|
525
|
+
<DxcFlex direction="column" gap="80px">
|
|
526
|
+
<DxcTextInput label="Label" suggestions={countries} optional placeholder="Choose an option" />
|
|
527
|
+
<DxcCheckbox
|
|
528
|
+
label="You understand the selection and give your consent"
|
|
529
|
+
onChange={() => {}}
|
|
530
|
+
labelPosition="after"
|
|
531
|
+
/>
|
|
532
|
+
<DxcButton label="Submit" onClick={() => {}} size="medium" margin={{ bottom: "xxlarge" }} />
|
|
533
|
+
</DxcFlex>
|
|
534
|
+
</ExampleContainer>
|
|
535
|
+
<ExampleContainer>
|
|
536
|
+
<Title title="Autosuggest Error" theme="dark" level={3} />
|
|
537
|
+
<div style={{ height: "100px" }}>
|
|
538
|
+
<Suggestions
|
|
539
|
+
id="x"
|
|
540
|
+
value=""
|
|
541
|
+
suggestions={country}
|
|
542
|
+
visualFocusIndex={-1}
|
|
543
|
+
highlightedSuggestions={false}
|
|
544
|
+
searchHasErrors={true}
|
|
545
|
+
isSearching={false}
|
|
546
|
+
suggestionOnClick={(suggestion) => {}}
|
|
547
|
+
getTextInputWidth={() => 350}
|
|
548
|
+
/>
|
|
549
|
+
</div>
|
|
550
|
+
</ExampleContainer>
|
|
551
|
+
</DarkContainer>
|
|
552
|
+
</BackgroundColorProvider>
|
|
553
|
+
</ThemeProvider>
|
|
554
|
+
);
|
|
459
555
|
};
|
|
460
556
|
|
|
461
|
-
export const
|
|
462
|
-
|
|
557
|
+
export const AutosuggestListboxStates = AutosuggestListbox.bind({});
|
|
558
|
+
AutosuggestListboxStates.play = async ({ canvasElement }) => {
|
|
463
559
|
const canvas = within(canvasElement);
|
|
464
|
-
const
|
|
465
|
-
await userEvent.click(
|
|
466
|
-
fireEvent.keyDown(autosuggest, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
|
|
560
|
+
const select = canvas.getByRole("combobox");
|
|
561
|
+
await userEvent.click(select);
|
|
467
562
|
};
|
|
468
563
|
|
|
469
|
-
export const
|
|
470
|
-
|
|
564
|
+
export const AutosuggestListboxOnDark = DarkAutosuggestListbox.bind({});
|
|
565
|
+
AutosuggestListboxOnDark.play = async ({ canvasElement }) => {
|
|
471
566
|
const canvas = within(canvasElement);
|
|
472
|
-
const
|
|
473
|
-
await userEvent.click(
|
|
567
|
+
const select = canvas.getByRole("combobox");
|
|
568
|
+
await userEvent.click(select);
|
|
474
569
|
};
|