@dxc-technology/halstack-react 0.0.0-fdc49d2 → 0.0.0-feed711
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/HalstackContext.d.ts +12 -0
- package/HalstackContext.js +295 -0
- package/accordion/Accordion.js +5 -27
- package/accordion/Accordion.stories.tsx +4 -4
- package/accordion/types.d.ts +1 -1
- package/accordion-group/AccordionGroup.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +14 -15
- package/accordion-group/AccordionGroup.stories.tsx +1 -1
- package/accordion-group/AccordionGroup.test.js +24 -6
- package/accordion-group/types.d.ts +5 -1
- package/alert/Alert.js +4 -1
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +5 -3
- package/badge/types.d.ts +1 -0
- package/bleed/Bleed.js +1 -34
- package/bleed/Bleed.stories.tsx +94 -95
- package/bleed/types.d.ts +1 -1
- package/box/Box.js +22 -32
- 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/{list → bulleted-list}/types.js +0 -0
- package/button/Button.js +53 -68
- package/button/Button.stories.tsx +9 -0
- package/button/types.d.ts +7 -7
- package/card/Card.js +24 -27
- package/checkbox/Checkbox.d.ts +1 -1
- package/checkbox/Checkbox.js +38 -28
- package/checkbox/Checkbox.stories.tsx +124 -128
- package/checkbox/types.d.ts +3 -3
- package/chip/types.d.ts +1 -1
- package/common/variables.js +229 -98
- package/date-input/DateInput.js +41 -23
- package/date-input/DateInput.test.js +9 -22
- package/date-input/types.d.ts +12 -9
- package/dialog/Dialog.js +46 -50
- package/dialog/Dialog.stories.tsx +1 -2
- package/dialog/Dialog.test.js +34 -4
- package/dialog/types.d.ts +2 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +242 -250
- package/dropdown/Dropdown.stories.tsx +126 -63
- package/dropdown/Dropdown.test.js +510 -108
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +80 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +92 -0
- package/dropdown/types.d.ts +25 -5
- package/file-input/FileInput.js +9 -6
- package/file-input/FileItem.js +7 -5
- 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/{radio → flex}/types.js +0 -0
- package/footer/Footer.js +15 -88
- package/footer/Icons.js +1 -1
- package/footer/types.d.ts +1 -1
- package/header/Header.js +95 -114
- package/header/Header.stories.tsx +46 -36
- package/header/Header.test.js +18 -2
- package/header/Icons.js +2 -2
- package/header/types.d.ts +2 -2
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +36 -36
- package/inset/types.d.ts +25 -1
- package/layout/ApplicationLayout.d.ts +16 -6
- package/layout/ApplicationLayout.js +71 -131
- package/layout/ApplicationLayout.stories.tsx +83 -93
- 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 +18 -33
- package/link/Link.d.ts +3 -2
- package/link/Link.js +57 -74
- package/link/Link.stories.tsx +95 -53
- package/link/Link.test.js +7 -15
- package/link/types.d.ts +7 -23
- package/main.d.ts +7 -10
- package/main.js +43 -61
- package/number-input/NumberInput.test.js +2 -4
- package/number-input/types.d.ts +13 -10
- package/package.json +14 -12
- package/paginator/Paginator.js +17 -38
- package/paginator/Paginator.test.js +42 -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.js +7 -4
- package/password-input/PasswordInput.test.js +3 -6
- package/password-input/types.d.ts +14 -11
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +57 -51
- package/progress-bar/ProgressBar.stories.jsx +13 -11
- package/progress-bar/ProgressBar.test.js +67 -22
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.js +83 -25
- package/quick-nav/QuickNav.stories.tsx +43 -16
- package/quick-nav/types.d.ts +4 -8
- package/radio-group/Radio.js +1 -1
- package/radio-group/RadioGroup.js +21 -20
- package/resultsetTable/ResultsetTable.test.js +42 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +199 -0
- package/select/Option.js +1 -1
- package/select/Select.js +102 -199
- package/select/Select.stories.tsx +145 -100
- package/select/Select.test.js +440 -281
- package/select/types.d.ts +31 -12
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +184 -52
- package/sidenav/Sidenav.stories.tsx +154 -156
- package/sidenav/Sidenav.test.js +25 -37
- package/sidenav/types.d.ts +50 -27
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +5 -4
- package/slider/Slider.stories.tsx +8 -8
- package/slider/Slider.test.js +68 -10
- package/slider/types.d.ts +4 -0
- package/spinner/Spinner.js +1 -1
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +113 -54
- package/switch/Switch.stories.tsx +16 -38
- package/switch/Switch.test.js +122 -8
- package/switch/types.d.ts +5 -6
- package/tabs/Tabs.d.ts +1 -1
- package/tabs/Tabs.js +9 -11
- package/tabs/Tabs.stories.tsx +0 -8
- package/tabs/Tabs.test.js +26 -9
- package/tabs/types.d.ts +5 -1
- 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 +130 -0
- package/tabs-nav/types.d.ts +53 -0
- package/{row → tabs-nav}/types.js +0 -0
- package/tag/Tag.js +5 -8
- package/tag/types.d.ts +1 -1
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +55 -0
- package/text-input/TextInput.js +60 -97
- package/text-input/TextInput.stories.tsx +1 -2
- package/text-input/TextInput.test.js +22 -35
- package/text-input/types.d.ts +27 -12
- package/textarea/Textarea.js +10 -19
- package/textarea/types.d.ts +10 -7
- package/toggle-group/ToggleGroup.d.ts +1 -1
- package/toggle-group/ToggleGroup.js +5 -4
- package/toggle-group/ToggleGroup.stories.tsx +4 -4
- package/toggle-group/ToggleGroup.test.js +35 -4
- package/toggle-group/types.d.ts +9 -1
- 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/{stack → typography}/types.js +0 -0
- package/useTheme.js +2 -2
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.js +43 -44
- package/wizard/Wizard.stories.tsx +20 -1
- package/wizard/types.d.ts +5 -4
- package/ThemeContext.d.ts +0 -10
- package/ThemeContext.js +0 -243
- package/list/List.d.ts +0 -4
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -95
- package/list/types.d.ts +0 -7
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -174
- package/radio/Radio.stories.tsx +0 -192
- package/radio/Radio.test.js +0 -71
- package/radio/types.d.ts +0 -54
- package/row/Row.d.ts +0 -3
- package/row/Row.js +0 -127
- package/row/Row.stories.tsx +0 -237
- package/row/types.d.ts +0 -28
- package/stack/Stack.d.ts +0 -3
- package/stack/Stack.js +0 -97
- package/stack/Stack.stories.tsx +0 -164
- package/stack/types.d.ts +0 -24
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
|
@@ -0,0 +1,80 @@
|
|
|
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 = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
17
|
+
|
|
18
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
19
|
+
|
|
20
|
+
var _DropdownMenuItem = _interopRequireDefault(require("./DropdownMenuItem"));
|
|
21
|
+
|
|
22
|
+
var _templateObject;
|
|
23
|
+
|
|
24
|
+
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); }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
var DropdownMenu = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
29
|
+
var id = _ref.id,
|
|
30
|
+
dropdownTriggerId = _ref.dropdownTriggerId,
|
|
31
|
+
iconsPosition = _ref.iconsPosition,
|
|
32
|
+
visualFocusIndex = _ref.visualFocusIndex,
|
|
33
|
+
menuItemOnClick = _ref.menuItemOnClick,
|
|
34
|
+
onKeyDown = _ref.onKeyDown,
|
|
35
|
+
options = _ref.options,
|
|
36
|
+
styles = _ref.styles;
|
|
37
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
38
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
39
|
+
theme: colorsTheme.dropdown
|
|
40
|
+
}, /*#__PURE__*/_react["default"].createElement(DropdownMenuContainer, {
|
|
41
|
+
onMouseDown: function onMouseDown(event) {
|
|
42
|
+
// Prevent the onBlur event from closing menu when clicking on the menu since it is implemented with a Portal and the menu is not a child of the container
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
},
|
|
45
|
+
onKeyDown: onKeyDown,
|
|
46
|
+
id: id,
|
|
47
|
+
role: "menu",
|
|
48
|
+
"aria-labelledby": dropdownTriggerId,
|
|
49
|
+
"aria-orientation": "vertical",
|
|
50
|
+
"aria-activedescendant": "option-".concat(visualFocusIndex),
|
|
51
|
+
tabIndex: -1,
|
|
52
|
+
style: styles,
|
|
53
|
+
ref: ref
|
|
54
|
+
}, options.map(function (option, index) {
|
|
55
|
+
return /*#__PURE__*/_react["default"].createElement(_DropdownMenuItem["default"], {
|
|
56
|
+
id: "option-".concat(index),
|
|
57
|
+
key: "option-".concat(index),
|
|
58
|
+
visuallyFocused: index === visualFocusIndex,
|
|
59
|
+
iconPosition: iconsPosition,
|
|
60
|
+
onClick: menuItemOnClick,
|
|
61
|
+
option: option
|
|
62
|
+
});
|
|
63
|
+
})));
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
var DropdownMenuContainer = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n max-height: 230px;\n overflow-y: auto;\n padding: 0;\n margin: 0;\n background-color: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n border-radius: ", ";\n border-top-right-radius: 0;\n border-top-left-radius: 0;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n outline: none;\n"])), function (props) {
|
|
67
|
+
return props.theme.optionBackgroundColor;
|
|
68
|
+
}, function (props) {
|
|
69
|
+
return props.theme.borderThickness;
|
|
70
|
+
}, function (props) {
|
|
71
|
+
return props.theme.borderStyle;
|
|
72
|
+
}, function (props) {
|
|
73
|
+
return props.theme.borderColor;
|
|
74
|
+
}, function (props) {
|
|
75
|
+
return props.theme.borderRadius;
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
var _default = /*#__PURE__*/_react["default"].memo(DropdownMenu);
|
|
79
|
+
|
|
80
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,92 @@
|
|
|
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 = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
17
|
+
|
|
18
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
19
|
+
|
|
20
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
21
|
+
|
|
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); }
|
|
23
|
+
|
|
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; }
|
|
25
|
+
|
|
26
|
+
var DropdownMenuItem = function DropdownMenuItem(_ref) {
|
|
27
|
+
var id = _ref.id,
|
|
28
|
+
visuallyFocused = _ref.visuallyFocused,
|
|
29
|
+
iconPosition = _ref.iconPosition,
|
|
30
|
+
_onClick = _ref.onClick,
|
|
31
|
+
option = _ref.option;
|
|
32
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
33
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
34
|
+
theme: colorsTheme.dropdown
|
|
35
|
+
}, /*#__PURE__*/_react["default"].createElement(DropdownMenuItemContainer, {
|
|
36
|
+
visuallyFocused: visuallyFocused,
|
|
37
|
+
onClick: function onClick() {
|
|
38
|
+
_onClick(option.value);
|
|
39
|
+
},
|
|
40
|
+
id: id,
|
|
41
|
+
role: "menuitem",
|
|
42
|
+
tabIndex: -1
|
|
43
|
+
}, iconPosition === "after" && /*#__PURE__*/_react["default"].createElement(DropdownMenuItemLabel, null, option.label), option.icon && /*#__PURE__*/_react["default"].createElement(DropdownMenuItemIcon, {
|
|
44
|
+
iconPosition: iconPosition,
|
|
45
|
+
label: option.label,
|
|
46
|
+
role: typeof option.icon === "string" ? undefined : "img"
|
|
47
|
+
}, typeof option.icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
48
|
+
src: option.icon
|
|
49
|
+
}) : option.icon), iconPosition === "before" && /*#__PURE__*/_react["default"].createElement(DropdownMenuItemLabel, null, option.label)));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
var DropdownMenuItemContainer = _styledComponents["default"].li(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: ", ";\n min-height: 36px;\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n cursor: pointer;\n\n ", "\n :hover {\n background-color: ", ";\n }\n :active {\n background-color: ", ";\n }\n"])), function (props) {
|
|
53
|
+
return props.theme.optionIconSpacing;
|
|
54
|
+
}, function (props) {
|
|
55
|
+
return props.theme.optionPaddingTop;
|
|
56
|
+
}, function (props) {
|
|
57
|
+
return props.theme.optionPaddingBottom;
|
|
58
|
+
}, function (props) {
|
|
59
|
+
return props.theme.optionPaddingLeft;
|
|
60
|
+
}, function (props) {
|
|
61
|
+
return props.theme.optionPaddingRight;
|
|
62
|
+
}, function (props) {
|
|
63
|
+
return props.visuallyFocused && "outline: ".concat(props.theme.focusColor, " solid 2px; outline-offset: -2px;");
|
|
64
|
+
}, function (props) {
|
|
65
|
+
return props.theme.hoverOptionBackgroundColor;
|
|
66
|
+
}, function (props) {
|
|
67
|
+
return props.theme.activeOptionBackgroundColor;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
var DropdownMenuItemLabel = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5rem;\n color: ", ";\n"])), function (props) {
|
|
71
|
+
return props.theme.optionFontFamily;
|
|
72
|
+
}, function (props) {
|
|
73
|
+
return props.theme.optionFontSize;
|
|
74
|
+
}, function (props) {
|
|
75
|
+
return props.theme.optionFontStyle;
|
|
76
|
+
}, function (props) {
|
|
77
|
+
return props.theme.optionFontWeight;
|
|
78
|
+
}, function (props) {
|
|
79
|
+
return props.theme.optionFontColor;
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
var DropdownMenuItemIcon = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n color: ", ";\n\n img,\n svg {\n width: ", ";\n height: ", ";\n }\n"])), function (props) {
|
|
83
|
+
return props.theme.optionIconColor;
|
|
84
|
+
}, function (props) {
|
|
85
|
+
return props.theme.optionIconSize;
|
|
86
|
+
}, function (props) {
|
|
87
|
+
return props.theme.optionIconSize;
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
var _default = /*#__PURE__*/_react["default"].memo(DropdownMenuItem);
|
|
91
|
+
|
|
92
|
+
exports["default"] = _default;
|
package/dropdown/types.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
-
declare type Margin = {
|
|
2
|
+
export declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
export declare type Margin = {
|
|
4
4
|
top?: Space;
|
|
5
5
|
bottom?: Space;
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
declare type
|
|
10
|
-
declare type
|
|
9
|
+
export declare type Size = "small" | "medium" | "large" | "fillParent" | "fitContent";
|
|
10
|
+
declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
11
|
+
export declare type Option = {
|
|
11
12
|
/**
|
|
12
13
|
* Option display value.
|
|
13
14
|
*/
|
|
@@ -67,7 +68,7 @@ declare type Props = {
|
|
|
67
68
|
/**
|
|
68
69
|
* Size of the component.
|
|
69
70
|
*/
|
|
70
|
-
size?:
|
|
71
|
+
size?: Size;
|
|
71
72
|
/**
|
|
72
73
|
* Value of the tabindex.
|
|
73
74
|
*/
|
|
@@ -77,4 +78,23 @@ declare type Props = {
|
|
|
77
78
|
*/
|
|
78
79
|
disabled?: boolean;
|
|
79
80
|
};
|
|
81
|
+
export declare type DropdownMenuProps = {
|
|
82
|
+
id: string;
|
|
83
|
+
dropdownTriggerId: string;
|
|
84
|
+
iconsPosition: "before" | "after";
|
|
85
|
+
visualFocusIndex: number;
|
|
86
|
+
menuItemOnClick: (value: string) => void;
|
|
87
|
+
onKeyDown: (event: React.KeyboardEvent<HTMLUListElement>) => void;
|
|
88
|
+
options: Option[];
|
|
89
|
+
styles: {
|
|
90
|
+
width: number;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
export declare type DropdownMenuItemProps = {
|
|
94
|
+
id: string;
|
|
95
|
+
visuallyFocused: boolean;
|
|
96
|
+
iconPosition: "before" | "after";
|
|
97
|
+
onClick: (value: string) => void;
|
|
98
|
+
option: Option;
|
|
99
|
+
};
|
|
80
100
|
export default Props;
|
package/file-input/FileInput.js
CHANGED
|
@@ -33,6 +33,8 @@ var _variables = require("../common/variables.js");
|
|
|
33
33
|
|
|
34
34
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
35
35
|
|
|
36
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
37
|
+
|
|
36
38
|
var _Button = _interopRequireDefault(require("../button/Button"));
|
|
37
39
|
|
|
38
40
|
var _FileItem = _interopRequireDefault(require("./FileItem"));
|
|
@@ -127,6 +129,7 @@ var DxcFileInput = function DxcFileInput(_ref) {
|
|
|
127
129
|
fileInputId = _useState6[0];
|
|
128
130
|
|
|
129
131
|
var colorsTheme = (0, _useTheme["default"])();
|
|
132
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
130
133
|
(0, _react.useEffect)(function () {
|
|
131
134
|
var getFiles = /*#__PURE__*/function () {
|
|
132
135
|
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
@@ -204,11 +207,11 @@ var DxcFileInput = function DxcFileInput(_ref) {
|
|
|
204
207
|
|
|
205
208
|
var checkFileSize = function checkFileSize(file) {
|
|
206
209
|
if (file.size < minSize) {
|
|
207
|
-
return
|
|
210
|
+
return translatedLabels.fileInput.fileSizeGreaterThanErrorMessage;
|
|
208
211
|
}
|
|
209
212
|
|
|
210
213
|
if (file.size > maxSize) {
|
|
211
|
-
return
|
|
214
|
+
return translatedLabels.fileInput.fileSizeLessThanErrorMessage;
|
|
212
215
|
}
|
|
213
216
|
};
|
|
214
217
|
|
|
@@ -410,7 +413,7 @@ var DxcFileInput = function DxcFileInput(_ref) {
|
|
|
410
413
|
onChange: selectFiles
|
|
411
414
|
}), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
412
415
|
mode: "secondary",
|
|
413
|
-
label: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : multiple ?
|
|
416
|
+
label: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : multiple ? translatedLabels.fileInput.multipleButtonLabelDefault : translatedLabels.fileInput.singleButtonLabelDefault,
|
|
414
417
|
onClick: handleClick,
|
|
415
418
|
disabled: disabled,
|
|
416
419
|
size: "medium",
|
|
@@ -450,15 +453,15 @@ var DxcFileInput = function DxcFileInput(_ref) {
|
|
|
450
453
|
mode: mode
|
|
451
454
|
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
452
455
|
mode: "secondary",
|
|
453
|
-
label: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel :
|
|
456
|
+
label: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : translatedLabels.fileInput.dropAreaButtonLabelDefault,
|
|
454
457
|
onClick: handleClick,
|
|
455
458
|
disabled: disabled,
|
|
456
459
|
size: "fitContent"
|
|
457
460
|
})), mode === "dropzone" ? /*#__PURE__*/_react["default"].createElement(DropzoneLabel, {
|
|
458
461
|
disabled: disabled
|
|
459
|
-
}, dropAreaLabel !== null && dropAreaLabel !== void 0 ? dropAreaLabel : multiple ?
|
|
462
|
+
}, dropAreaLabel !== null && dropAreaLabel !== void 0 ? dropAreaLabel : multiple ? translatedLabels.fileInput.multipleDropAreaLabelDefault : translatedLabels.fileInput.singleDropAreaLabelDefault) : /*#__PURE__*/_react["default"].createElement(FiledropLabel, {
|
|
460
463
|
disabled: disabled
|
|
461
|
-
}, dropAreaLabel !== null && dropAreaLabel !== void 0 ? dropAreaLabel : multiple ?
|
|
464
|
+
}, dropAreaLabel !== null && dropAreaLabel !== void 0 ? dropAreaLabel : multiple ? translatedLabels.fileInput.multipleDropAreaLabelDefault : translatedLabels.fileInput.singleDropAreaLabelDefault)), files.map(function (file) {
|
|
462
465
|
return /*#__PURE__*/_react["default"].createElement(FileItemContainer, {
|
|
463
466
|
mode: mode,
|
|
464
467
|
multiple: multiple,
|
package/file-input/FileItem.js
CHANGED
|
@@ -133,9 +133,9 @@ var FileItemContainer = _styledComponents["default"].div(_templateObject3 || (_t
|
|
|
133
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"])));
|
|
134
134
|
|
|
135
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.
|
|
136
|
+
return props.error ? props.theme.errorFilePreviewBackgroundColor : props.theme.filePreviewBackgroundColor;
|
|
137
137
|
}, function (props) {
|
|
138
|
-
return props.error ? props.theme.
|
|
138
|
+
return props.error ? props.theme.errorFilePreviewIconColor : props.theme.filePreviewIconColor;
|
|
139
139
|
});
|
|
140
140
|
|
|
141
141
|
var IconPreview = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
@@ -156,14 +156,16 @@ var FileName = _styledComponents["default"].span(_templateObject7 || (_templateO
|
|
|
156
156
|
|
|
157
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"])));
|
|
158
158
|
|
|
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 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) {
|
|
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) {
|
|
160
160
|
return props.theme.fontFamily;
|
|
161
|
+
}, function (props) {
|
|
162
|
+
return props.theme.deleteFileItemColor;
|
|
161
163
|
}, function (props) {
|
|
162
164
|
return props.theme.hoverDeleteFileItemBackgroundColor;
|
|
163
165
|
}, function (props) {
|
|
164
|
-
return props.theme.
|
|
166
|
+
return props.theme.focusDeleteFileItemBorderColor;
|
|
165
167
|
}, function (props) {
|
|
166
|
-
return props.theme.
|
|
168
|
+
return props.theme.focusDeleteFileItemBorderColor;
|
|
167
169
|
}, function (props) {
|
|
168
170
|
return props.theme.activeDeleteFileItemBackgroundColor;
|
|
169
171
|
});
|
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 align-self: ").concat(alignSelf, ";\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 ");
|
|
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
|
+
alignSelf?: "auto" | "flex-start" | "flex-end" | "center" | "baseline" | "stretch";
|
|
13
|
+
gap?: string | Gap;
|
|
14
|
+
order?: number;
|
|
15
|
+
grow?: number;
|
|
16
|
+
shrink?: number;
|
|
17
|
+
basis?: string;
|
|
18
|
+
as?: keyof HTMLElementTagNameMap;
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
};
|
|
21
|
+
export default Props;
|
package/{radio → flex}/types.js
RENAMED
|
File without changes
|