@dxc-technology/halstack-react 0.0.0-d5ae9d7 → 0.0.0-d618bea

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 (216) hide show
  1. package/BackgroundColorContext.d.ts +10 -0
  2. package/BackgroundColorContext.js +1 -3
  3. package/ThemeContext.d.ts +15 -0
  4. package/ThemeContext.js +5 -8
  5. package/V3Select/V3Select.js +2 -2
  6. package/V3Textarea/V3Textarea.js +2 -2
  7. package/accordion/Accordion.d.ts +2 -2
  8. package/accordion/Accordion.js +2 -2
  9. package/accordion/types.d.ts +1 -1
  10. package/accordion-group/AccordionGroup.d.ts +7 -0
  11. package/accordion-group/AccordionGroup.js +59 -73
  12. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  13. package/accordion-group/types.d.ts +72 -0
  14. package/accordion-group/types.js +5 -0
  15. package/alert/Alert.js +2 -2
  16. package/alert/Alert.stories.tsx +170 -0
  17. package/alert/types.d.ts +1 -1
  18. package/badge/Badge.js +1 -1
  19. package/box/Box.d.ts +4 -0
  20. package/box/Box.js +6 -32
  21. package/box/Box.stories.tsx +132 -0
  22. package/box/types.d.ts +43 -0
  23. package/box/types.js +5 -0
  24. package/button/Button.d.ts +1 -1
  25. package/button/Button.js +9 -12
  26. package/button/Button.stories.tsx +217 -234
  27. package/button/types.d.ts +11 -11
  28. package/card/Card.d.ts +4 -0
  29. package/card/Card.js +17 -53
  30. package/card/Card.stories.tsx +201 -0
  31. package/card/ice-cream.jpg +0 -0
  32. package/card/types.d.ts +67 -0
  33. package/card/types.js +5 -0
  34. package/checkbox/Checkbox.js +2 -2
  35. package/checkbox/Checkbox.stories.tsx +192 -0
  36. package/checkbox/types.d.ts +3 -4
  37. package/chip/Chip.d.ts +4 -0
  38. package/chip/Chip.js +1 -23
  39. package/chip/Chip.stories.tsx +121 -0
  40. package/chip/types.d.ts +53 -0
  41. package/chip/types.js +5 -0
  42. package/common/variables.js +45 -38
  43. package/date/Date.js +1 -1
  44. package/date-input/DateInput.js +4 -7
  45. package/date-input/DateInput.stories.tsx +138 -0
  46. package/dialog/Dialog.d.ts +4 -0
  47. package/dialog/Dialog.js +6 -25
  48. package/dialog/Dialog.stories.tsx +212 -0
  49. package/dialog/types.d.ts +43 -0
  50. package/dialog/types.js +5 -0
  51. package/dropdown/Dropdown.d.ts +4 -0
  52. package/dropdown/Dropdown.js +8 -41
  53. package/dropdown/types.d.ts +89 -0
  54. package/dropdown/types.js +5 -0
  55. package/file-input/FileInput.d.ts +4 -0
  56. package/file-input/FileInput.js +65 -76
  57. package/file-input/FileItem.d.ts +14 -0
  58. package/file-input/FileItem.js +12 -21
  59. package/file-input/types.d.ts +112 -0
  60. package/file-input/types.js +5 -0
  61. package/footer/Footer.d.ts +4 -0
  62. package/footer/Footer.js +11 -42
  63. package/footer/Footer.stories.tsx +151 -0
  64. package/footer/types.d.ts +65 -0
  65. package/footer/types.js +5 -0
  66. package/header/Header.d.ts +7 -0
  67. package/header/Header.js +28 -30
  68. package/header/Header.stories.tsx +162 -0
  69. package/header/Icons.js +2 -27
  70. package/header/types.d.ts +47 -0
  71. package/header/types.js +5 -0
  72. package/heading/Heading.d.ts +4 -0
  73. package/heading/Heading.js +7 -24
  74. package/heading/Heading.stories.tsx +53 -0
  75. package/heading/types.d.ts +33 -0
  76. package/heading/types.js +5 -0
  77. package/input-text/InputText.js +2 -2
  78. package/layout/ApplicationLayout.d.ts +10 -0
  79. package/layout/ApplicationLayout.js +8 -18
  80. package/layout/ApplicationLayout.stories.tsx +171 -0
  81. package/layout/types.d.ts +57 -0
  82. package/layout/types.js +5 -0
  83. package/link/Link.d.ts +3 -0
  84. package/link/Link.js +4 -26
  85. package/link/Link.stories.tsx +146 -0
  86. package/link/types.d.ts +74 -0
  87. package/link/types.js +5 -0
  88. package/list/List.d.ts +7 -0
  89. package/list/List.js +37 -0
  90. package/list/List.stories.tsx +70 -0
  91. package/main.d.ts +7 -3
  92. package/main.js +34 -2
  93. package/number-input/NumberInput.d.ts +4 -0
  94. package/number-input/NumberInput.js +5 -50
  95. package/number-input/NumberInput.stories.tsx +115 -0
  96. package/number-input/NumberInputContext.d.ts +4 -0
  97. package/number-input/NumberInputContext.js +5 -2
  98. package/number-input/numberInputContextTypes.d.ts +19 -0
  99. package/number-input/numberInputContextTypes.js +5 -0
  100. package/number-input/types.d.ts +117 -0
  101. package/number-input/types.js +5 -0
  102. package/package.json +1 -1
  103. package/paginator/Paginator.js +2 -8
  104. package/paginator/Paginator.stories.tsx +63 -0
  105. package/password-input/PasswordInput.d.ts +4 -0
  106. package/password-input/PasswordInput.js +19 -55
  107. package/password-input/{PasswordInput.stories.jsx → PasswordInput.stories.tsx} +1 -1
  108. package/password-input/types.d.ts +107 -0
  109. package/password-input/types.js +5 -0
  110. package/progress-bar/ProgressBar.d.ts +4 -0
  111. package/progress-bar/ProgressBar.js +5 -23
  112. package/progress-bar/ProgressBar.stories.jsx +58 -0
  113. package/progress-bar/types.d.ts +37 -0
  114. package/progress-bar/types.js +5 -0
  115. package/radio/Radio.js +2 -2
  116. package/radio/Radio.stories.tsx +192 -0
  117. package/radio/types.d.ts +2 -2
  118. package/resultsetTable/ResultsetTable.d.ts +4 -0
  119. package/resultsetTable/ResultsetTable.js +4 -27
  120. package/resultsetTable/types.d.ts +67 -0
  121. package/resultsetTable/types.js +5 -0
  122. package/row/Row.d.ts +11 -0
  123. package/row/Row.js +124 -0
  124. package/row/Row.stories.tsx +223 -0
  125. package/select/Select.js +15 -17
  126. package/select/Select.stories.tsx +572 -0
  127. package/select/index.d.ts +4 -4
  128. package/sidenav/Sidenav.d.ts +9 -0
  129. package/sidenav/Sidenav.js +6 -15
  130. package/sidenav/Sidenav.stories.tsx +165 -0
  131. package/sidenav/types.d.ts +50 -0
  132. package/sidenav/types.js +5 -0
  133. package/slider/Slider.d.ts +4 -0
  134. package/slider/Slider.js +61 -84
  135. package/slider/Slider.stories.tsx +177 -0
  136. package/slider/types.d.ts +78 -0
  137. package/slider/types.js +5 -0
  138. package/spinner/Spinner.d.ts +4 -0
  139. package/spinner/Spinner.js +8 -25
  140. package/spinner/Spinner.stories.jsx +102 -0
  141. package/spinner/types.d.ts +32 -0
  142. package/spinner/types.js +5 -0
  143. package/stack/Stack.d.ts +10 -0
  144. package/stack/Stack.js +94 -0
  145. package/stack/Stack.stories.tsx +150 -0
  146. package/switch/Switch.js +4 -4
  147. package/switch/Switch.stories.tsx +160 -0
  148. package/table/Table.d.ts +4 -0
  149. package/table/Table.js +3 -3
  150. package/table/Table.stories.jsx +276 -0
  151. package/table/types.d.ts +21 -0
  152. package/table/types.js +5 -0
  153. package/tabs/Tabs.d.ts +4 -0
  154. package/tabs/Tabs.js +9 -55
  155. package/tabs/Tabs.stories.tsx +121 -0
  156. package/tabs/types.d.ts +70 -0
  157. package/tabs/types.js +5 -0
  158. package/tag/Tag.d.ts +4 -0
  159. package/tag/Tag.js +21 -36
  160. package/tag/Tag.stories.tsx +145 -0
  161. package/tag/types.d.ts +60 -0
  162. package/tag/types.js +5 -0
  163. package/text/Text.d.ts +7 -0
  164. package/text/Text.js +30 -0
  165. package/text/Text.stories.tsx +19 -0
  166. package/text-input/TextInput.d.ts +4 -0
  167. package/text-input/TextInput.js +42 -81
  168. package/text-input/TextInput.stories.tsx +456 -0
  169. package/text-input/types.d.ts +159 -0
  170. package/text-input/types.js +5 -0
  171. package/textarea/Textarea.js +29 -32
  172. package/textarea/Textarea.stories.jsx +135 -0
  173. package/textarea/index.d.ts +18 -8
  174. package/toggle/Toggle.js +1 -1
  175. package/toggle-group/ToggleGroup.d.ts +4 -0
  176. package/toggle-group/ToggleGroup.js +8 -34
  177. package/toggle-group/ToggleGroup.stories.tsx +178 -0
  178. package/toggle-group/types.d.ts +84 -0
  179. package/toggle-group/types.js +5 -0
  180. package/upload/buttons-upload/ButtonsUpload.js +2 -2
  181. package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
  182. package/upload/file-upload/FileToUpload.js +1 -1
  183. package/upload/files-upload/FilesToUpload.js +1 -1
  184. package/upload/transaction/Transaction.js +2 -2
  185. package/upload/transactions/Transactions.js +1 -1
  186. package/useTheme.d.ts +2 -0
  187. package/useTheme.js +1 -1
  188. package/wizard/Wizard.d.ts +4 -0
  189. package/wizard/Wizard.js +13 -53
  190. package/wizard/Wizard.stories.jsx +224 -0
  191. package/wizard/types.d.ts +64 -0
  192. package/wizard/types.js +5 -0
  193. package/accordion-group/index.d.ts +0 -16
  194. package/box/index.d.ts +0 -25
  195. package/card/index.d.ts +0 -22
  196. package/chip/index.d.ts +0 -22
  197. package/dialog/index.d.ts +0 -18
  198. package/dropdown/index.d.ts +0 -26
  199. package/file-input/index.d.ts +0 -81
  200. package/footer/index.d.ts +0 -25
  201. package/header/index.d.ts +0 -25
  202. package/heading/index.d.ts +0 -17
  203. package/link/index.d.ts +0 -23
  204. package/number-input/index.d.ts +0 -113
  205. package/password-input/index.d.ts +0 -94
  206. package/progress-bar/index.d.ts +0 -18
  207. package/resultsetTable/index.d.ts +0 -19
  208. package/sidenav/index.d.ts +0 -13
  209. package/slider/index.d.ts +0 -29
  210. package/spinner/index.d.ts +0 -17
  211. package/table/index.d.ts +0 -13
  212. package/tabs/index.d.ts +0 -19
  213. package/tag/index.d.ts +0 -24
  214. package/text-input/index.d.ts +0 -135
  215. package/toggle-group/index.d.ts +0 -21
  216. package/wizard/index.d.ts +0 -18
@@ -0,0 +1,178 @@
1
+ import React from "react";
2
+ import { userEvent, within } from "@storybook/testing-library";
3
+ import DxcToggleGroup from "./ToggleGroup";
4
+ import Title from "../../.storybook/components/Title";
5
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
6
+
7
+ export default {
8
+ title: "ToggleGroup",
9
+ component: DxcToggleGroup,
10
+ };
11
+
12
+ const ethernetSVG = () => {
13
+ return (
14
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
15
+ <path d="M0 0h24v24H0V0z" fill="none" />
16
+ <path d="M7.77 6.76L6.23 5.48.82 12l5.41 6.52 1.54-1.28L3.42 12l4.35-5.24zM7 13h2v-2H7v2zm10-2h-2v2h2v-2zm-6 2h2v-2h-2v2zm6.77-7.52l-1.54 1.28L20.58 12l-4.35 5.24 1.54 1.28L23.18 12l-5.41-6.52z" />
17
+ </svg>
18
+ );
19
+ };
20
+ const gMobileSVG = () => {
21
+ return (
22
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
23
+ <g>
24
+ <path d="M0,0h24v24H0V0z" fill="none" />
25
+ </g>
26
+ <g>
27
+ <g>
28
+ <path d="M3,7v2h5v2H4v2h4v2H3v2h5c1.1,0,2-0.9,2-2v-1.5c0-0.83-0.67-1.5-1.5-1.5c0.83,0,1.5-0.67,1.5-1.5V9c0-1.1-0.9-2-2-2H3z M21,11v4c0,1.1-0.9,2-2,2h-5c-1.1,0-2-0.9-2-2V9c0-1.1,0.9-2,2-2h5c1.1,0,2,0.9,2,2h-7v6h5v-2h-2.5v-2H21z" />
29
+ </g>
30
+ </g>
31
+ </svg>
32
+ );
33
+ };
34
+ const wifiSVG = () => {
35
+ return (
36
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
37
+ <path d="M0 0h24v24H0V0zm0 0h24v24H0V0z" fill="none" />
38
+ <path d="M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z" />
39
+ </svg>
40
+ );
41
+ };
42
+ const options = [
43
+ {
44
+ value: 1,
45
+ label: "Facebook",
46
+ },
47
+ {
48
+ value: 2,
49
+ label: "Twitter",
50
+ },
51
+ {
52
+ value: 3,
53
+ label: "Linkedin",
54
+ },
55
+ ];
56
+ const optionsWithIcon = [
57
+ {
58
+ value: 1,
59
+ icon: wifiSVG,
60
+ },
61
+ {
62
+ value: 2,
63
+ icon: ethernetSVG,
64
+ },
65
+ {
66
+ value: 3,
67
+ icon: gMobileSVG,
68
+ },
69
+ ];
70
+ const optionsWithIconAndLabel = [
71
+ {
72
+ value: 1,
73
+ label: "Wi-fi",
74
+ icon: wifiSVG,
75
+ },
76
+ {
77
+ value: 2,
78
+ label: "Ethernet",
79
+ icon: ethernetSVG,
80
+ },
81
+ {
82
+ value: 3,
83
+ label: "3G Mobile",
84
+ icon: gMobileSVG,
85
+ },
86
+ ];
87
+ const twoOptions = [
88
+ {
89
+ value: 1,
90
+ label: "Facebook",
91
+ },
92
+ {
93
+ value: 2,
94
+ label: "Twitter",
95
+ },
96
+ ];
97
+ export const Chromatic = () => (
98
+ <>
99
+ <ExampleContainer>
100
+ <Title title="Basic toggle group" theme="light" level={4} />
101
+ <DxcToggleGroup label="Toggle group" helperText="HelperText" options={options} />
102
+ </ExampleContainer>
103
+ <ExampleContainer>
104
+ <Title title="Selected" theme="light" level={4} />
105
+ <DxcToggleGroup label="Selected" helperText="HelperText" value={2} options={options} />
106
+ </ExampleContainer>
107
+ <ExampleContainer>
108
+ <Title title="Icons toggle group" theme="light" level={4} />
109
+ <DxcToggleGroup label="Icons group" options={optionsWithIcon} />
110
+ </ExampleContainer>
111
+ <ExampleContainer>
112
+ <Title title="Icons & label toggle group" theme="light" level={4} />
113
+ <DxcToggleGroup label="Icons & label" options={optionsWithIconAndLabel} />
114
+ </ExampleContainer>
115
+ <ExampleContainer>
116
+ <Title title="Disabled" theme="light" level={4} />
117
+ <DxcToggleGroup label="Disabled" value={2} options={options} disabled />
118
+ </ExampleContainer>
119
+ <ExampleContainer pseudoState="pseudo-hover">
120
+ <Title title="Hovered" theme="light" level={4} />
121
+ <DxcToggleGroup label="Hovered" options={twoOptions} value={2} />
122
+ </ExampleContainer>
123
+ <ExampleContainer>
124
+ <Title title="Multiple toggleGroup" theme="light" level={4} />
125
+ <DxcToggleGroup
126
+ label="Toggle group"
127
+ helperText="Please select one or more"
128
+ options={options}
129
+ value={[1, 3]}
130
+ multiple
131
+ ></DxcToggleGroup>
132
+ </ExampleContainer>
133
+ <Title title="Margins" theme="light" level={2} />
134
+ <ExampleContainer>
135
+ <Title title="xxSmall" theme="light" level={4} />
136
+ <DxcToggleGroup label="xxSmall margin" options={options} margin="xxsmall" />
137
+ </ExampleContainer>
138
+ <ExampleContainer>
139
+ <Title title="xSmall" theme="light" level={4} />
140
+ <DxcToggleGroup label="xSmall margin" options={options} margin="xsmall" />
141
+ </ExampleContainer>
142
+ <ExampleContainer>
143
+ <Title title="Small" theme="light" level={4} />
144
+ <DxcToggleGroup label="Small margin" options={options} margin="small" />
145
+ </ExampleContainer>
146
+ <ExampleContainer>
147
+ <Title title="Medium" theme="light" level={4} />
148
+ <DxcToggleGroup label="Medium margin" options={options} margin="medium" />
149
+ </ExampleContainer>
150
+ <ExampleContainer>
151
+ <Title title="Large" theme="light" level={4} />
152
+ <DxcToggleGroup label="Large margin" options={options} margin="large" />
153
+ </ExampleContainer>
154
+ <ExampleContainer>
155
+ <Title title="xLarge" theme="light" level={4} />
156
+ <DxcToggleGroup label="xLarge margin" options={options} margin="xlarge" />
157
+ </ExampleContainer>
158
+ <ExampleContainer>
159
+ <Title title="xxLarge" theme="light" level={4} />
160
+ <DxcToggleGroup label="xxLarge margin" options={options} margin="xxlarge" />
161
+ </ExampleContainer>
162
+ </>
163
+ );
164
+ const OptionSelected = () => <DxcToggleGroup label="Toggle group" helperText="HelperText" options={options} />;
165
+
166
+ export const ToggleGroupSelectedActived = OptionSelected.bind({});
167
+ ToggleGroupSelectedActived.play = async ({ canvasElement }) => {
168
+ const canvas = within(canvasElement);
169
+ const option = canvas.getByText("Linkedin");
170
+ await userEvent.click(option);
171
+ };
172
+ export const ToggleGroupUnselectedActived = OptionSelected.bind({});
173
+ ToggleGroupUnselectedActived.play = async ({ canvasElement }) => {
174
+ const canvas = within(canvasElement);
175
+ const option = canvas.getByText("Twitter");
176
+ await userEvent.click(option);
177
+ userEvent.tab();
178
+ };
@@ -0,0 +1,84 @@
1
+ /// <reference types="react" />
2
+ declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ declare type Margin = {
4
+ top?: Space;
5
+ bottom?: Space;
6
+ left?: Space;
7
+ right?: Space;
8
+ };
9
+ declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
10
+ declare type OptionCommons = {
11
+ /**
12
+ * Number with the option inner value.
13
+ */
14
+ value: string;
15
+ /**
16
+ * @deprecated URL of the icon that will be placed. IconSrc and label can't be used at same time.
17
+ */
18
+ iconSrc?: string;
19
+ };
20
+ declare type OptionIcon = OptionCommons & {
21
+ /**
22
+ * String with the option display value.
23
+ */
24
+ label?: string;
25
+ /**
26
+ * Element used as the icon. Icon and label can't be used at same time.
27
+ */
28
+ icon: SVG;
29
+ };
30
+ declare type OptionLabel = OptionCommons & {
31
+ /**
32
+ * String with the option display value.
33
+ */
34
+ label: string;
35
+ /**
36
+ * Element used as the icon. Icon and label can't be used at same time.
37
+ */
38
+ icon?: SVG;
39
+ };
40
+ declare type Option = OptionIcon | OptionLabel;
41
+ declare type Props = {
42
+ /**
43
+ * Text to be placed above the component.
44
+ */
45
+ label?: string;
46
+ /**
47
+ * Helper text to be placed above the component.
48
+ */
49
+ helperText?: string;
50
+ /**
51
+ * The key(s) of the selected value(s). If the toggle group component doesn't allow multiple selection,
52
+ * it must be one unique value. If the component allows multiple selection, value must be an array.
53
+ * If undefined, the component will be uncontrolled and the value will be managed internally by the component.
54
+ */
55
+ value?: string | string[];
56
+ /**
57
+ * This function will be called every time the selection changes. The number with the key of the selected
58
+ * value will be passed as a parameter to this function.
59
+ * If multiple selection is allowed, an array of keys will be passed.
60
+ */
61
+ onChange?: (optionIndex: number | number[]) => void;
62
+ /**
63
+ * If true, the component will be disabled.
64
+ */
65
+ disabled?: boolean;
66
+ /**
67
+ * An array of objects representing the selectable options.
68
+ */
69
+ options: Option[];
70
+ /**
71
+ * If true, the toggle group will support multiple selection. In that case, value must be an array of numbers with the keys of the selected values.
72
+ */
73
+ multiple?: boolean;
74
+ /**
75
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
76
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
77
+ */
78
+ margin?: Space | Margin;
79
+ /**
80
+ * Value of the tabindex.
81
+ */
82
+ tabIndex?: number;
83
+ };
84
+ export default Props;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -21,9 +21,9 @@ var _Button = _interopRequireDefault(require("../../button/Button"));
21
21
 
22
22
  var _Icons = require("./Icons");
23
23
 
24
- var _useTheme = _interopRequireDefault(require("../../useTheme.js"));
24
+ var _useTheme = _interopRequireDefault(require("../../useTheme"));
25
25
 
26
- var _BackgroundColorContext = require("../../BackgroundColorContext.js");
26
+ var _BackgroundColorContext = require("../../BackgroundColorContext");
27
27
 
28
28
  var _templateObject, _templateObject2, _templateObject3;
29
29
 
@@ -23,9 +23,9 @@ var _Icons = require("./Icons");
23
23
 
24
24
  var _Button = _interopRequireDefault(require("../../button/Button"));
25
25
 
26
- var _useTheme = _interopRequireDefault(require("../../useTheme.js"));
26
+ var _useTheme = _interopRequireDefault(require("../../useTheme"));
27
27
 
28
- var _BackgroundColorContext = require("../../BackgroundColorContext.js");
28
+ var _BackgroundColorContext = require("../../BackgroundColorContext");
29
29
 
30
30
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
31
31
 
@@ -19,7 +19,7 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
19
19
 
20
20
  var _Icons = require("./Icons");
21
21
 
22
- var _useTheme = _interopRequireDefault(require("../../useTheme.js"));
22
+ var _useTheme = _interopRequireDefault(require("../../useTheme"));
23
23
 
24
24
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
25
25
 
@@ -21,7 +21,7 @@ var _FileToUpload = _interopRequireDefault(require("../file-upload/FileToUpload"
21
21
 
22
22
  var _ButtonsUpload = _interopRequireDefault(require("../buttons-upload/ButtonsUpload"));
23
23
 
24
- var _useTheme = _interopRequireDefault(require("../../useTheme.js"));
24
+ var _useTheme = _interopRequireDefault(require("../../useTheme"));
25
25
 
26
26
  var _templateObject, _templateObject2;
27
27
 
@@ -23,9 +23,9 @@ var _Icons = require("./Icons");
23
23
 
24
24
  var _Spinner = _interopRequireDefault(require("../../spinner/Spinner"));
25
25
 
26
- var _useTheme = _interopRequireDefault(require("../../useTheme.js"));
26
+ var _useTheme = _interopRequireDefault(require("../../useTheme"));
27
27
 
28
- var _BackgroundColorContext = require("../../BackgroundColorContext.js");
28
+ var _BackgroundColorContext = require("../../BackgroundColorContext");
29
29
 
30
30
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
31
31
 
@@ -19,7 +19,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
19
19
 
20
20
  var _Transaction = _interopRequireDefault(require("../transaction/Transaction"));
21
21
 
22
- var _useTheme = _interopRequireDefault(require("../../useTheme.js"));
22
+ var _useTheme = _interopRequireDefault(require("../../useTheme"));
23
23
 
24
24
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
25
25
 
package/useTheme.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const useTheme: () => any;
2
+ export default useTheme;
package/useTheme.js CHANGED
@@ -11,7 +11,7 @@ var _react = require("react");
11
11
 
12
12
  var _variables = require("./common/variables.js");
13
13
 
14
- var _ThemeContext = _interopRequireDefault(require("./ThemeContext.js"));
14
+ var _ThemeContext = _interopRequireDefault(require("./ThemeContext"));
15
15
 
16
16
  var useTheme = function useTheme() {
17
17
  var colorsTheme = (0, _react.useContext)(_ThemeContext["default"]);
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import WizardPropsType from "./types";
3
+ declare const DxcWizard: ({ mode, currentStep, onStepClick, steps, margin, tabIndex, }: WizardPropsType) => JSX.Element;
4
+ export default DxcWizard;
package/wizard/Wizard.js CHANGED
@@ -9,8 +9,6 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports["default"] = void 0;
11
11
 
12
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
-
14
12
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
13
 
16
14
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
@@ -21,15 +19,13 @@ var _react = _interopRequireWildcard(require("react"));
21
19
 
22
20
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
23
21
 
24
- var _propTypes = _interopRequireDefault(require("prop-types"));
25
-
26
22
  var _variables = require("../common/variables.js");
27
23
 
28
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
24
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
29
25
 
30
26
  var _Icons = require("./Icons");
31
27
 
32
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
28
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
33
29
 
34
30
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35
31
 
@@ -68,11 +64,11 @@ var DxcWizard = function DxcWizard(_ref) {
68
64
  }, /*#__PURE__*/_react["default"].createElement(StepsContainer, {
69
65
  mode: mode,
70
66
  margin: margin
71
- }, steps.map(function (step, i) {
67
+ }, steps === null || steps === void 0 ? void 0 : steps.map(function (step, i) {
72
68
  return /*#__PURE__*/_react["default"].createElement(StepContainer, {
73
69
  key: "step".concat(i),
74
70
  mode: mode,
75
- lastStep: i === steps.length - 1
71
+ lastStep: i === (steps === null || steps === void 0 ? void 0 : steps.length) - 1
76
72
  }, /*#__PURE__*/_react["default"].createElement(Step, {
77
73
  tabIndex: tabIndex,
78
74
  onClick: function onClick() {
@@ -81,17 +77,14 @@ var DxcWizard = function DxcWizard(_ref) {
81
77
  mode: mode,
82
78
  disabled: step.disabled,
83
79
  first: i === 0,
84
- last: i === steps.length - 1
80
+ last: i === (steps === null || steps === void 0 ? void 0 : steps.length) - 1
85
81
  }, /*#__PURE__*/_react["default"].createElement(StepHeader, null, /*#__PURE__*/_react["default"].createElement(IconContainer, {
86
82
  current: i === renderedCurrent,
87
83
  visited: i < renderedCurrent,
88
84
  disabled: step.disabled
89
85
  }, step.icon ? /*#__PURE__*/_react["default"].createElement(StepIconContainer, {
90
86
  disabled: step.disabled
91
- }, (0, _typeof2["default"])(step.icon) === "object" ? step.icon.type === "img" ? /*#__PURE__*/_react["default"].createElement(ImgContainer, {
92
- current: i === renderedCurrent,
93
- img: step.icon.props.src
94
- }) : step.icon : /*#__PURE__*/_react["default"].createElement(step.icon)) : step.iconSrc ? /*#__PURE__*/_react["default"].createElement(Icon, {
87
+ }, (0, _typeof2["default"])(step.icon) === "object" ? step.icon : /*#__PURE__*/_react["default"].createElement(step.icon)) : step.iconSrc ? /*#__PURE__*/_react["default"].createElement(Icon, {
95
88
  src: step.iconSrc
96
89
  }) : /*#__PURE__*/_react["default"].createElement(Number, {
97
90
  disabled: step.disabled,
@@ -153,7 +146,7 @@ var IconContainer = _styledComponents["default"].div(_templateObject5 || (_templ
153
146
  }, function (props) {
154
147
  return props.disabled ? props.theme.disabledCircleHeight : props.current ? props.theme.selectedCircleHeight : props.theme.circleHeight;
155
148
  }, function (props) {
156
- return "\n ".concat(!props.current && !props.disabled ? "border: ".concat(props.theme.circleBorderThickness, " ").concat(props.theme.circleBorderStyle, " ").concat(props.theme.circleBorderColor, ";") : props.current ? "border: ".concat(props.theme.selectedCircleBorderThickness, " ").concat(props.theme.selectedCircleBorderStyle, " ").concat(props.theme.selectedCircleBorderColor, ";") : props.disabled ? "border: ".concat(props.theme.disabledCircleBorderThickness, " ").concat(props.theme.disabledCircleBorderStyle, " ").concat(props.theme.disabledCircleBorderColor, ";") : "", "\n background: ").concat(props.disabled ? "".concat(props.theme.disabledBackgroundColor) : props.current ? "".concat(props.theme.stepContainerSelectedBackgroundColor) : "".concat(props.theme.stepContainerBackgroundColor), ";\n ");
149
+ return "\n ".concat(!props.current && !props.disabled ? "border: ".concat(props.theme.circleBorderThickness, " ").concat(props.theme.circleBorderStyle, " ").concat(props.theme.circleBorderColor, ";") : props.current && !props.disabled ? "border: ".concat(props.theme.selectedCircleBorderThickness, " ").concat(props.theme.selectedCircleBorderStyle, " ").concat(props.theme.selectedCircleBorderColor, ";") : props.disabled ? "border: ".concat(props.theme.disabledCircleBorderThickness, " ").concat(props.theme.disabledCircleBorderStyle, " ").concat(props.theme.disabledCircleBorderColor, ";") : "", "\n background: ").concat(props.disabled ? "".concat(props.theme.disabledBackgroundColor) : props.current ? "".concat(props.theme.stepContainerSelectedBackgroundColor) : "".concat(props.theme.stepContainerBackgroundColor), ";\n ");
157
150
  }, function (props) {
158
151
  return props.disabled ? "color: ".concat(props.theme.disabledFontColor, ";") : "color: ".concat(props.current ? props.theme.stepContainerSelectedFontColor : props.theme.stepContainerFontColor, ";");
159
152
  }, function (props) {
@@ -172,20 +165,7 @@ var StepIconContainer = _styledComponents["default"].div(_templateObject7 || (_t
172
165
  return props.theme.stepContainerIconSize;
173
166
  });
174
167
 
175
- var ImgContainer = _styledComponents["default"].div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n mask: url(", ") no-repeat center;\n mask-size: ", ";\n height: ", ";\n width: ", ";\n"])), function (props) {
176
- return props.current ? props.theme.stepContainerSelectedFontColor : props.theme.stepContainerFontColor;
177
- }, function (_ref2) {
178
- var img = _ref2.img;
179
- return img;
180
- }, function (props) {
181
- return "".concat(props.theme.stepContainerIconSize, " ").concat(props.theme.stepContainerIconSize);
182
- }, function (props) {
183
- return props.theme.stepContainerIconSize;
184
- }, function (props) {
185
- return props.theme.stepContainerIconSize;
186
- });
187
-
188
- var Number = _styledComponents["default"].p(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n opacity: 1;\n margin: 0px 0px 0px 1px;\n"])), function (props) {
168
+ var Number = _styledComponents["default"].p(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n opacity: 1;\n margin: 0px 0px 0px 1px;\n"])), function (props) {
189
169
  return props.theme.stepContainerFontSize;
190
170
  }, function (props) {
191
171
  return props.theme.stepContainerFontFamily;
@@ -197,11 +177,11 @@ var Number = _styledComponents["default"].p(_templateObject9 || (_templateObject
197
177
  return props.theme.stepContainerLetterSpacing;
198
178
  });
199
179
 
200
- var ValidityIconContainer = _styledComponents["default"].div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n width: 18px;\n height: 18px;\n position: absolute;\n top: 22.5px;\n left: 22.5px;\n"])));
180
+ var ValidityIconContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n width: 18px;\n height: 18px;\n position: absolute;\n top: 22.5px;\n left: 22.5px;\n"])));
201
181
 
202
- var InfoContainer = _styledComponents["default"].div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: 12px;\n"])));
182
+ var InfoContainer = _styledComponents["default"].div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: 12px;\n"])));
203
183
 
204
- var Label = _styledComponents["default"].p(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n text-align: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n ", ";\n text-transform: ", ";\n margin: 0;\n"])), function (props) {
184
+ var Label = _styledComponents["default"].p(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n text-align: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n ", ";\n text-transform: ", ";\n margin: 0;\n"])), function (props) {
205
185
  return props.theme.labelTextAlign;
206
186
  }, function (props) {
207
187
  return props.theme.labelFontFamily;
@@ -219,7 +199,7 @@ var Label = _styledComponents["default"].p(_templateObject12 || (_templateObject
219
199
  return props.theme.labelFontTextTransform;
220
200
  });
221
201
 
222
- var Description = _styledComponents["default"].p(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["\n text-align: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n text-transform: ", ";\n ", ";\n margin: 0;\n"])), function (props) {
202
+ var Description = _styledComponents["default"].p(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n text-align: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n text-transform: ", ";\n ", ";\n margin: 0;\n"])), function (props) {
223
203
  return props.theme.descriptionTextAlign;
224
204
  }, function (props) {
225
205
  return props.theme.descriptionFontFamily;
@@ -237,7 +217,7 @@ var Description = _styledComponents["default"].p(_templateObject13 || (_template
237
217
  return props.disabled ? "color: ".concat(props.theme.disabledFontColor, ";") : "color: ".concat(props.visited ? props.theme.visitedDescriptionFontColor : props.theme.descriptionFontColor, ";");
238
218
  });
239
219
 
240
- var StepSeparator = _styledComponents["default"].div(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n ", "\n border: ", ";\n opacity: 1;\n flex-grow: 1;\n"])), function (props) {
220
+ var StepSeparator = _styledComponents["default"].div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n ", "\n border: ", ";\n opacity: 1;\n flex-grow: 1;\n"])), function (props) {
241
221
  return props.mode === "horizontal" ? "" : "0";
242
222
  }, function (props) {
243
223
  return props.mode === "horizontal" ? "0" : "";
@@ -247,25 +227,5 @@ var StepSeparator = _styledComponents["default"].div(_templateObject14 || (_temp
247
227
  return "".concat(props.theme.separatorBorderStyle, " ").concat(props.theme.separatorBorderThickness, " ").concat(props.theme.separatorColor);
248
228
  });
249
229
 
250
- DxcWizard.propTypes = {
251
- mode: _propTypes["default"].oneOf(["horizontal", "vertical"]),
252
- currentStep: _propTypes["default"].number,
253
- onStepClick: _propTypes["default"].func,
254
- steps: _propTypes["default"].arrayOf(_propTypes["default"].shape({
255
- label: _propTypes["default"].string,
256
- description: _propTypes["default"].string,
257
- icon: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
258
- iconSrc: _propTypes["default"].string,
259
- disabled: _propTypes["default"].bool,
260
- valid: _propTypes["default"].bool
261
- })),
262
- margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
263
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
264
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
265
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
266
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
267
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
268
- tabIndex: _propTypes["default"].number
269
- };
270
230
  var _default = DxcWizard;
271
231
  exports["default"] = _default;