@dxc-technology/halstack-react 0.0.0-ff6c8bf → 0.0.0-ff78514
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/README.md +1 -2
- package/dist/index.d.mts +6589 -0
- package/dist/index.d.ts +6589 -0
- package/dist/index.js +13660 -0
- package/dist/index.mjs +13602 -0
- package/package.json +64 -66
- package/BackgroundColorContext.d.ts +0 -1
- package/BackgroundColorContext.js +0 -30
- package/HalstackContext.d.ts +0 -1246
- package/HalstackContext.js +0 -310
- package/accordion/Accordion.accessibility.test.js +0 -71
- package/accordion/Accordion.d.ts +0 -4
- package/accordion/Accordion.js +0 -171
- package/accordion/Accordion.stories.tsx +0 -241
- package/accordion/Accordion.test.js +0 -56
- package/accordion/types.d.ts +0 -57
- package/accordion/types.js +0 -5
- package/accordion-group/AccordionGroup.accessibility.test.js +0 -88
- package/accordion-group/AccordionGroup.d.ts +0 -7
- package/accordion-group/AccordionGroup.js +0 -101
- package/accordion-group/AccordionGroup.stories.tsx +0 -252
- package/accordion-group/AccordionGroup.test.js +0 -98
- package/accordion-group/AccordionGroupAccordion.d.ts +0 -4
- package/accordion-group/AccordionGroupAccordion.js +0 -31
- package/accordion-group/AccordionGroupContext.d.ts +0 -3
- package/accordion-group/AccordionGroupContext.js +0 -8
- package/accordion-group/types.d.ts +0 -67
- package/accordion-group/types.js +0 -5
- package/action-icon/ActionIcon.accessibility.test.js +0 -63
- package/action-icon/ActionIcon.d.ts +0 -4
- package/action-icon/ActionIcon.js +0 -48
- package/action-icon/ActionIcon.stories.tsx +0 -41
- package/action-icon/ActionIcon.test.js +0 -64
- package/action-icon/types.d.ts +0 -26
- package/action-icon/types.js +0 -5
- package/alert/Alert.accessibility.test.js +0 -95
- package/alert/Alert.d.ts +0 -4
- package/alert/Alert.js +0 -203
- package/alert/Alert.stories.tsx +0 -198
- package/alert/Alert.test.js +0 -75
- package/alert/types.d.ts +0 -49
- package/alert/types.js +0 -5
- package/badge/Badge.accessibility.test.js +0 -129
- package/badge/Badge.d.ts +0 -4
- package/badge/Badge.js +0 -161
- package/badge/Badge.stories.tsx +0 -210
- package/badge/Badge.test.js +0 -30
- package/badge/types.d.ts +0 -54
- package/badge/types.js +0 -5
- package/bleed/Bleed.d.ts +0 -3
- package/bleed/Bleed.js +0 -43
- package/bleed/Bleed.stories.tsx +0 -342
- package/bleed/types.d.ts +0 -37
- package/bleed/types.js +0 -5
- package/box/Box.accessibility.test.js +0 -33
- package/box/Box.d.ts +0 -4
- package/box/Box.js +0 -75
- package/box/Box.stories.tsx +0 -119
- package/box/Box.test.js +0 -13
- package/box/types.d.ts +0 -32
- package/box/types.js +0 -5
- package/breadcrumbs/Breadcrumbs.accessibility.test.d.ts +0 -1
- package/breadcrumbs/Breadcrumbs.accessibility.test.js +0 -96
- package/breadcrumbs/Breadcrumbs.d.ts +0 -4
- package/breadcrumbs/Breadcrumbs.js +0 -79
- package/breadcrumbs/Breadcrumbs.stories.tsx +0 -194
- package/breadcrumbs/Breadcrumbs.test.d.ts +0 -1
- package/breadcrumbs/Breadcrumbs.test.js +0 -169
- package/breadcrumbs/Item.d.ts +0 -4
- package/breadcrumbs/Item.js +0 -52
- package/breadcrumbs/dropdownTheme.d.ts +0 -53
- package/breadcrumbs/dropdownTheme.js +0 -62
- package/breadcrumbs/types.d.ts +0 -16
- package/breadcrumbs/types.js +0 -5
- package/bulleted-list/BulletedList.accessibility.test.js +0 -119
- package/bulleted-list/BulletedList.d.ts +0 -7
- package/bulleted-list/BulletedList.js +0 -92
- package/bulleted-list/BulletedList.stories.tsx +0 -115
- package/bulleted-list/types.d.ts +0 -38
- package/bulleted-list/types.js +0 -5
- package/button/Button.accessibility.test.js +0 -127
- package/button/Button.d.ts +0 -4
- package/button/Button.js +0 -121
- package/button/Button.stories.tsx +0 -325
- package/button/Button.test.js +0 -38
- package/button/types.d.ts +0 -57
- package/button/types.js +0 -5
- package/card/Card.accessibility.test.js +0 -36
- package/card/Card.d.ts +0 -4
- package/card/Card.js +0 -121
- package/card/Card.stories.tsx +0 -171
- package/card/Card.test.js +0 -39
- package/card/types.d.ts +0 -62
- package/card/types.js +0 -5
- package/checkbox/Checkbox.accessibility.test.js +0 -87
- package/checkbox/Checkbox.d.ts +0 -4
- package/checkbox/Checkbox.js +0 -215
- package/checkbox/Checkbox.stories.tsx +0 -222
- package/checkbox/Checkbox.test.js +0 -199
- package/checkbox/types.d.ts +0 -72
- package/checkbox/types.js +0 -5
- package/chip/Chip.accessibility.test.js +0 -67
- package/chip/Chip.d.ts +0 -4
- package/chip/Chip.js +0 -126
- package/chip/Chip.stories.tsx +0 -199
- package/chip/Chip.test.js +0 -41
- package/chip/types.d.ts +0 -45
- package/chip/types.js +0 -5
- package/common/coreTokens.d.ts +0 -237
- package/common/coreTokens.js +0 -184
- package/common/utils.d.ts +0 -1
- package/common/utils.js +0 -16
- package/common/variables.d.ts +0 -1392
- package/common/variables.js +0 -1264
- package/container/Container.d.ts +0 -4
- package/container/Container.js +0 -194
- package/container/Container.stories.tsx +0 -214
- package/container/types.d.ts +0 -74
- package/container/types.js +0 -5
- package/contextual-menu/ContextualMenu.accessibility.test.js +0 -97
- package/contextual-menu/ContextualMenu.d.ts +0 -5
- package/contextual-menu/ContextualMenu.js +0 -88
- package/contextual-menu/ContextualMenu.stories.tsx +0 -232
- package/contextual-menu/ContextualMenu.test.js +0 -205
- package/contextual-menu/GroupItem.d.ts +0 -4
- package/contextual-menu/GroupItem.js +0 -67
- package/contextual-menu/ItemAction.d.ts +0 -4
- package/contextual-menu/ItemAction.js +0 -51
- package/contextual-menu/MenuItem.d.ts +0 -4
- package/contextual-menu/MenuItem.js +0 -29
- package/contextual-menu/SingleItem.d.ts +0 -4
- package/contextual-menu/SingleItem.js +0 -38
- package/contextual-menu/types.d.ts +0 -58
- package/contextual-menu/types.js +0 -5
- package/date-input/Calendar.d.ts +0 -4
- package/date-input/Calendar.js +0 -214
- package/date-input/DateInput.accessibility.test.js +0 -228
- package/date-input/DateInput.d.ts +0 -4
- package/date-input/DateInput.js +0 -222
- package/date-input/DateInput.stories.tsx +0 -292
- package/date-input/DateInput.test.js +0 -808
- package/date-input/DatePicker.d.ts +0 -4
- package/date-input/DatePicker.js +0 -121
- package/date-input/YearPicker.d.ts +0 -4
- package/date-input/YearPicker.js +0 -100
- package/date-input/types.d.ts +0 -164
- package/date-input/types.js +0 -5
- package/dialog/Dialog.accessibility.test.js +0 -69
- package/dialog/Dialog.d.ts +0 -4
- package/dialog/Dialog.js +0 -93
- package/dialog/Dialog.stories.tsx +0 -371
- package/dialog/Dialog.test.js +0 -307
- package/dialog/types.d.ts +0 -36
- package/dialog/types.js +0 -5
- package/divider/Divider.accessibility.test.js +0 -33
- package/divider/Divider.d.ts +0 -4
- package/divider/Divider.js +0 -36
- package/divider/Divider.stories.tsx +0 -223
- package/divider/Divider.test.js +0 -38
- package/divider/types.d.ts +0 -21
- package/divider/types.js +0 -5
- package/dropdown/Dropdown.accessibility.test.js +0 -180
- package/dropdown/Dropdown.d.ts +0 -4
- package/dropdown/Dropdown.js +0 -321
- package/dropdown/Dropdown.stories.tsx +0 -427
- package/dropdown/Dropdown.test.js +0 -599
- package/dropdown/DropdownMenu.d.ts +0 -4
- package/dropdown/DropdownMenu.js +0 -63
- package/dropdown/DropdownMenuItem.d.ts +0 -4
- package/dropdown/DropdownMenuItem.js +0 -71
- package/dropdown/types.d.ts +0 -96
- package/dropdown/types.js +0 -5
- package/file-input/FileInput.accessibility.test.js +0 -160
- package/file-input/FileInput.d.ts +0 -4
- package/file-input/FileInput.js +0 -443
- package/file-input/FileInput.stories.tsx +0 -618
- package/file-input/FileInput.test.js +0 -396
- package/file-input/FileItem.d.ts +0 -4
- package/file-input/FileItem.js +0 -125
- package/file-input/types.d.ts +0 -129
- package/file-input/types.js +0 -5
- package/flex/Flex.d.ts +0 -4
- package/flex/Flex.js +0 -57
- package/flex/Flex.stories.tsx +0 -112
- package/flex/types.d.ts +0 -97
- package/flex/types.js +0 -5
- package/footer/Footer.accessibility.test.js +0 -125
- package/footer/Footer.d.ts +0 -4
- package/footer/Footer.js +0 -140
- package/footer/Footer.stories.tsx +0 -208
- package/footer/Footer.test.js +0 -85
- package/footer/Icons.d.ts +0 -3
- package/footer/Icons.js +0 -108
- package/footer/types.d.ts +0 -64
- package/footer/types.js +0 -5
- package/grid/Grid.d.ts +0 -7
- package/grid/Grid.js +0 -76
- package/grid/Grid.stories.tsx +0 -219
- package/grid/types.d.ts +0 -115
- package/grid/types.js +0 -5
- package/header/Header.accessibility.test.js +0 -93
- package/header/Header.d.ts +0 -8
- package/header/Header.js +0 -210
- package/header/Header.stories.tsx +0 -267
- package/header/Header.test.js +0 -66
- package/header/Icons.d.ts +0 -2
- package/header/Icons.js +0 -24
- package/header/types.d.ts +0 -33
- package/header/types.js +0 -5
- package/heading/Heading.accessibility.test.js +0 -33
- package/heading/Heading.d.ts +0 -4
- package/heading/Heading.js +0 -137
- package/heading/Heading.stories.tsx +0 -54
- package/heading/Heading.test.js +0 -169
- package/heading/types.d.ts +0 -33
- package/heading/types.js +0 -5
- package/icon/Icon.accessibility.test.js +0 -30
- package/icon/Icon.d.ts +0 -4
- package/icon/Icon.js +0 -33
- package/icon/Icon.stories.tsx +0 -28
- package/icon/types.d.ts +0 -4
- package/icon/types.js +0 -5
- package/image/Image.accessibility.test.js +0 -56
- package/image/Image.d.ts +0 -4
- package/image/Image.js +0 -70
- package/image/Image.stories.tsx +0 -129
- package/image/types.d.ts +0 -72
- package/image/types.js +0 -5
- package/inset/Inset.d.ts +0 -3
- package/inset/Inset.js +0 -43
- package/inset/Inset.stories.tsx +0 -230
- package/inset/types.d.ts +0 -37
- package/inset/types.js +0 -5
- package/layout/ApplicationLayout.d.ts +0 -20
- package/layout/ApplicationLayout.js +0 -137
- package/layout/ApplicationLayout.stories.tsx +0 -162
- package/layout/Icons.d.ts +0 -7
- package/layout/Icons.js +0 -48
- package/layout/types.d.ts +0 -41
- package/layout/types.js +0 -5
- package/link/Link.accessibility.test.js +0 -108
- package/link/Link.d.ts +0 -4
- package/link/Link.js +0 -117
- package/link/Link.stories.tsx +0 -253
- package/link/Link.test.js +0 -63
- package/link/types.d.ts +0 -54
- package/link/types.js +0 -5
- package/main.d.ts +0 -50
- package/main.js +0 -364
- package/nav-tabs/NavTabs.accessibility.test.js +0 -44
- package/nav-tabs/NavTabs.d.ts +0 -7
- package/nav-tabs/NavTabs.js +0 -93
- package/nav-tabs/NavTabs.stories.tsx +0 -279
- package/nav-tabs/NavTabs.test.js +0 -77
- package/nav-tabs/NavTabsContext.d.ts +0 -3
- package/nav-tabs/NavTabsContext.js +0 -8
- package/nav-tabs/Tab.d.ts +0 -4
- package/nav-tabs/Tab.js +0 -117
- package/nav-tabs/types.d.ts +0 -52
- package/nav-tabs/types.js +0 -5
- package/number-input/NumberInput.accessibility.test.js +0 -228
- package/number-input/NumberInput.d.ts +0 -4
- package/number-input/NumberInput.js +0 -86
- package/number-input/NumberInput.stories.tsx +0 -131
- package/number-input/NumberInput.test.js +0 -989
- package/number-input/NumberInputContext.d.ts +0 -3
- package/number-input/NumberInputContext.js +0 -8
- package/number-input/types.d.ts +0 -136
- package/number-input/types.js +0 -5
- package/paginator/Paginator.accessibility.test.js +0 -79
- package/paginator/Paginator.d.ts +0 -4
- package/paginator/Paginator.js +0 -138
- package/paginator/Paginator.stories.tsx +0 -87
- package/paginator/Paginator.test.js +0 -335
- package/paginator/types.d.ts +0 -38
- package/paginator/types.js +0 -5
- package/paragraph/Paragraph.accessibility.test.js +0 -28
- package/paragraph/Paragraph.d.ts +0 -5
- package/paragraph/Paragraph.js +0 -22
- package/paragraph/Paragraph.stories.tsx +0 -27
- package/password-input/PasswordInput.accessibility.test.js +0 -153
- package/password-input/PasswordInput.d.ts +0 -4
- package/password-input/PasswordInput.js +0 -97
- package/password-input/PasswordInput.stories.tsx +0 -99
- package/password-input/PasswordInput.test.js +0 -198
- package/password-input/types.d.ts +0 -111
- package/password-input/types.js +0 -5
- package/progress-bar/ProgressBar.accessibility.test.js +0 -35
- package/progress-bar/ProgressBar.d.ts +0 -4
- package/progress-bar/ProgressBar.js +0 -146
- package/progress-bar/ProgressBar.stories.tsx +0 -93
- package/progress-bar/ProgressBar.test.js +0 -93
- package/progress-bar/types.d.ts +0 -37
- package/progress-bar/types.js +0 -5
- package/quick-nav/QuickNav.accessibility.test.js +0 -57
- package/quick-nav/QuickNav.d.ts +0 -4
- package/quick-nav/QuickNav.js +0 -94
- package/quick-nav/QuickNav.stories.tsx +0 -356
- package/quick-nav/types.d.ts +0 -21
- package/quick-nav/types.js +0 -5
- package/radio-group/Radio.d.ts +0 -4
- package/radio-group/Radio.js +0 -124
- package/radio-group/RadioGroup.accessibility.test.js +0 -97
- package/radio-group/RadioGroup.d.ts +0 -4
- package/radio-group/RadioGroup.js +0 -236
- package/radio-group/RadioGroup.stories.tsx +0 -214
- package/radio-group/RadioGroup.test.js +0 -756
- package/radio-group/types.d.ts +0 -114
- package/radio-group/types.js +0 -5
- package/resultset-table/Icons.d.ts +0 -7
- package/resultset-table/Icons.js +0 -47
- package/resultset-table/ResultsetTable.accessibility.test.js +0 -285
- package/resultset-table/ResultsetTable.d.ts +0 -7
- package/resultset-table/ResultsetTable.js +0 -171
- package/resultset-table/ResultsetTable.stories.tsx +0 -413
- package/resultset-table/ResultsetTable.test.js +0 -381
- package/resultset-table/types.d.ts +0 -100
- package/resultset-table/types.js +0 -5
- package/select/Listbox.d.ts +0 -4
- package/select/Listbox.js +0 -155
- package/select/Option.d.ts +0 -4
- package/select/Option.js +0 -89
- package/select/Select.accessibility.test.js +0 -228
- package/select/Select.d.ts +0 -4
- package/select/Select.js +0 -602
- package/select/Select.stories.tsx +0 -919
- package/select/Select.test.js +0 -2265
- package/select/types.d.ts +0 -209
- package/select/types.js +0 -5
- package/sidenav/Sidenav.accessibility.test.js +0 -59
- package/sidenav/Sidenav.d.ts +0 -10
- package/sidenav/Sidenav.js +0 -201
- package/sidenav/Sidenav.stories.tsx +0 -277
- package/sidenav/Sidenav.test.js +0 -37
- package/sidenav/SidenavContext.d.ts +0 -5
- package/sidenav/SidenavContext.js +0 -13
- package/sidenav/types.d.ts +0 -76
- package/sidenav/types.js +0 -5
- package/slider/Slider.accessibility.test.js +0 -104
- package/slider/Slider.d.ts +0 -4
- package/slider/Slider.js +0 -286
- package/slider/Slider.stories.tsx +0 -180
- package/slider/Slider.test.js +0 -254
- package/slider/types.d.ts +0 -86
- package/slider/types.js +0 -5
- package/spinner/Spinner.accessibility.test.js +0 -96
- package/spinner/Spinner.d.ts +0 -4
- package/spinner/Spinner.js +0 -210
- package/spinner/Spinner.stories.tsx +0 -129
- package/spinner/Spinner.test.js +0 -55
- package/spinner/types.d.ts +0 -32
- package/spinner/types.js +0 -5
- package/status-light/StatusLight.accessibility.test.js +0 -157
- package/status-light/StatusLight.d.ts +0 -4
- package/status-light/StatusLight.js +0 -51
- package/status-light/StatusLight.stories.tsx +0 -74
- package/status-light/StatusLight.test.js +0 -25
- package/status-light/types.d.ts +0 -17
- package/status-light/types.js +0 -5
- package/switch/Switch.accessibility.test.js +0 -98
- package/switch/Switch.d.ts +0 -4
- package/switch/Switch.js +0 -214
- package/switch/Switch.stories.tsx +0 -149
- package/switch/Switch.test.js +0 -180
- package/switch/types.d.ts +0 -66
- package/switch/types.js +0 -5
- package/table/DropdownTheme.js +0 -62
- package/table/Table.accessibility.test.js +0 -93
- package/table/Table.d.ts +0 -8
- package/table/Table.js +0 -161
- package/table/Table.stories.tsx +0 -663
- package/table/Table.test.js +0 -113
- package/table/types.d.ts +0 -49
- package/table/types.js +0 -5
- package/tabs/Tab.d.ts +0 -4
- package/tabs/Tab.js +0 -117
- package/tabs/Tabs.accessibility.test.js +0 -56
- package/tabs/Tabs.d.ts +0 -4
- package/tabs/Tabs.js +0 -373
- package/tabs/Tabs.stories.tsx +0 -230
- package/tabs/Tabs.test.js +0 -276
- package/tabs/types.d.ts +0 -92
- package/tabs/types.js +0 -5
- package/tag/Tag.accessibility.test.js +0 -69
- package/tag/Tag.d.ts +0 -4
- package/tag/Tag.js +0 -151
- package/tag/Tag.stories.tsx +0 -152
- package/tag/Tag.test.js +0 -41
- package/tag/types.d.ts +0 -69
- package/tag/types.js +0 -5
- package/text-input/Suggestion.d.ts +0 -4
- package/text-input/Suggestion.js +0 -67
- package/text-input/Suggestions.d.ts +0 -4
- package/text-input/Suggestions.js +0 -94
- package/text-input/TextInput.accessibility.test.js +0 -321
- package/text-input/TextInput.d.ts +0 -4
- package/text-input/TextInput.js +0 -571
- package/text-input/TextInput.stories.tsx +0 -474
- package/text-input/TextInput.test.js +0 -1756
- package/text-input/types.d.ts +0 -205
- package/text-input/types.js +0 -5
- package/textarea/Textarea.accessibility.test.js +0 -155
- package/textarea/Textarea.d.ts +0 -4
- package/textarea/Textarea.js +0 -235
- package/textarea/Textarea.stories.tsx +0 -174
- package/textarea/Textarea.test.js +0 -406
- package/textarea/types.d.ts +0 -141
- package/textarea/types.js +0 -5
- package/toggle-group/ToggleGroup.accessibility.test.js +0 -107
- package/toggle-group/ToggleGroup.d.ts +0 -4
- package/toggle-group/ToggleGroup.js +0 -202
- package/toggle-group/ToggleGroup.stories.tsx +0 -218
- package/toggle-group/ToggleGroup.test.js +0 -137
- package/toggle-group/types.d.ts +0 -114
- package/toggle-group/types.js +0 -5
- package/typography/Typography.accessibility.test.js +0 -339
- package/typography/Typography.d.ts +0 -4
- package/typography/Typography.js +0 -23
- package/typography/Typography.stories.tsx +0 -198
- package/typography/types.d.ts +0 -18
- package/typography/types.js +0 -5
- package/useTheme.d.ts +0 -1145
- package/useTheme.js +0 -15
- package/useTranslatedLabels.d.ts +0 -85
- package/useTranslatedLabels.js +0 -14
- package/utils/BaseTypography.d.ts +0 -21
- package/utils/BaseTypography.js +0 -94
- package/utils/FocusLock.d.ts +0 -13
- package/utils/FocusLock.js +0 -124
- package/wizard/Wizard.accessibility.test.js +0 -55
- package/wizard/Wizard.d.ts +0 -4
- package/wizard/Wizard.js +0 -239
- package/wizard/Wizard.stories.tsx +0 -272
- package/wizard/Wizard.test.js +0 -114
- package/wizard/types.d.ts +0 -64
- package/wizard/types.js +0 -5
package/grid/Grid.stories.tsx
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import Title from "../../.storybook/components/Title";
|
|
3
|
-
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
4
|
-
import styled from "styled-components";
|
|
5
|
-
import DxcGrid from "./Grid";
|
|
6
|
-
import DxcInset from "../inset/Inset";
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: "Grid",
|
|
10
|
-
component: DxcGrid,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const Chromatic = () => (
|
|
14
|
-
<>
|
|
15
|
-
<Title title="Default" level={4} />
|
|
16
|
-
<ExampleContainer>
|
|
17
|
-
<DxcGrid>
|
|
18
|
-
<ColoredContainer />
|
|
19
|
-
<ColoredContainer />
|
|
20
|
-
<ColoredContainer />
|
|
21
|
-
</DxcGrid>
|
|
22
|
-
</ExampleContainer>
|
|
23
|
-
<Title title="Place items" level={4} />
|
|
24
|
-
<ExampleContainer>
|
|
25
|
-
<DxcGrid templateRows={["200px"]} placeItems="center">
|
|
26
|
-
<ColoredContainer height="50px" width="50px" />
|
|
27
|
-
</DxcGrid>
|
|
28
|
-
<DxcGrid placeItems={{ justifyItems: "end" }}>
|
|
29
|
-
<ColoredContainer />
|
|
30
|
-
<ColoredContainer />
|
|
31
|
-
<ColoredContainer />
|
|
32
|
-
</DxcGrid>
|
|
33
|
-
<DxcGrid templateRows={["repeat(3, 100px)"]} placeItems={{ alignItems: "end", justifyItems: "center" }}>
|
|
34
|
-
<ColoredContainer height="50px" width="50px" />
|
|
35
|
-
<ColoredContainer height="50px" width="50px" />
|
|
36
|
-
<ColoredContainer height="50px" width="50px" />
|
|
37
|
-
</DxcGrid>
|
|
38
|
-
</ExampleContainer>
|
|
39
|
-
<Title title="Place content" level={4} />
|
|
40
|
-
<Container height="200px">
|
|
41
|
-
<DxcGrid placeContent="center">
|
|
42
|
-
<ColoredContainer height="50px" width="50px" />
|
|
43
|
-
<ColoredContainer height="50px" width="50px" />
|
|
44
|
-
</DxcGrid>
|
|
45
|
-
</Container>
|
|
46
|
-
<Container height="200px">
|
|
47
|
-
<DxcGrid placeContent={{ alignContent: "center" }}>
|
|
48
|
-
<ColoredContainer height="50px" width="50px" />
|
|
49
|
-
</DxcGrid>
|
|
50
|
-
</Container>
|
|
51
|
-
<Container height="200px">
|
|
52
|
-
<DxcGrid placeContent={{ alignContent: "center", justifyContent: "end" }}>
|
|
53
|
-
<ColoredContainer height="50px" width="50px" />
|
|
54
|
-
</DxcGrid>
|
|
55
|
-
</Container>
|
|
56
|
-
<Title title="Place self" level={4} />
|
|
57
|
-
<ExampleContainer>
|
|
58
|
-
<DxcGrid templateRows={["repeat(3, 100px)"]}>
|
|
59
|
-
<DxcGrid.Item placeSelf="center">
|
|
60
|
-
<ColoredContainer height="50px" width="50px" />
|
|
61
|
-
</DxcGrid.Item>
|
|
62
|
-
<DxcGrid.Item placeSelf={{ alignSelf: "end" }}>
|
|
63
|
-
<ColoredContainer height="40px" width="40px" />
|
|
64
|
-
<ColoredContainer height="30px" width="30px" />
|
|
65
|
-
</DxcGrid.Item>
|
|
66
|
-
<DxcGrid.Item placeSelf={{ alignSelf: "center", justifySelf: "end" }}>
|
|
67
|
-
<ColoredContainer height="50px" width="50px" />
|
|
68
|
-
</DxcGrid.Item>
|
|
69
|
-
</DxcGrid>
|
|
70
|
-
</ExampleContainer>
|
|
71
|
-
<Title title="Halstack layout using template areas" level={4} />
|
|
72
|
-
<ExampleContainer>
|
|
73
|
-
<DxcGrid
|
|
74
|
-
templateColumns={["repeat(4, 1fr)"]}
|
|
75
|
-
templateRows={["40px", "200px", "60px"]}
|
|
76
|
-
templateAreas={["header header header header", "sidenav main main main", "sidenav footer footer footer"]}
|
|
77
|
-
gap={{ rowGap: "0.5rem", columnGap: "1rem" }}
|
|
78
|
-
>
|
|
79
|
-
<DxcGrid.Item areaName="header" as="header">
|
|
80
|
-
<ColoredContainer height="100%" />
|
|
81
|
-
</DxcGrid.Item>
|
|
82
|
-
<DxcGrid.Item areaName="main" as="main">
|
|
83
|
-
<ColoredContainer height="100%" />
|
|
84
|
-
</DxcGrid.Item>
|
|
85
|
-
<DxcGrid.Item areaName="sidenav" as="nav">
|
|
86
|
-
<ColoredContainer height="100%" />
|
|
87
|
-
</DxcGrid.Item>
|
|
88
|
-
<DxcGrid.Item areaName="footer" as="footer">
|
|
89
|
-
<ColoredContainer height="100%" />
|
|
90
|
-
</DxcGrid.Item>
|
|
91
|
-
</DxcGrid>
|
|
92
|
-
</ExampleContainer>
|
|
93
|
-
<Title title="Template rows and columns with flexible sizes" level={4} />
|
|
94
|
-
<ExampleContainer>
|
|
95
|
-
<DxcGrid templateColumns={["1fr", "1fr", "1fr"]} templateRows={["1fr", "3fr", "1fr"]} gap="0.5rem">
|
|
96
|
-
<DxcGrid.Item column={{ start: 1, end: -1 }}>
|
|
97
|
-
<ColoredContainer color="yellow" height="100%">
|
|
98
|
-
Header
|
|
99
|
-
</ColoredContainer>
|
|
100
|
-
</DxcGrid.Item>
|
|
101
|
-
<DxcGrid.Item column={1}>
|
|
102
|
-
<ColoredContainer color="lightcyan" height="100%">
|
|
103
|
-
Sidenav
|
|
104
|
-
</ColoredContainer>
|
|
105
|
-
</DxcGrid.Item>
|
|
106
|
-
<DxcGrid
|
|
107
|
-
column={{ start: 2, end: -1 }}
|
|
108
|
-
templateRows={["repeat(4, 1fr)"]}
|
|
109
|
-
templateColumns={["repeat(2, 1fr)"]}
|
|
110
|
-
gap="1rem"
|
|
111
|
-
>
|
|
112
|
-
<ColoredContainer />
|
|
113
|
-
<ColoredContainer />
|
|
114
|
-
<ColoredContainer />
|
|
115
|
-
<ColoredContainer />
|
|
116
|
-
<ColoredContainer />
|
|
117
|
-
<ColoredContainer />
|
|
118
|
-
<ColoredContainer />
|
|
119
|
-
<ColoredContainer />
|
|
120
|
-
</DxcGrid>
|
|
121
|
-
<DxcGrid.Item column={{ start: 1, end: -1 }}>
|
|
122
|
-
<ColoredContainer color="black" height="100%">
|
|
123
|
-
Footer
|
|
124
|
-
</ColoredContainer>
|
|
125
|
-
</DxcGrid.Item>
|
|
126
|
-
</DxcGrid>
|
|
127
|
-
</ExampleContainer>
|
|
128
|
-
<Title title="Overlapping" level={4} />
|
|
129
|
-
<DxcInset bottom="2rem">
|
|
130
|
-
<ExampleContainer>
|
|
131
|
-
<DxcGrid templateRows={["50px", "50px"]}>
|
|
132
|
-
<ColoredContainer color="yellow" height="100px">
|
|
133
|
-
1
|
|
134
|
-
</ColoredContainer>
|
|
135
|
-
<ColoredContainer color="transparent" height="100px">
|
|
136
|
-
2
|
|
137
|
-
</ColoredContainer>
|
|
138
|
-
</DxcGrid>
|
|
139
|
-
</ExampleContainer>
|
|
140
|
-
</DxcInset>
|
|
141
|
-
<Title title="Implicit rows and columns" level={4} />
|
|
142
|
-
<ExampleContainer>
|
|
143
|
-
<DxcGrid templateColumns={["50px"]} templateRows={["50px", "50px"]} autoRows="50px" autoColumns="50px">
|
|
144
|
-
<DxcGrid.Item>
|
|
145
|
-
<ColoredContainer height="50px">1</ColoredContainer>
|
|
146
|
-
</DxcGrid.Item>
|
|
147
|
-
<DxcGrid.Item row={2}>
|
|
148
|
-
<ColoredContainer height="50px">3</ColoredContainer>
|
|
149
|
-
</DxcGrid.Item>
|
|
150
|
-
<DxcGrid.Item row={6} column={1}>
|
|
151
|
-
<ColoredContainer height="50px">5</ColoredContainer>
|
|
152
|
-
</DxcGrid.Item>
|
|
153
|
-
<DxcGrid.Item row={3}>
|
|
154
|
-
<ColoredContainer height="50px">4</ColoredContainer>
|
|
155
|
-
</DxcGrid.Item>
|
|
156
|
-
<DxcGrid.Item row={{ start: 1, end: 2 }} column={{ start: 5, end: "span 2" }}>
|
|
157
|
-
<ColoredContainer height="50px">2</ColoredContainer>
|
|
158
|
-
</DxcGrid.Item>
|
|
159
|
-
</DxcGrid>
|
|
160
|
-
</ExampleContainer>
|
|
161
|
-
<Title title="Autoflow 'row' (default)" level={4} />
|
|
162
|
-
<ExampleContainer>
|
|
163
|
-
<DxcGrid templateColumns={["repeat(5, 1fr)"]} templateRows={["1fr", "1fr"]} autoFlow="row" autoColumns="1fr">
|
|
164
|
-
<DxcGrid.Item row={{ start: 1, end: "span 2" }} column={1}>
|
|
165
|
-
<ColoredContainer height="100%">1</ColoredContainer>
|
|
166
|
-
</DxcGrid.Item>
|
|
167
|
-
<ColoredContainer color="lightyellow">2</ColoredContainer>
|
|
168
|
-
<ColoredContainer color="lightcyan">3</ColoredContainer>
|
|
169
|
-
<ColoredContainer color="lightgreen">4</ColoredContainer>
|
|
170
|
-
<DxcGrid.Item row={{ start: 1, end: -1 }} column={-2}>
|
|
171
|
-
<ColoredContainer color="lightpink" height="100%">
|
|
172
|
-
5
|
|
173
|
-
</ColoredContainer>
|
|
174
|
-
</DxcGrid.Item>
|
|
175
|
-
</DxcGrid>
|
|
176
|
-
</ExampleContainer>
|
|
177
|
-
<Title title="Autoflow 'column'" level={4} />
|
|
178
|
-
<ExampleContainer>
|
|
179
|
-
<DxcGrid templateColumns={["repeat(5, 1fr)"]} templateRows={["1fr", "1fr"]} autoFlow="column" autoColumns="1fr">
|
|
180
|
-
<DxcGrid.Item row={{ start: 1, end: -1 }} column={1}>
|
|
181
|
-
<ColoredContainer height="100%">1</ColoredContainer>
|
|
182
|
-
</DxcGrid.Item>
|
|
183
|
-
<ColoredContainer color="lightyellow">2</ColoredContainer>
|
|
184
|
-
<ColoredContainer color="lightcyan">3</ColoredContainer>
|
|
185
|
-
<ColoredContainer color="lightgreen">4</ColoredContainer>
|
|
186
|
-
<DxcGrid.Item row={{ start: 1, end: -1 }} column={-2}>
|
|
187
|
-
<ColoredContainer color="lightpink" height="100%">
|
|
188
|
-
5
|
|
189
|
-
</ColoredContainer>
|
|
190
|
-
</DxcGrid.Item>
|
|
191
|
-
</DxcGrid>
|
|
192
|
-
</ExampleContainer>
|
|
193
|
-
</>
|
|
194
|
-
);
|
|
195
|
-
|
|
196
|
-
const Container = styled.div<{ height?: string }>`
|
|
197
|
-
display: grid;
|
|
198
|
-
overflow: auto;
|
|
199
|
-
margin: 2.5rem;
|
|
200
|
-
${({ height }) => height && `height: ${height}`};
|
|
201
|
-
`;
|
|
202
|
-
|
|
203
|
-
const ColoredContainer = styled.div<{ color?: string; width?: string; height?: string }>`
|
|
204
|
-
box-sizing: border-box;
|
|
205
|
-
display: flex;
|
|
206
|
-
justify-content: center;
|
|
207
|
-
align-items: center;
|
|
208
|
-
background-color: ${({ color }) => color ?? "#e5d5f6"};
|
|
209
|
-
padding: 1rem;
|
|
210
|
-
border: 1px solid #a46ede;
|
|
211
|
-
border-radius: 0.5rem;
|
|
212
|
-
font-family: Open Sans, sans-serif;
|
|
213
|
-
font-size: 1.5rem;
|
|
214
|
-
font-weight: bold;
|
|
215
|
-
color: #a46ede;
|
|
216
|
-
|
|
217
|
-
${({ width }) => width && `width: ${width}`};
|
|
218
|
-
${({ height }) => height && `height: ${height}`};
|
|
219
|
-
`;
|
package/grid/types.d.ts
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
type Spaces = "0rem" | "0.125rem" | "0.25rem" | "0.5rem" | "1rem" | "1.5rem" | "2rem" | "3rem" | "4rem" | "5rem";
|
|
3
|
-
type Gap = {
|
|
4
|
-
rowGap: Spaces;
|
|
5
|
-
columnGap?: Spaces;
|
|
6
|
-
} | {
|
|
7
|
-
rowGap?: Spaces;
|
|
8
|
-
columnGap: Spaces;
|
|
9
|
-
} | Spaces;
|
|
10
|
-
type GridCell = {
|
|
11
|
-
start: number | string;
|
|
12
|
-
end: number | string;
|
|
13
|
-
};
|
|
14
|
-
type PlaceSelfValues = "auto" | "start" | "end" | "center" | "stretch" | "baseline";
|
|
15
|
-
type PlaceContentValues = "normal" | "start" | "end" | "center" | "stretch" | "space-between" | "space-around" | "space-evenly" | "baseline";
|
|
16
|
-
type PlaceItemsValues = "normal" | "start" | "end" | "center" | "stretch" | "baseline";
|
|
17
|
-
type PlaceObject<Type, Suffix extends string> = {
|
|
18
|
-
[Property in keyof Type as `${string & Property}${Capitalize<string & Suffix>}`]: Type[Property];
|
|
19
|
-
};
|
|
20
|
-
type PlaceGeneric<PlaceValues, Element extends string> = PlaceObject<{
|
|
21
|
-
justify?: PlaceValues;
|
|
22
|
-
align: PlaceValues;
|
|
23
|
-
}, Element> | PlaceObject<{
|
|
24
|
-
justify: PlaceValues;
|
|
25
|
-
align?: PlaceValues;
|
|
26
|
-
}, Element> | PlaceValues;
|
|
27
|
-
export type GridItemProps = {
|
|
28
|
-
/**
|
|
29
|
-
* Sets the name of an item so that it can be referenced by a template created with the grid-template-areas property.
|
|
30
|
-
*/
|
|
31
|
-
areaName?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Sets the grid-column CSS property.
|
|
34
|
-
*
|
|
35
|
-
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/grid-column
|
|
36
|
-
*/
|
|
37
|
-
column?: number | string | GridCell;
|
|
38
|
-
/**
|
|
39
|
-
* Sets the grid-row CSS property.
|
|
40
|
-
*
|
|
41
|
-
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row
|
|
42
|
-
*/
|
|
43
|
-
row?: number | string | GridCell;
|
|
44
|
-
/**
|
|
45
|
-
* Sets the place-self CSS property.
|
|
46
|
-
*
|
|
47
|
-
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/place-self
|
|
48
|
-
*/
|
|
49
|
-
placeSelf?: PlaceGeneric<PlaceSelfValues, "self">;
|
|
50
|
-
/**
|
|
51
|
-
* Sets a custom HTML tag.
|
|
52
|
-
*/
|
|
53
|
-
as?: keyof HTMLElementTagNameMap;
|
|
54
|
-
/**
|
|
55
|
-
* Custom content inside the grid container.
|
|
56
|
-
*/
|
|
57
|
-
children: React.ReactNode;
|
|
58
|
-
};
|
|
59
|
-
type Props = GridItemProps & {
|
|
60
|
-
/**
|
|
61
|
-
* Sets the grid-auto-columns CSS property.
|
|
62
|
-
*
|
|
63
|
-
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-columns
|
|
64
|
-
*/
|
|
65
|
-
autoColumns?: string;
|
|
66
|
-
/**
|
|
67
|
-
* Sets the grid-auto-flow CSS property.
|
|
68
|
-
*
|
|
69
|
-
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow
|
|
70
|
-
*/
|
|
71
|
-
autoFlow?: "row" | "column" | "row dense" | "column dense";
|
|
72
|
-
/**
|
|
73
|
-
* Sets the grid-auto-rows CSS property.
|
|
74
|
-
*
|
|
75
|
-
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-rows
|
|
76
|
-
*/
|
|
77
|
-
autoRows?: string;
|
|
78
|
-
/**
|
|
79
|
-
* Sets the gap CSS property.
|
|
80
|
-
*
|
|
81
|
-
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/gap
|
|
82
|
-
*/
|
|
83
|
-
gap?: Spaces | Gap;
|
|
84
|
-
/**
|
|
85
|
-
* Sets the place-content CSS property.
|
|
86
|
-
*
|
|
87
|
-
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/place-content
|
|
88
|
-
*/
|
|
89
|
-
placeContent?: PlaceGeneric<PlaceContentValues, "content">;
|
|
90
|
-
/**
|
|
91
|
-
* Sets the place-items CSS property.
|
|
92
|
-
*
|
|
93
|
-
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/place-items
|
|
94
|
-
*/
|
|
95
|
-
placeItems?: PlaceGeneric<PlaceItemsValues, "items">;
|
|
96
|
-
/**
|
|
97
|
-
* Sets the grid-template-areas CSS property.
|
|
98
|
-
*
|
|
99
|
-
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-areas
|
|
100
|
-
*/
|
|
101
|
-
templateAreas?: string[];
|
|
102
|
-
/**
|
|
103
|
-
* Sets the grid-template-columns CSS property.
|
|
104
|
-
*
|
|
105
|
-
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns
|
|
106
|
-
*/
|
|
107
|
-
templateColumns?: string[];
|
|
108
|
-
/**
|
|
109
|
-
* Sets the grid-template-rows CSS property.
|
|
110
|
-
*
|
|
111
|
-
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-rows
|
|
112
|
-
*/
|
|
113
|
-
templateRows?: string[];
|
|
114
|
-
};
|
|
115
|
-
export default Props;
|
package/grid/types.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
5
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
|
-
var _react = _interopRequireDefault(require("react"));
|
|
7
|
-
var _react2 = require("@testing-library/react");
|
|
8
|
-
var _axeHelper = require("../../test/accessibility/axe-helper.js");
|
|
9
|
-
var _Header = _interopRequireDefault(require("./Header.tsx"));
|
|
10
|
-
var _Flex = _interopRequireDefault(require("../flex/Flex.tsx"));
|
|
11
|
-
var _Link = _interopRequireDefault(require("../link/Link.tsx"));
|
|
12
|
-
var _disabledRules = require("../../test/accessibility/rules/specific/header/disabledRules.js");
|
|
13
|
-
var disabledRules = {
|
|
14
|
-
rules: _disabledRules.disabledRules.reduce(function (rulesObj, rule) {
|
|
15
|
-
rulesObj[rule] = {
|
|
16
|
-
enabled: false
|
|
17
|
-
};
|
|
18
|
-
return rulesObj;
|
|
19
|
-
}, {})
|
|
20
|
-
};
|
|
21
|
-
var iconSVG = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
22
|
-
viewBox: "0 0 24 24",
|
|
23
|
-
height: "24",
|
|
24
|
-
width: "24",
|
|
25
|
-
fill: "currentColor"
|
|
26
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
27
|
-
d: "M0 0h24v24H0z",
|
|
28
|
-
fill: "none"
|
|
29
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
30
|
-
d: "M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"
|
|
31
|
-
}));
|
|
32
|
-
var iconUrl = "https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png";
|
|
33
|
-
var options = [{
|
|
34
|
-
value: "1",
|
|
35
|
-
label: "Amazon",
|
|
36
|
-
icon: iconUrl
|
|
37
|
-
}, {
|
|
38
|
-
value: "2",
|
|
39
|
-
label: "Ebay",
|
|
40
|
-
icon: iconUrl
|
|
41
|
-
}, {
|
|
42
|
-
value: "3",
|
|
43
|
-
label: "Wallapop",
|
|
44
|
-
icon: iconSVG
|
|
45
|
-
}, {
|
|
46
|
-
value: "4",
|
|
47
|
-
label: "Aliexpress",
|
|
48
|
-
icon: iconSVG
|
|
49
|
-
}];
|
|
50
|
-
describe("Header component accessibility tests", function () {
|
|
51
|
-
beforeAll(function () {
|
|
52
|
-
Object.defineProperty(window, "matchMedia", {
|
|
53
|
-
writable: true,
|
|
54
|
-
value: jest.fn().mockImplementation(function () {
|
|
55
|
-
return {
|
|
56
|
-
matches: false
|
|
57
|
-
};
|
|
58
|
-
})
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
62
|
-
var _render, container, results;
|
|
63
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
64
|
-
while (1) switch (_context.prev = _context.next) {
|
|
65
|
-
case 0:
|
|
66
|
-
_render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Header["default"], {
|
|
67
|
-
content: /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
68
|
-
alignItems: "center",
|
|
69
|
-
gap: "4rem"
|
|
70
|
-
}, /*#__PURE__*/_react["default"].createElement(_Link["default"], null, "Link 1"), /*#__PURE__*/_react["default"].createElement(_Link["default"], null, "Link 2"), /*#__PURE__*/_react["default"].createElement(_Link["default"], null, "Link 3"), /*#__PURE__*/_react["default"].createElement(_Header["default"].Dropdown, {
|
|
71
|
-
options: options,
|
|
72
|
-
label: "dropdown-test",
|
|
73
|
-
icon: iconSVG,
|
|
74
|
-
iconPosition: "after",
|
|
75
|
-
margin: "medium",
|
|
76
|
-
size: "medium",
|
|
77
|
-
optionsIconPosition: "after"
|
|
78
|
-
})),
|
|
79
|
-
margin: "medium",
|
|
80
|
-
underlined: true
|
|
81
|
-
})), container = _render.container;
|
|
82
|
-
_context.next = 3;
|
|
83
|
-
return (0, _axeHelper.axe)(container, disabledRules);
|
|
84
|
-
case 3:
|
|
85
|
-
results = _context.sent;
|
|
86
|
-
expect(results).toHaveNoViolations();
|
|
87
|
-
case 5:
|
|
88
|
-
case "end":
|
|
89
|
-
return _context.stop();
|
|
90
|
-
}
|
|
91
|
-
}, _callee);
|
|
92
|
-
})));
|
|
93
|
-
});
|
package/header/Header.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import DxcDropdown from "../dropdown/Dropdown";
|
|
3
|
-
import HeaderPropsType from "./types";
|
|
4
|
-
declare const DxcHeader: {
|
|
5
|
-
({ underlined, content, responsiveContent, onClick, margin, tabIndex, }: HeaderPropsType): JSX.Element;
|
|
6
|
-
Dropdown: (props: React.ComponentProps<typeof DxcDropdown>) => React.JSX.Element;
|
|
7
|
-
};
|
|
8
|
-
export default DxcHeader;
|
package/header/Header.js
DELETED
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
13
|
-
var _Dropdown = _interopRequireDefault(require("../dropdown/Dropdown"));
|
|
14
|
-
var _Icons = require("./Icons");
|
|
15
|
-
var _variables = require("../common/variables");
|
|
16
|
-
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
17
|
-
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
18
|
-
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
19
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15;
|
|
20
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
21
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
22
|
-
var Dropdown = function Dropdown(props) {
|
|
23
|
-
return /*#__PURE__*/_react["default"].createElement(HeaderDropdown, null, /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], props));
|
|
24
|
-
};
|
|
25
|
-
var HeaderDropdown = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n button {\n background-color: transparent;\n :hover {\n background-color: transparent;\n }\n }\n"])));
|
|
26
|
-
var getLogoElement = function getLogoElement(themeInput, logoLabel) {
|
|
27
|
-
if (!themeInput) return _Icons.dxcLogo;else if (typeof themeInput === "string") return /*#__PURE__*/_react["default"].createElement(LogoImg, {
|
|
28
|
-
alt: logoLabel,
|
|
29
|
-
src: themeInput
|
|
30
|
-
});else return themeInput;
|
|
31
|
-
};
|
|
32
|
-
var Content = function Content(_ref) {
|
|
33
|
-
var isResponsive = _ref.isResponsive,
|
|
34
|
-
responsiveContent = _ref.responsiveContent,
|
|
35
|
-
handleMenu = _ref.handleMenu,
|
|
36
|
-
content = _ref.content;
|
|
37
|
-
return isResponsive ? /*#__PURE__*/_react["default"].createElement(MenuContent, null, responsiveContent(handleMenu)) : /*#__PURE__*/_react["default"].createElement(ContentContainer, null, content);
|
|
38
|
-
};
|
|
39
|
-
var DxcHeader = function DxcHeader(_ref2) {
|
|
40
|
-
var _ref2$underlined = _ref2.underlined,
|
|
41
|
-
underlined = _ref2$underlined === void 0 ? false : _ref2$underlined,
|
|
42
|
-
content = _ref2.content,
|
|
43
|
-
responsiveContent = _ref2.responsiveContent,
|
|
44
|
-
onClick = _ref2.onClick,
|
|
45
|
-
margin = _ref2.margin,
|
|
46
|
-
_ref2$tabIndex = _ref2.tabIndex,
|
|
47
|
-
tabIndex = _ref2$tabIndex === void 0 ? 0 : _ref2$tabIndex;
|
|
48
|
-
var colorsTheme = (0, _useTheme["default"])();
|
|
49
|
-
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
50
|
-
var ref = (0, _react.useRef)(null);
|
|
51
|
-
var _useState = (0, _react.useState)(false),
|
|
52
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
53
|
-
isResponsive = _useState2[0],
|
|
54
|
-
setIsResponsive = _useState2[1];
|
|
55
|
-
var _useState3 = (0, _react.useState)(false),
|
|
56
|
-
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
57
|
-
isMenuVisible = _useState4[0],
|
|
58
|
-
setIsMenuVisible = _useState4[1];
|
|
59
|
-
var handleResize = (0, _react.useCallback)(function () {
|
|
60
|
-
setIsResponsive(window.matchMedia("(max-width: ".concat(_variables.responsiveSizes.medium, "rem)")).matches);
|
|
61
|
-
}, []);
|
|
62
|
-
var handleMenu = function handleMenu() {
|
|
63
|
-
if (isResponsive && !isMenuVisible) {
|
|
64
|
-
setIsMenuVisible(!isMenuVisible);
|
|
65
|
-
} else {
|
|
66
|
-
setIsMenuVisible(!isMenuVisible);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
var headerLogo = (0, _react.useMemo)(function () {
|
|
70
|
-
return getLogoElement(colorsTheme.header.logo, translatedLabels.formFields.logoAlternativeText);
|
|
71
|
-
}, [colorsTheme.header.logo]);
|
|
72
|
-
var headerResponsiveLogo = (0, _react.useMemo)(function () {
|
|
73
|
-
return getLogoElement(colorsTheme.header.logoResponsive, translatedLabels.formFields.logoAlternativeText);
|
|
74
|
-
}, [colorsTheme.header.logoResponsive]);
|
|
75
|
-
(0, _react.useEffect)(function () {
|
|
76
|
-
handleResize();
|
|
77
|
-
window.addEventListener("resize", handleResize);
|
|
78
|
-
return function () {
|
|
79
|
-
window.removeEventListener("resize", handleResize);
|
|
80
|
-
};
|
|
81
|
-
}, [handleResize]);
|
|
82
|
-
(0, _react.useEffect)(function () {
|
|
83
|
-
!isResponsive && setIsMenuVisible(false);
|
|
84
|
-
}, [isResponsive]);
|
|
85
|
-
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
86
|
-
theme: colorsTheme.header
|
|
87
|
-
}, /*#__PURE__*/_react["default"].createElement(HeaderContainer, {
|
|
88
|
-
underlined: underlined,
|
|
89
|
-
margin: margin,
|
|
90
|
-
ref: ref
|
|
91
|
-
}, /*#__PURE__*/_react["default"].createElement(LogoAnchor, {
|
|
92
|
-
tabIndex: onClick ? tabIndex : -1,
|
|
93
|
-
interactuable: onClick ? true : false,
|
|
94
|
-
onClick: onClick
|
|
95
|
-
}, /*#__PURE__*/_react["default"].createElement(LogoContainer, null, headerLogo)), isResponsive && responsiveContent && /*#__PURE__*/_react["default"].createElement(MainContainer, null, /*#__PURE__*/_react["default"].createElement(ChildContainer, null, /*#__PURE__*/_react["default"].createElement(HamburguerTrigger, {
|
|
96
|
-
tabIndex: tabIndex,
|
|
97
|
-
onClick: handleMenu,
|
|
98
|
-
"aria-label": "Show options"
|
|
99
|
-
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
100
|
-
icon: "menu"
|
|
101
|
-
}), translatedLabels.header.hamburguerTitle)), /*#__PURE__*/_react["default"].createElement(ResponsiveMenu, {
|
|
102
|
-
hasVisibility: isMenuVisible
|
|
103
|
-
}, /*#__PURE__*/_react["default"].createElement(ResponsiveIconsContainer, null, /*#__PURE__*/_react["default"].createElement(ResponsiveLogoContainer, null, headerResponsiveLogo), /*#__PURE__*/_react["default"].createElement(CloseAction, {
|
|
104
|
-
tabIndex: tabIndex,
|
|
105
|
-
onClick: handleMenu,
|
|
106
|
-
"aria-label": translatedLabels.header.closeIcon,
|
|
107
|
-
title: translatedLabels.header.closeIcon
|
|
108
|
-
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
109
|
-
icon: "close"
|
|
110
|
-
}))), /*#__PURE__*/_react["default"].createElement(Content, {
|
|
111
|
-
isResponsive: isResponsive,
|
|
112
|
-
responsiveContent: responsiveContent,
|
|
113
|
-
handleMenu: handleMenu,
|
|
114
|
-
content: content
|
|
115
|
-
})), /*#__PURE__*/_react["default"].createElement(Overlay, {
|
|
116
|
-
onClick: handleMenu,
|
|
117
|
-
hasVisibility: isMenuVisible
|
|
118
|
-
})), !isResponsive && /*#__PURE__*/_react["default"].createElement(Content, {
|
|
119
|
-
isResponsive: isResponsive,
|
|
120
|
-
responsiveContent: responsiveContent,
|
|
121
|
-
handleMenu: handleMenu,
|
|
122
|
-
content: content
|
|
123
|
-
})));
|
|
124
|
-
};
|
|
125
|
-
DxcHeader.Dropdown = Dropdown;
|
|
126
|
-
var HeaderContainer = _styledComponents["default"].header(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n min-height: ", ";\n margin-bottom: ", ";\n padding: ", ";\n background-color: ", ";\n border-bottom: ", ";\n"])), function (props) {
|
|
127
|
-
return props.theme.minHeight;
|
|
128
|
-
}, function (props) {
|
|
129
|
-
return props.margin ? _variables.spaces[props.margin] : "0px";
|
|
130
|
-
}, function (props) {
|
|
131
|
-
return "".concat(props.theme.paddingTop, " ").concat(props.theme.paddingRight, " ").concat(props.theme.paddingBottom, " ").concat(props.theme.paddingLeft);
|
|
132
|
-
}, function (props) {
|
|
133
|
-
return props.theme.backgroundColor;
|
|
134
|
-
}, function (props) {
|
|
135
|
-
return props.underlined && "".concat(props.theme.underlinedThickness, " ").concat(props.theme.underlinedStyle, " ").concat(props.theme.underlinedColor);
|
|
136
|
-
});
|
|
137
|
-
var LogoAnchor = _styledComponents["default"].a(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n ", ";\n"])), function (props) {
|
|
138
|
-
return props.interactuable ? "cursor: pointer" : "cursor: default; outline:none;";
|
|
139
|
-
});
|
|
140
|
-
var LogoImg = _styledComponents["default"].img(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: ", ";\n width: ", ";\n"])), function (props) {
|
|
141
|
-
return props.theme.logoHeight;
|
|
142
|
-
}, function (props) {
|
|
143
|
-
return props.theme.logoWidth;
|
|
144
|
-
});
|
|
145
|
-
var LogoContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: ", ";\n width: ", ";\n vertical-align: middle;\n"])), function (props) {
|
|
146
|
-
return props.theme.logoHeight;
|
|
147
|
-
}, function (props) {
|
|
148
|
-
return props.theme.logoWidth;
|
|
149
|
-
});
|
|
150
|
-
var ChildContainer = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: flex-end;\n flex-grow: 1;\n width: calc(100% - 186px);\n"])));
|
|
151
|
-
var ContentContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n flex-grow: 1;\n justify-content: flex-end;\n width: calc(100% - 186px);\n color: ", ";\n"])), function (props) {
|
|
152
|
-
return props.theme.contentColor;
|
|
153
|
-
});
|
|
154
|
-
var HamburguerTrigger = _styledComponents["default"].button(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 54px;\n cursor: pointer;\n border: 1px solid transparent;\n border-radius: 2px;\n background-color: transparent;\n :hover {\n background-color: ", ";\n }\n &:focus {\n outline: ", " auto 1px;\n }\n & > svg {\n fill: ", ";\n }\n & > span {\n font-size: 24px;\n }\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n text-transform: ", ";\n font-weight: ", ";\n color: ", ";\n"])), function (props) {
|
|
155
|
-
return props.theme.hamburguerHoverColor;
|
|
156
|
-
}, function (props) {
|
|
157
|
-
return props.theme.hamburguerFocusColor;
|
|
158
|
-
}, function (props) {
|
|
159
|
-
return props.theme.hamburguerIconColor;
|
|
160
|
-
}, function (props) {
|
|
161
|
-
return props.theme.hamburguerFontFamily;
|
|
162
|
-
}, function (props) {
|
|
163
|
-
return props.theme.hamburguerFontStyle;
|
|
164
|
-
}, function (props) {
|
|
165
|
-
return props.theme.hamburguerFontSize;
|
|
166
|
-
}, function (props) {
|
|
167
|
-
return props.theme.hamburguerTextTransform;
|
|
168
|
-
}, function (props) {
|
|
169
|
-
return props.theme.hamburguerFontWeight;
|
|
170
|
-
}, function (props) {
|
|
171
|
-
return props.theme.hamburguerFontColor;
|
|
172
|
-
});
|
|
173
|
-
var MainContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-grow: 1;\n"])));
|
|
174
|
-
var ResponsiveMenu = _styledComponents["default"].div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n background-color: ", ";\n position: fixed;\n top: 0;\n right: 0;\n z-index: ", ";\n\n @media (max-width: ", "rem) and (min-width: ", "rem) {\n width: ", ";\n }\n\n @media (not((max-width: ", "rem) and (min-width: ", "rem))) {\n width: ", ";\n }\n\n height: 100vh;\n padding: 20px;\n transform: ", ";\n opacity: ", ";\n transition-property: transform, opacity;\n transition-duration: 0.6s;\n transition-timing-function: ease-in-out;\n box-sizing: border-box;\n"])), function (props) {
|
|
175
|
-
return props.theme.menuBackgroundColor;
|
|
176
|
-
}, function (props) {
|
|
177
|
-
return props.theme.menuZindex;
|
|
178
|
-
}, _variables.responsiveSizes.large, _variables.responsiveSizes.small, function (props) {
|
|
179
|
-
return props.theme.menuTabletWidth;
|
|
180
|
-
}, _variables.responsiveSizes.large, _variables.responsiveSizes.small, function (props) {
|
|
181
|
-
return props.theme.menuMobileWidth;
|
|
182
|
-
}, function (props) {
|
|
183
|
-
return props.hasVisibility ? "translateX(0)" : "translateX(100vw)";
|
|
184
|
-
}, function (props) {
|
|
185
|
-
return props.hasVisibility ? "1" : "0.96";
|
|
186
|
-
});
|
|
187
|
-
var ResponsiveLogoContainer = _styledComponents["default"].div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: ", ";\n width: ", ";\n display: flex;\n"])), function (props) {
|
|
188
|
-
return props.theme.logoHeight;
|
|
189
|
-
}, function (props) {
|
|
190
|
-
return props.theme.logoWidth;
|
|
191
|
-
});
|
|
192
|
-
var ResponsiveIconsContainer = _styledComponents["default"].div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n"])));
|
|
193
|
-
var CloseAction = _styledComponents["default"].button(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: center;\n align-content: center;\n padding: 6px;\n border: unset;\n border-radius: 2px;\n background-color: transparent;\n cursor: pointer;\n\n :focus,\n :focus-visible {\n outline: ", " auto 1px;\n }\n font-size: 24px;\n svg {\n height: 24px;\n width: 24px;\n }\n"])), function (props) {
|
|
194
|
-
return props.theme.hamburguerFocusColor;
|
|
195
|
-
});
|
|
196
|
-
var MenuContent = _styledComponents["default"].div(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n height: 100%;\n color: ", ";\n"])), function (props) {
|
|
197
|
-
return props.theme.contentColor;
|
|
198
|
-
});
|
|
199
|
-
var Overlay = _styledComponents["default"].div(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background-color: ", ";\n opacity: ", " !important;\n visibility: ", ";\n opacity: ", ";\n\n @media (max-width: ", "rem) {\n display: none;\n }\n\n transition: opacity 0.2s 0.2s ease-in-out;\n z-index: ", ";\n"])), function (props) {
|
|
200
|
-
return props.theme.overlayColor;
|
|
201
|
-
}, function (props) {
|
|
202
|
-
return props.theme.overlayOpacity;
|
|
203
|
-
}, function (props) {
|
|
204
|
-
return props.hasVisibility ? "visible" : "hidden";
|
|
205
|
-
}, function (props) {
|
|
206
|
-
return props.hasVisibility ? "1" : "0";
|
|
207
|
-
}, _variables.responsiveSizes.small, function (props) {
|
|
208
|
-
return props.theme.overlayZindex;
|
|
209
|
-
});
|
|
210
|
-
var _default = exports["default"] = DxcHeader;
|