@unbxd-ui/unbxd-react-components 0.2.220 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/components/Accordian/Accordian.js +14 -11
- package/components/Accordian/Accordian.stories.js +141 -118
- package/components/Accordian/index.js +1 -1
- package/components/Button/Button.js +4 -4
- package/components/Button/Button.stories.js +168 -62
- package/components/Button/DropdownButton.js +5 -6
- package/components/Button/buttonTheme.css +1 -1
- package/components/Button/index.js +2 -3
- package/components/DataLoader/DataLoader.js +6 -7
- package/components/DataLoader/DataLoader.stories.js +244 -58
- package/components/DataLoader/index.js +1 -1
- package/components/Form/Checkbox.js +12 -11
- package/components/Form/DragDropFileUploader.js +6 -7
- package/components/Form/Dropdown.js +14 -12
- package/components/Form/FileUploader.js +3 -4
- package/components/Form/Form.js +6 -7
- package/components/Form/FormElementWrapper.js +1 -1
- package/components/Form/Input.js +24 -15
- package/components/Form/RadioList.js +8 -9
- package/components/Form/RangeSlider.js +12 -13
- package/components/Form/SearchableDropdown.js +563 -0
- package/components/Form/ServerPaginatedDDList.js +56 -41
- package/components/Form/Textarea.js +26 -10
- package/components/Form/Toggle.js +6 -7
- package/components/Form/formCore.css +1 -1
- package/components/Form/formTheme.css +1 -1
- package/components/Form/index.js +8 -1
- package/components/Form/stories/Checkbox.stories.js +139 -40
- package/components/Form/stories/Dropdown.stories.js +323 -92
- package/components/Form/stories/FileUploader.stories.js +178 -19
- package/components/Form/stories/Input.stories.js +115 -0
- package/components/Form/stories/RangeSlider.stories.js +162 -64
- package/components/Form/stories/SearchableDropdown.stories.js +189 -0
- package/components/Form/stories/ServerPaginatedDropdown.stories.js +365 -0
- package/components/Form/stories/Textarea.stories.js +113 -34
- package/components/Form/stories/Toggle.stories.js +193 -14
- package/components/Form/variables.css +0 -0
- package/components/InlineModal/InlineModal.js +119 -21
- package/components/InlineModal/InlineModal.stories.js +239 -45
- package/components/InlineModal/index.js +1 -2
- package/components/InlineModal/inlineModalCore.css +1 -1
- package/components/List/List.js +11 -8
- package/components/List/List.stories.js +238 -0
- package/components/List/index.js +1 -1
- package/components/Modal/Modal.js +67 -20
- package/components/Modal/Modal.stories.js +257 -38
- package/components/Modal/index.js +1 -1
- package/components/Modal/modalCore.css +1 -1
- package/components/NoDataPlaceholder/NoDataPlaceholder.js +41 -0
- package/components/NoDataPlaceholder/NoDataPlaceholder.stories.js +42 -0
- package/components/NoDataPlaceholder/index.js +9 -0
- package/components/NoDataPlaceholder/noDataPlaceholderCore.css +1 -0
- package/components/NotificationComponent/NotificationComponent.js +20 -10
- package/components/NotificationComponent/NotificationComponent.stories.js +171 -19
- package/components/NotificationComponent/index.js +1 -1
- package/components/NotificationComponent/notificationTheme.css +1 -1
- package/components/PageLoader/PageLoader.js +84 -0
- package/components/PageLoader/PageLoader.stories.js +276 -0
- package/components/PageLoader/index.js +9 -0
- package/components/PageLoader/pageLoaderCore.css +1 -0
- package/components/ProgressBar/ProgressBar.css +0 -0
- package/components/ProgressBar/ProgressBar.js +1 -1
- package/components/ProgressBar/ProgressBar.stories.js +203 -10
- package/components/ProgressBar/index.js +1 -1
- package/components/ProgressBar/progressBarCore.css +1 -1
- package/components/Table/BaseTable.js +86 -342
- package/components/Table/PaginationComponent.js +4 -4
- package/components/Table/Table.js +7 -326
- package/components/Table/Table.stories.js +2117 -158
- package/components/Table/TableChild.js +383 -0
- package/components/Table/TableConstants.js +15 -0
- package/components/Table/hooks/usePrevious.js +14 -0
- package/components/Table/index.js +14 -1
- package/components/Table/tableCore.css +1 -1
- package/components/TableOld/BaseTable.js +373 -0
- package/components/TableOld/PaginationComponent.js +86 -0
- package/components/TableOld/TableOld.js +367 -0
- package/components/TableOld/index.js +15 -0
- package/components/TabsComponent/TabsComponent.js +6 -7
- package/components/TabsComponent/TabsComponent.stories.js +291 -53
- package/components/TabsComponent/index.js +1 -1
- package/components/ToastNotification/ToastNotificationWrapper.js +212 -0
- package/components/ToastNotification/ToastNotificationWrapper.stories.js +554 -0
- package/components/ToastNotification/index.js +40 -0
- package/components/ToastNotification/toastNotificationCore.css +1 -0
- package/components/Tooltip/Tooltip.js +231 -56
- package/components/Tooltip/Tooltip.stories.js +380 -15
- package/components/Tooltip/index.js +1 -1
- package/components/Tooltip/tooltipCore.css +1 -1
- package/components/Tooltip/tooltipTheme.css +1 -1
- package/components/common/NoDataDropdown.js +50 -0
- package/components/common/common.css +1 -0
- package/components/core.css +2 -3
- package/components/core.scss +20 -1
- package/components/index.js +66 -3
- package/components/theme.css +2 -3
- package/core/Validators.js +1 -1
- package/core/customHooks.js +4 -4
- package/core/dataLoader.js +58 -17
- package/core/index.js +1 -1
- package/core/utils.js +15 -4
- package/index.js +54 -0
- package/package.json +41 -28
- package/components/Button/DropdownButton.stories.js +0 -49
- package/components/Form/stories/DragDropFileUploader.stories.js +0 -25
- package/components/Form/stories/FormDefault.stories.js +0 -115
- package/components/Form/stories/RadioList.stories.js +0 -53
- package/components/Form/stories/TextInput.stories.js +0 -76
- package/components/Form/stories/form.stories.js +0 -233
- package/components/List/list.stories.js +0 -35
- package/core/dataLoader.stories.js +0 -119
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.WithLabel = exports.WithError = exports.Password = exports.Disabled = exports.Default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _Input = _interopRequireDefault(require("../Input"));
|
|
9
|
+
var _Form = _interopRequireDefault(require("../Form"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
var meta = {
|
|
12
|
+
title: 'Components/Form/Input',
|
|
13
|
+
component: _Input["default"],
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: 'centered'
|
|
16
|
+
},
|
|
17
|
+
tags: ['autodocs'],
|
|
18
|
+
argTypes: {
|
|
19
|
+
type: {
|
|
20
|
+
control: 'select',
|
|
21
|
+
options: ['text', 'password', 'email', 'number', 'tel'],
|
|
22
|
+
description: 'Type of input field'
|
|
23
|
+
},
|
|
24
|
+
placeholder: {
|
|
25
|
+
control: 'text',
|
|
26
|
+
description: 'Placeholder text'
|
|
27
|
+
},
|
|
28
|
+
disabled: {
|
|
29
|
+
control: 'boolean',
|
|
30
|
+
description: 'Whether the input is disabled'
|
|
31
|
+
},
|
|
32
|
+
className: {
|
|
33
|
+
control: 'text',
|
|
34
|
+
description: 'Additional CSS classes'
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var _default = exports["default"] = meta;
|
|
39
|
+
var Default = exports.Default = {
|
|
40
|
+
render: function render() {
|
|
41
|
+
return /*#__PURE__*/_react["default"].createElement(_Input["default"], {
|
|
42
|
+
placeholder: "Enter text...",
|
|
43
|
+
type: "text",
|
|
44
|
+
onChange: function onChange(value) {
|
|
45
|
+
return console.log('Input changed:', value);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var WithLabel = exports.WithLabel = {
|
|
51
|
+
render: function render() {
|
|
52
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
53
|
+
style: {
|
|
54
|
+
width: '300px'
|
|
55
|
+
}
|
|
56
|
+
}, /*#__PURE__*/_react["default"].createElement(_Input["default"], {
|
|
57
|
+
label: "Username",
|
|
58
|
+
type: "text",
|
|
59
|
+
placeholder: "Enter username",
|
|
60
|
+
onChange: function onChange(value) {
|
|
61
|
+
return console.log('Input changed:', value);
|
|
62
|
+
}
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var Password = exports.Password = {
|
|
67
|
+
render: function render() {
|
|
68
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
69
|
+
style: {
|
|
70
|
+
width: '300px'
|
|
71
|
+
}
|
|
72
|
+
}, /*#__PURE__*/_react["default"].createElement(_Input["default"], {
|
|
73
|
+
type: "password",
|
|
74
|
+
label: "Password",
|
|
75
|
+
placeholder: "Enter password",
|
|
76
|
+
onChange: function onChange(value) {
|
|
77
|
+
return console.log('Password changed:', value);
|
|
78
|
+
}
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var Disabled = exports.Disabled = {
|
|
83
|
+
render: function render() {
|
|
84
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
85
|
+
style: {
|
|
86
|
+
width: '300px'
|
|
87
|
+
}
|
|
88
|
+
}, /*#__PURE__*/_react["default"].createElement(_Input["default"], {
|
|
89
|
+
disabled: true,
|
|
90
|
+
type: "text",
|
|
91
|
+
value: "Disabled input",
|
|
92
|
+
onChange: function onChange(value) {
|
|
93
|
+
return console.log('Input changed:', value);
|
|
94
|
+
}
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var WithError = exports.WithError = {
|
|
99
|
+
render: function render() {
|
|
100
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
101
|
+
style: {
|
|
102
|
+
width: '300px'
|
|
103
|
+
}
|
|
104
|
+
}, /*#__PURE__*/_react["default"].createElement(_Form["default"], null, /*#__PURE__*/_react["default"].createElement(_Input["default"], {
|
|
105
|
+
name: "email",
|
|
106
|
+
label: "Email",
|
|
107
|
+
type: "email",
|
|
108
|
+
placeholder: "Enter email",
|
|
109
|
+
validations: [{
|
|
110
|
+
type: "EMAIL",
|
|
111
|
+
message: "Please enter a valid email address"
|
|
112
|
+
}]
|
|
113
|
+
})));
|
|
114
|
+
}
|
|
115
|
+
};
|
|
@@ -1,79 +1,177 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports["default"] = exports.
|
|
6
|
+
exports["default"] = exports.WithLabels = exports.WithCustomColors = exports.ShowBubbleValue = exports.Disabled = exports.Default = void 0;
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
function
|
|
14
|
-
function
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
return /*#__PURE__*/_react["default"].createElement(_Form["default"], {
|
|
22
|
-
onSubmit: onSubmit
|
|
23
|
-
}, /*#__PURE__*/_react["default"].createElement(_RangeSlider2["default"], {
|
|
24
|
-
name: "price",
|
|
25
|
-
label: "Select price range",
|
|
26
|
-
min: "10",
|
|
27
|
-
max: "100",
|
|
28
|
-
appearance: "block",
|
|
29
|
-
defaultValue: "10"
|
|
30
|
-
}), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
31
|
-
appearance: _Button.ButtonAppearance.PRIMARY,
|
|
32
|
-
className: "full-width-btn"
|
|
33
|
-
}, "Submit"));
|
|
34
|
-
};
|
|
35
|
-
_RangeSlider.story = {
|
|
36
|
-
name: "Range Slider ",
|
|
8
|
+
var _RangeSlider = _interopRequireDefault(require("../RangeSlider"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
16
|
+
var meta = {
|
|
17
|
+
title: 'Components/Form/RangeSlider',
|
|
18
|
+
component: _RangeSlider["default"],
|
|
37
19
|
parameters: {
|
|
38
|
-
|
|
39
|
-
|
|
20
|
+
layout: 'centered'
|
|
21
|
+
},
|
|
22
|
+
tags: ['autodocs'],
|
|
23
|
+
argTypes: {
|
|
24
|
+
min: {
|
|
25
|
+
control: 'number',
|
|
26
|
+
description: 'Minimum value of the slider'
|
|
27
|
+
},
|
|
28
|
+
max: {
|
|
29
|
+
control: 'number',
|
|
30
|
+
description: 'Maximum value of the slider'
|
|
31
|
+
},
|
|
32
|
+
step: {
|
|
33
|
+
control: 'number',
|
|
34
|
+
description: 'Step value for the slider'
|
|
35
|
+
},
|
|
36
|
+
disabled: {
|
|
37
|
+
control: 'boolean',
|
|
38
|
+
description: 'Whether the slider is disabled'
|
|
39
|
+
},
|
|
40
|
+
showLabels: {
|
|
41
|
+
control: 'boolean',
|
|
42
|
+
description: 'Whether to show min/max labels'
|
|
43
|
+
},
|
|
44
|
+
showInput: {
|
|
45
|
+
control: 'boolean',
|
|
46
|
+
description: 'Whether to show input fields'
|
|
47
|
+
},
|
|
48
|
+
className: {
|
|
49
|
+
control: 'text',
|
|
50
|
+
description: 'Additional CSS classes'
|
|
40
51
|
}
|
|
41
52
|
}
|
|
42
53
|
};
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
var _default = exports["default"] = meta;
|
|
55
|
+
var Default = exports.Default = {
|
|
56
|
+
render: function render() {
|
|
57
|
+
var _React$useState = _react["default"].useState(20),
|
|
58
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
59
|
+
sliderValue = _React$useState2[0],
|
|
60
|
+
setSliderValue = _React$useState2[1];
|
|
61
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
62
|
+
style: {
|
|
63
|
+
width: '300px'
|
|
64
|
+
}
|
|
65
|
+
}, /*#__PURE__*/_react["default"].createElement(_RangeSlider["default"], {
|
|
66
|
+
min: 0,
|
|
67
|
+
max: 100,
|
|
68
|
+
value: sliderValue,
|
|
69
|
+
onChange: function onChange(value) {
|
|
70
|
+
console.log('Range changed:', value);
|
|
71
|
+
setSliderValue(value);
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
63
75
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
var WithLabels = exports.WithLabels = {
|
|
77
|
+
render: function render() {
|
|
78
|
+
var _React$useState3 = _react["default"].useState(500),
|
|
79
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
80
|
+
sliderValue = _React$useState4[0],
|
|
81
|
+
setSliderValue = _React$useState4[1];
|
|
82
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
83
|
+
style: {
|
|
84
|
+
width: '300px'
|
|
85
|
+
}
|
|
86
|
+
}, /*#__PURE__*/_react["default"].createElement(_RangeSlider["default"], {
|
|
87
|
+
label: "Price Range",
|
|
88
|
+
min: 0,
|
|
89
|
+
max: 1000,
|
|
90
|
+
value: sliderValue
|
|
91
|
+
// showLabels
|
|
92
|
+
,
|
|
93
|
+
onChange: function onChange(value) {
|
|
94
|
+
console.log('Range changed:', value);
|
|
95
|
+
setSliderValue(value);
|
|
96
|
+
},
|
|
97
|
+
formatLabel: function formatLabel(value) {
|
|
98
|
+
return "$".concat(value);
|
|
99
|
+
}
|
|
100
|
+
}));
|
|
70
101
|
}
|
|
71
102
|
};
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
103
|
+
var Disabled = exports.Disabled = {
|
|
104
|
+
render: function render() {
|
|
105
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
106
|
+
style: {
|
|
107
|
+
width: '300px'
|
|
108
|
+
}
|
|
109
|
+
}, /*#__PURE__*/_react["default"].createElement(_RangeSlider["default"], {
|
|
110
|
+
label: "Disabled Range",
|
|
111
|
+
min: 0,
|
|
112
|
+
max: 100,
|
|
113
|
+
value: 50,
|
|
114
|
+
disabled: true,
|
|
115
|
+
onChange: function onChange(value) {
|
|
116
|
+
return console.log('Range changed:', value);
|
|
117
|
+
}
|
|
118
|
+
}));
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
var ShowBubbleValue = exports.ShowBubbleValue = {
|
|
122
|
+
render: function render() {
|
|
123
|
+
var _React$useState5 = _react["default"].useState(100),
|
|
124
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
125
|
+
sliderValue = _React$useState6[0],
|
|
126
|
+
setSliderValue = _React$useState6[1];
|
|
127
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
128
|
+
style: {
|
|
129
|
+
width: '300px'
|
|
130
|
+
}
|
|
131
|
+
}, /*#__PURE__*/_react["default"].createElement(_RangeSlider["default"], {
|
|
132
|
+
label: "Show Range Value",
|
|
133
|
+
min: 0,
|
|
134
|
+
max: 500,
|
|
135
|
+
value: sliderValue,
|
|
136
|
+
showBubble: true,
|
|
137
|
+
onChange: function onChange(value) {
|
|
138
|
+
console.log('Range changed:', value);
|
|
139
|
+
setSliderValue(value);
|
|
140
|
+
}
|
|
141
|
+
}));
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
var WithCustomColors = exports.WithCustomColors = {
|
|
145
|
+
render: function render() {
|
|
146
|
+
var _React$useState7 = _react["default"].useState(20),
|
|
147
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
148
|
+
sliderValue = _React$useState8[0],
|
|
149
|
+
setSliderValue = _React$useState8[1];
|
|
150
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
151
|
+
style: {
|
|
152
|
+
width: '300px'
|
|
153
|
+
}
|
|
154
|
+
}, /*#__PURE__*/_react["default"].createElement(_RangeSlider["default"], {
|
|
155
|
+
label: "Custom Styled Range",
|
|
156
|
+
min: 0,
|
|
157
|
+
max: 100,
|
|
158
|
+
value: sliderValue,
|
|
159
|
+
className: "custom-range",
|
|
160
|
+
showBubble: true,
|
|
161
|
+
inputStyle: {
|
|
162
|
+
// Track styles
|
|
163
|
+
background: "linear-gradient(to right, #22c55e 0%, #22c55e ".concat(sliderValue, "%, #dcfce7 ").concat(sliderValue, "%, #dcfce7 100%)"),
|
|
164
|
+
height: '6px',
|
|
165
|
+
borderRadius: '3px',
|
|
166
|
+
outline: 'none',
|
|
167
|
+
WebkitAppearance: 'none',
|
|
168
|
+
cursor: 'pointer',
|
|
169
|
+
padding: '0px'
|
|
170
|
+
},
|
|
171
|
+
onChange: function onChange(value) {
|
|
172
|
+
console.log('Range changed:', value);
|
|
173
|
+
setSliderValue(value);
|
|
174
|
+
}
|
|
175
|
+
}));
|
|
78
176
|
}
|
|
79
177
|
};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.Default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _SearchableDropdown = _interopRequireDefault(require("../SearchableDropdown"));
|
|
9
|
+
var _dataLoader = _interopRequireDefault(require("../../../core/dataLoader"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
12
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
13
|
+
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."); }
|
|
14
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
15
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
16
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
17
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
18
|
+
// Set up mock request configuration
|
|
19
|
+
_dataLoader["default"].addRequestConfig('getFieldValue', {
|
|
20
|
+
url: 'https://jsonplaceholder.typicode.com/users',
|
|
21
|
+
method: 'GET'
|
|
22
|
+
});
|
|
23
|
+
var meta = {
|
|
24
|
+
title: 'Components/Form/SearchableDropdown',
|
|
25
|
+
component: _SearchableDropdown["default"],
|
|
26
|
+
parameters: {
|
|
27
|
+
layout: 'centered'
|
|
28
|
+
},
|
|
29
|
+
tags: ['autodocs']
|
|
30
|
+
};
|
|
31
|
+
var _default = exports["default"] = meta;
|
|
32
|
+
var Default = exports.Default = {
|
|
33
|
+
args: {
|
|
34
|
+
paginationType: 'SERVER',
|
|
35
|
+
requestId: 'getFieldValue',
|
|
36
|
+
perPageKey: '_limit',
|
|
37
|
+
pageNoKey: '_page',
|
|
38
|
+
halign: 'right',
|
|
39
|
+
searchAttribute: 'id',
|
|
40
|
+
noSelectionLabel: 'Select value',
|
|
41
|
+
className: 'searchable-dd',
|
|
42
|
+
name: 'fieldValueDD',
|
|
43
|
+
label: 'Field Value',
|
|
44
|
+
showLabel: true,
|
|
45
|
+
nameAttribute: 'id',
|
|
46
|
+
idAttribute: 'id',
|
|
47
|
+
pageSize: 2,
|
|
48
|
+
maxHeight: 80,
|
|
49
|
+
ddItemHeight: 40,
|
|
50
|
+
searchPlaceholder: "Search with id"
|
|
51
|
+
},
|
|
52
|
+
argTypes: {
|
|
53
|
+
paginationType: {
|
|
54
|
+
control: 'select',
|
|
55
|
+
options: ['SERVER', 'CLIENT'],
|
|
56
|
+
description: 'Type of pagination'
|
|
57
|
+
},
|
|
58
|
+
requestId: {
|
|
59
|
+
control: 'text',
|
|
60
|
+
description: 'Identifier for the API request configuration'
|
|
61
|
+
},
|
|
62
|
+
perPageKey: {
|
|
63
|
+
control: 'text',
|
|
64
|
+
description: 'Query parameter for items per page'
|
|
65
|
+
},
|
|
66
|
+
pageNoKey: {
|
|
67
|
+
control: 'text',
|
|
68
|
+
description: 'Query parameter for page number'
|
|
69
|
+
},
|
|
70
|
+
halign: {
|
|
71
|
+
control: 'select',
|
|
72
|
+
options: ['left', 'right'],
|
|
73
|
+
description: 'Horizontal alignment of the dropdown'
|
|
74
|
+
},
|
|
75
|
+
searchAttribute: {
|
|
76
|
+
control: 'text',
|
|
77
|
+
description: 'Field to search against'
|
|
78
|
+
},
|
|
79
|
+
requestParams: {
|
|
80
|
+
control: 'object',
|
|
81
|
+
description: 'Additional request parameters'
|
|
82
|
+
},
|
|
83
|
+
noSelectionLabel: {
|
|
84
|
+
control: 'text',
|
|
85
|
+
description: 'Label shown when no value is selected'
|
|
86
|
+
},
|
|
87
|
+
className: {
|
|
88
|
+
control: 'text',
|
|
89
|
+
description: 'Additional CSS classes'
|
|
90
|
+
},
|
|
91
|
+
name: {
|
|
92
|
+
control: 'text',
|
|
93
|
+
description: 'Name attribute for the dropdown'
|
|
94
|
+
},
|
|
95
|
+
label: {
|
|
96
|
+
control: 'text',
|
|
97
|
+
description: 'Label text'
|
|
98
|
+
},
|
|
99
|
+
showLabel: {
|
|
100
|
+
control: 'boolean',
|
|
101
|
+
description: 'Whether to show the label'
|
|
102
|
+
},
|
|
103
|
+
nameAttribute: {
|
|
104
|
+
control: 'text',
|
|
105
|
+
description: 'Field to use as item label'
|
|
106
|
+
},
|
|
107
|
+
pageSize: {
|
|
108
|
+
control: 'number',
|
|
109
|
+
description: 'Number of items per page'
|
|
110
|
+
},
|
|
111
|
+
maxHeight: {
|
|
112
|
+
control: 'number',
|
|
113
|
+
description: 'Maximum height of dropdown list'
|
|
114
|
+
},
|
|
115
|
+
ddItemHeight: {
|
|
116
|
+
control: 'number',
|
|
117
|
+
description: 'Height of each dropdown item'
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
render: function render(args) {
|
|
121
|
+
var _React$useState = _react["default"].useState(null),
|
|
122
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
123
|
+
selectedValue = _React$useState2[0],
|
|
124
|
+
setSelectedValue = _React$useState2[1];
|
|
125
|
+
var ddRef = _react["default"].useRef(null);
|
|
126
|
+
|
|
127
|
+
// Mock response formatter
|
|
128
|
+
var valuesResponseFormatter = function valuesResponseFormatter(response) {
|
|
129
|
+
return {
|
|
130
|
+
entries: response,
|
|
131
|
+
total: response.length ? 10 : 0
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// Custom dropdown item component
|
|
136
|
+
var ValueDropdownItem = function ValueDropdownItem(props) {
|
|
137
|
+
var index = props.index,
|
|
138
|
+
data = props.data,
|
|
139
|
+
style = props.style;
|
|
140
|
+
var items = data.items;
|
|
141
|
+
if (items.length === 0) return null;
|
|
142
|
+
var itemData = items[index];
|
|
143
|
+
if (!itemData) return null;
|
|
144
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
145
|
+
style: {
|
|
146
|
+
width: '300px'
|
|
147
|
+
}
|
|
148
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
149
|
+
onClick: function onClick() {
|
|
150
|
+
setSelectedValue(itemData);
|
|
151
|
+
ddRef.current.closeDropdown();
|
|
152
|
+
},
|
|
153
|
+
style: style
|
|
154
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, itemData.id)));
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// Mock loader component
|
|
158
|
+
var PageLoader = function PageLoader(_ref) {
|
|
159
|
+
var className = _ref.className;
|
|
160
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
161
|
+
className: className,
|
|
162
|
+
style: {
|
|
163
|
+
padding: '10px',
|
|
164
|
+
textAlign: 'center'
|
|
165
|
+
}
|
|
166
|
+
}, "Loading...");
|
|
167
|
+
};
|
|
168
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
169
|
+
style: {
|
|
170
|
+
width: '300px',
|
|
171
|
+
height: '150px'
|
|
172
|
+
}
|
|
173
|
+
}, /*#__PURE__*/_react["default"].createElement(_SearchableDropdown["default"], _extends({}, args, {
|
|
174
|
+
ref: ddRef,
|
|
175
|
+
LoaderComponent: /*#__PURE__*/_react["default"].createElement(PageLoader, {
|
|
176
|
+
className: "search-loader"
|
|
177
|
+
}),
|
|
178
|
+
DropdownItem: ValueDropdownItem,
|
|
179
|
+
responseFormatter: valuesResponseFormatter,
|
|
180
|
+
value: selectedValue
|
|
181
|
+
// getUrlParams={getFieldValuesUrlParams}
|
|
182
|
+
,
|
|
183
|
+
|
|
184
|
+
onChange: function onChange(value) {
|
|
185
|
+
return setSelectedValue(value);
|
|
186
|
+
}
|
|
187
|
+
})));
|
|
188
|
+
}
|
|
189
|
+
};
|