@pathscale/ui 1.1.62 → 1.1.64
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/_shared/index.d.ts +1 -0
- package/dist/components/_shared/index.js +3 -0
- package/dist/components/_shared/overlayPosition.d.ts +19 -0
- package/dist/components/_shared/overlayPosition.js +115 -0
- package/dist/components/dropdown/Dropdown.css +36 -7
- package/dist/components/dropdown/Dropdown.d.ts +7 -1
- package/dist/components/dropdown/Dropdown.js +84 -40
- package/dist/components/dropdown/index.d.ts +1 -1
- package/dist/components/popover/Popover.css +10 -18
- package/dist/components/popover/Popover.d.ts +3 -1
- package/dist/components/popover/Popover.js +70 -37
- package/dist/components/select/Select.css +38 -4
- package/dist/components/select/Select.d.ts +4 -0
- package/dist/components/select/Select.js +75 -20
- package/dist/components/select/index.d.ts +1 -1
- package/dist/components/theme-color-picker/ThemeColorPicker.classes.d.ts +1 -1
- package/dist/components/theme-color-picker/ThemeColorPicker.classes.js +1 -1
- package/dist/components/theme-color-picker/ThemeColorPicker.d.ts +12 -0
- package/dist/components/theme-color-picker/ThemeColorPicker.js +76 -49
- package/dist/components/theme-color-picker/index.d.ts +1 -1
- package/dist/hooks/form/createForm.d.ts +3 -2
- package/dist/hooks/form/createForm.js +77 -2
- package/dist/purge-manifest.json +2462 -2452
- package/dist/styles/icons/generated-icons.css +63 -1
- package/package.json +2 -2
|
@@ -10,8 +10,9 @@ export type CreateFormOptions<TValues extends AnyValues = AnyValues> = {
|
|
|
10
10
|
*/
|
|
11
11
|
defaultValues: TValues;
|
|
12
12
|
/**
|
|
13
|
-
* Any Standard Schema-compatible schema (Zod, Valibot, Arktype,
|
|
14
|
-
* Applied as `validators.
|
|
13
|
+
* Any Standard Schema-compatible schema (Zod, Valibot, Arktype, ...).
|
|
14
|
+
* Applied as `validators.onChange`, `validators.onBlur` and
|
|
15
|
+
* `validators.onSubmit`.
|
|
15
16
|
*/
|
|
16
17
|
schema?: StandardSchemaV1<TValues>;
|
|
17
18
|
/**
|
|
@@ -1,12 +1,87 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE__tanstack_solid_form_5af81884__ from "@tanstack/solid-form";
|
|
2
|
+
const createValidationLogic = (props)=>{
|
|
3
|
+
if (!props.validators) return props.runValidation({
|
|
4
|
+
validators: [],
|
|
5
|
+
form: props.form
|
|
6
|
+
});
|
|
7
|
+
const isAsync = props.event.async;
|
|
8
|
+
const onMountValidator = isAsync ? void 0 : {
|
|
9
|
+
fn: props.validators.onMount,
|
|
10
|
+
cause: "mount"
|
|
11
|
+
};
|
|
12
|
+
const onChangeValidator = {
|
|
13
|
+
fn: isAsync ? props.validators.onChangeAsync : props.validators.onChange,
|
|
14
|
+
cause: "change"
|
|
15
|
+
};
|
|
16
|
+
const onBlurValidator = {
|
|
17
|
+
fn: isAsync ? props.validators.onBlurAsync : props.validators.onBlur,
|
|
18
|
+
cause: "blur"
|
|
19
|
+
};
|
|
20
|
+
const onSubmitValidator = {
|
|
21
|
+
fn: isAsync ? props.validators.onSubmitAsync : props.validators.onSubmit,
|
|
22
|
+
cause: "submit"
|
|
23
|
+
};
|
|
24
|
+
const onServerValidator = isAsync ? void 0 : {
|
|
25
|
+
fn: ()=>void 0,
|
|
26
|
+
cause: "server"
|
|
27
|
+
};
|
|
28
|
+
switch(props.event.type){
|
|
29
|
+
case "mount":
|
|
30
|
+
return props.runValidation({
|
|
31
|
+
validators: [
|
|
32
|
+
onMountValidator
|
|
33
|
+
],
|
|
34
|
+
form: props.form
|
|
35
|
+
});
|
|
36
|
+
case "submit":
|
|
37
|
+
return props.runValidation({
|
|
38
|
+
validators: [
|
|
39
|
+
onChangeValidator,
|
|
40
|
+
onBlurValidator,
|
|
41
|
+
onSubmitValidator,
|
|
42
|
+
onServerValidator
|
|
43
|
+
],
|
|
44
|
+
form: props.form
|
|
45
|
+
});
|
|
46
|
+
case "server":
|
|
47
|
+
return props.runValidation({
|
|
48
|
+
validators: [],
|
|
49
|
+
form: props.form
|
|
50
|
+
});
|
|
51
|
+
case "blur":
|
|
52
|
+
return props.runValidation({
|
|
53
|
+
validators: [
|
|
54
|
+
onBlurValidator,
|
|
55
|
+
onServerValidator
|
|
56
|
+
],
|
|
57
|
+
form: props.form
|
|
58
|
+
});
|
|
59
|
+
case "change":
|
|
60
|
+
return props.runValidation({
|
|
61
|
+
validators: [
|
|
62
|
+
onChangeValidator,
|
|
63
|
+
onBlurValidator,
|
|
64
|
+
onServerValidator
|
|
65
|
+
],
|
|
66
|
+
form: props.form
|
|
67
|
+
});
|
|
68
|
+
default:
|
|
69
|
+
throw new Error(`Unknown validation event type: ${props.event.type}`);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
2
72
|
const createForm = (options)=>{
|
|
73
|
+
const hasSchema = Boolean(options.schema);
|
|
74
|
+
const hasAsyncValidators = Boolean(options.asyncValidators);
|
|
3
75
|
const tsForm = (0, __WEBPACK_EXTERNAL_MODULE__tanstack_solid_form_5af81884__.createForm)(()=>({
|
|
4
76
|
defaultValues: options.defaultValues,
|
|
5
|
-
validators:
|
|
77
|
+
validators: hasSchema || hasAsyncValidators ? {
|
|
6
78
|
onChange: options.schema,
|
|
7
79
|
onBlur: options.schema,
|
|
8
|
-
onSubmit: options.schema
|
|
80
|
+
onSubmit: options.schema,
|
|
81
|
+
onBlurAsync: options.asyncValidators?.onBlur,
|
|
82
|
+
onSubmitAsync: options.asyncValidators?.onSubmit
|
|
9
83
|
} : void 0,
|
|
84
|
+
validationLogic: createValidationLogic,
|
|
10
85
|
onSubmit: async ({ value })=>{
|
|
11
86
|
await options.onSubmit?.(value);
|
|
12
87
|
}
|