@dxc-technology/halstack-react 0.0.0-dec566a → 0.0.0-df9abc7
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 +6581 -0
- package/dist/index.d.ts +6581 -0
- package/dist/index.js +14078 -0
- package/dist/index.mjs +14020 -0
- package/package.json +68 -68
- package/BackgroundColorContext.d.ts +0 -1
- package/BackgroundColorContext.js +0 -30
- package/HalstackContext.d.ts +0 -1249
- package/HalstackContext.js +0 -310
- package/accordion/Accordion.d.ts +0 -4
- package/accordion/Accordion.js +0 -169
- package/accordion/Accordion.stories.tsx +0 -252
- package/accordion/Accordion.test.js +0 -56
- package/accordion/types.d.ts +0 -57
- package/accordion/types.js +0 -5
- 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.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.d.ts +0 -4
- package/alert/Alert.js +0 -200
- 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.d.ts +0 -4
- package/badge/Badge.js +0 -159
- 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.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/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.d.ts +0 -4
- package/button/Button.js +0 -121
- package/button/Button.stories.tsx +0 -326
- package/button/Button.test.js +0 -38
- package/button/types.d.ts +0 -57
- package/button/types.js +0 -5
- package/card/Card.d.ts +0 -4
- package/card/Card.js +0 -120
- 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.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.d.ts +0 -4
- package/chip/Chip.js +0 -121
- package/chip/Chip.stories.tsx +0 -214
- 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 -1395
- package/common/variables.js +0 -1267
- 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.d.ts +0 -7
- package/contextual-menu/ContextualMenu.js +0 -71
- package/contextual-menu/ContextualMenu.stories.tsx +0 -182
- package/contextual-menu/ContextualMenu.test.js +0 -71
- package/contextual-menu/MenuItemAction.d.ts +0 -4
- package/contextual-menu/MenuItemAction.js +0 -46
- package/contextual-menu/types.d.ts +0 -22
- 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.d.ts +0 -4
- package/date-input/DateInput.js +0 -223
- package/date-input/DateInput.stories.tsx +0 -285
- package/date-input/DateInput.test.js +0 -808
- package/date-input/DatePicker.d.ts +0 -4
- package/date-input/DatePicker.js +0 -115
- package/date-input/Icons.d.ts +0 -6
- package/date-input/Icons.js +0 -58
- 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.d.ts +0 -4
- package/dialog/Dialog.js +0 -104
- package/dialog/Dialog.stories.tsx +0 -365
- package/dialog/Dialog.test.js +0 -307
- package/dialog/types.d.ts +0 -36
- package/dialog/types.js +0 -5
- 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.d.ts +0 -4
- package/dropdown/Dropdown.js +0 -319
- 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 -70
- package/dropdown/types.d.ts +0 -96
- package/dropdown/types.js +0 -5
- package/file-input/FileInput.d.ts +0 -4
- package/file-input/FileInput.js +0 -479
- package/file-input/FileInput.stories.tsx +0 -618
- package/file-input/FileInput.test.js +0 -459
- package/file-input/FileItem.d.ts +0 -4
- package/file-input/FileItem.js +0 -135
- 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.d.ts +0 -4
- package/footer/Footer.js +0 -138
- package/footer/Footer.stories.tsx +0 -171
- package/footer/Footer.test.js +0 -85
- package/footer/Icons.d.ts +0 -3
- package/footer/Icons.js +0 -136
- 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.d.ts +0 -8
- package/header/Header.js +0 -220
- package/header/Header.stories.tsx +0 -251
- package/header/Header.test.js +0 -66
- package/header/Icons.d.ts +0 -2
- package/header/Icons.js +0 -29
- package/header/types.d.ts +0 -33
- package/header/types.js +0 -5
- 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.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.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 -134
- package/layout/ApplicationLayout.stories.tsx +0 -162
- package/layout/Icons.d.ts +0 -8
- package/layout/Icons.js +0 -58
- package/layout/types.d.ts +0 -41
- package/layout/types.js +0 -5
- package/link/Link.d.ts +0 -4
- package/link/Link.js +0 -115
- 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 -49
- package/main.js +0 -357
- package/nav-tabs/NavTabs.d.ts +0 -7
- package/nav-tabs/NavTabs.js +0 -93
- package/nav-tabs/NavTabs.stories.tsx +0 -276
- package/nav-tabs/NavTabs.test.js +0 -76
- 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 -118
- package/nav-tabs/types.d.ts +0 -52
- package/nav-tabs/types.js +0 -5
- 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/Icons.d.ts +0 -5
- package/paginator/Icons.js +0 -40
- package/paginator/Paginator.d.ts +0 -4
- package/paginator/Paginator.js +0 -135
- 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.d.ts +0 -5
- package/paragraph/Paragraph.js +0 -22
- package/paragraph/Paragraph.stories.tsx +0 -27
- package/password-input/Icons.d.ts +0 -6
- package/password-input/Icons.js +0 -35
- 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.d.ts +0 -4
- package/progress-bar/ProgressBar.js +0 -144
- 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.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.d.ts +0 -4
- package/radio-group/RadioGroup.js +0 -235
- 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.d.ts +0 -7
- package/resultset-table/ResultsetTable.js +0 -170
- package/resultset-table/ResultsetTable.stories.tsx +0 -401
- 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/Icons.d.ts +0 -10
- package/select/Icons.js +0 -89
- package/select/Listbox.d.ts +0 -4
- package/select/Listbox.js +0 -143
- package/select/Option.d.ts +0 -4
- package/select/Option.js +0 -87
- package/select/Select.d.ts +0 -4
- package/select/Select.js +0 -590
- package/select/Select.stories.tsx +0 -971
- package/select/Select.test.js +0 -2370
- package/select/types.d.ts +0 -209
- package/select/types.js +0 -5
- package/sidenav/Icons.d.ts +0 -7
- package/sidenav/Icons.js +0 -47
- package/sidenav/Sidenav.d.ts +0 -10
- package/sidenav/Sidenav.js +0 -197
- package/sidenav/Sidenav.stories.tsx +0 -282
- 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.d.ts +0 -4
- package/slider/Slider.js +0 -285
- package/slider/Slider.test.js +0 -254
- package/slider/types.d.ts +0 -86
- package/slider/types.js +0 -5
- package/spinner/Spinner.d.ts +0 -4
- package/spinner/Spinner.js +0 -206
- 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.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.d.ts +0 -4
- package/switch/Switch.js +0 -214
- package/switch/Switch.stories.tsx +0 -137
- 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.d.ts +0 -8
- package/table/Table.js +0 -161
- package/table/Table.stories.tsx +0 -651
- 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 -116
- package/tabs/Tabs.d.ts +0 -4
- package/tabs/Tabs.js +0 -384
- package/tabs/Tabs.stories.tsx +0 -226
- package/tabs/Tabs.test.js +0 -294
- package/tabs/types.d.ts +0 -92
- package/tabs/types.js +0 -5
- package/tag/Tag.d.ts +0 -4
- package/tag/Tag.js +0 -151
- package/tag/Tag.stories.tsx +0 -155
- package/tag/Tag.test.js +0 -49
- 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 -86
- package/text-input/TextInput.d.ts +0 -4
- package/text-input/TextInput.js +0 -567
- package/text-input/TextInput.stories.tsx +0 -465
- 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.d.ts +0 -4
- package/textarea/Textarea.js +0 -234
- 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.d.ts +0 -4
- package/toggle-group/ToggleGroup.js +0 -201
- 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.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 -1148
- 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.d.ts +0 -4
- package/wizard/Wizard.js +0 -250
- package/wizard/Wizard.stories.tsx +0 -253
- package/wizard/Wizard.test.js +0 -114
- package/wizard/types.d.ts +0 -64
- package/wizard/types.js +0 -5
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import Title from "../../.storybook/components/Title";
|
|
3
|
-
import DxcContextualMenu from "./ContextualMenu";
|
|
4
|
-
import DxcContainer from "../container/Container";
|
|
5
|
-
import MenuItemAction from "./MenuItemAction";
|
|
6
|
-
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: "Contextual Menu",
|
|
10
|
-
component: DxcContextualMenu,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const key_icon = (
|
|
14
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24" fill="currentColor">
|
|
15
|
-
<path d="M280-400q-33 0-56.5-23.5T200-480q0-33 23.5-56.5T280-560q33 0 56.5 23.5T360-480q0 33-23.5 56.5T280-400Zm0 160q-100 0-170-70T40-480q0-100 70-170t170-70q67 0 121.5 33t86.5 87h352l120 120-180 180-80-60-80 60-85-60h-47q-32 54-86.5 87T280-240Zm0-80q56 0 98.5-34t56.5-86h125l58 41 82-61 71 55 75-75-40-40H435q-14-52-56.5-86T280-640q-66 0-113 47t-47 113q0 66 47 113t113 47Z" />
|
|
16
|
-
</svg>
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
const fav_icon = (
|
|
20
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24" fill="currentColor">
|
|
21
|
-
<path d="m480-120-58-52q-101-91-167-157T150-447.5Q111-500 95.5-544T80-634q0-94 63-157t157-63q52 0 99 22t81 62q34-40 81-62t99-22q94 0 157 63t63 157q0 46-15.5 90T810-447.5Q771-395 705-329T538-172l-58 52Zm0-108q96-86 158-147.5t98-107q36-45.5 50-81t14-70.5q0-60-40-100t-100-40q-47 0-87 26.5T518-680h-76q-15-41-55-67.5T300-774q-60 0-100 40t-40 100q0 35 14 70.5t50 81q36 45.5 98 107T480-228Zm0-273Z" />
|
|
22
|
-
</svg>
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
const items = [{ label: "Item 1" }, { label: "Item 2" }, { label: "Item 3" }, { label: "Item 4" }];
|
|
26
|
-
|
|
27
|
-
const sections = [
|
|
28
|
-
{
|
|
29
|
-
title: "Team repositories",
|
|
30
|
-
items: [{ label: "Approved locations" }, { label: "Approved locations" }, { label: "Approved locations" }],
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
items: [{ label: "Approved locations" }, { label: "Approved locations" }, { label: "Approved locations" }],
|
|
34
|
-
},
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
const itemsWithIcon = [
|
|
38
|
-
{
|
|
39
|
-
label: "Item 1",
|
|
40
|
-
icon: key_icon,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
label: "Item 2",
|
|
44
|
-
icon: fav_icon,
|
|
45
|
-
},
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
const itemsWithSlot = [
|
|
49
|
-
{
|
|
50
|
-
label: "Item 1",
|
|
51
|
-
slot: <DxcContextualMenu.Badge color="green" label="New" />,
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
label: "Item 2",
|
|
55
|
-
slot: (
|
|
56
|
-
<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
57
|
-
<path
|
|
58
|
-
d="M10.6667 10.6667H1.33333V1.33333H6V0H1.33333C0.593333 0 0 0.6 0 1.33333V10.6667C0 11.4 0.593333 12 1.33333 12H10.6667C11.4 12 12 11.4 12 10.6667V6H10.6667V10.6667ZM7.33333 0V1.33333H9.72667L3.17333 7.88667L4.11333 8.82667L10.6667 2.27333V4.66667H12V0H7.33333Z"
|
|
59
|
-
fill="#323232"
|
|
60
|
-
/>
|
|
61
|
-
</svg>
|
|
62
|
-
),
|
|
63
|
-
},
|
|
64
|
-
];
|
|
65
|
-
|
|
66
|
-
const sectionsWithScroll = [
|
|
67
|
-
{
|
|
68
|
-
title: "Team repositories",
|
|
69
|
-
items: [{ label: "Approved locations" }, { label: "Approved locations" }, { label: "Approved locations" }],
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
items: [
|
|
73
|
-
{ label: "Approved locations" },
|
|
74
|
-
{ label: "Approved locations" },
|
|
75
|
-
{ label: "Approved locations" },
|
|
76
|
-
{ label: "Approved locations" },
|
|
77
|
-
{ label: "Approved locations" },
|
|
78
|
-
{ label: "Approved locations" },
|
|
79
|
-
{ label: "Approved locations" },
|
|
80
|
-
{ label: "Approved locations" },
|
|
81
|
-
{ label: "Approved locations" },
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
];
|
|
85
|
-
|
|
86
|
-
const itemsWithTruncatedText = [
|
|
87
|
-
{
|
|
88
|
-
label: "Item with a very long label that should be truncated",
|
|
89
|
-
slot: <DxcContextualMenu.Badge color="green" label="New" />,
|
|
90
|
-
icon: key_icon,
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
label: "Item 2",
|
|
94
|
-
slot: (
|
|
95
|
-
<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
96
|
-
<path
|
|
97
|
-
d="M10.6667 10.6667H1.33333V1.33333H6V0H1.33333C0.593333 0 0 0.6 0 1.33333V10.6667C0 11.4 0.593333 12 1.33333 12H10.6667C11.4 12 12 11.4 12 10.6667V6H10.6667V10.6667ZM7.33333 0V1.33333H9.72667L3.17333 7.88667L4.11333 8.82667L10.6667 2.27333V4.66667H12V0H7.33333Z"
|
|
98
|
-
fill="#323232"
|
|
99
|
-
/>
|
|
100
|
-
</svg>
|
|
101
|
-
),
|
|
102
|
-
icon: fav_icon,
|
|
103
|
-
},
|
|
104
|
-
];
|
|
105
|
-
|
|
106
|
-
export const Chromatic = () => (
|
|
107
|
-
<>
|
|
108
|
-
<Title title="Default" theme="light" level={3} />
|
|
109
|
-
<ExampleContainer>
|
|
110
|
-
<DxcContextualMenu items={items} />
|
|
111
|
-
</ExampleContainer>
|
|
112
|
-
<Title title="With sections" theme="light" level={3} />
|
|
113
|
-
<ExampleContainer>
|
|
114
|
-
<DxcContainer width="300px">
|
|
115
|
-
<DxcContextualMenu items={sections} />
|
|
116
|
-
</DxcContainer>
|
|
117
|
-
</ExampleContainer>
|
|
118
|
-
<Title title="With icons" theme="light" level={3} />
|
|
119
|
-
<ExampleContainer>
|
|
120
|
-
<DxcContainer width="300px">
|
|
121
|
-
<DxcContextualMenu items={itemsWithIcon} defaultSelectedItemIndex={0} />
|
|
122
|
-
</DxcContainer>
|
|
123
|
-
</ExampleContainer>
|
|
124
|
-
<Title title="With slot" theme="light" level={3} />
|
|
125
|
-
<ExampleContainer>
|
|
126
|
-
<DxcContainer width="300px">
|
|
127
|
-
<DxcContextualMenu items={itemsWithSlot} />
|
|
128
|
-
</DxcContainer>
|
|
129
|
-
</ExampleContainer>
|
|
130
|
-
<Title title="With label truncated" theme="light" level={3} />
|
|
131
|
-
<ExampleContainer>
|
|
132
|
-
<DxcContainer width="300px">
|
|
133
|
-
<DxcContextualMenu items={itemsWithTruncatedText} />
|
|
134
|
-
</DxcContainer>
|
|
135
|
-
</ExampleContainer>
|
|
136
|
-
<Title title="With scroll" theme="light" level={3} />
|
|
137
|
-
<ExampleContainer>
|
|
138
|
-
<DxcContainer height="300px" width="300px">
|
|
139
|
-
<DxcContextualMenu items={sectionsWithScroll} />
|
|
140
|
-
</DxcContainer>
|
|
141
|
-
</ExampleContainer>
|
|
142
|
-
<Title title="Width doesn't go below 248px" theme="light" level={3} />
|
|
143
|
-
<ExampleContainer>
|
|
144
|
-
<DxcContainer width="200px">
|
|
145
|
-
<DxcContextualMenu items={items} />
|
|
146
|
-
</DxcContainer>
|
|
147
|
-
</ExampleContainer>
|
|
148
|
-
</>
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
export const MenuItemStates = () => (
|
|
152
|
-
<>
|
|
153
|
-
<Title title="Default" theme="light" level={3} />
|
|
154
|
-
<ExampleContainer>
|
|
155
|
-
<MenuItemAction {...items[0]} selected={false} />
|
|
156
|
-
</ExampleContainer>
|
|
157
|
-
<Title title="Focus" theme="light" level={3} />
|
|
158
|
-
<ExampleContainer pseudoState="pseudo-focus">
|
|
159
|
-
<MenuItemAction {...items[0]} selected={false} />
|
|
160
|
-
</ExampleContainer>
|
|
161
|
-
<Title title="Hover" theme="light" level={3} />
|
|
162
|
-
<ExampleContainer pseudoState="pseudo-hover">
|
|
163
|
-
<MenuItemAction {...items[0]} selected={false} />
|
|
164
|
-
</ExampleContainer>
|
|
165
|
-
<Title title="Active" theme="light" level={3} />
|
|
166
|
-
<ExampleContainer pseudoState="pseudo-active">
|
|
167
|
-
<MenuItemAction {...items[0]} selected={false} />
|
|
168
|
-
</ExampleContainer>
|
|
169
|
-
<Title title="Selected" theme="light" level={3} />
|
|
170
|
-
<ExampleContainer>
|
|
171
|
-
<MenuItemAction {...items[0]} selected />
|
|
172
|
-
</ExampleContainer>
|
|
173
|
-
<Title title="Selected hover" theme="light" level={3} />
|
|
174
|
-
<ExampleContainer pseudoState="pseudo-hover">
|
|
175
|
-
<MenuItemAction {...items[0]} selected />
|
|
176
|
-
</ExampleContainer>
|
|
177
|
-
<Title title="Selected active" theme="light" level={3} />
|
|
178
|
-
<ExampleContainer pseudoState="pseudo-active">
|
|
179
|
-
<MenuItemAction {...items[0]} selected />
|
|
180
|
-
</ExampleContainer>
|
|
181
|
-
</>
|
|
182
|
-
);
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _react = _interopRequireDefault(require("react"));
|
|
5
|
-
var _react2 = require("@testing-library/react");
|
|
6
|
-
var _ContextualMenu = _interopRequireDefault(require("./ContextualMenu.tsx"));
|
|
7
|
-
var items = [{
|
|
8
|
-
label: "Item 1"
|
|
9
|
-
}, {
|
|
10
|
-
label: "Item 2"
|
|
11
|
-
}, {
|
|
12
|
-
label: "Item 3"
|
|
13
|
-
}, {
|
|
14
|
-
label: "Item 4"
|
|
15
|
-
}];
|
|
16
|
-
var sections = [{
|
|
17
|
-
title: "Team repositories",
|
|
18
|
-
items: [{
|
|
19
|
-
label: "Approved locations"
|
|
20
|
-
}, {
|
|
21
|
-
label: "Approved locations"
|
|
22
|
-
}, {
|
|
23
|
-
label: "Approved locations"
|
|
24
|
-
}]
|
|
25
|
-
}, {
|
|
26
|
-
items: [{
|
|
27
|
-
label: "Approved locations"
|
|
28
|
-
}, {
|
|
29
|
-
label: "Approved locations"
|
|
30
|
-
}, {
|
|
31
|
-
label: "Approved locations"
|
|
32
|
-
}]
|
|
33
|
-
}];
|
|
34
|
-
describe("Context menu component tests", function () {
|
|
35
|
-
test("Context menu renders with correct aria attributes", function () {
|
|
36
|
-
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ContextualMenu["default"], {
|
|
37
|
-
items: items,
|
|
38
|
-
defaultSelectedItemIndex: 0
|
|
39
|
-
})),
|
|
40
|
-
getAllByRole = _render.getAllByRole,
|
|
41
|
-
getByRole = _render.getByRole;
|
|
42
|
-
expect(getAllByRole("menuitem").length).toBe(4);
|
|
43
|
-
var actions = getAllByRole("button");
|
|
44
|
-
expect(actions[0].getAttribute("aria-selected")).toBeTruthy();
|
|
45
|
-
expect(getByRole("menu")).toBeTruthy();
|
|
46
|
-
});
|
|
47
|
-
test("Context menu (with sections) renders with correct aria attributes", function () {
|
|
48
|
-
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ContextualMenu["default"], {
|
|
49
|
-
items: sections,
|
|
50
|
-
defaultSelectedItemIndex: 4
|
|
51
|
-
})),
|
|
52
|
-
getAllByRole = _render2.getAllByRole;
|
|
53
|
-
expect(getAllByRole("menuitem").length).toBe(6);
|
|
54
|
-
var actions = getAllByRole("button");
|
|
55
|
-
expect(actions[4].getAttribute("aria-selected")).toBeTruthy();
|
|
56
|
-
expect(getAllByRole("group").length).toBe(2);
|
|
57
|
-
});
|
|
58
|
-
test("onSelect event from each item is called correctly", function () {
|
|
59
|
-
var test = [{
|
|
60
|
-
label: "Tested item",
|
|
61
|
-
onSelect: jest.fn()
|
|
62
|
-
}];
|
|
63
|
-
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ContextualMenu["default"], {
|
|
64
|
-
items: test
|
|
65
|
-
})),
|
|
66
|
-
getByRole = _render3.getByRole;
|
|
67
|
-
var item = getByRole("button");
|
|
68
|
-
_react2.fireEvent.click(item);
|
|
69
|
-
expect(test[0].onSelect).toHaveBeenCalled();
|
|
70
|
-
});
|
|
71
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = void 0;
|
|
8
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
-
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
-
var _coreTokens = _interopRequireDefault(require("../common/coreTokens"));
|
|
12
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
13
|
-
var MenuItemAction = function MenuItemAction(_ref) {
|
|
14
|
-
var label = _ref.label,
|
|
15
|
-
icon = _ref.icon,
|
|
16
|
-
slot = _ref.slot,
|
|
17
|
-
selected = _ref.selected,
|
|
18
|
-
onSelect = _ref.onSelect;
|
|
19
|
-
return /*#__PURE__*/_react["default"].createElement(Action, {
|
|
20
|
-
"aria-selected": selected,
|
|
21
|
-
selected: selected,
|
|
22
|
-
onClick: function onClick() {
|
|
23
|
-
return onSelect();
|
|
24
|
-
}
|
|
25
|
-
}, /*#__PURE__*/_react["default"].createElement(Label, null, icon && /*#__PURE__*/_react["default"].createElement(Icon, {
|
|
26
|
-
"aria-hidden": true
|
|
27
|
-
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
28
|
-
src: icon
|
|
29
|
-
}) : icon), /*#__PURE__*/_react["default"].createElement(Text, {
|
|
30
|
-
onMouseEnter: function onMouseEnter(event) {
|
|
31
|
-
var text = event.currentTarget;
|
|
32
|
-
if (text.title === "" && text.scrollWidth > text.clientWidth) text.title = label;
|
|
33
|
-
}
|
|
34
|
-
}, label)), slot);
|
|
35
|
-
};
|
|
36
|
-
var Action = _styledComponents["default"].button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n border: none;\n border-radius: 4px;\n padding: ", " ", ";\n box-shadow: inset 0 0 0 2px transparent;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: 24px;\n ", ";\n cursor: pointer;\n overflow: hidden;\n\n &:hover {\n ", ";\n }\n &:active {\n ", ";\n }\n &:focus {\n outline: 2px solid ", ";\n outline-offset: -1px;\n }\n"])), _coreTokens["default"].spacing_4, _coreTokens["default"].spacing_8, _coreTokens["default"].spacing_16, _coreTokens["default"].color_grey_900, _coreTokens["default"].type_sans, _coreTokens["default"].type_scale_02, function (props) {
|
|
37
|
-
return props.selected ? "background-color: ".concat(_coreTokens["default"].color_purple_100, "; font-weight: ").concat(_coreTokens["default"].type_semibold, ";") : "background-color: ".concat(_coreTokens["default"].color_transparent);
|
|
38
|
-
}, function (props) {
|
|
39
|
-
return props.selected ? "background-color: ".concat(_coreTokens["default"].color_purple_200, ";") : "background-color: ".concat(_coreTokens["default"].color_grey_100, ";");
|
|
40
|
-
}, function (props) {
|
|
41
|
-
return props.selected ? "background-color: ".concat(_coreTokens["default"].color_purple_200, ";") : "background-color: ".concat(_coreTokens["default"].color_grey_100, ";");
|
|
42
|
-
}, _coreTokens["default"].color_blue_600);
|
|
43
|
-
var Label = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n gap: ", ";\n overflow: hidden;\n"])), _coreTokens["default"].spacing_8);
|
|
44
|
-
var Text = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"])));
|
|
45
|
-
var Icon = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n"])));
|
|
46
|
-
var _default = exports["default"] = /*#__PURE__*/_react["default"].memo(MenuItemAction);
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { NotificationProps, CommonProps, ContextualProps } from "../badge/types";
|
|
3
|
-
type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
4
|
-
export type Item = {
|
|
5
|
-
label: string;
|
|
6
|
-
icon?: string | SVG;
|
|
7
|
-
slot?: React.ReactNode;
|
|
8
|
-
onSelect?: () => void;
|
|
9
|
-
};
|
|
10
|
-
export type Section = {
|
|
11
|
-
title?: string;
|
|
12
|
-
items: Item[];
|
|
13
|
-
};
|
|
14
|
-
type Props = {
|
|
15
|
-
defaultSelectedItemIndex?: number;
|
|
16
|
-
items: Item[] | Section[];
|
|
17
|
-
};
|
|
18
|
-
export type MenuItemActionProps = Item & {
|
|
19
|
-
selected: boolean;
|
|
20
|
-
};
|
|
21
|
-
export type BadgeProps = (ContextualProps | NotificationProps) & Omit<CommonProps, "size">;
|
|
22
|
-
export default Props;
|
package/contextual-menu/types.js
DELETED
package/date-input/Calendar.d.ts
DELETED
package/date-input/Calendar.js
DELETED
|
@@ -1,214 +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 _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
-
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
14
|
-
var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
15
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
16
|
-
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); }
|
|
17
|
-
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 && Object.prototype.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; }
|
|
18
|
-
var getDays = function getDays(innerDate) {
|
|
19
|
-
var monthDayCells = [];
|
|
20
|
-
var lastMonthNumberOfDays = innerDate.set("month", innerDate.get("month") - 1).endOf("month");
|
|
21
|
-
var firstDayOfMonth = innerDate.startOf("month").day() === 0 ? 6 : innerDate.startOf("month").day() - 1;
|
|
22
|
-
var daysInMonth = firstDayOfMonth + innerDate.daysInMonth();
|
|
23
|
-
for (var i = 0; i < 42; i++) {
|
|
24
|
-
if (i < firstDayOfMonth) {
|
|
25
|
-
monthDayCells.push({
|
|
26
|
-
day: lastMonthNumberOfDays.get("date") - firstDayOfMonth + i + 1,
|
|
27
|
-
month: innerDate.get("month") ? innerDate.get("month") - 1 : 11,
|
|
28
|
-
year: innerDate.set("month", innerDate.get("month") - 1).get("year")
|
|
29
|
-
});
|
|
30
|
-
} else if (i < daysInMonth) {
|
|
31
|
-
monthDayCells.push({
|
|
32
|
-
day: i - firstDayOfMonth + 1,
|
|
33
|
-
month: innerDate.get("month"),
|
|
34
|
-
year: innerDate.get("year")
|
|
35
|
-
});
|
|
36
|
-
} else {
|
|
37
|
-
monthDayCells.push({
|
|
38
|
-
day: i - daysInMonth + 1,
|
|
39
|
-
month: innerDate.get("month") === 11 ? 0 : innerDate.get("month") + 1,
|
|
40
|
-
year: innerDate.set("month", innerDate.get("month") + 1).get("year")
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return monthDayCells;
|
|
45
|
-
};
|
|
46
|
-
var getDateToFocus = function getDateToFocus(selectedDate, innerDate, today) {
|
|
47
|
-
return (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("month")) === innerDate.get("month") && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("year")) === innerDate.get("year") ? selectedDate : today.get("month") === innerDate.get("month") && today.get("year") === innerDate.get("year") ? today : innerDate.set("date", 1);
|
|
48
|
-
};
|
|
49
|
-
var isDaySelected = function isDaySelected(date, selectedDate) {
|
|
50
|
-
return (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("month")) === date.month && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("year")) === date.year && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("date")) === date.day;
|
|
51
|
-
};
|
|
52
|
-
var Calendar = function Calendar(_ref) {
|
|
53
|
-
var selectedDate = _ref.selectedDate,
|
|
54
|
-
innerDate = _ref.innerDate,
|
|
55
|
-
onInnerDateChange = _ref.onInnerDateChange,
|
|
56
|
-
onDaySelect = _ref.onDaySelect,
|
|
57
|
-
today = _ref.today;
|
|
58
|
-
var _useState = (0, _react.useState)(getDateToFocus(selectedDate, innerDate, today)),
|
|
59
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
60
|
-
dateToFocus = _useState2[0],
|
|
61
|
-
setDateToFocus = _useState2[1];
|
|
62
|
-
var _useState3 = (0, _react.useState)(false),
|
|
63
|
-
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
64
|
-
isFocusable = _useState4[0],
|
|
65
|
-
setIsFocusable = _useState4[1];
|
|
66
|
-
var dayCells = (0, _react.useMemo)(function () {
|
|
67
|
-
return getDays(innerDate);
|
|
68
|
-
}, [innerDate]);
|
|
69
|
-
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
70
|
-
var weekDays = translatedLabels.calendar.daysShort;
|
|
71
|
-
var onDateClickHandler = function onDateClickHandler(date) {
|
|
72
|
-
var newDate = innerDate.set("month", date.month).set("date", date.day);
|
|
73
|
-
onDaySelect(newDate);
|
|
74
|
-
setDateToFocus(newDate);
|
|
75
|
-
};
|
|
76
|
-
var handleOnBlur = function handleOnBlur(event) {
|
|
77
|
-
if (!(event !== null && event !== void 0 && event.currentTarget.contains(event.relatedTarget))) {
|
|
78
|
-
setDateToFocus(getDateToFocus(selectedDate, innerDate, today));
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
var focusDate = function focusDate(date) {
|
|
82
|
-
if (innerDate.get("month") !== date.get("month") || innerDate.get("year") !== date.get("year")) {
|
|
83
|
-
onInnerDateChange(date);
|
|
84
|
-
}
|
|
85
|
-
setDateToFocus(date);
|
|
86
|
-
setIsFocusable(true);
|
|
87
|
-
};
|
|
88
|
-
(0, _react.useEffect)(function () {
|
|
89
|
-
if (isFocusable) {
|
|
90
|
-
var _document$getElementB;
|
|
91
|
-
(_document$getElementB = document.getElementById("day_".concat(dateToFocus.get("date"), "_month").concat(dateToFocus.get("month")))) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.focus();
|
|
92
|
-
setIsFocusable(false);
|
|
93
|
-
}
|
|
94
|
-
}, [dateToFocus, isFocusable]);
|
|
95
|
-
(0, _react.useEffect)(function () {
|
|
96
|
-
if (dateToFocus.get("month") !== innerDate.get("month") || dateToFocus.get("year") !== innerDate.get("year")) {
|
|
97
|
-
setDateToFocus(getDateToFocus(selectedDate, innerDate, today));
|
|
98
|
-
}
|
|
99
|
-
}, [innerDate, dateToFocus, selectedDate, today]);
|
|
100
|
-
var handleDayKeyboardEvent = function handleDayKeyboardEvent(event, date) {
|
|
101
|
-
var dateToFocusTemp = date.month === innerDate.get("month") ? innerDate.set("date", date.day) : innerDate.set("date", date.day).set("month", date.month);
|
|
102
|
-
switch (event.key) {
|
|
103
|
-
case "PageUp":
|
|
104
|
-
event.preventDefault();
|
|
105
|
-
event.shiftKey ? dateToFocusTemp = dateToFocusTemp.set("year", dateToFocusTemp.get("year") - 1) : dateToFocusTemp = dateToFocusTemp.set("month", dateToFocusTemp.get("month") - 1);
|
|
106
|
-
focusDate(dateToFocusTemp);
|
|
107
|
-
break;
|
|
108
|
-
case "PageDown":
|
|
109
|
-
event.preventDefault();
|
|
110
|
-
event.shiftKey ? dateToFocusTemp = dateToFocusTemp.set("year", dateToFocusTemp.get("year") + 1) : dateToFocusTemp = dateToFocusTemp.set("month", dateToFocusTemp.get("month") + 1);
|
|
111
|
-
focusDate(dateToFocusTemp);
|
|
112
|
-
break;
|
|
113
|
-
case "ArrowLeft":
|
|
114
|
-
event.preventDefault();
|
|
115
|
-
dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") - 1);
|
|
116
|
-
focusDate(dateToFocusTemp);
|
|
117
|
-
break;
|
|
118
|
-
case "ArrowRight":
|
|
119
|
-
event.preventDefault();
|
|
120
|
-
dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") + 1);
|
|
121
|
-
focusDate(dateToFocusTemp);
|
|
122
|
-
break;
|
|
123
|
-
case "ArrowUp":
|
|
124
|
-
event.preventDefault();
|
|
125
|
-
dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") - 7);
|
|
126
|
-
focusDate(dateToFocusTemp);
|
|
127
|
-
break;
|
|
128
|
-
case "ArrowDown":
|
|
129
|
-
event.preventDefault();
|
|
130
|
-
dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") + 7);
|
|
131
|
-
focusDate(dateToFocusTemp);
|
|
132
|
-
break;
|
|
133
|
-
case "Home":
|
|
134
|
-
event.preventDefault();
|
|
135
|
-
dateToFocus.get("day") !== 0 ? dateToFocusTemp = dateToFocusTemp.day(1) : dateToFocusTemp = innerDate.date(date.day - 1).day(1);
|
|
136
|
-
focusDate(dateToFocusTemp);
|
|
137
|
-
break;
|
|
138
|
-
case "End":
|
|
139
|
-
event.preventDefault();
|
|
140
|
-
dateToFocusTemp.get("day") !== 0 && (dateToFocusTemp = dateToFocusTemp.day(7));
|
|
141
|
-
focusDate(dateToFocusTemp);
|
|
142
|
-
break;
|
|
143
|
-
case " ":
|
|
144
|
-
event.preventDefault();
|
|
145
|
-
onDaySelect(dateToFocusTemp);
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
return /*#__PURE__*/_react["default"].createElement(CalendarContainer, null, /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
150
|
-
alignItems: "center",
|
|
151
|
-
justifyContent: "space-between"
|
|
152
|
-
}, weekDays.map(function (weekDay) {
|
|
153
|
-
return /*#__PURE__*/_react["default"].createElement(WeekHeaderCell, {
|
|
154
|
-
key: weekDay
|
|
155
|
-
}, weekDay);
|
|
156
|
-
})), /*#__PURE__*/_react["default"].createElement(DayCellsContainer, {
|
|
157
|
-
onBlur: handleOnBlur
|
|
158
|
-
}, dayCells.map(function (date, index) {
|
|
159
|
-
return /*#__PURE__*/_react["default"].createElement(DayCell, {
|
|
160
|
-
onKeyDown: function onKeyDown(event) {
|
|
161
|
-
return handleDayKeyboardEvent(event, date);
|
|
162
|
-
},
|
|
163
|
-
"aria-label": date.day,
|
|
164
|
-
id: "day_".concat(date.day, "_month").concat(date.month),
|
|
165
|
-
key: "day_".concat(index),
|
|
166
|
-
onClick: function onClick() {
|
|
167
|
-
return onDateClickHandler(date);
|
|
168
|
-
},
|
|
169
|
-
selected: isDaySelected(date, selectedDate),
|
|
170
|
-
actualMonth: date.month === innerDate.get("month"),
|
|
171
|
-
autoFocus: date.day === dateToFocus.get("date") && date.month === dateToFocus.get("month"),
|
|
172
|
-
"aria-selected": isDaySelected(date, selectedDate),
|
|
173
|
-
tabIndex: date.day === dateToFocus.get("date") && date.month === dateToFocus.get("month") ? 0 : -1,
|
|
174
|
-
isCurrentDay: today.get("date") === date.day && today.get("month") === innerDate.get("month") && today.get("month") === date.month && today.get("year") === innerDate.get("year")
|
|
175
|
-
}, date.day);
|
|
176
|
-
})));
|
|
177
|
-
};
|
|
178
|
-
var CalendarContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 0px 8px 8px 8px;\n width: 292px;\n font-family: ", ";\n font-size: ", ";\n color: ", ";\n font-weight: ", ";\n"])), function (props) {
|
|
179
|
-
return props.theme.dateInput.pickerFontFamily;
|
|
180
|
-
}, function (props) {
|
|
181
|
-
return props.theme.dateInput.pickerFontSize;
|
|
182
|
-
}, function (props) {
|
|
183
|
-
return props.theme.dateInput.pickerFontColor;
|
|
184
|
-
}, function (props) {
|
|
185
|
-
return props.theme.dateInput.pickerFontWeight;
|
|
186
|
-
});
|
|
187
|
-
var WeekHeaderCell = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n"])));
|
|
188
|
-
var DayCellsContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n gap: 4px;\n flex-wrap: wrap;\n justify-content: space-between;\n"])));
|
|
189
|
-
var DayCell = _styledComponents["default"].button(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n width: 36px;\n height: 36px;\n padding: 0;\n border: none;\n border-radius: 50%;\n cursor: pointer;\n font-family: ", ";\n font-size: ", ";\n color: ", ";\n font-weight: ", ";\n\n &:focus {\n outline: ", " solid 2px;\n }\n &:hover {\n background-color: ", ";\n color: ", ";\n }\n &:active {\n background-color: ", ";\n color: ", ";\n }\n\n ", "\n background-color: ", ";\n color: ", ";\n"])), function (props) {
|
|
190
|
-
return props.theme.dateInput.pickerFontFamily;
|
|
191
|
-
}, function (props) {
|
|
192
|
-
return props.theme.dateInput.pickerFontSize;
|
|
193
|
-
}, function (props) {
|
|
194
|
-
return props.theme.dateInput.pickerFontColor;
|
|
195
|
-
}, function (props) {
|
|
196
|
-
return props.theme.dateInput.pickerFontWeight;
|
|
197
|
-
}, function (props) {
|
|
198
|
-
return props.theme.dateInput.pickerFocusColor;
|
|
199
|
-
}, function (props) {
|
|
200
|
-
return props.selected ? props.theme.dateInput.pickerSelectedBackgroundColor : props.theme.dateInput.pickerHoverBackgroundColor;
|
|
201
|
-
}, function (props) {
|
|
202
|
-
return props.selected ? props.theme.dateInput.pickerSelectedFontColor : props.theme.dateInput.pickerHoverFontColor;
|
|
203
|
-
}, function (props) {
|
|
204
|
-
return props.theme.dateInput.pickerActiveBackgroundColor;
|
|
205
|
-
}, function (props) {
|
|
206
|
-
return props.theme.dateInput.pickerActiveFontColor;
|
|
207
|
-
}, function (props) {
|
|
208
|
-
return props.isCurrentDay && !props.selected && "border: ".concat(props.theme.dateInput.pickerCurrentDateBorderWidth, " solid ").concat(props.theme.dateInput.pickerCurrentDateBorderColor, ";");
|
|
209
|
-
}, function (props) {
|
|
210
|
-
return props.selected ? props.theme.dateInput.pickerSelectedBackgroundColor : "transparent";
|
|
211
|
-
}, function (props) {
|
|
212
|
-
return props.selected ? props.theme.dateInput.pickerSelectedFontColor : props.isCurrentDay ? props.theme.dateInput.pickerCurrentDateFontColor : !props.actualMonth ? props.theme.dateInput.pickerNonCurrentMonthFontColor : props.theme.dateInput.pickerFontColor;
|
|
213
|
-
});
|
|
214
|
-
var _default = exports["default"] = /*#__PURE__*/_react["default"].memo(Calendar);
|