@councilbox/councilbox-ui 2.0.53 → 2.0.55
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/Accordion.js +3 -0
- package/Alert.js +3 -0
- package/Avatar.js +3 -0
- package/AvatarGroup.js +3 -0
- package/Block.js +3 -0
- package/Button.js +3 -0
- package/ButtonBasic.js +3 -0
- package/Checkbox.js +3 -0
- package/DatePicker.js +3 -0
- package/DateRangePicker.js +3 -0
- package/DateTimePicker.js +3 -0
- package/DragDrop.js +3 -0
- package/DrawerPanel.js +3 -0
- package/DropDown.js +3 -0
- package/EnhancedTable.js +3 -0
- package/FabButton.js +3 -0
- package/Grid.js +3 -0
- package/Header.js +3 -0
- package/IconButton.js +3 -0
- package/IconButtonSquare.js +3 -0
- package/IconFont.js +3 -0
- package/InputAutocomplete.js +3 -0
- package/InputPassword.js +3 -0
- package/InputText.js +3 -0
- package/InputTextArea.js +3 -0
- package/LoadingSection.js +3 -0
- package/MenuItem.js +3 -0
- package/MenuLateralLeft.js +3 -0
- package/MenuLateralRight.js +3 -0
- package/Modal.js +3 -0
- package/Radio.js +3 -0
- package/RichTextInput.js +3 -0
- package/Scrollbar.js +3 -0
- package/ScrollbarNew.js +3 -0
- package/SelectInput.js +3 -0
- package/Slider.js +3 -0
- package/Spacing.js +3 -0
- package/Stars.js +3 -0
- package/Stepper.js +3 -0
- package/Table.js +3 -0
- package/TableBody.js +3 -0
- package/TableCell.js +3 -0
- package/TableContainer.js +3 -0
- package/TableHead.js +3 -0
- package/TableRow.js +3 -0
- package/TableSortLabel.js +3 -0
- package/Tabs.js +3 -0
- package/Tag.js +3 -0
- package/TextInput.js +3 -0
- package/ThemeProvider.js +3 -0
- package/TimePicker.js +3 -0
- package/Timeline.js +3 -0
- package/ToastProvider.js +3 -0
- package/Toggle.js +3 -0
- package/Tooltip.js +3 -0
- package/Typography.js +3 -0
- package/dist/HOCs/overlayA11yStack.js +47 -0
- package/dist/HOCs/useA11yGuard.js +38 -0
- package/dist/HOCs/useDynamicStyles.js +41 -60
- package/dist/HOCs/useMenuNavigation.js +110 -0
- package/dist/HOCs/useOverlay.js +87 -0
- package/dist/HOCs/usePopoverPosition.js +228 -0
- package/dist/HOCs/useRipple.js +17 -35
- package/dist/HOCs/useWindowSize.js +24 -42
- package/dist/build-index.js +119 -99
- package/dist/components/1.Introduction.stories.mdx +4 -1
- package/dist/components/2.Changelog.stories.mdx +54 -0
- package/dist/components/3.Guide.stories.mdx +1 -1
- package/dist/components/Accordion/Accordion.css +7 -0
- package/dist/components/Accordion/Accordion.js +97 -102
- package/dist/components/Accordion/Accordion.stories.js +10 -12
- package/dist/components/Accordion/DesignAccordion.stories.js +10 -21
- package/dist/components/Alert/Alert.js +55 -55
- package/dist/components/Alert/Alert.stories.js +10 -11
- package/dist/components/Avatar/Avatar.js +82 -74
- package/dist/components/Avatar/Avatar.stories.js +19 -23
- package/dist/components/Avatar/DesignAvatar.stories.js +18 -26
- package/dist/components/Avatar/DesignAvatarText.stories.js +31 -40
- package/dist/components/AvatarGroup/AvatarGroup.js +7 -14
- package/dist/components/AvatarGroup/AvatarGroup.stories.js +6 -13
- package/dist/components/AvatarGroup/DesignAvatarGroup.stories.js +34 -45
- package/dist/components/Block/Block.css +3 -3
- package/dist/components/Block/Block.js +31 -45
- package/dist/components/Block/Block.stories.js +5 -12
- package/dist/components/Block/DesignBlock.stories.js +7 -13
- package/dist/components/Button/Button.js +44 -66
- package/dist/components/Button/Button.stories.js +8 -14
- package/dist/components/Button/button.css +1 -1
- package/dist/components/ButtonBasic/ButtonBasic.css +6 -1
- package/dist/components/ButtonBasic/ButtonBasic.js +96 -118
- package/dist/components/ButtonBasic/ButtonBasic.stories.js +14 -15
- package/dist/components/Checkbox/Checkbox.css +6 -0
- package/dist/components/Checkbox/Checkbox.js +81 -100
- package/dist/components/Checkbox/Checkbox.stories.js +10 -11
- package/dist/components/DatePicker/Calendar.js +243 -0
- package/dist/components/DatePicker/DatePicker.css +197 -0
- package/dist/components/DatePicker/DatePicker.js +384 -0
- package/dist/components/DatePicker/DatePicker.stories.js +180 -0
- package/dist/components/DatePicker/dateUtils.js +478 -0
- package/dist/components/DateRangePicker/DateRangePicker.css +41 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +435 -0
- package/dist/components/DateRangePicker/DateRangePicker.stories.js +147 -0
- package/dist/components/DateRangePicker/RangeCalendar.js +188 -0
- package/dist/components/DateTimePicker/DateTimePicker.css +4 -0
- package/dist/components/DateTimePicker/DateTimePicker.js +481 -0
- package/dist/components/DateTimePicker/DateTimePicker.stories.js +144 -0
- package/dist/components/DateTimePicker/TimeColumns.css +46 -0
- package/dist/components/DateTimePicker/TimeColumns.js +175 -0
- package/dist/components/DragDrop/DragDrop.css +20 -9
- package/dist/components/DragDrop/DragDrop.js +83 -76
- package/dist/components/DragDrop/DragDrop.stories.js +9 -16
- package/dist/components/DrawerPanel/DesignDrawerPanel.js +35 -53
- package/dist/components/DrawerPanel/DrawerPanel.js +157 -146
- package/dist/components/DrawerPanel/DrawerPanel.stories.js +10 -12
- package/dist/components/DropDown/DesignDropDown.stories.js +87 -97
- package/dist/components/DropDown/DropDown.js +179 -343
- package/dist/components/DropDown/DropDown.stories.js +6 -12
- package/dist/components/DropDown/PopoverPlayground.js +68 -98
- package/dist/components/EnhancedTable/DesignEnhancedTable.stories.js +26 -36
- package/dist/components/EnhancedTable/EnhancedMyTable.js +16 -19
- package/dist/components/EnhancedTable/EnhancedTable.js +77 -136
- package/dist/components/EnhancedTable/EnhancedTable.stories.js +5 -12
- package/dist/components/EnhancedTable/EnhancedTableBody.js +11 -14
- package/dist/components/EnhancedTable/EnhancedTableCell.js +25 -34
- package/dist/components/EnhancedTable/EnhancedTableContainer.js +11 -14
- package/dist/components/EnhancedTable/EnhancedTableHead.js +11 -14
- package/dist/components/EnhancedTable/EnhancedTableRow.js +15 -18
- package/dist/components/EnhancedTable/EnhancedTableSortLabel.js +15 -18
- package/dist/components/FabButton/DesignFabButton.stories.js +9 -16
- package/dist/components/FabButton/FabButton.js +51 -54
- package/dist/components/FabButton/FabButton.stories.js +10 -12
- package/dist/components/Grid/DesignGrid.stories.js +7 -14
- package/dist/components/Grid/Grid.js +38 -46
- package/dist/components/Grid/Grid.stories.js +6 -13
- package/dist/components/Grid/GridItem.js +37 -39
- package/dist/components/Header/DesignHeader.stories.js +20 -24
- package/dist/components/Header/Header.js +227 -246
- package/dist/components/Header/Header.stories.js +9 -21
- package/dist/components/Header/header.css +10 -5
- package/dist/components/IconButton/DesignIconButton.stories.js +31 -36
- package/dist/components/IconButton/IconButton.css +6 -1
- package/dist/components/IconButton/IconButton.js +135 -140
- package/dist/components/IconButton/IconButton.stories.js +12 -13
- package/dist/components/IconButtonSquare/DesignIconButtonSquare.stories.js +5 -11
- package/dist/components/IconButtonSquare/IconButtonSquare.js +14 -28
- package/dist/components/IconButtonSquare/IconButtonSquare.stories.js +7 -13
- package/dist/components/IconFont/IconFont.js +27 -48
- package/dist/components/IconFont/IconFont.stories.js +5 -11
- package/dist/components/InputAutocomplete/InputAutocomplete.css +6 -0
- package/dist/components/InputAutocomplete/InputAutocomplete.js +184 -260
- package/dist/components/InputAutocomplete/InputAutocomplete.stories.js +5 -11
- package/dist/components/InputPassword/InputPassword.css +0 -6
- package/dist/components/InputPassword/InputPassword.js +58 -73
- package/dist/components/InputPassword/InputPassword.stories.js +5 -11
- package/dist/components/InputText/InputText.css +96 -83
- package/dist/components/InputText/InputText.js +211 -215
- package/dist/components/InputText/InputText.stories.js +11 -11
- package/dist/components/InputTextArea/DesignInputTextArea.stories.js +38 -51
- package/dist/components/InputTextArea/InputTextArea.js +84 -93
- package/dist/components/InputTextArea/InputTextArea.stories.js +5 -12
- package/dist/components/LoadingSection/LoadingSection.js +44 -51
- package/dist/components/LoadingSection/LoadingSection.stories.js +5 -11
- package/dist/components/MenuItem/DesignMenuItem.stories.js +20 -34
- package/dist/components/MenuItem/MenuItem.css +7 -2
- package/dist/components/MenuItem/MenuItem.js +131 -140
- package/dist/components/MenuItem/MenuItem.stories.js +6 -15
- package/dist/components/MenuLateralLeft/MenuLateralLeft.css +24 -0
- package/dist/components/MenuLateralLeft/MenuLateralLeft.js +120 -157
- package/dist/components/MenuLateralLeft/MenuLateralLeft.stories.js +5 -12
- package/dist/components/MenuLateralRight/MenuLateralRight.css +2 -2
- package/dist/components/MenuLateralRight/MenuLateralRight.js +91 -79
- package/dist/components/MenuLateralRight/MenuLateralRight.stories.js +5 -12
- package/dist/components/Modal/DesignModal.stories.js +15 -30
- package/dist/components/Modal/Modal.css +35 -15
- package/dist/components/Modal/Modal.js +156 -145
- package/dist/components/Modal/Modal.stories.js +7 -16
- package/dist/components/PaginationFooter/DesignPaginationFooter.stories.js +4 -10
- package/dist/components/PaginationFooter/PaginationFooter.css +10 -0
- package/dist/components/PaginationFooter/PaginationFooter.js +99 -91
- package/dist/components/PaginationFooter/PaginationFooter.stories.js +5 -12
- package/dist/components/RadioButton/Radio.css +19 -18
- package/dist/components/RadioButton/Radio.js +65 -83
- package/dist/components/RadioButton/Radio.stories.js +27 -36
- package/dist/components/RichTextInput/DesignRichTextInput.stories.js +119 -0
- package/dist/components/RichTextInput/RichTextInput.css +309 -0
- package/dist/components/RichTextInput/RichTextInput.js +851 -0
- package/dist/components/RichTextInput/RichTextInput.stories.js +33 -0
- package/dist/components/Ripple/DesignRipple.js +42 -41
- package/dist/components/Ripple/Ripple.stories.js +5 -11
- package/dist/components/Scrollbar/DesignScrollbar.js +5 -10
- package/dist/components/Scrollbar/Scrollbar.js +37 -56
- package/dist/components/Scrollbar/Scrollbar.stories.js +5 -12
- package/dist/components/ScrollbarNew/DesignScrollbarNew.js +24 -0
- package/dist/components/ScrollbarNew/ScrollbarNew.css +79 -0
- package/dist/components/ScrollbarNew/ScrollbarNew.js +426 -0
- package/dist/components/ScrollbarNew/ScrollbarNew.stories.js +37 -0
- package/dist/components/SelectInput/DesignSelectInput.js +22 -45
- package/dist/components/SelectInput/SelectInput.js +171 -218
- package/dist/components/SelectInput/SelectInput.stories.js +6 -15
- package/dist/components/Slider/DesignSlider.js +8 -14
- package/dist/components/Slider/Slider.css +57 -37
- package/dist/components/Slider/Slider.js +85 -84
- package/dist/components/Slider/Slider.stories.js +5 -12
- package/dist/components/Spacing/Spacing.js +38 -45
- package/dist/components/Spacing/Spacing.stories.js +5 -11
- package/dist/components/Stars/DesignStars.js +17 -30
- package/dist/components/Stars/Stars.css +55 -104
- package/dist/components/Stars/Stars.js +89 -73
- package/dist/components/Stars/Stars.stories.js +5 -12
- package/dist/components/Stepper/DesignStepper.stories.js +16 -30
- package/dist/components/Stepper/Stepper.css +46 -10
- package/dist/components/Stepper/Stepper.js +118 -134
- package/dist/components/Stepper/Stepper.stories.js +5 -12
- package/dist/components/Table/DesignTable.stories.js +200 -211
- package/dist/components/Table/Table.css +33 -2
- package/dist/components/Table/Table.js +30 -38
- package/dist/components/Table/Table.stories.js +5 -12
- package/dist/components/Table/TableBody.js +22 -34
- package/dist/components/Table/TableCell.js +71 -61
- package/dist/components/Table/TableContainer.js +22 -34
- package/dist/components/Table/TableHead.js +22 -34
- package/dist/components/Table/TableRow.js +33 -37
- package/dist/components/Table/TableSortLabel.js +42 -52
- package/dist/components/Tabs/DesignTabs.js +14 -28
- package/dist/components/Tabs/Tabs.css +30 -11
- package/dist/components/Tabs/Tabs.js +151 -138
- package/dist/components/Tabs/Tabs.stories.js +5 -12
- package/dist/components/Tag/DesignTags.stories.js +24 -39
- package/dist/components/Tag/Tag.css +61 -42
- package/dist/components/Tag/Tag.js +93 -91
- package/dist/components/Tag/Tag.stories.js +5 -12
- package/dist/components/TextInput/TextInput.js +38 -54
- package/dist/components/TextInput/TextInput.stories.js +5 -11
- package/dist/components/ThemeProvider/Colors.js +2 -2
- package/dist/components/ThemeProvider/CouncilboxThemeContext.js +7 -10
- package/dist/components/ThemeProvider/ThemeProvider.js +34 -52
- package/dist/components/TimePicker/TimePicker.css +3 -0
- package/dist/components/TimePicker/TimePicker.js +359 -0
- package/dist/components/TimePicker/TimePicker.stories.js +132 -0
- package/dist/components/Timeline/DesignTimeline.stories.js +4 -10
- package/dist/components/Timeline/Timeline.js +66 -46
- package/dist/components/Timeline/Timeline.stories.js +5 -12
- package/dist/components/Toast/DesignToast.stories.js +174 -0
- package/dist/components/Toast/Toast.css +154 -0
- package/dist/components/Toast/Toast.js +165 -0
- package/dist/components/Toast/Toast.stories.js +33 -0
- package/dist/components/Toast/ToastProvider.js +33 -0
- package/dist/components/Toast/ToastRoot.js +89 -0
- package/dist/components/Toast/toastStore.js +127 -0
- package/dist/components/Toast/useToast.js +42 -0
- package/dist/components/Toggle/Toggle.css +10 -0
- package/dist/components/Toggle/Toggle.js +123 -100
- package/dist/components/Toggle/Toggle.stories.js +10 -11
- package/dist/components/Tooltip/DesignTooltip.stories.js +10 -16
- package/dist/components/Tooltip/Tooltip.css +17 -1
- package/dist/components/Tooltip/Tooltip.js +195 -366
- package/dist/components/Tooltip/Tooltip.stories.js +5 -12
- package/dist/components/Typography/Typography.css +57 -6
- package/dist/components/Typography/Typography.js +44 -97
- package/dist/components/Typography/Typography.stories.js +5 -11
- package/dist/index.js +2 -6
- package/dist/reportWebVitals.js +8 -14
- package/dist/storybook.test.js +2 -4
- package/dist/styles/colorConsts.css +4 -4
- package/dist/styles/main.css +16 -0
- package/dist/styles/styleFont.css +1 -1
- package/dist/styles/stylesheet.js +10 -22
- package/dist/styles/zIndexConsts.css +2 -0
- package/dist/testing/TestAutocomplete.js +74 -97
- package/dist/testing/TestComponents.js +5 -10
- package/dist/testing/TestDropdown.js +33 -41
- package/dist/utils/autoDetectScroll.js +12 -35
- package/dist/utils/index.js +37 -63
- package/dist/utils/useFallbackId.js +19 -0
- package/package.json +67 -4
- package/toast.js +7 -0
- package/useCouncilboxTheme.js +7 -0
- package/useToast.js +7 -0
- package/dist/components/Accordion/AccordionOld.css +0 -16
- package/dist/components/Accordion/AccordionOld.js +0 -115
- package/dist/components/Avatar/AvatarOld.js +0 -138
- package/dist/components/ButtonBasic/ButtonBasicOld.css +0 -41
- package/dist/components/ButtonBasic/ButtonBasicOld.js +0 -231
- package/dist/components/Checkbox/CheckboxOld.css +0 -31
- package/dist/components/Checkbox/CheckboxOld.js +0 -112
- package/dist/components/DrawerPanel/DrawerPanelOld.css +0 -56
- package/dist/components/DrawerPanel/DrawerPanelOld.js +0 -233
- package/dist/components/DropDown/DropDownOld.css +0 -3
- package/dist/components/DropDown/DropDownOld.js +0 -186
- package/dist/components/Grid/GridItemOld.js +0 -43
- package/dist/components/Grid/GridOld.css +0 -0
- package/dist/components/Grid/GridOld.js +0 -53
- package/dist/components/IconButton/IconButtonOld.css +0 -0
- package/dist/components/IconButton/IconButtonOld.js +0 -138
- package/dist/components/IconButtonSquare/IconButtonSquareOld.css +0 -43
- package/dist/components/IconButtonSquare/IconButtonSquareOld.js +0 -133
- package/dist/components/InputAutocomplete/InputAutocompleteOld.css +0 -5
- package/dist/components/InputAutocomplete/InputAutocompleteOld.js +0 -178
- package/dist/components/InputText/InputTextOld.css +0 -10
- package/dist/components/InputText/InputTextOld.js +0 -340
- package/dist/components/MenuItem/MenuItemOld.js +0 -139
- package/dist/components/Modal/ModalOld.css +0 -3
- package/dist/components/Modal/ModalOld.js +0 -230
- package/dist/components/RadioButton/RadioOld.css +0 -31
- package/dist/components/RadioButton/RadioOld.js +0 -142
- package/dist/components/SelectInput/SelectInputOld.css +0 -17
- package/dist/components/SelectInput/SelectInputOld.js +0 -325
- package/dist/components/Table/TableOld.css +0 -79
- package/dist/components/Table/TableOld.js +0 -165
- package/dist/components/Tabs/TabsOld.js +0 -92
- package/dist/components/Typography/TypographyOld.js +0 -132
|
@@ -17,111 +17,88 @@ exports.isNode = isNode;
|
|
|
17
17
|
exports.isOverflowElement = isOverflowElement;
|
|
18
18
|
exports.isShadowRoot = isShadowRoot;
|
|
19
19
|
exports.unwrapElement = void 0;
|
|
20
|
-
|
|
21
20
|
function getWindow(node) {
|
|
22
21
|
var _node$ownerDocument;
|
|
23
|
-
|
|
24
22
|
return (node === null || node === void 0 ? void 0 : (_node$ownerDocument = node.ownerDocument) === null || _node$ownerDocument === void 0 ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
25
23
|
}
|
|
26
|
-
|
|
27
24
|
function isHTMLElement(value) {
|
|
28
25
|
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
function isShadowRoot(value) {
|
|
32
28
|
if (typeof ShadowRoot === 'undefined') {
|
|
33
29
|
return false;
|
|
34
30
|
}
|
|
35
|
-
|
|
36
31
|
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
37
32
|
}
|
|
38
|
-
|
|
39
33
|
function getDocumentElement(node) {
|
|
40
34
|
var _ref;
|
|
41
|
-
|
|
42
35
|
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) === null || _ref === void 0 ? void 0 : _ref.documentElement;
|
|
43
36
|
}
|
|
44
|
-
|
|
45
37
|
function isNode(value) {
|
|
46
38
|
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
47
39
|
}
|
|
48
|
-
|
|
49
40
|
function getNodeName(node) {
|
|
50
41
|
if (isNode(node)) {
|
|
51
42
|
return (node.nodeName || '').toLowerCase();
|
|
52
43
|
}
|
|
53
|
-
|
|
54
44
|
return '#document';
|
|
55
45
|
}
|
|
56
|
-
|
|
57
46
|
function getParentNode(node) {
|
|
58
47
|
if (getNodeName(node) === 'html') {
|
|
59
48
|
return node;
|
|
60
49
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
node.assignedSlot ||
|
|
64
|
-
|
|
65
|
-
|
|
50
|
+
var result =
|
|
51
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
52
|
+
node.assignedSlot ||
|
|
53
|
+
// DOM Element detected.
|
|
54
|
+
node.parentNode ||
|
|
55
|
+
// ShadowRoot detected.
|
|
56
|
+
isShadowRoot(node) && node.host ||
|
|
57
|
+
// Fallback.
|
|
66
58
|
getDocumentElement(node);
|
|
67
59
|
return isShadowRoot(result) ? result.host : result;
|
|
68
60
|
}
|
|
69
|
-
|
|
70
61
|
function isOverflowElement(element) {
|
|
71
62
|
var _getComputedStyle = getComputedStyle(element),
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
63
|
+
overflow = _getComputedStyle.overflow,
|
|
64
|
+
overflowX = _getComputedStyle.overflowX,
|
|
65
|
+
overflowY = _getComputedStyle.overflowY,
|
|
66
|
+
display = _getComputedStyle.display;
|
|
77
67
|
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
|
|
78
68
|
}
|
|
79
|
-
|
|
80
69
|
function isLastTraversableNode(node) {
|
|
81
70
|
return ['html', 'body', '#document'].includes(getNodeName(node));
|
|
82
71
|
}
|
|
83
|
-
|
|
84
72
|
function getNearestOverflowAncestor(node) {
|
|
85
73
|
var parentNode = getParentNode(node);
|
|
86
|
-
|
|
87
74
|
if (isLastTraversableNode(parentNode)) {
|
|
88
75
|
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
89
76
|
}
|
|
90
|
-
|
|
91
77
|
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
92
78
|
return parentNode;
|
|
93
79
|
}
|
|
94
|
-
|
|
95
80
|
return getNearestOverflowAncestor(parentNode);
|
|
96
81
|
}
|
|
97
|
-
|
|
98
82
|
function getFrameElement(win) {
|
|
99
83
|
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
100
84
|
}
|
|
101
|
-
|
|
102
85
|
function getOverflowAncestors(node) {
|
|
103
86
|
var _node$ownerDocument2;
|
|
104
|
-
|
|
105
87
|
var list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
106
88
|
var traverseIframes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
107
89
|
var scrollableAncestor = getNearestOverflowAncestor(node);
|
|
108
90
|
var isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) === null || _node$ownerDocument2 === void 0 ? void 0 : _node$ownerDocument2.body);
|
|
109
91
|
var win = getWindow(scrollableAncestor);
|
|
110
|
-
|
|
111
92
|
if (isBody) {
|
|
112
93
|
var frameElement = getFrameElement(win);
|
|
113
94
|
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
114
95
|
}
|
|
115
|
-
|
|
116
96
|
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
117
97
|
}
|
|
118
|
-
|
|
119
98
|
function isElement(value) {
|
|
120
99
|
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
121
100
|
}
|
|
122
|
-
|
|
123
101
|
var unwrapElement = function unwrapElement(element) {
|
|
124
102
|
return !isElement(element) ? element.contextElement : element;
|
|
125
103
|
};
|
|
126
|
-
|
|
127
104
|
exports.unwrapElement = unwrapElement;
|
package/dist/utils/index.js
CHANGED
|
@@ -3,57 +3,43 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useKeyItemNavigation = exports.enhanceClickableChildren = void 0;
|
|
7
|
-
|
|
6
|
+
exports.useKeyItemNavigation = exports.getOuterSize = exports.enhanceClickableChildren = void 0;
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
-
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
10
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
14
11
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25
|
-
|
|
26
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
27
|
-
|
|
28
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
29
|
-
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) { n[e] = r[e]; } return n; }
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
16
|
+
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; }
|
|
17
|
+
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) { _defineProperty(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; }
|
|
18
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
20
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
30
21
|
var enhanceClickableChildren = function enhanceClickableChildren(node, handler, handlerClose) {
|
|
31
22
|
var overrides = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
32
|
-
return _react
|
|
23
|
+
return _react["default"].Children.map(node, function (child, index) {
|
|
33
24
|
return enhanceChild(child, index, handler, handlerClose, overrides);
|
|
34
25
|
});
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
exports.enhanceClickableChildren = enhanceClickableChildren;
|
|
38
|
-
|
|
39
28
|
var enhanceChild = function enhanceChild(child, index, handler, handlerClose, overrides) {
|
|
40
|
-
if (
|
|
41
|
-
if (child.type === _react
|
|
29
|
+
if (/*#__PURE__*/_react["default"].isValidElement(child)) {
|
|
30
|
+
if (child.type === _react["default"].Fragment) {
|
|
42
31
|
return enhanceClickableChildren(child.props.children, handler, handlerClose, overrides);
|
|
43
32
|
}
|
|
44
|
-
|
|
45
33
|
var originalOnClick = child.props.onClick;
|
|
46
|
-
return /*#__PURE__*/_react
|
|
34
|
+
return /*#__PURE__*/_react["default"].cloneElement(child, _objectSpread({
|
|
47
35
|
key: child.key || index,
|
|
48
36
|
menuItems: child.props.menuItems && enhanceClickableChildren(child.props.menuItems, handler, handlerClose) || null,
|
|
49
37
|
onClick: handlerClose ? function (event) {
|
|
50
38
|
event.preventDefault();
|
|
51
39
|
event.stopPropagation();
|
|
52
|
-
|
|
53
40
|
if (originalOnClick) {
|
|
54
41
|
originalOnClick(event);
|
|
55
42
|
}
|
|
56
|
-
|
|
57
43
|
handlerClose(child, event);
|
|
58
44
|
} : function (event) {
|
|
59
45
|
event.preventDefault();
|
|
@@ -62,93 +48,81 @@ var enhanceChild = function enhanceChild(child, index, handler, handlerClose, ov
|
|
|
62
48
|
}
|
|
63
49
|
}, overrides));
|
|
64
50
|
}
|
|
65
|
-
|
|
66
51
|
return child;
|
|
67
52
|
};
|
|
68
|
-
|
|
69
53
|
var getDefaultSelectedChildNode = function getDefaultSelectedChildNode(childNodes) {
|
|
70
54
|
if (!childNodes) return null;
|
|
71
55
|
var active = Array.from(childNodes).findIndex(function (child) {
|
|
72
56
|
return child.className.includes('-active');
|
|
73
57
|
});
|
|
74
|
-
|
|
75
58
|
if (active === -1) {
|
|
76
59
|
return null;
|
|
77
60
|
}
|
|
78
|
-
|
|
79
61
|
return active;
|
|
80
62
|
};
|
|
81
|
-
|
|
82
63
|
var useKeyItemNavigation = function useKeyItemNavigation(_ref) {
|
|
83
64
|
var _containerRef$current, _containerRef$current3;
|
|
84
|
-
|
|
85
65
|
var containerRef = _ref.containerRef,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
_react.default.useLayoutEffect(function () {
|
|
66
|
+
_ref$canLoop = _ref.canLoop,
|
|
67
|
+
canLoop = _ref$canLoop === void 0 ? true : _ref$canLoop;
|
|
68
|
+
var _React$useState = _react["default"].useState(getDefaultSelectedChildNode((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.childNodes)),
|
|
69
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
70
|
+
itemFocus = _React$useState2[0],
|
|
71
|
+
setItemFocus = _React$useState2[1];
|
|
72
|
+
_react["default"].useLayoutEffect(function () {
|
|
95
73
|
var _containerRef$current2;
|
|
96
|
-
|
|
97
74
|
setItemFocus(getDefaultSelectedChildNode((_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.childNodes));
|
|
98
75
|
}, [(_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.childNodes]);
|
|
99
|
-
|
|
100
76
|
var handleKeyDown = function handleKeyDown(e) {
|
|
101
77
|
if (e.key === 'ArrowDown') {
|
|
102
78
|
var _containerRef$current5;
|
|
103
|
-
|
|
104
79
|
e.preventDefault();
|
|
105
80
|
e.stopPropagation();
|
|
106
81
|
var newItemFocus = itemFocus !== null ? itemFocus + 1 : 0;
|
|
107
|
-
|
|
108
82
|
if (newItemFocus >= containerRef.current.childNodes.length) {
|
|
109
83
|
if (canLoop) {
|
|
110
84
|
var _containerRef$current4;
|
|
111
|
-
|
|
112
85
|
(_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.childNodes[0].focus();
|
|
113
86
|
setItemFocus(0);
|
|
114
87
|
}
|
|
115
|
-
|
|
116
88
|
return;
|
|
117
89
|
}
|
|
118
|
-
|
|
119
90
|
(_containerRef$current5 = containerRef.current) === null || _containerRef$current5 === void 0 ? void 0 : _containerRef$current5.childNodes[newItemFocus].focus();
|
|
120
91
|
setItemFocus(newItemFocus);
|
|
121
92
|
}
|
|
122
|
-
|
|
123
93
|
if (e.key === 'ArrowUp') {
|
|
124
94
|
var _containerRef$current7;
|
|
125
|
-
|
|
126
95
|
e.preventDefault();
|
|
127
96
|
e.stopPropagation();
|
|
128
|
-
|
|
129
97
|
var _newItemFocus = itemFocus !== null ? itemFocus - 1 : containerRef.current.childNodes.length - 1;
|
|
130
|
-
|
|
131
98
|
if (_newItemFocus < 0) {
|
|
132
99
|
if (canLoop) {
|
|
133
100
|
var _containerRef$current6;
|
|
134
|
-
|
|
135
101
|
(_containerRef$current6 = containerRef.current) === null || _containerRef$current6 === void 0 ? void 0 : _containerRef$current6.childNodes[containerRef.current.childNodes.length - 1].focus();
|
|
136
102
|
setItemFocus(containerRef.current.childNodes.length - 1);
|
|
137
103
|
}
|
|
138
|
-
|
|
139
104
|
return;
|
|
140
105
|
}
|
|
141
|
-
|
|
142
106
|
(_containerRef$current7 = containerRef.current) === null || _containerRef$current7 === void 0 ? void 0 : _containerRef$current7.childNodes[_newItemFocus].focus();
|
|
143
107
|
setItemFocus(_newItemFocus);
|
|
144
108
|
}
|
|
145
109
|
};
|
|
146
|
-
|
|
147
110
|
return {
|
|
148
111
|
itemFocus: itemFocus,
|
|
149
112
|
setItemFocus: setItemFocus,
|
|
150
113
|
handleKeyDown: handleKeyDown
|
|
151
114
|
};
|
|
152
115
|
};
|
|
153
|
-
|
|
154
|
-
|
|
116
|
+
exports.useKeyItemNavigation = useKeyItemNavigation;
|
|
117
|
+
var getOuterSize = function getOuterSize(element) {
|
|
118
|
+
var _window$getComputedSt = window.getComputedStyle(element),
|
|
119
|
+
marginTop = _window$getComputedSt.marginTop,
|
|
120
|
+
marginRight = _window$getComputedSt.marginRight,
|
|
121
|
+
marginBottom = _window$getComputedSt.marginBottom,
|
|
122
|
+
marginLeft = _window$getComputedSt.marginLeft;
|
|
123
|
+
return {
|
|
124
|
+
width: element.offsetWidth + Number.parseFloat(marginLeft) + Number.parseFloat(marginRight),
|
|
125
|
+
height: element.offsetHeight + Number.parseFloat(marginTop) + Number.parseFloat(marginBottom)
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
exports.getOuterSize = getOuterSize;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
|
+
var useFallbackId = function useFallbackId() {
|
|
10
|
+
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'cbx';
|
|
11
|
+
var idRef = _react["default"].useRef(null);
|
|
12
|
+
if (idRef.current === null) {
|
|
13
|
+
var randomStr = Math.random().toString(36).substring(2, 9);
|
|
14
|
+
idRef.current = "".concat(prefix, "-").concat(randomStr);
|
|
15
|
+
}
|
|
16
|
+
return idRef.current;
|
|
17
|
+
};
|
|
18
|
+
var _default = useFallbackId;
|
|
19
|
+
exports["default"] = _default;
|
package/package.json
CHANGED
|
@@ -1,10 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@councilbox/councilbox-ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.55",
|
|
4
4
|
"main": "dist/build-index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
|
-
"README.md"
|
|
7
|
+
"README.md",
|
|
8
|
+
"Accordion.js",
|
|
9
|
+
"Alert.js",
|
|
10
|
+
"Avatar.js",
|
|
11
|
+
"AvatarGroup.js",
|
|
12
|
+
"Block.js",
|
|
13
|
+
"Button.js",
|
|
14
|
+
"ButtonBasic.js",
|
|
15
|
+
"Checkbox.js",
|
|
16
|
+
"DatePicker.js",
|
|
17
|
+
"DateRangePicker.js",
|
|
18
|
+
"DateTimePicker.js",
|
|
19
|
+
"DragDrop.js",
|
|
20
|
+
"DrawerPanel.js",
|
|
21
|
+
"DropDown.js",
|
|
22
|
+
"EnhancedTable.js",
|
|
23
|
+
"FabButton.js",
|
|
24
|
+
"Grid.js",
|
|
25
|
+
"Header.js",
|
|
26
|
+
"IconButton.js",
|
|
27
|
+
"IconButtonSquare.js",
|
|
28
|
+
"IconFont.js",
|
|
29
|
+
"InputAutocomplete.js",
|
|
30
|
+
"InputPassword.js",
|
|
31
|
+
"InputText.js",
|
|
32
|
+
"InputTextArea.js",
|
|
33
|
+
"LoadingSection.js",
|
|
34
|
+
"MenuItem.js",
|
|
35
|
+
"MenuLateralLeft.js",
|
|
36
|
+
"MenuLateralRight.js",
|
|
37
|
+
"Modal.js",
|
|
38
|
+
"Radio.js",
|
|
39
|
+
"RichTextInput.js",
|
|
40
|
+
"Scrollbar.js",
|
|
41
|
+
"ScrollbarNew.js",
|
|
42
|
+
"SelectInput.js",
|
|
43
|
+
"Slider.js",
|
|
44
|
+
"Spacing.js",
|
|
45
|
+
"Stars.js",
|
|
46
|
+
"Stepper.js",
|
|
47
|
+
"Table.js",
|
|
48
|
+
"TableBody.js",
|
|
49
|
+
"TableCell.js",
|
|
50
|
+
"TableContainer.js",
|
|
51
|
+
"TableHead.js",
|
|
52
|
+
"TableRow.js",
|
|
53
|
+
"TableSortLabel.js",
|
|
54
|
+
"Tabs.js",
|
|
55
|
+
"Tag.js",
|
|
56
|
+
"TextInput.js",
|
|
57
|
+
"ThemeProvider.js",
|
|
58
|
+
"TimePicker.js",
|
|
59
|
+
"Timeline.js",
|
|
60
|
+
"ToastProvider.js",
|
|
61
|
+
"Toggle.js",
|
|
62
|
+
"Tooltip.js",
|
|
63
|
+
"Typography.js",
|
|
64
|
+
"toast.js",
|
|
65
|
+
"useCouncilboxTheme.js",
|
|
66
|
+
"useToast.js"
|
|
8
67
|
],
|
|
9
68
|
"author": "Aarón Fuentes González <aaronfuentes86@gmail.com>",
|
|
10
69
|
"contributors": [
|
|
@@ -18,6 +77,7 @@
|
|
|
18
77
|
"@mui/icons-material": "^5.4.4",
|
|
19
78
|
"@mui/material": "^5.11.13",
|
|
20
79
|
"cross-env": "^7.0.3",
|
|
80
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
21
81
|
"prop-types": "^15.8.1",
|
|
22
82
|
"raw-loader": "^4.0.2",
|
|
23
83
|
"react-custom-scrollbars-2": "^4.5.0",
|
|
@@ -36,7 +96,7 @@
|
|
|
36
96
|
"build-storybook": "build-storybook -s public",
|
|
37
97
|
"lint": "eslint . --quiet --ext .js --ext .jsx",
|
|
38
98
|
"clean": "rimraf dist",
|
|
39
|
-
"compile": "yarn run clean && cross-env NODE_ENV=production babel src --out-dir dist --copy-files --ignore testing/*,__tests__,spec.js,test.js,stories.js,__snapshots__"
|
|
99
|
+
"compile": "yarn run clean && cross-env NODE_ENV=production babel src --out-dir dist --copy-files --ignore testing/*,__tests__,spec.js,test.js,stories.js,__snapshots__ && node scripts/generate-shims.js"
|
|
40
100
|
},
|
|
41
101
|
"babel": {
|
|
42
102
|
"presets": [
|
|
@@ -85,6 +145,7 @@
|
|
|
85
145
|
"@babel/preset-env": "^7.16.8",
|
|
86
146
|
"@babel/preset-react": "^7.16.7",
|
|
87
147
|
"@councilbox/eslint-config-base": "^0.0.1",
|
|
148
|
+
"@storybook/addon-a11y": "6.4.13",
|
|
88
149
|
"@storybook/addon-actions": "^6.4.13",
|
|
89
150
|
"@storybook/addon-essentials": "^6.4.13",
|
|
90
151
|
"@storybook/addon-links": "^6.4.13",
|
|
@@ -95,10 +156,12 @@
|
|
|
95
156
|
"@storybook/node-logger": "^6.4.13",
|
|
96
157
|
"@storybook/preset-create-react-app": "^4.0.0",
|
|
97
158
|
"@storybook/react": "^6.4.13",
|
|
159
|
+
"@storybook/test-runner": "0.9.4",
|
|
98
160
|
"@storybook/theming": "^6.4.13",
|
|
99
161
|
"@testing-library/jest-dom": "^5.14.1",
|
|
100
162
|
"@testing-library/react": "^12.0.0",
|
|
101
163
|
"@testing-library/user-event": "^13.2.1",
|
|
164
|
+
"axe-playwright": "^2.2.2",
|
|
102
165
|
"eslint-plugin-cypress": "^2.12.1",
|
|
103
166
|
"eslint-plugin-import": "^2.25.4",
|
|
104
167
|
"eslint-plugin-react": "^7.28.0",
|
|
@@ -112,7 +175,7 @@
|
|
|
112
175
|
},
|
|
113
176
|
"packageManager": "yarn@1.22.19",
|
|
114
177
|
"volta": {
|
|
115
|
-
"node": "
|
|
178
|
+
"node": "18.18.0",
|
|
116
179
|
"yarn": "1.22.19"
|
|
117
180
|
}
|
|
118
181
|
}
|
package/toast.js
ADDED
package/useToast.js
ADDED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
.cbx-Accordion-block-title {
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
justify-content: space-between;
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.cbx-Accordion-block,
|
|
9
|
-
.cbx-Accordion-block-title {
|
|
10
|
-
overflow: hidden;
|
|
11
|
-
width: 100%
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.cbx-Accordion-container-rigth-title {
|
|
15
|
-
padding: 0 1rem
|
|
16
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
|
-
var _Accordion = _interopRequireDefault(require("@mui/material/Accordion"));
|
|
13
|
-
|
|
14
|
-
var _AccordionSummary = _interopRequireDefault(require("@mui/material/AccordionSummary"));
|
|
15
|
-
|
|
16
|
-
var _AccordionDetails = _interopRequireDefault(require("@mui/material/AccordionDetails"));
|
|
17
|
-
|
|
18
|
-
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
19
|
-
|
|
20
|
-
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
21
|
-
|
|
22
|
-
require("../../styles/main.css");
|
|
23
|
-
|
|
24
|
-
require("./Accordion.css");
|
|
25
|
-
|
|
26
|
-
var _excluded = ["id", "className", "title", "contentRightTitle", "contentExpand", "disabled"];
|
|
27
|
-
|
|
28
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
|
-
|
|
30
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
31
|
-
|
|
32
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
33
|
-
|
|
34
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
35
|
-
|
|
36
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
37
|
-
|
|
38
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
39
|
-
|
|
40
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
41
|
-
|
|
42
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
43
|
-
|
|
44
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
45
|
-
|
|
46
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
47
|
-
|
|
48
|
-
var Accordion = function Accordion(_ref) {
|
|
49
|
-
var id = _ref.id,
|
|
50
|
-
className = _ref.className,
|
|
51
|
-
title = _ref.title,
|
|
52
|
-
contentRightTitle = _ref.contentRightTitle,
|
|
53
|
-
contentExpand = _ref.contentExpand,
|
|
54
|
-
disabled = _ref.disabled,
|
|
55
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
56
|
-
|
|
57
|
-
var _React$useState = _react.default.useState(false),
|
|
58
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
59
|
-
open = _React$useState2[0],
|
|
60
|
-
setOpen = _React$useState2[1];
|
|
61
|
-
|
|
62
|
-
return /*#__PURE__*/_react.default.createElement(_Accordion.default, _extends({
|
|
63
|
-
disabled: disabled,
|
|
64
|
-
id: id,
|
|
65
|
-
className: "cbx-Accordion-block ".concat(className),
|
|
66
|
-
onChange: function onChange() {
|
|
67
|
-
return setOpen(!open);
|
|
68
|
-
}
|
|
69
|
-
}, props), /*#__PURE__*/_react.default.createElement(_AccordionSummary.default, {
|
|
70
|
-
expandIcon: /*#__PURE__*/_react.default.createElement(_ExpandMore.default, null),
|
|
71
|
-
sx: {
|
|
72
|
-
padding: '0.5rem 1.5rem',
|
|
73
|
-
width: '100%',
|
|
74
|
-
overflow: 'hidden',
|
|
75
|
-
'& .MuiAccordionSummary-content': {
|
|
76
|
-
overflow: 'hidden'
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
80
|
-
className: 'cbx-Accordion-block-title'
|
|
81
|
-
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
82
|
-
component: 'span',
|
|
83
|
-
styles: {
|
|
84
|
-
fontSize: '1.125rem',
|
|
85
|
-
overflow: 'hidden',
|
|
86
|
-
whiteSpace: !open && 'nowrap',
|
|
87
|
-
textOverflow: !open && 'ellipsis',
|
|
88
|
-
paddingRight: '1rem'
|
|
89
|
-
},
|
|
90
|
-
color: 'var(--gray5)',
|
|
91
|
-
fontWeight: '700'
|
|
92
|
-
}, title), /*#__PURE__*/_react.default.createElement("div", {
|
|
93
|
-
className: 'cbx-Accordion-container-rigth-title'
|
|
94
|
-
}, contentRightTitle))), /*#__PURE__*/_react.default.createElement(_AccordionDetails.default, {
|
|
95
|
-
sx: {
|
|
96
|
-
padding: '0.5rem 1.5rem'
|
|
97
|
-
}
|
|
98
|
-
}, contentExpand));
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
Accordion.displayName = "Accordion";
|
|
102
|
-
Accordion.propTypes = {
|
|
103
|
-
title: _propTypes.default.string,
|
|
104
|
-
disabled: _propTypes.default.bool,
|
|
105
|
-
contentRightTitle: _propTypes.default.node,
|
|
106
|
-
contentExpand: _propTypes.default.node
|
|
107
|
-
};
|
|
108
|
-
Accordion.defaultProps = {
|
|
109
|
-
title: '',
|
|
110
|
-
disabled: false,
|
|
111
|
-
contentRightTitle: '',
|
|
112
|
-
contentExpand: ''
|
|
113
|
-
};
|
|
114
|
-
var _default = Accordion;
|
|
115
|
-
exports.default = _default;
|