@react-fabric/form 1.0.0-beta.59 → 1.0.0-beta.60
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/dist/cjs/builder/FileField.js +1 -1
- package/dist/cjs/builder/components/SchemaArrayForm.js +3 -1
- package/dist/cjs/input/ArrayInput.js +5 -3
- package/dist/cjs/input/AvatarInput.js +1 -1
- package/dist/cjs/input/Checkbox.js +1 -1
- package/dist/cjs/input/ColorPicker.js +2 -0
- package/dist/cjs/input/Password.js +1 -1
- package/dist/cjs/input/Radio.js +1 -1
- package/dist/cjs/input/RangeSlider.js +2 -2
- package/dist/cjs/input/Slider.js +2 -2
- package/dist/cjs/input/Switch.js +2 -2
- package/dist/cjs/internal/InputWrapper.js +9 -5
- package/dist/cjs/select/AutoComplete.js +1 -1
- package/dist/cjs/select/DualList.js +3 -3
- package/dist/cjs/select/List.js +22 -4
- package/dist/cjs/select/Options.js +2 -2
- package/dist/cjs/select/Select.js +23 -5
- package/dist/esm/builder/FileField.js +1 -1
- package/dist/esm/builder/components/SchemaArrayForm.js +3 -1
- package/dist/esm/input/ArrayInput.js +5 -3
- package/dist/esm/input/AvatarInput.js +1 -1
- package/dist/esm/input/Checkbox.js +1 -1
- package/dist/esm/input/ColorPicker.js +2 -0
- package/dist/esm/input/Password.js +1 -1
- package/dist/esm/input/Radio.js +1 -1
- package/dist/esm/input/RangeSlider.js +2 -2
- package/dist/esm/input/Slider.js +2 -2
- package/dist/esm/input/Switch.js +2 -2
- package/dist/esm/internal/InputWrapper.js +9 -5
- package/dist/esm/select/AutoComplete.js +1 -1
- package/dist/esm/select/DualList.js +3 -3
- package/dist/esm/select/List.js +22 -4
- package/dist/esm/select/Options.js +2 -2
- package/dist/esm/select/Select.js +23 -5
- package/dist/types/input/ArrayInput.d.ts +2 -2
- package/dist/types/input/AvatarInput.d.ts +1 -1
- package/dist/types/select/Options.d.ts +2 -2
- package/package.json +5 -5
- package/src/builder/FileField.tsx +1 -1
- package/src/builder/components/SchemaArrayForm.tsx +5 -2
- package/src/form/Form.tsx +2 -2
- package/src/input/ArrayInput.tsx +5 -6
- package/src/input/AvatarInput.tsx +2 -2
- package/src/input/Checkbox.tsx +1 -1
- package/src/input/ColorPicker.tsx +1 -0
- package/src/input/Password.tsx +1 -1
- package/src/input/Radio.tsx +1 -1
- package/src/input/RangeSlider.tsx +3 -3
- package/src/input/Slider.tsx +5 -5
- package/src/input/Switch.tsx +2 -2
- package/src/internal/InputWrapper.tsx +13 -7
- package/src/select/AutoComplete.tsx +1 -1
- package/src/select/DualList.tsx +8 -8
- package/src/select/List.tsx +1 -1
- package/src/select/Options.tsx +4 -4
- package/src/select/Select.tsx +2 -2
|
@@ -58,7 +58,9 @@ var SchemaArrayForm = function SchemaArrayForm(_ref) {
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
}, []);
|
|
61
|
-
var Wrapper = react.useCallback(
|
|
61
|
+
var Wrapper = react.useCallback(
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
63
|
+
function (_ref2) {
|
|
62
64
|
var children = _ref2.children;
|
|
63
65
|
if (dynamic) {
|
|
64
66
|
// pass id list to dnd context
|
|
@@ -110,7 +110,7 @@ var ArrayInput = function ArrayInput(_ref) {
|
|
|
110
110
|
var removeCheck = react.useCallback(function (item, index) {
|
|
111
111
|
if (canRemove === false) return false;
|
|
112
112
|
if (canRemove === "newonly") {
|
|
113
|
-
return initialList.includes(item.__ID__)
|
|
113
|
+
return !initialList.includes(item.__ID__);
|
|
114
114
|
}
|
|
115
115
|
if (typeof canRemove === "function") {
|
|
116
116
|
return canRemove({
|
|
@@ -143,7 +143,9 @@ var ArrayInput = function ArrayInput(_ref) {
|
|
|
143
143
|
removeItem: remove
|
|
144
144
|
};
|
|
145
145
|
});
|
|
146
|
-
var Wrapper = react.useCallback(
|
|
146
|
+
var Wrapper = react.useCallback(
|
|
147
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
148
|
+
function (_ref2) {
|
|
147
149
|
var children = _ref2.children;
|
|
148
150
|
if (enableSorting) {
|
|
149
151
|
// pass id list to dnd context
|
|
@@ -262,7 +264,7 @@ var ArrayInput = function ArrayInput(_ref) {
|
|
|
262
264
|
color: "danger",
|
|
263
265
|
variant: "link",
|
|
264
266
|
className: "self-end",
|
|
265
|
-
disabled: disabled || readOnly || fields.length <= minItems || removeCheck(item, index)
|
|
267
|
+
disabled: disabled || readOnly || fields.length <= minItems || !removeCheck(item, index),
|
|
266
268
|
onClick: function onClick() {
|
|
267
269
|
return handleRemove(item, index);
|
|
268
270
|
}
|
|
@@ -132,7 +132,7 @@ var AvatarInput = function AvatarInput(_ref) {
|
|
|
132
132
|
bg: "danger",
|
|
133
133
|
color: "white",
|
|
134
134
|
size: "sm",
|
|
135
|
-
className: "p-
|
|
135
|
+
className: "p-0.5 flex-content",
|
|
136
136
|
"aria-label": "abort",
|
|
137
137
|
onClick: function onClick() {
|
|
138
138
|
var _file$abort;
|
|
@@ -57,7 +57,7 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
57
57
|
onChange === null || onChange === void 0 || onChange((_e$target$checked2 = e === null || e === void 0 ? void 0 : e.target.checked) !== null && _e$target$checked2 !== void 0 ? _e$target$checked2 : false);
|
|
58
58
|
}, [onChange, value]);
|
|
59
59
|
return /*#__PURE__*/jsxRuntime.jsxs("label", {
|
|
60
|
-
className: classNames(invalid ? "ring-danger-500" : "ring-primary-500", disabled ? "opacity-50 cursor-not-allowed" : " opacity-85 hover:opacity-100 cursor-pointer", "inline-flex gap-1 py-1 items-center relative rounded ring-offset-2 has-
|
|
60
|
+
className: classNames(invalid ? "ring-danger-500" : "ring-primary-500", disabled ? "opacity-50 cursor-not-allowed" : " opacity-85 hover:opacity-100 cursor-pointer", "inline-flex gap-1 py-1 items-center relative rounded ring-offset-2 has-focus-visible:ring-1"),
|
|
61
61
|
style: {
|
|
62
62
|
width: width
|
|
63
63
|
},
|
|
@@ -45,7 +45,9 @@ var ColorPicker = /*#__PURE__*/react.memo(function (_ref) {
|
|
|
45
45
|
});
|
|
46
46
|
}, [onChange]);
|
|
47
47
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
48
|
+
role: "none"
|
|
48
49
|
// prevent default on mouse down to avoid selection issues
|
|
50
|
+
,
|
|
49
51
|
onMouseDown: function onMouseDown(e) {
|
|
50
52
|
return e.preventDefault();
|
|
51
53
|
},
|
|
@@ -103,7 +103,7 @@ var Password = function Password(_ref) {
|
|
|
103
103
|
onChange: handleChange,
|
|
104
104
|
onKeyDown: handleEnterPressed
|
|
105
105
|
}), !!strength && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
106
|
-
className: classNames("absolute bottom-px h-[3px] inset-x-0 after:block after:h-full after:bg-dimmed", "ltr:bg-
|
|
106
|
+
className: classNames("absolute bottom-px h-[3px] inset-x-0 after:block after:h-full after:bg-dimmed", "ltr:bg-linear-to-r rtl:bg-linear-to-l from-danger-500 via-marigold-500 to-jade-500"),
|
|
107
107
|
style: {
|
|
108
108
|
paddingInlineStart: "".concat(strength > 1 ? 100 : strength * 100, "%")
|
|
109
109
|
}
|
package/dist/cjs/input/Radio.js
CHANGED
|
@@ -44,7 +44,7 @@ var Radio = function Radio(_ref) {
|
|
|
44
44
|
(e === null || e === void 0 ? void 0 : e.target.checked) && value && (onChange === null || onChange === void 0 ? void 0 : onChange(value));
|
|
45
45
|
}, [onChange, value]);
|
|
46
46
|
return /*#__PURE__*/jsxRuntime.jsxs("label", {
|
|
47
|
-
className: classNames(invalid ? "ring-danger-500" : "ring-primary-500", disabled ? "opacity-50 cursor-not-allowed" : "hover:opacity-100 cursor-pointer", "inline-flex gap-1 py-1 items-center relative cursor-pointer opacity-85 rounded ring-offset-2 has-
|
|
47
|
+
className: classNames(invalid ? "ring-danger-500" : "ring-primary-500", disabled ? "opacity-50 cursor-not-allowed" : "hover:opacity-100 cursor-pointer", "inline-flex gap-1 py-1 items-center relative cursor-pointer opacity-85 rounded ring-offset-2 has-focus-visible:ring-1"),
|
|
48
48
|
style: {
|
|
49
49
|
width: width
|
|
50
50
|
},
|
|
@@ -138,7 +138,7 @@ var RangeSlider = function RangeSlider(_ref) {
|
|
|
138
138
|
var key = _ref2.key,
|
|
139
139
|
styles = _ref2.styles;
|
|
140
140
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
141
|
-
className: classNames("absolute inline-block h-1 w-1 rounded-sm bg-invert opacity-30 leading-
|
|
141
|
+
className: classNames("absolute inline-block h-1 w-1 rounded-sm bg-invert opacity-30 leading-0 z-1", vertical && "left-1/2 -ml-0.5"),
|
|
142
142
|
style: styles
|
|
143
143
|
}, key);
|
|
144
144
|
}), rangerInstance.segments.map(function (_ref3) {
|
|
@@ -162,7 +162,7 @@ var RangeSlider = function RangeSlider(_ref) {
|
|
|
162
162
|
}, props), {}, {
|
|
163
163
|
style: styles
|
|
164
164
|
})), displayValue && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
165
|
-
className: classNames("bg-invert text-invert py-px px-2 text-xs absolute rounded z-1 whitespace-nowrap", "before:absolute before:h-1.5 before:w-1.5 before:z-[-1] before:bg-invert before:top-1/2 before:-translate-y-1/2 before:rotate-45", vertical ? "end-0 ltr:translate-x-full rtl:-translate-x-full translate-y-2" : "top-1/2 -translate-y-1/2", !vertical && (key === 0 ? "-ms-3 ltr:-translate-x-full rtl:translate-x-full ltr:before:translate-x-
|
|
165
|
+
className: classNames("bg-invert text-invert py-px px-2 text-xs absolute rounded z-1 whitespace-nowrap", "before:absolute before:h-1.5 before:w-1.5 before:z-[-1] before:bg-invert before:top-1/2 before:-translate-y-1/2 before:rotate-45", vertical ? "end-0 ltr:translate-x-full rtl:-translate-x-full translate-y-2" : "top-1/2 -translate-y-1/2", !vertical && (key === 0 ? "-ms-3 ltr:-translate-x-full rtl:translate-x-full ltr:before:translate-x-0.5 rtl:before:-translate-x-0.5 before:end-0" : "ms-3 ltr:before:-translate-x-0.5 rtl:before:translate-x-0.5 before:start-0")),
|
|
166
166
|
"data-align": key === 0 ? "start" : "end",
|
|
167
167
|
style: valueStyles,
|
|
168
168
|
children: utilities.Format.number(value, format)
|
package/dist/cjs/input/Slider.js
CHANGED
|
@@ -138,7 +138,7 @@ var Slider = function Slider(_ref) {
|
|
|
138
138
|
var key = _ref2.key,
|
|
139
139
|
styles = _ref2.styles;
|
|
140
140
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
141
|
-
className: classNames("absolute inline-block h-1 w-1 rounded-sm bg-invert opacity-30 leading-
|
|
141
|
+
className: classNames("absolute inline-block h-1 w-1 rounded-sm bg-invert opacity-30 leading-0 z-1", vertical && "left-1/2 -ml-0.5"),
|
|
142
142
|
style: styles
|
|
143
143
|
}, key);
|
|
144
144
|
}), rangerInstance.segments.map(function (_ref3) {
|
|
@@ -163,7 +163,7 @@ var Slider = function Slider(_ref) {
|
|
|
163
163
|
}, props), {}, {
|
|
164
164
|
style: styles
|
|
165
165
|
})), displayValue && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
166
|
-
className: classNames("bg-invert text-invert py-px px-2 text-xs absolute rounded z-
|
|
166
|
+
className: classNames("bg-invert text-invert py-px px-2 text-xs absolute rounded z-5 whitespace-nowrap pointer-events-none", "before:absolute before:h-1.5 before:w-1.5 before:z-[-1] before:bg-invert before:top-1/2 before:-translate-y-1/2 before:rotate-45", vertical ? "end-0 ltr:translate-x-full rtl:-translate-x-full translate-y-2 ltr:before:-translate-x-0.5 rtl:before:translate-x-0.5 before:start-0" : "top-1/2 -translate-y-1/2", !vertical && (percentage > 50 ? "-ms-3 ltr:-translate-x-full rtl:translate-x-full ltr:before:translate-x-0.5 rtl:before:-translate-x-0.5 before:end-0" : "ms-3 ltr:before:-translate-x-0.5 rtl:before:translate-x-0.5 before:start-0")),
|
|
167
167
|
"data-align": percentage > 50 ? "start" : "end",
|
|
168
168
|
style: valueStyles,
|
|
169
169
|
children: value === Infinity || useInfinity && value === max ? maxLabel !== null && maxLabel !== void 0 ? maxLabel : "∞" : utilities.Format.number(value, format)
|
package/dist/cjs/input/Switch.js
CHANGED
|
@@ -55,7 +55,7 @@ var Switch = function Switch(_ref) {
|
|
|
55
55
|
onChange === null || onChange === void 0 || onChange((_e$target$checked2 = e === null || e === void 0 ? void 0 : e.target.checked) !== null && _e$target$checked2 !== void 0 ? _e$target$checked2 : false);
|
|
56
56
|
}, [onChange]);
|
|
57
57
|
return /*#__PURE__*/jsxRuntime.jsxs("label", {
|
|
58
|
-
className: classNames(invalid ? "ring-danger-500" : "ring-primary-500", disabled ? "opacity-50 cursor-not-allowed" : "hover:opacity-100 cursor-pointer", "inline-flex gap-1 py-1 items-center relative cursor-pointer opacity-85 rounded ring-offset-2 has-
|
|
58
|
+
className: classNames(invalid ? "ring-danger-500" : "ring-primary-500", disabled ? "opacity-50 cursor-not-allowed" : "hover:opacity-100 cursor-pointer", "inline-flex gap-1 py-1 items-center relative cursor-pointer opacity-85 rounded ring-offset-2 has-focus-visible:ring-1"),
|
|
59
59
|
style: {
|
|
60
60
|
width: width
|
|
61
61
|
},
|
|
@@ -79,7 +79,7 @@ var Switch = function Switch(_ref) {
|
|
|
79
79
|
onChange: handleChange
|
|
80
80
|
}, rest)), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
81
81
|
"aria-hidden": "true",
|
|
82
|
-
className: classNames(!disabled && "shadow-sm", actualValue ? "translate-x-
|
|
82
|
+
className: classNames(!disabled && "shadow-sm", actualValue ? "translate-x-full" : "translate-x-0", "pointer-events-none inline-block h-[1em] start-[0.25em] absolute rounded-full bg-white ring-0 transition duration-200 ease-in-out"),
|
|
83
83
|
style: {
|
|
84
84
|
width: "calc(50% - 0.25em)"
|
|
85
85
|
}
|
|
@@ -52,13 +52,17 @@ var InputWrapper = function InputWrapper(_ref) {
|
|
|
52
52
|
});
|
|
53
53
|
}, [isInner, rest, width]);
|
|
54
54
|
var handleClear = react.useCallback(function (e) {
|
|
55
|
-
var _e$currentTarget$pare;
|
|
56
|
-
(_e$currentTarget$pare = e.currentTarget.parentElement) === null || _e$currentTarget$pare === void 0
|
|
55
|
+
var _e$currentTarget$pare, _parent$querySelector;
|
|
56
|
+
var parent = (_e$currentTarget$pare = e.currentTarget.parentElement) === null || _e$currentTarget$pare === void 0 ? void 0 : _e$currentTarget$pare.querySelector("& > :not(.fabric-decorate)");
|
|
57
|
+
var el = (_parent$querySelector = parent === null || parent === void 0 ? void 0 : parent.querySelector("input,textarea,button")) !== null && _parent$querySelector !== void 0 ? _parent$querySelector : parent;
|
|
58
|
+
el === null || el === void 0 || el.focus();
|
|
57
59
|
onClear === null || onClear === void 0 || onClear();
|
|
58
60
|
}, [onClear]);
|
|
59
61
|
var doFocus = react.useCallback(function (e) {
|
|
60
|
-
var _e$currentTarget$pare2;
|
|
61
|
-
(_e$currentTarget$pare2 = e.currentTarget.parentElement) === null || _e$currentTarget$pare2 === void 0
|
|
62
|
+
var _e$currentTarget$pare2, _parent$querySelector2;
|
|
63
|
+
var parent = (_e$currentTarget$pare2 = e.currentTarget.parentElement) === null || _e$currentTarget$pare2 === void 0 ? void 0 : _e$currentTarget$pare2.querySelector("& > :not(.fabric-decorate)");
|
|
64
|
+
var el = (_parent$querySelector2 = parent === null || parent === void 0 ? void 0 : parent.querySelector("input,textarea,button")) !== null && _parent$querySelector2 !== void 0 ? _parent$querySelector2 : parent;
|
|
65
|
+
el === null || el === void 0 || el.focus();
|
|
62
66
|
}, [onClear]);
|
|
63
67
|
react.useEffect(function () {
|
|
64
68
|
isExpanded && setTimeout(function () {
|
|
@@ -69,7 +73,7 @@ var InputWrapper = function InputWrapper(_ref) {
|
|
|
69
73
|
var el = /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
70
74
|
role: "none",
|
|
71
75
|
ref: wrapperRef,
|
|
72
|
-
className: classNames("fabric-inputWrapper", invalid && "fabric-invalidWrapper", !noOutline && !noBorder && "bg-(--fabric-input) outline overflow-hidden", "flex flex-nowrap items-center flex-1", textarea ? "rounded-capped group" : "rounded", isExpanded ? "fixed inset-4 z-
|
|
76
|
+
className: classNames("fabric-inputWrapper", invalid && "fabric-invalidWrapper", !noOutline && !noBorder && "bg-(--fabric-input) outline overflow-hidden", "flex flex-nowrap items-center flex-1", textarea ? "rounded-capped group" : "rounded", isExpanded ? "fixed inset-4 z-99" : floatingExpand ? "absolute inset-x-0" : "relative", !noOutline && "after:absolute after:bottom-0 after:h-px after:bg-primary-500 after:mx-auto"),
|
|
73
77
|
onKeyDown: function onKeyDown(e) {
|
|
74
78
|
return e.key === "Escape" && isExpanded && (setExpanded(false), e.stopPropagation());
|
|
75
79
|
},
|
|
@@ -207,7 +207,7 @@ var AutoComplete = function AutoComplete(_ref) {
|
|
|
207
207
|
required: required,
|
|
208
208
|
error: error,
|
|
209
209
|
wrapperRef: refs.setReference,
|
|
210
|
-
className: !multiple && expandOnEdit && state.open ? "
|
|
210
|
+
className: !multiple && expandOnEdit && state.open ? "z-99!" : "",
|
|
211
211
|
floatingExpand: !multiple && expandOnEdit && state.open
|
|
212
212
|
}, rest), {}, {
|
|
213
213
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -4,13 +4,13 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
4
4
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
5
5
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
6
6
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
7
|
+
var core = require('@dnd-kit/core');
|
|
8
|
+
var modifiers = require('@dnd-kit/modifiers');
|
|
7
9
|
var core$1 = require('@react-fabric/core');
|
|
10
|
+
var utilities = require('@react-fabric/utilities');
|
|
8
11
|
var react = require('react');
|
|
9
12
|
var Field = require('../input/Field.js');
|
|
10
13
|
var List = require('./List.js');
|
|
11
|
-
var modifiers = require('@dnd-kit/modifiers');
|
|
12
|
-
var core = require('@dnd-kit/core');
|
|
13
|
-
var utilities = require('@react-fabric/utilities');
|
|
14
14
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
15
|
|
|
16
16
|
var _excluded = ["ref", "value", "options", "emptyDisplay", "groupProperty", "height", "labelProperty", "valueProperty", "renderer", "onChange", "name", "invalid", "readOnly", "disabled", "placeholder", "autoFocus", "error"];
|
package/dist/cjs/select/List.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
3
4
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
5
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
6
|
+
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
5
7
|
var react$1 = require('@floating-ui/react');
|
|
6
8
|
var core = require('@react-fabric/core');
|
|
7
9
|
var utilities = require('@react-fabric/utilities');
|
|
@@ -257,10 +259,26 @@ var List = function List(_ref) {
|
|
|
257
259
|
itemProps: makeItemProps,
|
|
258
260
|
empty: emptyDisplay,
|
|
259
261
|
info: (_state$activeItem = state.activeItem) === null || _state$activeItem === void 0 ? void 0 : _state$activeItem[infoProperty !== null && infoProperty !== void 0 ? infoProperty : "info"],
|
|
260
|
-
children: function
|
|
261
|
-
var
|
|
262
|
-
|
|
263
|
-
|
|
262
|
+
children: ( /*#__PURE__*/function () {
|
|
263
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(item, label) {
|
|
264
|
+
var _renderer3;
|
|
265
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
266
|
+
while (1) switch (_context.prev = _context.next) {
|
|
267
|
+
case 0:
|
|
268
|
+
_context.next = 2;
|
|
269
|
+
return (_renderer3 = renderer === null || renderer === void 0 ? void 0 : renderer(item)) !== null && _renderer3 !== void 0 ? _renderer3 : label;
|
|
270
|
+
case 2:
|
|
271
|
+
return _context.abrupt("return", _context.sent);
|
|
272
|
+
case 3:
|
|
273
|
+
case "end":
|
|
274
|
+
return _context.stop();
|
|
275
|
+
}
|
|
276
|
+
}, _callee);
|
|
277
|
+
}));
|
|
278
|
+
return function (_x, _x2) {
|
|
279
|
+
return _ref4.apply(this, arguments);
|
|
280
|
+
};
|
|
281
|
+
}())
|
|
264
282
|
}))
|
|
265
283
|
})]
|
|
266
284
|
}));
|
|
@@ -49,7 +49,7 @@ var Options = function Options(_ref) {
|
|
|
49
49
|
return itemRef(index, el);
|
|
50
50
|
},
|
|
51
51
|
"data-active": active === index ? true : undefined,
|
|
52
|
-
className: classNames("block text-start truncate px-2 py-1 leading-normal cursor-pointer select-none", "data-
|
|
52
|
+
className: classNames("block text-start truncate px-2 py-1 leading-normal cursor-pointer select-none", "data-active:bg-primary-200 data-selected:bg-primary-600 data-selected:text-white data-active:data-selected:underline")
|
|
53
53
|
}, itemProps(item)), {}, {
|
|
54
54
|
children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
|
|
55
55
|
i18nKey: "form:select.createOption",
|
|
@@ -68,7 +68,7 @@ var Options = function Options(_ref) {
|
|
|
68
68
|
return itemRef(index, el);
|
|
69
69
|
},
|
|
70
70
|
"data-active": active === index ? true : undefined,
|
|
71
|
-
className: classNames("block text-start truncate px-2 py-1 leading-normal cursor-pointer", "data-
|
|
71
|
+
className: classNames("block text-start truncate px-2 py-1 leading-normal cursor-pointer", "data-active:bg-primary-200 data-selected:bg-primary-600 data-selected:text-white data-active:data-selected:underline")
|
|
72
72
|
}, itemProps(item)), {}, {
|
|
73
73
|
children: children(item, (_item$labelProperty = item[labelProperty]) !== null && _item$labelProperty !== void 0 ? _item$labelProperty : item)
|
|
74
74
|
}), index);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
3
4
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
5
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
6
|
+
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
5
7
|
var react$1 = require('@floating-ui/react');
|
|
6
8
|
var core = require('@react-fabric/core');
|
|
7
9
|
var utilities = require('@react-fabric/utilities');
|
|
@@ -225,7 +227,7 @@ var Select = function Select(_ref) {
|
|
|
225
227
|
required: required,
|
|
226
228
|
error: error,
|
|
227
229
|
wrapperRef: refs.setReference,
|
|
228
|
-
className: state.open ? "
|
|
230
|
+
className: state.open ? "z-99!" : ""
|
|
229
231
|
}, rest), {}, {
|
|
230
232
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread(_objectSpread({
|
|
231
233
|
role: "none",
|
|
@@ -282,10 +284,26 @@ var Select = function Select(_ref) {
|
|
|
282
284
|
itemProps: makeItemProps,
|
|
283
285
|
empty: emptyDisplay,
|
|
284
286
|
info: (_state$activeItem = state.activeItem) === null || _state$activeItem === void 0 ? void 0 : _state$activeItem[infoProperty !== null && infoProperty !== void 0 ? infoProperty : "info"],
|
|
285
|
-
children: function
|
|
286
|
-
var
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
children: ( /*#__PURE__*/function () {
|
|
288
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(item, label) {
|
|
289
|
+
var _renderer3;
|
|
290
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
291
|
+
while (1) switch (_context.prev = _context.next) {
|
|
292
|
+
case 0:
|
|
293
|
+
_context.next = 2;
|
|
294
|
+
return (_renderer3 = renderer === null || renderer === void 0 ? void 0 : renderer(item)) !== null && _renderer3 !== void 0 ? _renderer3 : label;
|
|
295
|
+
case 2:
|
|
296
|
+
return _context.abrupt("return", _context.sent);
|
|
297
|
+
case 3:
|
|
298
|
+
case "end":
|
|
299
|
+
return _context.stop();
|
|
300
|
+
}
|
|
301
|
+
}, _callee);
|
|
302
|
+
}));
|
|
303
|
+
return function (_x, _x2) {
|
|
304
|
+
return _ref4.apply(this, arguments);
|
|
305
|
+
};
|
|
306
|
+
}())
|
|
289
307
|
}))
|
|
290
308
|
})
|
|
291
309
|
})]
|
|
@@ -58,7 +58,9 @@ var SchemaArrayForm = function SchemaArrayForm(_ref) {
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
}, []);
|
|
61
|
-
var Wrapper = useCallback(
|
|
61
|
+
var Wrapper = useCallback(
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
63
|
+
function (_ref2) {
|
|
62
64
|
var children = _ref2.children;
|
|
63
65
|
if (dynamic) {
|
|
64
66
|
// pass id list to dnd context
|
|
@@ -110,7 +110,7 @@ var ArrayInput = function ArrayInput(_ref) {
|
|
|
110
110
|
var removeCheck = useCallback(function (item, index) {
|
|
111
111
|
if (canRemove === false) return false;
|
|
112
112
|
if (canRemove === "newonly") {
|
|
113
|
-
return initialList.includes(item.__ID__)
|
|
113
|
+
return !initialList.includes(item.__ID__);
|
|
114
114
|
}
|
|
115
115
|
if (typeof canRemove === "function") {
|
|
116
116
|
return canRemove({
|
|
@@ -143,7 +143,9 @@ var ArrayInput = function ArrayInput(_ref) {
|
|
|
143
143
|
removeItem: remove
|
|
144
144
|
};
|
|
145
145
|
});
|
|
146
|
-
var Wrapper = useCallback(
|
|
146
|
+
var Wrapper = useCallback(
|
|
147
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
148
|
+
function (_ref2) {
|
|
147
149
|
var children = _ref2.children;
|
|
148
150
|
if (enableSorting) {
|
|
149
151
|
// pass id list to dnd context
|
|
@@ -262,7 +264,7 @@ var ArrayInput = function ArrayInput(_ref) {
|
|
|
262
264
|
color: "danger",
|
|
263
265
|
variant: "link",
|
|
264
266
|
className: "self-end",
|
|
265
|
-
disabled: disabled || readOnly || fields.length <= minItems || removeCheck(item, index)
|
|
267
|
+
disabled: disabled || readOnly || fields.length <= minItems || !removeCheck(item, index),
|
|
266
268
|
onClick: function onClick() {
|
|
267
269
|
return handleRemove(item, index);
|
|
268
270
|
}
|
|
@@ -132,7 +132,7 @@ var AvatarInput = function AvatarInput(_ref) {
|
|
|
132
132
|
bg: "danger",
|
|
133
133
|
color: "white",
|
|
134
134
|
size: "sm",
|
|
135
|
-
className: "p-
|
|
135
|
+
className: "p-0.5 flex-content",
|
|
136
136
|
"aria-label": "abort",
|
|
137
137
|
onClick: function onClick() {
|
|
138
138
|
var _file$abort;
|
|
@@ -57,7 +57,7 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
57
57
|
onChange === null || onChange === void 0 || onChange((_e$target$checked2 = e === null || e === void 0 ? void 0 : e.target.checked) !== null && _e$target$checked2 !== void 0 ? _e$target$checked2 : false);
|
|
58
58
|
}, [onChange, value]);
|
|
59
59
|
return /*#__PURE__*/jsxs("label", {
|
|
60
|
-
className: classNames(invalid ? "ring-danger-500" : "ring-primary-500", disabled ? "opacity-50 cursor-not-allowed" : " opacity-85 hover:opacity-100 cursor-pointer", "inline-flex gap-1 py-1 items-center relative rounded ring-offset-2 has-
|
|
60
|
+
className: classNames(invalid ? "ring-danger-500" : "ring-primary-500", disabled ? "opacity-50 cursor-not-allowed" : " opacity-85 hover:opacity-100 cursor-pointer", "inline-flex gap-1 py-1 items-center relative rounded ring-offset-2 has-focus-visible:ring-1"),
|
|
61
61
|
style: {
|
|
62
62
|
width: width
|
|
63
63
|
},
|
|
@@ -45,7 +45,9 @@ var ColorPicker = /*#__PURE__*/memo(function (_ref) {
|
|
|
45
45
|
});
|
|
46
46
|
}, [onChange]);
|
|
47
47
|
return /*#__PURE__*/jsx("div", {
|
|
48
|
+
role: "none"
|
|
48
49
|
// prevent default on mouse down to avoid selection issues
|
|
50
|
+
,
|
|
49
51
|
onMouseDown: function onMouseDown(e) {
|
|
50
52
|
return e.preventDefault();
|
|
51
53
|
},
|
|
@@ -103,7 +103,7 @@ var Password = function Password(_ref) {
|
|
|
103
103
|
onChange: handleChange,
|
|
104
104
|
onKeyDown: handleEnterPressed
|
|
105
105
|
}), !!strength && /*#__PURE__*/jsx("div", {
|
|
106
|
-
className: classNames("absolute bottom-px h-[3px] inset-x-0 after:block after:h-full after:bg-dimmed", "ltr:bg-
|
|
106
|
+
className: classNames("absolute bottom-px h-[3px] inset-x-0 after:block after:h-full after:bg-dimmed", "ltr:bg-linear-to-r rtl:bg-linear-to-l from-danger-500 via-marigold-500 to-jade-500"),
|
|
107
107
|
style: {
|
|
108
108
|
paddingInlineStart: "".concat(strength > 1 ? 100 : strength * 100, "%")
|
|
109
109
|
}
|
package/dist/esm/input/Radio.js
CHANGED
|
@@ -44,7 +44,7 @@ var Radio = function Radio(_ref) {
|
|
|
44
44
|
(e === null || e === void 0 ? void 0 : e.target.checked) && value && (onChange === null || onChange === void 0 ? void 0 : onChange(value));
|
|
45
45
|
}, [onChange, value]);
|
|
46
46
|
return /*#__PURE__*/jsxs("label", {
|
|
47
|
-
className: classNames(invalid ? "ring-danger-500" : "ring-primary-500", disabled ? "opacity-50 cursor-not-allowed" : "hover:opacity-100 cursor-pointer", "inline-flex gap-1 py-1 items-center relative cursor-pointer opacity-85 rounded ring-offset-2 has-
|
|
47
|
+
className: classNames(invalid ? "ring-danger-500" : "ring-primary-500", disabled ? "opacity-50 cursor-not-allowed" : "hover:opacity-100 cursor-pointer", "inline-flex gap-1 py-1 items-center relative cursor-pointer opacity-85 rounded ring-offset-2 has-focus-visible:ring-1"),
|
|
48
48
|
style: {
|
|
49
49
|
width: width
|
|
50
50
|
},
|
|
@@ -138,7 +138,7 @@ var RangeSlider = function RangeSlider(_ref) {
|
|
|
138
138
|
var key = _ref2.key,
|
|
139
139
|
styles = _ref2.styles;
|
|
140
140
|
return /*#__PURE__*/jsx("div", {
|
|
141
|
-
className: classNames("absolute inline-block h-1 w-1 rounded-sm bg-invert opacity-30 leading-
|
|
141
|
+
className: classNames("absolute inline-block h-1 w-1 rounded-sm bg-invert opacity-30 leading-0 z-1", vertical && "left-1/2 -ml-0.5"),
|
|
142
142
|
style: styles
|
|
143
143
|
}, key);
|
|
144
144
|
}), rangerInstance.segments.map(function (_ref3) {
|
|
@@ -162,7 +162,7 @@ var RangeSlider = function RangeSlider(_ref) {
|
|
|
162
162
|
}, props), {}, {
|
|
163
163
|
style: styles
|
|
164
164
|
})), displayValue && /*#__PURE__*/jsx("div", {
|
|
165
|
-
className: classNames("bg-invert text-invert py-px px-2 text-xs absolute rounded z-1 whitespace-nowrap", "before:absolute before:h-1.5 before:w-1.5 before:z-[-1] before:bg-invert before:top-1/2 before:-translate-y-1/2 before:rotate-45", vertical ? "end-0 ltr:translate-x-full rtl:-translate-x-full translate-y-2" : "top-1/2 -translate-y-1/2", !vertical && (key === 0 ? "-ms-3 ltr:-translate-x-full rtl:translate-x-full ltr:before:translate-x-
|
|
165
|
+
className: classNames("bg-invert text-invert py-px px-2 text-xs absolute rounded z-1 whitespace-nowrap", "before:absolute before:h-1.5 before:w-1.5 before:z-[-1] before:bg-invert before:top-1/2 before:-translate-y-1/2 before:rotate-45", vertical ? "end-0 ltr:translate-x-full rtl:-translate-x-full translate-y-2" : "top-1/2 -translate-y-1/2", !vertical && (key === 0 ? "-ms-3 ltr:-translate-x-full rtl:translate-x-full ltr:before:translate-x-0.5 rtl:before:-translate-x-0.5 before:end-0" : "ms-3 ltr:before:-translate-x-0.5 rtl:before:translate-x-0.5 before:start-0")),
|
|
166
166
|
"data-align": key === 0 ? "start" : "end",
|
|
167
167
|
style: valueStyles,
|
|
168
168
|
children: Format.number(value, format)
|
package/dist/esm/input/Slider.js
CHANGED
|
@@ -138,7 +138,7 @@ var Slider = function Slider(_ref) {
|
|
|
138
138
|
var key = _ref2.key,
|
|
139
139
|
styles = _ref2.styles;
|
|
140
140
|
return /*#__PURE__*/jsx("div", {
|
|
141
|
-
className: classNames("absolute inline-block h-1 w-1 rounded-sm bg-invert opacity-30 leading-
|
|
141
|
+
className: classNames("absolute inline-block h-1 w-1 rounded-sm bg-invert opacity-30 leading-0 z-1", vertical && "left-1/2 -ml-0.5"),
|
|
142
142
|
style: styles
|
|
143
143
|
}, key);
|
|
144
144
|
}), rangerInstance.segments.map(function (_ref3) {
|
|
@@ -163,7 +163,7 @@ var Slider = function Slider(_ref) {
|
|
|
163
163
|
}, props), {}, {
|
|
164
164
|
style: styles
|
|
165
165
|
})), displayValue && /*#__PURE__*/jsx("div", {
|
|
166
|
-
className: classNames("bg-invert text-invert py-px px-2 text-xs absolute rounded z-
|
|
166
|
+
className: classNames("bg-invert text-invert py-px px-2 text-xs absolute rounded z-5 whitespace-nowrap pointer-events-none", "before:absolute before:h-1.5 before:w-1.5 before:z-[-1] before:bg-invert before:top-1/2 before:-translate-y-1/2 before:rotate-45", vertical ? "end-0 ltr:translate-x-full rtl:-translate-x-full translate-y-2 ltr:before:-translate-x-0.5 rtl:before:translate-x-0.5 before:start-0" : "top-1/2 -translate-y-1/2", !vertical && (percentage > 50 ? "-ms-3 ltr:-translate-x-full rtl:translate-x-full ltr:before:translate-x-0.5 rtl:before:-translate-x-0.5 before:end-0" : "ms-3 ltr:before:-translate-x-0.5 rtl:before:translate-x-0.5 before:start-0")),
|
|
167
167
|
"data-align": percentage > 50 ? "start" : "end",
|
|
168
168
|
style: valueStyles,
|
|
169
169
|
children: value === Infinity || useInfinity && value === max ? maxLabel !== null && maxLabel !== void 0 ? maxLabel : "∞" : Format.number(value, format)
|
package/dist/esm/input/Switch.js
CHANGED
|
@@ -55,7 +55,7 @@ var Switch = function Switch(_ref) {
|
|
|
55
55
|
onChange === null || onChange === void 0 || onChange((_e$target$checked2 = e === null || e === void 0 ? void 0 : e.target.checked) !== null && _e$target$checked2 !== void 0 ? _e$target$checked2 : false);
|
|
56
56
|
}, [onChange]);
|
|
57
57
|
return /*#__PURE__*/jsxs("label", {
|
|
58
|
-
className: classNames(invalid ? "ring-danger-500" : "ring-primary-500", disabled ? "opacity-50 cursor-not-allowed" : "hover:opacity-100 cursor-pointer", "inline-flex gap-1 py-1 items-center relative cursor-pointer opacity-85 rounded ring-offset-2 has-
|
|
58
|
+
className: classNames(invalid ? "ring-danger-500" : "ring-primary-500", disabled ? "opacity-50 cursor-not-allowed" : "hover:opacity-100 cursor-pointer", "inline-flex gap-1 py-1 items-center relative cursor-pointer opacity-85 rounded ring-offset-2 has-focus-visible:ring-1"),
|
|
59
59
|
style: {
|
|
60
60
|
width: width
|
|
61
61
|
},
|
|
@@ -79,7 +79,7 @@ var Switch = function Switch(_ref) {
|
|
|
79
79
|
onChange: handleChange
|
|
80
80
|
}, rest)), /*#__PURE__*/jsx("span", {
|
|
81
81
|
"aria-hidden": "true",
|
|
82
|
-
className: classNames(!disabled && "shadow-sm", actualValue ? "translate-x-
|
|
82
|
+
className: classNames(!disabled && "shadow-sm", actualValue ? "translate-x-full" : "translate-x-0", "pointer-events-none inline-block h-[1em] start-[0.25em] absolute rounded-full bg-white ring-0 transition duration-200 ease-in-out"),
|
|
83
83
|
style: {
|
|
84
84
|
width: "calc(50% - 0.25em)"
|
|
85
85
|
}
|
|
@@ -52,13 +52,17 @@ var InputWrapper = function InputWrapper(_ref) {
|
|
|
52
52
|
});
|
|
53
53
|
}, [isInner, rest, width]);
|
|
54
54
|
var handleClear = useCallback(function (e) {
|
|
55
|
-
var _e$currentTarget$pare;
|
|
56
|
-
(_e$currentTarget$pare = e.currentTarget.parentElement) === null || _e$currentTarget$pare === void 0
|
|
55
|
+
var _e$currentTarget$pare, _parent$querySelector;
|
|
56
|
+
var parent = (_e$currentTarget$pare = e.currentTarget.parentElement) === null || _e$currentTarget$pare === void 0 ? void 0 : _e$currentTarget$pare.querySelector("& > :not(.fabric-decorate)");
|
|
57
|
+
var el = (_parent$querySelector = parent === null || parent === void 0 ? void 0 : parent.querySelector("input,textarea,button")) !== null && _parent$querySelector !== void 0 ? _parent$querySelector : parent;
|
|
58
|
+
el === null || el === void 0 || el.focus();
|
|
57
59
|
onClear === null || onClear === void 0 || onClear();
|
|
58
60
|
}, [onClear]);
|
|
59
61
|
var doFocus = useCallback(function (e) {
|
|
60
|
-
var _e$currentTarget$pare2;
|
|
61
|
-
(_e$currentTarget$pare2 = e.currentTarget.parentElement) === null || _e$currentTarget$pare2 === void 0
|
|
62
|
+
var _e$currentTarget$pare2, _parent$querySelector2;
|
|
63
|
+
var parent = (_e$currentTarget$pare2 = e.currentTarget.parentElement) === null || _e$currentTarget$pare2 === void 0 ? void 0 : _e$currentTarget$pare2.querySelector("& > :not(.fabric-decorate)");
|
|
64
|
+
var el = (_parent$querySelector2 = parent === null || parent === void 0 ? void 0 : parent.querySelector("input,textarea,button")) !== null && _parent$querySelector2 !== void 0 ? _parent$querySelector2 : parent;
|
|
65
|
+
el === null || el === void 0 || el.focus();
|
|
62
66
|
}, [onClear]);
|
|
63
67
|
useEffect(function () {
|
|
64
68
|
isExpanded && setTimeout(function () {
|
|
@@ -69,7 +73,7 @@ var InputWrapper = function InputWrapper(_ref) {
|
|
|
69
73
|
var el = /*#__PURE__*/jsxs("div", {
|
|
70
74
|
role: "none",
|
|
71
75
|
ref: wrapperRef,
|
|
72
|
-
className: classNames("fabric-inputWrapper", invalid && "fabric-invalidWrapper", !noOutline && !noBorder && "bg-(--fabric-input) outline overflow-hidden", "flex flex-nowrap items-center flex-1", textarea ? "rounded-capped group" : "rounded", isExpanded ? "fixed inset-4 z-
|
|
76
|
+
className: classNames("fabric-inputWrapper", invalid && "fabric-invalidWrapper", !noOutline && !noBorder && "bg-(--fabric-input) outline overflow-hidden", "flex flex-nowrap items-center flex-1", textarea ? "rounded-capped group" : "rounded", isExpanded ? "fixed inset-4 z-99" : floatingExpand ? "absolute inset-x-0" : "relative", !noOutline && "after:absolute after:bottom-0 after:h-px after:bg-primary-500 after:mx-auto"),
|
|
73
77
|
onKeyDown: function onKeyDown(e) {
|
|
74
78
|
return e.key === "Escape" && isExpanded && (setExpanded(false), e.stopPropagation());
|
|
75
79
|
},
|
|
@@ -207,7 +207,7 @@ var AutoComplete = function AutoComplete(_ref) {
|
|
|
207
207
|
required: required,
|
|
208
208
|
error: error,
|
|
209
209
|
wrapperRef: refs.setReference,
|
|
210
|
-
className: !multiple && expandOnEdit && state.open ? "
|
|
210
|
+
className: !multiple && expandOnEdit && state.open ? "z-99!" : "",
|
|
211
211
|
floatingExpand: !multiple && expandOnEdit && state.open
|
|
212
212
|
}, rest), {}, {
|
|
213
213
|
children: [/*#__PURE__*/jsxs("div", {
|
|
@@ -4,13 +4,13 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
4
4
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
5
5
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
6
6
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
7
|
+
import { useDraggable, useDroppable, DndContext, DragOverlay } from '@dnd-kit/core';
|
|
8
|
+
import { restrictToHorizontalAxis } from '@dnd-kit/modifiers';
|
|
7
9
|
import { ButtonGroup, Button, CoreIcons } from '@react-fabric/core';
|
|
10
|
+
import { mergeRefs } from '@react-fabric/utilities';
|
|
8
11
|
import { useState, useDeferredValue, useEffect, useMemo, useCallback } from 'react';
|
|
9
12
|
import { Field } from '../input/Field.js';
|
|
10
13
|
import { List } from './List.js';
|
|
11
|
-
import { restrictToHorizontalAxis } from '@dnd-kit/modifiers';
|
|
12
|
-
import { useDraggable, useDroppable, DndContext, DragOverlay } from '@dnd-kit/core';
|
|
13
|
-
import { mergeRefs } from '@react-fabric/utilities';
|
|
14
14
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
15
15
|
|
|
16
16
|
var _excluded = ["ref", "value", "options", "emptyDisplay", "groupProperty", "height", "labelProperty", "valueProperty", "renderer", "onChange", "name", "invalid", "readOnly", "disabled", "placeholder", "autoFocus", "error"];
|
package/dist/esm/select/List.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
3
4
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
5
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
6
|
+
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
5
7
|
import { useFloating, autoUpdate, useListNavigation, useTypeahead, useInteractions, FloatingFocusManager } from '@floating-ui/react';
|
|
6
8
|
import { Chip } from '@react-fabric/core';
|
|
7
9
|
import { isArray, isEmpty } from '@react-fabric/utilities';
|
|
@@ -257,10 +259,26 @@ var List = function List(_ref) {
|
|
|
257
259
|
itemProps: makeItemProps,
|
|
258
260
|
empty: emptyDisplay,
|
|
259
261
|
info: (_state$activeItem = state.activeItem) === null || _state$activeItem === void 0 ? void 0 : _state$activeItem[infoProperty !== null && infoProperty !== void 0 ? infoProperty : "info"],
|
|
260
|
-
children: function
|
|
261
|
-
var
|
|
262
|
-
|
|
263
|
-
|
|
262
|
+
children: ( /*#__PURE__*/function () {
|
|
263
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(item, label) {
|
|
264
|
+
var _renderer3;
|
|
265
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
266
|
+
while (1) switch (_context.prev = _context.next) {
|
|
267
|
+
case 0:
|
|
268
|
+
_context.next = 2;
|
|
269
|
+
return (_renderer3 = renderer === null || renderer === void 0 ? void 0 : renderer(item)) !== null && _renderer3 !== void 0 ? _renderer3 : label;
|
|
270
|
+
case 2:
|
|
271
|
+
return _context.abrupt("return", _context.sent);
|
|
272
|
+
case 3:
|
|
273
|
+
case "end":
|
|
274
|
+
return _context.stop();
|
|
275
|
+
}
|
|
276
|
+
}, _callee);
|
|
277
|
+
}));
|
|
278
|
+
return function (_x, _x2) {
|
|
279
|
+
return _ref4.apply(this, arguments);
|
|
280
|
+
};
|
|
281
|
+
}())
|
|
264
282
|
}))
|
|
265
283
|
})]
|
|
266
284
|
}));
|
|
@@ -49,7 +49,7 @@ var Options = function Options(_ref) {
|
|
|
49
49
|
return itemRef(index, el);
|
|
50
50
|
},
|
|
51
51
|
"data-active": active === index ? true : undefined,
|
|
52
|
-
className: classNames("block text-start truncate px-2 py-1 leading-normal cursor-pointer select-none", "data-
|
|
52
|
+
className: classNames("block text-start truncate px-2 py-1 leading-normal cursor-pointer select-none", "data-active:bg-primary-200 data-selected:bg-primary-600 data-selected:text-white data-active:data-selected:underline")
|
|
53
53
|
}, itemProps(item)), {}, {
|
|
54
54
|
children: /*#__PURE__*/jsx(Trans, {
|
|
55
55
|
i18nKey: "form:select.createOption",
|
|
@@ -68,7 +68,7 @@ var Options = function Options(_ref) {
|
|
|
68
68
|
return itemRef(index, el);
|
|
69
69
|
},
|
|
70
70
|
"data-active": active === index ? true : undefined,
|
|
71
|
-
className: classNames("block text-start truncate px-2 py-1 leading-normal cursor-pointer", "data-
|
|
71
|
+
className: classNames("block text-start truncate px-2 py-1 leading-normal cursor-pointer", "data-active:bg-primary-200 data-selected:bg-primary-600 data-selected:text-white data-active:data-selected:underline")
|
|
72
72
|
}, itemProps(item)), {}, {
|
|
73
73
|
children: children(item, (_item$labelProperty = item[labelProperty]) !== null && _item$labelProperty !== void 0 ? _item$labelProperty : item)
|
|
74
74
|
}), index);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
3
4
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
5
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
6
|
+
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
5
7
|
import { useFloating, autoUpdate, shift, flip, offset, useClick, useDismiss, useListNavigation, useTypeahead, useInteractions, FloatingPortal, FloatingFocusManager } from '@floating-ui/react';
|
|
6
8
|
import { Chip, Icon, CoreIcons } from '@react-fabric/core';
|
|
7
9
|
import { isArray, isEmpty } from '@react-fabric/utilities';
|
|
@@ -225,7 +227,7 @@ var Select = function Select(_ref) {
|
|
|
225
227
|
required: required,
|
|
226
228
|
error: error,
|
|
227
229
|
wrapperRef: refs.setReference,
|
|
228
|
-
className: state.open ? "
|
|
230
|
+
className: state.open ? "z-99!" : ""
|
|
229
231
|
}, rest), {}, {
|
|
230
232
|
children: [/*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({
|
|
231
233
|
role: "none",
|
|
@@ -282,10 +284,26 @@ var Select = function Select(_ref) {
|
|
|
282
284
|
itemProps: makeItemProps,
|
|
283
285
|
empty: emptyDisplay,
|
|
284
286
|
info: (_state$activeItem = state.activeItem) === null || _state$activeItem === void 0 ? void 0 : _state$activeItem[infoProperty !== null && infoProperty !== void 0 ? infoProperty : "info"],
|
|
285
|
-
children: function
|
|
286
|
-
var
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
children: ( /*#__PURE__*/function () {
|
|
288
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(item, label) {
|
|
289
|
+
var _renderer3;
|
|
290
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
291
|
+
while (1) switch (_context.prev = _context.next) {
|
|
292
|
+
case 0:
|
|
293
|
+
_context.next = 2;
|
|
294
|
+
return (_renderer3 = renderer === null || renderer === void 0 ? void 0 : renderer(item)) !== null && _renderer3 !== void 0 ? _renderer3 : label;
|
|
295
|
+
case 2:
|
|
296
|
+
return _context.abrupt("return", _context.sent);
|
|
297
|
+
case 3:
|
|
298
|
+
case "end":
|
|
299
|
+
return _context.stop();
|
|
300
|
+
}
|
|
301
|
+
}, _callee);
|
|
302
|
+
}));
|
|
303
|
+
return function (_x, _x2) {
|
|
304
|
+
return _ref4.apply(this, arguments);
|
|
305
|
+
};
|
|
306
|
+
}())
|
|
289
307
|
}))
|
|
290
308
|
})
|
|
291
309
|
})]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Ref } from "react";
|
|
2
2
|
export interface ArrayInputProps<T extends AnyObject = string> {
|
|
3
3
|
/**
|
|
4
4
|
* input label
|
|
@@ -48,7 +48,7 @@ export interface ArrayInputProps<T extends AnyObject = string> {
|
|
|
48
48
|
index: number;
|
|
49
49
|
name: string;
|
|
50
50
|
item: T;
|
|
51
|
-
}) => ReactNode);
|
|
51
|
+
}) => React.ReactNode);
|
|
52
52
|
/**
|
|
53
53
|
* add item button label
|
|
54
54
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
2
2
|
import { type UploadHandler } from "../hooks/useFileUploader";
|
|
3
|
-
import { AvatarProps } from "@react-fabric/core/dist/types/components/avatar/Avatar";
|
|
3
|
+
import { type AvatarProps } from "@react-fabric/core/dist/types/components/avatar/Avatar";
|
|
4
4
|
export interface Props extends RefProp {
|
|
5
5
|
/**
|
|
6
6
|
* field name
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactElement
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
2
|
export declare const Options: ({ ref, style, items, active, className, itemRef, empty, info, valueProperty, labelProperty, itemProps, children, ...rest }: {
|
|
3
3
|
ref: AnyObject;
|
|
4
4
|
info?: AnyObject;
|
|
@@ -11,5 +11,5 @@ export declare const Options: ({ ref, style, items, active, className, itemRef,
|
|
|
11
11
|
valueProperty?: AnyObject;
|
|
12
12
|
labelProperty?: AnyObject;
|
|
13
13
|
itemProps: (item: AnyObject) => AnyObject;
|
|
14
|
-
children: (item: AnyObject, label: string) => ReactNode;
|
|
14
|
+
children: (item: AnyObject, label: string) => React.ReactNode;
|
|
15
15
|
} & KeyValue) => import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-fabric/form",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.60",
|
|
4
4
|
"description": "RUF: Form package",
|
|
5
5
|
"author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"@dnd-kit/utilities": "~3.2.2",
|
|
42
42
|
"@floating-ui/react": "~0.27.16",
|
|
43
43
|
"@hookform/resolvers": "~5.2.2",
|
|
44
|
-
"@react-fabric/core": "^1.0.0-beta.
|
|
45
|
-
"@react-fabric/date": "^1.0.0-beta.
|
|
46
|
-
"@react-fabric/utilities": "^1.0.0-beta.
|
|
44
|
+
"@react-fabric/core": "^1.0.0-beta.60",
|
|
45
|
+
"@react-fabric/date": "^1.0.0-beta.60",
|
|
46
|
+
"@react-fabric/utilities": "^1.0.0-beta.60",
|
|
47
47
|
"classnames": "~2.5.1",
|
|
48
48
|
"color": "~5.0.2",
|
|
49
49
|
"react-color": "~2.19.3",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"node": ">=18.12.0",
|
|
63
63
|
"npm": ">=8.19.0"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "a79f053ee7e13422c06d7d9c35d4f0c2610cdf5d"
|
|
66
66
|
}
|
|
@@ -32,12 +32,14 @@ import {
|
|
|
32
32
|
useOverlayService,
|
|
33
33
|
} from "@react-fabric/core";
|
|
34
34
|
import { isArray } from "@react-fabric/utilities";
|
|
35
|
-
import {
|
|
35
|
+
import { useCallback, useState } from "react";
|
|
36
36
|
import { useFieldArray, useFormContext } from "react-hook-form";
|
|
37
37
|
import { DATA_TYPES, type SchemaEditorProps } from "../../types/schema";
|
|
38
38
|
import { AddSchemaFields } from "./AddSchemaFields";
|
|
39
39
|
import { SchemaField } from "./SchemaField";
|
|
40
40
|
|
|
41
|
+
// Need to disable prop-types lint due to uknown lint error
|
|
42
|
+
/* eslint-disable react/prop-types */
|
|
41
43
|
export const SchemaArrayForm = ({
|
|
42
44
|
dynamic,
|
|
43
45
|
acceptableTypes,
|
|
@@ -79,7 +81,8 @@ export const SchemaArrayForm = ({
|
|
|
79
81
|
}, []);
|
|
80
82
|
|
|
81
83
|
const Wrapper = useCallback(
|
|
82
|
-
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
85
|
+
({ children }: { children: React.ReactNode }) => {
|
|
83
86
|
if (dynamic) {
|
|
84
87
|
// pass id list to dnd context
|
|
85
88
|
const idMap = fields.map((item) => item.id);
|
package/src/form/Form.tsx
CHANGED
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
} from "react";
|
|
36
36
|
import {
|
|
37
37
|
FormProvider,
|
|
38
|
-
Path,
|
|
38
|
+
type Path,
|
|
39
39
|
useFormContext,
|
|
40
40
|
useForm as useFormHook,
|
|
41
41
|
useWatch,
|
|
@@ -156,7 +156,7 @@ export const Form = <K extends KeyValue>({
|
|
|
156
156
|
reset: () => handleReset(defaultValues),
|
|
157
157
|
clear: () => handleReset(),
|
|
158
158
|
submit: () => form.handleSubmit(onSubmit),
|
|
159
|
-
validate: async (fields?: Path<K
|
|
159
|
+
validate: async (fields?: Array<Path<K>>) => await form.trigger(fields),
|
|
160
160
|
getValues: () => form.getValues(),
|
|
161
161
|
setValues: (v) => setTimeout(() => form.reset(v), 50),
|
|
162
162
|
setValue: (k, v) =>
|
package/src/input/ArrayInput.tsx
CHANGED
|
@@ -34,14 +34,12 @@ import { isFalse, isString } from "@react-fabric/utilities";
|
|
|
34
34
|
import classNames from "classnames";
|
|
35
35
|
import {
|
|
36
36
|
cloneElement,
|
|
37
|
-
use,
|
|
38
37
|
useCallback,
|
|
39
38
|
useEffect,
|
|
40
39
|
useImperativeHandle,
|
|
41
40
|
useMemo,
|
|
42
41
|
useState,
|
|
43
42
|
type PropsWithChildren,
|
|
44
|
-
type ReactNode,
|
|
45
43
|
type Ref,
|
|
46
44
|
} from "react";
|
|
47
45
|
import { useFieldArray, useFormContext } from "react-hook-form";
|
|
@@ -99,7 +97,7 @@ export interface ArrayInputProps<T extends AnyObject = string> {
|
|
|
99
97
|
enableSorting?: boolean;
|
|
100
98
|
children:
|
|
101
99
|
| React.ReactNode
|
|
102
|
-
| ((props: { index: number; name: string; item: T }) => ReactNode);
|
|
100
|
+
| ((props: { index: number; name: string; item: T }) => React.ReactNode);
|
|
103
101
|
/**
|
|
104
102
|
* add item button label
|
|
105
103
|
*/
|
|
@@ -228,7 +226,7 @@ export const ArrayInput = <T extends AnyObject = string>({
|
|
|
228
226
|
(item: T, index: number) => {
|
|
229
227
|
if (canRemove === false) return false;
|
|
230
228
|
if (canRemove === "newonly") {
|
|
231
|
-
return initialList.includes((item as any).__ID__)
|
|
229
|
+
return !initialList.includes((item as any).__ID__);
|
|
232
230
|
}
|
|
233
231
|
if (typeof canRemove === "function") {
|
|
234
232
|
return canRemove({
|
|
@@ -274,7 +272,8 @@ export const ArrayInput = <T extends AnyObject = string>({
|
|
|
274
272
|
}));
|
|
275
273
|
|
|
276
274
|
const Wrapper = useCallback(
|
|
277
|
-
|
|
275
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
276
|
+
({ children }: { children: React.ReactNode }) => {
|
|
278
277
|
if (enableSorting) {
|
|
279
278
|
// pass id list to dnd context
|
|
280
279
|
const idMap = fields.map((item) => item.__ID__);
|
|
@@ -452,7 +451,7 @@ export const ArrayInput = <T extends AnyObject = string>({
|
|
|
452
451
|
disabled ||
|
|
453
452
|
readOnly ||
|
|
454
453
|
fields.length <= minItems ||
|
|
455
|
-
removeCheck(item as any, index)
|
|
454
|
+
!removeCheck(item as any, index)
|
|
456
455
|
}
|
|
457
456
|
onClick={() => handleRemove(item as any, index)}
|
|
458
457
|
/>
|
|
@@ -26,7 +26,7 @@ import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
|
26
26
|
import { useEffect, useState } from "react";
|
|
27
27
|
import { useFileUploader, type UploadHandler } from "../hooks/useFileUploader";
|
|
28
28
|
import { HiddenInput } from "./Hidden";
|
|
29
|
-
import { AvatarProps } from "@react-fabric/core/dist/types/components/avatar/Avatar";
|
|
29
|
+
import { type AvatarProps } from "@react-fabric/core/dist/types/components/avatar/Avatar";
|
|
30
30
|
import classNames from "classnames";
|
|
31
31
|
|
|
32
32
|
export interface Props extends RefProp {
|
|
@@ -172,7 +172,7 @@ export const AvatarInput = ({
|
|
|
172
172
|
bg="danger"
|
|
173
173
|
color="white"
|
|
174
174
|
size="sm"
|
|
175
|
-
className="p-
|
|
175
|
+
className="p-0.5 flex-content"
|
|
176
176
|
aria-label="abort"
|
|
177
177
|
onClick={() => file.abort?.()}
|
|
178
178
|
/>
|
package/src/input/Checkbox.tsx
CHANGED
|
@@ -135,7 +135,7 @@ export const Checkbox = ({
|
|
|
135
135
|
disabled
|
|
136
136
|
? "opacity-50 cursor-not-allowed"
|
|
137
137
|
: " opacity-85 hover:opacity-100 cursor-pointer",
|
|
138
|
-
"inline-flex gap-1 py-1 items-center relative rounded ring-offset-2 has-
|
|
138
|
+
"inline-flex gap-1 py-1 items-center relative rounded ring-offset-2 has-focus-visible:ring-1",
|
|
139
139
|
)}
|
|
140
140
|
style={{ width }}
|
|
141
141
|
>
|
package/src/input/Password.tsx
CHANGED
|
@@ -146,7 +146,7 @@ export const Password = ({
|
|
|
146
146
|
<div
|
|
147
147
|
className={classNames(
|
|
148
148
|
"absolute bottom-px h-[3px] inset-x-0 after:block after:h-full after:bg-dimmed",
|
|
149
|
-
"ltr:bg-
|
|
149
|
+
"ltr:bg-linear-to-r rtl:bg-linear-to-l from-danger-500 via-marigold-500 to-jade-500",
|
|
150
150
|
)}
|
|
151
151
|
style={{
|
|
152
152
|
paddingInlineStart: `${strength > 1 ? 100 : strength * 100}%`,
|
package/src/input/Radio.tsx
CHANGED
|
@@ -113,7 +113,7 @@ export const Radio = ({
|
|
|
113
113
|
disabled
|
|
114
114
|
? "opacity-50 cursor-not-allowed"
|
|
115
115
|
: "hover:opacity-100 cursor-pointer",
|
|
116
|
-
"inline-flex gap-1 py-1 items-center relative cursor-pointer opacity-85 rounded ring-offset-2 has-
|
|
116
|
+
"inline-flex gap-1 py-1 items-center relative cursor-pointer opacity-85 rounded ring-offset-2 has-focus-visible:ring-1",
|
|
117
117
|
)}
|
|
118
118
|
style={{ width }}
|
|
119
119
|
>
|
|
@@ -218,7 +218,7 @@ export const RangeSlider = ({
|
|
|
218
218
|
<div
|
|
219
219
|
key={key}
|
|
220
220
|
className={classNames(
|
|
221
|
-
"absolute inline-block h-1 w-1 rounded-sm bg-invert opacity-30 leading-
|
|
221
|
+
"absolute inline-block h-1 w-1 rounded-sm bg-invert opacity-30 leading-0 z-1",
|
|
222
222
|
vertical && "left-1/2 -ml-0.5",
|
|
223
223
|
)}
|
|
224
224
|
style={styles}
|
|
@@ -264,8 +264,8 @@ export const RangeSlider = ({
|
|
|
264
264
|
: "top-1/2 -translate-y-1/2",
|
|
265
265
|
!vertical &&
|
|
266
266
|
(key === 0
|
|
267
|
-
? "-ms-3 ltr:-translate-x-full rtl:translate-x-full ltr:before:translate-x-
|
|
268
|
-
: "ms-3 ltr:before:-translate-x-
|
|
267
|
+
? "-ms-3 ltr:-translate-x-full rtl:translate-x-full ltr:before:translate-x-0.5 rtl:before:-translate-x-0.5 before:end-0"
|
|
268
|
+
: "ms-3 ltr:before:-translate-x-0.5 rtl:before:translate-x-0.5 before:start-0"),
|
|
269
269
|
)}
|
|
270
270
|
data-align={key === 0 ? "start" : "end"}
|
|
271
271
|
style={valueStyles}
|
package/src/input/Slider.tsx
CHANGED
|
@@ -223,7 +223,7 @@ export const Slider = ({
|
|
|
223
223
|
<div
|
|
224
224
|
key={key}
|
|
225
225
|
className={classNames(
|
|
226
|
-
"absolute inline-block h-1 w-1 rounded-sm bg-invert opacity-30 leading-
|
|
226
|
+
"absolute inline-block h-1 w-1 rounded-sm bg-invert opacity-30 leading-0 z-1",
|
|
227
227
|
vertical && "left-1/2 -ml-0.5",
|
|
228
228
|
)}
|
|
229
229
|
style={styles}
|
|
@@ -262,15 +262,15 @@ export const Slider = ({
|
|
|
262
262
|
{displayValue && (
|
|
263
263
|
<div
|
|
264
264
|
className={classNames(
|
|
265
|
-
"bg-invert text-invert py-px px-2 text-xs absolute rounded z-
|
|
265
|
+
"bg-invert text-invert py-px px-2 text-xs absolute rounded z-5 whitespace-nowrap pointer-events-none",
|
|
266
266
|
"before:absolute before:h-1.5 before:w-1.5 before:z-[-1] before:bg-invert before:top-1/2 before:-translate-y-1/2 before:rotate-45",
|
|
267
267
|
vertical
|
|
268
|
-
? "end-0 ltr:translate-x-full rtl:-translate-x-full translate-y-2 ltr:before:-translate-x-
|
|
268
|
+
? "end-0 ltr:translate-x-full rtl:-translate-x-full translate-y-2 ltr:before:-translate-x-0.5 rtl:before:translate-x-0.5 before:start-0"
|
|
269
269
|
: "top-1/2 -translate-y-1/2",
|
|
270
270
|
!vertical &&
|
|
271
271
|
(percentage > 50
|
|
272
|
-
? "-ms-3 ltr:-translate-x-full rtl:translate-x-full ltr:before:translate-x-
|
|
273
|
-
: "ms-3 ltr:before:-translate-x-
|
|
272
|
+
? "-ms-3 ltr:-translate-x-full rtl:translate-x-full ltr:before:translate-x-0.5 rtl:before:-translate-x-0.5 before:end-0"
|
|
273
|
+
: "ms-3 ltr:before:-translate-x-0.5 rtl:before:translate-x-0.5 before:start-0"),
|
|
274
274
|
)}
|
|
275
275
|
data-align={percentage > 50 ? "start" : "end"}
|
|
276
276
|
style={valueStyles}
|
package/src/input/Switch.tsx
CHANGED
|
@@ -138,7 +138,7 @@ export const Switch = ({
|
|
|
138
138
|
disabled
|
|
139
139
|
? "opacity-50 cursor-not-allowed"
|
|
140
140
|
: "hover:opacity-100 cursor-pointer",
|
|
141
|
-
"inline-flex gap-1 py-1 items-center relative cursor-pointer opacity-85 rounded ring-offset-2 has-
|
|
141
|
+
"inline-flex gap-1 py-1 items-center relative cursor-pointer opacity-85 rounded ring-offset-2 has-focus-visible:ring-1",
|
|
142
142
|
)}
|
|
143
143
|
style={{ width }}
|
|
144
144
|
>
|
|
@@ -176,7 +176,7 @@ export const Switch = ({
|
|
|
176
176
|
aria-hidden="true"
|
|
177
177
|
className={classNames(
|
|
178
178
|
!disabled && "shadow-sm",
|
|
179
|
-
actualValue ? "translate-x-
|
|
179
|
+
actualValue ? "translate-x-full" : "translate-x-0",
|
|
180
180
|
"pointer-events-none inline-block h-[1em] start-[0.25em] absolute rounded-full bg-white ring-0 transition duration-200 ease-in-out",
|
|
181
181
|
)}
|
|
182
182
|
style={{
|
|
@@ -74,9 +74,12 @@ export const InputWrapper = ({
|
|
|
74
74
|
|
|
75
75
|
const handleClear = useCallback(
|
|
76
76
|
(e: MouseEvent<HTMLDivElement>) => {
|
|
77
|
-
e.currentTarget.parentElement
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
const parent = e.currentTarget.parentElement?.querySelector(
|
|
78
|
+
"& > :not(.fabric-decorate)",
|
|
79
|
+
);
|
|
80
|
+
const el = (parent?.querySelector<HTMLElement>("input,textarea,button") ??
|
|
81
|
+
parent) as HTMLElement;
|
|
82
|
+
el?.focus();
|
|
80
83
|
onClear?.();
|
|
81
84
|
},
|
|
82
85
|
[onClear],
|
|
@@ -84,9 +87,12 @@ export const InputWrapper = ({
|
|
|
84
87
|
|
|
85
88
|
const doFocus = useCallback(
|
|
86
89
|
(e: MouseEvent<HTMLDivElement>) => {
|
|
87
|
-
e.currentTarget.parentElement
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
const parent = e.currentTarget.parentElement?.querySelector(
|
|
91
|
+
"& > :not(.fabric-decorate)",
|
|
92
|
+
);
|
|
93
|
+
const el = (parent?.querySelector<HTMLElement>("input,textarea,button") ??
|
|
94
|
+
parent) as HTMLElement;
|
|
95
|
+
el?.focus();
|
|
90
96
|
},
|
|
91
97
|
[onClear],
|
|
92
98
|
);
|
|
@@ -112,7 +118,7 @@ export const InputWrapper = ({
|
|
|
112
118
|
"flex flex-nowrap items-center flex-1",
|
|
113
119
|
textarea ? "rounded-capped group" : "rounded",
|
|
114
120
|
isExpanded
|
|
115
|
-
? "fixed inset-4 z-
|
|
121
|
+
? "fixed inset-4 z-99"
|
|
116
122
|
: floatingExpand
|
|
117
123
|
? "absolute inset-x-0"
|
|
118
124
|
: "relative",
|
|
@@ -276,7 +276,7 @@ export const AutoComplete = ({
|
|
|
276
276
|
required={required}
|
|
277
277
|
error={error}
|
|
278
278
|
wrapperRef={refs.setReference}
|
|
279
|
-
className={!multiple && expandOnEdit && state.open ? "
|
|
279
|
+
className={!multiple && expandOnEdit && state.open ? "z-99!" : ""}
|
|
280
280
|
floatingExpand={!multiple && expandOnEdit && state.open}
|
|
281
281
|
{...rest}
|
|
282
282
|
>
|
package/src/select/DualList.tsx
CHANGED
|
@@ -21,8 +21,16 @@
|
|
|
21
21
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
+
import {
|
|
25
|
+
DndContext,
|
|
26
|
+
DragOverlay,
|
|
27
|
+
useDraggable,
|
|
28
|
+
useDroppable,
|
|
29
|
+
} from "@dnd-kit/core";
|
|
30
|
+
import { restrictToHorizontalAxis } from "@dnd-kit/modifiers";
|
|
24
31
|
import { Button, ButtonGroup, CoreIcons } from "@react-fabric/core";
|
|
25
32
|
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
33
|
+
import { mergeRefs } from "@react-fabric/utilities";
|
|
26
34
|
import {
|
|
27
35
|
type ReactElement,
|
|
28
36
|
useCallback,
|
|
@@ -33,14 +41,6 @@ import {
|
|
|
33
41
|
} from "react";
|
|
34
42
|
import { Field, type FieldProps } from "../input/Field";
|
|
35
43
|
import { List } from "./List";
|
|
36
|
-
import { restrictToHorizontalAxis } from "@dnd-kit/modifiers";
|
|
37
|
-
import {
|
|
38
|
-
DndContext,
|
|
39
|
-
DragOverlay,
|
|
40
|
-
useDraggable,
|
|
41
|
-
useDroppable,
|
|
42
|
-
} from "@dnd-kit/core";
|
|
43
|
-
import { mergeRefs } from "@react-fabric/utilities";
|
|
44
44
|
|
|
45
45
|
export interface DualListProps<T>
|
|
46
46
|
extends Omit<FieldProps, "children">,
|
package/src/select/List.tsx
CHANGED
|
@@ -324,7 +324,7 @@ export const List = <T extends AnyObject = string>({
|
|
|
324
324
|
empty={emptyDisplay}
|
|
325
325
|
info={state.activeItem?.[infoProperty ?? "info"]}
|
|
326
326
|
>
|
|
327
|
-
{(item, label) => renderer?.(item) ?? label}
|
|
327
|
+
{async (item, label) => await (renderer?.(item) ?? label)}
|
|
328
328
|
</Options>
|
|
329
329
|
</FloatingFocusManager>
|
|
330
330
|
</Wrapper>
|
package/src/select/Options.tsx
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
import { EmptyContent } from "@react-fabric/core";
|
|
25
25
|
import classNames from "classnames";
|
|
26
|
-
import { type ReactElement
|
|
26
|
+
import { type ReactElement } from "react";
|
|
27
27
|
import { Trans } from "react-i18next";
|
|
28
28
|
|
|
29
29
|
export const Options = ({
|
|
@@ -52,7 +52,7 @@ export const Options = ({
|
|
|
52
52
|
valueProperty?: AnyObject;
|
|
53
53
|
labelProperty?: AnyObject;
|
|
54
54
|
itemProps: (item: AnyObject) => AnyObject;
|
|
55
|
-
children: (item: AnyObject, label: string) => ReactNode;
|
|
55
|
+
children: (item: AnyObject, label: string) => React.ReactNode;
|
|
56
56
|
} & KeyValue) => {
|
|
57
57
|
return (
|
|
58
58
|
<div
|
|
@@ -87,7 +87,7 @@ export const Options = ({
|
|
|
87
87
|
data-active={active === index ? true : undefined}
|
|
88
88
|
className={classNames(
|
|
89
89
|
"block text-start truncate px-2 py-1 leading-normal cursor-pointer select-none",
|
|
90
|
-
"data-
|
|
90
|
+
"data-active:bg-primary-200 data-selected:bg-primary-600 data-selected:text-white data-active:data-selected:underline",
|
|
91
91
|
)}
|
|
92
92
|
{...itemProps(item)}
|
|
93
93
|
>
|
|
@@ -108,7 +108,7 @@ export const Options = ({
|
|
|
108
108
|
data-active={active === index ? true : undefined}
|
|
109
109
|
className={classNames(
|
|
110
110
|
"block text-start truncate px-2 py-1 leading-normal cursor-pointer",
|
|
111
|
-
"data-
|
|
111
|
+
"data-active:bg-primary-200 data-selected:bg-primary-600 data-selected:text-white data-active:data-selected:underline",
|
|
112
112
|
)}
|
|
113
113
|
{...itemProps(item)}
|
|
114
114
|
>
|
package/src/select/Select.tsx
CHANGED
|
@@ -281,7 +281,7 @@ export const Select = <T extends AnyObject = string>({
|
|
|
281
281
|
required={required}
|
|
282
282
|
error={error}
|
|
283
283
|
wrapperRef={refs.setReference}
|
|
284
|
-
className={state.open ? "
|
|
284
|
+
className={state.open ? "z-99!" : ""}
|
|
285
285
|
{...rest}
|
|
286
286
|
>
|
|
287
287
|
<div
|
|
@@ -360,7 +360,7 @@ export const Select = <T extends AnyObject = string>({
|
|
|
360
360
|
empty={emptyDisplay}
|
|
361
361
|
info={state.activeItem?.[infoProperty ?? "info"]}
|
|
362
362
|
>
|
|
363
|
-
{(item, label) => renderer?.(item) ?? label}
|
|
363
|
+
{async (item, label) => await (renderer?.(item) ?? label)}
|
|
364
364
|
</Options>
|
|
365
365
|
</FloatingFocusManager>
|
|
366
366
|
</FloatingPortal>
|