@dxc-technology/halstack-react 0.0.0-5aa300b → 0.0.0-5b43b04

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.
Files changed (59) hide show
  1. package/HalstackContext.js +86 -45
  2. package/accordion/Accordion.stories.tsx +51 -2
  3. package/alert/Alert.stories.tsx +28 -0
  4. package/box/Box.stories.tsx +15 -0
  5. package/button/Button.stories.tsx +100 -9
  6. package/checkbox/Checkbox.stories.tsx +52 -0
  7. package/chip/Chip.js +8 -2
  8. package/chip/Chip.stories.tsx +55 -0
  9. package/common/variables.js +163 -137
  10. package/date-input/Calendar.d.ts +1 -1
  11. package/date-input/Calendar.js +43 -43
  12. package/date-input/DateInput.js +74 -32
  13. package/date-input/DateInput.stories.tsx +183 -30
  14. package/date-input/DateInput.test.js +120 -37
  15. package/date-input/DatePicker.js +38 -52
  16. package/date-input/Icons.d.ts +6 -0
  17. package/date-input/Icons.js +75 -0
  18. package/date-input/YearPicker.d.ts +1 -1
  19. package/date-input/YearPicker.js +23 -12
  20. package/date-input/types.d.ts +6 -8
  21. package/dialog/Dialog.js +1 -3
  22. package/dialog/Dialog.stories.tsx +42 -20
  23. package/dropdown/Dropdown.js +0 -1
  24. package/dropdown/Dropdown.stories.tsx +200 -82
  25. package/dropdown/DropdownMenu.js +8 -18
  26. package/dropdown/DropdownMenuItem.js +4 -15
  27. package/file-input/FileInput.stories.tsx +85 -2
  28. package/footer/Footer.stories.tsx +91 -0
  29. package/header/Header.js +18 -20
  30. package/header/Header.stories.tsx +149 -6
  31. package/link/Link.stories.tsx +60 -0
  32. package/package.json +1 -1
  33. package/paginator/Paginator.stories.tsx +24 -0
  34. package/paginator/Paginator.test.js +17 -10
  35. package/progress-bar/ProgressBar.js +4 -4
  36. package/progress-bar/ProgressBar.stories.jsx +35 -2
  37. package/quick-nav/QuickNav.stories.tsx +14 -0
  38. package/radio-group/RadioGroup.stories.tsx +131 -18
  39. package/resultsetTable/ResultsetTable.test.js +17 -22
  40. package/select/Listbox.d.ts +1 -1
  41. package/select/Listbox.js +5 -34
  42. package/select/Option.js +3 -14
  43. package/select/Select.js +43 -24
  44. package/select/Select.stories.tsx +475 -187
  45. package/select/Select.test.js +17 -22
  46. package/select/types.d.ts +2 -2
  47. package/sidenav/Sidenav.stories.tsx +93 -0
  48. package/slider/Slider.stories.tsx +57 -0
  49. package/spinner/Spinner.stories.jsx +27 -1
  50. package/switch/Switch.stories.tsx +33 -0
  51. package/table/Table.stories.jsx +80 -1
  52. package/tabs/Tabs.stories.tsx +38 -0
  53. package/tabs-nav/NavTabs.js +1 -1
  54. package/tabs-nav/Tab.js +30 -9
  55. package/tag/Tag.stories.tsx +14 -1
  56. package/text-input/TextInput.stories.tsx +69 -0
  57. package/textarea/Textarea.stories.jsx +60 -1
  58. package/toggle-group/ToggleGroup.stories.tsx +42 -0
  59. package/wizard/Wizard.stories.tsx +20 -0
@@ -1,8 +1,12 @@
1
1
  import React from "react";
2
2
  import DxcHeader from "./Header";
3
+ import DxcButton from "../button/Button";
3
4
  import Title from "../../.storybook/components/Title";
4
5
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
6
  import { userEvent, waitFor, within } from "@storybook/testing-library";
7
+ import DxcFlex from "../flex/Flex";
8
+ import DxcLink from "../link/Link";
9
+ import { HalstackProvider } from "../HalstackContext";
6
10
 
7
11
  export default {
8
12
  title: "Header",
@@ -16,16 +20,99 @@ const options: any = [
16
20
  },
17
21
  ];
18
22
 
23
+ const options2: any = [
24
+ {
25
+ value: 1,
26
+ label: "Home",
27
+ },
28
+ {
29
+ value: 2,
30
+ label: "Release notes",
31
+ },
32
+ {
33
+ value: 3,
34
+ label: "Sign out",
35
+ },
36
+ ];
37
+
38
+ const opinionatedTheme = {
39
+ header: {
40
+ baseColor: "#ffffff",
41
+ accentColor: "#000000",
42
+ fontColor: "#000000",
43
+ menuBaseColor: "#ffffff",
44
+ hamburguerColor: "#000000",
45
+ logo: (
46
+ <svg xmlns="http://www.w3.org/2000/svg" width="73" height="40" viewBox="0 0 73 40">
47
+ <g id="g10" transform="translate(0)">
48
+ <g id="g12">
49
+ <path
50
+ id="path14"
51
+ d="M91.613-28.177v2.514H90.231V-28.15l-2.415-3.82h1.616l1.5,2.532,1.526-2.532h1.571ZM83.9-25.555A3.15,3.15,0,0,1,80.6-28.8v-.018a3.231,3.231,0,0,1,3.294-3.262,3.442,3.442,0,0,1,2.469.865l-.87,1.054a2.311,2.311,0,0,0-1.643-.64,1.891,1.891,0,0,0-1.8,1.964v.018a1.886,1.886,0,0,0,1.9,2,2.2,2.2,0,0,0,1.3-.378v-.9H83.858v-1.2h2.729v2.738A4.071,4.071,0,0,1,83.9-25.555Zm-6.416-3.261a1.913,1.913,0,0,0-1.9-1.982A1.883,1.883,0,0,0,73.7-28.835v.018a1.913,1.913,0,0,0,1.9,1.982A1.883,1.883,0,0,0,77.486-28.8Zm-1.9,3.261a3.225,3.225,0,0,1-3.33-3.243v-.018A3.255,3.255,0,0,1,75.6-32.078a3.225,3.225,0,0,1,3.331,3.243v.018A3.255,3.255,0,0,1,75.583-25.555Zm-9.173-.108V-31.97h1.382v5.045h3.133v1.261Zm-3.433-3.153a1.913,1.913,0,0,0-1.9-1.982,1.883,1.883,0,0,0-1.886,1.964v.018a1.913,1.913,0,0,0,1.9,1.982A1.883,1.883,0,0,0,62.978-28.8Zm-1.9,3.261a3.225,3.225,0,0,1-3.33-3.243v-.018a3.255,3.255,0,0,1,3.348-3.262,3.225,3.225,0,0,1,3.331,3.243v.018A3.255,3.255,0,0,1,61.075-25.555Zm-6.508-.108-3.043-4.009v4.009H50.159V-31.97h1.275l2.944,3.883V-31.97h1.364v6.306Zm-8.246,0v-2.531h-2.55v2.531H42.389V-31.97h1.382v2.5h2.55v-2.5H47.7v6.306Zm-8.432.108A3.178,3.178,0,0,1,34.666-28.8v-.018a3.2,3.2,0,0,1,3.276-3.262,3.237,3.237,0,0,1,2.478.973l-.88,1.018a2.315,2.315,0,0,0-1.606-.712,1.866,1.866,0,0,0-1.822,1.964v.018a1.87,1.87,0,0,0,1.822,1.982,2.265,2.265,0,0,0,1.651-.739l.88.891A3.206,3.206,0,0,1,37.889-25.555Zm-9.805-.108V-31.97h4.739v1.235H29.458v1.279h2.962v1.234H29.458V-26.9h3.411v1.234ZM24.322-30.69v5.027H22.939V-30.69H21.028v-1.28h5.206v1.28H24.322"
52
+ transform="translate(-21.028 65.555)"
53
+ fill="#100f0d"
54
+ />
55
+ <path
56
+ id="path16"
57
+ d="M75.836-76.712a8.975,8.975,0,0,1,2.246-3.9,8.393,8.393,0,0,1,6.058-2.457h9.824v-5.67H84.139a14.611,14.611,0,0,0-10.232,4.221,14.509,14.509,0,0,0-3.076,4.536,11.913,11.913,0,0,0-.973,3.271Zm0,4.325a8.978,8.978,0,0,0,2.246,3.9,8.394,8.394,0,0,0,6.058,2.457h9.824v5.67H84.139A14.611,14.611,0,0,1,73.907-64.58a14.506,14.506,0,0,1-3.076-4.536,11.91,11.91,0,0,1-.973-3.271ZM57.522-69.832l-7.5,9.473H42.581L53.818-74.55,42.581-88.739H50.02l7.5,9.472,7.5-9.472h7.439L61.225-74.55l11.237,14.19H65.023Zm-12.336-6.88a11.935,11.935,0,0,0-.973-3.271,14.515,14.515,0,0,0-3.076-4.536A14.612,14.612,0,0,0,30.9-88.739H21.081v5.67H30.9a8.394,8.394,0,0,1,6.058,2.457,8.978,8.978,0,0,1,2.246,3.9Zm0,4.325a11.932,11.932,0,0,1-.973,3.271,14.511,14.511,0,0,1-3.076,4.536A14.611,14.611,0,0,1,30.9-60.359H21.081v-5.67H30.9a8.4,8.4,0,0,0,6.058-2.457,8.981,8.981,0,0,0,2.246-3.9h5.978"
58
+ transform="translate(-21.049 88.739)"
59
+ fill="#5f249f"
60
+ />
61
+ </g>
62
+ </g>
63
+ </svg>
64
+ ),
65
+ logoResponsive: (
66
+ <svg xmlns="http://www.w3.org/2000/svg" width="73" height="40" viewBox="0 0 73 40">
67
+ <g id="g10" transform="translate(0)">
68
+ <g id="g12">
69
+ <path
70
+ id="path14"
71
+ d="M91.613-28.177v2.514H90.231V-28.15l-2.415-3.82h1.616l1.5,2.532,1.526-2.532h1.571ZM83.9-25.555A3.15,3.15,0,0,1,80.6-28.8v-.018a3.231,3.231,0,0,1,3.294-3.262,3.442,3.442,0,0,1,2.469.865l-.87,1.054a2.311,2.311,0,0,0-1.643-.64,1.891,1.891,0,0,0-1.8,1.964v.018a1.886,1.886,0,0,0,1.9,2,2.2,2.2,0,0,0,1.3-.378v-.9H83.858v-1.2h2.729v2.738A4.071,4.071,0,0,1,83.9-25.555Zm-6.416-3.261a1.913,1.913,0,0,0-1.9-1.982A1.883,1.883,0,0,0,73.7-28.835v.018a1.913,1.913,0,0,0,1.9,1.982A1.883,1.883,0,0,0,77.486-28.8Zm-1.9,3.261a3.225,3.225,0,0,1-3.33-3.243v-.018A3.255,3.255,0,0,1,75.6-32.078a3.225,3.225,0,0,1,3.331,3.243v.018A3.255,3.255,0,0,1,75.583-25.555Zm-9.173-.108V-31.97h1.382v5.045h3.133v1.261Zm-3.433-3.153a1.913,1.913,0,0,0-1.9-1.982,1.883,1.883,0,0,0-1.886,1.964v.018a1.913,1.913,0,0,0,1.9,1.982A1.883,1.883,0,0,0,62.978-28.8Zm-1.9,3.261a3.225,3.225,0,0,1-3.33-3.243v-.018a3.255,3.255,0,0,1,3.348-3.262,3.225,3.225,0,0,1,3.331,3.243v.018A3.255,3.255,0,0,1,61.075-25.555Zm-6.508-.108-3.043-4.009v4.009H50.159V-31.97h1.275l2.944,3.883V-31.97h1.364v6.306Zm-8.246,0v-2.531h-2.55v2.531H42.389V-31.97h1.382v2.5h2.55v-2.5H47.7v6.306Zm-8.432.108A3.178,3.178,0,0,1,34.666-28.8v-.018a3.2,3.2,0,0,1,3.276-3.262,3.237,3.237,0,0,1,2.478.973l-.88,1.018a2.315,2.315,0,0,0-1.606-.712,1.866,1.866,0,0,0-1.822,1.964v.018a1.87,1.87,0,0,0,1.822,1.982,2.265,2.265,0,0,0,1.651-.739l.88.891A3.206,3.206,0,0,1,37.889-25.555Zm-9.805-.108V-31.97h4.739v1.235H29.458v1.279h2.962v1.234H29.458V-26.9h3.411v1.234ZM24.322-30.69v5.027H22.939V-30.69H21.028v-1.28h5.206v1.28H24.322"
72
+ transform="translate(-21.028 65.555)"
73
+ fill="#100f0d"
74
+ />
75
+ <path
76
+ id="path16"
77
+ d="M75.836-76.712a8.975,8.975,0,0,1,2.246-3.9,8.393,8.393,0,0,1,6.058-2.457h9.824v-5.67H84.139a14.611,14.611,0,0,0-10.232,4.221,14.509,14.509,0,0,0-3.076,4.536,11.913,11.913,0,0,0-.973,3.271Zm0,4.325a8.978,8.978,0,0,0,2.246,3.9,8.394,8.394,0,0,0,6.058,2.457h9.824v5.67H84.139A14.611,14.611,0,0,1,73.907-64.58a14.506,14.506,0,0,1-3.076-4.536,11.91,11.91,0,0,1-.973-3.271ZM57.522-69.832l-7.5,9.473H42.581L53.818-74.55,42.581-88.739H50.02l7.5,9.472,7.5-9.472h7.439L61.225-74.55l11.237,14.19H65.023Zm-12.336-6.88a11.935,11.935,0,0,0-.973-3.271,14.515,14.515,0,0,0-3.076-4.536A14.612,14.612,0,0,0,30.9-88.739H21.081v5.67H30.9a8.394,8.394,0,0,1,6.058,2.457,8.978,8.978,0,0,1,2.246,3.9Zm0,4.325a11.932,11.932,0,0,1-.973,3.271,14.511,14.511,0,0,1-3.076,4.536A14.611,14.611,0,0,1,30.9-60.359H21.081v-5.67H30.9a8.4,8.4,0,0,0,6.058-2.457,8.981,8.981,0,0,0,2.246-3.9h5.978"
78
+ transform="translate(-21.049 88.739)"
79
+ fill="#5f249f"
80
+ />
81
+ </g>
82
+ </g>
83
+ </svg>
84
+ ),
85
+ contentColor: "#000000",
86
+ overlayColor: "#000000b3",
87
+ },
88
+ };
89
+
19
90
  export const Chromatic = () => (
20
91
  <>
21
92
  <ExampleContainer>
22
93
  <Title title="Default with dropdown" theme="light" level={4} />
23
- <DxcHeader content={<DxcHeader.Dropdown options={options} label="Default Dropdown" />} />
94
+ <DxcHeader
95
+ content={<DxcHeader.Dropdown options={options} label="Default Dropdown" onSelectOption={() => {}} />}
96
+ />
24
97
  </ExampleContainer>
25
98
  <ExampleContainer>
26
99
  <Title title="Underlined with text" theme="light" level={4} />
27
100
  <DxcHeader underlined content={<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>} />
28
101
  </ExampleContainer>
102
+ <ExampleContainer>
103
+ <Title title="Underlined, dropdown and links" theme="light" level={4} />
104
+ <DxcHeader
105
+ content={
106
+ <DxcFlex alignItems="center" gap="4rem">
107
+ <DxcLink>Link 1</DxcLink>
108
+ <DxcLink>Link 2</DxcLink>
109
+ <DxcLink>Link 3</DxcLink>
110
+ <DxcHeader.Dropdown options={options2} label="Label" onSelectOption={() => {}} />
111
+ </DxcFlex>
112
+ }
113
+ underlined
114
+ />
115
+ </ExampleContainer>
29
116
  <Title title="Margins" theme="light" level={2} />
30
117
  <ExampleContainer>
31
118
  <Title title="Xxsmall margin" theme="light" level={4} />
@@ -62,7 +149,6 @@ export const Chromatic = () => (
62
149
  <DxcHeader underlined margin="xxlarge" />
63
150
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
64
151
  </ExampleContainer>
65
-
66
152
  <Title title="Paddings" theme="light" level={2} />
67
153
  <ExampleContainer>
68
154
  <Title title="Xxsmall padding" theme="light" level={4} />
@@ -92,6 +178,21 @@ export const Chromatic = () => (
92
178
  <Title title="Xxlarge padding" theme="light" level={4} />
93
179
  <DxcHeader underlined padding="xxlarge" />
94
180
  </ExampleContainer>
181
+ <Title title="Opinionated theme" theme="light" level={2} />
182
+ <ExampleContainer>
183
+ <HalstackProvider theme={opinionatedTheme}>
184
+ <DxcHeader
185
+ underlined
186
+ content={<DxcButton label={"Custom Button"} />}
187
+ responsiveContent={(closeHandler) => (
188
+ <>
189
+ <DxcButton label={"Custom Button"} onClick={closeHandler} />
190
+ Custom content
191
+ </>
192
+ )}
193
+ />
194
+ </HalstackProvider>
195
+ </ExampleContainer>
95
196
  </>
96
197
  );
97
198
 
@@ -120,13 +221,29 @@ const RespHeaderHover = () => (
120
221
  </ExampleContainer>
121
222
  );
122
223
 
123
- const RespHeaderMenu = () => (
224
+ const RespHeaderMenuMobile = () => (
225
+ <ExampleContainer>
226
+ <Title title="Responsive menu" theme="light" level={4} />
227
+ <DxcHeader responsiveContent={(closeHandler) => <p>Lorem ipsum dolor sit amet.</p>} underlined />
228
+ </ExampleContainer>
229
+ );
230
+
231
+ const RespHeaderMenuTablet = () => (
124
232
  <ExampleContainer>
125
233
  <Title title="Responsive menu" theme="light" level={4} />
126
234
  <DxcHeader responsiveContent={(closeHandler) => <p>Lorem ipsum dolor sit amet.</p>} underlined />
127
235
  </ExampleContainer>
128
236
  );
129
237
 
238
+ const RespHeaderMenuOpinionated = () => (
239
+ <ExampleContainer>
240
+ <Title title="Responsive menu" theme="light" level={4} />
241
+ <HalstackProvider theme={opinionatedTheme}>
242
+ <DxcHeader responsiveContent={(closeHandler) => <p>Lorem ipsum dolor sit amet.</p>} underlined />
243
+ </HalstackProvider>
244
+ </ExampleContainer>
245
+ );
246
+
130
247
  ResponsiveHeader.parameters = {
131
248
  viewport: {
132
249
  defaultViewport: "iphonex",
@@ -158,14 +275,40 @@ ResponsiveHeaderHover.play = async ({ canvasElement }) => {
158
275
  await waitFor(() => canvas.findByText("Menu"));
159
276
  };
160
277
 
161
- export const ResponsiveHeaderMenu = RespHeaderMenu.bind({});
162
- ResponsiveHeaderMenu.parameters = {
278
+ export const ResponsiveHeaderMenuMobile = RespHeaderMenuMobile.bind({});
279
+ ResponsiveHeaderMenuMobile.parameters = {
163
280
  viewport: {
164
281
  defaultViewport: "iphonex",
165
282
  },
166
283
  chromatic: { viewports: [375] },
167
284
  };
168
- ResponsiveHeaderMenu.play = async ({ canvasElement }) => {
285
+ ResponsiveHeaderMenuMobile.play = async ({ canvasElement }) => {
286
+ const canvas = within(canvasElement);
287
+ await waitFor(() => canvas.findByText("Menu"));
288
+ await userEvent.click(canvas.getByText("Menu"));
289
+ };
290
+
291
+ export const ResponsiveHeaderMenuTablet = RespHeaderMenuTablet.bind({});
292
+ ResponsiveHeaderMenuTablet.parameters = {
293
+ viewport: {
294
+ defaultViewport: "pixelxl",
295
+ },
296
+ chromatic: { viewports: [720] },
297
+ };
298
+ ResponsiveHeaderMenuTablet.play = async ({ canvasElement }) => {
299
+ const canvas = within(canvasElement);
300
+ await waitFor(() => canvas.findByText("Menu"));
301
+ await userEvent.click(canvas.getByText("Menu"));
302
+ };
303
+
304
+ export const ResponsiveHeaderMenuOpinionated = RespHeaderMenuOpinionated.bind({});
305
+ ResponsiveHeaderMenuOpinionated.parameters = {
306
+ viewport: {
307
+ defaultViewport: "pixelxl",
308
+ },
309
+ chromatic: { viewports: [720] },
310
+ };
311
+ ResponsiveHeaderMenuOpinionated.play = async ({ canvasElement }) => {
169
312
  const canvas = within(canvasElement);
170
313
  await waitFor(() => canvas.findByText("Menu"));
171
314
  await userEvent.click(canvas.getByText("Menu"));
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import DxcLink from "./Link";
3
3
  import Title from "../../.storybook/components/Title";
4
4
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
+ import { HalstackProvider } from "../HalstackContext";
5
6
 
6
7
  export default {
7
8
  title: "Link",
@@ -19,6 +20,12 @@ const icon = (
19
20
  </svg>
20
21
  );
21
22
 
23
+ const opinionatedTheme = {
24
+ link: {
25
+ baseColor: "#5f249f",
26
+ },
27
+ };
28
+
22
29
  export const Chromatic = () => (
23
30
  <>
24
31
  <Title title="With anchor" theme="light" level={2} />
@@ -189,5 +196,58 @@ export const Chromatic = () => (
189
196
  Test
190
197
  </DxcLink>
191
198
  </ExampleContainer>
199
+ <Title title="Opinionated theme" theme="light" level={2} />
200
+ <ExampleContainer>
201
+ <Title title="Disabled" theme="light" level={4} />
202
+ <HalstackProvider theme={opinionatedTheme}>
203
+ <DxcLink disabled>Test</DxcLink>
204
+ </HalstackProvider>
205
+ </ExampleContainer>
206
+ <ExampleContainer>
207
+ <Title title="Icon before" theme="light" level={4} />
208
+ <HalstackProvider theme={opinionatedTheme}>
209
+ <DxcLink href="https://www.google.com" icon={icon} iconPosition="before">
210
+ Test
211
+ </DxcLink>
212
+ </HalstackProvider>
213
+ </ExampleContainer>
214
+ <ExampleContainer>
215
+ <Title title="Disabled" theme="light" level={4} />
216
+ <HalstackProvider theme={opinionatedTheme}>
217
+ <DxcLink disabled>Test</DxcLink>
218
+ </HalstackProvider>
219
+ </ExampleContainer>
220
+ <ExampleContainer>
221
+ <Title title="Icon after" theme="light" level={4} />{" "}
222
+ <HalstackProvider theme={opinionatedTheme}>
223
+ <DxcLink onClick={() => {}} icon={icon} iconPosition="after">
224
+ Test
225
+ </DxcLink>
226
+ </HalstackProvider>
227
+ </ExampleContainer>
228
+ <ExampleContainer pseudoState="pseudo-hover">
229
+ <Title title="With link hovered" theme="light" level={4} />
230
+ <HalstackProvider theme={opinionatedTheme}>
231
+ <DxcLink onClick={() => {}}>Test</DxcLink>
232
+ </HalstackProvider>
233
+ </ExampleContainer>
234
+ <ExampleContainer pseudoState="pseudo-focus">
235
+ <Title title="With link focused" theme="light" level={4} />
236
+ <HalstackProvider theme={opinionatedTheme}>
237
+ <DxcLink onClick={() => {}}>Test</DxcLink>
238
+ </HalstackProvider>
239
+ </ExampleContainer>
240
+ <ExampleContainer pseudoState="pseudo-active">
241
+ <Title title="With link active" theme="light" level={4} />
242
+ <HalstackProvider theme={opinionatedTheme}>
243
+ <DxcLink onClick={() => {}}>Test</DxcLink>
244
+ </HalstackProvider>
245
+ </ExampleContainer>
246
+ <ExampleContainer pseudoState="pseudo-visited">
247
+ <HalstackProvider theme={opinionatedTheme}>
248
+ <Title title="With link visited" theme="light" level={4} />
249
+ <DxcLink href="https://www.google.com">Test</DxcLink>
250
+ </HalstackProvider>
251
+ </ExampleContainer>
192
252
  </>
193
253
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxc-technology/halstack-react",
3
- "version": "0.0.0-5aa300b",
3
+ "version": "0.0.0-5b43b04",
4
4
  "description": "DXC Halstack React components library",
5
5
  "repository": "dxc-technology/halstack-react",
6
6
  "homepage": "https://developer.dxc.com/halstack",
@@ -2,12 +2,20 @@ import React from "react";
2
2
  import DxcPaginator from "./Paginator";
3
3
  import Title from "../../.storybook/components/Title";
4
4
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
+ import { HalstackProvider } from "../HalstackContext";
5
6
 
6
7
  export default {
7
8
  title: "Paginator",
8
9
  component: DxcPaginator,
9
10
  };
10
11
 
12
+ const opinionatedTheme = {
13
+ paginator: {
14
+ baseColor: "#f2f2f2",
15
+ fontColor: "#000000",
16
+ },
17
+ };
18
+
11
19
  export const Chromatic = () => (
12
20
  <>
13
21
  <ExampleContainer>
@@ -59,5 +67,21 @@ export const Chromatic = () => (
59
67
  showGoToPage
60
68
  />
61
69
  </ExampleContainer>
70
+ <Title title="Opinionated theme" theme="light" level={2} />
71
+ <ExampleContainer>
72
+ <HalstackProvider theme={opinionatedTheme}>
73
+ <ExampleContainer>
74
+ <Title title="Page change and items per page options" theme="light" level={4} />
75
+ <DxcPaginator
76
+ currentPage={1}
77
+ itemsPerPage={10}
78
+ totalItems={27}
79
+ onPageChange={() => {}}
80
+ itemsPerPageOptions={[5, 10, 15]}
81
+ showGoToPage
82
+ />
83
+ </ExampleContainer>
84
+ </HalstackProvider>
85
+ </ExampleContainer>
62
86
  </>
63
87
  );
@@ -16,26 +16,33 @@ var _Paginator = _interopRequireDefault(require("./Paginator"));
16
16
 
17
17
  // Mocking DOMRect for Radix Primitive Popover
18
18
  global.globalThis = global;
19
+ global.DOMRect = {
20
+ fromRect: function fromRect() {
21
+ return {
22
+ top: 0,
23
+ left: 0,
24
+ bottom: 0,
25
+ right: 0,
26
+ width: 0,
27
+ height: 0
28
+ };
29
+ }
30
+ };
19
31
 
20
32
  global.ResizeObserver = /*#__PURE__*/function () {
21
- function ResizeObserver(cb) {
33
+ function ResizeObserver() {
22
34
  (0, _classCallCheck2["default"])(this, ResizeObserver);
23
- this.cb = cb;
24
35
  }
25
36
 
26
37
  (0, _createClass2["default"])(ResizeObserver, [{
27
38
  key: "observe",
28
- value: function observe() {
29
- this.cb([{
30
- borderBoxSize: {
31
- inlineSize: 0,
32
- blockSize: 0
33
- }
34
- }]);
35
- }
39
+ value: function observe() {}
36
40
  }, {
37
41
  key: "unobserve",
38
42
  value: function unobserve() {}
43
+ }, {
44
+ key: "disconnect",
45
+ value: function disconnect() {}
39
46
  }]);
40
47
  return ResizeObserver;
41
48
  }();
@@ -87,7 +87,7 @@ var DxcProgressBar = function DxcProgressBar(_ref) {
87
87
  var BackgroundProgressBar = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n ", "\n display: flex;\n flex-wrap: wrap;\n min-width: 100px;\n width: 100%;\n"])), function (_ref2) {
88
88
  var overlay = _ref2.overlay,
89
89
  theme = _ref2.theme;
90
- return overlay ? "background-color: ".concat(theme.overlayColor, ";\n opacity: 0.8;\n width: 100%;\n justify-content: center;\n height: 100vh;\n align-items: center;\n max-width: 100%;\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 1300;") : "background-color: \"transparent\";";
90
+ return overlay ? "background-color: ".concat(theme.overlayColor, ";\n width: 100%;\n justify-content: center;\n height: 100vh;\n align-items: center;\n max-width: 100%;\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 1300;") : "background-color: \"transparent\";";
91
91
  });
92
92
 
93
93
  var ProgressBarContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n z-index: ", ";\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
@@ -119,7 +119,7 @@ var ProgressBarLabel = _styledComponents["default"].div(_templateObject4 || (_te
119
119
  }, function (props) {
120
120
  return props.theme.labelFontTextTransform;
121
121
  }, function (props) {
122
- return props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.overlay === true ? "#FFFFFF" : props.theme.labelFontColor;
122
+ return props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.overlay === true ? props.theme.overlayFontColor : props.theme.labelFontColor;
123
123
  });
124
124
 
125
125
  var ProgressBarProgress = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n display: ", ";\n flex-shrink: 0;\n"])), function (props) {
@@ -133,13 +133,13 @@ var ProgressBarProgress = _styledComponents["default"].div(_templateObject5 || (
133
133
  }, function (props) {
134
134
  return props.theme.valueFontTextTransform;
135
135
  }, function (props) {
136
- return props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.overlay === true ? "#FFFFFF" : props.theme.valueFontColor;
136
+ return props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.overlay === true ? props.theme.overlayFontColor : props.theme.valueFontColor;
137
137
  }, function (props) {
138
138
  return props.value !== undefined && props.value !== null && props.showValue === true && "block" || "none";
139
139
  });
140
140
 
141
141
  var HelperText = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n"])), function (props) {
142
- return props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.overlay === true ? "#FFFFFF" : props.theme.helperTextFontColor;
142
+ return props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.overlay === true ? props.theme.overlayFontColor : props.theme.helperTextFontColor;
143
143
  }, function (props) {
144
144
  return props.theme.helperTextFontFamily;
145
145
  }, function (props) {
@@ -2,12 +2,23 @@ import React from "react";
2
2
  import DxcProgressBar from "./ProgressBar";
3
3
  import Title from "../../.storybook/components/Title";
4
4
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
+ import { HalstackProvider } from "../HalstackContext";
5
6
 
6
7
  export default {
7
8
  title: "ProgressBar",
8
9
  component: DxcProgressBar,
9
10
  };
10
11
 
12
+ const opinionatedTheme = {
13
+ progressBar: {
14
+ accentColor: "#5f249f",
15
+ baseColor: "#e6e6e6",
16
+ fontColor: "#000000",
17
+ overlayColor: "#000000b3",
18
+ overlayFontColor: "#ffffff",
19
+ },
20
+ };
21
+
11
22
  export const Chromatic = () => (
12
23
  <>
13
24
  <ExampleContainer>
@@ -46,15 +57,37 @@ export const Chromatic = () => (
46
57
  <DxcProgressBar label="Margin xlarge" margin="xlarge" value={50} showValue />
47
58
  </ExampleContainer>
48
59
  <ExampleContainer>
49
- <Title title="XxLarge margin" theme="light" level={4} />
60
+ <Title title="Xxlarge margin" theme="light" level={4} />
50
61
  <DxcProgressBar label="Margin xxlarge" margin="xxlarge" value={50} showValue />
51
62
  </ExampleContainer>
63
+ <Title title="Opinionated theme" theme="light" level={2} />
64
+ <ExampleContainer>
65
+ <Title title="Label and helper text" theme="light" level={4} />
66
+ <HalstackProvider theme={opinionatedTheme}>
67
+ <DxcProgressBar label="Loading..." helperText="Helper text" value={24} showValue />
68
+ </HalstackProvider>
69
+ </ExampleContainer>
70
+ <ExampleContainer>
71
+ <Title title="Without default value" theme="light" level={4} />
72
+ <HalstackProvider theme={opinionatedTheme}>
73
+ <DxcProgressBar label="Loading..." helperText="Helper text" showValue />
74
+ </HalstackProvider>
75
+ </ExampleContainer>
52
76
  </>
53
77
  );
54
78
 
55
79
  export const ProgressBarOverlay = () => (
56
80
  <ExampleContainer>
57
81
  <Title title="Overlay" theme="dark" level={4} />
58
- <DxcProgressBar label="Overlay" helperText="Helper text" overlay={true} showValue value={50} />
82
+ <DxcProgressBar label="Overlay" helperText="Helper text" overlay showValue value={50} />
83
+ </ExampleContainer>
84
+ );
85
+
86
+ export const ProgressBarOverlayOpinionated = () => (
87
+ <ExampleContainer>
88
+ <Title title="Overlay" theme="dark" level={4} />
89
+ <HalstackProvider theme={opinionatedTheme}>
90
+ <DxcProgressBar label="Overlay" helperText="Helper text" overlay showValue value={50} />
91
+ </HalstackProvider>
59
92
  </ExampleContainer>
60
93
  );
@@ -5,12 +5,20 @@ import DxcHeading from "../heading/Heading";
5
5
  import DxcParagraph from "../paragraph/Paragraph";
6
6
  import Title from "../../.storybook/components/Title";
7
7
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
8
+ import { HalstackProvider } from "../HalstackContext";
8
9
 
9
10
  export default {
10
11
  title: "QuickNav",
11
12
  component: DxcQuickNav,
12
13
  };
13
14
 
15
+ const opinionatedTheme = {
16
+ quickNav: {
17
+ fontColor: "#666666",
18
+ accentColor: "#9a6bb2",
19
+ },
20
+ };
21
+
14
22
  const defaultLinks = [
15
23
  {
16
24
  label: "Overview",
@@ -315,6 +323,12 @@ export const Chromatic = () => (
315
323
  </QuickNavContainer>
316
324
  </Container>
317
325
  </ExampleContainer>
326
+ <Title title="Opinionated theme" level={2} />
327
+ <ExampleContainer>
328
+ <HalstackProvider theme={opinionatedTheme}>
329
+ <DxcQuickNav links={defaultLinks} />
330
+ </HalstackProvider>
331
+ </ExampleContainer>
318
332
  </>
319
333
  );
320
334