@unbxd-ui/unbxd-react-components 0.2.107-beta.2 → 0.2.108-beta.2
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/components/Accordian/Accordian.js +13 -45
- package/components/Accordian/Accordian.stories.js +6 -25
- package/components/Accordian/index.js +0 -3
- package/components/Button/Button.js +9 -26
- package/components/Button/Button.stories.js +1 -14
- package/components/Button/DropdownButton.js +9 -31
- package/components/Button/DropdownButton.stories.js +6 -23
- package/components/Button/index.js +1 -8
- package/components/DataLoader/DataLoader.js +10 -40
- package/components/DataLoader/DataLoader.stories.js +5 -30
- package/components/DataLoader/index.js +0 -3
- package/components/Form/Checkbox.js +18 -43
- package/components/Form/DragDropFileUploader.js +12 -42
- package/components/Form/Dropdown.js +106 -182
- package/components/Form/FileUploader.js +10 -32
- package/components/Form/Form.js +15 -45
- package/components/Form/FormElementWrapper.js +2 -7
- package/components/Form/Input.js +27 -72
- package/components/Form/RadioList.js +20 -49
- package/components/Form/RangeSlider.js +39 -74
- package/components/Form/ServerPaginatedDDList.js +86 -130
- package/components/Form/Textarea.js +18 -43
- package/components/Form/Toggle.js +16 -48
- package/components/Form/index.js +18 -30
- package/components/Form/stories/Checkbox.stories.js +1 -12
- package/components/Form/stories/DragDropFileUploader.stories.js +0 -8
- package/components/Form/stories/Dropdown.stories.js +6 -24
- package/components/Form/stories/FileUploader.stories.js +0 -8
- package/components/Form/stories/FormDefault.stories.js +1 -21
- package/components/Form/stories/RadioList.stories.js +1 -12
- package/components/Form/stories/RangeSlider.stories.js +1 -15
- package/components/Form/stories/TextInput.stories.js +3 -19
- package/components/Form/stories/Textarea.stories.js +1 -12
- package/components/Form/stories/Toggle.stories.js +0 -7
- package/components/Form/stories/form.stories.js +3 -40
- package/components/InlineModal/InlineModal.js +14 -51
- package/components/InlineModal/InlineModal.stories.js +2 -14
- package/components/InlineModal/index.js +1 -6
- package/components/List/List.js +9 -24
- package/components/List/index.js +0 -3
- package/components/List/list.stories.js +0 -10
- package/components/Modal/Modal.js +17 -49
- package/components/Modal/Modal.stories.js +1 -15
- package/components/Modal/index.js +0 -3
- package/components/NotificationComponent/NotificationComponent.js +11 -34
- package/components/NotificationComponent/NotificationComponent.stories.js +0 -6
- package/components/NotificationComponent/index.js +0 -3
- package/components/ProgressBar/ProgressBar.js +2 -11
- package/components/ProgressBar/ProgressBar.stories.js +0 -6
- package/components/ProgressBar/index.js +0 -3
- package/components/Table/BaseTable.js +69 -134
- package/components/Table/PaginationComponent.js +11 -23
- package/components/Table/Table.js +68 -149
- package/components/Table/Table.stories.js +22 -67
- package/components/Table/index.js +0 -4
- package/components/TabsComponent/TabsComponent.js +20 -57
- package/components/TabsComponent/TabsComponent.stories.js +0 -16
- package/components/TabsComponent/index.js +0 -3
- package/components/Tooltip/Tooltip.js +25 -47
- package/components/Tooltip/Tooltip.stories.js +0 -6
- package/components/Tooltip/index.js +0 -3
- package/components/core.css +3 -1
- package/components/index.js +1 -17
- package/components/theme.css +2 -0
- package/package.json +3 -2
- package/.babelrc +0 -4
- package/.eslintrc.js +0 -38
- package/CONTRIBUTE.md +0 -105
- package/README.md +0 -82
- package/lib/components/Accordian/Accordian.js +0 -117
- package/lib/components/Accordian/Accordian.stories.js +0 -137
- package/lib/components/Accordian/index.js +0 -10
- package/lib/components/Button/Button.js +0 -84
- package/lib/components/Button/Button.stories.js +0 -89
- package/lib/components/Button/DropdownButton.js +0 -77
- package/lib/components/Button/DropdownButton.stories.js +0 -51
- package/lib/components/Button/index.js +0 -32
- package/lib/components/DataLoader/DataLoader.js +0 -88
- package/lib/components/DataLoader/DataLoader.stories.js +0 -77
- package/lib/components/DataLoader/index.js +0 -10
- package/lib/components/Form/Checkbox.js +0 -93
- package/lib/components/Form/DragDropFileUploader.js +0 -85
- package/lib/components/Form/Dropdown.js +0 -478
- package/lib/components/Form/FileUploader.js +0 -81
- package/lib/components/Form/Form.js +0 -106
- package/lib/components/Form/FormElementWrapper.js +0 -27
- package/lib/components/Form/Input.js +0 -140
- package/lib/components/Form/RadioList.js +0 -111
- package/lib/components/Form/RangeSlider.js +0 -142
- package/lib/components/Form/ServerPaginatedDDList.js +0 -267
- package/lib/components/Form/Textarea.js +0 -95
- package/lib/components/Form/Toggle.js +0 -117
- package/lib/components/Form/index.js +0 -73
- package/lib/components/Form/stories/Checkbox.stories.js +0 -54
- package/lib/components/Form/stories/DragDropFileUploader.stories.js +0 -27
- package/lib/components/Form/stories/Dropdown.stories.js +0 -114
- package/lib/components/Form/stories/FileUploader.stories.js +0 -31
- package/lib/components/Form/stories/FormDefault.stories.js +0 -117
- package/lib/components/Form/stories/RadioList.stories.js +0 -55
- package/lib/components/Form/stories/RangeSlider.stories.js +0 -82
- package/lib/components/Form/stories/TextInput.stories.js +0 -79
- package/lib/components/Form/stories/Textarea.stories.js +0 -48
- package/lib/components/Form/stories/Toggle.stories.js +0 -25
- package/lib/components/Form/stories/form.stories.js +0 -240
- package/lib/components/InlineModal/InlineModal.js +0 -146
- package/lib/components/InlineModal/InlineModal.stories.js +0 -61
- package/lib/components/InlineModal/index.js +0 -24
- package/lib/components/List/List.js +0 -76
- package/lib/components/List/index.js +0 -10
- package/lib/components/List/list.stories.js +0 -38
- package/lib/components/Modal/Modal.js +0 -117
- package/lib/components/Modal/Modal.stories.js +0 -55
- package/lib/components/Modal/index.js +0 -10
- package/lib/components/NotificationComponent/NotificationComponent.js +0 -76
- package/lib/components/NotificationComponent/NotificationComponent.stories.js +0 -29
- package/lib/components/NotificationComponent/index.js +0 -10
- package/lib/components/ProgressBar/ProgressBar.js +0 -49
- package/lib/components/ProgressBar/ProgressBar.stories.js +0 -21
- package/lib/components/ProgressBar/index.js +0 -10
- package/lib/components/Table/BaseTable.js +0 -352
- package/lib/components/Table/PaginationComponent.js +0 -87
- package/lib/components/Table/Table.js +0 -333
- package/lib/components/Table/Table.stories.js +0 -204
- package/lib/components/Table/index.js +0 -17
- package/lib/components/TabsComponent/TabsComponent.js +0 -134
- package/lib/components/TabsComponent/TabsComponent.stories.js +0 -65
- package/lib/components/TabsComponent/index.js +0 -10
- package/lib/components/Tooltip/Tooltip.js +0 -102
- package/lib/components/Tooltip/Tooltip.stories.js +0 -25
- package/lib/components/Tooltip/index.js +0 -10
- package/lib/components/core.css +0 -3
- package/lib/components/core.scss +0 -29
- package/lib/components/index.js +0 -159
- package/lib/components/theme.css +0 -3
- package/lib/components/theme.scss +0 -11
- package/lib/package-lock.json +0 -20607
- package/lib/package.json +0 -94
- package/src/Intro.stories.mdx +0 -119
- package/src/components/Accordian/Accordian.js +0 -89
- package/src/components/Accordian/Accordian.stories.js +0 -92
- package/src/components/Accordian/accordianCore.css +0 -1
- package/src/components/Accordian/accordianCore.scss +0 -8
- package/src/components/Accordian/accordianTheme.css +0 -1
- package/src/components/Accordian/accordianTheme.scss +0 -6
- package/src/components/Accordian/index.js +0 -3
- package/src/components/Button/Button.js +0 -67
- package/src/components/Button/Button.stories.js +0 -103
- package/src/components/Button/DropdownButton.js +0 -60
- package/src/components/Button/DropdownButton.stories.js +0 -38
- package/src/components/Button/button.css +0 -1
- package/src/components/Button/buttonTheme.css +0 -1
- package/src/components/Button/buttonTheme.scss +0 -45
- package/src/components/Button/index.js +0 -5
- package/src/components/DataLoader/DataLoader.js +0 -86
- package/src/components/DataLoader/DataLoader.stories.js +0 -72
- package/src/components/DataLoader/index.js +0 -3
- package/src/components/Form/Checkbox.js +0 -73
- package/src/components/Form/DragDropFileUploader.js +0 -67
- package/src/components/Form/Dropdown.js +0 -430
- package/src/components/Form/FileUploader.js +0 -64
- package/src/components/Form/Form.js +0 -83
- package/src/components/Form/FormElementWrapper.js +0 -22
- package/src/components/Form/Input.js +0 -121
- package/src/components/Form/RadioList.js +0 -86
- package/src/components/Form/RangeSlider.js +0 -100
- package/src/components/Form/ServerPaginatedDDList.js +0 -231
- package/src/components/Form/Textarea.js +0 -76
- package/src/components/Form/Toggle.js +0 -96
- package/src/components/Form/form.css +0 -1
- package/src/components/Form/formCore.css +0 -1
- package/src/components/Form/formCore.scss +0 -142
- package/src/components/Form/formTheme.css +0 -1
- package/src/components/Form/formTheme.scss +0 -27
- package/src/components/Form/index.js +0 -13
- package/src/components/Form/stories/Checkbox.stories.js +0 -41
- package/src/components/Form/stories/DragDropFileUploader.stories.js +0 -21
- package/src/components/Form/stories/Dropdown.stories.js +0 -124
- package/src/components/Form/stories/FileUploader.stories.js +0 -21
- package/src/components/Form/stories/FormDefault.stories.js +0 -87
- package/src/components/Form/stories/RadioList.stories.js +0 -48
- package/src/components/Form/stories/RangeSlider.stories.js +0 -84
- package/src/components/Form/stories/TextInput.stories.js +0 -77
- package/src/components/Form/stories/Textarea.stories.js +0 -43
- package/src/components/Form/stories/Toggle.stories.js +0 -14
- package/src/components/Form/stories/form.stories.js +0 -216
- package/src/components/InlineModal/InlineModal.js +0 -135
- package/src/components/InlineModal/InlineModal.stories.js +0 -54
- package/src/components/InlineModal/index.js +0 -4
- package/src/components/InlineModal/inlineModal.css +0 -1
- package/src/components/InlineModal/inlineModalCore.css +0 -1
- package/src/components/InlineModal/inlineModalCore.scss +0 -31
- package/src/components/InlineModal/inlineModalTheme.css +0 -1
- package/src/components/InlineModal/inlineModalTheme.scss +0 -16
- package/src/components/List/List.js +0 -72
- package/src/components/List/index.js +0 -3
- package/src/components/List/list.css +0 -1
- package/src/components/List/list.stories.js +0 -28
- package/src/components/List/listCore.css +0 -1
- package/src/components/List/listCore.scss +0 -6
- package/src/components/List/listTheme.css +0 -0
- package/src/components/List/listTheme.scss +0 -0
- package/src/components/Modal/Modal.js +0 -99
- package/src/components/Modal/Modal.stories.js +0 -54
- package/src/components/Modal/index.js +0 -3
- package/src/components/Modal/modal.css +0 -1
- package/src/components/Modal/modalCore.css +0 -1
- package/src/components/Modal/modalCore.scss +0 -34
- package/src/components/Modal/modalTheme.css +0 -0
- package/src/components/Modal/modalTheme.scss +0 -0
- package/src/components/NotificationComponent/NotificationComponent.js +0 -58
- package/src/components/NotificationComponent/NotificationComponent.stories.js +0 -28
- package/src/components/NotificationComponent/index.js +0 -3
- package/src/components/NotificationComponent/notificationComponent.css +0 -1
- package/src/components/NotificationComponent/notificationTheme.css +0 -1
- package/src/components/NotificationComponent/notificationTheme.scss +0 -30
- package/src/components/ProgressBar/ProgressBar.js +0 -45
- package/src/components/ProgressBar/ProgressBar.stories.js +0 -14
- package/src/components/ProgressBar/index.js +0 -3
- package/src/components/ProgressBar/progressBar.css +0 -1
- package/src/components/ProgressBar/progressBarCore.css +0 -1
- package/src/components/ProgressBar/progressBarCore.scss +0 -14
- package/src/components/ProgressBar/progressBarTheme.css +0 -0
- package/src/components/ProgressBar/progressBarTheme.scss +0 -0
- package/src/components/Table/BaseTable.js +0 -306
- package/src/components/Table/PaginationComponent.js +0 -73
- package/src/components/Table/Table.js +0 -295
- package/src/components/Table/Table.stories.js +0 -198
- package/src/components/Table/index.js +0 -8
- package/src/components/Table/table.css +0 -1
- package/src/components/Table/tableCore.css +0 -1
- package/src/components/Table/tableCore.scss +0 -94
- package/src/components/Table/tableTheme.css +0 -1
- package/src/components/Table/tableTheme.scss +0 -34
- package/src/components/TabsComponent/TabsComponent.js +0 -99
- package/src/components/TabsComponent/TabsComponent.stories.js +0 -69
- package/src/components/TabsComponent/index.js +0 -3
- package/src/components/TabsComponent/tabs.css +0 -1
- package/src/components/TabsComponent/tabsCore.css +0 -1
- package/src/components/TabsComponent/tabsCore.scss +0 -59
- package/src/components/TabsComponent/tabsTheme.css +0 -0
- package/src/components/TabsComponent/tabsTheme.scss +0 -0
- package/src/components/Tooltip/Tooltip.js +0 -87
- package/src/components/Tooltip/Tooltip.stories.js +0 -16
- package/src/components/Tooltip/index.js +0 -3
- package/src/components/Tooltip/tooltipCore.css +0 -1
- package/src/components/Tooltip/tooltipCore.scss +0 -22
- package/src/components/Tooltip/tooltipTheme.css +0 -1
- package/src/components/Tooltip/tooltipTheme.scss +0 -21
- package/src/components/core.css +0 -1
- package/src/components/core.scss +0 -29
- package/src/components/index.js +0 -38
- package/src/components/theme.css +0 -1
- package/src/components/theme.scss +0 -11
- package/src/core/Validators.js +0 -34
- package/src/core/customHooks.js +0 -20
- package/src/core/dataLoader.js +0 -143
- package/src/core/dataLoader.stories.js +0 -123
- package/src/core/index.js +0 -3
- package/src/core/utils.js +0 -95
- package/src/index.js +0 -68
- package/vscode-templates/NewStoryTemplate.stories.js +0 -8
- /package/{lib/Readme.md → Readme.md} +0 -0
- /package/{lib/components → components}/Accordian/accordianCore.css +0 -0
- /package/{lib/components → components}/Accordian/accordianTheme.css +0 -0
- /package/{lib/components → components}/Button/buttonTheme.css +0 -0
- /package/{lib/components → components}/Form/formCore.css +0 -0
- /package/{lib/components → components}/Form/formTheme.css +0 -0
- /package/{lib/components → components}/InlineModal/inlineModalCore.css +0 -0
- /package/{lib/components → components}/InlineModal/inlineModalTheme.css +0 -0
- /package/{lib/components → components}/List/listCore.css +0 -0
- /package/{lib/components → components}/List/listTheme.css +0 -0
- /package/{lib/components → components}/Modal/modalCore.css +0 -0
- /package/{lib/components → components}/Modal/modalTheme.css +0 -0
- /package/{lib/components → components}/NotificationComponent/notificationTheme.css +0 -0
- /package/{lib/components → components}/ProgressBar/progressBarCore.css +0 -0
- /package/{lib/components → components}/ProgressBar/progressBarTheme.css +0 -0
- /package/{lib/components → components}/Table/tableCore.css +0 -0
- /package/{lib/components → components}/Table/tableTheme.css +0 -0
- /package/{lib/components → components}/TabsComponent/tabsCore.css +0 -0
- /package/{lib/components → components}/TabsComponent/tabsTheme.css +0 -0
- /package/{lib/components → components}/Tooltip/tooltipCore.css +0 -0
- /package/{lib/components → components}/Tooltip/tooltipTheme.css +0 -0
- /package/{lib/core → core}/Validators.js +0 -0
- /package/{lib/core → core}/customHooks.js +0 -0
- /package/{lib/core → core}/dataLoader.js +0 -0
- /package/{lib/core → core}/dataLoader.stories.js +0 -0
- /package/{lib/core → core}/index.js +0 -0
- /package/{lib/core → core}/utils.js +0 -0
- /package/{lib/index.js → index.js} +0 -0
|
@@ -1,106 +1,79 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
4
|
-
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = exports.InlineModalBody = exports.InlineModalActivator = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
|
|
16
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
|
|
18
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
20
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
|
-
|
|
13
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
22
14
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
23
|
-
|
|
24
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."); }
|
|
25
|
-
|
|
26
16
|
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); }
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
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; }
|
|
31
|
-
|
|
17
|
+
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; }
|
|
18
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
32
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
33
|
-
|
|
34
20
|
var InlineModalActivator = function InlineModalActivator(props) {
|
|
35
21
|
return props.children;
|
|
36
22
|
};
|
|
37
|
-
|
|
38
23
|
exports.InlineModalActivator = InlineModalActivator;
|
|
39
|
-
|
|
40
24
|
var InlineModalBody = function InlineModalBody(props) {
|
|
41
25
|
return props.children;
|
|
42
26
|
};
|
|
43
|
-
|
|
44
27
|
exports.InlineModalBody = InlineModalBody;
|
|
45
|
-
|
|
46
28
|
var InlineModal = function InlineModal(props, ref) {
|
|
47
29
|
var children = props.children,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
30
|
+
activatorAction = props.activatorAction,
|
|
31
|
+
className = props.className,
|
|
32
|
+
propIsOpen = props.isModalOpen,
|
|
33
|
+
halign = props.halign,
|
|
34
|
+
onModalStateChange = props.onModalStateChange;
|
|
54
35
|
var _useState = (0, _react.useState)(propIsOpen),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
36
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
+
isModalOpen = _useState2[0],
|
|
38
|
+
setIsModalOpen = _useState2[1];
|
|
59
39
|
var activatorProps = {};
|
|
60
40
|
var inlineModalClassName = "RCB-inline-modal ".concat(className);
|
|
61
41
|
var showModalBody = isModalOpen;
|
|
62
42
|
var inlineModalRef = (0, _react.useRef)();
|
|
63
43
|
var isFirstRun = (0, _react.useRef)(true);
|
|
64
|
-
|
|
65
44
|
var changeModalState = function changeModalState(newState) {
|
|
66
45
|
setIsModalOpen(newState);
|
|
67
46
|
};
|
|
68
|
-
|
|
69
47
|
var onActivatorClick = function onActivatorClick(e) {
|
|
70
48
|
e.stopPropagation();
|
|
71
49
|
changeModalState(!isModalOpen);
|
|
72
50
|
};
|
|
73
|
-
|
|
74
51
|
var onBodyClick = function onBodyClick(e) {
|
|
75
52
|
var eventTarget = e.target;
|
|
76
53
|
var inlineModalNode = inlineModalRef.current;
|
|
77
54
|
var eventPathNodes = e.composedPath();
|
|
78
55
|
var isWithinModal = false;
|
|
79
|
-
|
|
80
56
|
if (inlineModalNode.contains(eventTarget)) {
|
|
81
57
|
isWithinModal = true;
|
|
82
58
|
} else {
|
|
83
59
|
for (var i = 0; i < eventPathNodes.length; i++) {
|
|
84
60
|
var node = eventPathNodes[i];
|
|
85
|
-
|
|
86
61
|
if (node !== window && inlineModalNode.contains(node)) {
|
|
87
62
|
isWithinModal = true;
|
|
88
63
|
break;
|
|
89
64
|
}
|
|
90
65
|
}
|
|
91
66
|
}
|
|
92
|
-
|
|
93
67
|
if (!isWithinModal) {
|
|
94
68
|
/* outside click -> close modal */
|
|
95
69
|
changeModalState(false);
|
|
96
70
|
}
|
|
97
71
|
};
|
|
98
|
-
|
|
99
72
|
(0, _react.useEffect)(function () {
|
|
100
73
|
/* add when mounted */
|
|
101
74
|
document.addEventListener("click", onBodyClick);
|
|
102
|
-
/* return function to be called when unmounted */
|
|
103
75
|
|
|
76
|
+
/* return function to be called when unmounted */
|
|
104
77
|
return function () {
|
|
105
78
|
document.removeEventListener("click", onBodyClick);
|
|
106
79
|
};
|
|
@@ -111,10 +84,8 @@ var InlineModal = function InlineModal(props, ref) {
|
|
|
111
84
|
isFirstRun.current = false;
|
|
112
85
|
return;
|
|
113
86
|
}
|
|
114
|
-
|
|
115
87
|
typeof onModalStateChange === "function" && onModalStateChange(isModalOpen);
|
|
116
88
|
}, [isModalOpen]);
|
|
117
|
-
|
|
118
89
|
if (activatorAction === "click") {
|
|
119
90
|
activatorProps = {
|
|
120
91
|
onClick: onActivatorClick
|
|
@@ -123,9 +94,8 @@ var InlineModal = function InlineModal(props, ref) {
|
|
|
123
94
|
inlineModalClassName += " hover-open";
|
|
124
95
|
showModalBody = true;
|
|
125
96
|
}
|
|
126
|
-
/* add methods that can be accessed via this component's ref */
|
|
127
|
-
|
|
128
97
|
|
|
98
|
+
/* add methods that can be accessed via this component's ref */
|
|
129
99
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
130
100
|
return {
|
|
131
101
|
hideModal: function hideModal() {
|
|
@@ -142,32 +112,25 @@ var InlineModal = function InlineModal(props, ref) {
|
|
|
142
112
|
className: "RCB-inline-modal-body RCB-align-".concat(halign)
|
|
143
113
|
}, children[1]));
|
|
144
114
|
};
|
|
145
|
-
|
|
146
115
|
InlineModal = /*#__PURE__*/(0, _react.forwardRef)(InlineModal);
|
|
147
116
|
InlineModal.propTypes = {
|
|
148
117
|
/** Pass any additional classNames to InlineModal component */
|
|
149
118
|
className: _propTypes["default"].string,
|
|
150
|
-
|
|
151
119
|
/** Horizontal alignment of the inline modal body */
|
|
152
120
|
halign: _propTypes["default"].oneOf(["left", "right"]),
|
|
153
|
-
|
|
154
121
|
/** Event on which the modal should be opened */
|
|
155
122
|
activatorAction: _propTypes["default"].oneOf(["click", "hover"]),
|
|
156
123
|
children: function children(props, propName, componentName) {
|
|
157
124
|
var children = props[propName];
|
|
158
|
-
|
|
159
125
|
if (_react["default"].Children.count(children) !== 2) {
|
|
160
126
|
return new Error("".concat(componentName, " should have 2 children"));
|
|
161
127
|
}
|
|
162
|
-
|
|
163
128
|
if (children[0].type !== InlineModalActivator || children[1].type !== InlineModalBody) {
|
|
164
129
|
return new Error("".concat(componentName, " should have an InlineModalActivator & InlineModalBody components as children"));
|
|
165
130
|
}
|
|
166
131
|
},
|
|
167
|
-
|
|
168
132
|
/** Boolean prop to have the modal open or close */
|
|
169
133
|
isModalOpen: _propTypes["default"].bool,
|
|
170
|
-
|
|
171
134
|
/** callback function that gets called when the modal state changes (either opens or closes) */
|
|
172
135
|
onModalStateChange: _propTypes["default"].func
|
|
173
136
|
};
|
|
@@ -1,31 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
4
|
-
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = exports.SimpleUsage = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _addonLinks = require("@storybook/addon-links");
|
|
13
|
-
|
|
14
10
|
var _Constants = require("../../../public/Constants");
|
|
15
|
-
|
|
16
11
|
var _InlineModal = _interopRequireWildcard(require("./InlineModal"));
|
|
17
|
-
|
|
18
12
|
var _ = require("../");
|
|
19
|
-
|
|
20
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
-
|
|
22
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
-
|
|
24
15
|
/* eslint-disable react/prop-types */
|
|
25
16
|
var CustomListItem = function CustomListItem(props) {
|
|
26
17
|
var itemData = props.itemData;
|
|
27
18
|
var id = itemData.id,
|
|
28
|
-
|
|
19
|
+
name = itemData.name;
|
|
29
20
|
return /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("input", {
|
|
30
21
|
type: "checkbox",
|
|
31
22
|
id: id
|
|
@@ -35,7 +26,6 @@ var CustomListItem = function CustomListItem(props) {
|
|
|
35
26
|
};
|
|
36
27
|
/* eslint-enable react/prop-types */
|
|
37
28
|
|
|
38
|
-
|
|
39
29
|
var SimpleUsage = function SimpleUsage() {
|
|
40
30
|
var onModalStateChange = function onModalStateChange(isModalOpen) {
|
|
41
31
|
console.log("Modal state change 1");
|
|
@@ -43,7 +33,6 @@ var SimpleUsage = function SimpleUsage() {
|
|
|
43
33
|
isModalOpen: isModalOpen
|
|
44
34
|
});
|
|
45
35
|
};
|
|
46
|
-
|
|
47
36
|
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, /*#__PURE__*/_react["default"].createElement(_InlineModal["default"], {
|
|
48
37
|
onModalStateChange: onModalStateChange
|
|
49
38
|
}, /*#__PURE__*/_react["default"].createElement(_InlineModal.InlineModalActivator, null, /*#__PURE__*/_react["default"].createElement("div", null, "Select a fruit")), /*#__PURE__*/_react["default"].createElement(_InlineModal.InlineModalBody, null, /*#__PURE__*/_react["default"].createElement(_.List, {
|
|
@@ -52,7 +41,6 @@ var SimpleUsage = function SimpleUsage() {
|
|
|
52
41
|
ListItem: CustomListItem
|
|
53
42
|
}))));
|
|
54
43
|
};
|
|
55
|
-
|
|
56
44
|
exports.SimpleUsage = SimpleUsage;
|
|
57
45
|
SimpleUsage.story = {
|
|
58
46
|
parameters: {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
4
|
-
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -18,12 +17,8 @@ Object.defineProperty(exports, "InlineModalBody", {
|
|
|
18
17
|
}
|
|
19
18
|
});
|
|
20
19
|
exports["default"] = void 0;
|
|
21
|
-
|
|
22
20
|
var _InlineModal = _interopRequireWildcard(require("./InlineModal"));
|
|
23
|
-
|
|
24
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
-
|
|
26
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
-
|
|
28
23
|
var _default = _InlineModal["default"];
|
|
29
24
|
exports["default"] = _default;
|
package/components/List/List.js
CHANGED
|
@@ -4,51 +4,39 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _excluded = ["className", "items", "idAttribute", "ListItem", "showNoDataMsg", "noDataComponent"];
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
|
|
16
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
17
|
-
|
|
11
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
18
12
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
19
|
-
|
|
20
13
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
21
|
-
|
|
22
14
|
var ListItem = function ListItem(props) {
|
|
23
15
|
var _props$itemData = props.itemData,
|
|
24
|
-
|
|
16
|
+
itemData = _props$itemData === void 0 ? {} : _props$itemData;
|
|
25
17
|
var name = itemData.name;
|
|
26
18
|
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
27
19
|
className: "RCB-list-item"
|
|
28
20
|
}, name);
|
|
29
21
|
};
|
|
30
|
-
|
|
31
22
|
ListItem.propTypes = {
|
|
32
23
|
itemData: _propTypes["default"].shape({
|
|
33
24
|
id: _propTypes["default"].string.isRequired,
|
|
34
25
|
name: _propTypes["default"].string.isRequired
|
|
35
26
|
}).isRequired
|
|
36
27
|
};
|
|
37
|
-
|
|
38
28
|
var List = function List(props) {
|
|
39
29
|
var _props$className = props.className,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
30
|
+
className = _props$className === void 0 ? "" : _props$className,
|
|
31
|
+
items = props.items,
|
|
32
|
+
idAttribute = props.idAttribute,
|
|
33
|
+
ListItem = props.ListItem,
|
|
34
|
+
showNoDataMsg = props.showNoDataMsg,
|
|
35
|
+
noDataComponent = props.noDataComponent,
|
|
36
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
48
37
|
if (!items.length && showNoDataMsg) {
|
|
49
38
|
return noDataComponent;
|
|
50
39
|
}
|
|
51
|
-
|
|
52
40
|
return /*#__PURE__*/_react["default"].createElement("ul", {
|
|
53
41
|
className: "RCB-list ".concat(className)
|
|
54
42
|
}, items.map(function (itemData, index) {
|
|
@@ -60,13 +48,11 @@ var List = function List(props) {
|
|
|
60
48
|
}, restProps));
|
|
61
49
|
}));
|
|
62
50
|
};
|
|
63
|
-
|
|
64
51
|
var DefaultNoDataComponent = function DefaultNoDataComponent() {
|
|
65
52
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
66
53
|
className: "RCB-no-data"
|
|
67
54
|
}, "No data found");
|
|
68
55
|
};
|
|
69
|
-
|
|
70
56
|
List.propTypes = {
|
|
71
57
|
/** Pass any additional classNames to List component */
|
|
72
58
|
className: _propTypes["default"].string,
|
|
@@ -75,7 +61,6 @@ List.propTypes = {
|
|
|
75
61
|
name: _propTypes["default"].any
|
|
76
62
|
})).isRequired,
|
|
77
63
|
idAttribute: _propTypes["default"].string,
|
|
78
|
-
|
|
79
64
|
/** Pass a custom ListItem component */
|
|
80
65
|
ListItem: _propTypes["default"].oneOfType([_propTypes["default"].instanceOf(Element), _propTypes["default"].func]),
|
|
81
66
|
noDataComponent: _propTypes["default"].any
|
package/components/List/index.js
CHANGED
|
@@ -4,10 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _List = _interopRequireDefault(require("./List"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
9
|
var _default = _List["default"];
|
|
13
10
|
exports["default"] = _default;
|
|
@@ -4,28 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.SimpleUsage = exports.CustomListItem = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _Constants = require("../../../public/Constants");
|
|
11
|
-
|
|
12
9
|
var _List = _interopRequireDefault(require("./List"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
|
|
16
11
|
var _default = {
|
|
17
12
|
title: "List"
|
|
18
13
|
};
|
|
19
14
|
exports["default"] = _default;
|
|
20
|
-
|
|
21
15
|
var SimpleUsage = function SimpleUsage() {
|
|
22
16
|
return /*#__PURE__*/_react["default"].createElement(_List["default"], {
|
|
23
17
|
items: _Constants.FRUITS_LIST
|
|
24
18
|
});
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
exports.SimpleUsage = SimpleUsage;
|
|
28
|
-
|
|
29
21
|
var CustomListItem = function CustomListItem() {
|
|
30
22
|
/* eslint-disable react/prop-types */
|
|
31
23
|
var ListItem = function ListItem(_ref) {
|
|
@@ -35,13 +27,11 @@ var CustomListItem = function CustomListItem() {
|
|
|
35
27
|
};
|
|
36
28
|
/* eslint-enable react/prop-types */
|
|
37
29
|
|
|
38
|
-
|
|
39
30
|
return /*#__PURE__*/_react["default"].createElement(_List["default"], {
|
|
40
31
|
items: _Constants.FRUITS_LIST,
|
|
41
32
|
ListItem: ListItem
|
|
42
33
|
});
|
|
43
34
|
};
|
|
44
|
-
|
|
45
35
|
exports.CustomListItem = CustomListItem;
|
|
46
36
|
CustomListItem.story = {
|
|
47
37
|
name: "Custom ListItem"
|
|
@@ -1,52 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
4
|
-
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
13
|
-
|
|
14
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
11
|
var _excluded = ["isOpen", "onClose"];
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
|
|
20
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
-
|
|
22
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
-
|
|
24
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
25
|
-
|
|
15
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
26
16
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
-
|
|
28
17
|
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."); }
|
|
29
|
-
|
|
30
18
|
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); }
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
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; }
|
|
35
|
-
|
|
19
|
+
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; }
|
|
20
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
36
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
|
-
|
|
38
22
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
39
|
-
|
|
40
23
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
41
|
-
|
|
42
24
|
var ModalContent = function ModalContent(props) {
|
|
43
25
|
var className = props.className,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
26
|
+
children = props.children,
|
|
27
|
+
title = props.title,
|
|
28
|
+
titleComponent = props.titleComponent,
|
|
29
|
+
showClose = props.showClose,
|
|
30
|
+
showHeader = props.showHeader,
|
|
31
|
+
hideModal = props.hideModal;
|
|
50
32
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
51
33
|
className: "RCB-modal ".concat(className)
|
|
52
34
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -62,7 +44,6 @@ var ModalContent = function ModalContent(props) {
|
|
|
62
44
|
className: "RCB-modal-content"
|
|
63
45
|
}, children)));
|
|
64
46
|
};
|
|
65
|
-
|
|
66
47
|
ModalContent.propTypes = {
|
|
67
48
|
/** Pass any additional classNames to Modal component */
|
|
68
49
|
className: _propTypes["default"].string,
|
|
@@ -72,37 +53,31 @@ ModalContent.propTypes = {
|
|
|
72
53
|
showHeader: _propTypes["default"].bool,
|
|
73
54
|
hideModal: _propTypes["default"].func
|
|
74
55
|
};
|
|
75
|
-
/** Displays a full screen modal */
|
|
76
56
|
|
|
57
|
+
/** Displays a full screen modal */
|
|
77
58
|
var Modal = function Modal(props, ref) {
|
|
78
59
|
var isOpen = props.isOpen,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
60
|
+
onClose = props.onClose,
|
|
61
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
82
62
|
var _useState = (0, _react.useState)(isOpen),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
63
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
64
|
+
isModalOpen = _useState2[0],
|
|
65
|
+
setIsModalOpen = _useState2[1];
|
|
87
66
|
var bodyElement = document.getElementsByTagName("body")[0];
|
|
88
|
-
|
|
89
67
|
var showModal = function showModal() {
|
|
90
68
|
setIsModalOpen(true);
|
|
91
69
|
};
|
|
92
|
-
|
|
93
70
|
var hideModal = function hideModal() {
|
|
94
71
|
setIsModalOpen(false);
|
|
95
|
-
|
|
96
72
|
if (typeof onClose === "function") {
|
|
97
73
|
onClose();
|
|
98
74
|
}
|
|
99
75
|
};
|
|
100
|
-
|
|
101
76
|
(0, _react.useEffect)(function () {
|
|
102
77
|
setIsModalOpen(isOpen);
|
|
103
78
|
}, [isOpen]);
|
|
104
|
-
/* add methods that can be accessed via this component's ref */
|
|
105
79
|
|
|
80
|
+
/* add methods that can be accessed via this component's ref */
|
|
106
81
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
107
82
|
return {
|
|
108
83
|
showModal: showModal,
|
|
@@ -113,27 +88,20 @@ var Modal = function Modal(props, ref) {
|
|
|
113
88
|
hideModal: hideModal
|
|
114
89
|
})), bodyElement) : null;
|
|
115
90
|
};
|
|
116
|
-
|
|
117
91
|
Modal = /*#__PURE__*/(0, _react.forwardRef)(Modal);
|
|
118
92
|
Modal.propTypes = {
|
|
119
93
|
/** Pass any additional classNames to Modal component */
|
|
120
94
|
className: _propTypes["default"].string,
|
|
121
|
-
|
|
122
95
|
/** Header or title for the modal */
|
|
123
96
|
title: _propTypes["default"].string,
|
|
124
|
-
|
|
125
97
|
/** Component to render as modal title. This will be given preference over "title" prop */
|
|
126
98
|
titleComponent: _propTypes["default"].element,
|
|
127
|
-
|
|
128
99
|
/** indicates if the modal should be opened by default */
|
|
129
100
|
isOpen: _propTypes["default"].bool,
|
|
130
|
-
|
|
131
101
|
/** indicates whether to show or hide the close button */
|
|
132
102
|
showClose: _propTypes["default"].bool,
|
|
133
|
-
|
|
134
103
|
/** indicates whether to show or hide the modal header */
|
|
135
104
|
showHeader: _propTypes["default"].bool,
|
|
136
|
-
|
|
137
105
|
/** callback function that gets called when the modal closes */
|
|
138
106
|
onClose: _propTypes["default"].func
|
|
139
107
|
};
|
|
@@ -1,36 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
4
|
-
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = exports.OpenByDefault = exports.ActivateOnClick = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _Modal = _interopRequireDefault(require("./Modal"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
|
|
16
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
|
|
18
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
20
13
|
var ModalExample = function ModalExample() {
|
|
21
14
|
return /*#__PURE__*/_react["default"].createElement(_Modal["default"], {
|
|
22
15
|
isOpen: true,
|
|
23
16
|
title: "This is the header"
|
|
24
17
|
}, /*#__PURE__*/_react["default"].createElement("div", null, "From inside a modal"));
|
|
25
18
|
};
|
|
26
|
-
|
|
27
19
|
var ModalClickExample = function ModalClickExample() {
|
|
28
20
|
var modalRef = (0, _react.useRef)();
|
|
29
|
-
|
|
30
21
|
var showModal = function showModal() {
|
|
31
22
|
modalRef.current.showModal();
|
|
32
23
|
};
|
|
33
|
-
|
|
34
24
|
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("a", {
|
|
35
25
|
href: "javascript:void(0)",
|
|
36
26
|
onClick: showModal
|
|
@@ -39,20 +29,16 @@ var ModalClickExample = function ModalClickExample() {
|
|
|
39
29
|
ref: modalRef
|
|
40
30
|
}, /*#__PURE__*/_react["default"].createElement("div", null, "From inside a modal")));
|
|
41
31
|
};
|
|
42
|
-
|
|
43
32
|
var ActivateOnClick = function ActivateOnClick() {
|
|
44
33
|
return /*#__PURE__*/_react["default"].createElement(ModalClickExample, null);
|
|
45
34
|
};
|
|
46
|
-
|
|
47
35
|
exports.ActivateOnClick = ActivateOnClick;
|
|
48
36
|
ActivateOnClick.story = {
|
|
49
37
|
name: "Activate on click"
|
|
50
38
|
};
|
|
51
|
-
|
|
52
39
|
var OpenByDefault = function OpenByDefault() {
|
|
53
40
|
return /*#__PURE__*/_react["default"].createElement(ModalExample, null);
|
|
54
41
|
};
|
|
55
|
-
|
|
56
42
|
exports.OpenByDefault = OpenByDefault;
|
|
57
43
|
OpenByDefault.story = {
|
|
58
44
|
name: "Open by default"
|
|
@@ -4,10 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _Modal = _interopRequireDefault(require("./Modal"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
9
|
var _default = _Modal["default"];
|
|
13
10
|
exports["default"] = _default;
|