@unbxd-ui/unbxd-react-components 0.2.105 → 0.2.107-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/.babelrc +4 -0
- package/.eslintrc.js +38 -0
- package/CONTRIBUTE.md +105 -0
- package/components/Accordian/Accordian.js +45 -13
- package/components/Accordian/Accordian.stories.js +25 -6
- package/components/Accordian/index.js +3 -0
- package/components/Button/Button.js +26 -9
- package/components/Button/Button.stories.js +14 -1
- package/components/Button/DropdownButton.js +31 -9
- package/components/Button/DropdownButton.stories.js +23 -6
- package/components/Button/index.js +8 -1
- package/components/DataLoader/DataLoader.js +40 -10
- package/components/DataLoader/DataLoader.stories.js +30 -5
- package/components/DataLoader/index.js +3 -0
- package/components/Form/Checkbox.js +42 -14
- package/components/Form/DragDropFileUploader.js +42 -12
- package/components/Form/Dropdown.js +181 -104
- package/components/Form/FileUploader.js +32 -10
- package/components/Form/Form.js +45 -15
- package/components/Form/FormElementWrapper.js +7 -2
- package/components/Form/Input.js +72 -27
- package/components/Form/RadioList.js +48 -17
- package/components/Form/RangeSlider.js +73 -37
- package/components/Form/ServerPaginatedDDList.js +130 -86
- package/components/Form/Textarea.js +43 -18
- package/components/Form/Toggle.js +48 -16
- package/components/Form/index.js +30 -18
- package/components/Form/stories/Checkbox.stories.js +12 -1
- package/components/Form/stories/DragDropFileUploader.stories.js +8 -0
- package/components/Form/stories/Dropdown.stories.js +24 -6
- package/components/Form/stories/FileUploader.stories.js +8 -0
- package/components/Form/stories/FormDefault.stories.js +21 -1
- package/components/Form/stories/RadioList.stories.js +12 -1
- package/components/Form/stories/RangeSlider.stories.js +15 -1
- package/components/Form/stories/TextInput.stories.js +19 -3
- package/components/Form/stories/Textarea.stories.js +12 -1
- package/components/Form/stories/Toggle.stories.js +7 -0
- package/components/Form/stories/form.stories.js +40 -3
- package/components/InlineModal/InlineModal.js +51 -14
- package/components/InlineModal/InlineModal.stories.js +14 -2
- package/components/InlineModal/index.js +6 -1
- package/components/List/List.js +24 -9
- package/components/List/index.js +3 -0
- package/components/List/list.stories.js +10 -0
- package/components/Modal/Modal.js +49 -17
- package/components/Modal/Modal.stories.js +15 -1
- package/components/Modal/index.js +3 -0
- package/components/NotificationComponent/NotificationComponent.js +34 -11
- package/components/NotificationComponent/NotificationComponent.stories.js +6 -0
- package/components/NotificationComponent/index.js +3 -0
- package/components/ProgressBar/ProgressBar.js +11 -2
- package/components/ProgressBar/ProgressBar.stories.js +6 -0
- package/components/ProgressBar/index.js +3 -0
- package/components/Table/BaseTable.js +134 -69
- package/components/Table/PaginationComponent.js +23 -11
- package/components/Table/Table.js +149 -68
- package/components/Table/Table.stories.js +67 -22
- package/components/Table/index.js +4 -0
- package/components/TabsComponent/TabsComponent.js +57 -20
- package/components/TabsComponent/TabsComponent.stories.js +16 -0
- package/components/TabsComponent/index.js +3 -0
- package/components/Tooltip/Tooltip.js +47 -25
- package/components/Tooltip/Tooltip.stories.js +6 -0
- package/components/Tooltip/index.js +3 -0
- package/components/core.css +1 -3
- package/components/index.js +17 -1
- package/components/theme.css +0 -2
- package/lib/Readme.md +82 -0
- package/lib/components/Accordian/Accordian.js +117 -0
- package/lib/components/Accordian/Accordian.stories.js +137 -0
- package/lib/components/Accordian/index.js +10 -0
- package/lib/components/Button/Button.js +84 -0
- package/lib/components/Button/Button.stories.js +89 -0
- package/lib/components/Button/DropdownButton.js +77 -0
- package/lib/components/Button/DropdownButton.stories.js +51 -0
- package/lib/components/Button/index.js +32 -0
- package/lib/components/DataLoader/DataLoader.js +88 -0
- package/lib/components/DataLoader/DataLoader.stories.js +77 -0
- package/lib/components/DataLoader/index.js +10 -0
- package/lib/components/Form/Checkbox.js +93 -0
- package/lib/components/Form/DragDropFileUploader.js +85 -0
- package/lib/components/Form/Dropdown.js +478 -0
- package/lib/components/Form/FileUploader.js +81 -0
- package/lib/components/Form/Form.js +106 -0
- package/lib/components/Form/FormElementWrapper.js +27 -0
- package/lib/components/Form/Input.js +140 -0
- package/lib/components/Form/RadioList.js +111 -0
- package/lib/components/Form/RangeSlider.js +142 -0
- package/lib/components/Form/ServerPaginatedDDList.js +267 -0
- package/lib/components/Form/Textarea.js +95 -0
- package/lib/components/Form/Toggle.js +117 -0
- package/lib/components/Form/index.js +73 -0
- package/lib/components/Form/stories/Checkbox.stories.js +54 -0
- package/lib/components/Form/stories/DragDropFileUploader.stories.js +27 -0
- package/lib/components/Form/stories/Dropdown.stories.js +114 -0
- package/lib/components/Form/stories/FileUploader.stories.js +31 -0
- package/lib/components/Form/stories/FormDefault.stories.js +117 -0
- package/lib/components/Form/stories/RadioList.stories.js +55 -0
- package/lib/components/Form/stories/RangeSlider.stories.js +82 -0
- package/lib/components/Form/stories/TextInput.stories.js +79 -0
- package/lib/components/Form/stories/Textarea.stories.js +48 -0
- package/lib/components/Form/stories/Toggle.stories.js +25 -0
- package/lib/components/Form/stories/form.stories.js +240 -0
- package/lib/components/InlineModal/InlineModal.js +146 -0
- package/lib/components/InlineModal/InlineModal.stories.js +61 -0
- package/lib/components/InlineModal/index.js +24 -0
- package/lib/components/List/List.js +76 -0
- package/lib/components/List/index.js +10 -0
- package/lib/components/List/list.stories.js +38 -0
- package/lib/components/Modal/Modal.js +117 -0
- package/lib/components/Modal/Modal.stories.js +55 -0
- package/lib/components/Modal/index.js +10 -0
- package/lib/components/NotificationComponent/NotificationComponent.js +76 -0
- package/lib/components/NotificationComponent/NotificationComponent.stories.js +29 -0
- package/lib/components/NotificationComponent/index.js +10 -0
- package/lib/components/ProgressBar/ProgressBar.js +49 -0
- package/lib/components/ProgressBar/ProgressBar.stories.js +21 -0
- package/lib/components/ProgressBar/index.js +10 -0
- package/lib/components/Table/BaseTable.js +352 -0
- package/lib/components/Table/PaginationComponent.js +87 -0
- package/lib/components/Table/Table.js +333 -0
- package/lib/components/Table/Table.stories.js +204 -0
- package/lib/components/Table/index.js +17 -0
- package/lib/components/TabsComponent/TabsComponent.js +134 -0
- package/lib/components/TabsComponent/TabsComponent.stories.js +65 -0
- package/lib/components/TabsComponent/index.js +10 -0
- package/lib/components/Tooltip/Tooltip.js +102 -0
- package/lib/components/Tooltip/Tooltip.stories.js +25 -0
- package/lib/components/Tooltip/index.js +10 -0
- package/lib/components/core.css +3 -0
- package/lib/components/core.scss +29 -0
- package/lib/components/index.js +159 -0
- package/lib/components/theme.css +3 -0
- package/lib/components/theme.scss +11 -0
- package/lib/package-lock.json +20607 -0
- package/lib/package.json +94 -0
- package/package.json +1 -1
- package/src/Intro.stories.mdx +119 -0
- package/src/components/Accordian/Accordian.js +89 -0
- package/src/components/Accordian/Accordian.stories.js +92 -0
- package/src/components/Accordian/accordianCore.css +1 -0
- package/src/components/Accordian/accordianCore.scss +8 -0
- package/src/components/Accordian/accordianTheme.css +1 -0
- package/src/components/Accordian/accordianTheme.scss +6 -0
- package/src/components/Accordian/index.js +3 -0
- package/src/components/Button/Button.js +67 -0
- package/src/components/Button/Button.stories.js +103 -0
- package/src/components/Button/DropdownButton.js +60 -0
- package/src/components/Button/DropdownButton.stories.js +38 -0
- package/src/components/Button/button.css +1 -0
- package/src/components/Button/buttonTheme.css +1 -0
- package/src/components/Button/buttonTheme.scss +45 -0
- package/src/components/Button/index.js +5 -0
- package/src/components/DataLoader/DataLoader.js +86 -0
- package/src/components/DataLoader/DataLoader.stories.js +72 -0
- package/src/components/DataLoader/index.js +3 -0
- package/src/components/Form/Checkbox.js +73 -0
- package/src/components/Form/DragDropFileUploader.js +67 -0
- package/src/components/Form/Dropdown.js +430 -0
- package/src/components/Form/FileUploader.js +64 -0
- package/src/components/Form/Form.js +83 -0
- package/src/components/Form/FormElementWrapper.js +22 -0
- package/src/components/Form/Input.js +121 -0
- package/src/components/Form/RadioList.js +86 -0
- package/src/components/Form/RangeSlider.js +100 -0
- package/src/components/Form/ServerPaginatedDDList.js +231 -0
- package/src/components/Form/Textarea.js +76 -0
- package/src/components/Form/Toggle.js +96 -0
- package/src/components/Form/form.css +1 -0
- package/src/components/Form/formCore.css +1 -0
- package/src/components/Form/formCore.scss +142 -0
- package/src/components/Form/formTheme.css +1 -0
- package/src/components/Form/formTheme.scss +27 -0
- package/src/components/Form/index.js +13 -0
- package/src/components/Form/stories/Checkbox.stories.js +41 -0
- package/src/components/Form/stories/DragDropFileUploader.stories.js +21 -0
- package/src/components/Form/stories/Dropdown.stories.js +124 -0
- package/src/components/Form/stories/FileUploader.stories.js +21 -0
- package/src/components/Form/stories/FormDefault.stories.js +87 -0
- package/src/components/Form/stories/RadioList.stories.js +48 -0
- package/src/components/Form/stories/RangeSlider.stories.js +84 -0
- package/src/components/Form/stories/TextInput.stories.js +77 -0
- package/src/components/Form/stories/Textarea.stories.js +43 -0
- package/src/components/Form/stories/Toggle.stories.js +14 -0
- package/src/components/Form/stories/form.stories.js +216 -0
- package/src/components/InlineModal/InlineModal.js +135 -0
- package/src/components/InlineModal/InlineModal.stories.js +54 -0
- package/src/components/InlineModal/index.js +4 -0
- package/src/components/InlineModal/inlineModal.css +1 -0
- package/src/components/InlineModal/inlineModalCore.css +1 -0
- package/src/components/InlineModal/inlineModalCore.scss +31 -0
- package/src/components/InlineModal/inlineModalTheme.css +1 -0
- package/src/components/InlineModal/inlineModalTheme.scss +16 -0
- package/src/components/List/List.js +72 -0
- package/src/components/List/index.js +3 -0
- package/src/components/List/list.css +1 -0
- package/src/components/List/list.stories.js +28 -0
- package/src/components/List/listCore.css +1 -0
- package/src/components/List/listCore.scss +6 -0
- package/src/components/List/listTheme.css +0 -0
- package/src/components/List/listTheme.scss +0 -0
- package/src/components/Modal/Modal.js +99 -0
- package/src/components/Modal/Modal.stories.js +54 -0
- package/src/components/Modal/index.js +3 -0
- package/src/components/Modal/modal.css +1 -0
- package/src/components/Modal/modalCore.css +1 -0
- package/src/components/Modal/modalCore.scss +34 -0
- package/src/components/Modal/modalTheme.css +0 -0
- package/src/components/Modal/modalTheme.scss +0 -0
- package/src/components/NotificationComponent/NotificationComponent.js +58 -0
- package/src/components/NotificationComponent/NotificationComponent.stories.js +28 -0
- package/src/components/NotificationComponent/index.js +3 -0
- package/src/components/NotificationComponent/notificationComponent.css +1 -0
- package/src/components/NotificationComponent/notificationTheme.css +1 -0
- package/src/components/NotificationComponent/notificationTheme.scss +30 -0
- package/src/components/ProgressBar/ProgressBar.js +45 -0
- package/src/components/ProgressBar/ProgressBar.stories.js +14 -0
- package/src/components/ProgressBar/index.js +3 -0
- package/src/components/ProgressBar/progressBar.css +1 -0
- package/src/components/ProgressBar/progressBarCore.css +1 -0
- package/src/components/ProgressBar/progressBarCore.scss +14 -0
- package/src/components/ProgressBar/progressBarTheme.css +0 -0
- package/src/components/ProgressBar/progressBarTheme.scss +0 -0
- package/src/components/Table/BaseTable.js +306 -0
- package/src/components/Table/PaginationComponent.js +73 -0
- package/src/components/Table/Table.js +295 -0
- package/src/components/Table/Table.stories.js +198 -0
- package/src/components/Table/index.js +8 -0
- package/src/components/Table/table.css +1 -0
- package/src/components/Table/tableCore.css +1 -0
- package/src/components/Table/tableCore.scss +94 -0
- package/src/components/Table/tableTheme.css +1 -0
- package/src/components/Table/tableTheme.scss +34 -0
- package/src/components/TabsComponent/TabsComponent.js +99 -0
- package/src/components/TabsComponent/TabsComponent.stories.js +69 -0
- package/src/components/TabsComponent/index.js +3 -0
- package/src/components/TabsComponent/tabs.css +1 -0
- package/src/components/TabsComponent/tabsCore.css +1 -0
- package/src/components/TabsComponent/tabsCore.scss +59 -0
- package/src/components/TabsComponent/tabsTheme.css +0 -0
- package/src/components/TabsComponent/tabsTheme.scss +0 -0
- package/src/components/Tooltip/Tooltip.js +87 -0
- package/src/components/Tooltip/Tooltip.stories.js +16 -0
- package/src/components/Tooltip/index.js +3 -0
- package/src/components/Tooltip/tooltipCore.css +1 -0
- package/src/components/Tooltip/tooltipCore.scss +22 -0
- package/src/components/Tooltip/tooltipTheme.css +1 -0
- package/src/components/Tooltip/tooltipTheme.scss +21 -0
- package/src/components/core.css +1 -0
- package/src/components/core.scss +29 -0
- package/src/components/index.js +38 -0
- package/src/components/theme.css +1 -0
- package/src/components/theme.scss +11 -0
- package/src/core/Validators.js +34 -0
- package/src/core/customHooks.js +20 -0
- package/src/core/dataLoader.js +143 -0
- package/src/core/dataLoader.stories.js +123 -0
- package/src/core/index.js +3 -0
- package/src/core/utils.js +95 -0
- package/src/index.js +68 -0
- package/vscode-templates/NewStoryTemplate.stories.js +8 -0
- /package/{Readme.md → README.md} +0 -0
- /package/{components → lib/components}/Accordian/accordianCore.css +0 -0
- /package/{components → lib/components}/Accordian/accordianTheme.css +0 -0
- /package/{components → lib/components}/Button/buttonTheme.css +0 -0
- /package/{components → lib/components}/Form/formCore.css +0 -0
- /package/{components → lib/components}/Form/formTheme.css +0 -0
- /package/{components → lib/components}/InlineModal/inlineModalCore.css +0 -0
- /package/{components → lib/components}/InlineModal/inlineModalTheme.css +0 -0
- /package/{components → lib/components}/List/listCore.css +0 -0
- /package/{components → lib/components}/List/listTheme.css +0 -0
- /package/{components → lib/components}/Modal/modalCore.css +0 -0
- /package/{components → lib/components}/Modal/modalTheme.css +0 -0
- /package/{components → lib/components}/NotificationComponent/notificationTheme.css +0 -0
- /package/{components → lib/components}/ProgressBar/progressBarCore.css +0 -0
- /package/{components → lib/components}/ProgressBar/progressBarTheme.css +0 -0
- /package/{components → lib/components}/Table/tableCore.css +0 -0
- /package/{components → lib/components}/Table/tableTheme.css +0 -0
- /package/{components → lib/components}/TabsComponent/tabsCore.css +0 -0
- /package/{components → lib/components}/TabsComponent/tabsTheme.css +0 -0
- /package/{components → lib/components}/Tooltip/tooltipCore.css +0 -0
- /package/{components → lib/components}/Tooltip/tooltipTheme.css +0 -0
- /package/{core → lib/core}/Validators.js +0 -0
- /package/{core → lib/core}/customHooks.js +0 -0
- /package/{core → lib/core}/dataLoader.js +0 -0
- /package/{core → lib/core}/dataLoader.stories.js +0 -0
- /package/{core → lib/core}/index.js +0 -0
- /package/{core → lib/core}/utils.js +0 -0
- /package/{index.js → lib/index.js} +0 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = exports._Toggle = exports._FileUploader = exports._Dropdown = exports._DragDropFileUploader = exports.GetFormData = exports.FormExample = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _Form = _interopRequireDefault(require("../Form"));
|
|
10
|
+
var _Dropdown2 = _interopRequireDefault(require("../Dropdown"));
|
|
11
|
+
var _Input = _interopRequireDefault(require("../Input"));
|
|
12
|
+
var _Textarea = _interopRequireDefault(require("../Textarea"));
|
|
13
|
+
var _RadioList = _interopRequireDefault(require("../RadioList"));
|
|
14
|
+
var _Checkbox = _interopRequireDefault(require("../Checkbox"));
|
|
15
|
+
var _FileUploader2 = _interopRequireDefault(require("../FileUploader"));
|
|
16
|
+
var _DragDropFileUploader2 = _interopRequireDefault(require("../DragDropFileUploader"));
|
|
17
|
+
var _Toggle2 = _interopRequireDefault(require("../Toggle"));
|
|
18
|
+
var _RangeSlider = _interopRequireDefault(require("../RangeSlider"));
|
|
19
|
+
var _Button = _interopRequireWildcard(require("../../Button"));
|
|
20
|
+
var _Constants = require("../../../../public/Constants");
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
22
|
+
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); }
|
|
23
|
+
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; }
|
|
24
|
+
var FormExample = function FormExample() {
|
|
25
|
+
var onSubmit = function onSubmit(formData) {
|
|
26
|
+
var data = formData.data,
|
|
27
|
+
_formData$errors = formData.errors,
|
|
28
|
+
errors = _formData$errors === void 0 ? {} : _formData$errors;
|
|
29
|
+
if (Object.keys(errors).length) {
|
|
30
|
+
console.log("ERRORS FOUND : ");
|
|
31
|
+
console.log(errors);
|
|
32
|
+
} else {
|
|
33
|
+
console.log("Submitted data: ", data);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
return /*#__PURE__*/_react["default"].createElement(_Form["default"], {
|
|
37
|
+
onSubmit: onSubmit
|
|
38
|
+
}, /*#__PURE__*/_react["default"].createElement(_Input["default"], {
|
|
39
|
+
type: "text",
|
|
40
|
+
name: "email",
|
|
41
|
+
label: "Name",
|
|
42
|
+
placeholder: "Enter your email",
|
|
43
|
+
appearance: "block"
|
|
44
|
+
}), /*#__PURE__*/_react["default"].createElement(_Textarea["default"], {
|
|
45
|
+
name: "description",
|
|
46
|
+
label: "Description",
|
|
47
|
+
placeholder: "Enter your description",
|
|
48
|
+
appearance: "block"
|
|
49
|
+
}), /*#__PURE__*/_react["default"].createElement(_RadioList["default"], {
|
|
50
|
+
name: "yesNoOption",
|
|
51
|
+
label: "Are you sure?",
|
|
52
|
+
options: [{
|
|
53
|
+
id: "YES",
|
|
54
|
+
name: "Yes"
|
|
55
|
+
}, {
|
|
56
|
+
id: "NO",
|
|
57
|
+
name: "No"
|
|
58
|
+
}],
|
|
59
|
+
appearance: "block"
|
|
60
|
+
}), /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
61
|
+
name: "orange",
|
|
62
|
+
label: "Orange"
|
|
63
|
+
}), /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
64
|
+
name: "pineapple",
|
|
65
|
+
label: "Pineapple",
|
|
66
|
+
value: true,
|
|
67
|
+
onChange: function onChange() {}
|
|
68
|
+
}), /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
69
|
+
name: "grapes",
|
|
70
|
+
label: "Grapes"
|
|
71
|
+
}), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement(_Dropdown2["default"], {
|
|
72
|
+
name: "fruit",
|
|
73
|
+
label: "Select fruit",
|
|
74
|
+
options: _Constants.FRUITS_LIST,
|
|
75
|
+
appearance: "block",
|
|
76
|
+
validations: [{
|
|
77
|
+
type: "REQUIRED",
|
|
78
|
+
message: "Please select a fruit"
|
|
79
|
+
}]
|
|
80
|
+
}), /*#__PURE__*/_react["default"].createElement(_Toggle2["default"], {
|
|
81
|
+
label: "Is Active?",
|
|
82
|
+
name: "isActive",
|
|
83
|
+
appearance: "block"
|
|
84
|
+
}), /*#__PURE__*/_react["default"].createElement(_RangeSlider["default"], {
|
|
85
|
+
name: "price",
|
|
86
|
+
label: "Select price range",
|
|
87
|
+
min: "10",
|
|
88
|
+
max: "100",
|
|
89
|
+
appearance: "block",
|
|
90
|
+
defaultValue: "10"
|
|
91
|
+
}), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
92
|
+
appearance: _Button.ButtonAppearance.PRIMARY,
|
|
93
|
+
className: "full-width-btn"
|
|
94
|
+
}, "Submit"));
|
|
95
|
+
};
|
|
96
|
+
exports.FormExample = FormExample;
|
|
97
|
+
FormExample.story = {
|
|
98
|
+
name: "Form"
|
|
99
|
+
};
|
|
100
|
+
var _Dropdown = function _Dropdown() {
|
|
101
|
+
var onSubmit = function onSubmit(formData) {
|
|
102
|
+
var data = formData.data;
|
|
103
|
+
var fruit = data.fruit;
|
|
104
|
+
console.log("Selected Fruit: ", fruit);
|
|
105
|
+
};
|
|
106
|
+
return /*#__PURE__*/_react["default"].createElement(_Form["default"], {
|
|
107
|
+
onSubmit: onSubmit
|
|
108
|
+
}, /*#__PURE__*/_react["default"].createElement(_Dropdown2["default"], {
|
|
109
|
+
name: "fruit",
|
|
110
|
+
label: "Select fruit",
|
|
111
|
+
options: _Constants.FRUITS_LIST,
|
|
112
|
+
appearance: "block"
|
|
113
|
+
}), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
114
|
+
appearance: _Button.ButtonAppearance.PRIMARY,
|
|
115
|
+
className: "full-width-btn"
|
|
116
|
+
}, "Submit"));
|
|
117
|
+
};
|
|
118
|
+
exports._Dropdown = _Dropdown;
|
|
119
|
+
_Dropdown.story = {
|
|
120
|
+
name: "Dropdown ",
|
|
121
|
+
parameters: {
|
|
122
|
+
info: {
|
|
123
|
+
propTables: [_Dropdown2["default"]]
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
var _FileUploader = function _FileUploader() {
|
|
128
|
+
var onSubmit = function onSubmit(formData) {
|
|
129
|
+
var data = formData.data;
|
|
130
|
+
var file = data.file;
|
|
131
|
+
console.log("Selected file: ", file[0].name);
|
|
132
|
+
};
|
|
133
|
+
return /*#__PURE__*/_react["default"].createElement(_Form["default"], {
|
|
134
|
+
onSubmit: onSubmit
|
|
135
|
+
}, /*#__PURE__*/_react["default"].createElement(_FileUploader2["default"], {
|
|
136
|
+
name: "file",
|
|
137
|
+
appearance: "block"
|
|
138
|
+
}, /*#__PURE__*/_react["default"].createElement("a", {
|
|
139
|
+
href: "javascript:void(0)"
|
|
140
|
+
}, "Upload File")), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
141
|
+
appearance: _Button.ButtonAppearance.PRIMARY,
|
|
142
|
+
className: "full-width-btn"
|
|
143
|
+
}, "Submit"));
|
|
144
|
+
};
|
|
145
|
+
exports._FileUploader = _FileUploader;
|
|
146
|
+
_FileUploader.story = {
|
|
147
|
+
name: "File Uploader ",
|
|
148
|
+
parameters: {
|
|
149
|
+
info: {
|
|
150
|
+
propTables: [_FileUploader2["default"]]
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
var _DragDropFileUploader = function _DragDropFileUploader() {
|
|
155
|
+
var onSubmit = function onSubmit(formData) {
|
|
156
|
+
var data = formData.data;
|
|
157
|
+
var filesList = data.filesList;
|
|
158
|
+
console.log("Selected file: ", filesList[0].name);
|
|
159
|
+
};
|
|
160
|
+
return /*#__PURE__*/_react["default"].createElement(_Form["default"], {
|
|
161
|
+
onSubmit: onSubmit
|
|
162
|
+
}, /*#__PURE__*/_react["default"].createElement(_DragDropFileUploader2["default"], {
|
|
163
|
+
name: "filesList",
|
|
164
|
+
appearance: "block"
|
|
165
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "Drag & drop files into this area")), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
166
|
+
appearance: _Button.ButtonAppearance.PRIMARY,
|
|
167
|
+
className: "full-width-btn"
|
|
168
|
+
}, "Submit"));
|
|
169
|
+
};
|
|
170
|
+
exports._DragDropFileUploader = _DragDropFileUploader;
|
|
171
|
+
_DragDropFileUploader.story = {
|
|
172
|
+
name: "DragDrop File Uploader ",
|
|
173
|
+
parameters: {
|
|
174
|
+
info: {
|
|
175
|
+
propTables: [_DragDropFileUploader2["default"]]
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
var _Toggle = function _Toggle() {
|
|
180
|
+
var onSubmit = function onSubmit(formData) {
|
|
181
|
+
var data = formData.data;
|
|
182
|
+
var isActive = data.isActive;
|
|
183
|
+
console.log("isActive: ", isActive);
|
|
184
|
+
};
|
|
185
|
+
return /*#__PURE__*/_react["default"].createElement(_Form["default"], {
|
|
186
|
+
onSubmit: onSubmit
|
|
187
|
+
}, /*#__PURE__*/_react["default"].createElement(_Toggle2["default"], {
|
|
188
|
+
label: "Is Active?",
|
|
189
|
+
name: "isActive",
|
|
190
|
+
appearance: "block"
|
|
191
|
+
}), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
192
|
+
appearance: _Button.ButtonAppearance.PRIMARY,
|
|
193
|
+
className: "full-width-btn"
|
|
194
|
+
}, "Submit"));
|
|
195
|
+
};
|
|
196
|
+
exports._Toggle = _Toggle;
|
|
197
|
+
_Toggle.story = {
|
|
198
|
+
name: "Toggle ",
|
|
199
|
+
parameters: {
|
|
200
|
+
info: {
|
|
201
|
+
propTables: [_Toggle2["default"]]
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
var GetFormData = function GetFormData() {
|
|
206
|
+
var formRef = (0, _react.useRef)();
|
|
207
|
+
var submitFormData = function submitFormData() {
|
|
208
|
+
var formData = formRef.current.getFormData();
|
|
209
|
+
var data = formData.data;
|
|
210
|
+
console.log("Got data", data);
|
|
211
|
+
};
|
|
212
|
+
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, /*#__PURE__*/_react["default"].createElement(_Form["default"], {
|
|
213
|
+
ref: formRef
|
|
214
|
+
}, /*#__PURE__*/_react["default"].createElement(_Input["default"], {
|
|
215
|
+
name: "name",
|
|
216
|
+
label: "Enter name"
|
|
217
|
+
}), /*#__PURE__*/_react["default"].createElement(_Input["default"], {
|
|
218
|
+
name: "email",
|
|
219
|
+
label: "Enter Email ID"
|
|
220
|
+
}), /*#__PURE__*/_react["default"].createElement(_Dropdown2["default"], {
|
|
221
|
+
name: "fruit",
|
|
222
|
+
label: "Select fruit",
|
|
223
|
+
options: _Constants.FRUITS_LIST,
|
|
224
|
+
appearance: "block"
|
|
225
|
+
})), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
226
|
+
appearance: _Button.ButtonAppearance.PRIMARY,
|
|
227
|
+
className: "full-width-btn",
|
|
228
|
+
onClick: submitFormData
|
|
229
|
+
}, "Click to submit"));
|
|
230
|
+
};
|
|
231
|
+
exports.GetFormData = GetFormData;
|
|
232
|
+
var _default = {
|
|
233
|
+
title: "Form|Miscellanious",
|
|
234
|
+
parameters: {
|
|
235
|
+
info: {
|
|
236
|
+
propTables: [_Form["default"]]
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = exports.InlineModalBody = exports.InlineModalActivator = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
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); }
|
|
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; }
|
|
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); }
|
|
14
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _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(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); }
|
|
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; } }
|
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
+
var InlineModalActivator = function InlineModalActivator(props) {
|
|
21
|
+
return props.children;
|
|
22
|
+
};
|
|
23
|
+
exports.InlineModalActivator = InlineModalActivator;
|
|
24
|
+
var InlineModalBody = function InlineModalBody(props) {
|
|
25
|
+
return props.children;
|
|
26
|
+
};
|
|
27
|
+
exports.InlineModalBody = InlineModalBody;
|
|
28
|
+
var InlineModal = function InlineModal(props, ref) {
|
|
29
|
+
var children = props.children,
|
|
30
|
+
activatorAction = props.activatorAction,
|
|
31
|
+
className = props.className,
|
|
32
|
+
propIsOpen = props.isModalOpen,
|
|
33
|
+
halign = props.halign,
|
|
34
|
+
onModalStateChange = props.onModalStateChange;
|
|
35
|
+
var _useState = (0, _react.useState)(propIsOpen),
|
|
36
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
+
isModalOpen = _useState2[0],
|
|
38
|
+
setIsModalOpen = _useState2[1];
|
|
39
|
+
var activatorProps = {};
|
|
40
|
+
var inlineModalClassName = "RCB-inline-modal ".concat(className);
|
|
41
|
+
var showModalBody = isModalOpen;
|
|
42
|
+
var inlineModalRef = (0, _react.useRef)();
|
|
43
|
+
var isFirstRun = (0, _react.useRef)(true);
|
|
44
|
+
var changeModalState = function changeModalState(newState) {
|
|
45
|
+
setIsModalOpen(newState);
|
|
46
|
+
};
|
|
47
|
+
var onActivatorClick = function onActivatorClick(e) {
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
changeModalState(!isModalOpen);
|
|
50
|
+
};
|
|
51
|
+
var onBodyClick = function onBodyClick(e) {
|
|
52
|
+
var eventTarget = e.target;
|
|
53
|
+
var inlineModalNode = inlineModalRef.current;
|
|
54
|
+
var eventPathNodes = e.composedPath();
|
|
55
|
+
var isWithinModal = false;
|
|
56
|
+
if (inlineModalNode.contains(eventTarget)) {
|
|
57
|
+
isWithinModal = true;
|
|
58
|
+
} else {
|
|
59
|
+
for (var i = 0; i < eventPathNodes.length; i++) {
|
|
60
|
+
var node = eventPathNodes[i];
|
|
61
|
+
if (node !== window && inlineModalNode.contains(node)) {
|
|
62
|
+
isWithinModal = true;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (!isWithinModal) {
|
|
68
|
+
/* outside click -> close modal */
|
|
69
|
+
changeModalState(false);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
(0, _react.useEffect)(function () {
|
|
73
|
+
/* add when mounted */
|
|
74
|
+
document.addEventListener("click", onBodyClick);
|
|
75
|
+
|
|
76
|
+
/* return function to be called when unmounted */
|
|
77
|
+
return function () {
|
|
78
|
+
document.removeEventListener("click", onBodyClick);
|
|
79
|
+
};
|
|
80
|
+
}, []);
|
|
81
|
+
(0, _react.useEffect)(function () {
|
|
82
|
+
if (isFirstRun.current) {
|
|
83
|
+
/* skip first run */
|
|
84
|
+
isFirstRun.current = false;
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
typeof onModalStateChange === "function" && onModalStateChange(isModalOpen);
|
|
88
|
+
}, [isModalOpen]);
|
|
89
|
+
if (activatorAction === "click") {
|
|
90
|
+
activatorProps = {
|
|
91
|
+
onClick: onActivatorClick
|
|
92
|
+
};
|
|
93
|
+
} else if (activatorAction === "hover") {
|
|
94
|
+
inlineModalClassName += " hover-open";
|
|
95
|
+
showModalBody = true;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* add methods that can be accessed via this component's ref */
|
|
99
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
|
100
|
+
return {
|
|
101
|
+
hideModal: function hideModal() {
|
|
102
|
+
changeModalState(false);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
107
|
+
className: inlineModalClassName,
|
|
108
|
+
ref: inlineModalRef
|
|
109
|
+
}, /*#__PURE__*/_react["default"].createElement("div", _extends({}, activatorProps, {
|
|
110
|
+
className: "RCB-inline-modal-btn"
|
|
111
|
+
}), children[0]), showModalBody && /*#__PURE__*/_react["default"].createElement("div", {
|
|
112
|
+
className: "RCB-inline-modal-body RCB-align-".concat(halign)
|
|
113
|
+
}, children[1]));
|
|
114
|
+
};
|
|
115
|
+
InlineModal = /*#__PURE__*/(0, _react.forwardRef)(InlineModal);
|
|
116
|
+
InlineModal.propTypes = {
|
|
117
|
+
/** Pass any additional classNames to InlineModal component */
|
|
118
|
+
className: _propTypes["default"].string,
|
|
119
|
+
/** Horizontal alignment of the inline modal body */
|
|
120
|
+
halign: _propTypes["default"].oneOf(["left", "right"]),
|
|
121
|
+
/** Event on which the modal should be opened */
|
|
122
|
+
activatorAction: _propTypes["default"].oneOf(["click", "hover"]),
|
|
123
|
+
children: function children(props, propName, componentName) {
|
|
124
|
+
var children = props[propName];
|
|
125
|
+
if (_react["default"].Children.count(children) !== 2) {
|
|
126
|
+
return new Error("".concat(componentName, " should have 2 children"));
|
|
127
|
+
}
|
|
128
|
+
if (children[0].type !== InlineModalActivator || children[1].type !== InlineModalBody) {
|
|
129
|
+
return new Error("".concat(componentName, " should have an InlineModalActivator & InlineModalBody components as children"));
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
/** Boolean prop to have the modal open or close */
|
|
133
|
+
isModalOpen: _propTypes["default"].bool,
|
|
134
|
+
/** callback function that gets called when the modal state changes (either opens or closes) */
|
|
135
|
+
onModalStateChange: _propTypes["default"].func
|
|
136
|
+
};
|
|
137
|
+
InlineModal.defaultProps = {
|
|
138
|
+
className: "",
|
|
139
|
+
halign: "left",
|
|
140
|
+
activatorAction: "click",
|
|
141
|
+
// or "hover"
|
|
142
|
+
isModalOpen: false
|
|
143
|
+
};
|
|
144
|
+
InlineModal.displayName = "InlineModal";
|
|
145
|
+
var _default = InlineModal;
|
|
146
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = exports.SimpleUsage = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _addonLinks = require("@storybook/addon-links");
|
|
10
|
+
var _Constants = require("../../../public/Constants");
|
|
11
|
+
var _InlineModal = _interopRequireWildcard(require("./InlineModal"));
|
|
12
|
+
var _ = require("../");
|
|
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); }
|
|
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; }
|
|
15
|
+
/* eslint-disable react/prop-types */
|
|
16
|
+
var CustomListItem = function CustomListItem(props) {
|
|
17
|
+
var itemData = props.itemData;
|
|
18
|
+
var id = itemData.id,
|
|
19
|
+
name = itemData.name;
|
|
20
|
+
return /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("input", {
|
|
21
|
+
type: "checkbox",
|
|
22
|
+
id: id
|
|
23
|
+
}), /*#__PURE__*/_react["default"].createElement("label", {
|
|
24
|
+
htmlFor: id
|
|
25
|
+
}, name));
|
|
26
|
+
};
|
|
27
|
+
/* eslint-enable react/prop-types */
|
|
28
|
+
|
|
29
|
+
var SimpleUsage = function SimpleUsage() {
|
|
30
|
+
var onModalStateChange = function onModalStateChange(isModalOpen) {
|
|
31
|
+
console.log("Modal state change 1");
|
|
32
|
+
console.log({
|
|
33
|
+
isModalOpen: isModalOpen
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, /*#__PURE__*/_react["default"].createElement(_InlineModal["default"], {
|
|
37
|
+
onModalStateChange: onModalStateChange
|
|
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, {
|
|
39
|
+
items: _Constants.FRUITS_LIST,
|
|
40
|
+
showApp: (0, _addonLinks.linkTo)("List"),
|
|
41
|
+
ListItem: CustomListItem
|
|
42
|
+
}))));
|
|
43
|
+
};
|
|
44
|
+
exports.SimpleUsage = SimpleUsage;
|
|
45
|
+
SimpleUsage.story = {
|
|
46
|
+
parameters: {
|
|
47
|
+
info: {
|
|
48
|
+
text: "Displaying a dropdown list of items"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var _default = {
|
|
53
|
+
title: "Modals|Inline modal",
|
|
54
|
+
parameters: {
|
|
55
|
+
info: {
|
|
56
|
+
propTables: [_InlineModal["default"], _InlineModal.InlineModalActivator, _InlineModal.InlineModalBody],
|
|
57
|
+
propTablesExclude: [_.List]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "InlineModalActivator", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _InlineModal.InlineModalActivator;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "InlineModalBody", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _InlineModal.InlineModalBody;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
exports["default"] = void 0;
|
|
20
|
+
var _InlineModal = _interopRequireWildcard(require("./InlineModal"));
|
|
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); }
|
|
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; }
|
|
23
|
+
var _default = _InlineModal["default"];
|
|
24
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,76 @@
|
|
|
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 _excluded = ["className", "items", "idAttribute", "ListItem", "showNoDataMsg", "noDataComponent"];
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
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); }
|
|
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; }
|
|
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; }
|
|
14
|
+
var ListItem = function ListItem(props) {
|
|
15
|
+
var _props$itemData = props.itemData,
|
|
16
|
+
itemData = _props$itemData === void 0 ? {} : _props$itemData;
|
|
17
|
+
var name = itemData.name;
|
|
18
|
+
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
19
|
+
className: "RCB-list-item"
|
|
20
|
+
}, name);
|
|
21
|
+
};
|
|
22
|
+
ListItem.propTypes = {
|
|
23
|
+
itemData: _propTypes["default"].shape({
|
|
24
|
+
id: _propTypes["default"].string.isRequired,
|
|
25
|
+
name: _propTypes["default"].string.isRequired
|
|
26
|
+
}).isRequired
|
|
27
|
+
};
|
|
28
|
+
var List = function List(props) {
|
|
29
|
+
var _props$className = props.className,
|
|
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);
|
|
37
|
+
if (!items.length && showNoDataMsg) {
|
|
38
|
+
return noDataComponent;
|
|
39
|
+
}
|
|
40
|
+
return /*#__PURE__*/_react["default"].createElement("ul", {
|
|
41
|
+
className: "RCB-list ".concat(className)
|
|
42
|
+
}, items.map(function (itemData, index) {
|
|
43
|
+
return /*#__PURE__*/_react["default"].createElement(ListItem, _extends({
|
|
44
|
+
itemData: itemData,
|
|
45
|
+
index: index,
|
|
46
|
+
key: itemData[idAttribute],
|
|
47
|
+
idAttribute: idAttribute
|
|
48
|
+
}, restProps));
|
|
49
|
+
}));
|
|
50
|
+
};
|
|
51
|
+
var DefaultNoDataComponent = function DefaultNoDataComponent() {
|
|
52
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
53
|
+
className: "RCB-no-data"
|
|
54
|
+
}, "No data found");
|
|
55
|
+
};
|
|
56
|
+
List.propTypes = {
|
|
57
|
+
/** Pass any additional classNames to List component */
|
|
58
|
+
className: _propTypes["default"].string,
|
|
59
|
+
items: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
60
|
+
id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
|
61
|
+
name: _propTypes["default"].any
|
|
62
|
+
})).isRequired,
|
|
63
|
+
idAttribute: _propTypes["default"].string,
|
|
64
|
+
/** Pass a custom ListItem component */
|
|
65
|
+
ListItem: _propTypes["default"].oneOfType([_propTypes["default"].instanceOf(Element), _propTypes["default"].func]),
|
|
66
|
+
noDataComponent: _propTypes["default"].any
|
|
67
|
+
};
|
|
68
|
+
List.defaultProps = {
|
|
69
|
+
className: "",
|
|
70
|
+
items: [],
|
|
71
|
+
idAttribute: "id",
|
|
72
|
+
ListItem: ListItem,
|
|
73
|
+
noDataComponent: /*#__PURE__*/_react["default"].createElement(DefaultNoDataComponent, null)
|
|
74
|
+
};
|
|
75
|
+
var _default = List;
|
|
76
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _List = _interopRequireDefault(require("./List"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
+
var _default = _List["default"];
|
|
10
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.SimpleUsage = exports.CustomListItem = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _Constants = require("../../../public/Constants");
|
|
9
|
+
var _List = _interopRequireDefault(require("./List"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
var _default = {
|
|
12
|
+
title: "List"
|
|
13
|
+
};
|
|
14
|
+
exports["default"] = _default;
|
|
15
|
+
var SimpleUsage = function SimpleUsage() {
|
|
16
|
+
return /*#__PURE__*/_react["default"].createElement(_List["default"], {
|
|
17
|
+
items: _Constants.FRUITS_LIST
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
exports.SimpleUsage = SimpleUsage;
|
|
21
|
+
var CustomListItem = function CustomListItem() {
|
|
22
|
+
/* eslint-disable react/prop-types */
|
|
23
|
+
var ListItem = function ListItem(_ref) {
|
|
24
|
+
var itemData = _ref.itemData;
|
|
25
|
+
var name = itemData.name;
|
|
26
|
+
return /*#__PURE__*/_react["default"].createElement("li", null, "Custom ListItem ---> ".concat(name));
|
|
27
|
+
};
|
|
28
|
+
/* eslint-enable react/prop-types */
|
|
29
|
+
|
|
30
|
+
return /*#__PURE__*/_react["default"].createElement(_List["default"], {
|
|
31
|
+
items: _Constants.FRUITS_LIST,
|
|
32
|
+
ListItem: ListItem
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
exports.CustomListItem = CustomListItem;
|
|
36
|
+
CustomListItem.story = {
|
|
37
|
+
name: "Custom ListItem"
|
|
38
|
+
};
|