@dxc-technology/halstack-react 0.0.0-ebf4fe2 → 0.0.0-ec06b53

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 (179) hide show
  1. package/HalstackContext.js +7 -8
  2. package/accordion/Accordion.js +122 -103
  3. package/accordion/Accordion.stories.tsx +2 -3
  4. package/accordion/Accordion.test.js +9 -10
  5. package/accordion/types.d.ts +5 -4
  6. package/accordion-group/AccordionGroup.js +1 -21
  7. package/accordion-group/AccordionGroup.stories.tsx +27 -1
  8. package/accordion-group/AccordionGroup.test.js +20 -45
  9. package/accordion-group/types.d.ts +10 -3
  10. package/alert/Alert.js +1 -1
  11. package/bleed/Bleed.stories.tsx +63 -63
  12. package/box/Box.js +1 -1
  13. package/box/types.d.ts +1 -0
  14. package/bulleted-list/BulletedList.d.ts +7 -0
  15. package/bulleted-list/BulletedList.js +123 -0
  16. package/bulleted-list/BulletedList.stories.tsx +200 -0
  17. package/bulleted-list/types.d.ts +11 -0
  18. package/{inline → bulleted-list}/types.js +0 -0
  19. package/button/Button.js +43 -61
  20. package/button/Button.stories.tsx +9 -0
  21. package/button/types.d.ts +7 -7
  22. package/card/types.d.ts +1 -0
  23. package/checkbox/Checkbox.d.ts +2 -2
  24. package/checkbox/Checkbox.js +92 -99
  25. package/checkbox/Checkbox.stories.tsx +79 -59
  26. package/checkbox/Checkbox.test.js +93 -16
  27. package/checkbox/types.d.ts +6 -2
  28. package/chip/types.d.ts +1 -1
  29. package/common/variables.js +75 -33
  30. package/date-input/Calendar.d.ts +4 -0
  31. package/date-input/Calendar.js +258 -0
  32. package/date-input/DateInput.js +77 -222
  33. package/date-input/DateInput.stories.tsx +30 -17
  34. package/date-input/DateInput.test.js +411 -138
  35. package/date-input/DatePicker.d.ts +4 -0
  36. package/date-input/DatePicker.js +160 -0
  37. package/date-input/YearPicker.d.ts +4 -0
  38. package/date-input/YearPicker.js +115 -0
  39. package/date-input/types.d.ts +53 -0
  40. package/dialog/Dialog.js +52 -28
  41. package/dialog/Dialog.stories.tsx +57 -2
  42. package/dialog/Dialog.test.js +34 -4
  43. package/dialog/types.d.ts +3 -2
  44. package/dropdown/Dropdown.d.ts +1 -1
  45. package/dropdown/Dropdown.js +247 -247
  46. package/dropdown/Dropdown.stories.tsx +126 -63
  47. package/dropdown/Dropdown.test.js +504 -108
  48. package/dropdown/DropdownMenu.d.ts +4 -0
  49. package/dropdown/DropdownMenu.js +80 -0
  50. package/dropdown/DropdownMenuItem.d.ts +4 -0
  51. package/dropdown/DropdownMenuItem.js +92 -0
  52. package/dropdown/types.d.ts +25 -5
  53. package/file-input/FileInput.d.ts +2 -2
  54. package/file-input/FileInput.js +177 -219
  55. package/file-input/FileInput.stories.tsx +38 -10
  56. package/file-input/FileInput.test.js +53 -12
  57. package/file-input/FileItem.d.ts +4 -14
  58. package/file-input/FileItem.js +38 -63
  59. package/file-input/types.d.ts +17 -0
  60. package/flex/Flex.d.ts +4 -0
  61. package/flex/Flex.js +69 -0
  62. package/flex/Flex.stories.tsx +103 -0
  63. package/flex/types.d.ts +32 -0
  64. package/{list → flex}/types.js +0 -0
  65. package/footer/Footer.stories.tsx +8 -1
  66. package/footer/types.d.ts +2 -1
  67. package/header/Header.js +74 -72
  68. package/header/Header.stories.tsx +4 -4
  69. package/header/Icons.js +2 -2
  70. package/header/types.d.ts +3 -2
  71. package/inset/Inset.stories.tsx +4 -4
  72. package/layout/ApplicationLayout.d.ts +15 -6
  73. package/layout/ApplicationLayout.js +36 -64
  74. package/layout/ApplicationLayout.stories.tsx +80 -44
  75. package/layout/types.d.ts +17 -27
  76. package/link/Link.js +2 -2
  77. package/link/Link.stories.tsx +13 -6
  78. package/link/types.d.ts +1 -1
  79. package/main.d.ts +5 -9
  80. package/main.js +27 -59
  81. package/number-input/NumberInput.test.js +43 -7
  82. package/package.json +16 -20
  83. package/paginator/Paginator.js +2 -2
  84. package/paginator/Paginator.test.js +1 -1
  85. package/paragraph/Paragraph.d.ts +6 -0
  86. package/paragraph/Paragraph.js +38 -0
  87. package/paragraph/Paragraph.stories.tsx +44 -0
  88. package/password-input/PasswordInput.test.js +13 -12
  89. package/progress-bar/ProgressBar.d.ts +2 -2
  90. package/progress-bar/ProgressBar.js +56 -50
  91. package/progress-bar/ProgressBar.stories.jsx +3 -1
  92. package/progress-bar/ProgressBar.test.js +67 -22
  93. package/progress-bar/types.d.ts +3 -4
  94. package/quick-nav/QuickNav.js +18 -17
  95. package/quick-nav/QuickNav.stories.tsx +131 -26
  96. package/radio-group/Radio.d.ts +1 -1
  97. package/radio-group/Radio.js +43 -28
  98. package/radio-group/RadioGroup.js +23 -22
  99. package/radio-group/RadioGroup.stories.tsx +1 -0
  100. package/radio-group/RadioGroup.test.js +123 -96
  101. package/radio-group/types.d.ts +2 -2
  102. package/resultsetTable/Icons.d.ts +7 -0
  103. package/resultsetTable/Icons.js +51 -0
  104. package/resultsetTable/ResultsetTable.js +48 -107
  105. package/resultsetTable/ResultsetTable.stories.tsx +50 -25
  106. package/resultsetTable/ResultsetTable.test.js +23 -41
  107. package/resultsetTable/types.d.ts +2 -2
  108. package/select/Listbox.d.ts +1 -1
  109. package/select/Listbox.js +25 -2
  110. package/select/Select.js +17 -32
  111. package/select/Select.stories.tsx +6 -5
  112. package/select/Select.test.js +321 -250
  113. package/select/types.d.ts +2 -4
  114. package/sidenav/Sidenav.d.ts +6 -5
  115. package/sidenav/Sidenav.js +176 -55
  116. package/sidenav/Sidenav.stories.tsx +154 -156
  117. package/sidenav/Sidenav.test.js +25 -37
  118. package/sidenav/types.d.ts +50 -27
  119. package/slider/Slider.d.ts +2 -2
  120. package/slider/Slider.js +120 -95
  121. package/slider/Slider.stories.tsx +7 -1
  122. package/slider/Slider.test.js +121 -21
  123. package/slider/types.d.ts +6 -2
  124. package/switch/Switch.d.ts +2 -2
  125. package/switch/Switch.js +135 -68
  126. package/switch/Switch.stories.tsx +8 -30
  127. package/switch/Switch.test.js +144 -17
  128. package/switch/types.d.ts +6 -2
  129. package/table/Table.js +1 -1
  130. package/table/Table.test.js +1 -1
  131. package/tabs/Tab.d.ts +4 -0
  132. package/tabs/Tab.js +135 -0
  133. package/tabs/Tabs.js +360 -104
  134. package/tabs/Tabs.stories.tsx +74 -0
  135. package/tabs/Tabs.test.js +217 -6
  136. package/tabs/types.d.ts +15 -5
  137. package/tabs-nav/NavTabs.js +5 -5
  138. package/tabs-nav/Tab.js +3 -5
  139. package/tabs-nav/types.d.ts +1 -1
  140. package/tag/Tag.js +1 -1
  141. package/tag/types.d.ts +1 -1
  142. package/text-input/Icons.d.ts +8 -0
  143. package/text-input/Icons.js +60 -0
  144. package/text-input/Suggestion.js +7 -5
  145. package/text-input/Suggestions.d.ts +4 -0
  146. package/text-input/Suggestions.js +134 -0
  147. package/text-input/TextInput.js +189 -282
  148. package/text-input/TextInput.stories.tsx +189 -182
  149. package/text-input/TextInput.test.js +639 -727
  150. package/text-input/types.d.ts +22 -3
  151. package/toggle-group/types.d.ts +1 -1
  152. package/typography/Typography.d.ts +4 -0
  153. package/typography/Typography.js +131 -0
  154. package/typography/Typography.stories.tsx +198 -0
  155. package/typography/types.d.ts +18 -0
  156. package/{row → typography}/types.js +0 -0
  157. package/wizard/Wizard.js +9 -16
  158. package/wizard/Wizard.stories.tsx +20 -1
  159. package/wizard/types.d.ts +5 -4
  160. package/inline/Inline.d.ts +0 -4
  161. package/inline/Inline.js +0 -60
  162. package/inline/Inline.stories.tsx +0 -305
  163. package/inline/types.d.ts +0 -36
  164. package/list/List.d.ts +0 -4
  165. package/list/List.js +0 -47
  166. package/list/List.stories.tsx +0 -89
  167. package/list/types.d.ts +0 -7
  168. package/row/Row.d.ts +0 -3
  169. package/row/Row.js +0 -127
  170. package/row/Row.stories.tsx +0 -237
  171. package/row/types.d.ts +0 -28
  172. package/stack/Stack.d.ts +0 -4
  173. package/stack/Stack.js +0 -52
  174. package/stack/Stack.stories.tsx +0 -225
  175. package/stack/types.d.ts +0 -28
  176. package/stack/types.js +0 -5
  177. package/text/Text.d.ts +0 -7
  178. package/text/Text.js +0 -30
  179. package/text/Text.stories.tsx +0 -19
@@ -6,7 +6,7 @@ declare type Margin = {
6
6
  left?: Space;
7
7
  right?: Space;
8
8
  };
9
- declare type SVG = React.SVGProps<SVGSVGElement>;
9
+ declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
10
10
  declare type Action = {
11
11
  /**
12
12
  * This function will be called when the user clicks the action.
@@ -159,20 +159,39 @@ declare type Props = {
159
159
  */
160
160
  tabIndex?: number;
161
161
  };
162
+ /**
163
+ * List of suggestions of an Text Input component.
164
+ */
165
+ export declare type SuggestionsProps = {
166
+ id: string;
167
+ value: string;
168
+ suggestions: string[];
169
+ visualFocusIndex: number;
170
+ highlightedSuggestions: boolean;
171
+ searchHasErrors: boolean;
172
+ isSearching: boolean;
173
+ suggestionOnClick: (suggestion: string) => void;
174
+ getTextInputWidth: () => number;
175
+ };
162
176
  /**
163
177
  * Reference to the component.
164
178
  */
165
179
  export declare type RefType = HTMLDivElement;
166
180
  /**
167
- * Single suggestion of the Autosuggest Text Input component.
181
+ * Single suggestion of an Text Input component.
168
182
  */
169
183
  export declare type SuggestionProps = {
170
184
  id: string;
171
185
  value: string;
172
- onClick: () => void;
186
+ onClick: (suggestion: string) => void;
173
187
  suggestion: string;
174
188
  isLast: boolean;
175
189
  visuallyFocused: boolean;
176
190
  highlighted: boolean;
177
191
  };
192
+ export declare type AutosuggestWrapperProps = {
193
+ condition: boolean;
194
+ wrapper: (children: React.ReactNode) => JSX.Element;
195
+ children: React.ReactNode;
196
+ };
178
197
  export default Props;
@@ -6,7 +6,7 @@ declare type Margin = {
6
6
  left?: Space;
7
7
  right?: Space;
8
8
  };
9
- declare type SVG = React.SVGProps<SVGSVGElement>;
9
+ declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
10
10
  declare type OptionCommons = {
11
11
  /**
12
12
  * Number with the option inner value.
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import TypographyPropsTypes from "./types";
3
+ declare const Typography: ({ as, display, fontFamily, fontSize, fontStyle, fontWeight, letterSpacing, lineHeight, textAlign, color, textDecoration, textOverflow, whiteSpace, children, }: TypographyPropsTypes) => JSX.Element;
4
+ export default Typography;
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports["default"] = void 0;
11
+
12
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
+
14
+ var _react = _interopRequireWildcard(require("react"));
15
+
16
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
17
+
18
+ var _templateObject;
19
+
20
+ 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); }
21
+
22
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(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; }
23
+
24
+ var TypographyContext = /*#__PURE__*/_react["default"].createContext(null);
25
+
26
+ var Typography = function Typography(_ref) {
27
+ var as = _ref.as,
28
+ display = _ref.display,
29
+ fontFamily = _ref.fontFamily,
30
+ fontSize = _ref.fontSize,
31
+ fontStyle = _ref.fontStyle,
32
+ fontWeight = _ref.fontWeight,
33
+ letterSpacing = _ref.letterSpacing,
34
+ lineHeight = _ref.lineHeight,
35
+ textAlign = _ref.textAlign,
36
+ color = _ref.color,
37
+ textDecoration = _ref.textDecoration,
38
+ textOverflow = _ref.textOverflow,
39
+ whiteSpace = _ref.whiteSpace,
40
+ children = _ref.children;
41
+ var componentContext = (0, _react.useContext)(TypographyContext);
42
+ var asValue = as !== null && as !== void 0 ? as : (componentContext === null || componentContext === void 0 ? void 0 : componentContext.as) || "span";
43
+ var displayValue = display !== null && display !== void 0 ? display : (componentContext === null || componentContext === void 0 ? void 0 : componentContext.display) || "inline";
44
+ var fontFamilyValue = fontFamily !== null && fontFamily !== void 0 ? fontFamily : (componentContext === null || componentContext === void 0 ? void 0 : componentContext.fontFamily) || "Open Sans, sans-serif";
45
+ var fontSizeValue = fontSize !== null && fontSize !== void 0 ? fontSize : (componentContext === null || componentContext === void 0 ? void 0 : componentContext.fontSize) || "1rem";
46
+ var fontStyleValue = fontStyle !== null && fontStyle !== void 0 ? fontStyle : (componentContext === null || componentContext === void 0 ? void 0 : componentContext.fontStyle) || "normal";
47
+ var fontWeightValue = fontWeight !== null && fontWeight !== void 0 ? fontWeight : (componentContext === null || componentContext === void 0 ? void 0 : componentContext.fontWeight) || "400";
48
+ var letterSpacingValue = letterSpacing !== null && letterSpacing !== void 0 ? letterSpacing : (componentContext === null || componentContext === void 0 ? void 0 : componentContext.letterSpacing) || "0em";
49
+ var lineHeightValue = lineHeight !== null && lineHeight !== void 0 ? lineHeight : (componentContext === null || componentContext === void 0 ? void 0 : componentContext.lineHeight) || "1.5em";
50
+ var textAlignValue = textAlign !== null && textAlign !== void 0 ? textAlign : (componentContext === null || componentContext === void 0 ? void 0 : componentContext.textAlign) || "left";
51
+ var colorValue = color !== null && color !== void 0 ? color : (componentContext === null || componentContext === void 0 ? void 0 : componentContext.color) || "#000000";
52
+ var textDecorationValue = textDecoration !== null && textDecoration !== void 0 ? textDecoration : (componentContext === null || componentContext === void 0 ? void 0 : componentContext.textDecoration) || "none";
53
+ var textOverflowValue = textOverflow !== null && textOverflow !== void 0 ? textOverflow : (componentContext === null || componentContext === void 0 ? void 0 : componentContext.textOverflow) || "unset";
54
+ var whiteSpaceValue = whiteSpace !== null && whiteSpace !== void 0 ? whiteSpace : (componentContext === null || componentContext === void 0 ? void 0 : componentContext.whiteSpace) || "normal";
55
+ return /*#__PURE__*/_react["default"].createElement(TypographyContext.Provider, {
56
+ value: {
57
+ as: asValue,
58
+ display: displayValue,
59
+ fontFamily: fontFamilyValue,
60
+ fontSize: fontSizeValue,
61
+ fontStyle: fontStyleValue,
62
+ fontWeight: fontWeightValue,
63
+ letterSpacing: letterSpacingValue,
64
+ lineHeight: lineHeightValue,
65
+ textAlign: textAlignValue,
66
+ color: colorValue,
67
+ textDecoration: textDecorationValue,
68
+ textOverflow: textOverflowValue,
69
+ whiteSpace: whiteSpaceValue
70
+ }
71
+ }, /*#__PURE__*/_react["default"].createElement(StyledTypography, {
72
+ as: asValue,
73
+ display: displayValue,
74
+ fontFamily: fontFamilyValue,
75
+ fontSize: fontSizeValue,
76
+ fontStyle: fontStyleValue,
77
+ fontWeight: fontWeightValue,
78
+ letterSpacing: letterSpacingValue,
79
+ lineHeight: lineHeightValue,
80
+ textAlign: textAlignValue,
81
+ color: colorValue,
82
+ textDecoration: textDecorationValue,
83
+ textOverflow: textOverflowValue,
84
+ whiteSpace: whiteSpaceValue
85
+ }, children));
86
+ };
87
+
88
+ var StyledTypography = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0px;\n display: ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n text-align: ", ";\n line-height: ", ";\n text-decoration: ", ";\n text-overflow: ", ";\n white-space: ", ";\n overflow: ", ";\n"])), function (_ref2) {
89
+ var display = _ref2.display;
90
+ return display;
91
+ }, function (_ref3) {
92
+ var color = _ref3.color;
93
+ return color;
94
+ }, function (_ref4) {
95
+ var fontFamily = _ref4.fontFamily;
96
+ return fontFamily;
97
+ }, function (_ref5) {
98
+ var fontSize = _ref5.fontSize;
99
+ return fontSize;
100
+ }, function (_ref6) {
101
+ var fontStyle = _ref6.fontStyle;
102
+ return fontStyle;
103
+ }, function (_ref7) {
104
+ var fontWeight = _ref7.fontWeight;
105
+ return fontWeight;
106
+ }, function (_ref8) {
107
+ var letterSpacing = _ref8.letterSpacing;
108
+ return letterSpacing;
109
+ }, function (_ref9) {
110
+ var textAlign = _ref9.textAlign;
111
+ return textAlign;
112
+ }, function (_ref10) {
113
+ var lineHeight = _ref10.lineHeight;
114
+ return lineHeight;
115
+ }, function (_ref11) {
116
+ var textDecoration = _ref11.textDecoration;
117
+ return textDecoration;
118
+ }, function (_ref12) {
119
+ var textOverflow = _ref12.textOverflow;
120
+ return textOverflow;
121
+ }, function (_ref13) {
122
+ var whiteSpace = _ref13.whiteSpace,
123
+ textOverflow = _ref13.textOverflow;
124
+ return whiteSpace !== "normal" ? whiteSpace : textOverflow !== "unset" ? "nowrap" : "normal";
125
+ }, function (_ref14) {
126
+ var textOverflow = _ref14.textOverflow;
127
+ return textOverflow !== "unset" ? "hidden" : "visible";
128
+ });
129
+
130
+ var _default = Typography;
131
+ exports["default"] = _default;
@@ -0,0 +1,198 @@
1
+ import React from "react";
2
+ import Title from "../../.storybook/components/Title";
3
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
4
+ import DxcTypography from "./Typography";
5
+
6
+ export default {
7
+ title: "Typography",
8
+ component: DxcTypography,
9
+ };
10
+
11
+ export const Chromatic = () => (
12
+ <>
13
+ <ExampleContainer>
14
+ <Title title="Default Typography" theme="light" level={4} />
15
+ <DxcTypography>Default typography.</DxcTypography>
16
+ </ExampleContainer>
17
+ <ExampleContainer>
18
+ <Title title="Typography font sizes" theme="light" level={4} />
19
+ <DxcTypography display="block" fontSize="3.75rem">
20
+ 3.75rem.
21
+ </DxcTypography>
22
+ <DxcTypography display="block" fontSize="3rem">
23
+ 3rem.
24
+ </DxcTypography>
25
+ <DxcTypography display="block" fontSize="2rem">
26
+ 2rem.
27
+ </DxcTypography>
28
+ <DxcTypography display="block" fontSize="1.5rem">
29
+ 1.5rem.
30
+ </DxcTypography>
31
+ <DxcTypography display="block" fontSize="1.25rem">
32
+ 1.25rem.
33
+ </DxcTypography>
34
+ <DxcTypography display="block" fontSize="1rem">
35
+ 1rem.
36
+ </DxcTypography>
37
+ <DxcTypography display="block" fontSize="0.875rem">
38
+ 0.875rem.
39
+ </DxcTypography>
40
+ <DxcTypography display="block" fontSize="0.75rem">
41
+ 0.75rem.
42
+ </DxcTypography>
43
+ </ExampleContainer>
44
+ <ExampleContainer>
45
+ <Title title="Typography letter spacing" theme="light" level={4} />
46
+ <DxcTypography display="block" letterSpacing="-0.025em">
47
+ -0.025em.
48
+ </DxcTypography>
49
+ <DxcTypography display="block" letterSpacing="-0.0125em">
50
+ -0.0125em.
51
+ </DxcTypography>
52
+ <DxcTypography display="block" letterSpacing="0em">
53
+ 0em.
54
+ </DxcTypography>
55
+ <DxcTypography display="block" letterSpacing="0.025em">
56
+ 0.025em.
57
+ </DxcTypography>
58
+ <DxcTypography display="block" letterSpacing="0.05em">
59
+ 0.05em.
60
+ </DxcTypography>
61
+ <DxcTypography display="block" letterSpacing="0.1em">
62
+ 0.1em.
63
+ </DxcTypography>{" "}
64
+ </ExampleContainer>
65
+ <ExampleContainer>
66
+ <Title title="Typography line height" theme="light" level={4} />
67
+ <DxcTypography display="block" lineHeight="1em">
68
+ 1em.
69
+ </DxcTypography>
70
+ <DxcTypography display="block" lineHeight="1.25em">
71
+ 1.25em.
72
+ </DxcTypography>
73
+ <DxcTypography display="block" lineHeight="1.365em">
74
+ 1.365em.
75
+ </DxcTypography>
76
+ <DxcTypography display="block" lineHeight="1.5em">
77
+ 1.5em.
78
+ </DxcTypography>
79
+ <DxcTypography display="block" lineHeight="1.715em">
80
+ 1.715em.
81
+ </DxcTypography>
82
+ <DxcTypography display="block" lineHeight="2em">
83
+ 2em.
84
+ </DxcTypography>
85
+ </ExampleContainer>
86
+ <ExampleContainer>
87
+ <Title title="Typography font weight" theme="light" level={4} />
88
+ <DxcTypography display="block" fontWeight="300">
89
+ 300.
90
+ </DxcTypography>
91
+ <DxcTypography display="block" fontWeight="400">
92
+ 400.
93
+ </DxcTypography>
94
+ <DxcTypography display="block" fontWeight="600">
95
+ 600.
96
+ </DxcTypography>
97
+ <DxcTypography display="block" fontWeight="700">
98
+ 700.
99
+ </DxcTypography>
100
+ </ExampleContainer>
101
+ <ExampleContainer>
102
+ <Title title="Typography decoration" theme="light" level={4} />
103
+ <DxcTypography display="block" textDecoration="underline">
104
+ Underline.
105
+ </DxcTypography>
106
+ <DxcTypography display="block" textDecoration="line-through">
107
+ Line-through.
108
+ </DxcTypography>
109
+ </ExampleContainer>
110
+ <ExampleContainer>
111
+ <Title title="Typography font family" theme="light" level={4} />
112
+ <DxcTypography display="block" fontFamily="Open Sans, sans-serif">
113
+ Open Sans, sans-serif.
114
+ </DxcTypography>
115
+ <DxcTypography display="block" fontFamily="Source Code Pro, monospace">
116
+ Source Code Pro, monospace.
117
+ </DxcTypography>
118
+ </ExampleContainer>
119
+ <ExampleContainer>
120
+ <Title title="Typography font style" theme="light" level={4} />
121
+ <DxcTypography display="block" fontStyle="italic">
122
+ Italic.
123
+ </DxcTypography>
124
+ <DxcTypography display="block" fontStyle="normal">
125
+ Normal.
126
+ </DxcTypography>
127
+ </ExampleContainer>
128
+ <ExampleContainer>
129
+ <Title title="Typography align" theme="light" level={4} />
130
+ <DxcTypography display="block" textAlign="left">
131
+ Left.
132
+ </DxcTypography>
133
+ <DxcTypography display="block" textAlign="center">
134
+ Center.
135
+ </DxcTypography>
136
+ <DxcTypography display="block" textAlign="right">
137
+ Right.
138
+ </DxcTypography>
139
+ </ExampleContainer>
140
+ <ExampleContainer>
141
+ <Title title="Typography whitespace" theme="light" level={4} />
142
+ <div style={{ margin: "50px", border: "1px solid red", width: "125px" }}>
143
+ <DxcTypography whiteSpace="normal" fontSize="2rem">
144
+ {" "} Normal: A bunch of words you see.
145
+ </DxcTypography>
146
+ </div>
147
+ <div style={{ margin: "50px", border: "1px solid red", width: "125px" }}>
148
+ <DxcTypography whiteSpace="nowrap" fontSize="2rem">
149
+ {" "}No-wrap: A bunch of words you see.
150
+ </DxcTypography>
151
+ </div>
152
+ <div style={{ margin: "50px", border: "1px solid red", width: "125px" }}>
153
+ <DxcTypography whiteSpace="pre" fontSize="2rem">
154
+ {" "} pre: A bunch of words you see.
155
+ </DxcTypography>
156
+ </div>
157
+ <div style={{ margin: "50px", border: "1px solid red", width: "125px" }}>
158
+ <DxcTypography whiteSpace="pre-line" fontSize="2rem">
159
+ {" "}pre-line: A bunch of words you see.
160
+ </DxcTypography>
161
+ </div>
162
+ <div style={{ margin: "50px", border: "1px solid red", width: "125px" }}>
163
+ <DxcTypography whiteSpace="pre-wrap" fontSize="2rem">
164
+ {" "} pre-wrap: A bunch of words you see.
165
+ </DxcTypography>
166
+ </div>
167
+ </ExampleContainer>{" "}
168
+ <ExampleContainer>
169
+ <Title title="Typography display" theme="light" level={4} />
170
+ <DxcTypography display="block" textAlign="left">
171
+ Display Block.
172
+ <DxcTypography>A different text.</DxcTypography>
173
+ </DxcTypography>
174
+ <DxcTypography display="inline" textAlign="left">
175
+ Display Inline.
176
+ <DxcTypography>A different text.</DxcTypography>
177
+ </DxcTypography>
178
+ </ExampleContainer>
179
+ <ExampleContainer>
180
+ <Title title="Typography text-overflow" theme="light" level={4} />
181
+ <div style={{ width: "75px" }}>
182
+ <DxcTypography display="block" textOverflow="clip">
183
+ Overflow clip.
184
+ </DxcTypography>
185
+ </div>
186
+ <div style={{ width: "75px" }}>
187
+ <DxcTypography display="block" textOverflow="ellipsis">
188
+ Overflow ellipsis.
189
+ </DxcTypography>
190
+ </div>
191
+ <div style={{ width: "75px" }}>
192
+ <DxcTypography display="block" textOverflow="unset">
193
+ Overflow unset.
194
+ </DxcTypography>
195
+ </div>
196
+ </ExampleContainer>
197
+ </>
198
+ );
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ declare type Props = {
3
+ as?: keyof HTMLElementTagNameMap;
4
+ display?: "inline" | "block";
5
+ fontFamily?: "Open Sans, sans-serif" | "Source Code Pro, monospace";
6
+ fontSize?: "0.75rem" | "0.875rem" | "1rem" | "1.25rem" | "1.5rem" | "2rem" | "3rem" | "3.75rem";
7
+ fontStyle?: "italic" | "normal";
8
+ fontWeight?: "300" | "400" | "600" | "700";
9
+ letterSpacing?: "-0.025em" | "-0.0125em" | "0em" | "0.025em" | "0.05em" | "0.1em";
10
+ lineHeight?: "1em" | "1.25em" | "1.365em" | "1.5em" | "1.715em" | "2em";
11
+ textAlign?: "left" | "center" | "right";
12
+ color?: string;
13
+ textDecoration?: "none" | "underline" | "line-through";
14
+ textOverflow?: "clip" | "ellipsis" | "unset";
15
+ whiteSpace?: "normal" | "nowrap" | "pre" | "pre-line" | "pre-wrap";
16
+ children: React.ReactNode;
17
+ };
18
+ export default Props;
File without changes
package/wizard/Wizard.js CHANGED
@@ -139,14 +139,9 @@ var DxcWizard = function DxcWizard(_ref) {
139
139
  current: i === renderedCurrent,
140
140
  visited: i < renderedCurrent,
141
141
  disabled: step.disabled
142
- }, step.icon ? /*#__PURE__*/_react["default"].createElement(StepIconContainer, {
143
- disabled: step.disabled
144
- }, typeof step.icon === "string" ? /*#__PURE__*/_react["default"].createElement(Icon, {
142
+ }, step.icon ? /*#__PURE__*/_react["default"].createElement(StepIconContainer, null, typeof step.icon === "string" ? /*#__PURE__*/_react["default"].createElement(Icon, {
145
143
  src: step.icon
146
- }) : step.icon) : /*#__PURE__*/_react["default"].createElement(Number, {
147
- disabled: step.disabled,
148
- current: i === renderedCurrent
149
- }, 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, {
144
+ }) : step.icon) : /*#__PURE__*/_react["default"].createElement(Number, null, 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, {
150
145
  current: i === renderedCurrent,
151
146
  disabled: step.disabled,
152
147
  visited: i <= innerCurrent
@@ -160,7 +155,7 @@ var DxcWizard = function DxcWizard(_ref) {
160
155
  })));
161
156
  };
162
157
 
163
- var StepsContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: ", ";\n justify-content: \"center\";\n ", ";\n font-family: ", ";\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
158
+ var StepsContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: ", ";\n justify-content: center;\n ", ";\n font-family: ", ";\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
164
159
  return props.mode === "vertical" ? "column" : "row";
165
160
  }, function (props) {
166
161
  return props.mode === "vertical" && "height: 500px";
@@ -179,16 +174,16 @@ var StepsContainer = _styledComponents["default"].div(_templateObject || (_templ
179
174
  });
180
175
 
181
176
  var StepContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n ", "\n flex-grow: ", ";\n flex-direction: ", ";\n ", "\n"])), function (props) {
182
- return props.mode === "vertical" ? "" : "align-items: center;";
177
+ return props.mode !== "vertical" && "align-items: center;";
183
178
  }, function (props) {
184
179
  return props.lastStep ? "0" : "1";
185
180
  }, function (props) {
186
181
  return props.mode === "vertical" ? "column" : "row";
187
182
  }, function (props) {
188
- return props.mode === "vertical" ? "width: 100%;" : "";
183
+ return props.mode === "vertical" && "width: fit-content;";
189
184
  });
190
185
 
191
- var Step = _styledComponents["default"].button(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n border: none;\n background: inherit;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n margin: ", ";\n\n padding: 0px;\n ", ";\n\n &:hover {\n ", ";\n }\n &:focus {\n outline: ", " auto 1px;\n }\n"])), function (props) {
186
+ var Step = _styledComponents["default"].button(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: flex-start;\n align-items: center;\n border: none;\n border-radius: 0.25rem;\n background: inherit;\n margin: ", ";\n\n padding: 0px;\n ", ";\n\n &:hover {\n ", ";\n }\n &:focus {\n outline: 2px solid ", ";\n }\n"])), function (props) {
192
187
  return props.first ? props.mode === "vertical" ? "0 0 24px 0" : "0 24px 0 0" : props.last ? props.mode === "vertical" ? "24px 0 0 0" : "0 0 0 24px" : props.mode === "vertical" ? "24px 0" : "0 24px";
193
188
  }, function (props) {
194
189
  return props.disabled ? "cursor: not-allowed" : "";
@@ -278,12 +273,10 @@ var Description = _styledComponents["default"].p(_templateObject12 || (_template
278
273
  return props.disabled ? "color: ".concat(props.theme.disabledHelperTextFontColor, ";") : "color: ".concat(!props.visited ? props.theme.unvisitedHelperTextFontColor : props.current ? props.theme.selectedHelperTextFontColor : props.theme.visitedHelperTextFontColor, ";");
279
274
  });
280
275
 
281
- 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) {
282
- return props.mode === "horizontal" ? "" : "0";
283
- }, function (props) {
284
- return props.mode === "horizontal" ? "0" : "";
276
+ var StepSeparator = _styledComponents["default"].div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["\n ", ";\n ", "\n border: ", ";\n opacity: 1;\n flex-grow: 1;\n"])), function (props) {
277
+ return props.mode === "horizontal" ? "height: 0;" : "width: 0;";
285
278
  }, function (props) {
286
- return props.mode === "vertical" ? "margin: 0 18px;" : "";
279
+ return props.mode === "vertical" && "margin: 0 18px;";
287
280
  }, function (props) {
288
281
  return "".concat(props.theme.separatorBorderStyle, " ").concat(props.theme.separatorBorderThickness, " ").concat(props.theme.separatorColor);
289
282
  });
@@ -132,14 +132,28 @@ export const Chromatic = () => (
132
132
  <ExampleContainer>
133
133
  <Title title="Current step in the third step, labels and description" theme="light" level={4} />
134
134
  <DxcWizard defaultCurrentStep={2} steps={stepWithLabelDescription}></DxcWizard>
135
+ </ExampleContainer>
136
+ <ExampleContainer>
135
137
  <Title title="With long description in horizontal" theme="light" level={4} />
136
138
  <DxcWizard steps={stepWithLongDescription}></DxcWizard>
139
+ </ExampleContainer>
140
+ <ExampleContainer>
137
141
  <Title title="With long description in vertical" theme="light" level={4} />
138
142
  <DxcWizard mode="vertical" steps={stepWithLongDescription}></DxcWizard>
143
+ </ExampleContainer>
144
+ <ExampleContainer>
139
145
  <Title title="Disabled steps" theme="light" level={4} />
140
146
  <DxcWizard steps={stepDisabled}></DxcWizard>
147
+ </ExampleContainer>
148
+ <ExampleContainer pseudoState="pseudo-focus">
149
+ <Title title="Focused steps" theme="light" level={4} />
150
+ <DxcWizard steps={stepIcons}></DxcWizard>
151
+ </ExampleContainer>
152
+ <ExampleContainer>
141
153
  <Title title="With icons" theme="light" level={4} />
142
154
  <DxcWizard steps={stepIcons}></DxcWizard>
155
+ </ExampleContainer>
156
+ <ExampleContainer>
143
157
  <Title title="With large icons" theme="light" level={4} />
144
158
  <DxcWizard steps={stepLargeIcons}></DxcWizard>
145
159
  </ExampleContainer>
@@ -204,7 +218,12 @@ export const Chromatic = () => (
204
218
  </>
205
219
  );
206
220
 
207
- const WizardSelected = () => <DxcWizard steps={stepWithLabel}></DxcWizard>;
221
+ const WizardSelected = () => (
222
+ <ExampleContainer>
223
+ <Title title="Clicked step" theme="light" level={4} />
224
+ <DxcWizard steps={stepWithLabel} mode="vertical"></DxcWizard>
225
+ </ExampleContainer>
226
+ );
208
227
 
209
228
  export const WizardStepActived = WizardSelected.bind({});
210
229
  WizardStepActived.play = async ({ canvasElement }) => {
package/wizard/types.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  /// <reference types="react" />
2
- declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
- declare type Margin = {
2
+ export declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ export declare type Margin = {
4
4
  top?: Space;
5
5
  bottom?: Space;
6
6
  left?: Space;
7
7
  right?: Space;
8
8
  };
9
- declare type SVG = React.SVGProps<SVGSVGElement>;
9
+ declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
10
10
  declare type Step = {
11
11
  /**
12
12
  * Step label.
@@ -29,11 +29,12 @@ declare type Step = {
29
29
  */
30
30
  valid?: boolean;
31
31
  };
32
+ export declare type Mode = "horizontal" | "vertical";
32
33
  declare type Props = {
33
34
  /**
34
35
  * The wizard can be showed in horizontal or vertical.
35
36
  */
36
- mode?: "horizontal" | "vertical";
37
+ mode?: Mode;
37
38
  /**
38
39
  * Initially selected step, only when it is uncontrolled.
39
40
  */
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import InlineProps from "./types";
3
- declare const DxcInline: ({ wrap, alignX, alignY, as, divider, gutter, reverse, children, }: InlineProps) => JSX.Element;
4
- export default DxcInline;
package/inline/Inline.js DELETED
@@ -1,60 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
-
10
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
-
12
- var _react = _interopRequireDefault(require("react"));
13
-
14
- var _styledComponents = _interopRequireDefault(require("styled-components"));
15
-
16
- var _templateObject, _templateObject2;
17
-
18
- var DxcInline = function DxcInline(_ref) {
19
- var _ref$wrap = _ref.wrap,
20
- wrap = _ref$wrap === void 0 ? false : _ref$wrap,
21
- _ref$alignX = _ref.alignX,
22
- alignX = _ref$alignX === void 0 ? "start" : _ref$alignX,
23
- _ref$alignY = _ref.alignY,
24
- alignY = _ref$alignY === void 0 ? "stretch" : _ref$alignY,
25
- _ref$as = _ref.as,
26
- as = _ref$as === void 0 ? "div" : _ref$as,
27
- _ref$divider = _ref.divider,
28
- divider = _ref$divider === void 0 ? false : _ref$divider,
29
- _ref$gutter = _ref.gutter,
30
- gutter = _ref$gutter === void 0 ? "0rem" : _ref$gutter,
31
- _ref$reverse = _ref.reverse,
32
- reverse = _ref$reverse === void 0 ? false : _ref$reverse,
33
- children = _ref.children;
34
- return /*#__PURE__*/_react["default"].createElement(Inline, {
35
- wrap: wrap,
36
- as: as,
37
- alignX: alignX,
38
- alignY: alignY,
39
- gutter: gutter,
40
- reverse: reverse,
41
- divider: divider
42
- }, _react["default"].Children.map(children, function (child, index) {
43
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, child, divider && index !== _react["default"].Children.count(children) - 1 && /*#__PURE__*/_react["default"].createElement(Divider, null));
44
- }));
45
- };
46
-
47
- var Inline = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n ", "\n padding: 0px;\n margin: 0px;\n"])), function (_ref2) {
48
- var wrap = _ref2.wrap,
49
- alignX = _ref2.alignX,
50
- alignY = _ref2.alignY,
51
- gutter = _ref2.gutter,
52
- reverse = _ref2.reverse,
53
- divider = _ref2.divider;
54
- return "\n flex-wrap: ".concat(wrap ? "wrap" : "nowrap", ";\n flex-direction: ").concat(reverse ? "row-reverse" : "row", ";\n align-items: stretch;\n justify-content: ").concat(alignX === "start" || alignX === "end" ? "flex-".concat(alignX) : alignX, ";\n gap: ").concat(divider ? "calc(".concat(gutter, "/2 - 1px)") : gutter, ";\n\n & > * {\n align-self: ").concat(alignY === "start" || alignY === "end" ? "flex-".concat(alignY) : alignY, ";\n }\n ");
55
- });
56
-
57
- var Divider = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n width: 1px;\n background-color: #999999;\n align-self: stretch;\n"])));
58
-
59
- var _default = DxcInline;
60
- exports["default"] = _default;