@dxc-technology/halstack-react 0.0.0-c18d61a → 0.0.0-c1a6e05
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BackgroundColorContext.d.ts +2 -2
- package/BackgroundColorContext.js +1 -1
- package/HalstackContext.d.ts +1329 -5
- package/HalstackContext.js +117 -77
- package/accordion/Accordion.js +13 -24
- package/accordion/Accordion.stories.tsx +102 -13
- package/accordion/Accordion.test.js +1 -1
- package/accordion/types.d.ts +3 -3
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +23 -44
- package/accordion-group/AccordionGroup.test.js +1 -1
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +43 -0
- package/accordion-group/types.d.ts +2 -2
- package/alert/Alert.js +4 -8
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +1 -1
- package/bleed/Bleed.stories.tsx +1 -0
- package/box/Box.js +3 -5
- package/box/Box.stories.tsx +15 -0
- package/box/Box.test.js +1 -1
- 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.js +13 -16
- package/button/Button.stories.tsx +151 -9
- package/button/Button.test.js +1 -1
- package/button/types.d.ts +3 -3
- package/card/Card.js +12 -13
- package/card/Card.stories.tsx +12 -13
- package/card/Card.test.js +1 -1
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +18 -17
- package/checkbox/Checkbox.stories.tsx +131 -59
- package/checkbox/Checkbox.test.js +1 -1
- package/checkbox/types.d.ts +6 -2
- package/chip/Chip.js +28 -49
- package/chip/Chip.stories.tsx +121 -26
- package/chip/Chip.test.js +3 -5
- package/common/OpenSans.css +68 -80
- package/common/coreTokens.d.ts +146 -0
- package/common/coreTokens.js +167 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +4 -4
- package/common/variables.d.ts +1482 -0
- package/common/variables.js +981 -1129
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +134 -237
- package/date-input/DateInput.stories.tsx +199 -33
- package/date-input/DateInput.test.js +494 -138
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +146 -0
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +75 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +126 -0
- package/date-input/types.d.ts +51 -0
- package/dialog/Dialog.js +61 -74
- package/dialog/Dialog.stories.tsx +211 -159
- package/dialog/Dialog.test.js +302 -3
- package/dialog/types.d.ts +2 -2
- package/dropdown/Dropdown.js +37 -37
- package/dropdown/Dropdown.stories.tsx +210 -84
- package/dropdown/Dropdown.test.js +20 -24
- package/dropdown/DropdownMenu.js +12 -18
- package/dropdown/DropdownMenuItem.js +4 -17
- package/dropdown/types.d.ts +3 -3
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +28 -52
- package/file-input/FileInput.stories.tsx +96 -17
- package/file-input/FileInput.test.js +14 -55
- package/file-input/FileItem.d.ts +2 -12
- package/file-input/FileItem.js +29 -41
- package/file-input/types.d.ts +17 -0
- package/flex/Flex.js +4 -2
- package/flex/Flex.stories.tsx +35 -26
- package/flex/types.d.ts +70 -5
- package/footer/Footer.js +6 -8
- package/footer/Footer.stories.tsx +91 -0
- package/footer/Footer.test.js +14 -26
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +91 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- package/header/Header.d.ts +3 -2
- package/header/Header.js +21 -23
- package/header/Header.stories.tsx +149 -6
- package/header/Header.test.js +2 -2
- package/header/types.d.ts +2 -2
- package/heading/Heading.js +1 -1
- package/heading/Heading.test.js +1 -1
- package/inset/Inset.stories.tsx +2 -1
- package/layout/ApplicationLayout.d.ts +3 -3
- package/layout/ApplicationLayout.js +1 -1
- package/layout/types.d.ts +2 -3
- package/link/Link.js +4 -4
- package/link/Link.stories.tsx +60 -0
- package/link/Link.test.js +2 -4
- package/link/types.d.ts +2 -2
- package/main.d.ts +3 -2
- package/main.js +9 -1
- package/{tabs-nav → nav-tabs}/NavTabs.js +1 -1
- package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +96 -6
- package/{tabs-nav → nav-tabs}/NavTabs.test.js +1 -1
- package/{tabs-nav → nav-tabs}/Tab.js +37 -17
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.test.js +6 -7
- package/package.json +8 -13
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +6 -14
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +44 -47
- package/paragraph/Paragraph.d.ts +3 -4
- package/paragraph/Paragraph.js +5 -5
- package/password-input/PasswordInput.test.js +1 -1
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +5 -5
- package/progress-bar/ProgressBar.stories.jsx +35 -2
- package/progress-bar/ProgressBar.test.js +1 -1
- package/progress-bar/types.d.ts +4 -3
- package/quick-nav/QuickNav.stories.tsx +14 -0
- package/radio-group/Radio.js +10 -10
- package/radio-group/RadioGroup.js +8 -10
- package/radio-group/RadioGroup.stories.tsx +131 -18
- package/radio-group/RadioGroup.test.js +1 -1
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.js +49 -106
- package/resultsetTable/ResultsetTable.stories.tsx +50 -25
- package/resultsetTable/ResultsetTable.test.js +41 -64
- package/resultsetTable/types.d.ts +1 -1
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +5 -34
- package/select/Option.js +11 -24
- package/select/Select.js +56 -35
- package/select/Select.stories.tsx +494 -150
- package/select/Select.test.js +76 -81
- package/select/types.d.ts +2 -2
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +51 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +66 -96
- package/sidenav/Sidenav.stories.tsx +165 -63
- package/sidenav/types.d.ts +21 -18
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +11 -11
- package/slider/Slider.stories.tsx +57 -0
- package/slider/Slider.test.js +1 -1
- package/slider/types.d.ts +6 -2
- package/spinner/Spinner.js +17 -23
- package/spinner/Spinner.stories.jsx +53 -27
- package/spinner/Spinner.test.js +1 -1
- package/switch/Switch.d.ts +3 -3
- package/switch/Switch.js +7 -6
- package/switch/Switch.stories.tsx +33 -0
- package/switch/Switch.test.js +1 -1
- package/switch/types.d.ts +8 -3
- package/table/Table.js +2 -2
- package/table/Table.stories.jsx +80 -1
- package/table/Table.test.js +2 -2
- package/tabs/Tab.js +12 -15
- package/tabs/Tabs.js +11 -17
- package/tabs/Tabs.stories.tsx +45 -5
- package/tabs/Tabs.test.js +4 -5
- package/tabs/types.d.ts +2 -2
- package/tag/Tag.js +7 -9
- package/tag/Tag.stories.tsx +14 -1
- package/tag/Tag.test.js +1 -1
- package/text-input/Suggestion.js +34 -7
- package/text-input/TextInput.js +11 -15
- package/text-input/TextInput.stories.tsx +93 -5
- package/text-input/TextInput.test.js +587 -635
- package/textarea/Textarea.js +3 -4
- package/textarea/Textarea.stories.jsx +60 -1
- package/textarea/Textarea.test.js +2 -4
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +7 -4
- package/toggle-group/ToggleGroup.stories.tsx +42 -0
- package/toggle-group/ToggleGroup.test.js +1 -1
- package/toggle-group/types.d.ts +1 -1
- package/typography/Typography.d.ts +2 -2
- package/typography/Typography.js +14 -113
- package/typography/Typography.stories.tsx +1 -1
- package/useTheme.d.ts +1234 -1
- package/useTheme.js +1 -1
- package/useTranslatedLabels.d.ts +84 -1
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +108 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +138 -0
- package/wizard/Wizard.js +2 -2
- package/wizard/Wizard.stories.tsx +20 -0
- package/wizard/Wizard.test.js +1 -1
- package/wizard/types.d.ts +5 -6
- package/common/RequiredComponent.js +0 -32
- /package/{tabs-nav → grid}/types.js +0 -0
- /package/{tabs-nav → nav-tabs}/NavTabs.d.ts +0 -0
- /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
- /package/{tabs-nav → nav-tabs}/types.d.ts +0 -0
|
@@ -30,10 +30,33 @@ const folderIcon = (
|
|
|
30
30
|
</svg>
|
|
31
31
|
);
|
|
32
32
|
|
|
33
|
-
const
|
|
34
|
-
<svg xmlns="http://www.w3.org/2000/svg"
|
|
35
|
-
<path d="
|
|
36
|
-
|
|
33
|
+
const smallIcon = (
|
|
34
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="20" width="20">
|
|
35
|
+
<path d="m7.646 18.333-.313-2.625q-.208-.125-.458-.27-.25-.146-.458-.271l-2.438 1.021-2.354-4.063 2.083-1.583V9.458L1.625 7.875l2.354-4.063 2.438 1.021q.208-.125.458-.27.25-.146.458-.271l.313-2.625h4.708l.313 2.625q.208.125.458.271.25.145.458.27l2.438-1.021 2.354 4.063-2.063 1.583v1.084l2.063 1.583-2.354 4.063-2.438-1.021q-.208.125-.458.271-.25.145-.458.27l-.313 2.625ZM10 12.979q1.229 0 2.104-.875T12.979 10q0-1.229-.875-2.104T10 7.021q-1.229 0-2.104.875T7.021 10q0 1.229.875 2.104t2.104.875Zm0-1.75q-.5 0-.865-.364-.364-.365-.364-.865t.364-.865q.365-.364.865-.364t.865.364q.364.365.364.865t-.364.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.166q.605-.167 1.167-.5.562-.334 1.021-.792l2.021.854.833-1.375-1.771-1.354q.104-.292.146-.604.042-.313.042-.646 0-.292-.042-.594t-.125-.635l1.771-1.375-.834-1.375-2.02.875q-.48-.479-1.032-.802-.552-.323-1.156-.49l-.271-2.187H9.167l-.271 2.187q-.604.167-1.156.49-.552.323-1.011.781l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.459.458 1.011.781.552.323 1.156.49Z" />
|
|
36
|
+
</svg>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const facebookIcon = (
|
|
40
|
+
<svg
|
|
41
|
+
version="1.1"
|
|
42
|
+
id="Capa_1"
|
|
43
|
+
x="0px"
|
|
44
|
+
y="0px"
|
|
45
|
+
width="438.536px"
|
|
46
|
+
height="438.536px"
|
|
47
|
+
viewBox="0 0 438.536 438.536"
|
|
48
|
+
fill="currentColor"
|
|
49
|
+
>
|
|
50
|
+
<g>
|
|
51
|
+
<path
|
|
52
|
+
d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
|
|
53
|
+
C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
|
|
54
|
+
h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
|
|
55
|
+
C438.532,59.576,430.49,40.204,414.41,24.123z M373.155,225.548h-49.963V406.84h-74.802V225.548H210.99V163.02h37.401v-37.402
|
|
56
|
+
c0-26.838,6.283-47.107,18.843-60.813c12.559-13.706,33.304-20.555,62.242-20.555h49.963v62.526h-31.401
|
|
57
|
+
c-10.663,0-17.467,1.853-20.417,5.568c-2.949,3.711-4.428,10.23-4.428,19.558v31.119h56.534L373.155,225.548z"
|
|
58
|
+
/>
|
|
59
|
+
</g>
|
|
37
60
|
</svg>
|
|
38
61
|
);
|
|
39
62
|
|
|
@@ -47,6 +70,14 @@ const advancedTheme = {
|
|
|
47
70
|
},
|
|
48
71
|
};
|
|
49
72
|
|
|
73
|
+
const opinionatedTheme = {
|
|
74
|
+
accordion: {
|
|
75
|
+
accentColor: "#5f249f",
|
|
76
|
+
titleFontColor: "#000000",
|
|
77
|
+
assistiveTextFontColor: "#666666",
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
50
81
|
export const Chromatic = () => (
|
|
51
82
|
<>
|
|
52
83
|
<Title title="Component anatomy" theme="light" level={2} />
|
|
@@ -78,8 +109,30 @@ export const Chromatic = () => (
|
|
|
78
109
|
</DxcAccordion>
|
|
79
110
|
</ExampleContainer>
|
|
80
111
|
<ExampleContainer>
|
|
81
|
-
<Title title="With
|
|
82
|
-
<DxcAccordion label="Accordion" assistiveText="Assistive text" icon={
|
|
112
|
+
<Title title="With smaller icon" theme="light" level={4} />
|
|
113
|
+
<DxcAccordion label="Accordion" assistiveText="Assistive text" icon={smallIcon}>
|
|
114
|
+
<div>
|
|
115
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
116
|
+
lobortis eget.
|
|
117
|
+
</div>
|
|
118
|
+
</DxcAccordion>
|
|
119
|
+
</ExampleContainer>
|
|
120
|
+
<ExampleContainer>
|
|
121
|
+
<Title title="With bigger icon (SVG)" theme="light" level={4} />
|
|
122
|
+
<DxcAccordion label="AccordionTest" assistiveText="Assistive text" icon={facebookIcon}>
|
|
123
|
+
<div>
|
|
124
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
125
|
+
lobortis eget.
|
|
126
|
+
</div>
|
|
127
|
+
</DxcAccordion>
|
|
128
|
+
</ExampleContainer>
|
|
129
|
+
<ExampleContainer>
|
|
130
|
+
<Title title="With bigger icon (image)" theme="light" level={4} />
|
|
131
|
+
<DxcAccordion
|
|
132
|
+
label="Accordion"
|
|
133
|
+
assistiveText="Assistive text"
|
|
134
|
+
icon="https://www.freepnglogos.com/uploads/facebook-logo-design-1.png"
|
|
135
|
+
>
|
|
83
136
|
<div>
|
|
84
137
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
85
138
|
lobortis eget.
|
|
@@ -134,12 +187,7 @@ export const Chromatic = () => (
|
|
|
134
187
|
padding="medium"
|
|
135
188
|
>
|
|
136
189
|
<div style={{ display: "flex", flexDirection: "column", gap: "36px" }}>
|
|
137
|
-
<DxcTextInput
|
|
138
|
-
label="Label"
|
|
139
|
-
helperText="HelperText"
|
|
140
|
-
placeholder="Placeholder"
|
|
141
|
-
size="fillParent"
|
|
142
|
-
/>
|
|
190
|
+
<DxcTextInput label="Label" helperText="HelperText" placeholder="Placeholder" size="fillParent" />
|
|
143
191
|
<DxcButton label="Submit" size="medium" />
|
|
144
192
|
</div>
|
|
145
193
|
</DxcAccordion>
|
|
@@ -300,7 +348,48 @@ export const Chromatic = () => (
|
|
|
300
348
|
lobortis eget.
|
|
301
349
|
</div>
|
|
302
350
|
</DxcAccordion>
|
|
303
|
-
|
|
351
|
+
</ExampleContainer>
|
|
352
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
353
|
+
<ExampleContainer>
|
|
354
|
+
<Title title="With assistive text and icon" theme="light" level={4} />
|
|
355
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
356
|
+
<DxcAccordion label="Accordion" assistiveText="Assistive text" icon={folderIcon}>
|
|
357
|
+
Content
|
|
358
|
+
</DxcAccordion>
|
|
359
|
+
</HalstackProvider>
|
|
360
|
+
</ExampleContainer>
|
|
361
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
362
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
363
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
364
|
+
<DxcAccordion label="Hovered">
|
|
365
|
+
<div>
|
|
366
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
|
|
367
|
+
leo lobortis eget.
|
|
368
|
+
</div>
|
|
369
|
+
</DxcAccordion>
|
|
370
|
+
</HalstackProvider>
|
|
371
|
+
</ExampleContainer>
|
|
372
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
373
|
+
<Title title="Active" theme="light" level={4} />
|
|
374
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
375
|
+
<DxcAccordion label="Active">
|
|
376
|
+
<div>
|
|
377
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
|
|
378
|
+
leo lobortis eget.
|
|
379
|
+
</div>
|
|
380
|
+
</DxcAccordion>
|
|
381
|
+
</HalstackProvider>
|
|
382
|
+
</ExampleContainer>
|
|
383
|
+
<ExampleContainer>
|
|
384
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
385
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
386
|
+
<DxcAccordion label="Disabled" assistiveText="Assistive text" icon={folderIcon} disabled>
|
|
387
|
+
<div>
|
|
388
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
|
|
389
|
+
leo lobortis eget.
|
|
390
|
+
</div>
|
|
391
|
+
</DxcAccordion>
|
|
392
|
+
</HalstackProvider>
|
|
304
393
|
</ExampleContainer>
|
|
305
394
|
</>
|
|
306
395
|
);
|
|
@@ -6,7 +6,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
6
6
|
|
|
7
7
|
var _react2 = require("@testing-library/react");
|
|
8
8
|
|
|
9
|
-
var _Accordion = _interopRequireDefault(require("./Accordion"));
|
|
9
|
+
var _Accordion = _interopRequireDefault(require("./Accordion.tsx"));
|
|
10
10
|
|
|
11
11
|
describe("Accordion component tests", function () {
|
|
12
12
|
test("Renders with correct aria accessibility attributes", function () {
|
package/accordion/types.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
declare type Margin = {
|
|
4
4
|
top?: Space;
|
|
5
5
|
bottom?: Space;
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
declare type Padding = {
|
|
10
10
|
top?: Space;
|
|
11
11
|
bottom?: Space;
|
|
12
12
|
left?: Space;
|
|
@@ -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
|
|
27
|
-
|
|
28
|
-
var _utils = require("../common/utils.js");
|
|
24
|
+
var _utils = require("../common/utils");
|
|
29
25
|
|
|
30
|
-
var _variables = require("../common/variables
|
|
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";
|
|
@@ -6,7 +6,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
6
6
|
|
|
7
7
|
var _react2 = require("@testing-library/react");
|
|
8
8
|
|
|
9
|
-
var _AccordionGroup = _interopRequireDefault(require("./AccordionGroup"));
|
|
9
|
+
var _AccordionGroup = _interopRequireDefault(require("./AccordionGroup.tsx"));
|
|
10
10
|
|
|
11
11
|
describe("Accordion component tests", function () {
|
|
12
12
|
test("Uncontrolled accordion group calls correct function on click", function () {
|
|
@@ -0,0 +1,43 @@
|
|
|
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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _Accordion = _interopRequireDefault(require("../accordion/Accordion"));
|
|
17
|
+
|
|
18
|
+
var _AccordionGroup = require("./AccordionGroup");
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
var AccordionGroupAccordion = function AccordionGroupAccordion(_ref) {
|
|
25
|
+
var childProps = (0, _extends2["default"])({}, _ref);
|
|
26
|
+
|
|
27
|
+
var _useContext = (0, _react.useContext)(_AccordionGroup.AccordionGroupAccordionContext),
|
|
28
|
+
activeIndex = _useContext.activeIndex,
|
|
29
|
+
handlerActiveChange = _useContext.handlerActiveChange,
|
|
30
|
+
disabled = _useContext.disabled,
|
|
31
|
+
index = _useContext.index;
|
|
32
|
+
|
|
33
|
+
return /*#__PURE__*/_react["default"].createElement(_Accordion["default"], (0, _extends2["default"])({
|
|
34
|
+
isExpanded: activeIndex === index,
|
|
35
|
+
onChange: function onChange() {
|
|
36
|
+
handlerActiveChange(index);
|
|
37
|
+
},
|
|
38
|
+
disabled: disabled
|
|
39
|
+
}, childProps), childProps.children);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
var _default = AccordionGroupAccordion;
|
|
43
|
+
exports["default"] = _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
declare type Margin = {
|
|
4
4
|
top?: Space;
|
|
5
5
|
bottom?: Space;
|
|
6
6
|
left?: Space;
|
package/alert/Alert.js
CHANGED
|
@@ -17,9 +17,9 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
17
17
|
|
|
18
18
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
19
|
|
|
20
|
-
var _variables = require("../common/variables
|
|
20
|
+
var _variables = require("../common/variables");
|
|
21
21
|
|
|
22
|
-
var _utils = require("../common/utils
|
|
22
|
+
var _utils = require("../common/utils");
|
|
23
23
|
|
|
24
24
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
25
|
|
|
@@ -131,9 +131,7 @@ var DxcAlert = function DxcAlert(_ref) {
|
|
|
131
131
|
size: size
|
|
132
132
|
}, /*#__PURE__*/_react["default"].createElement(AlertInfo, null, /*#__PURE__*/_react["default"].createElement(AlertIcon, {
|
|
133
133
|
type: type
|
|
134
|
-
}, type === "info" && alertIcons.info || type === "confirm" && alertIcons.success || type === "warning" && alertIcons.warning || type === "error" && alertIcons.error), /*#__PURE__*/_react["default"].createElement(AlertText, null, /*#__PURE__*/_react["default"].createElement(AlertTitle, {
|
|
135
|
-
type: type
|
|
136
|
-
}, getTypeText()), inlineText && inlineText !== "" && "-", /*#__PURE__*/_react["default"].createElement(AlertInlineText, null, inlineText)), onClose && /*#__PURE__*/_react["default"].createElement(AlertCloseAction, {
|
|
134
|
+
}, type === "info" && alertIcons.info || type === "confirm" && alertIcons.success || type === "warning" && alertIcons.warning || type === "error" && alertIcons.error), /*#__PURE__*/_react["default"].createElement(AlertText, null, /*#__PURE__*/_react["default"].createElement(AlertTitle, null, getTypeText()), inlineText && inlineText !== "" && "-", /*#__PURE__*/_react["default"].createElement(AlertInlineText, null, inlineText)), onClose && /*#__PURE__*/_react["default"].createElement(AlertCloseAction, {
|
|
137
135
|
onClick: onClose,
|
|
138
136
|
tabIndex: tabIndex
|
|
139
137
|
}, alertIcons.close)), children && /*#__PURE__*/_react["default"].createElement(AlertContent, null, /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
|
|
@@ -279,12 +277,10 @@ var AlertContent = _styledComponents["default"].div(_templateObject9 || (_templa
|
|
|
279
277
|
return "".concat(props.theme.contentPaddingTop, " ").concat(props.theme.contentPaddingRight, " ").concat(props.theme.contentPaddingBottom, " ").concat(props.theme.contentPaddingLeft);
|
|
280
278
|
});
|
|
281
279
|
|
|
282
|
-
var AlertCloseAction = _styledComponents["default"].button(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n border: 1px solid transparent;\n border-radius: 2px;\n box-shadow: 0 0 0 2px transparent;\n padding: 3px;\n margin-left: 12px;\n background-color: transparent;\n color: #000000;\n cursor: pointer;\n\n &:hover {\n background-color: ", ";\n }\n &:focus
|
|
280
|
+
var AlertCloseAction = _styledComponents["default"].button(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n border: 1px solid transparent;\n border-radius: 2px;\n box-shadow: 0 0 0 2px transparent;\n padding: 3px;\n margin-left: 12px;\n background-color: transparent;\n color: #000000;\n cursor: pointer;\n\n &:hover {\n background-color: ", ";\n }\n &:focus,\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n &:active {\n background-color: ", ";\n }\n"])), function (props) {
|
|
283
281
|
return props.theme.hoverActionBackgroundColor;
|
|
284
282
|
}, function (props) {
|
|
285
283
|
return props.theme.focusActionBorderColor;
|
|
286
|
-
}, function (props) {
|
|
287
|
-
return props.theme.focusActionBorderColor;
|
|
288
284
|
}, function (props) {
|
|
289
285
|
return props.theme.activeActionBackgroundColor;
|
|
290
286
|
});
|
package/alert/Alert.stories.tsx
CHANGED
|
@@ -2,12 +2,21 @@ import React from "react";
|
|
|
2
2
|
import DxcAlert from "./Alert";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: "Alert",
|
|
8
9
|
component: DxcAlert,
|
|
9
10
|
};
|
|
10
11
|
|
|
12
|
+
const opinionatedTheme = {
|
|
13
|
+
alert: {
|
|
14
|
+
baseColor: "#e6f4ff",
|
|
15
|
+
accentColor: "#0067b3",
|
|
16
|
+
overlayColor: "#000000b3",
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
11
20
|
export const Chromatic = () => (
|
|
12
21
|
<>
|
|
13
22
|
<ExampleContainer>
|
|
@@ -155,6 +164,12 @@ export const Chromatic = () => (
|
|
|
155
164
|
</div>
|
|
156
165
|
</DxcAlert>
|
|
157
166
|
</ExampleContainer>
|
|
167
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
168
|
+
<ExampleContainer>
|
|
169
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
170
|
+
<DxcAlert inlineText="Info type alert with inline text." />
|
|
171
|
+
</HalstackProvider>
|
|
172
|
+
</ExampleContainer>
|
|
158
173
|
</>
|
|
159
174
|
);
|
|
160
175
|
|
|
@@ -168,3 +183,16 @@ export const ModalAlert = () => (
|
|
|
168
183
|
</DxcAlert>
|
|
169
184
|
</ExampleContainer>
|
|
170
185
|
);
|
|
186
|
+
|
|
187
|
+
export const ModalAlertOpinionated = () => (
|
|
188
|
+
<ExampleContainer>
|
|
189
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
190
|
+
<DxcAlert inlineText="Modal alert." mode="modal" onClose={() => {}}>
|
|
191
|
+
<div>
|
|
192
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
193
|
+
lobortis eget.
|
|
194
|
+
</div>
|
|
195
|
+
</DxcAlert>
|
|
196
|
+
</HalstackProvider>
|
|
197
|
+
</ExampleContainer>
|
|
198
|
+
);
|
package/alert/Alert.test.js
CHANGED
|
@@ -6,7 +6,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
6
6
|
|
|
7
7
|
var _react2 = require("@testing-library/react");
|
|
8
8
|
|
|
9
|
-
var _Alert = _interopRequireDefault(require("./Alert"));
|
|
9
|
+
var _Alert = _interopRequireDefault(require("./Alert.tsx"));
|
|
10
10
|
|
|
11
11
|
describe("Alert component tests", function () {
|
|
12
12
|
test("Info alert renders with correct text", function () {
|
package/bleed/Bleed.stories.tsx
CHANGED
package/box/Box.js
CHANGED
|
@@ -17,9 +17,9 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
17
17
|
|
|
18
18
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
19
|
|
|
20
|
-
var _variables = require("../common/variables
|
|
20
|
+
var _variables = require("../common/variables");
|
|
21
21
|
|
|
22
|
-
var _utils = require("../common/utils
|
|
22
|
+
var _utils = require("../common/utils");
|
|
23
23
|
|
|
24
24
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
25
|
|
|
@@ -71,7 +71,7 @@ var calculateWidth = function calculateWidth(margin, size, padding) {
|
|
|
71
71
|
return sizes[size];
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
var StyledDxcBox = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: ", ";\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n
|
|
74
|
+
var StyledDxcBox = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: ", ";\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n overflow: hidden;\n width: ", ";\n background-color: ", ";\n box-shadow: ", ";\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n"])), function (props) {
|
|
75
75
|
return props.display;
|
|
76
76
|
}, function (props) {
|
|
77
77
|
return props.theme.borderRadius;
|
|
@@ -81,8 +81,6 @@ var StyledDxcBox = _styledComponents["default"].div(_templateObject || (_templat
|
|
|
81
81
|
return props.theme.borderStyle;
|
|
82
82
|
}, function (props) {
|
|
83
83
|
return props.theme.borderColor;
|
|
84
|
-
}, function (props) {
|
|
85
|
-
return props.theme.letterSpacing;
|
|
86
84
|
}, function (props) {
|
|
87
85
|
return calculateWidth(props.margin, props.size, props.padding);
|
|
88
86
|
}, function (props) {
|
package/box/Box.stories.tsx
CHANGED
|
@@ -2,12 +2,19 @@ import React from "react";
|
|
|
2
2
|
import Title from "../../.storybook/components/Title";
|
|
3
3
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
4
4
|
import DxcBox from "./Box";
|
|
5
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: "Box ",
|
|
8
9
|
component: DxcBox,
|
|
9
10
|
};
|
|
10
11
|
|
|
12
|
+
const opinionatedTheme = {
|
|
13
|
+
box: {
|
|
14
|
+
baseColor: "#ffffff",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
11
18
|
export const Chromatic = () => (
|
|
12
19
|
<>
|
|
13
20
|
<Title title="Display flex" theme="light" level={2} />
|
|
@@ -128,5 +135,13 @@ export const Chromatic = () => (
|
|
|
128
135
|
<Title title="FitContent" theme="light" level={4} />
|
|
129
136
|
<DxcBox size="fitContent">Box</DxcBox>
|
|
130
137
|
</ExampleContainer>
|
|
138
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
139
|
+
<ExampleContainer>
|
|
140
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
141
|
+
<DxcBox display="flex" padding="medium">
|
|
142
|
+
Box
|
|
143
|
+
</DxcBox>
|
|
144
|
+
</HalstackProvider>
|
|
145
|
+
</ExampleContainer>
|
|
131
146
|
</>
|
|
132
147
|
);
|
package/box/Box.test.js
CHANGED
|
@@ -6,7 +6,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
6
6
|
|
|
7
7
|
var _react2 = require("@testing-library/react");
|
|
8
8
|
|
|
9
|
-
var _Card = _interopRequireDefault(require("../card/Card"));
|
|
9
|
+
var _Card = _interopRequireDefault(require("../card/Card.tsx"));
|
|
10
10
|
|
|
11
11
|
describe("Box component tests", function () {
|
|
12
12
|
test("Box renders with correct text", function () {
|
|
@@ -57,7 +57,9 @@ var DxcBulletedList = function DxcBulletedList(_ref2) {
|
|
|
57
57
|
backgroundType: backgroundType
|
|
58
58
|
})) : type === "icon" ? /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Icon, {
|
|
59
59
|
backgroundType: backgroundType
|
|
60
|
-
}, icon
|
|
60
|
+
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
61
|
+
src: icon
|
|
62
|
+
}) : icon)) : /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Disc, {
|
|
61
63
|
backgroundType: backgroundType
|
|
62
64
|
})), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
63
65
|
color: backgroundType && backgroundType === "dark" ? colorsTheme.bulletedList.fontColorOnDark : colorsTheme.bulletedList.fontColor
|
|
@@ -73,7 +75,7 @@ var Bullet = _styledComponents["default"].div(_templateObject2 || (_templateObje
|
|
|
73
75
|
|
|
74
76
|
var GeneralContent = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: grid;\n grid-template-columns: auto 1fr;\n align-items: center;\n"])));
|
|
75
77
|
|
|
76
|
-
var Icon = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n width: auto;\n margin-right: ", ";\n align-content: center;\n color: ", ";\n
|
|
78
|
+
var Icon = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n width: auto;\n margin-right: ", ";\n align-content: center;\n color: ", ";\n svg,\n img {\n height: ", ";\n width: ", ";\n }\n"])), function (props) {
|
|
77
79
|
return props.theme.bulletMarginRight;
|
|
78
80
|
}, function (props) {
|
|
79
81
|
return props.backgroundType && props.backgroundType === "dark" ? props.theme.fontColorOnDark : props.theme.fontColor;
|
|
@@ -20,12 +20,18 @@ const icon = (
|
|
|
20
20
|
export const Chromatic = () => (
|
|
21
21
|
<>
|
|
22
22
|
<ExampleContainer>
|
|
23
|
-
<Title title="Icon list" level={4} />
|
|
23
|
+
<Title title="Icon list (SVG)" level={4} />
|
|
24
24
|
<DxcBulletedList type="icon" icon={icon}>
|
|
25
25
|
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
26
26
|
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
27
27
|
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
28
28
|
</DxcBulletedList>
|
|
29
|
+
<Title title="Icon list (path)" level={4} />
|
|
30
|
+
<DxcBulletedList type="icon" icon="https://upload.wikimedia.org/wikipedia/commons/e/e0/Check_green_icon.svg">
|
|
31
|
+
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
32
|
+
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
33
|
+
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
34
|
+
</DxcBulletedList>
|
|
29
35
|
<Title title="Number list" level={4} />
|
|
30
36
|
<DxcBulletedList type="number">
|
|
31
37
|
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|