@dxc-technology/halstack-react 8.0.0 → 9.0.0

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 (88) hide show
  1. package/HalstackContext.js +94 -45
  2. package/accordion/Accordion.js +7 -13
  3. package/accordion/Accordion.stories.tsx +102 -13
  4. package/alert/Alert.stories.tsx +28 -0
  5. package/box/Box.js +1 -3
  6. package/box/Box.stories.tsx +15 -0
  7. package/button/Button.js +11 -13
  8. package/button/Button.stories.tsx +150 -8
  9. package/checkbox/Checkbox.stories.tsx +52 -0
  10. package/chip/Chip.js +16 -22
  11. package/chip/Chip.stories.tsx +96 -9
  12. package/common/variables.js +280 -288
  13. package/date-input/Calendar.d.ts +1 -1
  14. package/date-input/Calendar.js +43 -43
  15. package/date-input/DateInput.js +74 -32
  16. package/date-input/DateInput.stories.tsx +183 -30
  17. package/date-input/DateInput.test.js +120 -37
  18. package/date-input/DatePicker.js +38 -52
  19. package/date-input/Icons.d.ts +6 -0
  20. package/date-input/Icons.js +75 -0
  21. package/date-input/YearPicker.d.ts +1 -1
  22. package/date-input/YearPicker.js +23 -12
  23. package/date-input/types.d.ts +6 -8
  24. package/dialog/Dialog.js +60 -73
  25. package/dialog/Dialog.stories.tsx +211 -159
  26. package/dialog/Dialog.test.js +301 -2
  27. package/dropdown/Dropdown.js +3 -6
  28. package/dropdown/Dropdown.stories.tsx +210 -84
  29. package/dropdown/DropdownMenu.js +8 -18
  30. package/dropdown/DropdownMenuItem.js +4 -15
  31. package/file-input/FileInput.js +3 -6
  32. package/file-input/FileInput.stories.tsx +85 -2
  33. package/file-input/FileInput.test.js +0 -41
  34. package/file-input/FileItem.js +1 -0
  35. package/footer/Footer.stories.tsx +91 -0
  36. package/header/Header.js +18 -20
  37. package/header/Header.stories.tsx +149 -6
  38. package/link/Link.stories.tsx +60 -0
  39. package/main.d.ts +1 -1
  40. package/main.js +1 -1
  41. package/{tabs-nav → nav-tabs}/NavTabs.js +1 -1
  42. package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +96 -6
  43. package/{tabs-nav → nav-tabs}/Tab.js +35 -15
  44. package/package.json +1 -1
  45. package/paginator/Icons.d.ts +5 -0
  46. package/paginator/Icons.js +16 -28
  47. package/paginator/Paginator.js +5 -11
  48. package/paginator/Paginator.stories.tsx +24 -0
  49. package/paginator/Paginator.test.js +17 -10
  50. package/progress-bar/ProgressBar.js +4 -4
  51. package/progress-bar/ProgressBar.stories.jsx +35 -2
  52. package/quick-nav/QuickNav.stories.tsx +14 -0
  53. package/radio-group/RadioGroup.stories.tsx +131 -18
  54. package/resultsetTable/ResultsetTable.test.js +17 -22
  55. package/select/Listbox.d.ts +1 -1
  56. package/select/Listbox.js +5 -34
  57. package/select/Option.js +11 -24
  58. package/select/Select.js +43 -24
  59. package/select/Select.stories.tsx +492 -145
  60. package/select/Select.test.js +17 -22
  61. package/select/types.d.ts +2 -2
  62. package/sidenav/Sidenav.js +8 -10
  63. package/sidenav/Sidenav.stories.tsx +148 -46
  64. package/slider/Slider.js +4 -4
  65. package/slider/Slider.stories.tsx +57 -0
  66. package/spinner/Spinner.js +2 -2
  67. package/spinner/Spinner.stories.jsx +27 -1
  68. package/switch/Switch.js +1 -1
  69. package/switch/Switch.stories.tsx +33 -0
  70. package/table/Table.stories.jsx +80 -1
  71. package/tabs/Tab.js +3 -5
  72. package/tabs/Tabs.js +3 -3
  73. package/tabs/Tabs.stories.tsx +45 -5
  74. package/tag/Tag.stories.tsx +14 -1
  75. package/text-input/Suggestion.js +32 -5
  76. package/text-input/TextInput.js +7 -11
  77. package/text-input/TextInput.stories.tsx +92 -4
  78. package/text-input/TextInput.test.js +125 -25
  79. package/textarea/Textarea.stories.jsx +60 -1
  80. package/toggle-group/ToggleGroup.stories.tsx +42 -0
  81. package/utils/FocusLock.d.ts +13 -0
  82. package/utils/FocusLock.js +139 -0
  83. package/wizard/Wizard.stories.tsx +20 -0
  84. /package/{tabs-nav → nav-tabs}/NavTabs.d.ts +0 -0
  85. /package/{tabs-nav → nav-tabs}/NavTabs.test.js +0 -0
  86. /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
  87. /package/{tabs-nav → nav-tabs}/types.d.ts +0 -0
  88. /package/{tabs-nav → nav-tabs}/types.js +0 -0
@@ -3,6 +3,7 @@ import { userEvent, within } from "@storybook/testing-library";
3
3
  import DxcChip from "./Chip";
4
4
  import Title from "../../.storybook/components/Title";
5
5
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
6
+ import { HalstackProvider } from "../HalstackContext";
6
7
 
7
8
  export default {
8
9
  title: "Chip",
@@ -10,12 +11,43 @@ export default {
10
11
  };
11
12
 
12
13
  const iconSVG = (
13
- <svg viewBox="0 0 24 24" fill="currentColor">
14
- <path d="M0 0h24v24H0z" fill="none" />
15
- <path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" />
14
+ <svg
15
+ version="1.1"
16
+ id="Capa_1"
17
+ x="0px"
18
+ y="0px"
19
+ width="438.536px"
20
+ height="438.536px"
21
+ viewBox="0 0 438.536 438.536"
22
+ fill="currentColor"
23
+ >
24
+ <g>
25
+ <path
26
+ d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
27
+ C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
28
+ h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
29
+ C438.532,59.576,430.49,40.204,414.41,24.123z M373.155,225.548h-49.963V406.84h-74.802V225.548H210.99V163.02h37.401v-37.402
30
+ c0-26.838,6.283-47.107,18.843-60.813c12.559-13.706,33.304-20.555,62.242-20.555h49.963v62.526h-31.401
31
+ c-10.663,0-17.467,1.853-20.417,5.568c-2.949,3.711-4.428,10.23-4.428,19.558v31.119h56.534L373.155,225.548z"
32
+ />
33
+ </g>
16
34
  </svg>
17
35
  );
18
36
 
37
+ const smallIconSVG = (
38
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="20" width="20">
39
+ <path d="m10 17-1.042-.938q-2.083-1.854-3.437-3.177-1.354-1.323-2.136-2.354Q2.604 9.5 2.302 8.646 2 7.792 2 6.896q0-1.854 1.271-3.125T6.396 2.5q1.021 0 1.979.438.958.437 1.625 1.229.667-.792 1.625-1.229.958-.438 1.979-.438 1.854 0 3.125 1.271T18 6.896q0 .896-.292 1.729-.291.833-1.073 1.854-.781 1.021-2.145 2.365-1.365 1.344-3.49 3.26Zm0-2.021q1.938-1.729 3.188-2.948 1.25-1.219 1.989-2.125.74-.906 1.031-1.614.292-.709.292-1.396 0-1.229-.833-2.063Q14.833 4 13.604 4q-.729 0-1.364.302-.636.302-1.094.844L10.417 6h-.834l-.729-.854q-.458-.542-1.114-.844Q7.083 4 6.396 4q-1.229 0-2.063.833-.833.834-.833 2.063 0 .687.271 1.364.271.678.989 1.573.719.896 1.98 2.125Q8 13.188 10 14.979Zm0-5.5Z" />
40
+ </svg>
41
+ );
42
+
43
+ const opinionatedTheme = {
44
+ chip: {
45
+ baseColor: "#e6e6e6",
46
+ fontColor: "#000000",
47
+ iconColor: "#4d4d4d",
48
+ },
49
+ };
50
+
19
51
  export const Chromatic = () => (
20
52
  <>
21
53
  <ExampleContainer>
@@ -23,20 +55,29 @@ export const Chromatic = () => (
23
55
  <DxcChip label="Default Chip" />
24
56
  </ExampleContainer>
25
57
  <ExampleContainer>
26
- <Title title="Chip with prefix" theme="light" level={4} />
27
- <DxcChip label="Chip with prefix" prefixIcon={iconSVG} />
58
+ <Title title="Chip with prefix SVG (small icon)" theme="light" level={4} />
59
+ <DxcChip label="Chip with prefix" prefixIcon={smallIconSVG} />
28
60
  </ExampleContainer>
29
61
  <ExampleContainer>
30
- <Title title="Chip with suffix" theme="light" level={4} />
62
+ <Title title="Chip with suffix SVG (large icon)" theme="light" level={4} />
31
63
  <DxcChip label="Chip with suffix" suffixIcon={iconSVG} />
32
64
  </ExampleContainer>
33
65
  <ExampleContainer>
34
- <Title title="Chip with prefix and suffix" theme="light" level={4} />
35
- <DxcChip label="Chip with prefix and suffix" prefixIcon={iconSVG} suffixIcon={iconSVG} />
66
+ <Title title="Chip with prefix (SVG) and suffix (URL)" theme="light" level={4} />
67
+ <DxcChip
68
+ label="Chip with prefix and suffix"
69
+ prefixIcon={iconSVG}
70
+ suffixIcon="https://upload.wikimedia.org/wikipedia/commons/e/e0/Check_green_icon.svg"
71
+ />
36
72
  </ExampleContainer>
37
73
  <ExampleContainer>
38
74
  <Title title="Disabled chip" theme="light" level={4} />
39
- <DxcChip label="Disabled" disabled prefixIcon={iconSVG} suffixIcon={iconSVG} />
75
+ <DxcChip
76
+ label="Disabled"
77
+ disabled
78
+ prefixIcon={iconSVG}
79
+ suffixIcon="https://upload.wikimedia.org/wikipedia/commons/e/e0/Check_green_icon.svg"
80
+ />
40
81
  </ExampleContainer>
41
82
  <ExampleContainer>
42
83
  <Title title="Chip with ellipsis" theme="light" level={4} />
@@ -93,6 +134,52 @@ export const Chromatic = () => (
93
134
  <Title title="Xxlarge margin" theme="light" level={4} />
94
135
  <DxcChip label="xxlarge" margin="xxlarge" />
95
136
  </ExampleContainer>
137
+ <Title title="Opinionated theme" theme="light" level={2} />
138
+ <ExampleContainer>
139
+ <Title title="Chip with prefix and suffix" theme="light" level={4} />
140
+ <HalstackProvider theme={opinionatedTheme}>
141
+ <DxcChip
142
+ label="Chip"
143
+ prefixIcon={iconSVG}
144
+ suffixIcon="https://upload.wikimedia.org/wikipedia/commons/e/e0/Check_green_icon.svg"
145
+ />
146
+ </HalstackProvider>
147
+ </ExampleContainer>
148
+ <ExampleContainer>
149
+ <Title title="Chip with prefix and suffix" theme="light" level={4} />
150
+ <HalstackProvider theme={opinionatedTheme}>
151
+ <DxcChip
152
+ label="Chip"
153
+ disabled
154
+ prefixIcon={iconSVG}
155
+ suffixIcon="https://upload.wikimedia.org/wikipedia/commons/e/e0/Check_green_icon.svg"
156
+ />
157
+ </HalstackProvider>
158
+ </ExampleContainer>
159
+ <ExampleContainer pseudoState="pseudo-hover">
160
+ <Title title="Hovered" theme="light" level={4} />
161
+ <HalstackProvider theme={opinionatedTheme}>
162
+ <DxcChip
163
+ label="Chip"
164
+ prefixIcon={iconSVG}
165
+ suffixIcon={iconSVG}
166
+ onClickPrefix={() => {}}
167
+ onClickSuffix={() => {}}
168
+ />
169
+ </HalstackProvider>
170
+ </ExampleContainer>
171
+ <ExampleContainer pseudoState="pseudo-active">
172
+ <Title title="Actived" theme="light" level={4} />
173
+ <HalstackProvider theme={opinionatedTheme}>
174
+ <DxcChip
175
+ label="Chip"
176
+ prefixIcon={iconSVG}
177
+ suffixIcon={iconSVG}
178
+ onClickPrefix={() => {}}
179
+ onClickSuffix={() => {}}
180
+ />
181
+ </HalstackProvider>
182
+ </ExampleContainer>
96
183
  </>
97
184
  );
98
185
  const ChipPrefixFocused = () => (