@manafishrov/ui 1.2.12 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/form/AutoSubmit.d.ts +5 -0
- package/dist/components/form/AutoSubmit.js +21 -0
- package/dist/components/form/AutoSubmit.js.map +1 -0
- package/dist/components/form/ComboboxField.d.ts +5 -3
- package/dist/components/form/ComboboxField.js +62 -63
- package/dist/components/form/ComboboxField.js.map +1 -1
- package/dist/components/form/DatePickerField.d.ts +3 -2
- package/dist/components/form/DatePickerField.js +43 -32
- package/dist/components/form/DatePickerField.js.map +1 -1
- package/dist/components/form/Form.d.ts +99 -84
- package/dist/components/form/Form.js +62 -40
- package/dist/components/form/Form.js.map +1 -1
- package/dist/components/form/NumberInputField.d.ts +3 -3
- package/dist/components/form/NumberInputField.js +18 -19
- package/dist/components/form/NumberInputField.js.map +1 -1
- package/dist/components/form/PasswordInputField.d.ts +1 -0
- package/dist/components/form/PasswordInputField.js +23 -16
- package/dist/components/form/PasswordInputField.js.map +1 -1
- package/dist/components/form/TagsInputField.d.ts +4 -4
- package/dist/components/form/TagsInputField.js +52 -49
- package/dist/components/form/TagsInputField.js.map +1 -1
- package/dist/components/form/index.d.ts +1 -0
- package/dist/components/form/index.js +30 -27
- package/dist/components/form/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/form/AutoSubmit.tsx +38 -0
- package/src/components/form/ComboboxField.tsx +30 -25
- package/src/components/form/DatePickerField.tsx +30 -17
- package/src/components/form/Form.tsx +29 -1
- package/src/components/form/NumberInputField.tsx +5 -6
- package/src/components/form/PasswordInputField.tsx +7 -3
- package/src/components/form/TagsInputField.tsx +43 -32
- package/src/components/form/index.ts +1 -0
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
import { type Component, splitProps, For } from 'solid-js';
|
|
1
|
+
import { type Component, type ComponentProps, splitProps, For } from 'solid-js';
|
|
4
2
|
|
|
5
3
|
import { Field, FieldContent, FieldDescription, FieldError, FieldLabel } from '@/components/Field';
|
|
6
4
|
import {
|
|
@@ -19,36 +17,45 @@ import {
|
|
|
19
17
|
|
|
20
18
|
import { useFieldContext } from './context';
|
|
21
19
|
|
|
22
|
-
export type TagsInputFieldProps =
|
|
20
|
+
export type TagsInputFieldProps = ComponentProps<typeof TagsInputInput> & {
|
|
23
21
|
label?: string;
|
|
24
22
|
description?: string;
|
|
25
|
-
|
|
23
|
+
showClearTrigger?: boolean;
|
|
26
24
|
};
|
|
27
25
|
|
|
28
|
-
const TagsInputGroup: Component<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
26
|
+
const TagsInputGroup: Component<
|
|
27
|
+
ComponentProps<typeof TagsInputInput> & { showClearTrigger?: boolean }
|
|
28
|
+
> = (props) => {
|
|
29
|
+
const [local, others] = splitProps(props, ['children', 'showClearTrigger']);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<TagsInputContext>
|
|
34
|
+
{(context) => (
|
|
35
|
+
<TagsInputControl>
|
|
36
|
+
<For each={context().value}>
|
|
37
|
+
{(value, index) => (
|
|
38
|
+
<TagsInputItem index={index()} value={value}>
|
|
39
|
+
<TagsInputItemPreview>
|
|
40
|
+
<TagsInputItemText>{value}</TagsInputItemText>
|
|
41
|
+
<TagsInputItemDeleteTrigger />
|
|
42
|
+
</TagsInputItemPreview>
|
|
43
|
+
<TagsInputItemInput />
|
|
44
|
+
</TagsInputItem>
|
|
45
|
+
)}
|
|
46
|
+
</For>
|
|
47
|
+
<TagsInputInput {...others} />
|
|
48
|
+
<Show when={local.showClearTrigger !== false}>
|
|
49
|
+
<TagsInputClearTrigger />
|
|
50
|
+
</Show>
|
|
51
|
+
{local.children}
|
|
52
|
+
</TagsInputControl>
|
|
53
|
+
)}
|
|
54
|
+
</TagsInputContext>
|
|
55
|
+
<TagsInputHiddenInput />
|
|
56
|
+
</>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
52
59
|
|
|
53
60
|
const TAGS_INPUT_FIELD_PROPS = [
|
|
54
61
|
'label',
|
|
@@ -56,7 +63,7 @@ const TAGS_INPUT_FIELD_PROPS = [
|
|
|
56
63
|
'required',
|
|
57
64
|
'disabled',
|
|
58
65
|
'readOnly',
|
|
59
|
-
'
|
|
66
|
+
'showClearTrigger',
|
|
60
67
|
] as const;
|
|
61
68
|
|
|
62
69
|
export const TagsInputField: Component<TagsInputFieldProps> = (props) => {
|
|
@@ -83,9 +90,13 @@ export const TagsInputField: Component<TagsInputFieldProps> = (props) => {
|
|
|
83
90
|
invalid={field().state.meta.errors.length > 0}
|
|
84
91
|
disabled={local.disabled ?? false}
|
|
85
92
|
readOnly={local.readOnly ?? false}
|
|
86
|
-
{...others}
|
|
87
93
|
>
|
|
88
|
-
<TagsInputGroup
|
|
94
|
+
<TagsInputGroup
|
|
95
|
+
{...others}
|
|
96
|
+
{...(typeof local.showClearTrigger === 'boolean' && {
|
|
97
|
+
showClearTrigger: local.showClearTrigger,
|
|
98
|
+
})}
|
|
99
|
+
/>
|
|
89
100
|
</TagsInput>
|
|
90
101
|
<FieldError errors={field().state.meta.errors} />
|
|
91
102
|
<FieldDescription>{local.description}</FieldDescription>
|