@manafishrov/ui 1.3.4 → 1.3.5
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 +9 -9
- 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 +6 -11
- 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,25 +1,26 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { Field as
|
|
1
|
+
import { createComponent as t, mergeProps as d, Show as s } from "solid-js/web";
|
|
2
|
+
import { Field as g, FieldLabel as c, FieldContent as h, FieldError as f, FieldDescription as b } from "../Field.js";
|
|
3
3
|
import { NumberInput as V, NumberInputControl as C, NumberInputInput as N, NumberInputTriggers as I } from "../NumberInput.js";
|
|
4
4
|
import { useFieldContext as O } from "./context.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { WithTrailingAddon as F } from "./WithTrailingAddon.js";
|
|
6
|
+
import { splitProps as m, createSignal as v, createEffect as P } from "solid-js";
|
|
7
|
+
const B = ["min", "max", "step", "allowMouseWheel", "allowOverflow", "clampValueOnBlur", "formatOptions", "inputMode", "locale", "pattern", "spinOnPress", "focusInputOnChange", "translations", "form", "name", "onValueInvalid"], u = (e) => typeof e != "number" || !Number.isFinite(e) ? "" : String(e), w = (e) => {
|
|
8
|
+
const [l, n] = v(u(e().state.value));
|
|
9
|
+
return P(() => {
|
|
9
10
|
n(u(e().state.value));
|
|
10
11
|
}), {
|
|
11
12
|
inputValue: l,
|
|
12
|
-
onValueChange: (
|
|
13
|
-
n(
|
|
13
|
+
onValueChange: (r) => {
|
|
14
|
+
n(r.value);
|
|
14
15
|
},
|
|
15
|
-
onValueCommit: (
|
|
16
|
-
n(
|
|
16
|
+
onValueCommit: (r) => {
|
|
17
|
+
n(r.value), Number.isFinite(r.valueAsNumber) && e().handleChange(r.valueAsNumber);
|
|
17
18
|
},
|
|
18
19
|
onBlur: () => {
|
|
19
20
|
n(u(e().state.value)), e().handleBlur();
|
|
20
21
|
}
|
|
21
22
|
};
|
|
22
|
-
}, p = (e) =>
|
|
23
|
+
}, p = (e) => t(g, {
|
|
23
24
|
get invalid() {
|
|
24
25
|
return e.field().state.meta.errors.length > 0;
|
|
25
26
|
},
|
|
@@ -33,57 +34,64 @@ const P = ["min", "max", "step", "allowMouseWheel", "allowOverflow", "clampValue
|
|
|
33
34
|
return e.local.readOnly ?? !1;
|
|
34
35
|
},
|
|
35
36
|
get children() {
|
|
36
|
-
return [
|
|
37
|
+
return [t(c, {
|
|
37
38
|
get children() {
|
|
38
39
|
return e.local.label;
|
|
39
40
|
}
|
|
40
|
-
}),
|
|
41
|
+
}), t(h, {
|
|
41
42
|
get children() {
|
|
42
|
-
return [
|
|
43
|
-
get
|
|
44
|
-
return e.
|
|
43
|
+
return [t(F, {
|
|
44
|
+
get addon() {
|
|
45
|
+
return e.local.trailingAddon;
|
|
45
46
|
},
|
|
46
|
-
get onValueChange() {
|
|
47
|
-
return e.onValueChange;
|
|
48
|
-
},
|
|
49
|
-
get onValueCommit() {
|
|
50
|
-
return e.onValueCommit;
|
|
51
|
-
},
|
|
52
|
-
get onBlur() {
|
|
53
|
-
return e.onBlur;
|
|
54
|
-
},
|
|
55
|
-
get invalid() {
|
|
56
|
-
return e.field().state.meta.errors.length > 0;
|
|
57
|
-
},
|
|
58
|
-
get disabled() {
|
|
59
|
-
return e.local.disabled ?? !1;
|
|
60
|
-
},
|
|
61
|
-
get readOnly() {
|
|
62
|
-
return e.local.readOnly ?? !1;
|
|
63
|
-
},
|
|
64
|
-
get required() {
|
|
65
|
-
return e.local.required ?? !1;
|
|
66
|
-
}
|
|
67
|
-
}, () => e.rootProps, {
|
|
68
47
|
get children() {
|
|
69
|
-
return
|
|
48
|
+
return t(V, d({
|
|
49
|
+
get value() {
|
|
50
|
+
return e.inputValue();
|
|
51
|
+
},
|
|
52
|
+
get onValueChange() {
|
|
53
|
+
return e.onValueChange;
|
|
54
|
+
},
|
|
55
|
+
get onValueCommit() {
|
|
56
|
+
return e.onValueCommit;
|
|
57
|
+
},
|
|
58
|
+
get onBlur() {
|
|
59
|
+
return e.onBlur;
|
|
60
|
+
},
|
|
61
|
+
get invalid() {
|
|
62
|
+
return e.field().state.meta.errors.length > 0;
|
|
63
|
+
},
|
|
64
|
+
get disabled() {
|
|
65
|
+
return e.local.disabled ?? !1;
|
|
66
|
+
},
|
|
67
|
+
get readOnly() {
|
|
68
|
+
return e.local.readOnly ?? !1;
|
|
69
|
+
},
|
|
70
|
+
get required() {
|
|
71
|
+
return e.local.required ?? !1;
|
|
72
|
+
}
|
|
73
|
+
}, () => e.rootProps, {
|
|
70
74
|
get children() {
|
|
71
|
-
return
|
|
72
|
-
get when() {
|
|
73
|
-
return e.local.showTriggers !== !1;
|
|
74
|
-
},
|
|
75
|
+
return t(C, {
|
|
75
76
|
get children() {
|
|
76
|
-
return
|
|
77
|
+
return [t(N, d(() => e.inputProps)), t(s, {
|
|
78
|
+
get when() {
|
|
79
|
+
return e.local.showTriggers !== !1;
|
|
80
|
+
},
|
|
81
|
+
get children() {
|
|
82
|
+
return t(I, {});
|
|
83
|
+
}
|
|
84
|
+
})];
|
|
77
85
|
}
|
|
78
|
-
})
|
|
86
|
+
});
|
|
79
87
|
}
|
|
80
|
-
});
|
|
88
|
+
}));
|
|
81
89
|
}
|
|
82
|
-
})
|
|
90
|
+
}), t(f, {
|
|
83
91
|
get errors() {
|
|
84
92
|
return e.field().state.meta.errors;
|
|
85
93
|
}
|
|
86
|
-
}),
|
|
94
|
+
}), t(b, {
|
|
87
95
|
get children() {
|
|
88
96
|
return e.local.description;
|
|
89
97
|
}
|
|
@@ -91,20 +99,20 @@ const P = ["min", "max", "step", "allowMouseWheel", "allowOverflow", "clampValue
|
|
|
91
99
|
}
|
|
92
100
|
})];
|
|
93
101
|
}
|
|
94
|
-
}),
|
|
95
|
-
const l = O(), [n, a] = m(e, ["label", "description", "required", "disabled", "readOnly", "showTriggers"]), [o, i] = m(a,
|
|
102
|
+
}), E = (e) => {
|
|
103
|
+
const l = O(), [n, a] = m(e, ["label", "description", "required", "disabled", "readOnly", "showTriggers", "trailingAddon"]), [o, i] = m(a, B), r = w(l);
|
|
96
104
|
return p({
|
|
97
105
|
field: l,
|
|
98
106
|
local: n,
|
|
99
107
|
rootProps: o,
|
|
100
108
|
inputProps: i,
|
|
101
|
-
inputValue:
|
|
102
|
-
onValueChange:
|
|
103
|
-
onValueCommit:
|
|
104
|
-
onBlur:
|
|
109
|
+
inputValue: r.inputValue,
|
|
110
|
+
onValueChange: r.onValueChange,
|
|
111
|
+
onValueCommit: r.onValueCommit,
|
|
112
|
+
onBlur: r.onBlur
|
|
105
113
|
});
|
|
106
114
|
};
|
|
107
115
|
export {
|
|
108
|
-
|
|
116
|
+
E as NumberInputField
|
|
109
117
|
};
|
|
110
118
|
//# sourceMappingURL=NumberInputField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInputField.js","sources":["../../../src/components/form/NumberInputField.tsx"],"sourcesContent":["import type { Component, ComponentProps, JSX } from 'solid-js';\n\nimport { Field, FieldLabel, FieldContent, FieldError, FieldDescription } from '@/components/Field';\nimport {\n NumberInput,\n NumberInputControl,\n NumberInputInput,\n NumberInputTriggers,\n} from '@/components/NumberInput';\n\nimport { useFieldContext } from './context';\n\nconst NUMBER_INPUT_ROOT_PROPS = [\n 'min',\n 'max',\n 'step',\n 'allowMouseWheel',\n 'allowOverflow',\n 'clampValueOnBlur',\n 'formatOptions',\n 'inputMode',\n 'locale',\n 'pattern',\n 'spinOnPress',\n 'focusInputOnChange',\n 'translations',\n 'form',\n 'name',\n 'onValueInvalid',\n] as const;\n\nexport type NumberInputFieldProps = ComponentProps<typeof NumberInputInput> &\n Pick<ComponentProps<typeof NumberInput>, (typeof NUMBER_INPUT_ROOT_PROPS)[number]> & {\n label?: string;\n description?: string;\n showTriggers?: boolean;\n };\n\nconst toNumberInputValue = (value: number | undefined): string => {\n if (typeof value !== 'number' || !Number.isFinite(value)) {\n return '';\n }\n\n return String(value);\n};\n\ntype NumberInputFieldLocalProps = Pick<\n NumberInputFieldProps,\n 'label' | 'description' | 'required' | 'disabled' | 'readOnly' | 'showTriggers'\n>;\n\ntype NumberInputFieldRootProps = Pick<\n NumberInputFieldProps,\n (typeof NUMBER_INPUT_ROOT_PROPS)[number]\n>;\n\ntype RenderNumberInputFieldProps = {\n field: ReturnType<typeof useFieldContext<number>>;\n local: NumberInputFieldLocalProps;\n rootProps: NumberInputFieldRootProps;\n inputProps: Omit<\n NumberInputFieldProps,\n keyof NumberInputFieldLocalProps | keyof NumberInputFieldRootProps\n >;\n inputValue: () => string;\n onValueChange: NonNullable<ComponentProps<typeof NumberInput>['onValueChange']>;\n onValueCommit: NonNullable<ComponentProps<typeof NumberInput>['onValueCommit']>;\n onBlur: () => void;\n};\n\ntype NumberInputFieldState = Pick<\n RenderNumberInputFieldProps,\n 'inputValue' | 'onValueChange' | 'onValueCommit' | 'onBlur'\n>;\n\nconst createNumberInputFieldState = (\n field: ReturnType<typeof useFieldContext<number>>,\n): NumberInputFieldState => {\n const [inputValue, setInputValue] = createSignal(toNumberInputValue(field().state.value));\n\n createEffect(() => {\n setInputValue(toNumberInputValue(field().state.value));\n });\n\n const onValueChange: NonNullable<ComponentProps<typeof NumberInput>['onValueChange']> = (\n details,\n ) => {\n setInputValue(details.value);\n };\n\n const onValueCommit: NonNullable<ComponentProps<typeof NumberInput>['onValueCommit']> = (\n details,\n ) => {\n setInputValue(details.value);\n\n if (!Number.isFinite(details.valueAsNumber)) {\n return;\n }\n\n field().handleChange(details.valueAsNumber);\n };\n\n const onBlur = (): void => {\n setInputValue(toNumberInputValue(field().state.value));\n field().handleBlur();\n };\n\n return {\n inputValue,\n onValueChange,\n onValueCommit,\n onBlur,\n };\n};\n\nconst renderNumberInputField = (props: RenderNumberInputFieldProps): JSX.Element => (\n <Field\n invalid={props.field().state.meta.errors.length > 0}\n required={props.local.required ?? false}\n disabled={props.local.disabled ?? false}\n readOnly={props.local.readOnly ?? false}\n >\n <FieldLabel>{props.local.label}</FieldLabel>\n <FieldContent>\n <NumberInput\n
|
|
1
|
+
{"version":3,"file":"NumberInputField.js","sources":["../../../src/components/form/NumberInputField.tsx"],"sourcesContent":["import type { Component, ComponentProps, JSX, JSXElement } from 'solid-js';\n\nimport { Field, FieldLabel, FieldContent, FieldError, FieldDescription } from '@/components/Field';\nimport {\n NumberInput,\n NumberInputControl,\n NumberInputInput,\n NumberInputTriggers,\n} from '@/components/NumberInput';\n\nimport { useFieldContext } from './context';\nimport { WithTrailingAddon } from './WithTrailingAddon';\n\nconst NUMBER_INPUT_ROOT_PROPS = [\n 'min',\n 'max',\n 'step',\n 'allowMouseWheel',\n 'allowOverflow',\n 'clampValueOnBlur',\n 'formatOptions',\n 'inputMode',\n 'locale',\n 'pattern',\n 'spinOnPress',\n 'focusInputOnChange',\n 'translations',\n 'form',\n 'name',\n 'onValueInvalid',\n] as const;\n\nexport type NumberInputFieldProps = ComponentProps<typeof NumberInputInput> &\n Pick<ComponentProps<typeof NumberInput>, (typeof NUMBER_INPUT_ROOT_PROPS)[number]> & {\n label?: string;\n description?: string;\n showTriggers?: boolean;\n trailingAddon?: JSXElement;\n };\n\nconst toNumberInputValue = (value: number | undefined): string => {\n if (typeof value !== 'number' || !Number.isFinite(value)) {\n return '';\n }\n\n return String(value);\n};\n\ntype NumberInputFieldLocalProps = Pick<\n NumberInputFieldProps,\n 'label' | 'description' | 'required' | 'disabled' | 'readOnly' | 'showTriggers' | 'trailingAddon'\n>;\n\ntype NumberInputFieldRootProps = Pick<\n NumberInputFieldProps,\n (typeof NUMBER_INPUT_ROOT_PROPS)[number]\n>;\n\ntype RenderNumberInputFieldProps = {\n field: ReturnType<typeof useFieldContext<number>>;\n local: NumberInputFieldLocalProps;\n rootProps: NumberInputFieldRootProps;\n inputProps: Omit<\n NumberInputFieldProps,\n keyof NumberInputFieldLocalProps | keyof NumberInputFieldRootProps\n >;\n inputValue: () => string;\n onValueChange: NonNullable<ComponentProps<typeof NumberInput>['onValueChange']>;\n onValueCommit: NonNullable<ComponentProps<typeof NumberInput>['onValueCommit']>;\n onBlur: () => void;\n};\n\ntype NumberInputFieldState = Pick<\n RenderNumberInputFieldProps,\n 'inputValue' | 'onValueChange' | 'onValueCommit' | 'onBlur'\n>;\n\nconst createNumberInputFieldState = (\n field: ReturnType<typeof useFieldContext<number>>,\n): NumberInputFieldState => {\n const [inputValue, setInputValue] = createSignal(toNumberInputValue(field().state.value));\n\n createEffect(() => {\n setInputValue(toNumberInputValue(field().state.value));\n });\n\n const onValueChange: NonNullable<ComponentProps<typeof NumberInput>['onValueChange']> = (\n details,\n ) => {\n setInputValue(details.value);\n };\n\n const onValueCommit: NonNullable<ComponentProps<typeof NumberInput>['onValueCommit']> = (\n details,\n ) => {\n setInputValue(details.value);\n\n if (!Number.isFinite(details.valueAsNumber)) {\n return;\n }\n\n field().handleChange(details.valueAsNumber);\n };\n\n const onBlur = (): void => {\n setInputValue(toNumberInputValue(field().state.value));\n field().handleBlur();\n };\n\n return {\n inputValue,\n onValueChange,\n onValueCommit,\n onBlur,\n };\n};\n\nconst renderNumberInputField = (props: RenderNumberInputFieldProps): JSX.Element => (\n <Field\n invalid={props.field().state.meta.errors.length > 0}\n required={props.local.required ?? false}\n disabled={props.local.disabled ?? false}\n readOnly={props.local.readOnly ?? false}\n >\n <FieldLabel>{props.local.label}</FieldLabel>\n <FieldContent>\n <WithTrailingAddon addon={props.local.trailingAddon}>\n <NumberInput\n value={props.inputValue()}\n onValueChange={props.onValueChange}\n onValueCommit={props.onValueCommit}\n onBlur={props.onBlur}\n invalid={props.field().state.meta.errors.length > 0}\n disabled={props.local.disabled ?? false}\n readOnly={props.local.readOnly ?? false}\n required={props.local.required ?? false}\n {...props.rootProps}\n >\n <NumberInputControl>\n <NumberInputInput {...props.inputProps} />\n <Show when={props.local.showTriggers !== false}>\n <NumberInputTriggers />\n </Show>\n </NumberInputControl>\n </NumberInput>\n </WithTrailingAddon>\n <FieldError errors={props.field().state.meta.errors} />\n <FieldDescription>{props.local.description}</FieldDescription>\n </FieldContent>\n </Field>\n);\n\nexport const NumberInputField: Component<NumberInputFieldProps> = (props) => {\n const field = useFieldContext<number>();\n const [local, others] = splitProps(props, [\n 'label',\n 'description',\n 'required',\n 'disabled',\n 'readOnly',\n 'showTriggers',\n 'trailingAddon',\n ]);\n const [rootProps, inputProps] = splitProps(others, NUMBER_INPUT_ROOT_PROPS);\n const state = createNumberInputFieldState(field);\n\n return renderNumberInputField({\n field,\n local,\n rootProps,\n inputProps,\n inputValue: state.inputValue,\n onValueChange: state.onValueChange,\n onValueCommit: state.onValueCommit,\n onBlur: state.onBlur,\n });\n};\n"],"names":["NUMBER_INPUT_ROOT_PROPS","toNumberInputValue","value","Number","isFinite","String","createNumberInputFieldState","field","inputValue","setInputValue","createSignal","state","createEffect","onValueChange","details","onValueCommit","valueAsNumber","handleChange","onBlur","handleBlur","renderNumberInputField","props","_$createComponent","Field","invalid","meta","errors","length","required","local","disabled","readOnly","children","FieldLabel","label","FieldContent","WithTrailingAddon","addon","trailingAddon","NumberInput","_$mergeProps","rootProps","NumberInputControl","NumberInputInput","inputProps","_$Show","when","showTriggers","NumberInputTriggers","FieldError","FieldDescription","description","NumberInputField","useFieldContext","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IAAAf,WAAA;AAAA,+BAAAV,EAC3C0B,GAAmB,EAAA;AAAA,sBAAA;AAAA,oBAAA,CAAA,CAAA;AAAA,kBAAA;AAAA,gBAAA,CAAA;AAAA,cAAA;AAAA,YAAA,CAAA,CAAA;AAAA,UAAA;AAAA,QAAA,CAAA,GAAA1B,EAK3B2B,GAAU;AAAA,UAAA,IAACvB,SAAM;AAAA,mBAAEL,EAAMd,MAAAA,EAAQI,MAAMc,KAAKC;AAAAA,UAAM;AAAA,QAAA,CAAA,GAAAJ,EAClD4B,GAAgB;AAAA,UAAA,IAAAlB,WAAA;AAAA,mBAAEX,EAAMQ,MAAMsB;AAAAA,UAAW;AAAA,QAAA,CAAA,CAAA;AAAA,MAAA;AAAA,IAAA,CAAA,CAAA;AAAA,EAAA;AAAA,CAAA,GAKnCC,IAAsD/B,CAAAA,MAAU;AAC3E,QAAMd,IAAQ8C,EAAAA,GACR,CAACxB,GAAOyB,CAAM,IAAIC,EAAWlC,GAAO,CACxC,SACA,eACA,YACA,YACA,YACA,gBACA,eAAe,CAChB,GACK,CAACoB,GAAWG,CAAU,IAAIW,EAAWD,GAAQtD,CAAuB,GACpEW,IAAQL,EAA4BC,CAAK;AAE/C,SAAOa,EAAuB;AAAA,IAC5Bb,OAAAA;AAAAA,IACAsB,OAAAA;AAAAA,IACAY,WAAAA;AAAAA,IACAG,YAAAA;AAAAA,IACApC,YAAYG,EAAMH;AAAAA,IAClBK,eAAeF,EAAME;AAAAA,IACrBE,eAAeJ,EAAMI;AAAAA,IACrBG,QAAQP,EAAMO;AAAAA,EAAAA,CACf;AACH;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Component, ComponentProps } from 'solid-js';
|
|
1
|
+
import { Component, ComponentProps, JSXElement } from 'solid-js';
|
|
2
2
|
import { PasswordInputInput } from '../PasswordInput';
|
|
3
3
|
export type PasswordInputFieldProps = ComponentProps<typeof PasswordInputInput> & {
|
|
4
4
|
label?: string;
|
|
5
5
|
description?: string;
|
|
6
6
|
showVisibilityTrigger?: boolean;
|
|
7
|
+
trailingAddon?: JSXElement;
|
|
7
8
|
};
|
|
8
9
|
export declare const PasswordInputField: Component<PasswordInputFieldProps>;
|
|
@@ -1,78 +1,90 @@
|
|
|
1
|
-
import { createComponent as e, mergeProps as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { PasswordInput as c, PasswordInputControl as m, PasswordInputInput as f, PasswordInputVisibilityTrigger as b, PasswordInputIndicator as w } from "../PasswordInput.js";
|
|
1
|
+
import { createComponent as e, mergeProps as i, Show as d } from "solid-js/web";
|
|
2
|
+
import { Field as a, FieldLabel as o, FieldContent as s, FieldError as u, FieldDescription as g } from "../Field.js";
|
|
3
|
+
import { PasswordInput as c, PasswordInputControl as h, PasswordInputInput as f, PasswordInputVisibilityTrigger as m, PasswordInputIndicator as P } from "../PasswordInput.js";
|
|
5
4
|
import { useFieldContext as I } from "./context.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { WithTrailingAddon as b } from "./WithTrailingAddon.js";
|
|
6
|
+
import { splitProps as w } from "solid-js";
|
|
7
|
+
const F = ["label", "description", "required", "disabled", "readOnly", "showVisibilityTrigger", "trailingAddon"], y = (r) => e(b, {
|
|
8
|
+
get addon() {
|
|
9
|
+
return r.local.trailingAddon;
|
|
10
|
+
},
|
|
11
|
+
get children() {
|
|
12
|
+
return e(c, {
|
|
13
|
+
get invalid() {
|
|
14
|
+
return r.field().state.meta.errors.length > 0;
|
|
15
|
+
},
|
|
16
|
+
get disabled() {
|
|
17
|
+
return r.local.disabled ?? !1;
|
|
18
|
+
},
|
|
19
|
+
get readOnly() {
|
|
20
|
+
return r.local.readOnly ?? !1;
|
|
21
|
+
},
|
|
22
|
+
get required() {
|
|
23
|
+
return r.local.required ?? !1;
|
|
24
|
+
},
|
|
25
|
+
get children() {
|
|
26
|
+
return e(h, {
|
|
27
|
+
get children() {
|
|
28
|
+
return [e(f, i({
|
|
29
|
+
get value() {
|
|
30
|
+
return r.field().state.value;
|
|
31
|
+
},
|
|
32
|
+
onInput: (n) => {
|
|
33
|
+
r.field().handleChange(n.target.value);
|
|
34
|
+
},
|
|
35
|
+
onBlur: () => {
|
|
36
|
+
r.field().handleBlur();
|
|
37
|
+
}
|
|
38
|
+
}, () => r.others)), e(d, {
|
|
39
|
+
get when() {
|
|
40
|
+
return r.local.showVisibilityTrigger !== !1;
|
|
41
|
+
},
|
|
42
|
+
get children() {
|
|
43
|
+
return e(m, {
|
|
44
|
+
get children() {
|
|
45
|
+
return e(P, {});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
})];
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}), A = (r) => {
|
|
56
|
+
const n = I(), [t, l] = w(r, F);
|
|
57
|
+
return e(a, {
|
|
9
58
|
get invalid() {
|
|
10
|
-
return
|
|
59
|
+
return n().state.meta.errors.length > 0;
|
|
11
60
|
},
|
|
12
61
|
get required() {
|
|
13
|
-
return
|
|
62
|
+
return t.required ?? !1;
|
|
14
63
|
},
|
|
15
64
|
get disabled() {
|
|
16
|
-
return
|
|
65
|
+
return t.disabled ?? !1;
|
|
17
66
|
},
|
|
18
67
|
get readOnly() {
|
|
19
|
-
return
|
|
68
|
+
return t.readOnly ?? !1;
|
|
20
69
|
},
|
|
21
70
|
get children() {
|
|
22
|
-
return [e(
|
|
71
|
+
return [e(o, {
|
|
23
72
|
get children() {
|
|
24
|
-
return
|
|
73
|
+
return t.label;
|
|
25
74
|
}
|
|
26
|
-
}), e(
|
|
75
|
+
}), e(s, {
|
|
27
76
|
get children() {
|
|
28
|
-
return [e(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return r.disabled ?? !1;
|
|
34
|
-
},
|
|
35
|
-
get readOnly() {
|
|
36
|
-
return r.readOnly ?? !1;
|
|
37
|
-
},
|
|
38
|
-
get required() {
|
|
39
|
-
return r.required ?? !1;
|
|
40
|
-
},
|
|
41
|
-
get children() {
|
|
42
|
-
return e(m, {
|
|
43
|
-
get children() {
|
|
44
|
-
return [e(f, d({
|
|
45
|
-
get value() {
|
|
46
|
-
return t().state.value;
|
|
47
|
-
},
|
|
48
|
-
onInput: (l) => {
|
|
49
|
-
t().handleChange(l.target.value);
|
|
50
|
-
},
|
|
51
|
-
onBlur: () => {
|
|
52
|
-
t().handleBlur();
|
|
53
|
-
}
|
|
54
|
-
}, i)), e(s, {
|
|
55
|
-
get when() {
|
|
56
|
-
return r.showVisibilityTrigger !== !1;
|
|
57
|
-
},
|
|
58
|
-
get children() {
|
|
59
|
-
return e(b, {
|
|
60
|
-
get children() {
|
|
61
|
-
return e(w, {});
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
})];
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}), e(p, {
|
|
77
|
+
return [e(y, {
|
|
78
|
+
field: n,
|
|
79
|
+
local: t,
|
|
80
|
+
others: l
|
|
81
|
+
}), e(u, {
|
|
70
82
|
get errors() {
|
|
71
|
-
return
|
|
83
|
+
return n().state.meta.errors;
|
|
72
84
|
}
|
|
73
|
-
}), e(
|
|
85
|
+
}), e(g, {
|
|
74
86
|
get children() {
|
|
75
|
-
return
|
|
87
|
+
return t.description;
|
|
76
88
|
}
|
|
77
89
|
})];
|
|
78
90
|
}
|
|
@@ -81,6 +93,6 @@ const C = (n) => {
|
|
|
81
93
|
});
|
|
82
94
|
};
|
|
83
95
|
export {
|
|
84
|
-
|
|
96
|
+
A as PasswordInputField
|
|
85
97
|
};
|
|
86
98
|
//# sourceMappingURL=PasswordInputField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordInputField.js","sources":["../../../src/components/form/PasswordInputField.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"PasswordInputField.js","sources":["../../../src/components/form/PasswordInputField.tsx"],"sourcesContent":["import type { Component, ComponentProps, JSXElement } from 'solid-js';\n\nimport { Field, FieldLabel, FieldContent, FieldError, FieldDescription } from '@/components/Field';\nimport {\n PasswordInput,\n PasswordInputControl,\n PasswordInputInput,\n PasswordInputVisibilityTrigger,\n PasswordInputIndicator,\n} from '@/components/PasswordInput';\n\nimport { useFieldContext } from './context';\nimport { WithTrailingAddon } from './WithTrailingAddon';\n\nexport type PasswordInputFieldProps = ComponentProps<typeof PasswordInputInput> & {\n label?: string;\n description?: string;\n showVisibilityTrigger?: boolean;\n trailingAddon?: JSXElement;\n};\n\nconst PASSWORD_INPUT_FIELD_PROPS = [\n 'label',\n 'description',\n 'required',\n 'disabled',\n 'readOnly',\n 'showVisibilityTrigger',\n 'trailingAddon',\n] as const;\n\ntype PasswordInputFieldLocalProps = Pick<\n PasswordInputFieldProps,\n (typeof PASSWORD_INPUT_FIELD_PROPS)[number]\n>;\n\nconst PasswordInputFieldControl: Component<{\n field: ReturnType<typeof useFieldContext<string>>;\n local: PasswordInputFieldLocalProps;\n others: Omit<PasswordInputFieldProps, keyof PasswordInputFieldLocalProps>;\n}> = (props) => (\n <WithTrailingAddon addon={props.local.trailingAddon}>\n <PasswordInput\n invalid={props.field().state.meta.errors.length > 0}\n disabled={props.local.disabled ?? false}\n readOnly={props.local.readOnly ?? false}\n required={props.local.required ?? false}\n >\n <PasswordInputControl>\n <PasswordInputInput\n value={props.field().state.value}\n onInput={(event) => {\n props.field().handleChange(event.target.value);\n }}\n onBlur={() => {\n props.field().handleBlur();\n }}\n {...props.others}\n />\n <Show when={props.local.showVisibilityTrigger !== false}>\n <PasswordInputVisibilityTrigger>\n <PasswordInputIndicator />\n </PasswordInputVisibilityTrigger>\n </Show>\n </PasswordInputControl>\n </PasswordInput>\n </WithTrailingAddon>\n);\n\nexport const PasswordInputField: Component<PasswordInputFieldProps> = (props) => {\n const field = useFieldContext<string>();\n const [local, others] = splitProps(props, PASSWORD_INPUT_FIELD_PROPS);\n\n return (\n <Field\n invalid={field().state.meta.errors.length > 0}\n required={local.required ?? false}\n disabled={local.disabled ?? false}\n readOnly={local.readOnly ?? false}\n >\n <FieldLabel>{local.label}</FieldLabel>\n <FieldContent>\n <PasswordInputFieldControl field={field} local={local} others={others} />\n <FieldError errors={field().state.meta.errors} />\n <FieldDescription>{local.description}</FieldDescription>\n </FieldContent>\n </Field>\n );\n};\n"],"names":["PASSWORD_INPUT_FIELD_PROPS","PasswordInputFieldControl","props","_$createComponent","WithTrailingAddon","addon","local","trailingAddon","children","PasswordInput","invalid","field","state","meta","errors","length","disabled","readOnly","required","PasswordInputControl","PasswordInputInput","_$mergeProps","value","onInput","event","handleChange","target","onBlur","handleBlur","others","_$Show","when","showVisibilityTrigger","PasswordInputVisibilityTrigger","PasswordInputIndicator","PasswordInputField","useFieldContext","splitProps","Field","FieldLabel","label","FieldContent","FieldError","FieldDescription","description"],"mappings":";;;;;;AAqBA,MAAMA,IAA6B,CACjC,SACA,eACA,YACA,YACA,YACA,yBACA,eAAe,GAQXC,IAIAC,CAAAA,MAAKC,EACRC,GAAiB;AAAA,EAAA,IAACC,QAAK;AAAA,WAAEH,EAAMI,MAAMC;AAAAA,EAAa;AAAA,EAAA,IAAAC,WAAA;AAAA,WAAAL,EAChDM,GAAa;AAAA,MAAA,IACZC,UAAO;AAAA,eAAER,EAAMS,QAAQC,MAAMC,KAAKC,OAAOC,SAAS;AAAA,MAAC;AAAA,MAAA,IACnDC,WAAQ;AAAA,eAAEd,EAAMI,MAAMU,YAAY;AAAA,MAAK;AAAA,MAAA,IACvCC,WAAQ;AAAA,eAAEf,EAAMI,MAAMW,YAAY;AAAA,MAAK;AAAA,MAAA,IACvCC,WAAQ;AAAA,eAAEhB,EAAMI,MAAMY,YAAY;AAAA,MAAK;AAAA,MAAA,IAAAV,WAAA;AAAA,eAAAL,EAEtCgB,GAAoB;AAAA,UAAA,IAAAX,WAAA;AAAA,mBAAA,CAAAL,EAClBiB,GAAkB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,iBAAEF,EAAMkC;AAAAA,QAAK;AAAA,MAAA,CAAA,GAAArC,EACvBsC,GAAY;AAAA,QAAA,IAAAjC,WAAA;AAAA,iBAAA,CAAAL,EACVF,GAAyB;AAAA,YAACU,OAAAA;AAAAA,YAAcL,OAAAA;AAAAA,YAAcuB,QAAAA;AAAAA,UAAAA,CAAc,GAAA1B,EACpEuC,GAAU;AAAA,YAAA,IAAC5B,SAAM;AAAA,qBAAEH,EAAAA,EAAQC,MAAMC,KAAKC;AAAAA,YAAM;AAAA,UAAA,CAAA,GAAAX,EAC5CwC,GAAgB;AAAA,YAAA,IAAAnC,WAAA;AAAA,qBAAEF,EAAMsC;AAAAA,YAAW;AAAA,UAAA,CAAA,CAAA;AAAA,QAAA;AAAA,MAAA,CAAA,CAAA;AAAA,IAAA;AAAA,EAAA,CAAA;AAI5C;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Component, ComponentProps } from 'solid-js';
|
|
1
|
+
import { Component, ComponentProps, JSXElement } from 'solid-js';
|
|
2
2
|
import { PinInput } from '../PinInput';
|
|
3
3
|
export type PinInputFieldProps = ComponentProps<typeof PinInput> & {
|
|
4
4
|
label?: string;
|
|
5
5
|
description?: string;
|
|
6
6
|
count?: number;
|
|
7
|
+
trailingAddon?: JSXElement;
|
|
7
8
|
};
|
|
8
9
|
export declare const PinInputField: Component<PinInputFieldProps>;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { createComponent as e, mergeProps as o } from "solid-js/web";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import { createComponent as e, mergeProps as o, Index as u } from "solid-js/web";
|
|
2
|
+
import { Field as a, FieldLabel as s, FieldContent as g, FieldError as c, FieldDescription as p } from "../Field.js";
|
|
3
|
+
import { PinInput as h, PinInputHiddenInput as m, PinInputControl as f, PinInputGroup as I, PinInputInput as P } from "../PinInput.js";
|
|
4
|
+
import { useFieldContext as F } from "./context.js";
|
|
5
|
+
import { WithTrailingAddon as b } from "./WithTrailingAddon.js";
|
|
6
|
+
import { splitProps as C } from "solid-js";
|
|
7
|
+
const O = 6, y = ["label", "description", "required", "disabled", "readOnly", "count", "trailingAddon"], _ = (n) => e(f, {
|
|
7
8
|
get children() {
|
|
8
|
-
return e(
|
|
9
|
+
return e(I, {
|
|
9
10
|
get children() {
|
|
10
|
-
return e(
|
|
11
|
+
return e(u, {
|
|
11
12
|
get each() {
|
|
12
13
|
return Array.from({
|
|
13
14
|
length: n.count
|
|
14
15
|
});
|
|
15
16
|
},
|
|
16
|
-
children: (t, r) => e(
|
|
17
|
+
children: (t, r) => e(P, {
|
|
17
18
|
index: r
|
|
18
19
|
})
|
|
19
20
|
});
|
|
@@ -21,8 +22,8 @@ const C = 6, O = ["label", "description", "required", "disabled", "readOnly", "c
|
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
24
|
}), x = (n) => {
|
|
24
|
-
const t =
|
|
25
|
-
return e(
|
|
25
|
+
const t = F(), [r, l] = C(n, y), i = r.count ?? O;
|
|
26
|
+
return e(a, {
|
|
26
27
|
get invalid() {
|
|
27
28
|
return t().state.meta.errors.length > 0;
|
|
28
29
|
},
|
|
@@ -36,46 +37,53 @@ const C = 6, O = ["label", "description", "required", "disabled", "readOnly", "c
|
|
|
36
37
|
return r.required ?? !1;
|
|
37
38
|
},
|
|
38
39
|
get children() {
|
|
39
|
-
return [e(
|
|
40
|
+
return [e(s, {
|
|
40
41
|
get children() {
|
|
41
42
|
return r.label;
|
|
42
43
|
}
|
|
43
44
|
}), e(g, {
|
|
44
45
|
get children() {
|
|
45
|
-
return [e(
|
|
46
|
-
get
|
|
47
|
-
return
|
|
46
|
+
return [e(b, {
|
|
47
|
+
get addon() {
|
|
48
|
+
return r.trailingAddon;
|
|
48
49
|
},
|
|
49
|
-
onValueChange: (u) => {
|
|
50
|
-
t().handleChange(u.value);
|
|
51
|
-
},
|
|
52
|
-
onBlur: () => {
|
|
53
|
-
t().handleBlur();
|
|
54
|
-
},
|
|
55
|
-
get invalid() {
|
|
56
|
-
return t().state.meta.errors.length > 0;
|
|
57
|
-
},
|
|
58
|
-
get disabled() {
|
|
59
|
-
return r.disabled ?? !1;
|
|
60
|
-
},
|
|
61
|
-
get readOnly() {
|
|
62
|
-
return r.readOnly ?? !1;
|
|
63
|
-
},
|
|
64
|
-
get required() {
|
|
65
|
-
return r.required ?? !1;
|
|
66
|
-
},
|
|
67
|
-
count: l
|
|
68
|
-
}, i, {
|
|
69
50
|
get children() {
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
|
|
51
|
+
return e(h, o({
|
|
52
|
+
get value() {
|
|
53
|
+
return t().state.value;
|
|
54
|
+
},
|
|
55
|
+
onValueChange: (d) => {
|
|
56
|
+
t().handleChange(d.value);
|
|
57
|
+
},
|
|
58
|
+
onBlur: () => {
|
|
59
|
+
t().handleBlur();
|
|
60
|
+
},
|
|
61
|
+
get invalid() {
|
|
62
|
+
return t().state.meta.errors.length > 0;
|
|
63
|
+
},
|
|
64
|
+
get disabled() {
|
|
65
|
+
return r.disabled ?? !1;
|
|
66
|
+
},
|
|
67
|
+
get readOnly() {
|
|
68
|
+
return r.readOnly ?? !1;
|
|
69
|
+
},
|
|
70
|
+
get required() {
|
|
71
|
+
return r.required ?? !1;
|
|
72
|
+
},
|
|
73
|
+
count: i
|
|
74
|
+
}, l, {
|
|
75
|
+
get children() {
|
|
76
|
+
return [e(_, {
|
|
77
|
+
count: i
|
|
78
|
+
}), e(m, {})];
|
|
79
|
+
}
|
|
80
|
+
}));
|
|
73
81
|
}
|
|
74
|
-
})
|
|
82
|
+
}), e(c, {
|
|
75
83
|
get errors() {
|
|
76
84
|
return t().state.meta.errors;
|
|
77
85
|
}
|
|
78
|
-
}), e(
|
|
86
|
+
}), e(p, {
|
|
79
87
|
get children() {
|
|
80
88
|
return r.description;
|
|
81
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PinInputField.js","sources":["../../../src/components/form/PinInputField.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"PinInputField.js","sources":["../../../src/components/form/PinInputField.tsx"],"sourcesContent":["import type { Component, ComponentProps, JSXElement } from 'solid-js';\n\nimport { Field, FieldLabel, FieldContent, FieldError, FieldDescription } from '@/components/Field';\nimport {\n PinInput,\n PinInputControl,\n PinInputInput,\n PinInputGroup,\n PinInputHiddenInput,\n} from '@/components/PinInput';\n\nimport { useFieldContext } from './context';\nimport { WithTrailingAddon } from './WithTrailingAddon';\n\nexport type PinInputFieldProps = ComponentProps<typeof PinInput> & {\n label?: string;\n description?: string;\n count?: number;\n trailingAddon?: JSXElement;\n};\n\nconst DEFAULT_PIN_COUNT = 6;\nconst PIN_INPUT_FIELD_PROPS = [\n 'label',\n 'description',\n 'required',\n 'disabled',\n 'readOnly',\n 'count',\n 'trailingAddon',\n] as const;\n\nconst PinInputDigits: Component<{ count: number }> = (props) => (\n <PinInputControl>\n <PinInputGroup>\n <Index each={Array.from({ length: props.count })}>\n {(_, index) => <PinInputInput index={index} />}\n </Index>\n </PinInputGroup>\n </PinInputControl>\n);\n\nexport const PinInputField: Component<PinInputFieldProps> = (props) => {\n const field = useFieldContext<string[]>();\n const [local, others] = splitProps(props, PIN_INPUT_FIELD_PROPS);\n const pinCount = local.count ?? DEFAULT_PIN_COUNT;\n\n return (\n <Field\n invalid={field().state.meta.errors.length > 0}\n disabled={local.disabled ?? false}\n readOnly={local.readOnly ?? false}\n required={local.required ?? false}\n >\n <FieldLabel>{local.label}</FieldLabel>\n <FieldContent>\n <WithTrailingAddon addon={local.trailingAddon}>\n <PinInput\n value={field().state.value}\n onValueChange={(details) => {\n field().handleChange(details.value);\n }}\n onBlur={() => {\n field().handleBlur();\n }}\n invalid={field().state.meta.errors.length > 0}\n disabled={local.disabled ?? false}\n readOnly={local.readOnly ?? false}\n required={local.required ?? false}\n count={pinCount}\n {...others}\n >\n <PinInputDigits count={pinCount} />\n <PinInputHiddenInput />\n </PinInput>\n </WithTrailingAddon>\n <FieldError errors={field().state.meta.errors} />\n <FieldDescription>{local.description}</FieldDescription>\n </FieldContent>\n </Field>\n );\n};\n"],"names":["DEFAULT_PIN_COUNT","PIN_INPUT_FIELD_PROPS","PinInputDigits","props","_$createComponent","PinInputControl","children","PinInputGroup","_$Index","each","Array","from","length","count","_","index","PinInputInput","PinInputField","field","useFieldContext","local","others","splitProps","pinCount","Field","invalid","state","meta","errors","disabled","readOnly","required","FieldLabel","label","FieldContent","WithTrailingAddon","addon","trailingAddon","PinInput","_$mergeProps","value","onValueChange","details","handleChange","onBlur","handleBlur","PinInputHiddenInput","FieldError","FieldDescription","description"],"mappings":";;;;;;AAqBA,MAAMA,IAAoB,GACpBC,IAAwB,CAC5B,SACA,eACA,YACA,YACA,YACA,SACA,eAAe,GAGXC,IAAgDC,CAAAA,MAAKC,EACxDC,GAAe;AAAA,EAAA,IAAAC,WAAA;AAAA,WAAAF,EACbG,GAAa;AAAA,MAAA,IAAAD,WAAA;AAAA,eAAAF,EACXI,GAAK;AAAA,UAAA,IAACC,OAAI;AAAA,mBAAEC,MAAMC,KAAK;AAAA,cAAEC,QAAQT,EAAMU;AAAAA,YAAAA,CAAO;AAAA,UAAC;AAAA,UAAAP,UAC7CA,CAACQ,GAAGC,MAAKX,EAAMY,GAAa;AAAA,YAACD,OAAAA;AAAAA,UAAAA,CAAY;AAAA,QAAA,CAAI;AAAA,MAAA;AAAA,IAAA,CAAA;AAAA,EAAA;AAAA,CAAA,GAMzCE,IAAgDd,CAAAA,MAAU;AACrE,QAAMe,IAAQC,EAAAA,GACR,CAACC,GAAOC,CAAM,IAAIC,EAAWnB,GAAOF,CAAqB,GACzDsB,IAAWH,EAAMP,SAASb;AAEhC,SAAAI,EACGoB,GAAK;AAAA,IAAA,IACJC,UAAO;AAAA,aAAEP,EAAAA,EAAQQ,MAAMC,KAAKC,OAAOhB,SAAS;AAAA,IAAC;AAAA,IAAA,IAC7CiB,WAAQ;AA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nB,EAC9B0C,GAAmB,CAAA,CAAA,CAAA;AAAA,gBAAA;AAAA,cAAA,CAAA,CAAA;AAAA,YAAA;AAAA,UAAA,CAAA,GAAA1C,EAGvB2C,GAAU;AAAA,YAAA,IAACnB,SAAM;AAAA,qBAAEV,EAAAA,EAAQQ,MAAMC,KAAKC;AAAAA,YAAM;AAAA,UAAA,CAAA,GAAAxB,EAC5C4C,GAAgB;AAAA,YAAA,IAAA1C,WAAA;AAAA,qBAAEc,EAAM6B;AAAAA,YAAW;AAAA,UAAA,CAAA,CAAA;AAAA,QAAA;AAAA,MAAA,CAAA,CAAA;AAAA,IAAA;AAAA,EAAA,CAAA;AAI5C;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Component, ComponentProps } from 'solid-js';
|
|
1
|
+
import { Component, ComponentProps, JSXElement } from 'solid-js';
|
|
2
2
|
import { RadioGroup } from '../RadioGroup';
|
|
3
3
|
export type RadioGroupFieldProps = ComponentProps<typeof RadioGroup> & {
|
|
4
4
|
label?: string;
|
|
5
5
|
description?: string;
|
|
6
|
+
trailingAddon?: JSXElement;
|
|
6
7
|
};
|
|
7
8
|
export declare const RadioGroupField: Component<RadioGroupFieldProps>;
|