@react-fabric/form 1.0.0-beta.4 → 1.0.0-beta.40
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/{src/input/ArrayInput.module.css → css/_arrayInput.css} +8 -8
- package/css/_colorPicker.css +65 -0
- package/{src/internal/Field.module.css → css/_field.css} +26 -15
- package/{src/input/File.module.css → css/_file.css} +20 -6
- package/css/styles.css +27 -0
- package/dist/cjs/builder/FileField.js +37 -25
- package/dist/cjs/builder/FormField.js +44 -34
- package/dist/cjs/builder/SchemaEditor.js +72 -0
- package/dist/cjs/builder/components/AddSchemaFields.js +62 -0
- package/dist/cjs/builder/components/SchemaArrayForm.js +143 -0
- package/dist/cjs/builder/components/SchemaField.js +413 -0
- package/dist/cjs/form/Controller.js +1 -1
- package/dist/cjs/form/Form.js +19 -10
- package/dist/cjs/hooks/useFormBuilder.js +27 -15
- package/dist/cjs/index.js +9 -2
- package/dist/cjs/input/ArrayInput.js +36 -25
- package/dist/cjs/input/AvatarInput.js +1 -1
- package/dist/cjs/input/Checkbox.js +5 -4
- package/dist/cjs/input/ColorInput.js +70 -28
- package/dist/cjs/input/ColorPicker.js +1 -35
- package/dist/cjs/input/DateInput.js +183 -0
- package/dist/cjs/input/Field.js +4 -4
- package/dist/cjs/input/File.js +2 -3
- package/dist/cjs/input/Hidden.js +3 -1
- package/dist/cjs/input/Input.js +1 -1
- package/dist/cjs/input/Number.js +1 -1
- package/dist/cjs/input/Password.js +1 -1
- package/dist/cjs/input/Radio.js +1 -1
- package/dist/cjs/input/RadioGroup.js +6 -3
- package/dist/cjs/input/{Range.js → RangeSlider.js} +3 -3
- package/dist/cjs/input/Search.js +1 -1
- package/dist/cjs/input/Slider.js +1 -1
- package/dist/cjs/input/Switch.js +27 -5
- package/dist/cjs/input/Textarea.js +7 -3
- package/dist/cjs/internal/ErrorIcon.js +1 -1
- package/dist/cjs/internal/FieldWrapper.js +4 -3
- package/dist/cjs/internal/InputWrapper.js +14 -16
- package/dist/cjs/select/AutoComplete.js +1 -1
- package/dist/cjs/select/List.js +41 -20
- package/dist/cjs/select/Options.js +2 -2
- package/dist/cjs/select/Select.js +11 -8
- package/dist/cjs/select/useSelect.js +12 -7
- package/{src/input/ColorPicker.module.css → dist/cjs/types/schema.js} +18 -27
- package/dist/cjs/utils/getColor.js +6 -0
- package/dist/esm/builder/FileField.js +39 -27
- package/dist/esm/builder/FormField.js +44 -34
- package/dist/esm/builder/SchemaEditor.js +72 -0
- package/dist/esm/builder/components/AddSchemaFields.js +62 -0
- package/dist/esm/builder/components/SchemaArrayForm.js +143 -0
- package/dist/esm/builder/components/SchemaField.js +413 -0
- package/dist/esm/form/Controller.js +1 -1
- package/dist/esm/form/Form.js +19 -10
- package/dist/esm/hooks/useFormBuilder.js +25 -13
- package/dist/esm/index.js +4 -1
- package/dist/esm/input/ArrayInput.js +38 -27
- package/dist/esm/input/AvatarInput.js +1 -1
- package/dist/esm/input/Checkbox.js +5 -4
- package/dist/esm/input/ColorInput.js +72 -30
- package/dist/esm/input/ColorPicker.js +1 -35
- package/dist/esm/input/DateInput.js +183 -0
- package/dist/esm/input/Field.js +5 -5
- package/dist/esm/input/File.js +2 -3
- package/dist/esm/input/Hidden.js +3 -1
- package/dist/esm/input/Input.js +1 -1
- package/dist/esm/input/Number.js +1 -1
- package/dist/esm/input/Password.js +1 -1
- package/dist/esm/input/Radio.js +1 -1
- package/dist/esm/input/RadioGroup.js +7 -4
- package/dist/esm/input/{Range.js → RangeSlider.js} +3 -3
- package/dist/esm/input/Search.js +1 -1
- package/dist/esm/input/Slider.js +1 -1
- package/dist/esm/input/Switch.js +29 -7
- package/dist/esm/input/Textarea.js +7 -3
- package/dist/esm/internal/ErrorIcon.js +1 -1
- package/dist/esm/internal/FieldWrapper.js +4 -3
- package/dist/esm/internal/InputWrapper.js +14 -16
- package/dist/esm/select/AutoComplete.js +1 -1
- package/dist/esm/select/List.js +42 -21
- package/dist/esm/select/Options.js +2 -2
- package/dist/esm/select/Select.js +11 -8
- package/dist/esm/select/useSelect.js +13 -8
- package/dist/esm/types/schema.js +41 -0
- package/dist/esm/utils/getColor.js +6 -1
- package/dist/types/builder/FileField.d.ts +4 -2
- package/dist/types/builder/FormField.d.ts +3 -1
- package/dist/types/builder/SchemaEditor.d.ts +2 -0
- package/dist/types/builder/components/AddSchemaFields.d.ts +2 -0
- package/dist/types/builder/components/SchemaArrayForm.d.ts +2 -0
- package/dist/types/builder/components/SchemaField.d.ts +10 -0
- package/dist/types/form/Controller.d.ts +1 -1
- package/dist/types/hooks/useFormBuilder.d.ts +3 -1
- package/dist/types/index.d.ts +4 -2
- package/dist/types/input/ArrayInput.d.ts +20 -3
- package/dist/types/input/Checkbox.d.ts +4 -3
- package/dist/types/input/ColorInput.d.ts +1 -1
- package/dist/types/input/DateInput.d.ts +19 -0
- package/dist/types/input/RadioGroup.d.ts +18 -2
- package/dist/types/input/{Range.d.ts → RangeSlider.d.ts} +1 -1
- package/dist/types/input/Switch.d.ts +7 -3
- package/dist/types/input/Textarea.d.ts +5 -1
- package/dist/types/internal/InputWrapper.d.ts +1 -1
- package/dist/types/select/List.d.ts +1 -1
- package/dist/types/types/index.d.ts +9 -5
- package/dist/types/types/schema.d.ts +79 -33
- package/package.json +10 -7
- package/src/builder/FileField.tsx +53 -27
- package/src/builder/FormField.tsx +45 -32
- package/src/builder/SchemaEditor.tsx +72 -0
- package/src/builder/components/AddSchemaFields.tsx +74 -0
- package/src/builder/components/SchemaArrayForm.tsx +158 -0
- package/src/builder/components/SchemaField.tsx +435 -0
- package/src/form/Controller.tsx +2 -2
- package/src/form/Form.tsx +15 -8
- package/src/hooks/useFormBuilder.tsx +29 -15
- package/src/index.ts +10 -2
- package/src/input/ArrayInput.tsx +80 -42
- package/src/input/AvatarInput.tsx +1 -1
- package/src/input/Checkbox.tsx +5 -4
- package/src/input/ColorInput.tsx +102 -34
- package/src/input/ColorPicker.tsx +1 -35
- package/src/input/DateInput.tsx +248 -0
- package/src/input/Field.tsx +9 -11
- package/src/input/File.tsx +3 -6
- package/src/input/Hidden.tsx +4 -1
- package/src/input/Input.tsx +2 -2
- package/src/input/Number.tsx +2 -2
- package/src/input/Password.tsx +2 -2
- package/src/input/Radio.tsx +1 -1
- package/src/input/RadioGroup.tsx +27 -4
- package/src/input/{Range.tsx → RangeSlider.tsx} +2 -2
- package/src/input/Search.tsx +2 -2
- package/src/input/Slider.tsx +1 -1
- package/src/input/Switch.tsx +42 -6
- package/src/input/Textarea.tsx +11 -3
- package/src/internal/ErrorIcon.tsx +1 -1
- package/src/internal/FieldWrapper.tsx +3 -3
- package/src/internal/InputWrapper.tsx +21 -20
- package/src/select/AutoComplete.tsx +1 -1
- package/src/select/List.tsx +34 -7
- package/src/select/Options.tsx +1 -1
- package/src/select/Select.tsx +5 -2
- package/src/select/useSelect.tsx +27 -18
- package/src/types/index.ts +14 -7
- package/src/types/schema.ts +96 -41
- package/dist/cjs/input/ArrayInput.module.css +0 -1
- package/dist/cjs/input/ColorPicker.module.css +0 -1
- package/dist/cjs/input/File.module.css +0 -1
- package/dist/cjs/internal/Field.module.css +0 -1
- package/dist/esm/input/ArrayInput.module.css +0 -1
- package/dist/esm/input/ColorPicker.module.css +0 -1
- package/dist/esm/input/File.module.css +0 -1
- package/dist/esm/internal/Field.module.css +0 -1
package/dist/esm/select/List.js
CHANGED
|
@@ -6,33 +6,34 @@ import { useFloating, autoUpdate, useListNavigation, useTypeahead, useInteractio
|
|
|
6
6
|
import { Chip } from '@react-fabric/core';
|
|
7
7
|
import { isArray, isEmpty } from '@react-fabric/utilities';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
|
-
import { useMemo, Fragment, useId, useCallback } from 'react';
|
|
9
|
+
import { useMemo, Fragment, useId, useCallback, useLayoutEffect } from 'react';
|
|
10
10
|
import { FieldWrapper } from '../internal/FieldWrapper.js';
|
|
11
11
|
import { InputWrapper } from '../internal/InputWrapper.js';
|
|
12
12
|
import { Options } from './Options.js';
|
|
13
13
|
import { useSelect } from './useSelect.js';
|
|
14
14
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
15
15
|
|
|
16
|
-
var _excluded = ["ref", "name", "value", "readOnly", "disabled", "required", "placeholder", "autoFocus", "options", "height", "groupProperty", "labelProperty", "valueProperty", "multiple", "allowCreate", "createOption", "matcher", "renderer", "onQuery", "onChange", "onSelect", "onEnterPressed", "invalid", "error", "allowClear", "decorateStart", "decorateEnd", "data-inner", "data-hide-selected"];
|
|
16
|
+
var _excluded = ["ref", "name", "value", "readOnly", "disabled", "required", "placeholder", "autoFocus", "options", "height", "groupProperty", "labelProperty", "valueProperty", "multiple", "allowCreate", "searchable", "createOption", "matcher", "renderer", "onQuery", "onChange", "onSelect", "onEnterPressed", "invalid", "error", "allowClear", "decorateStart", "decorateEnd", "data-inner", "data-hide-selected"];
|
|
17
17
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
18
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
19
|
var List = function List(_ref) {
|
|
20
20
|
var _state$query;
|
|
21
|
-
_ref.ref
|
|
22
|
-
|
|
21
|
+
var ref = _ref.ref,
|
|
22
|
+
name = _ref.name,
|
|
23
23
|
value = _ref.value,
|
|
24
24
|
readOnly = _ref.readOnly,
|
|
25
25
|
disabled = _ref.disabled,
|
|
26
26
|
required = _ref.required,
|
|
27
|
-
placeholder = _ref.placeholder
|
|
28
|
-
_ref.autoFocus
|
|
29
|
-
|
|
27
|
+
placeholder = _ref.placeholder,
|
|
28
|
+
autoFocus = _ref.autoFocus,
|
|
29
|
+
options = _ref.options,
|
|
30
30
|
height = _ref.height,
|
|
31
31
|
groupProperty = _ref.groupProperty,
|
|
32
32
|
labelProperty = _ref.labelProperty,
|
|
33
33
|
valueProperty = _ref.valueProperty,
|
|
34
34
|
multiple = _ref.multiple,
|
|
35
35
|
allowCreate = _ref.allowCreate,
|
|
36
|
+
searchable = _ref.searchable,
|
|
36
37
|
createOption = _ref.createOption,
|
|
37
38
|
matcher = _ref.matcher,
|
|
38
39
|
renderer = _ref.renderer,
|
|
@@ -138,9 +139,10 @@ var List = function List(_ref) {
|
|
|
138
139
|
}
|
|
139
140
|
} else if (evt.key === "Backspace") {
|
|
140
141
|
!state.query && handleRemove();
|
|
141
|
-
} else if (["ArrowUp", "ArrowDown"].includes(evt.key)) {
|
|
142
|
-
if (state.activeIndex === null) {
|
|
143
|
-
|
|
142
|
+
} else if (!searchable || ["ArrowUp", "ArrowDown"].includes(evt.key)) {
|
|
143
|
+
if (["ArrowUp", "ArrowDown"].includes(evt.key) && state.activeIndex === null) {
|
|
144
|
+
var _state$selectedIndex;
|
|
145
|
+
setActiveIndex((_state$selectedIndex = state.selectedIndex) !== null && _state$selectedIndex !== void 0 ? _state$selectedIndex : 0);
|
|
144
146
|
}
|
|
145
147
|
setTimeout(function () {
|
|
146
148
|
var _props$onKeyDown;
|
|
@@ -185,6 +187,14 @@ var List = function List(_ref) {
|
|
|
185
187
|
});
|
|
186
188
|
}
|
|
187
189
|
}, [state.value, state.query, placeholder, renderer]);
|
|
190
|
+
useLayoutEffect(function () {
|
|
191
|
+
setTimeout(function () {
|
|
192
|
+
var _listRef$current$stat;
|
|
193
|
+
state.selectedIndex && ((_listRef$current$stat = listRef.current[state.selectedIndex]) === null || _listRef$current$stat === void 0 ? void 0 : _listRef$current$stat.scrollIntoView({
|
|
194
|
+
block: "center"
|
|
195
|
+
}));
|
|
196
|
+
}, 100);
|
|
197
|
+
}, [state.selectedIndex]);
|
|
188
198
|
return /*#__PURE__*/jsxs(Wrapper, _objectSpread(_objectSpread({}, wrapperProps), {}, {
|
|
189
199
|
children: [/*#__PURE__*/jsx(InputWrapper, {
|
|
190
200
|
showClear: !isEmpty(state.value),
|
|
@@ -197,23 +207,32 @@ var List = function List(_ref) {
|
|
|
197
207
|
className: "z-1 rounded-b-none",
|
|
198
208
|
"data-inner": true,
|
|
199
209
|
wrapperRef: refs.setReference,
|
|
200
|
-
children: /*#__PURE__*/jsxs("div", {
|
|
210
|
+
children: /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({
|
|
211
|
+
role: "none",
|
|
201
212
|
"data-select-display": "true",
|
|
202
|
-
className: "group flex-1 py-1 px-2 truncate text-start flex gap-1 flex-wrap"
|
|
203
|
-
|
|
213
|
+
className: classNames("group flex-1 py-1 px-2 truncate text-start flex gap-1 relative min-h-5 justify-start", multiple ? "flex-wrap" : "flex-nowrap overflow-hidden")
|
|
214
|
+
}, referenceProps), {}, {
|
|
215
|
+
onMouseUp: function onMouseUp(e) {
|
|
216
|
+
var _e$currentTarget$quer;
|
|
217
|
+
return (_e$currentTarget$quer = e.currentTarget.querySelector("input")) === null || _e$currentTarget$quer === void 0 ? void 0 : _e$currentTarget$quer.focus();
|
|
218
|
+
},
|
|
219
|
+
children: [!hideSelected && displayValue, /*#__PURE__*/jsx("input", {
|
|
220
|
+
readOnly: !searchable || readOnly,
|
|
204
221
|
disabled: disabled,
|
|
205
222
|
value: (_state$query = state.query) !== null && _state$query !== void 0 ? _state$query : "",
|
|
206
223
|
"aria-invalid": invalid,
|
|
207
224
|
"data-testid": name,
|
|
208
225
|
name: name,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
226
|
+
size: 1,
|
|
227
|
+
ref: ref,
|
|
228
|
+
autoFocus: autoFocus,
|
|
229
|
+
className: classNames("appearance-none bg-transparent outline-none border-none ring-0 flex-1 min-w-24", disabled && "cursor-not-allowed pointer-events-none", multiple && "min-w-24"),
|
|
230
|
+
placeholder: isEmpty(state.value) ? placeholder : "",
|
|
212
231
|
onChange: function onChange(evt) {
|
|
213
232
|
return handleQuery(evt.target.value);
|
|
214
233
|
}
|
|
215
|
-
})
|
|
216
|
-
})
|
|
234
|
+
})]
|
|
235
|
+
}))
|
|
217
236
|
}), /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
218
237
|
context: context,
|
|
219
238
|
initialFocus: -1,
|
|
@@ -227,11 +246,13 @@ var List = function List(_ref) {
|
|
|
227
246
|
}, floatingProps), {}, {
|
|
228
247
|
items: state.items,
|
|
229
248
|
active: state.activeIndex,
|
|
249
|
+
valueProperty: valueProperty,
|
|
250
|
+
labelProperty: labelProperty,
|
|
230
251
|
itemRef: setItemRef,
|
|
231
252
|
itemProps: makeItemProps,
|
|
232
|
-
children: function children(item) {
|
|
233
|
-
var
|
|
234
|
-
return (
|
|
253
|
+
children: function children(item, label) {
|
|
254
|
+
var _renderer3;
|
|
255
|
+
return (_renderer3 = renderer === null || renderer === void 0 ? void 0 : renderer(item)) !== null && _renderer3 !== void 0 ? _renderer3 : label;
|
|
235
256
|
}
|
|
236
257
|
}))
|
|
237
258
|
})]
|
|
@@ -34,7 +34,7 @@ var Options = function Options(_ref) {
|
|
|
34
34
|
i18nKey: "form:select.emptyList"
|
|
35
35
|
})
|
|
36
36
|
})), items.map(function (item, index) {
|
|
37
|
-
var _item$labelProperty;
|
|
37
|
+
var _item$value, _item$labelProperty;
|
|
38
38
|
if (item.___group___) return /*#__PURE__*/jsx("p", {
|
|
39
39
|
className: "px-2 py-1 text-muted text-xs sticky -top-px z-2 bg-base border-t",
|
|
40
40
|
children: item.label
|
|
@@ -51,7 +51,7 @@ var Options = function Options(_ref) {
|
|
|
51
51
|
children: /*#__PURE__*/jsx(Trans, {
|
|
52
52
|
i18nKey: "form:select.createOption",
|
|
53
53
|
values: {
|
|
54
|
-
query: item.value
|
|
54
|
+
query: (_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item
|
|
55
55
|
},
|
|
56
56
|
components: [/*#__PURE__*/jsx("strong", {
|
|
57
57
|
children: "query"
|
|
@@ -140,6 +140,9 @@ var Select = function Select(_ref) {
|
|
|
140
140
|
return false;
|
|
141
141
|
} else if (state.query) {
|
|
142
142
|
handleQuery("");
|
|
143
|
+
evt.preventDefault();
|
|
144
|
+
evt.stopPropagation();
|
|
145
|
+
return false;
|
|
143
146
|
} else {
|
|
144
147
|
onEnterPressed === null || onEnterPressed === void 0 || onEnterPressed(evt);
|
|
145
148
|
}
|
|
@@ -217,15 +220,16 @@ var Select = function Select(_ref) {
|
|
|
217
220
|
wrapperRef: refs.setReference,
|
|
218
221
|
className: state.open ? "!z-[99]" : ""
|
|
219
222
|
}, rest), {}, {
|
|
220
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
223
|
+
children: [/*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({
|
|
221
224
|
role: "none",
|
|
222
225
|
"data-select-display": "true",
|
|
223
|
-
className: classNames("group flex-1 py-1 px-2 truncate text-start flex gap-1 relative min-h-5 justify-start", multiple ? "flex-wrap" : "flex-nowrap overflow-hidden")
|
|
226
|
+
className: classNames("group flex-1 py-1 px-2 truncate text-start flex gap-1 relative min-h-5 justify-start", multiple ? "flex-wrap" : "flex-nowrap overflow-hidden")
|
|
227
|
+
}, referenceProps), {}, {
|
|
224
228
|
onMouseUp: function onMouseUp(e) {
|
|
225
229
|
var _e$currentTarget$quer;
|
|
226
230
|
return (_e$currentTarget$quer = e.currentTarget.querySelector("input")) === null || _e$currentTarget$quer === void 0 ? void 0 : _e$currentTarget$quer.focus();
|
|
227
231
|
},
|
|
228
|
-
children: [displayValue, /*#__PURE__*/jsx("input",
|
|
232
|
+
children: [displayValue, /*#__PURE__*/jsx("input", {
|
|
229
233
|
readOnly: !searchable || readOnly,
|
|
230
234
|
disabled: disabled,
|
|
231
235
|
value: (_state$query = state.query) !== null && _state$query !== void 0 ? _state$query : "",
|
|
@@ -236,13 +240,12 @@ var Select = function Select(_ref) {
|
|
|
236
240
|
ref: ref,
|
|
237
241
|
autoFocus: autoFocus,
|
|
238
242
|
className: classNames("appearance-none bg-transparent outline-none border-none ring-0 flex-1", disabled && "cursor-not-allowed pointer-events-none", multiple && "min-w-24"),
|
|
239
|
-
placeholder: isEmpty(state.value) ? placeholder : ""
|
|
240
|
-
}, referenceProps), {}, {
|
|
243
|
+
placeholder: isEmpty(state.value) ? placeholder : "",
|
|
241
244
|
onChange: function onChange(evt) {
|
|
242
245
|
return handleQuery(evt.target.value);
|
|
243
246
|
}
|
|
244
|
-
})
|
|
245
|
-
}), !state.loading && /*#__PURE__*/jsx(Icon, {
|
|
247
|
+
})]
|
|
248
|
+
})), !state.loading && /*#__PURE__*/jsx(Icon, {
|
|
246
249
|
className: classNames("flex-content p-2 z-0 order-9 text-muted cursor-pointer self-stretch flex items-center h-auto", state.open && "-scale-y-100 pointer-events-none", disabled && "pointer-events-none"),
|
|
247
250
|
onClick: function onClick() {
|
|
248
251
|
return !disabled && openDropdown();
|
|
@@ -259,7 +262,7 @@ var Select = function Select(_ref) {
|
|
|
259
262
|
visuallyHiddenDismiss: true,
|
|
260
263
|
children: /*#__PURE__*/jsx(Options, _objectSpread(_objectSpread({
|
|
261
264
|
ref: refs.setFloating,
|
|
262
|
-
className: "outline shadow-lg max-h-[40vh] z-
|
|
265
|
+
className: "outline shadow-lg max-h-[40vh] z-(--z-popover)",
|
|
263
266
|
style: _objectSpread({
|
|
264
267
|
width: (_refs$reference$curre = refs.reference.current) === null || _refs$reference$curre === void 0 ? void 0 : _refs$reference$curre.getBoundingClientRect().width
|
|
265
268
|
}, floatingStyles)
|
|
@@ -4,7 +4,7 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
|
4
4
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
5
5
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
6
6
|
import { useDebounce } from '@react-fabric/core';
|
|
7
|
-
import { matchString, dedupe, groupBy, isArray, EMPTY_ARRAY } from '@react-fabric/utilities';
|
|
7
|
+
import { matchString, isString, dedupe, compareValues, groupBy, isArray, EMPTY_ARRAY } from '@react-fabric/utilities';
|
|
8
8
|
import { useMemo, useDeferredValue, useRef, useCallback, useReducer, useEffect } from 'react';
|
|
9
9
|
import { getSelectedValue, makeOption } from './helpers.js';
|
|
10
10
|
|
|
@@ -88,7 +88,7 @@ var useSelect = function useSelect(_ref) {
|
|
|
88
88
|
if (action.value !== undefined) {
|
|
89
89
|
if (multiple) {
|
|
90
90
|
var values = [];
|
|
91
|
-
if (action.value
|
|
91
|
+
if (isString(action.value)) values.push.apply(values, _toConsumableArray(action.value.split(/,\s?/)));else values.push(action.value);
|
|
92
92
|
newState.value = _toConsumableArray(state.value);
|
|
93
93
|
values.forEach(function (value) {
|
|
94
94
|
var _newState$value$inclu, _newState$value;
|
|
@@ -133,13 +133,14 @@ var useSelect = function useSelect(_ref) {
|
|
|
133
133
|
if (autoComplete && action.query !== undefined) {
|
|
134
134
|
optionList = dedupe([action.query].concat(_toConsumableArray(optionList)));
|
|
135
135
|
}
|
|
136
|
+
optionList = optionList.sort(compareValues("asc", labelProperty));
|
|
136
137
|
var grouped = groupBy(optionList, groupProperty, "");
|
|
137
138
|
if (action.open) _newState.open = true;
|
|
138
139
|
_newState.items = [];
|
|
139
140
|
// add new item if allowCreate
|
|
140
141
|
if (allowCreate && action.query) _newState.items.push({
|
|
141
142
|
___create___: true,
|
|
142
|
-
value:
|
|
143
|
+
value: action.query
|
|
143
144
|
});
|
|
144
145
|
Object.entries(grouped).forEach(function (_ref2) {
|
|
145
146
|
var _newState$items;
|
|
@@ -201,22 +202,22 @@ var useSelect = function useSelect(_ref) {
|
|
|
201
202
|
});
|
|
202
203
|
dispatch({
|
|
203
204
|
type: "setValue",
|
|
204
|
-
value: (_ref4 = hasValue !== null && hasValue !== void 0 ? hasValue : newOption) !== null && _ref4 !== void 0 ? _ref4 :
|
|
205
|
+
value: (_ref4 = hasValue !== null && hasValue !== void 0 ? hasValue : newOption) !== null && _ref4 !== void 0 ? _ref4 : deferred
|
|
205
206
|
});
|
|
206
207
|
}
|
|
207
208
|
if (multiple) {
|
|
208
209
|
optionsRef.current = [];
|
|
209
|
-
var _value = (deferred
|
|
210
|
+
var _value = (isArray(deferred) ? deferred : []).map(function (item) {
|
|
210
211
|
var _ref5;
|
|
211
212
|
var newOption = (allowCreate || autoComplete) && item ? createOption(item) : undefined;
|
|
212
213
|
var hasValue = options.find(function (opt) {
|
|
213
214
|
var _opt$valueProperty2;
|
|
214
|
-
return ((_opt$valueProperty2 = opt[valueProperty]) !== null && _opt$valueProperty2 !== void 0 ? _opt$valueProperty2 : opt) ===
|
|
215
|
+
return ((_opt$valueProperty2 = opt[valueProperty]) !== null && _opt$valueProperty2 !== void 0 ? _opt$valueProperty2 : opt) === item;
|
|
215
216
|
});
|
|
216
217
|
if (!hasValue && newOption) {
|
|
217
218
|
optionsRef.current.push(newOption);
|
|
218
219
|
}
|
|
219
|
-
return (_ref5 = hasValue !== null && hasValue !== void 0 ? hasValue : newOption) !== null && _ref5 !== void 0 ? _ref5 :
|
|
220
|
+
return (_ref5 = hasValue !== null && hasValue !== void 0 ? hasValue : newOption) !== null && _ref5 !== void 0 ? _ref5 : item;
|
|
220
221
|
});
|
|
221
222
|
optionsRef.current = [].concat(_toConsumableArray(optionsRef.current), _toConsumableArray(options !== null && options !== void 0 ? options : []));
|
|
222
223
|
dispatch({
|
|
@@ -285,7 +286,11 @@ var useSelect = function useSelect(_ref) {
|
|
|
285
286
|
value: value !== null && value !== void 0 && value.___create___ ? value.value : value
|
|
286
287
|
});
|
|
287
288
|
if (value !== null && value !== void 0 && value.___create___) {
|
|
288
|
-
|
|
289
|
+
var val = [value.value];
|
|
290
|
+
if (multiple) {
|
|
291
|
+
val = value.value.split(/,\s?/);
|
|
292
|
+
}
|
|
293
|
+
optionsRef.current = [].concat(_toConsumableArray(optionsRef.current), _toConsumableArray(val.map(createOption)));
|
|
289
294
|
}
|
|
290
295
|
if (autoComplete) {
|
|
291
296
|
optionsRef.current = dedupe([].concat(_toConsumableArray(isArray(values) ? values : [values]), _toConsumableArray(optionsRef.current)));
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* React Fabric
|
|
5
|
+
* @version: 1.0.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* The MIT License (MIT)
|
|
9
|
+
* Copyright (c) 2024 Adarsh Pastakia
|
|
10
|
+
*
|
|
11
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
12
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
13
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
14
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
15
|
+
* subject to the following conditions:
|
|
16
|
+
*
|
|
17
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
18
|
+
* portions of the Software.
|
|
19
|
+
*
|
|
20
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
21
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
22
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
23
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
var DATA_TYPES = /*#__PURE__*/function (DATA_TYPES) {
|
|
27
|
+
DATA_TYPES["TEXT"] = "text";
|
|
28
|
+
DATA_TYPES["COLOR"] = "color";
|
|
29
|
+
DATA_TYPES["BOOL"] = "bool";
|
|
30
|
+
DATA_TYPES["DATE"] = "date";
|
|
31
|
+
DATA_TYPES["STRING"] = "string";
|
|
32
|
+
DATA_TYPES["NUMBER"] = "number";
|
|
33
|
+
DATA_TYPES["RANGE"] = "range";
|
|
34
|
+
DATA_TYPES["FILE"] = "file";
|
|
35
|
+
DATA_TYPES["AVATAR"] = "avatar";
|
|
36
|
+
DATA_TYPES["SCHEMA"] = "schema";
|
|
37
|
+
return DATA_TYPES;
|
|
38
|
+
}({});
|
|
39
|
+
var SCHEMA_CUSTOM_LIST = "--CUSTOM--";
|
|
40
|
+
|
|
41
|
+
export { DATA_TYPES, SCHEMA_CUSTOM_LIST };
|
|
@@ -35,5 +35,10 @@ var getBgClass = function getBgClass(bg) {
|
|
|
35
35
|
return "bg-".concat(bg);
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
var getColorClass = function getColorClass(color) {
|
|
39
|
+
if (color && !isColor(color)) {
|
|
40
|
+
return "text-".concat(color);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
38
43
|
|
|
39
|
-
export { getBgClass, getColor };
|
|
44
|
+
export { getBgClass, getColor, getColorClass };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type UploadHandler } from "../hooks/useFileUploader";
|
|
2
|
-
import { type FileSchema } from "../types/schema";
|
|
3
|
-
export declare const FileField: ({ uploadHandler, inline, label, accept, multiple,
|
|
2
|
+
import { type FileSchema, type ValueType } from "../types/schema";
|
|
3
|
+
export declare const FileField: ({ uploadHandler, inline, label, accept, value, fileUrl, multiple, invalid, error, ...rest }: Partial<FileSchema & ValueType> & {
|
|
4
4
|
value?: AnyObject;
|
|
5
5
|
inline?: boolean;
|
|
6
|
+
invalid?: boolean;
|
|
7
|
+
error?: AnyObject;
|
|
6
8
|
fileUrl?: (path: string) => string;
|
|
7
9
|
uploadHandler: UploadHandler;
|
|
8
10
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { type UploadHandler } from "../hooks/useFileUploader";
|
|
2
|
+
import { type BaseSelectProps } from "../types";
|
|
2
3
|
import { type SchemaType } from "../types/schema";
|
|
3
|
-
export declare const FormField: ({ id, label, required, inline, prefix, autoFocus,
|
|
4
|
+
export declare const FormField: ({ id, label, required, inline, prefix, autoFocus, optionLists, fileUrl, uploadHandler, ...rest }: SchemaType & {
|
|
4
5
|
inline?: boolean;
|
|
5
6
|
prefix?: string;
|
|
6
7
|
autoFocus?: boolean;
|
|
8
|
+
optionLists?: KeyValue<BaseSelectProps<any>>;
|
|
7
9
|
fileUrl?: (path: string) => string;
|
|
8
10
|
uploadHandler?: UploadHandler;
|
|
9
11
|
}) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type SchemaEditorProps } from "../../types/schema";
|
|
2
|
+
export declare const SchemaField: ({ id, field, fieldId, getModel, onRemove, defaultOpen, optionLists, dynamic, onTypeChange, acceptableTypes, }: {
|
|
3
|
+
id: string;
|
|
4
|
+
field: string;
|
|
5
|
+
fieldId: string;
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
onRemove: () => void;
|
|
8
|
+
getModel: () => KeyValue;
|
|
9
|
+
onTypeChange: (val: KeyValue) => void;
|
|
10
|
+
} & Omit<SchemaEditorProps, "schemaDef" | "onChange">) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,7 +14,7 @@ export interface ControllerProps {
|
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
onBlur: () => void;
|
|
16
16
|
onChange: (value: AnyObject) => void;
|
|
17
|
-
|
|
17
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
18
18
|
}) => ReactElement);
|
|
19
19
|
}
|
|
20
20
|
export declare const Controller: ({ name, children, ...rest }: ControllerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { yup } from "@react-fabric/utilities";
|
|
2
|
+
import { type BaseSelectProps } from "../types";
|
|
2
3
|
import { type FormSchema } from "../types/schema";
|
|
3
4
|
import { type UploadHandler } from "./useFileUploader";
|
|
4
|
-
export declare const useFormBuilder: (schema: FormSchema
|
|
5
|
+
export declare const useFormBuilder: <T extends unknown = string>(schema: FormSchema, options?: {
|
|
5
6
|
prefix?: string;
|
|
6
7
|
inline?: boolean;
|
|
7
8
|
fileUrl?: (path: string) => string;
|
|
8
9
|
uploadHandler?: UploadHandler;
|
|
10
|
+
optionLists?: KeyValue<BaseSelectProps<T>>;
|
|
9
11
|
}) => {
|
|
10
12
|
formDef: import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
schemaDef: yup.ObjectSchema<{
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import "./i18n";
|
|
2
2
|
export { Controller } from "./form/Controller";
|
|
3
3
|
export { Form, type FormRef } from "./form/Form";
|
|
4
|
+
export { SchemaEditor } from "./builder/SchemaEditor";
|
|
4
5
|
export { useFileUploader } from "./hooks/useFileUploader";
|
|
5
6
|
export { useFormBuilder } from "./hooks/useFormBuilder";
|
|
6
|
-
export { type FormSchema } from "./types/schema";
|
|
7
|
+
export { DATA_TYPES, SCHEMA_CUSTOM_LIST, type FormSchema, type SchemaDef, } from "./types/schema";
|
|
7
8
|
export { ArrayInput } from "./input/ArrayInput";
|
|
8
9
|
export { Checkbox } from "./input/Checkbox";
|
|
9
10
|
export { ColorInput } from "./input/ColorInput";
|
|
10
11
|
export { ColorPicker } from "./input/ColorPicker";
|
|
12
|
+
export { DateInput } from "./input/DateInput";
|
|
11
13
|
export { Field } from "./input/Field";
|
|
12
14
|
export { FileInput } from "./input/File";
|
|
13
15
|
export { HiddenInput } from "./input/Hidden";
|
|
@@ -16,7 +18,7 @@ export { Number } from "./input/Number";
|
|
|
16
18
|
export { Password } from "./input/Password";
|
|
17
19
|
export { Radio } from "./input/Radio";
|
|
18
20
|
export { RadioGroup } from "./input/RadioGroup";
|
|
19
|
-
export {
|
|
21
|
+
export { RangeSlider } from "./input/RangeSlider";
|
|
20
22
|
export { Search } from "./input/Search";
|
|
21
23
|
export { Slider } from "./input/Slider";
|
|
22
24
|
export { Switch } from "./input/Switch";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactNode, type
|
|
1
|
+
import { type ReactNode, type Ref } from "react";
|
|
2
2
|
export interface ArrayInputProps {
|
|
3
3
|
/**
|
|
4
4
|
* input label
|
|
@@ -32,6 +32,10 @@ export interface ArrayInputProps {
|
|
|
32
32
|
* minimum required length
|
|
33
33
|
*/
|
|
34
34
|
minItems?: number;
|
|
35
|
+
/**
|
|
36
|
+
* maximum length
|
|
37
|
+
*/
|
|
38
|
+
maxItems?: number;
|
|
35
39
|
/**
|
|
36
40
|
* field name to focus on add
|
|
37
41
|
*/
|
|
@@ -48,11 +52,12 @@ export interface ArrayInputProps {
|
|
|
48
52
|
* add item button label
|
|
49
53
|
*/
|
|
50
54
|
addLabel?: string;
|
|
55
|
+
buttonPosition?: "top" | "bottom" | "both";
|
|
51
56
|
/**
|
|
52
57
|
* fixed length list
|
|
53
58
|
*/
|
|
54
59
|
fixedList?: boolean;
|
|
55
|
-
arrayRef?:
|
|
60
|
+
arrayRef?: Ref<{
|
|
56
61
|
addItem: (item: AnyObject) => void;
|
|
57
62
|
removeItem: (idx: number) => void;
|
|
58
63
|
}>;
|
|
@@ -60,5 +65,17 @@ export interface ArrayInputProps {
|
|
|
60
65
|
* Add item
|
|
61
66
|
*/
|
|
62
67
|
onAdd?: () => AnyObject;
|
|
68
|
+
/**
|
|
69
|
+
* field width
|
|
70
|
+
*/
|
|
71
|
+
width?: number | string;
|
|
72
|
+
/**
|
|
73
|
+
* inline label and input
|
|
74
|
+
*/
|
|
75
|
+
inline?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* label width for inline
|
|
78
|
+
*/
|
|
79
|
+
labelWidth?: string;
|
|
63
80
|
}
|
|
64
|
-
export declare const ArrayInput: ({ name, children, addLabel, fixedList, focusName, onAdd, arrayRef, enableSorting, disabled, readOnly, minItems, ...rest }: ArrayInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
81
|
+
export declare const ArrayInput: ({ name, children, addLabel, fixedList, focusName, buttonPosition, onAdd, arrayRef, enableSorting, disabled, readOnly, minItems, maxItems, ...rest }: ArrayInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
3
|
-
|
|
3
|
+
interface CheckboxProps extends RefProp<HTMLInputElement> {
|
|
4
4
|
/**
|
|
5
5
|
* checkbox label
|
|
6
6
|
*/
|
|
@@ -16,7 +16,7 @@ export interface CheckboxProps extends RefProp<HTMLInputElement> {
|
|
|
16
16
|
/**
|
|
17
17
|
* on checked change
|
|
18
18
|
*/
|
|
19
|
-
onChange?: (checked: boolean
|
|
19
|
+
onChange?: (checked: boolean) => void;
|
|
20
20
|
/**
|
|
21
21
|
* disabled input
|
|
22
22
|
*/
|
|
@@ -43,4 +43,5 @@ export interface CheckboxProps extends RefProp<HTMLInputElement> {
|
|
|
43
43
|
iconChecked?: string;
|
|
44
44
|
name?: string;
|
|
45
45
|
}
|
|
46
|
-
export declare const Checkbox: ({ ref, label, value, name, checked, invalid, disabled, error, width, icon, iconChecked, onChange, ...rest }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export declare const Checkbox: ({ ref, label, value, name, checked, invalid, disabled, error, width, icon, iconChecked, required, onChange, ...rest }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
2
2
|
import { type InputProps } from "../types";
|
|
3
3
|
import { type ColorProps } from "./ColorPicker";
|
|
4
|
-
export interface ColorInputProps extends InputProps, ColorProps, RefProp {
|
|
4
|
+
export interface ColorInputProps extends InputProps, Omit<ColorProps, "onChange">, RefProp {
|
|
5
5
|
/**
|
|
6
6
|
* show eydrop picker
|
|
7
7
|
*/
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
2
|
+
import { type DateLike } from "@react-fabric/date";
|
|
3
|
+
import { type InputProps } from "../types";
|
|
4
|
+
export interface DateProps extends InputProps<string>, RefProp<HTMLInputElement> {
|
|
5
|
+
type?: "date" | "datetime";
|
|
6
|
+
/**
|
|
7
|
+
* date format
|
|
8
|
+
*/
|
|
9
|
+
format?: string;
|
|
10
|
+
/**
|
|
11
|
+
* minimum value
|
|
12
|
+
*/
|
|
13
|
+
min?: DateLike;
|
|
14
|
+
/**
|
|
15
|
+
* maximum value
|
|
16
|
+
*/
|
|
17
|
+
max?: DateLike;
|
|
18
|
+
}
|
|
19
|
+
export declare const DateInput: ({ ref, name, value, invalid, readOnly, disabled, required, placeholder, autoFocus, error, type, onChange, onEnterPressed, format, min, max, ...rest }: DateProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { type
|
|
2
|
+
import { type ChildrenProp, type CssProp } from "@react-fabric/core/dist/types/types";
|
|
3
3
|
import { type Radio } from "./Radio";
|
|
4
4
|
export interface RadioGroupProps extends ChildrenProp<typeof Radio>, CssProp {
|
|
5
5
|
/**
|
|
@@ -14,6 +14,22 @@ export interface RadioGroupProps extends ChildrenProp<typeof Radio>, CssProp {
|
|
|
14
14
|
* field info
|
|
15
15
|
*/
|
|
16
16
|
info?: string;
|
|
17
|
+
/**
|
|
18
|
+
* field width
|
|
19
|
+
*/
|
|
20
|
+
width?: number | string;
|
|
21
|
+
/**
|
|
22
|
+
* inline label and input
|
|
23
|
+
*/
|
|
24
|
+
inline?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* label width for inline
|
|
27
|
+
*/
|
|
28
|
+
labelWidth?: string;
|
|
29
|
+
/**
|
|
30
|
+
* label width for inline
|
|
31
|
+
*/
|
|
32
|
+
optionWidth?: string;
|
|
17
33
|
/**
|
|
18
34
|
* field name
|
|
19
35
|
*/
|
|
@@ -27,4 +43,4 @@ export interface RadioGroupProps extends ChildrenProp<typeof Radio>, CssProp {
|
|
|
27
43
|
*/
|
|
28
44
|
onChange?: (value: AnyObject) => void;
|
|
29
45
|
}
|
|
30
|
-
export declare const RadioGroup: ({ children, name, className, onChange, ...rest }: RadioGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export declare const RadioGroup: ({ children, name, className, optionWidth, onChange, ...rest }: RadioGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -56,4 +56,4 @@ export interface RangeProps extends Omit<InputProps<[number, number]>, "placehol
|
|
|
56
56
|
/**
|
|
57
57
|
* Number Range input
|
|
58
58
|
*/
|
|
59
|
-
export declare const
|
|
59
|
+
export declare const RangeSlider: ({ error, name, value, step, min, max, height, color, vertical, showLabels, showValue, minLabel, maxLabel, ranges, format, autoFocus, disabled, readOnly, onBlur, onChange, onEnterPressed, onFocus, onSlide, invalid, ...rest }: RangeProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -32,11 +32,15 @@ export interface SwitchProps extends RefProp<HTMLInputElement> {
|
|
|
32
32
|
/**
|
|
33
33
|
* cutom Switch icon
|
|
34
34
|
*/
|
|
35
|
-
color?: ColorType;
|
|
35
|
+
color?: string | ColorType;
|
|
36
36
|
/**
|
|
37
37
|
* cutom Switch icon
|
|
38
38
|
*/
|
|
39
|
-
defaultColor?: ColorType;
|
|
39
|
+
defaultColor?: string | ColorType;
|
|
40
40
|
name?: string;
|
|
41
|
+
onLabel?: string;
|
|
42
|
+
onLabelColor?: string | ColorType;
|
|
43
|
+
offLabel?: string;
|
|
44
|
+
offLabelColor?: string | ColorType;
|
|
41
45
|
}
|
|
42
|
-
export declare const Switch: ({ ref, label, checked, invalid, disabled, error, width, color, name, defaultColor, onChange, ...rest }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export declare const Switch: ({ ref, label, checked, invalid, disabled, error, width, color, name, onLabel, offLabel, onLabelColor, offLabelColor, defaultColor, required, onChange, ...rest }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,5 +13,9 @@ export interface TextareaProps extends InputProps, RefProp<HTMLTextAreaElement>
|
|
|
13
13
|
* increment rows on value change
|
|
14
14
|
*/
|
|
15
15
|
variableRows?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* expandable textarea
|
|
18
|
+
*/
|
|
19
|
+
expandable?: boolean;
|
|
16
20
|
}
|
|
17
|
-
export declare const Textarea: ({ ref, value, name, invalid, readOnly, disabled, required, placeholder, autoFocus, rows, maxRows, variableRows, onChange, onEnterPressed, ...rest }: TextareaProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const Textarea: ({ ref, value, name, invalid, readOnly, disabled, required, placeholder, autoFocus, rows, maxRows, variableRows, expandable, onChange, onEnterPressed, ...rest }: TextareaProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const InputWrapper: ({ invalid, error, allowClear, showClear, decorateStart, decorateEnd, children, onClear, noOutline, noBorder, textarea, "data-inner": isInner, "data-open": isOpen, floatingExpand, wrapperRef, width, ...rest }: KeyValue) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare const InputWrapper: ({ invalid, error, allowClear, showClear, decorateStart, decorateEnd, decorateEndShowWhenEmpty, decorateEndHideWhenEmpty, children, onClear, noOutline, noBorder, textarea, textareaExpandable, "data-inner": isInner, "data-open": isOpen, floatingExpand, wrapperRef, width, ...rest }: KeyValue) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type SelectProps } from "../types";
|
|
2
|
-
export declare const List: <T extends unknown = string>({ ref, name, value, readOnly, disabled, required, placeholder, autoFocus, options, height, groupProperty, labelProperty, valueProperty, multiple, allowCreate, createOption, matcher, renderer, onQuery, onChange, onSelect, onEnterPressed, invalid, error, allowClear, decorateStart, decorateEnd, "data-inner": isInner, "data-hide-selected": hideSelected, ...rest }: SelectProps<T> & {
|
|
2
|
+
export declare const List: <T extends unknown = string>({ ref, name, value, readOnly, disabled, required, placeholder, autoFocus, options, height, groupProperty, labelProperty, valueProperty, multiple, allowCreate, searchable, createOption, matcher, renderer, onQuery, onChange, onSelect, onEnterPressed, invalid, error, allowClear, decorateStart, decorateEnd, "data-inner": isInner, "data-hide-selected": hideSelected, ...rest }: SelectProps<T> & {
|
|
3
3
|
height?: string | number;
|
|
4
4
|
}) => import("react/jsx-runtime").JSX.Element;
|