@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,91 +1,108 @@
|
|
|
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("./Stars.css");
|
|
15
|
-
|
|
16
12
|
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
31
|
-
|
|
32
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
-
|
|
34
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
35
|
-
|
|
36
|
-
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; }
|
|
37
|
-
|
|
13
|
+
var _useFallbackId = _interopRequireDefault(require("../../utils/useFallbackId"));
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
15
|
+
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; }
|
|
16
|
+
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; }
|
|
17
|
+
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; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
19
|
+
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); }
|
|
20
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
21
|
+
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."); }
|
|
22
|
+
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; } }
|
|
23
|
+
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; }
|
|
24
|
+
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; } }
|
|
25
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
38
26
|
var Stars = function Stars(_ref) {
|
|
39
27
|
var name = _ref.name,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
28
|
+
lowStars = _ref.lowStars,
|
|
29
|
+
onClick = _ref.onClick,
|
|
30
|
+
value = _ref.value,
|
|
31
|
+
error = _ref.error,
|
|
32
|
+
disabled = _ref.disabled,
|
|
33
|
+
lengthtStars = _ref.lengthtStars,
|
|
34
|
+
lengthStars = _ref.lengthStars,
|
|
35
|
+
variant = _ref.variant,
|
|
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 lengthSt = lengthtStars || lengthStars;
|
|
42
|
+
var _React$useState = _react["default"].useState(null),
|
|
43
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
44
|
+
hoverValue = _React$useState2[0],
|
|
45
|
+
setHoverValue = _React$useState2[1];
|
|
46
|
+
var errorId = (0, _useFallbackId["default"])('cbx-stars-error');
|
|
47
|
+
var displayValue = hoverValue !== null && hoverValue !== void 0 ? hoverValue : value;
|
|
48
|
+
var stars = _react["default"].useMemo(function () {
|
|
49
|
+
return Array.from({
|
|
50
|
+
length: lengthSt
|
|
51
|
+
}, function (_, i) {
|
|
52
|
+
return i + 1;
|
|
53
|
+
});
|
|
54
|
+
}, [lengthSt]);
|
|
55
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
57
56
|
style: _objectSpread(_objectSpread({
|
|
58
57
|
display: 'inline-block'
|
|
59
58
|
}, style), stylesInLine),
|
|
60
59
|
className: prefixClass('cbx-RatingStarts')
|
|
61
|
-
}, /*#__PURE__*/_react
|
|
60
|
+
}, /*#__PURE__*/_react["default"].createElement("fieldset", {
|
|
62
61
|
className: prefixClass(disabled ? 'cbx-rating-disabled' : "cbx-rating ".concat(variant === 'secondary' ? 'cbx-rating-secondary' : '')),
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
onMouseLeave: function onMouseLeave() {
|
|
63
|
+
return !disabled && setHoverValue(null);
|
|
64
|
+
},
|
|
65
|
+
"aria-describedby": error ? errorId : undefined,
|
|
66
|
+
"aria-invalid": !!error
|
|
67
|
+
}, /*#__PURE__*/_react["default"].createElement("legend", {
|
|
65
68
|
className: "cbx-rating-legend-hidden"
|
|
66
|
-
}, "Rating for ".concat(name)),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
}, "Rating for ".concat(name)), stars.map(function (starValue) {
|
|
70
|
+
var isFilled = displayValue != null && starValue <= displayValue;
|
|
71
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
|
|
72
|
+
key: "".concat(starValue, "_").concat(name)
|
|
73
|
+
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
70
74
|
type: "radio",
|
|
71
|
-
id: "star".concat(
|
|
75
|
+
id: "star".concat(starValue).concat(name),
|
|
72
76
|
name: "rating2".concat(name),
|
|
73
|
-
checked: value ===
|
|
74
|
-
value:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
77
|
+
checked: value === starValue,
|
|
78
|
+
value: starValue,
|
|
79
|
+
disabled: disabled,
|
|
80
|
+
onFocus: function onFocus() {
|
|
81
|
+
return !disabled && setHoverValue(starValue);
|
|
82
|
+
},
|
|
83
|
+
onBlur: function onBlur() {
|
|
84
|
+
return !disabled && setHoverValue(null);
|
|
85
|
+
},
|
|
79
86
|
onChange: function onChange(event) {
|
|
80
87
|
if (!disabled) {
|
|
81
88
|
onClick(event.target.value);
|
|
82
89
|
}
|
|
83
90
|
}
|
|
84
|
-
}), /*#__PURE__*/_react
|
|
85
|
-
htmlFor: "star".concat(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
}), /*#__PURE__*/_react["default"].createElement("label", {
|
|
92
|
+
htmlFor: "star".concat(starValue).concat(name),
|
|
93
|
+
onMouseEnter: function onMouseEnter() {
|
|
94
|
+
return !disabled && setHoverValue(starValue);
|
|
95
|
+
},
|
|
96
|
+
className: prefixClass("cbx-star-label ".concat(isFilled ? 'cbx-star-filled' : '', " ").concat(lowStars ? 'cbx-lowStars' : ''))
|
|
97
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
98
|
+
"aria-hidden": "true",
|
|
99
|
+
role: "presentation"
|
|
100
|
+
}, "\u2605"), /*#__PURE__*/_react["default"].createElement("span", {
|
|
101
|
+
className: "cbx-rating-legend-hidden"
|
|
102
|
+
}, "".concat(starValue, " ").concat(starValue === 1 ? 'star' : 'stars'))));
|
|
103
|
+
})), error && /*#__PURE__*/_react["default"].createElement("div", {
|
|
104
|
+
id: errorId,
|
|
105
|
+
role: "alert",
|
|
89
106
|
style: {
|
|
90
107
|
color: 'var(--error)',
|
|
91
108
|
fontWeight: '700',
|
|
@@ -94,17 +111,16 @@ var Stars = function Stars(_ref) {
|
|
|
94
111
|
}
|
|
95
112
|
}, error));
|
|
96
113
|
};
|
|
97
|
-
|
|
98
114
|
Stars.displayName = "Stars";
|
|
99
115
|
Stars.propTypes = {
|
|
100
|
-
name: _propTypes
|
|
101
|
-
lowStars: _propTypes
|
|
102
|
-
onClick: _propTypes
|
|
103
|
-
value: _propTypes
|
|
104
|
-
error: _propTypes
|
|
105
|
-
disabled: _propTypes
|
|
106
|
-
lengthStars: _propTypes
|
|
107
|
-
variant: _propTypes
|
|
116
|
+
name: _propTypes["default"].string,
|
|
117
|
+
lowStars: _propTypes["default"].bool,
|
|
118
|
+
onClick: _propTypes["default"].func,
|
|
119
|
+
value: _propTypes["default"].number,
|
|
120
|
+
error: _propTypes["default"].bool,
|
|
121
|
+
disabled: _propTypes["default"].bool,
|
|
122
|
+
lengthStars: _propTypes["default"].number,
|
|
123
|
+
variant: _propTypes["default"].string
|
|
108
124
|
};
|
|
109
125
|
Stars.defaultProps = {
|
|
110
126
|
name: '',
|
|
@@ -117,4 +133,4 @@ Stars.defaultProps = {
|
|
|
117
133
|
variant: ''
|
|
118
134
|
};
|
|
119
135
|
var _default = Stars;
|
|
120
|
-
exports
|
|
136
|
+
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.DesignStarsTemplate = void 0;
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _Stars = _interopRequireDefault(require("./Stars"));
|
|
11
|
-
|
|
12
9
|
var _DesignStars = _interopRequireDefault(require("./DesignStars"));
|
|
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/Stars',
|
|
18
|
-
component: _Stars
|
|
13
|
+
component: _Stars["default"],
|
|
19
14
|
argTypes: {},
|
|
20
15
|
parameters: {
|
|
21
16
|
storybookCodePanel: {
|
|
@@ -32,12 +27,10 @@ var _default = {
|
|
|
32
27
|
}
|
|
33
28
|
}
|
|
34
29
|
};
|
|
35
|
-
exports
|
|
36
|
-
|
|
30
|
+
exports["default"] = _default;
|
|
37
31
|
var Template = function Template(args) {
|
|
38
|
-
return /*#__PURE__*/_react
|
|
32
|
+
return /*#__PURE__*/_react["default"].createElement(_DesignStars["default"], args);
|
|
39
33
|
};
|
|
40
|
-
|
|
41
34
|
Template.displayName = "Template";
|
|
42
35
|
var DesignStarsTemplate = Template.bind({});
|
|
43
36
|
exports.DesignStarsTemplate = DesignStarsTemplate;
|
|
@@ -3,32 +3,21 @@
|
|
|
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 _Stepper = _interopRequireDefault(require("./Stepper"));
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
|
-
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
16
11
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
23
|
-
|
|
24
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
|
-
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) { n[e] = r[e]; } return n; }
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
26
16
|
var DesignStepper = function DesignStepper() {
|
|
27
|
-
var _React$useState = _react
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
var _React$useState = _react["default"].useState(null),
|
|
18
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
19
|
+
state = _React$useState2[0],
|
|
20
|
+
setState = _React$useState2[1];
|
|
32
21
|
var steps = [{
|
|
33
22
|
text: 'Detalles',
|
|
34
23
|
name: 'Detalles',
|
|
@@ -60,7 +49,6 @@ var DesignStepper = function DesignStepper() {
|
|
|
60
49
|
var currentIndex = stepNames.indexOf(state);
|
|
61
50
|
var previous = stepNames[currentIndex - 1];
|
|
62
51
|
var next = stepNames[currentIndex + 1];
|
|
63
|
-
|
|
64
52
|
var handleStepClick = function handleStepClick(stepName) {
|
|
65
53
|
if (stepName === next) {
|
|
66
54
|
setState(next);
|
|
@@ -68,12 +56,11 @@ var DesignStepper = function DesignStepper() {
|
|
|
68
56
|
setState(previous);
|
|
69
57
|
}
|
|
70
58
|
};
|
|
71
|
-
|
|
72
|
-
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
59
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
73
60
|
style: {
|
|
74
61
|
marginBottom: '1rem'
|
|
75
62
|
}
|
|
76
|
-
}, /*#__PURE__*/_react
|
|
63
|
+
}, /*#__PURE__*/_react["default"].createElement(_Stepper["default"], {
|
|
77
64
|
onClick: setState,
|
|
78
65
|
items: [{
|
|
79
66
|
text: 'Detalles',
|
|
@@ -101,7 +88,7 @@ var DesignStepper = function DesignStepper() {
|
|
|
101
88
|
icon: 'ri-file-text-line'
|
|
102
89
|
}],
|
|
103
90
|
active: state
|
|
104
|
-
})), /*#__PURE__*/_react
|
|
91
|
+
})), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_Stepper["default"], {
|
|
105
92
|
onClick: setState,
|
|
106
93
|
freeNavigation: false,
|
|
107
94
|
items: [{
|
|
@@ -130,7 +117,7 @@ var DesignStepper = function DesignStepper() {
|
|
|
130
117
|
icon: 'ri-file-text-line'
|
|
131
118
|
}],
|
|
132
119
|
active: state
|
|
133
|
-
})), /*#__PURE__*/_react
|
|
120
|
+
})), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_Stepper["default"], {
|
|
134
121
|
onClick: handleStepClick,
|
|
135
122
|
freeNavigation: false,
|
|
136
123
|
allowedSteps: [previous, next].filter(Boolean),
|
|
@@ -138,7 +125,6 @@ var DesignStepper = function DesignStepper() {
|
|
|
138
125
|
active: state
|
|
139
126
|
})));
|
|
140
127
|
};
|
|
141
|
-
|
|
142
128
|
DesignStepper.displayName = "DesignStepper";
|
|
143
129
|
var _default = DesignStepper;
|
|
144
|
-
exports
|
|
130
|
+
exports["default"] = _default;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
.cbx-stepper-container-nav {
|
|
2
|
+
width: 100%;
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
.cbx-stepper-container {
|
|
2
6
|
width: 100%;
|
|
3
7
|
display: flex;
|
|
4
|
-
align-items: center
|
|
8
|
+
align-items: center;
|
|
9
|
+
list-style: none;
|
|
10
|
+
margin: 0;
|
|
11
|
+
padding: 0;
|
|
5
12
|
}
|
|
6
13
|
|
|
7
14
|
.cbx-stepper-item {
|
|
@@ -10,6 +17,7 @@
|
|
|
10
17
|
justify-content: space-between;
|
|
11
18
|
cursor: pointer;
|
|
12
19
|
overflow: hidden;
|
|
20
|
+
list-style: none;
|
|
13
21
|
}
|
|
14
22
|
|
|
15
23
|
.cbx-stepper-item-contentText {
|
|
@@ -17,10 +25,24 @@
|
|
|
17
25
|
padding: 0.5rem 0.75rem 0.5rem 0.75rem;
|
|
18
26
|
display: flex;
|
|
19
27
|
align-items: center;
|
|
20
|
-
transition: .3s;
|
|
21
|
-
width: calc(
|
|
28
|
+
transition: 0.3s;
|
|
29
|
+
width: calc(100% - 2rem);
|
|
22
30
|
max-height: 2.5rem;
|
|
23
31
|
overflow: visible;
|
|
32
|
+
border: none;
|
|
33
|
+
background: transparent;
|
|
34
|
+
font: inherit;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
position: relative;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.cbx-stepper-item-contentText:disabled {
|
|
40
|
+
cursor: inherit;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.cbx-stepper-item-contentText:focus-visible {
|
|
44
|
+
outline: 2px solid var(--accent);
|
|
45
|
+
outline-offset: 2px;
|
|
24
46
|
}
|
|
25
47
|
|
|
26
48
|
.cbx-stepper-item-contentText:last-child {
|
|
@@ -37,7 +59,8 @@
|
|
|
37
59
|
max-height: 2.5rem;
|
|
38
60
|
}
|
|
39
61
|
|
|
40
|
-
.cbx-stepper-item-contentText-hover:hover,
|
|
62
|
+
.cbx-stepper-item-contentText-hover:hover,
|
|
63
|
+
.cbx-stepper-item-active {
|
|
41
64
|
background: var(--gray1);
|
|
42
65
|
border-radius: 0.25rem;
|
|
43
66
|
}
|
|
@@ -48,36 +71,49 @@
|
|
|
48
71
|
|
|
49
72
|
.cbx-stepper-item-contentText i,
|
|
50
73
|
.cbx-stepper-item-contentText p {
|
|
51
|
-
transition: .3s
|
|
74
|
+
transition: 0.3s;
|
|
52
75
|
}
|
|
53
76
|
|
|
54
77
|
.cbx-stepper-item-contentText-hover:hover i,
|
|
55
78
|
.cbx-stepper-item-contentText-hover:hover p {
|
|
56
|
-
color: var(--primary)
|
|
79
|
+
color: var(--primary);
|
|
57
80
|
}
|
|
58
81
|
|
|
59
82
|
.cbx-stepper-item-text-icon {
|
|
60
|
-
font-size: 1.5rem
|
|
83
|
+
font-size: 1.5rem;
|
|
61
84
|
}
|
|
62
85
|
|
|
63
86
|
.cbx-stepper-item-arrow-icon {
|
|
64
87
|
color: var(--gray3);
|
|
65
|
-
font-size: 1.5rem
|
|
88
|
+
font-size: 1.5rem;
|
|
66
89
|
}
|
|
67
90
|
|
|
68
91
|
.cbx-stepper-item-text {
|
|
69
92
|
margin-left: var(--spacing8);
|
|
70
93
|
overflow: hidden;
|
|
94
|
+
display: inline-block;
|
|
71
95
|
}
|
|
72
96
|
|
|
73
97
|
.cbx-stepper-item-text p {
|
|
74
98
|
overflow: hidden;
|
|
75
|
-
|
|
76
|
-
|
|
99
|
+
white-space: nowrap;
|
|
100
|
+
text-overflow: ellipsis;
|
|
77
101
|
}
|
|
78
102
|
|
|
79
103
|
.cbx-stepper-item-arrow-content {
|
|
80
104
|
width: 100%;
|
|
81
105
|
text-align: center;
|
|
82
106
|
cursor: default;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.cbx-visually-hidden {
|
|
110
|
+
position: absolute;
|
|
111
|
+
width: 1px;
|
|
112
|
+
height: 1px;
|
|
113
|
+
padding: 0;
|
|
114
|
+
margin: -1px;
|
|
115
|
+
overflow: hidden;
|
|
116
|
+
clip: rect(0, 0, 0, 0);
|
|
117
|
+
white-space: nowrap;
|
|
118
|
+
border: 0;
|
|
83
119
|
}
|