@dxc-technology/halstack-react 0.0.0-459df48 → 0.0.0-460d7ec
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.d.ts +4 -0
- package/accordion/Accordion.js +12 -43
- 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 +58 -72
- package/accordion-group/types.d.ts +72 -0
- package/accordion-group/types.js +5 -0
- package/box/Box.stories.jsx +132 -0
- package/card/Card.d.ts +4 -0
- package/card/Card.js +13 -48
- package/card/types.d.ts +69 -0
- package/card/types.js +5 -0
- package/checkbox/Checkbox.stories.tsx +192 -0
- package/checkbox/types.d.ts +2 -3
- package/common/variables.js +1 -1
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +4 -23
- package/dialog/types.d.ts +43 -0
- package/dialog/types.js +5 -0
- package/dropdown/Dropdown.d.ts +4 -0
- package/dropdown/Dropdown.js +7 -40
- package/dropdown/types.d.ts +89 -0
- package/dropdown/types.js +5 -0
- package/footer/Footer.d.ts +4 -0
- package/footer/Footer.js +4 -35
- package/footer/Footer.stories.jsx +151 -0
- package/footer/types.d.ts +61 -0
- package/footer/types.js +5 -0
- package/header/Header.d.ts +7 -0
- package/header/Header.js +26 -28
- package/header/Icons.js +2 -27
- package/header/types.d.ts +45 -0
- package/header/types.js +5 -0
- package/number-input/NumberInput.stories.jsx +115 -0
- package/package.json +1 -1
- package/paginator/Paginator.stories.tsx +63 -0
- package/progress-bar/ProgressBar.d.ts +4 -0
- package/progress-bar/ProgressBar.js +3 -21
- package/progress-bar/types.d.ts +37 -0
- package/progress-bar/types.js +5 -0
- package/radio/Radio.d.ts +4 -0
- package/radio/Radio.js +3 -24
- package/radio/Radio.stories.tsx +192 -0
- package/radio/types.d.ts +54 -0
- package/radio/types.js +5 -0
- package/select/index.d.ts +4 -4
- package/slider/Slider.d.ts +4 -0
- package/slider/Slider.js +26 -60
- package/slider/types.d.ts +83 -0
- package/slider/types.js +5 -0
- package/spinner/Spinner.js +6 -6
- package/spinner/Spinner.stories.jsx +102 -0
- package/table/Table.d.ts +4 -0
- package/table/Table.stories.jsx +276 -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 +5 -53
- package/tabs/types.d.ts +71 -0
- package/tabs/types.js +5 -0
- package/text-input/index.d.ts +2 -2
- package/textarea/Textarea.stories.jsx +135 -0
- package/accordion/index.d.ts +0 -28
- package/accordion-group/index.d.ts +0 -16
- package/card/index.d.ts +0 -22
- package/dialog/index.d.ts +0 -18
- package/dropdown/index.d.ts +0 -26
- package/footer/index.d.ts +0 -25
- package/header/index.d.ts +0 -25
- package/progress-bar/index.d.ts +0 -18
- package/radio/index.d.ts +0 -23
- package/slider/index.d.ts +0 -29
- package/table/index.d.ts +0 -13
- package/tabs/index.d.ts +0 -19
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import AccordionPropsType from "./types";
|
|
3
|
+
declare const DxcAccordion: ({ label, isExpanded, iconSrc, icon, assistiveText, disabled, onChange, children, margin, padding, tabIndex, }: AccordionPropsType) => JSX.Element;
|
|
4
|
+
export default DxcAccordion;
|
package/accordion/Accordion.js
CHANGED
|
@@ -9,8 +9,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
13
|
|
|
16
14
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
@@ -29,8 +27,6 @@ var _ExpansionPanelDetails = _interopRequireDefault(require("@material-ui/core/E
|
|
|
29
27
|
|
|
30
28
|
var _ExpandMore = _interopRequireDefault(require("@material-ui/icons/ExpandMore"));
|
|
31
29
|
|
|
32
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
33
|
-
|
|
34
30
|
var _utils = require("../common/utils.js");
|
|
35
31
|
|
|
36
32
|
var _variables = require("../common/variables.js");
|
|
@@ -48,38 +44,34 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
48
44
|
var DxcAccordion = function DxcAccordion(_ref) {
|
|
49
45
|
var _ref$label = _ref.label,
|
|
50
46
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
51
|
-
|
|
52
|
-
iconSrc = _ref
|
|
47
|
+
isExpanded = _ref.isExpanded,
|
|
48
|
+
iconSrc = _ref.iconSrc,
|
|
53
49
|
icon = _ref.icon,
|
|
54
50
|
_ref$assistiveText = _ref.assistiveText,
|
|
55
51
|
assistiveText = _ref$assistiveText === void 0 ? "" : _ref$assistiveText,
|
|
56
52
|
_ref$disabled = _ref.disabled,
|
|
57
53
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
58
|
-
|
|
59
|
-
onChange = _ref$onChange === void 0 ? "" : _ref$onChange,
|
|
60
|
-
isExpanded = _ref.isExpanded,
|
|
54
|
+
onChange = _ref.onChange,
|
|
61
55
|
children = _ref.children,
|
|
62
56
|
margin = _ref.margin,
|
|
63
57
|
padding = _ref.padding,
|
|
64
58
|
_ref$tabIndex = _ref.tabIndex,
|
|
65
59
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
66
60
|
|
|
67
|
-
var
|
|
68
|
-
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
69
|
-
innerIsExpanded = _React$useState2[0],
|
|
70
|
-
setInnerIsExpanded = _React$useState2[1];
|
|
71
|
-
|
|
72
|
-
var _useState = (0, _react.useState)(),
|
|
61
|
+
var _useState = (0, _react.useState)(false),
|
|
73
62
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
74
|
-
|
|
75
|
-
|
|
63
|
+
innerIsExpanded = _useState2[0],
|
|
64
|
+
setInnerIsExpanded = _useState2[1];
|
|
65
|
+
|
|
66
|
+
var _useState3 = (0, _react.useState)(false),
|
|
67
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
68
|
+
isResponsive = _useState4[0],
|
|
69
|
+
setIsResponsive = _useState4[1];
|
|
76
70
|
|
|
77
71
|
var colorsTheme = (0, _useTheme["default"])();
|
|
78
72
|
|
|
79
73
|
var handleResize = function handleResize(width) {
|
|
80
|
-
|
|
81
|
-
if (width <= _variables.responsiveSizes.tablet ? setIsResponsive(true) : setIsResponsive(false)) ;
|
|
82
|
-
}
|
|
74
|
+
width && width <= _variables.responsiveSizes.tablet ? setIsResponsive(true) : setIsResponsive(false);
|
|
83
75
|
};
|
|
84
76
|
|
|
85
77
|
var handleEventListener = function handleEventListener() {
|
|
@@ -262,28 +254,5 @@ var AccordionIcon = _styledComponents["default"].img(_templateObject7 || (_templ
|
|
|
262
254
|
return props.disabled ? props.theme.disabledIconColor : props.theme.iconColor;
|
|
263
255
|
});
|
|
264
256
|
|
|
265
|
-
DxcAccordion.propTypes = {
|
|
266
|
-
label: _propTypes["default"].string,
|
|
267
|
-
iconSrc: _propTypes["default"].string,
|
|
268
|
-
icon: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
|
|
269
|
-
assistiveText: _propTypes["default"].string,
|
|
270
|
-
disabled: _propTypes["default"].bool,
|
|
271
|
-
onChange: _propTypes["default"].func,
|
|
272
|
-
isExpanded: _propTypes["default"].bool,
|
|
273
|
-
children: _propTypes["default"].element,
|
|
274
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
275
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
276
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
277
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
278
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
279
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
280
|
-
padding: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
281
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
282
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
283
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
284
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
285
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
286
|
-
tabIndex: _propTypes["default"].number
|
|
287
|
-
};
|
|
288
257
|
var _default = DxcAccordion;
|
|
289
258
|
exports["default"] = _default;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
declare type Margin = {
|
|
4
|
+
top?: Space;
|
|
5
|
+
bottom?: Space;
|
|
6
|
+
left?: Space;
|
|
7
|
+
right?: Space;
|
|
8
|
+
};
|
|
9
|
+
declare type Padding = {
|
|
10
|
+
top?: Space;
|
|
11
|
+
bottom?: Space;
|
|
12
|
+
left?: Space;
|
|
13
|
+
right?: Space;
|
|
14
|
+
};
|
|
15
|
+
declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
16
|
+
declare type Props = {
|
|
17
|
+
/**
|
|
18
|
+
* The panel label.
|
|
19
|
+
*/
|
|
20
|
+
label?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Represents the state of the panel. When true, the component will be
|
|
23
|
+
* expanded. If undefined, the component will be uncontrolled and its
|
|
24
|
+
* value will be managed internally by the component.
|
|
25
|
+
*/
|
|
26
|
+
isExpanded?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Element used as the icon that will be placed next to panel label.
|
|
29
|
+
*/
|
|
30
|
+
icon?: SVG;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated URL of the icon that will be placed next to panel label.
|
|
33
|
+
*/
|
|
34
|
+
iconSrc?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Assistive text to be placed on the right side of the panel.
|
|
37
|
+
*/
|
|
38
|
+
assistiveText?: string;
|
|
39
|
+
/**
|
|
40
|
+
* If true, the component will be disabled.
|
|
41
|
+
*/
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* This function will be called when the user clicks the accordion to expand or collapse
|
|
45
|
+
* the panel. The new state of the panel will be passed as a parameter.
|
|
46
|
+
*/
|
|
47
|
+
onChange?: (isExpanded: boolean) => void;
|
|
48
|
+
/**
|
|
49
|
+
* The expanded panel of the accordion. This area can be used to render
|
|
50
|
+
* custom content.
|
|
51
|
+
*/
|
|
52
|
+
children: React.ReactNode;
|
|
53
|
+
/**
|
|
54
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
55
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
56
|
+
*/
|
|
57
|
+
margin?: Space | Margin;
|
|
58
|
+
/**
|
|
59
|
+
* Size of the padding to be applied to the custom area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
60
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
|
|
61
|
+
*/
|
|
62
|
+
padding?: Space | Padding;
|
|
63
|
+
/**
|
|
64
|
+
* Value of the tabindex.
|
|
65
|
+
*/
|
|
66
|
+
tabIndex?: number;
|
|
67
|
+
};
|
|
68
|
+
export default Props;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import AccordionGroupPropsType, { AccordionPropsType } from "./types";
|
|
3
|
+
declare const DxcAccordionGroup: {
|
|
4
|
+
({ indexActive, disabled, onActiveChange, margin, children, }: AccordionGroupPropsType): JSX.Element;
|
|
5
|
+
Accordion: ({ ...childProps }: AccordionPropsType) => JSX.Element;
|
|
6
|
+
};
|
|
7
|
+
export default DxcAccordionGroup;
|
|
@@ -9,22 +9,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
13
|
|
|
16
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
15
|
|
|
16
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
+
|
|
18
18
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
21
21
|
|
|
22
22
|
var _react = _interopRequireWildcard(require("react"));
|
|
23
23
|
|
|
24
24
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
25
25
|
|
|
26
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
|
-
|
|
28
26
|
var _Accordion = _interopRequireDefault(require("../accordion/Accordion"));
|
|
29
27
|
|
|
30
28
|
var _utils = require("../common/utils.js");
|
|
@@ -35,46 +33,61 @@ var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
|
35
33
|
|
|
36
34
|
var _templateObject;
|
|
37
35
|
|
|
38
|
-
var _excluded = ["margin"];
|
|
39
|
-
|
|
40
36
|
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); }
|
|
41
37
|
|
|
42
38
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(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; }
|
|
43
39
|
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
41
|
+
|
|
42
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
43
|
+
|
|
44
|
+
var AccordionGroupAccordionContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
45
|
+
|
|
46
|
+
var AccordionGroupAccordion = function AccordionGroupAccordion(_ref) {
|
|
47
|
+
var childProps = (0, _extends2["default"])({}, _ref);
|
|
48
|
+
|
|
49
|
+
var _useContext = (0, _react.useContext)(AccordionGroupAccordionContext),
|
|
50
|
+
innerIsExpanded = _useContext.innerIsExpanded,
|
|
51
|
+
handlerActiveChange = _useContext.handlerActiveChange,
|
|
52
|
+
disabled = _useContext.disabled,
|
|
53
|
+
index = _useContext.index;
|
|
54
|
+
|
|
55
|
+
return /*#__PURE__*/_react["default"].createElement(_Accordion["default"], (0, _extends2["default"])({
|
|
56
|
+
isExpanded: innerIsExpanded === index,
|
|
57
|
+
onChange: function onChange() {
|
|
58
|
+
handlerActiveChange(index);
|
|
59
|
+
},
|
|
60
|
+
disabled: disabled
|
|
61
|
+
}, childProps), childProps.children);
|
|
48
62
|
};
|
|
49
63
|
|
|
50
64
|
var DxcAccordionGroup = function DxcAccordionGroup(_ref2) {
|
|
51
|
-
var
|
|
65
|
+
var indexActive = _ref2.indexActive,
|
|
66
|
+
_ref2$disabled = _ref2.disabled,
|
|
52
67
|
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
53
68
|
onActiveChange = _ref2.onActiveChange,
|
|
54
|
-
_ref2$indexActive = _ref2.indexActive,
|
|
55
|
-
indexActive = _ref2$indexActive === void 0 ? undefined : _ref2$indexActive,
|
|
56
69
|
margin = _ref2.margin,
|
|
57
|
-
|
|
58
|
-
children = _ref2$children === void 0 ? [] : _ref2$children;
|
|
70
|
+
children = _ref2.children;
|
|
59
71
|
var colorsTheme = (0, _useTheme["default"])();
|
|
60
72
|
|
|
61
|
-
var
|
|
62
|
-
|
|
63
|
-
innerIsExpanded =
|
|
64
|
-
setInnerIsExpanded =
|
|
65
|
-
|
|
66
|
-
var handlerActiveChange = function
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
var _useState = (0, _react.useState)(0),
|
|
74
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
75
|
+
innerIsExpanded = _useState2[0],
|
|
76
|
+
setInnerIsExpanded = _useState2[1];
|
|
77
|
+
|
|
78
|
+
var handlerActiveChange = (0, _react.useCallback)(function (index) {
|
|
79
|
+
indexActive === undefined ? setInnerIsExpanded(function (prev) {
|
|
80
|
+
return index === prev ? -1 : index;
|
|
81
|
+
}) : setInnerIsExpanded(indexActive);
|
|
82
|
+
!disabled && (onActiveChange === null || onActiveChange === void 0 ? void 0 : onActiveChange(index));
|
|
83
|
+
}, [disabled, indexActive, onActiveChange]);
|
|
84
|
+
var value = (0, _react.useMemo)(function () {
|
|
85
|
+
return {
|
|
86
|
+
innerIsExpanded: innerIsExpanded,
|
|
87
|
+
handlerActiveChange: handlerActiveChange,
|
|
88
|
+
disabled: disabled
|
|
89
|
+
};
|
|
90
|
+
}, [innerIsExpanded, disabled]);
|
|
78
91
|
(0, _react.useEffect)(function () {
|
|
79
92
|
setInnerIsExpanded(indexActive);
|
|
80
93
|
}, [indexActive]);
|
|
@@ -83,24 +96,24 @@ var DxcAccordionGroup = function DxcAccordionGroup(_ref2) {
|
|
|
83
96
|
}, /*#__PURE__*/_react["default"].createElement(AccordionGroupContainer, {
|
|
84
97
|
margin: margin,
|
|
85
98
|
disabled: disabled
|
|
86
|
-
}, (Array.isArray(children) ? children : [children]).filter(function (
|
|
87
|
-
return
|
|
88
|
-
}).map(function (
|
|
89
|
-
return /*#__PURE__*/_react["default"].
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
disabled: disabled || el.props.disabled
|
|
95
|
-
});
|
|
99
|
+
}, (Array.isArray(children) ? children : [children]).filter(function (child) {
|
|
100
|
+
return child.type === AccordionGroupAccordion;
|
|
101
|
+
}).map(function (accordion, index) {
|
|
102
|
+
return /*#__PURE__*/_react["default"].createElement(AccordionGroupAccordionContext.Provider, {
|
|
103
|
+
value: _objectSpread({
|
|
104
|
+
index: index
|
|
105
|
+
}, value)
|
|
106
|
+
}, accordion);
|
|
96
107
|
})));
|
|
97
108
|
};
|
|
98
109
|
|
|
110
|
+
DxcAccordionGroup.Accordion = AccordionGroupAccordion;
|
|
111
|
+
|
|
99
112
|
var calculateWidth = function calculateWidth(margin) {
|
|
100
113
|
return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
101
114
|
};
|
|
102
115
|
|
|
103
|
-
var AccordionGroupContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n cursor: ", ";\n\n & > :not(div:last-child) {\n & > div:first-child {\n border-radius: 0;\n border-bottom: ", ";\n border-color: ", ";\n\n & > .Mui-expanded {\n border-radius: 0;\n }\n
|
|
116
|
+
var AccordionGroupContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n cursor: ", ";\n\n & > :not(div:last-child) {\n & > div:first-child {\n border-radius: 0;\n border-bottom: ", ";\n border-color: ", ";\n\n & > .Mui-expanded {\n border-radius: 0;\n }\n & > .MuiButtonBase-root {\n border-radius: 0;\n }\n }\n }\n\n & > div:first-child {\n & > div:first-child {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom: ", ";\n border-color: ", ";\n\n & > .Mui-expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n }\n & > .MuiButtonBase-root {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n }\n }\n }\n\n & > div:last-child {\n & > div:first-child {\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n\n & > .Mui-expanded {\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n & > .MuiButtonBase-root {\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n }\n }\n"])), function (props) {
|
|
104
117
|
return calculateWidth(props.margin);
|
|
105
118
|
}, function (_ref3) {
|
|
106
119
|
var margin = _ref3.margin;
|
|
@@ -118,7 +131,7 @@ var AccordionGroupContainer = _styledComponents["default"].div(_templateObject |
|
|
|
118
131
|
var margin = _ref7.margin;
|
|
119
132
|
return margin && (0, _typeof2["default"])(margin) === "object" && margin.left ? _variables.spaces[margin.left] : "";
|
|
120
133
|
}, function (props) {
|
|
121
|
-
return props.disabled
|
|
134
|
+
return props.disabled ? "not-allowed" : "pointer";
|
|
122
135
|
}, function (props) {
|
|
123
136
|
return "".concat(props.theme.accordionGroupSeparatorBorderThickness, " ").concat(props.theme.accordionGroupSeparatorBorderStyle);
|
|
124
137
|
}, function (props) {
|
|
@@ -153,32 +166,5 @@ var AccordionGroupContainer = _styledComponents["default"].div(_templateObject |
|
|
|
153
166
|
return props.theme.borderRadius;
|
|
154
167
|
});
|
|
155
168
|
|
|
156
|
-
DxcAccordionGroup.propTypes = {
|
|
157
|
-
disabled: _propTypes["default"].bool,
|
|
158
|
-
onActiveChange: _propTypes["default"].func,
|
|
159
|
-
indexActive: _propTypes["default"].number,
|
|
160
|
-
children: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
161
|
-
label: _propTypes["default"].string,
|
|
162
|
-
icon: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
|
|
163
|
-
iconSrc: _propTypes["default"].string,
|
|
164
|
-
iconPosition: _propTypes["default"].oneOf(["before", "after"]),
|
|
165
|
-
assistiveText: _propTypes["default"].string,
|
|
166
|
-
disabled: _propTypes["default"].bool,
|
|
167
|
-
children: _propTypes["default"].element,
|
|
168
|
-
padding: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
169
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
170
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
171
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
172
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
173
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
|
|
174
|
-
})),
|
|
175
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
176
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
177
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
178
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
179
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
180
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
|
|
181
|
-
};
|
|
182
|
-
DxcAccordionGroup.Accordion = Accordion;
|
|
183
169
|
var _default = DxcAccordionGroup;
|
|
184
170
|
exports["default"] = _default;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
declare type Margin = {
|
|
4
|
+
top?: Space;
|
|
5
|
+
bottom?: Space;
|
|
6
|
+
left?: Space;
|
|
7
|
+
right?: Space;
|
|
8
|
+
};
|
|
9
|
+
declare type Padding = {
|
|
10
|
+
top?: Space;
|
|
11
|
+
bottom?: Space;
|
|
12
|
+
left?: Space;
|
|
13
|
+
right?: Space;
|
|
14
|
+
};
|
|
15
|
+
declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
16
|
+
export declare type AccordionPropsType = {
|
|
17
|
+
/**
|
|
18
|
+
* The panel label.
|
|
19
|
+
*/
|
|
20
|
+
label?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Element used as the icon that will be placed next to panel label.
|
|
23
|
+
*/
|
|
24
|
+
icon?: SVG;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated URL of the icon that will be placed next to panel label.
|
|
27
|
+
*/
|
|
28
|
+
iconSrc?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Assistive text to be placed on the right side of the panel.
|
|
31
|
+
*/
|
|
32
|
+
assistiveText?: string;
|
|
33
|
+
/**
|
|
34
|
+
* If true, the component will be disabled.
|
|
35
|
+
*/
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Size of the padding to be applied to the custom area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
39
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
|
|
40
|
+
*/
|
|
41
|
+
padding?: Space | Padding;
|
|
42
|
+
/**
|
|
43
|
+
* The expanded panel of the accordion. This area can be used to render
|
|
44
|
+
* custom content.
|
|
45
|
+
*/
|
|
46
|
+
children: React.ReactNode;
|
|
47
|
+
};
|
|
48
|
+
declare type Props = {
|
|
49
|
+
/**
|
|
50
|
+
* The index of the active accordion. If undefined, the component will be uncontrolled and the active accordion will be managed internally by the component.
|
|
51
|
+
* If null, the component will be controlled and all accordions will be closed.
|
|
52
|
+
*/
|
|
53
|
+
indexActive?: number;
|
|
54
|
+
/**
|
|
55
|
+
* If true, the component will be disabled.
|
|
56
|
+
*/
|
|
57
|
+
disabled?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* This function will be called when the user clicks on an accordion. The index of the clicked accordion will be passed as a parameter.
|
|
60
|
+
*/
|
|
61
|
+
onActiveChange?: (indexActive: number) => void;
|
|
62
|
+
/**
|
|
63
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
64
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
65
|
+
*/
|
|
66
|
+
margin?: Space | Margin;
|
|
67
|
+
/**
|
|
68
|
+
* Customized accordion(s) that are allowed inside an Accordion Group.
|
|
69
|
+
*/
|
|
70
|
+
children: React.ReactElement<AccordionPropsType>[] | React.ReactElement<AccordionPropsType>;
|
|
71
|
+
};
|
|
72
|
+
export default Props;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
4
|
+
import DxcBox from "./Box";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Box ",
|
|
8
|
+
component: DxcBox,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Chromatic = () => (
|
|
12
|
+
<>
|
|
13
|
+
<Title title="Display flex" theme="light" level={2} />
|
|
14
|
+
<ExampleContainer>
|
|
15
|
+
<DxcBox display="flex" padding="medium">
|
|
16
|
+
Box
|
|
17
|
+
</DxcBox>
|
|
18
|
+
</ExampleContainer>
|
|
19
|
+
<Title title="ShadowDepth" theme="light" level={2} />
|
|
20
|
+
<ExampleContainer>
|
|
21
|
+
<Title title="ShadowDepth 0" theme="light" level={4} />
|
|
22
|
+
<DxcBox shadowDepth={0} margin="medium" padding="medium">
|
|
23
|
+
Box
|
|
24
|
+
</DxcBox>
|
|
25
|
+
</ExampleContainer>
|
|
26
|
+
<ExampleContainer>
|
|
27
|
+
<Title title="ShadowDepth 1" theme="light" level={4} />
|
|
28
|
+
<DxcBox shadowDepth={1} margin="medium" padding="medium">
|
|
29
|
+
Box
|
|
30
|
+
</DxcBox>
|
|
31
|
+
</ExampleContainer>
|
|
32
|
+
<ExampleContainer>
|
|
33
|
+
<Title title="ShadowDepth 2" theme="light" level={4} />
|
|
34
|
+
<DxcBox shadowDepth={2} margin="medium" padding="medium">
|
|
35
|
+
Box
|
|
36
|
+
</DxcBox>
|
|
37
|
+
</ExampleContainer>
|
|
38
|
+
<Title title="Paddings" theme="light" level={2} />
|
|
39
|
+
<ExampleContainer>
|
|
40
|
+
<Title title="Xxsmall padding" theme="light" level={4} />
|
|
41
|
+
<DxcBox padding="xxsmall">Box</DxcBox>
|
|
42
|
+
</ExampleContainer>
|
|
43
|
+
<ExampleContainer>
|
|
44
|
+
<Title title="Xsmall padding" theme="light" level={4} />
|
|
45
|
+
<DxcBox padding="xsmall">Box</DxcBox>
|
|
46
|
+
</ExampleContainer>
|
|
47
|
+
<ExampleContainer>
|
|
48
|
+
<Title title="Small padding" theme="light" level={4} />
|
|
49
|
+
<DxcBox padding="small">Box</DxcBox>
|
|
50
|
+
</ExampleContainer>
|
|
51
|
+
<ExampleContainer>
|
|
52
|
+
<Title title="Medium padding" theme="light" level={4} />
|
|
53
|
+
<DxcBox padding="medium">Box</DxcBox>
|
|
54
|
+
</ExampleContainer>
|
|
55
|
+
<ExampleContainer>
|
|
56
|
+
<Title title="Large padding" theme="light" level={4} />
|
|
57
|
+
<DxcBox padding="large">Box</DxcBox>
|
|
58
|
+
</ExampleContainer>
|
|
59
|
+
<ExampleContainer>
|
|
60
|
+
<Title title="Xlarge padding" theme="light" level={4} />
|
|
61
|
+
<DxcBox padding="xlarge">Box</DxcBox>
|
|
62
|
+
</ExampleContainer>
|
|
63
|
+
<ExampleContainer>
|
|
64
|
+
<Title title="Xxlarge padding" theme="light" level={4} />
|
|
65
|
+
<DxcBox padding="xxlarge">Box</DxcBox>
|
|
66
|
+
</ExampleContainer>
|
|
67
|
+
<Title title="Margins" theme="light" level={2} />
|
|
68
|
+
<ExampleContainer>
|
|
69
|
+
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
70
|
+
<DxcBox margin="xxsmall" padding="medium">
|
|
71
|
+
Box
|
|
72
|
+
</DxcBox>
|
|
73
|
+
</ExampleContainer>
|
|
74
|
+
<ExampleContainer>
|
|
75
|
+
<Title title="Xsmall margin" theme="light" level={4} />
|
|
76
|
+
<DxcBox margin="xsmall" padding="medium">
|
|
77
|
+
Box
|
|
78
|
+
</DxcBox>
|
|
79
|
+
</ExampleContainer>
|
|
80
|
+
<ExampleContainer>
|
|
81
|
+
<Title title="Small margin" theme="light" level={4} />
|
|
82
|
+
<DxcBox margin="small" padding="medium">
|
|
83
|
+
Box
|
|
84
|
+
</DxcBox>
|
|
85
|
+
</ExampleContainer>
|
|
86
|
+
<ExampleContainer>
|
|
87
|
+
<Title title="Medium margin" theme="light" level={4} />
|
|
88
|
+
<DxcBox margin="medium" padding="medium">
|
|
89
|
+
Box
|
|
90
|
+
</DxcBox>
|
|
91
|
+
</ExampleContainer>
|
|
92
|
+
<ExampleContainer>
|
|
93
|
+
<Title title="Large margin" theme="light" level={4} />
|
|
94
|
+
<DxcBox margin="large" padding="medium">
|
|
95
|
+
Box
|
|
96
|
+
</DxcBox>
|
|
97
|
+
</ExampleContainer>
|
|
98
|
+
<ExampleContainer>
|
|
99
|
+
<Title title="Xlarge margin" theme="light" level={4} />
|
|
100
|
+
<DxcBox margin="xlarge" padding="medium">
|
|
101
|
+
Box
|
|
102
|
+
</DxcBox>
|
|
103
|
+
</ExampleContainer>
|
|
104
|
+
<ExampleContainer>
|
|
105
|
+
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
106
|
+
<DxcBox margin="xxlarge" padding="medium">
|
|
107
|
+
Box
|
|
108
|
+
</DxcBox>
|
|
109
|
+
</ExampleContainer>
|
|
110
|
+
<Title title="Sizes" theme="light" level={2} />
|
|
111
|
+
<ExampleContainer>
|
|
112
|
+
<Title title="Small size" theme="light" level={4} />
|
|
113
|
+
<DxcBox size="small">Box</DxcBox>
|
|
114
|
+
</ExampleContainer>
|
|
115
|
+
<ExampleContainer>
|
|
116
|
+
<Title title="Medium size" theme="light" level={4} />
|
|
117
|
+
<DxcBox size="medium">Box</DxcBox>
|
|
118
|
+
</ExampleContainer>
|
|
119
|
+
<ExampleContainer>
|
|
120
|
+
<Title title="Large size" theme="light" level={4} />
|
|
121
|
+
<DxcBox size="large">Box</DxcBox>
|
|
122
|
+
</ExampleContainer>
|
|
123
|
+
<ExampleContainer>
|
|
124
|
+
<Title title="FillParent size" theme="light" level={4} />
|
|
125
|
+
<DxcBox size="fillParent">Box</DxcBox>
|
|
126
|
+
</ExampleContainer>
|
|
127
|
+
<ExampleContainer>
|
|
128
|
+
<Title title="FitContent" theme="light" level={4} />
|
|
129
|
+
<DxcBox size="fitContent">Box</DxcBox>
|
|
130
|
+
</ExampleContainer>
|
|
131
|
+
</>
|
|
132
|
+
);
|
package/card/Card.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import CardPropsType from "./types";
|
|
3
|
+
declare const DxcCard: ({ imageSrc, imageBgColor, imagePadding, imagePosition, linkHref, onClick, imageCover, margin, contentPadding, tabIndex, outlined, children, }: CardPropsType) => JSX.Element;
|
|
4
|
+
export default DxcCard;
|