@dxc-technology/halstack-react 0.0.0-ee92231 → 0.0.0-f0d662d

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 (203) hide show
  1. package/BackgroundColorContext.d.ts +10 -0
  2. package/BackgroundColorContext.js +1 -4
  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.js +2 -2
  8. package/accordion/Accordion.stories.tsx +307 -0
  9. package/accordion/types.d.ts +1 -1
  10. package/accordion-group/AccordionGroup.js +2 -2
  11. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  12. package/accordion-group/types.d.ts +1 -1
  13. package/alert/Alert.js +2 -2
  14. package/alert/Alert.stories.tsx +170 -0
  15. package/alert/types.d.ts +1 -1
  16. package/badge/Badge.js +1 -1
  17. package/bleed/Bleed.d.ts +3 -0
  18. package/bleed/Bleed.js +84 -0
  19. package/bleed/Bleed.stories.tsx +342 -0
  20. package/bleed/types.d.ts +13 -0
  21. package/bleed/types.js +5 -0
  22. package/box/Box.d.ts +1 -1
  23. package/box/Box.js +4 -7
  24. package/box/types.d.ts +0 -4
  25. package/button/Button.d.ts +1 -1
  26. package/button/Button.js +13 -19
  27. package/button/Button.stories.tsx +222 -241
  28. package/button/types.d.ts +5 -9
  29. package/card/Card.js +5 -6
  30. package/card/Card.stories.tsx +201 -0
  31. package/card/ice-cream.jpg +0 -0
  32. package/card/types.d.ts +4 -6
  33. package/checkbox/Checkbox.js +2 -2
  34. package/checkbox/types.d.ts +2 -2
  35. package/chip/Chip.d.ts +4 -0
  36. package/chip/Chip.js +5 -27
  37. package/chip/Chip.stories.tsx +121 -0
  38. package/chip/types.d.ts +53 -0
  39. package/chip/types.js +5 -0
  40. package/common/variables.js +70 -27
  41. package/date/Date.js +1 -1
  42. package/date-input/DateInput.js +10 -13
  43. package/date-input/DateInput.stories.tsx +138 -0
  44. package/dialog/Dialog.js +4 -3
  45. package/dialog/Dialog.stories.tsx +212 -0
  46. package/dropdown/Dropdown.js +1 -1
  47. package/dropdown/Dropdown.stories.tsx +247 -0
  48. package/dropdown/types.d.ts +1 -1
  49. package/file-input/FileInput.d.ts +4 -0
  50. package/file-input/FileInput.js +167 -109
  51. package/file-input/FileInput.stories.tsx +507 -0
  52. package/file-input/FileItem.d.ts +14 -0
  53. package/file-input/FileItem.js +12 -21
  54. package/file-input/types.d.ts +112 -0
  55. package/file-input/types.js +5 -0
  56. package/footer/Footer.d.ts +1 -1
  57. package/footer/Footer.js +28 -36
  58. package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
  59. package/footer/Icons.d.ts +2 -0
  60. package/footer/Icons.js +3 -3
  61. package/footer/types.d.ts +22 -18
  62. package/header/Header.js +2 -2
  63. package/header/Header.stories.tsx +162 -0
  64. package/header/Icons.d.ts +2 -0
  65. package/header/types.d.ts +4 -2
  66. package/heading/Heading.d.ts +4 -0
  67. package/heading/Heading.js +7 -24
  68. package/heading/Heading.stories.tsx +54 -0
  69. package/heading/types.d.ts +33 -0
  70. package/heading/types.js +5 -0
  71. package/input-text/InputText.js +2 -2
  72. package/inset/Inset.d.ts +3 -0
  73. package/inset/Inset.js +84 -0
  74. package/inset/Inset.stories.tsx +229 -0
  75. package/inset/types.d.ts +13 -0
  76. package/inset/types.js +5 -0
  77. package/layout/ApplicationLayout.d.ts +10 -0
  78. package/layout/ApplicationLayout.js +9 -19
  79. package/layout/ApplicationLayout.stories.tsx +171 -0
  80. package/layout/types.d.ts +57 -0
  81. package/layout/types.js +5 -0
  82. package/link/Link.js +3 -3
  83. package/link/Link.stories.tsx +146 -0
  84. package/list/List.d.ts +4 -0
  85. package/list/List.js +47 -0
  86. package/list/List.stories.tsx +95 -0
  87. package/list/types.d.ts +7 -0
  88. package/list/types.js +5 -0
  89. package/main.d.ts +7 -3
  90. package/main.js +34 -2
  91. package/number-input/NumberInput.d.ts +4 -0
  92. package/number-input/NumberInput.js +5 -50
  93. package/number-input/{NumberInput.stories.jsx → NumberInput.stories.tsx} +0 -0
  94. package/number-input/NumberInputContext.d.ts +4 -0
  95. package/number-input/NumberInputContext.js +5 -2
  96. package/number-input/numberInputContextTypes.d.ts +19 -0
  97. package/number-input/numberInputContextTypes.js +5 -0
  98. package/number-input/types.d.ts +117 -0
  99. package/number-input/types.js +5 -0
  100. package/package.json +4 -2
  101. package/paginator/Paginator.js +2 -8
  102. package/password-input/PasswordInput.js +19 -18
  103. package/password-input/PasswordInput.stories.tsx +3 -3
  104. package/password-input/types.d.ts +17 -10
  105. package/progress-bar/ProgressBar.js +4 -4
  106. package/radio/Radio.js +2 -2
  107. package/radio/types.d.ts +2 -2
  108. package/radio-group/Radio.d.ts +4 -0
  109. package/radio-group/Radio.js +140 -0
  110. package/radio-group/RadioGroup.d.ts +4 -0
  111. package/radio-group/RadioGroup.js +273 -0
  112. package/radio-group/RadioGroup.stories.tsx +79 -0
  113. package/radio-group/RadioGroup.test.js +248 -0
  114. package/radio-group/types.d.ts +36 -0
  115. package/radio-group/types.js +5 -0
  116. package/resultsetTable/ResultsetTable.d.ts +4 -0
  117. package/resultsetTable/ResultsetTable.js +5 -28
  118. package/resultsetTable/ResultsetTable.stories.tsx +275 -0
  119. package/resultsetTable/types.d.ts +67 -0
  120. package/resultsetTable/types.js +5 -0
  121. package/row/Row.d.ts +3 -0
  122. package/row/Row.js +127 -0
  123. package/row/Row.stories.tsx +237 -0
  124. package/row/types.d.ts +10 -0
  125. package/row/types.js +5 -0
  126. package/select/Select.d.ts +4 -0
  127. package/select/Select.js +20 -22
  128. package/select/Select.stories.tsx +572 -0
  129. package/select/types.d.ts +170 -0
  130. package/select/types.js +5 -0
  131. package/sidenav/Sidenav.d.ts +9 -0
  132. package/sidenav/Sidenav.js +6 -15
  133. package/sidenav/Sidenav.stories.tsx +182 -0
  134. package/sidenav/types.d.ts +50 -0
  135. package/sidenav/types.js +5 -0
  136. package/slider/Slider.d.ts +1 -1
  137. package/slider/Slider.js +43 -32
  138. package/slider/Slider.stories.tsx +177 -0
  139. package/slider/types.d.ts +2 -7
  140. package/spinner/Spinner.js +2 -2
  141. package/spinner/Spinner.stories.jsx +1 -0
  142. package/stack/Stack.d.ts +3 -0
  143. package/stack/Stack.js +97 -0
  144. package/stack/Stack.stories.tsx +164 -0
  145. package/stack/types.d.ts +9 -0
  146. package/stack/types.js +5 -0
  147. package/switch/Switch.js +2 -2
  148. package/switch/Switch.stories.tsx +1 -1
  149. package/table/Table.js +3 -3
  150. package/table/Table.stories.jsx +2 -1
  151. package/tabs/Tabs.js +11 -9
  152. package/tabs/Tabs.stories.tsx +120 -0
  153. package/tabs/types.d.ts +25 -18
  154. package/tag/Tag.d.ts +4 -0
  155. package/tag/Tag.js +4 -25
  156. package/tag/{Tag.stories.jsx → Tag.stories.tsx} +1 -1
  157. package/tag/types.d.ts +60 -0
  158. package/tag/types.js +5 -0
  159. package/text/Text.d.ts +7 -0
  160. package/text/Text.js +30 -0
  161. package/text/Text.stories.tsx +19 -0
  162. package/text-input/TextInput.d.ts +4 -0
  163. package/text-input/TextInput.js +54 -85
  164. package/text-input/TextInput.stories.tsx +456 -0
  165. package/text-input/types.d.ts +159 -0
  166. package/text-input/types.js +5 -0
  167. package/textarea/Textarea.d.ts +4 -0
  168. package/textarea/Textarea.js +27 -60
  169. package/textarea/Textarea.stories.jsx +4 -3
  170. package/textarea/types.d.ts +130 -0
  171. package/textarea/types.js +5 -0
  172. package/toggle/Toggle.js +1 -1
  173. package/toggle-group/ToggleGroup.d.ts +4 -0
  174. package/toggle-group/ToggleGroup.js +16 -45
  175. package/toggle-group/ToggleGroup.stories.tsx +173 -0
  176. package/toggle-group/types.d.ts +97 -0
  177. package/toggle-group/types.js +5 -0
  178. package/upload/buttons-upload/ButtonsUpload.js +2 -2
  179. package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
  180. package/upload/file-upload/FileToUpload.js +1 -1
  181. package/upload/files-upload/FilesToUpload.js +1 -1
  182. package/upload/transaction/Transaction.js +2 -2
  183. package/upload/transactions/Transactions.js +1 -1
  184. package/useTheme.d.ts +2 -0
  185. package/useTheme.js +1 -1
  186. package/wizard/Wizard.d.ts +4 -0
  187. package/wizard/Wizard.js +69 -59
  188. package/wizard/Wizard.stories.tsx +224 -0
  189. package/wizard/types.d.ts +60 -0
  190. package/wizard/types.js +5 -0
  191. package/chip/index.d.ts +0 -22
  192. package/file-input/index.d.ts +0 -81
  193. package/heading/index.d.ts +0 -17
  194. package/number-input/index.d.ts +0 -113
  195. package/resultsetTable/index.d.ts +0 -19
  196. package/select/index.d.ts +0 -131
  197. package/sidenav/index.d.ts +0 -13
  198. package/tag/index.d.ts +0 -24
  199. package/text-input/index.d.ts +0 -135
  200. package/textarea/index.d.ts +0 -117
  201. package/toggle-group/index.d.ts +0 -21
  202. package/wizard/Icons.js +0 -65
  203. package/wizard/index.d.ts +0 -18
@@ -0,0 +1,173 @@
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
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
14
+ <path d="M0 0h24v24H0V0z" fill="none" />
15
+ <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" />
16
+ </svg>
17
+ );
18
+ const gMobileSVG = (
19
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
20
+ <g>
21
+ <path d="M0,0h24v24H0V0z" fill="none" />
22
+ </g>
23
+ <g>
24
+ <g>
25
+ <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" />
26
+ </g>
27
+ </g>
28
+ </svg>
29
+ );
30
+ const wifiSVG = (
31
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
32
+ <path d="M0 0h24v24H0V0zm0 0h24v24H0V0z" fill="none" />
33
+ <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" />
34
+ </svg>
35
+ );
36
+
37
+ const options = [
38
+ {
39
+ value: 1,
40
+ label: "Facebook",
41
+ },
42
+ {
43
+ value: 2,
44
+ label: "Twitter",
45
+ },
46
+ {
47
+ value: 3,
48
+ label: "Linkedin",
49
+ },
50
+ ];
51
+ const optionsWithIcon = [
52
+ {
53
+ value: 1,
54
+ icon: wifiSVG,
55
+ },
56
+ {
57
+ value: 2,
58
+ icon: ethernetSVG,
59
+ },
60
+ {
61
+ value: 3,
62
+ icon: gMobileSVG,
63
+ },
64
+ ];
65
+ const optionsWithIconAndLabel = [
66
+ {
67
+ value: 1,
68
+ label: "Wi-fi",
69
+ icon: wifiSVG,
70
+ },
71
+ {
72
+ value: 2,
73
+ label: "Ethernet",
74
+ icon: ethernetSVG,
75
+ },
76
+ {
77
+ value: 3,
78
+ label: "3G Mobile",
79
+ icon: gMobileSVG,
80
+ },
81
+ ];
82
+ const twoOptions = [
83
+ {
84
+ value: 1,
85
+ label: "Facebook",
86
+ },
87
+ {
88
+ value: 2,
89
+ label: "Twitter",
90
+ },
91
+ ];
92
+ export const Chromatic = () => (
93
+ <>
94
+ <ExampleContainer>
95
+ <Title title="Basic toggle group" theme="light" level={4} />
96
+ <DxcToggleGroup label="Toggle group" helperText="HelperText" options={options} />
97
+ </ExampleContainer>
98
+ <ExampleContainer>
99
+ <Title title="Selected" theme="light" level={4} />
100
+ <DxcToggleGroup label="Selected" helperText="HelperText" value={2} options={options} />
101
+ </ExampleContainer>
102
+ <ExampleContainer>
103
+ <Title title="Icons toggle group" theme="light" level={4} />
104
+ <DxcToggleGroup label="Icons group" options={optionsWithIcon} />
105
+ </ExampleContainer>
106
+ <ExampleContainer>
107
+ <Title title="Icons & label toggle group" theme="light" level={4} />
108
+ <DxcToggleGroup label="Icons & label" options={optionsWithIconAndLabel} />
109
+ </ExampleContainer>
110
+ <ExampleContainer>
111
+ <Title title="Disabled" theme="light" level={4} />
112
+ <DxcToggleGroup label="Disabled" value={2} options={options} disabled />
113
+ </ExampleContainer>
114
+ <ExampleContainer pseudoState="pseudo-hover">
115
+ <Title title="Hovered" theme="light" level={4} />
116
+ <DxcToggleGroup label="Hovered" options={twoOptions} value={2} />
117
+ </ExampleContainer>
118
+ <ExampleContainer>
119
+ <Title title="Multiple toggleGroup" theme="light" level={4} />
120
+ <DxcToggleGroup
121
+ label="Toggle group"
122
+ helperText="Please select one or more"
123
+ options={options}
124
+ value={[1, 3]}
125
+ multiple
126
+ ></DxcToggleGroup>
127
+ </ExampleContainer>
128
+ <Title title="Margins" theme="light" level={2} />
129
+ <ExampleContainer>
130
+ <Title title="xxSmall" theme="light" level={4} />
131
+ <DxcToggleGroup label="xxSmall margin" options={options} margin="xxsmall" />
132
+ </ExampleContainer>
133
+ <ExampleContainer>
134
+ <Title title="xSmall" theme="light" level={4} />
135
+ <DxcToggleGroup label="xSmall margin" options={options} margin="xsmall" />
136
+ </ExampleContainer>
137
+ <ExampleContainer>
138
+ <Title title="Small" theme="light" level={4} />
139
+ <DxcToggleGroup label="Small margin" options={options} margin="small" />
140
+ </ExampleContainer>
141
+ <ExampleContainer>
142
+ <Title title="Medium" theme="light" level={4} />
143
+ <DxcToggleGroup label="Medium margin" options={options} margin="medium" />
144
+ </ExampleContainer>
145
+ <ExampleContainer>
146
+ <Title title="Large" theme="light" level={4} />
147
+ <DxcToggleGroup label="Large margin" options={options} margin="large" />
148
+ </ExampleContainer>
149
+ <ExampleContainer>
150
+ <Title title="xLarge" theme="light" level={4} />
151
+ <DxcToggleGroup label="xLarge margin" options={options} margin="xlarge" />
152
+ </ExampleContainer>
153
+ <ExampleContainer>
154
+ <Title title="xxLarge" theme="light" level={4} />
155
+ <DxcToggleGroup label="xxLarge margin" options={options} margin="xxlarge" />
156
+ </ExampleContainer>
157
+ </>
158
+ );
159
+ const OptionSelected = () => <DxcToggleGroup label="Toggle group" helperText="HelperText" options={options} />;
160
+
161
+ export const ToggleGroupSelectedActived = OptionSelected.bind({});
162
+ ToggleGroupSelectedActived.play = async ({ canvasElement }) => {
163
+ const canvas = within(canvasElement);
164
+ const option = canvas.getByText("Linkedin");
165
+ await userEvent.click(option);
166
+ };
167
+ export const ToggleGroupUnselectedActived = OptionSelected.bind({});
168
+ ToggleGroupUnselectedActived.play = async ({ canvasElement }) => {
169
+ const canvas = within(canvasElement);
170
+ const option = canvas.getByText("Twitter");
171
+ await userEvent.click(option);
172
+ userEvent.tab();
173
+ };
@@ -0,0 +1,97 @@
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>;
10
+ declare type OptionCommons = {
11
+ /**
12
+ * Number with the option inner value.
13
+ */
14
+ value: number;
15
+ };
16
+ declare type OptionIcon = OptionCommons & {
17
+ /**
18
+ * String with the option display value.
19
+ */
20
+ label?: string;
21
+ /**
22
+ * Element used as the icon. Icon and label can't be used at same time.
23
+ */
24
+ icon: string | SVG;
25
+ };
26
+ declare type OptionLabel = OptionCommons & {
27
+ /**
28
+ * String with the option display value.
29
+ */
30
+ label: string;
31
+ /**
32
+ * Element used as the icon. Icon and label can't be used at same time.
33
+ */
34
+ icon?: string | SVG;
35
+ };
36
+ declare type Option = OptionIcon | OptionLabel;
37
+ declare type CommonProps = {
38
+ /**
39
+ * Text to be placed above the component.
40
+ */
41
+ label?: string;
42
+ /**
43
+ * Helper text to be placed above the component.
44
+ */
45
+ helperText?: string;
46
+ /**
47
+ * If true, the component will be disabled.
48
+ */
49
+ disabled?: boolean;
50
+ /**
51
+ * An array of objects representing the selectable options.
52
+ */
53
+ options: Option[];
54
+ /**
55
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
56
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
57
+ */
58
+ margin?: Space | Margin;
59
+ /**
60
+ * Value of the tabindex.
61
+ */
62
+ tabIndex?: number;
63
+ };
64
+ declare type SingleSelectionToggle = CommonProps & {
65
+ /**
66
+ * 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.
67
+ */
68
+ multiple?: false;
69
+ /**
70
+ * The key of the selected value. If the component allows multiple selection, value must be an array.
71
+ * If undefined, the component will be uncontrolled and the value will be managed internally by the component.
72
+ */
73
+ value?: number;
74
+ /**
75
+ * This function will be called every time the selection changes. The number with the key of the selected
76
+ * value will be passed as a parameter to this function.
77
+ */
78
+ onChange?: (optionIndex: number) => void;
79
+ };
80
+ declare type MultipleSelectionToggle = CommonProps & {
81
+ /**
82
+ * 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.
83
+ */
84
+ multiple: true;
85
+ /**
86
+ * An array with the keys of the selected values.
87
+ * If undefined, the component will be uncontrolled and the value will be managed internally by the component.
88
+ */
89
+ value?: number[];
90
+ /**
91
+ * This function will be called every time the selection changes. An array with the key of
92
+ * the selected values will be passed as a parameter to this function.
93
+ */
94
+ onChange?: (optionIndex: number[]) => void;
95
+ };
96
+ declare type Props = SingleSelectionToggle | MultipleSelectionToggle;
97
+ 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,20 +19,68 @@ 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
- var _Icons = require("./Icons");
31
-
32
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
26
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
33
27
 
34
28
  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
29
 
36
30
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37
31
 
32
+ var icons = {
33
+ validIcon: /*#__PURE__*/_react["default"].createElement("svg", {
34
+ id: "check_circle_black_18dp",
35
+ xmlns: "http://www.w3.org/2000/svg",
36
+ width: "18",
37
+ height: "18",
38
+ viewBox: "0 0 18 18"
39
+ }, /*#__PURE__*/_react["default"].createElement("path", {
40
+ id: "Path_2946",
41
+ "data-name": "Path 2946",
42
+ d: "M0,0H18V18H0Z",
43
+ fill: "none"
44
+ }), /*#__PURE__*/_react["default"].createElement("path", {
45
+ id: "Path_2947",
46
+ "data-name": "Path 2947",
47
+ d: "M9.986,4a5.986,5.986,0,1,0,5.986,5.986A5.994,5.994,0,0,0,9.986,4Zm-1.5,9.727L5.5,10.734,6.551,9.679l1.938,1.93L13.42,6.679l1.055,1.063Z",
48
+ transform: "translate(-0.986 -0.986)",
49
+ fill: "#eafaef",
50
+ opacity: "0.999"
51
+ }), /*#__PURE__*/_react["default"].createElement("path", {
52
+ id: "Path_2948",
53
+ "data-name": "Path 2948",
54
+ d: "M9.493,2a7.493,7.493,0,1,0,7.493,7.493A7.5,7.5,0,0,0,9.493,2Zm0,13.487a5.994,5.994,0,1,1,5.994-5.994A6,6,0,0,1,9.493,15.487Zm3.439-9.306L7.994,11.119,6.054,9.186,5,10.242l3,3,5.994-5.994Z",
55
+ transform: "translate(-0.493 -0.493)",
56
+ fill: "#24a148"
57
+ })),
58
+ invalidIcon: /*#__PURE__*/_react["default"].createElement("svg", {
59
+ id: "highlight_off_black_18dp",
60
+ xmlns: "http://www.w3.org/2000/svg",
61
+ width: "18",
62
+ height: "18",
63
+ viewBox: "0 0 18 18"
64
+ }, /*#__PURE__*/_react["default"].createElement("path", {
65
+ id: "Path_2943",
66
+ "data-name": "Path 2943",
67
+ d: "M0,0H18V18H0Z",
68
+ fill: "none"
69
+ }), /*#__PURE__*/_react["default"].createElement("path", {
70
+ id: "Path_2944",
71
+ "data-name": "Path 2944",
72
+ d: "M10,4a6,6,0,1,0,6,6A6.01,6.01,0,0,0,10,4Zm3,7.945L11.945,13,10,11.06,8.059,13,7,11.945,8.944,10,7,8.059,8.059,7,10,8.944,11.945,7,13,8.059,11.06,10Z",
73
+ transform: "translate(-1.002 -1.002)",
74
+ fill: "#ffe6e9"
75
+ }), /*#__PURE__*/_react["default"].createElement("path", {
76
+ id: "Path_2945",
77
+ "data-name": "Path 2945",
78
+ d: "M11.444,6.5,9.5,8.443,7.558,6.5,6.5,7.558,8.443,9.5,6.5,11.444,7.558,12.5,9.5,10.558,11.444,12.5,12.5,11.444,10.558,9.5,12.5,7.558ZM9.5,2A7.5,7.5,0,1,0,17,9.5,7.494,7.494,0,0,0,9.5,2Zm0,13.5a6,6,0,1,1,6-6A6.009,6.009,0,0,1,9.5,15.5Z",
79
+ transform: "translate(-0.501 -0.501)",
80
+ fill: "#d0011b"
81
+ }))
82
+ };
83
+
38
84
  var DxcWizard = function DxcWizard(_ref) {
39
85
  var _ref$mode = _ref.mode,
40
86
  mode = _ref$mode === void 0 ? "horizontal" : _ref$mode,
@@ -68,11 +114,11 @@ var DxcWizard = function DxcWizard(_ref) {
68
114
  }, /*#__PURE__*/_react["default"].createElement(StepsContainer, {
69
115
  mode: mode,
70
116
  margin: margin
71
- }, steps.map(function (step, i) {
117
+ }, steps === null || steps === void 0 ? void 0 : steps.map(function (step, i) {
72
118
  return /*#__PURE__*/_react["default"].createElement(StepContainer, {
73
119
  key: "step".concat(i),
74
120
  mode: mode,
75
- lastStep: i === steps.length - 1
121
+ lastStep: i === (steps === null || steps === void 0 ? void 0 : steps.length) - 1
76
122
  }, /*#__PURE__*/_react["default"].createElement(Step, {
77
123
  tabIndex: tabIndex,
78
124
  onClick: function onClick() {
@@ -81,22 +127,19 @@ var DxcWizard = function DxcWizard(_ref) {
81
127
  mode: mode,
82
128
  disabled: step.disabled,
83
129
  first: i === 0,
84
- last: i === steps.length - 1
130
+ last: i === (steps === null || steps === void 0 ? void 0 : steps.length) - 1
85
131
  }, /*#__PURE__*/_react["default"].createElement(StepHeader, null, /*#__PURE__*/_react["default"].createElement(IconContainer, {
86
132
  current: i === renderedCurrent,
87
133
  visited: i < renderedCurrent,
88
134
  disabled: step.disabled
89
- }, step.icon ? /*#__PURE__*/_react["default"].createElement(StepIconContainer, {
135
+ }, step.icon ? typeof step.icon === "string" ? /*#__PURE__*/_react["default"].createElement(Icon, {
136
+ src: step.icon
137
+ }) : /*#__PURE__*/_react["default"].createElement(StepIconContainer, {
90
138
  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, {
95
- src: step.iconSrc
96
- }) : /*#__PURE__*/_react["default"].createElement(Number, {
139
+ }, (0, _typeof2["default"])(step.icon) === "object" ? step.icon : /*#__PURE__*/_react["default"].createElement(step.icon)) : /*#__PURE__*/_react["default"].createElement(Number, {
97
140
  disabled: step.disabled,
98
141
  current: i === renderedCurrent
99
- }, i + 1)), step.valid !== undefined ? step.valid ? /*#__PURE__*/_react["default"].createElement(ValidityIconContainer, null, _Icons.validIcon) : /*#__PURE__*/_react["default"].createElement(ValidityIconContainer, null, _Icons.invalidIcon) : ""), step.label || step.description ? /*#__PURE__*/_react["default"].createElement(InfoContainer, null, step.label ? /*#__PURE__*/_react["default"].createElement(Label, {
142
+ }, i + 1)), step.valid !== undefined ? step.valid ? /*#__PURE__*/_react["default"].createElement(ValidityIconContainer, null, icons.validIcon) : /*#__PURE__*/_react["default"].createElement(ValidityIconContainer, null, icons.invalidIcon) : ""), step.label || step.description ? /*#__PURE__*/_react["default"].createElement(InfoContainer, null, step.label ? /*#__PURE__*/_react["default"].createElement(Label, {
100
143
  disabled: step.disabled,
101
144
  visited: i <= innerCurrent
102
145
  }, step.label) : "", step.description ? /*#__PURE__*/_react["default"].createElement(Description, {
@@ -153,7 +196,7 @@ var IconContainer = _styledComponents["default"].div(_templateObject5 || (_templ
153
196
  }, function (props) {
154
197
  return props.disabled ? props.theme.disabledCircleHeight : props.current ? props.theme.selectedCircleHeight : props.theme.circleHeight;
155
198
  }, 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 ");
199
+ 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
200
  }, function (props) {
158
201
  return props.disabled ? "color: ".concat(props.theme.disabledFontColor, ";") : "color: ".concat(props.current ? props.theme.stepContainerSelectedFontColor : props.theme.stepContainerFontColor, ";");
159
202
  }, function (props) {
@@ -172,20 +215,7 @@ var StepIconContainer = _styledComponents["default"].div(_templateObject7 || (_t
172
215
  return props.theme.stepContainerIconSize;
173
216
  });
174
217
 
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) {
218
+ 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
219
  return props.theme.stepContainerFontSize;
190
220
  }, function (props) {
191
221
  return props.theme.stepContainerFontFamily;
@@ -197,11 +227,11 @@ var Number = _styledComponents["default"].p(_templateObject9 || (_templateObject
197
227
  return props.theme.stepContainerLetterSpacing;
198
228
  });
199
229
 
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"])));
230
+ 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
231
 
202
- var InfoContainer = _styledComponents["default"].div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: 12px;\n"])));
232
+ var InfoContainer = _styledComponents["default"].div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: 12px;\n"])));
203
233
 
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) {
234
+ 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
235
  return props.theme.labelTextAlign;
206
236
  }, function (props) {
207
237
  return props.theme.labelFontFamily;
@@ -219,7 +249,7 @@ var Label = _styledComponents["default"].p(_templateObject12 || (_templateObject
219
249
  return props.theme.labelFontTextTransform;
220
250
  });
221
251
 
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) {
252
+ 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
253
  return props.theme.descriptionTextAlign;
224
254
  }, function (props) {
225
255
  return props.theme.descriptionFontFamily;
@@ -237,7 +267,7 @@ var Description = _styledComponents["default"].p(_templateObject13 || (_template
237
267
  return props.disabled ? "color: ".concat(props.theme.disabledFontColor, ";") : "color: ".concat(props.visited ? props.theme.visitedDescriptionFontColor : props.theme.descriptionFontColor, ";");
238
268
  });
239
269
 
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) {
270
+ 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
271
  return props.mode === "horizontal" ? "" : "0";
242
272
  }, function (props) {
243
273
  return props.mode === "horizontal" ? "0" : "";
@@ -247,25 +277,5 @@ var StepSeparator = _styledComponents["default"].div(_templateObject14 || (_temp
247
277
  return "".concat(props.theme.separatorBorderStyle, " ").concat(props.theme.separatorBorderThickness, " ").concat(props.theme.separatorColor);
248
278
  });
249
279
 
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
280
  var _default = DxcWizard;
271
281
  exports["default"] = _default;