@dxc-technology/halstack-react 0.0.0-8d998c7 → 0.0.0-9005464

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/accordion/types.d.ts +1 -1
  2. package/accordion-group/types.d.ts +1 -1
  3. package/alert/Alert.stories.tsx +170 -0
  4. package/box/Box.d.ts +4 -0
  5. package/box/Box.js +9 -32
  6. package/box/{Box.stories.jsx → Box.stories.tsx} +0 -0
  7. package/box/types.d.ts +47 -0
  8. package/box/types.js +5 -0
  9. package/button/Button.d.ts +1 -1
  10. package/button/Button.js +7 -12
  11. package/button/Button.stories.tsx +217 -234
  12. package/button/types.d.ts +10 -10
  13. package/checkbox/Checkbox.stories.tsx +192 -0
  14. package/common/variables.js +29 -21
  15. package/date-input/DateInput.stories.tsx +138 -0
  16. package/dialog/Dialog.d.ts +4 -0
  17. package/dialog/Dialog.js +4 -23
  18. package/dialog/types.d.ts +43 -0
  19. package/dialog/types.js +5 -0
  20. package/footer/Footer.stories.jsx +151 -0
  21. package/header/Header.d.ts +7 -0
  22. package/header/Header.js +26 -28
  23. package/header/Icons.js +2 -27
  24. package/header/types.d.ts +45 -0
  25. package/header/types.js +5 -0
  26. package/link/Link.d.ts +3 -0
  27. package/link/Link.js +1 -23
  28. package/link/Link.stories.tsx +70 -0
  29. package/link/types.d.ts +74 -0
  30. package/link/types.js +5 -0
  31. package/number-input/NumberInput.d.ts +4 -0
  32. package/number-input/NumberInput.js +2 -44
  33. package/number-input/NumberInput.stories.tsx +115 -0
  34. package/number-input/types.d.ts +117 -0
  35. package/number-input/types.js +5 -0
  36. package/package.json +1 -1
  37. package/paginator/Paginator.stories.tsx +63 -0
  38. package/password-input/PasswordInput.d.ts +4 -0
  39. package/password-input/PasswordInput.js +0 -37
  40. package/password-input/{PasswordInput.stories.jsx → PasswordInput.stories.tsx} +1 -1
  41. package/password-input/types.d.ts +100 -0
  42. package/password-input/types.js +5 -0
  43. package/progress-bar/ProgressBar.js +1 -1
  44. package/progress-bar/ProgressBar.stories.jsx +58 -0
  45. package/radio/Radio.stories.tsx +192 -0
  46. package/select/Select.stories.tsx +572 -0
  47. package/select/index.d.ts +2 -2
  48. package/sidenav/Sidenav.d.ts +9 -0
  49. package/sidenav/Sidenav.js +4 -13
  50. package/sidenav/types.d.ts +50 -0
  51. package/sidenav/types.js +5 -0
  52. package/slider/Slider.d.ts +1 -1
  53. package/slider/Slider.js +39 -28
  54. package/slider/Slider.stories.tsx +172 -0
  55. package/slider/types.d.ts +2 -7
  56. package/spinner/Spinner.d.ts +4 -0
  57. package/spinner/Spinner.js +6 -23
  58. package/spinner/Spinner.stories.jsx +102 -0
  59. package/spinner/types.d.ts +32 -0
  60. package/spinner/types.js +5 -0
  61. package/switch/Switch.js +2 -2
  62. package/switch/Switch.stories.tsx +160 -0
  63. package/table/Table.d.ts +4 -0
  64. package/table/Table.stories.jsx +276 -0
  65. package/table/types.d.ts +21 -0
  66. package/table/types.js +5 -0
  67. package/tag/Tag.d.ts +4 -0
  68. package/tag/Tag.js +20 -35
  69. package/tag/Tag.stories.tsx +145 -0
  70. package/tag/types.d.ts +60 -0
  71. package/tag/types.js +5 -0
  72. package/text-input/index.d.ts +2 -2
  73. package/toggle-group/ToggleGroup.stories.tsx +178 -0
  74. package/wizard/Wizard.d.ts +4 -0
  75. package/wizard/Wizard.js +11 -51
  76. package/wizard/types.d.ts +64 -0
  77. package/wizard/types.js +5 -0
  78. package/box/index.d.ts +0 -25
  79. package/dialog/index.d.ts +0 -18
  80. package/header/index.d.ts +0 -25
  81. package/link/index.d.ts +0 -23
  82. package/number-input/index.d.ts +0 -113
  83. package/password-input/index.d.ts +0 -94
  84. package/sidenav/index.d.ts +0 -13
  85. package/spinner/index.d.ts +0 -17
  86. package/table/index.d.ts +0 -13
  87. package/tag/index.d.ts +0 -24
  88. package/wizard/index.d.ts +0 -18
@@ -0,0 +1,145 @@
1
+ import React from "react";
2
+ import { userEvent, within } from "@storybook/testing-library";
3
+ import Title from "../../.storybook/components/Title";
4
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
+ import DxcTag from "./Tag";
6
+
7
+ export default {
8
+ title: "Tag",
9
+ component: DxcTag,
10
+ };
11
+
12
+ const icon = () => {
13
+ return (
14
+ <svg viewBox="0 0 24 24" fill="currentColor">
15
+ <path d="M0 0h24v24H0z" fill="none" />
16
+ <path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" />
17
+ </svg>
18
+ );
19
+ };
20
+ const largeIcon = () => {
21
+ return (
22
+ <svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
23
+ <path d="M0 0h24v24H0V0z" fill="none" />
24
+ <path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z" />
25
+ </svg>
26
+ );
27
+ };
28
+
29
+ export const Chromatic = () => (
30
+ <>
31
+ <ExampleContainer>
32
+ <Title title="Without label" theme="light" level={4} />
33
+ <DxcTag />
34
+ </ExampleContainer>
35
+ <ExampleContainer>
36
+ <Title title="With icon" theme="light" level={4} />
37
+ <DxcTag icon={icon} />
38
+ </ExampleContainer>
39
+ <ExampleContainer>
40
+ <Title title="With large icon" theme="light" level={4} />
41
+ <DxcTag icon={largeIcon} />
42
+ </ExampleContainer>
43
+ <ExampleContainer>
44
+ <Title title="With label" theme="light" level={4} />
45
+ <DxcTag label="Tag" />
46
+ </ExampleContainer>
47
+ <ExampleContainer>
48
+ <Title title="With label and icon" theme="light" level={4} />
49
+ <DxcTag label="Tag" icon={icon} />
50
+ </ExampleContainer>
51
+ <ExampleContainer>
52
+ <Title title="With right icon" theme="light" level={4} />
53
+ <DxcTag label="Tag" icon={icon} labelPosition="before" />
54
+ </ExampleContainer>
55
+ <ExampleContainer>
56
+ <Title title="Icon background color" theme="light" level={4} />
57
+ <DxcTag label="Tag" icon={icon} iconBgColor="#fabada" />
58
+ </ExampleContainer>
59
+ <ExampleContainer pseudoState="pseudo-focus">
60
+ <Title title="With link focused" theme="light" level={4} />
61
+ <DxcTag icon={icon} label="Tag" linkHref="https://www.dxc.com" />
62
+ </ExampleContainer>
63
+ <ExampleContainer pseudoState="pseudo-focus">
64
+ <Title title="With action focused" theme="light" level={4} />
65
+ <DxcTag
66
+ icon={icon}
67
+ label="Tag"
68
+ onClick={() => {
69
+ console.log("click");
70
+ }}
71
+ />
72
+ </ExampleContainer>
73
+ <Title title="Margins" theme="light" level={2} />
74
+ <ExampleContainer>
75
+ <Title title="Xxsmall margin" theme="light" level={4} />
76
+ <DxcTag label="Xxsmall" margin="xxsmall" />
77
+ </ExampleContainer>
78
+ <ExampleContainer>
79
+ <Title title="Xsmall margin" theme="light" level={4} />
80
+ <DxcTag label="Xsmall" margin="xsmall" />
81
+ </ExampleContainer>
82
+ <ExampleContainer>
83
+ <Title title="Small margin" theme="light" level={4} />
84
+ <DxcTag label="Small" margin="small" />
85
+ </ExampleContainer>
86
+ <ExampleContainer>
87
+ <Title title="Medium margin" theme="light" level={4} />
88
+ <DxcTag label="Medium" margin="medium" />
89
+ </ExampleContainer>
90
+ <ExampleContainer>
91
+ <Title title="Large margin" theme="light" level={4} />
92
+ <DxcTag label="Large" margin="large" />
93
+ </ExampleContainer>
94
+ <ExampleContainer>
95
+ <Title title="Xlarge margin" theme="light" level={4} />
96
+ <DxcTag label="Xlarge" margin="xlarge" />
97
+ </ExampleContainer>
98
+ <ExampleContainer>
99
+ <Title title="Xxlarge margin" theme="light" level={4} />
100
+ <DxcTag label="Xxlarge" margin="xxlarge" />
101
+ </ExampleContainer>
102
+ <Title title="Sizes" theme="light" level={2} />
103
+ <ExampleContainer>
104
+ <Title title="Small size" theme="light" level={4} />
105
+ <DxcTag label="Small" size="small" />
106
+ </ExampleContainer>
107
+ <ExampleContainer>
108
+ <Title title="Medium size" theme="light" level={4} />
109
+ <DxcTag label="Medium size medium s" size="medium" />
110
+ </ExampleContainer>
111
+ <ExampleContainer>
112
+ <Title title="Medium size with ellipsis" theme="light" level={4} />
113
+ <DxcTag label="Medium size medium si medium" size="medium" />
114
+ </ExampleContainer>
115
+ <ExampleContainer>
116
+ <Title title="Large size" theme="light" level={4} />
117
+ <DxcTag label="Large size large size large size large size large size" size="large" />
118
+ </ExampleContainer>
119
+ <ExampleContainer>
120
+ <Title title="Large size with ellipsis" theme="light" level={4} />
121
+ <DxcTag label="Large size large size large size large size large size large size" size="large" />
122
+ </ExampleContainer>
123
+ <ExampleContainer>
124
+ <Title title="FillParent size" theme="light" level={4} />
125
+ <DxcTag label="FillParent" size="fillParent" />
126
+ </ExampleContainer>
127
+ <ExampleContainer>
128
+ <Title title="FitContent size" theme="light" level={4} />
129
+ <DxcTag label="FitContent" size="fitContent" />
130
+ </ExampleContainer>
131
+ </>
132
+ );
133
+
134
+ const LinkTag = () => (
135
+ <ExampleContainer>
136
+ <Title title="Hover link tag" theme="light" level={4} />
137
+ <DxcTag label="Tag" icon={icon} linkHref="https://www.dxc.com" />
138
+ </ExampleContainer>
139
+ );
140
+
141
+ export const HoverLinkTag = LinkTag.bind({});
142
+ HoverLinkTag.play = async ({ canvasElement }) => {
143
+ const canvas = within(canvasElement);
144
+ await userEvent.hover(canvas.getByText("Tag"));
145
+ };
package/tag/types.d.ts ADDED
@@ -0,0 +1,60 @@
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 Props = {
11
+ /**
12
+ * Element used as the icon that will be placed next to the label.
13
+ */
14
+ icon?: SVG;
15
+ /**
16
+ * @deprecated URL of the icon.
17
+ */
18
+ iconSrc?: string;
19
+ /**
20
+ * Text to be placed next inside the tag.
21
+ */
22
+ label?: string;
23
+ /**
24
+ * If defined, the tag will be displayed as an anchor, using this prop as "href".
25
+ * Component will show some visual feedback on hover.
26
+ */
27
+ linkHref?: string;
28
+ /**
29
+ * If defined, the tag will be displayed as a button. This function will
30
+ * be called when the user clicks the tag. Component will show some
31
+ * visual feedback on hover.
32
+ */
33
+ onClick?: () => void;
34
+ /**
35
+ * Background color of the icon section of the tag.
36
+ */
37
+ iconBgColor?: string;
38
+ /**
39
+ * Whether the label should appear after or before the icon.
40
+ */
41
+ labelPosition?: "before" | "after";
42
+ /**
43
+ * If true, the page is opened in a new browser tab.
44
+ */
45
+ newWindow?: boolean;
46
+ /**
47
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
48
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
49
+ */
50
+ margin?: Space | Margin;
51
+ /**
52
+ * Size of the component.
53
+ */
54
+ size?: "small" | "medium" | "large" | "fillParent" | "fitContent";
55
+ /**
56
+ * Value of the tabindex attribute.
57
+ */
58
+ tabIndex?: number;
59
+ };
60
+ export default Props;
package/tag/types.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -6,10 +6,10 @@ type Margin = {
6
6
  left?: Space;
7
7
  right?: Space;
8
8
  };
9
- type SVG = string | (HTMLElement & SVGElement);
9
+ type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
10
10
  type Action = {
11
11
  onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
12
- icon: SVG;
12
+ icon: string | SVG;
13
13
  };
14
14
 
15
15
  type Props = {
@@ -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,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
24
  var _useTheme = _interopRequireDefault(require("../useTheme.js"));
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,
@@ -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;
@@ -0,0 +1,64 @@
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 Step = {
11
+ /**
12
+ * Step label.
13
+ */
14
+ label: string;
15
+ /**
16
+ * Description that will be placed next to the step.
17
+ */
18
+ description?: string;
19
+ /**
20
+ * Element used as the icon to be displayed in the step.
21
+ */
22
+ icon?: SVG;
23
+ /**
24
+ * @deprecated URL of the icon to be displayed in the step.
25
+ */
26
+ iconSrc?: string;
27
+ /**
28
+ * Whether the step is disabled or not.
29
+ */
30
+ disabled?: boolean;
31
+ /**
32
+ * Whether the step is valid or not.
33
+ */
34
+ valid?: boolean;
35
+ };
36
+ declare type Props = {
37
+ /**
38
+ * The wizard can be showed in horizontal or vertical.
39
+ */
40
+ mode?: "horizontal" | "vertical";
41
+ /**
42
+ * Defines which step is marked as the current. The numeration starts in 0.
43
+ */
44
+ currentStep?: number;
45
+ /**
46
+ * This function will be called when the user clicks a step. The step
47
+ * number will be passed as a parameter.
48
+ */
49
+ onStepClick?: (newCurrentStep: number) => void;
50
+ /**
51
+ * An array of objects representing the steps.
52
+ */
53
+ steps: [Step, ...Step[]];
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 attribute that is given to all the steps.
61
+ */
62
+ tabIndex?: number;
63
+ };
64
+ export default Props;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/box/index.d.ts DELETED
@@ -1,25 +0,0 @@
1
- type Size = "small" | "medium" | "large" | "fillParent" | "fitContent";
2
- type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
- type Margin = {
4
- top?: Space;
5
- bottom?: Space;
6
- left?: Space;
7
- right?: Space;
8
- };
9
- type Padding = {
10
- top?: Space;
11
- bottom?: Space;
12
- left?: Space;
13
- right?: Space;
14
- };
15
-
16
-
17
- type Props = {
18
- shadowDepth?: 0 | 1 | 2;
19
- margin?: Space | Margin;
20
- padging?: Space | Padding;
21
- display: string;
22
- size: Size;
23
- };
24
-
25
- export default function DxcBox(props: Props): JSX.Element;
package/dialog/index.d.ts DELETED
@@ -1,18 +0,0 @@
1
- type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
2
- type Padding = {
3
- top?: Space;
4
- bottom?: Space;
5
- left?: Space;
6
- right?: Space;
7
- };
8
-
9
- type Props = {
10
- isCloseVisible?: boolean;
11
- onCloseClick?: void;
12
- overlay?: boolean;
13
- onBackgroundClick?: void;
14
- padding?: Padding,
15
- tabIndex?: number;
16
- };
17
-
18
- export default function DxcDialog(props: Props): JSX.Element;