@dxc-technology/halstack-react 9.1.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HalstackContext.d.ts +3 -6
- package/HalstackContext.js +1 -1
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +2 -14
- package/accordion/Accordion.stories.tsx +2 -100
- package/accordion/types.d.ts +0 -12
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +21 -42
- package/accordion-group/AccordionGroup.stories.tsx +77 -76
- package/accordion-group/AccordionGroup.test.js +6 -16
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +43 -0
- package/accordion-group/types.d.ts +0 -12
- package/alert/Alert.js +1 -3
- package/box/Box.d.ts +1 -1
- package/box/Box.js +5 -22
- package/box/Box.stories.tsx +25 -53
- package/box/types.d.ts +0 -12
- package/bulleted-list/BulletedList.js +4 -2
- package/bulleted-list/BulletedList.stories.tsx +7 -1
- package/bulleted-list/types.d.ts +31 -4
- package/button/Button.d.ts +1 -1
- package/button/Button.js +45 -54
- package/button/Button.stories.tsx +3 -3
- package/button/Button.test.js +11 -0
- package/button/types.d.ts +4 -0
- package/card/Card.d.ts +1 -1
- package/card/Card.js +18 -35
- package/card/Card.stories.tsx +0 -29
- package/card/types.d.ts +1 -7
- package/chip/Chip.js +23 -36
- package/chip/Chip.stories.tsx +25 -17
- package/common/OpenSans.css +68 -80
- package/common/coreTokens.d.ts +146 -0
- package/common/coreTokens.js +167 -0
- package/common/variables.d.ts +1 -144
- package/common/variables.js +952 -1095
- package/date-input/Calendar.js +2 -2
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +4 -22
- package/dialog/Dialog.stories.tsx +52 -176
- package/dialog/types.d.ts +0 -13
- package/dropdown/DropdownMenu.js +5 -1
- package/file-input/FileItem.js +2 -2
- package/file-input/types.d.ts +1 -1
- package/flex/Flex.js +4 -2
- package/flex/Flex.stories.tsx +24 -10
- package/flex/types.d.ts +70 -5
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +43 -61
- package/footer/Footer.stories.tsx +12 -89
- package/footer/Footer.test.js +3 -1
- package/footer/types.d.ts +10 -12
- package/grid/Grid.d.ts +1 -1
- package/grid/Grid.js +1 -1
- package/grid/Grid.stories.tsx +38 -38
- package/header/Header.d.ts +1 -1
- package/header/Header.js +3 -30
- package/header/Header.stories.tsx +7 -71
- package/header/types.d.ts +0 -14
- package/inset/Inset.stories.tsx +1 -1
- package/layout/ApplicationLayout.d.ts +2 -2
- package/layout/ApplicationLayout.js +7 -4
- package/link/Link.js +1 -1
- package/nav-tabs/NavTabs.d.ts +2 -2
- package/nav-tabs/NavTabs.js +7 -10
- package/nav-tabs/NavTabs.stories.tsx +14 -0
- package/nav-tabs/Tab.js +22 -26
- package/nav-tabs/types.d.ts +8 -9
- package/package.json +1 -1
- package/paginator/Paginator.js +1 -1
- package/paginator/Paginator.test.js +13 -0
- package/radio-group/Radio.js +10 -10
- package/radio-group/RadioGroup.js +8 -10
- package/sidenav/Sidenav.js +21 -23
- package/text-input/TextInput.js +1 -1
- package/text-input/TextInput.stories.tsx +1 -1
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/useTheme.d.ts +1 -1
- package/utils/FocusLock.js +2 -3
- package/card/ice-cream.jpg +0 -0
package/HalstackContext.d.ts
CHANGED
|
@@ -432,10 +432,7 @@ declare const HalstackContext: React.Context<DeepPartial<{
|
|
|
432
432
|
hamburguerIconColor: string;
|
|
433
433
|
hamburguerHoverColor: string;
|
|
434
434
|
logo: string;
|
|
435
|
-
logoResponsive: string;
|
|
436
|
-
* This type is used to allow partial themes and labels objects to be passed to the HalstackProvider.
|
|
437
|
-
* This is an extension of the already extisting Partial type, which only allows one level of partiality.
|
|
438
|
-
*/
|
|
435
|
+
logoResponsive: string;
|
|
439
436
|
logoHeight: string;
|
|
440
437
|
logoWidth: string;
|
|
441
438
|
menuBackgroundColor: string;
|
|
@@ -504,7 +501,7 @@ declare const HalstackContext: React.Context<DeepPartial<{
|
|
|
504
501
|
underlineSpacing: string;
|
|
505
502
|
underlineStyle: string;
|
|
506
503
|
underlineThickness: string;
|
|
507
|
-
|
|
504
|
+
disabledFontColor: string;
|
|
508
505
|
hoverFontColor: string;
|
|
509
506
|
hoverUnderlineColor: string;
|
|
510
507
|
visitedFontColor: string;
|
|
@@ -1323,7 +1320,7 @@ declare const HalstackLanguageContext: React.Context<DeepPartial<{
|
|
|
1323
1320
|
}>>;
|
|
1324
1321
|
/**
|
|
1325
1322
|
* This type is used to allow partial themes and labels objects to be passed to the HalstackProvider.
|
|
1326
|
-
* This is an extension of the already
|
|
1323
|
+
* This is an extension of the already existing Partial type, which only allows one level of partiality.
|
|
1327
1324
|
*/
|
|
1328
1325
|
declare type DeepPartial<T> = {
|
|
1329
1326
|
[P in keyof T]?: Partial<T[P]>;
|
package/HalstackContext.js
CHANGED
|
@@ -305,7 +305,7 @@ var parseLabels = function parseLabels(labels) {
|
|
|
305
305
|
};
|
|
306
306
|
/**
|
|
307
307
|
* This type is used to allow partial themes and labels objects to be passed to the HalstackProvider.
|
|
308
|
-
* This is an extension of the already
|
|
308
|
+
* This is an extension of the already existing Partial type, which only allows one level of partiality.
|
|
309
309
|
*/
|
|
310
310
|
|
|
311
311
|
|
package/accordion/Accordion.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import AccordionPropsType from "./types";
|
|
3
|
-
declare const DxcAccordion: ({ label, defaultIsExpanded, isExpanded, icon, assistiveText, disabled, onChange, children, margin,
|
|
3
|
+
declare const DxcAccordion: ({ label, defaultIsExpanded, isExpanded, icon, assistiveText, disabled, onChange, children, margin, tabIndex, }: AccordionPropsType) => JSX.Element;
|
|
4
4
|
export default DxcAccordion;
|
package/accordion/Accordion.js
CHANGED
|
@@ -68,7 +68,6 @@ var DxcAccordion = function DxcAccordion(_ref) {
|
|
|
68
68
|
onChange = _ref.onChange,
|
|
69
69
|
children = _ref.children,
|
|
70
70
|
margin = _ref.margin,
|
|
71
|
-
padding = _ref.padding,
|
|
72
71
|
_ref$tabIndex = _ref.tabIndex,
|
|
73
72
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
74
73
|
|
|
@@ -129,8 +128,7 @@ var DxcAccordion = function DxcAccordion(_ref) {
|
|
|
129
128
|
}, (isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded) ? expandLess : expandMore))), (isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded) && /*#__PURE__*/_react["default"].createElement(AccordionPanel, {
|
|
130
129
|
id: "accordion-panel-".concat(id),
|
|
131
130
|
role: "region",
|
|
132
|
-
"aria-labelledby": "accordion-".concat(id)
|
|
133
|
-
padding: padding
|
|
131
|
+
"aria-labelledby": "accordion-".concat(id)
|
|
134
132
|
}, /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
|
|
135
133
|
color: colorsTheme.accordion.backgroundColor
|
|
136
134
|
}, children))));
|
|
@@ -214,20 +212,10 @@ var CollapseIndicator = _styledComponents["default"].span(_templateObject8 || (_
|
|
|
214
212
|
return props.disabled ? props.theme.disabledArrowColor : props.theme.arrowColor;
|
|
215
213
|
});
|
|
216
214
|
|
|
217
|
-
var AccordionPanel = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n
|
|
215
|
+
var AccordionPanel = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n"])), function (props) {
|
|
218
216
|
return props.theme.borderRadius;
|
|
219
217
|
}, function (props) {
|
|
220
218
|
return props.theme.borderRadius;
|
|
221
|
-
}, function (props) {
|
|
222
|
-
return props.padding && (0, _typeof2["default"])(props.padding) !== "object" ? _variables.spaces[props.padding] : "0px";
|
|
223
|
-
}, function (props) {
|
|
224
|
-
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.top ? _variables.spaces[props.padding.top] : "";
|
|
225
|
-
}, function (props) {
|
|
226
|
-
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.right ? _variables.spaces[props.padding.right] : "";
|
|
227
|
-
}, function (props) {
|
|
228
|
-
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.bottom ? _variables.spaces[props.padding.bottom] : "";
|
|
229
|
-
}, function (props) {
|
|
230
|
-
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.left ? _variables.spaces[props.padding.left] : "";
|
|
231
219
|
});
|
|
232
220
|
|
|
233
221
|
var _default = DxcAccordion;
|
|
@@ -179,112 +179,14 @@ export const Chromatic = () => (
|
|
|
179
179
|
<ExampleContainer>
|
|
180
180
|
<Title title="Background color provider over accordion content" theme="light" level={4} />
|
|
181
181
|
<HalstackProvider advancedTheme={advancedTheme}>
|
|
182
|
-
<DxcAccordion
|
|
183
|
-
|
|
184
|
-
defaultIsExpanded
|
|
185
|
-
assistiveText="Assistive text"
|
|
186
|
-
icon={folderIcon}
|
|
187
|
-
padding="medium"
|
|
188
|
-
>
|
|
189
|
-
<div style={{ display: "flex", flexDirection: "column", gap: "36px" }}>
|
|
182
|
+
<DxcAccordion label="Dark Accordion" defaultIsExpanded assistiveText="Assistive text" icon={folderIcon}>
|
|
183
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "36px", padding: "36px" }}>
|
|
190
184
|
<DxcTextInput label="Label" helperText="HelperText" placeholder="Placeholder" size="fillParent" />
|
|
191
185
|
<DxcButton label="Submit" size="medium" />
|
|
192
186
|
</div>
|
|
193
187
|
</DxcAccordion>
|
|
194
188
|
</HalstackProvider>
|
|
195
189
|
</ExampleContainer>
|
|
196
|
-
<Title title="Paddings" theme="light" level={2} />
|
|
197
|
-
<ExampleContainer>
|
|
198
|
-
<Title title="Xxsmall padding" theme="light" level={4} />
|
|
199
|
-
<DxcAccordion label="Xxsmall padding" defaultIsExpanded padding="xxsmall">
|
|
200
|
-
<div>
|
|
201
|
-
<DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
|
|
202
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
203
|
-
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
204
|
-
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
205
|
-
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
|
|
206
|
-
est laborum.
|
|
207
|
-
</div>
|
|
208
|
-
</DxcAccordion>
|
|
209
|
-
</ExampleContainer>
|
|
210
|
-
<ExampleContainer>
|
|
211
|
-
<Title title="Xsmall padding" theme="light" level={4} />
|
|
212
|
-
<DxcAccordion label="Xsmall padding" defaultIsExpanded padding="xsmall">
|
|
213
|
-
<div>
|
|
214
|
-
<DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
|
|
215
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
216
|
-
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
217
|
-
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
218
|
-
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
|
|
219
|
-
est laborum.
|
|
220
|
-
</div>
|
|
221
|
-
</DxcAccordion>
|
|
222
|
-
</ExampleContainer>
|
|
223
|
-
<ExampleContainer>
|
|
224
|
-
<Title title="Small padding" theme="light" level={4} />
|
|
225
|
-
<DxcAccordion label="Small padding" defaultIsExpanded padding="small">
|
|
226
|
-
<div>
|
|
227
|
-
<DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
|
|
228
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
229
|
-
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
230
|
-
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
231
|
-
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
|
|
232
|
-
est laborum.
|
|
233
|
-
</div>
|
|
234
|
-
</DxcAccordion>
|
|
235
|
-
</ExampleContainer>
|
|
236
|
-
<ExampleContainer>
|
|
237
|
-
<Title title="Medium padding" theme="light" level={4} />
|
|
238
|
-
<DxcAccordion label="Medium padding" defaultIsExpanded padding="medium">
|
|
239
|
-
<div>
|
|
240
|
-
<DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
|
|
241
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
242
|
-
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
243
|
-
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
244
|
-
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
|
|
245
|
-
est laborum.
|
|
246
|
-
</div>
|
|
247
|
-
</DxcAccordion>
|
|
248
|
-
</ExampleContainer>
|
|
249
|
-
<ExampleContainer>
|
|
250
|
-
<Title title="Large padding" theme="light" level={4} />
|
|
251
|
-
<DxcAccordion label="Large padding" defaultIsExpanded padding="large">
|
|
252
|
-
<div>
|
|
253
|
-
<DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
|
|
254
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
255
|
-
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
256
|
-
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
257
|
-
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
|
|
258
|
-
est laborum.
|
|
259
|
-
</div>
|
|
260
|
-
</DxcAccordion>
|
|
261
|
-
</ExampleContainer>
|
|
262
|
-
<ExampleContainer>
|
|
263
|
-
<Title title="Xlarge padding" theme="light" level={4} />
|
|
264
|
-
<DxcAccordion label="Xlarge padding" defaultIsExpanded padding="xlarge">
|
|
265
|
-
<div>
|
|
266
|
-
<DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
|
|
267
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
268
|
-
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
269
|
-
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
270
|
-
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
|
|
271
|
-
est laborum.
|
|
272
|
-
</div>
|
|
273
|
-
</DxcAccordion>
|
|
274
|
-
</ExampleContainer>
|
|
275
|
-
<ExampleContainer>
|
|
276
|
-
<Title title="Xxlarge padding" theme="light" level={4} />
|
|
277
|
-
<DxcAccordion label="Xxlarge padding" defaultIsExpanded padding="xxlarge">
|
|
278
|
-
<div>
|
|
279
|
-
<DxcHeading level={5} text="Content header" margin={{ bottom: "xxsmall" }} />
|
|
280
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
281
|
-
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
282
|
-
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
283
|
-
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
|
|
284
|
-
est laborum.
|
|
285
|
-
</div>
|
|
286
|
-
</DxcAccordion>
|
|
287
|
-
</ExampleContainer>
|
|
288
190
|
<Title title="Margins" theme="light" level={2} />
|
|
289
191
|
<ExampleContainer>
|
|
290
192
|
<Title title="Xxsmall margin" theme="light" level={4} />
|
package/accordion/types.d.ts
CHANGED
|
@@ -6,12 +6,6 @@ declare type Margin = {
|
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
declare type Padding = {
|
|
10
|
-
top?: Space;
|
|
11
|
-
bottom?: Space;
|
|
12
|
-
left?: Space;
|
|
13
|
-
right?: Space;
|
|
14
|
-
};
|
|
15
9
|
declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
16
10
|
declare type Props = {
|
|
17
11
|
/**
|
|
@@ -55,12 +49,6 @@ declare type Props = {
|
|
|
55
49
|
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
56
50
|
*/
|
|
57
51
|
margin?: Space | Margin;
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated This prop will be removed shortly, consider using the Inset component for this purpose.
|
|
60
|
-
* Size of the padding to be applied to the custom area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
61
|
-
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
|
|
62
|
-
*/
|
|
63
|
-
padding?: Space | Padding;
|
|
64
52
|
/**
|
|
65
53
|
* Value of the tabindex.
|
|
66
54
|
*/
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import AccordionGroupPropsType, {
|
|
1
|
+
import React from "react";
|
|
2
|
+
import AccordionGroupPropsType, { AccordionGroupAccordionContextProps } from "./types";
|
|
3
|
+
export declare const AccordionGroupAccordionContext: React.Context<AccordionGroupAccordionContextProps>;
|
|
3
4
|
declare const DxcAccordionGroup: {
|
|
4
5
|
({ defaultIndexActive, indexActive, disabled, onActiveChange, margin, children, }: AccordionGroupPropsType): JSX.Element;
|
|
5
|
-
Accordion: ({ ...childProps }: AccordionPropsType) => JSX.Element;
|
|
6
|
+
Accordion: ({ ...childProps }: import("./types").AccordionPropsType) => JSX.Element;
|
|
6
7
|
};
|
|
7
8
|
export default DxcAccordionGroup;
|
|
@@ -7,7 +7,7 @@ var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports["default"] = void 0;
|
|
10
|
+
exports["default"] = exports.AccordionGroupAccordionContext = void 0;
|
|
11
11
|
|
|
12
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
13
|
|
|
@@ -17,20 +17,18 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
17
17
|
|
|
18
18
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
19
19
|
|
|
20
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
21
|
-
|
|
22
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
23
21
|
|
|
24
22
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
25
23
|
|
|
26
|
-
var _Accordion = _interopRequireDefault(require("../accordion/Accordion"));
|
|
27
|
-
|
|
28
24
|
var _utils = require("../common/utils");
|
|
29
25
|
|
|
30
26
|
var _variables = require("../common/variables");
|
|
31
27
|
|
|
32
28
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
33
29
|
|
|
30
|
+
var _AccordionGroupAccordion = _interopRequireDefault(require("./AccordionGroupAccordion"));
|
|
31
|
+
|
|
34
32
|
var _templateObject;
|
|
35
33
|
|
|
36
34
|
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); }
|
|
@@ -42,33 +40,16 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
42
40
|
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
41
|
|
|
44
42
|
var AccordionGroupAccordionContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return /*#__PURE__*/_react["default"].createElement(_Accordion["default"], (0, _extends2["default"])({
|
|
56
|
-
isExpanded: activeIndex === index,
|
|
57
|
-
onChange: function onChange() {
|
|
58
|
-
handlerActiveChange(index);
|
|
59
|
-
},
|
|
60
|
-
disabled: disabled
|
|
61
|
-
}, childProps), childProps.children);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
var DxcAccordionGroup = function DxcAccordionGroup(_ref2) {
|
|
65
|
-
var defaultIndexActive = _ref2.defaultIndexActive,
|
|
66
|
-
indexActive = _ref2.indexActive,
|
|
67
|
-
_ref2$disabled = _ref2.disabled,
|
|
68
|
-
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
69
|
-
onActiveChange = _ref2.onActiveChange,
|
|
70
|
-
margin = _ref2.margin,
|
|
71
|
-
children = _ref2.children;
|
|
43
|
+
exports.AccordionGroupAccordionContext = AccordionGroupAccordionContext;
|
|
44
|
+
|
|
45
|
+
var DxcAccordionGroup = function DxcAccordionGroup(_ref) {
|
|
46
|
+
var defaultIndexActive = _ref.defaultIndexActive,
|
|
47
|
+
indexActive = _ref.indexActive,
|
|
48
|
+
_ref$disabled = _ref.disabled,
|
|
49
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
50
|
+
onActiveChange = _ref.onActiveChange,
|
|
51
|
+
margin = _ref.margin,
|
|
52
|
+
children = _ref.children;
|
|
72
53
|
var colorsTheme = (0, _useTheme["default"])();
|
|
73
54
|
|
|
74
55
|
var _useState = (0, _react.useState)(defaultIndexActive !== null && defaultIndexActive !== void 0 ? defaultIndexActive : -1),
|
|
@@ -94,9 +75,7 @@ var DxcAccordionGroup = function DxcAccordionGroup(_ref2) {
|
|
|
94
75
|
}, /*#__PURE__*/_react["default"].createElement(AccordionGroupContainer, {
|
|
95
76
|
margin: margin,
|
|
96
77
|
disabled: disabled
|
|
97
|
-
},
|
|
98
|
-
return child.type === AccordionGroupAccordion;
|
|
99
|
-
}).map(function (accordion, index) {
|
|
78
|
+
}, _react.Children.map(children, function (accordion, index) {
|
|
100
79
|
return /*#__PURE__*/_react["default"].createElement(AccordionGroupAccordionContext.Provider, {
|
|
101
80
|
key: "accordion-".concat(index),
|
|
102
81
|
value: _objectSpread({
|
|
@@ -106,7 +85,7 @@ var DxcAccordionGroup = function DxcAccordionGroup(_ref2) {
|
|
|
106
85
|
})));
|
|
107
86
|
};
|
|
108
87
|
|
|
109
|
-
DxcAccordionGroup.Accordion =
|
|
88
|
+
DxcAccordionGroup.Accordion = _AccordionGroupAccordion["default"];
|
|
110
89
|
|
|
111
90
|
var calculateWidth = function calculateWidth(margin) {
|
|
112
91
|
return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
@@ -114,20 +93,20 @@ var calculateWidth = function calculateWidth(margin) {
|
|
|
114
93
|
|
|
115
94
|
var AccordionGroupContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n cursor: ", ";\n\n > div:not(:last-of-type):not(:only-of-type) {\n border-bottom: ", ";\n border-color: ", ";\n }\n > div:not(:first-of-type):not(:last-of-type):not(:only-of-type) {\n border-radius: 0;\n & > h3 > button {\n border-radius: 0;\n }\n }\n > div:first-of-type:not(:only-of-type) {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n\n & > h3 > button {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n }\n > div:last-of-type:not(:only-of-type) {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n\n & > h3 > button {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n }\n"])), function (props) {
|
|
116
95
|
return calculateWidth(props.margin);
|
|
96
|
+
}, function (_ref2) {
|
|
97
|
+
var margin = _ref2.margin;
|
|
98
|
+
return margin && (0, _typeof2["default"])(margin) !== "object" ? _variables.spaces[margin] : "0px";
|
|
117
99
|
}, function (_ref3) {
|
|
118
100
|
var margin = _ref3.margin;
|
|
119
|
-
return margin && (0, _typeof2["default"])(margin)
|
|
101
|
+
return margin && (0, _typeof2["default"])(margin) === "object" && margin.top ? _variables.spaces[margin.top] : "";
|
|
120
102
|
}, function (_ref4) {
|
|
121
103
|
var margin = _ref4.margin;
|
|
122
|
-
return margin && (0, _typeof2["default"])(margin) === "object" && margin.
|
|
104
|
+
return margin && (0, _typeof2["default"])(margin) === "object" && margin.right ? _variables.spaces[margin.right] : "";
|
|
123
105
|
}, function (_ref5) {
|
|
124
106
|
var margin = _ref5.margin;
|
|
125
|
-
return margin && (0, _typeof2["default"])(margin) === "object" && margin.
|
|
107
|
+
return margin && (0, _typeof2["default"])(margin) === "object" && margin.bottom ? _variables.spaces[margin.bottom] : "";
|
|
126
108
|
}, function (_ref6) {
|
|
127
109
|
var margin = _ref6.margin;
|
|
128
|
-
return margin && (0, _typeof2["default"])(margin) === "object" && margin.bottom ? _variables.spaces[margin.bottom] : "";
|
|
129
|
-
}, function (_ref7) {
|
|
130
|
-
var margin = _ref7.margin;
|
|
131
110
|
return margin && (0, _typeof2["default"])(margin) === "object" && margin.left ? _variables.spaces[margin.left] : "";
|
|
132
111
|
}, function (props) {
|
|
133
112
|
return props.disabled ? "not-allowed" : "pointer";
|