@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
|
@@ -1,55 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports["default"] = void 0;
|
|
9
|
+
|
|
8
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
9
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
10
14
|
var _Form = require("./Form");
|
|
15
|
+
|
|
11
16
|
var _FormElementWrapper = _interopRequireDefault(require("./FormElementWrapper"));
|
|
17
|
+
|
|
12
18
|
var _excluded = ["label", "name", "className", "value", "defaultValue", "placeholder", "appearance", "onChange"];
|
|
19
|
+
|
|
13
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
+
|
|
14
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
|
+
|
|
15
24
|
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; }
|
|
16
|
-
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
function
|
|
20
|
-
|
|
25
|
+
|
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
+
|
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
29
|
+
|
|
30
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
|
+
|
|
21
32
|
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; }
|
|
33
|
+
|
|
22
34
|
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; }
|
|
35
|
+
|
|
23
36
|
var Textarea = function Textarea(props) {
|
|
24
37
|
var label = props.label,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
38
|
+
name = props.name,
|
|
39
|
+
className = props.className,
|
|
40
|
+
value = props.value,
|
|
41
|
+
defaultValue = props.defaultValue,
|
|
42
|
+
placeholder = props.placeholder,
|
|
43
|
+
appearance = props.appearance,
|
|
44
|
+
onChange = props.onChange,
|
|
45
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
46
|
+
|
|
33
47
|
var _useContext = (0, _react.useContext)(_Form.FormContext),
|
|
34
|
-
|
|
48
|
+
onValueChange = _useContext.onValueChange;
|
|
49
|
+
|
|
35
50
|
var postFormValueChange = function postFormValueChange(value) {
|
|
36
51
|
typeof onValueChange === "function" && onValueChange(name, value);
|
|
37
52
|
};
|
|
38
|
-
var onInputChange = function onInputChange(event) {
|
|
39
|
-
var value = event.target.value;
|
|
40
53
|
|
|
41
|
-
|
|
54
|
+
var onInputChange = function onInputChange(event) {
|
|
55
|
+
var value = event.target.value; // TODO : do validations
|
|
42
56
|
|
|
43
57
|
if (typeof onChange === "function") {
|
|
44
58
|
onChange(value);
|
|
45
59
|
}
|
|
60
|
+
|
|
46
61
|
postFormValueChange(value);
|
|
47
62
|
};
|
|
63
|
+
|
|
48
64
|
(0, _react.useEffect)(function () {
|
|
49
65
|
/* set the initial form element value in the form context */
|
|
50
66
|
var postValue = typeof onChange === "function" ? value : defaultValue;
|
|
51
67
|
postFormValueChange(postValue);
|
|
52
68
|
}, [value, defaultValue]);
|
|
69
|
+
|
|
53
70
|
var inputProps = _objectSpread({
|
|
54
71
|
label: label,
|
|
55
72
|
name: name,
|
|
@@ -59,10 +76,12 @@ var Textarea = function Textarea(props) {
|
|
|
59
76
|
className: "RCB-form-el",
|
|
60
77
|
onChange: onInputChange
|
|
61
78
|
}, restProps);
|
|
79
|
+
|
|
62
80
|
if (typeof onChange === "function") {
|
|
63
81
|
/* make it a controlled component if onChange function is given */
|
|
64
82
|
inputProps.value = value;
|
|
65
83
|
}
|
|
84
|
+
|
|
66
85
|
return /*#__PURE__*/_react["default"].createElement(_FormElementWrapper["default"], {
|
|
67
86
|
className: className,
|
|
68
87
|
appearance: appearance
|
|
@@ -71,19 +90,25 @@ var Textarea = function Textarea(props) {
|
|
|
71
90
|
htmlFor: name
|
|
72
91
|
}, label), /*#__PURE__*/_react["default"].createElement("textarea", inputProps));
|
|
73
92
|
};
|
|
93
|
+
|
|
74
94
|
Textarea.propTypes = {
|
|
75
95
|
/** Pass any additional classNames to Textarea component */
|
|
76
96
|
className: _propTypes["default"].string,
|
|
97
|
+
|
|
77
98
|
/** Label for the input element */
|
|
78
99
|
label: _propTypes["default"].string,
|
|
100
|
+
|
|
79
101
|
/** Unique ID for the input element */
|
|
80
102
|
name: _propTypes["default"].string.isRequired,
|
|
103
|
+
|
|
81
104
|
/* Will be used only with onChange function, or else ignored */
|
|
82
105
|
value: _propTypes["default"].any,
|
|
83
106
|
defaultValue: _propTypes["default"].any,
|
|
84
107
|
placeholder: _propTypes["default"].string,
|
|
108
|
+
|
|
85
109
|
/* Define the appearance of the form element. Accepted values are either "inline" or "block" */
|
|
86
110
|
appearance: _propTypes["default"].oneOf(["inline", "block"]),
|
|
111
|
+
|
|
87
112
|
/* Becomes a controlled component if onChange function is given */
|
|
88
113
|
onChange: _propTypes["default"].func
|
|
89
114
|
};
|
|
@@ -1,42 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports["default"] = void 0;
|
|
9
|
+
|
|
8
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
9
12
|
var _customHooks = require("../../core/customHooks");
|
|
13
|
+
|
|
10
14
|
var _Form = require("./Form");
|
|
15
|
+
|
|
11
16
|
var _FormElementWrapper = _interopRequireDefault(require("./FormElementWrapper"));
|
|
17
|
+
|
|
12
18
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
+
|
|
13
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
+
|
|
14
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
|
+
|
|
15
24
|
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; }
|
|
25
|
+
|
|
16
26
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
|
|
17
28
|
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
|
+
|
|
18
30
|
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); }
|
|
19
|
-
|
|
20
|
-
function
|
|
31
|
+
|
|
32
|
+
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; }
|
|
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
|
+
|
|
21
36
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
|
+
|
|
22
38
|
var Toggle = function Toggle(props) {
|
|
23
39
|
var name = props.name,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
label = props.label,
|
|
41
|
+
value = props.value,
|
|
42
|
+
defaultValue = props.defaultValue,
|
|
43
|
+
className = props.className,
|
|
44
|
+
appearance = props.appearance,
|
|
45
|
+
toggleElWidth = props.toggleElWidth,
|
|
46
|
+
toggleKnobSize = props.toggleKnobSize,
|
|
47
|
+
onChange = props.onChange,
|
|
48
|
+
disabled = props.disabled;
|
|
33
49
|
var initialValue = typeof onChange === "function" ? value : defaultValue;
|
|
50
|
+
|
|
34
51
|
var _useState = (0, _react.useState)(initialValue),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
52
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
+
isActive = _useState2[0],
|
|
54
|
+
setIsActive = _useState2[1];
|
|
55
|
+
|
|
38
56
|
var _useContext = (0, _react.useContext)(_Form.FormContext),
|
|
39
|
-
|
|
57
|
+
onValueChange = _useContext.onValueChange;
|
|
58
|
+
|
|
40
59
|
var toggleActive = function toggleActive() {
|
|
41
60
|
if (typeof onChange === "function") {
|
|
42
61
|
onChange(!isActive);
|
|
@@ -44,9 +63,11 @@ var Toggle = function Toggle(props) {
|
|
|
44
63
|
setIsActive(!isActive);
|
|
45
64
|
}
|
|
46
65
|
};
|
|
66
|
+
|
|
47
67
|
var postFormValueChange = function postFormValueChange(value) {
|
|
48
68
|
typeof onValueChange === "function" && onValueChange(name, value);
|
|
49
69
|
};
|
|
70
|
+
|
|
50
71
|
(0, _customHooks.useDidUpdateEffect)(function () {
|
|
51
72
|
/* runs only when isActive changes, hence call the onChange function then */
|
|
52
73
|
var value = isActive;
|
|
@@ -66,9 +87,11 @@ var Toggle = function Toggle(props) {
|
|
|
66
87
|
width: "".concat(toggleKnobSize, "px"),
|
|
67
88
|
height: "".concat(toggleKnobSize, "px")
|
|
68
89
|
};
|
|
90
|
+
|
|
69
91
|
if (isActive) {
|
|
70
92
|
toggleKnobCSS.transform = "translateX(".concat(toggleElWidth - toggleKnobSize, "px)");
|
|
71
93
|
}
|
|
94
|
+
|
|
72
95
|
var toggleClasses = "RCB-form-el RCB-toggle ".concat(isActive ? "active" : "", " ").concat(disabled ? "RCB-toggle-disable" : "");
|
|
73
96
|
return /*#__PURE__*/_react["default"].createElement(_FormElementWrapper["default"], {
|
|
74
97
|
className: className,
|
|
@@ -85,24 +108,33 @@ var Toggle = function Toggle(props) {
|
|
|
85
108
|
style: toggleKnobCSS
|
|
86
109
|
})));
|
|
87
110
|
};
|
|
111
|
+
|
|
88
112
|
Toggle.propTypes = {
|
|
89
113
|
/** Pass any additional classNames to Input component */
|
|
90
114
|
className: _propTypes["default"].string,
|
|
115
|
+
|
|
91
116
|
/** Label for the input element */
|
|
92
117
|
label: _propTypes["default"].string,
|
|
118
|
+
|
|
93
119
|
/** Unique ID for the input element */
|
|
94
120
|
name: _propTypes["default"].string.isRequired,
|
|
121
|
+
|
|
95
122
|
/** Will be used only with onChange function, or else ignored */
|
|
96
123
|
value: _propTypes["default"].bool,
|
|
97
124
|
defaultValue: _propTypes["default"].bool,
|
|
125
|
+
|
|
98
126
|
/** Set this to true to disable the toggle component */
|
|
99
127
|
disabled: _propTypes["default"].bool,
|
|
128
|
+
|
|
100
129
|
/** Define the appearance of the form element. Accepted values are either "inline" or "block" */
|
|
101
130
|
appearance: _propTypes["default"].oneOf(["inline", "block"]),
|
|
131
|
+
|
|
102
132
|
/** Becomes a controlled component if onChange function is given */
|
|
103
133
|
onChange: _propTypes["default"].func,
|
|
134
|
+
|
|
104
135
|
/** width of the toggle element in pixels */
|
|
105
136
|
toggleElWidth: _propTypes["default"].number,
|
|
137
|
+
|
|
106
138
|
/** size of the toggle inner knob in pixels */
|
|
107
139
|
toggleKnobSize: _propTypes["default"].number
|
|
108
140
|
};
|
package/components/Form/index.js
CHANGED
|
@@ -6,68 +6,80 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "Checkbox", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
|
-
return
|
|
9
|
+
return _Checkbox2["default"];
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "DragDropFileUploader", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function get() {
|
|
15
|
-
return
|
|
15
|
+
return _DragDropFileUploader2["default"];
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "Dropdown", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function get() {
|
|
21
|
-
return
|
|
21
|
+
return _Dropdown2["default"];
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "FileUploader", {
|
|
25
25
|
enumerable: true,
|
|
26
26
|
get: function get() {
|
|
27
|
-
return
|
|
27
|
+
return _FileUploader2["default"];
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "Input", {
|
|
31
31
|
enumerable: true,
|
|
32
32
|
get: function get() {
|
|
33
|
-
return
|
|
33
|
+
return _Input2["default"];
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "RadioList", {
|
|
37
37
|
enumerable: true,
|
|
38
38
|
get: function get() {
|
|
39
|
-
return
|
|
39
|
+
return _RadioList2["default"];
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "RangeSlider", {
|
|
43
43
|
enumerable: true,
|
|
44
44
|
get: function get() {
|
|
45
|
-
return
|
|
45
|
+
return _RangeSlider2["default"];
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "Textarea", {
|
|
49
49
|
enumerable: true,
|
|
50
50
|
get: function get() {
|
|
51
|
-
return
|
|
51
|
+
return _Textarea2["default"];
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "Toggle", {
|
|
55
55
|
enumerable: true,
|
|
56
56
|
get: function get() {
|
|
57
|
-
return
|
|
57
|
+
return _Toggle2["default"];
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
exports["default"] = void 0;
|
|
61
|
+
|
|
61
62
|
var _Form = _interopRequireDefault(require("./Form"));
|
|
62
|
-
|
|
63
|
-
var
|
|
64
|
-
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
var
|
|
70
|
-
|
|
63
|
+
|
|
64
|
+
var _Input2 = _interopRequireDefault(require("./Input"));
|
|
65
|
+
|
|
66
|
+
var _Checkbox2 = _interopRequireDefault(require("./Checkbox"));
|
|
67
|
+
|
|
68
|
+
var _RadioList2 = _interopRequireDefault(require("./RadioList"));
|
|
69
|
+
|
|
70
|
+
var _Textarea2 = _interopRequireDefault(require("./Textarea"));
|
|
71
|
+
|
|
72
|
+
var _Dropdown2 = _interopRequireDefault(require("./Dropdown"));
|
|
73
|
+
|
|
74
|
+
var _RangeSlider2 = _interopRequireDefault(require("./RangeSlider"));
|
|
75
|
+
|
|
76
|
+
var _FileUploader2 = _interopRequireDefault(require("./FileUploader"));
|
|
77
|
+
|
|
78
|
+
var _DragDropFileUploader2 = _interopRequireDefault(require("./DragDropFileUploader"));
|
|
79
|
+
|
|
80
|
+
var _Toggle2 = _interopRequireDefault(require("./Toggle"));
|
|
81
|
+
|
|
71
82
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
83
|
+
|
|
72
84
|
var _default = _Form["default"];
|
|
73
85
|
exports["default"] = _default;
|
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports["default"] = exports._Checkbox = void 0;
|
|
9
|
+
|
|
8
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
9
12
|
var _Form = _interopRequireDefault(require("../Form"));
|
|
13
|
+
|
|
10
14
|
var _Checkbox2 = _interopRequireDefault(require("../Checkbox"));
|
|
15
|
+
|
|
11
16
|
var _Button = _interopRequireWildcard(require("../../Button"));
|
|
17
|
+
|
|
12
18
|
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); }
|
|
19
|
+
|
|
13
20
|
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; }
|
|
21
|
+
|
|
14
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
+
|
|
15
24
|
var _Checkbox = function _Checkbox() {
|
|
16
25
|
var onSubmit = function onSubmit(formData) {
|
|
17
26
|
var data = formData.data;
|
|
18
27
|
console.log("Submitted data: ", data);
|
|
19
28
|
};
|
|
29
|
+
|
|
20
30
|
return /*#__PURE__*/_react["default"].createElement(_Form["default"], {
|
|
21
31
|
onSubmit: onSubmit
|
|
22
32
|
}, /*#__PURE__*/_react["default"].createElement(_Checkbox2["default"], {
|
|
@@ -35,6 +45,7 @@ var _Checkbox = function _Checkbox() {
|
|
|
35
45
|
className: "full-width-btn"
|
|
36
46
|
}, "Submit"));
|
|
37
47
|
};
|
|
48
|
+
|
|
38
49
|
exports._Checkbox = _Checkbox;
|
|
39
50
|
_Checkbox.story = {
|
|
40
51
|
parameters: {
|
|
@@ -4,24 +4,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.SimpleUsage = void 0;
|
|
7
|
+
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
8
10
|
var _DragDropFileUploader = _interopRequireDefault(require("../DragDropFileUploader"));
|
|
11
|
+
|
|
9
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
10
14
|
var _default = {
|
|
11
15
|
title: "DragDropFileUploader"
|
|
12
16
|
};
|
|
13
17
|
exports["default"] = _default;
|
|
18
|
+
|
|
14
19
|
var SimpleUsage = function SimpleUsage() {
|
|
15
20
|
var onFileChange = function onFileChange() {
|
|
16
21
|
var files = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
17
22
|
console.log("SELECTED FILES");
|
|
23
|
+
|
|
18
24
|
for (var i = 0; i < files.length; i++) {
|
|
19
25
|
console.log(files[i].name);
|
|
20
26
|
}
|
|
21
27
|
};
|
|
28
|
+
|
|
22
29
|
return /*#__PURE__*/_react["default"].createElement(_DragDropFileUploader["default"], {
|
|
23
30
|
onChange: onFileChange,
|
|
24
31
|
appearance: "block"
|
|
25
32
|
}, /*#__PURE__*/_react["default"].createElement("div", null, "Drag & drop files into this area"));
|
|
26
33
|
};
|
|
34
|
+
|
|
27
35
|
exports.SimpleUsage = SimpleUsage;
|
|
@@ -4,25 +4,33 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.SimpleUsage = exports.SearchEnbaledDropdown = exports.PaginatedDropdown = void 0;
|
|
7
|
+
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
8
10
|
var _Constants = require("../../../../public/Constants");
|
|
11
|
+
|
|
9
12
|
var _Dropdown = _interopRequireDefault(require("../Dropdown"));
|
|
13
|
+
|
|
10
14
|
var _dataLoader = _interopRequireDefault(require("../../../core/dataLoader"));
|
|
15
|
+
|
|
11
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
-
|
|
13
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly
|
|
14
|
-
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
function
|
|
17
|
+
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
+
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
21
|
+
|
|
22
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
|
|
18
24
|
var _default = {
|
|
19
25
|
title: "Dropdown"
|
|
20
26
|
};
|
|
21
27
|
exports["default"] = _default;
|
|
28
|
+
|
|
22
29
|
var SimpleUsage = function SimpleUsage() {
|
|
23
30
|
var onChange = function onChange(selectedFruit) {
|
|
24
31
|
console.log("Selected Fruit: ", selectedFruit);
|
|
25
32
|
};
|
|
33
|
+
|
|
26
34
|
return /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], {
|
|
27
35
|
name: "fruit",
|
|
28
36
|
label: "Select a fruit",
|
|
@@ -33,6 +41,7 @@ var SimpleUsage = function SimpleUsage() {
|
|
|
33
41
|
noSelectionLabel: "Select"
|
|
34
42
|
});
|
|
35
43
|
};
|
|
44
|
+
|
|
36
45
|
exports.SimpleUsage = SimpleUsage;
|
|
37
46
|
SimpleUsage.story = {
|
|
38
47
|
name: "Simple Usage ",
|
|
@@ -42,19 +51,23 @@ SimpleUsage.story = {
|
|
|
42
51
|
}
|
|
43
52
|
}
|
|
44
53
|
};
|
|
54
|
+
|
|
45
55
|
_dataLoader["default"].addRequestConfig("getPaginatedUsers", {
|
|
46
56
|
method: "GET",
|
|
47
57
|
url: "https://reqres.in/api/users"
|
|
48
58
|
});
|
|
59
|
+
|
|
49
60
|
var PaginatedDropdown = function PaginatedDropdown() {
|
|
50
61
|
var onChange = function onChange(selected) {
|
|
51
62
|
console.log("Selected User: ", selected);
|
|
52
63
|
};
|
|
64
|
+
|
|
53
65
|
var responseFormatter = function responseFormatter(response) {
|
|
54
66
|
return _objectSpread(_objectSpread({}, response), {}, {
|
|
55
67
|
entries: response.data
|
|
56
68
|
});
|
|
57
69
|
};
|
|
70
|
+
|
|
58
71
|
return /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], {
|
|
59
72
|
paginationType: "SERVER",
|
|
60
73
|
requestId: "getPaginatedUsers",
|
|
@@ -69,6 +82,7 @@ var PaginatedDropdown = function PaginatedDropdown() {
|
|
|
69
82
|
responseFormatter: responseFormatter
|
|
70
83
|
});
|
|
71
84
|
};
|
|
85
|
+
|
|
72
86
|
exports.PaginatedDropdown = PaginatedDropdown;
|
|
73
87
|
PaginatedDropdown.story = {
|
|
74
88
|
name: "Dropdown with server side pagination",
|
|
@@ -78,15 +92,18 @@ PaginatedDropdown.story = {
|
|
|
78
92
|
}
|
|
79
93
|
}
|
|
80
94
|
};
|
|
95
|
+
|
|
81
96
|
var SearchEnbaledDropdown = function SearchEnbaledDropdown() {
|
|
82
97
|
var onChange = function onChange(selected) {
|
|
83
98
|
console.log("Selected User: ", selected);
|
|
84
99
|
};
|
|
100
|
+
|
|
85
101
|
var responseFormatter = function responseFormatter(response) {
|
|
86
102
|
return _objectSpread(_objectSpread({}, response), {}, {
|
|
87
103
|
entries: response.data
|
|
88
104
|
});
|
|
89
105
|
};
|
|
106
|
+
|
|
90
107
|
return /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], {
|
|
91
108
|
paginationType: "SERVER",
|
|
92
109
|
requestId: "getPaginatedUsers",
|
|
@@ -103,6 +120,7 @@ var SearchEnbaledDropdown = function SearchEnbaledDropdown() {
|
|
|
103
120
|
responseFormatter: responseFormatter
|
|
104
121
|
});
|
|
105
122
|
};
|
|
123
|
+
|
|
106
124
|
exports.SearchEnbaledDropdown = SearchEnbaledDropdown;
|
|
107
125
|
PaginatedDropdown.story = {
|
|
108
126
|
name: "Dropdown with server side search and pagination",
|
|
@@ -4,21 +4,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.SimpleUsage = void 0;
|
|
7
|
+
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
8
10
|
var _FileUploader = _interopRequireDefault(require("../FileUploader"));
|
|
11
|
+
|
|
9
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
10
14
|
var _default = {
|
|
11
15
|
title: "FileUploader"
|
|
12
16
|
};
|
|
13
17
|
exports["default"] = _default;
|
|
18
|
+
|
|
14
19
|
var SimpleUsage = function SimpleUsage() {
|
|
15
20
|
var onFileChange = function onFileChange() {
|
|
16
21
|
var files = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
17
22
|
console.log("SELECTED FILES");
|
|
23
|
+
|
|
18
24
|
for (var i = 0; i < files.length; i++) {
|
|
19
25
|
console.log(files[i].name);
|
|
20
26
|
}
|
|
21
27
|
};
|
|
28
|
+
|
|
22
29
|
return /*#__PURE__*/_react["default"].createElement(_FileUploader["default"], {
|
|
23
30
|
name: "files",
|
|
24
31
|
appearance: "block",
|
|
@@ -28,4 +35,5 @@ var SimpleUsage = function SimpleUsage() {
|
|
|
28
35
|
href: "javascript:void(0)"
|
|
29
36
|
}, "Upload File"));
|
|
30
37
|
};
|
|
38
|
+
|
|
31
39
|
exports.SimpleUsage = SimpleUsage;
|