@unbxd-ui/unbxd-react-components 0.2.221 → 0.3.0
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/README.md +17 -1
- package/components/Accordian/Accordian.js +14 -11
- package/components/Accordian/Accordian.stories.js +141 -118
- package/components/Accordian/index.js +1 -1
- package/components/Button/Button.js +4 -4
- package/components/Button/Button.stories.js +168 -62
- package/components/Button/DropdownButton.js +5 -6
- package/components/Button/buttonTheme.css +1 -1
- package/components/Button/index.js +2 -3
- package/components/DataLoader/DataLoader.js +6 -7
- package/components/DataLoader/DataLoader.stories.js +244 -58
- package/components/DataLoader/index.js +1 -1
- package/components/Form/Checkbox.js +12 -11
- package/components/Form/DragDropFileUploader.js +6 -7
- package/components/Form/Dropdown.js +14 -12
- package/components/Form/FileUploader.js +3 -4
- package/components/Form/Form.js +6 -7
- package/components/Form/FormElementWrapper.js +1 -1
- package/components/Form/Input.js +24 -15
- package/components/Form/RadioList.js +8 -9
- package/components/Form/RangeSlider.js +12 -13
- package/components/Form/SearchableDropdown.js +563 -0
- package/components/Form/ServerPaginatedDDList.js +53 -44
- package/components/Form/Textarea.js +26 -10
- package/components/Form/Toggle.js +6 -7
- package/components/Form/formCore.css +1 -1
- package/components/Form/formTheme.css +1 -1
- package/components/Form/index.js +8 -1
- package/components/Form/stories/Checkbox.stories.js +139 -40
- package/components/Form/stories/Dropdown.stories.js +323 -92
- package/components/Form/stories/FileUploader.stories.js +178 -19
- package/components/Form/stories/Input.stories.js +115 -0
- package/components/Form/stories/RangeSlider.stories.js +162 -64
- package/components/Form/stories/SearchableDropdown.stories.js +189 -0
- package/components/Form/stories/ServerPaginatedDropdown.stories.js +365 -0
- package/components/Form/stories/Textarea.stories.js +113 -34
- package/components/Form/stories/Toggle.stories.js +193 -14
- package/components/Form/variables.css +0 -0
- package/components/InlineModal/InlineModal.js +119 -21
- package/components/InlineModal/InlineModal.stories.js +239 -45
- package/components/InlineModal/index.js +1 -2
- package/components/InlineModal/inlineModalCore.css +1 -1
- package/components/List/List.js +11 -8
- package/components/List/List.stories.js +238 -0
- package/components/List/index.js +1 -1
- package/components/Modal/Modal.js +67 -20
- package/components/Modal/Modal.stories.js +257 -38
- package/components/Modal/index.js +1 -1
- package/components/Modal/modalCore.css +1 -1
- package/components/NoDataPlaceholder/NoDataPlaceholder.js +41 -0
- package/components/NoDataPlaceholder/NoDataPlaceholder.stories.js +42 -0
- package/components/NoDataPlaceholder/index.js +9 -0
- package/components/NoDataPlaceholder/noDataPlaceholderCore.css +1 -0
- package/components/NotificationComponent/NotificationComponent.js +20 -10
- package/components/NotificationComponent/NotificationComponent.stories.js +171 -19
- package/components/NotificationComponent/index.js +1 -1
- package/components/NotificationComponent/notificationTheme.css +1 -1
- package/components/PageLoader/PageLoader.js +84 -0
- package/components/PageLoader/PageLoader.stories.js +276 -0
- package/components/PageLoader/index.js +9 -0
- package/components/PageLoader/pageLoaderCore.css +1 -0
- package/components/ProgressBar/ProgressBar.css +0 -0
- package/components/ProgressBar/ProgressBar.js +1 -1
- package/components/ProgressBar/ProgressBar.stories.js +203 -10
- package/components/ProgressBar/index.js +1 -1
- package/components/ProgressBar/progressBarCore.css +1 -1
- package/components/Table/BaseTable.js +86 -342
- package/components/Table/PaginationComponent.js +4 -4
- package/components/Table/Table.js +7 -326
- package/components/Table/Table.stories.js +2117 -158
- package/components/Table/TableChild.js +383 -0
- package/components/Table/TableConstants.js +15 -0
- package/components/Table/hooks/usePrevious.js +14 -0
- package/components/Table/index.js +14 -1
- package/components/Table/tableCore.css +1 -1
- package/components/TableOld/BaseTable.js +373 -0
- package/components/TableOld/PaginationComponent.js +86 -0
- package/components/TableOld/TableOld.js +367 -0
- package/components/TableOld/index.js +15 -0
- package/components/TabsComponent/TabsComponent.js +6 -7
- package/components/TabsComponent/TabsComponent.stories.js +291 -53
- package/components/TabsComponent/index.js +1 -1
- package/components/ToastNotification/ToastNotificationWrapper.js +212 -0
- package/components/ToastNotification/ToastNotificationWrapper.stories.js +554 -0
- package/components/ToastNotification/index.js +40 -0
- package/components/ToastNotification/toastNotificationCore.css +1 -0
- package/components/Tooltip/Tooltip.js +231 -56
- package/components/Tooltip/Tooltip.stories.js +380 -15
- package/components/Tooltip/index.js +1 -1
- package/components/Tooltip/tooltipCore.css +1 -1
- package/components/Tooltip/tooltipTheme.css +1 -1
- package/components/common/NoDataDropdown.js +50 -0
- package/components/common/common.css +1 -0
- package/components/core.css +2 -3
- package/components/core.scss +20 -1
- package/components/index.js +66 -3
- package/components/theme.css +2 -3
- package/core/Validators.js +1 -1
- package/core/customHooks.js +4 -4
- package/core/dataLoader.js +58 -17
- package/core/index.js +1 -1
- package/core/utils.js +15 -4
- package/index.js +54 -0
- package/package.json +41 -28
- package/components/Button/DropdownButton.stories.js +0 -49
- package/components/Form/stories/DragDropFileUploader.stories.js +0 -25
- package/components/Form/stories/FormDefault.stories.js +0 -115
- package/components/Form/stories/RadioList.stories.js +0 -53
- package/components/Form/stories/TextInput.stories.js +0 -76
- package/components/Form/stories/form.stories.js +0 -233
- package/components/List/list.stories.js +0 -35
- package/core/dataLoader.stories.js +0 -119
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ use npm version : '9.7.2'
|
|
|
8
8
|
```
|
|
9
9
|
use node version: 'v14.20.1'
|
|
10
10
|
```
|
|
11
|
-
npm install unbxd-react-components
|
|
11
|
+
npm install @unbxd-ui/unbxd-react-components
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
Import the required components along with the CSS.
|
|
@@ -59,6 +59,22 @@ You can view the available components and their props using the storybook at thi
|
|
|
59
59
|
|
|
60
60
|
https://unbxd.github.io/unbxd-react-components/
|
|
61
61
|
|
|
62
|
+
|
|
63
|
+
## To Contribute & Run Storybook Locally
|
|
64
|
+
|
|
65
|
+
**1. Use node version: `v14.20.1`.**
|
|
66
|
+
|
|
67
|
+
**2. After making changes to the required components and their scss, Add examples in stories.js file of the respective component.**
|
|
68
|
+
|
|
69
|
+
**3. `npm run build` && `npm run build-css`**
|
|
70
|
+
|
|
71
|
+
**4. Then use node version: `v18.17.1` (Required for storybook)**
|
|
72
|
+
|
|
73
|
+
**5. `npm run storybook`**
|
|
74
|
+
|
|
75
|
+
After this the storybook will be up on 6007 port.
|
|
76
|
+
|
|
77
|
+
|
|
62
78
|
## FAQs
|
|
63
79
|
|
|
64
80
|
1) I am getting "multiple instances of React" error. What to do?
|
|
@@ -8,19 +8,18 @@ exports["default"] = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _List = _interopRequireDefault(require("../List"));
|
|
11
|
-
function _interopRequireDefault(
|
|
12
|
-
function
|
|
13
|
-
function
|
|
14
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
13
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
15
14
|
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
15
|
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; } }
|
|
17
|
-
function _arrayWithHoles(
|
|
18
|
-
function _toConsumableArray(
|
|
16
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
17
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
19
18
|
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."); }
|
|
20
|
-
function _unsupportedIterableToArray(
|
|
21
|
-
function _iterableToArray(
|
|
22
|
-
function _arrayWithoutHoles(
|
|
23
|
-
function _arrayLikeToArray(
|
|
19
|
+
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; } }
|
|
20
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
21
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
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; }
|
|
24
23
|
var ALL = "ALL";
|
|
25
24
|
var getDefaultOpenedItems = function getDefaultOpenedItems() {
|
|
26
25
|
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
@@ -48,11 +47,15 @@ var AccordianItem = function AccordianItem(props) {
|
|
|
48
47
|
return item === id;
|
|
49
48
|
}) ? true : false;
|
|
50
49
|
var onItemClick = function onItemClick() {
|
|
51
|
-
var newList = [
|
|
50
|
+
var newList = [];
|
|
52
51
|
if (!allowOneOpen) {
|
|
53
52
|
newList = isOpen ? openedItems.filter(function (item) {
|
|
54
53
|
return item !== id;
|
|
55
54
|
}) : [].concat(_toConsumableArray(openedItems), [id]);
|
|
55
|
+
} else {
|
|
56
|
+
if (!openedItems.includes(id)) {
|
|
57
|
+
newList = [id];
|
|
58
|
+
}
|
|
56
59
|
}
|
|
57
60
|
setOpenedItems(newList);
|
|
58
61
|
};
|
|
@@ -1,133 +1,156 @@
|
|
|
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); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports["default"] = exports.
|
|
8
|
-
var _react =
|
|
6
|
+
exports["default"] = exports.WithDefaultOpen = exports.SingleSectionOpen = exports.Default = exports.CustomStyled = exports.AllOpenByDefault = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
8
|
var _Accordian = _interopRequireDefault(require("./Accordian"));
|
|
10
|
-
function _interopRequireDefault(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
-
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."); }
|
|
15
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
-
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; }
|
|
17
|
-
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; } }
|
|
18
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
+
// Import required styles
|
|
11
|
+
// import './accordianTheme.scss';
|
|
19
12
|
var _default = exports["default"] = {
|
|
20
|
-
title: 'Accordian',
|
|
21
|
-
component: _Accordian["default"]
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var onSetRandom = function onSetRandom() {
|
|
29
|
-
setRandomNumber(Math.round(Math.random() * 10));
|
|
30
|
-
};
|
|
31
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
32
|
-
style: {
|
|
33
|
-
padding: '20px'
|
|
13
|
+
title: 'Components/Accordian',
|
|
14
|
+
component: _Accordian["default"],
|
|
15
|
+
parameters: {
|
|
16
|
+
layout: 'centered',
|
|
17
|
+
docs: {
|
|
18
|
+
story: {
|
|
19
|
+
inline: true
|
|
20
|
+
}
|
|
34
21
|
}
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
22
|
+
},
|
|
23
|
+
tags: ['autodocs'],
|
|
24
|
+
argTypes: {
|
|
25
|
+
defaultOpen: {
|
|
26
|
+
control: 'select',
|
|
27
|
+
options: ['', 'ALL', 'section1', 'section2', 'section3'],
|
|
28
|
+
description: 'Controls which accordion items are open by default'
|
|
29
|
+
},
|
|
30
|
+
allowOneOpen: {
|
|
31
|
+
control: 'boolean',
|
|
32
|
+
description: 'If true, only one accordion item can be open at a time'
|
|
33
|
+
},
|
|
34
|
+
items: {
|
|
35
|
+
control: 'object',
|
|
36
|
+
description: 'Array of accordion items with id, titleComponent, and bodyComponent'
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}; // Sample items for the accordion
|
|
40
|
+
var sampleItems = [{
|
|
41
|
+
id: 'section1',
|
|
42
|
+
titleComponent: /*#__PURE__*/_react["default"].createElement("div", {
|
|
43
|
+
className: "RCB-accordian-title-content"
|
|
44
|
+
}, "Section 1"),
|
|
45
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement("div", {
|
|
46
|
+
className: "RCB-accordian-body-content"
|
|
47
|
+
}, "This is the content for section 1. It can contain any React elements.")
|
|
48
|
+
}, {
|
|
49
|
+
id: 'section2',
|
|
50
|
+
titleComponent: /*#__PURE__*/_react["default"].createElement("div", {
|
|
51
|
+
className: "RCB-accordian-title-content"
|
|
52
|
+
}, "Section 2"),
|
|
53
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement("div", {
|
|
54
|
+
className: "RCB-accordian-body-content"
|
|
55
|
+
}, "This is the content for section 2. It can be text, components, or other elements.")
|
|
56
|
+
}, {
|
|
57
|
+
id: 'section3',
|
|
58
|
+
titleComponent: /*#__PURE__*/_react["default"].createElement("div", {
|
|
59
|
+
className: "RCB-accordian-title-content"
|
|
60
|
+
}, "Section 3"),
|
|
61
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement("div", {
|
|
62
|
+
className: "RCB-accordian-body-content"
|
|
63
|
+
}, "This is the content for section 3. You can put anything here!")
|
|
64
|
+
}];
|
|
65
|
+
|
|
66
|
+
// Template for stories
|
|
43
67
|
var Template = function Template(args) {
|
|
44
68
|
return /*#__PURE__*/_react["default"].createElement(_Accordian["default"], args);
|
|
45
69
|
};
|
|
46
|
-
|
|
70
|
+
|
|
71
|
+
// Default accordion
|
|
72
|
+
var Default = exports.Default = Template.bind({});
|
|
47
73
|
Default.args = {
|
|
48
|
-
items:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
id: '41'
|
|
52
|
-
}),
|
|
53
|
-
bodyComponent: /*#__PURE__*/_react["default"].createElement(AccordianBody, null)
|
|
54
|
-
}, {
|
|
55
|
-
id: "42",
|
|
56
|
-
titleComponent: /*#__PURE__*/_react["default"].createElement(AccordianTitle, {
|
|
57
|
-
id: '42'
|
|
58
|
-
}),
|
|
59
|
-
bodyComponent: /*#__PURE__*/_react["default"].createElement(AccordianBody, null)
|
|
60
|
-
}, {
|
|
61
|
-
id: "43",
|
|
62
|
-
titleComponent: /*#__PURE__*/_react["default"].createElement(AccordianTitle, {
|
|
63
|
-
id: '43'
|
|
64
|
-
}),
|
|
65
|
-
bodyComponent: /*#__PURE__*/_react["default"].createElement(AccordianBody, null)
|
|
66
|
-
}, {
|
|
67
|
-
id: "44",
|
|
68
|
-
titleComponent: /*#__PURE__*/_react["default"].createElement(AccordianTitle, {
|
|
69
|
-
id: '44'
|
|
70
|
-
}),
|
|
71
|
-
bodyComponent: /*#__PURE__*/_react["default"].createElement(AccordianBody, null)
|
|
72
|
-
}],
|
|
73
|
-
defaultOpen: ""
|
|
74
|
+
items: sampleItems,
|
|
75
|
+
allowOneOpen: false,
|
|
76
|
+
defaultOpen: ''
|
|
74
77
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
id: "43",
|
|
91
|
-
titleComponent: /*#__PURE__*/_react["default"].createElement(AccordianTitle, {
|
|
92
|
-
id: '43'
|
|
93
|
-
}),
|
|
94
|
-
bodyComponent: /*#__PURE__*/_react["default"].createElement(AccordianBody, null)
|
|
95
|
-
}, {
|
|
96
|
-
id: "44",
|
|
97
|
-
titleComponent: /*#__PURE__*/_react["default"].createElement(AccordianTitle, {
|
|
98
|
-
id: '44'
|
|
99
|
-
}),
|
|
100
|
-
bodyComponent: /*#__PURE__*/_react["default"].createElement(AccordianBody, null)
|
|
101
|
-
}],
|
|
102
|
-
defaultOpen: "42"
|
|
78
|
+
|
|
79
|
+
// One section open by default
|
|
80
|
+
var WithDefaultOpen = exports.WithDefaultOpen = Template.bind({});
|
|
81
|
+
WithDefaultOpen.args = {
|
|
82
|
+
items: sampleItems,
|
|
83
|
+
allowOneOpen: false,
|
|
84
|
+
defaultOpen: 'section1'
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// All sections open by default
|
|
88
|
+
var AllOpenByDefault = exports.AllOpenByDefault = Template.bind({});
|
|
89
|
+
AllOpenByDefault.args = {
|
|
90
|
+
items: sampleItems,
|
|
91
|
+
allowOneOpen: false,
|
|
92
|
+
defaultOpen: 'ALL'
|
|
103
93
|
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
94
|
+
|
|
95
|
+
// Only one section can be open
|
|
96
|
+
var SingleSectionOpen = exports.SingleSectionOpen = Template.bind({});
|
|
97
|
+
SingleSectionOpen.args = {
|
|
98
|
+
items: sampleItems,
|
|
99
|
+
allowOneOpen: true,
|
|
100
|
+
defaultOpen: 'section1'
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// Custom styled sections
|
|
104
|
+
var customStyledItems = [{
|
|
105
|
+
id: 'custom1',
|
|
106
|
+
titleComponent: /*#__PURE__*/_react["default"].createElement("div", {
|
|
107
|
+
className: "RCB-accordian-title-content",
|
|
108
|
+
style: {
|
|
109
|
+
color: 'blue',
|
|
110
|
+
fontWeight: 'bold'
|
|
111
|
+
}
|
|
112
|
+
}, "Custom Section 1", /*#__PURE__*/_react["default"].createElement("span", {
|
|
113
|
+
style: {
|
|
114
|
+
marginLeft: '8px',
|
|
115
|
+
fontSize: '0.8em'
|
|
116
|
+
}
|
|
117
|
+
}, "\u25BC")),
|
|
118
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement("div", {
|
|
119
|
+
className: "RCB-accordian-body-content",
|
|
120
|
+
style: {
|
|
121
|
+
padding: '1rem',
|
|
122
|
+
backgroundColor: '#f0f0f0',
|
|
123
|
+
borderRadius: '4px',
|
|
124
|
+
margin: '0.5rem'
|
|
125
|
+
}
|
|
126
|
+
}, "This section has custom styling applied to both the title and content.")
|
|
127
|
+
}, {
|
|
128
|
+
id: 'custom2',
|
|
129
|
+
titleComponent: /*#__PURE__*/_react["default"].createElement("div", {
|
|
130
|
+
className: "RCB-accordian-title-content",
|
|
131
|
+
style: {
|
|
132
|
+
color: 'green',
|
|
133
|
+
fontWeight: 'bold'
|
|
134
|
+
}
|
|
135
|
+
}, "Custom Section 2", /*#__PURE__*/_react["default"].createElement("span", {
|
|
136
|
+
style: {
|
|
137
|
+
marginLeft: '8px',
|
|
138
|
+
fontSize: '0.8em'
|
|
139
|
+
}
|
|
140
|
+
}, "\u25BC")),
|
|
141
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement("div", {
|
|
142
|
+
className: "RCB-accordian-body-content",
|
|
143
|
+
style: {
|
|
144
|
+
padding: '1rem',
|
|
145
|
+
backgroundColor: '#e8f5e9',
|
|
146
|
+
borderRadius: '4px',
|
|
147
|
+
margin: '0.5rem'
|
|
148
|
+
}
|
|
149
|
+
}, "Another section with different custom styling.")
|
|
150
|
+
}];
|
|
151
|
+
var CustomStyled = exports.CustomStyled = Template.bind({});
|
|
152
|
+
CustomStyled.args = {
|
|
153
|
+
items: customStyledItems,
|
|
154
|
+
allowOneOpen: false,
|
|
155
|
+
defaultOpen: ''
|
|
133
156
|
};
|
|
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _Accordian = _interopRequireDefault(require("./Accordian"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
9
|
var _default = exports["default"] = _Accordian["default"];
|
|
@@ -7,10 +7,10 @@ exports["default"] = exports.ButtonSize = exports.ButtonAppearance = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _excluded = ["children", "className", "loading", "disabled", "appearance", "size", "onClick"];
|
|
10
|
-
function _interopRequireDefault(
|
|
11
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
12
|
-
function _objectWithoutProperties(
|
|
13
|
-
function _objectWithoutPropertiesLoose(
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
14
|
/** ButtonAppearance enum */
|
|
15
15
|
var ButtonAppearance = exports.ButtonAppearance = {
|
|
16
16
|
DEFAULT: "default",
|
|
@@ -4,82 +4,188 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports["default"] = exports.
|
|
7
|
+
exports["default"] = exports.Sizes = exports.Secondary = exports.Primary = exports.Loading = exports.Interactive = exports.Disabled = exports.Default = exports.AllVariations = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _addonActions = require("@storybook/addon-actions");
|
|
10
9
|
var _Button = _interopRequireWildcard(require("./Button"));
|
|
11
|
-
function
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
onClick: (0, _addonActions.action)("clicked")
|
|
20
|
-
}, "SMALL"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
21
|
-
size: _Button.ButtonSize.MEDIUM,
|
|
22
|
-
onClick: (0, _addonActions.action)("clicked")
|
|
23
|
-
}, "MEDIUM"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
24
|
-
size: _Button.ButtonSize.LARGE,
|
|
25
|
-
onClick: (0, _addonActions.action)("clicked")
|
|
26
|
-
}, "LARGE"));
|
|
27
|
-
};
|
|
28
|
-
SimpleUsage.story = {
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
|
+
// Import required styles
|
|
13
|
+
// import '../theme.scss';
|
|
14
|
+
// import './buttonTheme.scss';
|
|
15
|
+
var _default = exports["default"] = {
|
|
16
|
+
title: 'Components/Button',
|
|
17
|
+
component: _Button["default"],
|
|
29
18
|
parameters: {
|
|
19
|
+
layout: 'centered',
|
|
30
20
|
docs: {
|
|
31
|
-
|
|
21
|
+
story: {
|
|
22
|
+
inline: true
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
backgrounds: {
|
|
26
|
+
"default": 'light',
|
|
27
|
+
values: [{
|
|
28
|
+
name: 'light',
|
|
29
|
+
value: '#ffffff'
|
|
30
|
+
}, {
|
|
31
|
+
name: 'dark',
|
|
32
|
+
value: '#333333'
|
|
33
|
+
}]
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
tags: ['autodocs'],
|
|
37
|
+
argTypes: {
|
|
38
|
+
appearance: {
|
|
39
|
+
control: 'select',
|
|
40
|
+
options: Object.values(_Button.ButtonAppearance),
|
|
41
|
+
description: 'The visual style of the button'
|
|
42
|
+
},
|
|
43
|
+
size: {
|
|
44
|
+
control: 'select',
|
|
45
|
+
options: Object.values(_Button.ButtonSize),
|
|
46
|
+
description: 'The size of the button'
|
|
47
|
+
},
|
|
48
|
+
disabled: {
|
|
49
|
+
control: 'boolean',
|
|
50
|
+
description: 'Whether the button is disabled'
|
|
51
|
+
},
|
|
52
|
+
loading: {
|
|
53
|
+
control: 'boolean',
|
|
54
|
+
description: 'Whether the button is in a loading state'
|
|
55
|
+
},
|
|
56
|
+
onClick: {
|
|
57
|
+
action: 'clicked',
|
|
58
|
+
description: 'Button click handler'
|
|
59
|
+
},
|
|
60
|
+
children: {
|
|
61
|
+
control: 'text',
|
|
62
|
+
description: 'Button content'
|
|
63
|
+
},
|
|
64
|
+
className: {
|
|
65
|
+
control: 'text',
|
|
66
|
+
description: 'Additional CSS classes'
|
|
32
67
|
}
|
|
33
68
|
}
|
|
69
|
+
}; // Template for stories
|
|
70
|
+
var Template = function Template(args) {
|
|
71
|
+
return /*#__PURE__*/_react["default"].createElement(_Button["default"], args);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// Default button
|
|
75
|
+
var Default = exports.Default = Template.bind({});
|
|
76
|
+
Default.args = {
|
|
77
|
+
children: 'Default Button',
|
|
78
|
+
appearance: _Button.ButtonAppearance.DEFAULT,
|
|
79
|
+
size: _Button.ButtonSize.MEDIUM
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// Primary button
|
|
83
|
+
var Primary = exports.Primary = Template.bind({});
|
|
84
|
+
Primary.args = {
|
|
85
|
+
children: 'Primary Button',
|
|
86
|
+
appearance: _Button.ButtonAppearance.PRIMARY,
|
|
87
|
+
size: _Button.ButtonSize.MEDIUM
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// Secondary button
|
|
91
|
+
var Secondary = exports.Secondary = Template.bind({});
|
|
92
|
+
Secondary.args = {
|
|
93
|
+
children: 'Secondary Button',
|
|
94
|
+
appearance: _Button.ButtonAppearance.SECONDARY,
|
|
95
|
+
size: _Button.ButtonSize.MEDIUM
|
|
34
96
|
};
|
|
35
|
-
|
|
97
|
+
|
|
98
|
+
// Button sizes
|
|
99
|
+
var Sizes = exports.Sizes = function Sizes() {
|
|
36
100
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
37
|
-
|
|
101
|
+
style: {
|
|
102
|
+
display: 'flex',
|
|
103
|
+
gap: '1rem',
|
|
104
|
+
alignItems: 'center'
|
|
105
|
+
}
|
|
38
106
|
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}, "
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
onClick: (0, _addonActions.action)("clicked")
|
|
46
|
-
}, "MEDIUM"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
47
|
-
appearance: _Button.ButtonAppearance.PRIMARY,
|
|
48
|
-
size: _Button.ButtonSize.LARGE,
|
|
49
|
-
onClick: (0, _addonActions.action)("clicked")
|
|
50
|
-
}, "LARGE"));
|
|
107
|
+
size: _Button.ButtonSize.SMALL
|
|
108
|
+
}, "Small Button"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
109
|
+
size: _Button.ButtonSize.MEDIUM
|
|
110
|
+
}, "Medium Button"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
111
|
+
size: _Button.ButtonSize.LARGE
|
|
112
|
+
}, "Large Button"));
|
|
51
113
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
114
|
+
|
|
115
|
+
// Disabled state
|
|
116
|
+
var Disabled = exports.Disabled = Template.bind({});
|
|
117
|
+
Disabled.args = {
|
|
118
|
+
children: 'Disabled Button',
|
|
119
|
+
disabled: true,
|
|
120
|
+
appearance: _Button.ButtonAppearance.PRIMARY,
|
|
121
|
+
size: _Button.ButtonSize.MEDIUM
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// Loading state
|
|
125
|
+
var Loading = exports.Loading = Template.bind({});
|
|
126
|
+
Loading.args = {
|
|
127
|
+
children: 'Loading Button',
|
|
128
|
+
loading: true,
|
|
129
|
+
appearance: _Button.ButtonAppearance.PRIMARY,
|
|
130
|
+
size: _Button.ButtonSize.MEDIUM
|
|
58
131
|
};
|
|
59
|
-
|
|
132
|
+
|
|
133
|
+
// All variations
|
|
134
|
+
var AllVariations = exports.AllVariations = function AllVariations() {
|
|
60
135
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
61
|
-
|
|
136
|
+
style: {
|
|
137
|
+
display: 'flex',
|
|
138
|
+
flexDirection: 'column',
|
|
139
|
+
gap: '1rem'
|
|
140
|
+
}
|
|
141
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
142
|
+
style: {
|
|
143
|
+
display: 'flex',
|
|
144
|
+
gap: '1rem'
|
|
145
|
+
}
|
|
62
146
|
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
147
|
+
appearance: _Button.ButtonAppearance.DEFAULT
|
|
148
|
+
}, "Default"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
149
|
+
appearance: _Button.ButtonAppearance.PRIMARY
|
|
150
|
+
}, "Primary"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
151
|
+
appearance: _Button.ButtonAppearance.SECONDARY
|
|
152
|
+
}, "Secondary")), /*#__PURE__*/_react["default"].createElement("div", {
|
|
153
|
+
style: {
|
|
154
|
+
display: 'flex',
|
|
155
|
+
gap: '1rem'
|
|
156
|
+
}
|
|
157
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
158
|
+
appearance: _Button.ButtonAppearance.DEFAULT,
|
|
159
|
+
disabled: true
|
|
160
|
+
}, "Default Disabled"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
161
|
+
appearance: _Button.ButtonAppearance.PRIMARY,
|
|
162
|
+
disabled: true
|
|
163
|
+
}, "Primary Disabled"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
63
164
|
appearance: _Button.ButtonAppearance.SECONDARY,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
onClick: (0, _addonActions.action)("clicked")
|
|
70
|
-
}, "MEDIUM"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
71
|
-
appearance: _Button.ButtonAppearance.SECONDARY,
|
|
72
|
-
size: _Button.ButtonSize.LARGE,
|
|
73
|
-
onClick: (0, _addonActions.action)("clicked")
|
|
74
|
-
}, "LARGE"));
|
|
75
|
-
};
|
|
76
|
-
SecondaryButton.story = {
|
|
77
|
-
parameters: {
|
|
78
|
-
docs: {
|
|
79
|
-
storyDescription: "Depicts a secondary button"
|
|
165
|
+
disabled: true
|
|
166
|
+
}, "Secondary Disabled")), /*#__PURE__*/_react["default"].createElement("div", {
|
|
167
|
+
style: {
|
|
168
|
+
display: 'flex',
|
|
169
|
+
gap: '1rem'
|
|
80
170
|
}
|
|
81
|
-
}
|
|
171
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
172
|
+
appearance: _Button.ButtonAppearance.DEFAULT,
|
|
173
|
+
loading: true
|
|
174
|
+
}, "Default Loading"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
175
|
+
appearance: _Button.ButtonAppearance.PRIMARY,
|
|
176
|
+
loading: true
|
|
177
|
+
}, "Primary Loading"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
178
|
+
appearance: _Button.ButtonAppearance.SECONDARY,
|
|
179
|
+
loading: true
|
|
180
|
+
}, "Secondary Loading")));
|
|
82
181
|
};
|
|
83
|
-
|
|
84
|
-
|
|
182
|
+
|
|
183
|
+
// Interactive example with all controls
|
|
184
|
+
var Interactive = exports.Interactive = Template.bind({});
|
|
185
|
+
Interactive.args = {
|
|
186
|
+
children: 'Interactive Button',
|
|
187
|
+
appearance: _Button.ButtonAppearance.PRIMARY,
|
|
188
|
+
size: _Button.ButtonSize.MEDIUM,
|
|
189
|
+
disabled: false,
|
|
190
|
+
loading: false
|
|
85
191
|
};
|