@dxc-technology/halstack-react 4.0.0 → 6.0.0
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 +7 -6
- package/HalstackContext.d.ts +12 -0
- package/HalstackContext.js +295 -0
- package/accordion/Accordion.d.ts +4 -0
- package/accordion/Accordion.js +35 -162
- package/accordion/Accordion.stories.tsx +307 -0
- package/accordion/Accordion.test.js +72 -0
- package/accordion/types.d.ts +68 -0
- package/accordion/types.js +5 -0
- package/accordion-group/AccordionGroup.d.ts +7 -0
- package/accordion-group/AccordionGroup.js +68 -85
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/AccordionGroup.test.js +151 -0
- package/accordion-group/types.d.ts +72 -0
- package/accordion-group/types.js +5 -0
- package/alert/Alert.d.ts +4 -0
- package/alert/Alert.js +43 -153
- package/alert/Alert.stories.tsx +170 -0
- package/alert/Alert.test.js +92 -0
- package/alert/types.d.ts +49 -0
- package/alert/types.js +5 -0
- package/badge/Badge.d.ts +4 -0
- package/badge/Badge.js +15 -17
- package/badge/types.d.ts +5 -0
- package/badge/types.js +5 -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 +4 -0
- package/box/Box.js +36 -76
- package/box/Box.stories.tsx +132 -0
- package/box/Box.test.js +18 -0
- package/box/types.d.ts +43 -0
- package/box/types.js +5 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +123 -0
- package/bulleted-list/BulletedList.stories.tsx +200 -0
- package/bulleted-list/types.d.ts +11 -0
- package/bulleted-list/types.js +5 -0
- package/button/Button.d.ts +4 -0
- package/button/Button.js +33 -97
- package/button/Button.stories.tsx +274 -0
- package/button/Button.test.js +35 -0
- package/button/types.d.ts +53 -0
- package/button/types.js +5 -0
- package/card/Card.d.ts +4 -0
- package/card/Card.js +44 -137
- 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 +67 -0
- package/card/types.js +5 -0
- package/checkbox/Checkbox.d.ts +4 -0
- package/checkbox/Checkbox.js +52 -94
- package/checkbox/Checkbox.stories.tsx +188 -0
- package/checkbox/Checkbox.test.js +78 -0
- package/checkbox/types.d.ts +64 -0
- package/checkbox/types.js +5 -0
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +26 -130
- 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/RequiredComponent.js +3 -11
- package/common/variables.js +301 -373
- package/date-input/DateInput.d.ts +4 -0
- package/date-input/DateInput.js +80 -108
- package/date-input/DateInput.stories.tsx +138 -0
- package/date-input/DateInput.test.js +479 -0
- package/date-input/types.d.ts +107 -0
- package/date-input/types.js +5 -0
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +25 -105
- package/dialog/Dialog.stories.tsx +212 -0
- package/dialog/Dialog.test.js +40 -0
- package/dialog/types.d.ts +43 -0
- package/dialog/types.js +5 -0
- package/dropdown/Dropdown.d.ts +4 -0
- package/dropdown/Dropdown.js +54 -207
- package/dropdown/Dropdown.stories.tsx +249 -0
- package/dropdown/Dropdown.test.js +189 -0
- package/dropdown/types.d.ts +80 -0
- package/dropdown/types.js +5 -0
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +200 -251
- 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 +44 -145
- package/file-input/types.d.ts +112 -0
- package/file-input/types.js +5 -0
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +57 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +21 -0
- package/flex/types.js +5 -0
- package/footer/Footer.d.ts +4 -0
- package/footer/Footer.js +50 -286
- package/footer/Footer.stories.tsx +130 -0
- package/footer/Footer.test.js +109 -0
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +16 -16
- package/footer/types.d.ts +65 -0
- package/footer/types.js +5 -0
- package/header/Header.d.ts +7 -0
- package/header/Header.js +82 -249
- package/header/Header.stories.tsx +172 -0
- package/header/Header.test.js +79 -0
- package/header/Icons.d.ts +2 -0
- package/header/Icons.js +7 -32
- package/header/types.d.ts +47 -0
- package/header/types.js +5 -0
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +25 -96
- 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/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 +20 -0
- package/layout/ApplicationLayout.js +76 -232
- package/layout/ApplicationLayout.stories.tsx +161 -0
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +19 -8
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +42 -0
- package/layout/types.js +5 -0
- package/link/Link.d.ts +4 -0
- package/link/Link.js +64 -165
- package/link/Link.stories.tsx +186 -0
- package/link/Link.test.js +83 -0
- package/link/types.d.ts +54 -0
- package/link/types.js +5 -0
- package/main.d.ts +44 -40
- package/main.js +114 -104
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +21 -81
- package/number-input/NumberInput.stories.tsx +115 -0
- 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 +23 -16
- package/paginator/Icons.js +9 -9
- package/paginator/Paginator.d.ts +4 -0
- package/paginator/Paginator.js +32 -166
- package/paginator/Paginator.stories.tsx +63 -0
- package/paginator/Paginator.test.js +308 -0
- package/paginator/types.d.ts +38 -0
- package/paginator/types.js +5 -0
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/password-input/PasswordInput.js +40 -77
- package/password-input/PasswordInput.stories.tsx +131 -0
- package/password-input/PasswordInput.test.js +180 -0
- package/password-input/types.d.ts +110 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.d.ts +4 -0
- package/progress-bar/ProgressBar.js +23 -95
- package/progress-bar/ProgressBar.stories.jsx +58 -0
- package/progress-bar/ProgressBar.test.js +65 -0
- package/progress-bar/types.d.ts +37 -0
- package/progress-bar/types.js +5 -0
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +118 -0
- package/quick-nav/QuickNav.stories.tsx +264 -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 +283 -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 +43 -147
- package/resultsetTable/ResultsetTable.stories.tsx +275 -0
- package/resultsetTable/ResultsetTable.test.js +348 -0
- package/resultsetTable/types.d.ts +67 -0
- package/resultsetTable/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 +175 -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 +231 -709
- package/select/Select.stories.tsx +626 -0
- package/select/Select.test.js +2162 -0
- package/select/types.d.ts +212 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.d.ts +10 -0
- package/sidenav/Sidenav.js +182 -105
- package/sidenav/Sidenav.stories.tsx +180 -0
- package/sidenav/Sidenav.test.js +44 -0
- package/sidenav/types.d.ts +73 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +4 -0
- package/slider/Slider.js +76 -162
- package/slider/Slider.stories.tsx +177 -0
- package/slider/Slider.test.js +150 -0
- package/slider/types.d.ts +82 -0
- package/slider/types.js +5 -0
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +46 -177
- package/spinner/Spinner.stories.jsx +103 -0
- package/spinner/Spinner.test.js +64 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/switch/Switch.d.ts +4 -0
- package/switch/Switch.js +55 -82
- package/switch/Switch.stories.tsx +160 -0
- package/switch/Switch.test.js +98 -0
- package/switch/types.d.ts +62 -0
- package/switch/types.js +5 -0
- package/table/Table.d.ts +4 -0
- package/table/Table.js +12 -26
- package/table/Table.stories.jsx +277 -0
- package/table/Table.test.js +26 -0
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tabs/Tabs.d.ts +4 -0
- package/tabs/Tabs.js +43 -175
- package/tabs/Tabs.stories.tsx +112 -0
- package/tabs/Tabs.test.js +140 -0
- package/tabs/types.d.ts +82 -0
- package/tabs/types.js +5 -0
- 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 +4 -0
- package/tag/Tag.js +44 -143
- package/tag/Tag.stories.tsx +142 -0
- package/tag/Tag.test.js +60 -0
- package/tag/types.d.ts +69 -0
- package/tag/types.js +5 -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 +169 -391
- 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 +50 -142
- package/textarea/Textarea.stories.jsx +157 -0
- 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 +36 -148
- 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/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +131 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/typography/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 +132 -252
- package/wizard/Wizard.stories.tsx +233 -0
- package/wizard/Wizard.test.js +141 -0
- package/wizard/types.d.ts +65 -0
- package/wizard/types.js +5 -0
- package/ThemeContext.js +0 -250
- package/V3Select/V3Select.js +0 -549
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -264
- package/V3Textarea/index.d.ts +0 -27
- package/accordion/index.d.ts +0 -28
- package/accordion-group/index.d.ts +0 -16
- package/alert/index.d.ts +0 -51
- package/box/index.d.ts +0 -25
- package/button/Button.stories.js +0 -27
- package/button/index.d.ts +0 -24
- package/card/index.d.ts +0 -22
- package/checkbox/index.d.ts +0 -24
- package/chip/index.d.ts +0 -22
- package/date/Date.js +0 -379
- package/date/index.d.ts +0 -27
- package/date-input/index.d.ts +0 -95
- package/dialog/index.d.ts +0 -18
- package/dropdown/index.d.ts +0 -26
- package/file-input/index.d.ts +0 -81
- package/footer/index.d.ts +0 -25
- package/header/index.d.ts +0 -25
- package/heading/index.d.ts +0 -17
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -705
- package/input-text/index.d.ts +0 -36
- package/link/index.d.ts +0 -23
- package/number-input/index.d.ts +0 -113
- package/paginator/index.d.ts +0 -20
- package/password-input/index.d.ts +0 -94
- package/progress-bar/index.d.ts +0 -18
- package/radio/Radio.js +0 -209
- package/radio/index.d.ts +0 -23
- package/resultsetTable/index.d.ts +0 -19
- package/select/index.d.ts +0 -131
- package/sidenav/index.d.ts +0 -13
- package/slider/index.d.ts +0 -29
- package/spinner/index.d.ts +0 -17
- package/switch/index.d.ts +0 -24
- package/table/index.d.ts +0 -13
- package/tabs/index.d.ts +0 -19
- package/tag/index.d.ts +0 -24
- package/text-input/index.d.ts +0 -135
- package/textarea/index.d.ts +0 -117
- package/toggle/Toggle.js +0 -220
- package/toggle/index.d.ts +0 -21
- package/toggle-group/index.d.ts +0 -21
- package/upload/Upload.js +0 -205
- package/upload/buttons-upload/ButtonsUpload.js +0 -135
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -329
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -189
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -123
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -148
- package/upload/transactions/Transactions.js +0 -138
- package/wizard/Icons.js +0 -65
- package/wizard/index.d.ts +0 -18
package/file-input/FileItem.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
@@ -13,132 +13,36 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
13
13
|
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
|
|
16
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
-
|
|
18
16
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
17
|
|
|
20
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
21
|
-
|
|
22
|
-
function _templateObject10() {
|
|
23
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
24
|
-
|
|
25
|
-
_templateObject10 = function _templateObject10() {
|
|
26
|
-
return data;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
return data;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function _templateObject9() {
|
|
33
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 4px;\n margin-left: 4px;\n background-color: transparent;\n padding: 3px;\n cursor: pointer;\n svg {\n line-height: 18px;\n }\n &:hover {\n background-color: ", ";\n }\n &:focus {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n }\n"]);
|
|
34
|
-
|
|
35
|
-
_templateObject9 = function _templateObject9() {
|
|
36
|
-
return data;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return data;
|
|
40
|
-
}
|
|
18
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
41
19
|
|
|
42
|
-
|
|
43
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n color: #d0011b;\n"]);
|
|
20
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
44
21
|
|
|
45
|
-
|
|
46
|
-
return data;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
return data;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function _templateObject7() {
|
|
53
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n width: ", ";\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
54
|
-
|
|
55
|
-
_templateObject7 = function _templateObject7() {
|
|
56
|
-
return data;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
return data;
|
|
60
|
-
}
|
|
22
|
+
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); }
|
|
61
23
|
|
|
62
|
-
function
|
|
63
|
-
var data = (0, _taggedTemplateLiteral2["default"])([""]);
|
|
24
|
+
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; }
|
|
64
25
|
|
|
65
|
-
|
|
66
|
-
return data;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
return data;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function _templateObject5() {
|
|
73
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: 12px;\n background-color: ", ";\n width: 48px;\n height: 48px;\n border-radius: 2px;\n color: ", ";\n"]);
|
|
74
|
-
|
|
75
|
-
_templateObject5 = function _templateObject5() {
|
|
76
|
-
return data;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
return data;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function _templateObject4() {
|
|
83
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n width: 48px;\n height: 48px;\n object-fit: contain;\n margin-right: 12px;\n border-radius: 2px;\n"]);
|
|
84
|
-
|
|
85
|
-
_templateObject4 = function _templateObject4() {
|
|
86
|
-
return data;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
return data;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function _templateObject3() {
|
|
93
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n align-items: center;\n"]);
|
|
94
|
-
|
|
95
|
-
_templateObject3 = function _templateObject3() {
|
|
96
|
-
return data;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
return data;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function _templateObject2() {
|
|
103
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n"]);
|
|
104
|
-
|
|
105
|
-
_templateObject2 = function _templateObject2() {
|
|
106
|
-
return data;
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
return data;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function _templateObject() {
|
|
113
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n padding: ", ";\n background-color: ", ";\n border-radius: ", ";\n width: ", ";\n min-height: ", ";\n border-color: ", ";\n border-width: ", ";\n border-style: ", ";\n display: flex;\n justify-content: center;\n"]);
|
|
114
|
-
|
|
115
|
-
_templateObject = function _templateObject() {
|
|
116
|
-
return data;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
return data;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
var deleteIcon = _react["default"].createElement("svg", {
|
|
26
|
+
var deleteIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
123
27
|
xmlns: "http://www.w3.org/2000/svg",
|
|
124
28
|
width: "24",
|
|
125
29
|
height: "24",
|
|
126
30
|
viewBox: "0 0 24 24",
|
|
127
31
|
fill: "currentColor"
|
|
128
|
-
}, _react["default"].createElement("path", {
|
|
32
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
129
33
|
d: "M0 0h24v24H0V0z",
|
|
130
34
|
fill: "none"
|
|
131
|
-
}), _react["default"].createElement("path", {
|
|
35
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
132
36
|
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
|
|
133
37
|
}));
|
|
134
38
|
|
|
135
|
-
var errorIcon = _react["default"].createElement("svg", {
|
|
39
|
+
var errorIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
136
40
|
xmlns: "http://www.w3.org/2000/svg",
|
|
137
41
|
height: "24px",
|
|
138
42
|
viewBox: "0 0 24 24",
|
|
139
43
|
width: "24px",
|
|
140
44
|
fill: "currentColor"
|
|
141
|
-
}, _react["default"].createElement("path", {
|
|
45
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
142
46
|
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"
|
|
143
47
|
}));
|
|
144
48
|
|
|
@@ -153,7 +57,8 @@ var FileItem = function FileItem(_ref) {
|
|
|
153
57
|
preview = _ref.preview,
|
|
154
58
|
type = _ref.type,
|
|
155
59
|
numFiles = _ref.numFiles,
|
|
156
|
-
onDelete = _ref.onDelete
|
|
60
|
+
onDelete = _ref.onDelete,
|
|
61
|
+
tabIndex = _ref.tabIndex;
|
|
157
62
|
var colorsTheme = (0, _useTheme["default"])();
|
|
158
63
|
var isImage = type.includes("image");
|
|
159
64
|
|
|
@@ -169,41 +74,42 @@ var FileItem = function FileItem(_ref) {
|
|
|
169
74
|
return "file";
|
|
170
75
|
};
|
|
171
76
|
|
|
172
|
-
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
77
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
173
78
|
theme: colorsTheme.fileInput
|
|
174
|
-
}, _react["default"].createElement(Container, {
|
|
79
|
+
}, /*#__PURE__*/_react["default"].createElement(Container, {
|
|
175
80
|
mode: mode,
|
|
176
81
|
multiple: multiple,
|
|
177
82
|
error: error,
|
|
178
83
|
showPreview: showPreview,
|
|
179
84
|
numFiles: numFiles
|
|
180
|
-
}, showPreview && (isImage ? _react["default"].createElement(ImagePreview, {
|
|
85
|
+
}, showPreview && (isImage ? /*#__PURE__*/_react["default"].createElement(ImagePreview, {
|
|
181
86
|
src: preview,
|
|
182
87
|
alt: name
|
|
183
|
-
}) : _react["default"].createElement(IconPreviewContainer, {
|
|
88
|
+
}) : /*#__PURE__*/_react["default"].createElement(IconPreviewContainer, {
|
|
184
89
|
error: error,
|
|
185
90
|
"aria-label": getIconAriaLabel()
|
|
186
|
-
}, _react["default"].createElement(IconPreview, {
|
|
91
|
+
}, /*#__PURE__*/_react["default"].createElement(IconPreview, {
|
|
187
92
|
error: error
|
|
188
|
-
}, preview))), _react["default"].createElement(FileItemContent, null, _react["default"].createElement(FileItemContainer, null, _react["default"].createElement(FileName, {
|
|
93
|
+
}, preview))), /*#__PURE__*/_react["default"].createElement(FileItemContent, null, /*#__PURE__*/_react["default"].createElement(FileItemContainer, null, /*#__PURE__*/_react["default"].createElement(FileName, {
|
|
189
94
|
mode: mode,
|
|
190
95
|
multiple: multiple,
|
|
191
96
|
error: error,
|
|
192
97
|
showPreview: showPreview,
|
|
193
98
|
numFiles: numFiles
|
|
194
|
-
}, name), error && _react["default"].createElement(ErrorIcon, {
|
|
99
|
+
}, name), error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, {
|
|
195
100
|
"aria-label": "Error"
|
|
196
|
-
}, errorIcon), _react["default"].createElement(DeleteIcon, {
|
|
101
|
+
}, errorIcon), /*#__PURE__*/_react["default"].createElement(DeleteIcon, {
|
|
197
102
|
error: error,
|
|
198
103
|
onClick: function onClick() {
|
|
199
104
|
return onDelete(name);
|
|
200
105
|
},
|
|
201
|
-
"aria-label": "Remove ".concat(name)
|
|
202
|
-
|
|
106
|
+
"aria-label": "Remove ".concat(name),
|
|
107
|
+
tabIndex: tabIndex
|
|
108
|
+
}, deleteIcon)), error && (multiple || numFiles > 1) && /*#__PURE__*/_react["default"].createElement(ErrorMessage, null, error))));
|
|
203
109
|
};
|
|
204
110
|
|
|
205
|
-
var Container = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
206
|
-
return props.showPreview ? "8px" : "8px 8px 8px 16px";
|
|
111
|
+
var Container = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n padding: ", ";\n background-color: ", ";\n border-radius: ", ";\n width: ", ";\n min-height: ", ";\n border-color: ", ";\n border-width: ", ";\n border-style: ", ";\n display: flex;\n justify-content: center;\n"])), function (props) {
|
|
112
|
+
return props.showPreview ? "calc(8px - ".concat(props.theme.fileItemBorderThickness, ") 8px") : "calc(8px - ".concat(props.theme.fileItemBorderThickness, ") 8px calc(8px - ").concat(props.theme.fileItemBorderThickness, ") 16px");
|
|
207
113
|
}, function (props) {
|
|
208
114
|
return props.error && props.theme.errorFileItemBackgroundColor;
|
|
209
115
|
}, function (props) {
|
|
@@ -220,21 +126,21 @@ var Container = _styledComponents["default"].div(_templateObject(), function (pr
|
|
|
220
126
|
return props.theme.fileItemBorderStyle;
|
|
221
127
|
});
|
|
222
128
|
|
|
223
|
-
var FileItemContent = _styledComponents["default"].div(_templateObject2());
|
|
129
|
+
var FileItemContent = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n"])));
|
|
224
130
|
|
|
225
|
-
var FileItemContainer = _styledComponents["default"].div(_templateObject3());
|
|
131
|
+
var FileItemContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n align-items: center;\n"])));
|
|
226
132
|
|
|
227
|
-
var ImagePreview = _styledComponents["default"].img(_templateObject4());
|
|
133
|
+
var ImagePreview = _styledComponents["default"].img(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n width: 48px;\n height: 48px;\n object-fit: contain;\n margin-right: 12px;\n border-radius: 2px;\n"])));
|
|
228
134
|
|
|
229
|
-
var IconPreviewContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
|
|
230
|
-
return props.error ? props.theme.
|
|
135
|
+
var IconPreviewContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: 12px;\n background-color: ", ";\n width: 48px;\n height: 48px;\n border-radius: 2px;\n color: ", ";\n"])), function (props) {
|
|
136
|
+
return props.error ? props.theme.errorFilePreviewBackgroundColor : props.theme.filePreviewBackgroundColor;
|
|
231
137
|
}, function (props) {
|
|
232
|
-
return props.error ? props.theme.
|
|
138
|
+
return props.error ? props.theme.errorFilePreviewIconColor : props.theme.filePreviewIconColor;
|
|
233
139
|
});
|
|
234
140
|
|
|
235
|
-
var IconPreview = _styledComponents["default"].div(_templateObject6());
|
|
141
|
+
var IconPreview = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
236
142
|
|
|
237
|
-
var FileName = _styledComponents["default"].span(_templateObject7(), function (props) {
|
|
143
|
+
var FileName = _styledComponents["default"].span(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n width: ", ";\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
|
|
238
144
|
return props.theme.fileNameFontColor;
|
|
239
145
|
}, function (props) {
|
|
240
146
|
return props.mode === "file" && !props.multiple && props.error && props.numFiles === 1 ? "calc(230px - 76px)" : props.mode === "file" && !props.multiple && !props.error && props.numFiles === 1 ? "calc(230px - 50px)" : !props.showPreview && !props.error ? "calc(320px - 52px)" : !props.showPreview && props.error ? "calc(320px - 76px)" : props.showPreview && props.error ? "calc(320px - 128px)" : props.showPreview && !props.error && "calc(320px - 102px)";
|
|
@@ -248,19 +154,23 @@ var FileName = _styledComponents["default"].span(_templateObject7(), function (p
|
|
|
248
154
|
return props.theme.fileItemLineHeight;
|
|
249
155
|
});
|
|
250
156
|
|
|
251
|
-
var ErrorIcon = _styledComponents["default"].span(_templateObject8());
|
|
157
|
+
var ErrorIcon = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n color: #d0011b;\n"])));
|
|
252
158
|
|
|
253
|
-
var DeleteIcon = _styledComponents["default"].button(_templateObject9(), function (props) {
|
|
159
|
+
var DeleteIcon = _styledComponents["default"].button(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 2px;\n margin-left: 4px;\n background-color: transparent;\n box-shadow: 0 0 0 2px transparent;\n padding: 3px;\n cursor: pointer;\n color: ", ";\n svg {\n line-height: 18px;\n }\n &:hover {\n background-color: ", ";\n }\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n &:active {\n background-color: ", ";\n }\n"])), function (props) {
|
|
254
160
|
return props.theme.fontFamily;
|
|
255
161
|
}, function (props) {
|
|
256
|
-
return props.
|
|
162
|
+
return props.theme.deleteFileItemColor;
|
|
163
|
+
}, function (props) {
|
|
164
|
+
return props.theme.hoverDeleteFileItemBackgroundColor;
|
|
257
165
|
}, function (props) {
|
|
258
|
-
return props.
|
|
166
|
+
return props.theme.focusDeleteFileItemBorderColor;
|
|
259
167
|
}, function (props) {
|
|
260
|
-
return props.
|
|
168
|
+
return props.theme.focusDeleteFileItemBorderColor;
|
|
169
|
+
}, function (props) {
|
|
170
|
+
return props.theme.activeDeleteFileItemBackgroundColor;
|
|
261
171
|
});
|
|
262
172
|
|
|
263
|
-
var ErrorMessage = _styledComponents["default"].span(_templateObject10(), function (props) {
|
|
173
|
+
var ErrorMessage = _styledComponents["default"].span(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
|
|
264
174
|
return props.theme.errorMessageFontColor;
|
|
265
175
|
}, function (props) {
|
|
266
176
|
return props.theme.errorMessageFontFamily;
|
|
@@ -272,16 +182,5 @@ var ErrorMessage = _styledComponents["default"].span(_templateObject10(), functi
|
|
|
272
182
|
return props.theme.errorMessageLineHeight;
|
|
273
183
|
});
|
|
274
184
|
|
|
275
|
-
FileItem.propTypes = {
|
|
276
|
-
mode: _propTypes["default"].string,
|
|
277
|
-
multiple: _propTypes["default"].bool,
|
|
278
|
-
name: _propTypes["default"].string,
|
|
279
|
-
type: _propTypes["default"].string,
|
|
280
|
-
showPreview: _propTypes["default"]["boolean"],
|
|
281
|
-
numFiles: _propTypes["default"].number,
|
|
282
|
-
preview: _propTypes["default"].string,
|
|
283
|
-
error: _propTypes["default"].string,
|
|
284
|
-
onDelete: _propTypes["default"].func
|
|
285
|
-
};
|
|
286
185
|
var _default = FileItem;
|
|
287
186
|
exports["default"] = _default;
|
|
@@ -0,0 +1,112 @@
|
|
|
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 FileData = {
|
|
9
|
+
/**
|
|
10
|
+
* Selected file.
|
|
11
|
+
*/
|
|
12
|
+
file: File;
|
|
13
|
+
/**
|
|
14
|
+
* Error of the file. If it is defined, it will be shown and the file item will be mark as invalid.
|
|
15
|
+
*/
|
|
16
|
+
error?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Preview of the file.
|
|
19
|
+
*/
|
|
20
|
+
preview?: string;
|
|
21
|
+
};
|
|
22
|
+
declare type CommonProps = {
|
|
23
|
+
/**
|
|
24
|
+
* Name attribute.
|
|
25
|
+
*/
|
|
26
|
+
name?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Text to be placed above the component.
|
|
29
|
+
*/
|
|
30
|
+
label?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Text to be placed inside the button.
|
|
33
|
+
*/
|
|
34
|
+
buttonLabel?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Helper text to be placed above the component.
|
|
37
|
+
*/
|
|
38
|
+
helperText?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The file types that the component accepts. Its value must be one of all the possible values of the HTML file input's accept attribute.
|
|
41
|
+
*/
|
|
42
|
+
accept?: string;
|
|
43
|
+
/**
|
|
44
|
+
* An array of files representing the selected files.
|
|
45
|
+
*/
|
|
46
|
+
value: FileData[];
|
|
47
|
+
/**
|
|
48
|
+
* The minimum file size (in bytes) allowed. If the size of the file does not comply the minSize, the file will have an error.
|
|
49
|
+
*/
|
|
50
|
+
minSize?: number;
|
|
51
|
+
/**
|
|
52
|
+
* The maximum file size (in bytes) allowed. If the size of the file does not comply the maxSize, the file will have an error.
|
|
53
|
+
*/
|
|
54
|
+
maxSize?: number;
|
|
55
|
+
/**
|
|
56
|
+
* If true, if the file is an image, a preview of it will be shown. If not, an icon refering to the file type will be shown.
|
|
57
|
+
*/
|
|
58
|
+
showPreview?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* If true, the component allows multiple file items and will show all of them. If false, only one file will be shown, and if there is already one
|
|
61
|
+
* file selected and a new one is chosen, it will be replaced by the new selected one.
|
|
62
|
+
*/
|
|
63
|
+
multiple?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* If true, the component will be disabled.
|
|
66
|
+
*/
|
|
67
|
+
disabled?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* This function will be called when the user selects or drops a file. The list of files will be sent as a parameter.
|
|
70
|
+
* In this function, the files can be updated or returned as they come. These files must be passed to the value in order to be shown.
|
|
71
|
+
*/
|
|
72
|
+
callbackFile: (files: FileData[]) => void;
|
|
73
|
+
/**
|
|
74
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
75
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
76
|
+
*/
|
|
77
|
+
margin?: Space | Margin;
|
|
78
|
+
/**
|
|
79
|
+
* Value of the tabindex attribute.
|
|
80
|
+
*/
|
|
81
|
+
tabIndex?: number;
|
|
82
|
+
};
|
|
83
|
+
declare type DropModeProps = CommonProps & {
|
|
84
|
+
/**
|
|
85
|
+
* Uses one of the available file input modes:
|
|
86
|
+
* 'file': Files are selected by clicking the button and selecting it through the file explorer.
|
|
87
|
+
* 'filedrop': Files can be selected by clicking the button and selecting it through the file explorer or by dropping them inside the drag and drop area.
|
|
88
|
+
* 'dropzone': Files can be selected by clicking the button and selecting it through the file explorer or by dropping them inside the drag and drop area.
|
|
89
|
+
* The drag and drop area of this mode is bigger than the one of the filedrop mode.
|
|
90
|
+
*/
|
|
91
|
+
mode: "filedrop" | "dropzone";
|
|
92
|
+
/**
|
|
93
|
+
* Text to be placed inside the drag and drop zone alongside the button.
|
|
94
|
+
*/
|
|
95
|
+
dropAreaLabel?: string;
|
|
96
|
+
};
|
|
97
|
+
declare type FileModeProps = CommonProps & {
|
|
98
|
+
/**
|
|
99
|
+
* Uses one of the available file input modes:
|
|
100
|
+
* 'file': Files are selected by clicking the button and selecting it through the file explorer.
|
|
101
|
+
* 'filedrop': Files can be selected by clicking the button and selecting it through the file explorer or by dropping them inside the drag and drop area.
|
|
102
|
+
* 'dropzone': Files can be selected by clicking the button and selecting it through the file explorer or by dropping them inside the drag and drop area.
|
|
103
|
+
* The drag and drop area of this mode is bigger than the one of the filedrop mode.
|
|
104
|
+
*/
|
|
105
|
+
mode?: "file";
|
|
106
|
+
/**
|
|
107
|
+
* Text to be placed inside the drag and drop zone alongside the button.
|
|
108
|
+
*/
|
|
109
|
+
dropAreaLabel?: never;
|
|
110
|
+
};
|
|
111
|
+
declare type Props = DropModeProps | FileModeProps;
|
|
112
|
+
export default Props;
|
package/flex/Flex.d.ts
ADDED
package/flex/Flex.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
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 _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
+
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
14
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireDefault(require("react"));
|
|
17
|
+
|
|
18
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
19
|
+
|
|
20
|
+
var _templateObject;
|
|
21
|
+
|
|
22
|
+
var _excluded = ["children"];
|
|
23
|
+
|
|
24
|
+
var DxcFlex = function DxcFlex(_ref) {
|
|
25
|
+
var children = _ref.children,
|
|
26
|
+
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
27
|
+
return /*#__PURE__*/_react["default"].createElement(Flex, props, children);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var Flex = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n ", "\n"])), function (_ref2) {
|
|
31
|
+
var _ref2$direction = _ref2.direction,
|
|
32
|
+
direction = _ref2$direction === void 0 ? "row" : _ref2$direction,
|
|
33
|
+
_ref2$wrap = _ref2.wrap,
|
|
34
|
+
wrap = _ref2$wrap === void 0 ? "nowrap" : _ref2$wrap,
|
|
35
|
+
_ref2$justifyContent = _ref2.justifyContent,
|
|
36
|
+
justifyContent = _ref2$justifyContent === void 0 ? "flex-start" : _ref2$justifyContent,
|
|
37
|
+
_ref2$alignItems = _ref2.alignItems,
|
|
38
|
+
alignItems = _ref2$alignItems === void 0 ? "stretch" : _ref2$alignItems,
|
|
39
|
+
_ref2$alignContent = _ref2.alignContent,
|
|
40
|
+
alignContent = _ref2$alignContent === void 0 ? "normal" : _ref2$alignContent,
|
|
41
|
+
_ref2$alignSelf = _ref2.alignSelf,
|
|
42
|
+
alignSelf = _ref2$alignSelf === void 0 ? "auto" : _ref2$alignSelf,
|
|
43
|
+
_ref2$gap = _ref2.gap,
|
|
44
|
+
gap = _ref2$gap === void 0 ? "0" : _ref2$gap,
|
|
45
|
+
_ref2$order = _ref2.order,
|
|
46
|
+
order = _ref2$order === void 0 ? 0 : _ref2$order,
|
|
47
|
+
_ref2$grow = _ref2.grow,
|
|
48
|
+
grow = _ref2$grow === void 0 ? 0 : _ref2$grow,
|
|
49
|
+
_ref2$shrink = _ref2.shrink,
|
|
50
|
+
shrink = _ref2$shrink === void 0 ? 1 : _ref2$shrink,
|
|
51
|
+
_ref2$basis = _ref2.basis,
|
|
52
|
+
basis = _ref2$basis === void 0 ? "auto" : _ref2$basis;
|
|
53
|
+
return "\n flex-direction: ".concat(direction, "; \n flex-wrap: ").concat(wrap, "; \n justify-content: ").concat(justifyContent, "; \n align-items: ").concat(alignItems, ";\n align-content: ").concat(alignContent, ";\n gap: ").concat((0, _typeof2["default"])(gap) === "object" ? "".concat(gap.rowGap, " ").concat(gap.columnGap) : gap, ";\n order: ").concat(order, ";\n flex-grow: ").concat(grow, ";\n flex-shrink: ").concat(shrink, ";\n flex-basis: ").concat(basis, ";\n align-self: ").concat(alignSelf, ";\n ");
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
var _default = DxcFlex;
|
|
57
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import DxcFlex from "./Flex";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Flex",
|
|
8
|
+
component: DxcFlex,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Chromatic = () => (
|
|
12
|
+
<>
|
|
13
|
+
<Title title="Default" level={4} />
|
|
14
|
+
<Container>
|
|
15
|
+
<DxcFlex>
|
|
16
|
+
<Placeholder />
|
|
17
|
+
<Placeholder width="50px" />
|
|
18
|
+
<Placeholder />
|
|
19
|
+
<Placeholder width="50px" />
|
|
20
|
+
<Placeholder width="50px" />
|
|
21
|
+
</DxcFlex>
|
|
22
|
+
</Container>
|
|
23
|
+
<Title title="Direction column, wrap, justify content end, align items center and gap" level={4} />
|
|
24
|
+
<Container>
|
|
25
|
+
<DxcFlex direction="column" wrap="wrap" justifyContent="end" alignItems="center" gap="20px">
|
|
26
|
+
<Placeholder />
|
|
27
|
+
<Placeholder width="100px" />
|
|
28
|
+
<Placeholder />
|
|
29
|
+
<Placeholder width="100px" />
|
|
30
|
+
<Placeholder />
|
|
31
|
+
</DxcFlex>
|
|
32
|
+
</Container>
|
|
33
|
+
<Title title="Wrap with align content space between, row and column gaps, and as a span" level={4} />
|
|
34
|
+
<Container height="250px">
|
|
35
|
+
<DxcFlex wrap="wrap" alignContent="space-between" as="span" gap={{ rowGap: "10px", columnGap: "20px" }}>
|
|
36
|
+
<Placeholder />
|
|
37
|
+
<Placeholder />
|
|
38
|
+
<Placeholder />
|
|
39
|
+
<Placeholder />
|
|
40
|
+
<Placeholder width="100px" />
|
|
41
|
+
<Placeholder />
|
|
42
|
+
<Placeholder />
|
|
43
|
+
<Placeholder width="100px" />
|
|
44
|
+
<Placeholder />
|
|
45
|
+
<Placeholder />
|
|
46
|
+
<Placeholder width="100px" />
|
|
47
|
+
<Placeholder />
|
|
48
|
+
</DxcFlex>
|
|
49
|
+
</Container>
|
|
50
|
+
<Title title="Basis 100%, order, grow and align self" level={4} />
|
|
51
|
+
<Container height="75px">
|
|
52
|
+
<DxcFlex basis="100%">
|
|
53
|
+
<DxcFlex order={3} grow={1} alignSelf="flex-end">
|
|
54
|
+
<PlaceholderGrowAndShrink>order 3, grow 1, align self end</PlaceholderGrowAndShrink>
|
|
55
|
+
</DxcFlex>
|
|
56
|
+
<DxcFlex order={-1} grow={4}>
|
|
57
|
+
<PlaceholderGrowAndShrink>order -1, grow 4</PlaceholderGrowAndShrink>
|
|
58
|
+
</DxcFlex>
|
|
59
|
+
<DxcFlex order={5} grow={1}>
|
|
60
|
+
<PlaceholderGrowAndShrink>order 5, grow 1</PlaceholderGrowAndShrink>
|
|
61
|
+
</DxcFlex>
|
|
62
|
+
<DxcFlex order={2} grow={2}>
|
|
63
|
+
<PlaceholderGrowAndShrink>order 2. grow 2</PlaceholderGrowAndShrink>
|
|
64
|
+
</DxcFlex>
|
|
65
|
+
</DxcFlex>
|
|
66
|
+
</Container>
|
|
67
|
+
<Title title="Basis and shrink" level={4} />
|
|
68
|
+
<Container>
|
|
69
|
+
<DxcFlex basis="600px">
|
|
70
|
+
<DxcFlex shrink={4} basis="400px">
|
|
71
|
+
<PlaceholderGrowAndShrink>shrink 4</PlaceholderGrowAndShrink>
|
|
72
|
+
</DxcFlex>
|
|
73
|
+
<DxcFlex shrink={2} basis="400px">
|
|
74
|
+
<PlaceholderGrowAndShrink>shrink 2</PlaceholderGrowAndShrink>
|
|
75
|
+
</DxcFlex>
|
|
76
|
+
<DxcFlex shrink={1} basis="400px">
|
|
77
|
+
<PlaceholderGrowAndShrink>shrink 1</PlaceholderGrowAndShrink>
|
|
78
|
+
</DxcFlex>
|
|
79
|
+
</DxcFlex>
|
|
80
|
+
</Container>
|
|
81
|
+
</>
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const Container = styled.div<{ height?: string }>`
|
|
85
|
+
display: flex;
|
|
86
|
+
background: #f2eafa;
|
|
87
|
+
margin: 2.5rem;
|
|
88
|
+
${({ height }) => (height ? `height: ${height}` : "max-height: 150px")};
|
|
89
|
+
`;
|
|
90
|
+
|
|
91
|
+
const Placeholder = styled.div<{ width?: string }>`
|
|
92
|
+
height: 40px;
|
|
93
|
+
min-width: ${({ width }) => width || "200px"};
|
|
94
|
+
border: 1px solid #a46ede;
|
|
95
|
+
background-color: #e5d5f6;
|
|
96
|
+
`;
|
|
97
|
+
|
|
98
|
+
const PlaceholderGrowAndShrink = styled.div`
|
|
99
|
+
height: 40px;
|
|
100
|
+
width: 100%;
|
|
101
|
+
border: 1px solid #a46ede;
|
|
102
|
+
background-color: #e5d5f6;
|
|
103
|
+
`;
|
package/flex/types.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Gap = {
|
|
3
|
+
rowGap: string;
|
|
4
|
+
columnGap: string;
|
|
5
|
+
};
|
|
6
|
+
declare type Props = {
|
|
7
|
+
direction?: "row" | "row-reverse" | "column" | "column-reverse";
|
|
8
|
+
wrap?: "nowrap" | "wrap" | "wrap-reverse";
|
|
9
|
+
justifyContent?: "flex-start" | "flex-end" | "start" | "end" | "left" | "right" | "center" | "space-between" | "space-around" | "space-evenly";
|
|
10
|
+
alignItems?: "stretch" | "flex-start" | "flex-end" | "start" | "end" | "self-start" | "self-end" | "center" | "baseline";
|
|
11
|
+
alignContent?: "normal" | "flex-start" | "flex-end" | "start" | "end" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch";
|
|
12
|
+
gap?: string | Gap;
|
|
13
|
+
order?: number;
|
|
14
|
+
grow?: number;
|
|
15
|
+
shrink?: number;
|
|
16
|
+
basis?: string;
|
|
17
|
+
alignSelf?: "auto" | "flex-start" | "flex-end" | "center" | "baseline" | "stretch";
|
|
18
|
+
as?: keyof HTMLElementTagNameMap;
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
};
|
|
21
|
+
export default Props;
|
package/flex/types.js
ADDED