@react-fabric/form 1.0.0-beta.60 → 1.0.0-beta.61

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.
Files changed (69) hide show
  1. package/dist/cjs/builder/FileField.js +2 -2
  2. package/dist/cjs/builder/components/AddSchemaFields.js +2 -1
  3. package/dist/cjs/builder/components/SchemaArrayForm.js +3 -3
  4. package/dist/cjs/builder/components/SchemaField.js +2 -2
  5. package/dist/cjs/form/Form.js +5 -8
  6. package/dist/cjs/hooks/useFormBuilder.js +10 -3
  7. package/dist/cjs/input/ArrayInput.js +3 -3
  8. package/dist/cjs/input/AvatarInput.js +3 -3
  9. package/dist/cjs/input/Checkbox.js +2 -2
  10. package/dist/cjs/input/ColorInput.js +2 -2
  11. package/dist/cjs/input/File.js +1 -1
  12. package/dist/cjs/input/Password.js +1 -1
  13. package/dist/cjs/input/Radio.js +2 -2
  14. package/dist/cjs/input/Search.js +2 -3
  15. package/dist/cjs/internal/ErrorIcon.js +1 -1
  16. package/dist/cjs/internal/InputWrapper.js +3 -3
  17. package/dist/cjs/select/AutoComplete.js +1 -2
  18. package/dist/cjs/select/DualList.js +4 -4
  19. package/dist/cjs/select/List.js +4 -22
  20. package/dist/cjs/select/Select.js +8 -27
  21. package/dist/esm/builder/FileField.js +3 -3
  22. package/dist/esm/builder/components/AddSchemaFields.js +2 -1
  23. package/dist/esm/builder/components/SchemaArrayForm.js +4 -4
  24. package/dist/esm/builder/components/SchemaField.js +3 -3
  25. package/dist/esm/form/Form.js +5 -8
  26. package/dist/esm/hooks/useFormBuilder.js +10 -3
  27. package/dist/esm/input/ArrayInput.js +4 -4
  28. package/dist/esm/input/AvatarInput.js +4 -4
  29. package/dist/esm/input/Checkbox.js +3 -3
  30. package/dist/esm/input/ColorInput.js +3 -3
  31. package/dist/esm/input/File.js +2 -2
  32. package/dist/esm/input/Password.js +2 -2
  33. package/dist/esm/input/Radio.js +3 -3
  34. package/dist/esm/input/Search.js +3 -4
  35. package/dist/esm/internal/ErrorIcon.js +2 -2
  36. package/dist/esm/internal/InputWrapper.js +4 -4
  37. package/dist/esm/select/AutoComplete.js +2 -3
  38. package/dist/esm/select/DualList.js +5 -5
  39. package/dist/esm/select/List.js +4 -22
  40. package/dist/esm/select/Select.js +9 -28
  41. package/dist/types/form/Form.d.ts +6 -9
  42. package/dist/types/hooks/useFormBuilder.d.ts +6 -0
  43. package/dist/types/input/AvatarInput.d.ts +1 -1
  44. package/dist/types/select/DualList.d.ts +5 -6
  45. package/dist/types/select/Options.d.ts +1 -1
  46. package/dist/types/types/index.d.ts +7 -8
  47. package/package.json +5 -5
  48. package/src/builder/FileField.tsx +3 -9
  49. package/src/builder/components/AddSchemaFields.tsx +2 -1
  50. package/src/builder/components/SchemaArrayForm.tsx +4 -10
  51. package/src/builder/components/SchemaField.tsx +2 -3
  52. package/src/form/Form.tsx +10 -11
  53. package/src/hooks/useFormBuilder.tsx +12 -4
  54. package/src/input/ArrayInput.tsx +4 -10
  55. package/src/input/AvatarInput.tsx +5 -5
  56. package/src/input/Checkbox.tsx +6 -3
  57. package/src/input/ColorInput.tsx +3 -7
  58. package/src/input/File.tsx +2 -2
  59. package/src/input/Password.tsx +4 -2
  60. package/src/input/Radio.tsx +3 -3
  61. package/src/input/Search.tsx +3 -3
  62. package/src/internal/ErrorIcon.tsx +2 -2
  63. package/src/internal/InputWrapper.tsx +8 -4
  64. package/src/select/AutoComplete.tsx +2 -3
  65. package/src/select/DualList.tsx +14 -11
  66. package/src/select/List.tsx +1 -1
  67. package/src/select/Options.tsx +1 -1
  68. package/src/select/Select.tsx +6 -7
  69. package/src/types/index.ts +8 -7
@@ -5,14 +5,13 @@ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
5
5
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
6
6
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
7
7
  import _regeneratorRuntime from '@babel/runtime/regenerator';
8
- import { yupResolver } from '@hookform/resolvers/yup';
9
8
  import { useDebounce } from '@react-fabric/core';
10
9
  import { EMPTY_OBJECT } from '@react-fabric/utilities';
11
10
  import { useRef, useTransition, useEffect, useCallback, useImperativeHandle } from 'react';
12
11
  import { useForm as useForm$1, FormProvider, useFormContext, useWatch } from 'react-hook-form';
13
12
  import { jsx, jsxs } from 'react/jsx-runtime';
14
13
 
15
- var _excluded = ["formRef", "schema", "children", "defaultValues", "onSubmit", "onChange"];
14
+ var _excluded = ["formRef", "resolver", "children", "defaultValues", "onSubmit", "onChange"];
16
15
  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; }
17
16
  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; }
18
17
  var DEFAULT_SUBMIT = function DEFAULT_SUBMIT() {
@@ -31,10 +30,7 @@ var DEFAULT_SUBMIT = function DEFAULT_SUBMIT() {
31
30
  * ```jsx
32
31
  * <Form
33
32
  * formRef={formRef}
34
- * schema={yup.object().shape({
35
- * name: yup.string().required("Name is required"),
36
- * email: yup.string().email("Invalid email").required("Email is required"),
37
- * })}
33
+ * resolver={hookformResolver(schema)}
38
34
  * defaultValues={{ name: "", email: "" }}
39
35
  * onSubmit={(values) => {
40
36
  * console.log("Form submitted with values:", values);
@@ -52,7 +48,7 @@ var DEFAULT_SUBMIT = function DEFAULT_SUBMIT() {
52
48
  */
53
49
  var Form = function Form(_ref) {
54
50
  var formRef = _ref.formRef,
55
- schema = _ref.schema,
51
+ resolver = _ref.resolver,
56
52
  children = _ref.children,
57
53
  _ref$defaultValues = _ref.defaultValues,
58
54
  defaultValues = _ref$defaultValues === void 0 ? EMPTY_OBJECT : _ref$defaultValues,
@@ -63,7 +59,7 @@ var Form = function Form(_ref) {
63
59
  var ref = useRef(null);
64
60
  var form = useForm$1({
65
61
  shouldFocusError: true,
66
- resolver: schema && yupResolver(schema),
62
+ resolver: resolver,
67
63
  defaultValues: defaultValues
68
64
  });
69
65
  var _useTransition = useTransition(),
@@ -139,6 +135,7 @@ var Form = function Form(_ref) {
139
135
  }, [_onSubmit, form, form.formState, defaultValues]);
140
136
  var onInvalid = useCallback(function (_, e) {
141
137
  var el = e.target;
138
+ console.log("Invalid:", _, e);
142
139
  setTimeout(function () {
143
140
  var _el$querySelector;
144
141
  return (_el$querySelector = el.querySelector("input[aria-invalid='true'],textarea[aria-invalid='true']")) === null || _el$querySelector === void 0 ? void 0 : _el$querySelector.focus();
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
+ import { yupResolver } from '@hookform/resolvers/yup';
4
5
  import { EmptyContent } from '@react-fabric/core';
5
6
  import { yup, isNil, isEmpty } from '@react-fabric/utilities';
6
7
  import { useMemo, Fragment } from 'react';
@@ -100,9 +101,14 @@ var useFormBuilder = function useFormBuilder(schema) {
100
101
  return !!schm.id;
101
102
  })) !== null && _schema$filter !== void 0 ? _schema$filter : [];
102
103
  }, [schema]);
103
- var schemaDef = yup.object(Object.fromEntries(filteredSchema.map(function (field) {
104
- return [field.id, makeYupField(field)];
105
- })));
104
+ var schemaDef = useMemo(function () {
105
+ return yup.object(Object.fromEntries(filteredSchema.map(function (field) {
106
+ return [field.id, makeYupField(field)];
107
+ })));
108
+ }, [filteredSchema]);
109
+ var resolver = useMemo(function () {
110
+ return yupResolver(schemaDef);
111
+ }, [schemaDef]);
106
112
  var formDef = /*#__PURE__*/jsxs(Fragment, {
107
113
  children: [filteredSchema.map(function (field, idx) {
108
114
  return /*#__PURE__*/jsx("div", {
@@ -122,6 +128,7 @@ var useFormBuilder = function useFormBuilder(schema) {
122
128
  });
123
129
  return {
124
130
  formDef: formDef,
131
+ resolver: resolver,
125
132
  schemaDef: schemaDef
126
133
  };
127
134
  };
@@ -5,7 +5,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
5
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
6
6
  import { DndContext } from '@dnd-kit/core';
7
7
  import { SortableContext, useSortable } from '@dnd-kit/sortable';
8
- import { Icon, CoreIcons, Tooltip, Button, cloneChildren } from '@react-fabric/core';
8
+ import { Icon, Tooltip, Button, cloneChildren } from '@react-fabric/core';
9
9
  import { isFalse, isString } from '@react-fabric/utilities';
10
10
  import classNames from 'classnames';
11
11
  import { useState, useEffect, useMemo, useCallback, useImperativeHandle, cloneElement } from 'react';
@@ -196,7 +196,7 @@ var ArrayInput = function ArrayInput(_ref) {
196
196
  },
197
197
  children: [/*#__PURE__*/jsx(Icon, _objectSpread(_objectSpread({
198
198
  className: isDragging ? "cursor-grabbing" : "cursor-grab",
199
- icon: CoreIcons.dragHandle
199
+ icon: "icon-[mdi--drag-vertical]"
200
200
  }, attributes), listeners)), children]
201
201
  });
202
202
  }
@@ -219,7 +219,7 @@ var ArrayInput = function ArrayInput(_ref) {
219
219
  children: /*#__PURE__*/jsx(Button, {
220
220
  size: "sm",
221
221
  "aria-label": "Add item",
222
- icon: CoreIcons.insert,
222
+ icon: "icon-[mdi--plus-circle-outline]",
223
223
  onClick: function onClick() {
224
224
  return handleAdd(onAdd === null || onAdd === void 0 ? void 0 : onAdd());
225
225
  },
@@ -260,7 +260,7 @@ var ArrayInput = function ArrayInput(_ref) {
260
260
  }));
261
261
  }), canRemove !== false && /*#__PURE__*/jsx(Button, {
262
262
  "aria-label": "Remove item",
263
- icon: CoreIcons.remove,
263
+ icon: "icon-[mdi--minus-circle-outline]",
264
264
  color: "danger",
265
265
  variant: "link",
266
266
  className: "self-end",
@@ -5,11 +5,11 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
5
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
6
6
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
7
7
  import _regeneratorRuntime from '@babel/runtime/regenerator';
8
- import { Avatar, Icon, CoreIcons, ProgressBar } from '@react-fabric/core';
8
+ import { Avatar, Icon, ProgressBar } from '@react-fabric/core';
9
+ import classNames from 'classnames';
9
10
  import { useState, useEffect } from 'react';
10
11
  import { useFileUploader } from '../hooks/useFileUploader.js';
11
12
  import { HiddenInput } from './Hidden.js';
12
- import classNames from 'classnames';
13
13
  import { jsxs, jsx } from 'react/jsx-runtime';
14
14
 
15
15
  var _excluded = ["size", "avatarName", "avatarClassName", "value", "rounded", "defaultValue", "fallbackIcon", "variant", "fileUrl", "uploadHandler"];
@@ -128,7 +128,7 @@ var AvatarInput = function AvatarInput(_ref) {
128
128
  children: file.error
129
129
  })
130
130
  }), file.progress && /*#__PURE__*/jsx(Icon, {
131
- icon: CoreIcons.stop,
131
+ icon: "icon-[mdi--stop]",
132
132
  bg: "danger",
133
133
  color: "white",
134
134
  size: "sm",
@@ -139,7 +139,7 @@ var AvatarInput = function AvatarInput(_ref) {
139
139
  return (_file$abort = file.abort) === null || _file$abort === void 0 ? void 0 : _file$abort.call(file);
140
140
  }
141
141
  }), !file.progress && /*#__PURE__*/jsx(Icon, {
142
- icon: CoreIcons.trash,
142
+ icon: "icon-[mdi--trash-can-outline]",
143
143
  color: "danger",
144
144
  size: "sm",
145
145
  className: "flex-content",
@@ -3,7 +3,7 @@
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
5
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
6
- import { CoreIcons, Icon } from '@react-fabric/core';
6
+ import { Icon } from '@react-fabric/core';
7
7
  import classNames from 'classnames';
8
8
  import { useState, useDeferredValue, useMemo, useEffect, useCallback } from 'react';
9
9
  import { ErrorIcon } from '../internal/ErrorIcon.js';
@@ -43,10 +43,10 @@ var Checkbox = function Checkbox(_ref) {
43
43
  var deferred = useDeferredValue(!!checked);
44
44
  var iconOn = useMemo(function () {
45
45
  var _ref2;
46
- return (_ref2 = iconChecked !== null && iconChecked !== void 0 ? iconChecked : icon) !== null && _ref2 !== void 0 ? _ref2 : CoreIcons.checkboxOn;
46
+ return (_ref2 = iconChecked !== null && iconChecked !== void 0 ? iconChecked : icon) !== null && _ref2 !== void 0 ? _ref2 : "icon-[mdi--checkbox-marked]";
47
47
  }, [icon, iconChecked]);
48
48
  var iconOff = useMemo(function () {
49
- return icon !== null && icon !== void 0 ? icon : CoreIcons.checkboxOff;
49
+ return icon !== null && icon !== void 0 ? icon : "icon-[mdi--checkbox-blank-outline]";
50
50
  }, [icon]);
51
51
  useEffect(function () {
52
52
  setActualValue(deferred);
@@ -4,7 +4,7 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
5
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
6
6
  import { useFloating, autoUpdate, shift, flip, offset, arrow, useClick, useDismiss, useInteractions, FloatingArrow } from '@floating-ui/react';
7
- import { Icon, CoreIcons } from '@react-fabric/core';
7
+ import { Icon } from '@react-fabric/core';
8
8
  import { useState, useDeferredValue, useEffect, useCallback, startTransition, useRef } from 'react';
9
9
  import { InputWrapper } from '../internal/InputWrapper.js';
10
10
  import { ColorPicker } from './ColorPicker.js';
@@ -120,7 +120,7 @@ var ColorInput = function ColorInput(_ref) {
120
120
  children: !actualValue && /*#__PURE__*/jsx(Icon, {
121
121
  size: "md",
122
122
  className: "text-muted",
123
- icon: CoreIcons.colorSwatch
123
+ icon: "icon-[mdi--palette]"
124
124
  })
125
125
  })
126
126
  })), isOpen && /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({
@@ -142,7 +142,7 @@ var ColorInput = function ColorInput(_ref) {
142
142
  })]
143
143
  })), !disabled && showPicker && /*#__PURE__*/jsx(Icon, {
144
144
  className: "flex-content p-1",
145
- icon: CoreIcons.colorPicker,
145
+ icon: "icon-[mdi--eyedropper]",
146
146
  onClick: function onClick() {
147
147
  return window.EyeDropper && new window.EyeDropper().open().then(function (resp) {
148
148
  return handleChange(resp.sRGBHex);
@@ -3,7 +3,7 @@
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
5
5
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
6
- import { Icon, CoreIcons } from '@react-fabric/core';
6
+ import { Icon } from '@react-fabric/core';
7
7
  import { isArray, mergeRefs, isEmpty, FileUtil, Format } from '@react-fabric/utilities';
8
8
  import classNames from 'classnames';
9
9
  import { useRef, useState, useDeferredValue, useEffect, useCallback, Fragment } from 'react';
@@ -132,7 +132,7 @@ var FileInput = function FileInput(_ref) {
132
132
  children: Format.bytes(file.size)
133
133
  }), /*#__PURE__*/jsx(Icon, {
134
134
  className: "cursor-pointer opacity-30 hover:opacity-80",
135
- icon: CoreIcons.close,
135
+ icon: "icon-[mdi--close]",
136
136
  onClick: function onClick() {
137
137
  removeFile(idx);
138
138
  }
@@ -3,7 +3,7 @@
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
5
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
6
- import { Tooltip, Button, CoreIcons } from '@react-fabric/core';
6
+ import { Tooltip, Button } from '@react-fabric/core';
7
7
  import classNames from 'classnames';
8
8
  import { useState, useDeferredValue, useEffect, useCallback } from 'react';
9
9
  import { useTranslation } from 'react-i18next';
@@ -76,7 +76,7 @@ var Password = function Password(_ref) {
76
76
  color: "warning",
77
77
  variant: "link",
78
78
  "aria-label": t(show ? "password.hide" : "password.show"),
79
- icon: show ? CoreIcons.eyeOff : CoreIcons.eye,
79
+ icon: show ? "icon-[mdi--eye-off-outline]" : "icon-[mdi--eye-outline]",
80
80
  onClick: function onClick() {
81
81
  return setShow(!show);
82
82
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
5
- import { CoreIcons, Icon } from '@react-fabric/core';
5
+ import { Icon } from '@react-fabric/core';
6
6
  import classNames from 'classnames';
7
7
  import { useMemo, useCallback } from 'react';
8
8
  import { jsxs, jsx } from 'react/jsx-runtime';
@@ -34,10 +34,10 @@ var Radio = function Radio(_ref) {
34
34
  rest = _objectWithoutProperties(_ref, _excluded);
35
35
  var iconOn = useMemo(function () {
36
36
  var _ref2;
37
- return (_ref2 = iconChecked !== null && iconChecked !== void 0 ? iconChecked : icon) !== null && _ref2 !== void 0 ? _ref2 : CoreIcons.radioOn;
37
+ return (_ref2 = iconChecked !== null && iconChecked !== void 0 ? iconChecked : icon) !== null && _ref2 !== void 0 ? _ref2 : "icon-[mdi--radiobox-marked]";
38
38
  }, [icon, iconChecked]);
39
39
  var iconOff = useMemo(function () {
40
- return icon !== null && icon !== void 0 ? icon : CoreIcons.radioOff;
40
+ return icon !== null && icon !== void 0 ? icon : "icon-[mdi--radiobox-blank]";
41
41
  }, [icon]);
42
42
  var handleChange = useCallback(function (e) {
43
43
  // @ts-expect-error ignore
@@ -3,7 +3,7 @@
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
5
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
6
- import { useDebounce, Icon, CoreIcons, Button } from '@react-fabric/core';
6
+ import { useDebounce, Icon, Button } from '@react-fabric/core';
7
7
  import { useState, useDeferredValue, useRef, useEffect, useCallback, Fragment } from 'react';
8
8
  import { InputWrapper } from '../internal/InputWrapper.js';
9
9
  import { useHandleEnter } from '../utils/eventHandlers.js';
@@ -81,14 +81,13 @@ var Search = function Search(_ref) {
81
81
  actionButton: /*#__PURE__*/jsxs(Fragment, {
82
82
  children: [searching && /*#__PURE__*/jsx(Icon, {
83
83
  className: "p-2",
84
- icon: CoreIcons.spinner,
85
- animate: "spin"
84
+ icon: "icon-[svg-spinners--eclipse]"
86
85
  }), !searching && !hideHandle && /*#__PURE__*/jsx(Button, {
87
86
  tabIndex: -1,
88
87
  variant: "link",
89
88
  "aria-label": "search",
90
89
  disabled: !actualValue,
91
- icon: CoreIcons.search,
90
+ icon: "icon-[mdi--magnify]",
92
91
  onClick: handleSearch
93
92
  })]
94
93
  })
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
- import { Tooltip, Icon, CoreIcons } from '@react-fabric/core';
4
+ import { Tooltip, Icon } from '@react-fabric/core';
5
5
  import { isString } from '@react-fabric/utilities';
6
6
  import { useTranslation } from 'react-i18next';
7
7
  import { jsx } from 'react/jsx-runtime';
@@ -24,7 +24,7 @@ var ErrorIcon = function ErrorIcon(_ref) {
24
24
  children: /*#__PURE__*/jsx(Icon, {
25
25
  className: "flex-content first:ms-2 self-center",
26
26
  color: "danger",
27
- icon: CoreIcons.alert
27
+ icon: "icon-[mdi--alert-circle-outline]"
28
28
  })
29
29
  });
30
30
  };
@@ -3,7 +3,7 @@
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
5
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
6
- import { Icon, CoreIcons } from '@react-fabric/core';
6
+ import { Icon } from '@react-fabric/core';
7
7
  import { isString } from '@react-fabric/utilities';
8
8
  import classNames from 'classnames';
9
9
  import { useRef, useState, useMemo, useCallback, useEffect } from 'react';
@@ -85,7 +85,7 @@ var InputWrapper = function InputWrapper(_ref) {
85
85
  invalid: invalid,
86
86
  error: error
87
87
  }), children, allowClear && showClear && /*#__PURE__*/jsx(Icon, {
88
- icon: CoreIcons.close,
88
+ icon: "icon-[mdi--close]",
89
89
  onClick: handleClear,
90
90
  className: classNames("text-tint-500 hover:text-tint-700 p-1 z-1 flex-content", "fabric-inputClear", textarea && "self-start mt-1 me-1")
91
91
  }), decorateEnd && /*#__PURE__*/jsx("div", {
@@ -100,14 +100,14 @@ var InputWrapper = function InputWrapper(_ref) {
100
100
  onClick: function onClick() {
101
101
  return setExpanded(!isExpanded);
102
102
  },
103
- icon: isExpanded ? CoreIcons.arrowCollapse : CoreIcons.arrowExpand,
103
+ icon: isExpanded ? "icon-[mdi--arrow-collapse]" : "icon-[mdi--arrow-expand]",
104
104
  className: "hidden group-hover:block absolute top-0 end-0 bg-base hover:bg-tint-200 p-1 opacity-65 rounded-capped"
105
105
  })]
106
106
  });
107
107
  return /*#__PURE__*/jsx(Wrapper, _objectSpread(_objectSpread({}, wrapperProps), {}, {
108
108
  children: /*#__PURE__*/jsx("div", {
109
109
  ref: elRef,
110
- className: classNames("relative min-h-8 flex flex-col flex-nowrap", width ? "flex-auto" : "flex-1"),
110
+ className: classNames("relative min-h-8 flex flex-col flex-nowrap", width ? "flex-content" : "flex-1"),
111
111
  style: {
112
112
  width: width,
113
113
  flexBasis: width
@@ -3,7 +3,7 @@
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
5
5
  import { useFloating, autoUpdate, shift, flip, offset, useDismiss, useListNavigation, useTypeahead, useInteractions, FloatingPortal, FloatingFocusManager } from '@floating-ui/react';
6
- import { Chip, Icon, CoreIcons } from '@react-fabric/core';
6
+ import { Chip, Icon } from '@react-fabric/core';
7
7
  import { isArray, isEmpty } from '@react-fabric/utilities';
8
8
  import classNames from 'classnames';
9
9
  import { useRef, useId, useMemo, useCallback, useLayoutEffect } from 'react';
@@ -243,9 +243,8 @@ var AutoComplete = function AutoComplete(_ref) {
243
243
  className: "opacity-0 absolute"
244
244
  })]
245
245
  }), state.loading && /*#__PURE__*/jsx(Icon, {
246
- animate: "spin",
247
246
  className: classNames("flex-content p-2 z-0 order-9 text-muted pointer-events-none"),
248
- icon: CoreIcons.spinner
247
+ icon: "icon-[svg-spinners--eclipse]"
249
248
  }), state.open && !state.loading && /*#__PURE__*/jsx(FloatingPortal, {
250
249
  children: /*#__PURE__*/jsx(FloatingFocusManager, {
251
250
  context: context,
@@ -6,7 +6,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
6
6
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
7
7
  import { useDraggable, useDroppable, DndContext, DragOverlay } from '@dnd-kit/core';
8
8
  import { restrictToHorizontalAxis } from '@dnd-kit/modifiers';
9
- import { ButtonGroup, Button, CoreIcons } from '@react-fabric/core';
9
+ import { ButtonGroup, Button } from '@react-fabric/core';
10
10
  import { mergeRefs } from '@react-fabric/utilities';
11
11
  import { useState, useDeferredValue, useEffect, useMemo, useCallback } from 'react';
12
12
  import { Field } from '../input/Field.js';
@@ -195,7 +195,7 @@ var DualList = function DualList(_ref) {
195
195
  "aria-label": "scroll to top",
196
196
  onClick: moveAllLeft,
197
197
  icon: {
198
- icon: CoreIcons.chevronsLeft,
198
+ icon: "icon-[mdi--chevron-double-left]",
199
199
  rtlFlip: true
200
200
  },
201
201
  disabled: !rightOptions.length
@@ -205,7 +205,7 @@ var DualList = function DualList(_ref) {
205
205
  "aria-label": "scroll up",
206
206
  onClick: moveRightSelected,
207
207
  icon: {
208
- icon: CoreIcons.chevronLeft,
208
+ icon: "icon-[mdi--chevron-left]",
209
209
  rtlFlip: true
210
210
  },
211
211
  disabled: !rightSelected.length
@@ -215,7 +215,7 @@ var DualList = function DualList(_ref) {
215
215
  "aria-label": "scroll down",
216
216
  onClick: moveLeftSelected,
217
217
  icon: {
218
- icon: CoreIcons.chevronRight,
218
+ icon: "icon-[mdi--chevron-right]",
219
219
  rtlFlip: true
220
220
  },
221
221
  disabled: !leftSelected.length
@@ -225,7 +225,7 @@ var DualList = function DualList(_ref) {
225
225
  "aria-label": "scroll to bottom",
226
226
  onClick: moveAllRight,
227
227
  icon: {
228
- icon: CoreIcons.chevronsRight,
228
+ icon: "icon-[mdi--chevron-double-right]",
229
229
  rtlFlip: true
230
230
  },
231
231
  disabled: !leftOptions.length
@@ -1,9 +1,7 @@
1
1
  'use client';
2
2
 
3
- import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
4
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
5
4
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
6
- import _regeneratorRuntime from '@babel/runtime/regenerator';
7
5
  import { useFloating, autoUpdate, useListNavigation, useTypeahead, useInteractions, FloatingFocusManager } from '@floating-ui/react';
8
6
  import { Chip } from '@react-fabric/core';
9
7
  import { isArray, isEmpty } from '@react-fabric/utilities';
@@ -259,26 +257,10 @@ var List = function List(_ref) {
259
257
  itemProps: makeItemProps,
260
258
  empty: emptyDisplay,
261
259
  info: (_state$activeItem = state.activeItem) === null || _state$activeItem === void 0 ? void 0 : _state$activeItem[infoProperty !== null && infoProperty !== void 0 ? infoProperty : "info"],
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
- }())
260
+ children: function children(item, label) {
261
+ var _renderer3;
262
+ return (_renderer3 = renderer === null || renderer === void 0 ? void 0 : renderer(item)) !== null && _renderer3 !== void 0 ? _renderer3 : label;
263
+ }
282
264
  }))
283
265
  })]
284
266
  }));
@@ -1,11 +1,9 @@
1
1
  'use client';
2
2
 
3
- import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
4
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
5
4
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
6
- import _regeneratorRuntime from '@babel/runtime/regenerator';
7
5
  import { useFloating, autoUpdate, shift, flip, offset, useClick, useDismiss, useListNavigation, useTypeahead, useInteractions, FloatingPortal, FloatingFocusManager } from '@floating-ui/react';
8
- import { Chip, Icon, CoreIcons } from '@react-fabric/core';
6
+ import { Chip, Icon } from '@react-fabric/core';
9
7
  import { isArray, isEmpty } from '@react-fabric/utilities';
10
8
  import classNames from 'classnames';
11
9
  import { useId, useMemo, useCallback, useLayoutEffect } from 'react';
@@ -200,7 +198,7 @@ var Select = function Select(_ref) {
200
198
  } else if (!isEmpty(state.value) && !state.query) {
201
199
  var _ref3, _renderer2;
202
200
  return /*#__PURE__*/jsx("span", {
203
- className: "self-center pointer-events-none select-none",
201
+ className: "self-center pointer-events-none select-none truncate leading-tight",
204
202
  children: (_ref3 = (_renderer2 = renderer === null || renderer === void 0 ? void 0 : renderer(state.value)) !== null && _renderer2 !== void 0 ? _renderer2 : state.value[labelProperty]) !== null && _ref3 !== void 0 ? _ref3 : state.value
205
203
  });
206
204
  }
@@ -248,7 +246,7 @@ var Select = function Select(_ref) {
248
246
  size: 1,
249
247
  ref: ref,
250
248
  autoFocus: autoFocus,
251
- className: classNames("appearance-none bg-transparent outline-none border-none ring-0 flex-1 peer", disabled && "cursor-not-allowed pointer-events-none", multiple && "min-w-24"),
249
+ className: classNames("appearance-none bg-transparent outline-none border-none ring-0 flex-1 peer", disabled && "cursor-not-allowed pointer-events-none", multiple ? "min-w-24" : "min-w-2"),
252
250
  placeholder: isEmpty(state.value) ? placeholder : "",
253
251
  onChange: function onChange(evt) {
254
252
  return handleQuery(evt.target.value);
@@ -259,11 +257,10 @@ var Select = function Select(_ref) {
259
257
  onClick: function onClick() {
260
258
  return !disabled && openDropdown();
261
259
  },
262
- icon: CoreIcons.chevronDown
260
+ icon: "icon-[mdi--chevron-down]"
263
261
  }), state.loading && /*#__PURE__*/jsx(Icon, {
264
- animate: "spin",
265
262
  className: classNames("flex-content p-2 z-0 order-9 text-muted pointer-events-none"),
266
- icon: CoreIcons.spinner
263
+ icon: "icon-[svg-spinners--eclipse]"
267
264
  }), state.open && !state.loading && /*#__PURE__*/jsx(FloatingPortal, {
268
265
  children: /*#__PURE__*/jsx(FloatingFocusManager, {
269
266
  context: context,
@@ -284,26 +281,10 @@ var Select = function Select(_ref) {
284
281
  itemProps: makeItemProps,
285
282
  empty: emptyDisplay,
286
283
  info: (_state$activeItem = state.activeItem) === null || _state$activeItem === void 0 ? void 0 : _state$activeItem[infoProperty !== null && infoProperty !== void 0 ? infoProperty : "info"],
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
- }())
284
+ children: function children(item, label) {
285
+ var _renderer3;
286
+ return (_renderer3 = renderer === null || renderer === void 0 ? void 0 : renderer(item)) !== null && _renderer3 !== void 0 ? _renderer3 : label;
287
+ }
307
288
  }))
308
289
  })
309
290
  })]
@@ -1,6 +1,5 @@
1
- import { type yup } from "@react-fabric/utilities";
2
1
  import { type PropsWithChildren, type Ref } from "react";
3
- import { type FormState } from "react-hook-form";
2
+ import { type FormState, type Resolver } from "react-hook-form";
4
3
  type NestedKeyOf<T extends object> = {
5
4
  [K in keyof T & (string | number)]: T[K] extends object ? `${K}` | `${K}.${NestedKeyOf<T[K]>}` : K;
6
5
  }[keyof T & (string | number)];
@@ -17,9 +16,10 @@ export interface FormRef<K extends KeyValue> {
17
16
  export interface FormProps<K extends KeyValue = KeyValue> {
18
17
  formRef?: Ref<FormRef<K>>;
19
18
  /**
20
- * form data schema
19
+ * react-hook-form resolver for validation
20
+ * @see {@link https://react-hook-form.com/ts#Resolver}
21
21
  */
22
- schema?: yup.ObjectSchema<K>;
22
+ resolver?: Resolver<K>;
23
23
  /**
24
24
  * default data values
25
25
  */
@@ -45,10 +45,7 @@ export interface FormProps<K extends KeyValue = KeyValue> {
45
45
  * ```jsx
46
46
  * <Form
47
47
  * formRef={formRef}
48
- * schema={yup.object().shape({
49
- * name: yup.string().required("Name is required"),
50
- * email: yup.string().email("Invalid email").required("Email is required"),
51
- * })}
48
+ * resolver={hookformResolver(schema)}
52
49
  * defaultValues={{ name: "", email: "" }}
53
50
  * onSubmit={(values) => {
54
51
  * console.log("Form submitted with values:", values);
@@ -64,7 +61,7 @@ export interface FormProps<K extends KeyValue = KeyValue> {
64
61
  * @see {@link https://react-hook-form.com/docs/useform} for more details on the properties.
65
62
  * @see {@link https://github.com/jquense/yup} for more details on the Yup validation schema.
66
63
  */
67
- export declare const Form: <K extends KeyValue>({ formRef, schema, children, defaultValues, onSubmit, onChange, ...rest }: PropsWithChildren<FormProps<K>>) => import("react/jsx-runtime").JSX.Element;
64
+ export declare const Form: <K extends KeyValue>({ formRef, resolver, children, defaultValues, onSubmit, onChange, ...rest }: PropsWithChildren<FormProps<K>>) => import("react/jsx-runtime").JSX.Element;
68
65
  export declare const useForm: <K extends KeyValue = KeyValue>() => {
69
66
  values: import("react-hook-form").DeepPartialSkipArrayKey<K> & K;
70
67
  formState: FormState<K>;
@@ -39,6 +39,12 @@ export declare const useFormBuilder: <T extends AnyObject = string>(schema: Form
39
39
  optionLists?: KeyValue<BaseSelectProps<T>>;
40
40
  }) => {
41
41
  formDef: import("react/jsx-runtime").JSX.Element;
42
+ resolver: import("react-hook-form").Resolver<{
43
+ [x: string]: any;
44
+ }, unknown, {
45
+ [x: string]: any;
46
+ [x: number]: any;
47
+ }>;
42
48
  schemaDef: yup.ObjectSchema<{
43
49
  [x: string]: any;
44
50
  }, yup.AnyObject, {
@@ -1,6 +1,6 @@
1
+ import { type AvatarProps } from "@react-fabric/core/dist/types/components/avatar/Avatar";
1
2
  import { type RefProp } from "@react-fabric/core/dist/types/types";
2
3
  import { type UploadHandler } from "../hooks/useFileUploader";
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,5 +1,4 @@
1
- import { type RefProp } from "@react-fabric/core/dist/types/types";
2
- import { type ReactElement } from "react";
1
+ import { type NestedKeys, type ReactElement, type RefProp } from "@react-fabric/core/dist/types/types";
3
2
  import { type FieldProps } from "../input/Field";
4
3
  export interface DualListProps<T> extends Omit<FieldProps, "children">, RefProp<HTMLInputElement> {
5
4
  /**
@@ -17,15 +16,15 @@ export interface DualListProps<T> extends Omit<FieldProps, "children">, RefProp<
17
16
  /**
18
17
  * group by property name
19
18
  */
20
- groupProperty?: keyof T;
19
+ groupProperty?: NestedKeys<T>;
21
20
  /**
22
21
  * label property name
23
22
  */
24
- labelProperty?: keyof T;
23
+ labelProperty?: NestedKeys<T>;
25
24
  /**
26
25
  * value property name
27
26
  */
28
- valueProperty?: keyof T;
27
+ valueProperty?: NestedKeys<T>;
29
28
  /**
30
29
  * empty list display
31
30
  */
@@ -33,7 +32,7 @@ export interface DualListProps<T> extends Omit<FieldProps, "children">, RefProp<
33
32
  /**
34
33
  * item renderer
35
34
  */
36
- renderer?: (option: T) => React.ReactNode;
35
+ renderer?: (option: T) => ReactElement;
37
36
  /**
38
37
  * change handler
39
38
  */
@@ -1,4 +1,4 @@
1
- import { type ReactElement } from "react";
1
+ import { type ReactElement } from "@react-fabric/core/dist/types/types";
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;