@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,140 +1,143 @@
|
|
|
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("./Tabs.css");
|
|
15
|
-
|
|
16
12
|
var _IconButtonSquare = _interopRequireDefault(require("../IconButtonSquare/IconButtonSquare"));
|
|
17
|
-
|
|
18
13
|
var _useWindowSize2 = _interopRequireDefault(require("../../HOCs/useWindowSize"));
|
|
19
|
-
|
|
20
14
|
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
21
|
-
|
|
22
|
-
var _excluded = ["id", "className", "value", "onChange", "itemsTab", "variant", "sx", "style", "stylesText", "indicatorColor", "prefixClass"];
|
|
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
|
-
|
|
15
|
+
var _useFallbackId = _interopRequireDefault(require("../../utils/useFallbackId"));
|
|
16
|
+
var _excluded = ["id", "className", "value", "onChange", "itemsTab", "variant", "sx", "style", "stylesText", "indicatorColor", "prefixClass", "ariaLabel"];
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
18
|
+
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); }
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
23
|
+
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); }
|
|
24
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
36
25
|
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
|
-
|
|
26
|
+
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; } }
|
|
27
|
+
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; }
|
|
28
|
+
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; } }
|
|
29
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
30
|
+
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; }
|
|
31
|
+
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
32
|
var Tabs = function Tabs(_ref) {
|
|
51
33
|
var id = _ref.id,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
var _useDynamicStyles = (0, _useDynamicStyles2
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
34
|
+
className = _ref.className,
|
|
35
|
+
value = _ref.value,
|
|
36
|
+
onChange = _ref.onChange,
|
|
37
|
+
itemsTab = _ref.itemsTab,
|
|
38
|
+
variant = _ref.variant,
|
|
39
|
+
sx = _ref.sx,
|
|
40
|
+
style = _ref.style,
|
|
41
|
+
stylesText = _ref.stylesText,
|
|
42
|
+
indicatorColor = _ref.indicatorColor,
|
|
43
|
+
propPrefixClass = _ref.prefixClass,
|
|
44
|
+
ariaLabel = _ref.ariaLabel,
|
|
45
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
46
|
+
var _useDynamicStyles = (0, _useDynamicStyles2["default"])(sx),
|
|
47
|
+
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
48
|
+
dynamicPrefixClass = _useDynamicStyles.prefixClass;
|
|
68
49
|
var prefixClass = propPrefixClass || dynamicPrefixClass;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var _React$
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
setShowRightScrollButton = _React$useState8[1];
|
|
94
|
-
|
|
95
|
-
var _React$useState9 = _react.default.useState(false),
|
|
96
|
-
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
97
|
-
isEllipsisActive = _React$useState10[0],
|
|
98
|
-
setIsEllipsisActive = _React$useState10[1];
|
|
99
|
-
|
|
50
|
+
var _React$useState = _react["default"].useState(0),
|
|
51
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
52
|
+
scrollLeft = _React$useState2[0],
|
|
53
|
+
setScrollLeft = _React$useState2[1];
|
|
54
|
+
var _useWindowSize = (0, _useWindowSize2["default"])(),
|
|
55
|
+
innerWidth = _useWindowSize.innerWidth;
|
|
56
|
+
var tabsContainerRef = _react["default"].useRef(null);
|
|
57
|
+
var tabRefs = _react["default"].useRef([]);
|
|
58
|
+
var _React$useState3 = _react["default"].useState(false),
|
|
59
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
60
|
+
showScrollButtons = _React$useState4[0],
|
|
61
|
+
setShowScrollButtons = _React$useState4[1];
|
|
62
|
+
var _React$useState5 = _react["default"].useState(false),
|
|
63
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
64
|
+
showLeftScrollButton = _React$useState6[0],
|
|
65
|
+
setShowLeftScrollButton = _React$useState6[1];
|
|
66
|
+
var _React$useState7 = _react["default"].useState(false),
|
|
67
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
68
|
+
showRightScrollButton = _React$useState8[0],
|
|
69
|
+
setShowRightScrollButton = _React$useState8[1];
|
|
70
|
+
var _React$useState9 = _react["default"].useState(false),
|
|
71
|
+
_React$useState0 = _slicedToArray(_React$useState9, 2),
|
|
72
|
+
isEllipsisActive = _React$useState0[0],
|
|
73
|
+
setIsEllipsisActive = _React$useState0[1];
|
|
100
74
|
var isControlled = value !== undefined;
|
|
101
|
-
|
|
102
75
|
var getInitialTabIndex = function getInitialTabIndex() {
|
|
103
76
|
return Math.max(itemsTab.findIndex(function (i) {
|
|
104
77
|
return i.value === value;
|
|
105
78
|
}), 0);
|
|
106
79
|
};
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
setInternalTabIndex = _React$useState12[1];
|
|
112
|
-
|
|
80
|
+
var _React$useState1 = _react["default"].useState(getInitialTabIndex()),
|
|
81
|
+
_React$useState10 = _slicedToArray(_React$useState1, 2),
|
|
82
|
+
internalTabIndex = _React$useState10[0],
|
|
83
|
+
setInternalTabIndex = _React$useState10[1];
|
|
113
84
|
var activeTabIndex = isControlled ? value : internalTabIndex;
|
|
114
|
-
|
|
85
|
+
var generatedId = (0, _useFallbackId["default"])('cbx-tabs');
|
|
86
|
+
var tabsId = id || generatedId;
|
|
115
87
|
var handleTabClick = function handleTabClick(e, index, valueItem) {
|
|
116
88
|
if (!isControlled) {
|
|
117
89
|
setInternalTabIndex(index);
|
|
118
90
|
}
|
|
119
|
-
|
|
120
91
|
if (onChange) {
|
|
121
92
|
onChange(index, valueItem);
|
|
122
93
|
}
|
|
123
94
|
};
|
|
124
|
-
|
|
125
|
-
|
|
95
|
+
var handleTabsKeyDown = function handleTabsKeyDown(event) {
|
|
96
|
+
var _tabRefs$current$next;
|
|
97
|
+
var enabledIndexes = itemsTab.map(function (item, idx) {
|
|
98
|
+
return item.disabled ? null : idx;
|
|
99
|
+
}).filter(function (idx) {
|
|
100
|
+
return idx !== null;
|
|
101
|
+
});
|
|
102
|
+
if (enabledIndexes.length === 0) return;
|
|
103
|
+
var currentPos = enabledIndexes.indexOf(activeTabIndex);
|
|
104
|
+
var nextPos = null;
|
|
105
|
+
switch (event.key) {
|
|
106
|
+
case 'ArrowRight':
|
|
107
|
+
nextPos = (currentPos + 1) % enabledIndexes.length;
|
|
108
|
+
break;
|
|
109
|
+
case 'ArrowLeft':
|
|
110
|
+
nextPos = (currentPos - 1 + enabledIndexes.length) % enabledIndexes.length;
|
|
111
|
+
break;
|
|
112
|
+
case 'Home':
|
|
113
|
+
nextPos = 0;
|
|
114
|
+
break;
|
|
115
|
+
case 'End':
|
|
116
|
+
nextPos = enabledIndexes.length - 1;
|
|
117
|
+
break;
|
|
118
|
+
case 'Enter':
|
|
119
|
+
case ' ':
|
|
120
|
+
handleTabClick(event, activeTabIndex, itemsTab[activeTabIndex].value || activeTabIndex);
|
|
121
|
+
event.preventDefault();
|
|
122
|
+
return;
|
|
123
|
+
default:
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
event.preventDefault();
|
|
127
|
+
var nextIndex = enabledIndexes[nextPos];
|
|
128
|
+
handleTabClick(event, nextIndex, itemsTab[nextIndex].value || nextIndex);
|
|
129
|
+
(_tabRefs$current$next = tabRefs.current[nextIndex]) === null || _tabRefs$current$next === void 0 ? void 0 : _tabRefs$current$next.focus();
|
|
130
|
+
};
|
|
131
|
+
_react["default"].useEffect(function () {
|
|
126
132
|
if (!isControlled) {
|
|
127
133
|
setInternalTabIndex(getInitialTabIndex());
|
|
128
134
|
}
|
|
129
135
|
}, [itemsTab]);
|
|
130
|
-
|
|
131
136
|
var showButtons = function showButtons(direction, scrollLeftNumber) {
|
|
132
137
|
var container = tabsContainerRef === null || tabsContainerRef === void 0 ? void 0 : tabsContainerRef.current;
|
|
133
|
-
|
|
134
138
|
if (container) {
|
|
135
139
|
var isAtStart = (scrollLeftNumber || container.scrollLeft) <= 0;
|
|
136
140
|
var isAtEnd = (scrollLeftNumber || container.scrollLeft) >= container.scrollWidth - container.clientWidth;
|
|
137
|
-
|
|
138
141
|
if (direction === 'left' && !isAtEnd) {
|
|
139
142
|
setTimeout(function () {
|
|
140
143
|
setShowLeftScrollButton(!isAtStart);
|
|
@@ -148,10 +151,8 @@ var Tabs = function Tabs(_ref) {
|
|
|
148
151
|
}
|
|
149
152
|
}
|
|
150
153
|
};
|
|
151
|
-
|
|
152
154
|
var handleScroll = function handleScroll(direction) {
|
|
153
155
|
var container = tabsContainerRef === null || tabsContainerRef === void 0 ? void 0 : tabsContainerRef.current;
|
|
154
|
-
|
|
155
156
|
if (container) {
|
|
156
157
|
if (direction === 'left') {
|
|
157
158
|
container.scrollLeft -= 500;
|
|
@@ -160,28 +161,22 @@ var Tabs = function Tabs(_ref) {
|
|
|
160
161
|
container.scrollLeft += 500;
|
|
161
162
|
showButtons(direction, container.scrollLeft += 500);
|
|
162
163
|
}
|
|
163
|
-
|
|
164
164
|
setScrollLeft(container.scrollLeft);
|
|
165
165
|
}
|
|
166
166
|
};
|
|
167
|
-
|
|
168
|
-
_react.default.useEffect(function () {
|
|
167
|
+
_react["default"].useEffect(function () {
|
|
169
168
|
var container = tabsContainerRef === null || tabsContainerRef === void 0 ? void 0 : tabsContainerRef.current;
|
|
170
|
-
|
|
171
169
|
if (container) {
|
|
172
170
|
setShowScrollButtons(container.scrollLeft > 0 || container.scrollLeft < container.scrollWidth - container.clientWidth);
|
|
173
171
|
}
|
|
174
172
|
}, [scrollLeft, innerWidth, variant]);
|
|
175
|
-
|
|
176
|
-
_react.default.useEffect(function () {
|
|
173
|
+
_react["default"].useEffect(function () {
|
|
177
174
|
var container = tabsContainerRef === null || tabsContainerRef === void 0 ? void 0 : tabsContainerRef.current;
|
|
178
|
-
|
|
179
175
|
if (container) {
|
|
180
176
|
showButtons('left');
|
|
181
177
|
}
|
|
182
178
|
}, []);
|
|
183
|
-
|
|
184
|
-
_react.default.useEffect(function () {
|
|
179
|
+
_react["default"].useEffect(function () {
|
|
185
180
|
var timeout = setTimeout(function () {
|
|
186
181
|
if (tabsContainerRef.current) {
|
|
187
182
|
var textElements = tabsContainerRef.current.querySelectorAll('.cbx-Typography');
|
|
@@ -196,28 +191,33 @@ var Tabs = function Tabs(_ref) {
|
|
|
196
191
|
return clearTimeout(timeout);
|
|
197
192
|
};
|
|
198
193
|
}, [itemsTab]);
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
id: id,
|
|
194
|
+
return /*#__PURE__*/_react["default"].createElement("div", _extends({
|
|
195
|
+
id: tabsId,
|
|
202
196
|
className: "".concat(prefixClass('cbx-Tabs'), " ").concat(className || ''),
|
|
203
197
|
style: _objectSpread(_objectSpread({}, style), stylesInLine)
|
|
204
|
-
}, props), (variant === 'scrollable' || variant === 'scrollable-fullWidth') && showScrollButtons && /*#__PURE__*/_react
|
|
198
|
+
}, props), (variant === 'scrollable' || variant === 'scrollable-fullWidth') && showScrollButtons && /*#__PURE__*/_react["default"].createElement("button", {
|
|
199
|
+
type: "button",
|
|
205
200
|
className: "".concat(prefixClass('cbx-Tabs-button-left')),
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
201
|
+
"aria-label": "Desplazar pesta\xF1as hacia la izquierda",
|
|
202
|
+
"aria-controls": tabsId,
|
|
203
|
+
disabled: !showLeftScrollButton,
|
|
209
204
|
onClick: function onClick() {
|
|
210
205
|
return handleScroll('left');
|
|
211
206
|
}
|
|
212
|
-
},
|
|
213
|
-
className: "ri-arrow-left-s-line"
|
|
214
|
-
|
|
207
|
+
}, /*#__PURE__*/_react["default"].createElement("i", {
|
|
208
|
+
className: "ri-arrow-left-s-line",
|
|
209
|
+
"aria-hidden": "true"
|
|
210
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
215
211
|
className: prefixClass('cbx-Tabs-container'),
|
|
216
212
|
style: {
|
|
217
213
|
width: variant === 'fullWidth' || variant === 'scrollable-fullWidth' ? '100%' : 'auto'
|
|
218
214
|
}
|
|
219
|
-
}, /*#__PURE__*/_react
|
|
215
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
220
216
|
ref: tabsContainerRef,
|
|
217
|
+
role: "tablist",
|
|
218
|
+
"aria-label": ariaLabel || 'Pestañas',
|
|
219
|
+
"aria-orientation": "horizontal",
|
|
220
|
+
onKeyDown: handleTabsKeyDown,
|
|
221
221
|
style: {
|
|
222
222
|
display: 'flex',
|
|
223
223
|
overflow: 'hidden',
|
|
@@ -225,15 +225,26 @@ var Tabs = function Tabs(_ref) {
|
|
|
225
225
|
width: variant === 'fullWidth' || variant === 'scrollable-fullWidth' ? '100%' : 'auto'
|
|
226
226
|
}
|
|
227
227
|
}, itemsTab === null || itemsTab === void 0 ? void 0 : itemsTab.map(function (item, index) {
|
|
228
|
-
|
|
228
|
+
var isActive = index === activeTabIndex;
|
|
229
|
+
return /*#__PURE__*/_react["default"].createElement(_IconButtonSquare["default"], {
|
|
229
230
|
key: "".concat(item.text, "-").concat(index),
|
|
231
|
+
ref: function ref(el) {
|
|
232
|
+
tabRefs.current[index] = el;
|
|
233
|
+
},
|
|
234
|
+
id: "".concat(tabsId, "-tab-").concat(index),
|
|
235
|
+
role: "tab",
|
|
236
|
+
"aria-selected": isActive,
|
|
237
|
+
"aria-controls": item.panelId || undefined,
|
|
238
|
+
"aria-disabled": item.disabled || undefined,
|
|
239
|
+
tabIndex: isActive ? 0 : -1,
|
|
230
240
|
onClick: function onClick(e) {
|
|
231
241
|
return handleTabClick(e, index, item.value || index);
|
|
232
242
|
},
|
|
233
243
|
text: item.text || item.label,
|
|
234
244
|
badge: item.badge,
|
|
245
|
+
badgeLabel: item.badge ? item.badgeLabel || 'Nuevo contenido' : undefined,
|
|
235
246
|
variant: 'M',
|
|
236
|
-
className: "cbx-Tab-item".concat(
|
|
247
|
+
className: "cbx-Tab-item".concat(isActive ? '-active' : '', " cbx-Tab-").concat(index),
|
|
237
248
|
disabled: item.disabled,
|
|
238
249
|
placementTooltip: 'bottom',
|
|
239
250
|
tooltip: isEllipsisActive[index] ? item.text || item.label : '',
|
|
@@ -250,7 +261,8 @@ var Tabs = function Tabs(_ref) {
|
|
|
250
261
|
margin: '0',
|
|
251
262
|
width: 'auto',
|
|
252
263
|
height: '3rem',
|
|
253
|
-
borderBottom:
|
|
264
|
+
borderBottom: isActive ? indicatorColor === 'secondary' ? '2px solid var(--gray2)' : '2px solid var(--primary)' : indicatorColor === 'secondary' ? '2px solid var(--primary)' : '2px solid var(--gray2)',
|
|
265
|
+
backgroundColor: indicatorColor === 'secondary' ? 'var(--primary)' : undefined,
|
|
254
266
|
transition: 'color .2s'
|
|
255
267
|
}, variant === 'fullWidth' ? {
|
|
256
268
|
flex: '1 1 0px'
|
|
@@ -259,35 +271,37 @@ var Tabs = function Tabs(_ref) {
|
|
|
259
271
|
flex: 1
|
|
260
272
|
} : {}),
|
|
261
273
|
stylesText: _objectSpread({
|
|
262
|
-
color: item.disabled ? 'rgba(0,0,0,0.38)' :
|
|
263
|
-
opacity:
|
|
274
|
+
color: item.disabled ? 'rgba(0,0,0,0.38)' : isActive ? indicatorColor === 'secondary' ? 'white' : 'var(--primary)' : indicatorColor === 'secondary' ? 'white' : 'var(--gray3)',
|
|
275
|
+
opacity: !isActive && indicatorColor === 'secondary' && '0.7'
|
|
264
276
|
}, stylesText)
|
|
265
277
|
});
|
|
266
|
-
}))), (variant === 'scrollable' || variant === 'scrollable-fullWidth') && showScrollButtons && /*#__PURE__*/_react
|
|
278
|
+
}))), (variant === 'scrollable' || variant === 'scrollable-fullWidth') && showScrollButtons && /*#__PURE__*/_react["default"].createElement("button", {
|
|
279
|
+
type: "button",
|
|
267
280
|
className: "".concat(prefixClass('cbx-Tabs-button-right')),
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
},
|
|
281
|
+
"aria-label": "Desplazar pesta\xF1as hacia la derecha",
|
|
282
|
+
disabled: !showRightScrollButton,
|
|
271
283
|
onClick: function onClick() {
|
|
272
284
|
return handleScroll('right');
|
|
273
285
|
}
|
|
274
|
-
},
|
|
275
|
-
className: "ri-arrow-right-s-line"
|
|
286
|
+
}, /*#__PURE__*/_react["default"].createElement("i", {
|
|
287
|
+
className: "ri-arrow-right-s-line",
|
|
288
|
+
"aria-hidden": "true"
|
|
276
289
|
})));
|
|
277
290
|
};
|
|
278
|
-
|
|
279
291
|
Tabs.displayName = "Tabs";
|
|
280
292
|
Tabs.propTypes = {
|
|
281
|
-
value: _propTypes
|
|
282
|
-
onChange: _propTypes
|
|
283
|
-
itemsTab: _propTypes
|
|
284
|
-
variant: _propTypes
|
|
293
|
+
value: _propTypes["default"].any,
|
|
294
|
+
onChange: _propTypes["default"].func,
|
|
295
|
+
itemsTab: _propTypes["default"].array,
|
|
296
|
+
variant: _propTypes["default"].string,
|
|
297
|
+
ariaLabel: _propTypes["default"].string
|
|
285
298
|
};
|
|
286
299
|
Tabs.defaultProps = {
|
|
287
300
|
value: undefined,
|
|
288
301
|
onChange: undefined,
|
|
289
302
|
itemsTab: [],
|
|
290
|
-
variant: ''
|
|
303
|
+
variant: '',
|
|
304
|
+
ariaLabel: 'Tabs'
|
|
291
305
|
};
|
|
292
306
|
var _default = Tabs;
|
|
293
|
-
exports
|
|
307
|
+
exports["default"] = _default;
|
|
@@ -3,19 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
6
|
+
exports["default"] = exports.DesignTabsTemplate = void 0;
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _Tabs = _interopRequireDefault(require("./Tabs"));
|
|
11
|
-
|
|
12
9
|
var _DesignTabs = _interopRequireDefault(require("./DesignTabs"));
|
|
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/Tabs',
|
|
18
|
-
component: _Tabs
|
|
13
|
+
component: _Tabs["default"],
|
|
19
14
|
argTypes: {
|
|
20
15
|
variant: {
|
|
21
16
|
options: ['normal', 'fullWidth', 'scrollable', 'scrollable-fullWidth'],
|
|
@@ -39,12 +34,10 @@ var _default = {
|
|
|
39
34
|
}
|
|
40
35
|
}
|
|
41
36
|
};
|
|
42
|
-
exports
|
|
43
|
-
|
|
37
|
+
exports["default"] = _default;
|
|
44
38
|
var Template = function Template(args) {
|
|
45
|
-
return /*#__PURE__*/_react
|
|
39
|
+
return /*#__PURE__*/_react["default"].createElement(_DesignTabs["default"], args);
|
|
46
40
|
};
|
|
47
|
-
|
|
48
41
|
Template.displayName = "Template";
|
|
49
42
|
var DesignTabsTemplate = Template.bind({});
|
|
50
43
|
exports.DesignTabsTemplate = DesignTabsTemplate;
|
|
@@ -1,48 +1,35 @@
|
|
|
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 _Tabs = _interopRequireDefault(require("@mui/material/Tabs"));
|
|
13
|
-
|
|
14
11
|
var _Tab = _interopRequireDefault(require("@mui/material/Tab"));
|
|
15
|
-
|
|
16
12
|
require("../../styles/main.css");
|
|
17
|
-
|
|
18
13
|
require("./Tabs.css");
|
|
19
|
-
|
|
20
14
|
var _excluded = ["id", "className", "value", "onChange", "itemsTab", "variant"];
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
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; }
|
|
31
|
-
|
|
32
|
-
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; }
|
|
33
|
-
|
|
34
|
-
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; }
|
|
35
|
-
|
|
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 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); }
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
36
24
|
var Tabs = function Tabs(_ref) {
|
|
37
25
|
var id = _ref.id,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return /*#__PURE__*/_react.default.createElement(_Tabs.default, _extends({
|
|
26
|
+
className = _ref.className,
|
|
27
|
+
value = _ref.value,
|
|
28
|
+
onChange = _ref.onChange,
|
|
29
|
+
itemsTab = _ref.itemsTab,
|
|
30
|
+
variant = _ref.variant,
|
|
31
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
return /*#__PURE__*/_react["default"].createElement(_Tabs["default"], _extends({
|
|
46
33
|
id: id,
|
|
47
34
|
className: className,
|
|
48
35
|
value: value,
|
|
@@ -50,7 +37,7 @@ var Tabs = function Tabs(_ref) {
|
|
|
50
37
|
variant: variant === 'scrollable-fullWidth' ? 'scrollable' : variant,
|
|
51
38
|
scrollButtons: "auto"
|
|
52
39
|
}, props), itemsTab === null || itemsTab === void 0 ? void 0 : itemsTab.map(function (item, index) {
|
|
53
|
-
return /*#__PURE__*/_react
|
|
40
|
+
return /*#__PURE__*/_react["default"].createElement(_Tab["default"], _extends({
|
|
54
41
|
key: "".concat(item.text, "-").concat(index),
|
|
55
42
|
sx: _objectSpread(_objectSpread({
|
|
56
43
|
borderBottom: '2px solid var(--gray2)',
|
|
@@ -63,30 +50,29 @@ var Tabs = function Tabs(_ref) {
|
|
|
63
50
|
} : {}), item.sx),
|
|
64
51
|
disabled: item.disabled,
|
|
65
52
|
value: item.value || index,
|
|
66
|
-
label: /*#__PURE__*/_react
|
|
53
|
+
label: /*#__PURE__*/_react["default"].createElement("div", {
|
|
67
54
|
className: "cbx-Tab-container-label"
|
|
68
|
-
}, item.badge && /*#__PURE__*/_react
|
|
55
|
+
}, item.badge && /*#__PURE__*/_react["default"].createElement("div", {
|
|
69
56
|
className: 'cbx-Tab-red-dot'
|
|
70
57
|
}), item.text)
|
|
71
58
|
}, item));
|
|
72
59
|
}));
|
|
73
60
|
};
|
|
74
|
-
|
|
75
61
|
Tabs.displayName = "Tabs";
|
|
76
62
|
Tabs.propTypes = {
|
|
77
|
-
value: _propTypes
|
|
78
|
-
onChange: _propTypes
|
|
79
|
-
itemsTab: _propTypes
|
|
80
|
-
variant: _propTypes
|
|
63
|
+
value: _propTypes["default"].any,
|
|
64
|
+
onChange: _propTypes["default"].func,
|
|
65
|
+
itemsTab: _propTypes["default"].array,
|
|
66
|
+
variant: _propTypes["default"].string
|
|
81
67
|
};
|
|
82
68
|
Tabs.defaultProps = {
|
|
83
69
|
value: 0,
|
|
84
70
|
onChange: undefined,
|
|
85
71
|
itemsTab: [],
|
|
86
|
-
variant: ''
|
|
72
|
+
variant: ''
|
|
73
|
+
// variant: 'fullWidth'
|
|
87
74
|
// variant: 'scrollable-fullWidth'
|
|
88
75
|
// variant: 'scrollable'
|
|
89
|
-
|
|
90
76
|
};
|
|
91
77
|
var _default = Tabs;
|
|
92
|
-
exports
|
|
78
|
+
exports["default"] = _default;
|