@councilbox/councilbox-ui 2.0.53 → 2.0.54
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/dist/HOCs/overlayA11yStack.js +47 -0
- package/dist/HOCs/useA11yGuard.js +38 -0
- package/dist/HOCs/useDynamicStyles.js +18 -38
- 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 +49 -99
- package/dist/components/1.Introduction.stories.mdx +1 -1
- package/dist/components/2.Changelog.stories.mdx +42 -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/AccordionOld.js +32 -56
- 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/AvatarOld.js +46 -60
- 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/ButtonBasic/ButtonBasicOld.js +57 -77
- 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/Checkbox/CheckboxOld.js +19 -35
- package/dist/components/DragDrop/DragDrop.css +20 -9
- package/dist/components/DragDrop/DragDrop.js +80 -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/DrawerPanel/DrawerPanelOld.js +76 -98
- package/dist/components/DropDown/DesignDropDown.stories.js +79 -97
- package/dist/components/DropDown/DropDown.js +168 -342
- package/dist/components/DropDown/DropDown.stories.js +6 -12
- package/dist/components/DropDown/DropDownOld.js +57 -89
- 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/Grid/GridItemOld.js +13 -18
- package/dist/components/Grid/GridOld.js +14 -21
- package/dist/components/Header/DesignHeader.stories.js +20 -24
- package/dist/components/Header/Header.js +201 -242
- 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 +132 -138
- package/dist/components/IconButton/IconButton.stories.js +12 -13
- package/dist/components/IconButton/IconButtonOld.js +41 -57
- package/dist/components/IconButtonSquare/DesignIconButtonSquare.stories.js +5 -11
- package/dist/components/IconButtonSquare/IconButtonSquare.js +11 -25
- package/dist/components/IconButtonSquare/IconButtonSquare.stories.js +7 -13
- package/dist/components/IconButtonSquare/IconButtonSquareOld.js +44 -62
- 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/InputAutocomplete/InputAutocompleteOld.js +43 -62
- 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 +86 -78
- package/dist/components/InputText/InputText.js +207 -211
- package/dist/components/InputText/InputText.stories.js +11 -11
- package/dist/components/InputText/InputTextOld.js +48 -74
- 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 +100 -113
- package/dist/components/MenuItem/MenuItem.stories.js +6 -15
- package/dist/components/MenuItem/MenuItemOld.js +40 -56
- 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 +73 -77
- 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 +154 -145
- package/dist/components/Modal/Modal.stories.js +7 -16
- package/dist/components/Modal/ModalOld.js +73 -90
- 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/RadioButton/RadioOld.js +23 -39
- package/dist/components/Ripple/DesignRipple.js +25 -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/SelectInput/DesignSelectInput.js +22 -45
- package/dist/components/SelectInput/SelectInput.js +101 -155
- package/dist/components/SelectInput/SelectInput.stories.js +6 -15
- package/dist/components/SelectInput/SelectInputOld.js +52 -81
- 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/TableOld.js +52 -84
- 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 -137
- package/dist/components/Tabs/Tabs.stories.js +5 -12
- package/dist/components/Tabs/TabsOld.js +28 -42
- 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/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/Toggle/Toggle.css +10 -0
- package/dist/components/Toggle/Toggle.js +115 -98
- 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 +190 -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/components/Typography/TypographyOld.js +29 -42
- 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/stylesheet.js +10 -22
- 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 +5 -2
|
@@ -1,113 +1,102 @@
|
|
|
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
|
require("../../styles/main.css");
|
|
13
|
-
|
|
14
11
|
require("./Checkbox.css");
|
|
15
|
-
|
|
16
12
|
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
17
|
-
|
|
18
13
|
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
19
|
-
|
|
20
14
|
var _useRipple3 = _interopRequireDefault(require("../../HOCs/useRipple"));
|
|
21
|
-
|
|
22
|
-
var _excluded = ["id", "className", "disabled", "indeterminate", "label", "onChange", "checked", "sx", "style", "onClick"];
|
|
23
|
-
|
|
24
|
-
function _interopRequireDefault(
|
|
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
|
-
|
|
15
|
+
var _useA11yGuard2 = require("../../HOCs/useA11yGuard");
|
|
16
|
+
var _excluded = ["id", "className", "disabled", "indeterminate", "label", "onChange", "checked", "sx", "style", "onClick", "ariaLabel", "ariaLabelledby"];
|
|
17
|
+
/* eslint-disable no-nested-ternary */
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
19
|
+
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); }
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
24
|
+
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); }
|
|
25
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
36
26
|
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
|
-
|
|
27
|
+
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; } }
|
|
28
|
+
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; }
|
|
29
|
+
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; } }
|
|
30
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
31
|
+
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; }
|
|
32
|
+
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
33
|
var Checkbox = function Checkbox(_ref) {
|
|
51
34
|
var id = _ref.id,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var _useDynamicStyles = (0, _useDynamicStyles2
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
ripples = _useRipple2[1];
|
|
75
|
-
|
|
35
|
+
className = _ref.className,
|
|
36
|
+
disabled = _ref.disabled,
|
|
37
|
+
indeterminate = _ref.indeterminate,
|
|
38
|
+
label = _ref.label,
|
|
39
|
+
onChange = _ref.onChange,
|
|
40
|
+
checkedProp = _ref.checked,
|
|
41
|
+
sx = _ref.sx,
|
|
42
|
+
style = _ref.style,
|
|
43
|
+
onClick = _ref.onClick,
|
|
44
|
+
ariaLabel = _ref.ariaLabel,
|
|
45
|
+
ariaLabelledby = _ref.ariaLabelledby,
|
|
46
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
47
|
+
var inputRef = _react["default"].useRef(null);
|
|
48
|
+
var _useDynamicStyles = (0, _useDynamicStyles2["default"])(sx),
|
|
49
|
+
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
50
|
+
prefixClass = _useDynamicStyles.prefixClass;
|
|
51
|
+
var _useRipple = (0, _useRipple3["default"])({
|
|
52
|
+
backgroundColor: 'var(--accent25)'
|
|
53
|
+
}, 'center'),
|
|
54
|
+
_useRipple2 = _slicedToArray(_useRipple, 2),
|
|
55
|
+
addRipple = _useRipple2[0],
|
|
56
|
+
ripples = _useRipple2[1];
|
|
76
57
|
var isControlled = checkedProp !== undefined;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
setInternalState = _React$useState2[1];
|
|
82
|
-
|
|
58
|
+
var _React$useState = _react["default"].useState(!!checkedProp),
|
|
59
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
60
|
+
internalState = _React$useState2[0],
|
|
61
|
+
setInternalState = _React$useState2[1];
|
|
83
62
|
var checked = isControlled ? checkedProp : internalState;
|
|
84
|
-
|
|
63
|
+
var _useA11yGuard = (0, _useA11yGuard2.useA11yGuard)(),
|
|
64
|
+
requireAccessibleText = _useA11yGuard.requireAccessibleText;
|
|
65
|
+
requireAccessibleText(label || ariaLabel || ariaLabelledby, {
|
|
66
|
+
component: 'Checkbox',
|
|
67
|
+
prop: '"label", "ariaLabel" o "ariaLabelledby"',
|
|
68
|
+
hint: 'Una casilla de verificación (checkbox) debe contar con una etiqueta visible o una propiedad de accesibilidad para ser identificada por los lectores de pantalla.',
|
|
69
|
+
receivedProps: {
|
|
70
|
+
label: label,
|
|
71
|
+
ariaLabel: ariaLabel,
|
|
72
|
+
ariaLabelledby: ariaLabelledby,
|
|
73
|
+
disabled: disabled,
|
|
74
|
+
checked: checkedProp
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
var Wrapper = label ? 'label' : 'span';
|
|
85
78
|
var handleChange = function handleChange(event) {
|
|
86
79
|
if (disabled) return;
|
|
87
80
|
var newChecked = event.target.checked;
|
|
88
|
-
|
|
89
81
|
if (!isControlled) {
|
|
90
82
|
setInternalState(newChecked);
|
|
91
83
|
}
|
|
92
|
-
|
|
93
84
|
if (onChange) {
|
|
94
85
|
onChange(event, newChecked);
|
|
95
86
|
}
|
|
96
87
|
};
|
|
97
|
-
|
|
98
|
-
_react.default.useEffect(function () {
|
|
88
|
+
_react["default"].useEffect(function () {
|
|
99
89
|
if (inputRef.current) {
|
|
100
90
|
inputRef.current.indeterminate = indeterminate;
|
|
101
91
|
}
|
|
102
92
|
}, [indeterminate]);
|
|
103
|
-
|
|
104
|
-
return /*#__PURE__*/_react.default.createElement("label", _extends({
|
|
93
|
+
return /*#__PURE__*/_react["default"].createElement(Wrapper, _extends({
|
|
105
94
|
className: prefixClass('cbx-checkbox'),
|
|
106
95
|
style: _objectSpread(_objectSpread({}, style), stylesInLine)
|
|
107
|
-
}, props), /*#__PURE__*/_react
|
|
96
|
+
}, props), /*#__PURE__*/_react["default"].createElement("span", {
|
|
108
97
|
className: prefixClass("cbx-checkbox-container ".concat(disabled ? 'cbx-checkbox-container-disabled' : '', " ").concat(!disabled ? 'cbx-ripple' : '')),
|
|
109
98
|
onClick: addRipple
|
|
110
|
-
}, /*#__PURE__*/_react
|
|
99
|
+
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
111
100
|
ref: inputRef,
|
|
112
101
|
type: "checkbox",
|
|
113
102
|
checked: checked,
|
|
@@ -115,25 +104,16 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
115
104
|
onClick: function onClick(e) {
|
|
116
105
|
return e.stopPropagation();
|
|
117
106
|
},
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
handleChange({
|
|
122
|
-
target: {
|
|
123
|
-
checked: !checked
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
tabIndex: 0
|
|
129
|
-
}), !disabled && ripples, checked ? indeterminate ? /*#__PURE__*/_react.default.createElement("svg", {
|
|
107
|
+
"aria-label": !label && !ariaLabelledby ? ariaLabel || 'Checkbox' : undefined,
|
|
108
|
+
"aria-labelledby": ariaLabelledby || undefined
|
|
109
|
+
}), !disabled && ripples, checked ? indeterminate ? /*#__PURE__*/_react["default"].createElement("svg", {
|
|
130
110
|
className: prefixClass('cbx-checkbox-checked'),
|
|
131
111
|
focusable: "false",
|
|
132
112
|
"aria-hidden": "true",
|
|
133
113
|
viewBox: "0 0 24 24"
|
|
134
|
-
}, /*#__PURE__*/_react
|
|
114
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
135
115
|
d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"
|
|
136
|
-
})) : /*#__PURE__*/_react
|
|
116
|
+
})) : /*#__PURE__*/_react["default"].createElement("svg", {
|
|
137
117
|
className: prefixClass('cbx-checkbox-checked'),
|
|
138
118
|
focusable: "false",
|
|
139
119
|
"aria-hidden": "true",
|
|
@@ -142,16 +122,16 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
142
122
|
style: {
|
|
143
123
|
fill: disabled && 'var(--gray3)'
|
|
144
124
|
}
|
|
145
|
-
}, /*#__PURE__*/_react
|
|
125
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
146
126
|
d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
|
147
|
-
})) : /*#__PURE__*/_react
|
|
127
|
+
})) : /*#__PURE__*/_react["default"].createElement("svg", {
|
|
148
128
|
className: prefixClass('cbx-checkbox-notChecked'),
|
|
149
129
|
focusable: "false",
|
|
150
130
|
"aria-hidden": "true",
|
|
151
131
|
viewBox: "0 0 24 24"
|
|
152
|
-
}, /*#__PURE__*/_react
|
|
132
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
153
133
|
d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"
|
|
154
|
-
}))), /*#__PURE__*/_react
|
|
134
|
+
}))), label && /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
155
135
|
component: "span",
|
|
156
136
|
style: {
|
|
157
137
|
margin: 0,
|
|
@@ -163,21 +143,22 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
163
143
|
prefixClass: prefixClass
|
|
164
144
|
}, label));
|
|
165
145
|
};
|
|
166
|
-
|
|
167
146
|
Checkbox.displayName = "Checkbox";
|
|
168
147
|
Checkbox.propTypes = {
|
|
169
|
-
onChange: _propTypes
|
|
170
|
-
disabled: _propTypes
|
|
171
|
-
indeterminate: _propTypes
|
|
172
|
-
label: _propTypes
|
|
173
|
-
|
|
148
|
+
onChange: _propTypes["default"].func,
|
|
149
|
+
disabled: _propTypes["default"].bool,
|
|
150
|
+
indeterminate: _propTypes["default"].bool,
|
|
151
|
+
label: _propTypes["default"].string,
|
|
152
|
+
ariaLabel: _propTypes["default"].string,
|
|
153
|
+
checked: _propTypes["default"].bool
|
|
174
154
|
};
|
|
175
155
|
Checkbox.defaultProps = {
|
|
176
156
|
onChange: undefined,
|
|
177
157
|
disabled: false,
|
|
178
158
|
indeterminate: false,
|
|
179
159
|
label: '',
|
|
160
|
+
ariaLabel: '',
|
|
180
161
|
checked: false
|
|
181
162
|
};
|
|
182
163
|
var _default = Checkbox;
|
|
183
|
-
exports
|
|
164
|
+
exports["default"] = _default;
|
|
@@ -3,19 +3,20 @@
|
|
|
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 _Checkbox = _interopRequireDefault(require("./Checkbox"));
|
|
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/Checkbox',
|
|
16
|
-
component: _Checkbox
|
|
12
|
+
component: _Checkbox["default"],
|
|
17
13
|
argTypes: {},
|
|
18
14
|
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component: "\n## Checkbox\n\nComponente de casilla de verificaci\xF3n que permite al usuario seleccionar o deseleccionar una o m\xE1s opciones independientes dentro de un formulario o interfaz.\n\nEl componente utiliza el elemento HTML nativo `input type=\"checkbox\"` para garantizar la compatibilidad con teclado, lectores de pantalla y comportamientos de formularios.\n\n## Accesibilidad\n\n### Etiqueta y nombre accesible\n\n- El componente garantiza un nombre accesible evaluando las siguientes propiedades:\n - Texto visible en `label`.\n - Etiqueta accesible mediante `ariaLabel` (`aria-label`).\n - Identificador de referencia externa mediante `ariaLabelledby` (`aria-labelledby`).\n- Cuando existe una etiqueta visible (`label`):\n - El contenedor principal se renderiza como elemento `label`, asociando autom\xE1ticamente el clic del texto al `input` nativo.\n- Cuando no hay etiqueta visible:\n - Se valida obligatoriamente la presencia de `ariaLabel` o `ariaLabelledby` para que el control no sea an\xF3nimo.\n\n### Control mediante `useA11yGuard`\n\n- Integra la guardia `useA11yGuard` para prevenir el uso de casillas sin identificaci\xF3n.\n- Exige la presencia de al menos uno de los atributos: `label`, `ariaLabel` o `ariaLabelledby`.\n- En caso de omisi\xF3n, la guardia lanza una excepci\xF3n detallando la falta de nombre accesible para tecnolog\xEDas asistivas.\n\n### Estados del control (`checked`, `indeterminate` y `disabled`)\n\n- **Estado de selecci\xF3n (`checked`)**:\n - Se delega completamente en el atributo nativo `checked` del elemento `input`, permitiendo que el lector de pantalla anuncie autom\xE1ticamente \"marcado\" o \"no marcado\".\n- **Estado indeterminado (`indeterminate`)**:\n - Se sincroniza de forma imperativa con la propiedad `indeterminate` del nodo DOM del `input`, informando a las tecnolog\xEDas de asistencia cuando la casilla se encuentra en un estado mixto o parcial.\n- **Estado deshabilitado (`disabled`)**:\n - Aplica el atributo HTML `disabled` al `input`, impidiendo el foco por teclado y la interacci\xF3n por rat\xF3n.\n\n### Iconograf\xEDa decorativa\n\n- Los iconos SVG que representan los estados marcado, no marcado e indeterminado son meramente visuales.\n- Se marcan expl\xEDcitamente con `aria-hidden=\"true\"` y `focusable=\"false\"` para evitar lecturas duplicadas o interferencias en el flujo de tabulaci\xF3n.\n\n### Navegaci\xF3n mediante teclado\n\n- Al utilizar un elemento `input type=\"checkbox\"` nativo:\n - Recibe el foco de forma est\xE1ndar mediante la tecla **Tab**.\n - Permite alternar su estado mediante la tecla **Espacio**.\n\n## Recomendaciones de uso\n\n- Utilizar siempre un texto claro y descriptivo en la propiedad `label`.\n- En casillas dentro de tablas o listas densas donde no haya espacio para una etiqueta visible, proporcionar obligatoriamente `ariaLabel` o `ariaLabelledby`.\n- Evitar utilizar el estado `indeterminate` como un tercer estado persistente; debe emplearse \xFAnicamente para representar la selecci\xF3n parcial de subelementos (como en \xE1rboles de selecci\xF3n o casillas \"seleccionar todo\").\n\n## Consideraciones\n\nEl componente gestiona autom\xE1ticamente la asociaci\xF3n sem\xE1ntica con el elemento `label` nativo y la propiedad imperativa `indeterminate`.\nNo es necesario a\xF1adir atributos ARIA adicionales salvo que la casilla controle la visibilidad o expansi\xF3n de otra secci\xF3n de la pantalla.\n\t\t\t"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
19
20
|
storybookCodePanel: {
|
|
20
21
|
disabled: false,
|
|
21
22
|
files: [{
|
|
@@ -30,12 +31,10 @@ var _default = {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
};
|
|
33
|
-
exports
|
|
34
|
-
|
|
34
|
+
exports["default"] = _default;
|
|
35
35
|
var Template = function Template(args) {
|
|
36
|
-
return /*#__PURE__*/_react
|
|
36
|
+
return /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], args);
|
|
37
37
|
};
|
|
38
|
-
|
|
39
38
|
Template.displayName = "Template";
|
|
40
39
|
var Default = Template.bind({});
|
|
41
40
|
exports.Default = Default;
|
|
@@ -3,33 +3,20 @@
|
|
|
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 _Checkbox = _interopRequireDefault(require("@mui/material/Checkbox"));
|
|
13
|
-
|
|
14
10
|
require("../../styles/main.css");
|
|
15
|
-
|
|
16
11
|
require("./Checkbox.css");
|
|
17
|
-
|
|
18
12
|
var _FormControlLabel = _interopRequireDefault(require("@mui/material/FormControlLabel"));
|
|
19
|
-
|
|
20
13
|
var _styled = _interopRequireDefault(require("@mui/material/styles/styled"));
|
|
21
|
-
|
|
22
14
|
var _excluded = ["id", "className", "disabled", "indeterminate", "label", "onChange"];
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
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; }
|
|
29
|
-
|
|
30
|
-
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; }
|
|
31
|
-
|
|
32
|
-
var CssFormControlLabel = (0, _styled.default)(_FormControlLabel.default)(function () {
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
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 _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; }
|
|
18
|
+
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; }
|
|
19
|
+
var CssFormControlLabel = (0, _styled["default"])(_FormControlLabel["default"])(function () {
|
|
33
20
|
return {
|
|
34
21
|
'& .MuiFormControlLabel-label': {
|
|
35
22
|
marginLeft: 'var(--spacing12)',
|
|
@@ -57,24 +44,22 @@ var CssFormControlLabel = (0, _styled.default)(_FormControlLabel.default)(functi
|
|
|
57
44
|
}
|
|
58
45
|
};
|
|
59
46
|
});
|
|
60
|
-
|
|
61
47
|
var CheckboxOld = function CheckboxOld(_ref) {
|
|
62
48
|
var id = _ref.id,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return /*#__PURE__*/_react.default.createElement(CssFormControlLabel, _extends({
|
|
49
|
+
className = _ref.className,
|
|
50
|
+
disabled = _ref.disabled,
|
|
51
|
+
indeterminate = _ref.indeterminate,
|
|
52
|
+
label = _ref.label,
|
|
53
|
+
onChange = _ref.onChange,
|
|
54
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
55
|
+
return /*#__PURE__*/_react["default"].createElement(CssFormControlLabel, _extends({
|
|
71
56
|
id: id,
|
|
72
57
|
className: className,
|
|
73
58
|
style: {
|
|
74
59
|
margin: '0px'
|
|
75
60
|
},
|
|
76
61
|
onChange: onChange,
|
|
77
|
-
control: /*#__PURE__*/_react
|
|
62
|
+
control: /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
78
63
|
className: 'cbx-checkbox-container',
|
|
79
64
|
indeterminate: indeterminate,
|
|
80
65
|
style: {
|
|
@@ -94,13 +79,12 @@ var CheckboxOld = function CheckboxOld(_ref) {
|
|
|
94
79
|
label: label
|
|
95
80
|
}, props));
|
|
96
81
|
};
|
|
97
|
-
|
|
98
82
|
CheckboxOld.displayName = "CheckboxOld";
|
|
99
83
|
CheckboxOld.propTypes = {
|
|
100
|
-
onChange: _propTypes
|
|
101
|
-
disabled: _propTypes
|
|
102
|
-
indeterminate: _propTypes
|
|
103
|
-
label: _propTypes
|
|
84
|
+
onChange: _propTypes["default"].func,
|
|
85
|
+
disabled: _propTypes["default"].bool,
|
|
86
|
+
indeterminate: _propTypes["default"].bool,
|
|
87
|
+
label: _propTypes["default"].string
|
|
104
88
|
};
|
|
105
89
|
CheckboxOld.defaultProps = {
|
|
106
90
|
onChange: undefined,
|
|
@@ -109,4 +93,4 @@ CheckboxOld.defaultProps = {
|
|
|
109
93
|
label: ''
|
|
110
94
|
};
|
|
111
95
|
var _default = CheckboxOld;
|
|
112
|
-
exports
|
|
96
|
+
exports["default"] = _default;
|
|
@@ -40,14 +40,25 @@
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.cbx-dragDrop-input {
|
|
43
|
-
display: block!important;
|
|
44
|
-
width: 100%;
|
|
45
|
-
height: 100%;
|
|
46
43
|
position: absolute;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
width: 1px;
|
|
45
|
+
height: 1px;
|
|
46
|
+
padding: 0;
|
|
47
|
+
margin: -1px;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
clip: rect(0, 0, 0, 0);
|
|
50
|
+
white-space: nowrap;
|
|
51
|
+
border: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.cbx-dragDrop-visually-hidden {
|
|
55
|
+
position: absolute;
|
|
56
|
+
width: 1px;
|
|
57
|
+
height: 1px;
|
|
58
|
+
padding: 0;
|
|
59
|
+
margin: -1px;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
clip: rect(0, 0, 0, 0);
|
|
62
|
+
white-space: nowrap;
|
|
63
|
+
border: 0;
|
|
53
64
|
}
|