@uipath/apollo-wind 2.69.0 → 2.71.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/dist/components/custom/demo-composer.cjs +80 -0
- package/dist/components/custom/demo-composer.d.ts +11 -0
- package/dist/components/custom/demo-composer.js +46 -0
- package/dist/components/custom/panel-flow.cjs +2 -2
- package/dist/components/custom/panel-flow.js +2 -2
- package/dist/components/forms/field-control.cjs +3 -2
- package/dist/components/forms/field-control.js +3 -2
- package/dist/components/forms/validation-converter.cjs +14 -5
- package/dist/components/forms/validation-converter.js +14 -5
- package/dist/components/ui/chat-composer.cjs +429 -0
- package/dist/components/ui/chat-composer.d.ts +157 -0
- package/dist/components/ui/chat-composer.js +359 -0
- package/dist/components/ui/chat-hero.cjs +244 -0
- package/dist/components/ui/chat-hero.d.ts +51 -0
- package/dist/components/ui/chat-hero.js +189 -0
- package/dist/components/ui/citation.cjs +188 -0
- package/dist/components/ui/citation.d.ts +42 -0
- package/dist/components/ui/citation.js +148 -0
- package/dist/components/ui/date-picker.cjs +6 -5
- package/dist/components/ui/date-picker.js +7 -6
- package/dist/components/ui/datetime-picker.cjs +7 -10
- package/dist/components/ui/datetime-picker.js +8 -11
- package/dist/components/ui/dropzone-overlay.cjs +142 -0
- package/dist/components/ui/dropzone-overlay.d.ts +27 -0
- package/dist/components/ui/dropzone-overlay.js +105 -0
- package/dist/components/ui/file-upload.cjs +5 -29
- package/dist/components/ui/file-upload.js +2 -26
- package/dist/components/ui/file-validation.cjs +91 -0
- package/dist/components/ui/file-validation.d.ts +24 -0
- package/dist/components/ui/file-validation.js +51 -0
- package/dist/components/ui/hover-card.cjs +15 -8
- package/dist/components/ui/hover-card.d.ts +4 -1
- package/dist/components/ui/hover-card.js +16 -9
- package/dist/components/ui/index.cjs +304 -216
- package/dist/components/ui/index.d.ts +8 -0
- package/dist/components/ui/index.js +8 -0
- package/dist/components/ui/input-group.cjs +1 -1
- package/dist/components/ui/input-group.d.ts +2 -1
- package/dist/components/ui/input-group.js +1 -1
- package/dist/components/ui/message-actions.cjs +302 -0
- package/dist/components/ui/message-actions.d.ts +102 -0
- package/dist/components/ui/message-actions.js +241 -0
- package/dist/components/ui/message.cjs +1 -1
- package/dist/components/ui/message.d.ts +2 -0
- package/dist/components/ui/message.js +1 -1
- package/dist/components/ui/prompt-suggestions.cjs +133 -0
- package/dist/components/ui/prompt-suggestions.d.ts +52 -0
- package/dist/components/ui/prompt-suggestions.js +90 -0
- package/dist/components/ui/quick-form-field/components/field-header.cjs +9 -4
- package/dist/components/ui/quick-form-field/components/field-header.d.ts +4 -1
- package/dist/components/ui/quick-form-field/components/field-header.js +9 -4
- package/dist/components/ui/quick-form-field/components/lock-toggle-button.cjs +2 -2
- package/dist/components/ui/quick-form-field/components/lock-toggle-button.d.ts +5 -4
- package/dist/components/ui/quick-form-field/components/lock-toggle-button.js +2 -2
- package/dist/components/ui/quick-form-field/index.d.ts +1 -1
- package/dist/components/ui/quick-form-field/quick-form-field.cjs +158 -222
- package/dist/components/ui/quick-form-field/quick-form-field.d.ts +6 -4
- package/dist/components/ui/quick-form-field/quick-form-field.js +159 -223
- package/dist/components/ui/quick-form-field/types.cjs +2 -2
- package/dist/components/ui/quick-form-field/types.d.ts +39 -32
- package/dist/components/ui/quick-form-field/types.js +2 -2
- package/dist/components/ui/quick-form-field/utils.cjs +5 -59
- package/dist/components/ui/quick-form-field/utils.d.ts +2 -24
- package/dist/components/ui/quick-form-field/utils.js +3 -48
- package/dist/components/ui/sources.cjs +175 -0
- package/dist/components/ui/sources.d.ts +44 -0
- package/dist/components/ui/sources.js +132 -0
- package/dist/index.cjs +156 -7
- package/dist/index.d.ts +17 -1
- package/dist/index.js +9 -1
- package/dist/lib/date-value.cjs +46 -0
- package/dist/lib/date-value.d.ts +8 -0
- package/dist/lib/date-value.js +12 -0
- package/dist/lib/index.cjs +8 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +2 -1
- package/dist/lib/url.cjs +54 -0
- package/dist/lib/url.d.ts +8 -0
- package/dist/lib/url.js +17 -0
- package/dist/styles.css +239 -78
- package/dist/tailwind.utilities.css +15 -0
- package/package.json +1 -1
- package/dist/components/custom/chat-composer.cjs +0 -134
- package/dist/components/custom/chat-composer.d.ts +0 -14
- package/dist/components/custom/chat-composer.js +0 -100
- package/dist/components/custom/chat-first-experience.cjs +0 -87
- package/dist/components/custom/chat-first-experience.d.ts +0 -24
- package/dist/components/custom/chat-first-experience.js +0 -53
- package/dist/components/custom/chat-prompt-suggestions.cjs +0 -49
- package/dist/components/custom/chat-prompt-suggestions.d.ts +0 -18
- package/dist/components/custom/chat-prompt-suggestions.js +0 -15
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
DemoComposer: ()=>DemoComposer
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
31
|
+
const chat_composer_cjs_namespaceObject = require("../ui/chat-composer.cjs");
|
|
32
|
+
const input_group_cjs_namespaceObject = require("../ui/input-group.cjs");
|
|
33
|
+
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
34
|
+
function DemoComposer({ className, placeholder, onSubmit }) {
|
|
35
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(chat_composer_cjs_namespaceObject.ChatComposer, {
|
|
36
|
+
className: (0, index_cjs_namespaceObject.cn)('max-w-[800px] rounded-[32px] bg-surface-raised p-2', className),
|
|
37
|
+
onSubmit: (value)=>onSubmit?.(value.trim()),
|
|
38
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(chat_composer_cjs_namespaceObject.ChatComposerInputGroup, {
|
|
39
|
+
className: "rounded-[24px] border-border bg-surface future:rounded-[24px] future:border future:border-border future:bg-surface",
|
|
40
|
+
children: [
|
|
41
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(chat_composer_cjs_namespaceObject.ChatComposerTextarea, {
|
|
42
|
+
placeholder: placeholder,
|
|
43
|
+
minRows: 3,
|
|
44
|
+
className: "px-1 pt-2"
|
|
45
|
+
}),
|
|
46
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(chat_composer_cjs_namespaceObject.ChatComposerToolbar, {
|
|
47
|
+
className: "border-t-0 px-3 pb-3",
|
|
48
|
+
children: [
|
|
49
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(chat_composer_cjs_namespaceObject.ChatComposerAttachButton, {
|
|
50
|
+
size: "xs",
|
|
51
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Plus, {})
|
|
52
|
+
}),
|
|
53
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_group_cjs_namespaceObject.InputGroupButton, {
|
|
54
|
+
"aria-label": "Add workflow",
|
|
55
|
+
icon: true,
|
|
56
|
+
size: "xs",
|
|
57
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Workflow, {})
|
|
58
|
+
}),
|
|
59
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_group_cjs_namespaceObject.InputGroupButton, {
|
|
60
|
+
"aria-label": "Settings",
|
|
61
|
+
icon: true,
|
|
62
|
+
size: "xs",
|
|
63
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Settings2, {})
|
|
64
|
+
}),
|
|
65
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(chat_composer_cjs_namespaceObject.ChatComposerSubmit, {
|
|
66
|
+
size: "xs"
|
|
67
|
+
})
|
|
68
|
+
]
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
exports.DemoComposer = __webpack_exports__.DemoComposer;
|
|
75
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
76
|
+
"DemoComposer"
|
|
77
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
78
|
+
Object.defineProperty(exports, '__esModule', {
|
|
79
|
+
value: true
|
|
80
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface DemoComposerProps {
|
|
2
|
+
className?: string;
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
/** Called with the trimmed draft when the user sends. */
|
|
5
|
+
onSubmit?: (value: string) => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The prototype screens' composer: `ChatComposer` in a raised shell. Only typing and sending work;
|
|
9
|
+
* the attach, workflow and settings buttons are there for the look.
|
|
10
|
+
*/
|
|
11
|
+
export declare function DemoComposer({ className, placeholder, onSubmit }: DemoComposerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Plus, Settings2, Workflow } from "lucide-react";
|
|
3
|
+
import { ChatComposer, ChatComposerAttachButton, ChatComposerInputGroup, ChatComposerSubmit, ChatComposerTextarea, ChatComposerToolbar } from "../ui/chat-composer.js";
|
|
4
|
+
import { InputGroupButton } from "../ui/input-group.js";
|
|
5
|
+
import { cn } from "../../lib/index.js";
|
|
6
|
+
function DemoComposer({ className, placeholder, onSubmit }) {
|
|
7
|
+
return /*#__PURE__*/ jsx(ChatComposer, {
|
|
8
|
+
className: cn('max-w-[800px] rounded-[32px] bg-surface-raised p-2', className),
|
|
9
|
+
onSubmit: (value)=>onSubmit?.(value.trim()),
|
|
10
|
+
children: /*#__PURE__*/ jsxs(ChatComposerInputGroup, {
|
|
11
|
+
className: "rounded-[24px] border-border bg-surface future:rounded-[24px] future:border future:border-border future:bg-surface",
|
|
12
|
+
children: [
|
|
13
|
+
/*#__PURE__*/ jsx(ChatComposerTextarea, {
|
|
14
|
+
placeholder: placeholder,
|
|
15
|
+
minRows: 3,
|
|
16
|
+
className: "px-1 pt-2"
|
|
17
|
+
}),
|
|
18
|
+
/*#__PURE__*/ jsxs(ChatComposerToolbar, {
|
|
19
|
+
className: "border-t-0 px-3 pb-3",
|
|
20
|
+
children: [
|
|
21
|
+
/*#__PURE__*/ jsx(ChatComposerAttachButton, {
|
|
22
|
+
size: "xs",
|
|
23
|
+
children: /*#__PURE__*/ jsx(Plus, {})
|
|
24
|
+
}),
|
|
25
|
+
/*#__PURE__*/ jsx(InputGroupButton, {
|
|
26
|
+
"aria-label": "Add workflow",
|
|
27
|
+
icon: true,
|
|
28
|
+
size: "xs",
|
|
29
|
+
children: /*#__PURE__*/ jsx(Workflow, {})
|
|
30
|
+
}),
|
|
31
|
+
/*#__PURE__*/ jsx(InputGroupButton, {
|
|
32
|
+
"aria-label": "Settings",
|
|
33
|
+
icon: true,
|
|
34
|
+
size: "xs",
|
|
35
|
+
children: /*#__PURE__*/ jsx(Settings2, {})
|
|
36
|
+
}),
|
|
37
|
+
/*#__PURE__*/ jsx(ChatComposerSubmit, {
|
|
38
|
+
size: "xs"
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export { DemoComposer };
|
|
@@ -30,7 +30,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
30
30
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
31
|
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
32
32
|
const external_react_namespaceObject = require("react");
|
|
33
|
-
const
|
|
33
|
+
const external_demo_composer_cjs_namespaceObject = require("./demo-composer.cjs");
|
|
34
34
|
const avatar_cjs_namespaceObject = require("../ui/avatar.cjs");
|
|
35
35
|
const collapsible_cjs_namespaceObject = require("../ui/collapsible.cjs");
|
|
36
36
|
const tooltip_cjs_namespaceObject = require("../ui/tooltip.cjs");
|
|
@@ -338,7 +338,7 @@ function ExpandedPanel({ chatMessages, expandedContent, onClose }) {
|
|
|
338
338
|
}),
|
|
339
339
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
340
340
|
className: "pt-12",
|
|
341
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
341
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_demo_composer_cjs_namespaceObject.DemoComposer, {
|
|
342
342
|
placeholder: "Ask me to help build your Flow"
|
|
343
343
|
})
|
|
344
344
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Bot, Brain, ChevronUp, Copy, House, MessageCircle, PanelRightOpen, RefreshCcw, Search, ThumbsDown, ThumbsUp, Workflow } from "lucide-react";
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { DemoComposer } from "./demo-composer.js";
|
|
5
5
|
import { Avatar, AvatarFallback } from "../ui/avatar.js";
|
|
6
6
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../ui/collapsible.js";
|
|
7
7
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../ui/tooltip.js";
|
|
@@ -309,7 +309,7 @@ function ExpandedPanel({ chatMessages, expandedContent, onClose }) {
|
|
|
309
309
|
}),
|
|
310
310
|
/*#__PURE__*/ jsx("div", {
|
|
311
311
|
className: "pt-12",
|
|
312
|
-
children: /*#__PURE__*/ jsx(
|
|
312
|
+
children: /*#__PURE__*/ jsx(DemoComposer, {
|
|
313
313
|
placeholder: "Ask me to help build your Flow"
|
|
314
314
|
})
|
|
315
315
|
})
|
|
@@ -45,6 +45,7 @@ const select_cjs_namespaceObject = require("../ui/select.cjs");
|
|
|
45
45
|
const slider_cjs_namespaceObject = require("../ui/slider.cjs");
|
|
46
46
|
const switch_cjs_namespaceObject = require("../ui/switch.cjs");
|
|
47
47
|
const textarea_cjs_namespaceObject = require("../ui/textarea.cjs");
|
|
48
|
+
const date_value_cjs_namespaceObject = require("../../lib/date-value.cjs");
|
|
48
49
|
const external_aria_ids_cjs_namespaceObject = require("./aria-ids.cjs");
|
|
49
50
|
const external_literal_value_context_cjs_namespaceObject = require("./literal-value-context.cjs");
|
|
50
51
|
const external_string_list_field_cjs_namespaceObject = require("./string-list-field.cjs");
|
|
@@ -301,7 +302,7 @@ function FieldControl({ field, formField, options = NO_OPTIONS, disabled = false
|
|
|
301
302
|
case 'date':
|
|
302
303
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(date_picker_cjs_namespaceObject.DatePicker, {
|
|
303
304
|
id: field.name,
|
|
304
|
-
value: formField.value,
|
|
305
|
+
value: (0, date_value_cjs_namespaceObject.toDateValue)(formField.value),
|
|
305
306
|
onValueChange: formField.onChange,
|
|
306
307
|
disabled: disabled,
|
|
307
308
|
placeholder: field.placeholder,
|
|
@@ -315,7 +316,7 @@ function FieldControl({ field, formField, options = NO_OPTIONS, disabled = false
|
|
|
315
316
|
"aria-invalid": invalid || void 0,
|
|
316
317
|
"aria-describedby": describedById,
|
|
317
318
|
"aria-errormessage": errorId,
|
|
318
|
-
value: formField.value,
|
|
319
|
+
value: (0, date_value_cjs_namespaceObject.toDateValue)(formField.value),
|
|
319
320
|
onValueChange: formField.onChange,
|
|
320
321
|
disabled: disabled,
|
|
321
322
|
placeholder: field.placeholder,
|
|
@@ -14,6 +14,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from ".
|
|
|
14
14
|
import { Slider } from "../ui/slider.js";
|
|
15
15
|
import { Switch } from "../ui/switch.js";
|
|
16
16
|
import { Textarea } from "../ui/textarea.js";
|
|
17
|
+
import { toDateValue } from "../../lib/date-value.js";
|
|
17
18
|
import { joinIds } from "./aria-ids.js";
|
|
18
19
|
import { LiteralValueContext } from "./literal-value-context.js";
|
|
19
20
|
import { StringListControl } from "./string-list-field.js";
|
|
@@ -270,7 +271,7 @@ function FieldControl({ field, formField, options = NO_OPTIONS, disabled = false
|
|
|
270
271
|
case 'date':
|
|
271
272
|
return /*#__PURE__*/ jsx(DatePicker, {
|
|
272
273
|
id: field.name,
|
|
273
|
-
value: formField.value,
|
|
274
|
+
value: toDateValue(formField.value),
|
|
274
275
|
onValueChange: formField.onChange,
|
|
275
276
|
disabled: disabled,
|
|
276
277
|
placeholder: field.placeholder,
|
|
@@ -284,7 +285,7 @@ function FieldControl({ field, formField, options = NO_OPTIONS, disabled = false
|
|
|
284
285
|
"aria-invalid": invalid || void 0,
|
|
285
286
|
"aria-describedby": describedById,
|
|
286
287
|
"aria-errormessage": errorId,
|
|
287
|
-
value: formField.value,
|
|
288
|
+
value: toDateValue(formField.value),
|
|
288
289
|
onValueChange: formField.onChange,
|
|
289
290
|
disabled: disabled,
|
|
290
291
|
placeholder: field.placeholder,
|
|
@@ -31,11 +31,12 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
31
31
|
validationConfigToZod: ()=>validationConfigToZod
|
|
32
32
|
});
|
|
33
33
|
const external_zod_namespaceObject = require("zod");
|
|
34
|
+
const date_value_cjs_namespaceObject = require("../../lib/date-value.cjs");
|
|
34
35
|
const external_value_modes_cjs_namespaceObject = require("./value-modes.cjs");
|
|
35
36
|
const external_rules_engine_cjs_namespaceObject = require("./rules-engine.cjs");
|
|
36
37
|
function validationConfigToZod(config, fieldType, customValueType) {
|
|
37
38
|
let schema = getBaseSchemaForType(fieldType, customValueType);
|
|
38
|
-
if (!config) return schema.nullish();
|
|
39
|
+
if (!config) return withDateParsing(schema.nullish(), fieldType);
|
|
39
40
|
schema = applyStringConstraints(schema, config, fieldType, customValueType);
|
|
40
41
|
schema = applyNumberConstraints(schema, config, fieldType, customValueType);
|
|
41
42
|
schema = applyArrayConstraints(schema, config, fieldType, customValueType);
|
|
@@ -45,9 +46,18 @@ function validationConfigToZod(config, fieldType, customValueType) {
|
|
|
45
46
|
message: requiredMessage
|
|
46
47
|
});
|
|
47
48
|
if (isArrayType(fieldType, customValueType) && (null == config.minItems || config.minItems < 1)) schema = schema.min(1, requiredMessage);
|
|
48
|
-
|
|
49
|
+
if (isDateType(fieldType)) schema = external_zod_namespaceObject.z.date({
|
|
50
|
+
error: requiredMessage
|
|
51
|
+
});
|
|
52
|
+
return withDateParsing(applyCustomExpression(schema, config), fieldType);
|
|
49
53
|
}
|
|
50
|
-
return applyCustomExpression(schema, config).nullish();
|
|
54
|
+
return withDateParsing(applyCustomExpression(schema, config).nullish(), fieldType);
|
|
55
|
+
}
|
|
56
|
+
function isDateType(fieldType) {
|
|
57
|
+
return 'date' === fieldType || 'datetime' === fieldType;
|
|
58
|
+
}
|
|
59
|
+
function withDateParsing(schema, fieldType) {
|
|
60
|
+
return isDateType(fieldType) ? external_zod_namespaceObject.z.preprocess(date_value_cjs_namespaceObject.toDateValue, schema) : schema;
|
|
51
61
|
}
|
|
52
62
|
function modeAwareSchema(literalSchema, { codec, context, required, requiredMessage, validators }) {
|
|
53
63
|
return external_zod_namespaceObject.z.any().superRefine((stored, ctx)=>{
|
|
@@ -110,9 +120,8 @@ function getBaseSchemaForType(fieldType, customValueType) {
|
|
|
110
120
|
case 'string-list':
|
|
111
121
|
return external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.string());
|
|
112
122
|
case 'date':
|
|
113
|
-
return external_zod_namespaceObject.z.coerce.date();
|
|
114
123
|
case 'datetime':
|
|
115
|
-
return external_zod_namespaceObject.z.
|
|
124
|
+
return external_zod_namespaceObject.z.date();
|
|
116
125
|
case 'file':
|
|
117
126
|
return external_zod_namespaceObject.z.any();
|
|
118
127
|
case 'custom':
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { toDateValue } from "../../lib/date-value.js";
|
|
2
3
|
import { isDecodedEmpty } from "./value-modes.js";
|
|
3
4
|
import { RulesEngine } from "./rules-engine.js";
|
|
4
5
|
function validationConfigToZod(config, fieldType, customValueType) {
|
|
5
6
|
let schema = getBaseSchemaForType(fieldType, customValueType);
|
|
6
|
-
if (!config) return schema.nullish();
|
|
7
|
+
if (!config) return withDateParsing(schema.nullish(), fieldType);
|
|
7
8
|
schema = applyStringConstraints(schema, config, fieldType, customValueType);
|
|
8
9
|
schema = applyNumberConstraints(schema, config, fieldType, customValueType);
|
|
9
10
|
schema = applyArrayConstraints(schema, config, fieldType, customValueType);
|
|
@@ -13,9 +14,18 @@ function validationConfigToZod(config, fieldType, customValueType) {
|
|
|
13
14
|
message: requiredMessage
|
|
14
15
|
});
|
|
15
16
|
if (isArrayType(fieldType, customValueType) && (null == config.minItems || config.minItems < 1)) schema = schema.min(1, requiredMessage);
|
|
16
|
-
|
|
17
|
+
if (isDateType(fieldType)) schema = z.date({
|
|
18
|
+
error: requiredMessage
|
|
19
|
+
});
|
|
20
|
+
return withDateParsing(applyCustomExpression(schema, config), fieldType);
|
|
17
21
|
}
|
|
18
|
-
return applyCustomExpression(schema, config).nullish();
|
|
22
|
+
return withDateParsing(applyCustomExpression(schema, config).nullish(), fieldType);
|
|
23
|
+
}
|
|
24
|
+
function isDateType(fieldType) {
|
|
25
|
+
return 'date' === fieldType || 'datetime' === fieldType;
|
|
26
|
+
}
|
|
27
|
+
function withDateParsing(schema, fieldType) {
|
|
28
|
+
return isDateType(fieldType) ? z.preprocess(toDateValue, schema) : schema;
|
|
19
29
|
}
|
|
20
30
|
function modeAwareSchema(literalSchema, { codec, context, required, requiredMessage, validators }) {
|
|
21
31
|
return z.any().superRefine((stored, ctx)=>{
|
|
@@ -78,9 +88,8 @@ function getBaseSchemaForType(fieldType, customValueType) {
|
|
|
78
88
|
case 'string-list':
|
|
79
89
|
return z.array(z.string());
|
|
80
90
|
case 'date':
|
|
81
|
-
return z.coerce.date();
|
|
82
91
|
case 'datetime':
|
|
83
|
-
return z.
|
|
92
|
+
return z.date();
|
|
84
93
|
case 'file':
|
|
85
94
|
return z.any();
|
|
86
95
|
case 'custom':
|