@dxc-technology/halstack-react 0.0.0-de7c6b0 → 0.0.0-dec566a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BackgroundColorContext.d.ts +1 -10
- package/BackgroundColorContext.js +4 -21
- package/HalstackContext.d.ts +52 -139
- package/HalstackContext.js +11 -36
- package/README.md +47 -0
- package/accordion/Accordion.js +31 -84
- package/accordion/Accordion.stories.tsx +5 -50
- package/accordion/Accordion.test.js +18 -33
- package/accordion/types.d.ts +6 -6
- package/accordion-group/AccordionGroup.d.ts +2 -3
- package/accordion-group/AccordionGroup.js +17 -44
- package/accordion-group/AccordionGroup.stories.tsx +1 -1
- package/accordion-group/AccordionGroup.test.js +42 -60
- package/accordion-group/AccordionGroupAccordion.js +11 -23
- package/accordion-group/AccordionGroupContext.d.ts +3 -0
- package/accordion-group/AccordionGroupContext.js +8 -0
- package/accordion-group/types.d.ts +7 -7
- package/action-icon/ActionIcon.d.ts +4 -0
- package/action-icon/ActionIcon.js +48 -0
- package/action-icon/ActionIcon.stories.tsx +41 -0
- package/action-icon/ActionIcon.test.js +64 -0
- package/action-icon/types.d.ts +26 -0
- package/alert/Alert.js +29 -118
- package/alert/Alert.test.js +28 -45
- package/alert/types.d.ts +5 -5
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +141 -43
- package/badge/Badge.stories.tsx +210 -0
- package/badge/Badge.test.js +30 -0
- package/badge/types.d.ts +52 -3
- package/bleed/Bleed.js +13 -21
- package/bleed/types.d.ts +2 -2
- package/box/Box.js +11 -33
- package/box/Box.test.js +1 -6
- package/box/types.d.ts +3 -3
- package/bulleted-list/BulletedList.js +22 -55
- package/bulleted-list/BulletedList.stories.tsx +2 -93
- package/bulleted-list/types.d.ts +5 -5
- package/button/Button.d.ts +1 -1
- package/button/Button.js +68 -100
- package/button/Button.stories.tsx +33 -132
- package/button/Button.test.js +19 -16
- package/button/types.d.ts +9 -5
- package/card/Card.js +21 -44
- package/card/Card.test.js +10 -21
- package/card/types.d.ts +5 -5
- package/checkbox/Checkbox.js +85 -120
- package/checkbox/Checkbox.stories.tsx +16 -54
- package/checkbox/Checkbox.test.js +107 -63
- package/checkbox/types.d.ts +8 -4
- package/chip/Chip.js +12 -31
- package/chip/Chip.stories.tsx +1 -1
- package/chip/Chip.test.js +15 -28
- package/chip/types.d.ts +4 -4
- package/common/coreTokens.d.ts +105 -14
- package/common/coreTokens.js +41 -24
- package/common/utils.js +2 -8
- package/common/variables.d.ts +52 -139
- package/common/variables.js +63 -157
- package/container/Container.d.ts +4 -0
- package/container/Container.js +194 -0
- package/container/Container.stories.tsx +214 -0
- package/container/types.d.ts +74 -0
- package/contextual-menu/ContextualMenu.d.ts +7 -0
- package/contextual-menu/ContextualMenu.js +71 -0
- package/contextual-menu/ContextualMenu.stories.tsx +182 -0
- package/contextual-menu/ContextualMenu.test.js +71 -0
- package/contextual-menu/MenuItemAction.d.ts +4 -0
- package/contextual-menu/MenuItemAction.js +46 -0
- package/contextual-menu/types.d.ts +22 -0
- package/contextual-menu/types.js +5 -0
- package/date-input/Calendar.js +15 -59
- package/date-input/DateInput.js +50 -96
- package/date-input/DateInput.stories.tsx +11 -30
- package/date-input/DateInput.test.js +674 -701
- package/date-input/DatePicker.js +11 -42
- package/date-input/Icons.d.ts +6 -6
- package/date-input/Icons.js +6 -23
- package/date-input/YearPicker.js +8 -34
- package/date-input/types.d.ts +28 -22
- package/dialog/Dialog.js +13 -40
- package/dialog/Dialog.stories.tsx +170 -0
- package/dialog/Dialog.test.js +125 -187
- package/dialog/types.d.ts +18 -13
- package/divider/Divider.d.ts +4 -0
- package/divider/Divider.js +36 -0
- package/divider/Divider.stories.tsx +223 -0
- package/divider/Divider.test.js +38 -0
- package/divider/types.d.ts +21 -0
- package/divider/types.js +5 -0
- package/dropdown/Dropdown.js +59 -128
- package/dropdown/Dropdown.stories.tsx +5 -16
- package/dropdown/Dropdown.test.js +391 -378
- package/dropdown/DropdownMenu.js +8 -19
- package/dropdown/DropdownMenuItem.js +11 -20
- package/dropdown/types.d.ts +20 -24
- package/file-input/FileInput.js +180 -248
- package/file-input/FileInput.stories.tsx +1 -1
- package/file-input/FileInput.test.js +356 -354
- package/file-input/FileItem.js +14 -41
- package/file-input/types.d.ts +10 -10
- package/flex/Flex.js +25 -39
- package/flex/types.d.ts +6 -6
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +70 -102
- package/footer/Footer.stories.tsx +37 -6
- package/footer/Footer.test.js +21 -33
- package/footer/Icons.d.ts +3 -2
- package/footer/Icons.js +66 -7
- package/footer/types.d.ts +25 -21
- package/grid/Grid.d.ts +1 -1
- package/grid/Grid.js +2 -17
- package/grid/Grid.stories.tsx +38 -38
- package/grid/types.d.ts +10 -10
- package/header/Header.d.ts +1 -1
- package/header/Header.js +28 -84
- package/header/Header.test.js +12 -25
- package/header/Icons.d.ts +2 -2
- package/header/Icons.js +2 -7
- package/header/types.d.ts +7 -8
- package/heading/Heading.js +9 -31
- package/heading/Heading.test.js +70 -87
- package/heading/types.d.ts +7 -7
- package/icon/Icon.d.ts +4 -0
- package/icon/Icon.js +33 -0
- package/icon/Icon.stories.tsx +28 -0
- package/icon/types.d.ts +4 -0
- package/icon/types.js +5 -0
- package/image/Image.d.ts +4 -0
- package/image/Image.js +70 -0
- package/image/Image.stories.tsx +129 -0
- package/image/types.d.ts +72 -0
- package/image/types.js +5 -0
- package/inset/Inset.js +13 -21
- package/inset/types.d.ts +2 -2
- package/layout/ApplicationLayout.d.ts +2 -2
- package/layout/ApplicationLayout.js +29 -66
- package/layout/ApplicationLayout.stories.tsx +1 -1
- package/layout/Icons.d.ts +8 -5
- package/layout/Icons.js +51 -59
- package/layout/types.d.ts +3 -3
- package/link/Link.js +21 -42
- package/link/Link.test.js +23 -41
- package/link/types.d.ts +14 -14
- package/main.d.ts +8 -4
- package/main.js +39 -59
- package/nav-tabs/NavTabs.d.ts +1 -2
- package/nav-tabs/NavTabs.js +19 -48
- package/nav-tabs/NavTabs.stories.tsx +7 -5
- package/nav-tabs/NavTabs.test.js +38 -44
- package/nav-tabs/NavTabsContext.d.ts +3 -0
- package/nav-tabs/NavTabsContext.js +8 -0
- package/nav-tabs/Tab.js +24 -52
- package/nav-tabs/types.d.ts +9 -9
- package/number-input/NumberInput.js +46 -36
- package/number-input/NumberInput.stories.tsx +42 -26
- package/number-input/NumberInput.test.js +859 -412
- package/number-input/NumberInputContext.d.ts +3 -4
- package/number-input/NumberInputContext.js +3 -14
- package/number-input/types.d.ts +17 -5
- package/package.json +30 -28
- package/paginator/Icons.d.ts +5 -5
- package/paginator/Icons.js +5 -19
- package/paginator/Paginator.js +15 -43
- package/paginator/Paginator.test.js +224 -207
- package/paginator/types.d.ts +3 -3
- package/paragraph/Paragraph.js +3 -19
- package/paragraph/Paragraph.stories.tsx +0 -17
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +35 -0
- package/password-input/PasswordInput.js +57 -126
- package/password-input/PasswordInput.stories.tsx +1 -33
- package/password-input/PasswordInput.test.js +157 -140
- package/password-input/types.d.ts +8 -7
- package/progress-bar/ProgressBar.js +21 -53
- package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +1 -1
- package/progress-bar/ProgressBar.test.js +35 -52
- package/progress-bar/types.d.ts +3 -3
- package/quick-nav/QuickNav.js +4 -27
- package/quick-nav/QuickNav.stories.tsx +1 -1
- package/quick-nav/types.d.ts +10 -10
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +22 -54
- package/radio-group/RadioGroup.js +37 -83
- package/radio-group/RadioGroup.stories.tsx +10 -10
- package/radio-group/RadioGroup.test.js +504 -470
- package/radio-group/types.d.ts +8 -8
- package/resultset-table/Icons.d.ts +7 -0
- package/{resultsetTable → resultset-table}/Icons.js +1 -5
- package/resultset-table/ResultsetTable.d.ts +7 -0
- package/{resultsetTable → resultset-table}/ResultsetTable.js +44 -69
- package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +106 -5
- package/{resultsetTable → resultset-table}/ResultsetTable.test.js +148 -92
- package/{resultsetTable → resultset-table}/types.d.ts +44 -11
- package/resultset-table/types.js +5 -0
- package/select/Icons.d.ts +7 -7
- package/select/Icons.js +1 -5
- package/select/Listbox.js +13 -39
- package/select/Option.js +17 -27
- package/select/Select.js +87 -163
- package/select/Select.stories.tsx +3 -3
- package/select/Select.test.js +1946 -1804
- package/select/types.d.ts +14 -15
- package/sidenav/Icons.d.ts +4 -4
- package/sidenav/Icons.js +1 -5
- package/sidenav/Sidenav.js +29 -70
- package/sidenav/Sidenav.test.js +3 -10
- package/{layout → sidenav}/SidenavContext.d.ts +1 -1
- package/{layout → sidenav}/SidenavContext.js +3 -9
- package/sidenav/types.d.ts +18 -18
- package/slider/Slider.js +68 -125
- package/slider/Slider.test.js +107 -103
- package/slider/types.d.ts +4 -4
- package/spinner/Spinner.js +16 -54
- package/spinner/Spinner.test.js +25 -34
- package/spinner/types.d.ts +3 -3
- package/status-light/StatusLight.d.ts +4 -0
- package/status-light/StatusLight.js +51 -0
- package/status-light/StatusLight.stories.tsx +74 -0
- package/status-light/StatusLight.test.js +25 -0
- package/status-light/types.d.ts +17 -0
- package/status-light/types.js +5 -0
- package/switch/Switch.js +49 -97
- package/switch/Switch.stories.tsx +0 -34
- package/switch/Switch.test.js +51 -96
- package/switch/types.d.ts +4 -4
- package/table/DropdownTheme.js +62 -0
- package/table/Table.d.ts +6 -2
- package/table/Table.js +76 -33
- package/table/{Table.stories.jsx → Table.stories.tsx} +297 -2
- package/table/Table.test.js +93 -6
- package/table/types.d.ts +34 -6
- package/tabs/Tab.js +17 -33
- package/tabs/Tabs.js +52 -129
- package/tabs/Tabs.stories.tsx +1 -1
- package/tabs/Tabs.test.js +62 -118
- package/tabs/types.d.ts +19 -19
- package/tag/Tag.js +21 -51
- package/tag/Tag.test.js +19 -30
- package/tag/types.d.ts +7 -7
- package/text-input/Suggestion.js +9 -26
- package/text-input/Suggestions.d.ts +1 -1
- package/text-input/Suggestions.js +19 -67
- package/text-input/TextInput.js +221 -327
- package/text-input/TextInput.stories.tsx +49 -153
- package/text-input/TextInput.test.js +1227 -1194
- package/text-input/types.d.ts +25 -17
- package/textarea/Textarea.js +67 -109
- package/textarea/{Textarea.stories.jsx → Textarea.stories.tsx} +58 -100
- package/textarea/Textarea.test.js +150 -179
- package/textarea/types.d.ts +9 -5
- package/toggle-group/ToggleGroup.js +90 -107
- package/toggle-group/ToggleGroup.stories.tsx +7 -4
- package/toggle-group/ToggleGroup.test.js +68 -87
- package/toggle-group/types.d.ts +26 -17
- package/typography/Typography.js +4 -13
- package/typography/types.d.ts +1 -1
- package/useTheme.d.ts +49 -136
- package/useTheme.js +1 -8
- package/useTranslatedLabels.js +1 -7
- package/utils/BaseTypography.d.ts +2 -2
- package/utils/BaseTypography.js +16 -30
- package/utils/FocusLock.js +25 -39
- package/wizard/Wizard.js +14 -49
- package/wizard/Wizard.test.js +53 -80
- package/wizard/types.d.ts +7 -7
- package/common/OpenSans.css +0 -69
- package/common/fonts/OpenSans-Bold.ttf +0 -0
- package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-Italic.ttf +0 -0
- package/common/fonts/OpenSans-Light.ttf +0 -0
- package/common/fonts/OpenSans-LightItalic.ttf +0 -0
- package/common/fonts/OpenSans-Regular.ttf +0 -0
- package/common/fonts/OpenSans-SemiBold.ttf +0 -0
- package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- package/number-input/numberInputContextTypes.d.ts +0 -19
- package/resultsetTable/Icons.d.ts +0 -7
- package/resultsetTable/ResultsetTable.d.ts +0 -4
- package/slider/Slider.stories.tsx +0 -240
- package/text-input/Icons.d.ts +0 -8
- package/text-input/Icons.js +0 -60
- /package/{resultsetTable → action-icon}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → container/types.js} +0 -0
- /package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +0 -0
|
@@ -0,0 +1,182 @@
|
|
|
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
|
+
);
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
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);
|
|
@@ -0,0 +1,22 @@
|
|
|
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/date-input/Calendar.js
CHANGED
|
@@ -1,38 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
9
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
|
|
16
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
|
|
18
12
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
19
|
-
|
|
20
13
|
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
21
|
-
|
|
22
|
-
var _main = require("../main");
|
|
23
|
-
|
|
14
|
+
var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
24
15
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
-
|
|
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; }
|
|
30
18
|
var getDays = function getDays(innerDate) {
|
|
31
19
|
var monthDayCells = [];
|
|
32
20
|
var lastMonthNumberOfDays = innerDate.set("month", innerDate.get("month") - 1).endOf("month");
|
|
33
21
|
var firstDayOfMonth = innerDate.startOf("month").day() === 0 ? 6 : innerDate.startOf("month").day() - 1;
|
|
34
22
|
var daysInMonth = firstDayOfMonth + innerDate.daysInMonth();
|
|
35
|
-
|
|
36
23
|
for (var i = 0; i < 42; i++) {
|
|
37
24
|
if (i < firstDayOfMonth) {
|
|
38
25
|
monthDayCells.push({
|
|
@@ -54,66 +41,53 @@ var getDays = function getDays(innerDate) {
|
|
|
54
41
|
});
|
|
55
42
|
}
|
|
56
43
|
}
|
|
57
|
-
|
|
58
44
|
return monthDayCells;
|
|
59
45
|
};
|
|
60
|
-
|
|
61
46
|
var getDateToFocus = function getDateToFocus(selectedDate, innerDate, today) {
|
|
62
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);
|
|
63
48
|
};
|
|
64
|
-
|
|
65
49
|
var isDaySelected = function isDaySelected(date, selectedDate) {
|
|
66
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;
|
|
67
51
|
};
|
|
68
|
-
|
|
69
52
|
var Calendar = function Calendar(_ref) {
|
|
70
53
|
var selectedDate = _ref.selectedDate,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
54
|
+
innerDate = _ref.innerDate,
|
|
55
|
+
onInnerDateChange = _ref.onInnerDateChange,
|
|
56
|
+
onDaySelect = _ref.onDaySelect,
|
|
57
|
+
today = _ref.today;
|
|
76
58
|
var _useState = (0, _react.useState)(getDateToFocus(selectedDate, innerDate, today)),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
59
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
60
|
+
dateToFocus = _useState2[0],
|
|
61
|
+
setDateToFocus = _useState2[1];
|
|
81
62
|
var _useState3 = (0, _react.useState)(false),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
63
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
64
|
+
isFocusable = _useState4[0],
|
|
65
|
+
setIsFocusable = _useState4[1];
|
|
86
66
|
var dayCells = (0, _react.useMemo)(function () {
|
|
87
67
|
return getDays(innerDate);
|
|
88
68
|
}, [innerDate]);
|
|
89
69
|
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
90
70
|
var weekDays = translatedLabels.calendar.daysShort;
|
|
91
|
-
|
|
92
71
|
var onDateClickHandler = function onDateClickHandler(date) {
|
|
93
72
|
var newDate = innerDate.set("month", date.month).set("date", date.day);
|
|
94
73
|
onDaySelect(newDate);
|
|
95
74
|
setDateToFocus(newDate);
|
|
96
75
|
};
|
|
97
|
-
|
|
98
76
|
var handleOnBlur = function handleOnBlur(event) {
|
|
99
77
|
if (!(event !== null && event !== void 0 && event.currentTarget.contains(event.relatedTarget))) {
|
|
100
78
|
setDateToFocus(getDateToFocus(selectedDate, innerDate, today));
|
|
101
79
|
}
|
|
102
80
|
};
|
|
103
|
-
|
|
104
81
|
var focusDate = function focusDate(date) {
|
|
105
82
|
if (innerDate.get("month") !== date.get("month") || innerDate.get("year") !== date.get("year")) {
|
|
106
83
|
onInnerDateChange(date);
|
|
107
84
|
}
|
|
108
|
-
|
|
109
85
|
setDateToFocus(date);
|
|
110
86
|
setIsFocusable(true);
|
|
111
87
|
};
|
|
112
|
-
|
|
113
88
|
(0, _react.useEffect)(function () {
|
|
114
89
|
if (isFocusable) {
|
|
115
90
|
var _document$getElementB;
|
|
116
|
-
|
|
117
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();
|
|
118
92
|
setIsFocusable(false);
|
|
119
93
|
}
|
|
@@ -123,67 +97,56 @@ var Calendar = function Calendar(_ref) {
|
|
|
123
97
|
setDateToFocus(getDateToFocus(selectedDate, innerDate, today));
|
|
124
98
|
}
|
|
125
99
|
}, [innerDate, dateToFocus, selectedDate, today]);
|
|
126
|
-
|
|
127
100
|
var handleDayKeyboardEvent = function handleDayKeyboardEvent(event, date) {
|
|
128
101
|
var dateToFocusTemp = date.month === innerDate.get("month") ? innerDate.set("date", date.day) : innerDate.set("date", date.day).set("month", date.month);
|
|
129
|
-
|
|
130
102
|
switch (event.key) {
|
|
131
103
|
case "PageUp":
|
|
132
104
|
event.preventDefault();
|
|
133
105
|
event.shiftKey ? dateToFocusTemp = dateToFocusTemp.set("year", dateToFocusTemp.get("year") - 1) : dateToFocusTemp = dateToFocusTemp.set("month", dateToFocusTemp.get("month") - 1);
|
|
134
106
|
focusDate(dateToFocusTemp);
|
|
135
107
|
break;
|
|
136
|
-
|
|
137
108
|
case "PageDown":
|
|
138
109
|
event.preventDefault();
|
|
139
110
|
event.shiftKey ? dateToFocusTemp = dateToFocusTemp.set("year", dateToFocusTemp.get("year") + 1) : dateToFocusTemp = dateToFocusTemp.set("month", dateToFocusTemp.get("month") + 1);
|
|
140
111
|
focusDate(dateToFocusTemp);
|
|
141
112
|
break;
|
|
142
|
-
|
|
143
113
|
case "ArrowLeft":
|
|
144
114
|
event.preventDefault();
|
|
145
115
|
dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") - 1);
|
|
146
116
|
focusDate(dateToFocusTemp);
|
|
147
117
|
break;
|
|
148
|
-
|
|
149
118
|
case "ArrowRight":
|
|
150
119
|
event.preventDefault();
|
|
151
120
|
dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") + 1);
|
|
152
121
|
focusDate(dateToFocusTemp);
|
|
153
122
|
break;
|
|
154
|
-
|
|
155
123
|
case "ArrowUp":
|
|
156
124
|
event.preventDefault();
|
|
157
125
|
dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") - 7);
|
|
158
126
|
focusDate(dateToFocusTemp);
|
|
159
127
|
break;
|
|
160
|
-
|
|
161
128
|
case "ArrowDown":
|
|
162
129
|
event.preventDefault();
|
|
163
130
|
dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") + 7);
|
|
164
131
|
focusDate(dateToFocusTemp);
|
|
165
132
|
break;
|
|
166
|
-
|
|
167
133
|
case "Home":
|
|
168
134
|
event.preventDefault();
|
|
169
135
|
dateToFocus.get("day") !== 0 ? dateToFocusTemp = dateToFocusTemp.day(1) : dateToFocusTemp = innerDate.date(date.day - 1).day(1);
|
|
170
136
|
focusDate(dateToFocusTemp);
|
|
171
137
|
break;
|
|
172
|
-
|
|
173
138
|
case "End":
|
|
174
139
|
event.preventDefault();
|
|
175
140
|
dateToFocusTemp.get("day") !== 0 && (dateToFocusTemp = dateToFocusTemp.day(7));
|
|
176
141
|
focusDate(dateToFocusTemp);
|
|
177
142
|
break;
|
|
178
|
-
|
|
179
143
|
case " ":
|
|
180
144
|
event.preventDefault();
|
|
181
145
|
onDaySelect(dateToFocusTemp);
|
|
182
146
|
break;
|
|
183
147
|
}
|
|
184
148
|
};
|
|
185
|
-
|
|
186
|
-
return /*#__PURE__*/_react["default"].createElement(CalendarContainer, null, /*#__PURE__*/_react["default"].createElement(_main.DxcFlex, {
|
|
149
|
+
return /*#__PURE__*/_react["default"].createElement(CalendarContainer, null, /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
187
150
|
alignItems: "center",
|
|
188
151
|
justifyContent: "space-between"
|
|
189
152
|
}, weekDays.map(function (weekDay) {
|
|
@@ -212,7 +175,6 @@ var Calendar = function Calendar(_ref) {
|
|
|
212
175
|
}, date.day);
|
|
213
176
|
})));
|
|
214
177
|
};
|
|
215
|
-
|
|
216
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) {
|
|
217
179
|
return props.theme.dateInput.pickerFontFamily;
|
|
218
180
|
}, function (props) {
|
|
@@ -222,11 +184,8 @@ var CalendarContainer = _styledComponents["default"].div(_templateObject || (_te
|
|
|
222
184
|
}, function (props) {
|
|
223
185
|
return props.theme.dateInput.pickerFontWeight;
|
|
224
186
|
});
|
|
225
|
-
|
|
226
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"])));
|
|
227
|
-
|
|
228
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"])));
|
|
229
|
-
|
|
230
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) {
|
|
231
190
|
return props.theme.dateInput.pickerFontFamily;
|
|
232
191
|
}, function (props) {
|
|
@@ -252,7 +211,4 @@ var DayCell = _styledComponents["default"].button(_templateObject4 || (_template
|
|
|
252
211
|
}, function (props) {
|
|
253
212
|
return props.selected ? props.theme.dateInput.pickerSelectedFontColor : props.isCurrentDay ? props.theme.dateInput.pickerCurrentDateFontColor : !props.actualMonth ? props.theme.dateInput.pickerNonCurrentMonthFontColor : props.theme.dateInput.pickerFontColor;
|
|
254
213
|
});
|
|
255
|
-
|
|
256
|
-
var _default = /*#__PURE__*/_react["default"].memo(Calendar);
|
|
257
|
-
|
|
258
|
-
exports["default"] = _default;
|
|
214
|
+
var _default = exports["default"] = /*#__PURE__*/_react["default"].memo(Calendar);
|