@councilbox/councilbox-ui 2.0.54 → 2.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion.js +3 -0
- package/Alert.js +3 -0
- package/Avatar.js +3 -0
- package/AvatarGroup.js +3 -0
- package/Block.js +3 -0
- package/Button.js +3 -0
- package/ButtonBasic.js +3 -0
- package/Checkbox.js +3 -0
- package/DatePicker.js +3 -0
- package/DateRangePicker.js +3 -0
- package/DateTimePicker.js +3 -0
- package/DragDrop.js +3 -0
- package/DrawerPanel.js +3 -0
- package/DropDown.js +3 -0
- package/EnhancedTable.js +3 -0
- package/FabButton.js +3 -0
- package/Grid.js +3 -0
- package/Header.js +3 -0
- package/IconButton.js +3 -0
- package/IconButtonSquare.js +3 -0
- package/IconFont.js +3 -0
- package/InputAutocomplete.js +3 -0
- package/InputPassword.js +3 -0
- package/InputText.js +3 -0
- package/InputTextArea.js +3 -0
- package/LoadingSection.js +3 -0
- package/MenuItem.js +3 -0
- package/MenuLateralLeft.js +3 -0
- package/MenuLateralRight.js +3 -0
- package/Modal.js +3 -0
- package/Radio.js +3 -0
- package/RichTextInput.js +3 -0
- package/Scrollbar.js +3 -0
- package/ScrollbarNew.js +3 -0
- package/SelectInput.js +3 -0
- package/Slider.js +3 -0
- package/Spacing.js +3 -0
- package/Stars.js +3 -0
- package/Stepper.js +3 -0
- package/Table.js +3 -0
- package/TableBody.js +3 -0
- package/TableCell.js +3 -0
- package/TableContainer.js +3 -0
- package/TableHead.js +3 -0
- package/TableRow.js +3 -0
- package/TableSortLabel.js +3 -0
- package/Tabs.js +3 -0
- package/Tag.js +3 -0
- package/TextInput.js +3 -0
- package/ThemeProvider.js +3 -0
- package/TimePicker.js +3 -0
- package/Timeline.js +3 -0
- package/ToastProvider.js +3 -0
- package/Toggle.js +3 -0
- package/Tooltip.js +3 -0
- package/Typography.js +3 -0
- package/dist/HOCs/useDynamicStyles.js +25 -24
- package/dist/build-index.js +70 -0
- package/dist/components/1.Introduction.stories.mdx +4 -1
- package/dist/components/2.Changelog.stories.mdx +15 -3
- package/dist/components/DatePicker/Calendar.js +243 -0
- package/dist/components/DatePicker/DatePicker.css +197 -0
- package/dist/components/DatePicker/DatePicker.js +384 -0
- package/dist/components/DatePicker/DatePicker.stories.js +180 -0
- package/dist/components/DatePicker/dateUtils.js +478 -0
- package/dist/components/DateRangePicker/DateRangePicker.css +41 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +435 -0
- package/dist/components/DateRangePicker/DateRangePicker.stories.js +147 -0
- package/dist/components/DateRangePicker/RangeCalendar.js +188 -0
- package/dist/components/DateTimePicker/DateTimePicker.css +4 -0
- package/dist/components/DateTimePicker/DateTimePicker.js +481 -0
- package/dist/components/DateTimePicker/DateTimePicker.stories.js +144 -0
- package/dist/components/DateTimePicker/TimeColumns.css +46 -0
- package/dist/components/DateTimePicker/TimeColumns.js +175 -0
- package/dist/components/DragDrop/DragDrop.js +4 -1
- package/dist/components/DropDown/DesignDropDown.stories.js +8 -0
- package/dist/components/DropDown/DropDown.js +14 -4
- package/dist/components/Header/Header.js +32 -10
- package/dist/components/IconButton/IconButton.js +3 -2
- package/dist/components/IconButtonSquare/IconButtonSquare.js +3 -3
- package/dist/components/InputAutocomplete/InputAutocomplete.js +2 -2
- package/dist/components/InputText/InputText.css +10 -5
- package/dist/components/InputText/InputText.js +4 -4
- package/dist/components/MenuItem/MenuItem.js +65 -61
- package/dist/components/MenuLateralRight/MenuLateralRight.js +18 -2
- package/dist/components/Modal/Modal.js +3 -1
- package/dist/components/RichTextInput/DesignRichTextInput.stories.js +119 -0
- package/dist/components/RichTextInput/RichTextInput.css +309 -0
- package/dist/components/RichTextInput/RichTextInput.js +851 -0
- package/dist/components/RichTextInput/RichTextInput.stories.js +33 -0
- package/dist/components/Ripple/DesignRipple.js +17 -0
- package/dist/components/ScrollbarNew/DesignScrollbarNew.js +24 -0
- package/dist/components/ScrollbarNew/ScrollbarNew.css +79 -0
- package/dist/components/ScrollbarNew/ScrollbarNew.js +426 -0
- package/dist/components/ScrollbarNew/ScrollbarNew.stories.js +37 -0
- package/dist/components/SelectInput/SelectInput.js +85 -78
- package/dist/components/Tabs/DesignTabs.js +1 -1
- package/dist/components/Tabs/Tabs.js +0 -1
- package/dist/components/TimePicker/TimePicker.css +3 -0
- package/dist/components/TimePicker/TimePicker.js +359 -0
- package/dist/components/TimePicker/TimePicker.stories.js +132 -0
- package/dist/components/Toast/DesignToast.stories.js +174 -0
- package/dist/components/Toast/Toast.css +154 -0
- package/dist/components/Toast/Toast.js +165 -0
- package/dist/components/Toast/Toast.stories.js +33 -0
- package/dist/components/Toast/ToastProvider.js +33 -0
- package/dist/components/Toast/ToastRoot.js +89 -0
- package/dist/components/Toast/toastStore.js +127 -0
- package/dist/components/Toast/useToast.js +42 -0
- package/dist/components/Toggle/Toggle.js +20 -14
- package/dist/components/Tooltip/Tooltip.js +7 -2
- package/dist/styles/styleFont.css +1 -1
- package/dist/styles/zIndexConsts.css +2 -0
- package/package.json +63 -3
- package/toast.js +7 -0
- package/useCouncilboxTheme.js +7 -0
- package/useToast.js +7 -0
- package/dist/components/Accordion/AccordionOld.css +0 -16
- package/dist/components/Accordion/AccordionOld.js +0 -91
- package/dist/components/Avatar/AvatarOld.js +0 -124
- package/dist/components/ButtonBasic/ButtonBasicOld.css +0 -41
- package/dist/components/ButtonBasic/ButtonBasicOld.js +0 -211
- package/dist/components/Checkbox/CheckboxOld.css +0 -31
- package/dist/components/Checkbox/CheckboxOld.js +0 -96
- package/dist/components/DrawerPanel/DrawerPanelOld.css +0 -56
- package/dist/components/DrawerPanel/DrawerPanelOld.js +0 -211
- package/dist/components/DropDown/DropDownOld.css +0 -3
- package/dist/components/DropDown/DropDownOld.js +0 -154
- package/dist/components/Grid/GridItemOld.js +0 -38
- package/dist/components/Grid/GridOld.css +0 -0
- package/dist/components/Grid/GridOld.js +0 -46
- package/dist/components/IconButton/IconButtonOld.css +0 -0
- package/dist/components/IconButton/IconButtonOld.js +0 -122
- package/dist/components/IconButtonSquare/IconButtonSquareOld.css +0 -43
- package/dist/components/IconButtonSquare/IconButtonSquareOld.js +0 -115
- package/dist/components/InputAutocomplete/InputAutocompleteOld.css +0 -5
- package/dist/components/InputAutocomplete/InputAutocompleteOld.js +0 -159
- package/dist/components/InputText/InputTextOld.css +0 -10
- package/dist/components/InputText/InputTextOld.js +0 -314
- package/dist/components/MenuItem/MenuItemOld.js +0 -123
- package/dist/components/Modal/ModalOld.css +0 -3
- package/dist/components/Modal/ModalOld.js +0 -213
- package/dist/components/RadioButton/RadioOld.css +0 -31
- package/dist/components/RadioButton/RadioOld.js +0 -126
- package/dist/components/SelectInput/SelectInputOld.css +0 -17
- package/dist/components/SelectInput/SelectInputOld.js +0 -296
- package/dist/components/Table/TableOld.css +0 -79
- package/dist/components/Table/TableOld.js +0 -133
- package/dist/components/Tabs/TabsOld.js +0 -78
- package/dist/components/Typography/TypographyOld.js +0 -119
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _toastStore = require("./toastStore");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
/**
|
|
12
|
+
* Optional. `useToast()`/`toast()` work anywhere without this - see toastStore.js.
|
|
13
|
+
* Mount it only if you want to set a non-default `maxVisible` (toasts stacked per
|
|
14
|
+
* corner before the oldest gets dropped); otherwise there's no need to render it at all.
|
|
15
|
+
*/
|
|
16
|
+
var ToastProvider = function ToastProvider(_ref) {
|
|
17
|
+
var children = _ref.children,
|
|
18
|
+
maxVisible = _ref.maxVisible;
|
|
19
|
+
_react["default"].useEffect(function () {
|
|
20
|
+
if (maxVisible !== undefined) {
|
|
21
|
+
(0, _toastStore.setMaxVisible)(maxVisible);
|
|
22
|
+
}
|
|
23
|
+
}, [maxVisible]);
|
|
24
|
+
return children;
|
|
25
|
+
};
|
|
26
|
+
ToastProvider.propTypes = {
|
|
27
|
+
maxVisible: _propTypes["default"].number
|
|
28
|
+
};
|
|
29
|
+
ToastProvider.defaultProps = {
|
|
30
|
+
maxVisible: undefined
|
|
31
|
+
};
|
|
32
|
+
var _default = ToastProvider;
|
|
33
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _Toast = _interopRequireDefault(require("./Toast"));
|
|
10
|
+
require("../../styles/main.css");
|
|
11
|
+
require("./Toast.css");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
13
|
+
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); }
|
|
14
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
15
|
+
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."); }
|
|
16
|
+
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; } }
|
|
17
|
+
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; }
|
|
18
|
+
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; } }
|
|
19
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
20
|
+
var cornerKey = function cornerKey(vertical, horizontal) {
|
|
21
|
+
return "".concat(vertical, "-").concat(horizontal);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Internal - mounted once by toastStore.ensureMounted() into its own detached root.
|
|
26
|
+
* Not part of the public API. Takes everything as props (instead of importing toastStore
|
|
27
|
+
* itself) so this file has no dependency back on toastStore.js - toastStore.js importing
|
|
28
|
+
* this file would otherwise be a circular import, which the bundler resolves incorrectly
|
|
29
|
+
* (ToastRoot comes back as undefined the first time it's needed).
|
|
30
|
+
*/
|
|
31
|
+
var ToastRoot = function ToastRoot(_ref) {
|
|
32
|
+
var subscribe = _ref.subscribe,
|
|
33
|
+
getSnapshot = _ref.getSnapshot,
|
|
34
|
+
onCloseToast = _ref.onCloseToast;
|
|
35
|
+
var _React$useState = _react["default"].useState(getSnapshot()),
|
|
36
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
37
|
+
toasts = _React$useState2[0],
|
|
38
|
+
setToasts = _React$useState2[1];
|
|
39
|
+
_react["default"].useEffect(function () {
|
|
40
|
+
// The very first toast is pushed (and notify()'d) synchronously as part of the same
|
|
41
|
+
// toast() call that mounts this component, which happens *before* this effect has
|
|
42
|
+
// had a chance to run and subscribe - so that first notification would otherwise be
|
|
43
|
+
// missed forever. Re-sync to the latest snapshot right here, before subscribing, to
|
|
44
|
+
// close that race window.
|
|
45
|
+
setToasts(getSnapshot());
|
|
46
|
+
return subscribe(setToasts);
|
|
47
|
+
}, [subscribe, getSnapshot]);
|
|
48
|
+
var grouped = _react["default"].useMemo(function () {
|
|
49
|
+
var groups = {};
|
|
50
|
+
toasts.forEach(function (item) {
|
|
51
|
+
var key = cornerKey(item.vertical, item.horizontal);
|
|
52
|
+
if (!groups[key]) groups[key] = [];
|
|
53
|
+
groups[key].push(item);
|
|
54
|
+
});
|
|
55
|
+
return groups;
|
|
56
|
+
}, [toasts]);
|
|
57
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, Object.entries(grouped).map(function (_ref2) {
|
|
58
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
59
|
+
key = _ref3[0],
|
|
60
|
+
group = _ref3[1];
|
|
61
|
+
var _key$split = key.split('-'),
|
|
62
|
+
_key$split2 = _slicedToArray(_key$split, 2),
|
|
63
|
+
vertical = _key$split2[0],
|
|
64
|
+
horizontal = _key$split2[1];
|
|
65
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
66
|
+
key: key,
|
|
67
|
+
className: "cbx-toast-stack cbx-toast-stack-".concat(vertical, " cbx-toast-stack-").concat(horizontal)
|
|
68
|
+
}, group.map(function (item) {
|
|
69
|
+
return (
|
|
70
|
+
/*#__PURE__*/
|
|
71
|
+
// onCloseToast is the stable store function (not a fresh arrow per render),
|
|
72
|
+
// so Toast's own autoClose timer - which depends on it - never gets reset
|
|
73
|
+
// just because a sibling toast changed.
|
|
74
|
+
_react["default"].createElement(_Toast["default"], _extends({
|
|
75
|
+
key: item.id
|
|
76
|
+
}, item, {
|
|
77
|
+
onClose: onCloseToast
|
|
78
|
+
}))
|
|
79
|
+
);
|
|
80
|
+
}));
|
|
81
|
+
}));
|
|
82
|
+
};
|
|
83
|
+
ToastRoot.propTypes = {
|
|
84
|
+
subscribe: _propTypes["default"].func.isRequired,
|
|
85
|
+
getSnapshot: _propTypes["default"].func.isRequired,
|
|
86
|
+
onCloseToast: _propTypes["default"].func.isRequired
|
|
87
|
+
};
|
|
88
|
+
var _default = ToastRoot;
|
|
89
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toast = exports.subscribeToasts = exports.setMaxVisible = exports.getToastsSnapshot = exports.closeToast = exports.closeAllToasts = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
9
|
+
var _ToastRoot = _interopRequireDefault(require("./ToastRoot"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
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); }
|
|
12
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
13
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
|
+
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; } }
|
|
15
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
16
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
17
|
+
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; }
|
|
18
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
22
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
|
+
/**
|
|
24
|
+
* Plain-JS singleton store (no React context) so `toast()` works from anywhere -
|
|
25
|
+
* any component, any file, even outside React (a utility function, an Apollo error
|
|
26
|
+
* link) - without the host app having to mount a provider anywhere. The first call
|
|
27
|
+
* lazily mounts a self-contained React root into its own <div> on <body>, completely
|
|
28
|
+
* independent of the caller's app tree. Known trade-off: content passed as `message`/
|
|
29
|
+
* `title` therefore can't read React Context from the host app (CSS custom properties
|
|
30
|
+
* still work fine, since those flow through the DOM/CSSOM, not the React tree).
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
var DEFAULT_TOAST = {
|
|
34
|
+
severity: 'success',
|
|
35
|
+
autoClose: 5000,
|
|
36
|
+
vertical: 'top',
|
|
37
|
+
horizontal: 'right'
|
|
38
|
+
};
|
|
39
|
+
var DEFAULT_MAX_VISIBLE = 5;
|
|
40
|
+
var toasts = [];
|
|
41
|
+
var maxVisible = DEFAULT_MAX_VISIBLE;
|
|
42
|
+
var listeners = new Set();
|
|
43
|
+
var idCounter = 0;
|
|
44
|
+
var nextId = function nextId() {
|
|
45
|
+
idCounter += 1;
|
|
46
|
+
return "cbx-toast-".concat(Date.now(), "-").concat(idCounter);
|
|
47
|
+
};
|
|
48
|
+
var cornerKey = function cornerKey(vertical, horizontal) {
|
|
49
|
+
return "".concat(vertical, "-").concat(horizontal);
|
|
50
|
+
};
|
|
51
|
+
var notify = function notify() {
|
|
52
|
+
listeners.forEach(function (listener) {
|
|
53
|
+
return listener(toasts);
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
var subscribeToasts = function subscribeToasts(listener) {
|
|
57
|
+
listeners.add(listener);
|
|
58
|
+
return function () {
|
|
59
|
+
return listeners["delete"](listener);
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
exports.subscribeToasts = subscribeToasts;
|
|
63
|
+
var getToastsSnapshot = function getToastsSnapshot() {
|
|
64
|
+
return toasts;
|
|
65
|
+
};
|
|
66
|
+
exports.getToastsSnapshot = getToastsSnapshot;
|
|
67
|
+
var setMaxVisible = function setMaxVisible(value) {
|
|
68
|
+
if (typeof value === 'number' && value > 0) {
|
|
69
|
+
maxVisible = value;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
exports.setMaxVisible = setMaxVisible;
|
|
73
|
+
var closeToast = function closeToast(id) {
|
|
74
|
+
toasts = toasts.filter(function (item) {
|
|
75
|
+
return item.id !== id;
|
|
76
|
+
});
|
|
77
|
+
notify();
|
|
78
|
+
};
|
|
79
|
+
exports.closeToast = closeToast;
|
|
80
|
+
var mounted = false;
|
|
81
|
+
var ensureMounted = function ensureMounted() {
|
|
82
|
+
if (mounted || typeof document === 'undefined') return;
|
|
83
|
+
mounted = true;
|
|
84
|
+
var node = document.createElement('div');
|
|
85
|
+
node.setAttribute('id', 'cbx-toast-root');
|
|
86
|
+
document.body.appendChild(node);
|
|
87
|
+
var element = /*#__PURE__*/_react["default"].createElement(_ToastRoot["default"], {
|
|
88
|
+
subscribe: subscribeToasts,
|
|
89
|
+
getSnapshot: getToastsSnapshot,
|
|
90
|
+
onCloseToast: closeToast
|
|
91
|
+
});
|
|
92
|
+
if (typeof _reactDom["default"].createRoot === 'function') {
|
|
93
|
+
_reactDom["default"].createRoot(node).render(element);
|
|
94
|
+
} else {
|
|
95
|
+
_reactDom["default"].render(element, node);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var toast = function toast(newToast) {
|
|
99
|
+
ensureMounted();
|
|
100
|
+
var id = nextId();
|
|
101
|
+
var merged = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_TOAST), newToast), {}, {
|
|
102
|
+
id: id
|
|
103
|
+
});
|
|
104
|
+
var key = cornerKey(merged.vertical, merged.horizontal);
|
|
105
|
+
var sameCorner = toasts.filter(function (item) {
|
|
106
|
+
return cornerKey(item.vertical, item.horizontal) === key;
|
|
107
|
+
});
|
|
108
|
+
var overflow = sameCorner.length - maxVisible + 1;
|
|
109
|
+
if (overflow > 0) {
|
|
110
|
+
var toDrop = new Set(sameCorner.slice(0, overflow).map(function (item) {
|
|
111
|
+
return item.id;
|
|
112
|
+
}));
|
|
113
|
+
toasts = [].concat(_toConsumableArray(toasts.filter(function (item) {
|
|
114
|
+
return !toDrop.has(item.id);
|
|
115
|
+
})), [merged]);
|
|
116
|
+
} else {
|
|
117
|
+
toasts = [].concat(_toConsumableArray(toasts), [merged]);
|
|
118
|
+
}
|
|
119
|
+
notify();
|
|
120
|
+
return id;
|
|
121
|
+
};
|
|
122
|
+
exports.toast = toast;
|
|
123
|
+
var closeAllToasts = function closeAllToasts() {
|
|
124
|
+
toasts = [];
|
|
125
|
+
notify();
|
|
126
|
+
};
|
|
127
|
+
exports.closeAllToasts = closeAllToasts;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useToast = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _toastStore = require("./toastStore");
|
|
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(); }
|
|
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."); }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) { n[e] = r[e]; } return n; }
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
16
|
+
/**
|
|
17
|
+
* const { toast } = useToast();
|
|
18
|
+
* toast({ message: '...', severity: 'error' });
|
|
19
|
+
*
|
|
20
|
+
* Works anywhere, no provider required - see toastStore.js. Need to call it outside a
|
|
21
|
+
* component (a plain util, an error handler)? Import `toast` directly instead:
|
|
22
|
+
* import { toast } from '@councilbox/councilbox-ui';
|
|
23
|
+
*/
|
|
24
|
+
var useToast = function useToast() {
|
|
25
|
+
var _React$useState = _react["default"].useState((0, _toastStore.getToastsSnapshot)()),
|
|
26
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
27
|
+
toasts = _React$useState2[0],
|
|
28
|
+
setToasts = _React$useState2[1];
|
|
29
|
+
_react["default"].useEffect(function () {
|
|
30
|
+
// Re-sync in case a toast() fired between this component's initial render and this
|
|
31
|
+
// effect actually running (same race as ToastRoot.jsx - see the comment there).
|
|
32
|
+
setToasts((0, _toastStore.getToastsSnapshot)());
|
|
33
|
+
return (0, _toastStore.subscribeToasts)(setToasts);
|
|
34
|
+
}, []);
|
|
35
|
+
return {
|
|
36
|
+
toast: _toastStore.toast,
|
|
37
|
+
closeToast: _toastStore.closeToast,
|
|
38
|
+
closeAll: _toastStore.closeAllToasts,
|
|
39
|
+
toasts: toasts
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
exports.useToast = useToast;
|
|
@@ -106,16 +106,28 @@ var Toggle = function Toggle(_ref) {
|
|
|
106
106
|
};
|
|
107
107
|
var hasVisibleLabel = Boolean(label);
|
|
108
108
|
var resolvedName = ariaLabel && ariaLabel.trim() || (typeof label === 'string' && label.trim() ? label : undefined) || 'toggle';
|
|
109
|
+
var focusInput = function focusInput() {
|
|
110
|
+
var _document$getElementB;
|
|
111
|
+
return (_document$getElementB = document.getElementById(inputId)) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.click();
|
|
112
|
+
};
|
|
113
|
+
var startLabelText = labelPlacement === 'start' && hasVisibleLabel &&
|
|
114
|
+
/*#__PURE__*/
|
|
115
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
116
|
+
_react["default"].createElement("div", {
|
|
117
|
+
className: prefixClass('cbx-switch-textStart'),
|
|
118
|
+
onClick: disabled ? undefined : focusInput
|
|
119
|
+
}, renderLabelText());
|
|
120
|
+
var endLabelText = labelPlacement === 'end' && hasVisibleLabel &&
|
|
121
|
+
/*#__PURE__*/
|
|
122
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
123
|
+
_react["default"].createElement("div", {
|
|
124
|
+
className: prefixClass('cbx-switch-textEnd'),
|
|
125
|
+
onClick: disabled ? undefined : focusInput
|
|
126
|
+
}, renderLabelText());
|
|
109
127
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
110
128
|
className: prefixClass("cbx-switch ".concat(className || '')),
|
|
111
129
|
style: containerStyle
|
|
112
|
-
},
|
|
113
|
-
className: prefixClass('cbx-switch-textStart'),
|
|
114
|
-
onClick: disabled ? undefined : function () {
|
|
115
|
-
var _document$getElementB;
|
|
116
|
-
return (_document$getElementB = document.getElementById(inputId)) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.click();
|
|
117
|
-
}
|
|
118
|
-
}, renderLabelText()), /*#__PURE__*/_react["default"].createElement("label", _extends({
|
|
130
|
+
}, startLabelText, /*#__PURE__*/_react["default"].createElement("label", _extends({
|
|
119
131
|
className: prefixClass('cbx-switch-label'),
|
|
120
132
|
htmlFor: inputId
|
|
121
133
|
}, props), /*#__PURE__*/_react["default"].createElement("input", {
|
|
@@ -131,13 +143,7 @@ var Toggle = function Toggle(_ref) {
|
|
|
131
143
|
"aria-hidden": "true"
|
|
132
144
|
}), /*#__PURE__*/_react["default"].createElement("span", {
|
|
133
145
|
className: "sr-only"
|
|
134
|
-
}, resolvedName)),
|
|
135
|
-
className: prefixClass('cbx-switch-textEnd'),
|
|
136
|
-
onClick: disabled ? undefined : function () {
|
|
137
|
-
var _document$getElementB2;
|
|
138
|
-
return (_document$getElementB2 = document.getElementById(inputId)) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.click();
|
|
139
|
-
}
|
|
140
|
-
}, renderLabelText()));
|
|
146
|
+
}, resolvedName)), endLabelText);
|
|
141
147
|
};
|
|
142
148
|
Toggle.displayName = "Toggle";
|
|
143
149
|
Toggle.propTypes = {
|
|
@@ -124,7 +124,9 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
124
124
|
var containerTooltipRef = _react["default"].useRef(null);
|
|
125
125
|
var tooltipRef = _react["default"].useRef(null);
|
|
126
126
|
var timeoutRef = _react["default"].useRef(null);
|
|
127
|
-
var childElement = /*#__PURE__*/_react["default"].isValidElement(children) && !Array.isArray(children) ? _react["default"].Children.only(children)
|
|
127
|
+
var childElement = /*#__PURE__*/_react["default"].isValidElement(children) && !Array.isArray(children) ? _react["default"].Children.only(children)
|
|
128
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
129
|
+
: /*#__PURE__*/_react["default"].createElement("span", {
|
|
128
130
|
tabIndex: 0
|
|
129
131
|
}, children);
|
|
130
132
|
var generatedId = (0, _useFallbackId["default"])('cbx-tooltip');
|
|
@@ -249,7 +251,10 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
249
251
|
'aria-describedby': title && shouldRender ? [existingDescribedBy, tooltipId].filter(Boolean).join(' ') : existingDescribedBy
|
|
250
252
|
});
|
|
251
253
|
var getTooltip = function getTooltip() {
|
|
252
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, clonedChild, shouldRender && /*#__PURE__*/(0, _reactDom.createPortal)(
|
|
254
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, clonedChild, shouldRender && /*#__PURE__*/(0, _reactDom.createPortal)(
|
|
255
|
+
/*#__PURE__*/
|
|
256
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
257
|
+
_react["default"].createElement("div", _extends({
|
|
253
258
|
id: tooltipId,
|
|
254
259
|
role: "tooltip",
|
|
255
260
|
"aria-hidden": !isOpen,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
url('../fonts/remixicons-cbx.ttf?ze674e') format('truetype'),
|
|
6
6
|
url('../fonts/remixicons-cbx.woff?ze674e') format('woff'),
|
|
7
7
|
url('../fonts/remixicons-cbx.svg?ze674e#remixicons-cbx') format('svg');
|
|
8
|
-
font-display:
|
|
8
|
+
font-display: block;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
[class^="ri-"],
|
package/package.json
CHANGED
|
@@ -1,10 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@councilbox/councilbox-ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.55",
|
|
4
4
|
"main": "dist/build-index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
|
-
"README.md"
|
|
7
|
+
"README.md",
|
|
8
|
+
"Accordion.js",
|
|
9
|
+
"Alert.js",
|
|
10
|
+
"Avatar.js",
|
|
11
|
+
"AvatarGroup.js",
|
|
12
|
+
"Block.js",
|
|
13
|
+
"Button.js",
|
|
14
|
+
"ButtonBasic.js",
|
|
15
|
+
"Checkbox.js",
|
|
16
|
+
"DatePicker.js",
|
|
17
|
+
"DateRangePicker.js",
|
|
18
|
+
"DateTimePicker.js",
|
|
19
|
+
"DragDrop.js",
|
|
20
|
+
"DrawerPanel.js",
|
|
21
|
+
"DropDown.js",
|
|
22
|
+
"EnhancedTable.js",
|
|
23
|
+
"FabButton.js",
|
|
24
|
+
"Grid.js",
|
|
25
|
+
"Header.js",
|
|
26
|
+
"IconButton.js",
|
|
27
|
+
"IconButtonSquare.js",
|
|
28
|
+
"IconFont.js",
|
|
29
|
+
"InputAutocomplete.js",
|
|
30
|
+
"InputPassword.js",
|
|
31
|
+
"InputText.js",
|
|
32
|
+
"InputTextArea.js",
|
|
33
|
+
"LoadingSection.js",
|
|
34
|
+
"MenuItem.js",
|
|
35
|
+
"MenuLateralLeft.js",
|
|
36
|
+
"MenuLateralRight.js",
|
|
37
|
+
"Modal.js",
|
|
38
|
+
"Radio.js",
|
|
39
|
+
"RichTextInput.js",
|
|
40
|
+
"Scrollbar.js",
|
|
41
|
+
"ScrollbarNew.js",
|
|
42
|
+
"SelectInput.js",
|
|
43
|
+
"Slider.js",
|
|
44
|
+
"Spacing.js",
|
|
45
|
+
"Stars.js",
|
|
46
|
+
"Stepper.js",
|
|
47
|
+
"Table.js",
|
|
48
|
+
"TableBody.js",
|
|
49
|
+
"TableCell.js",
|
|
50
|
+
"TableContainer.js",
|
|
51
|
+
"TableHead.js",
|
|
52
|
+
"TableRow.js",
|
|
53
|
+
"TableSortLabel.js",
|
|
54
|
+
"Tabs.js",
|
|
55
|
+
"Tag.js",
|
|
56
|
+
"TextInput.js",
|
|
57
|
+
"ThemeProvider.js",
|
|
58
|
+
"TimePicker.js",
|
|
59
|
+
"Timeline.js",
|
|
60
|
+
"ToastProvider.js",
|
|
61
|
+
"Toggle.js",
|
|
62
|
+
"Tooltip.js",
|
|
63
|
+
"Typography.js",
|
|
64
|
+
"toast.js",
|
|
65
|
+
"useCouncilboxTheme.js",
|
|
66
|
+
"useToast.js"
|
|
8
67
|
],
|
|
9
68
|
"author": "Aarón Fuentes González <aaronfuentes86@gmail.com>",
|
|
10
69
|
"contributors": [
|
|
@@ -18,6 +77,7 @@
|
|
|
18
77
|
"@mui/icons-material": "^5.4.4",
|
|
19
78
|
"@mui/material": "^5.11.13",
|
|
20
79
|
"cross-env": "^7.0.3",
|
|
80
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
21
81
|
"prop-types": "^15.8.1",
|
|
22
82
|
"raw-loader": "^4.0.2",
|
|
23
83
|
"react-custom-scrollbars-2": "^4.5.0",
|
|
@@ -36,7 +96,7 @@
|
|
|
36
96
|
"build-storybook": "build-storybook -s public",
|
|
37
97
|
"lint": "eslint . --quiet --ext .js --ext .jsx",
|
|
38
98
|
"clean": "rimraf dist",
|
|
39
|
-
"compile": "yarn run clean && cross-env NODE_ENV=production babel src --out-dir dist --copy-files --ignore testing/*,__tests__,spec.js,test.js,stories.js,__snapshots__"
|
|
99
|
+
"compile": "yarn run clean && cross-env NODE_ENV=production babel src --out-dir dist --copy-files --ignore testing/*,__tests__,spec.js,test.js,stories.js,__snapshots__ && node scripts/generate-shims.js"
|
|
40
100
|
},
|
|
41
101
|
"babel": {
|
|
42
102
|
"presets": [
|
package/toast.js
ADDED
package/useToast.js
ADDED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
.cbx-Accordion-block-title {
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
justify-content: space-between;
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.cbx-Accordion-block,
|
|
9
|
-
.cbx-Accordion-block-title {
|
|
10
|
-
overflow: hidden;
|
|
11
|
-
width: 100%
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.cbx-Accordion-container-rigth-title {
|
|
15
|
-
padding: 0 1rem
|
|
16
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _Accordion = _interopRequireDefault(require("@mui/material/Accordion"));
|
|
10
|
-
var _AccordionSummary = _interopRequireDefault(require("@mui/material/AccordionSummary"));
|
|
11
|
-
var _AccordionDetails = _interopRequireDefault(require("@mui/material/AccordionDetails"));
|
|
12
|
-
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
13
|
-
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
14
|
-
require("../../styles/main.css");
|
|
15
|
-
require("./Accordion.css");
|
|
16
|
-
var _excluded = ["id", "className", "title", "contentRightTitle", "contentExpand", "disabled"];
|
|
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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
20
|
-
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."); }
|
|
21
|
-
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; } }
|
|
22
|
-
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; }
|
|
23
|
-
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; } }
|
|
24
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
25
|
-
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; }
|
|
26
|
-
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; }
|
|
27
|
-
var Accordion = function Accordion(_ref) {
|
|
28
|
-
var id = _ref.id,
|
|
29
|
-
className = _ref.className,
|
|
30
|
-
title = _ref.title,
|
|
31
|
-
contentRightTitle = _ref.contentRightTitle,
|
|
32
|
-
contentExpand = _ref.contentExpand,
|
|
33
|
-
disabled = _ref.disabled,
|
|
34
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
35
|
-
var _React$useState = _react["default"].useState(false),
|
|
36
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
37
|
-
open = _React$useState2[0],
|
|
38
|
-
setOpen = _React$useState2[1];
|
|
39
|
-
return /*#__PURE__*/_react["default"].createElement(_Accordion["default"], _extends({
|
|
40
|
-
disabled: disabled,
|
|
41
|
-
id: id,
|
|
42
|
-
className: "cbx-Accordion-block ".concat(className),
|
|
43
|
-
onChange: function onChange() {
|
|
44
|
-
return setOpen(!open);
|
|
45
|
-
}
|
|
46
|
-
}, props), /*#__PURE__*/_react["default"].createElement(_AccordionSummary["default"], {
|
|
47
|
-
expandIcon: /*#__PURE__*/_react["default"].createElement(_ExpandMore["default"], null),
|
|
48
|
-
sx: {
|
|
49
|
-
padding: '0.5rem 1.5rem',
|
|
50
|
-
width: '100%',
|
|
51
|
-
overflow: 'hidden',
|
|
52
|
-
'& .MuiAccordionSummary-content': {
|
|
53
|
-
overflow: 'hidden'
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
57
|
-
className: 'cbx-Accordion-block-title'
|
|
58
|
-
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
59
|
-
component: 'span',
|
|
60
|
-
styles: {
|
|
61
|
-
fontSize: '1.125rem',
|
|
62
|
-
overflow: 'hidden',
|
|
63
|
-
whiteSpace: !open && 'nowrap',
|
|
64
|
-
textOverflow: !open && 'ellipsis',
|
|
65
|
-
paddingRight: '1rem'
|
|
66
|
-
},
|
|
67
|
-
color: 'var(--gray5)',
|
|
68
|
-
fontWeight: '700'
|
|
69
|
-
}, title), /*#__PURE__*/_react["default"].createElement("div", {
|
|
70
|
-
className: 'cbx-Accordion-container-rigth-title'
|
|
71
|
-
}, contentRightTitle))), /*#__PURE__*/_react["default"].createElement(_AccordionDetails["default"], {
|
|
72
|
-
sx: {
|
|
73
|
-
padding: '0.5rem 1.5rem'
|
|
74
|
-
}
|
|
75
|
-
}, contentExpand));
|
|
76
|
-
};
|
|
77
|
-
Accordion.displayName = "Accordion";
|
|
78
|
-
Accordion.propTypes = {
|
|
79
|
-
title: _propTypes["default"].string,
|
|
80
|
-
disabled: _propTypes["default"].bool,
|
|
81
|
-
contentRightTitle: _propTypes["default"].node,
|
|
82
|
-
contentExpand: _propTypes["default"].node
|
|
83
|
-
};
|
|
84
|
-
Accordion.defaultProps = {
|
|
85
|
-
title: '',
|
|
86
|
-
disabled: false,
|
|
87
|
-
contentRightTitle: '',
|
|
88
|
-
contentExpand: ''
|
|
89
|
-
};
|
|
90
|
-
var _default = Accordion;
|
|
91
|
-
exports["default"] = _default;
|