@dxc-technology/halstack-react 0.0.0-b2237e2 → 0.0.0-b230d97
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 +55 -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/box/Box.js +1 -1
- package/box/types.d.ts +1 -0
- package/bulleted-list/types.d.ts +1 -1
- 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 +281 -259
- 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 +137 -38
- 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 +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 +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 +1 -1
- package/flex/Flex.js +31 -19
- package/flex/types.d.ts +15 -4
- 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 +127 -6
- package/header/Icons.js +2 -2
- package/header/types.d.ts +3 -2
- package/layout/ApplicationLayout.js +3 -3
- package/layout/ApplicationLayout.stories.tsx +1 -0
- package/link/Link.js +1 -1
- package/link/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/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 +36 -3
- package/progress-bar/ProgressBar.test.js +67 -22
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.js +11 -12
- package/quick-nav/QuickNav.stories.tsx +111 -19
- 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.js +8 -10
- package/sidenav/Sidenav.stories.tsx +148 -46
- package/sidenav/types.d.ts +1 -1
- 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/tabs-nav/NavTabs.js +5 -5
- package/tabs-nav/NavTabs.stories.tsx +8 -6
- package/tabs-nav/Tab.js +8 -12
- package/tabs-nav/types.d.ts +1 -1
- 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 +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/toggle-group/ToggleGroup.stories.tsx +42 -0
- package/toggle-group/types.d.ts +1 -1
- package/wizard/Wizard.stories.tsx +20 -0
- package/wizard/types.d.ts +1 -1
- package/common/RequiredComponent.js +0 -32
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { userEvent, within, fireEvent, screen } from "@storybook/testing-library";
|
|
3
3
|
import DxcDateInput from "./DateInput";
|
|
4
|
+
import DxcDatePicker from "./DatePicker";
|
|
5
|
+
import YearPicker from "./YearPicker";
|
|
6
|
+
import Calendar from "./Calendar";
|
|
4
7
|
import Title from "../../.storybook/components/Title";
|
|
5
8
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
9
|
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
7
10
|
import DarkContainer from "../../.storybook/components/DarkSection";
|
|
11
|
+
import dayjs from "dayjs";
|
|
12
|
+
import useTheme from "../useTheme";
|
|
13
|
+
import { ThemeProvider } from "styled-components";
|
|
8
14
|
|
|
9
15
|
export default {
|
|
10
16
|
title: "Date input",
|
|
11
17
|
component: DxcDateInput,
|
|
12
18
|
};
|
|
13
19
|
|
|
14
|
-
|
|
20
|
+
const DateInputChromatic = () => (
|
|
15
21
|
<>
|
|
16
22
|
<ExampleContainer>
|
|
17
23
|
<Title title="Complete date input" theme="light" level={4} />
|
|
@@ -19,7 +25,13 @@ export const Chromatic = () => (
|
|
|
19
25
|
</ExampleContainer>
|
|
20
26
|
<ExampleContainer>
|
|
21
27
|
<Title title="Disabled" theme="light" level={4} />
|
|
22
|
-
<DxcDateInput
|
|
28
|
+
<DxcDateInput
|
|
29
|
+
label="Disabled date input"
|
|
30
|
+
helperText="Help message"
|
|
31
|
+
defaultValue="06-04-2007"
|
|
32
|
+
clearable
|
|
33
|
+
disabled
|
|
34
|
+
/>
|
|
23
35
|
</ExampleContainer>
|
|
24
36
|
<ExampleContainer>
|
|
25
37
|
<Title title="Invalid" theme="light" level={4} />
|
|
@@ -27,7 +39,7 @@ export const Chromatic = () => (
|
|
|
27
39
|
</ExampleContainer>
|
|
28
40
|
<ExampleContainer>
|
|
29
41
|
<Title title="Relation between icons" theme="light" level={4} />
|
|
30
|
-
<DxcDateInput label="Error date input" error="Error message." defaultValue="06-04-
|
|
42
|
+
<DxcDateInput label="Error date input" error="Error message." defaultValue="06-04-2007" clearable />
|
|
31
43
|
</ExampleContainer>
|
|
32
44
|
<BackgroundColorProvider color="#333333">
|
|
33
45
|
<DarkContainer>
|
|
@@ -38,7 +50,13 @@ export const Chromatic = () => (
|
|
|
38
50
|
</ExampleContainer>
|
|
39
51
|
<ExampleContainer>
|
|
40
52
|
<Title title="Disabled" theme="dark" level={4} />
|
|
41
|
-
<DxcDateInput
|
|
53
|
+
<DxcDateInput
|
|
54
|
+
label="Disabled Date input"
|
|
55
|
+
helperText="Help message"
|
|
56
|
+
defaultValue="06-04-2027"
|
|
57
|
+
clearable
|
|
58
|
+
disabled
|
|
59
|
+
/>
|
|
42
60
|
</ExampleContainer>
|
|
43
61
|
<ExampleContainer>
|
|
44
62
|
<Title title="Invalid" theme="dark" level={4} />
|
|
@@ -46,7 +64,7 @@ export const Chromatic = () => (
|
|
|
46
64
|
</ExampleContainer>
|
|
47
65
|
<ExampleContainer>
|
|
48
66
|
<Title title="Relation between icons" theme="dark" level={4} />
|
|
49
|
-
<DxcDateInput label="Error date input" defaultValue="06-04-
|
|
67
|
+
<DxcDateInput label="Error date input" defaultValue="06-04-2007" error="Error message." clearable />
|
|
50
68
|
</ExampleContainer>
|
|
51
69
|
</DarkContainer>
|
|
52
70
|
</BackgroundColorProvider>
|
|
@@ -92,47 +110,128 @@ export const Chromatic = () => (
|
|
|
92
110
|
<Title title="FillParent size" theme="light" level={4} />
|
|
93
111
|
<DxcDateInput label="FillParent" size="fillParent" />
|
|
94
112
|
</ExampleContainer>
|
|
113
|
+
<ExampleContainer expanded>
|
|
114
|
+
<Title title="Year picker" theme="light" level={4} />
|
|
115
|
+
<DxcDateInput label="Date input" defaultValue="06-04-1905" />
|
|
116
|
+
</ExampleContainer>
|
|
95
117
|
</>
|
|
96
118
|
);
|
|
97
119
|
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
<Title title="Show date input" theme="light" level={4} />
|
|
101
|
-
<DxcDateInput label="Date input" defaultValue="10-06-2023" />
|
|
102
|
-
</ExampleContainer>
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
export const ShowDatePicker = DatePicker.bind({});
|
|
106
|
-
ShowDatePicker.play = async ({ canvasElement }) => {
|
|
120
|
+
export const Chromatic = DateInputChromatic.bind({});
|
|
121
|
+
Chromatic.play = async ({ canvasElement }) => {
|
|
107
122
|
const canvas = within(canvasElement);
|
|
108
|
-
|
|
109
|
-
await
|
|
110
|
-
await userEvent.tab();
|
|
123
|
+
await userEvent.click(canvas.getAllByRole("combobox")[canvas.getAllByRole("combobox").length - 1]);
|
|
124
|
+
await fireEvent.click(screen.getByText("April 1905"));
|
|
111
125
|
};
|
|
112
126
|
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
127
|
+
const DatePickerButtonStates = () => {
|
|
128
|
+
const colorsTheme: any = useTheme();
|
|
129
|
+
return (
|
|
130
|
+
<>
|
|
131
|
+
<ExampleContainer>
|
|
132
|
+
<Title title="Show date picker over another element with z-index 0" theme="light" level={4} />
|
|
133
|
+
<div
|
|
134
|
+
style={{
|
|
135
|
+
display: "flex",
|
|
136
|
+
flexDirection: "column",
|
|
137
|
+
gap: "20px",
|
|
138
|
+
height: "200px",
|
|
139
|
+
width: "500px",
|
|
140
|
+
marginBottom: "250px",
|
|
141
|
+
padding: "20px",
|
|
142
|
+
border: "1px solid black",
|
|
143
|
+
borderRadius: "4px",
|
|
144
|
+
overflow: "auto",
|
|
145
|
+
zIndex: "1300",
|
|
146
|
+
position: "relative",
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
<DxcDateInput label="From" defaultValue="01-12-1995" />
|
|
150
|
+
<DxcDateInput label="To" />
|
|
151
|
+
<button style={{ zIndex: "1", width: "100px" }}>Submit</button>
|
|
152
|
+
</div>
|
|
153
|
+
</ExampleContainer>
|
|
154
|
+
<ThemeProvider theme={colorsTheme}>
|
|
155
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
156
|
+
<Title title="Isolated calendar focused" theme="light" level={4} />
|
|
157
|
+
<DxcDatePicker date={dayjs("06-04-1950", "DD-MM-YYYY")} onDateSelect={() => {}} id="test-calendar" />
|
|
158
|
+
</ExampleContainer>
|
|
159
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
160
|
+
<Title title="Isolated calendar hovered" theme="light" level={4} />
|
|
161
|
+
<DxcDatePicker date={dayjs("06-04-1950", "DD-MM-YYYY")} onDateSelect={() => {}} id="test-calendar" />
|
|
162
|
+
</ExampleContainer>
|
|
163
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
164
|
+
<Title title="Isolated calendar actived" theme="light" level={4} />
|
|
165
|
+
<DxcDatePicker date={dayjs("06-04-1950", "DD-MM-YYYY")} onDateSelect={() => {}} id="test-calendar" />
|
|
166
|
+
</ExampleContainer>
|
|
167
|
+
</ThemeProvider>
|
|
168
|
+
</>
|
|
169
|
+
);
|
|
170
|
+
};
|
|
119
171
|
|
|
120
|
-
export const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
172
|
+
export const DatePickerStates = DatePickerButtonStates.bind({});
|
|
173
|
+
DatePickerStates.play = async ({ canvasElement }) => {
|
|
174
|
+
const canvas = within(canvasElement);
|
|
175
|
+
const dateBtn = canvas.getAllByTitle("Open calendar")[0];
|
|
176
|
+
await userEvent.click(dateBtn);
|
|
124
177
|
};
|
|
125
178
|
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
179
|
+
export const YearPickerStates = () => {
|
|
180
|
+
const colorsTheme: any = useTheme();
|
|
181
|
+
return (
|
|
182
|
+
<>
|
|
183
|
+
<ThemeProvider theme={colorsTheme}>
|
|
184
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
185
|
+
<Title title="Isolated year picker focused" theme="light" level={4} />
|
|
186
|
+
<YearPicker
|
|
187
|
+
selectedDate={dayjs("06-04-1905", "DD-MM-YYYY")}
|
|
188
|
+
onYearSelect={() => {}}
|
|
189
|
+
today={dayjs("1904-04-03", "YYYY-MM-DD")}
|
|
190
|
+
/>
|
|
191
|
+
</ExampleContainer>
|
|
192
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
193
|
+
<Title title="Isolated year picker hovered" theme="light" level={4} />
|
|
194
|
+
<YearPicker
|
|
195
|
+
selectedDate={dayjs("06-04-1905", "DD-MM-YYYY")}
|
|
196
|
+
onYearSelect={() => {}}
|
|
197
|
+
today={dayjs("1904-04-03", "YYYY-MM-DD")}
|
|
198
|
+
/>
|
|
199
|
+
</ExampleContainer>
|
|
200
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
201
|
+
<Title title="Isolated year picker actived" theme="light" level={4} />
|
|
202
|
+
<YearPicker
|
|
203
|
+
selectedDate={dayjs("06-04-1905", "DD-MM-YYYY")}
|
|
204
|
+
onYearSelect={() => {}}
|
|
205
|
+
today={dayjs("1904-04-03", "YYYY-MM-DD")}
|
|
206
|
+
/>
|
|
207
|
+
</ExampleContainer>
|
|
208
|
+
</ThemeProvider>
|
|
209
|
+
</>
|
|
210
|
+
);
|
|
211
|
+
};
|
|
132
212
|
|
|
133
|
-
export const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
213
|
+
export const DatePickerWithToday = () => {
|
|
214
|
+
const colorsTheme: any = useTheme();
|
|
215
|
+
return (
|
|
216
|
+
<ThemeProvider theme={colorsTheme}>
|
|
217
|
+
<ExampleContainer>
|
|
218
|
+
<Title title="Isolated calendar with today" theme="light" level={4} />
|
|
219
|
+
<Calendar
|
|
220
|
+
selectedDate={dayjs("06-04-1904", "DD-MM-YYYY")}
|
|
221
|
+
today={dayjs("1904-04-03", "YYYY-MM-DD")}
|
|
222
|
+
onInnerDateChange={() => {}}
|
|
223
|
+
onDaySelect={() => {}}
|
|
224
|
+
innerDate={dayjs("06-04-1904", "DD-MM-YYYY")}
|
|
225
|
+
/>
|
|
226
|
+
</ExampleContainer>
|
|
227
|
+
<ExampleContainer>
|
|
228
|
+
<Title title="Isolated year picker with today" theme="light" level={4} />
|
|
229
|
+
<YearPicker
|
|
230
|
+
selectedDate={dayjs("06-04-1905", "DD-MM-YYYY")}
|
|
231
|
+
onYearSelect={() => {}}
|
|
232
|
+
today={dayjs("1904-04-03", "YYYY-MM-DD")}
|
|
233
|
+
/>
|
|
234
|
+
</ExampleContainer>
|
|
235
|
+
</ThemeProvider>
|
|
236
|
+
);
|
|
138
237
|
};
|