@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
|
@@ -1,95 +1,90 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
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); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
7
|
+
exports["default"] = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
10
|
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
13
|
-
|
|
14
|
-
var _IconButton = _interopRequireDefault(require("../IconButton/IconButton"));
|
|
15
|
-
|
|
16
11
|
require("../../styles/main.css");
|
|
17
|
-
|
|
18
12
|
require("./Accordion.css");
|
|
19
|
-
|
|
20
13
|
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
21
|
-
|
|
22
|
-
var _excluded = ["id", "className", "title", "contentExpand", "sx", "style", "disabled", "component", "defaultExpanded"];
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
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; }
|
|
33
|
-
|
|
34
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
35
|
-
|
|
14
|
+
var _useA11yGuard2 = require("../../HOCs/useA11yGuard");
|
|
15
|
+
var _excluded = ["id", "className", "title", "contentExpand", "sx", "style", "disabled", "component", "defaultExpanded", "aria-label"];
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
17
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
22
|
+
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); }
|
|
23
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
36
24
|
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."); }
|
|
37
|
-
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
45
|
-
|
|
46
|
-
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; }
|
|
47
|
-
|
|
48
|
-
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; }
|
|
49
|
-
|
|
25
|
+
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; } }
|
|
26
|
+
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; }
|
|
27
|
+
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; } }
|
|
28
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
29
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) { o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } } return i; }
|
|
30
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) { if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } } return t; }
|
|
50
31
|
var Accordion = function Accordion(_ref) {
|
|
51
32
|
var id = _ref.id,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var _useDynamicStyles = (0, _useDynamicStyles2
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
33
|
+
className = _ref.className,
|
|
34
|
+
title = _ref.title,
|
|
35
|
+
contentExpand = _ref.contentExpand,
|
|
36
|
+
sx = _ref.sx,
|
|
37
|
+
style = _ref.style,
|
|
38
|
+
disabled = _ref.disabled,
|
|
39
|
+
component = _ref.component,
|
|
40
|
+
_ref$defaultExpanded = _ref.defaultExpanded,
|
|
41
|
+
defaultExpanded = _ref$defaultExpanded === void 0 ? false : _ref$defaultExpanded,
|
|
42
|
+
ariaLabel = _ref['aria-label'],
|
|
43
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
44
|
+
var _useDynamicStyles = (0, _useDynamicStyles2["default"])(sx),
|
|
45
|
+
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
46
|
+
prefixClass = _useDynamicStyles.prefixClass;
|
|
47
|
+
var _useA11yGuard = (0, _useA11yGuard2.useA11yGuard)(),
|
|
48
|
+
requireAccessibleText = _useA11yGuard.requireAccessibleText;
|
|
49
|
+
requireAccessibleText(title || ariaLabel, {
|
|
50
|
+
component: 'Accordion',
|
|
51
|
+
prop: '"title" o "aria-label"',
|
|
52
|
+
hint: 'Un acordeón debe tener un título visible o una etiqueta de accesibilidad para que los lectores de pantalla puedan anunciar el botón interactivo.',
|
|
53
|
+
receivedProps: {
|
|
54
|
+
title: title,
|
|
55
|
+
ariaLabel: ariaLabel,
|
|
56
|
+
id: id,
|
|
57
|
+
disabled: disabled
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var _React$useState = _react["default"].useState(defaultExpanded),
|
|
61
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
62
|
+
expanded = _React$useState2[0],
|
|
63
|
+
setExpanded = _React$useState2[1];
|
|
64
|
+
var panelRef = _react["default"].useRef(null);
|
|
65
|
+
var _React$useState3 = _react["default"].useState(function () {
|
|
66
|
+
return id || "accordion-".concat(Math.random().toString(36).slice(2, 9));
|
|
67
|
+
}),
|
|
68
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
69
|
+
autoId = _React$useState4[0];
|
|
70
|
+
var baseId = id || autoId;
|
|
71
|
+
var titleId = "".concat(baseId, "-title");
|
|
72
|
+
var panelId = "".concat(baseId, "-panel");
|
|
74
73
|
var closePanel = function closePanel() {
|
|
75
74
|
setExpanded(false);
|
|
76
75
|
var panel = panelRef.current;
|
|
77
|
-
|
|
78
76
|
if (panel) {
|
|
79
77
|
panel.style.maxHeight = null;
|
|
80
78
|
}
|
|
81
79
|
};
|
|
82
|
-
|
|
83
|
-
_react.default.useEffect(function () {
|
|
80
|
+
_react["default"].useEffect(function () {
|
|
84
81
|
closePanel();
|
|
85
82
|
}, [disabled]);
|
|
86
|
-
|
|
87
83
|
var handleAccordionClick = function handleAccordionClick(e) {
|
|
88
84
|
e.stopPropagation();
|
|
89
85
|
e.preventDefault();
|
|
90
86
|
setExpanded(!expanded);
|
|
91
87
|
var panel = panelRef.current;
|
|
92
|
-
|
|
93
88
|
if (panel) {
|
|
94
89
|
if (expanded) {
|
|
95
90
|
panel.style.maxHeight = null;
|
|
@@ -98,18 +93,15 @@ var Accordion = function Accordion(_ref) {
|
|
|
98
93
|
}
|
|
99
94
|
}
|
|
100
95
|
};
|
|
101
|
-
|
|
102
|
-
_react.default.useEffect(function () {
|
|
96
|
+
_react["default"].useEffect(function () {
|
|
103
97
|
if (expanded) {
|
|
104
98
|
var panel = panelRef.current;
|
|
105
|
-
|
|
106
99
|
if (panel) {
|
|
107
100
|
panel.style.maxHeight = "".concat(panel.scrollHeight, "px");
|
|
108
101
|
}
|
|
109
102
|
}
|
|
110
103
|
}, [contentExpand]);
|
|
111
|
-
|
|
112
|
-
_react.default.useEffect(function () {
|
|
104
|
+
_react["default"].useEffect(function () {
|
|
113
105
|
var panel = panelRef.current;
|
|
114
106
|
if (!panel) return;
|
|
115
107
|
var content = panel.firstElementChild;
|
|
@@ -120,24 +112,27 @@ var Accordion = function Accordion(_ref) {
|
|
|
120
112
|
}
|
|
121
113
|
});
|
|
122
114
|
resizeObserver.observe(content);
|
|
123
|
-
|
|
124
115
|
if (expanded) {
|
|
125
116
|
panel.style.maxHeight = "".concat(panel.scrollHeight, "px");
|
|
126
117
|
}
|
|
127
|
-
|
|
128
118
|
return function () {
|
|
129
119
|
return resizeObserver.disconnect();
|
|
130
120
|
};
|
|
131
121
|
}, [expanded]);
|
|
132
|
-
|
|
133
|
-
return /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
122
|
+
return /*#__PURE__*/_react["default"].createElement("div", _extends({
|
|
134
123
|
id: id,
|
|
135
124
|
className: prefixClass("cbx-Accordion-block ".concat(className || '', " ").concat(disabled ? 'disabled' : '', " ").concat(expanded ? 'expanded' : '')),
|
|
136
125
|
style: _objectSpread(_objectSpread({}, style), stylesInLine)
|
|
137
|
-
}, props), /*#__PURE__*/_react
|
|
126
|
+
}, props), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("button", _extends({
|
|
138
127
|
className: prefixClass('cbx-Accordion-block-title'),
|
|
139
|
-
onClick: disabled ? null : handleAccordionClick
|
|
140
|
-
|
|
128
|
+
onClick: disabled ? null : handleAccordionClick,
|
|
129
|
+
"aria-expanded": expanded,
|
|
130
|
+
disabled: disabled,
|
|
131
|
+
"aria-controls": panelId,
|
|
132
|
+
id: titleId
|
|
133
|
+
}, ariaLabel ? {
|
|
134
|
+
'aria-label': ariaLabel
|
|
135
|
+
} : {}), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
141
136
|
component: component || 'span',
|
|
142
137
|
styles: {
|
|
143
138
|
fontSize: '1.125rem',
|
|
@@ -150,38 +145,37 @@ var Accordion = function Accordion(_ref) {
|
|
|
150
145
|
color: 'var(--gray5)',
|
|
151
146
|
fontWeight: '700',
|
|
152
147
|
prefixClass: prefixClass
|
|
153
|
-
}, title)), /*#__PURE__*/_react
|
|
148
|
+
}, title)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
154
149
|
className: prefixClass('cbx-Accordion-container-rigth-title')
|
|
155
|
-
}, /*#__PURE__*/_react
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
icon: /*#__PURE__*/_react.default.createElement("i", {
|
|
160
|
-
className: "ri-arrow-down-s-line"
|
|
161
|
-
}),
|
|
162
|
-
disabled: disabled,
|
|
163
|
-
prefixClass: prefixClass,
|
|
164
|
-
"aria-label": expanded ? 'Close accordion' : 'Open accordion',
|
|
165
|
-
title: 'button accordion expand',
|
|
166
|
-
styles: {
|
|
150
|
+
}, /*#__PURE__*/_react["default"].createElement("i", {
|
|
151
|
+
className: "ri-arrow-down-s-line",
|
|
152
|
+
"aria-hidden": "true",
|
|
153
|
+
style: {
|
|
167
154
|
fontSize: '1.5rem',
|
|
168
155
|
transform: expanded ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
169
|
-
transition: '
|
|
156
|
+
transition: 'transform 0.3s',
|
|
157
|
+
color: 'var(--gray3)',
|
|
158
|
+
fontWeight: 'normal',
|
|
159
|
+
display: 'inline-block'
|
|
170
160
|
}
|
|
171
|
-
}))), /*#__PURE__*/_react
|
|
161
|
+
})))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
172
162
|
ref: panelRef,
|
|
173
|
-
className: prefixClass('cbx-Accordion-expand-content')
|
|
174
|
-
|
|
163
|
+
className: prefixClass('cbx-Accordion-expand-content'),
|
|
164
|
+
id: panelId,
|
|
165
|
+
role: "region",
|
|
166
|
+
"aria-labelledby": titleId,
|
|
167
|
+
"aria-hidden": !expanded
|
|
168
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, contentExpand)));
|
|
175
169
|
};
|
|
176
|
-
|
|
177
170
|
Accordion.displayName = "Accordion";
|
|
178
171
|
Accordion.propTypes = {
|
|
179
|
-
id: _propTypes
|
|
180
|
-
className: _propTypes
|
|
181
|
-
title: _propTypes
|
|
182
|
-
contentExpand: _propTypes
|
|
183
|
-
disabled: _propTypes
|
|
184
|
-
defaultExpanded: _propTypes
|
|
172
|
+
id: _propTypes["default"].string,
|
|
173
|
+
className: _propTypes["default"].string,
|
|
174
|
+
title: _propTypes["default"].string,
|
|
175
|
+
contentExpand: _propTypes["default"].node,
|
|
176
|
+
disabled: _propTypes["default"].bool,
|
|
177
|
+
defaultExpanded: _propTypes["default"].bool,
|
|
178
|
+
'aria-label': _propTypes["default"].string
|
|
185
179
|
};
|
|
186
180
|
Accordion.defaultProps = {
|
|
187
181
|
id: '',
|
|
@@ -189,7 +183,8 @@ Accordion.defaultProps = {
|
|
|
189
183
|
title: '',
|
|
190
184
|
contentExpand: '',
|
|
191
185
|
disabled: false,
|
|
192
|
-
defaultExpanded: false
|
|
186
|
+
defaultExpanded: false,
|
|
187
|
+
'aria-label': ''
|
|
193
188
|
};
|
|
194
189
|
var _default = Accordion;
|
|
195
|
-
exports
|
|
190
|
+
exports["default"] = _default;
|
|
@@ -3,21 +3,21 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
6
|
+
exports["default"] = exports.Default = void 0;
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _Accordion = _interopRequireDefault(require("./Accordion"));
|
|
11
|
-
|
|
12
9
|
var _DesignAccordion = _interopRequireDefault(require("./DesignAccordion.stories"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
16
11
|
var _default = {
|
|
17
12
|
title: 'Components/Accordion',
|
|
18
|
-
component: _Accordion
|
|
13
|
+
component: _Accordion["default"],
|
|
19
14
|
argTypes: {},
|
|
20
15
|
parameters: {
|
|
16
|
+
docs: {
|
|
17
|
+
description: {
|
|
18
|
+
component: "\n\n## Accordion\n\nComponente que permite expandir y contraer bloques de contenido asociados a un t\xEDtulo.\n\nEl componente utiliza elementos HTML nativos para garantizar una interacci\xF3n correcta con teclado y lectores de pantalla.\n\n## Accesibilidad\n\n### Estructura sem\xE1ntica\n\n- El t\xEDtulo del acorde\xF3n se renderiza dentro de un elemento `h3`, proporcionando una jerarqu\xEDa sem\xE1ntica adecuada dentro de una p\xE1gina.\n- La acci\xF3n de expandir y contraer utiliza un elemento nativo `button`, evitando patrones personalizados que puedan perder comportamiento accesible.\n- El contenido expandible utiliza el rol `region` para identificarlo como una secci\xF3n independiente.\n\n### Estado expandido\n\n- El bot\xF3n informa del estado actual mediante el atributo `aria-expanded`.\n- Cuando el acorde\xF3n est\xE1 cerrado:\n - `aria-expanded=\"false\"`\n - El contenido se oculta visualmente.\n- Cuando el acorde\xF3n est\xE1 abierto:\n - `aria-expanded=\"true\"`\n - El contenido est\xE1 disponible para el usuario.\n\n### Relaci\xF3n entre t\xEDtulo y contenido\n\n- El bot\xF3n utiliza `aria-controls` para indicar qu\xE9 panel controla.\n- El panel utiliza `aria-labelledby` para asociarse con el t\xEDtulo del acorde\xF3n.\n- Los identificadores se generan autom\xE1ticamente para mantener una relaci\xF3n \xFAnica entre elementos.\n\n### Navegaci\xF3n mediante teclado\n\n- Al utilizar un elemento `button` nativo:\n - Se puede acceder mediante la tecla Tab.\n - Se puede activar mediante Enter y Espacio.\n - Mantiene el comportamiento esperado por lectores de pantalla y tecnolog\xEDas asistivas.\n\n### Estado deshabilitado\n\n- Cuando el acorde\xF3n est\xE1 deshabilitado:\n - El bot\xF3n utiliza el atributo HTML `disabled`.\n - No permite interacci\xF3n mediante teclado o rat\xF3n.\n - Mantiene el estado visual de elemento no interactivo.\n\n### Iconograf\xEDa\n\n- El icono utilizado para indicar el estado del acorde\xF3n es \xFAnicamente decorativo.\n- Se marca con `aria-hidden=\"true\"` para evitar que los lectores de pantalla anuncien informaci\xF3n redundante.\n\n## Recomendaciones de uso\n\n- Utilizar t\xEDtulos descriptivos que indiquen claramente el contenido que se mostrar\xE1.\n- No utilizar el Accordion para navegaci\xF3n principal; para ello deben utilizarse componentes espec\xEDficos de navegaci\xF3n.\n- Evitar introducir grandes cantidades de contenido dentro del panel expandible.\n\n## Consideraciones\n\nEl componente gestiona autom\xE1ticamente la relaci\xF3n entre el bot\xF3n y el panel mediante identificadores \xFAnicos.\nNo es necesario a\xF1adir atributos ARIA adicionales salvo que se requieran necesidades espec\xEDficas del caso de uso.\n\n\t\t\t"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
21
|
storybookCodePanel: {
|
|
22
22
|
disabled: false,
|
|
23
23
|
files: [{
|
|
@@ -32,12 +32,10 @@ var _default = {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
exports
|
|
36
|
-
|
|
35
|
+
exports["default"] = _default;
|
|
37
36
|
var Template = function Template(args) {
|
|
38
|
-
return /*#__PURE__*/_react
|
|
37
|
+
return /*#__PURE__*/_react["default"].createElement(_DesignAccordion["default"], args);
|
|
39
38
|
};
|
|
40
|
-
|
|
41
39
|
Template.displayName = "Template";
|
|
42
40
|
var Default = Template.bind({});
|
|
43
41
|
exports.Default = Default;
|
|
@@ -3,36 +3,25 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
6
|
+
exports["default"] = void 0;
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
require("../../styles/main.css");
|
|
11
|
-
|
|
12
9
|
var _Accordion = _interopRequireDefault(require("./Accordion"));
|
|
13
|
-
|
|
14
10
|
var _excluded = ["disabled", "title"];
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
22
|
-
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; }
|
|
23
|
-
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
|
|
13
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) { o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } } return i; }
|
|
14
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) { if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } } return t; }
|
|
24
15
|
var DesignAccordion = function DesignAccordion(_ref) {
|
|
25
16
|
var disabled = _ref.disabled,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Accordion.default, _extends({
|
|
17
|
+
title = _ref.title,
|
|
18
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_Accordion["default"], _extends({
|
|
30
20
|
title: title,
|
|
31
|
-
contentExpand: /*#__PURE__*/_react
|
|
21
|
+
contentExpand: /*#__PURE__*/_react["default"].createElement("div", null, "asdasd asd asd asdasd as asdasd asd asd asdasd as asdasd asd asd asdasd as asdasd asd asd asdasd as"),
|
|
32
22
|
disabled: disabled
|
|
33
23
|
}, props)));
|
|
34
24
|
};
|
|
35
|
-
|
|
36
25
|
DesignAccordion.displayName = "DesignAccordion";
|
|
37
26
|
var _default = DesignAccordion;
|
|
38
|
-
exports
|
|
27
|
+
exports["default"] = _default;
|
|
@@ -3,51 +3,53 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
6
|
+
exports["default"] = void 0;
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
13
|
-
|
|
14
10
|
require("../../styles/main.css");
|
|
15
|
-
|
|
16
11
|
require("./Alert.css");
|
|
17
|
-
|
|
18
12
|
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
19
|
-
|
|
20
|
-
function _interopRequireDefault(
|
|
21
|
-
|
|
22
|
-
function _extends() { _extends = Object.assign
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function
|
|
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
|
-
|
|
13
|
+
var _useA11yGuard2 = require("../../HOCs/useA11yGuard");
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
15
|
+
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); }
|
|
16
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
|
|
17
|
+
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; }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
21
|
+
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
22
|
var Alert = function Alert(_ref) {
|
|
31
23
|
var id = _ref.id,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
24
|
+
className = _ref.className,
|
|
25
|
+
title = _ref.title,
|
|
26
|
+
type = _ref.type,
|
|
27
|
+
variant = _ref.variant,
|
|
28
|
+
fontWeight = _ref.fontWeight,
|
|
29
|
+
textAlign = _ref.textAlign,
|
|
30
|
+
colorText = _ref.colorText,
|
|
31
|
+
secondaryFont = _ref.secondaryFont,
|
|
32
|
+
component = _ref.component,
|
|
33
|
+
description = _ref.description,
|
|
34
|
+
icon = _ref.icon,
|
|
35
|
+
typographyProps = _ref.typographyProps,
|
|
36
|
+
sx = _ref.sx,
|
|
37
|
+
style = _ref.style;
|
|
38
|
+
var _useDynamicStyles = (0, _useDynamicStyles2["default"])(sx),
|
|
39
|
+
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
40
|
+
prefixClass = _useDynamicStyles.prefixClass;
|
|
41
|
+
var _useA11yGuard = (0, _useA11yGuard2.useA11yGuard)(),
|
|
42
|
+
requireAccessibleText = _useA11yGuard.requireAccessibleText;
|
|
43
|
+
requireAccessibleText(title || description, {
|
|
44
|
+
component: 'Alert',
|
|
45
|
+
prop: '"title" o "description"',
|
|
46
|
+
hint: 'Una alerta (role="alert/status") debe contener texto en "title" o "description" para comunicar información a los lectores de pantalla.',
|
|
47
|
+
receivedProps: {
|
|
48
|
+
title: title,
|
|
49
|
+
description: description,
|
|
50
|
+
type: type
|
|
51
|
+
}
|
|
52
|
+
});
|
|
51
53
|
var stylesType = {
|
|
52
54
|
info: {
|
|
53
55
|
container: {
|
|
@@ -89,34 +91,33 @@ var Alert = function Alert(_ref) {
|
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
93
|
};
|
|
92
|
-
|
|
93
94
|
var getStyles = function getStyles(element) {
|
|
94
95
|
var typeStyles = type;
|
|
95
|
-
|
|
96
96
|
if (type !== 'info' && type !== 'success' && type !== 'error') {
|
|
97
97
|
typeStyles = 'info';
|
|
98
98
|
}
|
|
99
|
-
|
|
100
99
|
return stylesType[typeStyles][element];
|
|
101
100
|
};
|
|
102
|
-
|
|
103
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
101
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
104
102
|
id: id,
|
|
105
103
|
className: "".concat(prefixClass('cbx-alert-container'), " ").concat(className || ''),
|
|
106
104
|
style: _objectSpread(_objectSpread(_objectSpread({
|
|
107
105
|
alignItems: description ? '' : 'center'
|
|
108
|
-
}, getStyles('container')), style), stylesInLine)
|
|
109
|
-
|
|
106
|
+
}, getStyles('container')), style), stylesInLine),
|
|
107
|
+
role: type === 'error' ? 'alert' : 'status',
|
|
108
|
+
"aria-live": type === 'error' ? 'assertive' : 'polite'
|
|
109
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
110
110
|
className: prefixClass('cbx-alert-block'),
|
|
111
111
|
style: _objectSpread({}, getStyles('iconContainer'))
|
|
112
|
-
}, /*#__PURE__*/_react
|
|
113
|
-
className: icon || getStyles('icon')
|
|
114
|
-
|
|
112
|
+
}, /*#__PURE__*/_react["default"].createElement("i", {
|
|
113
|
+
className: icon || getStyles('icon'),
|
|
114
|
+
"aria-hidden": "true"
|
|
115
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
115
116
|
className: prefixClass('cbx-alert-block-text'),
|
|
116
117
|
style: {
|
|
117
118
|
marginTop: description ? '0.25rem' : ''
|
|
118
119
|
}
|
|
119
|
-
}, /*#__PURE__*/_react
|
|
120
|
+
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], _extends({
|
|
120
121
|
styles: _objectSpread({}, getStyles('textContainer')),
|
|
121
122
|
variant: variant,
|
|
122
123
|
fontWeight: fontWeight,
|
|
@@ -127,14 +128,13 @@ var Alert = function Alert(_ref) {
|
|
|
127
128
|
prefixClass: prefixClass
|
|
128
129
|
}, typographyProps), title), description));
|
|
129
130
|
};
|
|
130
|
-
|
|
131
131
|
Alert.displayName = "Alert";
|
|
132
132
|
Alert.propTypes = {
|
|
133
|
-
title: _propTypes
|
|
134
|
-
id: _propTypes
|
|
135
|
-
className: _propTypes
|
|
136
|
-
type: _propTypes
|
|
137
|
-
description: _propTypes
|
|
133
|
+
title: _propTypes["default"].string,
|
|
134
|
+
id: _propTypes["default"].string,
|
|
135
|
+
className: _propTypes["default"].string,
|
|
136
|
+
type: _propTypes["default"].string,
|
|
137
|
+
description: _propTypes["default"].node
|
|
138
138
|
};
|
|
139
139
|
Alert.defaultProps = {
|
|
140
140
|
title: '',
|
|
@@ -145,4 +145,4 @@ Alert.defaultProps = {
|
|
|
145
145
|
icon: ''
|
|
146
146
|
};
|
|
147
147
|
var _default = Alert;
|
|
148
|
-
exports
|
|
148
|
+
exports["default"] = _default;
|
|
@@ -3,17 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
6
|
+
exports["default"] = exports.Default = void 0;
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _Alert = _interopRequireDefault(require("./Alert"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
14
10
|
var _default = {
|
|
15
11
|
title: 'Components/Alert',
|
|
16
|
-
component: _Alert
|
|
12
|
+
component: _Alert["default"],
|
|
17
13
|
argTypes: {
|
|
18
14
|
type: {
|
|
19
15
|
options: ['info', 'success', 'error'],
|
|
@@ -23,6 +19,11 @@ var _default = {
|
|
|
23
19
|
}
|
|
24
20
|
},
|
|
25
21
|
parameters: {
|
|
22
|
+
docs: {
|
|
23
|
+
description: {
|
|
24
|
+
component: "\n## Alert\n\nComponente que permite comunicar mensajes importantes de informaci\xF3n, \xE9xito o error al usuario dentro de la interfaz.\n\nEl componente utiliza roles y regiones vivas ARIA para garantizar que las tecnolog\xEDas de asistencia anuncien el mensaje de forma adecuada.\n\n## Accesibilidad\n\n### Regiones vivas y roles din\xE1micos\n\n- El componente asigna autom\xE1ticamente un rol y nivel de prioridad (`aria-live`) seg\xFAn el tipo de alerta (`type`):\n - Cuando el tipo es error (`type=\"error\"`):\n - `role=\"alert\"`\n - `aria-live=\"assertive\"`\n - Interrumpe al lector de pantalla para anunciar el mensaje de forma inmediata.\n - Cuando el tipo es informaci\xF3n o \xE9xito (`type=\"info\"` o `type=\"success\"`):\n - `role=\"status\"`\n - `aria-live=\"polite\"`\n - Informa al usuario sin interrumpir su lectura o tarea actual.\n\n### Control de contenido accesible\n\n- El componente integra la guardia `useA11yGuard` para evitar renderizar alertas sin contenido \xFAtil.\n- Exige la presencia obligatoria de texto en el t\xEDtulo (`title`) o en la descripci\xF3n (`description`).\n- En caso de no proporcionar ninguno de estos elementos, la guardia lanza una excepci\xF3n informando del problema.\n\n### Iconograf\xEDa\n\n- Los iconos representativos del estado son \xFAnicamente decorativos.\n- Se marcan expl\xEDcitamente con `aria-hidden=\"true\"` para evitar que los lectores de pantalla anuncien informaci\xF3n redundante o nombres de clases.\n\n### Estructura del texto\n\n- El t\xEDtulo se renderiza apoy\xE1ndose en el componente `Typography`, garantizando contraste y legibilidad adecuados.\n- La descripci\xF3n permite contenido secundario o enriquecido (`node`) manteniendo la coherencia sem\xE1ntica del mensaje.\n\n## Recomendaciones de uso\n\n- Utilizar mensajes claros y concisos que expliquen la situaci\xF3n y la acci\xF3n requerida.\n- Reservar los mensajes de error \xFAnicamente para situaciones cr\xEDticas o fallos de acci\xF3n prioritarios.\n- Evitar ocultar o destruir alertas din\xE1micas con tiempos demasiado reducidos para permitir que todos los usuarios procesen la informaci\xF3n.\n\n## Consideraciones\n\nEl componente gestiona autom\xE1ticamente el comportamiento de lectura mediante los atributos `role` y `aria-live`.\nNo es necesario a\xF1adir atributos ARIA adicionales salvo que se requiera vincular la alerta a un elemento espec\xEDfico mediante `aria-describedby`.\n\t\t\t"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
26
27
|
storybookCodePanel: {
|
|
27
28
|
disabled: false,
|
|
28
29
|
files: [{
|
|
@@ -37,12 +38,10 @@ var _default = {
|
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
|
-
exports
|
|
41
|
-
|
|
41
|
+
exports["default"] = _default;
|
|
42
42
|
var Template = function Template(args) {
|
|
43
|
-
return /*#__PURE__*/_react
|
|
43
|
+
return /*#__PURE__*/_react["default"].createElement(_Alert["default"], args);
|
|
44
44
|
};
|
|
45
|
-
|
|
46
45
|
Template.displayName = "Template";
|
|
47
46
|
var Default = Template.bind({});
|
|
48
47
|
exports.Default = Default;
|