@dxc-technology/halstack-react 7.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 (109) hide show
  1. package/HalstackContext.js +98 -50
  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.d.ts +2 -2
  10. package/checkbox/Checkbox.js +16 -15
  11. package/checkbox/Checkbox.stories.tsx +131 -59
  12. package/checkbox/types.d.ts +4 -0
  13. package/chip/Chip.js +16 -22
  14. package/chip/Chip.stories.tsx +96 -9
  15. package/common/variables.js +286 -290
  16. package/date-input/Calendar.d.ts +4 -0
  17. package/date-input/Calendar.js +258 -0
  18. package/date-input/DateInput.js +134 -237
  19. package/date-input/DateInput.stories.tsx +199 -33
  20. package/date-input/DateInput.test.js +494 -138
  21. package/date-input/DatePicker.d.ts +4 -0
  22. package/date-input/DatePicker.js +146 -0
  23. package/date-input/Icons.d.ts +6 -0
  24. package/date-input/Icons.js +75 -0
  25. package/date-input/YearPicker.d.ts +4 -0
  26. package/date-input/YearPicker.js +126 -0
  27. package/date-input/types.d.ts +51 -0
  28. package/dialog/Dialog.js +60 -73
  29. package/dialog/Dialog.stories.tsx +211 -159
  30. package/dialog/Dialog.test.js +301 -2
  31. package/dropdown/Dropdown.js +35 -35
  32. package/dropdown/Dropdown.stories.tsx +210 -84
  33. package/dropdown/Dropdown.test.js +17 -22
  34. package/dropdown/DropdownMenu.js +8 -18
  35. package/dropdown/DropdownMenuItem.js +4 -15
  36. package/file-input/FileInput.d.ts +2 -2
  37. package/file-input/FileInput.js +169 -222
  38. package/file-input/FileInput.stories.tsx +122 -11
  39. package/file-input/FileInput.test.js +12 -53
  40. package/file-input/FileItem.d.ts +4 -14
  41. package/file-input/FileItem.js +39 -63
  42. package/file-input/types.d.ts +17 -0
  43. package/footer/Footer.stories.tsx +91 -0
  44. package/header/Header.js +18 -20
  45. package/header/Header.stories.tsx +149 -6
  46. package/link/Link.js +1 -1
  47. package/link/Link.stories.tsx +60 -0
  48. package/main.d.ts +1 -1
  49. package/main.js +1 -1
  50. package/{tabs-nav → nav-tabs}/NavTabs.js +1 -1
  51. package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +96 -6
  52. package/{tabs-nav → nav-tabs}/Tab.js +35 -15
  53. package/number-input/NumberInput.test.js +5 -6
  54. package/package.json +7 -12
  55. package/paginator/Icons.d.ts +5 -0
  56. package/paginator/Icons.js +16 -28
  57. package/paginator/Paginator.js +5 -11
  58. package/paginator/Paginator.stories.tsx +24 -0
  59. package/paginator/Paginator.test.js +17 -10
  60. package/progress-bar/ProgressBar.js +4 -4
  61. package/progress-bar/ProgressBar.stories.jsx +35 -2
  62. package/quick-nav/QuickNav.stories.tsx +14 -0
  63. package/radio-group/RadioGroup.stories.tsx +131 -18
  64. package/resultsetTable/Icons.d.ts +7 -0
  65. package/resultsetTable/Icons.js +51 -0
  66. package/resultsetTable/ResultsetTable.js +48 -105
  67. package/resultsetTable/ResultsetTable.stories.tsx +50 -25
  68. package/resultsetTable/ResultsetTable.test.js +40 -63
  69. package/resultsetTable/types.d.ts +2 -2
  70. package/select/Listbox.d.ts +1 -1
  71. package/select/Listbox.js +5 -34
  72. package/select/Option.js +11 -24
  73. package/select/Select.js +43 -24
  74. package/select/Select.stories.tsx +494 -150
  75. package/select/Select.test.js +17 -22
  76. package/select/types.d.ts +2 -2
  77. package/sidenav/Sidenav.js +8 -10
  78. package/sidenav/Sidenav.stories.tsx +148 -46
  79. package/slider/Slider.d.ts +2 -2
  80. package/slider/Slider.js +9 -8
  81. package/slider/Slider.stories.tsx +57 -0
  82. package/slider/types.d.ts +4 -0
  83. package/spinner/Spinner.js +2 -2
  84. package/spinner/Spinner.stories.jsx +27 -1
  85. package/switch/Switch.d.ts +3 -3
  86. package/switch/Switch.js +5 -4
  87. package/switch/Switch.stories.tsx +33 -0
  88. package/switch/types.d.ts +6 -1
  89. package/table/Table.stories.jsx +80 -1
  90. package/table/Table.test.js +1 -1
  91. package/tabs/Tab.js +3 -5
  92. package/tabs/Tabs.js +3 -3
  93. package/tabs/Tabs.stories.tsx +45 -5
  94. package/tag/Tag.stories.tsx +14 -1
  95. package/text-input/Suggestion.js +32 -5
  96. package/text-input/TextInput.js +7 -11
  97. package/text-input/TextInput.stories.tsx +92 -4
  98. package/text-input/TextInput.test.js +587 -634
  99. package/textarea/Textarea.stories.jsx +60 -1
  100. package/toggle-group/ToggleGroup.stories.tsx +42 -0
  101. package/utils/FocusLock.d.ts +13 -0
  102. package/utils/FocusLock.js +139 -0
  103. package/wizard/Wizard.stories.tsx +20 -0
  104. package/common/RequiredComponent.js +0 -32
  105. /package/{tabs-nav → nav-tabs}/NavTabs.d.ts +0 -0
  106. /package/{tabs-nav → nav-tabs}/NavTabs.test.js +0 -0
  107. /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
  108. /package/{tabs-nav → nav-tabs}/types.d.ts +0 -0
  109. /package/{tabs-nav → nav-tabs}/types.js +0 -0
@@ -11,6 +11,7 @@ import DxcFlex from "../flex/Flex";
11
11
  import Suggestions from "./Suggestions";
12
12
  import { ThemeProvider } from "styled-components";
13
13
  import useTheme from "../useTheme";
14
+ import { HalstackProvider } from "../HalstackContext";
14
15
 
15
16
  export default {
16
17
  title: "Text input",
@@ -27,7 +28,7 @@ const action = {
27
28
  ),
28
29
  };
29
30
 
30
- const actionLargeIcon = {
31
+ const actionLargeIconSVG = {
31
32
  onClick: () => {},
32
33
  icon: (
33
34
  <svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
@@ -37,6 +38,11 @@ const actionLargeIcon = {
37
38
  ),
38
39
  };
39
40
 
41
+ const actionLargeIconURL = {
42
+ onClick: () => {},
43
+ icon: "https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png",
44
+ };
45
+
40
46
  const country = ["Afghanistan"];
41
47
  const countries = [
42
48
  "Afghanistan",
@@ -61,8 +67,16 @@ const countries = [
61
67
  "Dominica",
62
68
  "Denmark",
63
69
  "Djibouti",
70
+ "*",
64
71
  ];
65
72
 
73
+ const opinionatedTheme = {
74
+ textInput: {
75
+ fontColor: "#000000",
76
+ hoverBorderColor: "#a46ede",
77
+ },
78
+ };
79
+
66
80
  export const Chromatic = () => (
67
81
  <>
68
82
  <ExampleContainer pseudoState="pseudo-hover">
@@ -98,12 +112,21 @@ export const Chromatic = () => (
98
112
  <DxcTextInput label="Text input" clearable defaultValue="Text" helperText="Help message" optional />
99
113
  </ExampleContainer>
100
114
  <ExampleContainer>
101
- <Title title="Clearable and large icon action" theme="light" level={4} />
115
+ <Title title="Clearable and large icon action (SVG)" theme="light" level={4} />
102
116
  <DxcTextInput
103
117
  label="Text input"
104
118
  defaultValue="Text text text text text text text text text text"
105
119
  clearable
106
- action={actionLargeIcon}
120
+ action={actionLargeIconSVG}
121
+ />
122
+ </ExampleContainer>
123
+ <ExampleContainer>
124
+ <Title title="Clearable and large icon action (URL)" theme="light" level={4} />
125
+ <DxcTextInput
126
+ label="Text input"
127
+ defaultValue="Text text text text text text text text text text"
128
+ clearable
129
+ action={actionLargeIconURL}
107
130
  />
108
131
  </ExampleContainer>
109
132
  <ExampleContainer>
@@ -297,6 +320,66 @@ export const Chromatic = () => (
297
320
  <Title title="FillParent size" theme="light" level={4} />
298
321
  <DxcTextInput label="FillParent" size="fillParent" />
299
322
  </ExampleContainer>
323
+ <Title title="Opinionated theme" theme="light" level={2} />
324
+ <ExampleContainer>
325
+ <HalstackProvider theme={opinionatedTheme}>
326
+ <ExampleContainer pseudoState="pseudo-hover">
327
+ <Title title="Hovered input" theme="light" level={4} />
328
+ <DxcTextInput label="Text input" helperText="Help message" />
329
+ </ExampleContainer>
330
+ <ExampleContainer pseudoState="pseudo-focus-within">
331
+ <Title title="Focused input" theme="light" level={4} />
332
+ <DxcTextInput label="Text input" helperText="Help message" />
333
+ </ExampleContainer>
334
+ <ExampleContainer pseudoState="pseudo-hover">
335
+ <Title title="Hovered action" theme="light" level={4} />
336
+ <DxcTextInput label="Text input" helperText="Help message" defaultValue="Text" clearable />
337
+ </ExampleContainer>
338
+ <ExampleContainer pseudoState="pseudo-active">
339
+ <Title title="Actived action" theme="light" level={4} />
340
+ <DxcTextInput label="Text input" helperText="Help message" action={action} clearable />
341
+ </ExampleContainer>
342
+ <ExampleContainer pseudoState="pseudo-focus">
343
+ <Title title="Focused action" theme="light" level={4} />
344
+ <DxcTextInput label="Text input" helperText="Help message" action={action} clearable />
345
+ </ExampleContainer>
346
+ <ExampleContainer>
347
+ <Title title="Prefix" theme="light" level={4} />
348
+ <DxcTextInput label="With prefix" prefix="+34" helperText="Help message" />
349
+ </ExampleContainer>
350
+ <ExampleContainer>
351
+ <Title title="Suffix and action" theme="light" level={4} />
352
+ <DxcTextInput label="With suffix" helperText="Help message" suffix="USD" action={action} />
353
+ </ExampleContainer>
354
+ <ExampleContainer>
355
+ <Title title="Invalid" theme="light" level={4} />
356
+ <DxcTextInput
357
+ label="Error text input"
358
+ helperText="Help message"
359
+ error="Error message."
360
+ defaultValue="Text"
361
+ clearable
362
+ optional
363
+ action={action}
364
+ />
365
+ </ExampleContainer>
366
+ <ExampleContainer>
367
+ <Title title="Disabled and placeholder" theme="light" level={4} />
368
+ <DxcTextInput label="Disabled text input" disabled placeholder="Placeholder" prefix="+34" suffix="USD" />
369
+ </ExampleContainer>
370
+ <ExampleContainer>
371
+ <Title title="Disabled, helper text, optional, value and action" theme="light" level={4} />
372
+ <DxcTextInput
373
+ label="Disabled text input"
374
+ helperText="Help message"
375
+ disabled
376
+ optional
377
+ defaultValue="Text"
378
+ action={action}
379
+ />
380
+ </ExampleContainer>
381
+ </HalstackProvider>
382
+ </ExampleContainer>
300
383
  </>
301
384
  );
302
385
 
@@ -308,7 +391,11 @@ const AutosuggestListbox = () => {
308
391
  <ExampleContainer>
309
392
  <Title title="Autosuggest listbox" theme="light" level={2} />
310
393
  <ExampleContainer>
311
- <Title title="List dialog uses a Radix Popover to appear over elements with a certain z-index" theme="light" level={3} />
394
+ <Title
395
+ title="List dialog uses a Radix Popover to appear over elements with a certain z-index"
396
+ theme="light"
397
+ level={3}
398
+ />
312
399
  <div
313
400
  style={{
314
401
  display: "flex",
@@ -322,6 +409,7 @@ const AutosuggestListbox = () => {
322
409
  borderRadius: "4px",
323
410
  overflow: "auto",
324
411
  zIndex: "1300",
412
+ position: "relative",
325
413
  }}
326
414
  >
327
415
  <DxcTextInput