@dxc-technology/halstack-react 12.0.0 → 12.0.1

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 (195) hide show
  1. package/HalstackContext.d.ts +0 -3
  2. package/HalstackContext.js +2 -6
  3. package/accordion/Accordion.accessibility.test.d.ts +1 -0
  4. package/accordion/Accordion.accessibility.test.js +1 -1
  5. package/accordion/Accordion.js +5 -8
  6. package/accordion/Accordion.test.d.ts +1 -0
  7. package/accordion/Accordion.test.js +3 -3
  8. package/accordion-group/AccordionGroup.accessibility.test.d.ts +1 -0
  9. package/accordion-group/AccordionGroup.accessibility.test.js +8 -14
  10. package/accordion-group/AccordionGroup.test.d.ts +1 -0
  11. package/accordion-group/AccordionGroup.test.js +5 -9
  12. package/action-icon/ActionIcon.accessibility.test.d.ts +1 -0
  13. package/action-icon/ActionIcon.accessibility.test.js +1 -1
  14. package/action-icon/ActionIcon.test.d.ts +1 -0
  15. package/action-icon/ActionIcon.test.js +1 -1
  16. package/alert/Alert.accessibility.test.d.ts +1 -0
  17. package/alert/Alert.accessibility.test.js +1 -1
  18. package/alert/Alert.test.d.ts +1 -0
  19. package/alert/Alert.test.js +1 -1
  20. package/badge/Badge.accessibility.test.d.ts +1 -0
  21. package/badge/Badge.accessibility.test.js +2 -2
  22. package/badge/Badge.test.d.ts +1 -0
  23. package/badge/Badge.test.js +2 -2
  24. package/box/Box.accessibility.test.d.ts +1 -0
  25. package/box/Box.accessibility.test.js +1 -1
  26. package/box/Box.test.d.ts +1 -0
  27. package/box/Box.test.js +1 -1
  28. package/bulleted-list/BulletedList.accessibility.test.d.ts +1 -0
  29. package/button/Button.accessibility.test.d.ts +1 -0
  30. package/button/Button.accessibility.test.js +1 -1
  31. package/button/Button.test.d.ts +1 -0
  32. package/button/Button.test.js +1 -1
  33. package/card/Card.accessibility.test.d.ts +1 -0
  34. package/card/Card.accessibility.test.js +1 -1
  35. package/card/Card.test.d.ts +1 -0
  36. package/card/Card.test.js +1 -1
  37. package/checkbox/Checkbox.accessibility.test.d.ts +1 -0
  38. package/checkbox/Checkbox.accessibility.test.js +1 -1
  39. package/checkbox/Checkbox.js +5 -8
  40. package/checkbox/Checkbox.test.d.ts +1 -0
  41. package/checkbox/Checkbox.test.js +1 -1
  42. package/chip/Chip.accessibility.test.d.ts +1 -0
  43. package/chip/Chip.accessibility.test.js +3 -1
  44. package/chip/Chip.js +10 -21
  45. package/chip/Chip.stories.tsx +78 -46
  46. package/chip/Chip.test.d.ts +1 -0
  47. package/chip/Chip.test.js +1 -1
  48. package/chip/types.d.ts +35 -12
  49. package/common/fonts.css +2 -0
  50. package/common/variables.d.ts +0 -3
  51. package/common/variables.js +1 -4
  52. package/contextual-menu/ContextualMenu.accessibility.test.d.ts +1 -0
  53. package/contextual-menu/ContextualMenu.accessibility.test.js +2 -1
  54. package/contextual-menu/ContextualMenu.test.d.ts +1 -0
  55. package/contextual-menu/ContextualMenu.test.js +1 -1
  56. package/date-input/DateInput.accessibility.test.d.ts +1 -0
  57. package/date-input/DateInput.accessibility.test.js +4 -2
  58. package/date-input/DateInput.js +15 -15
  59. package/date-input/DateInput.test.d.ts +1 -0
  60. package/date-input/DateInput.test.js +9 -8
  61. package/dialog/Dialog.accessibility.test.d.ts +1 -0
  62. package/dialog/Dialog.accessibility.test.js +1 -1
  63. package/dialog/Dialog.stories.tsx +1 -2
  64. package/dialog/Dialog.test.d.ts +1 -0
  65. package/dialog/Dialog.test.js +112 -48
  66. package/divider/Divider.accessibility.test.d.ts +1 -0
  67. package/divider/Divider.test.d.ts +1 -0
  68. package/dropdown/Dropdown.accessibility.test.d.ts +1 -0
  69. package/dropdown/Dropdown.accessibility.test.js +6 -2
  70. package/dropdown/Dropdown.js +11 -12
  71. package/dropdown/Dropdown.test.d.ts +1 -0
  72. package/dropdown/Dropdown.test.js +82 -52
  73. package/file-input/FileInput.accessibility.test.d.ts +1 -0
  74. package/file-input/FileInput.accessibility.test.js +25 -18
  75. package/file-input/FileInput.js +1 -4
  76. package/file-input/FileInput.test.d.ts +1 -0
  77. package/file-input/FileInput.test.js +44 -22
  78. package/footer/Footer.accessibility.test.d.ts +1 -0
  79. package/footer/Footer.accessibility.test.js +1 -1
  80. package/footer/Footer.test.d.ts +1 -0
  81. package/footer/Footer.test.js +1 -1
  82. package/header/Header.accessibility.test.d.ts +1 -0
  83. package/header/Header.accessibility.test.js +5 -4
  84. package/header/Header.test.d.ts +1 -0
  85. package/header/Header.test.js +1 -1
  86. package/heading/Heading.accessibility.test.d.ts +1 -0
  87. package/heading/Heading.accessibility.test.js +1 -1
  88. package/heading/Heading.test.d.ts +1 -0
  89. package/heading/Heading.test.js +1 -14
  90. package/icon/Icon.accessibility.test.d.ts +1 -0
  91. package/image/Image.accessibility.test.d.ts +1 -0
  92. package/link/Link.accessibility.test.d.ts +1 -0
  93. package/link/Link.accessibility.test.js +2 -2
  94. package/link/Link.test.d.ts +1 -0
  95. package/link/Link.test.js +1 -1
  96. package/main.d.ts +1 -0
  97. package/main.js +1 -0
  98. package/nav-tabs/NavTabs.accessibility.test.d.ts +1 -0
  99. package/nav-tabs/NavTabs.accessibility.test.js +1 -1
  100. package/nav-tabs/NavTabs.js +18 -3
  101. package/nav-tabs/NavTabs.stories.tsx +18 -3
  102. package/nav-tabs/NavTabs.test.d.ts +1 -0
  103. package/nav-tabs/NavTabs.test.js +1 -1
  104. package/nav-tabs/Tab.js +1 -1
  105. package/number-input/NumberInput.accessibility.test.d.ts +1 -0
  106. package/number-input/NumberInput.accessibility.test.js +1 -1
  107. package/number-input/NumberInput.test.d.ts +1 -0
  108. package/number-input/NumberInput.test.js +5 -5
  109. package/package.json +6 -6
  110. package/paginator/Paginator.accessibility.test.d.ts +1 -0
  111. package/paginator/Paginator.accessibility.test.js +1 -1
  112. package/paginator/Paginator.test.d.ts +1 -0
  113. package/paginator/Paginator.test.js +1 -1
  114. package/paragraph/Paragraph.accessibility.test.d.ts +1 -0
  115. package/password-input/PasswordInput.accessibility.test.d.ts +1 -0
  116. package/password-input/PasswordInput.accessibility.test.js +1 -1
  117. package/password-input/PasswordInput.test.d.ts +1 -0
  118. package/password-input/PasswordInput.test.js +1 -1
  119. package/progress-bar/ProgressBar.accessibility.test.d.ts +1 -0
  120. package/progress-bar/ProgressBar.accessibility.test.js +1 -1
  121. package/progress-bar/ProgressBar.test.d.ts +1 -0
  122. package/progress-bar/ProgressBar.test.js +1 -1
  123. package/quick-nav/QuickNav.accessibility.test.d.ts +1 -0
  124. package/radio-group/Radio.js +5 -8
  125. package/radio-group/RadioGroup.accessibility.test.d.ts +1 -0
  126. package/radio-group/RadioGroup.accessibility.test.js +1 -1
  127. package/radio-group/RadioGroup.js +12 -15
  128. package/radio-group/RadioGroup.test.d.ts +1 -0
  129. package/radio-group/RadioGroup.test.js +3 -5
  130. package/resultset-table/ResultsetTable.accessibility.test.d.ts +1 -0
  131. package/resultset-table/ResultsetTable.accessibility.test.js +1 -1
  132. package/resultset-table/ResultsetTable.test.d.ts +1 -0
  133. package/resultset-table/ResultsetTable.test.js +1 -2
  134. package/select/Listbox.js +6 -10
  135. package/select/Select.accessibility.test.d.ts +1 -0
  136. package/select/Select.accessibility.test.js +3 -3
  137. package/select/Select.js +15 -17
  138. package/select/Select.test.d.ts +1 -0
  139. package/select/Select.test.js +6 -3
  140. package/sidenav/Sidenav.accessibility.test.d.ts +1 -0
  141. package/sidenav/Sidenav.accessibility.test.js +1 -1
  142. package/sidenav/Sidenav.test.d.ts +1 -0
  143. package/sidenav/Sidenav.test.js +1 -1
  144. package/slider/Slider.accessibility.test.d.ts +1 -0
  145. package/slider/Slider.accessibility.test.js +1 -1
  146. package/slider/Slider.js +8 -11
  147. package/slider/Slider.stories.tsx +180 -0
  148. package/slider/Slider.test.d.ts +1 -0
  149. package/slider/Slider.test.js +12 -9
  150. package/spinner/Spinner.accessibility.test.d.ts +1 -0
  151. package/spinner/Spinner.accessibility.test.js +2 -2
  152. package/spinner/Spinner.test.d.ts +1 -0
  153. package/spinner/Spinner.test.js +1 -1
  154. package/status-light/StatusLight.accessibility.test.d.ts +1 -0
  155. package/status-light/StatusLight.accessibility.test.js +2 -2
  156. package/status-light/StatusLight.test.d.ts +1 -0
  157. package/status-light/StatusLight.test.js +1 -1
  158. package/switch/Switch.accessibility.test.d.ts +1 -0
  159. package/switch/Switch.accessibility.test.js +1 -1
  160. package/switch/Switch.js +5 -8
  161. package/switch/Switch.test.d.ts +1 -0
  162. package/switch/Switch.test.js +1 -1
  163. package/table/Table.accessibility.test.d.ts +1 -0
  164. package/table/Table.accessibility.test.js +1 -1
  165. package/table/Table.test.d.ts +1 -0
  166. package/table/Table.test.js +1 -2
  167. package/tabs/Tabs.accessibility.test.d.ts +1 -0
  168. package/tabs/Tabs.accessibility.test.js +1 -1
  169. package/tabs/Tabs.test.d.ts +1 -0
  170. package/tabs/Tabs.test.js +1 -1
  171. package/tag/Tag.accessibility.test.d.ts +1 -0
  172. package/tag/Tag.accessibility.test.js +1 -1
  173. package/tag/Tag.test.d.ts +1 -0
  174. package/tag/Tag.test.js +1 -1
  175. package/text-input/TextInput.accessibility.test.d.ts +1 -0
  176. package/text-input/TextInput.accessibility.test.js +1 -1
  177. package/text-input/TextInput.js +19 -21
  178. package/text-input/TextInput.test.d.ts +1 -0
  179. package/text-input/TextInput.test.js +1 -1
  180. package/textarea/Textarea.accessibility.test.d.ts +1 -0
  181. package/textarea/Textarea.accessibility.test.js +1 -1
  182. package/textarea/Textarea.js +1 -4
  183. package/textarea/Textarea.test.d.ts +1 -0
  184. package/textarea/Textarea.test.js +1 -1
  185. package/toggle-group/ToggleGroup.accessibility.test.d.ts +1 -0
  186. package/toggle-group/ToggleGroup.accessibility.test.js +2 -2
  187. package/toggle-group/ToggleGroup.js +5 -8
  188. package/toggle-group/ToggleGroup.test.d.ts +1 -0
  189. package/toggle-group/ToggleGroup.test.js +1 -1
  190. package/typography/Typography.accessibility.test.d.ts +1 -0
  191. package/useTheme.d.ts +0 -3
  192. package/wizard/Wizard.accessibility.test.d.ts +1 -0
  193. package/wizard/Wizard.accessibility.test.js +1 -1
  194. package/wizard/Wizard.test.d.ts +1 -0
  195. package/wizard/Wizard.test.js +1 -1
@@ -33,12 +33,6 @@ c-10.663,0-17.467,1.853-20.417,5.568c-2.949,3.711-4.428,10.23-4.428,19.558v31.11
33
33
  </svg>
34
34
  );
35
35
 
36
- const smallIconSVG = (
37
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="20" width="20">
38
- <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" />
39
- </svg>
40
- );
41
-
42
36
  const opinionatedTheme = {
43
37
  chip: {
44
38
  baseColor: "#e6e6e6",
@@ -50,33 +44,79 @@ const opinionatedTheme = {
50
44
  export const Chromatic = () => (
51
45
  <>
52
46
  <ExampleContainer>
53
- <Title title="Basic chip" theme="light" level={4} />
54
- <DxcChip label="Default Chip" />
47
+ <Title title="Default" theme="light" level={4} />
48
+ <DxcChip label="Default" />
49
+ </ExampleContainer>
50
+ <ExampleContainer>
51
+ <Title title="With prefix (SVG)" theme="light" level={4} />
52
+ <DxcChip label="Prefix" prefixIcon={iconSVG} />
55
53
  </ExampleContainer>
56
54
  <ExampleContainer>
57
- <Title title="Chip with prefix SVG (small icon)" theme="light" level={4} />
58
- <DxcChip label="Chip with prefix" prefixIcon={smallIconSVG} />
55
+ <Title title="With action prefix (SVG)" theme="light" level={4} />
56
+ <DxcChip label="Action prefix" prefixIcon={iconSVG} onClickPrefix={() => {}} />
59
57
  </ExampleContainer>
60
58
  <ExampleContainer>
61
- <Title title="Chip with suffix SVG (large icon)" theme="light" level={4} />
62
- <DxcChip label="Chip with suffix" suffixIcon={iconSVG} />
59
+ <Title title="Disabled action prefix (SVG)" theme="light" level={4} />
60
+ <DxcChip label="Disabled action prefix" prefixIcon={iconSVG} onClickPrefix={() => {}} disabled />
63
61
  </ExampleContainer>
64
62
  <ExampleContainer>
65
- <Title title="Chip with prefix (SVG) and suffix (URL)" theme="light" level={4} />
66
- <DxcChip label="Chip with prefix and suffix" prefixIcon={iconSVG} suffixIcon="filled_check_circle" />
63
+ <Title title="With suffix (Material icon)" theme="light" level={4} />
64
+ <DxcChip label="Suffix" suffixIcon="filled_check_circle" />
65
+ </ExampleContainer>
66
+ <ExampleContainer>
67
+ <Title title="With action suffix (Material icon)" theme="light" level={4} />
68
+ <DxcChip label="Action suffix" suffixIcon="filled_check_circle" onClickSuffix={() => {}} />
69
+ </ExampleContainer>
70
+ <ExampleContainer>
71
+ <Title title="Action prefix and suffix" theme="light" level={4} />
72
+ <DxcChip
73
+ label="Action prefix and suffix"
74
+ prefixIcon="filled_check_circle"
75
+ onClickPrefix={() => {}}
76
+ suffixIcon={iconSVG}
77
+ />
67
78
  </ExampleContainer>
68
79
  <ExampleContainer>
69
- <Title title="Disabled chip" theme="light" level={4} />
70
- <DxcChip label="Disabled" disabled prefixIcon={iconSVG} suffixIcon="filled_check_circle" />
80
+ <Title title="Prefix and action suffix" theme="light" level={4} />
81
+ <DxcChip
82
+ label="Prefix and action suffix"
83
+ prefixIcon="filled_check_circle"
84
+ suffixIcon={iconSVG}
85
+ onClickSuffix={() => {}}
86
+ />
87
+ </ExampleContainer>
88
+ <ExampleContainer>
89
+ <Title title="Disabled action suffix (Material icon)" theme="light" level={4} />
90
+ <DxcChip label="Disabled action suffix" suffixIcon="filled_check_circle" onClickSuffix={() => {}} disabled />
91
+ </ExampleContainer>
92
+ <ExampleContainer>
93
+ <Title title="Disabled action prefix and suffix" theme="light" level={4} />
94
+ <DxcChip
95
+ label="Disabled action prefix"
96
+ disabled
97
+ prefixIcon={iconSVG}
98
+ onClickPrefix={() => {}}
99
+ suffixIcon="filled_check_circle"
100
+ />
101
+ </ExampleContainer>
102
+ <ExampleContainer>
103
+ <Title title="Prefix and disabled action suffix" theme="light" level={4} />
104
+ <DxcChip
105
+ label="Disabled action suffix"
106
+ disabled
107
+ prefixIcon={iconSVG}
108
+ suffixIcon="filled_check_circle"
109
+ onClickSuffix={() => {}}
110
+ />
71
111
  </ExampleContainer>
72
112
  <ExampleContainer>
73
- <Title title="Chip with ellipsis" theme="light" level={4} />
113
+ <Title title="With ellipsis" theme="light" level={4} />
74
114
  <div style={{ width: "200px" }}>
75
115
  <DxcChip label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fg ssssssssssss ssss" />
76
116
  </div>
77
117
  </ExampleContainer>
78
118
  <ExampleContainer>
79
- <Title title="Chip with ellipsis and suffix" theme="light" level={4} />
119
+ <Title title="With ellipsis and suffix" theme="light" level={4} />
80
120
  <div style={{ width: "200px" }}>
81
121
  <DxcChip
82
122
  suffixIcon={iconSVG}
@@ -85,7 +125,7 @@ export const Chromatic = () => (
85
125
  </div>
86
126
  </ExampleContainer>
87
127
  <ExampleContainer>
88
- <Title title="Chip with ellipsis and prefix" theme="light" level={4} />
128
+ <Title title="With ellipsis and prefix" theme="light" level={4} />
89
129
  <div style={{ width: "200px" }}>
90
130
  <DxcChip
91
131
  prefixIcon={iconSVG}
@@ -94,10 +134,11 @@ export const Chromatic = () => (
94
134
  </div>
95
135
  </ExampleContainer>
96
136
  <ExampleContainer>
97
- <Title title="Chip with ellipsis, suffix and prefix" theme="light" level={4} />
137
+ <Title title="With ellipsis, action prefix and suffix" theme="light" level={4} />
98
138
  <div style={{ width: "200px" }}>
99
139
  <DxcChip
100
140
  prefixIcon={iconSVG}
141
+ onClickPrefix={() => {}}
101
142
  suffixIcon={iconSVG}
102
143
  label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasdf"
103
144
  />
@@ -134,57 +175,48 @@ export const Chromatic = () => (
134
175
  </ExampleContainer>
135
176
  <Title title="Opinionated theme" theme="light" level={2} />
136
177
  <ExampleContainer>
137
- <Title title="Chip with prefix and suffix" theme="light" level={4} />
178
+ <Title title="With prefix and suffix" theme="light" level={4} />
138
179
  <HalstackProvider theme={opinionatedTheme}>
139
- <DxcChip label="Chip" prefixIcon={iconSVG} suffixIcon="filled_check_circle" />
180
+ <DxcChip label="Chip" prefixIcon={iconSVG} onClickPrefix={() => {}} suffixIcon="filled_check_circle" />
140
181
  </HalstackProvider>
141
182
  </ExampleContainer>
142
183
  <ExampleContainer>
143
- <Title title="Chip with prefix and suffix" theme="light" level={4} />
184
+ <Title title="With prefix and suffix" theme="light" level={4} />
144
185
  <HalstackProvider theme={opinionatedTheme}>
145
- <DxcChip label="Chip" disabled prefixIcon={iconSVG} suffixIcon="filled_check_circle" />
186
+ <DxcChip
187
+ label="Disabled"
188
+ disabled
189
+ prefixIcon={iconSVG}
190
+ suffixIcon="filled_check_circle"
191
+ onClickSuffix={() => {}}
192
+ />
146
193
  </HalstackProvider>
147
194
  </ExampleContainer>
148
195
  <ExampleContainer pseudoState="pseudo-hover">
149
196
  <Title title="Hovered" theme="light" level={4} />
150
197
  <HalstackProvider theme={opinionatedTheme}>
151
- <DxcChip
152
- label="Chip"
153
- prefixIcon={iconSVG}
154
- suffixIcon={iconSVG}
155
- onClickPrefix={() => {}}
156
- onClickSuffix={() => {}}
157
- />
198
+ <DxcChip label="Chip" prefixIcon={iconSVG} suffixIcon={iconSVG} onClickPrefix={() => {}} />
158
199
  </HalstackProvider>
159
200
  </ExampleContainer>
160
201
  <ExampleContainer pseudoState="pseudo-active">
161
202
  <Title title="Actived" theme="light" level={4} />
162
203
  <HalstackProvider theme={opinionatedTheme}>
163
- <DxcChip
164
- label="Chip"
165
- prefixIcon={iconSVG}
166
- suffixIcon={iconSVG}
167
- onClickPrefix={() => {}}
168
- onClickSuffix={() => {}}
169
- />
204
+ <DxcChip label="Chip" prefixIcon={iconSVG} suffixIcon={iconSVG} onClickPrefix={() => {}} />
170
205
  </HalstackProvider>
171
206
  </ExampleContainer>
172
207
  </>
173
208
  );
209
+
174
210
  const ChipPrefixFocused = () => (
175
211
  <ExampleContainer>
176
- <Title title="Chip with prefix" theme="light" level={4} />
177
- <DxcChip
178
- label="Chip with prefix"
179
- prefixIcon={iconSVG}
180
- onClickPrefix={() => {}}
181
- />
212
+ <Title title="With prefix" theme="light" level={4} />
213
+ <DxcChip label="Prefix" prefixIcon={iconSVG} onClickPrefix={() => {}} />
182
214
  </ExampleContainer>
183
215
  );
184
216
  const ChipSuffixFocused = () => (
185
217
  <ExampleContainer>
186
- <Title title="Chip with suffix" theme="light" level={4} />
187
- <DxcChip label="Chip with suffix" suffixIcon="filled_delete" onClickSuffix={() => {}} />
218
+ <Title title="With suffix" theme="light" level={4} />
219
+ <DxcChip label="Suffix" suffixIcon="filled_delete" onClickSuffix={() => {}} />
188
220
  </ExampleContainer>
189
221
  );
190
222
 
@@ -0,0 +1 @@
1
+ export {};
package/chip/Chip.test.js CHANGED
@@ -3,7 +3,7 @@
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
  var _react = _interopRequireDefault(require("react"));
5
5
  var _react2 = require("@testing-library/react");
6
- var _Chip = _interopRequireDefault(require("./Chip.tsx"));
6
+ var _Chip = _interopRequireDefault(require("./Chip"));
7
7
  describe("Chip component tests", function () {
8
8
  test("Chip renders with correct text", function () {
9
9
  var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Chip["default"], {
package/chip/types.d.ts CHANGED
@@ -7,31 +7,53 @@ type Margin = {
7
7
  right?: Space;
8
8
  };
9
9
  type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
10
- type Props = {
10
+ type Icon = string | SVG;
11
+ type PrefixIconProps = {
11
12
  /**
12
- * Text to be placed on the chip.
13
+ * Element or path used as icon to be placed before the chip label.
13
14
  */
14
- label?: string;
15
+ prefixIcon: Icon;
15
16
  /**
16
- * Element or path used as icon to be placed after the chip label.
17
+ * This function will be called when the prefix is clicked.
17
18
  */
18
- suffixIcon?: string | SVG;
19
+ onClickPrefix: () => void;
19
20
  /**
20
- * Element or path used as icon to be placed before the chip label.
21
+ * Element or path used as icon to be placed after the chip label.
21
22
  */
22
- prefixIcon?: string | SVG;
23
+ suffixIcon?: Icon;
23
24
  /**
24
25
  * This function will be called when the suffix is clicked.
25
26
  */
26
- onClickSuffix?: () => void;
27
+ onClickSuffix?: never;
27
28
  /**
28
- * This function will be called when the prefix is clicked.
29
+ * If true, the action icon will be disabled.
29
30
  */
30
- onClickPrefix?: () => void;
31
+ disabled?: boolean;
32
+ } | {
33
+ prefixIcon?: Icon;
34
+ onClickPrefix?: never;
35
+ suffixIcon?: never;
36
+ onClickSuffix?: never;
37
+ disabled?: never;
38
+ };
39
+ type SuffixIconProps = {
40
+ suffixIcon: Icon;
41
+ onClickSuffix: () => void;
42
+ prefixIcon?: Icon;
43
+ onClickPrefix?: never;
44
+ disabled?: boolean;
45
+ } | {
46
+ suffixIcon?: Icon;
47
+ onClickSuffix?: never;
48
+ prefixIcon?: never;
49
+ onClickPrefix?: never;
50
+ disabled?: never;
51
+ };
52
+ type CommonProps = {
31
53
  /**
32
- * If true, the component will be disabled.
54
+ * Text to be placed on the chip.
33
55
  */
34
- disabled?: boolean;
56
+ label?: string;
35
57
  /**
36
58
  * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
37
59
  * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
@@ -42,4 +64,5 @@ type Props = {
42
64
  */
43
65
  tabIndex?: number;
44
66
  };
67
+ type Props = (PrefixIconProps | SuffixIconProps) & CommonProps;
45
68
  export default Props;
@@ -0,0 +1,2 @@
1
+ @import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:FILL@0..1");
2
+ @import url("https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;0,800;1,300;1,400;1,600;1,700;1,800&display=swap");
@@ -191,13 +191,11 @@ export declare const componentTokens: {
191
191
  };
192
192
  chip: {
193
193
  backgroundColor: string;
194
- disabledBackgroundColor: string;
195
194
  fontFamily: string;
196
195
  fontSize: string;
197
196
  fontStyle: string;
198
197
  fontWeight: string;
199
198
  fontColor: string;
200
- disabledFontColor: string;
201
199
  borderColor: string;
202
200
  borderRadius: string;
203
201
  borderThickness: string;
@@ -215,7 +213,6 @@ export declare const componentTokens: {
215
213
  focusColor: string;
216
214
  focusBorderStyle: string;
217
215
  focusBorderThickness: string;
218
- focusBorderRadius: string;
219
216
  };
220
217
  dateInput: {
221
218
  pickerBackgroundColor: string;
@@ -199,13 +199,11 @@ var componentTokens = exports.componentTokens = {
199
199
  },
200
200
  chip: {
201
201
  backgroundColor: _coreTokens["default"].color_grey_200,
202
- disabledBackgroundColor: _coreTokens["default"].color_grey_100,
203
202
  fontFamily: _coreTokens["default"].type_sans,
204
203
  fontSize: _coreTokens["default"].type_scale_03,
205
204
  fontStyle: _coreTokens["default"].type_normal,
206
205
  fontWeight: _coreTokens["default"].type_regular,
207
206
  fontColor: _coreTokens["default"].color_black,
208
- disabledFontColor: _coreTokens["default"].color_grey_500,
209
207
  borderColor: _coreTokens["default"].color_transparent,
210
208
  borderRadius: "80px",
211
209
  borderThickness: _coreTokens["default"].border_width_0,
@@ -222,8 +220,7 @@ var componentTokens = exports.componentTokens = {
222
220
  disabledIconColor: _coreTokens["default"].color_grey_500,
223
221
  focusColor: _coreTokens["default"].color_blue_600,
224
222
  focusBorderStyle: _coreTokens["default"].border_solid,
225
- focusBorderThickness: _coreTokens["default"].border_width_2,
226
- focusBorderRadius: _coreTokens["default"].border_radius_medium
223
+ focusBorderThickness: _coreTokens["default"].border_width_2
227
224
  },
228
225
  dateInput: {
229
226
  pickerBackgroundColor: _coreTokens["default"].color_white,
@@ -7,6 +7,7 @@ var _react = _interopRequireDefault(require("react"));
7
7
  var _react2 = require("@testing-library/react");
8
8
  var _axeHelper = require("../../test/accessibility/axe-helper.js");
9
9
  var _ContextualMenu = _interopRequireDefault(require("./ContextualMenu"));
10
+ var _Badge = _interopRequireDefault(require("../badge/Badge"));
10
11
  var _disabledRules = require("../../test/accessibility/rules/specific/contextual-menu/disabledRules.js");
11
12
  // TODO: REMOVE
12
13
 
@@ -51,7 +52,7 @@ var fav_icon = /*#__PURE__*/_react["default"].createElement("svg", {
51
52
  }));
52
53
  var itemsWithTruncatedText = [{
53
54
  label: "Item with a very long label that should be truncated",
54
- slot: /*#__PURE__*/_react["default"].createElement(_ContextualMenu["default"].Badge, {
55
+ slot: /*#__PURE__*/_react["default"].createElement(_Badge["default"], {
55
56
  color: "blue",
56
57
  mode: "contextual",
57
58
  label: "Label",
@@ -0,0 +1 @@
1
+ export {};
@@ -6,7 +6,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
6
6
  var _react = _interopRequireDefault(require("react"));
7
7
  var _react2 = require("@testing-library/react");
8
8
  var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
9
- var _ContextualMenu = _interopRequireDefault(require("./ContextualMenu.tsx"));
9
+ var _ContextualMenu = _interopRequireDefault(require("./ContextualMenu"));
10
10
  var items = [{
11
11
  label: "Item 1"
12
12
  }, {
@@ -0,0 +1 @@
1
+ export {};
@@ -8,7 +8,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _react2 = require("@testing-library/react");
10
10
  var _axeHelper = require("../../test/accessibility/axe-helper.js");
11
- var _DateInput = _interopRequireDefault(require("./DateInput.tsx"));
11
+ var _DateInput = _interopRequireDefault(require("./DateInput"));
12
12
  var _disabledRules = require("../../test/accessibility/rules/specific/date-input/disabledRules.js");
13
13
  // TODO: REMOVE
14
14
 
@@ -31,7 +31,9 @@ global.DOMRect = {
31
31
  bottom: 0,
32
32
  right: 0,
33
33
  width: 0,
34
- height: 0
34
+ height: 0,
35
+ x: 0,
36
+ y: 0
35
37
  };
36
38
  }
37
39
  };
@@ -18,7 +18,6 @@ var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
18
18
  var _DatePicker = _interopRequireDefault(require("./DatePicker"));
19
19
  var Popover = _interopRequireWildcard(require("@radix-ui/react-popover"));
20
20
  var _customParseFormat = _interopRequireDefault(require("dayjs/plugin/customParseFormat"));
21
- var _uuid = require("uuid");
22
21
  var _templateObject;
23
22
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
24
23
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
@@ -76,17 +75,15 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
76
75
  _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
77
76
  isOpen = _useState4[0],
78
77
  setIsOpen = _useState4[1];
79
- var _useState5 = (0, _react.useState)("date-picker-".concat((0, _uuid.v4)())),
80
- _useState6 = (0, _slicedToArray2["default"])(_useState5, 1),
81
- calendarId = _useState6[0];
82
- var _useState7 = (0, _react.useState)(getValueForPicker((_ref2 = value !== null && value !== void 0 ? value : defaultValue) !== null && _ref2 !== void 0 ? _ref2 : "", format)),
78
+ var calendarId = "date-picker-".concat((0, _react.useId)());
79
+ var _useState5 = (0, _react.useState)(getValueForPicker((_ref2 = value !== null && value !== void 0 ? value : defaultValue) !== null && _ref2 !== void 0 ? _ref2 : "", format)),
80
+ _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
81
+ dayjsDate = _useState6[0],
82
+ setDayjsDate = _useState6[1];
83
+ var _useState7 = (0, _react.useState)(innerValue || value ? !format.toUpperCase().includes("YYYY") && +getValueForPicker(value !== null && value !== void 0 ? value : innerValue, format).format("YY") < 68 ? 2000 : 1900 : undefined),
83
84
  _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
84
- dayjsDate = _useState8[0],
85
- setDayjsDate = _useState8[1];
86
- var _useState9 = (0, _react.useState)(innerValue || value ? !format.toUpperCase().includes("YYYY") && +getValueForPicker(value !== null && value !== void 0 ? value : innerValue, format).format("YY") < 68 ? 2000 : 1900 : undefined),
87
- _useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
88
- lastValidYear = _useState10[0],
89
- setLastValidYear = _useState10[1];
85
+ lastValidYear = _useState8[0],
86
+ setLastValidYear = _useState8[1];
90
87
  var colorsTheme = (0, _useTheme["default"])();
91
88
  var translatedLabels = (0, _useTranslatedLabels["default"])();
92
89
  var dateRef = (0, _react.useRef)(null);
@@ -165,9 +162,12 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
165
162
  setIsOpen(false);
166
163
  };
167
164
  var handleDatePickerEscKeydown = function handleDatePickerEscKeydown(event) {
168
- event.preventDefault();
169
- closeCalendar();
170
- dateRef === null || dateRef === void 0 ? void 0 : dateRef.current.getElementsByTagName("input")[0].focus();
165
+ if (event.key === "Escape") {
166
+ event.preventDefault();
167
+ isOpen && event.stopPropagation();
168
+ closeCalendar();
169
+ dateRef === null || dateRef === void 0 ? void 0 : dateRef.current.getElementsByTagName("input")[0].focus();
170
+ }
171
171
  };
172
172
  var handleDatePickerOnBlur = function handleDatePickerOnBlur(event) {
173
173
  if (!(event !== null && event !== void 0 && event.currentTarget.contains(event.relatedTarget))) closeCalendar();
@@ -210,7 +210,7 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
210
210
  align: "end",
211
211
  "aria-modal": true,
212
212
  onBlur: handleDatePickerOnBlur,
213
- onEscapeKeyDown: handleDatePickerEscKeydown,
213
+ onKeyDown: handleDatePickerEscKeydown,
214
214
  avoidCollisions: false
215
215
  }, /*#__PURE__*/_react["default"].createElement(_DatePicker["default"], {
216
216
  id: calendarId,
@@ -0,0 +1 @@
1
+ export {};
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
9
9
  var _react2 = require("@testing-library/react");
10
10
  var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
11
11
  var _dayjs = _interopRequireDefault(require("dayjs"));
12
- var _DateInput = _interopRequireDefault(require("./DateInput.tsx"));
12
+ var _DateInput = _interopRequireDefault(require("./DateInput"));
13
13
  // Mocking DOMRect for Radix Primitive Popover
14
14
  global.globalThis = global;
15
15
  global.DOMRect = {
@@ -214,7 +214,7 @@ describe("DateInput component tests", function () {
214
214
  _context6.next = 5;
215
215
  return _userEvent["default"].click(calendarAction);
216
216
  case 5:
217
- expect(document.activeElement === getAllByText(d.get("date")).length === 2 && +d.get("date") > 20 ? getAllByText(d.get("date"))[1] : getAllByText(d.get("date"))[0]).toBeTruthy();
217
+ expect(document.activeElement === (getAllByText(d.get("date")).length === 2 && +d.get("date") > 20 ? getAllByText(d.get("date"))[1] : getAllByText(d.get("date"))[0])).toBeTruthy();
218
218
  expect(getByText(d.format("MMMM YYYY"))).toBeTruthy();
219
219
  case 7:
220
220
  case "end":
@@ -286,7 +286,7 @@ describe("DateInput component tests", function () {
286
286
  _context9.next = 11;
287
287
  return _userEvent["default"].click(calendarAction);
288
288
  case 11:
289
- expect(document.activeElement === getAllByText(d.get("date")).length === 2 && +d.get("date") > 20 ? getAllByText(d.get("date"))[1] : getAllByText(d.get("date"))[0]).toBeTruthy();
289
+ expect(document.activeElement === (getAllByText(d.get("date")).length === 2 && +d.get("date") > 20 ? getAllByText(d.get("date"))[1] : getAllByText(d.get("date"))[0])).toBeTruthy();
290
290
  expect(getByText(d.format("MMMM YYYY"))).toBeTruthy();
291
291
  case 13:
292
292
  case "end":
@@ -687,7 +687,7 @@ describe("DateInput component tests", function () {
687
687
  });
688
688
  });
689
689
  test("Disabled date input (calendar action must be shown but not clickable)", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16() {
690
- var _render22, getByRole, queryByText, calendarAction, d, options;
690
+ var _render22, getByRole, queryByText, calendarAction, d, options, input;
691
691
  return _regenerator["default"].wrap(function _callee16$(_context16) {
692
692
  while (1) switch (_context16.prev = _context16.next) {
693
693
  case 0:
@@ -701,12 +701,13 @@ describe("DateInput component tests", function () {
701
701
  month: "short",
702
702
  day: "numeric"
703
703
  };
704
- expect(getByRole("textbox").disabled).toBeTruthy();
705
- _context16.next = 7;
704
+ input = getByRole("textbox");
705
+ expect(input.disabled).toBeTruthy();
706
+ _context16.next = 8;
706
707
  return _userEvent["default"].click(calendarAction);
707
- case 7:
708
- expect(queryByText(d.toLocaleString("en-US", options))).toBeFalsy();
709
708
  case 8:
709
+ expect(queryByText(d.toLocaleString("en-US", options))).toBeFalsy();
710
+ case 9:
710
711
  case "end":
711
712
  return _context16.stop();
712
713
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -6,7 +6,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
6
6
  var _react = _interopRequireDefault(require("react"));
7
7
  var _react2 = require("@testing-library/react");
8
8
  var _axeHelper = require("../../test/accessibility/axe-helper.js");
9
- var _Dialog = _interopRequireDefault(require("./Dialog.tsx"));
9
+ var _Dialog = _interopRequireDefault(require("./Dialog"));
10
10
  describe("Dialog component accessibility tests", function () {
11
11
  it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
12
12
  var _render, baseElement, results;
@@ -11,7 +11,7 @@ import DxcHeading from "../heading/Heading";
11
11
  import DxcParagraph from "../paragraph/Paragraph";
12
12
  import DxcAlert from "../alert/Alert";
13
13
  import { userEvent, within } from "@storybook/testing-library";
14
- import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
14
+ import { INITIAL_VIEWPORTS } from "@storybook/addon-viewport";
15
15
 
16
16
  export default {
17
17
  title: "Dialog",
@@ -368,4 +368,3 @@ ScrollDialog.play = async ({ canvasElement }) => {
368
368
  await userEvent.tab();
369
369
  await userEvent.tab();
370
370
  };
371
-
@@ -0,0 +1 @@
1
+ export {};