@manafishrov/ui 1.3.4 → 1.3.6
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.js +12 -12
- package/dist/components/form/AutoSubmit.js.map +1 -1
- package/dist/components/form/ComboboxField.d.ts +2 -1
- package/dist/components/form/ComboboxField.js +55 -47
- package/dist/components/form/ComboboxField.js.map +1 -1
- package/dist/components/form/DatePickerField.d.ts +2 -1
- package/dist/components/form/DatePickerField.js +36 -28
- package/dist/components/form/DatePickerField.js.map +1 -1
- package/dist/components/form/Form.js +37 -37
- package/dist/components/form/Form.js.map +1 -1
- package/dist/components/form/NumberInputField.d.ts +2 -1
- package/dist/components/form/NumberInputField.js +63 -55
- package/dist/components/form/NumberInputField.js.map +1 -1
- package/dist/components/form/PasswordInputField.d.ts +2 -1
- package/dist/components/form/PasswordInputField.js +72 -60
- package/dist/components/form/PasswordInputField.js.map +1 -1
- package/dist/components/form/PinInputField.d.ts +2 -1
- package/dist/components/form/PinInputField.js +48 -40
- package/dist/components/form/PinInputField.js.map +1 -1
- package/dist/components/form/RadioGroupField.d.ts +2 -1
- package/dist/components/form/RadioGroupField.js +47 -39
- package/dist/components/form/RadioGroupField.js.map +1 -1
- package/dist/components/form/SelectField.d.ts +2 -1
- package/dist/components/form/SelectField.js +43 -35
- package/dist/components/form/SelectField.js.map +1 -1
- package/dist/components/form/SliderField.d.ts +2 -1
- package/dist/components/form/SliderField.js +42 -34
- package/dist/components/form/SliderField.js.map +1 -1
- package/dist/components/form/TagsInputField.d.ts +2 -1
- package/dist/components/form/TagsInputField.js +45 -37
- package/dist/components/form/TagsInputField.js.map +1 -1
- package/dist/components/form/TextInputField.d.ts +2 -1
- package/dist/components/form/TextInputField.js +38 -30
- package/dist/components/form/TextInputField.js.map +1 -1
- package/dist/components/form/TextareaField.d.ts +2 -1
- package/dist/components/form/TextareaField.js +36 -28
- package/dist/components/form/TextareaField.js.map +1 -1
- package/dist/components/form/WithTrailingAddon.d.ts +6 -0
- package/dist/components/form/WithTrailingAddon.js +18 -0
- package/dist/components/form/WithTrailingAddon.js.map +1 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +42 -40
- package/dist/components/form/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/form/AutoSubmit.tsx +8 -13
- package/src/components/form/ComboboxField.tsx +27 -22
- package/src/components/form/DatePickerField.tsx +25 -20
- package/src/components/form/Form.tsx +2 -1
- package/src/components/form/NumberInputField.tsx +25 -20
- package/src/components/form/PasswordInputField.tsx +53 -33
- package/src/components/form/PinInputField.tsx +24 -19
- package/src/components/form/RadioGroupField.tsx +23 -18
- package/src/components/form/SelectField.tsx +21 -16
- package/src/components/form/SliderField.tsx +24 -19
- package/src/components/form/TagsInputField.tsx +26 -21
- package/src/components/form/TextInputField.tsx +18 -13
- package/src/components/form/TextareaField.tsx +18 -13
- package/src/components/form/WithTrailingAddon.tsx +15 -0
- package/src/components/form/index.ts +2 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DatePickerInputProps, DateValue } from '@ark-ui/solid';
|
|
2
|
-
import type { Component, ComponentProps } from 'solid-js';
|
|
2
|
+
import type { Component, ComponentProps, JSXElement } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
DatePicker,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import { Field, FieldContent, FieldDescription, FieldError, FieldLabel } from '@/components/Field';
|
|
14
14
|
|
|
15
15
|
import { useFieldContext } from './context';
|
|
16
|
+
import { WithTrailingAddon } from './WithTrailingAddon';
|
|
16
17
|
|
|
17
18
|
const DATE_PICKER_ROOT_PROPS = [
|
|
18
19
|
'min',
|
|
@@ -63,6 +64,7 @@ export type DatePickerFieldProps = DatePickerInputProps &
|
|
|
63
64
|
label?: string;
|
|
64
65
|
description?: string;
|
|
65
66
|
showTrigger?: boolean;
|
|
67
|
+
trailingAddon?: JSXElement;
|
|
66
68
|
};
|
|
67
69
|
|
|
68
70
|
const DatePickerInputGroup: Component<DatePickerInputProps & { showTrigger?: boolean }> = (
|
|
@@ -95,6 +97,7 @@ const DATE_PICKER_FIELD_PROPS = [
|
|
|
95
97
|
'readOnly',
|
|
96
98
|
'placeholder',
|
|
97
99
|
'showTrigger',
|
|
100
|
+
'trailingAddon',
|
|
98
101
|
] as const;
|
|
99
102
|
|
|
100
103
|
export const DatePickerField: Component<DatePickerFieldProps> = (props) => {
|
|
@@ -111,25 +114,27 @@ export const DatePickerField: Component<DatePickerFieldProps> = (props) => {
|
|
|
111
114
|
>
|
|
112
115
|
<FieldLabel>{local.label}</FieldLabel>
|
|
113
116
|
<FieldContent>
|
|
114
|
-
<
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
117
|
+
<WithTrailingAddon addon={local.trailingAddon}>
|
|
118
|
+
<DatePicker
|
|
119
|
+
value={field().state.value}
|
|
120
|
+
onValueChange={(details) => {
|
|
121
|
+
field().handleChange(details.value);
|
|
122
|
+
}}
|
|
123
|
+
onBlur={() => {
|
|
124
|
+
field().handleBlur();
|
|
125
|
+
}}
|
|
126
|
+
invalid={field().state.meta.errors.length > 0}
|
|
127
|
+
disabled={local.disabled ?? false}
|
|
128
|
+
readOnly={local.readOnly ?? false}
|
|
129
|
+
{...rootProps}
|
|
130
|
+
>
|
|
131
|
+
<DatePickerInputGroup
|
|
132
|
+
{...inputProps}
|
|
133
|
+
placeholder={local.placeholder}
|
|
134
|
+
{...(typeof local.showTrigger === 'boolean' && { showTrigger: local.showTrigger })}
|
|
135
|
+
/>
|
|
136
|
+
</DatePicker>
|
|
137
|
+
</WithTrailingAddon>
|
|
133
138
|
<FieldError errors={field().state.meta.errors} />
|
|
134
139
|
<FieldDescription>{local.description}</FieldDescription>
|
|
135
140
|
</FieldContent>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { Component, ComponentProps } from 'solid-js';
|
|
2
|
+
|
|
1
3
|
import { createFormHook } from '@tanstack/solid-form';
|
|
2
|
-
import { splitProps, type Component, type ComponentProps } from 'solid-js';
|
|
3
4
|
import { cn } from 'tailwind-variants';
|
|
4
5
|
|
|
5
6
|
import { AutoSubmit } from './AutoSubmit';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Component, ComponentProps, JSX } from 'solid-js';
|
|
1
|
+
import type { Component, ComponentProps, JSX, JSXElement } from 'solid-js';
|
|
2
2
|
|
|
3
3
|
import { Field, FieldLabel, FieldContent, FieldError, FieldDescription } from '@/components/Field';
|
|
4
4
|
import {
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from '@/components/NumberInput';
|
|
10
10
|
|
|
11
11
|
import { useFieldContext } from './context';
|
|
12
|
+
import { WithTrailingAddon } from './WithTrailingAddon';
|
|
12
13
|
|
|
13
14
|
const NUMBER_INPUT_ROOT_PROPS = [
|
|
14
15
|
'min',
|
|
@@ -34,6 +35,7 @@ export type NumberInputFieldProps = ComponentProps<typeof NumberInputInput> &
|
|
|
34
35
|
label?: string;
|
|
35
36
|
description?: string;
|
|
36
37
|
showTriggers?: boolean;
|
|
38
|
+
trailingAddon?: JSXElement;
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
const toNumberInputValue = (value: number | undefined): string => {
|
|
@@ -46,7 +48,7 @@ const toNumberInputValue = (value: number | undefined): string => {
|
|
|
46
48
|
|
|
47
49
|
type NumberInputFieldLocalProps = Pick<
|
|
48
50
|
NumberInputFieldProps,
|
|
49
|
-
'label' | 'description' | 'required' | 'disabled' | 'readOnly' | 'showTriggers'
|
|
51
|
+
'label' | 'description' | 'required' | 'disabled' | 'readOnly' | 'showTriggers' | 'trailingAddon'
|
|
50
52
|
>;
|
|
51
53
|
|
|
52
54
|
type NumberInputFieldRootProps = Pick<
|
|
@@ -122,24 +124,26 @@ const renderNumberInputField = (props: RenderNumberInputFieldProps): JSX.Element
|
|
|
122
124
|
>
|
|
123
125
|
<FieldLabel>{props.local.label}</FieldLabel>
|
|
124
126
|
<FieldContent>
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
<
|
|
138
|
-
|
|
139
|
-
<
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
127
|
+
<WithTrailingAddon addon={props.local.trailingAddon}>
|
|
128
|
+
<NumberInput
|
|
129
|
+
value={props.inputValue()}
|
|
130
|
+
onValueChange={props.onValueChange}
|
|
131
|
+
onValueCommit={props.onValueCommit}
|
|
132
|
+
onBlur={props.onBlur}
|
|
133
|
+
invalid={props.field().state.meta.errors.length > 0}
|
|
134
|
+
disabled={props.local.disabled ?? false}
|
|
135
|
+
readOnly={props.local.readOnly ?? false}
|
|
136
|
+
required={props.local.required ?? false}
|
|
137
|
+
{...props.rootProps}
|
|
138
|
+
>
|
|
139
|
+
<NumberInputControl>
|
|
140
|
+
<NumberInputInput {...props.inputProps} />
|
|
141
|
+
<Show when={props.local.showTriggers !== false}>
|
|
142
|
+
<NumberInputTriggers />
|
|
143
|
+
</Show>
|
|
144
|
+
</NumberInputControl>
|
|
145
|
+
</NumberInput>
|
|
146
|
+
</WithTrailingAddon>
|
|
143
147
|
<FieldError errors={props.field().state.meta.errors} />
|
|
144
148
|
<FieldDescription>{props.local.description}</FieldDescription>
|
|
145
149
|
</FieldContent>
|
|
@@ -155,6 +159,7 @@ export const NumberInputField: Component<NumberInputFieldProps> = (props) => {
|
|
|
155
159
|
'disabled',
|
|
156
160
|
'readOnly',
|
|
157
161
|
'showTriggers',
|
|
162
|
+
'trailingAddon',
|
|
158
163
|
]);
|
|
159
164
|
const [rootProps, inputProps] = splitProps(others, NUMBER_INPUT_ROOT_PROPS);
|
|
160
165
|
const state = createNumberInputFieldState(field);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Component, ComponentProps, JSXElement } from 'solid-js';
|
|
2
2
|
|
|
3
3
|
import { Field, FieldLabel, FieldContent, FieldError, FieldDescription } from '@/components/Field';
|
|
4
4
|
import {
|
|
@@ -10,23 +10,66 @@ import {
|
|
|
10
10
|
} from '@/components/PasswordInput';
|
|
11
11
|
|
|
12
12
|
import { useFieldContext } from './context';
|
|
13
|
+
import { WithTrailingAddon } from './WithTrailingAddon';
|
|
13
14
|
|
|
14
15
|
export type PasswordInputFieldProps = ComponentProps<typeof PasswordInputInput> & {
|
|
15
16
|
label?: string;
|
|
16
17
|
description?: string;
|
|
17
18
|
showVisibilityTrigger?: boolean;
|
|
19
|
+
trailingAddon?: JSXElement;
|
|
18
20
|
};
|
|
19
21
|
|
|
22
|
+
const PASSWORD_INPUT_FIELD_PROPS = [
|
|
23
|
+
'label',
|
|
24
|
+
'description',
|
|
25
|
+
'required',
|
|
26
|
+
'disabled',
|
|
27
|
+
'readOnly',
|
|
28
|
+
'showVisibilityTrigger',
|
|
29
|
+
'trailingAddon',
|
|
30
|
+
] as const;
|
|
31
|
+
|
|
32
|
+
type PasswordInputFieldLocalProps = Pick<
|
|
33
|
+
PasswordInputFieldProps,
|
|
34
|
+
(typeof PASSWORD_INPUT_FIELD_PROPS)[number]
|
|
35
|
+
>;
|
|
36
|
+
|
|
37
|
+
const PasswordInputFieldControl: Component<{
|
|
38
|
+
field: ReturnType<typeof useFieldContext<string>>;
|
|
39
|
+
local: PasswordInputFieldLocalProps;
|
|
40
|
+
others: Omit<PasswordInputFieldProps, keyof PasswordInputFieldLocalProps>;
|
|
41
|
+
}> = (props) => (
|
|
42
|
+
<WithTrailingAddon addon={props.local.trailingAddon}>
|
|
43
|
+
<PasswordInput
|
|
44
|
+
invalid={props.field().state.meta.errors.length > 0}
|
|
45
|
+
disabled={props.local.disabled ?? false}
|
|
46
|
+
readOnly={props.local.readOnly ?? false}
|
|
47
|
+
required={props.local.required ?? false}
|
|
48
|
+
>
|
|
49
|
+
<PasswordInputControl>
|
|
50
|
+
<PasswordInputInput
|
|
51
|
+
value={props.field().state.value}
|
|
52
|
+
onInput={(event) => {
|
|
53
|
+
props.field().handleChange(event.target.value);
|
|
54
|
+
}}
|
|
55
|
+
onBlur={() => {
|
|
56
|
+
props.field().handleBlur();
|
|
57
|
+
}}
|
|
58
|
+
{...props.others}
|
|
59
|
+
/>
|
|
60
|
+
<Show when={props.local.showVisibilityTrigger !== false}>
|
|
61
|
+
<PasswordInputVisibilityTrigger>
|
|
62
|
+
<PasswordInputIndicator />
|
|
63
|
+
</PasswordInputVisibilityTrigger>
|
|
64
|
+
</Show>
|
|
65
|
+
</PasswordInputControl>
|
|
66
|
+
</PasswordInput>
|
|
67
|
+
</WithTrailingAddon>
|
|
68
|
+
);
|
|
69
|
+
|
|
20
70
|
export const PasswordInputField: Component<PasswordInputFieldProps> = (props) => {
|
|
21
71
|
const field = useFieldContext<string>();
|
|
22
|
-
const [local, others] = splitProps(props,
|
|
23
|
-
'label',
|
|
24
|
-
'description',
|
|
25
|
-
'required',
|
|
26
|
-
'disabled',
|
|
27
|
-
'readOnly',
|
|
28
|
-
'showVisibilityTrigger',
|
|
29
|
-
]);
|
|
72
|
+
const [local, others] = splitProps(props, PASSWORD_INPUT_FIELD_PROPS);
|
|
30
73
|
|
|
31
74
|
return (
|
|
32
75
|
<Field
|
|
@@ -37,30 +80,7 @@ export const PasswordInputField: Component<PasswordInputFieldProps> = (props) =>
|
|
|
37
80
|
>
|
|
38
81
|
<FieldLabel>{local.label}</FieldLabel>
|
|
39
82
|
<FieldContent>
|
|
40
|
-
<
|
|
41
|
-
invalid={field().state.meta.errors.length > 0}
|
|
42
|
-
disabled={local.disabled ?? false}
|
|
43
|
-
readOnly={local.readOnly ?? false}
|
|
44
|
-
required={local.required ?? false}
|
|
45
|
-
>
|
|
46
|
-
<PasswordInputControl>
|
|
47
|
-
<PasswordInputInput
|
|
48
|
-
value={field().state.value}
|
|
49
|
-
onInput={(event) => {
|
|
50
|
-
field().handleChange(event.target.value);
|
|
51
|
-
}}
|
|
52
|
-
onBlur={() => {
|
|
53
|
-
field().handleBlur();
|
|
54
|
-
}}
|
|
55
|
-
{...others}
|
|
56
|
-
/>
|
|
57
|
-
<Show when={local.showVisibilityTrigger !== false}>
|
|
58
|
-
<PasswordInputVisibilityTrigger>
|
|
59
|
-
<PasswordInputIndicator />
|
|
60
|
-
</PasswordInputVisibilityTrigger>
|
|
61
|
-
</Show>
|
|
62
|
-
</PasswordInputControl>
|
|
63
|
-
</PasswordInput>
|
|
83
|
+
<PasswordInputFieldControl field={field} local={local} others={others} />
|
|
64
84
|
<FieldError errors={field().state.meta.errors} />
|
|
65
85
|
<FieldDescription>{local.description}</FieldDescription>
|
|
66
86
|
</FieldContent>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Component, ComponentProps, JSXElement } from 'solid-js';
|
|
2
2
|
|
|
3
3
|
import { Field, FieldLabel, FieldContent, FieldError, FieldDescription } from '@/components/Field';
|
|
4
4
|
import {
|
|
@@ -10,11 +10,13 @@ import {
|
|
|
10
10
|
} from '@/components/PinInput';
|
|
11
11
|
|
|
12
12
|
import { useFieldContext } from './context';
|
|
13
|
+
import { WithTrailingAddon } from './WithTrailingAddon';
|
|
13
14
|
|
|
14
15
|
export type PinInputFieldProps = ComponentProps<typeof PinInput> & {
|
|
15
16
|
label?: string;
|
|
16
17
|
description?: string;
|
|
17
18
|
count?: number;
|
|
19
|
+
trailingAddon?: JSXElement;
|
|
18
20
|
};
|
|
19
21
|
|
|
20
22
|
const DEFAULT_PIN_COUNT = 6;
|
|
@@ -25,6 +27,7 @@ const PIN_INPUT_FIELD_PROPS = [
|
|
|
25
27
|
'disabled',
|
|
26
28
|
'readOnly',
|
|
27
29
|
'count',
|
|
30
|
+
'trailingAddon',
|
|
28
31
|
] as const;
|
|
29
32
|
|
|
30
33
|
const PinInputDigits: Component<{ count: number }> = (props) => (
|
|
@@ -51,24 +54,26 @@ export const PinInputField: Component<PinInputFieldProps> = (props) => {
|
|
|
51
54
|
>
|
|
52
55
|
<FieldLabel>{local.label}</FieldLabel>
|
|
53
56
|
<FieldContent>
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
57
|
+
<WithTrailingAddon addon={local.trailingAddon}>
|
|
58
|
+
<PinInput
|
|
59
|
+
value={field().state.value}
|
|
60
|
+
onValueChange={(details) => {
|
|
61
|
+
field().handleChange(details.value);
|
|
62
|
+
}}
|
|
63
|
+
onBlur={() => {
|
|
64
|
+
field().handleBlur();
|
|
65
|
+
}}
|
|
66
|
+
invalid={field().state.meta.errors.length > 0}
|
|
67
|
+
disabled={local.disabled ?? false}
|
|
68
|
+
readOnly={local.readOnly ?? false}
|
|
69
|
+
required={local.required ?? false}
|
|
70
|
+
count={pinCount}
|
|
71
|
+
{...others}
|
|
72
|
+
>
|
|
73
|
+
<PinInputDigits count={pinCount} />
|
|
74
|
+
<PinInputHiddenInput />
|
|
75
|
+
</PinInput>
|
|
76
|
+
</WithTrailingAddon>
|
|
72
77
|
<FieldError errors={field().state.meta.errors} />
|
|
73
78
|
<FieldDescription>{local.description}</FieldDescription>
|
|
74
79
|
</FieldContent>
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Component, ComponentProps, JSXElement } from 'solid-js';
|
|
2
2
|
|
|
3
3
|
import { Field, FieldContent, FieldError, FieldDescription } from '@/components/Field';
|
|
4
4
|
import { RadioGroup, RadioGroupLabel } from '@/components/RadioGroup';
|
|
5
5
|
|
|
6
6
|
import { useFieldContext } from './context';
|
|
7
|
+
import { WithTrailingAddon } from './WithTrailingAddon';
|
|
7
8
|
|
|
8
9
|
export type RadioGroupFieldProps = ComponentProps<typeof RadioGroup> & {
|
|
9
10
|
label?: string;
|
|
10
11
|
description?: string;
|
|
12
|
+
trailingAddon?: JSXElement;
|
|
11
13
|
};
|
|
12
14
|
|
|
13
15
|
export const RadioGroupField: Component<RadioGroupFieldProps> = (props) => {
|
|
@@ -19,6 +21,7 @@ export const RadioGroupField: Component<RadioGroupFieldProps> = (props) => {
|
|
|
19
21
|
'disabled',
|
|
20
22
|
'readOnly',
|
|
21
23
|
'children',
|
|
24
|
+
'trailingAddon',
|
|
22
25
|
]);
|
|
23
26
|
|
|
24
27
|
return (
|
|
@@ -29,23 +32,25 @@ export const RadioGroupField: Component<RadioGroupFieldProps> = (props) => {
|
|
|
29
32
|
readOnly={local.readOnly ?? false}
|
|
30
33
|
>
|
|
31
34
|
<FieldContent>
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
35
|
+
<WithTrailingAddon addon={local.trailingAddon}>
|
|
36
|
+
<RadioGroup
|
|
37
|
+
value={field().state.value}
|
|
38
|
+
onValueChange={(details) => {
|
|
39
|
+
field().handleChange(details.value ?? '');
|
|
40
|
+
}}
|
|
41
|
+
onBlur={() => {
|
|
42
|
+
field().handleBlur();
|
|
43
|
+
}}
|
|
44
|
+
invalid={field().state.meta.errors.length > 0}
|
|
45
|
+
disabled={local.disabled ?? false}
|
|
46
|
+
readOnly={local.readOnly ?? false}
|
|
47
|
+
required={local.required ?? false}
|
|
48
|
+
{...others}
|
|
49
|
+
>
|
|
50
|
+
<RadioGroupLabel>{local.label}</RadioGroupLabel>
|
|
51
|
+
{local.children}
|
|
52
|
+
</RadioGroup>
|
|
53
|
+
</WithTrailingAddon>
|
|
49
54
|
<FieldError errors={field().state.meta.errors} />
|
|
50
55
|
<FieldDescription>{local.description}</FieldDescription>
|
|
51
56
|
</FieldContent>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Component, ComponentProps, JSX } from 'solid-js';
|
|
1
|
+
import type { Component, ComponentProps, JSX, JSXElement } from 'solid-js';
|
|
2
2
|
|
|
3
3
|
import { Field, FieldContent, FieldDescription, FieldError, FieldLabel } from '@/components/Field';
|
|
4
4
|
import {
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from '@/components/Select';
|
|
12
12
|
|
|
13
13
|
import { useFieldContext } from './context';
|
|
14
|
+
import { WithTrailingAddon } from './WithTrailingAddon';
|
|
14
15
|
|
|
15
16
|
const SelectInput: Component<{ placeholder: string; children: JSX.Element }> = (props) => (
|
|
16
17
|
<>
|
|
@@ -29,6 +30,7 @@ export type SelectFieldProps = ComponentProps<typeof Select> & {
|
|
|
29
30
|
label?: string;
|
|
30
31
|
description?: string;
|
|
31
32
|
placeholder?: string;
|
|
33
|
+
trailingAddon?: JSXElement;
|
|
32
34
|
};
|
|
33
35
|
|
|
34
36
|
export const SelectField: Component<SelectFieldProps> = (props) => {
|
|
@@ -41,6 +43,7 @@ export const SelectField: Component<SelectFieldProps> = (props) => {
|
|
|
41
43
|
'readOnly',
|
|
42
44
|
'placeholder',
|
|
43
45
|
'children',
|
|
46
|
+
'trailingAddon',
|
|
44
47
|
]);
|
|
45
48
|
|
|
46
49
|
return (
|
|
@@ -52,21 +55,23 @@ export const SelectField: Component<SelectFieldProps> = (props) => {
|
|
|
52
55
|
>
|
|
53
56
|
<FieldLabel>{local.label}</FieldLabel>
|
|
54
57
|
<FieldContent>
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
<WithTrailingAddon addon={local.trailingAddon}>
|
|
59
|
+
<Select
|
|
60
|
+
value={field().state.value}
|
|
61
|
+
onValueChange={(details) => {
|
|
62
|
+
field().handleChange(details.value);
|
|
63
|
+
}}
|
|
64
|
+
onBlur={() => {
|
|
65
|
+
field().handleBlur();
|
|
66
|
+
}}
|
|
67
|
+
invalid={field().state.meta.errors.length > 0}
|
|
68
|
+
disabled={local.disabled ?? false}
|
|
69
|
+
readOnly={local.readOnly ?? false}
|
|
70
|
+
{...others}
|
|
71
|
+
>
|
|
72
|
+
<SelectInput placeholder={local.placeholder ?? ''}>{local.children}</SelectInput>
|
|
73
|
+
</Select>
|
|
74
|
+
</WithTrailingAddon>
|
|
70
75
|
<FieldError errors={field().state.meta.errors} />
|
|
71
76
|
<FieldDescription>{local.description}</FieldDescription>
|
|
72
77
|
</FieldContent>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Component, ComponentProps } from 'solid-js';
|
|
1
|
+
import type { Component, ComponentProps, JSXElement } from 'solid-js';
|
|
2
2
|
|
|
3
3
|
import { Field, FieldDescription, FieldError } from '@/components/Field';
|
|
4
4
|
import {
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from '@/components/Slider';
|
|
15
15
|
|
|
16
16
|
import { useFieldContext } from './context';
|
|
17
|
+
import { WithTrailingAddon } from './WithTrailingAddon';
|
|
17
18
|
|
|
18
19
|
const SliderInput: Component<{
|
|
19
20
|
value: number[];
|
|
@@ -48,6 +49,7 @@ export type SliderFieldProps = ComponentProps<typeof Slider> & {
|
|
|
48
49
|
description?: string;
|
|
49
50
|
marks?: { value: number; label?: string }[];
|
|
50
51
|
required?: boolean;
|
|
52
|
+
trailingAddon?: JSXElement;
|
|
51
53
|
};
|
|
52
54
|
|
|
53
55
|
export const SliderField: Component<SliderFieldProps> = (props) => {
|
|
@@ -59,6 +61,7 @@ export const SliderField: Component<SliderFieldProps> = (props) => {
|
|
|
59
61
|
'disabled',
|
|
60
62
|
'readOnly',
|
|
61
63
|
'marks',
|
|
64
|
+
'trailingAddon',
|
|
62
65
|
]);
|
|
63
66
|
|
|
64
67
|
return (
|
|
@@ -68,25 +71,27 @@ export const SliderField: Component<SliderFieldProps> = (props) => {
|
|
|
68
71
|
readOnly={local.readOnly ?? false}
|
|
69
72
|
required={local.required ?? false}
|
|
70
73
|
>
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
onValueChange={(details) => {
|
|
74
|
-
field().handleChange(details.value);
|
|
75
|
-
}}
|
|
76
|
-
onFocusChange={() => {
|
|
77
|
-
field().handleBlur();
|
|
78
|
-
}}
|
|
79
|
-
invalid={field().state.meta.errors.length > 0}
|
|
80
|
-
disabled={local.disabled ?? false}
|
|
81
|
-
readOnly={local.readOnly ?? false}
|
|
82
|
-
{...others}
|
|
83
|
-
>
|
|
84
|
-
<SliderInput
|
|
74
|
+
<WithTrailingAddon addon={local.trailingAddon}>
|
|
75
|
+
<Slider
|
|
85
76
|
value={field().state.value}
|
|
86
|
-
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
77
|
+
onValueChange={(details) => {
|
|
78
|
+
field().handleChange(details.value);
|
|
79
|
+
}}
|
|
80
|
+
onFocusChange={() => {
|
|
81
|
+
field().handleBlur();
|
|
82
|
+
}}
|
|
83
|
+
invalid={field().state.meta.errors.length > 0}
|
|
84
|
+
disabled={local.disabled ?? false}
|
|
85
|
+
readOnly={local.readOnly ?? false}
|
|
86
|
+
{...others}
|
|
87
|
+
>
|
|
88
|
+
<SliderInput
|
|
89
|
+
value={field().state.value}
|
|
90
|
+
{...(typeof local.label === 'string' && { label: local.label })}
|
|
91
|
+
{...(Array.isArray(local.marks) && { marks: local.marks })}
|
|
92
|
+
/>
|
|
93
|
+
</Slider>
|
|
94
|
+
</WithTrailingAddon>
|
|
90
95
|
<FieldError errors={field().state.meta.errors} />
|
|
91
96
|
<FieldDescription>{local.description}</FieldDescription>
|
|
92
97
|
</Field>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Component, ComponentProps, JSXElement } from 'solid-js';
|
|
2
2
|
|
|
3
3
|
import { Field, FieldContent, FieldDescription, FieldError, FieldLabel } from '@/components/Field';
|
|
4
4
|
import {
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
} from '@/components/TagsInput';
|
|
17
17
|
|
|
18
18
|
import { useFieldContext } from './context';
|
|
19
|
+
import { WithTrailingAddon } from './WithTrailingAddon';
|
|
19
20
|
|
|
20
21
|
const TAGS_INPUT_ROOT_PROPS = [
|
|
21
22
|
'max',
|
|
@@ -42,6 +43,7 @@ export type TagsInputFieldProps = ComponentProps<typeof TagsInputInput> &
|
|
|
42
43
|
label?: string;
|
|
43
44
|
description?: string;
|
|
44
45
|
showClearTrigger?: boolean;
|
|
46
|
+
trailingAddon?: JSXElement;
|
|
45
47
|
};
|
|
46
48
|
|
|
47
49
|
const TagsInputGroup: Component<
|
|
@@ -85,6 +87,7 @@ const TAGS_INPUT_FIELD_PROPS = [
|
|
|
85
87
|
'disabled',
|
|
86
88
|
'readOnly',
|
|
87
89
|
'showClearTrigger',
|
|
90
|
+
'trailingAddon',
|
|
88
91
|
] as const;
|
|
89
92
|
|
|
90
93
|
export const TagsInputField: Component<TagsInputFieldProps> = (props) => {
|
|
@@ -101,26 +104,28 @@ export const TagsInputField: Component<TagsInputFieldProps> = (props) => {
|
|
|
101
104
|
>
|
|
102
105
|
<FieldLabel>{local.label}</FieldLabel>
|
|
103
106
|
<FieldContent>
|
|
104
|
-
<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
107
|
+
<WithTrailingAddon addon={local.trailingAddon}>
|
|
108
|
+
<TagsInput
|
|
109
|
+
value={field().state.value}
|
|
110
|
+
onValueChange={(details) => {
|
|
111
|
+
field().handleChange(details.value);
|
|
112
|
+
}}
|
|
113
|
+
onBlur={() => {
|
|
114
|
+
field().handleBlur();
|
|
115
|
+
}}
|
|
116
|
+
invalid={field().state.meta.errors.length > 0}
|
|
117
|
+
disabled={local.disabled ?? false}
|
|
118
|
+
readOnly={local.readOnly ?? false}
|
|
119
|
+
{...rootProps}
|
|
120
|
+
>
|
|
121
|
+
<TagsInputGroup
|
|
122
|
+
{...inputProps}
|
|
123
|
+
{...(typeof local.showClearTrigger === 'boolean' && {
|
|
124
|
+
showClearTrigger: local.showClearTrigger,
|
|
125
|
+
})}
|
|
126
|
+
/>
|
|
127
|
+
</TagsInput>
|
|
128
|
+
</WithTrailingAddon>
|
|
124
129
|
<FieldError errors={field().state.meta.errors} />
|
|
125
130
|
<FieldDescription>{local.description}</FieldDescription>
|
|
126
131
|
</FieldContent>
|