react-science 19.7.0 → 19.8.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/lib/components/form/components/field_groups/svg_line_style.d.ts +8 -8
- package/lib/components/form/components/field_groups/svg_line_style.d.ts.map +1 -1
- package/lib/components/form/components/field_groups/svg_line_style.js +1 -6
- package/lib/components/form/components/field_groups/svg_line_style.js.map +1 -1
- package/lib/components/form/components/field_groups/svg_line_style.schema.d.ts +5 -5
- package/lib/components/form/components/field_groups/svg_line_style.schema.d.ts.map +1 -1
- package/lib/components/form/components/field_groups/svg_line_style.schema.js +7 -3
- package/lib/components/form/components/field_groups/svg_line_style.schema.js.map +1 -1
- package/lib/components/form/components/field_groups/svg_text_style.d.ts +8 -8
- package/lib/components/form/components/field_groups/svg_text_style.d.ts.map +1 -1
- package/lib/components/form/components/field_groups/svg_text_style.js +3 -7
- package/lib/components/form/components/field_groups/svg_text_style.js.map +1 -1
- package/lib/components/form/components/field_groups/svg_text_style.schema.d.ts +6 -6
- package/lib/components/form/components/field_groups/svg_text_style.schema.d.ts.map +1 -1
- package/lib/components/form/components/field_groups/svg_text_style.schema.js +8 -4
- package/lib/components/form/components/field_groups/svg_text_style.schema.js.map +1 -1
- package/lib/components/form/components/input/index.d.ts +9 -0
- package/lib/components/form/components/input/index.d.ts.map +1 -0
- package/lib/components/form/components/input/index.js +2 -0
- package/lib/components/form/components/input/index.js.map +1 -0
- package/lib/components/form/components/layout/index.d.ts +2 -0
- package/lib/components/form/components/layout/index.d.ts.map +1 -0
- package/lib/components/form/components/layout/index.js +2 -0
- package/lib/components/form/components/layout/index.js.map +1 -0
- package/lib/components/form/utils/validators.d.ts +16 -0
- package/lib/components/form/utils/validators.d.ts.map +1 -0
- package/lib/components/form/utils/validators.js +26 -0
- package/lib/components/form/utils/validators.js.map +1 -0
- package/lib/components/index.d.ts +3 -1
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +3 -1
- package/lib/components/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/form/components/field_groups/svg_line_style.schema.ts +8 -4
- package/src/components/form/components/field_groups/svg_line_style.tsx +1 -6
- package/src/components/form/components/field_groups/svg_text_style.schema.ts +9 -4
- package/src/components/form/components/field_groups/svg_text_style.tsx +3 -7
- package/src/components/form/components/input/index.tsx +8 -0
- package/src/components/form/components/layout/index.tsx +1 -0
- package/src/components/form/utils/validators.ts +45 -0
- package/src/components/index.ts +3 -1
|
@@ -2,15 +2,15 @@ export interface SVGLineStyleFieldsProps {
|
|
|
2
2
|
label: string;
|
|
3
3
|
}
|
|
4
4
|
export declare const FieldGroupSVGLineStyleFields: <TFormData, TFields extends import("@tanstack/form-core").DeepKeysOfType<TFormData, {
|
|
5
|
-
stroke
|
|
6
|
-
strokeOpacity
|
|
7
|
-
strokeWidth
|
|
8
|
-
strokeDasharray
|
|
5
|
+
stroke?: string | undefined;
|
|
6
|
+
strokeOpacity?: string | undefined;
|
|
7
|
+
strokeWidth?: string | undefined;
|
|
8
|
+
strokeDasharray?: "solid" | "dashed" | "dotted" | "dashed-dot" | undefined;
|
|
9
9
|
} | null | undefined> | {
|
|
10
|
-
stroke
|
|
11
|
-
strokeOpacity
|
|
12
|
-
strokeWidth
|
|
13
|
-
strokeDasharray
|
|
10
|
+
stroke?: import("@tanstack/form-core").DeepKeysOfType<TFormData, string | undefined> | undefined;
|
|
11
|
+
strokeOpacity?: import("@tanstack/form-core").DeepKeysOfType<TFormData, string | undefined> | undefined;
|
|
12
|
+
strokeWidth?: import("@tanstack/form-core").DeepKeysOfType<TFormData, string | undefined> | undefined;
|
|
13
|
+
strokeDasharray?: import("@tanstack/form-core").DeepKeysOfType<TFormData, "solid" | "dashed" | "dotted" | "dashed-dot" | undefined> | undefined;
|
|
14
14
|
}, TOnMount extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnChange extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnChangeAsync extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TOnBlur extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnBlurAsync extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TOnSubmit extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnSubmitAsync extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TOnDynamic extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnDynamicAsync extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TOnServer extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TFormSubmitMeta>(params: import("react").PropsWithChildren<NoInfer<SVGLineStyleFieldsProps> & {
|
|
15
15
|
form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TFormSubmitMeta, {
|
|
16
16
|
readonly Input: typeof import("../input/input.tsx").Input;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg_line_style.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_line_style.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"svg_line_style.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_line_style.tsx"],"names":[],"mappings":"AAuBA,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;CACf;AAaD,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAqCvC,CAAC"}
|
|
@@ -8,12 +8,7 @@ import { Fieldset, Legend } from './fieldset.js';
|
|
|
8
8
|
import { svgLineStyleFieldsSchema } from './svg_line_style.schema.js';
|
|
9
9
|
// https://tanstack.com/form/latest/docs/framework/react/guides/form-composition#reusing-groups-of-fields-in-multiple-forms
|
|
10
10
|
// Default values are not used at runtime (same for props).
|
|
11
|
-
const defaultValues = {
|
|
12
|
-
stroke: '#000000',
|
|
13
|
-
strokeOpacity: '1',
|
|
14
|
-
strokeWidth: '1',
|
|
15
|
-
strokeDasharray: 'solid',
|
|
16
|
-
};
|
|
11
|
+
const defaultValues = {};
|
|
17
12
|
const inferSVGLineStyleFieldsProps = {
|
|
18
13
|
label: '',
|
|
19
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg_line_style.js","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_line_style.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAI7B,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAItE,2HAA2H;AAC3H,2DAA2D;AAC3D,MAAM,aAAa,GAAuB
|
|
1
|
+
{"version":3,"file":"svg_line_style.js","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_line_style.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAI7B,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,M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C,EACjB,KAAC,KAAK,CAAC,QAAQ,IAAC,IAAI,EAAC,iBAAiB,YACnC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAC,KAAK,CAAC,MAAM,IAAC,KAAK,EAAC,OAAO,EAAC,KAAK,EAAE,eAAe,GAAI,GACnD,EAEjB,KAAC,SAAS,IAAC,KAAK,EAAC,SAAS,YACxB,KAAC,KAAK,CAAC,SAAS,IAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,YAC/C,CAAC,MAAM,EAAE,EAAE,CAAC,KAAC,qBAAqB,OAAK,MAAM,GAAI,GAClC,GACR,IACH,CACZ,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,8BAA8B,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIhD,CAAC;AAEF,MAAM,qBAAqB,GAAG,IAAI,CAAC,SAAS,qBAAqB,CAC/D,KAAyB;IAEzB,MAAM,YAAY,GAAG,wBAAwB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAE3D,OAAO,CACL,KAAC,8BAA8B,cAC7B,cAAK,OAAO,EAAC,YAAY,YACvB,KAAC,aAAa,IACZ,EAAE,EAAE,CAAC,EACL,EAAE,EAAE,GAAG,EACP,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,KACF,YAAY,EAChB,OAAO,EAAE,CAAC,GACV,GACE,GACyB,CAClC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const svgLineStyleFieldsSchema: z.ZodObject<{
|
|
3
|
-
stroke: z.ZodString
|
|
4
|
-
strokeOpacity: z.
|
|
5
|
-
strokeWidth: z.
|
|
6
|
-
strokeDasharray: z.ZodEnum<{
|
|
3
|
+
stroke: z.ZodOptional<z.ZodString>;
|
|
4
|
+
strokeOpacity: z.ZodCodec<z.ZodOptional<z.ZodString>, z.ZodOptional<z.ZodNumber>>;
|
|
5
|
+
strokeWidth: z.ZodCodec<z.ZodOptional<z.ZodString>, z.ZodOptional<z.ZodNumber>>;
|
|
6
|
+
strokeDasharray: z.ZodOptional<z.ZodEnum<{
|
|
7
7
|
readonly solid: "solid";
|
|
8
8
|
readonly dashed: "dashed";
|
|
9
9
|
readonly dotted: "dotted";
|
|
10
10
|
readonly 'dashed-dot': "dashed-dot";
|
|
11
|
-
}
|
|
11
|
+
}>>;
|
|
12
12
|
}, z.core.$strip>;
|
|
13
13
|
//# sourceMappingURL=svg_line_style.schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg_line_style.schema.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_line_style.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"svg_line_style.schema.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_line_style.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,wBAAwB;;;;;;;;;;iBAanC,CAAC"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { SVGStyledLineStrokePattern } from '../../../svg/index.js';
|
|
3
|
+
import { stringToNumberOptional } from "../../utils/validators.js";
|
|
3
4
|
export const svgLineStyleFieldsSchema = z.object({
|
|
4
5
|
stroke: z
|
|
5
6
|
.string()
|
|
6
7
|
.trim()
|
|
7
8
|
.regex(/^#[0-9a-fA-F]{6}$/, {
|
|
8
9
|
message: 'Color must be hexadecimal and should not contain alpha',
|
|
10
|
+
})
|
|
11
|
+
.optional(),
|
|
12
|
+
strokeOpacity: stringToNumberOptional({
|
|
13
|
+
numSchema: z.number().min(0).max(1),
|
|
9
14
|
}),
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
strokeDasharray: z.enum(SVGStyledLineStrokePattern),
|
|
15
|
+
strokeWidth: stringToNumberOptional(),
|
|
16
|
+
strokeDasharray: z.enum(SVGStyledLineStrokePattern).optional(),
|
|
13
17
|
});
|
|
14
18
|
//# sourceMappingURL=svg_line_style.schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg_line_style.schema.js","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_line_style.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,IAAI,EAAE;SACN,KAAK,CAAC,mBAAmB,EAAE;QAC1B,OAAO,EAAE,wDAAwD;KAClE,CAAC;
|
|
1
|
+
{"version":3,"file":"svg_line_style.schema.js","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_line_style.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,IAAI,EAAE;SACN,KAAK,CAAC,mBAAmB,EAAE;QAC1B,OAAO,EAAE,wDAAwD;KAClE,CAAC;SACD,QAAQ,EAAE;IACb,aAAa,EAAE,sBAAsB,CAAC;QACpC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;KACpC,CAAC;IACF,WAAW,EAAE,sBAAsB,EAAE;IACrC,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,QAAQ,EAAE;CAC/D,CAAC,CAAC"}
|
|
@@ -3,15 +3,15 @@ export interface SVGTextStyleFieldsProps {
|
|
|
3
3
|
previewText?: string;
|
|
4
4
|
}
|
|
5
5
|
export declare const FieldGroupSVGTextStyleFields: <TFormData, TFields extends import("@tanstack/form-core").DeepKeysOfType<TFormData, {
|
|
6
|
-
fill
|
|
7
|
-
fontSize
|
|
8
|
-
fontStyle
|
|
9
|
-
fontWeight
|
|
6
|
+
fill?: string | undefined;
|
|
7
|
+
fontSize?: string | undefined;
|
|
8
|
+
fontStyle?: "italic" | "normal" | undefined;
|
|
9
|
+
fontWeight?: "bold" | "normal" | undefined;
|
|
10
10
|
} | null | undefined> | {
|
|
11
|
-
fill
|
|
12
|
-
fontSize
|
|
13
|
-
fontStyle
|
|
14
|
-
fontWeight
|
|
11
|
+
fill?: import("@tanstack/form-core").DeepKeysOfType<TFormData, string | undefined> | undefined;
|
|
12
|
+
fontSize?: import("@tanstack/form-core").DeepKeysOfType<TFormData, string | undefined> | undefined;
|
|
13
|
+
fontStyle?: import("@tanstack/form-core").DeepKeysOfType<TFormData, "italic" | "normal" | undefined> | undefined;
|
|
14
|
+
fontWeight?: import("@tanstack/form-core").DeepKeysOfType<TFormData, "bold" | "normal" | undefined> | undefined;
|
|
15
15
|
}, TOnMount extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnChange extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnChangeAsync extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TOnBlur extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnBlurAsync extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TOnSubmit extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnSubmitAsync extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TOnDynamic extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnDynamicAsync extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TOnServer extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TFormSubmitMeta>(params: import("react").PropsWithChildren<NoInfer<SVGTextStyleFieldsProps> & {
|
|
16
16
|
form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TFormSubmitMeta, {
|
|
17
17
|
readonly Input: typeof import("../input/input.tsx").Input;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg_text_style.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_text_style.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"svg_text_style.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_text_style.tsx"],"names":[],"mappings":"AAyBA,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDA4DvC,CAAC"}
|
|
@@ -14,12 +14,7 @@ const TextStyleSwitchContainer = styled.div `
|
|
|
14
14
|
`;
|
|
15
15
|
// https://tanstack.com/form/latest/docs/framework/react/guides/form-composition#reusing-groups-of-fields-in-multiple-forms
|
|
16
16
|
// Default values are not used at runtime (same for props).
|
|
17
|
-
const defaultValues = {
|
|
18
|
-
fill: '#000000',
|
|
19
|
-
fontSize: '16',
|
|
20
|
-
fontStyle: 'normal',
|
|
21
|
-
fontWeight: 'normal',
|
|
22
|
-
};
|
|
17
|
+
const defaultValues = {};
|
|
23
18
|
const inferSVGTextStyleFieldsProps = {
|
|
24
19
|
label: '',
|
|
25
20
|
};
|
|
@@ -37,7 +32,8 @@ const TextStyleFieldPreviewContainer = styled.div `
|
|
|
37
32
|
`;
|
|
38
33
|
const TextStyleFieldPreview = memo(function TextStyleFieldPreview(props) {
|
|
39
34
|
const parsedValues = svgTextStyleFieldsSchema.parse(props);
|
|
40
|
-
const
|
|
35
|
+
const fontSize = parsedValues.fontSize ?? 16;
|
|
36
|
+
const svgHeight = Math.round(fontSize * 1.5);
|
|
41
37
|
const textY = Math.round(svgHeight / 4);
|
|
42
38
|
return (_jsx(TextStyleFieldPreviewContainer, { children: _jsx("svg", { height: svgHeight, width: "auto", children: _jsx(SVGStyledText, { dominantBaseline: "hanging", x: 0, y: textY, ...parsedValues, children: props.children }) }) }));
|
|
43
39
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg_text_style.js","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_text_style.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAG7B,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAI1C,CAAC;AAIF,2HAA2H;AAC3H,2DAA2D;AAC3D,MAAM,aAAa,GAAuB
|
|
1
|
+
{"version":3,"file":"svg_text_style.js","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_text_style.tsx"],"names":[],"mappings":";AAAA,OA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: z.ZodObject<{
|
|
3
|
-
fill: z.ZodString
|
|
4
|
-
fontSize: z.
|
|
5
|
-
fontStyle: z.ZodEnum<{
|
|
3
|
+
fill: z.ZodOptional<z.ZodString>;
|
|
4
|
+
fontSize: z.ZodCodec<z.ZodOptional<z.ZodString>, z.ZodOptional<z.ZodInt>>;
|
|
5
|
+
fontStyle: z.ZodOptional<z.ZodEnum<{
|
|
6
6
|
italic: "italic";
|
|
7
7
|
normal: "normal";
|
|
8
|
-
}
|
|
9
|
-
fontWeight: z.ZodEnum<{
|
|
8
|
+
}>>;
|
|
9
|
+
fontWeight: z.ZodOptional<z.ZodEnum<{
|
|
10
10
|
bold: "bold";
|
|
11
11
|
normal: "normal";
|
|
12
|
-
}
|
|
12
|
+
}>>;
|
|
13
13
|
}, z.core.$strip>;
|
|
14
14
|
//# sourceMappingURL=svg_text_style.schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg_text_style.schema.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_text_style.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"svg_text_style.schema.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_text_style.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,wBAAwB;;;;;;;;;;;iBAQnC,CAAC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { stringToNumberOptional } from "../../utils/validators.js";
|
|
2
3
|
export const svgTextStyleFieldsSchema = z.object({
|
|
3
|
-
fill: z.string(),
|
|
4
|
-
fontSize:
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
fill: z.string().optional(),
|
|
5
|
+
fontSize: stringToNumberOptional({
|
|
6
|
+
numSchema: z.int().min(0),
|
|
7
|
+
parse: (str) => Number.parseInt(str, 10),
|
|
8
|
+
}),
|
|
9
|
+
fontStyle: z.enum(['normal', 'italic']).optional(),
|
|
10
|
+
fontWeight: z.enum(['normal', 'bold']).optional(),
|
|
7
11
|
});
|
|
8
12
|
//# sourceMappingURL=svg_text_style.schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg_text_style.schema.js","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_text_style.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;
|
|
1
|
+
{"version":3,"file":"svg_text_style.schema.js","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_text_style.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,QAAQ,EAAE,sBAAsB,CAAC;QAC/B,SAAS,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACzB,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC;KACzC,CAAC;IACF,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE;IAClD,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE;CAClD,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { type Checkbox as _Checkbox } from './checkbox.js';
|
|
2
|
+
export { type ColorPicker as _ColorPicker } from './color_picker.js';
|
|
3
|
+
export { type Input as _Input } from './input.js';
|
|
4
|
+
export { type NumericInput as _NumericInput } from './numeric_input.js';
|
|
5
|
+
export { type ResetButton as _ResetButton } from './reset_button.js';
|
|
6
|
+
export { type Select as _Select } from './select.js';
|
|
7
|
+
export { type SubmitButton as _SubmitButton } from './submit_button.js';
|
|
8
|
+
export { type Switch as _Switch } from './switch.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,IAAI,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,KAAK,WAAW,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,KAAK,KAAK,IAAI,MAAM,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,KAAK,YAAY,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,KAAK,WAAW,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,KAAK,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,KAAK,YAAY,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,KAAK,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input/index.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/layout/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/form/components/layout/index.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ZodCodec, ZodNumber, ZodOptional, ZodString } from 'zod';
|
|
2
|
+
interface StringToNumberOptionalOptions<Str extends ZodString, Num extends ZodNumber> {
|
|
3
|
+
/** @default z.string() */
|
|
4
|
+
strSchema?: Str;
|
|
5
|
+
/** @default z.number() */
|
|
6
|
+
numSchema?: Num;
|
|
7
|
+
/** @default Number */
|
|
8
|
+
parse?: (str: string) => number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The purpose is to replace `z.coerce.number().optional()` without coercing undefined to `0`
|
|
12
|
+
* @param options
|
|
13
|
+
*/
|
|
14
|
+
export declare function stringToNumberOptional<Str extends ZodString = ZodString, Num extends ZodNumber = ZodNumber>(options?: StringToNumberOptionalOptions<Str, Num>): ZodCodec<ZodOptional<Str>, ZodOptional<Num>>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../../src/components/form/utils/validators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAGvE,UAAU,6BAA6B,CACrC,GAAG,SAAS,SAAS,EACrB,GAAG,SAAS,SAAS;IAErB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,sBAAsB;IACtB,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,SAAS,SAAS,GAAG,SAAS,EACjC,GAAG,SAAS,SAAS,GAAG,SAAS,EAEjC,OAAO,GAAE,6BAA6B,CAAC,GAAG,EAAE,GAAG,CAAM,GACpD,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAoB9C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The purpose is to replace `z.coerce.number().optional()` without coercing undefined to `0`
|
|
4
|
+
* @param options
|
|
5
|
+
*/
|
|
6
|
+
export function stringToNumberOptional(options = {}) {
|
|
7
|
+
const strSchema = options?.strSchema ?? z.string();
|
|
8
|
+
const numSchema = options?.numSchema ?? z.number();
|
|
9
|
+
const parse = options?.parse ?? Number;
|
|
10
|
+
return z.codec(strSchema.optional(), numSchema.optional(), {
|
|
11
|
+
encode: (num) => {
|
|
12
|
+
if (num === undefined)
|
|
13
|
+
return undefined;
|
|
14
|
+
return String(num);
|
|
15
|
+
},
|
|
16
|
+
decode: (str) => {
|
|
17
|
+
if (!str)
|
|
18
|
+
return undefined;
|
|
19
|
+
const value = parse(str);
|
|
20
|
+
if (Number.isNaN(value))
|
|
21
|
+
return undefined;
|
|
22
|
+
return value;
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../../src/components/form/utils/validators.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAIpC,UAAmD,EAAE;IAErD,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,IAAK,CAAC,CAAC,MAAM,EAAU,CAAC;IAC5D,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,IAAK,CAAC,CAAC,MAAM,EAAU,CAAC;IAC5D,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,MAAM,CAAC;IAEvC,OAAO,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,CAAC,QAAQ,EAAE,EAAE;QACzD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE;YACd,IAAI,GAAG,KAAK,SAAS;gBAAE,OAAO,SAAS,CAAC;YAExC,OAAO,MAAM,CAAC,GAAG,CAA+B,CAAC;QACnD,CAAC;QACD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE;YACd,IAAI,CAAC,GAAG;gBAAE,OAAO,SAAS,CAAC;YAE3B,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;YACzB,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;gBAAE,OAAO,SAAS,CAAC;YAE1C,OAAO,KAAkC,CAAC;QAC5C,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -14,9 +14,11 @@ export * from './root-layout/index.js';
|
|
|
14
14
|
export * from './split_pane/index.js';
|
|
15
15
|
export * from './table/index.js';
|
|
16
16
|
export * from './toolbar/index.js';
|
|
17
|
-
export * from './form/context/use_ts_form.js';
|
|
18
17
|
export * from './form/components/field_groups/index.js';
|
|
19
18
|
export * from './form/components/input_groups/index.js';
|
|
19
|
+
export * from './form/components/input/index.js';
|
|
20
|
+
export * from './form/components/layout/index.js';
|
|
21
|
+
export * from './form/context/use_ts_form.js';
|
|
20
22
|
export * from './activity_bar/index.js';
|
|
21
23
|
export * from './activity_panel/index.js';
|
|
22
24
|
export * from './utils/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CA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
package/lib/components/index.js
CHANGED
|
@@ -14,9 +14,11 @@ export * from './root-layout/index.js';
|
|
|
14
14
|
export * from './split_pane/index.js';
|
|
15
15
|
export * from './table/index.js';
|
|
16
16
|
export * from './toolbar/index.js';
|
|
17
|
-
export * from './form/context/use_ts_form.js';
|
|
18
17
|
export * from './form/components/field_groups/index.js';
|
|
19
18
|
export * from './form/components/input_groups/index.js';
|
|
19
|
+
export * from './form/components/input/index.js';
|
|
20
|
+
export * from './form/components/layout/index.js';
|
|
21
|
+
export * from './form/context/use_ts_form.js';
|
|
20
22
|
export * from './activity_bar/index.js';
|
|
21
23
|
export * from './activity_panel/index.js';
|
|
22
24
|
export * from './utils/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yCAAyC,CAAC;AACxD,cAAc,yCAAyC,CAAC;AACxD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
import { SVGStyledLineStrokePattern } from '../../../svg/index.js';
|
|
4
|
+
import { stringToNumberOptional } from '../../utils/validators.ts';
|
|
4
5
|
|
|
5
6
|
export const svgLineStyleFieldsSchema = z.object({
|
|
6
7
|
stroke: z
|
|
@@ -8,8 +9,11 @@ export const svgLineStyleFieldsSchema = z.object({
|
|
|
8
9
|
.trim()
|
|
9
10
|
.regex(/^#[0-9a-fA-F]{6}$/, {
|
|
10
11
|
message: 'Color must be hexadecimal and should not contain alpha',
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
})
|
|
13
|
+
.optional(),
|
|
14
|
+
strokeOpacity: stringToNumberOptional({
|
|
15
|
+
numSchema: z.number().min(0).max(1),
|
|
16
|
+
}),
|
|
17
|
+
strokeWidth: stringToNumberOptional(),
|
|
18
|
+
strokeDasharray: z.enum(SVGStyledLineStrokePattern).optional(),
|
|
15
19
|
});
|
|
@@ -14,12 +14,7 @@ type SvgLineStyleFields = z.input<typeof svgLineStyleFieldsSchema>;
|
|
|
14
14
|
|
|
15
15
|
// https://tanstack.com/form/latest/docs/framework/react/guides/form-composition#reusing-groups-of-fields-in-multiple-forms
|
|
16
16
|
// Default values are not used at runtime (same for props).
|
|
17
|
-
const defaultValues: SvgLineStyleFields = {
|
|
18
|
-
stroke: '#000000',
|
|
19
|
-
strokeOpacity: '1',
|
|
20
|
-
strokeWidth: '1',
|
|
21
|
-
strokeDasharray: 'solid',
|
|
22
|
-
};
|
|
17
|
+
const defaultValues: SvgLineStyleFields = {};
|
|
23
18
|
|
|
24
19
|
interface PatternsOptionType {
|
|
25
20
|
label: string;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
+
import { stringToNumberOptional } from '../../utils/validators.ts';
|
|
4
|
+
|
|
3
5
|
export const svgTextStyleFieldsSchema = z.object({
|
|
4
|
-
fill: z.string(),
|
|
5
|
-
fontSize:
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
fill: z.string().optional(),
|
|
7
|
+
fontSize: stringToNumberOptional({
|
|
8
|
+
numSchema: z.int().min(0),
|
|
9
|
+
parse: (str) => Number.parseInt(str, 10),
|
|
10
|
+
}),
|
|
11
|
+
fontStyle: z.enum(['normal', 'italic']).optional(),
|
|
12
|
+
fontWeight: z.enum(['normal', 'bold']).optional(),
|
|
8
13
|
});
|
|
@@ -21,12 +21,7 @@ type SvgTextStyleFields = z.input<typeof svgTextStyleFieldsSchema>;
|
|
|
21
21
|
|
|
22
22
|
// https://tanstack.com/form/latest/docs/framework/react/guides/form-composition#reusing-groups-of-fields-in-multiple-forms
|
|
23
23
|
// Default values are not used at runtime (same for props).
|
|
24
|
-
const defaultValues: SvgTextStyleFields = {
|
|
25
|
-
fill: '#000000',
|
|
26
|
-
fontSize: '16',
|
|
27
|
-
fontStyle: 'normal',
|
|
28
|
-
fontWeight: 'normal',
|
|
29
|
-
};
|
|
24
|
+
const defaultValues: SvgTextStyleFields = {};
|
|
30
25
|
|
|
31
26
|
export interface SVGTextStyleFieldsProps {
|
|
32
27
|
label: string;
|
|
@@ -113,7 +108,8 @@ const TextStyleFieldPreview = memo(function TextStyleFieldPreview(
|
|
|
113
108
|
props: TextStyleFieldPreviewProps,
|
|
114
109
|
) {
|
|
115
110
|
const parsedValues = svgTextStyleFieldsSchema.parse(props);
|
|
116
|
-
const
|
|
111
|
+
const fontSize = parsedValues.fontSize ?? 16;
|
|
112
|
+
const svgHeight = Math.round(fontSize * 1.5);
|
|
117
113
|
const textY = Math.round(svgHeight / 4);
|
|
118
114
|
|
|
119
115
|
return (
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { type Checkbox as _Checkbox } from './checkbox.js';
|
|
2
|
+
export { type ColorPicker as _ColorPicker } from './color_picker.js';
|
|
3
|
+
export { type Input as _Input } from './input.js';
|
|
4
|
+
export { type NumericInput as _NumericInput } from './numeric_input.js';
|
|
5
|
+
export { type ResetButton as _ResetButton } from './reset_button.js';
|
|
6
|
+
export { type Select as _Select } from './select.js';
|
|
7
|
+
export { type SubmitButton as _SubmitButton } from './submit_button.js';
|
|
8
|
+
export { type Switch as _Switch } from './switch.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type Section as _Section } from './Section.js';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ZodCodec, ZodNumber, ZodOptional, ZodString } from 'zod';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
interface StringToNumberOptionalOptions<
|
|
5
|
+
Str extends ZodString,
|
|
6
|
+
Num extends ZodNumber,
|
|
7
|
+
> {
|
|
8
|
+
/** @default z.string() */
|
|
9
|
+
strSchema?: Str;
|
|
10
|
+
/** @default z.number() */
|
|
11
|
+
numSchema?: Num;
|
|
12
|
+
/** @default Number */
|
|
13
|
+
parse?: (str: string) => number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The purpose is to replace `z.coerce.number().optional()` without coercing undefined to `0`
|
|
18
|
+
* @param options
|
|
19
|
+
*/
|
|
20
|
+
export function stringToNumberOptional<
|
|
21
|
+
Str extends ZodString = ZodString,
|
|
22
|
+
Num extends ZodNumber = ZodNumber,
|
|
23
|
+
>(
|
|
24
|
+
options: StringToNumberOptionalOptions<Str, Num> = {},
|
|
25
|
+
): ZodCodec<ZodOptional<Str>, ZodOptional<Num>> {
|
|
26
|
+
const strSchema = options?.strSchema ?? (z.string() as Str);
|
|
27
|
+
const numSchema = options?.numSchema ?? (z.number() as Num);
|
|
28
|
+
const parse = options?.parse ?? Number;
|
|
29
|
+
|
|
30
|
+
return z.codec(strSchema.optional(), numSchema.optional(), {
|
|
31
|
+
encode: (num) => {
|
|
32
|
+
if (num === undefined) return undefined;
|
|
33
|
+
|
|
34
|
+
return String(num) as z.output<ZodOptional<Str>>;
|
|
35
|
+
},
|
|
36
|
+
decode: (str) => {
|
|
37
|
+
if (!str) return undefined;
|
|
38
|
+
|
|
39
|
+
const value = parse(str);
|
|
40
|
+
if (Number.isNaN(value)) return undefined;
|
|
41
|
+
|
|
42
|
+
return value as z.input<ZodOptional<Num>>;
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
}
|
package/src/components/index.ts
CHANGED
|
@@ -14,9 +14,11 @@ export * from './root-layout/index.js';
|
|
|
14
14
|
export * from './split_pane/index.js';
|
|
15
15
|
export * from './table/index.js';
|
|
16
16
|
export * from './toolbar/index.js';
|
|
17
|
-
export * from './form/context/use_ts_form.js';
|
|
18
17
|
export * from './form/components/field_groups/index.js';
|
|
19
18
|
export * from './form/components/input_groups/index.js';
|
|
19
|
+
export * from './form/components/input/index.js';
|
|
20
|
+
export * from './form/components/layout/index.js';
|
|
21
|
+
export * from './form/context/use_ts_form.js';
|
|
20
22
|
export * from './activity_bar/index.js';
|
|
21
23
|
export * from './activity_panel/index.js';
|
|
22
24
|
export * from './utils/index.js';
|