@dxc-technology/halstack-react 0.0.0-dcd93c4 → 0.0.0-dcee34a

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 (200) hide show
  1. package/HalstackContext.js +98 -50
  2. package/accordion/Accordion.js +117 -104
  3. package/accordion/Accordion.stories.tsx +103 -15
  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/alert/Alert.stories.tsx +28 -0
  12. package/bleed/Bleed.stories.tsx +63 -63
  13. package/box/Box.js +1 -1
  14. package/box/Box.stories.tsx +15 -0
  15. package/box/types.d.ts +1 -0
  16. package/bulleted-list/BulletedList.d.ts +7 -0
  17. package/bulleted-list/BulletedList.js +123 -0
  18. package/bulleted-list/BulletedList.stories.tsx +200 -0
  19. package/bulleted-list/types.d.ts +11 -0
  20. package/button/Button.js +50 -70
  21. package/button/Button.stories.tsx +159 -8
  22. package/button/types.d.ts +7 -7
  23. package/card/types.d.ts +1 -0
  24. package/checkbox/Checkbox.d.ts +2 -2
  25. package/checkbox/Checkbox.js +92 -99
  26. package/checkbox/Checkbox.stories.tsx +131 -59
  27. package/checkbox/Checkbox.test.js +93 -16
  28. package/checkbox/types.d.ts +6 -2
  29. package/chip/Chip.js +16 -22
  30. package/chip/Chip.stories.tsx +96 -9
  31. package/chip/types.d.ts +1 -1
  32. package/common/variables.js +328 -260
  33. package/date-input/Calendar.d.ts +4 -0
  34. package/date-input/Calendar.js +258 -0
  35. package/date-input/DateInput.js +134 -237
  36. package/date-input/DateInput.stories.tsx +199 -33
  37. package/date-input/DateInput.test.js +494 -138
  38. package/date-input/DatePicker.d.ts +4 -0
  39. package/date-input/DatePicker.js +146 -0
  40. package/date-input/Icons.d.ts +6 -0
  41. package/date-input/Icons.js +75 -0
  42. package/date-input/YearPicker.d.ts +4 -0
  43. package/date-input/YearPicker.js +126 -0
  44. package/date-input/types.d.ts +51 -0
  45. package/dialog/Dialog.js +50 -28
  46. package/dialog/Dialog.stories.tsx +99 -22
  47. package/dialog/Dialog.test.js +34 -4
  48. package/dialog/types.d.ts +3 -2
  49. package/dropdown/Dropdown.d.ts +1 -1
  50. package/dropdown/Dropdown.js +246 -249
  51. package/dropdown/Dropdown.stories.tsx +245 -56
  52. package/dropdown/Dropdown.test.js +504 -108
  53. package/dropdown/DropdownMenu.d.ts +4 -0
  54. package/dropdown/DropdownMenu.js +70 -0
  55. package/dropdown/DropdownMenuItem.d.ts +4 -0
  56. package/dropdown/DropdownMenuItem.js +81 -0
  57. package/dropdown/types.d.ts +25 -5
  58. package/file-input/FileInput.d.ts +2 -2
  59. package/file-input/FileInput.js +177 -219
  60. package/file-input/FileInput.stories.tsx +122 -11
  61. package/file-input/FileInput.test.js +53 -12
  62. package/file-input/FileItem.d.ts +4 -14
  63. package/file-input/FileItem.js +38 -63
  64. package/file-input/types.d.ts +17 -0
  65. package/flex/Flex.d.ts +4 -0
  66. package/flex/Flex.js +69 -0
  67. package/flex/Flex.stories.tsx +103 -0
  68. package/flex/types.d.ts +32 -0
  69. package/footer/Footer.stories.tsx +99 -1
  70. package/footer/types.d.ts +2 -1
  71. package/header/Header.js +87 -87
  72. package/header/Header.stories.tsx +152 -9
  73. package/header/Icons.js +2 -2
  74. package/header/types.d.ts +3 -2
  75. package/inset/Inset.stories.tsx +4 -4
  76. package/layout/ApplicationLayout.d.ts +15 -6
  77. package/layout/ApplicationLayout.js +36 -64
  78. package/layout/ApplicationLayout.stories.tsx +80 -44
  79. package/layout/types.d.ts +17 -27
  80. package/link/Link.js +2 -2
  81. package/link/Link.stories.tsx +72 -5
  82. package/link/types.d.ts +1 -1
  83. package/main.d.ts +6 -10
  84. package/main.js +28 -60
  85. package/{tabs-nav → nav-tabs}/NavTabs.js +6 -6
  86. package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +96 -6
  87. package/{tabs-nav → nav-tabs}/Tab.js +37 -20
  88. package/{tabs-nav → nav-tabs}/types.d.ts +1 -1
  89. package/number-input/NumberInput.test.js +43 -7
  90. package/package.json +16 -21
  91. package/paginator/Icons.d.ts +5 -0
  92. package/paginator/Icons.js +16 -28
  93. package/paginator/Paginator.js +6 -12
  94. package/paginator/Paginator.stories.tsx +24 -0
  95. package/paginator/Paginator.test.js +18 -11
  96. package/paragraph/Paragraph.d.ts +6 -0
  97. package/paragraph/Paragraph.js +38 -0
  98. package/paragraph/Paragraph.stories.tsx +44 -0
  99. package/password-input/PasswordInput.test.js +13 -12
  100. package/progress-bar/ProgressBar.d.ts +2 -2
  101. package/progress-bar/ProgressBar.js +59 -53
  102. package/progress-bar/ProgressBar.stories.jsx +38 -3
  103. package/progress-bar/ProgressBar.test.js +67 -22
  104. package/progress-bar/types.d.ts +3 -4
  105. package/quick-nav/QuickNav.js +18 -17
  106. package/quick-nav/QuickNav.stories.tsx +145 -26
  107. package/radio-group/Radio.d.ts +1 -1
  108. package/radio-group/Radio.js +43 -28
  109. package/radio-group/RadioGroup.js +24 -24
  110. package/radio-group/RadioGroup.stories.tsx +132 -18
  111. package/radio-group/RadioGroup.test.js +123 -96
  112. package/radio-group/types.d.ts +2 -2
  113. package/resultsetTable/Icons.d.ts +7 -0
  114. package/resultsetTable/Icons.js +51 -0
  115. package/resultsetTable/ResultsetTable.js +48 -107
  116. package/resultsetTable/ResultsetTable.stories.tsx +50 -25
  117. package/resultsetTable/ResultsetTable.test.js +40 -63
  118. package/resultsetTable/types.d.ts +2 -2
  119. package/select/Listbox.js +4 -10
  120. package/select/Option.js +11 -24
  121. package/select/Select.js +54 -50
  122. package/select/Select.stories.tsx +494 -149
  123. package/select/Select.test.js +338 -272
  124. package/select/types.d.ts +3 -5
  125. package/sidenav/Sidenav.d.ts +6 -5
  126. package/sidenav/Sidenav.js +174 -55
  127. package/sidenav/Sidenav.stories.tsx +249 -149
  128. package/sidenav/Sidenav.test.js +25 -37
  129. package/sidenav/types.d.ts +50 -27
  130. package/slider/Slider.d.ts +2 -2
  131. package/slider/Slider.js +120 -95
  132. package/slider/Slider.stories.tsx +64 -1
  133. package/slider/Slider.test.js +121 -21
  134. package/slider/types.d.ts +6 -2
  135. package/spinner/Spinner.js +2 -2
  136. package/spinner/Spinner.stories.jsx +27 -1
  137. package/switch/Switch.d.ts +2 -2
  138. package/switch/Switch.js +135 -68
  139. package/switch/Switch.stories.tsx +41 -30
  140. package/switch/Switch.test.js +144 -17
  141. package/switch/types.d.ts +6 -2
  142. package/table/Table.js +1 -1
  143. package/table/Table.stories.jsx +80 -1
  144. package/table/Table.test.js +1 -1
  145. package/tabs/Tab.d.ts +4 -0
  146. package/tabs/Tab.js +133 -0
  147. package/tabs/Tabs.js +360 -104
  148. package/tabs/Tabs.stories.tsx +119 -5
  149. package/tabs/Tabs.test.js +217 -6
  150. package/tabs/types.d.ts +15 -5
  151. package/tag/Tag.js +1 -1
  152. package/tag/Tag.stories.tsx +14 -1
  153. package/tag/types.d.ts +1 -1
  154. package/text-input/Icons.d.ts +8 -0
  155. package/text-input/Icons.js +60 -0
  156. package/text-input/Suggestion.js +38 -9
  157. package/text-input/Suggestions.d.ts +4 -0
  158. package/text-input/Suggestions.js +134 -0
  159. package/text-input/TextInput.js +195 -292
  160. package/text-input/TextInput.stories.tsx +280 -185
  161. package/text-input/TextInput.test.js +737 -725
  162. package/text-input/types.d.ts +22 -3
  163. package/textarea/Textarea.stories.jsx +60 -1
  164. package/toggle-group/ToggleGroup.stories.tsx +42 -0
  165. package/toggle-group/types.d.ts +1 -1
  166. package/typography/Typography.d.ts +4 -0
  167. package/typography/Typography.js +131 -0
  168. package/typography/Typography.stories.tsx +198 -0
  169. package/typography/types.d.ts +18 -0
  170. package/wizard/Wizard.js +9 -16
  171. package/wizard/Wizard.stories.tsx +40 -1
  172. package/wizard/types.d.ts +5 -4
  173. package/common/RequiredComponent.js +0 -32
  174. package/inline/Inline.d.ts +0 -4
  175. package/inline/Inline.js +0 -60
  176. package/inline/Inline.stories.tsx +0 -319
  177. package/inline/types.d.ts +0 -36
  178. package/list/List.d.ts +0 -4
  179. package/list/List.js +0 -47
  180. package/list/List.stories.tsx +0 -89
  181. package/list/types.d.ts +0 -7
  182. package/row/Row.d.ts +0 -3
  183. package/row/Row.js +0 -127
  184. package/row/Row.stories.tsx +0 -237
  185. package/row/types.d.ts +0 -28
  186. package/stack/Stack.d.ts +0 -4
  187. package/stack/Stack.js +0 -56
  188. package/stack/Stack.stories.tsx +0 -263
  189. package/stack/types.d.ts +0 -32
  190. package/tabs-nav/types.js +0 -5
  191. package/text/Text.d.ts +0 -7
  192. package/text/Text.js +0 -30
  193. package/text/Text.stories.tsx +0 -19
  194. /package/{inline → bulleted-list}/types.js +0 -0
  195. /package/{list → flex}/types.js +0 -0
  196. /package/{tabs-nav → nav-tabs}/NavTabs.d.ts +0 -0
  197. /package/{tabs-nav → nav-tabs}/NavTabs.test.js +0 -0
  198. /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
  199. /package/{row → nav-tabs}/types.js +0 -0
  200. /package/{stack → typography}/types.js +0 -0
@@ -3,6 +3,7 @@ import DxcWizard from "./Wizard";
3
3
  import Title from "../../.storybook/components/Title";
4
4
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
5
  import { userEvent, within } from "@storybook/testing-library";
6
+ import { HalstackProvider } from "../HalstackContext";
6
7
 
7
8
  export default {
8
9
  title: "Wizard",
@@ -36,6 +37,7 @@ const stepWithLabel = [
36
37
  label: "Forth step",
37
38
  },
38
39
  ];
40
+
39
41
  const stepWithLabelDescription = [
40
42
  {
41
43
  label: "First step",
@@ -56,6 +58,7 @@ const stepWithLabelDescription = [
56
58
  valid: false,
57
59
  },
58
60
  ];
61
+
59
62
  const stepWithLongDescription = [
60
63
  {
61
64
  label: "First step",
@@ -73,6 +76,7 @@ const stepWithLongDescription = [
73
76
  "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. ",
74
77
  },
75
78
  ];
79
+
76
80
  const stepDisabled = [
77
81
  {
78
82
  label: "First step",
@@ -98,6 +102,7 @@ const stepDisabled = [
98
102
  disabled: true,
99
103
  },
100
104
  ];
105
+
101
106
  const stepIcons = [
102
107
  {
103
108
  label: "First step",
@@ -112,6 +117,7 @@ const stepIcons = [
112
117
  icon: favoriteSVG,
113
118
  },
114
119
  ];
120
+
115
121
  const stepLargeIcons = [
116
122
  {
117
123
  label: "First step",
@@ -127,19 +133,41 @@ const stepLargeIcons = [
127
133
  },
128
134
  ];
129
135
 
136
+ const opinionatedTheme = {
137
+ wizard: {
138
+ baseColor: "#5f249f",
139
+ fontColor: "#000000",
140
+ selectedStepFontColor: "#ffffff",
141
+ },
142
+ };
143
+
130
144
  export const Chromatic = () => (
131
145
  <>
132
146
  <ExampleContainer>
133
147
  <Title title="Current step in the third step, labels and description" theme="light" level={4} />
134
148
  <DxcWizard defaultCurrentStep={2} steps={stepWithLabelDescription}></DxcWizard>
149
+ </ExampleContainer>
150
+ <ExampleContainer>
135
151
  <Title title="With long description in horizontal" theme="light" level={4} />
136
152
  <DxcWizard steps={stepWithLongDescription}></DxcWizard>
153
+ </ExampleContainer>
154
+ <ExampleContainer>
137
155
  <Title title="With long description in vertical" theme="light" level={4} />
138
156
  <DxcWizard mode="vertical" steps={stepWithLongDescription}></DxcWizard>
157
+ </ExampleContainer>
158
+ <ExampleContainer>
139
159
  <Title title="Disabled steps" theme="light" level={4} />
140
160
  <DxcWizard steps={stepDisabled}></DxcWizard>
161
+ </ExampleContainer>
162
+ <ExampleContainer pseudoState="pseudo-focus">
163
+ <Title title="Focused steps" theme="light" level={4} />
164
+ <DxcWizard steps={stepIcons}></DxcWizard>
165
+ </ExampleContainer>
166
+ <ExampleContainer>
141
167
  <Title title="With icons" theme="light" level={4} />
142
168
  <DxcWizard steps={stepIcons}></DxcWizard>
169
+ </ExampleContainer>
170
+ <ExampleContainer>
143
171
  <Title title="With large icons" theme="light" level={4} />
144
172
  <DxcWizard steps={stepLargeIcons}></DxcWizard>
145
173
  </ExampleContainer>
@@ -201,10 +229,21 @@ export const Chromatic = () => (
201
229
  <Title title="Xxlarge margin" theme="light" level={4} />
202
230
  <DxcWizard mode="vertical" margin="xxlarge" steps={stepWithLabel}></DxcWizard>
203
231
  </ExampleContainer>
232
+ <Title title="Opinionated theme" theme="light" level={2} />
233
+ <ExampleContainer>
234
+ <HalstackProvider theme={opinionatedTheme}>
235
+ <DxcWizard defaultCurrentStep={2} steps={stepWithLabelDescription}></DxcWizard>
236
+ </HalstackProvider>
237
+ </ExampleContainer>
204
238
  </>
205
239
  );
206
240
 
207
- const WizardSelected = () => <DxcWizard steps={stepWithLabel}></DxcWizard>;
241
+ const WizardSelected = () => (
242
+ <ExampleContainer>
243
+ <Title title="Clicked step" theme="light" level={4} />
244
+ <DxcWizard steps={stepWithLabel} mode="vertical"></DxcWizard>
245
+ </ExampleContainer>
246
+ );
208
247
 
209
248
  export const WizardStepActived = WizardSelected.bind({});
210
249
  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,32 +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 _propTypes = _interopRequireDefault(require("prop-types"));
17
-
18
- var _templateObject;
19
-
20
- var DxcRequired = function DxcRequired(_ref) {
21
- var _ref$theme = _ref.theme,
22
- theme = _ref$theme === void 0 ? "light" : _ref$theme;
23
- return /*#__PURE__*/_react["default"].createElement(RequiredSpan, null, "*");
24
- };
25
-
26
- var RequiredSpan = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n color: #d0011b;\n margin-right: 1px;\n cursor: default;\n"])));
27
-
28
- DxcRequired.propTypes = {
29
- theme: _propTypes["default"].oneOf(["dark", "light"])
30
- };
31
- var _default = DxcRequired;
32
- exports["default"] = _default;
@@ -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 width: 100%;\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;
@@ -1,319 +0,0 @@
1
- import React from "react";
2
- import Title from "../../.storybook/components/Title";
3
- import styled from "styled-components";
4
- import DxcInline from "./Inline";
5
-
6
- export default {
7
- title: "Inline",
8
- component: DxcInline,
9
- };
10
-
11
- export const Chromatic = () => (
12
- <>
13
- <Title title="Default" theme="light" level={4} />
14
- <Container>
15
- <DxcInline>
16
- <Placeholder height="small" width="small" />
17
- <Placeholder height="medium" width="medium" />
18
- <Placeholder height="large" width="large" />
19
- <Placeholder height="small" width="large" />
20
- </DxcInline>
21
- </Container>
22
- <Title title="Default with divider" theme="light" level={4} />
23
- <Container>
24
- <DxcInline divider>
25
- <Placeholder height="small" width="small" />
26
- <Placeholder height="medium" width="medium" />
27
- <Placeholder height="large" width="large" />
28
- <Placeholder height="small" width="large" />
29
- <Placeholder height="large" width="large" />
30
- <Placeholder height="medium" width="small" />
31
- </DxcInline>
32
- </Container>
33
- <Title title="One child larger (width) than the container" theme="light" level={4} />
34
- <FlexContainer customWidth>
35
- <DxcInline>
36
- <Placeholder height="large" width="xlarge" />
37
- </DxcInline>
38
- </FlexContainer>
39
- <Title title="One child larger (min-width) than the container" theme="light" level={4} />
40
- <FlexContainer customWidth customHeight>
41
- <DxcInline>
42
- <MinSizePlaceholder height="medium" />
43
- </DxcInline>
44
- </FlexContainer>
45
- <Title title="Wrap" theme="light" level={4} />
46
- <Container customWidth>
47
- <DxcInline wrap>
48
- <Placeholder height="large" width="small" />
49
- <Placeholder height="large" width="medium" />
50
- <Placeholder height="medium" width="small" />
51
- <Placeholder height="large" width="medium" />
52
- </DxcInline>
53
- </Container>
54
- <Title title="Nowrap in a non-flex container" theme="light" level={4} />
55
- <Container customWidth>
56
- <DxcInline>
57
- <Placeholder height="large" width="small" />
58
- <Placeholder height="large" width="medium" />
59
- <Placeholder height="medium" width="small" />
60
- <Placeholder height="small" width="medium" />
61
- <Placeholder height="large" width="small" />
62
- <Placeholder height="medium" width="large" />
63
- <Placeholder height="small" width="medium" />
64
- </DxcInline>
65
- </Container>
66
- <Title title="Nowrap in a flex container" theme="light" level={4} />
67
- <FlexContainer customWidth>
68
- <DxcInline>
69
- <Placeholder height="large" width="small" />
70
- <Placeholder height="large" width="medium" />
71
- <Placeholder height="medium" width="small" />
72
- <Placeholder height="small" width="medium" />
73
- <Placeholder height="large" width="small" />
74
- <Placeholder height="medium" width="large" />
75
- <Placeholder height="small" width="medium" />
76
- </DxcInline>
77
- </FlexContainer>
78
- <Title title="AlignY = start" theme="light" level={4} />
79
- <Container>
80
- <DxcInline alignY="stretch">
81
- <Placeholder width="small" />
82
- <Placeholder height="medium" width="medium" />
83
- <Placeholder height="large" width="large" />
84
- <Placeholder height="small" width="large" />
85
- </DxcInline>
86
- </Container>
87
- <Title title="AlignY = end with divider" theme="light" level={4} />
88
- <Container>
89
- <DxcInline alignY="end" divider>
90
- <Placeholder height="small" width="small" />
91
- <Placeholder height="medium" width="medium" />
92
- <Placeholder height="large" width="large" />
93
- <Placeholder height="small" width="large" />
94
- </DxcInline>
95
- </Container>
96
- <Title title="AlignY = center" theme="light" level={4} />
97
- <Container>
98
- <DxcInline alignY="center">
99
- <Placeholder height="small" width="small" />
100
- <Placeholder height="medium" width="medium" />
101
- <Placeholder height="large" width="large" />
102
- <Placeholder height="small" width="large" />
103
- </DxcInline>
104
- </Container>
105
- <Title title="AlignY with wrapped items" theme="light" level={4} />
106
- <Container customWidth>
107
- <DxcInline alignY="end" wrap>
108
- <Placeholder height="large" width="small" />
109
- <Placeholder height="large" width="medium" />
110
- <Placeholder height="medium" width="small" />
111
- <Placeholder height="large" width="medium" />
112
- <Placeholder height="medium" width="small" />
113
- <Placeholder height="small" width="medium" />
114
- </DxcInline>
115
- </Container>
116
- <Title title="AlignY = baseline" theme="light" level={4} />
117
- <Container>
118
- <DxcInline alignY="baseline">
119
- <Placeholder height="small" width="small" />
120
- <Placeholder height="medium" width="medium" />
121
- <Placeholder height="large" width="large" />
122
- <Placeholder height="small" width="large" />
123
- </DxcInline>
124
- </Container>
125
- <Title title="AlignX = start" theme="light" level={4} />
126
- <Container>
127
- <DxcInline alignX="start">
128
- <Placeholder height="small" width="small" />
129
- <Placeholder height="medium" width="medium" />
130
- <Placeholder height="large" width="large" />
131
- <Placeholder height="small" />
132
- </DxcInline>
133
- </Container>
134
- <Title title="AlignX = end with divider" theme="light" level={4} />
135
- <Container>
136
- <DxcInline alignX="end" divider>
137
- <Placeholder height="small" width="small" />
138
- <Placeholder height="medium" width="medium" />
139
- <Placeholder height="small" width="small" />
140
- <Placeholder height="large" width="large" />
141
- <Placeholder height="small" width="large" />
142
- </DxcInline>
143
- </Container>
144
- <Title title="AlignX = center" theme="light" level={4} />
145
- <Container>
146
- <DxcInline alignX="center">
147
- <Placeholder height="small" width="small" />
148
- <Placeholder height="medium" width="medium" />
149
- <Placeholder height="large" width="large" />
150
- <Placeholder height="small" width="large" />
151
- </DxcInline>
152
- </Container>
153
- <Title title="AlignX with wrapped items" theme="light" level={4} />
154
- <Container customWidth>
155
- <DxcInline alignX="center" wrap>
156
- <Placeholder height="small" width="small" />
157
- <Placeholder height="large" width="medium" />
158
- <Placeholder height="medium" width="small" />
159
- <Placeholder height="large" width="large" />
160
- <Placeholder height="medium" width="small" />
161
- <Placeholder height="small" width="large" />
162
- <Placeholder height="large" width="large" />
163
- <Placeholder height="large" width="medium" />
164
- </DxcInline>
165
- </Container>
166
- <Title title="Gutter = 0.125rem" theme="light" level={4} />
167
- <Container>
168
- <DxcInline gutter="0.125rem">
169
- <Placeholder height="small" width="small" />
170
- <Placeholder height="medium" width="medium" />
171
- <Placeholder height="large" width="large" />
172
- <Placeholder height="small" width="large" />
173
- </DxcInline>
174
- </Container>
175
- <Title title="Gutter = 0.25rem" theme="light" level={4} />
176
- <Container>
177
- <DxcInline gutter="0.25rem">
178
- <Placeholder height="small" width="small" />
179
- <Placeholder height="medium" width="medium" />
180
- <Placeholder height="large" width="large" />
181
- <Placeholder height="small" width="large" />
182
- </DxcInline>
183
- </Container>
184
- <Title title="Gutter = 0.5rem" theme="light" level={4} />
185
- <Container>
186
- <DxcInline gutter="0.5rem">
187
- <Placeholder height="small" width="small" />
188
- <Placeholder height="medium" width="medium" />
189
- <Placeholder height="large" width="large" />
190
- <Placeholder height="small" width="large" />
191
- </DxcInline>
192
- </Container>
193
- <Title title="Gutter = 0.75rem" theme="light" level={4} />
194
- <Container>
195
- <DxcInline gutter="0.75rem">
196
- <Placeholder height="small" width="small" />
197
- <Placeholder height="medium" width="medium" />
198
- <Placeholder height="large" width="large" />
199
- <Placeholder height="small" width="large" />
200
- </DxcInline>
201
- </Container>
202
- <Title title="Gutter = 1rem" theme="light" level={4} />
203
- <Container>
204
- <DxcInline gutter="1rem">
205
- <Placeholder height="small" width="small" />
206
- <Placeholder height="medium" width="medium" />
207
- <Placeholder height="large" width="large" />
208
- <Placeholder height="small" width="large" />
209
- </DxcInline>
210
- </Container>
211
- <Title title="Gutter = 1.5rem" theme="light" level={4} />
212
- <Container>
213
- <DxcInline gutter="1.5rem">
214
- <Placeholder height="small" width="small" />
215
- <Placeholder height="medium" width="medium" />
216
- <Placeholder height="large" width="large" />
217
- <Placeholder height="small" width="large" />
218
- </DxcInline>
219
- </Container>
220
- <Title title="Gutter = 2rem and divider" theme="light" level={4} />
221
- <Container>
222
- <DxcInline gutter="2rem" divider>
223
- <Placeholder height="small" width="small" />
224
- <Placeholder height="medium" width="medium" />
225
- <Placeholder height="large" width="large" />
226
- <Placeholder height="small" width="large" />
227
- </DxcInline>
228
- </Container>
229
- <Title title="Gutter = 3rem" theme="light" level={4} />
230
- <Container>
231
- <DxcInline gutter="3rem">
232
- <Placeholder height="small" width="small" />
233
- <Placeholder height="medium" width="medium" />
234
- <Placeholder height="large" width="large" />
235
- </DxcInline>
236
- </Container>
237
- <Title title="Gutter = 4rem" theme="light" level={4} />
238
- <Container>
239
- <DxcInline gutter="4rem">
240
- <Placeholder height="small" width="small" />
241
- <Placeholder height="medium" width="medium" />
242
- </DxcInline>
243
- </Container>
244
- <Title title="Gutter = 5rem" theme="light" level={4} />
245
- <Container>
246
- <DxcInline gutter="5rem">
247
- <Placeholder height="small" width="small" />
248
- <Placeholder height="medium" width="medium" />
249
- </DxcInline>
250
- </Container>
251
- <Title title="Reverse" theme="light" level={4} />
252
- <Container>
253
- <DxcInline reverse>
254
- <Placeholder height="small" width="small">
255
- 1
256
- </Placeholder>
257
- <Placeholder height="medium" width="medium">
258
- 2
259
- </Placeholder>
260
- <Placeholder height="large" width="large">
261
- 3
262
- </Placeholder>
263
- <Placeholder height="small" width="large">
264
- 4
265
- </Placeholder>
266
- </DxcInline>
267
- </Container>
268
- <Title title="Wrapped and reversed children" theme="light" level={4} />
269
- <Container customWidth>
270
- <DxcInline reverse wrap>
271
- <Placeholder height="small" width="small">
272
- 1
273
- </Placeholder>
274
- <Placeholder height="medium" width="medium">
275
- 2
276
- </Placeholder>
277
- <Placeholder height="large" width="large">
278
- 3
279
- </Placeholder>
280
- <Placeholder height="small" width="large">
281
- 4
282
- </Placeholder>
283
- </DxcInline>
284
- </Container>
285
- </>
286
- );
287
-
288
- const FlexContainer = styled.div<{ customWidth?: boolean, customHeight?: boolean }>`
289
- display: flex;
290
- ${({ customWidth }) => customWidth && `width: 200px;`};
291
- ${({ customHeight }) => customHeight && `height: 200px;`};
292
- background: #f2eafa;
293
- `;
294
-
295
- const Container = styled.div<{ customWidth?: boolean }>`
296
- background: #f2eafa;
297
- ${({ customWidth }) => customWidth && `width: 300px;`};
298
- `;
299
-
300
- type PlaceholderProps = {
301
- width?: "xlarge" | "large" | "medium" | "small" | "auto";
302
- height?: "large" | "medium" | "small" | "auto";
303
- };
304
-
305
- const Placeholder = styled.div<PlaceholderProps>`
306
- ${({ width }) =>
307
- width &&
308
- `width: ${width === "xlarge" ? "350px" : width === "large" ? "150px" : width === "medium" ? "100px" : "50px"};`};
309
- ${({ height }) => height && `height: ${height === "large" ? "150px" : height === "medium" ? "100px" : "50px"};`};
310
- border: 1px solid #a46ede;
311
- background-color: #e5d5f6;
312
- `;
313
-
314
- const MinSizePlaceholder = styled.div<PlaceholderProps>`
315
- min-width: 300px;
316
- ${({ height }) => height && `height: ${height === "large" ? "150px" : height === "medium" ? "100px" : "50px"};`};
317
- border: 1px solid #a46ede;
318
- background-color: #e5d5f6;
319
- `;
package/inline/types.d.ts DELETED
@@ -1,36 +0,0 @@
1
- /// <reference types="react" />
2
- declare type Props = {
3
- /**
4
- * Sets whether the children are forced onto one line or can wrap onto multiple lines.
5
- */
6
- wrap?: boolean;
7
- /**
8
- * Alignment applied to children in the main axis.
9
- */
10
- alignX?: "start" | "end" | "center";
11
- /**
12
- * Alignment applied to children in the cross axis.
13
- */
14
- alignY?: "start" | "end" | "center" | "baseline" | "stretch";
15
- /**
16
- * Specifies the HTML tag or component that is rendered as the wrapper element.
17
- */
18
- as?: React.ElementType;
19
- /**
20
- * If true, a divider is shown between each child.
21
- */
22
- divider?: boolean;
23
- /**
24
- * Space applied between each child.
25
- */
26
- gutter?: "0rem" | "0.125rem" | "0.25rem" | "0.5rem" | "0.75rem" | "1rem" | "1.5rem" | "2rem" | "3rem" | "4rem" | "5rem";
27
- /**
28
- * If true, it changes the direction of the inline to reverse.
29
- */
30
- reverse?: boolean;
31
- /**
32
- * Custom content inside the stack.
33
- */
34
- children: React.ReactNode[] | React.ReactNode;
35
- };
36
- export default Props;
package/list/List.d.ts DELETED
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import ListPropsType from "./types";
3
- declare function List({ children, type, gutter }: ListPropsType): JSX.Element;
4
- export default List;
package/list/List.js DELETED
@@ -1,47 +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 _Stack = _interopRequireDefault(require("../stack/Stack"));
17
-
18
- var _Text = _interopRequireDefault(require("../text/Text"));
19
-
20
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
21
-
22
- function List(_ref) {
23
- var children = _ref.children,
24
- _ref$type = _ref.type,
25
- type = _ref$type === void 0 ? "disc" : _ref$type,
26
- _ref$gutter = _ref.gutter,
27
- gutter = _ref$gutter === void 0 ? "0.25rem" : _ref$gutter;
28
- return /*#__PURE__*/_react["default"].createElement(_Stack["default"], {
29
- as: type === "number" ? "ol" : "ul",
30
- gutter: gutter
31
- }, _react["default"].Children.map(children, function (child, index) {
32
- return /*#__PURE__*/_react["default"].createElement(ListItem, null, type === "number" ? /*#__PURE__*/_react["default"].createElement(Number, null, /*#__PURE__*/_react["default"].createElement(_Text["default"], null, index + 1, ".")) : type === "square" ? /*#__PURE__*/_react["default"].createElement(Square, null) : type === "circle" ? /*#__PURE__*/_react["default"].createElement(Circle, null) : /*#__PURE__*/_react["default"].createElement(Disc, null), child);
33
- }));
34
- }
35
-
36
- var Number = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n user-select: none;\n margin-right: 10px;\n flex-shrink: 0;\n"])));
37
-
38
- var Square = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n background-color: black;\n width: 5px;\n height: 5px;\n flex-shrink: 0;\n margin-top: 10px;\n margin-right: 10px;\n"])));
39
-
40
- var Circle = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n width: 5px;\n height: 5px;\n border-radius: 50%;\n border: 1px solid black;\n flex-shrink: 0;\n margin-top: 10px;\n margin-right: 10px;\n box-sizing: border-box;\n"])));
41
-
42
- var Disc = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n background-color: black;\n width: 5px;\n height: 5px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-top: 10px;\n margin-right: 10px;\n"])));
43
-
44
- var ListItem = _styledComponents["default"].li(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0px;\n padding: 0px;\n list-style: none;\n display: flex;\n"])));
45
-
46
- var _default = List;
47
- exports["default"] = _default;