@dxc-technology/halstack-react 0.0.0-59b9187 → 0.0.0-5a4d834
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 +41 -3
- package/HalstackContext.js +28 -18
- package/accordion/Accordion.accessibility.test.d.ts +1 -0
- package/accordion/Accordion.accessibility.test.js +4 -4
- package/accordion/Accordion.js +6 -9
- 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 +7 -4
- 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.test.d.ts +1 -0
- package/badge/Badge.test.js +2 -2
- package/bar-chart/BarChart.d.ts +4 -0
- package/bar-chart/BarChart.js +152 -0
- package/bar-chart/BarChart.stories.tsx +281 -0
- package/bar-chart/BarChart.test.d.ts +1 -0
- package/bar-chart/BarChart.test.js +194 -0
- package/bar-chart/theme.d.ts +3 -0
- package/bar-chart/theme.js +31 -0
- package/bar-chart/types.d.ts +137 -0
- package/bar-chart/types.js +5 -0
- package/bleed/Bleed.stories.tsx +0 -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 +40 -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 +1 -1
- 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.d.ts +0 -1
- package/common/coreTokens.js +3 -4
- package/common/variables.d.ts +47 -3
- package/common/variables.js +109 -71
- package/container/Container.stories.tsx +3 -3
- package/container/types.d.ts +113 -11
- 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 +118 -53
- package/contextual-menu/ContextualMenu.stories.tsx +124 -75
- 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 +88 -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 +54 -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 +27 -21
- 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 +1 -1
- 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 +3 -2
- 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 +19 -37
- 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 +3 -8
- package/file-input/FileInput.test.d.ts +1 -0
- package/file-input/FileInput.test.js +44 -22
- package/file-input/FileItem.js +7 -3
- 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 +1 -1
- package/footer/Footer.stories.tsx +12 -0
- package/footer/Footer.test.d.ts +1 -0
- package/footer/Footer.test.js +1 -1
- package/footer/Icons.js +2 -30
- 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 +3 -2
- 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 +4 -4
- package/link/Link.accessibility.test.d.ts +1 -0
- package/link/Link.accessibility.test.js +8 -12
- package/link/Link.js +1 -1
- package/link/Link.stories.tsx +2 -2
- package/link/Link.test.d.ts +1 -0
- package/link/Link.test.js +1 -1
- package/main.d.ts +3 -1
- package/main.js +15 -1
- package/nav-tabs/NavTabs.accessibility.test.d.ts +1 -0
- package/nav-tabs/NavTabs.accessibility.test.js +3 -3
- package/nav-tabs/NavTabs.js +19 -4
- package/nav-tabs/NavTabs.stories.tsx +18 -3
- package/nav-tabs/NavTabs.test.d.ts +1 -0
- package/nav-tabs/NavTabs.test.js +9 -7
- package/nav-tabs/Tab.js +7 -7
- 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 +27 -21
- package/paginator/Paginator.accessibility.test.d.ts +1 -0
- package/paginator/Paginator.accessibility.test.js +4 -5
- package/paginator/Paginator.js +9 -5
- 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 -7
- 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 +41 -13
- 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/resultset-table/types.d.ts +4 -3
- package/select/Listbox.d.ts +3 -3
- package/select/Listbox.js +29 -27
- package/select/Option.d.ts +3 -3
- package/select/Option.js +13 -8
- package/select/Select.accessibility.test.d.ts +1 -0
- package/select/Select.accessibility.test.js +18 -8
- package/select/Select.js +75 -190
- package/select/Select.stories.tsx +41 -20
- package/select/Select.test.d.ts +1 -0
- package/select/Select.test.js +42 -150
- package/select/selectUtils.d.ts +41 -0
- package/select/selectUtils.js +129 -0
- package/sidenav/Sidenav.accessibility.test.d.ts +1 -0
- package/sidenav/Sidenav.accessibility.test.js +3 -3
- package/sidenav/Sidenav.js +1 -1
- package/sidenav/Sidenav.stories.tsx +1 -1
- package/sidenav/Sidenav.test.d.ts +1 -0
- package/sidenav/Sidenav.test.js +1 -1
- 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.d.ts +1 -1
- package/spinner/Spinner.js +32 -47
- 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 +1 -1
- package/tabs/Tabs.accessibility.test.d.ts +1 -0
- package/tabs/Tabs.accessibility.test.js +3 -3
- package/tabs/Tabs.js +1 -1
- package/tabs/Tabs.stories.tsx +7 -1
- package/tabs/Tabs.test.d.ts +1 -0
- package/tabs/Tabs.test.js +1 -1
- package/tag/Tag.accessibility.test.d.ts +1 -0
- package/tag/Tag.accessibility.test.js +4 -4
- package/tag/Tag.js +1 -1
- package/tag/Tag.stories.tsx +1 -1
- package/tag/Tag.test.d.ts +1 -0
- package/tag/Tag.test.js +1 -1
- 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 +49 -68
- 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 +6 -9
- package/toggle-group/ToggleGroup.stories.tsx +1 -1
- package/toggle-group/ToggleGroup.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.test.js +1 -1
- 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/typography/Typography.test.js +23 -0
- package/useTheme.d.ts +30 -3
- package/useTranslatedLabels.d.ts +11 -0
- package/utils/BaseTypography.js +45 -41
- package/utils/FocusLock.js +3 -2
- package/utils/useWidth.d.ts +2 -0
- package/utils/useWidth.js +30 -0
- package/wizard/Wizard.accessibility.test.d.ts +1 -0
- package/wizard/Wizard.accessibility.test.js +3 -3
- package/wizard/Wizard.js +1 -9
- package/wizard/Wizard.stories.tsx +1 -1
- package/wizard/Wizard.test.d.ts +1 -0
- package/wizard/Wizard.test.js +1 -1
- package/contextual-menu/MenuItemAction.d.ts +0 -4
- package/contextual-menu/MenuItemAction.js +0 -46
package/container/types.d.ts
CHANGED
|
@@ -43,27 +43,129 @@ type Overflow = OverflowValues | {
|
|
|
43
43
|
y?: OverflowValues;
|
|
44
44
|
};
|
|
45
45
|
type Props = {
|
|
46
|
+
/**
|
|
47
|
+
* Based on the CSS property background allows configuring all properties related to the background of a container.
|
|
48
|
+
*
|
|
49
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/background
|
|
50
|
+
*/
|
|
51
|
+
background?: Background;
|
|
52
|
+
/**
|
|
53
|
+
* Based on the CSS property border allows configuring all properties related to the border of a container.
|
|
54
|
+
*/
|
|
55
|
+
border?: Border;
|
|
56
|
+
/**
|
|
57
|
+
* Sets the border-radius CSS property.
|
|
58
|
+
*
|
|
59
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius
|
|
60
|
+
*/
|
|
61
|
+
borderRadius?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Sets the box-shadow CSS property.
|
|
64
|
+
*
|
|
65
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow
|
|
66
|
+
*/
|
|
67
|
+
boxShadow?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Sets the box-sizing CSS property.
|
|
70
|
+
*
|
|
71
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
|
|
72
|
+
*/
|
|
46
73
|
boxSizing?: "border-box" | "content-box";
|
|
74
|
+
/**
|
|
75
|
+
* Custom content inside the container.
|
|
76
|
+
*/
|
|
77
|
+
children: React.ReactNode;
|
|
78
|
+
/**
|
|
79
|
+
* Sets the display CSS property.
|
|
80
|
+
* The set of values is limited to the ones related to the outer display type.
|
|
81
|
+
* If you want to apply any pattern from the inner box and how the children are laid out,
|
|
82
|
+
* we recommend you to use the Flex and Grid components.
|
|
83
|
+
*
|
|
84
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/display
|
|
85
|
+
*/
|
|
47
86
|
display?: "block" | "inline-block" | "inline" | "none";
|
|
48
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Sets the float CSS property.
|
|
89
|
+
*
|
|
90
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/float
|
|
91
|
+
*/
|
|
92
|
+
float?: "left" | "right" | "none";
|
|
93
|
+
/**
|
|
94
|
+
* Sets the height CSS property.
|
|
95
|
+
*
|
|
96
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/height
|
|
97
|
+
*/
|
|
49
98
|
height?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Based on the CSS property inset this prop is a shorthand that corresponds
|
|
101
|
+
* to the top, right, bottom, and/or left properties.
|
|
102
|
+
*/
|
|
103
|
+
inset?: Inset;
|
|
104
|
+
/**
|
|
105
|
+
* Size of the margin to be applied to the component.
|
|
106
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties
|
|
107
|
+
* in order to specify different margin sizes.
|
|
108
|
+
*/
|
|
109
|
+
margin?: Space;
|
|
110
|
+
/**
|
|
111
|
+
* Sets the max-height CSS property.
|
|
112
|
+
*
|
|
113
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/max-height
|
|
114
|
+
*/
|
|
50
115
|
maxWidth?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Sets the max-width CSS property.
|
|
118
|
+
*
|
|
119
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/max-width
|
|
120
|
+
*/
|
|
51
121
|
maxHeight?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Sets the min-height CSS property.
|
|
124
|
+
*
|
|
125
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/min-height
|
|
126
|
+
*/
|
|
52
127
|
minWidth?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Sets the min-width CSS property.
|
|
130
|
+
*
|
|
131
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/min-width
|
|
132
|
+
*/
|
|
53
133
|
minHeight?: string;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
134
|
+
/**
|
|
135
|
+
* Based on the CSS property outline allows configuring all properties related
|
|
136
|
+
* to the outline of a container.
|
|
137
|
+
*/
|
|
138
|
+
outline?: Outline;
|
|
139
|
+
/**
|
|
140
|
+
* Sets the overflow CSS property.
|
|
141
|
+
*
|
|
142
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow
|
|
143
|
+
*/
|
|
58
144
|
overflow?: Overflow;
|
|
145
|
+
/**
|
|
146
|
+
* Size of the margin to be applied to the component.
|
|
147
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties
|
|
148
|
+
* in order to specify different margin sizes.
|
|
149
|
+
*/
|
|
150
|
+
padding?: Space;
|
|
151
|
+
/**
|
|
152
|
+
* Sets the position CSS property.
|
|
153
|
+
*
|
|
154
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/position
|
|
155
|
+
*/
|
|
59
156
|
position?: "static" | "relative" | "absolute" | "fixed" | "sticky";
|
|
60
|
-
|
|
61
|
-
|
|
157
|
+
/**
|
|
158
|
+
* Sets the width CSS property.
|
|
159
|
+
*
|
|
160
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/width
|
|
161
|
+
*/
|
|
162
|
+
width?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Sets the z-index CSS property.
|
|
165
|
+
*
|
|
166
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/z-index
|
|
167
|
+
*/
|
|
62
168
|
zIndex?: "auto" | number;
|
|
63
|
-
background?: Background;
|
|
64
|
-
boxShadow?: string;
|
|
65
|
-
outline?: Outline;
|
|
66
|
-
children: React.ReactNode;
|
|
67
169
|
};
|
|
68
170
|
export type StyledProps = Omit<Props, "display" | "width" | "height" | "opacity" | "overflow"> & {
|
|
69
171
|
$display?: "block" | "inline-block" | "inline" | "none";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,8 +5,20 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
5
5
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
6
|
var _react = _interopRequireDefault(require("react"));
|
|
7
7
|
var _react2 = require("@testing-library/react");
|
|
8
|
-
var
|
|
8
|
+
var _axeHelper = require("../../test/accessibility/axe-helper.js");
|
|
9
9
|
var _ContextualMenu = _interopRequireDefault(require("./ContextualMenu"));
|
|
10
|
+
var _Badge = _interopRequireDefault(require("../badge/Badge"));
|
|
11
|
+
var _disabledRules = require("../../test/accessibility/rules/specific/contextual-menu/disabledRules.js");
|
|
12
|
+
// TODO: REMOVE
|
|
13
|
+
|
|
14
|
+
var disabledRules = {
|
|
15
|
+
rules: _disabledRules.disabledRules.reduce(function (rulesObj, rule) {
|
|
16
|
+
rulesObj[rule] = {
|
|
17
|
+
enabled: false
|
|
18
|
+
};
|
|
19
|
+
return rulesObj;
|
|
20
|
+
}, {})
|
|
21
|
+
};
|
|
10
22
|
var badge_icon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
11
23
|
width: "24",
|
|
12
24
|
height: "24",
|
|
@@ -40,7 +52,7 @@ var fav_icon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
|
40
52
|
}));
|
|
41
53
|
var itemsWithTruncatedText = [{
|
|
42
54
|
label: "Item with a very long label that should be truncated",
|
|
43
|
-
slot: /*#__PURE__*/_react["default"].createElement(
|
|
55
|
+
slot: /*#__PURE__*/_react["default"].createElement(_Badge["default"], {
|
|
44
56
|
color: "blue",
|
|
45
57
|
mode: "contextual",
|
|
46
58
|
label: "Label",
|
|
@@ -73,7 +85,7 @@ describe("Context menu accessibility tests", function () {
|
|
|
73
85
|
items: itemsWithTruncatedText
|
|
74
86
|
})), container = _render.container;
|
|
75
87
|
_context.next = 3;
|
|
76
|
-
return (0,
|
|
88
|
+
return (0, _axeHelper.axe)(container, disabledRules);
|
|
77
89
|
case 3:
|
|
78
90
|
results = _context.sent;
|
|
79
91
|
expect(results).toHaveNoViolations();
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
Badge(props: BadgePropsType): React.JSX.Element;
|
|
6
|
-
};
|
|
2
|
+
import ContextualMenuPropsType, { ContextualMenuContextProps } from "./types";
|
|
3
|
+
export declare const ContextualMenuContext: React.Context<ContextualMenuContextProps>;
|
|
4
|
+
declare const DxcContextualMenu: ({ items }: ContextualMenuPropsType) => React.JSX.Element;
|
|
7
5
|
export default DxcContextualMenu;
|
|
@@ -5,67 +5,132 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] = void 0;
|
|
8
|
+
exports["default"] = exports.ContextualMenuContext = void 0;
|
|
9
9
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
var _styledComponents =
|
|
13
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
14
14
|
var _coreTokens = _interopRequireDefault(require("../common/coreTokens"));
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
15
|
+
var _Divider = _interopRequireDefault(require("../divider/Divider"));
|
|
16
|
+
var _Inset = _interopRequireDefault(require("../inset/Inset"));
|
|
17
|
+
var _MenuItem = _interopRequireDefault(require("./MenuItem"));
|
|
18
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
19
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
18
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); }
|
|
19
|
-
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 &&
|
|
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
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
|
+
var ContextualMenuContext = exports.ContextualMenuContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
25
|
+
var isGroupItem = function isGroupItem(item) {
|
|
26
|
+
return "items" in item;
|
|
27
|
+
};
|
|
28
|
+
var isSection = function isSection(item) {
|
|
29
|
+
return "items" in item && !("label" in item);
|
|
30
|
+
};
|
|
31
|
+
var addIdToItems = function addIdToItems(items) {
|
|
32
|
+
var accId = 0;
|
|
33
|
+
var innerAddIdToItems = function innerAddIdToItems(items) {
|
|
34
|
+
return items.map(function (item) {
|
|
35
|
+
return isSection(item) ? _objectSpread(_objectSpread({}, item), {}, {
|
|
36
|
+
items: innerAddIdToItems(item.items)
|
|
37
|
+
}) : isGroupItem(item) ? _objectSpread(_objectSpread({}, item), {}, {
|
|
38
|
+
items: innerAddIdToItems(item.items)
|
|
39
|
+
}) : _objectSpread(_objectSpread({}, item), {}, {
|
|
40
|
+
id: accId++
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
return innerAddIdToItems(items);
|
|
45
|
+
};
|
|
20
46
|
var DxcContextualMenu = function DxcContextualMenu(_ref) {
|
|
21
|
-
var items = _ref.items
|
|
22
|
-
|
|
23
|
-
defaultSelectedItemIndex = _ref$defaultSelectedI === void 0 ? -1 : _ref$defaultSelectedI;
|
|
24
|
-
var _useState = (0, _react.useState)(defaultSelectedItemIndex),
|
|
47
|
+
var items = _ref.items;
|
|
48
|
+
var _useState = (0, _react.useState)(-1),
|
|
25
49
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
onSelect: function onSelect() {
|
|
35
|
-
var _item$onSelect;
|
|
36
|
-
setSelectedItemIndex(index);
|
|
37
|
-
(_item$onSelect = item.onSelect) === null || _item$onSelect === void 0 ? void 0 : _item$onSelect.call(item);
|
|
38
|
-
}
|
|
39
|
-
})));
|
|
40
|
-
};
|
|
41
|
-
var accLength = 0;
|
|
42
|
-
var renderSection = function renderSection(section, currentSectionIndex, items) {
|
|
43
|
-
var startingIndex = accLength;
|
|
44
|
-
accLength += section.items.length;
|
|
50
|
+
selectedItemId = _useState2[0],
|
|
51
|
+
setSelectedItemId = _useState2[1];
|
|
52
|
+
var contextualMenuRef = (0, _react.useRef)(null);
|
|
53
|
+
var itemsWithId = (0, _react.useMemo)(function () {
|
|
54
|
+
return addIdToItems(items);
|
|
55
|
+
}, [items]);
|
|
56
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
57
|
+
var renderSection = function renderSection(section, currentSectionIndex, length) {
|
|
45
58
|
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, {
|
|
46
|
-
key: "
|
|
47
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
48
|
-
role: "group"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
key: "section-".concat(currentSectionIndex)
|
|
60
|
+
}, /*#__PURE__*/_react["default"].createElement("li", {
|
|
61
|
+
role: "group",
|
|
62
|
+
"aria-labelledby": section.title
|
|
63
|
+
}, section.title != null && /*#__PURE__*/_react["default"].createElement(Title, {
|
|
64
|
+
id: section.title
|
|
65
|
+
}, section.title), /*#__PURE__*/_react["default"].createElement(SectionList, null, section.items.map(function (item, index) {
|
|
66
|
+
return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
67
|
+
item: item,
|
|
68
|
+
key: "".concat(item.label, "-").concat(index)
|
|
69
|
+
});
|
|
70
|
+
}))), currentSectionIndex !== length - 1 && /*#__PURE__*/_react["default"].createElement(_Inset["default"], {
|
|
71
|
+
top: "0.25rem",
|
|
72
|
+
bottom: "0.25rem"
|
|
73
|
+
}, /*#__PURE__*/_react["default"].createElement(_Divider["default"], {
|
|
74
|
+
color: "lightGrey"
|
|
75
|
+
})));
|
|
54
76
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var
|
|
62
|
-
var
|
|
63
|
-
var
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
})
|
|
77
|
+
var _useState3 = (0, _react.useState)(true),
|
|
78
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
79
|
+
firstUpdate = _useState4[0],
|
|
80
|
+
setFirstUpdate = _useState4[1];
|
|
81
|
+
(0, _react.useLayoutEffect)(function () {
|
|
82
|
+
if (selectedItemId !== -1 && firstUpdate) {
|
|
83
|
+
var _contextualMenuEl$scr;
|
|
84
|
+
var contextualMenuEl = contextualMenuRef === null || contextualMenuRef === void 0 ? void 0 : contextualMenuRef.current;
|
|
85
|
+
var selectedItemEl = contextualMenuEl === null || contextualMenuEl === void 0 ? void 0 : contextualMenuEl.querySelector("[aria-selected='true']");
|
|
86
|
+
contextualMenuEl === null || contextualMenuEl === void 0 ? void 0 : (_contextualMenuEl$scr = contextualMenuEl.scrollTo) === null || _contextualMenuEl$scr === void 0 ? void 0 : _contextualMenuEl$scr.call(contextualMenuEl, {
|
|
87
|
+
top: (selectedItemEl === null || selectedItemEl === void 0 ? void 0 : selectedItemEl.offsetTop) - (contextualMenuEl === null || contextualMenuEl === void 0 ? void 0 : contextualMenuEl.clientHeight) / 2
|
|
88
|
+
});
|
|
89
|
+
setFirstUpdate(false);
|
|
90
|
+
}
|
|
91
|
+
}, [firstUpdate, selectedItemId]);
|
|
92
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
93
|
+
theme: colorsTheme.contextualMenu
|
|
94
|
+
}, /*#__PURE__*/_react["default"].createElement(ContextualMenu, {
|
|
95
|
+
role: "menu",
|
|
96
|
+
ref: contextualMenuRef
|
|
97
|
+
}, /*#__PURE__*/_react["default"].createElement(ContextualMenuContext.Provider, {
|
|
98
|
+
value: {
|
|
99
|
+
selectedItemId: selectedItemId,
|
|
100
|
+
setSelectedItemId: setSelectedItemId
|
|
101
|
+
}
|
|
102
|
+
}, itemsWithId.map(function (item, index) {
|
|
103
|
+
return "items" in item && !("label" in item) ? renderSection(item, index, itemsWithId.length) : /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
104
|
+
item: item,
|
|
105
|
+
key: "".concat(item.label, "-").concat(index)
|
|
106
|
+
});
|
|
107
|
+
}))));
|
|
70
108
|
};
|
|
109
|
+
var ContextualMenu = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n margin: 0;\n border: 1px solid ", ";\n border-radius: 0.25rem;\n padding: ", " ", ";\n display: grid;\n gap: ", ";\n min-width: 248px;\n max-height: 100%;\n background-color: ", ";\n overflow-y: auto;\n &::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n }\n &::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 0.25rem;\n }\n &::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 0.25rem;\n }\n"])), function (_ref2) {
|
|
110
|
+
var theme = _ref2.theme;
|
|
111
|
+
return theme.borderColor;
|
|
112
|
+
}, _coreTokens["default"].spacing_16, _coreTokens["default"].spacing_8, _coreTokens["default"].spacing_4, function (_ref3) {
|
|
113
|
+
var theme = _ref3.theme;
|
|
114
|
+
return theme.backgroundColor;
|
|
115
|
+
}, _coreTokens["default"].color_grey_700, _coreTokens["default"].color_grey_300);
|
|
116
|
+
var SectionList = _styledComponents["default"].ul(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n list-style: none;\n margin: 0;\n padding: 0;\n display: grid;\n gap: ", ";\n"])), _coreTokens["default"].spacing_4);
|
|
117
|
+
var Title = _styledComponents["default"].h2(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0 0 ", " 0;\n padding: ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), _coreTokens["default"].spacing_4, _coreTokens["default"].spacing_4, function (_ref4) {
|
|
118
|
+
var theme = _ref4.theme;
|
|
119
|
+
return theme.sectionTitleFontColor;
|
|
120
|
+
}, function (_ref5) {
|
|
121
|
+
var theme = _ref5.theme;
|
|
122
|
+
return theme.fontFamily;
|
|
123
|
+
}, function (_ref6) {
|
|
124
|
+
var theme = _ref6.theme;
|
|
125
|
+
return theme.sectionTitleFontSize;
|
|
126
|
+
}, function (_ref7) {
|
|
127
|
+
var theme = _ref7.theme;
|
|
128
|
+
return theme.sectionTitleFontStyle;
|
|
129
|
+
}, function (_ref8) {
|
|
130
|
+
var theme = _ref8.theme;
|
|
131
|
+
return theme.sectionTitleFontWeight;
|
|
132
|
+
}, function (_ref9) {
|
|
133
|
+
var theme = _ref9.theme;
|
|
134
|
+
return theme.sectionTitleLineHeight;
|
|
135
|
+
});
|
|
71
136
|
var _default = exports["default"] = DxcContextualMenu;
|