@dxc-technology/halstack-react 0.0.0-f2bad31 → 0.0.0-f319e71
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.js +1 -1
- package/HalstackContext.d.ts +2 -5
- package/HalstackContext.js +6 -6
- package/accordion/Accordion.accessibility.test.d.ts +1 -0
- package/accordion/Accordion.accessibility.test.js +4 -4
- package/accordion/Accordion.js +9 -10
- package/accordion/Accordion.stories.tsx +4 -14
- package/accordion/Accordion.test.d.ts +1 -0
- package/accordion/Accordion.test.js +3 -3
- package/accordion-group/AccordionGroup.accessibility.test.d.ts +1 -0
- package/accordion-group/AccordionGroup.accessibility.test.js +11 -17
- package/accordion-group/AccordionGroup.js +1 -1
- package/accordion-group/AccordionGroup.stories.tsx +23 -23
- package/accordion-group/AccordionGroup.test.d.ts +1 -0
- package/accordion-group/AccordionGroup.test.js +5 -9
- package/accordion-group/AccordionGroupAccordion.js +1 -1
- package/action-icon/ActionIcon.accessibility.test.d.ts +1 -0
- package/action-icon/ActionIcon.accessibility.test.js +4 -4
- package/action-icon/ActionIcon.test.d.ts +1 -0
- package/action-icon/ActionIcon.test.js +1 -1
- package/alert/Alert.accessibility.test.d.ts +1 -0
- package/alert/Alert.accessibility.test.js +6 -6
- package/alert/Alert.js +6 -3
- package/alert/Alert.test.d.ts +1 -0
- package/alert/Alert.test.js +1 -1
- package/badge/Badge.accessibility.test.d.ts +1 -0
- package/badge/Badge.accessibility.test.js +5 -5
- package/badge/Badge.js +6 -4
- package/badge/Badge.stories.tsx +11 -11
- package/badge/Badge.test.d.ts +1 -0
- package/badge/Badge.test.js +2 -2
- package/badge/types.d.ts +1 -1
- package/box/Box.accessibility.test.d.ts +1 -0
- package/box/Box.accessibility.test.js +3 -3
- package/box/Box.js +1 -1
- package/box/Box.test.d.ts +1 -0
- package/box/Box.test.js +1 -1
- package/breadcrumbs/Breadcrumbs.accessibility.test.d.ts +1 -0
- package/breadcrumbs/Breadcrumbs.accessibility.test.js +96 -0
- package/breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/breadcrumbs/Breadcrumbs.js +79 -0
- package/breadcrumbs/Breadcrumbs.stories.tsx +194 -0
- package/breadcrumbs/Breadcrumbs.test.d.ts +1 -0
- package/breadcrumbs/Breadcrumbs.test.js +168 -0
- package/breadcrumbs/Item.d.ts +4 -0
- package/breadcrumbs/Item.js +52 -0
- package/breadcrumbs/dropdownTheme.d.ts +53 -0
- package/breadcrumbs/dropdownTheme.js +62 -0
- package/breadcrumbs/types.d.ts +16 -0
- package/breadcrumbs/types.js +5 -0
- package/bulleted-list/BulletedList.accessibility.test.d.ts +1 -0
- package/bulleted-list/BulletedList.accessibility.test.js +18 -6
- package/bulleted-list/BulletedList.js +2 -2
- package/button/Button.accessibility.test.d.ts +1 -0
- package/button/Button.accessibility.test.js +6 -6
- package/button/Button.js +1 -1
- package/button/Button.stories.tsx +3 -3
- package/button/Button.test.d.ts +1 -0
- package/button/Button.test.js +1 -1
- package/card/Card.accessibility.test.d.ts +1 -0
- package/card/Card.accessibility.test.js +3 -3
- package/card/Card.js +3 -2
- package/card/Card.stories.tsx +1 -1
- package/card/Card.test.d.ts +1 -0
- package/card/Card.test.js +1 -1
- package/checkbox/Checkbox.accessibility.test.d.ts +1 -0
- package/checkbox/Checkbox.accessibility.test.js +5 -5
- package/checkbox/Checkbox.js +10 -13
- package/checkbox/Checkbox.test.d.ts +1 -0
- package/checkbox/Checkbox.test.js +1 -1
- package/chip/Chip.accessibility.test.d.ts +1 -0
- package/chip/Chip.accessibility.test.js +4 -4
- package/chip/Chip.js +3 -1
- package/chip/Chip.stories.tsx +1 -1
- package/chip/Chip.test.d.ts +1 -0
- package/chip/Chip.test.js +1 -1
- package/common/coreTokens.js +3 -3
- package/common/variables.d.ts +2 -5
- package/common/variables.js +68 -71
- package/container/Container.stories.tsx +3 -3
- package/contextual-menu/ContextualMenu.accessibility.test.d.ts +1 -0
- package/contextual-menu/ContextualMenu.accessibility.test.js +15 -3
- package/contextual-menu/ContextualMenu.d.ts +3 -5
- package/contextual-menu/ContextualMenu.js +89 -52
- package/contextual-menu/ContextualMenu.stories.tsx +115 -74
- package/contextual-menu/ContextualMenu.test.d.ts +1 -0
- package/contextual-menu/ContextualMenu.test.js +200 -24
- package/contextual-menu/GroupItem.d.ts +4 -0
- package/contextual-menu/GroupItem.js +67 -0
- package/contextual-menu/ItemAction.d.ts +4 -0
- package/contextual-menu/ItemAction.js +50 -0
- package/contextual-menu/MenuItem.d.ts +4 -0
- package/contextual-menu/MenuItem.js +29 -0
- package/contextual-menu/SingleItem.d.ts +4 -0
- package/contextual-menu/SingleItem.js +38 -0
- package/contextual-menu/types.d.ts +50 -11
- package/date-input/Calendar.js +47 -31
- package/date-input/DateInput.accessibility.test.d.ts +1 -0
- package/date-input/DateInput.accessibility.test.js +24 -11
- package/date-input/DateInput.js +28 -23
- package/date-input/DateInput.stories.tsx +18 -12
- package/date-input/DateInput.test.d.ts +1 -0
- package/date-input/DateInput.test.js +39 -39
- package/date-input/DatePicker.js +13 -7
- package/date-input/YearPicker.js +10 -5
- package/dialog/Dialog.accessibility.test.d.ts +1 -0
- package/dialog/Dialog.accessibility.test.js +5 -5
- package/dialog/Dialog.js +9 -20
- package/dialog/Dialog.stories.tsx +8 -4
- package/dialog/Dialog.test.d.ts +1 -0
- package/dialog/Dialog.test.js +111 -48
- package/divider/Divider.accessibility.test.d.ts +1 -0
- package/divider/Divider.accessibility.test.js +2 -2
- package/divider/Divider.stories.tsx +2 -1
- package/divider/Divider.test.d.ts +1 -0
- package/dropdown/Dropdown.accessibility.test.d.ts +1 -0
- package/dropdown/Dropdown.accessibility.test.js +12 -9
- package/dropdown/Dropdown.js +16 -15
- package/dropdown/Dropdown.stories.tsx +11 -11
- package/dropdown/Dropdown.test.d.ts +1 -0
- package/dropdown/Dropdown.test.js +101 -72
- package/dropdown/DropdownMenu.js +4 -4
- package/dropdown/DropdownMenuItem.js +2 -1
- package/file-input/FileInput.accessibility.test.d.ts +1 -0
- package/file-input/FileInput.accessibility.test.js +30 -23
- package/file-input/FileInput.js +6 -47
- package/file-input/FileInput.test.d.ts +1 -0
- package/file-input/FileInput.test.js +51 -106
- package/file-input/FileItem.js +18 -28
- package/file-input/types.d.ts +0 -4
- package/footer/Footer.accessibility.test.d.ts +1 -0
- package/footer/Footer.accessibility.test.js +13 -5
- package/footer/Footer.js +8 -6
- package/footer/Footer.stories.tsx +39 -1
- package/footer/Footer.test.d.ts +1 -0
- package/footer/Footer.test.js +1 -1
- package/footer/Icons.js +2 -30
- package/footer/types.d.ts +1 -1
- package/grid/Grid.stories.tsx +3 -1
- package/header/Header.accessibility.test.d.ts +1 -0
- package/header/Header.accessibility.test.js +16 -6
- package/header/Header.js +12 -22
- package/header/Header.stories.tsx +17 -1
- package/header/Header.test.d.ts +1 -0
- package/header/Header.test.js +1 -1
- package/header/Icons.js +1 -6
- package/heading/Heading.accessibility.test.d.ts +1 -0
- package/heading/Heading.accessibility.test.js +3 -3
- package/heading/Heading.js +1 -1
- package/heading/Heading.test.d.ts +1 -0
- package/heading/Heading.test.js +1 -14
- package/icon/Icon.accessibility.test.d.ts +1 -0
- package/icon/Icon.accessibility.test.js +2 -2
- package/icon/Icon.js +1 -1
- package/icon/Icon.stories.tsx +1 -1
- package/image/Image.accessibility.test.d.ts +1 -0
- package/image/Image.accessibility.test.js +3 -3
- package/image/Image.js +1 -1
- package/layout/ApplicationLayout.js +9 -6
- package/layout/Icons.d.ts +0 -1
- package/layout/Icons.js +1 -9
- package/link/Link.accessibility.test.d.ts +1 -0
- package/link/Link.accessibility.test.js +8 -12
- package/link/Link.js +8 -6
- package/link/Link.stories.tsx +4 -4
- package/link/Link.test.d.ts +1 -0
- package/link/Link.test.js +1 -1
- package/link/types.d.ts +1 -1
- package/main.d.ts +2 -1
- package/main.js +8 -1
- package/nav-tabs/NavTabs.accessibility.test.d.ts +1 -0
- package/nav-tabs/NavTabs.accessibility.test.js +8 -16
- package/nav-tabs/NavTabs.js +19 -4
- package/nav-tabs/NavTabs.stories.tsx +41 -23
- package/nav-tabs/NavTabs.test.d.ts +1 -0
- package/nav-tabs/NavTabs.test.js +10 -9
- package/nav-tabs/Tab.js +17 -18
- package/nav-tabs/types.d.ts +1 -1
- package/number-input/NumberInput.accessibility.test.d.ts +1 -0
- package/number-input/NumberInput.accessibility.test.js +9 -10
- package/number-input/NumberInput.js +6 -3
- package/number-input/NumberInput.stories.tsx +11 -16
- package/number-input/NumberInput.test.d.ts +1 -0
- package/number-input/NumberInput.test.js +6 -7
- package/package.json +25 -20
- package/paginator/Paginator.accessibility.test.d.ts +1 -0
- package/paginator/Paginator.accessibility.test.js +4 -5
- package/paginator/Paginator.js +13 -10
- package/paginator/Paginator.test.d.ts +1 -0
- package/paginator/Paginator.test.js +2 -3
- package/paragraph/Paragraph.accessibility.test.d.ts +1 -0
- package/paragraph/Paragraph.accessibility.test.js +2 -2
- package/password-input/PasswordInput.accessibility.test.d.ts +1 -0
- package/password-input/PasswordInput.accessibility.test.js +7 -8
- package/password-input/PasswordInput.js +11 -8
- package/password-input/PasswordInput.stories.tsx +10 -1
- package/password-input/PasswordInput.test.d.ts +1 -0
- package/password-input/PasswordInput.test.js +6 -7
- package/progress-bar/ProgressBar.accessibility.test.d.ts +1 -0
- package/progress-bar/ProgressBar.accessibility.test.js +3 -3
- package/progress-bar/ProgressBar.js +6 -4
- package/progress-bar/ProgressBar.test.d.ts +1 -0
- package/progress-bar/ProgressBar.test.js +1 -1
- package/quick-nav/QuickNav.accessibility.test.d.ts +1 -0
- package/quick-nav/QuickNav.accessibility.test.js +2 -2
- package/quick-nav/QuickNav.js +1 -1
- package/radio-group/Radio.js +6 -9
- package/radio-group/RadioGroup.accessibility.test.d.ts +1 -0
- package/radio-group/RadioGroup.accessibility.test.js +4 -4
- package/radio-group/RadioGroup.js +14 -16
- package/radio-group/RadioGroup.test.d.ts +1 -0
- package/radio-group/RadioGroup.test.js +3 -5
- package/resultset-table/ResultsetTable.accessibility.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.accessibility.test.js +16 -6
- package/resultset-table/ResultsetTable.js +36 -11
- package/resultset-table/ResultsetTable.stories.tsx +14 -2
- package/resultset-table/ResultsetTable.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.test.js +103 -34
- package/select/Listbox.js +24 -16
- package/select/Option.js +12 -10
- package/select/Select.accessibility.test.d.ts +1 -0
- package/select/Select.accessibility.test.js +18 -8
- package/select/Select.js +41 -29
- package/select/Select.stories.tsx +69 -111
- package/select/Select.test.d.ts +1 -0
- package/select/Select.test.js +371 -474
- package/select/types.d.ts +1 -1
- package/sidenav/Sidenav.accessibility.test.d.ts +1 -0
- package/sidenav/Sidenav.accessibility.test.js +3 -3
- package/sidenav/Sidenav.js +16 -12
- package/sidenav/Sidenav.stories.tsx +5 -9
- package/sidenav/Sidenav.test.d.ts +1 -0
- package/sidenav/Sidenav.test.js +1 -1
- package/sidenav/types.d.ts +2 -2
- package/slider/Slider.accessibility.test.d.ts +1 -0
- package/slider/Slider.accessibility.test.js +5 -6
- package/slider/Slider.js +11 -13
- package/slider/Slider.stories.tsx +180 -0
- package/slider/Slider.test.d.ts +1 -0
- package/slider/Slider.test.js +13 -11
- package/spinner/Spinner.accessibility.test.d.ts +1 -0
- package/spinner/Spinner.accessibility.test.js +6 -6
- package/spinner/Spinner.js +6 -2
- package/spinner/Spinner.test.d.ts +1 -0
- package/spinner/Spinner.test.js +1 -1
- package/status-light/StatusLight.accessibility.test.d.ts +1 -0
- package/status-light/StatusLight.accessibility.test.js +8 -8
- package/status-light/StatusLight.test.d.ts +1 -0
- package/status-light/StatusLight.test.js +1 -1
- package/switch/Switch.accessibility.test.d.ts +1 -0
- package/switch/Switch.accessibility.test.js +14 -5
- package/switch/Switch.js +6 -9
- package/switch/Switch.stories.tsx +12 -0
- package/switch/Switch.test.d.ts +1 -0
- package/switch/Switch.test.js +1 -1
- package/table/Table.accessibility.test.d.ts +1 -0
- package/table/Table.accessibility.test.js +16 -6
- package/table/Table.js +1 -1
- package/table/Table.stories.tsx +13 -1
- package/table/Table.test.d.ts +1 -0
- package/table/Table.test.js +2 -4
- package/tabs/Tab.js +6 -5
- package/tabs/Tabs.accessibility.test.d.ts +1 -0
- package/tabs/Tabs.accessibility.test.js +3 -3
- package/tabs/Tabs.js +9 -20
- package/tabs/Tabs.stories.tsx +7 -3
- package/tabs/Tabs.test.d.ts +1 -0
- package/tabs/Tabs.test.js +20 -38
- package/tabs/types.d.ts +2 -2
- package/tag/Tag.accessibility.test.d.ts +1 -0
- package/tag/Tag.accessibility.test.js +4 -4
- package/tag/Tag.js +7 -7
- package/tag/Tag.stories.tsx +5 -8
- package/tag/Tag.test.d.ts +1 -0
- package/tag/Tag.test.js +5 -13
- package/tag/types.d.ts +2 -2
- package/text-input/Suggestion.js +1 -1
- package/text-input/Suggestions.js +14 -6
- package/text-input/TextInput.accessibility.test.d.ts +1 -0
- package/text-input/TextInput.accessibility.test.js +11 -12
- package/text-input/TextInput.js +29 -25
- package/text-input/TextInput.stories.tsx +19 -7
- package/text-input/TextInput.test.d.ts +1 -0
- package/text-input/TextInput.test.js +2 -3
- package/textarea/Textarea.accessibility.test.d.ts +1 -0
- package/textarea/Textarea.accessibility.test.js +7 -7
- package/textarea/Textarea.js +14 -13
- package/textarea/Textarea.test.d.ts +1 -0
- package/textarea/Textarea.test.js +1 -1
- package/toggle-group/ToggleGroup.accessibility.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.accessibility.test.js +5 -5
- package/toggle-group/ToggleGroup.js +10 -12
- package/toggle-group/ToggleGroup.stories.tsx +4 -4
- package/toggle-group/ToggleGroup.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.test.js +1 -1
- package/toggle-group/types.d.ts +2 -2
- package/tooltip/Tooltip.accessibility.test.d.ts +1 -0
- package/tooltip/Tooltip.accessibility.test.js +144 -0
- package/tooltip/Tooltip.d.ts +4 -0
- package/tooltip/Tooltip.js +50 -0
- package/tooltip/Tooltip.stories.tsx +111 -0
- package/tooltip/Tooltip.test.d.ts +1 -0
- package/tooltip/Tooltip.test.js +112 -0
- package/tooltip/types.d.ts +16 -0
- package/tooltip/types.js +5 -0
- package/typography/Typography.accessibility.test.d.ts +1 -0
- package/typography/Typography.accessibility.test.js +12 -12
- package/typography/Typography.stories.tsx +1 -3
- package/useTheme.d.ts +2 -5
- package/utils/BaseTypography.js +1 -1
- package/utils/FocusLock.js +3 -2
- package/wizard/Wizard.accessibility.test.d.ts +1 -0
- package/wizard/Wizard.accessibility.test.js +3 -3
- package/wizard/Wizard.js +14 -25
- package/wizard/Wizard.stories.tsx +20 -1
- package/wizard/Wizard.test.d.ts +1 -0
- package/wizard/Wizard.test.js +1 -1
- package/wizard/types.d.ts +1 -1
- package/contextual-menu/MenuItemAction.d.ts +0 -4
- package/contextual-menu/MenuItemAction.js +0 -46
- package/date-input/Icons.d.ts +0 -6
- package/date-input/Icons.js +0 -58
- package/paginator/Icons.d.ts +0 -5
- package/paginator/Icons.js +0 -40
- package/password-input/Icons.d.ts +0 -6
- package/password-input/Icons.js +0 -35
- package/select/Icons.d.ts +0 -10
- package/select/Icons.js +0 -89
- package/sidenav/Icons.d.ts +0 -7
- package/sidenav/Icons.js +0 -47
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import DxcNavTabs from "./NavTabs";
|
|
3
|
+
import DxcContainer from "../container/Container";
|
|
3
4
|
import Title from "../../.storybook/components/Title";
|
|
4
5
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
6
|
import { HalstackProvider } from "../HalstackContext";
|
|
@@ -16,7 +17,9 @@ const iconSVG = (
|
|
|
16
17
|
</svg>
|
|
17
18
|
);
|
|
18
19
|
|
|
19
|
-
const
|
|
20
|
+
const favoriteIcon = "filled_Favorite";
|
|
21
|
+
|
|
22
|
+
const pinIcon = "Location_On";
|
|
20
23
|
|
|
21
24
|
const opinionatedTheme = {
|
|
22
25
|
navTabs: {
|
|
@@ -105,10 +108,10 @@ export const Chromatic = () => (
|
|
|
105
108
|
<DxcNavTabs.Tab href="#" disabled icon={iconSVG}>
|
|
106
109
|
Tab 2
|
|
107
110
|
</DxcNavTabs.Tab>
|
|
108
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
111
|
+
<DxcNavTabs.Tab href="#" icon={pinIcon}>
|
|
109
112
|
Tab 3
|
|
110
113
|
</DxcNavTabs.Tab>
|
|
111
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
114
|
+
<DxcNavTabs.Tab href="#" icon={pinIcon}>
|
|
112
115
|
Tab 4
|
|
113
116
|
</DxcNavTabs.Tab>
|
|
114
117
|
</DxcNavTabs>
|
|
@@ -116,16 +119,16 @@ export const Chromatic = () => (
|
|
|
116
119
|
<ExampleContainer>
|
|
117
120
|
<Title title="With icon position left" theme="light" level={4} />
|
|
118
121
|
<DxcNavTabs iconPosition="left">
|
|
119
|
-
<DxcNavTabs.Tab href="#" active icon={
|
|
122
|
+
<DxcNavTabs.Tab href="#" active icon={pinIcon}>
|
|
120
123
|
Tab 1
|
|
121
124
|
</DxcNavTabs.Tab>
|
|
122
|
-
<DxcNavTabs.Tab href="#" disabled icon={
|
|
125
|
+
<DxcNavTabs.Tab href="#" disabled icon={favoriteIcon}>
|
|
123
126
|
Tab 2
|
|
124
127
|
</DxcNavTabs.Tab>
|
|
125
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
128
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon}>
|
|
126
129
|
Tab 3
|
|
127
130
|
</DxcNavTabs.Tab>
|
|
128
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
131
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon}>
|
|
129
132
|
Tab 4
|
|
130
133
|
</DxcNavTabs.Tab>
|
|
131
134
|
</DxcNavTabs>
|
|
@@ -133,16 +136,16 @@ export const Chromatic = () => (
|
|
|
133
136
|
<ExampleContainer>
|
|
134
137
|
<Title title="With icon and notification number" theme="light" level={4} />
|
|
135
138
|
<DxcNavTabs>
|
|
136
|
-
<DxcNavTabs.Tab href="#" active icon={
|
|
139
|
+
<DxcNavTabs.Tab href="#" active icon={pinIcon} notificationNumber>
|
|
137
140
|
Tab 1
|
|
138
141
|
</DxcNavTabs.Tab>
|
|
139
|
-
<DxcNavTabs.Tab href="#" disabled icon={
|
|
142
|
+
<DxcNavTabs.Tab href="#" disabled icon={favoriteIcon} notificationNumber={5}>
|
|
140
143
|
Tab 2
|
|
141
144
|
</DxcNavTabs.Tab>
|
|
142
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
145
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon} notificationNumber={120}>
|
|
143
146
|
Tab 3
|
|
144
147
|
</DxcNavTabs.Tab>
|
|
145
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
148
|
+
<DxcNavTabs.Tab href="#" icon={pinIcon} notificationNumber={12}>
|
|
146
149
|
Tab 4
|
|
147
150
|
</DxcNavTabs.Tab>
|
|
148
151
|
</DxcNavTabs>
|
|
@@ -150,16 +153,16 @@ export const Chromatic = () => (
|
|
|
150
153
|
<ExampleContainer>
|
|
151
154
|
<Title title="With icon on the left and notification number" theme="light" level={4} />
|
|
152
155
|
<DxcNavTabs iconPosition="left">
|
|
153
|
-
<DxcNavTabs.Tab href="#" active icon={
|
|
156
|
+
<DxcNavTabs.Tab href="#" active icon={favoriteIcon} notificationNumber>
|
|
154
157
|
Tab 1
|
|
155
158
|
</DxcNavTabs.Tab>
|
|
156
|
-
<DxcNavTabs.Tab href="#" disabled icon={
|
|
159
|
+
<DxcNavTabs.Tab href="#" disabled icon={favoriteIcon} notificationNumber={5}>
|
|
157
160
|
Tab 2
|
|
158
161
|
</DxcNavTabs.Tab>
|
|
159
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
162
|
+
<DxcNavTabs.Tab href="#" icon={pinIcon} notificationNumber={120}>
|
|
160
163
|
Tab 3
|
|
161
164
|
</DxcNavTabs.Tab>
|
|
162
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
165
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon} notificationNumber={12}>
|
|
163
166
|
Tab 4
|
|
164
167
|
</DxcNavTabs.Tab>
|
|
165
168
|
</DxcNavTabs>
|
|
@@ -170,10 +173,10 @@ export const Chromatic = () => (
|
|
|
170
173
|
<DxcNavTabs.Tab href="#" active>
|
|
171
174
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
|
172
175
|
</DxcNavTabs.Tab>
|
|
173
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
176
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon} disabled notificationNumber={3}>
|
|
174
177
|
Tab 2
|
|
175
178
|
</DxcNavTabs.Tab>
|
|
176
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
179
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon}>
|
|
177
180
|
Tab 3
|
|
178
181
|
</DxcNavTabs.Tab>
|
|
179
182
|
</DxcNavTabs>
|
|
@@ -184,10 +187,10 @@ export const Chromatic = () => (
|
|
|
184
187
|
<DxcNavTabs.Tab href="#" active>
|
|
185
188
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
|
186
189
|
</DxcNavTabs.Tab>
|
|
187
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
190
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon} disabled notificationNumber={3}>
|
|
188
191
|
Tab 2
|
|
189
192
|
</DxcNavTabs.Tab>
|
|
190
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
193
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon}>
|
|
191
194
|
Tab 3
|
|
192
195
|
</DxcNavTabs.Tab>
|
|
193
196
|
</DxcNavTabs>
|
|
@@ -257,20 +260,35 @@ export const Chromatic = () => (
|
|
|
257
260
|
<Title title="With icon and notification number" theme="light" level={4} />
|
|
258
261
|
<HalstackProvider theme={opinionatedTheme}>
|
|
259
262
|
<DxcNavTabs>
|
|
260
|
-
<DxcNavTabs.Tab href="#" active icon={
|
|
263
|
+
<DxcNavTabs.Tab href="#" active icon={favoriteIcon} notificationNumber>
|
|
261
264
|
Tab 1
|
|
262
265
|
</DxcNavTabs.Tab>
|
|
263
|
-
<DxcNavTabs.Tab href="#" disabled icon={
|
|
266
|
+
<DxcNavTabs.Tab href="#" disabled icon={favoriteIcon} notificationNumber={5}>
|
|
264
267
|
Tab 2
|
|
265
268
|
</DxcNavTabs.Tab>
|
|
266
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
269
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon} notificationNumber={120}>
|
|
267
270
|
Tab 3
|
|
268
271
|
</DxcNavTabs.Tab>
|
|
269
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
272
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon} notificationNumber={12}>
|
|
270
273
|
Tab 4
|
|
271
274
|
</DxcNavTabs.Tab>
|
|
272
275
|
</DxcNavTabs>
|
|
273
276
|
</HalstackProvider>
|
|
274
277
|
</ExampleContainer>
|
|
278
|
+
<ExampleContainer>
|
|
279
|
+
<Title title="NavTabs in a limited space container" theme="light" level={4} />
|
|
280
|
+
<DxcContainer width="500px">
|
|
281
|
+
<DxcNavTabs>
|
|
282
|
+
<DxcNavTabs.Tab href="#" active>
|
|
283
|
+
Tab 1
|
|
284
|
+
</DxcNavTabs.Tab>
|
|
285
|
+
<DxcNavTabs.Tab href="#" disabled>
|
|
286
|
+
Tab 2
|
|
287
|
+
</DxcNavTabs.Tab>
|
|
288
|
+
<DxcNavTabs.Tab href="#">Tab 3</DxcNavTabs.Tab>
|
|
289
|
+
<DxcNavTabs.Tab href="#">Tab 4</DxcNavTabs.Tab>
|
|
290
|
+
</DxcNavTabs>
|
|
291
|
+
</DxcContainer>
|
|
292
|
+
</ExampleContainer>
|
|
275
293
|
</>
|
|
276
294
|
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/nav-tabs/NavTabs.test.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
var _react = _interopRequireDefault(require("react"));
|
|
5
5
|
var _react2 = require("@testing-library/react");
|
|
6
|
-
var _NavTabs = _interopRequireDefault(require("./NavTabs
|
|
6
|
+
var _NavTabs = _interopRequireDefault(require("./NavTabs"));
|
|
7
7
|
describe("Tabs component tests", function () {
|
|
8
8
|
test("Tabs render with correct labels and attributes", function () {
|
|
9
9
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_NavTabs["default"], null, /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
@@ -27,12 +27,14 @@ describe("Tabs component tests", function () {
|
|
|
27
27
|
tabs.forEach(function (tab, index) {
|
|
28
28
|
expect(tab.getAttribute("aria-selected")).toBe((index === 0).toString());
|
|
29
29
|
});
|
|
30
|
-
var anchors = getAllByRole("
|
|
31
|
-
expect(anchors.length).toBe(
|
|
30
|
+
var anchors = getAllByRole("tab");
|
|
31
|
+
expect(anchors.length).toBe(3);
|
|
32
32
|
expect(anchors[0].getAttribute("href")).toBe("/test1");
|
|
33
|
-
expect(anchors[1].getAttribute("href")).
|
|
33
|
+
expect(anchors[1].getAttribute("href")).toBeFalsy();
|
|
34
|
+
expect(anchors[2].getAttribute("href")).toBe("/test3");
|
|
34
35
|
expect(anchors[0].getAttribute("tabindex")).toBe("0");
|
|
35
36
|
expect(anchors[1].getAttribute("tabindex")).toBe("-1");
|
|
37
|
+
expect(anchors[2].getAttribute("tabindex")).toBe("-1");
|
|
36
38
|
});
|
|
37
39
|
test("Tabs render with correct labels, badges and icons", function () {
|
|
38
40
|
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_NavTabs["default"], null, /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
@@ -46,15 +48,13 @@ describe("Tabs component tests", function () {
|
|
|
46
48
|
}, "Tab 2"), /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
47
49
|
href: "/test3",
|
|
48
50
|
notificationNumber: 1000,
|
|
49
|
-
icon: "
|
|
51
|
+
icon: "Settings"
|
|
50
52
|
}, "Tab 3"))),
|
|
51
53
|
getByText = _render2.getByText,
|
|
52
|
-
getByRole = _render2.getByRole,
|
|
53
54
|
queryByText = _render2.queryByText;
|
|
54
55
|
expect(getByText("10")).toBeTruthy();
|
|
55
56
|
expect(queryByText("20")).toBeFalsy();
|
|
56
57
|
expect(getByText("+99")).toBeTruthy();
|
|
57
|
-
expect(getByRole("img")).toBeTruthy();
|
|
58
58
|
});
|
|
59
59
|
test("Tabs render with correct tab index", function () {
|
|
60
60
|
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_NavTabs["default"], {
|
|
@@ -69,8 +69,9 @@ describe("Tabs component tests", function () {
|
|
|
69
69
|
active: true
|
|
70
70
|
}, "Tab 3"))),
|
|
71
71
|
getAllByRole = _render3.getAllByRole;
|
|
72
|
-
var tabs = getAllByRole("
|
|
72
|
+
var tabs = getAllByRole("tab");
|
|
73
73
|
expect(tabs[0].getAttribute("tabindex")).toBe("-1");
|
|
74
|
-
expect(tabs[1].getAttribute("tabindex")).toBe("
|
|
74
|
+
expect(tabs[1].getAttribute("tabindex")).toBe("-1");
|
|
75
|
+
expect(tabs[2].getAttribute("tabindex")).toBe("3");
|
|
75
76
|
});
|
|
76
77
|
});
|
package/nav-tabs/Tab.js
CHANGED
|
@@ -16,10 +16,11 @@ var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
|
16
16
|
var _BaseTypography = _interopRequireDefault(require("../utils/BaseTypography"));
|
|
17
17
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
18
18
|
var _NavTabsContext = require("./NavTabsContext");
|
|
19
|
+
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
19
20
|
var _templateObject, _templateObject2, _templateObject3;
|
|
20
21
|
var _excluded = ["href", "active", "icon", "disabled", "notificationNumber", "children"];
|
|
21
22
|
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); }
|
|
22
|
-
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 &&
|
|
23
|
+
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; }
|
|
23
24
|
var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
24
25
|
var href = _ref.href,
|
|
25
26
|
_ref$active = _ref.active,
|
|
@@ -52,10 +53,7 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
52
53
|
}
|
|
53
54
|
};
|
|
54
55
|
return /*#__PURE__*/_react["default"].createElement(TabContainer, {
|
|
55
|
-
active: active
|
|
56
|
-
role: "tab",
|
|
57
|
-
"aria-selected": active,
|
|
58
|
-
"aria-disabled": disabled
|
|
56
|
+
active: active
|
|
59
57
|
}, /*#__PURE__*/_react["default"].createElement(Tab, (0, _extends2["default"])({
|
|
60
58
|
href: !disabled ? href : undefined,
|
|
61
59
|
disabled: disabled,
|
|
@@ -69,11 +67,16 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
69
67
|
}
|
|
70
68
|
},
|
|
71
69
|
onKeyDown: handleOnKeyDown,
|
|
72
|
-
tabIndex: active ? tabIndex : -1
|
|
70
|
+
tabIndex: active ? tabIndex : -1,
|
|
71
|
+
role: "tab",
|
|
72
|
+
"aria-selected": active,
|
|
73
|
+
"aria-disabled": disabled
|
|
73
74
|
}, otherProps), icon && /*#__PURE__*/_react["default"].createElement(TabIconContainer, {
|
|
74
|
-
iconPosition: iconPosition
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
iconPosition: iconPosition,
|
|
76
|
+
active: active,
|
|
77
|
+
disabled: disabled
|
|
78
|
+
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
79
|
+
icon: icon
|
|
77
80
|
}) : icon), /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
78
81
|
alignItems: "center",
|
|
79
82
|
gap: "0.5rem"
|
|
@@ -92,14 +95,8 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
92
95
|
label: typeof notificationNumber === "number" && notificationNumber
|
|
93
96
|
}))));
|
|
94
97
|
});
|
|
95
|
-
var TabContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n align-items: stretch;\n border-bottom: 2px solid ", ";\n padding: 0.5rem;\n
|
|
96
|
-
return props.active ? props.theme.selectedUnderlineColor :
|
|
97
|
-
}, function (props) {
|
|
98
|
-
return props.theme.unselectedIconColor;
|
|
99
|
-
}, function (props) {
|
|
100
|
-
return props.theme.selectedIconColor;
|
|
101
|
-
}, function (props) {
|
|
102
|
-
return props.theme.disabledIconColor;
|
|
98
|
+
var TabContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n align-items: stretch;\n border-bottom: 2px solid ", ";\n padding: 0.5rem;\n"])), function (props) {
|
|
99
|
+
return props.active ? props.theme.selectedUnderlineColor : "transparent";
|
|
103
100
|
});
|
|
104
101
|
var Tab = _styledComponents["default"].a(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: ", ";\n justify-content: center;\n align-items: center;\n gap: ", ";\n height: ", ";\n min-width: 176px;\n min-height: 44px;\n padding: 0.375rem;\n border-radius: 4px;\n background: ", ";\n text-decoration-color: transparent;\n text-decoration-line: none;\n cursor: ", ";\n\n ", "\n"])), function (props) {
|
|
105
102
|
return props.hasIcon && props.iconPosition === "top" ? "column" : "row";
|
|
@@ -114,5 +111,7 @@ var Tab = _styledComponents["default"].a(_templateObject2 || (_templateObject2 =
|
|
|
114
111
|
}, function (props) {
|
|
115
112
|
return !props.disabled && "\n :hover {\n background: ".concat(props.theme.hoverBackgroundColor, ";\n }\n :focus {\n outline: 2px solid ").concat(props.theme.focusOutline, ";\n }\n :active {\n background: ").concat(props.theme.pressedBackgroundColor, ";\n outline: 2px solid #33aaff};\n }\n ");
|
|
116
113
|
});
|
|
117
|
-
var TabIconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n
|
|
114
|
+
var TabIconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n font-size: 24px;\n color: ", ";\n svg {\n height: 24px;\n width: 24px;\n }\n"])), function (props) {
|
|
115
|
+
return props.active ? props.theme.selectedIconColor : props.disabled ? props.theme.disabledIconColor : props.theme.unselectedIconColor;
|
|
116
|
+
});
|
|
118
117
|
var _default = exports["default"] = DxcTab;
|
package/nav-tabs/types.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -7,8 +7,8 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
7
7
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _react2 = require("@testing-library/react");
|
|
10
|
-
var
|
|
11
|
-
var _NumberInput = _interopRequireDefault(require("./NumberInput
|
|
10
|
+
var _axeHelper = require("../../test/accessibility/axe-helper.js");
|
|
11
|
+
var _NumberInput = _interopRequireDefault(require("./NumberInput"));
|
|
12
12
|
// Mocking DOMRect for Radix Primitive Popover
|
|
13
13
|
global.globalThis = global;
|
|
14
14
|
global.DOMRect = {
|
|
@@ -27,7 +27,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
27
27
|
function ResizeObserver() {
|
|
28
28
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
29
29
|
}
|
|
30
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
30
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
31
31
|
key: "observe",
|
|
32
32
|
value: function observe() {}
|
|
33
33
|
}, {
|
|
@@ -37,7 +37,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
37
37
|
key: "disconnect",
|
|
38
38
|
value: function disconnect() {}
|
|
39
39
|
}]);
|
|
40
|
-
return ResizeObserver;
|
|
41
40
|
}();
|
|
42
41
|
describe("Number input component accessibility tests", function () {
|
|
43
42
|
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
@@ -60,7 +59,7 @@ describe("Number input component accessibility tests", function () {
|
|
|
60
59
|
step: 1
|
|
61
60
|
})), container = _render.container;
|
|
62
61
|
_context.next = 3;
|
|
63
|
-
return (0,
|
|
62
|
+
return (0, _axeHelper.axe)(container);
|
|
64
63
|
case 3:
|
|
65
64
|
results = _context.sent;
|
|
66
65
|
expect(results).toHaveNoViolations();
|
|
@@ -91,7 +90,7 @@ describe("Number input component accessibility tests", function () {
|
|
|
91
90
|
optional: true
|
|
92
91
|
})), container = _render2.container;
|
|
93
92
|
_context2.next = 3;
|
|
94
|
-
return (0,
|
|
93
|
+
return (0, _axeHelper.axe)(container);
|
|
95
94
|
case 3:
|
|
96
95
|
results = _context2.sent;
|
|
97
96
|
expect(results).toHaveNoViolations();
|
|
@@ -122,7 +121,7 @@ describe("Number input component accessibility tests", function () {
|
|
|
122
121
|
step: 1
|
|
123
122
|
})), container = _render3.container;
|
|
124
123
|
_context3.next = 3;
|
|
125
|
-
return (0,
|
|
124
|
+
return (0, _axeHelper.axe)(container);
|
|
126
125
|
case 3:
|
|
127
126
|
results = _context3.sent;
|
|
128
127
|
expect(results).toHaveNoViolations();
|
|
@@ -153,7 +152,7 @@ describe("Number input component accessibility tests", function () {
|
|
|
153
152
|
disabled: true
|
|
154
153
|
})), container = _render4.container;
|
|
155
154
|
_context4.next = 3;
|
|
156
|
-
return (0,
|
|
155
|
+
return (0, _axeHelper.axe)(container);
|
|
157
156
|
case 3:
|
|
158
157
|
results = _context4.sent;
|
|
159
158
|
expect(results).toHaveNoViolations();
|
|
@@ -184,7 +183,7 @@ describe("Number input component accessibility tests", function () {
|
|
|
184
183
|
readOnly: true
|
|
185
184
|
})), container = _render5.container;
|
|
186
185
|
_context5.next = 3;
|
|
187
|
-
return (0,
|
|
186
|
+
return (0, _axeHelper.axe)(container);
|
|
188
187
|
case 3:
|
|
189
188
|
results = _context5.sent;
|
|
190
189
|
expect(results).toHaveNoViolations();
|
|
@@ -215,7 +214,7 @@ describe("Number input component accessibility tests", function () {
|
|
|
215
214
|
autocomplete: "on"
|
|
216
215
|
})), container = _render6.container;
|
|
217
216
|
_context6.next = 3;
|
|
218
|
-
return (0,
|
|
217
|
+
return (0, _axeHelper.axe)(container);
|
|
219
218
|
case 3:
|
|
220
219
|
results = _context6.sent;
|
|
221
220
|
expect(results).toHaveNoViolations();
|
|
@@ -13,7 +13,7 @@ var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
|
|
|
13
13
|
var _NumberInputContext = require("./NumberInputContext");
|
|
14
14
|
var _templateObject;
|
|
15
15
|
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); }
|
|
16
|
-
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 &&
|
|
16
|
+
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; }
|
|
17
17
|
var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
18
18
|
var label = _ref.label,
|
|
19
19
|
name = _ref.name,
|
|
@@ -59,7 +59,8 @@ var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, r
|
|
|
59
59
|
stepNumber: step
|
|
60
60
|
}
|
|
61
61
|
}, /*#__PURE__*/_react["default"].createElement(NumberInputContainer, {
|
|
62
|
-
ref: numberInputRef
|
|
62
|
+
ref: numberInputRef,
|
|
63
|
+
size: size
|
|
63
64
|
}, /*#__PURE__*/_react["default"].createElement(_TextInput["default"], {
|
|
64
65
|
label: label,
|
|
65
66
|
name: name,
|
|
@@ -82,5 +83,7 @@ var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, r
|
|
|
82
83
|
ref: ref
|
|
83
84
|
})));
|
|
84
85
|
});
|
|
85
|
-
var NumberInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n // Chrome, Safari, Edge, Opera\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n // Firefox\n input[type=\"number\"] {\n -moz-appearance: textfield;\n }\n"])))
|
|
86
|
+
var NumberInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n ", "\n // Chrome, Safari, Edge, Opera\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n // Firefox\n input[type=\"number\"] {\n -moz-appearance: textfield;\n }\n"])), function (props) {
|
|
87
|
+
return props.size == "fillParent" && "width: 100%;";
|
|
88
|
+
});
|
|
86
89
|
var _default = exports["default"] = DxcNumberInput;
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import Title from "../../.storybook/components/Title";
|
|
3
3
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
4
4
|
import DxcNumberInput from "./NumberInput";
|
|
5
|
+
import DxcFlex from "../flex/Flex";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: "Number Input",
|
|
@@ -32,25 +33,11 @@ export const Chromatic = () => (
|
|
|
32
33
|
</ExampleContainer>
|
|
33
34
|
<ExampleContainer>
|
|
34
35
|
<Title title="Read only" theme="light" level={4} />
|
|
35
|
-
<DxcNumberInput
|
|
36
|
-
label="Example label"
|
|
37
|
-
helperText="Help message"
|
|
38
|
-
readOnly
|
|
39
|
-
optional
|
|
40
|
-
prefix="€"
|
|
41
|
-
defaultValue="33"
|
|
42
|
-
/>
|
|
36
|
+
<DxcNumberInput label="Example label" helperText="Help message" readOnly optional prefix="€" defaultValue="33" />
|
|
43
37
|
</ExampleContainer>
|
|
44
38
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
45
39
|
<Title title="Hovered read only" theme="light" level={4} />
|
|
46
|
-
<DxcNumberInput
|
|
47
|
-
label="Example label"
|
|
48
|
-
helperText="Help message"
|
|
49
|
-
readOnly
|
|
50
|
-
optional
|
|
51
|
-
prefix="€"
|
|
52
|
-
defaultValue="1"
|
|
53
|
-
/>
|
|
40
|
+
<DxcNumberInput label="Example label" helperText="Help message" readOnly optional prefix="€" defaultValue="1" />
|
|
54
41
|
</ExampleContainer>
|
|
55
42
|
<ExampleContainer pseudoState="pseudo-active">
|
|
56
43
|
<Title title="Active read only" theme="light" level={4} />
|
|
@@ -127,5 +114,13 @@ export const Chromatic = () => (
|
|
|
127
114
|
<Title title="FillParent size" theme="light" level={4} />
|
|
128
115
|
<DxcNumberInput label="FillParent" size="fillParent" />
|
|
129
116
|
</ExampleContainer>
|
|
117
|
+
<ExampleContainer>
|
|
118
|
+
<Title title="Different sizes inside a flex" theme="light" level={4} />
|
|
119
|
+
<DxcFlex justifyContent="space-between" gap="1rem">
|
|
120
|
+
<DxcNumberInput label="fillParent" size="fillParent" />
|
|
121
|
+
<DxcNumberInput label="medium" size="medium" />
|
|
122
|
+
<DxcNumberInput label="large" size="large" />
|
|
123
|
+
</DxcFlex>
|
|
124
|
+
</ExampleContainer>
|
|
130
125
|
</>
|
|
131
126
|
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,7 +8,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _react2 = require("@testing-library/react");
|
|
10
10
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
11
|
-
var _NumberInput = _interopRequireDefault(require("./NumberInput
|
|
11
|
+
var _NumberInput = _interopRequireDefault(require("./NumberInput"));
|
|
12
12
|
// Mocking DOMRect for Radix Primitive Popover
|
|
13
13
|
global.globalThis = global;
|
|
14
14
|
global.DOMRect = {
|
|
@@ -27,7 +27,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
27
27
|
function ResizeObserver() {
|
|
28
28
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
29
29
|
}
|
|
30
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
30
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
31
31
|
key: "observe",
|
|
32
32
|
value: function observe() {}
|
|
33
33
|
}, {
|
|
@@ -37,7 +37,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
37
37
|
key: "disconnect",
|
|
38
38
|
value: function disconnect() {}
|
|
39
39
|
}]);
|
|
40
|
-
return ResizeObserver;
|
|
41
40
|
}();
|
|
42
41
|
describe("Number input component tests", function () {
|
|
43
42
|
test("Number input renders with label, helper text, placeholder and increment/decrement action buttons", function () {
|
|
@@ -776,7 +775,7 @@ describe("Number input component tests", function () {
|
|
|
776
775
|
min: 5,
|
|
777
776
|
max: 20,
|
|
778
777
|
step: 5,
|
|
779
|
-
defaultValue: 10
|
|
778
|
+
defaultValue: "10"
|
|
780
779
|
})),
|
|
781
780
|
getByLabelText = _render30.getByLabelText;
|
|
782
781
|
var number = getByLabelText("Number input label");
|
|
@@ -804,7 +803,7 @@ describe("Number input component tests", function () {
|
|
|
804
803
|
min: 5,
|
|
805
804
|
max: 20,
|
|
806
805
|
step: 5,
|
|
807
|
-
defaultValue: 10
|
|
806
|
+
defaultValue: "10"
|
|
808
807
|
})),
|
|
809
808
|
getByLabelText = _render31.getByLabelText;
|
|
810
809
|
var number = getByLabelText("Number input label");
|
|
@@ -832,7 +831,7 @@ describe("Number input component tests", function () {
|
|
|
832
831
|
min: 5,
|
|
833
832
|
max: 20,
|
|
834
833
|
step: 5,
|
|
835
|
-
defaultValue: 10
|
|
834
|
+
defaultValue: "10"
|
|
836
835
|
})),
|
|
837
836
|
getByLabelText = _render32.getByLabelText;
|
|
838
837
|
var number = getByLabelText("Number input label");
|
|
@@ -860,7 +859,7 @@ describe("Number input component tests", function () {
|
|
|
860
859
|
min: 5,
|
|
861
860
|
max: 20,
|
|
862
861
|
step: 5,
|
|
863
|
-
defaultValue: 10
|
|
862
|
+
defaultValue: "10"
|
|
864
863
|
})),
|
|
865
864
|
getByLabelText = _render33.getByLabelText;
|
|
866
865
|
var number = getByLabelText("Number input label");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxc-technology/halstack-react",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-f319e71",
|
|
4
4
|
"description": "DXC Halstack React components library",
|
|
5
5
|
"repository": "dxc-technology/halstack-react",
|
|
6
6
|
"homepage": "https://developer.dxc.com/halstack",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@radix-ui/react-popover": "^1.0.7",
|
|
22
|
+
"@radix-ui/react-tooltip": "^1.0.7",
|
|
22
23
|
"color": "^3.1.3",
|
|
23
24
|
"dayjs": "^1.11.1",
|
|
24
|
-
"slugify": "^1.6.5"
|
|
25
|
-
"uuid": "^8.3.2"
|
|
25
|
+
"slugify": "^1.6.5"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"test": "jest --env=jsdom --config=./jest.config.js",
|
|
@@ -37,41 +37,45 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@babel/cli": "^7.16.8",
|
|
40
|
-
"@babel/core": "^7.24.
|
|
40
|
+
"@babel/core": "^7.24.5",
|
|
41
41
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8",
|
|
42
42
|
"@babel/plugin-proposal-optional-chaining": "^7.13.8",
|
|
43
43
|
"@babel/plugin-transform-runtime": "^7.16.8",
|
|
44
44
|
"@babel/preset-env": "^7.16.8",
|
|
45
45
|
"@babel/preset-react": "^7.16.7",
|
|
46
46
|
"@babel/preset-typescript": "^7.16.7",
|
|
47
|
-
"@storybook
|
|
48
|
-
"@storybook/addon-
|
|
49
|
-
"@storybook/addon-
|
|
50
|
-
"@storybook/addon-
|
|
51
|
-
"@storybook/
|
|
52
|
-
"@storybook/
|
|
53
|
-
"@storybook/
|
|
54
|
-
"@storybook/
|
|
55
|
-
"@storybook/
|
|
47
|
+
"@chromatic-com/storybook": "^1.3.3",
|
|
48
|
+
"@storybook/addon-a11y": "^8.0.8",
|
|
49
|
+
"@storybook/addon-essentials": "^8.0.8",
|
|
50
|
+
"@storybook/addon-interactions": "^8.0.8",
|
|
51
|
+
"@storybook/addon-links": "^8.0.8",
|
|
52
|
+
"@storybook/blocks": "^8.0.8",
|
|
53
|
+
"@storybook/builder-vite": "^8.0.8",
|
|
54
|
+
"@storybook/react": "^8.0.8",
|
|
55
|
+
"@storybook/react-vite": "^8.0.8",
|
|
56
|
+
"@storybook/test": "^8.0.9",
|
|
57
|
+
"@storybook/test-runner": "^0.17.0",
|
|
56
58
|
"@testing-library/react": "^13.0.0",
|
|
57
59
|
"@testing-library/user-event": "^13.0.0",
|
|
58
60
|
"@types/color": "^3.0.3",
|
|
59
|
-
"@types/
|
|
61
|
+
"@types/jest": "^29.5.12",
|
|
62
|
+
"@types/jest-axe": "^3.5.9",
|
|
63
|
+
"@types/react": "^18.2.79",
|
|
60
64
|
"@types/styled-components": "5.1.29",
|
|
61
|
-
"@types/uuid": "^9.0.6",
|
|
62
65
|
"axe-playwright": "^2.0.1",
|
|
63
66
|
"babel-jest": "^24.8.0",
|
|
64
67
|
"babel-loader": "^8.0.6",
|
|
65
|
-
"chromatic": "^
|
|
68
|
+
"chromatic": "^11.3.0",
|
|
69
|
+
"css-loader": "^7.1.1",
|
|
66
70
|
"eslint": "^8.53.0",
|
|
67
71
|
"eslint-config-airbnb": "^19.0.4",
|
|
68
72
|
"eslint-config-prettier": "^9.0.0",
|
|
69
73
|
"eslint-plugin-import": "^2.29.0",
|
|
70
74
|
"eslint-plugin-jest": "^27.6.0",
|
|
71
75
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
72
|
-
"eslint-plugin-react": "^7.
|
|
76
|
+
"eslint-plugin-react": "^7.34.1",
|
|
73
77
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
74
|
-
"eslint-plugin-storybook": "^0.
|
|
78
|
+
"eslint-plugin-storybook": "^0.8.0",
|
|
75
79
|
"identity-obj-proxy": "^3.0.0",
|
|
76
80
|
"jest": "^29.7.0",
|
|
77
81
|
"jest-axe": "^8.0.0",
|
|
@@ -79,8 +83,9 @@
|
|
|
79
83
|
"playwright": "^1.41.2",
|
|
80
84
|
"react": "^18.2.0",
|
|
81
85
|
"react-dom": "^18.2.0",
|
|
82
|
-
"storybook": "^
|
|
83
|
-
"storybook-addon-pseudo-states": "^
|
|
86
|
+
"storybook": "^8.0.8",
|
|
87
|
+
"storybook-addon-pseudo-states": "^3.0.1",
|
|
88
|
+
"style-loader": "^4.0.0",
|
|
84
89
|
"styled-components": "^5.0.1",
|
|
85
90
|
"typescript": "^5.3.3"
|
|
86
91
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|