@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.
- package/dist/cjs/builder/FileField.js +2 -2
- package/dist/cjs/builder/components/AddSchemaFields.js +2 -1
- package/dist/cjs/builder/components/SchemaArrayForm.js +3 -3
- package/dist/cjs/builder/components/SchemaField.js +2 -2
- package/dist/cjs/form/Form.js +5 -8
- package/dist/cjs/hooks/useFormBuilder.js +10 -3
- package/dist/cjs/input/ArrayInput.js +3 -3
- package/dist/cjs/input/AvatarInput.js +3 -3
- package/dist/cjs/input/Checkbox.js +2 -2
- package/dist/cjs/input/ColorInput.js +2 -2
- package/dist/cjs/input/File.js +1 -1
- package/dist/cjs/input/Password.js +1 -1
- package/dist/cjs/input/Radio.js +2 -2
- package/dist/cjs/input/Search.js +2 -3
- package/dist/cjs/internal/ErrorIcon.js +1 -1
- package/dist/cjs/internal/InputWrapper.js +3 -3
- package/dist/cjs/select/AutoComplete.js +1 -2
- package/dist/cjs/select/DualList.js +4 -4
- package/dist/cjs/select/List.js +4 -22
- package/dist/cjs/select/Select.js +8 -27
- package/dist/esm/builder/FileField.js +3 -3
- package/dist/esm/builder/components/AddSchemaFields.js +2 -1
- package/dist/esm/builder/components/SchemaArrayForm.js +4 -4
- package/dist/esm/builder/components/SchemaField.js +3 -3
- package/dist/esm/form/Form.js +5 -8
- package/dist/esm/hooks/useFormBuilder.js +10 -3
- package/dist/esm/input/ArrayInput.js +4 -4
- package/dist/esm/input/AvatarInput.js +4 -4
- package/dist/esm/input/Checkbox.js +3 -3
- package/dist/esm/input/ColorInput.js +3 -3
- package/dist/esm/input/File.js +2 -2
- package/dist/esm/input/Password.js +2 -2
- package/dist/esm/input/Radio.js +3 -3
- package/dist/esm/input/Search.js +3 -4
- package/dist/esm/internal/ErrorIcon.js +2 -2
- package/dist/esm/internal/InputWrapper.js +4 -4
- package/dist/esm/select/AutoComplete.js +2 -3
- package/dist/esm/select/DualList.js +5 -5
- package/dist/esm/select/List.js +4 -22
- package/dist/esm/select/Select.js +9 -28
- package/dist/types/form/Form.d.ts +6 -9
- package/dist/types/hooks/useFormBuilder.d.ts +6 -0
- package/dist/types/input/AvatarInput.d.ts +1 -1
- package/dist/types/select/DualList.d.ts +5 -6
- package/dist/types/select/Options.d.ts +1 -1
- package/dist/types/types/index.d.ts +7 -8
- package/package.json +5 -5
- package/src/builder/FileField.tsx +3 -9
- package/src/builder/components/AddSchemaFields.tsx +2 -1
- package/src/builder/components/SchemaArrayForm.tsx +4 -10
- package/src/builder/components/SchemaField.tsx +2 -3
- package/src/form/Form.tsx +10 -11
- package/src/hooks/useFormBuilder.tsx +12 -4
- package/src/input/ArrayInput.tsx +4 -10
- package/src/input/AvatarInput.tsx +5 -5
- package/src/input/Checkbox.tsx +6 -3
- package/src/input/ColorInput.tsx +3 -7
- package/src/input/File.tsx +2 -2
- package/src/input/Password.tsx +4 -2
- package/src/input/Radio.tsx +3 -3
- package/src/input/Search.tsx +3 -3
- package/src/internal/ErrorIcon.tsx +2 -2
- package/src/internal/InputWrapper.tsx +8 -4
- package/src/select/AutoComplete.tsx +2 -3
- package/src/select/DualList.tsx +14 -11
- package/src/select/List.tsx +1 -1
- package/src/select/Options.tsx +1 -1
- package/src/select/Select.tsx +6 -7
- package/src/types/index.ts +8 -7
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type RefProp, type TestProps } from "@react-fabric/core/dist/types/types";
|
|
2
|
-
import { type ReactElement } from "react";
|
|
1
|
+
import { type NestedKeys, type ReactElement, type RefProp, type TestProps } from "@react-fabric/core/dist/types/types";
|
|
3
2
|
export interface InputProps<V = string> extends TestProps {
|
|
4
3
|
/**
|
|
5
4
|
* value
|
|
@@ -113,23 +112,23 @@ export interface BaseSelectProps<T extends AnyObject = string> {
|
|
|
113
112
|
/**
|
|
114
113
|
* group by property name
|
|
115
114
|
*/
|
|
116
|
-
groupProperty?:
|
|
115
|
+
groupProperty?: NestedKeys<T>;
|
|
117
116
|
/**
|
|
118
117
|
* label property name
|
|
119
118
|
*/
|
|
120
|
-
labelProperty?:
|
|
119
|
+
labelProperty?: NestedKeys<T>;
|
|
121
120
|
/**
|
|
122
121
|
* value property name
|
|
123
122
|
*/
|
|
124
|
-
valueProperty?:
|
|
123
|
+
valueProperty?: NestedKeys<T>;
|
|
125
124
|
/**
|
|
126
125
|
* value property name
|
|
127
126
|
*/
|
|
128
|
-
infoProperty?:
|
|
127
|
+
infoProperty?: NestedKeys<T>;
|
|
129
128
|
/**
|
|
130
129
|
* value property name
|
|
131
130
|
*/
|
|
132
|
-
sortProperty?:
|
|
131
|
+
sortProperty?: NestedKeys<T> | true;
|
|
133
132
|
/**
|
|
134
133
|
* searchable list
|
|
135
134
|
*/
|
|
@@ -153,7 +152,7 @@ export interface BaseSelectProps<T extends AnyObject = string> {
|
|
|
153
152
|
/**
|
|
154
153
|
* item renderer
|
|
155
154
|
*/
|
|
156
|
-
renderer?: (option: T) =>
|
|
155
|
+
renderer?: (option: T) => ReactElement;
|
|
157
156
|
/**
|
|
158
157
|
* item matcher
|
|
159
158
|
*/
|
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.61",
|
|
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.61",
|
|
45
|
+
"@react-fabric/date": "^1.0.0-beta.61",
|
|
46
|
+
"@react-fabric/utilities": "^1.0.0-beta.61",
|
|
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": "a0b0c571bf9c189fa3355bbc3b896ecc4b9d6a04"
|
|
66
66
|
}
|
|
@@ -21,13 +21,7 @@
|
|
|
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
|
-
Button,
|
|
26
|
-
CoreIcons,
|
|
27
|
-
Icon,
|
|
28
|
-
ProgressBar,
|
|
29
|
-
Tooltip,
|
|
30
|
-
} from "@react-fabric/core";
|
|
24
|
+
import { Button, Icon, ProgressBar, Tooltip } from "@react-fabric/core";
|
|
31
25
|
import { FileUtil, Format, isString } from "@react-fabric/utilities";
|
|
32
26
|
import { Fragment } from "react";
|
|
33
27
|
import { useTranslation } from "react-i18next";
|
|
@@ -124,7 +118,7 @@ export const FileField = ({
|
|
|
124
118
|
</div>
|
|
125
119
|
{file.progress && (
|
|
126
120
|
<Icon
|
|
127
|
-
icon=
|
|
121
|
+
icon="icon-[mdi--stop]"
|
|
128
122
|
bg="danger"
|
|
129
123
|
color="white"
|
|
130
124
|
size="sm"
|
|
@@ -135,7 +129,7 @@ export const FileField = ({
|
|
|
135
129
|
)}
|
|
136
130
|
{!file.progress && (
|
|
137
131
|
<Icon
|
|
138
|
-
icon=
|
|
132
|
+
icon="icon-[mdi--trash-can-outline]"
|
|
139
133
|
color="danger"
|
|
140
134
|
size="sm"
|
|
141
135
|
aria-label="remove"
|
|
@@ -21,6 +21,7 @@
|
|
|
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 { yupResolver } from "@hookform/resolvers/yup";
|
|
24
25
|
import {
|
|
25
26
|
Button,
|
|
26
27
|
Content,
|
|
@@ -51,7 +52,7 @@ export const AddSchemaFields = (props: ModalProps) => {
|
|
|
51
52
|
return (
|
|
52
53
|
<Modal {...props}>
|
|
53
54
|
<Form
|
|
54
|
-
|
|
55
|
+
resolver={yupResolver(fieldSchema)}
|
|
55
56
|
defaultValues={{ fields: [" "] }}
|
|
56
57
|
onSubmit={handleSubmit}
|
|
57
58
|
>
|
|
@@ -24,13 +24,7 @@
|
|
|
24
24
|
import { DndContext, type DragEndEvent } from "@dnd-kit/core";
|
|
25
25
|
import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
|
|
26
26
|
import { SortableContext } from "@dnd-kit/sortable";
|
|
27
|
-
import {
|
|
28
|
-
Button,
|
|
29
|
-
Content,
|
|
30
|
-
CoreIcons,
|
|
31
|
-
Header,
|
|
32
|
-
useOverlayService,
|
|
33
|
-
} from "@react-fabric/core";
|
|
27
|
+
import { Button, Content, Header, useOverlayService } from "@react-fabric/core";
|
|
34
28
|
import { isArray } from "@react-fabric/utilities";
|
|
35
29
|
import { useCallback, useState } from "react";
|
|
36
30
|
import { useFieldArray, useFormContext } from "react-hook-form";
|
|
@@ -118,7 +112,7 @@ export const SchemaArrayForm = ({
|
|
|
118
112
|
<Button
|
|
119
113
|
size="sm"
|
|
120
114
|
variant="link"
|
|
121
|
-
icon=
|
|
115
|
+
icon="icon-[mdi--plus-circle-outline]"
|
|
122
116
|
aria-label="add field"
|
|
123
117
|
onClick={handleAdd}
|
|
124
118
|
/>
|
|
@@ -126,14 +120,14 @@ export const SchemaArrayForm = ({
|
|
|
126
120
|
<Button
|
|
127
121
|
size="sm"
|
|
128
122
|
variant="link"
|
|
129
|
-
icon=
|
|
123
|
+
icon="icon-[mdi--arrow-collapse-vertical]"
|
|
130
124
|
aria-label="collapse all"
|
|
131
125
|
onClick={() => setDefaultOpen(false)}
|
|
132
126
|
/>
|
|
133
127
|
<Button
|
|
134
128
|
size="sm"
|
|
135
129
|
variant="link"
|
|
136
|
-
icon=
|
|
130
|
+
icon="icon-[mdi--arrow-expand-vertical]"
|
|
137
131
|
aria-label="expand all"
|
|
138
132
|
onClick={() => setDefaultOpen(true)}
|
|
139
133
|
/>
|
|
@@ -27,7 +27,6 @@ import {
|
|
|
27
27
|
Button,
|
|
28
28
|
Collapsable,
|
|
29
29
|
Content,
|
|
30
|
-
CoreIcons,
|
|
31
30
|
Footer,
|
|
32
31
|
Modal,
|
|
33
32
|
type ModalProps,
|
|
@@ -222,7 +221,7 @@ export const SchemaField = ({
|
|
|
222
221
|
variant="link"
|
|
223
222
|
aria-label="Delete"
|
|
224
223
|
stopPropagation
|
|
225
|
-
icon=
|
|
224
|
+
icon="icon-[mdi--trash-can-outline]"
|
|
226
225
|
onClick={onRemove}
|
|
227
226
|
className="invisible group-hover/field:visible"
|
|
228
227
|
/>
|
|
@@ -277,7 +276,7 @@ export const SchemaField = ({
|
|
|
277
276
|
</Controller>
|
|
278
277
|
{customOptions && (
|
|
279
278
|
<Button
|
|
280
|
-
icon=
|
|
279
|
+
icon="icon-[mdi--list-box-outline]"
|
|
281
280
|
aria-label="Custom options"
|
|
282
281
|
onClick={() => {
|
|
283
282
|
void openOptionModal({ title: `${id} Options` });
|
package/src/form/Form.tsx
CHANGED
|
@@ -21,9 +21,8 @@
|
|
|
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 { yupResolver } from "@hookform/resolvers/yup";
|
|
25
24
|
import { useDebounce } from "@react-fabric/core";
|
|
26
|
-
import { EMPTY_OBJECT
|
|
25
|
+
import { EMPTY_OBJECT } from "@react-fabric/utilities";
|
|
27
26
|
import {
|
|
28
27
|
useCallback,
|
|
29
28
|
useEffect,
|
|
@@ -35,12 +34,13 @@ import {
|
|
|
35
34
|
} from "react";
|
|
36
35
|
import {
|
|
37
36
|
FormProvider,
|
|
38
|
-
type Path,
|
|
39
37
|
useFormContext,
|
|
40
38
|
useForm as useFormHook,
|
|
41
39
|
useWatch,
|
|
42
40
|
type DefaultValues,
|
|
43
41
|
type FormState,
|
|
42
|
+
type Path,
|
|
43
|
+
type Resolver,
|
|
44
44
|
} from "react-hook-form";
|
|
45
45
|
|
|
46
46
|
type NestedKeyOf<T extends object> = {
|
|
@@ -63,9 +63,10 @@ export interface FormRef<K extends KeyValue> {
|
|
|
63
63
|
export interface FormProps<K extends KeyValue = KeyValue> {
|
|
64
64
|
formRef?: Ref<FormRef<K>>;
|
|
65
65
|
/**
|
|
66
|
-
* form
|
|
66
|
+
* react-hook-form resolver for validation
|
|
67
|
+
* @see {@link https://react-hook-form.com/ts#Resolver}
|
|
67
68
|
*/
|
|
68
|
-
|
|
69
|
+
resolver?: Resolver<K>;
|
|
69
70
|
/**
|
|
70
71
|
* default data values
|
|
71
72
|
*/
|
|
@@ -94,10 +95,7 @@ const DEFAULT_SUBMIT = () => undefined;
|
|
|
94
95
|
* ```jsx
|
|
95
96
|
* <Form
|
|
96
97
|
* formRef={formRef}
|
|
97
|
-
*
|
|
98
|
-
* name: yup.string().required("Name is required"),
|
|
99
|
-
* email: yup.string().email("Invalid email").required("Email is required"),
|
|
100
|
-
* })}
|
|
98
|
+
* resolver={hookformResolver(schema)}
|
|
101
99
|
* defaultValues={{ name: "", email: "" }}
|
|
102
100
|
* onSubmit={(values) => {
|
|
103
101
|
* console.log("Form submitted with values:", values);
|
|
@@ -115,7 +113,7 @@ const DEFAULT_SUBMIT = () => undefined;
|
|
|
115
113
|
*/
|
|
116
114
|
export const Form = <K extends KeyValue>({
|
|
117
115
|
formRef,
|
|
118
|
-
|
|
116
|
+
resolver,
|
|
119
117
|
children,
|
|
120
118
|
defaultValues = EMPTY_OBJECT as K,
|
|
121
119
|
onSubmit = DEFAULT_SUBMIT,
|
|
@@ -125,7 +123,7 @@ export const Form = <K extends KeyValue>({
|
|
|
125
123
|
const ref = useRef<HTMLFormElement>(null);
|
|
126
124
|
const form = useFormHook<K>({
|
|
127
125
|
shouldFocusError: true,
|
|
128
|
-
resolver
|
|
126
|
+
resolver,
|
|
129
127
|
defaultValues: defaultValues as DefaultValues<K>,
|
|
130
128
|
});
|
|
131
129
|
|
|
@@ -174,6 +172,7 @@ export const Form = <K extends KeyValue>({
|
|
|
174
172
|
|
|
175
173
|
const onInvalid = useCallback((_: AnyObject, e: AnyObject) => {
|
|
176
174
|
const el = e.target;
|
|
175
|
+
console.log("Invalid:", _, e);
|
|
177
176
|
setTimeout(
|
|
178
177
|
() =>
|
|
179
178
|
el
|
|
@@ -21,6 +21,7 @@
|
|
|
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 { yupResolver } from "@hookform/resolvers/yup";
|
|
24
25
|
import { EmptyContent } from "@react-fabric/core";
|
|
25
26
|
import { isEmpty, isNil, yup } from "@react-fabric/utilities";
|
|
26
27
|
import { Fragment, useMemo } from "react";
|
|
@@ -135,12 +136,18 @@ export const useFormBuilder = <T extends AnyObject = string>(
|
|
|
135
136
|
() => schema.filter?.((schm) => !!schm.id) ?? [],
|
|
136
137
|
[schema],
|
|
137
138
|
);
|
|
138
|
-
const schemaDef =
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
const schemaDef = useMemo(
|
|
140
|
+
() =>
|
|
141
|
+
yup.object(
|
|
142
|
+
Object.fromEntries(
|
|
143
|
+
filteredSchema.map((field) => [field.id, makeYupField(field)]),
|
|
144
|
+
),
|
|
145
|
+
),
|
|
146
|
+
[filteredSchema],
|
|
142
147
|
);
|
|
143
148
|
|
|
149
|
+
const resolver = useMemo(() => yupResolver(schemaDef), [schemaDef]);
|
|
150
|
+
|
|
144
151
|
const formDef = (
|
|
145
152
|
<Fragment>
|
|
146
153
|
{filteredSchema.map((field, idx) => (
|
|
@@ -166,6 +173,7 @@ export const useFormBuilder = <T extends AnyObject = string>(
|
|
|
166
173
|
|
|
167
174
|
return {
|
|
168
175
|
formDef,
|
|
176
|
+
resolver,
|
|
169
177
|
schemaDef,
|
|
170
178
|
};
|
|
171
179
|
};
|
package/src/input/ArrayInput.tsx
CHANGED
|
@@ -23,13 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
import { DndContext, type DragEndEvent } from "@dnd-kit/core";
|
|
25
25
|
import { SortableContext, useSortable } from "@dnd-kit/sortable";
|
|
26
|
-
import {
|
|
27
|
-
Button,
|
|
28
|
-
cloneChildren,
|
|
29
|
-
CoreIcons,
|
|
30
|
-
Icon,
|
|
31
|
-
Tooltip,
|
|
32
|
-
} from "@react-fabric/core";
|
|
26
|
+
import { Button, cloneChildren, Icon, Tooltip } from "@react-fabric/core";
|
|
33
27
|
import { isFalse, isString } from "@react-fabric/utilities";
|
|
34
28
|
import classNames from "classnames";
|
|
35
29
|
import {
|
|
@@ -328,7 +322,7 @@ export const ArrayInput = <T extends AnyObject = string>({
|
|
|
328
322
|
>
|
|
329
323
|
<Icon
|
|
330
324
|
className={isDragging ? "cursor-grabbing" : "cursor-grab"}
|
|
331
|
-
icon=
|
|
325
|
+
icon="icon-[mdi--drag-vertical]"
|
|
332
326
|
{...attributes}
|
|
333
327
|
{...listeners}
|
|
334
328
|
/>
|
|
@@ -369,7 +363,7 @@ export const ArrayInput = <T extends AnyObject = string>({
|
|
|
369
363
|
<Button
|
|
370
364
|
size="sm"
|
|
371
365
|
aria-label="Add item"
|
|
372
|
-
icon=
|
|
366
|
+
icon="icon-[mdi--plus-circle-outline]"
|
|
373
367
|
onClick={() => handleAdd(onAdd?.())}
|
|
374
368
|
data-invalid={!!error}
|
|
375
369
|
disabled={!!disabled || readOnly || fields.length > maxItems}
|
|
@@ -443,7 +437,7 @@ export const ArrayInput = <T extends AnyObject = string>({
|
|
|
443
437
|
{canRemove !== false && (
|
|
444
438
|
<Button
|
|
445
439
|
aria-label="Remove item"
|
|
446
|
-
icon=
|
|
440
|
+
icon="icon-[mdi--minus-circle-outline]"
|
|
447
441
|
color="danger"
|
|
448
442
|
variant="link"
|
|
449
443
|
className="self-end"
|
|
@@ -21,13 +21,13 @@
|
|
|
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 { Avatar,
|
|
24
|
+
import { Avatar, Icon, ProgressBar } from "@react-fabric/core";
|
|
25
|
+
import { type AvatarProps } from "@react-fabric/core/dist/types/components/avatar/Avatar";
|
|
25
26
|
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
27
|
+
import classNames from "classnames";
|
|
26
28
|
import { useEffect, useState } from "react";
|
|
27
29
|
import { useFileUploader, type UploadHandler } from "../hooks/useFileUploader";
|
|
28
30
|
import { HiddenInput } from "./Hidden";
|
|
29
|
-
import { type AvatarProps } from "@react-fabric/core/dist/types/components/avatar/Avatar";
|
|
30
|
-
import classNames from "classnames";
|
|
31
31
|
|
|
32
32
|
export interface Props extends RefProp {
|
|
33
33
|
/**
|
|
@@ -168,7 +168,7 @@ export const AvatarInput = ({
|
|
|
168
168
|
)}
|
|
169
169
|
{file.progress && (
|
|
170
170
|
<Icon
|
|
171
|
-
icon=
|
|
171
|
+
icon="icon-[mdi--stop]"
|
|
172
172
|
bg="danger"
|
|
173
173
|
color="white"
|
|
174
174
|
size="sm"
|
|
@@ -179,7 +179,7 @@ export const AvatarInput = ({
|
|
|
179
179
|
)}
|
|
180
180
|
{!file.progress && (
|
|
181
181
|
<Icon
|
|
182
|
-
icon=
|
|
182
|
+
icon="icon-[mdi--trash-can-outline]"
|
|
183
183
|
color="danger"
|
|
184
184
|
size="sm"
|
|
185
185
|
className="flex-content"
|
package/src/input/Checkbox.tsx
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
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 {
|
|
24
|
+
import { Icon } from "@react-fabric/core";
|
|
25
25
|
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
26
26
|
import classNames from "classnames";
|
|
27
27
|
import {
|
|
@@ -111,10 +111,13 @@ export const Checkbox = ({
|
|
|
111
111
|
const deferred = useDeferredValue(!!checked);
|
|
112
112
|
|
|
113
113
|
const iconOn = useMemo(
|
|
114
|
-
() => iconChecked ?? icon ??
|
|
114
|
+
() => iconChecked ?? icon ?? "icon-[mdi--checkbox-marked]",
|
|
115
115
|
[icon, iconChecked],
|
|
116
116
|
);
|
|
117
|
-
const iconOff = useMemo(
|
|
117
|
+
const iconOff = useMemo(
|
|
118
|
+
() => icon ?? "icon-[mdi--checkbox-blank-outline]",
|
|
119
|
+
[icon],
|
|
120
|
+
);
|
|
118
121
|
|
|
119
122
|
useEffect(() => {
|
|
120
123
|
setActualValue(deferred);
|
package/src/input/ColorInput.tsx
CHANGED
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
useFloating,
|
|
34
34
|
useInteractions,
|
|
35
35
|
} from "@floating-ui/react";
|
|
36
|
-
import {
|
|
36
|
+
import { Icon } from "@react-fabric/core";
|
|
37
37
|
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
38
38
|
import {
|
|
39
39
|
startTransition,
|
|
@@ -168,11 +168,7 @@ export const ColorInput = ({
|
|
|
168
168
|
}}
|
|
169
169
|
>
|
|
170
170
|
{!actualValue && (
|
|
171
|
-
<Icon
|
|
172
|
-
size="md"
|
|
173
|
-
className="text-muted"
|
|
174
|
-
icon={CoreIcons.colorSwatch}
|
|
175
|
-
/>
|
|
171
|
+
<Icon size="md" className="text-muted" icon="icon-[mdi--palette]" />
|
|
176
172
|
)}
|
|
177
173
|
</div>
|
|
178
174
|
</button>
|
|
@@ -203,7 +199,7 @@ export const ColorInput = ({
|
|
|
203
199
|
{!disabled && showPicker && (
|
|
204
200
|
<Icon
|
|
205
201
|
className="flex-content p-1"
|
|
206
|
-
icon=
|
|
202
|
+
icon="icon-[mdi--eyedropper]"
|
|
207
203
|
onClick={() =>
|
|
208
204
|
(window as AnyObject).EyeDropper &&
|
|
209
205
|
new (window as AnyObject).EyeDropper()
|
package/src/input/File.tsx
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
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 {
|
|
24
|
+
import { Icon } from "@react-fabric/core";
|
|
25
25
|
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
26
26
|
import {
|
|
27
27
|
FileUtil,
|
|
@@ -181,7 +181,7 @@ export const FileInput = ({
|
|
|
181
181
|
</span>
|
|
182
182
|
<Icon
|
|
183
183
|
className="cursor-pointer opacity-30 hover:opacity-80"
|
|
184
|
-
icon=
|
|
184
|
+
icon="icon-[mdi--close]"
|
|
185
185
|
onClick={() => {
|
|
186
186
|
removeFile(idx);
|
|
187
187
|
}}
|
package/src/input/Password.tsx
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
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 { Button,
|
|
24
|
+
import { Button, Tooltip } from "@react-fabric/core";
|
|
25
25
|
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
26
26
|
import classNames from "classnames";
|
|
27
27
|
import {
|
|
@@ -114,7 +114,9 @@ export const Password = ({
|
|
|
114
114
|
color="warning"
|
|
115
115
|
variant="link"
|
|
116
116
|
aria-label={t(show ? "password.hide" : "password.show")}
|
|
117
|
-
icon={
|
|
117
|
+
icon={
|
|
118
|
+
show ? "icon-[mdi--eye-off-outline]" : "icon-[mdi--eye-outline]"
|
|
119
|
+
}
|
|
118
120
|
onClick={() => setShow(!show)}
|
|
119
121
|
/>
|
|
120
122
|
</Tooltip>
|
package/src/input/Radio.tsx
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
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 {
|
|
24
|
+
import { Icon } from "@react-fabric/core";
|
|
25
25
|
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
26
26
|
import classNames from "classnames";
|
|
27
27
|
import { useCallback, useMemo, type ChangeEvent } from "react";
|
|
@@ -93,10 +93,10 @@ export const Radio = ({
|
|
|
93
93
|
...rest
|
|
94
94
|
}: RadioProps) => {
|
|
95
95
|
const iconOn = useMemo(
|
|
96
|
-
() => iconChecked ?? icon ??
|
|
96
|
+
() => iconChecked ?? icon ?? "icon-[mdi--radiobox-marked]",
|
|
97
97
|
[icon, iconChecked],
|
|
98
98
|
);
|
|
99
|
-
const iconOff = useMemo(() => icon ??
|
|
99
|
+
const iconOff = useMemo(() => icon ?? "icon-[mdi--radiobox-blank]", [icon]);
|
|
100
100
|
|
|
101
101
|
const handleChange = useCallback(
|
|
102
102
|
(e?: ChangeEvent<HTMLInputElement>) => {
|
package/src/input/Search.tsx
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
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 { Button,
|
|
24
|
+
import { Button, Icon, useDebounce } from "@react-fabric/core";
|
|
25
25
|
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
26
26
|
import {
|
|
27
27
|
Fragment,
|
|
@@ -129,7 +129,7 @@ export const Search = ({
|
|
|
129
129
|
actionButton={
|
|
130
130
|
<Fragment>
|
|
131
131
|
{searching && (
|
|
132
|
-
<Icon className="p-2" icon=
|
|
132
|
+
<Icon className="p-2" icon="icon-[svg-spinners--eclipse]" />
|
|
133
133
|
)}
|
|
134
134
|
{!searching && !hideHandle && (
|
|
135
135
|
<Button
|
|
@@ -137,7 +137,7 @@ export const Search = ({
|
|
|
137
137
|
variant="link"
|
|
138
138
|
aria-label="search"
|
|
139
139
|
disabled={!actualValue}
|
|
140
|
-
icon=
|
|
140
|
+
icon="icon-[mdi--magnify]"
|
|
141
141
|
onClick={handleSearch}
|
|
142
142
|
/>
|
|
143
143
|
)}
|
|
@@ -21,7 +21,7 @@
|
|
|
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 {
|
|
24
|
+
import { Icon, Tooltip } from "@react-fabric/core";
|
|
25
25
|
import { isString } from "@react-fabric/utilities";
|
|
26
26
|
import { useTranslation } from "react-i18next";
|
|
27
27
|
|
|
@@ -53,7 +53,7 @@ export const ErrorIcon = ({ error = "", invalid }: KeyValue) => {
|
|
|
53
53
|
<Icon
|
|
54
54
|
className="flex-content first:ms-2 self-center"
|
|
55
55
|
color="danger"
|
|
56
|
-
icon=
|
|
56
|
+
icon="icon-[mdi--alert-circle-outline]"
|
|
57
57
|
/>
|
|
58
58
|
</Tooltip>
|
|
59
59
|
)
|
|
@@ -21,7 +21,7 @@
|
|
|
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 {
|
|
24
|
+
import { Icon } from "@react-fabric/core";
|
|
25
25
|
import { isString } from "@react-fabric/utilities";
|
|
26
26
|
import classNames from "classnames";
|
|
27
27
|
import {
|
|
@@ -147,7 +147,7 @@ export const InputWrapper = ({
|
|
|
147
147
|
{children}
|
|
148
148
|
{allowClear && showClear && (
|
|
149
149
|
<Icon
|
|
150
|
-
icon=
|
|
150
|
+
icon="icon-[mdi--close]"
|
|
151
151
|
onClick={handleClear}
|
|
152
152
|
className={classNames(
|
|
153
153
|
"text-tint-500 hover:text-tint-700 p-1 z-1 flex-content",
|
|
@@ -185,7 +185,11 @@ export const InputWrapper = ({
|
|
|
185
185
|
{textareaExpandable && (
|
|
186
186
|
<Icon
|
|
187
187
|
onClick={() => setExpanded(!isExpanded)}
|
|
188
|
-
icon={
|
|
188
|
+
icon={
|
|
189
|
+
isExpanded
|
|
190
|
+
? "icon-[mdi--arrow-collapse]"
|
|
191
|
+
: "icon-[mdi--arrow-expand]"
|
|
192
|
+
}
|
|
189
193
|
className="hidden group-hover:block absolute top-0 end-0 bg-base hover:bg-tint-200 p-1 opacity-65 rounded-capped"
|
|
190
194
|
/>
|
|
191
195
|
)}
|
|
@@ -198,7 +202,7 @@ export const InputWrapper = ({
|
|
|
198
202
|
ref={elRef}
|
|
199
203
|
className={classNames(
|
|
200
204
|
"relative min-h-8 flex flex-col flex-nowrap",
|
|
201
|
-
width ? "flex-
|
|
205
|
+
width ? "flex-content" : "flex-1",
|
|
202
206
|
)}
|
|
203
207
|
style={{ width, flexBasis: width }}
|
|
204
208
|
>
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
useListNavigation,
|
|
35
35
|
useTypeahead,
|
|
36
36
|
} from "@floating-ui/react";
|
|
37
|
-
import { Chip,
|
|
37
|
+
import { Chip, Icon } from "@react-fabric/core";
|
|
38
38
|
import { isArray, isEmpty } from "@react-fabric/utilities";
|
|
39
39
|
import classNames from "classnames";
|
|
40
40
|
import { useCallback, useId, useLayoutEffect, useMemo, useRef } from "react";
|
|
@@ -323,11 +323,10 @@ export const AutoComplete = ({
|
|
|
323
323
|
</div>
|
|
324
324
|
{state.loading && (
|
|
325
325
|
<Icon
|
|
326
|
-
animate="spin"
|
|
327
326
|
className={classNames(
|
|
328
327
|
"flex-content p-2 z-0 order-9 text-muted pointer-events-none",
|
|
329
328
|
)}
|
|
330
|
-
icon=
|
|
329
|
+
icon="icon-[svg-spinners--eclipse]"
|
|
331
330
|
/>
|
|
332
331
|
)}
|
|
333
332
|
{state.open && !state.loading && (
|