@dxc-technology/halstack-react 0.0.0-8b5e703 → 0.0.0-8b61ced
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 +7 -11
- package/accordion/Accordion.js +122 -103
- package/accordion/Accordion.stories.tsx +2 -3
- package/accordion/Accordion.test.js +9 -10
- package/accordion/types.d.ts +5 -4
- package/accordion-group/AccordionGroup.js +2 -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/bleed/Bleed.js +1 -34
- package/bleed/Bleed.stories.tsx +94 -95
- package/bleed/types.d.ts +1 -1
- package/box/Box.js +23 -33
- 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/{list → bulleted-list}/types.js +0 -0
- package/button/Button.js +43 -61
- package/button/Button.stories.tsx +9 -0
- package/button/types.d.ts +7 -7
- package/card/Card.js +34 -36
- 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 +79 -59
- package/checkbox/Checkbox.test.js +93 -16
- package/checkbox/types.d.ts +6 -2
- package/chip/types.d.ts +1 -1
- package/common/variables.js +75 -48
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +77 -222
- package/date-input/DateInput.stories.tsx +30 -17
- package/date-input/DateInput.test.js +411 -138
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +160 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +115 -0
- package/date-input/types.d.ts +53 -0
- package/dialog/Dialog.js +52 -28
- package/dialog/Dialog.stories.tsx +57 -2
- 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 +247 -247
- package/dropdown/Dropdown.stories.tsx +126 -63
- package/dropdown/Dropdown.test.js +504 -108
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +80 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +92 -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 +38 -10
- 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/{radio → flex}/types.js +0 -0
- package/footer/Footer.stories.tsx +8 -1
- package/footer/Icons.js +1 -1
- package/footer/types.d.ts +2 -1
- package/header/Header.js +74 -72
- package/header/Header.stories.tsx +4 -4
- package/header/Icons.js +2 -2
- package/header/types.d.ts +3 -2
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +36 -36
- package/inset/types.d.ts +1 -1
- package/layout/ApplicationLayout.d.ts +16 -6
- package/layout/ApplicationLayout.js +70 -117
- package/layout/ApplicationLayout.stories.tsx +84 -93
- 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 +18 -33
- package/link/Link.js +12 -5
- package/link/Link.stories.tsx +13 -6
- package/link/types.d.ts +1 -1
- package/main.d.ts +5 -9
- package/main.js +28 -60
- package/number-input/NumberInput.test.js +43 -7
- package/package.json +16 -20
- package/paginator/Paginator.js +2 -2
- package/paginator/Paginator.test.js +43 -1
- 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 +56 -50
- package/progress-bar/ProgressBar.stories.jsx +3 -1
- package/progress-bar/ProgressBar.test.js +67 -22
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.js +25 -20
- package/quick-nav/QuickNav.stories.tsx +131 -26
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +43 -28
- package/radio-group/RadioGroup.js +23 -22
- package/radio-group/RadioGroup.stories.tsx +1 -0
- 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 +65 -41
- package/resultsetTable/types.d.ts +2 -2
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +53 -7
- package/select/Select.js +43 -43
- package/select/Select.stories.tsx +133 -103
- package/select/Select.test.js +363 -250
- package/select/types.d.ts +2 -5
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +184 -52
- package/sidenav/Sidenav.stories.tsx +154 -156
- 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 +7 -1
- package/slider/Slider.test.js +121 -21
- package/slider/types.d.ts +6 -2
- package/spinner/Spinner.js +2 -2
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +135 -68
- package/switch/Switch.stories.tsx +8 -30
- package/switch/Switch.test.js +144 -17
- package/switch/types.d.ts +6 -2
- package/table/Table.js +1 -1
- package/table/Table.test.js +1 -1
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +135 -0
- package/tabs/Tabs.js +360 -104
- package/tabs/Tabs.stories.tsx +74 -1
- package/tabs/Tabs.test.js +217 -6
- package/tabs/types.d.ts +15 -5
- package/tabs-nav/NavTabs.d.ts +2 -1
- package/tabs-nav/NavTabs.js +40 -21
- package/tabs-nav/Tab.js +29 -16
- package/tabs-nav/types.d.ts +7 -5
- package/tag/Tag.js +1 -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 +189 -282
- package/text-input/TextInput.stories.tsx +194 -182
- package/text-input/TextInput.test.js +737 -725
- package/text-input/types.d.ts +22 -3
- 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/{row → typography}/types.js +0 -0
- package/wizard/Wizard.js +9 -16
- package/wizard/Wizard.stories.tsx +20 -1
- package/wizard/types.d.ts +5 -4
- package/common/RequiredComponent.js +0 -32
- package/list/List.d.ts +0 -4
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -95
- package/list/types.d.ts +0 -7
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -173
- package/radio/Radio.stories.tsx +0 -192
- package/radio/Radio.test.js +0 -71
- package/radio/types.d.ts +0 -54
- 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 -3
- package/stack/Stack.js +0 -97
- package/stack/Stack.stories.tsx +0 -164
- package/stack/types.d.ts +0 -24
- package/stack/types.js +0 -5
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
|
@@ -1,11 +1,16 @@
|
|
|
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";
|
|
9
14
|
|
|
10
15
|
export default {
|
|
11
16
|
title: "Text input",
|
|
@@ -56,6 +61,7 @@ const countries = [
|
|
|
56
61
|
"Dominica",
|
|
57
62
|
"Denmark",
|
|
58
63
|
"Djibouti",
|
|
64
|
+
"*",
|
|
59
65
|
];
|
|
60
66
|
|
|
61
67
|
export const Chromatic = () => (
|
|
@@ -72,6 +78,14 @@ export const Chromatic = () => (
|
|
|
72
78
|
<Title title="Hovered action" theme="light" level={4} />
|
|
73
79
|
<DxcTextInput label="Text input" defaultValue="Text" clearable />
|
|
74
80
|
</ExampleContainer>
|
|
81
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
82
|
+
<Title title="Actived action" theme="light" level={4} />
|
|
83
|
+
<DxcTextInput label="Text input" action={action} clearable />
|
|
84
|
+
</ExampleContainer>
|
|
85
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
86
|
+
<Title title="Focused action" theme="light" level={4} />
|
|
87
|
+
<DxcTextInput label="Text input" action={action} clearable />
|
|
88
|
+
</ExampleContainer>
|
|
75
89
|
<ExampleContainer>
|
|
76
90
|
<Title title="Without label" theme="light" level={4} />
|
|
77
91
|
<DxcTextInput />
|
|
@@ -152,7 +166,7 @@ export const Chromatic = () => (
|
|
|
152
166
|
</ExampleContainer>
|
|
153
167
|
<BackgroundColorProvider color="#333333">
|
|
154
168
|
<DarkContainer>
|
|
155
|
-
<Title title="Dark" theme="dark" level={2} />
|
|
169
|
+
<Title title="Dark theme" theme="dark" level={2} />
|
|
156
170
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
157
171
|
<Title title="Hovered" theme="dark" level={4} />
|
|
158
172
|
<DxcTextInput label="Text input" />
|
|
@@ -165,6 +179,14 @@ export const Chromatic = () => (
|
|
|
165
179
|
<Title title="Hovered action" theme="dark" level={4} />
|
|
166
180
|
<DxcTextInput label="Text input" defaultValue="Text" clearable />
|
|
167
181
|
</ExampleContainer>
|
|
182
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
183
|
+
<Title title="Actived action" theme="dark" level={4} />
|
|
184
|
+
<DxcTextInput label="Text input" action={action} clearable />
|
|
185
|
+
</ExampleContainer>
|
|
186
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
187
|
+
<Title title="Focused action" theme="dark" level={4} />
|
|
188
|
+
<DxcTextInput label="Text input" action={action} clearable />
|
|
189
|
+
</ExampleContainer>
|
|
168
190
|
<ExampleContainer>
|
|
169
191
|
<Title title="Helper text, placeholder, optional and action" theme="dark" level={4} />
|
|
170
192
|
<DxcTextInput
|
|
@@ -279,196 +301,186 @@ export const Chromatic = () => (
|
|
|
279
301
|
</>
|
|
280
302
|
);
|
|
281
303
|
|
|
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
|
-
);
|
|
304
|
+
const AutosuggestListbox = () => {
|
|
305
|
+
const colorsTheme: any = useTheme();
|
|
334
306
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
<
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
307
|
+
return (
|
|
308
|
+
<ThemeProvider theme={colorsTheme.textInput}>
|
|
309
|
+
<ExampleContainer>
|
|
310
|
+
<Title title="Autosuggest listbox" theme="light" level={2} />
|
|
311
|
+
<ExampleContainer>
|
|
312
|
+
<Title
|
|
313
|
+
title="List dialog uses a Radix Popover to appear over elements with a certain z-index"
|
|
314
|
+
theme="light"
|
|
315
|
+
level={3}
|
|
316
|
+
/>
|
|
317
|
+
<div
|
|
318
|
+
style={{
|
|
319
|
+
display: "flex",
|
|
320
|
+
flexDirection: "column",
|
|
321
|
+
gap: "20px",
|
|
322
|
+
height: "150px",
|
|
323
|
+
width: "500px",
|
|
324
|
+
marginBottom: "250px",
|
|
325
|
+
padding: "20px",
|
|
326
|
+
border: "1px solid black",
|
|
327
|
+
borderRadius: "4px",
|
|
328
|
+
overflow: "auto",
|
|
329
|
+
zIndex: "1300",
|
|
330
|
+
}}
|
|
331
|
+
>
|
|
332
|
+
<DxcTextInput
|
|
333
|
+
label="Label"
|
|
334
|
+
suggestions={countries}
|
|
335
|
+
optional
|
|
336
|
+
placeholder="Choose an option"
|
|
337
|
+
size="fillParent"
|
|
338
|
+
/>
|
|
339
|
+
<button style={{ zIndex: "1", width: "100px" }}>Submit</button>
|
|
340
|
+
</div>
|
|
341
|
+
</ExampleContainer>
|
|
342
|
+
<Title title="Listbox suggestion states" theme="light" level={3} />
|
|
343
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
344
|
+
<Title title="Hovered suggestion" theme="light" level={4} />
|
|
345
|
+
<Suggestions
|
|
346
|
+
id="x"
|
|
347
|
+
value=""
|
|
348
|
+
suggestions={country}
|
|
349
|
+
visualFocusIndex={-1}
|
|
350
|
+
highlightedSuggestions={false}
|
|
351
|
+
searchHasErrors={false}
|
|
352
|
+
isSearching={false}
|
|
353
|
+
suggestionOnClick={() => {}}
|
|
354
|
+
getTextInputWidth={() => 350}
|
|
355
|
+
/>
|
|
356
|
+
</ExampleContainer>
|
|
357
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
358
|
+
<Title title="Active suggestion" theme="light" level={4} />
|
|
359
|
+
<Suggestions
|
|
360
|
+
id="x"
|
|
361
|
+
value=""
|
|
362
|
+
suggestions={country}
|
|
363
|
+
visualFocusIndex={-1}
|
|
364
|
+
highlightedSuggestions={false}
|
|
365
|
+
searchHasErrors={false}
|
|
366
|
+
isSearching={false}
|
|
367
|
+
suggestionOnClick={(suggestion) => {}}
|
|
368
|
+
getTextInputWidth={() => 350}
|
|
369
|
+
/>
|
|
370
|
+
</ExampleContainer>
|
|
371
|
+
<ExampleContainer>
|
|
372
|
+
<Title title="Focused suggestion" theme="light" level={4} />
|
|
373
|
+
<Suggestions
|
|
374
|
+
id="x"
|
|
375
|
+
value=""
|
|
376
|
+
suggestions={country}
|
|
377
|
+
visualFocusIndex={0}
|
|
378
|
+
highlightedSuggestions={false}
|
|
379
|
+
searchHasErrors={false}
|
|
380
|
+
isSearching={false}
|
|
381
|
+
suggestionOnClick={(suggestion) => {}}
|
|
382
|
+
getTextInputWidth={() => 350}
|
|
383
|
+
/>
|
|
384
|
+
</ExampleContainer>
|
|
385
|
+
<ExampleContainer>
|
|
386
|
+
<Title title="Highlighted suggestion" theme="light" level={4} />
|
|
387
|
+
<Suggestions
|
|
388
|
+
id="x"
|
|
389
|
+
value="Afgh"
|
|
390
|
+
suggestions={country}
|
|
391
|
+
visualFocusIndex={-1}
|
|
392
|
+
highlightedSuggestions={true}
|
|
393
|
+
searchHasErrors={false}
|
|
394
|
+
isSearching={false}
|
|
395
|
+
suggestionOnClick={(suggestion) => {}}
|
|
396
|
+
getTextInputWidth={() => 350}
|
|
397
|
+
/>
|
|
398
|
+
</ExampleContainer>
|
|
363
399
|
</ExampleContainer>
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
400
|
+
<ExampleContainer>
|
|
401
|
+
<Title title="Autosuggest Error" theme="light" level={3} />
|
|
402
|
+
<Suggestions
|
|
403
|
+
id="x"
|
|
404
|
+
value=""
|
|
405
|
+
suggestions={country}
|
|
406
|
+
visualFocusIndex={-1}
|
|
407
|
+
highlightedSuggestions={false}
|
|
408
|
+
searchHasErrors={true}
|
|
409
|
+
isSearching={false}
|
|
410
|
+
suggestionOnClick={(suggestion) => {}}
|
|
411
|
+
getTextInputWidth={() => 350}
|
|
412
|
+
/>
|
|
374
413
|
</ExampleContainer>
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
414
|
+
<ExampleContainer>
|
|
415
|
+
<Title title="Autosuggest Searching message" theme="light" level={3} />
|
|
416
|
+
<Suggestions
|
|
417
|
+
id="x"
|
|
418
|
+
value=""
|
|
419
|
+
suggestions={country}
|
|
420
|
+
visualFocusIndex={-1}
|
|
421
|
+
highlightedSuggestions={false}
|
|
422
|
+
searchHasErrors={false}
|
|
423
|
+
isSearching={true}
|
|
424
|
+
suggestionOnClick={(suggestion) => {}}
|
|
425
|
+
getTextInputWidth={() => 350}
|
|
426
|
+
/>
|
|
385
427
|
</ExampleContainer>
|
|
386
|
-
</
|
|
387
|
-
|
|
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();
|
|
395
|
-
};
|
|
396
|
-
|
|
397
|
-
export const ActivedAction = ActivedActionTextInput.bind({});
|
|
398
|
-
ActivedAction.play = async ({ canvasElement }) => {
|
|
399
|
-
const canvas = within(canvasElement);
|
|
400
|
-
const action = canvas.getByRole("button");
|
|
401
|
-
await userEvent.click(action);
|
|
402
|
-
};
|
|
403
|
-
|
|
404
|
-
export const ShowOptions = ShowOptionsAutosuggest.bind({});
|
|
405
|
-
ShowOptions.play = async ({ canvasElement }) => {
|
|
406
|
-
const canvas = within(canvasElement);
|
|
407
|
-
const autosuggest = canvas.getByRole("combobox");
|
|
408
|
-
await userEvent.click(autosuggest);
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
export const HoveredOption = HoveredOptionAutosuggest.bind({});
|
|
412
|
-
HoveredOption.play = async ({ canvasElement }) => {
|
|
413
|
-
const canvas = within(canvasElement);
|
|
414
|
-
const autosuggest = canvas.getByRole("combobox");
|
|
415
|
-
await userEvent.click(autosuggest);
|
|
428
|
+
</ThemeProvider>
|
|
429
|
+
);
|
|
416
430
|
};
|
|
417
431
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
const canvas = within(canvasElement);
|
|
421
|
-
const autosuggest = canvas.getByRole("combobox");
|
|
422
|
-
await userEvent.click(autosuggest);
|
|
423
|
-
fireEvent.keyDown(autosuggest, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
|
|
424
|
-
};
|
|
432
|
+
const DarkAutosuggestListbox = () => {
|
|
433
|
+
const colorsTheme: any = useTheme();
|
|
425
434
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
435
|
+
return (
|
|
436
|
+
<ThemeProvider theme={colorsTheme.textInput}>
|
|
437
|
+
<BackgroundColorProvider color="#333333">
|
|
438
|
+
<DarkContainer>
|
|
439
|
+
<Title title="Dark theme" theme="dark" level={2} />
|
|
440
|
+
<ExampleContainer>
|
|
441
|
+
<Title title="Default with opened suggestions" theme="dark" level={3} />
|
|
442
|
+
<DxcFlex direction="column" gap="80px">
|
|
443
|
+
<DxcTextInput label="Label" suggestions={countries} optional placeholder="Choose an option" />
|
|
444
|
+
<DxcCheckbox
|
|
445
|
+
label="You understand the selection and give your consent"
|
|
446
|
+
onChange={() => {}}
|
|
447
|
+
labelPosition="after"
|
|
448
|
+
/>
|
|
449
|
+
<DxcButton label="Submit" onClick={() => {}} size="medium" margin={{ bottom: "xxlarge" }} />
|
|
450
|
+
</DxcFlex>
|
|
451
|
+
</ExampleContainer>
|
|
452
|
+
<ExampleContainer>
|
|
453
|
+
<Title title="Autosuggest Error" theme="dark" level={3} />
|
|
454
|
+
<div style={{ height: "100px" }}>
|
|
455
|
+
<Suggestions
|
|
456
|
+
id="x"
|
|
457
|
+
value=""
|
|
458
|
+
suggestions={country}
|
|
459
|
+
visualFocusIndex={-1}
|
|
460
|
+
highlightedSuggestions={false}
|
|
461
|
+
searchHasErrors={true}
|
|
462
|
+
isSearching={false}
|
|
463
|
+
suggestionOnClick={(suggestion) => {}}
|
|
464
|
+
getTextInputWidth={() => 350}
|
|
465
|
+
/>
|
|
466
|
+
</div>
|
|
467
|
+
</ExampleContainer>
|
|
468
|
+
</DarkContainer>
|
|
469
|
+
</BackgroundColorProvider>
|
|
470
|
+
</ThemeProvider>
|
|
471
|
+
);
|
|
459
472
|
};
|
|
460
473
|
|
|
461
|
-
export const
|
|
462
|
-
|
|
474
|
+
export const AutosuggestListboxStates = AutosuggestListbox.bind({});
|
|
475
|
+
AutosuggestListboxStates.play = async ({ canvasElement }) => {
|
|
463
476
|
const canvas = within(canvasElement);
|
|
464
|
-
const
|
|
465
|
-
await userEvent.click(
|
|
466
|
-
fireEvent.keyDown(autosuggest, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
|
|
477
|
+
const select = canvas.getByRole("combobox");
|
|
478
|
+
await userEvent.click(select);
|
|
467
479
|
};
|
|
468
480
|
|
|
469
|
-
export const
|
|
470
|
-
|
|
481
|
+
export const AutosuggestListboxOnDark = DarkAutosuggestListbox.bind({});
|
|
482
|
+
AutosuggestListboxOnDark.play = async ({ canvasElement }) => {
|
|
471
483
|
const canvas = within(canvasElement);
|
|
472
|
-
const
|
|
473
|
-
await userEvent.click(
|
|
484
|
+
const select = canvas.getByRole("combobox");
|
|
485
|
+
await userEvent.click(select);
|
|
474
486
|
};
|