@dxc-technology/halstack-react 0.0.0-4bbfa6c → 0.0.0-4c3af14
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.
- package/BackgroundColorContext.d.ts +10 -0
- package/BackgroundColorContext.js +1 -4
- package/HalstackContext.d.ts +12 -0
- package/HalstackContext.js +295 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +15 -47
- package/accordion/Accordion.stories.tsx +307 -0
- package/accordion/Accordion.test.js +72 -0
- package/accordion/types.d.ts +8 -8
- package/accordion-group/AccordionGroup.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +15 -17
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/AccordionGroup.test.js +151 -0
- package/accordion-group/types.d.ts +8 -8
- package/alert/Alert.js +6 -3
- package/alert/Alert.stories.tsx +170 -0
- package/alert/Alert.test.js +92 -0
- package/alert/types.d.ts +1 -1
- package/badge/Badge.d.ts +4 -0
- package/badge/Badge.js +6 -4
- package/badge/types.d.ts +5 -0
- package/{radio → badge}/types.js +0 -0
- package/bleed/Bleed.d.ts +3 -0
- package/bleed/Bleed.js +51 -0
- package/bleed/Bleed.stories.tsx +341 -0
- package/bleed/types.d.ts +37 -0
- package/bleed/types.js +5 -0
- package/box/Box.d.ts +1 -1
- package/box/Box.js +26 -39
- package/box/Box.test.js +18 -0
- package/box/types.d.ts +0 -4
- package/button/Button.d.ts +1 -1
- package/button/Button.js +24 -27
- package/button/Button.stories.tsx +222 -241
- package/button/Button.test.js +35 -0
- package/button/types.d.ts +5 -9
- package/card/Card.js +26 -30
- package/card/Card.stories.tsx +201 -0
- package/card/Card.test.js +50 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +4 -6
- package/checkbox/Checkbox.d.ts +1 -1
- package/checkbox/Checkbox.js +45 -41
- package/checkbox/Checkbox.stories.tsx +124 -128
- package/checkbox/Checkbox.test.js +78 -0
- package/checkbox/types.d.ts +9 -5
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +16 -76
- package/chip/Chip.stories.tsx +119 -0
- package/chip/Chip.test.js +56 -0
- package/chip/types.d.ts +45 -0
- package/chip/types.js +5 -0
- package/common/variables.js +234 -341
- package/date-input/DateInput.js +63 -52
- package/date-input/DateInput.stories.tsx +138 -0
- package/date-input/DateInput.test.js +479 -0
- package/date-input/types.d.ts +16 -9
- package/dialog/Dialog.js +8 -35
- package/dialog/Dialog.stories.tsx +212 -0
- package/dialog/Dialog.test.js +40 -0
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +22 -48
- package/dropdown/Dropdown.stories.tsx +249 -0
- package/dropdown/Dropdown.test.js +189 -0
- package/dropdown/types.d.ts +6 -15
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +172 -111
- package/file-input/FileInput.stories.tsx +507 -0
- package/file-input/FileInput.test.js +457 -0
- package/file-input/FileItem.d.ts +14 -0
- package/file-input/FileItem.js +16 -23
- package/file-input/types.d.ts +112 -0
- package/file-input/types.js +5 -0
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +32 -113
- package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
- package/footer/Footer.test.js +109 -0
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +3 -3
- package/footer/types.d.ts +22 -18
- package/header/Header.js +29 -50
- package/header/Header.stories.tsx +172 -0
- package/header/Header.test.js +79 -0
- package/header/Icons.d.ts +2 -0
- package/header/types.d.ts +4 -2
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +7 -24
- package/heading/Heading.stories.tsx +54 -0
- package/heading/Heading.test.js +186 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/inline/Inline.d.ts +4 -0
- package/inline/Inline.js +54 -0
- package/inline/Inline.stories.tsx +220 -0
- package/inline/types.d.ts +32 -0
- package/inline/types.js +5 -0
- package/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +51 -0
- package/inset/Inset.stories.tsx +229 -0
- package/inset/types.d.ts +37 -0
- package/inset/types.js +5 -0
- package/layout/ApplicationLayout.d.ts +11 -0
- package/layout/ApplicationLayout.js +84 -120
- package/layout/ApplicationLayout.stories.tsx +126 -0
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +13 -2
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +52 -0
- package/layout/types.js +5 -0
- package/link/Link.d.ts +3 -2
- package/link/Link.js +61 -86
- package/link/Link.stories.tsx +131 -15
- package/link/Link.test.js +83 -0
- package/link/types.d.ts +9 -29
- package/list/List.d.ts +4 -0
- package/list/List.js +47 -0
- package/list/List.stories.tsx +95 -0
- package/list/types.d.ts +7 -0
- package/list/types.js +5 -0
- package/main.d.ts +13 -9
- package/main.js +80 -42
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +16 -68
- package/number-input/{NumberInput.stories.jsx → NumberInput.stories.tsx} +5 -5
- package/number-input/NumberInput.test.js +506 -0
- package/number-input/NumberInputContext.d.ts +4 -0
- package/number-input/NumberInputContext.js +5 -2
- package/number-input/numberInputContextTypes.d.ts +19 -0
- package/number-input/numberInputContextTypes.js +5 -0
- package/number-input/types.d.ts +124 -0
- package/number-input/types.js +5 -0
- package/package.json +9 -6
- package/paginator/Paginator.js +19 -46
- package/paginator/Paginator.test.js +266 -0
- package/password-input/PasswordInput.js +23 -19
- package/password-input/PasswordInput.stories.tsx +3 -3
- package/password-input/PasswordInput.test.js +180 -0
- package/password-input/types.d.ts +29 -19
- package/progress-bar/ProgressBar.js +5 -5
- package/progress-bar/ProgressBar.stories.jsx +11 -11
- package/progress-bar/ProgressBar.test.js +65 -0
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +112 -0
- package/quick-nav/QuickNav.stories.tsx +237 -0
- package/quick-nav/types.d.ts +21 -0
- package/quick-nav/types.js +5 -0
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +141 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +282 -0
- package/radio-group/RadioGroup.stories.tsx +100 -0
- package/radio-group/RadioGroup.test.js +695 -0
- package/radio-group/types.d.ts +114 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/ResultsetTable.d.ts +4 -0
- package/resultsetTable/ResultsetTable.js +9 -29
- package/resultsetTable/ResultsetTable.stories.tsx +275 -0
- package/resultsetTable/ResultsetTable.test.js +306 -0
- package/resultsetTable/types.d.ts +67 -0
- package/resultsetTable/types.js +5 -0
- package/row/Row.d.ts +3 -0
- package/row/Row.js +127 -0
- package/row/Row.stories.tsx +237 -0
- package/row/types.d.ts +28 -0
- package/row/types.js +5 -0
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +93 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +152 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +110 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +122 -342
- package/select/Select.stories.tsx +594 -0
- package/select/Select.test.js +2120 -0
- package/select/types.d.ts +213 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.d.ts +9 -0
- package/sidenav/Sidenav.js +26 -24
- package/sidenav/Sidenav.stories.tsx +182 -0
- package/sidenav/Sidenav.test.js +56 -0
- package/sidenav/types.d.ts +50 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +10 -9
- package/slider/Slider.stories.tsx +14 -9
- package/slider/Slider.test.js +150 -0
- package/slider/types.d.ts +4 -0
- package/spinner/Spinner.js +3 -3
- package/spinner/Spinner.stories.jsx +1 -0
- package/spinner/Spinner.test.js +64 -0
- package/stack/Stack.d.ts +3 -0
- package/stack/Stack.js +97 -0
- package/stack/Stack.stories.tsx +164 -0
- package/stack/types.d.ts +24 -0
- package/stack/types.js +5 -0
- package/switch/Switch.d.ts +1 -1
- package/switch/Switch.js +37 -21
- package/switch/Switch.stories.tsx +15 -15
- package/switch/Switch.test.js +98 -0
- package/switch/types.d.ts +6 -2
- package/table/Table.js +3 -3
- package/table/Table.stories.jsx +2 -1
- package/table/Table.test.js +26 -0
- package/tabs/Tabs.d.ts +1 -1
- package/tabs/Tabs.js +20 -20
- package/tabs/Tabs.stories.tsx +112 -0
- package/tabs/Tabs.test.js +140 -0
- package/tabs/types.d.ts +29 -18
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +170 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +132 -0
- package/tabs-nav/types.d.ts +53 -0
- package/tabs-nav/types.js +5 -0
- package/tag/Tag.d.ts +1 -1
- package/tag/Tag.js +18 -28
- package/tag/Tag.stories.tsx +26 -29
- package/tag/Tag.test.js +60 -0
- package/tag/types.d.ts +23 -14
- package/text/Text.d.ts +7 -0
- package/text/Text.js +30 -0
- package/text/Text.stories.tsx +19 -0
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +55 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +91 -146
- package/text-input/TextInput.stories.tsx +474 -0
- package/text-input/TextInput.test.js +1712 -0
- package/text-input/types.d.ts +178 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +39 -79
- package/textarea/Textarea.stories.jsx +37 -15
- package/textarea/Textarea.test.js +437 -0
- package/textarea/types.d.ts +137 -0
- package/textarea/types.js +5 -0
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +18 -46
- package/toggle-group/ToggleGroup.stories.tsx +173 -0
- package/toggle-group/ToggleGroup.test.js +156 -0
- package/toggle-group/types.d.ts +105 -0
- package/toggle-group/types.js +5 -0
- package/useTheme.d.ts +2 -0
- package/useTheme.js +2 -2
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +115 -94
- package/wizard/Wizard.stories.tsx +214 -0
- package/wizard/Wizard.test.js +141 -0
- package/wizard/types.d.ts +64 -0
- package/wizard/types.js +5 -0
- package/ThemeContext.js +0 -246
- package/V3Select/V3Select.js +0 -455
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -260
- package/V3Textarea/index.d.ts +0 -27
- package/chip/index.d.ts +0 -22
- package/date/Date.js +0 -373
- package/date/index.d.ts +0 -27
- package/file-input/index.d.ts +0 -81
- package/heading/index.d.ts +0 -17
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -611
- package/input-text/index.d.ts +0 -36
- package/number-input/index.d.ts +0 -113
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -174
- package/radio/Radio.stories.tsx +0 -192
- package/radio/types.d.ts +0 -54
- package/resultsetTable/index.d.ts +0 -19
- package/select/index.d.ts +0 -131
- package/sidenav/index.d.ts +0 -13
- package/text-input/index.d.ts +0 -135
- package/textarea/index.d.ts +0 -117
- package/toggle/Toggle.js +0 -186
- package/toggle/index.d.ts +0 -21
- package/toggle-group/index.d.ts +0 -21
- package/upload/Upload.js +0 -201
- package/upload/buttons-upload/ButtonsUpload.js +0 -111
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -115
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -109
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -104
- package/upload/transactions/Transactions.js +0 -94
- package/wizard/Icons.js +0 -65
- package/wizard/index.d.ts +0 -18
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
|
|
9
|
+
var _Heading = _interopRequireDefault(require("./Heading"));
|
|
10
|
+
|
|
11
|
+
describe("Heading component tests", function () {
|
|
12
|
+
test("Heading renders with default level", function () {
|
|
13
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
|
|
14
|
+
text: "my-heading-test"
|
|
15
|
+
})),
|
|
16
|
+
getByText = _render.getByText,
|
|
17
|
+
getByRole = _render.getByRole;
|
|
18
|
+
|
|
19
|
+
expect(getByText("my-heading-test")).toBeTruthy();
|
|
20
|
+
expect(getByRole("heading", {
|
|
21
|
+
level: 1
|
|
22
|
+
})).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
test("Heading renders with level 1", function () {
|
|
25
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
|
|
26
|
+
text: "my-heading-test",
|
|
27
|
+
level: 1
|
|
28
|
+
})),
|
|
29
|
+
getByText = _render2.getByText,
|
|
30
|
+
getByRole = _render2.getByRole;
|
|
31
|
+
|
|
32
|
+
expect(getByText("my-heading-test")).toBeTruthy();
|
|
33
|
+
expect(getByRole("heading", {
|
|
34
|
+
level: 1
|
|
35
|
+
})).toBeTruthy();
|
|
36
|
+
});
|
|
37
|
+
test("Heading renders with level 2", function () {
|
|
38
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
|
|
39
|
+
text: "my-heading-test",
|
|
40
|
+
level: 2
|
|
41
|
+
})),
|
|
42
|
+
getByText = _render3.getByText,
|
|
43
|
+
getByRole = _render3.getByRole;
|
|
44
|
+
|
|
45
|
+
expect(getByText("my-heading-test")).toBeTruthy();
|
|
46
|
+
expect(getByRole("heading", {
|
|
47
|
+
level: 2
|
|
48
|
+
})).toBeTruthy();
|
|
49
|
+
});
|
|
50
|
+
test("Heading renders with level 3", function () {
|
|
51
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
|
|
52
|
+
text: "my-heading-test",
|
|
53
|
+
level: 3
|
|
54
|
+
})),
|
|
55
|
+
getByText = _render4.getByText,
|
|
56
|
+
getByRole = _render4.getByRole;
|
|
57
|
+
|
|
58
|
+
expect(getByText("my-heading-test")).toBeTruthy();
|
|
59
|
+
expect(getByRole("heading", {
|
|
60
|
+
level: 3
|
|
61
|
+
})).toBeTruthy();
|
|
62
|
+
});
|
|
63
|
+
test("Heading renders with level 4", function () {
|
|
64
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
|
|
65
|
+
text: "my-heading-test",
|
|
66
|
+
level: 4
|
|
67
|
+
})),
|
|
68
|
+
getByText = _render5.getByText,
|
|
69
|
+
getByRole = _render5.getByRole;
|
|
70
|
+
|
|
71
|
+
expect(getByText("my-heading-test")).toBeTruthy();
|
|
72
|
+
expect(getByRole("heading", {
|
|
73
|
+
level: 4
|
|
74
|
+
})).toBeTruthy();
|
|
75
|
+
});
|
|
76
|
+
test("Heading renders with level 5", function () {
|
|
77
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
|
|
78
|
+
text: "my-heading-test",
|
|
79
|
+
level: 5
|
|
80
|
+
})),
|
|
81
|
+
getByText = _render6.getByText,
|
|
82
|
+
getByRole = _render6.getByRole;
|
|
83
|
+
|
|
84
|
+
expect(getByText("my-heading-test")).toBeTruthy();
|
|
85
|
+
expect(getByRole("heading", {
|
|
86
|
+
level: 5
|
|
87
|
+
})).toBeTruthy();
|
|
88
|
+
});
|
|
89
|
+
test("Heading renders with default level and as h5", function () {
|
|
90
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
|
|
91
|
+
text: "my-heading-test",
|
|
92
|
+
as: "h5"
|
|
93
|
+
})),
|
|
94
|
+
getByText = _render7.getByText,
|
|
95
|
+
getByRole = _render7.getByRole;
|
|
96
|
+
|
|
97
|
+
expect(getByText("my-heading-test")).toBeTruthy();
|
|
98
|
+
expect(getByRole("heading", {
|
|
99
|
+
level: 5
|
|
100
|
+
})).toBeTruthy();
|
|
101
|
+
});
|
|
102
|
+
test("Heading renders with level 1 and as h5", function () {
|
|
103
|
+
var _render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
|
|
104
|
+
text: "my-heading-test",
|
|
105
|
+
level: 1,
|
|
106
|
+
as: "h5"
|
|
107
|
+
})),
|
|
108
|
+
getByText = _render8.getByText,
|
|
109
|
+
getByRole = _render8.getByRole;
|
|
110
|
+
|
|
111
|
+
expect(getByText("my-heading-test")).toBeTruthy();
|
|
112
|
+
expect(getByRole("heading", {
|
|
113
|
+
level: 5
|
|
114
|
+
})).toBeTruthy();
|
|
115
|
+
});
|
|
116
|
+
test("Heading renders with level 2 and as h4", function () {
|
|
117
|
+
var _render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
|
|
118
|
+
text: "my-heading-test",
|
|
119
|
+
level: 2,
|
|
120
|
+
as: "h4"
|
|
121
|
+
})),
|
|
122
|
+
getByText = _render9.getByText,
|
|
123
|
+
getByRole = _render9.getByRole;
|
|
124
|
+
|
|
125
|
+
expect(getByText("my-heading-test")).toBeTruthy();
|
|
126
|
+
expect(getByRole("heading", {
|
|
127
|
+
level: 4
|
|
128
|
+
})).toBeTruthy();
|
|
129
|
+
});
|
|
130
|
+
test("Heading renders with level 3 and as h2", function () {
|
|
131
|
+
var _render10 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
|
|
132
|
+
text: "my-heading-test",
|
|
133
|
+
level: 3,
|
|
134
|
+
as: "h2"
|
|
135
|
+
})),
|
|
136
|
+
getByText = _render10.getByText,
|
|
137
|
+
getByRole = _render10.getByRole;
|
|
138
|
+
|
|
139
|
+
expect(getByText("my-heading-test")).toBeTruthy();
|
|
140
|
+
expect(getByRole("heading", {
|
|
141
|
+
level: 2
|
|
142
|
+
})).toBeTruthy();
|
|
143
|
+
});
|
|
144
|
+
test("Heading renders with level 4 and as h3", function () {
|
|
145
|
+
var _render11 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
|
|
146
|
+
text: "my-heading-test",
|
|
147
|
+
level: 4,
|
|
148
|
+
as: "h3"
|
|
149
|
+
})),
|
|
150
|
+
getByText = _render11.getByText,
|
|
151
|
+
getByRole = _render11.getByRole;
|
|
152
|
+
|
|
153
|
+
expect(getByText("my-heading-test")).toBeTruthy();
|
|
154
|
+
expect(getByRole("heading", {
|
|
155
|
+
level: 3
|
|
156
|
+
})).toBeTruthy();
|
|
157
|
+
});
|
|
158
|
+
test("Heading renders with level 5 as h4", function () {
|
|
159
|
+
var _render12 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
|
|
160
|
+
text: "my-heading-test",
|
|
161
|
+
level: 5,
|
|
162
|
+
as: "h4"
|
|
163
|
+
})),
|
|
164
|
+
getByText = _render12.getByText,
|
|
165
|
+
getByRole = _render12.getByRole;
|
|
166
|
+
|
|
167
|
+
expect(getByText("my-heading-test")).toBeTruthy();
|
|
168
|
+
expect(getByRole("heading", {
|
|
169
|
+
level: 4
|
|
170
|
+
})).toBeTruthy();
|
|
171
|
+
});
|
|
172
|
+
test("Heading renders with level 5 and invalid as", function () {
|
|
173
|
+
var _render13 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
|
|
174
|
+
text: "my-heading-test",
|
|
175
|
+
level: 5,
|
|
176
|
+
as: "h4afdssf"
|
|
177
|
+
})),
|
|
178
|
+
getByText = _render13.getByText,
|
|
179
|
+
getByRole = _render13.getByRole;
|
|
180
|
+
|
|
181
|
+
expect(getByText("my-heading-test")).toBeTruthy();
|
|
182
|
+
expect(getByRole("heading", {
|
|
183
|
+
level: 5
|
|
184
|
+
})).toBeTruthy();
|
|
185
|
+
});
|
|
186
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
+
declare type Margin = {
|
|
3
|
+
top?: Space;
|
|
4
|
+
bottom?: Space;
|
|
5
|
+
left?: Space;
|
|
6
|
+
right?: Space;
|
|
7
|
+
};
|
|
8
|
+
declare type Props = {
|
|
9
|
+
/**
|
|
10
|
+
* Defines the heading level from 1 to 5. The styles of the heading are applied according to the level.
|
|
11
|
+
* The html tag of the heading will be the one specified in the 'as' prop.
|
|
12
|
+
* If 'as' is not specified, the html tag of the heading is the one specified in the 'level' prop.
|
|
13
|
+
*/
|
|
14
|
+
level?: 1 | 2 | 3 | 4 | 5;
|
|
15
|
+
/**
|
|
16
|
+
* Heading text.
|
|
17
|
+
*/
|
|
18
|
+
text: string;
|
|
19
|
+
/**
|
|
20
|
+
* Specifies the html tag of the heading.
|
|
21
|
+
*/
|
|
22
|
+
as?: "h1" | "h2" | "h3" | "h4" | "h5";
|
|
23
|
+
/**
|
|
24
|
+
* Modifies the default weight of the heading.
|
|
25
|
+
*/
|
|
26
|
+
weight?: "light" | "normal" | "bold";
|
|
27
|
+
/**
|
|
28
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
29
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
30
|
+
*/
|
|
31
|
+
margin?: Space | Margin;
|
|
32
|
+
};
|
|
33
|
+
export default Props;
|
package/heading/types.js
ADDED
package/inline/Inline.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
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$alignX = _ref.alignX,
|
|
20
|
+
alignX = _ref$alignX === void 0 ? "stretch" : _ref$alignX,
|
|
21
|
+
_ref$alignY = _ref.alignY,
|
|
22
|
+
alignY = _ref$alignY === void 0 ? "stretch" : _ref$alignY,
|
|
23
|
+
_ref$as = _ref.as,
|
|
24
|
+
as = _ref$as === void 0 ? "div" : _ref$as,
|
|
25
|
+
_ref$divider = _ref.divider,
|
|
26
|
+
divider = _ref$divider === void 0 ? false : _ref$divider,
|
|
27
|
+
_ref$gutter = _ref.gutter,
|
|
28
|
+
gutter = _ref$gutter === void 0 ? "0rem" : _ref$gutter,
|
|
29
|
+
_ref$reverse = _ref.reverse,
|
|
30
|
+
reverse = _ref$reverse === void 0 ? false : _ref$reverse,
|
|
31
|
+
children = _ref.children;
|
|
32
|
+
return /*#__PURE__*/_react["default"].createElement(Inline, {
|
|
33
|
+
as: as,
|
|
34
|
+
alignX: alignX,
|
|
35
|
+
alignY: alignY,
|
|
36
|
+
gutter: gutter,
|
|
37
|
+
reverse: reverse
|
|
38
|
+
}, _react["default"].Children.map(children, function (child, index) {
|
|
39
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, child, divider && index !== _react["default"].Children.count(children) - 1 && /*#__PURE__*/_react["default"].createElement(Divider, null));
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
var Inline = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n ", "\n flex-wrap: wrap;\n"])), function (_ref2) {
|
|
44
|
+
var alignX = _ref2.alignX,
|
|
45
|
+
alignY = _ref2.alignY,
|
|
46
|
+
gutter = _ref2.gutter,
|
|
47
|
+
reverse = _ref2.reverse;
|
|
48
|
+
return "\n flex-direction: ".concat(reverse ? "row-reverse" : "row", ";\n align-items: ").concat(alignY === "start" || alignY === "end" ? "flex-".concat(alignY) : alignY, ";\n justify-content: ").concat(alignX === "start" || alignX === "end" ? "flex-".concat(alignX) : alignX, ";\n gap: ").concat(gutter, ";\n ");
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
var Divider = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n width: 1px;\n background-color: #999999;\n"])));
|
|
52
|
+
|
|
53
|
+
var _default = DxcInline;
|
|
54
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,220 @@
|
|
|
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="Default with one child" theme="light" level={4} />
|
|
34
|
+
<Container>
|
|
35
|
+
<DxcInline>
|
|
36
|
+
<Placeholder height="large" width="large" />
|
|
37
|
+
</DxcInline>
|
|
38
|
+
</Container>
|
|
39
|
+
<Title title="Wrap" theme="light" level={4} />
|
|
40
|
+
<Container customWidth>
|
|
41
|
+
<DxcInline>
|
|
42
|
+
<Placeholder height="large" width="small" />
|
|
43
|
+
<Placeholder height="large" width="medium" />
|
|
44
|
+
<Placeholder height="medium" width="small" />
|
|
45
|
+
<Placeholder height="large" width="medium" />
|
|
46
|
+
</DxcInline>
|
|
47
|
+
</Container>
|
|
48
|
+
<Title title="AlignY = end" theme="light" level={4} />
|
|
49
|
+
<Container>
|
|
50
|
+
<DxcInline alignY="end">
|
|
51
|
+
<Placeholder height="small" width="small" />
|
|
52
|
+
<Placeholder height="medium" width="medium" />
|
|
53
|
+
<Placeholder height="large" width="large" />
|
|
54
|
+
<Placeholder height="small" width="large" />
|
|
55
|
+
</DxcInline>
|
|
56
|
+
</Container>
|
|
57
|
+
<Title title="AlignY = center" theme="light" level={4} />
|
|
58
|
+
<Container>
|
|
59
|
+
<DxcInline alignY="center">
|
|
60
|
+
<Placeholder height="small" width="small" />
|
|
61
|
+
<Placeholder height="medium" width="medium" />
|
|
62
|
+
<Placeholder height="large" width="large" />
|
|
63
|
+
<Placeholder height="small" width="large" />
|
|
64
|
+
</DxcInline>
|
|
65
|
+
</Container>
|
|
66
|
+
<Title title="AlignY = baseline" theme="light" level={4} />
|
|
67
|
+
<Container>
|
|
68
|
+
<DxcInline alignY="baseline">
|
|
69
|
+
<Placeholder height="small" width="small" />
|
|
70
|
+
<Placeholder height="medium" width="medium" />
|
|
71
|
+
<Placeholder height="large" width="large" />
|
|
72
|
+
<Placeholder height="small" width="large" />
|
|
73
|
+
</DxcInline>
|
|
74
|
+
</Container>
|
|
75
|
+
<Title title="AlignY = stretch" theme="light" level={4} />
|
|
76
|
+
<Container>
|
|
77
|
+
<DxcInline alignY="stretch">
|
|
78
|
+
<Placeholder width="small" />
|
|
79
|
+
<Placeholder height="medium" width="medium" />
|
|
80
|
+
<Placeholder height="large" width="large" />
|
|
81
|
+
<Placeholder height="small" width="large" />
|
|
82
|
+
</DxcInline>
|
|
83
|
+
</Container>
|
|
84
|
+
<Title title="AlignX = end" theme="light" level={4} />
|
|
85
|
+
<Container>
|
|
86
|
+
<DxcInline alignX="end">
|
|
87
|
+
<Placeholder height="small" width="small" />
|
|
88
|
+
<Placeholder height="medium" width="medium" />
|
|
89
|
+
<Placeholder height="small" width="small" />
|
|
90
|
+
<Placeholder height="large" width="large" />
|
|
91
|
+
<Placeholder height="small" width="large" />
|
|
92
|
+
</DxcInline>
|
|
93
|
+
</Container>
|
|
94
|
+
<Title title="AlignX = center" theme="light" level={4} />
|
|
95
|
+
<Container>
|
|
96
|
+
<DxcInline alignX="center">
|
|
97
|
+
<Placeholder height="small" width="small" />
|
|
98
|
+
<Placeholder height="medium" width="medium" />
|
|
99
|
+
<Placeholder height="large" width="large" />
|
|
100
|
+
<Placeholder height="small" width="large" />
|
|
101
|
+
</DxcInline>
|
|
102
|
+
</Container>
|
|
103
|
+
<Title title="AlignX = baseline" theme="light" level={4} />
|
|
104
|
+
<Container>
|
|
105
|
+
<DxcInline alignX="baseline">
|
|
106
|
+
<Placeholder height="small" width="small" />
|
|
107
|
+
<Placeholder height="medium" width="medium" />
|
|
108
|
+
<Placeholder height="large" width="large" />
|
|
109
|
+
<Placeholder height="small" width="large" />
|
|
110
|
+
</DxcInline>
|
|
111
|
+
</Container>
|
|
112
|
+
<Title title="AlignX = stretch" theme="light" level={4} />
|
|
113
|
+
<Container>
|
|
114
|
+
<DxcInline alignX="stretch">
|
|
115
|
+
<Placeholder height="small" width="small" />
|
|
116
|
+
<Placeholder height="medium" width="medium" />
|
|
117
|
+
<Placeholder height="large" width="large" />
|
|
118
|
+
<Placeholder height="small" />
|
|
119
|
+
</DxcInline>
|
|
120
|
+
</Container>
|
|
121
|
+
<Title title="Gutter = 0.125rem" theme="light" level={4} />
|
|
122
|
+
<Container>
|
|
123
|
+
<DxcInline gutter="0.125rem">
|
|
124
|
+
<Placeholder height="small" width="small" />
|
|
125
|
+
<Placeholder height="medium" width="medium" />
|
|
126
|
+
<Placeholder height="large" width="large" />
|
|
127
|
+
<Placeholder height="small" width="large" />
|
|
128
|
+
</DxcInline>
|
|
129
|
+
</Container>
|
|
130
|
+
<Title title="Gutter = 0.25rem" theme="light" level={4} />
|
|
131
|
+
<Container>
|
|
132
|
+
<DxcInline gutter="0.25rem">
|
|
133
|
+
<Placeholder height="small" width="small" />
|
|
134
|
+
<Placeholder height="medium" width="medium" />
|
|
135
|
+
<Placeholder height="large" width="large" />
|
|
136
|
+
<Placeholder height="small" width="large" />
|
|
137
|
+
</DxcInline>
|
|
138
|
+
</Container>
|
|
139
|
+
<Title title="Gutter = 0.5rem" theme="light" level={4} />
|
|
140
|
+
<Container>
|
|
141
|
+
<DxcInline gutter="0.5rem">
|
|
142
|
+
<Placeholder height="small" width="small" />
|
|
143
|
+
<Placeholder height="medium" width="medium" />
|
|
144
|
+
<Placeholder height="large" width="large" />
|
|
145
|
+
<Placeholder height="small" width="large" />
|
|
146
|
+
</DxcInline>
|
|
147
|
+
</Container>
|
|
148
|
+
<Title title="Gutter = 0.75rem" theme="light" level={4} />
|
|
149
|
+
<Container>
|
|
150
|
+
<DxcInline gutter="0.75rem">
|
|
151
|
+
<Placeholder height="small" width="small" />
|
|
152
|
+
<Placeholder height="medium" width="medium" />
|
|
153
|
+
<Placeholder height="large" width="large" />
|
|
154
|
+
<Placeholder height="small" width="large" />
|
|
155
|
+
</DxcInline>
|
|
156
|
+
</Container>
|
|
157
|
+
<Title title="Gutter = 1rem" theme="light" level={4} />
|
|
158
|
+
<Container>
|
|
159
|
+
<DxcInline gutter="1rem">
|
|
160
|
+
<Placeholder height="small" width="small" />
|
|
161
|
+
<Placeholder height="medium" width="medium" />
|
|
162
|
+
<Placeholder height="large" width="large" />
|
|
163
|
+
<Placeholder height="small" width="large" />
|
|
164
|
+
</DxcInline>
|
|
165
|
+
</Container>
|
|
166
|
+
<Title title="Gutter = 1.5rem" theme="light" level={4} />
|
|
167
|
+
<Container>
|
|
168
|
+
<DxcInline gutter="1.5rem">
|
|
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 = 2rem and divider" theme="light" level={4} />
|
|
176
|
+
<Container>
|
|
177
|
+
<DxcInline gutter="2rem" divider>
|
|
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="Reverse" theme="light" level={4} />
|
|
185
|
+
<Container>
|
|
186
|
+
<DxcInline reverse>
|
|
187
|
+
<Placeholder height="small" width="small">
|
|
188
|
+
1
|
|
189
|
+
</Placeholder>
|
|
190
|
+
<Placeholder height="medium" width="medium">
|
|
191
|
+
2
|
|
192
|
+
</Placeholder>
|
|
193
|
+
<Placeholder height="large" width="large">
|
|
194
|
+
3
|
|
195
|
+
</Placeholder>
|
|
196
|
+
<Placeholder height="small" width="large">
|
|
197
|
+
4
|
|
198
|
+
</Placeholder>
|
|
199
|
+
</DxcInline>
|
|
200
|
+
</Container>
|
|
201
|
+
</>
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
const Container = styled.div<{ customWidth?: boolean }>`
|
|
205
|
+
background: #f2eafa;
|
|
206
|
+
${({ customWidth }) => (customWidth ? `width: 300px;` : "")};
|
|
207
|
+
`;
|
|
208
|
+
|
|
209
|
+
type PlaceholderProps = {
|
|
210
|
+
width?: "large" | "medium" | "small" | "auto";
|
|
211
|
+
height?: "large" | "medium" | "small" | "auto";
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const Placeholder = styled.div<PlaceholderProps>`
|
|
215
|
+
${({ width }) => (width ? `width: ${width === "large" ? "150px" : width === "medium" ? "100px" : "50px"};` : "")};
|
|
216
|
+
${({ height }) =>
|
|
217
|
+
height ? `height: ${height === "large" ? "150px" : height === "medium" ? "100px" : "50px"};` : ""};
|
|
218
|
+
border: 1px solid #a46ede;
|
|
219
|
+
background-color: #e5d5f6;
|
|
220
|
+
`;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Props = {
|
|
3
|
+
/**
|
|
4
|
+
* Align children in the main axis.
|
|
5
|
+
*/
|
|
6
|
+
alignX?: "start" | "end" | "center" | "baseline" | "stretch";
|
|
7
|
+
/**
|
|
8
|
+
* Align children in the cross axis.
|
|
9
|
+
*/
|
|
10
|
+
alignY?: "start" | "end" | "center" | "baseline" | "stretch";
|
|
11
|
+
/**
|
|
12
|
+
* Set the component to a different HTML tag.
|
|
13
|
+
*/
|
|
14
|
+
as?: React.ElementType;
|
|
15
|
+
/**
|
|
16
|
+
* Add a divider between columns.
|
|
17
|
+
*/
|
|
18
|
+
divider?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Spacing between columns.
|
|
21
|
+
*/
|
|
22
|
+
gutter?: "0rem" | "0.125rem" | "0.25rem" | "0.5rem" | "0.75rem" | "1rem" | "1.5rem" | "2rem";
|
|
23
|
+
/**
|
|
24
|
+
* Change the flex-direction of the column to reverse.
|
|
25
|
+
*/
|
|
26
|
+
reverse?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Single column.
|
|
29
|
+
*/
|
|
30
|
+
children: React.ReactElement<React.ReactNode>[] | React.ReactElement<React.ReactNode>;
|
|
31
|
+
};
|
|
32
|
+
export default Props;
|
package/inline/types.js
ADDED
package/inset/Inset.d.ts
ADDED
package/inset/Inset.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
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"] = Inset;
|
|
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;
|
|
17
|
+
|
|
18
|
+
function Inset(_ref) {
|
|
19
|
+
var space = _ref.space,
|
|
20
|
+
horizontal = _ref.horizontal,
|
|
21
|
+
vertical = _ref.vertical,
|
|
22
|
+
top = _ref.top,
|
|
23
|
+
right = _ref.right,
|
|
24
|
+
bottom = _ref.bottom,
|
|
25
|
+
left = _ref.left,
|
|
26
|
+
children = _ref.children;
|
|
27
|
+
return /*#__PURE__*/_react["default"].createElement(StyledInset, {
|
|
28
|
+
space: space,
|
|
29
|
+
horizontal: horizontal,
|
|
30
|
+
vertical: vertical,
|
|
31
|
+
top: top,
|
|
32
|
+
right: right,
|
|
33
|
+
bottom: bottom,
|
|
34
|
+
left: left
|
|
35
|
+
}, children);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getSpacingValue(spacingName) {
|
|
39
|
+
return spacingName ? spacingName : "0rem";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var StyledInset = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n ", "\n"])), function (_ref2) {
|
|
43
|
+
var space = _ref2.space,
|
|
44
|
+
horizontal = _ref2.horizontal,
|
|
45
|
+
vertical = _ref2.vertical,
|
|
46
|
+
top = _ref2.top,
|
|
47
|
+
right = _ref2.right,
|
|
48
|
+
bottom = _ref2.bottom,
|
|
49
|
+
left = _ref2.left;
|
|
50
|
+
return "\n padding: ".concat(getSpacingValue(top || vertical || space), " ").concat(getSpacingValue(right || horizontal || space), "\n ").concat(getSpacingValue(bottom || vertical || space), " ").concat(getSpacingValue(left || horizontal || space), ";\n");
|
|
51
|
+
});
|