@dxc-technology/halstack-react 0.0.0-1d5e7bf → 0.0.0-1da0f40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/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 +10 -11
  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 +21 -46
  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/alert/Alert.test.js +1 -1
  13. package/bleed/Bleed.stories.tsx +63 -63
  14. package/box/Box.js +2 -4
  15. package/box/Box.stories.tsx +15 -0
  16. package/box/Box.test.js +1 -1
  17. package/box/types.d.ts +1 -0
  18. package/bulleted-list/BulletedList.d.ts +7 -0
  19. package/bulleted-list/BulletedList.js +123 -0
  20. package/bulleted-list/BulletedList.stories.tsx +200 -0
  21. package/bulleted-list/types.d.ts +11 -0
  22. package/button/Button.js +50 -70
  23. package/button/Button.stories.tsx +159 -8
  24. package/button/Button.test.js +1 -1
  25. package/button/types.d.ts +7 -7
  26. package/card/Card.test.js +1 -1
  27. package/card/types.d.ts +1 -0
  28. package/checkbox/Checkbox.d.ts +2 -2
  29. package/checkbox/Checkbox.js +92 -99
  30. package/checkbox/Checkbox.stories.tsx +131 -59
  31. package/checkbox/Checkbox.test.js +94 -17
  32. package/checkbox/types.d.ts +6 -2
  33. package/chip/Chip.js +16 -22
  34. package/chip/Chip.stories.tsx +96 -9
  35. package/chip/Chip.test.js +3 -5
  36. package/chip/types.d.ts +1 -1
  37. package/common/variables.js +333 -299
  38. package/date-input/Calendar.d.ts +4 -0
  39. package/date-input/Calendar.js +258 -0
  40. package/date-input/DateInput.js +134 -237
  41. package/date-input/DateInput.stories.tsx +199 -33
  42. package/date-input/DateInput.test.js +494 -138
  43. package/date-input/DatePicker.d.ts +4 -0
  44. package/date-input/DatePicker.js +146 -0
  45. package/date-input/Icons.d.ts +6 -0
  46. package/date-input/Icons.js +75 -0
  47. package/date-input/YearPicker.d.ts +4 -0
  48. package/date-input/YearPicker.js +126 -0
  49. package/date-input/types.d.ts +51 -0
  50. package/dialog/Dialog.js +79 -68
  51. package/dialog/Dialog.stories.tsx +230 -123
  52. package/dialog/Dialog.test.js +334 -5
  53. package/dialog/types.d.ts +3 -2
  54. package/dropdown/Dropdown.d.ts +1 -1
  55. package/dropdown/Dropdown.js +246 -249
  56. package/dropdown/Dropdown.stories.tsx +245 -56
  57. package/dropdown/Dropdown.test.js +507 -110
  58. package/dropdown/DropdownMenu.d.ts +4 -0
  59. package/dropdown/DropdownMenu.js +70 -0
  60. package/dropdown/DropdownMenuItem.d.ts +4 -0
  61. package/dropdown/DropdownMenuItem.js +81 -0
  62. package/dropdown/types.d.ts +25 -5
  63. package/file-input/FileInput.d.ts +2 -2
  64. package/file-input/FileInput.js +174 -219
  65. package/file-input/FileInput.stories.tsx +122 -11
  66. package/file-input/FileInput.test.js +14 -14
  67. package/file-input/FileItem.d.ts +4 -14
  68. package/file-input/FileItem.js +39 -63
  69. package/file-input/types.d.ts +17 -0
  70. package/flex/Flex.d.ts +4 -0
  71. package/flex/Flex.js +69 -0
  72. package/flex/Flex.stories.tsx +103 -0
  73. package/flex/types.d.ts +32 -0
  74. package/footer/Footer.stories.tsx +99 -1
  75. package/footer/Footer.test.js +14 -26
  76. package/footer/types.d.ts +2 -1
  77. package/header/Header.js +87 -87
  78. package/header/Header.stories.tsx +152 -9
  79. package/header/Header.test.js +2 -2
  80. package/header/Icons.js +2 -2
  81. package/header/types.d.ts +3 -2
  82. package/heading/Heading.test.js +1 -1
  83. package/inset/Inset.stories.tsx +4 -4
  84. package/layout/ApplicationLayout.d.ts +15 -6
  85. package/layout/ApplicationLayout.js +36 -64
  86. package/layout/ApplicationLayout.stories.tsx +80 -44
  87. package/layout/types.d.ts +17 -27
  88. package/link/Link.js +2 -2
  89. package/link/Link.stories.tsx +72 -5
  90. package/link/Link.test.js +2 -4
  91. package/link/types.d.ts +1 -1
  92. package/main.d.ts +6 -10
  93. package/main.js +28 -60
  94. package/{tabs-nav → nav-tabs}/NavTabs.js +6 -6
  95. package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +96 -6
  96. package/{tabs-nav → nav-tabs}/NavTabs.test.js +1 -1
  97. package/{tabs-nav → nav-tabs}/Tab.js +38 -20
  98. package/{tabs-nav → nav-tabs}/types.d.ts +1 -1
  99. package/number-input/NumberInput.test.js +44 -8
  100. package/package.json +16 -21
  101. package/paginator/Icons.d.ts +5 -0
  102. package/paginator/Icons.js +16 -28
  103. package/paginator/Paginator.js +6 -12
  104. package/paginator/Paginator.stories.tsx +24 -0
  105. package/paginator/Paginator.test.js +45 -48
  106. package/paragraph/Paragraph.d.ts +6 -0
  107. package/paragraph/Paragraph.js +38 -0
  108. package/paragraph/Paragraph.stories.tsx +44 -0
  109. package/password-input/PasswordInput.test.js +14 -13
  110. package/progress-bar/ProgressBar.d.ts +2 -2
  111. package/progress-bar/ProgressBar.js +59 -53
  112. package/progress-bar/ProgressBar.stories.jsx +38 -3
  113. package/progress-bar/ProgressBar.test.js +68 -23
  114. package/progress-bar/types.d.ts +3 -4
  115. package/quick-nav/QuickNav.js +17 -16
  116. package/quick-nav/QuickNav.stories.tsx +124 -32
  117. package/radio-group/Radio.d.ts +1 -1
  118. package/radio-group/Radio.js +43 -28
  119. package/radio-group/RadioGroup.js +24 -24
  120. package/radio-group/RadioGroup.stories.tsx +132 -18
  121. package/radio-group/RadioGroup.test.js +124 -97
  122. package/radio-group/types.d.ts +2 -2
  123. package/resultsetTable/Icons.d.ts +7 -0
  124. package/resultsetTable/Icons.js +51 -0
  125. package/resultsetTable/ResultsetTable.js +48 -107
  126. package/resultsetTable/ResultsetTable.stories.tsx +50 -25
  127. package/resultsetTable/ResultsetTable.test.js +41 -64
  128. package/resultsetTable/types.d.ts +2 -2
  129. package/select/Listbox.js +4 -10
  130. package/select/Option.js +11 -24
  131. package/select/Select.js +54 -50
  132. package/select/Select.stories.tsx +494 -149
  133. package/select/Select.test.js +393 -327
  134. package/select/types.d.ts +3 -5
  135. package/sidenav/Sidenav.d.ts +6 -5
  136. package/sidenav/Sidenav.js +174 -55
  137. package/sidenav/Sidenav.stories.tsx +249 -149
  138. package/sidenav/Sidenav.test.js +25 -37
  139. package/sidenav/types.d.ts +50 -27
  140. package/slider/Slider.d.ts +2 -2
  141. package/slider/Slider.js +120 -95
  142. package/slider/Slider.stories.tsx +64 -1
  143. package/slider/Slider.test.js +122 -22
  144. package/slider/types.d.ts +6 -2
  145. package/spinner/Spinner.js +2 -2
  146. package/spinner/Spinner.stories.jsx +27 -1
  147. package/spinner/Spinner.test.js +1 -1
  148. package/switch/Switch.d.ts +2 -2
  149. package/switch/Switch.js +135 -68
  150. package/switch/Switch.stories.tsx +41 -30
  151. package/switch/Switch.test.js +145 -18
  152. package/switch/types.d.ts +6 -2
  153. package/table/Table.js +1 -1
  154. package/table/Table.stories.jsx +80 -1
  155. package/table/Table.test.js +2 -2
  156. package/tabs/Tab.d.ts +4 -0
  157. package/tabs/Tab.js +133 -0
  158. package/tabs/Tabs.js +360 -104
  159. package/tabs/Tabs.stories.tsx +119 -5
  160. package/tabs/Tabs.test.js +217 -7
  161. package/tabs/types.d.ts +15 -5
  162. package/tag/Tag.js +1 -1
  163. package/tag/Tag.stories.tsx +14 -1
  164. package/tag/Tag.test.js +1 -1
  165. package/tag/types.d.ts +1 -1
  166. package/text-input/Icons.d.ts +8 -0
  167. package/text-input/Icons.js +60 -0
  168. package/text-input/Suggestion.js +38 -9
  169. package/text-input/Suggestions.d.ts +4 -0
  170. package/text-input/Suggestions.js +134 -0
  171. package/text-input/TextInput.js +195 -292
  172. package/text-input/TextInput.stories.tsx +280 -185
  173. package/text-input/TextInput.test.js +736 -725
  174. package/text-input/types.d.ts +22 -3
  175. package/textarea/Textarea.stories.jsx +60 -1
  176. package/textarea/Textarea.test.js +1 -1
  177. package/toggle-group/ToggleGroup.stories.tsx +42 -0
  178. package/toggle-group/ToggleGroup.test.js +1 -1
  179. package/toggle-group/types.d.ts +1 -1
  180. package/typography/Typography.d.ts +4 -0
  181. package/typography/Typography.js +131 -0
  182. package/typography/Typography.stories.tsx +198 -0
  183. package/typography/types.d.ts +18 -0
  184. package/utils/FocusLock.d.ts +13 -0
  185. package/utils/FocusLock.js +139 -0
  186. package/wizard/Wizard.js +9 -16
  187. package/wizard/Wizard.stories.tsx +40 -1
  188. package/wizard/Wizard.test.js +1 -1
  189. package/wizard/types.d.ts +5 -4
  190. package/common/RequiredComponent.js +0 -32
  191. package/inline/Inline.d.ts +0 -4
  192. package/inline/Inline.js +0 -60
  193. package/inline/Inline.stories.tsx +0 -319
  194. package/inline/types.d.ts +0 -36
  195. package/list/List.d.ts +0 -4
  196. package/list/List.js +0 -47
  197. package/list/List.stories.tsx +0 -89
  198. package/list/types.d.ts +0 -7
  199. package/row/Row.d.ts +0 -3
  200. package/row/Row.js +0 -127
  201. package/row/Row.stories.tsx +0 -237
  202. package/row/types.d.ts +0 -28
  203. package/stack/Stack.d.ts +0 -4
  204. package/stack/Stack.js +0 -56
  205. package/stack/Stack.stories.tsx +0 -263
  206. package/stack/types.d.ts +0 -32
  207. package/tabs-nav/types.js +0 -5
  208. package/text/Text.d.ts +0 -7
  209. package/text/Text.js +0 -30
  210. package/text/Text.stories.tsx +0 -19
  211. /package/{inline → bulleted-list}/types.js +0 -0
  212. /package/{list → flex}/types.js +0 -0
  213. /package/{tabs-nav → nav-tabs}/NavTabs.d.ts +0 -0
  214. /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
  215. /package/{row → nav-tabs}/types.js +0 -0
  216. /package/{stack → typography}/types.js +0 -0
@@ -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;
@@ -4,12 +4,20 @@ import Title from "../../.storybook/components/Title";
4
4
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
5
  import { BackgroundColorProvider } from "../BackgroundColorContext";
6
6
  import DarkContainer from "../../.storybook/components/DarkSection";
7
+ import { HalstackProvider } from "../HalstackContext";
7
8
 
8
9
  export default {
9
10
  title: "Textarea",
10
11
  component: DxcTextarea,
11
12
  };
12
13
 
14
+ const opinionatedTheme = {
15
+ textarea: {
16
+ fontColor: "#000000",
17
+ hoverBorderColor: "#a46ede",
18
+ },
19
+ };
20
+
13
21
  export const Chromatic = () => (
14
22
  <>
15
23
  <>
@@ -151,7 +159,58 @@ export const Chromatic = () => (
151
159
  <ExampleContainer>
152
160
  <Title title="Xxlarge margin" theme="light" level={4} />
153
161
  <DxcTextarea label="Xxlarge" margin="xxlarge" />
154
- <hr />
162
+ </ExampleContainer>
163
+ <Title title="Opinionated theme" theme="light" level={2} />
164
+ <ExampleContainer pseudoState="pseudo-hover">
165
+ <Title title="Hovered" theme="light" level={4} />
166
+ <HalstackProvider theme={opinionatedTheme}>
167
+ <DxcTextarea label="Hovered" helperText="Sample text" placeholder="Placeholder" />
168
+ </HalstackProvider>
169
+ </ExampleContainer>
170
+ <ExampleContainer pseudoState="pseudo-focus">
171
+ <Title title="Focused" theme="light" level={4} />
172
+ <HalstackProvider theme={opinionatedTheme}>
173
+ <DxcTextarea label="Focused" helperText="Sample text" />
174
+ </HalstackProvider>
175
+ </ExampleContainer>
176
+ <ExampleContainer>
177
+ <Title title="Disabled" theme="light" level={4} />
178
+ <HalstackProvider theme={opinionatedTheme}>
179
+ <DxcTextarea
180
+ label="Disabled"
181
+ optional
182
+ helperText="Sample text"
183
+ placeholder="Enter your text here..."
184
+ disabled
185
+ />
186
+ </HalstackProvider>
187
+ </ExampleContainer>
188
+ <ExampleContainer>
189
+ <Title title="Disabled with value" theme="light" level={4} />
190
+ <HalstackProvider theme={opinionatedTheme}>
191
+ <DxcTextarea label="Disabled" helperText="Sample text" defaultValue="Example text" disabled />
192
+ </HalstackProvider>
193
+ </ExampleContainer>
194
+ <ExampleContainer>
195
+ <Title title="With error" theme="light" level={4} />
196
+ <HalstackProvider theme={opinionatedTheme}>
197
+ <DxcTextarea
198
+ label="Textarea with error"
199
+ helperText="Helper text"
200
+ placeholder="Enter your text here..."
201
+ error="Error message."
202
+ />
203
+ </HalstackProvider>
204
+ </ExampleContainer>
205
+ <ExampleContainer>
206
+ <Title title="Grow manual" theme="light" level={4} />{" "}
207
+ <HalstackProvider theme={opinionatedTheme}>
208
+ <DxcTextarea
209
+ label="Manual vertical grow"
210
+ verticalGrow="manual"
211
+ defaultValue="Long textttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt"
212
+ />
213
+ </HalstackProvider>
155
214
  </ExampleContainer>
156
215
  </>
157
216
  );
@@ -8,7 +8,7 @@ var _react2 = require("@testing-library/react");
8
8
 
9
9
  var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
10
10
 
11
- var _Textarea = _interopRequireDefault(require("./Textarea"));
11
+ var _Textarea = _interopRequireDefault(require("./Textarea.tsx"));
12
12
 
13
13
  describe("Textarea component tests", function () {
14
14
  test("Renders with correct label", function () {
@@ -3,6 +3,7 @@ import { userEvent, within } from "@storybook/testing-library";
3
3
  import DxcToggleGroup from "./ToggleGroup";
4
4
  import Title from "../../.storybook/components/Title";
5
5
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
6
+ import { HalstackProvider } from "../HalstackContext";
6
7
 
7
8
  export default {
8
9
  title: "ToggleGroup",
@@ -89,6 +90,16 @@ const twoOptions = [
89
90
  label: "Twitter",
90
91
  },
91
92
  ];
93
+
94
+ const opinionatedTheme = {
95
+ toggleGroup: {
96
+ selectedBaseColor: "#5f249f",
97
+ selectedFontColor: "#ffffff",
98
+ unselectedBaseColor: "#e6e6e6",
99
+ unselectedFontColor: "#000000",
100
+ },
101
+ };
102
+
92
103
  export const Chromatic = () => (
93
104
  <>
94
105
  <ExampleContainer>
@@ -154,6 +165,37 @@ export const Chromatic = () => (
154
165
  <Title title="xxLarge" theme="light" level={4} />
155
166
  <DxcToggleGroup label="xxLarge margin" options={options} margin="xxlarge" />
156
167
  </ExampleContainer>
168
+ <Title title="Opinionated theme" theme="light" level={2} />
169
+ <ExampleContainer>
170
+ <HalstackProvider theme={opinionatedTheme}>
171
+ <Title title="Selected" theme="light" level={4} />
172
+ <DxcToggleGroup label="Selected" helperText="HelperText" defaultValue={2} options={options} />
173
+ </HalstackProvider>
174
+ </ExampleContainer>
175
+ <ExampleContainer>
176
+ <HalstackProvider theme={opinionatedTheme}>
177
+ <Title title="Icons & label toggle group" theme="light" level={4} />
178
+ <DxcToggleGroup label="Icons & label" options={optionsWithIconAndLabel} />
179
+ </HalstackProvider>
180
+ </ExampleContainer>
181
+ <ExampleContainer>
182
+ <HalstackProvider theme={opinionatedTheme}>
183
+ <Title title="Disabled" theme="light" level={4} />
184
+ <DxcToggleGroup label="Disabled" defaultValue={2} options={options} disabled />
185
+ </HalstackProvider>
186
+ </ExampleContainer>
187
+ <ExampleContainer pseudoState="pseudo-hover">
188
+ <Title title="Hovered" theme="light" level={4} />
189
+ <HalstackProvider theme={opinionatedTheme}>
190
+ <DxcToggleGroup label="Hovered" options={twoOptions} defaultValue={2} />
191
+ </HalstackProvider>
192
+ </ExampleContainer>
193
+ <ExampleContainer pseudoState="pseudo-active">
194
+ <Title title="Actived" theme="light" level={4} />
195
+ <HalstackProvider theme={opinionatedTheme}>
196
+ <DxcToggleGroup label="Actived" options={twoOptions} defaultValue={2} />
197
+ </HalstackProvider>
198
+ </ExampleContainer>
157
199
  </>
158
200
  );
159
201
  const OptionSelected = () => <DxcToggleGroup label="Toggle group" helperText="HelperText" options={options} />;
@@ -6,7 +6,7 @@ var _react = _interopRequireDefault(require("react"));
6
6
 
7
7
  var _react2 = require("@testing-library/react");
8
8
 
9
- var _ToggleGroup = _interopRequireDefault(require("./ToggleGroup"));
9
+ var _ToggleGroup = _interopRequireDefault(require("./ToggleGroup.tsx"));
10
10
 
11
11
  var options = [{
12
12
  value: 1,
@@ -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;
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ /**
3
+ * Traps the focus inside the children of the component. It will focus the first focusable element when the component is mounted.
4
+ * When the focus is on the last focusable element and the user tries to focus the next element, it will focus the first element.
5
+ * When the focus is on the first focusable element and the user tries to focus the previous element, it will focus the last element.
6
+ * The focus can't be moved outside the children unless the children are removed from the DOM (for example, a Dialog, a Modal, etc).
7
+ * @param children: React.ReactNode
8
+ * @returns
9
+ */
10
+ declare const FocusLock: ({ children }: {
11
+ children: React.ReactNode;
12
+ }) => JSX.Element;
13
+ export default FocusLock;