@dxc-technology/halstack-react 0.0.0-e201636 → 0.0.0-e26622f
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/accordion/Accordion.js +122 -103
- package/accordion/Accordion.stories.tsx +2 -3
- package/accordion/Accordion.test.js +9 -10
- package/accordion/types.d.ts +5 -4
- package/accordion-group/AccordionGroup.js +2 -21
- package/accordion-group/AccordionGroup.stories.tsx +27 -1
- package/accordion-group/AccordionGroup.test.js +20 -45
- package/accordion-group/types.d.ts +10 -3
- package/alert/Alert.js +1 -1
- package/bleed/Bleed.js +1 -34
- package/bleed/Bleed.stories.tsx +94 -95
- package/bleed/types.d.ts +1 -1
- package/box/Box.js +1 -1
- package/box/types.d.ts +1 -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/{list → bulleted-list}/types.js +0 -0
- package/button/Button.js +43 -61
- package/button/Button.stories.tsx +9 -0
- package/button/types.d.ts +7 -7
- package/card/Card.js +34 -36
- package/card/types.d.ts +1 -0
- package/checkbox/Checkbox.js +87 -95
- package/checkbox/Checkbox.test.js +93 -16
- package/checkbox/types.d.ts +2 -2
- package/chip/types.d.ts +1 -1
- package/common/variables.js +56 -18
- package/date-input/DateInput.js +3 -3
- package/dialog/Dialog.js +52 -28
- package/dialog/Dialog.stories.tsx +57 -2
- package/dialog/Dialog.test.js +34 -4
- package/dialog/types.d.ts +3 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +244 -247
- package/dropdown/Dropdown.stories.tsx +126 -63
- package/dropdown/Dropdown.test.js +509 -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/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +69 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +32 -0
- package/{row → flex}/types.js +0 -0
- package/footer/Footer.stories.tsx +8 -1
- package/footer/Icons.js +1 -1
- package/footer/types.d.ts +2 -1
- package/header/Header.js +74 -72
- package/header/Header.stories.tsx +4 -4
- package/header/Icons.js +2 -2
- package/header/types.d.ts +3 -2
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +36 -36
- package/inset/types.d.ts +1 -1
- package/layout/ApplicationLayout.d.ts +15 -6
- package/layout/ApplicationLayout.js +37 -65
- package/layout/ApplicationLayout.stories.tsx +80 -44
- package/layout/types.d.ts +17 -27
- package/link/Link.js +1 -1
- package/link/Link.stories.tsx +13 -6
- package/link/types.d.ts +1 -1
- package/main.d.ts +5 -8
- package/main.js +28 -52
- package/number-input/NumberInput.test.js +1 -1
- package/package.json +10 -9
- 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.test.js +13 -12
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +56 -50
- package/progress-bar/ProgressBar.stories.jsx +3 -1
- package/progress-bar/ProgressBar.test.js +67 -22
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.js +25 -20
- package/quick-nav/QuickNav.stories.tsx +131 -26
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +43 -28
- package/radio-group/RadioGroup.js +26 -29
- package/radio-group/RadioGroup.stories.tsx +1 -0
- package/radio-group/RadioGroup.test.js +28 -58
- package/radio-group/types.d.ts +2 -2
- package/resultsetTable/ResultsetTable.test.js +42 -0
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +53 -7
- package/select/Select.js +42 -43
- package/select/Select.stories.tsx +131 -98
- package/select/Select.test.js +105 -50
- package/select/types.d.ts +2 -5
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +176 -55
- package/sidenav/Sidenav.stories.tsx +154 -156
- package/sidenav/Sidenav.test.js +25 -37
- package/sidenav/types.d.ts +50 -27
- package/slider/Slider.js +116 -92
- package/slider/Slider.stories.tsx +7 -1
- package/slider/Slider.test.js +121 -21
- package/slider/types.d.ts +2 -2
- package/switch/Switch.d.ts +1 -1
- package/switch/Switch.js +132 -66
- package/switch/Switch.stories.tsx +8 -30
- package/switch/Switch.test.js +144 -17
- package/switch/types.d.ts +3 -4
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +135 -0
- package/tabs/Tabs.js +360 -104
- package/tabs/Tabs.stories.tsx +74 -0
- package/tabs/Tabs.test.js +217 -6
- package/tabs/types.d.ts +15 -5
- package/tabs-nav/NavTabs.js +5 -5
- package/tabs-nav/Tab.js +3 -5
- package/tabs-nav/types.d.ts +1 -1
- package/tag/Tag.js +1 -1
- package/tag/types.d.ts +1 -1
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.js +7 -5
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.js +181 -278
- package/text-input/TextInput.stories.tsx +189 -182
- package/text-input/TextInput.test.js +165 -163
- package/text-input/types.d.ts +22 -3
- package/toggle-group/types.d.ts +1 -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/wizard/Wizard.js +9 -16
- package/wizard/Wizard.stories.tsx +20 -1
- package/wizard/types.d.ts +5 -4
- 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/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/flex/Flex.d.ts
ADDED
package/flex/Flex.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
+
|
|
16
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireDefault(require("react"));
|
|
19
|
+
|
|
20
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
21
|
+
|
|
22
|
+
var _templateObject;
|
|
23
|
+
|
|
24
|
+
var _excluded = ["direction", "wrap", "gap", "order", "grow", "shrink", "basis", "children"],
|
|
25
|
+
_excluded2 = ["justifyContent", "alignItems", "alignContent", "alignSelf"];
|
|
26
|
+
|
|
27
|
+
var DxcFlex = function DxcFlex(_ref) {
|
|
28
|
+
var _ref$direction = _ref.direction,
|
|
29
|
+
direction = _ref$direction === void 0 ? "row" : _ref$direction,
|
|
30
|
+
_ref$wrap = _ref.wrap,
|
|
31
|
+
wrap = _ref$wrap === void 0 ? "nowrap" : _ref$wrap,
|
|
32
|
+
_ref$gap = _ref.gap,
|
|
33
|
+
gap = _ref$gap === void 0 ? "0" : _ref$gap,
|
|
34
|
+
_ref$order = _ref.order,
|
|
35
|
+
order = _ref$order === void 0 ? 0 : _ref$order,
|
|
36
|
+
_ref$grow = _ref.grow,
|
|
37
|
+
grow = _ref$grow === void 0 ? 0 : _ref$grow,
|
|
38
|
+
_ref$shrink = _ref.shrink,
|
|
39
|
+
shrink = _ref$shrink === void 0 ? 1 : _ref$shrink,
|
|
40
|
+
_ref$basis = _ref.basis,
|
|
41
|
+
basis = _ref$basis === void 0 ? "auto" : _ref$basis,
|
|
42
|
+
children = _ref.children,
|
|
43
|
+
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
44
|
+
return /*#__PURE__*/_react["default"].createElement(Flex, (0, _extends2["default"])({
|
|
45
|
+
$direction: direction,
|
|
46
|
+
$wrap: wrap,
|
|
47
|
+
$order: order,
|
|
48
|
+
$grow: grow,
|
|
49
|
+
$shrink: shrink,
|
|
50
|
+
$basis: basis,
|
|
51
|
+
$gap: gap
|
|
52
|
+
}, props), children);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
var Flex = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n ", "\n"])), function (_ref2) {
|
|
56
|
+
var _ref2$justifyContent = _ref2.justifyContent,
|
|
57
|
+
justifyContent = _ref2$justifyContent === void 0 ? "flex-start" : _ref2$justifyContent,
|
|
58
|
+
_ref2$alignItems = _ref2.alignItems,
|
|
59
|
+
alignItems = _ref2$alignItems === void 0 ? "stretch" : _ref2$alignItems,
|
|
60
|
+
_ref2$alignContent = _ref2.alignContent,
|
|
61
|
+
alignContent = _ref2$alignContent === void 0 ? "normal" : _ref2$alignContent,
|
|
62
|
+
_ref2$alignSelf = _ref2.alignSelf,
|
|
63
|
+
alignSelf = _ref2$alignSelf === void 0 ? "auto" : _ref2$alignSelf,
|
|
64
|
+
props = (0, _objectWithoutProperties2["default"])(_ref2, _excluded2);
|
|
65
|
+
return "\n flex-direction: ".concat(props.$direction, "; \n flex-wrap: ").concat(props.$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"])(props.$gap) === "object" ? "".concat(props.$gap.rowGap, " ").concat(props.$gap.columnGap) : props.$gap, ";\n order: ").concat(props.$order, ";\n flex-grow: ").concat(props.$grow, ";\n flex-shrink: ").concat(props.$shrink, ";\n flex-basis: ").concat(props.$basis, ";\n ");
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
var _default = DxcFlex;
|
|
69
|
+
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,32 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Gap = {
|
|
3
|
+
rowGap: string;
|
|
4
|
+
columnGap: string;
|
|
5
|
+
};
|
|
6
|
+
declare type CommonProps = {
|
|
7
|
+
justifyContent?: "flex-start" | "flex-end" | "start" | "end" | "left" | "right" | "center" | "space-between" | "space-around" | "space-evenly";
|
|
8
|
+
alignItems?: "stretch" | "flex-start" | "flex-end" | "start" | "end" | "self-start" | "self-end" | "center" | "baseline";
|
|
9
|
+
alignContent?: "normal" | "flex-start" | "flex-end" | "start" | "end" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch";
|
|
10
|
+
alignSelf?: "auto" | "flex-start" | "flex-end" | "center" | "baseline" | "stretch";
|
|
11
|
+
};
|
|
12
|
+
declare type Props = CommonProps & {
|
|
13
|
+
direction?: "row" | "row-reverse" | "column" | "column-reverse";
|
|
14
|
+
wrap?: "nowrap" | "wrap" | "wrap-reverse";
|
|
15
|
+
gap?: string | Gap;
|
|
16
|
+
order?: number;
|
|
17
|
+
grow?: number;
|
|
18
|
+
shrink?: number;
|
|
19
|
+
basis?: string;
|
|
20
|
+
as?: keyof HTMLElementTagNameMap;
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
};
|
|
23
|
+
export declare type StyledProps = CommonProps & {
|
|
24
|
+
$direction?: "row" | "row-reverse" | "column" | "column-reverse";
|
|
25
|
+
$wrap?: "nowrap" | "wrap" | "wrap-reverse";
|
|
26
|
+
$gap?: string | Gap;
|
|
27
|
+
$order?: number;
|
|
28
|
+
$grow?: number;
|
|
29
|
+
$shrink?: number;
|
|
30
|
+
$basis?: string;
|
|
31
|
+
};
|
|
32
|
+
export default Props;
|
package/{row → flex}/types.js
RENAMED
|
File without changes
|
|
@@ -28,7 +28,14 @@ const social = [
|
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
href: "https://twitter.com/dxctechnology",
|
|
31
|
-
logo:
|
|
31
|
+
logo: (
|
|
32
|
+
<svg viewBox="0 0 248 204" fill="currentColor">
|
|
33
|
+
<path
|
|
34
|
+
fill="#1d9bf0"
|
|
35
|
+
d="M221.95 51.29c.15 2.17.15 4.34.15 6.53 0 66.73-50.8 143.69-143.69 143.69v-.04c-27.44.04-54.31-7.82-77.41-22.64 3.99.48 8 .72 12.02.73 22.74.02 44.83-7.61 62.72-21.66-21.61-.41-40.56-14.5-47.18-35.07 7.57 1.46 15.37 1.16 22.8-.87-23.56-4.76-40.51-25.46-40.51-49.5v-.64c7.02 3.91 14.88 6.08 22.92 6.32C11.58 63.31 4.74 33.79 18.14 10.71c25.64 31.55 63.47 50.73 104.08 52.76-4.07-17.54 1.49-35.92 14.61-48.25 20.34-19.12 52.33-18.14 71.45 2.19 11.31-2.23 22.15-6.38 32.07-12.26-3.77 11.69-11.66 21.62-22.2 27.93 10.01-1.18 19.79-3.86 29-7.95-6.78 10.16-15.32 19.01-25.2 26.16z"
|
|
36
|
+
/>
|
|
37
|
+
</svg>
|
|
38
|
+
),
|
|
32
39
|
},
|
|
33
40
|
{
|
|
34
41
|
href: "https://www.facebook.com/DXCTechnology/",
|
package/footer/Icons.js
CHANGED
|
@@ -12,7 +12,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
12
12
|
var dxcLogo = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
13
13
|
id: "g10",
|
|
14
14
|
xmlns: "http://www.w3.org/2000/svg",
|
|
15
|
-
width: "
|
|
15
|
+
width: "100%",
|
|
16
16
|
height: "32",
|
|
17
17
|
viewBox: "0 0 280.781 32"
|
|
18
18
|
}, /*#__PURE__*/_react["default"].createElement("title", null, "DXC Logo"), /*#__PURE__*/_react["default"].createElement("g", {
|
package/footer/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare type Size = {
|
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
declare type SVG = React.SVGProps<SVGSVGElement>;
|
|
9
|
+
declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
10
10
|
declare type SocialLink = {
|
|
11
11
|
/**
|
|
12
12
|
* Element used as the icon for the link.
|
|
@@ -57,6 +57,7 @@ declare type FooterPropsType = {
|
|
|
57
57
|
*/
|
|
58
58
|
margin?: Space | Size;
|
|
59
59
|
/**
|
|
60
|
+
* @deprecated This prop will be removed shortly, consider using the Inset component for this purpose.
|
|
60
61
|
* Size of the padding to be applied to the custom area of the component.
|
|
61
62
|
* You can pass an object with properties in order to specify different padding sizes.
|
|
62
63
|
*/
|