@dxc-technology/halstack-react 0.0.0-7550efd → 0.0.0-75be8bf
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 +1332 -5
- package/HalstackContext.js +117 -77
- package/README.md +47 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +110 -114
- package/accordion/Accordion.stories.tsx +104 -114
- package/accordion/Accordion.test.js +10 -11
- package/accordion/types.d.ts +0 -11
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +24 -65
- package/accordion-group/AccordionGroup.stories.tsx +93 -66
- package/accordion-group/AccordionGroup.test.js +27 -62
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +43 -0
- package/accordion-group/types.d.ts +6 -11
- package/alert/Alert.js +5 -9
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +1 -1
- package/bleed/Bleed.stories.tsx +1 -0
- package/box/Box.d.ts +1 -1
- package/box/Box.js +8 -27
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.js +1 -1
- package/box/types.d.ts +0 -11
- 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 +48 -60
- package/button/Button.stories.tsx +151 -9
- package/button/Button.test.js +12 -1
- package/button/types.d.ts +7 -3
- package/card/Card.d.ts +1 -1
- package/card/Card.js +27 -45
- package/card/Card.stories.tsx +12 -42
- package/card/Card.test.js +1 -1
- package/card/types.d.ts +1 -6
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +94 -101
- package/checkbox/Checkbox.stories.tsx +131 -59
- package/checkbox/Checkbox.test.js +94 -17
- package/checkbox/types.d.ts +4 -0
- 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 +1485 -0
- package/common/variables.js +992 -1136
- 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.d.ts +1 -1
- package/dialog/Dialog.js +54 -85
- package/dialog/Dialog.stories.tsx +154 -170
- package/dialog/Dialog.test.js +302 -3
- package/dialog/types.d.ts +0 -12
- package/dropdown/Dropdown.js +43 -42
- package/dropdown/Dropdown.stories.tsx +210 -84
- package/dropdown/Dropdown.test.js +22 -27
- package/dropdown/DropdownMenu.js +12 -18
- package/dropdown/DropdownMenuItem.js +5 -18
- package/dropdown/types.d.ts +3 -3
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +174 -220
- package/file-input/FileInput.stories.tsx +122 -11
- package/file-input/FileInput.test.js +14 -14
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +39 -63
- package/file-input/types.d.ts +18 -1
- package/flex/Flex.d.ts +1 -1
- package/flex/Flex.js +33 -19
- package/flex/Flex.stories.tsx +35 -26
- package/flex/types.d.ts +83 -7
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +44 -64
- package/footer/Footer.stories.tsx +37 -16
- package/footer/Footer.test.js +16 -26
- package/footer/types.d.ts +10 -11
- 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 +4 -3
- package/header/Header.js +20 -49
- package/header/Header.stories.tsx +118 -39
- package/header/Header.test.js +2 -2
- package/header/types.d.ts +1 -14
- package/heading/Heading.js +1 -1
- package/heading/Heading.test.js +1 -1
- package/image/Image.d.ts +4 -0
- package/image/Image.js +81 -0
- package/image/Image.stories.tsx +127 -0
- package/image/types.d.ts +72 -0
- package/inset/Inset.stories.tsx +2 -1
- package/layout/ApplicationLayout.d.ts +5 -5
- package/layout/ApplicationLayout.js +8 -5
- 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 +4 -2
- package/main.js +17 -1
- package/{tabs-nav → nav-tabs}/NavTabs.d.ts +2 -2
- package/{tabs-nav → nav-tabs}/NavTabs.js +8 -11
- package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +110 -6
- package/{tabs-nav → nav-tabs}/NavTabs.test.js +1 -1
- package/{tabs-nav → nav-tabs}/Tab.js +49 -33
- package/{tabs-nav → nav-tabs}/types.d.ts +8 -9
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.d.ts +7 -0
- package/number-input/NumberInput.js +6 -4
- package/number-input/NumberInput.test.js +317 -98
- package/package.json +14 -19
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +8 -16
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +58 -48
- package/paragraph/Paragraph.d.ts +3 -4
- package/paragraph/Paragraph.js +5 -5
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +39 -0
- package/password-input/PasswordInput.js +35 -82
- package/password-input/PasswordInput.stories.tsx +1 -0
- package/password-input/PasswordInput.test.js +34 -40
- 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.js +11 -12
- package/quick-nav/QuickNav.stories.tsx +111 -19
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +46 -31
- package/radio-group/RadioGroup.js +23 -23
- package/radio-group/RadioGroup.stories.tsx +132 -18
- package/radio-group/RadioGroup.test.js +124 -97
- package/radio-group/types.d.ts +2 -2
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.js +49 -108
- 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 -35
- package/select/Option.js +11 -24
- package/select/Select.js +59 -36
- package/select/Select.stories.tsx +494 -150
- package/select/Select.test.js +341 -288
- 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 +24 -15
- 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 +96 -85
- package/switch/Switch.stories.tsx +33 -0
- package/switch/Switch.test.js +27 -14
- package/switch/types.d.ts +8 -3
- package/table/Table.js +3 -3
- 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 +8 -10
- package/tag/Tag.stories.tsx +14 -1
- package/tag/Tag.test.js +1 -1
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.js +40 -11
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.js +225 -329
- package/text-input/TextInput.stories.tsx +280 -184
- package/text-input/TextInput.test.js +736 -725
- package/text-input/types.d.ts +21 -2
- 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 +85 -59
- package/toggle-group/ToggleGroup.stories.tsx +45 -0
- package/toggle-group/ToggleGroup.test.js +38 -24
- package/toggle-group/types.d.ts +22 -13
- package/typography/Typography.d.ts +2 -2
- package/typography/Typography.js +14 -113
- package/typography/Typography.stories.tsx +1 -1
- package/useTheme.d.ts +1237 -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/card/ice-cream.jpg +0 -0
- package/common/RequiredComponent.js +0 -32
- package/number-input/NumberInputContext.d.ts +0 -4
- package/number-input/NumberInputContext.js +0 -19
- package/number-input/numberInputContextTypes.d.ts +0 -19
- /package/{tabs-nav → grid}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → image/types.js} +0 -0
- /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcImage from "./Image";
|
|
3
|
+
import Title from "../../.storybook/components/Title";
|
|
4
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
import { DxcFlex, DxcInset, DxcParagraph } from "../main";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Image",
|
|
9
|
+
component: DxcImage,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Chromatic = () => (
|
|
13
|
+
<>
|
|
14
|
+
<Title title="Image component" theme="light" level={2} />
|
|
15
|
+
<ExampleContainer>
|
|
16
|
+
<Title title="Simple image" theme="light" level={4} />
|
|
17
|
+
<DxcImage
|
|
18
|
+
alt="Example image"
|
|
19
|
+
width="100%"
|
|
20
|
+
src="https://images.ctfassets.net/hrltx12pl8hq/5596z2BCR9KmT1KeRBrOQa/4070fd4e2f1a13f71c2c46afeb18e41c/shutterstock_451077043-hero1.jpg"
|
|
21
|
+
/>
|
|
22
|
+
</ExampleContainer>
|
|
23
|
+
<ExampleContainer>
|
|
24
|
+
<Title title="Image with text" theme="light" level={4} />
|
|
25
|
+
<DxcParagraph>
|
|
26
|
+
Lorem ipsum dolor sit amet consectetur. Tincidunt sed pharetra mollis duis volutpat urna. Hendrerit aliquet et
|
|
27
|
+
arcu purus. Sodales elementum sollicitudin consequat elementum tortor. Lectus eget cursus ut ac pharetra
|
|
28
|
+
lobortis integer eu. Potenti amet ac id risus ac nunc orci nibh. Tempus vitae vitae aenean arcu. Nibh tristique
|
|
29
|
+
porta dui enim eget tristique rutrum. Quisque faucibus suscipit nibh est sed. Netus venenatis congue diam in dui
|
|
30
|
+
morbi dignissim lorem. Urna aliquet sem in tincidunt. Nunc arcu nec fringilla enim purus ut justo nisi. Vel mus
|
|
31
|
+
ut ornare faucibus blandit diam sit vestibulum massa. Semper nullam sit sagittis hendrerit augue. In fermentum
|
|
32
|
+
metus proin arcu faucibus proin nibh sit. Vel integer sed enim in sed vel nec ut vitae. Commodo sagittis
|
|
33
|
+
volutpat id lorem.
|
|
34
|
+
</DxcParagraph>
|
|
35
|
+
<DxcInset top="2rem" bottom="2rem">
|
|
36
|
+
<DxcImage
|
|
37
|
+
alt="Ratatouille is a great movie"
|
|
38
|
+
caption="Ratatouille with a smile on his face."
|
|
39
|
+
src="https://hips.hearstapps.com/es.h-cdn.co/fotoes/images/cinefilia/por-que-ratatouille-nos-sigue-enamorando-10-anos-despues/136444706-1-esl-ES/Por-que-Ratatouille-nos-sigue-enamorando-10-anos-despues.jpg"
|
|
40
|
+
/>
|
|
41
|
+
</DxcInset>
|
|
42
|
+
<DxcParagraph>
|
|
43
|
+
Lorem ipsum dolor sit amet consectetur. Tincidunt sed pharetra mollis duis volutpat urna. Hendrerit aliquet et
|
|
44
|
+
arcu purus. Sodales elementum sollicitudin consequat elementum tortor. Lectus eget cursus ut ac pharetra
|
|
45
|
+
lobortis integer eu. Potenti amet ac id risus ac nunc orci nibh. Tempus vitae vitae aenean arcu. Nibh tristique
|
|
46
|
+
porta dui enim eget tristique rutrum. Quisque faucibus suscipit nibh est sed. Netus venenatis congue diam in dui
|
|
47
|
+
morbi dignissim lorem. Urna aliquet sem in tincidunt. Nunc arcu nec fringilla enim purus ut justo nisi. Vel mus
|
|
48
|
+
ut ornare faucibus blandit diam sit vestibulum massa. Semper nullam sit sagittis hendrerit augue. In fermentum
|
|
49
|
+
metus proin arcu faucibus proin nibh sit. Vel integer sed enim in sed vel nec ut vitae. Commodo sagittis
|
|
50
|
+
volutpat id lorem.
|
|
51
|
+
</DxcParagraph>
|
|
52
|
+
</ExampleContainer>
|
|
53
|
+
<ExampleContainer>
|
|
54
|
+
<Title title="Example image" theme="light" level={4} />
|
|
55
|
+
<DxcFlex gap="1rem">
|
|
56
|
+
<DxcImage
|
|
57
|
+
alt="Camera pic"
|
|
58
|
+
caption="Picture of a camera and the sunset."
|
|
59
|
+
width="500px"
|
|
60
|
+
src="https://assets.entrepreneur.com/content/3x2/2000/20191009140007-GettyImages-1053962188.jpeg"
|
|
61
|
+
/>
|
|
62
|
+
<DxcParagraph>
|
|
63
|
+
Lorem ipsum dolor sit amet consectetur. Tincidunt sed pharetra mollis duis volutpat urna. Hendrerit aliquet et
|
|
64
|
+
arcu purus. Sodales elementum sollicitudin consequat elementum tortor. Lectus eget cursus ut ac pharetra
|
|
65
|
+
lobortis integer eu. Potenti amet ac id risus ac nunc orci nibh. Tempus vitae vitae aenean arcu. Nibh
|
|
66
|
+
tristique porta dui enim eget tristique rutrum. Quisque faucibus suscipit nibh est sed. Netus venenatis congue
|
|
67
|
+
diam in dui morbi dignissim lorem. Urna aliquet sem in tincidunt. Nunc arcu nec fringilla enim purus ut justo
|
|
68
|
+
nisi. Vel mus ut ornare faucibus blandit diam sit vestibulum massa. Semper nullam sit sagittis hendrerit
|
|
69
|
+
augue. In fermentum metus proin arcu faucibus proin nibh sit. Vel integer sed enim in sed vel nec ut vitae.
|
|
70
|
+
Commodo sagittis volutpat id lorem. Lorem ipsum dolor sit amet consectetur. Tincidunt sed pharetra mollis duis
|
|
71
|
+
volutpat urna. Hendrerit aliquet et arcu purus. Sodales elementum sollicitudin consequat elementum tortor.
|
|
72
|
+
Lectus eget cursus ut ac pharetra lobortis integer eu. Potenti amet ac id risus ac nunc orci nibh. Tempus
|
|
73
|
+
vitae vitae aenean arcu. Nibh tristique porta dui enim eget tristique rutrum. Quisque faucibus suscipit nibh
|
|
74
|
+
est sed. Netus venenatis congue diam in dui morbi dignissim lorem. Urna aliquet sem in tincidunt. Nunc arcu
|
|
75
|
+
nec fringilla enim purus ut justo nisi. Vel mus ut ornare faucibus blandit diam sit vestibulum massa. Semper
|
|
76
|
+
nullam sit sagittis hendrerit augue. In fermentum metus proin arcu faucibus proin nibh sit. Vel integer sed
|
|
77
|
+
enim in sed vel nec ut vitae. Commodo sagittis volutpat id lorem.
|
|
78
|
+
</DxcParagraph>
|
|
79
|
+
</DxcFlex>
|
|
80
|
+
</ExampleContainer>
|
|
81
|
+
<ExampleContainer>
|
|
82
|
+
<Title title="Object position" theme="light" level={4} />
|
|
83
|
+
<DxcImage
|
|
84
|
+
alt="Moon pic"
|
|
85
|
+
caption="Picture of the moon."
|
|
86
|
+
width="250px"
|
|
87
|
+
src="https://interactive-examples.mdn.mozilla.net/media/examples/moon.jpg"
|
|
88
|
+
objectPosition="right top"
|
|
89
|
+
objectFit="none"
|
|
90
|
+
/>
|
|
91
|
+
</ExampleContainer>
|
|
92
|
+
<ExampleContainer>
|
|
93
|
+
<Title title="Object fit: contain" theme="light" level={4} />
|
|
94
|
+
<div style={{ display: "flex", width: "fit-content", border: "1px solid #000", padding: "0.5rem" }}>
|
|
95
|
+
<DxcImage
|
|
96
|
+
alt="Dog pic"
|
|
97
|
+
src="https://cc-prod.scene7.com/is/image/CCProdAuthor/What-is-Stock-Photography_P1_mobile?$pjpeg$&jpegSize=200&wid=720"
|
|
98
|
+
width="200px"
|
|
99
|
+
height="200px"
|
|
100
|
+
objectFit="contain"
|
|
101
|
+
caption="Pretty dog."
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
</ExampleContainer>
|
|
105
|
+
<ExampleContainer>
|
|
106
|
+
<Title title="Object fit: cover" theme="light" level={4} />
|
|
107
|
+
<div style={{ width: "75%", height: "300px" }}>
|
|
108
|
+
<DxcImage
|
|
109
|
+
alt="Spaceship pic"
|
|
110
|
+
src="https://media.istockphoto.com/id/1344443930/es/foto/lanzamiento-de-cohetes-del-transbordador-espacial-en-el-cielo-y-nubes-al-espacio-exterior.jpg?s=612x612&w=0&k=20&c=CO2A96GnnWvJsgZuj9WfYCVIBVzicnQDfnzwD1nomN0="
|
|
111
|
+
objectFit="cover"
|
|
112
|
+
width="50%"
|
|
113
|
+
height="100%"
|
|
114
|
+
objectPosition="0px 0px"
|
|
115
|
+
/>
|
|
116
|
+
<DxcImage
|
|
117
|
+
alt="Spaceship pic"
|
|
118
|
+
src="https://media.istockphoto.com/id/1344443930/es/foto/lanzamiento-de-cohetes-del-transbordador-espacial-en-el-cielo-y-nubes-al-espacio-exterior.jpg?s=612x612&w=0&k=20&c=CO2A96GnnWvJsgZuj9WfYCVIBVzicnQDfnzwD1nomN0="
|
|
119
|
+
objectFit="cover"
|
|
120
|
+
width="50%"
|
|
121
|
+
height="100%"
|
|
122
|
+
objectPosition="0px 0px"
|
|
123
|
+
/>
|
|
124
|
+
</div>
|
|
125
|
+
</ExampleContainer>
|
|
126
|
+
</>
|
|
127
|
+
);
|
package/image/types.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Props = {
|
|
3
|
+
/**
|
|
4
|
+
* Alternative text description displayed when the specified image is not loaded.
|
|
5
|
+
*
|
|
6
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt
|
|
7
|
+
* See W3C alt decision tree: https://www.w3.org/WAI/tutorials/images/decision-tree/
|
|
8
|
+
*/
|
|
9
|
+
alt: string;
|
|
10
|
+
/**
|
|
11
|
+
* Image legend with a descriptive purpose. It is placed below the image and is complementary to the alt attribute,
|
|
12
|
+
* which is required regardless of the presence of the caption or not.
|
|
13
|
+
*/
|
|
14
|
+
caption?: string;
|
|
15
|
+
/**
|
|
16
|
+
* If true, the image will be loaded only when it is visible on the screen (lazy loading).
|
|
17
|
+
* Otherwise and by default, the image will be loaded as soon as the component is mounted (eager loading).
|
|
18
|
+
*/
|
|
19
|
+
lazyLoading?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* URL of the image. This prop is required and must be valid.
|
|
22
|
+
*/
|
|
23
|
+
src: string;
|
|
24
|
+
/**
|
|
25
|
+
* List of one or more strings separated by commas indicating a set of possible images for the user agent to use.
|
|
26
|
+
*
|
|
27
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset
|
|
28
|
+
*/
|
|
29
|
+
srcSet?: string;
|
|
30
|
+
/**
|
|
31
|
+
* One or more strings separated by commas, indicating a set of source sizes.
|
|
32
|
+
* If the srcSet attribute is absent or contains no values with a width descriptor,
|
|
33
|
+
* then this attribute has no effect.
|
|
34
|
+
*
|
|
35
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/sizes
|
|
36
|
+
*/
|
|
37
|
+
sizes?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Sets the rendered width of the image.
|
|
40
|
+
*/
|
|
41
|
+
width?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Sets the rendered height of the image.
|
|
44
|
+
*/
|
|
45
|
+
height?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Sets the object-fit CSS property.
|
|
48
|
+
*
|
|
49
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
|
|
50
|
+
*/
|
|
51
|
+
objectFit?: "contain" | "cover" | "fill" | "none" | "scale-down";
|
|
52
|
+
/**
|
|
53
|
+
* Sets the object-position CSS property.
|
|
54
|
+
*
|
|
55
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/object-position
|
|
56
|
+
*/
|
|
57
|
+
objectPosition?: string;
|
|
58
|
+
/**
|
|
59
|
+
* This function will be called when the image is loaded.
|
|
60
|
+
*/
|
|
61
|
+
onLoad?: React.ReactEventHandler<HTMLImageElement>;
|
|
62
|
+
/**
|
|
63
|
+
* This function will be called when the image fails to load.
|
|
64
|
+
*/
|
|
65
|
+
onError?: React.ReactEventHandler<HTMLImageElement>;
|
|
66
|
+
};
|
|
67
|
+
export declare type CaptionWrapperProps = {
|
|
68
|
+
condition: boolean;
|
|
69
|
+
wrapper: (children: React.ReactNode) => JSX.Element;
|
|
70
|
+
children: React.ReactNode;
|
|
71
|
+
};
|
|
72
|
+
export default Props;
|
package/inset/Inset.stories.tsx
CHANGED
|
@@ -205,7 +205,7 @@ export const Chromatic = () => (
|
|
|
205
205
|
</Container>
|
|
206
206
|
<Title title="Inside a flex column" level={4} />
|
|
207
207
|
<Container>
|
|
208
|
-
<DxcFlex direction="column" gap="
|
|
208
|
+
<DxcFlex direction="column" gap="1rem">
|
|
209
209
|
<Placeholder></Placeholder>
|
|
210
210
|
<DxcInset top="0.25rem" right="1.5rem" bottom="2rem" left="4rem">
|
|
211
211
|
<Placeholder></Placeholder>
|
|
@@ -225,5 +225,6 @@ const Placeholder = styled.div`
|
|
|
225
225
|
min-height: 40px;
|
|
226
226
|
min-width: 120px;
|
|
227
227
|
border: 1px solid #a46ede;
|
|
228
|
+
border-radius: 0.5rem;
|
|
228
229
|
background-color: #e5d5f6;
|
|
229
230
|
`;
|
|
@@ -3,15 +3,15 @@ import AppLayoutPropsType, { AppLayoutMainPropsType } from "./types";
|
|
|
3
3
|
declare const DxcApplicationLayout: {
|
|
4
4
|
({ visibilityToggleLabel, header, sidenav, footer, children, }: AppLayoutPropsType): JSX.Element;
|
|
5
5
|
Header: {
|
|
6
|
-
({ underlined, content, responsiveContent, onClick, margin,
|
|
7
|
-
Dropdown: (props:
|
|
6
|
+
({ underlined, content, responsiveContent, onClick, margin, tabIndex, }: import("../header/types").default): JSX.Element;
|
|
7
|
+
Dropdown: (props: import("../dropdown/types").default) => JSX.Element;
|
|
8
8
|
};
|
|
9
9
|
Main: ({ children }: AppLayoutMainPropsType) => JSX.Element;
|
|
10
|
-
Footer: ({ socialLinks, bottomLinks, copyright, children,
|
|
10
|
+
Footer: ({ socialLinks, bottomLinks, copyright, children, margin, tabIndex, }: import("../footer/types").default) => JSX.Element;
|
|
11
11
|
SideNav: {
|
|
12
|
-
({
|
|
12
|
+
({ title, children }: import("../sidenav/types").default): JSX.Element;
|
|
13
13
|
Section: ({ children }: import("../sidenav/types").SidenavSectionPropsType) => JSX.Element;
|
|
14
|
-
Group: ({
|
|
14
|
+
Group: ({ title, collapsable, icon, children }: import("../sidenav/types").SidenavGroupPropsType) => JSX.Element;
|
|
15
15
|
Link: React.ForwardRefExoticComponent<import("../sidenav/types").SidenavLinkPropsType & React.RefAttributes<HTMLAnchorElement>>;
|
|
16
16
|
Title: ({ children }: import("../sidenav/types").SidenavTitlePropsType) => JSX.Element;
|
|
17
17
|
};
|
|
@@ -23,7 +23,7 @@ var _Sidenav = _interopRequireDefault(require("../sidenav/Sidenav"));
|
|
|
23
23
|
|
|
24
24
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
25
25
|
|
|
26
|
-
var _variables = require("../common/variables
|
|
26
|
+
var _variables = require("../common/variables");
|
|
27
27
|
|
|
28
28
|
var _Icons = require("./Icons");
|
|
29
29
|
|
|
@@ -65,13 +65,16 @@ var defaultFooter = function defaultFooter() {
|
|
|
65
65
|
}],
|
|
66
66
|
socialLinks: [{
|
|
67
67
|
href: "https://www.linkedin.com/company/dxctechnology",
|
|
68
|
-
logo: _Icons.linkedinLogo
|
|
68
|
+
logo: _Icons.linkedinLogo,
|
|
69
|
+
title: "Linkedin"
|
|
69
70
|
}, {
|
|
70
71
|
href: "https://twitter.com/dxctechnology",
|
|
71
|
-
logo: _Icons.twitterLogo
|
|
72
|
+
logo: _Icons.twitterLogo,
|
|
73
|
+
title: "Twitter"
|
|
72
74
|
}, {
|
|
73
75
|
href: "https://www.facebook.com/DXCTechnology/",
|
|
74
|
-
logo: _Icons.facebookLogo
|
|
76
|
+
logo: _Icons.facebookLogo,
|
|
77
|
+
title: "Facebook"
|
|
75
78
|
}]
|
|
76
79
|
});
|
|
77
80
|
};
|
|
@@ -160,7 +163,7 @@ var SidenavContainer = _styledComponents["default"].div(_templateObject6 || (_te
|
|
|
160
163
|
|
|
161
164
|
var MainContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n width: 100%;\n"])));
|
|
162
165
|
|
|
163
|
-
var MainContentContainer = _styledComponents["default"].
|
|
166
|
+
var MainContentContainer = _styledComponents["default"].main(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n flex: 1;\n background-color: #fff;\n"])));
|
|
164
167
|
|
|
165
168
|
DxcApplicationLayout.Header = _Header["default"];
|
|
166
169
|
DxcApplicationLayout.Main = Main;
|
package/layout/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare type ChildrenType = AppLayoutMainPropsType | AppLayoutSidenavPropsType;
|
|
3
2
|
export declare type AppLayoutMainPropsType = {
|
|
4
3
|
/**
|
|
5
4
|
* Everything between the tags will be displayed as the content of the main part of the application.
|
|
@@ -35,8 +34,8 @@ declare type AppLayoutPropsType = {
|
|
|
35
34
|
*/
|
|
36
35
|
footer?: React.ReactNode;
|
|
37
36
|
/**
|
|
38
|
-
*
|
|
37
|
+
* Use the DxcApplicationLayout.Main provided to render main content.
|
|
39
38
|
*/
|
|
40
|
-
children: React.ReactElement<
|
|
39
|
+
children: React.ReactElement<AppLayoutMainPropsType>;
|
|
41
40
|
};
|
|
42
41
|
export default AppLayoutPropsType;
|
package/link/Link.js
CHANGED
|
@@ -21,7 +21,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
21
21
|
|
|
22
22
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
23
23
|
|
|
24
|
-
var _variables = require("../common/variables
|
|
24
|
+
var _variables = require("../common/variables");
|
|
25
25
|
|
|
26
26
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
27
27
|
|
|
@@ -68,7 +68,7 @@ var DxcLink = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
68
68
|
}, /*#__PURE__*/_react["default"].createElement(StyledLink, (0, _extends2["default"])({
|
|
69
69
|
as: href ? "a" : "button",
|
|
70
70
|
tabIndex: tabIndex,
|
|
71
|
-
onClick: !disabled
|
|
71
|
+
onClick: !disabled ? onClick : undefined,
|
|
72
72
|
href: !disabled && href ? href : undefined,
|
|
73
73
|
target: href ? newWindow ? "_blank" : "_self" : undefined,
|
|
74
74
|
disabled: disabled,
|
|
@@ -82,7 +82,7 @@ var DxcLink = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
82
82
|
})));
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
var StyledLink = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: baseline;\n
|
|
85
|
+
var StyledLink = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: baseline;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n font-size: ", ";\n font-weight: ", ";\n font-style: ", ";\n font-family: ", ";\n text-decoration-color: transparent;\n width: fit-content;\n ", "\n ", "\n color: ", ";\n ", "\n &:visited {\n color: ", ";\n &:hover {\n ", "\n }\n }\n &:hover {\n ", "\n }\n &:focus {\n border-radius: 2px;\n outline: 2px solid ", ";\n ", "\n }\n &:active {\n ", "\n }\n"])), function (props) {
|
|
86
86
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
87
87
|
}, function (props) {
|
|
88
88
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
@@ -105,7 +105,7 @@ var StyledLink = _styledComponents["default"].div(_templateObject || (_templateO
|
|
|
105
105
|
}, function (props) {
|
|
106
106
|
return props.disabled && "cursor: default;";
|
|
107
107
|
}, function (props) {
|
|
108
|
-
return props.inheritColor ? "inherit" : !props.disabled ? props.theme.fontColor : props.theme.
|
|
108
|
+
return props.inheritColor ? "inherit" : !props.disabled ? props.theme.fontColor : props.theme.disabledFontColor;
|
|
109
109
|
}, function (props) {
|
|
110
110
|
return props.disabled ? "pointer-events: none;" : "";
|
|
111
111
|
}, function (props) {
|
package/link/Link.stories.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import DxcLink from "./Link";
|
|
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: "Link",
|
|
@@ -19,6 +20,12 @@ const icon = (
|
|
|
19
20
|
</svg>
|
|
20
21
|
);
|
|
21
22
|
|
|
23
|
+
const opinionatedTheme = {
|
|
24
|
+
link: {
|
|
25
|
+
baseColor: "#5f249f",
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
22
29
|
export const Chromatic = () => (
|
|
23
30
|
<>
|
|
24
31
|
<Title title="With anchor" theme="light" level={2} />
|
|
@@ -189,5 +196,58 @@ export const Chromatic = () => (
|
|
|
189
196
|
Test
|
|
190
197
|
</DxcLink>
|
|
191
198
|
</ExampleContainer>
|
|
199
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
200
|
+
<ExampleContainer>
|
|
201
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
202
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
203
|
+
<DxcLink disabled>Test</DxcLink>
|
|
204
|
+
</HalstackProvider>
|
|
205
|
+
</ExampleContainer>
|
|
206
|
+
<ExampleContainer>
|
|
207
|
+
<Title title="Icon before" theme="light" level={4} />
|
|
208
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
209
|
+
<DxcLink href="https://www.google.com" icon={icon} iconPosition="before">
|
|
210
|
+
Test
|
|
211
|
+
</DxcLink>
|
|
212
|
+
</HalstackProvider>
|
|
213
|
+
</ExampleContainer>
|
|
214
|
+
<ExampleContainer>
|
|
215
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
216
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
217
|
+
<DxcLink disabled>Test</DxcLink>
|
|
218
|
+
</HalstackProvider>
|
|
219
|
+
</ExampleContainer>
|
|
220
|
+
<ExampleContainer>
|
|
221
|
+
<Title title="Icon after" theme="light" level={4} />{" "}
|
|
222
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
223
|
+
<DxcLink onClick={() => {}} icon={icon} iconPosition="after">
|
|
224
|
+
Test
|
|
225
|
+
</DxcLink>
|
|
226
|
+
</HalstackProvider>
|
|
227
|
+
</ExampleContainer>
|
|
228
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
229
|
+
<Title title="With link hovered" theme="light" level={4} />
|
|
230
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
231
|
+
<DxcLink onClick={() => {}}>Test</DxcLink>
|
|
232
|
+
</HalstackProvider>
|
|
233
|
+
</ExampleContainer>
|
|
234
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
235
|
+
<Title title="With link focused" theme="light" level={4} />
|
|
236
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
237
|
+
<DxcLink onClick={() => {}}>Test</DxcLink>
|
|
238
|
+
</HalstackProvider>
|
|
239
|
+
</ExampleContainer>
|
|
240
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
241
|
+
<Title title="With link active" theme="light" level={4} />
|
|
242
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
243
|
+
<DxcLink onClick={() => {}}>Test</DxcLink>
|
|
244
|
+
</HalstackProvider>
|
|
245
|
+
</ExampleContainer>
|
|
246
|
+
<ExampleContainer pseudoState="pseudo-visited">
|
|
247
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
248
|
+
<Title title="With link visited" theme="light" level={4} />
|
|
249
|
+
<DxcLink href="https://www.google.com">Test</DxcLink>
|
|
250
|
+
</HalstackProvider>
|
|
251
|
+
</ExampleContainer>
|
|
192
252
|
</>
|
|
193
253
|
);
|
package/link/Link.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 _Link = _interopRequireDefault(require("./Link"));
|
|
9
|
+
var _Link = _interopRequireDefault(require("./Link.tsx"));
|
|
10
10
|
|
|
11
11
|
describe("Link component tests", function () {
|
|
12
12
|
test("Link renders with correct text", function () {
|
|
@@ -33,9 +33,7 @@ describe("Link component tests", function () {
|
|
|
33
33
|
expect(getByText("Link").hasAttribute("href")).toBeFalsy();
|
|
34
34
|
|
|
35
35
|
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
36
|
-
onClick: function onClick() {
|
|
37
|
-
return console.log("Andorra");
|
|
38
|
-
},
|
|
36
|
+
onClick: function onClick() {},
|
|
39
37
|
disabled: true
|
|
40
38
|
}, "LinkButton")),
|
|
41
39
|
getByTextLinkButton = _render4.getByText;
|
package/link/types.d.ts
CHANGED
|
@@ -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/main.d.ts
CHANGED
|
@@ -34,11 +34,13 @@ import DxcRadioGroup from "./radio-group/RadioGroup";
|
|
|
34
34
|
import DxcBleed from "./bleed/Bleed";
|
|
35
35
|
import DxcInset from "./inset/Inset";
|
|
36
36
|
import DxcQuickNav from "./quick-nav/QuickNav";
|
|
37
|
-
import DxcNavTabs from "./tabs
|
|
37
|
+
import DxcNavTabs from "./nav-tabs/NavTabs";
|
|
38
38
|
import DxcFlex from "./flex/Flex";
|
|
39
39
|
import DxcTypography from "./typography/Typography";
|
|
40
40
|
import DxcParagraph from "./paragraph/Paragraph";
|
|
41
41
|
import DxcBulletedList from "./bulleted-list/BulletedList";
|
|
42
|
+
import DxcGrid from "./grid/Grid";
|
|
43
|
+
import DxcImage from "./image/Image";
|
|
42
44
|
import HalstackContext, { HalstackProvider, HalstackLanguageContext } from "./HalstackContext";
|
|
43
45
|
import { BackgroundColorProvider } from "./BackgroundColorContext";
|
|
44
|
-
export { DxcAlert, DxcButton, DxcCheckbox, DxcTextInput, DxcDropdown, DxcSwitch, DxcSlider, DxcTable, DxcTabs, DxcToggleGroup, DxcDialog, DxcCard, DxcProgressBar, DxcAccordion, DxcSpinner, DxcBox, DxcTag, DxcPaginator, DxcWizard, DxcLink, DxcHeading, DxcResultsetTable, DxcChip, DxcApplicationLayout, HalstackContext, HalstackLanguageContext, HalstackProvider, BackgroundColorProvider, DxcAccordionGroup, DxcBadge, DxcPasswordInput, DxcDateInput, DxcNumberInput, DxcTextarea, DxcSelect, DxcFileInput, DxcRadioGroup, DxcBleed, DxcInset, DxcQuickNav, DxcNavTabs, DxcFlex, DxcTypography, DxcParagraph, DxcBulletedList, };
|
|
46
|
+
export { DxcAlert, DxcButton, DxcCheckbox, DxcTextInput, DxcDropdown, DxcSwitch, DxcSlider, DxcTable, DxcTabs, DxcToggleGroup, DxcDialog, DxcCard, DxcProgressBar, DxcAccordion, DxcSpinner, DxcBox, DxcTag, DxcPaginator, DxcWizard, DxcLink, DxcHeading, DxcResultsetTable, DxcChip, DxcApplicationLayout, HalstackContext, HalstackLanguageContext, HalstackProvider, BackgroundColorProvider, DxcAccordionGroup, DxcBadge, DxcPasswordInput, DxcDateInput, DxcNumberInput, DxcTextarea, DxcSelect, DxcFileInput, DxcRadioGroup, DxcBleed, DxcInset, DxcQuickNav, DxcNavTabs, DxcFlex, DxcTypography, DxcParagraph, DxcBulletedList, DxcGrid, DxcImage, };
|
package/main.js
CHANGED
|
@@ -115,12 +115,24 @@ Object.defineProperty(exports, "DxcFlex", {
|
|
|
115
115
|
return _Flex["default"];
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
|
+
Object.defineProperty(exports, "DxcGrid", {
|
|
119
|
+
enumerable: true,
|
|
120
|
+
get: function get() {
|
|
121
|
+
return _Grid["default"];
|
|
122
|
+
}
|
|
123
|
+
});
|
|
118
124
|
Object.defineProperty(exports, "DxcHeading", {
|
|
119
125
|
enumerable: true,
|
|
120
126
|
get: function get() {
|
|
121
127
|
return _Heading["default"];
|
|
122
128
|
}
|
|
123
129
|
});
|
|
130
|
+
Object.defineProperty(exports, "DxcImage", {
|
|
131
|
+
enumerable: true,
|
|
132
|
+
get: function get() {
|
|
133
|
+
return _Image["default"];
|
|
134
|
+
}
|
|
135
|
+
});
|
|
124
136
|
Object.defineProperty(exports, "DxcInset", {
|
|
125
137
|
enumerable: true,
|
|
126
138
|
get: function get() {
|
|
@@ -350,7 +362,7 @@ var _Inset = _interopRequireDefault(require("./inset/Inset"));
|
|
|
350
362
|
|
|
351
363
|
var _QuickNav = _interopRequireDefault(require("./quick-nav/QuickNav"));
|
|
352
364
|
|
|
353
|
-
var _NavTabs = _interopRequireDefault(require("./tabs
|
|
365
|
+
var _NavTabs = _interopRequireDefault(require("./nav-tabs/NavTabs"));
|
|
354
366
|
|
|
355
367
|
var _Flex = _interopRequireDefault(require("./flex/Flex"));
|
|
356
368
|
|
|
@@ -360,6 +372,10 @@ var _Paragraph = _interopRequireDefault(require("./paragraph/Paragraph"));
|
|
|
360
372
|
|
|
361
373
|
var _BulletedList = _interopRequireDefault(require("./bulleted-list/BulletedList"));
|
|
362
374
|
|
|
375
|
+
var _Grid = _interopRequireDefault(require("./grid/Grid"));
|
|
376
|
+
|
|
377
|
+
var _Image = _interopRequireDefault(require("./image/Image"));
|
|
378
|
+
|
|
363
379
|
var _HalstackContext = _interopRequireWildcard(require("./HalstackContext"));
|
|
364
380
|
|
|
365
381
|
var _BackgroundColorContext = require("./BackgroundColorContext");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { NavTabsContextProps
|
|
2
|
+
import NavTabsPropsType, { NavTabsContextProps } from "./types";
|
|
3
3
|
export declare const NavTabsContext: React.Context<NavTabsContextProps>;
|
|
4
4
|
declare const DxcNavTabs: {
|
|
5
|
-
({ iconPosition, tabIndex, children }:
|
|
5
|
+
({ iconPosition, tabIndex, children }: NavTabsPropsType): JSX.Element;
|
|
6
6
|
Tab: React.ForwardRefExoticComponent<import("./types").TabProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
7
7
|
};
|
|
8
8
|
export default DxcNavTabs;
|
|
@@ -68,23 +68,20 @@ var DxcNavTabs = function DxcNavTabs(_ref) {
|
|
|
68
68
|
_ref$tabIndex = _ref.tabIndex,
|
|
69
69
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex,
|
|
70
70
|
children = _ref.children;
|
|
71
|
-
var colorsTheme = (0, _useTheme["default"])();
|
|
72
71
|
|
|
73
72
|
var _useState = (0, _react.useState)(null),
|
|
74
73
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
innerFocusIndex = _useState2[0],
|
|
75
|
+
setInnerFocusIndex = _useState2[1];
|
|
77
76
|
|
|
77
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
78
78
|
var contextValue = (0, _react.useMemo)(function () {
|
|
79
79
|
return {
|
|
80
80
|
iconPosition: iconPosition,
|
|
81
81
|
tabIndex: tabIndex,
|
|
82
|
-
|
|
83
|
-
return getPropInChild(child, "icon");
|
|
84
|
-
}),
|
|
85
|
-
focusedLabel: innerFocus === null ? undefined : getLabelFromTab(children[innerFocus])
|
|
82
|
+
focusedLabel: innerFocusIndex === null ? undefined : getLabelFromTab(children[innerFocusIndex])
|
|
86
83
|
};
|
|
87
|
-
}, [iconPosition, tabIndex,
|
|
84
|
+
}, [iconPosition, tabIndex, innerFocusIndex]);
|
|
88
85
|
|
|
89
86
|
var handleOnKeyDown = function handleOnKeyDown(event) {
|
|
90
87
|
var activeTab = _react["default"].Children.toArray(children).findIndex(function (child) {
|
|
@@ -95,19 +92,19 @@ var DxcNavTabs = function DxcNavTabs(_ref) {
|
|
|
95
92
|
case "Left":
|
|
96
93
|
case "ArrowLeft":
|
|
97
94
|
event.preventDefault();
|
|
98
|
-
|
|
95
|
+
setInnerFocusIndex(getPreviousTabIndex(children, innerFocusIndex === null ? activeTab : innerFocusIndex));
|
|
99
96
|
break;
|
|
100
97
|
|
|
101
98
|
case "Right":
|
|
102
99
|
case "ArrowRight":
|
|
103
100
|
event.preventDefault();
|
|
104
|
-
|
|
101
|
+
setInnerFocusIndex(getNextTabIndex(children, innerFocusIndex === null ? activeTab : innerFocusIndex));
|
|
105
102
|
break;
|
|
106
103
|
}
|
|
107
104
|
};
|
|
108
105
|
|
|
109
106
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
110
|
-
theme: colorsTheme.
|
|
107
|
+
theme: colorsTheme.navTabs
|
|
111
108
|
}, /*#__PURE__*/_react["default"].createElement(NavTabsContainer, {
|
|
112
109
|
onKeyDown: handleOnKeyDown,
|
|
113
110
|
role: "tablist",
|