@osdk/react-components 0.3.0 → 0.4.0-main-90a01d202dfa1e497125bd6cfcdc8175278fb7ec
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/CHANGELOG.md +14 -0
- package/build/browser/action-form/ActionFormApi.js.map +1 -1
- package/build/browser/action-form/BaseForm.js +100 -12
- package/build/browser/action-form/BaseForm.js.map +1 -1
- package/build/browser/action-form/BaseForm.module.css +21 -1
- package/build/browser/action-form/BaseForm.module.css.js +4 -1
- package/build/browser/action-form/FormField.js +3 -1
- package/build/browser/action-form/FormField.js.map +1 -1
- package/build/browser/action-form/FormFieldApi.js.map +1 -1
- package/build/browser/action-form/fields/BaseInput.module.css +4 -0
- package/build/browser/action-form/fields/DatetimePickerField.js +3 -1
- package/build/browser/action-form/fields/DatetimePickerField.js.map +1 -1
- package/build/browser/action-form/fields/DatetimePickerField.module.css +4 -0
- package/build/browser/action-form/fields/FieldBridge.js +31 -4
- package/build/browser/action-form/fields/FieldBridge.js.map +1 -1
- package/build/browser/action-form/fields/FilePickerField.js +6 -2
- package/build/browser/action-form/fields/FilePickerField.js.map +1 -1
- package/build/browser/action-form/fields/FilePickerField.module.css +4 -0
- package/build/browser/action-form/fields/FormFieldRenderer.js +24 -12
- package/build/browser/action-form/fields/FormFieldRenderer.js.map +1 -1
- package/build/browser/action-form/fields/NumberInputField.js +12 -8
- package/build/browser/action-form/fields/NumberInputField.js.map +1 -1
- package/build/browser/action-form/fields/NumberInputField.module.css +4 -0
- package/build/browser/action-form/fields/TextAreaField.js +3 -1
- package/build/browser/action-form/fields/TextAreaField.js.map +1 -1
- package/build/browser/action-form/fields/TextInputField.js +3 -1
- package/build/browser/action-form/fields/TextInputField.js.map +1 -1
- package/build/browser/action-form/utils/extractValidationRules.js +186 -0
- package/build/browser/action-form/utils/extractValidationRules.js.map +1 -0
- package/build/browser/public/experimental.js.map +1 -1
- package/build/browser/shared/hooks/useAsyncAction.js +56 -0
- package/build/browser/shared/hooks/useAsyncAction.js.map +1 -0
- package/build/browser/shared/hooks/useIsMounted.js +32 -0
- package/build/browser/shared/hooks/useIsMounted.js.map +1 -0
- package/build/browser/styles.css +37 -1
- package/build/cjs/public/experimental.cjs +361 -37
- package/build/cjs/public/experimental.cjs.map +1 -1
- package/build/cjs/public/experimental.css +30 -1
- package/build/cjs/public/experimental.css.map +1 -1
- package/build/cjs/public/experimental.d.cts +40 -13
- package/build/esm/action-form/ActionFormApi.js.map +1 -1
- package/build/esm/action-form/BaseForm.js +100 -12
- package/build/esm/action-form/BaseForm.js.map +1 -1
- package/build/esm/action-form/BaseForm.module.css +21 -1
- package/build/esm/action-form/FormField.js +3 -1
- package/build/esm/action-form/FormField.js.map +1 -1
- package/build/esm/action-form/FormFieldApi.js.map +1 -1
- package/build/esm/action-form/fields/BaseInput.module.css +4 -0
- package/build/esm/action-form/fields/DatetimePickerField.js +3 -1
- package/build/esm/action-form/fields/DatetimePickerField.js.map +1 -1
- package/build/esm/action-form/fields/DatetimePickerField.module.css +4 -0
- package/build/esm/action-form/fields/FieldBridge.js +31 -4
- package/build/esm/action-form/fields/FieldBridge.js.map +1 -1
- package/build/esm/action-form/fields/FilePickerField.js +6 -2
- package/build/esm/action-form/fields/FilePickerField.js.map +1 -1
- package/build/esm/action-form/fields/FilePickerField.module.css +4 -0
- package/build/esm/action-form/fields/FormFieldRenderer.js +24 -12
- package/build/esm/action-form/fields/FormFieldRenderer.js.map +1 -1
- package/build/esm/action-form/fields/NumberInputField.js +12 -8
- package/build/esm/action-form/fields/NumberInputField.js.map +1 -1
- package/build/esm/action-form/fields/NumberInputField.module.css +4 -0
- package/build/esm/action-form/fields/TextAreaField.js +3 -1
- package/build/esm/action-form/fields/TextAreaField.js.map +1 -1
- package/build/esm/action-form/fields/TextInputField.js +3 -1
- package/build/esm/action-form/fields/TextInputField.js.map +1 -1
- package/build/esm/action-form/utils/extractValidationRules.js +186 -0
- package/build/esm/action-form/utils/extractValidationRules.js.map +1 -0
- package/build/esm/public/experimental.js.map +1 -1
- package/build/esm/shared/hooks/useAsyncAction.js +56 -0
- package/build/esm/shared/hooks/useAsyncAction.js.map +1 -0
- package/build/esm/shared/hooks/useIsMounted.js +32 -0
- package/build/esm/shared/hooks/useIsMounted.js.map +1 -0
- package/build/types/action-form/ActionFormApi.d.ts +1 -1
- package/build/types/action-form/ActionFormApi.d.ts.map +1 -1
- package/build/types/action-form/BaseForm.d.ts.map +1 -1
- package/build/types/action-form/FormField.d.ts +1 -0
- package/build/types/action-form/FormField.d.ts.map +1 -1
- package/build/types/action-form/FormFieldApi.d.ts +39 -12
- package/build/types/action-form/FormFieldApi.d.ts.map +1 -1
- package/build/types/action-form/fields/DatetimePickerField.d.ts +1 -1
- package/build/types/action-form/fields/DatetimePickerField.d.ts.map +1 -1
- package/build/types/action-form/fields/FieldBridge.d.ts.map +1 -1
- package/build/types/action-form/fields/FormFieldRenderer.d.ts +2 -0
- package/build/types/action-form/fields/FormFieldRenderer.d.ts.map +1 -1
- package/build/types/action-form/fields/NumberInputField.d.ts +1 -1
- package/build/types/action-form/fields/NumberInputField.d.ts.map +1 -1
- package/build/types/action-form/fields/TextAreaField.d.ts +1 -1
- package/build/types/action-form/fields/TextAreaField.d.ts.map +1 -1
- package/build/types/action-form/fields/TextInputField.d.ts +1 -1
- package/build/types/action-form/fields/TextInputField.d.ts.map +1 -1
- package/build/types/action-form/utils/extractValidationRules.d.ts +13 -0
- package/build/types/action-form/utils/extractValidationRules.d.ts.map +1 -0
- package/build/types/public/experimental.d.ts +1 -1
- package/build/types/public/experimental.d.ts.map +1 -1
- package/build/types/shared/hooks/useAsyncAction.d.ts +16 -0
- package/build/types/shared/hooks/useAsyncAction.d.ts.map +1 -0
- package/build/types/shared/hooks/useIsMounted.d.ts +5 -0
- package/build/types/shared/hooks/useIsMounted.d.ts.map +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Derives react-hook-form validation rules from a field definition's
|
|
19
|
+
* constraint props (min, max, minLength, etc.) and the optional
|
|
20
|
+
* user-provided `validate` function.
|
|
21
|
+
*
|
|
22
|
+
* Called at rule-building time so that `onValidationError` can inject
|
|
23
|
+
* custom messages into the RHF rules object.
|
|
24
|
+
*/
|
|
25
|
+
export function extractValidationRules(fieldDef) {
|
|
26
|
+
const rules = {};
|
|
27
|
+
if (fieldDef.isRequired) {
|
|
28
|
+
rules.required = getMessage(fieldDef, {
|
|
29
|
+
type: "required"
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const validateFns = {};
|
|
33
|
+
switch (fieldDef.fieldComponent) {
|
|
34
|
+
case "NUMBER_INPUT":
|
|
35
|
+
{
|
|
36
|
+
const {
|
|
37
|
+
min,
|
|
38
|
+
max
|
|
39
|
+
} = fieldDef.fieldComponentProps;
|
|
40
|
+
if (min != null) {
|
|
41
|
+
const msg = getMessage(fieldDef, {
|
|
42
|
+
type: "min",
|
|
43
|
+
min
|
|
44
|
+
});
|
|
45
|
+
validateFns.min = value => typeof value === "number" && value < min ? msg : true;
|
|
46
|
+
}
|
|
47
|
+
if (max != null) {
|
|
48
|
+
const msg = getMessage(fieldDef, {
|
|
49
|
+
type: "max",
|
|
50
|
+
max
|
|
51
|
+
});
|
|
52
|
+
validateFns.max = value => typeof value === "number" && value > max ? msg : true;
|
|
53
|
+
}
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
case "TEXT_INPUT":
|
|
57
|
+
case "TEXT_AREA":
|
|
58
|
+
{
|
|
59
|
+
const {
|
|
60
|
+
minLength,
|
|
61
|
+
maxLength
|
|
62
|
+
} = fieldDef.fieldComponentProps;
|
|
63
|
+
if (minLength != null) {
|
|
64
|
+
rules.minLength = {
|
|
65
|
+
value: minLength,
|
|
66
|
+
message: getMessage(fieldDef, {
|
|
67
|
+
type: "minLength",
|
|
68
|
+
minLength
|
|
69
|
+
})
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (maxLength != null) {
|
|
73
|
+
rules.maxLength = {
|
|
74
|
+
value: maxLength,
|
|
75
|
+
message: getMessage(fieldDef, {
|
|
76
|
+
type: "maxLength",
|
|
77
|
+
maxLength
|
|
78
|
+
})
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
case "DATETIME_PICKER":
|
|
84
|
+
{
|
|
85
|
+
const {
|
|
86
|
+
min,
|
|
87
|
+
max
|
|
88
|
+
} = fieldDef.fieldComponentProps;
|
|
89
|
+
if (min != null) {
|
|
90
|
+
const msg = getMessage(fieldDef, {
|
|
91
|
+
type: "min",
|
|
92
|
+
min
|
|
93
|
+
});
|
|
94
|
+
validateFns.min = value => value instanceof Date && value.getTime() < min.getTime() ? msg : true;
|
|
95
|
+
}
|
|
96
|
+
if (max != null) {
|
|
97
|
+
const msg = getMessage(fieldDef, {
|
|
98
|
+
type: "max",
|
|
99
|
+
max
|
|
100
|
+
});
|
|
101
|
+
validateFns.max = value => value instanceof Date && value.getTime() > max.getTime() ? msg : true;
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
case "FILE_PICKER":
|
|
106
|
+
{
|
|
107
|
+
const {
|
|
108
|
+
maxSize
|
|
109
|
+
} = fieldDef.fieldComponentProps;
|
|
110
|
+
if (maxSize != null) {
|
|
111
|
+
const msg = getMessage(fieldDef, {
|
|
112
|
+
type: "maxSize",
|
|
113
|
+
maxSize
|
|
114
|
+
});
|
|
115
|
+
validateFns.maxSize = value => {
|
|
116
|
+
if (value instanceof File) {
|
|
117
|
+
return value.size > maxSize ? msg : true;
|
|
118
|
+
}
|
|
119
|
+
if (Array.isArray(value)) {
|
|
120
|
+
const oversized = value.some(f => f instanceof File && f.size > maxSize);
|
|
121
|
+
return oversized ? msg : true;
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
// DROPDOWN, RADIO_BUTTONS, CUSTOM, OBJECT_SET: only `required` applies
|
|
129
|
+
default:
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
if (fieldDef.validate != null) {
|
|
133
|
+
const userValidate = fieldDef.validate;
|
|
134
|
+
validateFns.custom = async value => {
|
|
135
|
+
const result = await userValidate(value);
|
|
136
|
+
if (result == null) {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
return getMessage(fieldDef, {
|
|
140
|
+
type: "validate",
|
|
141
|
+
message: result
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
if (Object.keys(validateFns).length > 0) {
|
|
146
|
+
rules.validate = validateFns;
|
|
147
|
+
}
|
|
148
|
+
return rules;
|
|
149
|
+
}
|
|
150
|
+
function getMessage(fieldDef, error) {
|
|
151
|
+
return fieldDef.onValidationError?.(error) ?? getDefaultMessage(error);
|
|
152
|
+
}
|
|
153
|
+
function getDefaultMessage(error) {
|
|
154
|
+
switch (error.type) {
|
|
155
|
+
case "required":
|
|
156
|
+
return "This field is required";
|
|
157
|
+
case "min":
|
|
158
|
+
return `Must be at least ${formatConstraint(error.min)}`;
|
|
159
|
+
case "max":
|
|
160
|
+
return `Must be at most ${formatConstraint(error.max)}`;
|
|
161
|
+
case "minLength":
|
|
162
|
+
return `Must be at least ${error.minLength} characters`;
|
|
163
|
+
case "maxLength":
|
|
164
|
+
return `Must be at most ${error.maxLength} characters`;
|
|
165
|
+
case "maxSize":
|
|
166
|
+
return `File must be smaller than ${formatBytes(error.maxSize)}`;
|
|
167
|
+
case "validate":
|
|
168
|
+
return error.message;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function formatConstraint(value) {
|
|
172
|
+
if (value instanceof Date) {
|
|
173
|
+
return value.toLocaleDateString();
|
|
174
|
+
}
|
|
175
|
+
return String(value);
|
|
176
|
+
}
|
|
177
|
+
function formatBytes(bytes) {
|
|
178
|
+
if (bytes < 1024) {
|
|
179
|
+
return `${bytes} B`;
|
|
180
|
+
}
|
|
181
|
+
if (bytes < 1024 * 1024) {
|
|
182
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
183
|
+
}
|
|
184
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=extractValidationRules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractValidationRules.js","names":["extractValidationRules","fieldDef","rules","isRequired","required","getMessage","type","validateFns","fieldComponent","min","max","fieldComponentProps","msg","value","minLength","maxLength","message","Date","getTime","maxSize","File","size","Array","isArray","oversized","some","f","validate","userValidate","custom","result","Object","keys","length","error","onValidationError","getDefaultMessage","formatConstraint","formatBytes","toLocaleDateString","String","bytes","toFixed"],"sources":["extractValidationRules.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { RegisterOptions } from \"react-hook-form\";\nimport type {\n RendererFieldDefinition,\n ValidationError,\n} from \"../FormFieldApi.js\";\n\ntype RhfRules = RegisterOptions<Record<string, unknown>, string>;\n\n/**\n * Derives react-hook-form validation rules from a field definition's\n * constraint props (min, max, minLength, etc.) and the optional\n * user-provided `validate` function.\n *\n * Called at rule-building time so that `onValidationError` can inject\n * custom messages into the RHF rules object.\n */\nexport function extractValidationRules(\n fieldDef: RendererFieldDefinition,\n): RhfRules {\n const rules: RhfRules = {};\n\n if (fieldDef.isRequired) {\n rules.required = getMessage(fieldDef, { type: \"required\" });\n }\n\n const validateFns: Record<\n string,\n (value: unknown) => string | true | Promise<string | true>\n > = {};\n\n switch (fieldDef.fieldComponent) {\n case \"NUMBER_INPUT\": {\n const { min, max } = fieldDef.fieldComponentProps;\n if (min != null) {\n const msg = getMessage(fieldDef, { type: \"min\", min });\n validateFns.min = (value) =>\n typeof value === \"number\" && value < min ? msg : true;\n }\n if (max != null) {\n const msg = getMessage(fieldDef, { type: \"max\", max });\n validateFns.max = (value) =>\n typeof value === \"number\" && value > max ? msg : true;\n }\n break;\n }\n case \"TEXT_INPUT\":\n case \"TEXT_AREA\": {\n const { minLength, maxLength } = fieldDef.fieldComponentProps;\n if (minLength != null) {\n rules.minLength = {\n value: minLength,\n message: getMessage(fieldDef, { type: \"minLength\", minLength }),\n };\n }\n if (maxLength != null) {\n rules.maxLength = {\n value: maxLength,\n message: getMessage(fieldDef, { type: \"maxLength\", maxLength }),\n };\n }\n break;\n }\n case \"DATETIME_PICKER\": {\n const { min, max } = fieldDef.fieldComponentProps;\n if (min != null) {\n const msg = getMessage(fieldDef, { type: \"min\", min });\n validateFns.min = (value) =>\n value instanceof Date && value.getTime() < min.getTime()\n ? msg\n : true;\n }\n if (max != null) {\n const msg = getMessage(fieldDef, { type: \"max\", max });\n validateFns.max = (value) =>\n value instanceof Date && value.getTime() > max.getTime()\n ? msg\n : true;\n }\n break;\n }\n case \"FILE_PICKER\": {\n const { maxSize } = fieldDef.fieldComponentProps;\n if (maxSize != null) {\n const msg = getMessage(fieldDef, { type: \"maxSize\", maxSize });\n validateFns.maxSize = (value) => {\n if (value instanceof File) {\n return value.size > maxSize ? msg : true;\n }\n if (Array.isArray(value)) {\n const oversized = value.some(\n (f: unknown) => f instanceof File && f.size > maxSize,\n );\n return oversized ? msg : true;\n }\n return true;\n };\n }\n break;\n }\n // DROPDOWN, RADIO_BUTTONS, CUSTOM, OBJECT_SET: only `required` applies\n default:\n break;\n }\n\n if (fieldDef.validate != null) {\n const userValidate = fieldDef.validate;\n validateFns.custom = async (value: unknown) => {\n const result = await userValidate(value);\n if (result == null) {\n return true;\n }\n return getMessage(fieldDef, { type: \"validate\", message: result });\n };\n }\n\n if (Object.keys(validateFns).length > 0) {\n rules.validate = validateFns;\n }\n\n return rules;\n}\n\nfunction getMessage(\n fieldDef: RendererFieldDefinition,\n error: ValidationError,\n): string {\n return fieldDef.onValidationError?.(error) ?? getDefaultMessage(error);\n}\n\nfunction getDefaultMessage(error: ValidationError): string {\n switch (error.type) {\n case \"required\":\n return \"This field is required\";\n case \"min\":\n return `Must be at least ${formatConstraint(error.min)}`;\n case \"max\":\n return `Must be at most ${formatConstraint(error.max)}`;\n case \"minLength\":\n return `Must be at least ${error.minLength} characters`;\n case \"maxLength\":\n return `Must be at most ${error.maxLength} characters`;\n case \"maxSize\":\n return `File must be smaller than ${formatBytes(error.maxSize)}`;\n case \"validate\":\n return error.message;\n }\n}\n\nfunction formatConstraint(value: number | Date): string {\n if (value instanceof Date) {\n return value.toLocaleDateString();\n }\n return String(value);\n}\n\nfunction formatBytes(bytes: number): string {\n if (bytes < 1024) {\n return `${bytes} B`;\n }\n if (bytes < 1024 * 1024) {\n return `${(bytes / 1024).toFixed(1)} KB`;\n }\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n"],"mappings":"AAAA;A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;AACxE;AAEA,SAASE,iBAAiBA,CAACF,KAAsB,EAAU;EACzD,QAAQA,KAAK,CAAC5B,IAAI;IAChB,KAAK,UAAU;MACb,OAAO,wBAAwB;IACjC,KAAK,KAAK;MACR,OAAO,oBAAoB+B,gBAAgB,CAACH,KAAK,CAACzB,GAAG,CAAC,EAAE;IAC1D,KAAK,KAAK;MACR,OAAO,mBAAmB4B,gBAAgB,CAACH,KAAK,CAACxB,GAAG,CAAC,EAAE;IACzD,KAAK,WAAW;MACd,OAAO,oBAAoBwB,KAAK,CAACpB,SAAS,aAAa;IACzD,KAAK,WAAW;MACd,OAAO,mBAAmBoB,KAAK,CAACnB,SAAS,aAAa;IACxD,KAAK,SAAS;MACZ,OAAO,6BAA6BuB,WAAW,CAACJ,KAAK,CAACf,OAAO,CAAC,EAAE;IAClE,KAAK,UAAU;MACb,OAAOe,KAAK,CAAClB,OAAO;EACxB;AACF;AAEA,SAASqB,gBAAgBA,CAACxB,KAAoB,EAAU;EACtD,IAAIA,KAAK,YAAYI,IAAI,EAAE;IACzB,OAAOJ,KAAK,CAAC0B,kBAAkB,CAAC,CAAC;EACnC;EACA,OAAOC,MAAM,CAAC3B,KAAK,CAAC;AACtB;AAEA,SAASyB,WAAWA,CAACG,KAAa,EAAU;EAC1C,IAAIA,KAAK,GAAG,IAAI,EAAE;IAChB,OAAO,GAAGA,KAAK,IAAI;EACrB;EACA,IAAIA,KAAK,GAAG,IAAI,GAAG,IAAI,EAAE;IACvB,OAAO,GAAG,CAACA,KAAK,GAAG,IAAI,EAAEC,OAAO,CAAC,CAAC,CAAC,KAAK;EAC1C;EACA,OAAO,GAAG,CAACD,KAAK,IAAI,IAAI,GAAG,IAAI,CAAC,EAAEC,OAAO,CAAC,CAAC,CAAC,KAAK;AACnD","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimental.js","names":["BaseFilterList","FilterList","deserializeFilterStates","serializeFilterStates","ObjectTable","BaseTable","ColumnConfigDialog","MultiColumnSortDialog","BasePdfViewer","PdfViewerAnnotationLayer","PdfViewerContent","PdfViewerOutlineSidebar","PdfViewerSearchBar","PdfViewerSidebar","PdfViewerToolbar","usePdfAnnotationPortals","usePdfAnnotationsByPage","usePdfDocument","usePdfFormFields","usePdfHighlightMode","usePdfOutline","usePdfViewer","usePdfViewerSearch","usePdfViewerSync","PdfViewerProvider","usePdfViewerContext","usePdfViewerInstance","usePdfViewerCore","usePdfViewerState","PdfViewer","ActionForm","BaseForm"],"sources":["experimental.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { BaseFilterList } from \"../filter-list/base/BaseFilterList.js\";\nexport type {\n BaseFilterListProps,\n RenderFilterInput,\n} from \"../filter-list/base/BaseFilterListApi.js\";\nexport { FilterList } from \"../filter-list/FilterList.js\";\n\nexport type {\n FilterDefinitionUnion,\n FilterListProps,\n} from \"../filter-list/FilterListApi.js\";\nexport type {\n FilterComponentType,\n FilterListItemProps,\n FilterState,\n PropertyFilterDefinition,\n} from \"../filter-list/FilterListItemApi.js\";\nexport {\n deserializeFilterStates,\n serializeFilterStates,\n} from \"../filter-list/utils/filterStateSerialization.js\";\n\n// ObjectTable that loads and displays data for a given objectSet\nexport { ObjectTable } from \"../object-table/ObjectTable.js\";\nexport type {\n ColumnDefinition,\n ColumnDefinitionLocator,\n CustomColumnLocator,\n FunctionColumnLocator,\n ObjectTableProps,\n PropertyColumnLocator,\n RdpColumnLocator,\n} from \"../object-table/ObjectTableApi.js\";\nexport type { CellEditInfo } from \"../object-table/utils/types.js\";\n\n// BaseTable that does not handle data fetching\nexport type { BaseTableProps } from \"../object-table/Table.js\";\nexport { BaseTable } from \"../object-table/Table.js\";\n\nexport { ColumnConfigDialog } from \"../object-table/ColumnConfigDialog.js\";\nexport type {\n ColumnConfigDialogProps,\n ColumnConfigOptions,\n} from \"../object-table/ColumnConfigDialog.js\";\n\nexport { MultiColumnSortDialog } from \"../object-table/MultiColumnSortDialog.js\";\nexport type {\n MultiColumnSortDialogProps,\n SortColumnItem,\n} from \"../object-table/MultiColumnSortDialog.js\";\n\n// PdfViewer\nexport { BasePdfViewer } from \"../pdf-viewer/PdfViewer.js\";\nexport type {\n AnnotationType,\n PdfAnnotation,\n PdfAnnotationRenderProps,\n PdfCustomAnnotation,\n PdfDownloadResult,\n PdfFormFieldValue,\n PdfRect,\n PdfTextHighlightEvent,\n PdfViewerProps,\n SidebarMode,\n} from \"../pdf-viewer/types.js\";\n\n// PdfViewer building blocks\nexport {\n PdfViewerAnnotationLayer,\n type PdfViewerAnnotationLayerProps,\n} from \"../pdf-viewer/components/PdfViewerAnnotationLayer.js\";\nexport {\n PdfViewerContent,\n type PdfViewerContentProps,\n} from \"../pdf-viewer/components/PdfViewerContent.js\";\nexport {\n PdfViewerOutlineSidebar,\n type PdfViewerOutlineSidebarProps,\n} from \"../pdf-viewer/components/PdfViewerOutlineSidebar.js\";\nexport {\n PdfViewerSearchBar,\n type PdfViewerSearchBarProps,\n} from \"../pdf-viewer/components/PdfViewerSearchBar.js\";\nexport {\n PdfViewerSidebar,\n type PdfViewerSidebarProps,\n} from \"../pdf-viewer/components/PdfViewerSidebar.js\";\nexport {\n PdfViewerToolbar,\n type PdfViewerToolbarProps,\n} from \"../pdf-viewer/components/PdfViewerToolbar.js\";\n\n// PdfViewer hooks — primitive\nexport {\n type AnnotationPortalTarget,\n usePdfAnnotationPortals,\n} from \"../pdf-viewer/hooks/usePdfAnnotationPortals.js\";\nexport { usePdfAnnotationsByPage } from \"../pdf-viewer/hooks/usePdfAnnotationsByPage.js\";\nexport { usePdfDocument } from \"../pdf-viewer/hooks/usePdfDocument.js\";\nexport {\n usePdfFormFields,\n type UsePdfFormFieldsOptions,\n type UsePdfFormFieldsResult,\n} from \"../pdf-viewer/hooks/usePdfFormFields.js\";\nexport {\n usePdfHighlightMode,\n type UsePdfHighlightModeOptions,\n type UsePdfHighlightModeResult,\n} from \"../pdf-viewer/hooks/usePdfHighlightMode.js\";\nexport { usePdfOutline } from \"../pdf-viewer/hooks/usePdfOutline.js\";\nexport {\n usePdfViewer,\n type UsePdfViewerResult,\n} from \"../pdf-viewer/hooks/usePdfViewer.js\";\nexport {\n usePdfViewerSearch,\n type UsePdfViewerSearchResult,\n} from \"../pdf-viewer/hooks/usePdfViewerSearch.js\";\nexport { usePdfViewerSync } from \"../pdf-viewer/hooks/usePdfViewerSync.js\";\nexport { type OutlineItem } from \"../pdf-viewer/types.js\";\n\n// PdfViewer context\nexport {\n type PdfViewerContextValue,\n PdfViewerProvider,\n usePdfViewerContext,\n usePdfViewerInstance,\n} from \"../pdf-viewer/PdfViewerContext.js\";\nexport type {\n PdfViewerHandle,\n PdfViewerInstanceOptions,\n} from \"../pdf-viewer/types.js\";\n\n// PdfViewer hooks — composition\nexport {\n usePdfViewerCore,\n type UsePdfViewerCoreOptions,\n type UsePdfViewerCoreResult,\n} from \"../pdf-viewer/hooks/usePdfViewerCore.js\";\nexport {\n usePdfViewerState,\n type UsePdfViewerStateOptions,\n type UsePdfViewerStateResult,\n} from \"../pdf-viewer/hooks/usePdfViewerState.js\";\n\n// PdfViewer (Media wrapper)\nexport {\n PdfViewer,\n type PdfViewerMediaProps,\n} from \"../pdf-viewer/PdfRenderer.js\";\n\nexport { ActionForm } from \"../action-form/ActionForm.js\";\nexport type {\n ActionFormProps,\n BaseFormProps,\n FormError,\n FormState,\n} from \"../action-form/ActionFormApi.js\";\nexport { BaseForm } from \"../action-form/BaseForm.js\";\nexport type {\n ActionParameters,\n BaseFormFieldProps,\n CustomFieldProps,\n DatetimePickerFieldProps,\n DropdownFieldProps,\n FieldComponent,\n FieldValueType,\n FilePickerProps,\n FormFieldDefinition,\n FormFieldPropsByType,\n NumberInputFieldProps,\n ObjectSetFieldProps,\n Option,\n RadioButtonsFieldProps,\n RendererFieldDefinition,\n TextAreaFieldProps,\n TextInputFieldProps,\n} from \"../action-form/FormFieldApi.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,uCAAuC;AAKtE,SAASC,UAAU,QAAQ,8BAA8B;AAYzD,SACEC,uBAAuB,EACvBC,qBAAqB,QAChB,kDAAkD;;AAEzD;AACA,SAASC,WAAW,QAAQ,gCAAgC;;AAY5D;;AAEA,SAASC,SAAS,QAAQ,0BAA0B;AAEpD,SAASC,kBAAkB,QAAQ,uCAAuC;AAM1E,SAASC,qBAAqB,QAAQ,0CAA0C;AAMhF;AACA,SAASC,aAAa,QAAQ,4BAA4B;AAc1D;AACA,SACEC,wBAAwB,QAEnB,sDAAsD;AAC7D,SACEC,gBAAgB,QAEX,8CAA8C;AACrD,SACEC,uBAAuB,QAElB,qDAAqD;AAC5D,SACEC,kBAAkB,QAEb,gDAAgD;AACvD,SACEC,gBAAgB,QAEX,8CAA8C;AACrD,SACEC,gBAAgB,QAEX,8CAA8C;;AAErD;AACA,SAEEC,uBAAuB,QAClB,gDAAgD;AACvD,SAASC,uBAAuB,QAAQ,gDAAgD;AACxF,SAASC,cAAc,QAAQ,uCAAuC;AACtE,SACEC,gBAAgB,QAGX,yCAAyC;AAChD,SACEC,mBAAmB,QAGd,4CAA4C;AACnD,SAASC,aAAa,QAAQ,sCAAsC;AACpE,SACEC,YAAY,QAEP,qCAAqC;AAC5C,SACEC,kBAAkB,QAEb,2CAA2C;AAClD,SAASC,gBAAgB,QAAQ,yCAAyC;AAG1E;AACA,SAEEC,iBAAiB,EACjBC,mBAAmB,EACnBC,oBAAoB,QACf,mCAAmC;AAM1C;AACA,SACEC,gBAAgB,QAGX,yCAAyC;AAChD,SACEC,iBAAiB,QAGZ,0CAA0C;;AAEjD;AACA,SACEC,SAAS,QAEJ,8BAA8B;AAErC,SAASC,UAAU,QAAQ,8BAA8B;AAOzD,SAASC,QAAQ,QAAQ,4BAA4B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"experimental.js","names":["BaseFilterList","FilterList","deserializeFilterStates","serializeFilterStates","ObjectTable","BaseTable","ColumnConfigDialog","MultiColumnSortDialog","BasePdfViewer","PdfViewerAnnotationLayer","PdfViewerContent","PdfViewerOutlineSidebar","PdfViewerSearchBar","PdfViewerSidebar","PdfViewerToolbar","usePdfAnnotationPortals","usePdfAnnotationsByPage","usePdfDocument","usePdfFormFields","usePdfHighlightMode","usePdfOutline","usePdfViewer","usePdfViewerSearch","usePdfViewerSync","PdfViewerProvider","usePdfViewerContext","usePdfViewerInstance","usePdfViewerCore","usePdfViewerState","PdfViewer","ActionForm","BaseForm"],"sources":["experimental.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { BaseFilterList } from \"../filter-list/base/BaseFilterList.js\";\nexport type {\n BaseFilterListProps,\n RenderFilterInput,\n} from \"../filter-list/base/BaseFilterListApi.js\";\nexport { FilterList } from \"../filter-list/FilterList.js\";\n\nexport type {\n FilterDefinitionUnion,\n FilterListProps,\n} from \"../filter-list/FilterListApi.js\";\nexport type {\n FilterComponentType,\n FilterListItemProps,\n FilterState,\n PropertyFilterDefinition,\n} from \"../filter-list/FilterListItemApi.js\";\nexport {\n deserializeFilterStates,\n serializeFilterStates,\n} from \"../filter-list/utils/filterStateSerialization.js\";\n\n// ObjectTable that loads and displays data for a given objectSet\nexport { ObjectTable } from \"../object-table/ObjectTable.js\";\nexport type {\n ColumnDefinition,\n ColumnDefinitionLocator,\n CustomColumnLocator,\n FunctionColumnLocator,\n ObjectTableProps,\n PropertyColumnLocator,\n RdpColumnLocator,\n} from \"../object-table/ObjectTableApi.js\";\nexport type { CellEditInfo } from \"../object-table/utils/types.js\";\n\n// BaseTable that does not handle data fetching\nexport type { BaseTableProps } from \"../object-table/Table.js\";\nexport { BaseTable } from \"../object-table/Table.js\";\n\nexport { ColumnConfigDialog } from \"../object-table/ColumnConfigDialog.js\";\nexport type {\n ColumnConfigDialogProps,\n ColumnConfigOptions,\n} from \"../object-table/ColumnConfigDialog.js\";\n\nexport { MultiColumnSortDialog } from \"../object-table/MultiColumnSortDialog.js\";\nexport type {\n MultiColumnSortDialogProps,\n SortColumnItem,\n} from \"../object-table/MultiColumnSortDialog.js\";\n\n// PdfViewer\nexport { BasePdfViewer } from \"../pdf-viewer/PdfViewer.js\";\nexport type {\n AnnotationType,\n PdfAnnotation,\n PdfAnnotationRenderProps,\n PdfCustomAnnotation,\n PdfDownloadResult,\n PdfFormFieldValue,\n PdfRect,\n PdfTextHighlightEvent,\n PdfViewerProps,\n SidebarMode,\n} from \"../pdf-viewer/types.js\";\n\n// PdfViewer building blocks\nexport {\n PdfViewerAnnotationLayer,\n type PdfViewerAnnotationLayerProps,\n} from \"../pdf-viewer/components/PdfViewerAnnotationLayer.js\";\nexport {\n PdfViewerContent,\n type PdfViewerContentProps,\n} from \"../pdf-viewer/components/PdfViewerContent.js\";\nexport {\n PdfViewerOutlineSidebar,\n type PdfViewerOutlineSidebarProps,\n} from \"../pdf-viewer/components/PdfViewerOutlineSidebar.js\";\nexport {\n PdfViewerSearchBar,\n type PdfViewerSearchBarProps,\n} from \"../pdf-viewer/components/PdfViewerSearchBar.js\";\nexport {\n PdfViewerSidebar,\n type PdfViewerSidebarProps,\n} from \"../pdf-viewer/components/PdfViewerSidebar.js\";\nexport {\n PdfViewerToolbar,\n type PdfViewerToolbarProps,\n} from \"../pdf-viewer/components/PdfViewerToolbar.js\";\n\n// PdfViewer hooks — primitive\nexport {\n type AnnotationPortalTarget,\n usePdfAnnotationPortals,\n} from \"../pdf-viewer/hooks/usePdfAnnotationPortals.js\";\nexport { usePdfAnnotationsByPage } from \"../pdf-viewer/hooks/usePdfAnnotationsByPage.js\";\nexport { usePdfDocument } from \"../pdf-viewer/hooks/usePdfDocument.js\";\nexport {\n usePdfFormFields,\n type UsePdfFormFieldsOptions,\n type UsePdfFormFieldsResult,\n} from \"../pdf-viewer/hooks/usePdfFormFields.js\";\nexport {\n usePdfHighlightMode,\n type UsePdfHighlightModeOptions,\n type UsePdfHighlightModeResult,\n} from \"../pdf-viewer/hooks/usePdfHighlightMode.js\";\nexport { usePdfOutline } from \"../pdf-viewer/hooks/usePdfOutline.js\";\nexport {\n usePdfViewer,\n type UsePdfViewerResult,\n} from \"../pdf-viewer/hooks/usePdfViewer.js\";\nexport {\n usePdfViewerSearch,\n type UsePdfViewerSearchResult,\n} from \"../pdf-viewer/hooks/usePdfViewerSearch.js\";\nexport { usePdfViewerSync } from \"../pdf-viewer/hooks/usePdfViewerSync.js\";\nexport { type OutlineItem } from \"../pdf-viewer/types.js\";\n\n// PdfViewer context\nexport {\n type PdfViewerContextValue,\n PdfViewerProvider,\n usePdfViewerContext,\n usePdfViewerInstance,\n} from \"../pdf-viewer/PdfViewerContext.js\";\nexport type {\n PdfViewerHandle,\n PdfViewerInstanceOptions,\n} from \"../pdf-viewer/types.js\";\n\n// PdfViewer hooks — composition\nexport {\n usePdfViewerCore,\n type UsePdfViewerCoreOptions,\n type UsePdfViewerCoreResult,\n} from \"../pdf-viewer/hooks/usePdfViewerCore.js\";\nexport {\n usePdfViewerState,\n type UsePdfViewerStateOptions,\n type UsePdfViewerStateResult,\n} from \"../pdf-viewer/hooks/usePdfViewerState.js\";\n\n// PdfViewer (Media wrapper)\nexport {\n PdfViewer,\n type PdfViewerMediaProps,\n} from \"../pdf-viewer/PdfRenderer.js\";\n\nexport { ActionForm } from \"../action-form/ActionForm.js\";\nexport type {\n ActionFormProps,\n BaseFormProps,\n FormError,\n FormState,\n} from \"../action-form/ActionFormApi.js\";\nexport { BaseForm } from \"../action-form/BaseForm.js\";\nexport type {\n ActionParameters,\n BaseFormFieldProps,\n CustomFieldProps,\n DatetimePickerFieldProps,\n DropdownFieldProps,\n FieldComponent,\n FieldValueType,\n FilePickerProps,\n FormFieldDefinition,\n FormFieldPropsByType,\n NumberInputFieldProps,\n ObjectSetFieldProps,\n Option,\n RadioButtonsFieldProps,\n RendererFieldDefinition,\n TextAreaFieldProps,\n TextInputFieldProps,\n ValidationError,\n} from \"../action-form/FormFieldApi.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,uCAAuC;AAKtE,SAASC,UAAU,QAAQ,8BAA8B;AAYzD,SACEC,uBAAuB,EACvBC,qBAAqB,QAChB,kDAAkD;;AAEzD;AACA,SAASC,WAAW,QAAQ,gCAAgC;;AAY5D;;AAEA,SAASC,SAAS,QAAQ,0BAA0B;AAEpD,SAASC,kBAAkB,QAAQ,uCAAuC;AAM1E,SAASC,qBAAqB,QAAQ,0CAA0C;AAMhF;AACA,SAASC,aAAa,QAAQ,4BAA4B;AAc1D;AACA,SACEC,wBAAwB,QAEnB,sDAAsD;AAC7D,SACEC,gBAAgB,QAEX,8CAA8C;AACrD,SACEC,uBAAuB,QAElB,qDAAqD;AAC5D,SACEC,kBAAkB,QAEb,gDAAgD;AACvD,SACEC,gBAAgB,QAEX,8CAA8C;AACrD,SACEC,gBAAgB,QAEX,8CAA8C;;AAErD;AACA,SAEEC,uBAAuB,QAClB,gDAAgD;AACvD,SAASC,uBAAuB,QAAQ,gDAAgD;AACxF,SAASC,cAAc,QAAQ,uCAAuC;AACtE,SACEC,gBAAgB,QAGX,yCAAyC;AAChD,SACEC,mBAAmB,QAGd,4CAA4C;AACnD,SAASC,aAAa,QAAQ,sCAAsC;AACpE,SACEC,YAAY,QAEP,qCAAqC;AAC5C,SACEC,kBAAkB,QAEb,2CAA2C;AAClD,SAASC,gBAAgB,QAAQ,yCAAyC;AAG1E;AACA,SAEEC,iBAAiB,EACjBC,mBAAmB,EACnBC,oBAAoB,QACf,mCAAmC;AAM1C;AACA,SACEC,gBAAgB,QAGX,yCAAyC;AAChD,SACEC,iBAAiB,QAGZ,0CAA0C;;AAEjD;AACA,SACEC,SAAS,QAEJ,8BAA8B;AAErC,SAASC,UAAU,QAAQ,8BAA8B;AAOzD,SAASC,QAAQ,QAAQ,4BAA4B","ignoreList":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { useCallback, useState } from "react";
|
|
18
|
+
import { useIsMounted } from "./useIsMounted.js";
|
|
19
|
+
/**
|
|
20
|
+
* Wraps an async callback with pending and error state tracking.
|
|
21
|
+
*
|
|
22
|
+
* - `isPending` is true while the action is executing
|
|
23
|
+
* - `error` holds the error from the last rejection (cleared on next execute or via clearError)
|
|
24
|
+
* - `execute` calls the action with pending/error bookkeeping
|
|
25
|
+
* - `clearError` resets the error to undefined
|
|
26
|
+
*/
|
|
27
|
+
export function useAsyncAction(action) {
|
|
28
|
+
const [isPending, setIsPending] = useState(false);
|
|
29
|
+
const [error, setError] = useState(undefined);
|
|
30
|
+
const isMountedRef = useIsMounted();
|
|
31
|
+
const execute = useCallback(async (...args) => {
|
|
32
|
+
setError(undefined);
|
|
33
|
+
setIsPending(true);
|
|
34
|
+
try {
|
|
35
|
+
await action(...args);
|
|
36
|
+
} catch (err) {
|
|
37
|
+
if (isMountedRef.current) {
|
|
38
|
+
setError(err);
|
|
39
|
+
}
|
|
40
|
+
} finally {
|
|
41
|
+
if (isMountedRef.current) {
|
|
42
|
+
setIsPending(false);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}, [action, isMountedRef]);
|
|
46
|
+
const clearError = useCallback(() => {
|
|
47
|
+
setError(undefined);
|
|
48
|
+
}, []);
|
|
49
|
+
return {
|
|
50
|
+
isPending,
|
|
51
|
+
error,
|
|
52
|
+
execute,
|
|
53
|
+
clearError
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=useAsyncAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAsyncAction.js","names":["useCallback","useState","useIsMounted","useAsyncAction","action","isPending","setIsPending","error","setError","undefined","isMountedRef","execute","args","err","current","clearError"],"sources":["useAsyncAction.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useCallback, useState } from \"react\";\nimport { useIsMounted } from \"./useIsMounted.js\";\n\ninterface AsyncActionState<Args extends unknown[]> {\n isPending: boolean;\n error: unknown;\n execute: (...args: Args) => Promise<void>;\n clearError: () => void;\n}\n\n/**\n * Wraps an async callback with pending and error state tracking.\n *\n * - `isPending` is true while the action is executing\n * - `error` holds the error from the last rejection (cleared on next execute or via clearError)\n * - `execute` calls the action with pending/error bookkeeping\n * - `clearError` resets the error to undefined\n */\nexport function useAsyncAction<Args extends unknown[]>(\n action: (...args: Args) => Promise<void> | void,\n): AsyncActionState<Args> {\n const [isPending, setIsPending] = useState(false);\n const [error, setError] = useState<unknown>(undefined);\n\n const isMountedRef = useIsMounted();\n\n const execute = useCallback(\n async (...args: Args) => {\n setError(undefined);\n setIsPending(true);\n try {\n await action(...args);\n } catch (err) {\n if (isMountedRef.current) {\n setError(err);\n }\n } finally {\n if (isMountedRef.current) {\n setIsPending(false);\n }\n }\n },\n [action, isMountedRef],\n );\n\n const clearError = useCallback(() => {\n setError(undefined);\n }, []);\n\n return { isPending, error, execute, clearError };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AAC7C,SAASC,YAAY,QAAQ,mBAAmB;AAShD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAC5BC,MAA+C,EACvB;EACxB,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGL,QAAQ,CAAC,KAAK,CAAC;EACjD,MAAM,CAACM,KAAK,EAAEC,QAAQ,CAAC,GAAGP,QAAQ,CAAUQ,SAAS,CAAC;EAEtD,MAAMC,YAAY,GAAGR,YAAY,CAAC,CAAC;EAEnC,MAAMS,OAAO,GAAGX,WAAW,CACzB,OAAO,GAAGY,IAAU,KAAK;IACvBJ,QAAQ,CAACC,SAAS,CAAC;IACnBH,YAAY,CAAC,IAAI,CAAC;IAClB,IAAI;MACF,MAAMF,MAAM,CAAC,GAAGQ,IAAI,CAAC;IACvB,CAAC,CAAC,OAAOC,GAAG,EAAE;MACZ,IAAIH,YAAY,CAACI,OAAO,EAAE;QACxBN,QAAQ,CAACK,GAAG,CAAC;MACf;IACF,CAAC,SAAS;MACR,IAAIH,YAAY,CAACI,OAAO,EAAE;QACxBR,YAAY,CAAC,KAAK,CAAC;MACrB;IACF;EACF,CAAC,EACD,CAACF,MAAM,EAAEM,YAAY,CACvB,CAAC;EAED,MAAMK,UAAU,GAAGf,WAAW,CAAC,MAAM;IACnCQ,QAAQ,CAACC,SAAS,CAAC;EACrB,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IAAEJ,SAAS;IAAEE,KAAK;IAAEI,OAAO;IAAEI;EAAW,CAAC;AAClD","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { useEffect, useRef } from "react";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Returns a ref whose `.current` is `true` while the component is mounted
|
|
21
|
+
* and `false` after unmount. Use to guard async state updates.
|
|
22
|
+
*/
|
|
23
|
+
export function useIsMounted() {
|
|
24
|
+
const isMountedRef = useRef(true);
|
|
25
|
+
useEffect(function () {
|
|
26
|
+
return () => {
|
|
27
|
+
isMountedRef.current = false;
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
return isMountedRef;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=useIsMounted.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsMounted.js","names":["useEffect","useRef","useIsMounted","isMountedRef","current"],"sources":["useIsMounted.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useRef } from \"react\";\n\n/**\n * Returns a ref whose `.current` is `true` while the component is mounted\n * and `false` after unmount. Use to guard async state updates.\n */\nexport function useIsMounted(): Readonly<React.RefObject<boolean>> {\n const isMountedRef = useRef(true);\n useEffect(function trackMountedState() {\n return () => {\n isMountedRef.current = false;\n };\n }, []);\n return isMountedRef;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;;AAEzC;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAA,EAAuC;EACjE,MAAMC,YAAY,GAAGF,MAAM,CAAC,IAAI,CAAC;EACjCD,SAAS,CAAC,YAA6B;IACrC,OAAO,MAAM;MACXG,YAAY,CAACC,OAAO,GAAG,KAAK;IAC9B,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EACN,OAAOD,YAAY;AACrB","ignoreList":[]}
|
|
@@ -84,7 +84,7 @@ export type BaseFormProps = BaseFormCommonProps & ({
|
|
|
84
84
|
interface BaseFormCommonProps {
|
|
85
85
|
formTitle?: string;
|
|
86
86
|
fieldDefinitions: ReadonlyArray<RendererFieldDefinition>;
|
|
87
|
-
onSubmit: (formState: Record<string, unknown>) => void;
|
|
87
|
+
onSubmit: (formState: Record<string, unknown>) => Promise<void> | void;
|
|
88
88
|
isSubmitDisabled?: boolean;
|
|
89
89
|
isPending?: boolean;
|
|
90
90
|
isLoading?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,kBACA,oBACA,gCACK,WAAY;AACnB,cAAc,6BAA6B,cAAe;AAC1D,cACE,kBACA,UACA,gBACA,qBACA,+BACK,mBAAoB;;;;;;;AAQ3B,YAAY,gBAAgB,UAAU,8BACjC,sBAAsB,KAAK;CAC5B,WAAW,UAAU;CACrB,oBACEA,UAAUC,WAAW,UAAU,OAAO,UAAU;AAEnD,MACE,sBAAsB,KAAK;CAC5B;CACA,qBACED,UAAUC,WAAW,UAAU,OAAO,UAAU;AAEnD;UAEO,sBAAsB,UAAU,mCAChC,KAAK,eAAe,cAAc,oBAC5C;CACE,kBAAkB;;;;CAKlB,uBAAuB,cAAc,oBAAoB;;;;;;;;;CAUzD,YACEC,WAAW,UAAU,IACrBC,cACEC,MAAM,iBAAiB,OACpB,QAAQ,oCACV;;;;;;CAOL,wBAAwBC,SAAS;;;;;;CAOjC,aAAaC,SAAS;;;;;;CAOtB,WAAWC,OAAO;AACnB;;;;AAKD,YAAY,UAAU,UAAU,gCAC7B,KAAK,SAAS,OAAM,eAAe,GAAG;;;;AAMzC,YAAY,YACR;CAAE,MAAM;CAAc,OAAO;AAAuB,IACpD;CAAE,MAAM;CAAc;AAAgB,IACtC;CAAE,MAAM;CAAW;AAAgB;;;;;;;;;;AAWvC,YAAY,gBACR,uBAEE;CACA,WAAW;CACX,qBAAqBC,kBAAkBC;AACxC,IACC;CACA;CACA,sBAAsBD,kBAAkBC;AACzC;UAGK,oBAAoB;CAC5B;CACA,kBAAkB,cAAc;CAChC,WAAWC,WAAW;
|
|
1
|
+
{"mappings":"AAgBA,cACE,kBACA,oBACA,gCACK,WAAY;AACnB,cAAc,6BAA6B,cAAe;AAC1D,cACE,kBACA,UACA,gBACA,qBACA,+BACK,mBAAoB;;;;;;;AAQ3B,YAAY,gBAAgB,UAAU,8BACjC,sBAAsB,KAAK;CAC5B,WAAW,UAAU;CACrB,oBACEA,UAAUC,WAAW,UAAU,OAAO,UAAU;AAEnD,MACE,sBAAsB,KAAK;CAC5B;CACA,qBACED,UAAUC,WAAW,UAAU,OAAO,UAAU;AAEnD;UAEO,sBAAsB,UAAU,mCAChC,KAAK,eAAe,cAAc,oBAC5C;CACE,kBAAkB;;;;CAKlB,uBAAuB,cAAc,oBAAoB;;;;;;;;;CAUzD,YACEC,WAAW,UAAU,IACrBC,cACEC,MAAM,iBAAiB,OACpB,QAAQ,oCACV;;;;;;CAOL,wBAAwBC,SAAS;;;;;;CAOjC,aAAaC,SAAS;;;;;;CAOtB,WAAWC,OAAO;AACnB;;;;AAKD,YAAY,UAAU,UAAU,gCAC7B,KAAK,SAAS,OAAM,eAAe,GAAG;;;;AAMzC,YAAY,YACR;CAAE,MAAM;CAAc,OAAO;AAAuB,IACpD;CAAE,MAAM;CAAc;AAAgB,IACtC;CAAE,MAAM;CAAW;AAAgB;;;;;;;;;;AAWvC,YAAY,gBACR,uBAEE;CACA,WAAW;CACX,qBAAqBC,kBAAkBC;AACxC,IACC;CACA;CACA,sBAAsBD,kBAAkBC;AACzC;UAGK,oBAAoB;CAC5B;CACA,kBAAkB,cAAc;CAChC,WAAWC,WAAW,4BAA4B;CAClD;CACA;CACA;CACA;AACD","names":["updater: (prevState: FormState<Q>) => FormState<Q>","prevState: FormState<Q>","formState: FormState<Q>","applyAction: (\n args: ActionParameters<Q>,\n ) => Promise<ActionEditResponse | undefined>","args: ActionParameters<Q>","results: ActionValidationResponse","results: ActionEditResponse | undefined","error: FormError","fieldKey: string","value: unknown","formState: Record<string, unknown>"],"sources":["../../../src/action-form/ActionFormApi.ts"],"version":3,"file":"ActionFormApi.d.ts"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":"AAkBA,OAAO,WAAqD,OAAQ;AAKpE,cAAc,qBAAqB,oBAAqB;AASxD,OAAO,cAAMA,UAAU,MAAM,GAAG","names":["BaseForm: React.FC<BaseFormProps>"],"sources":["../../../src/action-form/BaseForm.tsx"],"version":3,"file":"BaseForm.d.ts"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,OAAO,WAAqB,OAAQ;UAG1B,eAAe;CACvB;CACA;CACA;CACA;CACA;CACA,UAAU,MAAM;AACjB;AAED,OAAO,
|
|
1
|
+
{"mappings":"AAgBA,OAAO,WAAqB,OAAQ;UAG1B,eAAe;CACvB;CACA;CACA;CACA;CACA;CACA,UAAUA,GAAG,MAAM,WAAW;CAC9B,UAAU,MAAM;AACjB;AAED,OAAO,cAAMC,WAAW,MAAM,GAAG","names":["e: React.FocusEvent<HTMLDivElement>","FormField: React.FC<FormFieldProps>"],"sources":["../../../src/action-form/FormField.tsx"],"version":3,"file":"FormField.d.ts"}
|
|
@@ -47,30 +47,50 @@ export interface FormFieldDefinition<
|
|
|
47
47
|
*/
|
|
48
48
|
isDisabled?: boolean;
|
|
49
49
|
/**
|
|
50
|
-
* A callback to
|
|
50
|
+
* A callback to customize error messages when a built-in validation rule fails.
|
|
51
|
+
* Receives a discriminated union with the constraint data (e.g., the min value
|
|
52
|
+
* that was exceeded) so the message can reference the threshold.
|
|
51
53
|
*
|
|
52
|
-
*
|
|
53
|
-
* @returns the error message to display
|
|
54
|
+
* Return a string to override the default message, or `undefined` to keep it.
|
|
54
55
|
*/
|
|
55
|
-
onValidationError?: (error: ValidationError) => string;
|
|
56
|
+
onValidationError?: (error: ValidationError) => string | undefined;
|
|
56
57
|
/**
|
|
57
|
-
* Additional function to validate the field
|
|
58
|
+
* Additional function to validate the field.
|
|
58
59
|
*
|
|
59
|
-
*
|
|
60
|
-
* @returns a boolean promise indicating whether the value is valid
|
|
60
|
+
* Return `undefined` if valid, or an error message string if invalid.
|
|
61
61
|
*/
|
|
62
|
-
validate?: (value: FieldValueType<Q, K>) => Promise<
|
|
62
|
+
validate?: (value: FieldValueType<Q, K>) => Promise<string | undefined>;
|
|
63
63
|
/**
|
|
64
64
|
* The component props for the form field.
|
|
65
65
|
* Excludes runtime props (value, onChange) which are managed by ActionForm.
|
|
66
66
|
*/
|
|
67
67
|
fieldComponentProps: Omit<FormFieldPropsByType[ValidFormFieldForPropertyType<FieldDescriptorType<Q, K>>], FormManagedProps<ValidFormFieldForPropertyType<FieldDescriptorType<Q, K>>>>;
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
/**
|
|
70
|
+
* A discriminated union describing which validation rule failed and the
|
|
71
|
+
* constraint data the user needs to build a meaningful error message.
|
|
72
|
+
*/
|
|
73
|
+
export type ValidationError = {
|
|
74
|
+
type: "required"
|
|
75
|
+
} | {
|
|
76
|
+
type: "min"
|
|
77
|
+
min: number | Date
|
|
78
|
+
} | {
|
|
79
|
+
type: "max"
|
|
80
|
+
max: number | Date
|
|
81
|
+
} | {
|
|
82
|
+
type: "minLength"
|
|
83
|
+
minLength: number
|
|
84
|
+
} | {
|
|
85
|
+
type: "maxLength"
|
|
86
|
+
maxLength: number
|
|
87
|
+
} | {
|
|
88
|
+
type: "maxSize"
|
|
89
|
+
maxSize: number
|
|
90
|
+
} | {
|
|
91
|
+
type: "validate"
|
|
92
|
+
message: string
|
|
72
93
|
};
|
|
73
|
-
type ValidationRule = "required" | "min" | "max" | "minLength" | "maxLength" | "pattern" | "validate";
|
|
74
94
|
/**
|
|
75
95
|
* Maps field types to their corresponding props
|
|
76
96
|
*/
|
|
@@ -262,6 +282,11 @@ export interface BaseFormFieldProps<V> {
|
|
|
262
282
|
*/
|
|
263
283
|
id?: string;
|
|
264
284
|
/**
|
|
285
|
+
* The validation error message for this field, if any.
|
|
286
|
+
* When set, the field should display a visual error state.
|
|
287
|
+
*/
|
|
288
|
+
error?: string;
|
|
289
|
+
/**
|
|
265
290
|
* The value of the form field
|
|
266
291
|
*/
|
|
267
292
|
value: V | null;
|
|
@@ -350,6 +375,8 @@ export type RendererFieldDefinition = { [K in FieldComponent] : {
|
|
|
350
375
|
placeholder?: string
|
|
351
376
|
helperText?: string
|
|
352
377
|
helperTextPlacement?: "bottom" | "tooltip"
|
|
378
|
+
validate?: (value: unknown) => Promise<string | undefined>
|
|
379
|
+
onValidationError?: (error: ValidationError) => string | undefined
|
|
353
380
|
fieldComponentProps: Omit<FormFieldPropsByType[K], FormManagedProps<K>>
|
|
354
381
|
} }[FieldComponent];
|
|
355
382
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,kBACA,gBACA,aACA,qBACA,uBACA,WACA,4BACK,WAAY;AACnB,YAAY,WAAW,OAAQ;;;;AAK/B,iBAAiB;CACf,UAAU;CACV,UAAU,SAAS,KAAK,SAAS;EACjC;;;;CAIA,UAAU;;;;CAKV;;;;CAKA,eAAe,eAAe,GAAG;;;;CAKjC,gBAAgB,8BAA8B,oBAAoB,GAAG;;;;CAKrE;;;;CAKA;;;;;CAMA;;;;;;CAOA,sBAAsB,WAAW;;;;CAKjC
|
|
1
|
+
{"mappings":"AAgBA,cACE,kBACA,gBACA,aACA,qBACA,uBACA,WACA,4BACK,WAAY;AACnB,YAAY,WAAW,OAAQ;;;;AAK/B,iBAAiB;CACf,UAAU;CACV,UAAU,SAAS,KAAK,SAAS;EACjC;;;;CAIA,UAAU;;;;CAKV;;;;CAKA,eAAe,eAAe,GAAG;;;;CAKjC,gBAAgB,8BAA8B,oBAAoB,GAAG;;;;CAKrE;;;;CAKA;;;;;CAMA;;;;;;CAOA,sBAAsB,WAAW;;;;CAKjC;;;;;;;;CASA,qBAAqBA,OA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;CAAa;AAAmB,IACxC;CAAE,MAAM;CAAU,QAAQ;AAAwB;;;;;;;KAQjD,iBAAiB,UAAU,kBAAkB,yBAC1C,qBAAqB,KAAK,UAAU,aACxC;;;;;;;;;AAUJ,YAAY,6BACT,KAAK,kBAAiB;CACrB;CACA,gBAAgB;CAChB,YAAY;CACZ;CACA;CACA;CACA;CACA,sBAAsB,WAAW;CACjC,YAAYC,mBAAmB;CAC/B,qBAAqBR,OAAO;CAC5B,qBAAqB,KAAK,qBAAqB,IAAI,iBAAiB;AACrE,IACD;;;;AAKF,YAAY,8BAA8B,UAAU,uBAClD,UAAU,cAAc,eACpB,UAAU,WAAW,aACrB,UAAU,mBAAmB,eAAe,gBAC5C,UAAU,YAAY,kBAAkB,aACxC,UAAU,WAAW,eAAe,cACpC,UAAU,aAAa,cAAc,oBACrC,UACE,WACA,YACA,SACA,UACA,UACA,SACA,YAAY","names":["error: ValidationError","value: FieldValueType<Q, K>","date: Date","item: V","a: V","b: V","props: BaseFormFieldProps<V>","value: V | null","value: unknown"],"sources":["../../../src/action-form/FormFieldApi.ts"],"version":3,"file":"FormFieldApi.d.ts"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { DatetimePickerFieldProps } from "../FormFieldApi.js";
|
|
3
|
-
export declare function DatetimePickerField({ id, value, onChange, min, max, placeholder, formatDate, showTime, closeOnSelection }: DatetimePickerFieldProps): React.ReactElement;
|
|
3
|
+
export declare function DatetimePickerField({ id, value, onChange, error, min, max, placeholder, formatDate, showTime, closeOnSelection }: DatetimePickerFieldProps): React.ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAmBA,OAAO,WAA+C,OAAQ;AAM9D,cAAc,gCAAgC,oBAAqB;AAWnE,OAAO,iBAAS,oBAAoB,EAClC,IACA,OACA,UACA,KACA,KACA,aACA,YACA,UACA,kBACyB,EAAxB,2BAA2B,MAAM","names":[],"sources":["../../../../src/action-form/fields/DatetimePickerField.tsx"],"version":3,"file":"DatetimePickerField.d.ts"}
|
|
1
|
+
{"mappings":"AAmBA,OAAO,WAA+C,OAAQ;AAM9D,cAAc,gCAAgC,oBAAqB;AAWnE,OAAO,iBAAS,oBAAoB,EAClC,IACA,OACA,UACA,OACA,KACA,KACA,aACA,YACA,UACA,kBACyB,EAAxB,2BAA2B,MAAM","names":[],"sources":["../../../../src/action-form/fields/DatetimePickerField.tsx"],"version":3,"file":"DatetimePickerField.d.ts"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,OAAO,
|
|
1
|
+
{"mappings":"AAgBA,OAAO,WAA2C,OAAQ;AAC1D,cAAc,eAAe,iBAAkB;AAE/C,cAEE,+BACK,oBAAqB;AAI5B,iBAAiB,iBAAiB;CAChC,UAAU;CACV,SAAS,QAAQ;CACjB,oBAAoBA,kBAAkBC;AACvC;AAQD,OAAO,cAAMC,aAAa,MAAM,GAAG","names":["fieldKey: string","value: unknown","FieldBridge: React.FC<FieldBridgeProps>"],"sources":["../../../../src/action-form/fields/FieldBridge.tsx"],"version":3,"file":"FieldBridge.d.ts"}
|
|
@@ -4,5 +4,7 @@ export interface FormFieldRendererProps {
|
|
|
4
4
|
fieldDefinition: RendererFieldDefinition;
|
|
5
5
|
value: unknown;
|
|
6
6
|
onFieldValueChange: (value: unknown) => void;
|
|
7
|
+
onBlur: (e: React.FocusEvent<HTMLDivElement>) => void;
|
|
8
|
+
error: string | undefined;
|
|
7
9
|
}
|
|
8
10
|
export declare const FormFieldRenderer: React.FC<FormFieldRendererProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,OAAO,WAAqB,OAAQ;AAEpC,cAAc,+BAA+B,oBAAqB;AAWlE,iBAAiB,uBAAuB;CACtC,iBAAiB;CACjB;CACA,qBAAqBA;
|
|
1
|
+
{"mappings":"AAgBA,OAAO,WAAqB,OAAQ;AAEpC,cAAc,+BAA+B,oBAAqB;AAWlE,iBAAiB,uBAAuB;CACtC,iBAAiB;CACjB;CACA,qBAAqBA;CACrB,SAASC,GAAG,MAAM,WAAW;CAC7B;AACD;AAED,OAAO,cAAMC,mBAAmB,MAAM,GAAG","names":["value: unknown","e: React.FocusEvent<HTMLDivElement>","FormFieldRenderer: React.FC<FormFieldRendererProps>"],"sources":["../../../../src/action-form/fields/FormFieldRenderer.tsx"],"version":3,"file":"FormFieldRenderer.d.ts"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { NumberInputFieldProps } from "../FormFieldApi.js";
|
|
3
|
-
export declare function NumberInputField({ id, value, onChange, placeholder, min
|
|
3
|
+
export declare function NumberInputField({ id, value, onChange, error, placeholder, min, max, step }: NumberInputFieldProps): React.ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAmBA,OAAO,WAA8C,OAAQ;AAC7D,cAAc,6BAA6B,oBAAqB;
|
|
1
|
+
{"mappings":"AAmBA,OAAO,WAA8C,OAAQ;AAC7D,cAAc,6BAA6B,oBAAqB;AAoBhE,OAAO,iBAAS,iBAAiB,EAC/B,IACA,OACA,UACA,OACA,aACA,KACA,KACA,MACsB,EAArB,wBAAwB,MAAM","names":[],"sources":["../../../../src/action-form/fields/NumberInputField.tsx"],"version":3,"file":"NumberInputField.d.ts"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { TextAreaFieldProps } from "../FormFieldApi.js";
|
|
3
|
-
export declare function TextAreaField({ id, value, onChange, placeholder, rows, wrap, minLength, maxLength }: TextAreaFieldProps): React.ReactElement;
|
|
3
|
+
export declare function TextAreaField({ id, value, onChange, error, placeholder, rows, wrap, minLength, maxLength }: TextAreaFieldProps): React.ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAiBA,OAAO,WAA4B,OAAQ;AAC3C,cAAc,0BAA0B,oBAAqB;AAK7D,OAAO,iBAAS,cAAc,EAC5B,IACA,OACA,UACA,aACA,MACA,MACA,WACA,WACmB,EAAlB,qBAAqB,MAAM","names":[],"sources":["../../../../src/action-form/fields/TextAreaField.tsx"],"version":3,"file":"TextAreaField.d.ts"}
|
|
1
|
+
{"mappings":"AAiBA,OAAO,WAA4B,OAAQ;AAC3C,cAAc,0BAA0B,oBAAqB;AAK7D,OAAO,iBAAS,cAAc,EAC5B,IACA,OACA,UACA,OACA,aACA,MACA,MACA,WACA,WACmB,EAAlB,qBAAqB,MAAM","names":[],"sources":["../../../../src/action-form/fields/TextAreaField.tsx"],"version":3,"file":"TextAreaField.d.ts"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { TextInputFieldProps } from "../FormFieldApi.js";
|
|
3
|
-
export declare function TextInputField({ id, value, onChange, placeholder, minLength, maxLength }: TextInputFieldProps & {
|
|
3
|
+
export declare function TextInputField({ id, value, onChange, error, placeholder, minLength, maxLength }: TextInputFieldProps & {
|
|
4
4
|
id?: string
|
|
5
5
|
}): React.ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAiBA,OAAO,WAAW,OAAQ;AAC1B,cAAc,2BAA2B,oBAAqB;AAG9D,OAAO,iBAAS,eAAe,EAC7B,IACA,OACA,UACA,aACA,WACA,WACsC,EAArC,sBAAsB;CAAE;AAAa,IAAG,MAAM","names":[],"sources":["../../../../src/action-form/fields/TextInputField.tsx"],"version":3,"file":"TextInputField.d.ts"}
|
|
1
|
+
{"mappings":"AAiBA,OAAO,WAAW,OAAQ;AAC1B,cAAc,2BAA2B,oBAAqB;AAG9D,OAAO,iBAAS,eAAe,EAC7B,IACA,OACA,UACA,OACA,aACA,WACA,WACsC,EAArC,sBAAsB;CAAE;AAAa,IAAG,MAAM","names":[],"sources":["../../../../src/action-form/fields/TextInputField.tsx"],"version":3,"file":"TextInputField.d.ts"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RegisterOptions } from "react-hook-form";
|
|
2
|
+
import type { RendererFieldDefinition } from "../FormFieldApi.js";
|
|
3
|
+
type RhfRules = RegisterOptions<Record<string, unknown>, string>;
|
|
4
|
+
/**
|
|
5
|
+
* Derives react-hook-form validation rules from a field definition's
|
|
6
|
+
* constraint props (min, max, minLength, etc.) and the optional
|
|
7
|
+
* user-provided `validate` function.
|
|
8
|
+
*
|
|
9
|
+
* Called at rule-building time so that `onValidationError` can inject
|
|
10
|
+
* custom messages into the RHF rules object.
|
|
11
|
+
*/
|
|
12
|
+
export declare function extractValidationRules(fieldDef: RendererFieldDefinition): RhfRules;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,uBAAuB,iBAAkB;AACvD,cACE,+BAEK,oBAAqB;KAEvB,WAAW,gBAAgB;;;;;;;;;AAUhC,OAAO,iBAAS,uBACdA,UAAU,0BACT","names":["fieldDef: RendererFieldDefinition"],"sources":["../../../../src/action-form/utils/extractValidationRules.ts"],"version":3,"file":"extractValidationRules.d.ts"}
|
|
@@ -39,4 +39,4 @@ export { PdfViewer, type PdfViewerMediaProps } from "../pdf-viewer/PdfRenderer.j
|
|
|
39
39
|
export { ActionForm } from "../action-form/ActionForm.js";
|
|
40
40
|
export type { ActionFormProps, BaseFormProps, FormError, FormState } from "../action-form/ActionFormApi.js";
|
|
41
41
|
export { BaseForm } from "../action-form/BaseForm.js";
|
|
42
|
-
export type { ActionParameters, BaseFormFieldProps, CustomFieldProps, DatetimePickerFieldProps, DropdownFieldProps, FieldComponent, FieldValueType, FilePickerProps, FormFieldDefinition, FormFieldPropsByType, NumberInputFieldProps, ObjectSetFieldProps, Option, RadioButtonsFieldProps, RendererFieldDefinition, TextAreaFieldProps, TextInputFieldProps } from "../action-form/FormFieldApi.js";
|
|
42
|
+
export type { ActionParameters, BaseFormFieldProps, CustomFieldProps, DatetimePickerFieldProps, DropdownFieldProps, FieldComponent, FieldValueType, FilePickerProps, FormFieldDefinition, FormFieldPropsByType, NumberInputFieldProps, ObjectSetFieldProps, Option, RadioButtonsFieldProps, RendererFieldDefinition, TextAreaFieldProps, TextInputFieldProps, ValidationError } from "../action-form/FormFieldApi.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,SAAS,sBAAsB;AAC/B,cACE,qBACA,yBACK;AACP,SAAS,kBAAkB;AAE3B,cACE,uBACA,uBACK;AACP,cACE,qBACA,qBACA,aACA,gCACK;AACP,SACE,yBACA,6BACK;AAGP,SAAS,mBAAmB;AAC5B,cACE,kBACA,yBACA,qBACA,uBACA,kBACA,uBACA,wBACK;AACP,cAAc,oBAAoB;AAGlC,cAAc,sBAAsB;AACpC,SAAS,iBAAiB;AAE1B,SAAS,0BAA0B;AACnC,cACE,yBACA,2BACK;AAEP,SAAS,6BAA6B;AACtC,cACE,4BACA,sBACK;AAGP,SAAS,qBAAqB;AAC9B,cACE,gBACA,eACA,0BACA,qBACA,mBACA,mBACA,SACA,uBACA,gBACA,mBACK;AAGP,SACE,+BACK,qCACA;AACP,SACE,uBACK,6BACA;AACP,SACE,8BACK,oCACA;AACP,SACE,yBACK,+BACA;AACP,SACE,uBACK,6BACA;AACP,SACE,uBACK,6BACA;AAGP,cACO,wBACL,+BACK;AACP,SAAS,+BAA+B;AACxC,SAAS,sBAAsB;AAC/B,SACE,uBACK,8BACA,8BACA;AACP,SACE,0BACK,iCACA,iCACA;AACP,SAAS,qBAAqB;AAC9B,SACE,mBACK,0BACA;AACP,SACE,yBACK,gCACA;AACP,SAAS,wBAAwB;AACjC,cAAc,mBAAmB;AAGjC,cACO,uBACL,mBACA,qBACA,4BACK;AACP,cACE,iBACA,gCACK;AAGP,SACE,uBACK,8BACA,8BACA;AACP,SACE,wBACK,+BACA,+BACA;AAGP,SACE,gBACK,2BACA;AAEP,SAAS,kBAAkB;AAC3B,cACE,iBACA,eACA,WACA,iBACK;AACP,SAAS,gBAAgB;AACzB,cACE,kBACA,oBACA,kBACA,0BACA,oBACA,gBACA,gBACA,iBACA,qBACA,sBACA,uBACA,qBACA,QACA,wBACA,yBACA,oBACA,
|
|
1
|
+
{"mappings":"AAgBA,SAAS,sBAAsB;AAC/B,cACE,qBACA,yBACK;AACP,SAAS,kBAAkB;AAE3B,cACE,uBACA,uBACK;AACP,cACE,qBACA,qBACA,aACA,gCACK;AACP,SACE,yBACA,6BACK;AAGP,SAAS,mBAAmB;AAC5B,cACE,kBACA,yBACA,qBACA,uBACA,kBACA,uBACA,wBACK;AACP,cAAc,oBAAoB;AAGlC,cAAc,sBAAsB;AACpC,SAAS,iBAAiB;AAE1B,SAAS,0BAA0B;AACnC,cACE,yBACA,2BACK;AAEP,SAAS,6BAA6B;AACtC,cACE,4BACA,sBACK;AAGP,SAAS,qBAAqB;AAC9B,cACE,gBACA,eACA,0BACA,qBACA,mBACA,mBACA,SACA,uBACA,gBACA,mBACK;AAGP,SACE,+BACK,qCACA;AACP,SACE,uBACK,6BACA;AACP,SACE,8BACK,oCACA;AACP,SACE,yBACK,+BACA;AACP,SACE,uBACK,6BACA;AACP,SACE,uBACK,6BACA;AAGP,cACO,wBACL,+BACK;AACP,SAAS,+BAA+B;AACxC,SAAS,sBAAsB;AAC/B,SACE,uBACK,8BACA,8BACA;AACP,SACE,0BACK,iCACA,iCACA;AACP,SAAS,qBAAqB;AAC9B,SACE,mBACK,0BACA;AACP,SACE,yBACK,gCACA;AACP,SAAS,wBAAwB;AACjC,cAAc,mBAAmB;AAGjC,cACO,uBACL,mBACA,qBACA,4BACK;AACP,cACE,iBACA,gCACK;AAGP,SACE,uBACK,8BACA,8BACA;AACP,SACE,wBACK,+BACA,+BACA;AAGP,SACE,gBACK,2BACA;AAEP,SAAS,kBAAkB;AAC3B,cACE,iBACA,eACA,WACA,iBACK;AACP,SAAS,gBAAgB;AACzB,cACE,kBACA,oBACA,kBACA,0BACA,oBACA,gBACA,gBACA,iBACA,qBACA,sBACA,uBACA,qBACA,QACA,wBACA,yBACA,oBACA,qBACA,uBACK","names":[],"sources":["../../../src/public/experimental.ts"],"version":3,"file":"experimental.d.ts"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface AsyncActionState<Args extends unknown[]> {
|
|
2
|
+
isPending: boolean;
|
|
3
|
+
error: unknown;
|
|
4
|
+
execute: (...args: Args) => Promise<void>;
|
|
5
|
+
clearError: () => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Wraps an async callback with pending and error state tracking.
|
|
9
|
+
*
|
|
10
|
+
* - `isPending` is true while the action is executing
|
|
11
|
+
* - `error` holds the error from the last rejection (cleared on next execute or via clearError)
|
|
12
|
+
* - `execute` calls the action with pending/error bookkeeping
|
|
13
|
+
* - `clearError` resets the error to undefined
|
|
14
|
+
*/
|
|
15
|
+
export declare function useAsyncAction<Args extends unknown[]>(action: (...args: Args) => Promise<void> | void): AsyncActionState<Args>;
|
|
16
|
+
export {};
|