@uipath/apollo-wind 2.70.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.
Files changed (48) hide show
  1. package/dist/components/forms/field-control.cjs +3 -2
  2. package/dist/components/forms/field-control.js +3 -2
  3. package/dist/components/forms/validation-converter.cjs +14 -5
  4. package/dist/components/forms/validation-converter.js +14 -5
  5. package/dist/components/ui/chat-hero.cjs +244 -0
  6. package/dist/components/ui/chat-hero.d.ts +51 -0
  7. package/dist/components/ui/chat-hero.js +189 -0
  8. package/dist/components/ui/date-picker.cjs +6 -5
  9. package/dist/components/ui/date-picker.js +7 -6
  10. package/dist/components/ui/datetime-picker.cjs +7 -10
  11. package/dist/components/ui/datetime-picker.js +8 -11
  12. package/dist/components/ui/index.cjs +252 -230
  13. package/dist/components/ui/index.d.ts +2 -0
  14. package/dist/components/ui/index.js +2 -0
  15. package/dist/components/ui/prompt-suggestions.cjs +133 -0
  16. package/dist/components/ui/prompt-suggestions.d.ts +52 -0
  17. package/dist/components/ui/prompt-suggestions.js +90 -0
  18. package/dist/components/ui/quick-form-field/components/field-header.cjs +9 -4
  19. package/dist/components/ui/quick-form-field/components/field-header.d.ts +4 -1
  20. package/dist/components/ui/quick-form-field/components/field-header.js +9 -4
  21. package/dist/components/ui/quick-form-field/components/lock-toggle-button.cjs +2 -2
  22. package/dist/components/ui/quick-form-field/components/lock-toggle-button.d.ts +5 -4
  23. package/dist/components/ui/quick-form-field/components/lock-toggle-button.js +2 -2
  24. package/dist/components/ui/quick-form-field/index.d.ts +1 -1
  25. package/dist/components/ui/quick-form-field/quick-form-field.cjs +158 -222
  26. package/dist/components/ui/quick-form-field/quick-form-field.d.ts +6 -4
  27. package/dist/components/ui/quick-form-field/quick-form-field.js +159 -223
  28. package/dist/components/ui/quick-form-field/types.cjs +2 -2
  29. package/dist/components/ui/quick-form-field/types.d.ts +39 -32
  30. package/dist/components/ui/quick-form-field/types.js +2 -2
  31. package/dist/components/ui/quick-form-field/utils.cjs +5 -59
  32. package/dist/components/ui/quick-form-field/utils.d.ts +2 -24
  33. package/dist/components/ui/quick-form-field/utils.js +3 -48
  34. package/dist/index.cjs +40 -2
  35. package/dist/index.d.ts +5 -1
  36. package/dist/index.js +3 -1
  37. package/dist/lib/date-value.cjs +46 -0
  38. package/dist/lib/date-value.d.ts +8 -0
  39. package/dist/lib/date-value.js +12 -0
  40. package/dist/styles.css +82 -43
  41. package/dist/tailwind.utilities.css +15 -0
  42. package/package.json +1 -1
  43. package/dist/components/custom/chat-first-experience.cjs +0 -87
  44. package/dist/components/custom/chat-first-experience.d.ts +0 -24
  45. package/dist/components/custom/chat-first-experience.js +0 -53
  46. package/dist/components/custom/chat-prompt-suggestions.cjs +0 -49
  47. package/dist/components/custom/chat-prompt-suggestions.d.ts +0 -18
  48. package/dist/components/custom/chat-prompt-suggestions.js +0 -15
@@ -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
- return applyCustomExpression(schema, config);
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.coerce.date();
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
- return applyCustomExpression(schema, config);
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.coerce.date();
92
+ return z.date();
84
93
  case 'file':
85
94
  return z.any();
86
95
  case 'custom':
@@ -0,0 +1,244 @@
1
+ "use strict";
2
+ "use client";
3
+ var __webpack_require__ = {};
4
+ (()=>{
5
+ __webpack_require__.d = (exports1, definition)=>{
6
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ get: definition[key]
9
+ });
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.r = (exports1)=>{
17
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
18
+ value: 'Module'
19
+ });
20
+ Object.defineProperty(exports1, '__esModule', {
21
+ value: true
22
+ });
23
+ };
24
+ })();
25
+ var __webpack_exports__ = {};
26
+ __webpack_require__.r(__webpack_exports__);
27
+ __webpack_require__.d(__webpack_exports__, {
28
+ ChatHeroHeader: ()=>ChatHeroHeader,
29
+ chatHeroTitleVariants: ()=>chatHeroTitleVariants,
30
+ ChatHeroLogo: ()=>ChatHeroLogo,
31
+ ChatHeroDescription: ()=>ChatHeroDescription,
32
+ ChatHero: ()=>ChatHero,
33
+ ChatHeroTitle: ()=>ChatHeroTitle,
34
+ chatHeroVariants: ()=>chatHeroVariants,
35
+ chatHeroDescriptionVariants: ()=>chatHeroDescriptionVariants
36
+ });
37
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
38
+ const react_slot_namespaceObject = require("@radix-ui/react-slot");
39
+ const external_class_variance_authority_namespaceObject = require("class-variance-authority");
40
+ const external_react_namespaceObject = require("react");
41
+ const index_cjs_namespaceObject = require("../../lib/index.cjs");
42
+ const ChatHeroContext = /*#__PURE__*/ external_react_namespaceObject.createContext({
43
+ layout: 'centered',
44
+ density: 'comfortable'
45
+ });
46
+ const chatHeroVariants = (0, external_class_variance_authority_namespaceObject.cva)('flex w-full min-w-0 flex-1 flex-col', {
47
+ variants: {
48
+ layout: {
49
+ centered: 'mx-auto max-w-[800px] items-center justify-center',
50
+ docked: 'justify-end gap-6 text-start'
51
+ },
52
+ density: {
53
+ comfortable: '',
54
+ compact: ''
55
+ }
56
+ },
57
+ compoundVariants: [
58
+ {
59
+ layout: 'centered',
60
+ density: 'comfortable',
61
+ className: 'gap-8'
62
+ },
63
+ {
64
+ layout: 'centered',
65
+ density: 'compact',
66
+ className: 'gap-6'
67
+ }
68
+ ],
69
+ defaultVariants: {
70
+ layout: 'centered',
71
+ density: 'comfortable'
72
+ }
73
+ });
74
+ const ChatHero = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, layout, density, ...props }, ref)=>{
75
+ const context = external_react_namespaceObject.useMemo(()=>({
76
+ layout: layout ?? 'centered',
77
+ density: density ?? 'comfortable'
78
+ }), [
79
+ layout,
80
+ density
81
+ ]);
82
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ChatHeroContext.Provider, {
83
+ value: context,
84
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
85
+ ref: ref,
86
+ "data-slot": "chat-hero",
87
+ "data-layout": context.layout,
88
+ "data-density": context.density,
89
+ className: (0, index_cjs_namespaceObject.cn)(chatHeroVariants({
90
+ layout: context.layout,
91
+ density: context.density
92
+ }), className),
93
+ ...props
94
+ })
95
+ });
96
+ });
97
+ ChatHero.displayName = 'ChatHero';
98
+ const ChatHeroHeader = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, ...props }, ref)=>{
99
+ const { layout } = external_react_namespaceObject.useContext(ChatHeroContext);
100
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
101
+ ref: ref,
102
+ "data-slot": "chat-hero-header",
103
+ className: (0, index_cjs_namespaceObject.cn)('flex w-full min-w-0 flex-col empty:hidden', 'centered' === layout ? 'items-center gap-1 text-center' : 'items-start gap-2 text-start', className),
104
+ ...props
105
+ });
106
+ });
107
+ ChatHeroHeader.displayName = 'ChatHeroHeader';
108
+ const ChatHeroLogo = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
109
+ ref: ref,
110
+ "data-slot": "chat-hero-logo",
111
+ className: (0, index_cjs_namespaceObject.cn)('mb-3 flex shrink-0 items-center justify-center', className),
112
+ ...props
113
+ }));
114
+ ChatHeroLogo.displayName = 'ChatHeroLogo';
115
+ function isEmptyContent(children) {
116
+ return null == children || false === children || '' === children;
117
+ }
118
+ function isEmptyTitle(children, asChild) {
119
+ if (isEmptyContent(children)) return true;
120
+ if (!asChild || !/*#__PURE__*/ external_react_namespaceObject.isValidElement(children)) return false;
121
+ return isEmptyContent(children.props.children);
122
+ }
123
+ const chatHeroTitleVariants = (0, external_class_variance_authority_namespaceObject.cva)('min-w-0 text-foreground', {
124
+ variants: {
125
+ layout: {
126
+ centered: 'font-bold tracking-tight',
127
+ docked: 'font-semibold tracking-tight'
128
+ },
129
+ density: {
130
+ comfortable: '',
131
+ compact: ''
132
+ }
133
+ },
134
+ compoundVariants: [
135
+ {
136
+ layout: 'centered',
137
+ density: 'comfortable',
138
+ className: 'text-4xl leading-10'
139
+ },
140
+ {
141
+ layout: 'centered',
142
+ density: 'compact',
143
+ className: 'text-2xl leading-8'
144
+ },
145
+ {
146
+ layout: 'docked',
147
+ className: 'text-xl leading-6'
148
+ }
149
+ ],
150
+ defaultVariants: {
151
+ layout: 'centered',
152
+ density: 'comfortable'
153
+ }
154
+ });
155
+ const ChatHeroTitle = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, asChild = false, children, ...props }, ref)=>{
156
+ const { layout, density } = external_react_namespaceObject.useContext(ChatHeroContext);
157
+ if (isEmptyTitle(children, asChild)) return null;
158
+ const Comp = asChild ? react_slot_namespaceObject.Slot : 'h2';
159
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Comp, {
160
+ ref: ref,
161
+ "data-slot": "chat-hero-title",
162
+ className: (0, index_cjs_namespaceObject.cn)(chatHeroTitleVariants({
163
+ layout,
164
+ density
165
+ }), className),
166
+ ...props,
167
+ children: children
168
+ });
169
+ });
170
+ ChatHeroTitle.displayName = 'ChatHeroTitle';
171
+ const chatHeroDescriptionVariants = (0, external_class_variance_authority_namespaceObject.cva)('min-w-0 text-muted-foreground', {
172
+ variants: {
173
+ layout: {
174
+ centered: '',
175
+ docked: ''
176
+ },
177
+ density: {
178
+ comfortable: '',
179
+ compact: ''
180
+ }
181
+ },
182
+ compoundVariants: [
183
+ {
184
+ layout: 'centered',
185
+ density: 'comfortable',
186
+ className: 'text-base'
187
+ },
188
+ {
189
+ layout: 'centered',
190
+ density: 'compact',
191
+ className: 'text-sm'
192
+ },
193
+ {
194
+ layout: 'docked',
195
+ density: 'comfortable',
196
+ className: 'text-sm leading-5'
197
+ },
198
+ {
199
+ layout: 'docked',
200
+ density: 'compact',
201
+ className: 'text-xs leading-4'
202
+ }
203
+ ],
204
+ defaultVariants: {
205
+ layout: 'centered',
206
+ density: 'comfortable'
207
+ }
208
+ });
209
+ const ChatHeroDescription = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, children, ...props }, ref)=>{
210
+ const { layout, density } = external_react_namespaceObject.useContext(ChatHeroContext);
211
+ if (isEmptyContent(children)) return null;
212
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
213
+ ref: ref,
214
+ "data-slot": "chat-hero-description",
215
+ className: (0, index_cjs_namespaceObject.cn)(chatHeroDescriptionVariants({
216
+ layout,
217
+ density
218
+ }), className),
219
+ ...props,
220
+ children: children
221
+ });
222
+ });
223
+ ChatHeroDescription.displayName = "ChatHeroDescription";
224
+ exports.ChatHero = __webpack_exports__.ChatHero;
225
+ exports.ChatHeroDescription = __webpack_exports__.ChatHeroDescription;
226
+ exports.ChatHeroHeader = __webpack_exports__.ChatHeroHeader;
227
+ exports.ChatHeroLogo = __webpack_exports__.ChatHeroLogo;
228
+ exports.ChatHeroTitle = __webpack_exports__.ChatHeroTitle;
229
+ exports.chatHeroDescriptionVariants = __webpack_exports__.chatHeroDescriptionVariants;
230
+ exports.chatHeroTitleVariants = __webpack_exports__.chatHeroTitleVariants;
231
+ exports.chatHeroVariants = __webpack_exports__.chatHeroVariants;
232
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
233
+ "ChatHero",
234
+ "ChatHeroDescription",
235
+ "ChatHeroHeader",
236
+ "ChatHeroLogo",
237
+ "ChatHeroTitle",
238
+ "chatHeroDescriptionVariants",
239
+ "chatHeroTitleVariants",
240
+ "chatHeroVariants"
241
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
242
+ Object.defineProperty(exports, '__esModule', {
243
+ value: true
244
+ });
@@ -0,0 +1,51 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * The first-run state of a chat, before any message. `centered` is the home screen: greeting,
4
+ * composer and suggestions in a centered column. `docked` sits at the bottom of the message area,
5
+ * start-aligned, while the composer stays in the footer.
6
+ *
7
+ * ```tsx
8
+ * <ChatHero layout="centered">
9
+ * <ChatHeroHeader>
10
+ * <ChatHeroTitle>Hello David</ChatHeroTitle>
11
+ * <ChatHeroDescription>What should we work on today?</ChatHeroDescription>
12
+ * </ChatHeroHeader>
13
+ * <ChatComposer onSubmit={send}>...</ChatComposer>
14
+ * <PromptSuggestions suggestions={suggestions} onSelect={pick} />
15
+ * </ChatHero>
16
+ * ```
17
+ */
18
+ export type ChatHeroLayout = 'centered' | 'docked';
19
+ export type ChatHeroDensity = 'comfortable' | 'compact';
20
+ declare const chatHeroVariants: (props?: ({
21
+ layout?: "centered" | "docked" | null | undefined;
22
+ density?: "compact" | "comfortable" | null | undefined;
23
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
24
+ export interface ChatHeroProps extends React.HTMLAttributes<HTMLDivElement> {
25
+ layout?: ChatHeroLayout;
26
+ density?: ChatHeroDensity;
27
+ }
28
+ /** Fills its flex parent, so the parent decides the height that `centered` centers within. */
29
+ declare const ChatHero: React.ForwardRefExoticComponent<ChatHeroProps & React.RefAttributes<HTMLDivElement>>;
30
+ /** Holds the logo, title and description. Hidden when all of them render nothing. */
31
+ declare const ChatHeroHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
32
+ declare const ChatHeroLogo: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
33
+ declare const chatHeroTitleVariants: (props?: ({
34
+ layout?: "centered" | "docked" | null | undefined;
35
+ density?: "compact" | "comfortable" | null | undefined;
36
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
37
+ export interface ChatHeroTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
38
+ /**
39
+ * Renders the child element instead of an `h2`, such as an `h1` on a page of its own. Put
40
+ * class overrides on `ChatHeroTitle`, not the child: Slot joins the two without resolving
41
+ * conflicts.
42
+ */
43
+ asChild?: boolean;
44
+ }
45
+ declare const ChatHeroTitle: React.ForwardRefExoticComponent<ChatHeroTitleProps & React.RefAttributes<HTMLHeadingElement>>;
46
+ declare const chatHeroDescriptionVariants: (props?: ({
47
+ layout?: "centered" | "docked" | null | undefined;
48
+ density?: "compact" | "comfortable" | null | undefined;
49
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
50
+ declare const ChatHeroDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
51
+ export { ChatHero, ChatHeroDescription, ChatHeroHeader, ChatHeroLogo, ChatHeroTitle, chatHeroDescriptionVariants, chatHeroTitleVariants, chatHeroVariants, };
@@ -0,0 +1,189 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { Slot } from "@radix-ui/react-slot";
4
+ import { cva } from "class-variance-authority";
5
+ import { createContext, forwardRef, isValidElement, useContext, useMemo } from "react";
6
+ import { cn } from "../../lib/index.js";
7
+ const ChatHeroContext = /*#__PURE__*/ createContext({
8
+ layout: 'centered',
9
+ density: 'comfortable'
10
+ });
11
+ const chatHeroVariants = cva('flex w-full min-w-0 flex-1 flex-col', {
12
+ variants: {
13
+ layout: {
14
+ centered: 'mx-auto max-w-[800px] items-center justify-center',
15
+ docked: 'justify-end gap-6 text-start'
16
+ },
17
+ density: {
18
+ comfortable: '',
19
+ compact: ''
20
+ }
21
+ },
22
+ compoundVariants: [
23
+ {
24
+ layout: 'centered',
25
+ density: 'comfortable',
26
+ className: 'gap-8'
27
+ },
28
+ {
29
+ layout: 'centered',
30
+ density: 'compact',
31
+ className: 'gap-6'
32
+ }
33
+ ],
34
+ defaultVariants: {
35
+ layout: 'centered',
36
+ density: 'comfortable'
37
+ }
38
+ });
39
+ const ChatHero = /*#__PURE__*/ forwardRef(({ className, layout, density, ...props }, ref)=>{
40
+ const context = useMemo(()=>({
41
+ layout: layout ?? 'centered',
42
+ density: density ?? 'comfortable'
43
+ }), [
44
+ layout,
45
+ density
46
+ ]);
47
+ return /*#__PURE__*/ jsx(ChatHeroContext.Provider, {
48
+ value: context,
49
+ children: /*#__PURE__*/ jsx("div", {
50
+ ref: ref,
51
+ "data-slot": "chat-hero",
52
+ "data-layout": context.layout,
53
+ "data-density": context.density,
54
+ className: cn(chatHeroVariants({
55
+ layout: context.layout,
56
+ density: context.density
57
+ }), className),
58
+ ...props
59
+ })
60
+ });
61
+ });
62
+ ChatHero.displayName = 'ChatHero';
63
+ const ChatHeroHeader = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>{
64
+ const { layout } = useContext(ChatHeroContext);
65
+ return /*#__PURE__*/ jsx("div", {
66
+ ref: ref,
67
+ "data-slot": "chat-hero-header",
68
+ className: cn('flex w-full min-w-0 flex-col empty:hidden', 'centered' === layout ? 'items-center gap-1 text-center' : 'items-start gap-2 text-start', className),
69
+ ...props
70
+ });
71
+ });
72
+ ChatHeroHeader.displayName = 'ChatHeroHeader';
73
+ const ChatHeroLogo = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx("div", {
74
+ ref: ref,
75
+ "data-slot": "chat-hero-logo",
76
+ className: cn('mb-3 flex shrink-0 items-center justify-center', className),
77
+ ...props
78
+ }));
79
+ ChatHeroLogo.displayName = 'ChatHeroLogo';
80
+ function isEmptyContent(children) {
81
+ return null == children || false === children || '' === children;
82
+ }
83
+ function isEmptyTitle(children, asChild) {
84
+ if (isEmptyContent(children)) return true;
85
+ if (!asChild || !/*#__PURE__*/ isValidElement(children)) return false;
86
+ return isEmptyContent(children.props.children);
87
+ }
88
+ const chatHeroTitleVariants = cva('min-w-0 text-foreground', {
89
+ variants: {
90
+ layout: {
91
+ centered: 'font-bold tracking-tight',
92
+ docked: 'font-semibold tracking-tight'
93
+ },
94
+ density: {
95
+ comfortable: '',
96
+ compact: ''
97
+ }
98
+ },
99
+ compoundVariants: [
100
+ {
101
+ layout: 'centered',
102
+ density: 'comfortable',
103
+ className: 'text-4xl leading-10'
104
+ },
105
+ {
106
+ layout: 'centered',
107
+ density: 'compact',
108
+ className: 'text-2xl leading-8'
109
+ },
110
+ {
111
+ layout: 'docked',
112
+ className: 'text-xl leading-6'
113
+ }
114
+ ],
115
+ defaultVariants: {
116
+ layout: 'centered',
117
+ density: 'comfortable'
118
+ }
119
+ });
120
+ const ChatHeroTitle = /*#__PURE__*/ forwardRef(({ className, asChild = false, children, ...props }, ref)=>{
121
+ const { layout, density } = useContext(ChatHeroContext);
122
+ if (isEmptyTitle(children, asChild)) return null;
123
+ const Comp = asChild ? Slot : 'h2';
124
+ return /*#__PURE__*/ jsx(Comp, {
125
+ ref: ref,
126
+ "data-slot": "chat-hero-title",
127
+ className: cn(chatHeroTitleVariants({
128
+ layout,
129
+ density
130
+ }), className),
131
+ ...props,
132
+ children: children
133
+ });
134
+ });
135
+ ChatHeroTitle.displayName = 'ChatHeroTitle';
136
+ const chatHeroDescriptionVariants = cva('min-w-0 text-muted-foreground', {
137
+ variants: {
138
+ layout: {
139
+ centered: '',
140
+ docked: ''
141
+ },
142
+ density: {
143
+ comfortable: '',
144
+ compact: ''
145
+ }
146
+ },
147
+ compoundVariants: [
148
+ {
149
+ layout: 'centered',
150
+ density: 'comfortable',
151
+ className: 'text-base'
152
+ },
153
+ {
154
+ layout: 'centered',
155
+ density: 'compact',
156
+ className: 'text-sm'
157
+ },
158
+ {
159
+ layout: 'docked',
160
+ density: 'comfortable',
161
+ className: 'text-sm leading-5'
162
+ },
163
+ {
164
+ layout: 'docked',
165
+ density: 'compact',
166
+ className: 'text-xs leading-4'
167
+ }
168
+ ],
169
+ defaultVariants: {
170
+ layout: 'centered',
171
+ density: 'comfortable'
172
+ }
173
+ });
174
+ const ChatHeroDescription = /*#__PURE__*/ forwardRef(({ className, children, ...props }, ref)=>{
175
+ const { layout, density } = useContext(ChatHeroContext);
176
+ if (isEmptyContent(children)) return null;
177
+ return /*#__PURE__*/ jsx("p", {
178
+ ref: ref,
179
+ "data-slot": "chat-hero-description",
180
+ className: cn(chatHeroDescriptionVariants({
181
+ layout,
182
+ density
183
+ }), className),
184
+ ...props,
185
+ children: children
186
+ });
187
+ });
188
+ ChatHeroDescription.displayName = "ChatHeroDescription";
189
+ export { ChatHero, ChatHeroDescription, ChatHeroHeader, ChatHeroLogo, ChatHeroTitle, chatHeroDescriptionVariants, chatHeroTitleVariants, chatHeroVariants };
@@ -42,6 +42,7 @@ const external_input_group_context_cjs_namespaceObject = require("./input-group-
42
42
  const date_picker_DatePicker = /*#__PURE__*/ external_react_namespaceObject.forwardRef(function({ id, value, onValueChange, disabled, placeholder = 'Pick a date', className, calendarProps, error, errorId, 'aria-labelledby': ariaLabelledBy, 'aria-invalid': ariaInvalid, 'aria-describedby': ariaDescribedBy, 'aria-errormessage': ariaErrorMessage }, ref) {
43
43
  const generatedId = external_react_namespaceObject.useId();
44
44
  const validationId = errorId ?? `${id ?? `date-picker-${generatedId.replace(/:/g, '')}`}-error`;
45
+ const date = value instanceof Date && (0, external_date_fns_namespaceObject.isValid)(value) ? value : void 0;
45
46
  const group = (0, external_input_group_context_cjs_namespaceObject.useInputGroup)();
46
47
  const grouped = group.inGroup;
47
48
  const validation = (0, external_input_group_context_cjs_namespaceObject.useControlValidation)(group, {
@@ -53,7 +54,7 @@ const date_picker_DatePicker = /*#__PURE__*/ external_react_namespaceObject.forw
53
54
  });
54
55
  const triggerProps = {
55
56
  id,
56
- 'aria-label': id || ariaLabelledBy ? void 0 : value ? `Selected date: ${(0, external_date_fns_namespaceObject.format)(value, 'PPP')}` : placeholder,
57
+ 'aria-label': id || ariaLabelledBy ? void 0 : date ? `Selected date: ${(0, external_date_fns_namespaceObject.format)(date, 'PPP')}` : placeholder,
57
58
  'aria-labelledby': ariaLabelledBy,
58
59
  ...validation.aria,
59
60
  disabled: disabled || group.disabled
@@ -68,9 +69,9 @@ const date_picker_DatePicker = /*#__PURE__*/ external_react_namespaceObject.forw
68
69
  ...triggerProps,
69
70
  className: className,
70
71
  placeholder: placeholder,
71
- children: value && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
72
+ children: date && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
72
73
  className: "truncate",
73
- children: (0, external_date_fns_namespaceObject.format)(value, 'PPP')
74
+ children: (0, external_date_fns_namespaceObject.format)(date, 'PPP')
74
75
  })
75
76
  }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverTrigger, {
76
77
  asChild: true,
@@ -81,7 +82,7 @@ const date_picker_DatePicker = /*#__PURE__*/ external_react_namespaceObject.forw
81
82
  className: (0, index_cjs_namespaceObject.cn)('w-full justify-start text-left font-normal [&>svg]:text-foreground-muted hover:[&>svg]:text-accent-foreground', 'future:h-10 future:rounded-xl future:border-0 future:bg-surface-overlay future:px-4 future:gap-4 future:text-foreground future:hover:bg-surface-hover future:focus-visible:ring-offset-2 future:focus-visible:ring-offset-background', className),
82
83
  children: [
83
84
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.CalendarIcon, {}),
84
- value ? (0, external_date_fns_namespaceObject.format)(value, 'PPP') : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
85
+ date ? (0, external_date_fns_namespaceObject.format)(date, 'PPP') : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
85
86
  className: "text-foreground-muted",
86
87
  children: placeholder
87
88
  })
@@ -93,7 +94,7 @@ const date_picker_DatePicker = /*#__PURE__*/ external_react_namespaceObject.forw
93
94
  align: grouped ? 'start' : void 0,
94
95
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_calendar_cjs_namespaceObject.Calendar, {
95
96
  mode: "single",
96
- selected: value,
97
+ selected: date,
97
98
  onSelect: onValueChange,
98
99
  initialFocus: true,
99
100
  ...calendarProps