@keboola/design 6.3.0 → 6.5.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/rjsf.js CHANGED
@@ -1,4 +1,4 @@
1
- import React26, { createContext, forwardRef, useCallback, use, useMemo, useRef, useState, useEffect, useContext, isValidElement, useId, useSyncExternalStore, useLayoutEffect, Children, Fragment as Fragment$1 } from 'react';
1
+ import React26, { createContext, forwardRef, use, useCallback, useMemo, useRef, useState, useEffect, useContext, isValidElement, useId, useSyncExternalStore, useLayoutEffect, Children, Fragment as Fragment$1 } from 'react';
2
2
  import Form from '@rjsf/core';
3
3
  import validator from '@rjsf/validator-ajv8';
4
4
  import { completeAnyWord, autocompletion } from '@codemirror/autocomplete';
@@ -28,10 +28,10 @@ import DOMPurify from 'dompurify';
28
28
  import { Root as Root$2, CollapsibleTrigger, Content as Content$1 } from '@radix-ui/react-collapsible';
29
29
  import * as RadixTabs from '@radix-ui/react-tabs';
30
30
  import * as ScrollAreaPrimitive2 from '@radix-ui/react-scroll-area';
31
- import TextareaAutosize from 'react-textarea-autosize';
32
- import { Root as Root$3, Trigger as Trigger$1, Close, Portal as Portal$1, Content as Content$2 } from '@radix-ui/react-popover';
33
31
  import * as RLabel from '@radix-ui/react-label';
32
+ import TextareaAutosize from 'react-textarea-autosize';
34
33
  import { Root, Indicator } from '@radix-ui/react-checkbox';
34
+ import { Root as Root$3, Trigger as Trigger$1, Close, Portal as Portal$1, Content as Content$2 } from '@radix-ui/react-popover';
35
35
  import { Combobox as Combobox$1 } from '@base-ui/react/combobox';
36
36
  import * as RRadioGroup from '@radix-ui/react-radio-group';
37
37
  import { Item, Indicator as Indicator$1 } from '@radix-ui/react-radio-group';
@@ -298,6 +298,7 @@ var Tooltip = ({
298
298
  placement = "right",
299
299
  forceHide = false,
300
300
  forceShow = false,
301
+ delayDuration,
301
302
  // trigger props
302
303
  triggerAsChild = false
303
304
  }) => {
@@ -317,6 +318,7 @@ var Tooltip = ({
317
318
  {
318
319
  open: !!tooltip && (open || forceShow) && !forceHide,
319
320
  onOpenChange: setOpen,
321
+ delayDuration,
320
322
  disableHoverableContent: isActionVariant,
321
323
  children: [
322
324
  /* @__PURE__ */ jsx(
@@ -380,7 +382,8 @@ var HelpBlock = ({ children, className, state = "default", ...rest }) => {
380
382
  var icons_exports = {};
381
383
  __export(icons_exports, {
382
384
  Google: () => Google,
383
- Keboola: () => Keboola
385
+ Keboola: () => Keboola,
386
+ Microsoft: () => Microsoft
384
387
  });
385
388
  __reExport(icons_exports, lucide_react_star);
386
389
  var Google = forwardRef(
@@ -439,6 +442,7 @@ var Keboola = forwardRef(
439
442
  width: size,
440
443
  height: size,
441
444
  viewBox: "0 0 300 512",
445
+ overflow: "visible",
442
446
  fill: color,
443
447
  className: cn("lucide", className),
444
448
  ...rest,
@@ -450,6 +454,29 @@ var Keboola = forwardRef(
450
454
  )
451
455
  );
452
456
  Keboola.displayName = "Keboola";
457
+ var Microsoft = forwardRef(
458
+ ({ size = 24, className, children, ...rest }, ref) => /* @__PURE__ */ jsxs(
459
+ "svg",
460
+ {
461
+ ref,
462
+ xmlns: "http://www.w3.org/2000/svg",
463
+ width: size,
464
+ height: size,
465
+ viewBox: "0 0 21 21",
466
+ fill: "none",
467
+ className: cn("lucide", className),
468
+ ...rest,
469
+ children: [
470
+ /* @__PURE__ */ jsx("rect", { x: "0", y: "0", width: "10", height: "10", fill: "#F25022" }),
471
+ /* @__PURE__ */ jsx("rect", { x: "11", y: "0", width: "10", height: "10", fill: "#7FBA00" }),
472
+ /* @__PURE__ */ jsx("rect", { x: "0", y: "11", width: "10", height: "10", fill: "#00A4EF" }),
473
+ /* @__PURE__ */ jsx("rect", { x: "11", y: "11", width: "10", height: "10", fill: "#FFB900" }),
474
+ children
475
+ ]
476
+ }
477
+ )
478
+ );
479
+ Microsoft.displayName = "Microsoft";
453
480
  var variants = cva(
454
481
  [
455
482
  "tailwindcss-preflight",
@@ -980,14 +1007,9 @@ var getLanguageMode = (mode) => {
980
1007
  return json();
981
1008
  }
982
1009
  };
1010
+ var shouldLintJson = (mode, readOnly) => mode === "application/json" && !readOnly;
983
1011
  var KbdSeparator = ({ className, ...props }) => /* @__PURE__ */ jsx("span", { ...props, className: cn("tw-text-xs tw-text-muted-foreground", className) });
984
- var KbdGroup = ({
985
- ref,
986
- className,
987
- children,
988
- separator,
989
- ...props
990
- }) => {
1012
+ var KbdGroup = ({ ref, className, children, separator, ...props }) => {
991
1013
  return /* @__PURE__ */ jsx(
992
1014
  "kbd",
993
1015
  {
@@ -1078,7 +1100,7 @@ var CodeEditor = ({
1078
1100
  const commonExtensions = useMemo(() => {
1079
1101
  return [
1080
1102
  getLanguageMode(mode),
1081
- mode === "application/json" && linter(jsonParseLinter()),
1103
+ shouldLintJson(mode, readOnly) && linter(jsonParseLinter()),
1082
1104
  withLineWrapping ? EditorView.lineWrapping : [],
1083
1105
  EditorState.languageData.of(() => [
1084
1106
  { autocomplete: completeAny ? completeAnyWord : autocompletions }
@@ -1096,7 +1118,7 @@ var CodeEditor = ({
1096
1118
  autocompletion({ activateOnTyping: completeAny }),
1097
1119
  baseTheme
1098
1120
  ].filter(Boolean);
1099
- }, [autocompletions, completeAny, extraKeys, mode, withLineWrapping, baseTheme]);
1121
+ }, [autocompletions, completeAny, extraKeys, mode, readOnly, withLineWrapping, baseTheme]);
1100
1122
  const extensions = useMemo(() => {
1101
1123
  return [
1102
1124
  ...commonExtensions,
@@ -1567,12 +1589,7 @@ var GridObjectField = ({
1567
1589
  gridContent
1568
1590
  ] });
1569
1591
  };
1570
- var CollapsibleContent = ({
1571
- ref,
1572
- className,
1573
- children,
1574
- ...props
1575
- }) => /* @__PURE__ */ jsx(
1592
+ var CollapsibleContent = ({ ref, className, children, ...props }) => /* @__PURE__ */ jsx(
1576
1593
  Content$1,
1577
1594
  {
1578
1595
  ref,
@@ -1588,12 +1605,7 @@ var CollapsibleContent = ({
1588
1605
  var Collapsible = (props) => /* @__PURE__ */ jsx(Root$2, { ...props });
1589
1606
  Collapsible.Trigger = CollapsibleTrigger;
1590
1607
  Collapsible.Content = CollapsibleContent;
1591
- var AlertAction = ({
1592
- ref,
1593
- className,
1594
- asChild = false,
1595
- ...props
1596
- }) => {
1608
+ var AlertAction = ({ ref, className, asChild = false, ...props }) => {
1597
1609
  const Comp = asChild ? Slot : "div";
1598
1610
  return /* @__PURE__ */ jsx(
1599
1611
  Comp,
@@ -1631,12 +1643,7 @@ var AlertCollapsibleIcon = ({ open }) => /* @__PURE__ */ jsx(Tooltip, { placemen
1631
1643
  )
1632
1644
  }
1633
1645
  ) });
1634
- var AlertDescription = ({
1635
- ref,
1636
- children,
1637
- className,
1638
- ...rest
1639
- }) => /* @__PURE__ */ jsx(
1646
+ var AlertDescription = ({ ref, children, className, ...rest }) => /* @__PURE__ */ jsx(
1640
1647
  "div",
1641
1648
  {
1642
1649
  ...rest,
@@ -1689,13 +1696,7 @@ var AlertIcon = ({ variant, icon, className, ...rest }) => /* @__PURE__ */ jsx(
1689
1696
  children: icon ?? VARIANT_ICONS[variant]
1690
1697
  }
1691
1698
  );
1692
- var AlertRoot = ({
1693
- ref,
1694
- children,
1695
- className,
1696
- variant,
1697
- ...rest
1698
- }) => {
1699
+ var AlertRoot = ({ ref, children, className, variant, ...rest }) => {
1699
1700
  const renderArgo = useArgoDesign();
1700
1701
  return /* @__PURE__ */ jsx(
1701
1702
  "div",
@@ -1752,11 +1753,7 @@ var AlertRoot = ({
1752
1753
  }
1753
1754
  );
1754
1755
  };
1755
- var AlertTitle = ({
1756
- ref,
1757
- className,
1758
- ...props
1759
- }) => /* @__PURE__ */ jsx(
1756
+ var AlertTitle = ({ ref, className, ...props }) => /* @__PURE__ */ jsx(
1760
1757
  "div",
1761
1758
  {
1762
1759
  ...props,
@@ -2286,6 +2283,55 @@ var ErrorListTemplate = ({ errors }) => {
2286
2283
  if (!errors.length) return null;
2287
2284
  return /* @__PURE__ */ jsx("div", { className: "tw-mb-4", children: errors.map((error) => /* @__PURE__ */ jsx("p", { className: "tw-text-xs tw-text-error-500", children: error.message }, `${error.property}:${error.message}`)) });
2288
2285
  };
2286
+ var Optional = ({ className, ...props }) => /* @__PURE__ */ jsx("span", { ...props, "aria-hidden": true, className: cn("tw-ml-0.5", "tw-text-muted-foreground", className), children: "(optional)" });
2287
+ var Required = ({ className, ...props }) => /* @__PURE__ */ jsx("span", { ...props, "aria-hidden": true, className: cn("tw-ml-0.5", "tw-text-primary", className), children: "*" });
2288
+ var Label = ({ className, children, id, htmlFor, ...rest }) => /* @__PURE__ */ jsx(
2289
+ RLabel.Root,
2290
+ {
2291
+ ...rest,
2292
+ id: id?.toString(),
2293
+ htmlFor: htmlFor?.toString(),
2294
+ className: cn(
2295
+ "tw-m-0 tw-text-foreground tw-font-normal peer-disabled:tw-opacity-50",
2296
+ className
2297
+ ),
2298
+ children
2299
+ }
2300
+ );
2301
+ Label.Optional = Optional;
2302
+ Label.Required = Required;
2303
+ var Link = ({
2304
+ ref,
2305
+ children,
2306
+ target = "_blank",
2307
+ rel = "noopener noreferrer",
2308
+ onClick,
2309
+ className,
2310
+ ...rest
2311
+ }) => {
2312
+ const handleOnClick = (event) => {
2313
+ event.stopPropagation();
2314
+ onClick?.(event);
2315
+ };
2316
+ return (
2317
+ // oxlint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
2318
+ /* @__PURE__ */ jsx(
2319
+ "a",
2320
+ {
2321
+ ...rest,
2322
+ ref,
2323
+ target,
2324
+ rel,
2325
+ onClick: handleOnClick,
2326
+ className: cn(
2327
+ "tw-text-primary tw-underline hover:tw-text-primary/90 hover:tw-no-underline",
2328
+ className
2329
+ ),
2330
+ children
2331
+ }
2332
+ )
2333
+ );
2334
+ };
2289
2335
  var FormGroupContext = createContext({
2290
2336
  state: "default"
2291
2337
  });
@@ -2333,12 +2379,7 @@ var InputGroupAddon = ({
2333
2379
  className,
2334
2380
  ...props
2335
2381
  }) => /* @__PURE__ */ jsx("div", { ...props, "data-align": align, className: cn(addonVariants({ align, className })), children });
2336
- var InputGroupButton = ({
2337
- ref,
2338
- className,
2339
- tabIndex = -1,
2340
- ...props
2341
- }) => /* @__PURE__ */ jsx(
2382
+ var InputGroupButton = ({ ref, className, tabIndex = -1, ...props }) => /* @__PURE__ */ jsx(
2342
2383
  Button,
2343
2384
  {
2344
2385
  ...props,
@@ -2349,11 +2390,7 @@ var InputGroupButton = ({
2349
2390
  className: cn("tw-size-5", "[&_svg]:tw-text-muted-foreground", className)
2350
2391
  }
2351
2392
  );
2352
- var InputGroupInput = ({
2353
- ref,
2354
- className,
2355
- ...inputProps
2356
- }) => /* @__PURE__ */ jsx(
2393
+ var InputGroupInput = ({ ref, className, ...inputProps }) => /* @__PURE__ */ jsx(
2357
2394
  "input",
2358
2395
  {
2359
2396
  ...inputProps,
@@ -2592,8 +2629,15 @@ var inputGroupVariants = cva(
2592
2629
  "tw-border-input",
2593
2630
  "tw-text-foreground",
2594
2631
  "has-[:is(input,textarea):disabled]:tw-opacity-50",
2632
+ // readonly: keep the themed input surface/border. The base layer's fixed
2633
+ // `neutral-150` (a light grey) is correct for the legacy light chrome but
2634
+ // collides with argo's themed `foreground` text — light-on-light, invisible
2635
+ // in dark mode. Re-pin to the same `muted`/`input` tokens the editable argo
2636
+ // input uses (validated AA), so readonly stays legible in every scheme.
2637
+ "has-[:is(input,textarea)[readonly]]:tw-bg-muted",
2638
+ "has-[:is(input,textarea)[readonly]]:tw-border-input",
2595
2639
  // higher specificity than has-[:is(input,textarea):focus] — prevents focus border on readonly
2596
- "has-[:is(input,textarea)[readonly]:focus]:tw-border-neutral-150",
2640
+ "has-[:is(input,textarea)[readonly]:focus]:tw-border-input",
2597
2641
  // aria-invalid on the control surfaces the error chrome without a `state` prop — the
2598
2642
  // accessible path (uses the themeable `destructive` status token).
2599
2643
  "has-[:is(input,textarea)[aria-invalid=true]]:tw-border-destructive",
@@ -2674,6 +2718,29 @@ InputGroup.Addon = InputGroupAddon;
2674
2718
  InputGroup.Button = InputGroupButton;
2675
2719
  InputGroup.TextArea = InputGroupTextArea;
2676
2720
  InputGroup.Text = InputGroupText;
2721
+ var useControllableState = ({
2722
+ prop,
2723
+ defaultProp,
2724
+ onChange
2725
+ }) => {
2726
+ const [uncontrolled, setUncontrolled] = useState(defaultProp);
2727
+ const isControlled = prop !== void 0;
2728
+ const value = prop !== void 0 ? prop : uncontrolled;
2729
+ const valueRef = useRef(value);
2730
+ valueRef.current = value;
2731
+ const onChangeRef = useRef(onChange);
2732
+ onChangeRef.current = onChange;
2733
+ const setValue = useCallback(
2734
+ (next) => {
2735
+ const nextValue = typeof next === "function" ? next(valueRef.current) : next;
2736
+ valueRef.current = nextValue;
2737
+ if (!isControlled) setUncontrolled(nextValue);
2738
+ onChangeRef.current?.(nextValue);
2739
+ },
2740
+ [isControlled]
2741
+ );
2742
+ return [value, setValue];
2743
+ };
2677
2744
 
2678
2745
  // src/blocks/ColorInput/utils.ts
2679
2746
  var HEX_CHARSET = /^[0-9a-fA-F]+$/;
@@ -2765,13 +2832,13 @@ var ColorInput = ({
2765
2832
  ...restInputProps
2766
2833
  }) => {
2767
2834
  const inputRef = useRef(null);
2768
- const [internalValue, setInternalValue] = useState(defaultValue ?? "");
2835
+ const [value, setValue] = useControllableState({
2836
+ // A `null` controlled value stays controlled (coerced to ''); `undefined` is uncontrolled.
2837
+ prop: valueProp === null ? "" : valueProp,
2838
+ defaultProp: defaultValue ?? "",
2839
+ onChange: onValueChange
2840
+ });
2769
2841
  const isControlled = valueProp !== void 0;
2770
- const value = isControlled ? valueProp ?? "" : internalValue;
2771
- const setValue = (nextValue) => {
2772
- if (!isControlled) setInternalValue(nextValue);
2773
- onValueChange?.(nextValue);
2774
- };
2775
2842
  const canClear = allowClear && !!value && !disabled && !readOnly;
2776
2843
  const swatchColor = coerceHexInputValue(value);
2777
2844
  const isValidSwatch = isCompleteHexColor(swatchColor);
@@ -2874,10 +2941,7 @@ var ColorInput = ({
2874
2941
  }
2875
2942
  );
2876
2943
  };
2877
- var FormGroupColorInput = ({
2878
- ref,
2879
- ...props
2880
- }) => {
2944
+ var FormGroupColorInput = ({ ref, ...props }) => {
2881
2945
  const { state } = useFormGroupContext();
2882
2946
  return /* @__PURE__ */ jsx(ColorInput, { state, ...props, ref });
2883
2947
  };
@@ -2951,10 +3015,7 @@ var NumberInput = ({
2951
3015
  }
2952
3016
  );
2953
3017
  };
2954
- var FormGroupNumberInput = ({
2955
- ref,
2956
- ...props
2957
- }) => {
3018
+ var FormGroupNumberInput = ({ ref, ...props }) => {
2958
3019
  const { state } = useFormGroupContext();
2959
3020
  return /* @__PURE__ */ jsx(NumberInput, { ...props, ref, state });
2960
3021
  };
@@ -2966,8 +3027,18 @@ var Textarea = ({
2966
3027
  variant,
2967
3028
  sizing,
2968
3029
  focusVariant,
3030
+ // value handling
3031
+ value: valueProp,
3032
+ defaultValue,
3033
+ onValueChange,
2969
3034
  ...rest
2970
3035
  }) => {
3036
+ const [value, setValue] = useControllableState({
3037
+ // `undefined` stays uncontrolled; any provided value (incl. `null`) is controlled, coerced to ''.
3038
+ prop: valueProp === void 0 ? void 0 : valueProp ?? "",
3039
+ defaultProp: defaultValue ?? "",
3040
+ onChange: onValueChange
3041
+ });
2971
3042
  return /* @__PURE__ */ jsx(
2972
3043
  InputGroup,
2973
3044
  {
@@ -2976,7 +3047,7 @@ var Textarea = ({
2976
3047
  focusVariant,
2977
3048
  variant,
2978
3049
  className: containerClassName,
2979
- children: /* @__PURE__ */ jsx(InputGroup.TextArea, { ...rest, ref })
3050
+ children: /* @__PURE__ */ jsx(InputGroup.TextArea, { ...rest, ref, value, onValueChange: setValue })
2980
3051
  }
2981
3052
  );
2982
3053
  };
@@ -2985,488 +3056,997 @@ var FormGroupTextarea = (props) => {
2985
3056
  return /* @__PURE__ */ jsx(Textarea, { state, ...props });
2986
3057
  };
2987
3058
 
2988
- // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tzName/index.js
2989
- function tzName(timeZone, date, format2 = "long") {
2990
- return new Intl.DateTimeFormat("en-US", {
2991
- // Enforces engine to render the time. Without the option JavaScriptCore omits it.
2992
- hour: "numeric",
2993
- timeZone,
2994
- timeZoneName: format2
2995
- }).format(date).split(/\s/g).slice(2).join(" ");
2996
- }
2997
-
2998
- // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tzOffset/index.js
2999
- var offsetFormatCache = {};
3000
- var offsetCache = {};
3001
- function tzOffset(timeZone, date) {
3002
- try {
3003
- const format2 = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat("en-US", {
3004
- timeZone,
3005
- timeZoneName: "longOffset"
3006
- }).format;
3007
- const offsetStr = format2(date).split("GMT")[1];
3008
- if (offsetStr in offsetCache) return offsetCache[offsetStr];
3009
- return calcOffset(offsetStr, offsetStr.split(":"));
3010
- } catch {
3011
- if (timeZone in offsetCache) return offsetCache[timeZone];
3012
- const captures = timeZone?.match(offsetRe);
3013
- if (captures) return calcOffset(timeZone, captures.slice(1));
3014
- return NaN;
3015
- }
3016
- }
3017
- var offsetRe = /([+-]\d\d):?(\d\d)?/;
3018
- function calcOffset(cacheStr, values) {
3019
- const hours = +(values[0] || 0);
3020
- const minutes = +(values[1] || 0);
3021
- const seconds = +(values[2] || 0) / 60;
3022
- return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;
3023
- }
3024
-
3025
- // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/date/mini.js
3026
- var TZDateMini = class _TZDateMini extends Date {
3027
- //#region static
3028
- constructor(...args) {
3029
- super();
3030
- if (args.length > 1 && typeof args[args.length - 1] === "string") {
3031
- this.timeZone = args.pop();
3032
- }
3033
- this.internal = /* @__PURE__ */ new Date();
3034
- if (isNaN(tzOffset(this.timeZone, this))) {
3035
- this.setTime(NaN);
3036
- } else {
3037
- if (!args.length) {
3038
- this.setTime(Date.now());
3039
- } else if (typeof args[0] === "number" && (args.length === 1 || args.length === 2 && typeof args[1] !== "number")) {
3040
- this.setTime(args[0]);
3041
- } else if (typeof args[0] === "string") {
3042
- this.setTime(+new Date(args[0]));
3043
- } else if (args[0] instanceof Date) {
3044
- this.setTime(+args[0]);
3045
- } else {
3046
- this.setTime(+new Date(...args));
3047
- adjustToSystemTZ(this);
3048
- syncToInternal(this);
3049
- }
3050
- }
3051
- }
3052
- static tz(tz, ...args) {
3053
- return args.length ? new _TZDateMini(...args, tz) : new _TZDateMini(Date.now(), tz);
3054
- }
3055
- //#endregion
3056
- //#region time zone
3057
- withTimeZone(timeZone) {
3058
- return new _TZDateMini(+this, timeZone);
3059
- }
3060
- getTimezoneOffset() {
3061
- const offset = -tzOffset(this.timeZone, this);
3062
- return offset > 0 ? Math.floor(offset) : Math.ceil(offset);
3063
- }
3064
- //#endregion
3065
- //#region time
3066
- setTime(time) {
3067
- Date.prototype.setTime.apply(this, arguments);
3068
- syncToInternal(this);
3069
- return +this;
3070
- }
3071
- //#endregion
3072
- //#region date-fns integration
3073
- [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) {
3074
- return new _TZDateMini(+new Date(date), this.timeZone);
3075
- }
3076
- //#endregion
3059
+ // src/blocks/TextInput/utils.ts
3060
+ var genInputTestId = (prefix = "") => {
3061
+ const ps = createPrefixedString(prefix);
3062
+ return {
3063
+ toString: () => prefix,
3064
+ inputWrapper: ps`input-wrapper`,
3065
+ input: ps`input`,
3066
+ clearButton: ps`clear-button`
3067
+ };
3077
3068
  };
3078
- var re = /^(get|set)(?!UTC)/;
3079
- Object.getOwnPropertyNames(Date.prototype).forEach((method) => {
3080
- if (!re.test(method)) return;
3081
- const utcMethod = method.replace(re, "$1UTC");
3082
- if (!TZDateMini.prototype[utcMethod]) return;
3083
- if (method.startsWith("get")) {
3084
- TZDateMini.prototype[method] = function() {
3085
- return this.internal[utcMethod]();
3086
- };
3087
- } else {
3088
- TZDateMini.prototype[method] = function() {
3089
- Date.prototype[utcMethod].apply(this.internal, arguments);
3090
- syncFromInternal(this);
3091
- return +this;
3092
- };
3093
- TZDateMini.prototype[utcMethod] = function() {
3094
- Date.prototype[utcMethod].apply(this, arguments);
3095
- syncToInternal(this);
3096
- return +this;
3097
- };
3098
- }
3099
- });
3100
- function syncToInternal(date) {
3101
- date.internal.setTime(+date);
3102
- date.internal.setUTCSeconds(date.internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, date) * 60));
3103
- }
3104
- function syncFromInternal(date) {
3105
- Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());
3106
- Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());
3107
- adjustToSystemTZ(date);
3108
- }
3109
- function adjustToSystemTZ(date) {
3110
- const baseOffset = tzOffset(date.timeZone, date);
3111
- const offset = baseOffset > 0 ? Math.floor(baseOffset) : Math.ceil(baseOffset);
3112
- const prevHour = /* @__PURE__ */ new Date(+date);
3113
- prevHour.setUTCHours(prevHour.getUTCHours() - 1);
3114
- const systemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset();
3115
- const prevHourSystemOffset = -(/* @__PURE__ */ new Date(+prevHour)).getTimezoneOffset();
3116
- const systemDSTChange = systemOffset - prevHourSystemOffset;
3117
- const dstShift = Date.prototype.getHours.apply(date) !== date.internal.getUTCHours();
3118
- if (systemDSTChange && dstShift) date.internal.setUTCMinutes(date.internal.getUTCMinutes() + systemDSTChange);
3119
- const offsetDiff = systemOffset - offset;
3120
- if (offsetDiff) Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);
3121
- const systemDate = /* @__PURE__ */ new Date(+date);
3122
- systemDate.setUTCSeconds(0);
3123
- const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;
3124
- const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;
3125
- if (secondsOffset || systemSecondsOffset) {
3126
- date.internal.setUTCSeconds(date.internal.getUTCSeconds() + secondsOffset);
3127
- Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);
3128
- }
3129
- const postBaseOffset = tzOffset(date.timeZone, date);
3130
- const postOffset = postBaseOffset > 0 ? Math.floor(postBaseOffset) : Math.ceil(postBaseOffset);
3131
- const postSystemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset();
3132
- const postOffsetDiff = postSystemOffset - postOffset;
3133
- const offsetChanged = postOffset !== offset;
3134
- const postDiff = postOffsetDiff - offsetDiff;
3135
- if (offsetChanged && postDiff) {
3136
- Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);
3137
- const newBaseOffset = tzOffset(date.timeZone, date);
3138
- const newOffset = newBaseOffset > 0 ? Math.floor(newBaseOffset) : Math.ceil(newBaseOffset);
3139
- const offsetChange = postOffset - newOffset;
3140
- if (offsetChange) {
3141
- date.internal.setUTCMinutes(date.internal.getUTCMinutes() + offsetChange);
3142
- Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);
3069
+ var sanitizeTextInputValue = (value) => {
3070
+ if (typeof value === "string" && value.trim() === "") return "";
3071
+ return value;
3072
+ };
3073
+ var TextInput = ({
3074
+ ref: forwardedRef,
3075
+ state = "default",
3076
+ sizing = "default",
3077
+ className,
3078
+ prefix = null,
3079
+ rightSuffix = null,
3080
+ rightSuffixVariant = "default",
3081
+ leftSuffix = null,
3082
+ allowClear = false,
3083
+ onClear,
3084
+ disabled = false,
3085
+ testId: prefixTestId = "",
3086
+ autoFocus = false,
3087
+ id,
3088
+ name,
3089
+ variant,
3090
+ readOnly,
3091
+ type = "text",
3092
+ focusVariant = "default",
3093
+ onChange,
3094
+ onBlur,
3095
+ onValueChange,
3096
+ onValueBlur,
3097
+ value: valueProp,
3098
+ defaultValue,
3099
+ ...inputProps
3100
+ }) => {
3101
+ const inputRef = useRef(null);
3102
+ const [value, setValue] = useControllableState({
3103
+ // `undefined` stays uncontrolled; any provided value (incl. `null`) is controlled and coerced
3104
+ // to a string. Whitespace-only input collapses to '' via `sanitizeTextInputValue`.
3105
+ prop: valueProp === void 0 ? void 0 : sanitizeTextInputValue(valueProp) ?? "",
3106
+ defaultProp: sanitizeTextInputValue(defaultValue) ?? "",
3107
+ onChange: onValueChange
3108
+ });
3109
+ const testId = genInputTestId(prefixTestId);
3110
+ const isClearButtonVisible = !!value && !disabled && !readOnly || !!onClear;
3111
+ const handleChange = (event) => {
3112
+ setValue(event.target.value);
3113
+ onChange?.(event);
3114
+ };
3115
+ const handleBlur = (event) => {
3116
+ onValueBlur?.(event.target.value);
3117
+ onBlur?.(event);
3118
+ };
3119
+ const handleClear = () => {
3120
+ if (inputRef.current === null) return;
3121
+ inputRef.current.value = "";
3122
+ inputRef.current.focus();
3123
+ onClear?.();
3124
+ handleChange(createChangeInputEvent(inputRef.current));
3125
+ };
3126
+ return /* @__PURE__ */ jsxs(
3127
+ InputGroup,
3128
+ {
3129
+ state,
3130
+ variant,
3131
+ sizing,
3132
+ focusVariant,
3133
+ className,
3134
+ "data-testid": testId.inputWrapper,
3135
+ children: [
3136
+ prefix && /* @__PURE__ */ jsx(InputGroup.Addon, { align: "inline-start", children: prefix }),
3137
+ /* @__PURE__ */ jsx(
3138
+ InputGroup.Input,
3139
+ {
3140
+ ...inputProps,
3141
+ value,
3142
+ autoFocus,
3143
+ type,
3144
+ onChange: handleChange,
3145
+ onBlur: handleBlur,
3146
+ ref: mergeRefs(forwardedRef ?? null, inputRef),
3147
+ disabled,
3148
+ id,
3149
+ name,
3150
+ readOnly,
3151
+ "data-testid": testId.input
3152
+ }
3153
+ ),
3154
+ (leftSuffix || allowClear || rightSuffix) && /* @__PURE__ */ jsxs(InputGroup.Addon, { align: "inline-end", children: [
3155
+ leftSuffix,
3156
+ allowClear && isClearButtonVisible && /* @__PURE__ */ jsx(
3157
+ InputGroup.Button,
3158
+ {
3159
+ "aria-label": "Clear",
3160
+ onMouseDown: (e) => e.preventDefault(),
3161
+ onClick: handleClear,
3162
+ "data-testid": testId.clearButton,
3163
+ children: /* @__PURE__ */ jsx(icons_exports.X, { className: "tw-size-4" })
3164
+ }
3165
+ ),
3166
+ rightSuffix && /* @__PURE__ */ jsx(
3167
+ "div",
3168
+ {
3169
+ className: cn({
3170
+ "tw-whitespace-nowrap tw-bg-muted tw-px-4 -tw-mr-4 tw-py-2.5": rightSuffixVariant === "addon"
3171
+ }),
3172
+ children: rightSuffix
3173
+ }
3174
+ )
3175
+ ] })
3176
+ ]
3143
3177
  }
3178
+ );
3179
+ };
3180
+ var FormGroupTextInput = ({ ref, ...props }) => {
3181
+ const { state } = useFormGroupContext();
3182
+ return /* @__PURE__ */ jsx(TextInput, { state, ...props, ref });
3183
+ };
3184
+ var FormGroup = ({ className, children, state, ...rest }) => {
3185
+ return /* @__PURE__ */ jsx(FormGroupProvider, { value: { state }, children: /* @__PURE__ */ jsx("div", { ...rest, className: cn("tw-flex tw-flex-col tw-gap-1", className), children }) });
3186
+ };
3187
+ FormGroup.Help = FormGroupHelp;
3188
+ FormGroup.Error = FormGroupError;
3189
+ FormGroup.TextInput = FormGroupTextInput;
3190
+ FormGroup.NumberInput = FormGroupNumberInput;
3191
+ FormGroup.ColorInput = FormGroupColorInput;
3192
+ FormGroup.Textarea = FormGroupTextarea;
3193
+ var RootFormDataContext = createContext({});
3194
+ var RootFormDataProvider = RootFormDataContext;
3195
+ var useRootFormData = () => use(RootFormDataContext);
3196
+ var resolveByPath2 = (parts, data) => {
3197
+ let current = data;
3198
+ for (const part of parts) {
3199
+ if (current == null || typeof current !== "object") return void 0;
3200
+ current = current[part];
3144
3201
  }
3145
- }
3146
-
3147
- // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/date/index.js
3148
- var TZDate = class _TZDate extends TZDateMini {
3149
- //#region static
3150
- static tz(tz, ...args) {
3151
- return args.length ? new _TZDate(...args, tz) : new _TZDate(Date.now(), tz);
3152
- }
3153
- //#endregion
3154
- //#region representation
3155
- toISOString() {
3156
- const [sign, hours, minutes] = this.tzComponents();
3157
- const tz = `${sign}${hours}:${minutes}`;
3158
- return this.internal.toISOString().slice(0, -1) + tz;
3159
- }
3160
- toString() {
3161
- return `${this.toDateString()} ${this.toTimeString()}`;
3202
+ return current;
3203
+ };
3204
+ var resolveDependencyValue = (path, formData, parentPath) => {
3205
+ if (path.startsWith("root.")) {
3206
+ return resolveByPath2(path.replace(/^root\./, "").split("."), formData);
3162
3207
  }
3163
- toDateString() {
3164
- const [day, date, month, year] = this.internal.toUTCString().split(" ");
3165
- return `${day?.slice(0, -1)} ${month} ${date} ${year}`;
3208
+ const parent = resolveByPath2(parentPath.map(String), formData);
3209
+ if (parent && typeof parent === "object") {
3210
+ const sibling = resolveByPath2(path.split("."), parent);
3211
+ if (sibling !== void 0) return sibling;
3166
3212
  }
3167
- toTimeString() {
3168
- const time = this.internal.toUTCString().split(" ")[4];
3169
- const [sign, hours, minutes] = this.tzComponents();
3170
- return `${time} GMT${sign}${hours}${minutes} (${tzName(this.timeZone, this)})`;
3213
+ return resolveByPath2(path.split("."), formData);
3214
+ };
3215
+ var evaluateDependencies = (dependencies, formData, parentPath) => {
3216
+ for (const [path, expected] of Object.entries(dependencies)) {
3217
+ const actual = resolveDependencyValue(path, formData, parentPath);
3218
+ if (Array.isArray(expected)) {
3219
+ if (!expected.includes(actual)) return false;
3220
+ } else if (expected === "") {
3221
+ if (actual !== "" && actual !== void 0 && actual !== null) return false;
3222
+ } else {
3223
+ if (actual !== expected) return false;
3224
+ }
3171
3225
  }
3172
- toLocaleString(locales, options) {
3173
- return Date.prototype.toLocaleString.call(this, locales, {
3174
- ...options,
3175
- timeZone: options?.timeZone || this.timeZone
3176
- });
3226
+ return true;
3227
+ };
3228
+ var DocumentationLinkIcon = ({
3229
+ documentation
3230
+ }) => /* @__PURE__ */ jsx(
3231
+ Tooltip,
3232
+ {
3233
+ placement: "top",
3234
+ variant: "explanatory",
3235
+ tooltip: documentation.tooltip ?? "Open documentation",
3236
+ triggerAsChild: true,
3237
+ children: /* @__PURE__ */ jsx(Link, { href: documentation.link, children: /* @__PURE__ */ jsx("span", { className: "tw-cursor-pointer tw-text-neutral-400 hover:tw-text-neutral-600", children: /* @__PURE__ */ jsx(icons_exports.BookOpen, { className: "tw-size-4" }) }) })
3177
3238
  }
3178
- toLocaleDateString(locales, options) {
3179
- return Date.prototype.toLocaleDateString.call(this, locales, {
3180
- ...options,
3181
- timeZone: options?.timeZone || this.timeZone
3182
- });
3239
+ );
3240
+ var FieldTemplateBody = ({
3241
+ id,
3242
+ label,
3243
+ rawHelp,
3244
+ rawDescription,
3245
+ rawErrors,
3246
+ children,
3247
+ schema,
3248
+ uiSchema,
3249
+ displayLabel
3250
+ }) => {
3251
+ const widget = uiSchema?.["ui:widget"];
3252
+ if (widget === "test-connection" || widget === "sync-action") {
3253
+ return /* @__PURE__ */ jsx(Fragment, { children });
3183
3254
  }
3184
- toLocaleTimeString(locales, options) {
3185
- return Date.prototype.toLocaleTimeString.call(this, locales, {
3186
- ...options,
3187
- timeZone: options?.timeZone || this.timeZone
3188
- });
3255
+ if (schema.type === "object") {
3256
+ return /* @__PURE__ */ jsx(Fragment, { children });
3189
3257
  }
3190
- //#endregion
3191
- //#region private
3192
- tzComponents() {
3193
- const offset = this.getTimezoneOffset();
3194
- const sign = offset > 0 ? "-" : "+";
3195
- const hours = String(Math.floor(Math.abs(offset) / 60)).padStart(2, "0");
3196
- const minutes = String(Math.abs(offset) % 60).padStart(2, "0");
3197
- return [sign, hours, minutes];
3258
+ if (schema.type === "array" && !uiSchema?.["ui:widget"]) {
3259
+ return /* @__PURE__ */ jsx(Fragment, { children });
3198
3260
  }
3199
- //#endregion
3200
- withTimeZone(timeZone) {
3201
- return new _TZDate(+this, timeZone);
3261
+ const uiOptions = uiSchema?.["ui:options"];
3262
+ const documentation = uiOptions?.documentation;
3263
+ const hasErrors = rawErrors && rawErrors.length > 0;
3264
+ const isCheckbox = schema.type === "boolean" && uiSchema?.["ui:widget"] !== "select";
3265
+ const showLabel = displayLabel && label && !isCheckbox;
3266
+ const hasHelpIcons = Boolean(rawHelp || documentation);
3267
+ const helpIcons = /* @__PURE__ */ jsxs(Fragment, { children: [
3268
+ rawHelp && /* @__PURE__ */ jsx(TooltipIcon, { rawHelp }),
3269
+ documentation && /* @__PURE__ */ jsx(DocumentationLinkIcon, { documentation })
3270
+ ] });
3271
+ return /* @__PURE__ */ jsxs(FormGroup, { state: hasErrors ? "error" : "default", children: [
3272
+ showLabel && /* @__PURE__ */ jsx(Label, { htmlFor: id, children: /* @__PURE__ */ jsxs("span", { className: "tw-inline-flex tw-items-center tw-gap-1", children: [
3273
+ label,
3274
+ helpIcons
3275
+ ] }) }),
3276
+ !showLabel && !isCheckbox && hasHelpIcons && /* @__PURE__ */ jsx("div", { className: "tw-flex tw-items-center tw-gap-1", children: helpIcons }),
3277
+ isCheckbox && hasHelpIcons ? /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [
3278
+ children,
3279
+ helpIcons
3280
+ ] }) : children,
3281
+ rawDescription && /* @__PURE__ */ jsx(FormGroup.Help, { children: /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(rawDescription) } }) }),
3282
+ hasErrors && /* @__PURE__ */ jsx(FormGroup.Help, { children: rawErrors.join(". ") })
3283
+ ] });
3284
+ };
3285
+ var FieldTemplateWithDependencies = ({
3286
+ dependencies,
3287
+ ...props
3288
+ }) => {
3289
+ const rootFormData = useRootFormData();
3290
+ const parentPath = props.fieldPathId.path.slice(0, -1);
3291
+ if (!evaluateDependencies(dependencies, rootFormData, parentPath)) {
3292
+ return null;
3202
3293
  }
3203
- //#region date-fns integration
3204
- [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) {
3205
- return new _TZDate(+new Date(date), this.timeZone);
3294
+ return /* @__PURE__ */ jsx(FieldTemplateBody, { ...props });
3295
+ };
3296
+ var FieldTemplate = (props) => {
3297
+ if (props.hidden) return /* @__PURE__ */ jsx("div", { className: "tw-hidden", children: props.children });
3298
+ if (props.uiSchema?.["ui:widget"] === "template-watch") {
3299
+ return /* @__PURE__ */ jsx("div", { className: "tw-hidden", children: props.children });
3206
3300
  }
3207
- //#endregion
3301
+ const uiOptions = props.uiSchema?.["ui:options"];
3302
+ const dependencies = uiOptions?.dependencies;
3303
+ if (dependencies) {
3304
+ return /* @__PURE__ */ jsx(FieldTemplateWithDependencies, { dependencies, ...props });
3305
+ }
3306
+ return /* @__PURE__ */ jsx(FieldTemplateBody, { ...props });
3208
3307
  };
3209
- var millisecondsInWeek = 6048e5;
3210
- var millisecondsInDay = 864e5;
3211
- var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom");
3212
-
3213
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/constructFrom.js
3214
- function constructFrom(date, value) {
3215
- if (typeof date === "function") return date(value);
3216
- if (date && typeof date === "object" && constructFromSymbol in date)
3217
- return date[constructFromSymbol](value);
3218
- if (date instanceof Date) return new date.constructor(value);
3219
- return new Date(value);
3220
- }
3221
-
3222
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/toDate.js
3223
- function toDate(argument, context) {
3224
- return constructFrom(context || argument, argument);
3225
- }
3226
-
3227
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addDays.js
3228
- function addDays(date, amount, options) {
3229
- const _date = toDate(date, options?.in);
3230
- if (isNaN(amount)) return constructFrom(date, NaN);
3231
- if (!amount) return _date;
3232
- _date.setDate(_date.getDate() + amount);
3233
- return _date;
3234
- }
3235
-
3236
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addMonths.js
3237
- function addMonths(date, amount, options) {
3238
- const _date = toDate(date, options?.in);
3239
- if (isNaN(amount)) return constructFrom(date, NaN);
3240
- if (!amount) {
3241
- return _date;
3308
+ var ObjectFieldTemplate = ({
3309
+ title,
3310
+ description,
3311
+ properties,
3312
+ formData,
3313
+ uiSchema,
3314
+ schema,
3315
+ fieldPathId
3316
+ }) => {
3317
+ const isRoot = !fieldPathId?.path?.length;
3318
+ const uiOptions = uiSchema?.["ui:options"];
3319
+ const hasCollapsed = uiOptions?.collapsed !== void 0;
3320
+ const collapsed = !!uiOptions?.collapsed;
3321
+ const disableCollapse = !!uiOptions?.disableCollapse;
3322
+ const lastPathSegment = fieldPathId?.path?.at(-1);
3323
+ const isArrayItem = typeof lastPathSegment === "number";
3324
+ const childSchemas = schema.properties;
3325
+ const isContainerSchema = (s) => {
3326
+ if (!s) return false;
3327
+ if (s.properties || s.items) return true;
3328
+ if (Array.isArray(s.type)) return s.type.includes("object") || s.type.includes("array");
3329
+ return s.type === "object" || s.type === "array";
3330
+ };
3331
+ const visibleProperties = properties.filter((prop) => {
3332
+ const childUi = uiSchema?.[prop.name];
3333
+ if (childUi?.["ui:widget"] !== "hidden") return true;
3334
+ return !isContainerSchema(childSchemas?.[prop.name]);
3335
+ });
3336
+ const isHiddenMount = (name) => {
3337
+ const w = uiSchema?.[name]?.["ui:widget"];
3338
+ return w === "hidden" || w === "template-watch";
3339
+ };
3340
+ const renderChildren = (props) => props.map((prop) => /* @__PURE__ */ jsx("div", { className: isHiddenMount(prop.name) ? "tw-hidden" : void 0, children: prop.content }, prop.name));
3341
+ if (isRoot) {
3342
+ return /* @__PURE__ */ jsx("div", { className: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden", children: renderChildren(visibleProperties) });
3242
3343
  }
3243
- const dayOfMonth = _date.getDate();
3244
- const endOfDesiredMonth = constructFrom(date, _date.getTime());
3245
- endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
3246
- const daysInMonth = endOfDesiredMonth.getDate();
3247
- if (dayOfMonth >= daysInMonth) {
3248
- return endOfDesiredMonth;
3249
- } else {
3250
- _date.setFullYear(
3251
- endOfDesiredMonth.getFullYear(),
3252
- endOfDesiredMonth.getMonth(),
3253
- dayOfMonth
3344
+ const childrenContent = renderChildren(visibleProperties);
3345
+ if (hasCollapsed && !disableCollapse) {
3346
+ const data = formData ?? {};
3347
+ const hasValues = Object.values(data).some(
3348
+ (v) => v !== void 0 && v !== null && v !== "" && v !== false
3349
+ );
3350
+ const defaultExpanded = hasValues ? !collapsed : true;
3351
+ return /* @__PURE__ */ jsxs(
3352
+ CollapsiblePanel,
3353
+ {
3354
+ className: "tw-rounded-lg",
3355
+ headerClassName: "tw-rounded-lg",
3356
+ header: title || "Settings",
3357
+ defaultExpanded,
3358
+ bodyClassName: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden",
3359
+ children: [
3360
+ description,
3361
+ childrenContent
3362
+ ]
3363
+ }
3254
3364
  );
3255
- return _date;
3256
3365
  }
3257
- }
3258
-
3259
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/defaultOptions.js
3260
- var defaultOptions = {};
3261
- function getDefaultOptions() {
3262
- return defaultOptions;
3263
- }
3264
-
3265
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfWeek.js
3266
- function startOfWeek(date, options) {
3267
- const defaultOptions2 = getDefaultOptions();
3268
- const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
3269
- const _date = toDate(date, options?.in);
3270
- const day = _date.getDay();
3271
- const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
3272
- _date.setDate(_date.getDate() - diff);
3273
- _date.setHours(0, 0, 0, 0);
3274
- return _date;
3275
- }
3276
-
3277
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeek.js
3278
- function startOfISOWeek(date, options) {
3279
- return startOfWeek(date, { ...options, weekStartsOn: 1 });
3280
- }
3281
-
3282
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISOWeekYear.js
3283
- function getISOWeekYear(date, options) {
3284
- const _date = toDate(date, options?.in);
3285
- const year = _date.getFullYear();
3286
- const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
3287
- fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
3288
- fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
3289
- const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
3290
- const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
3291
- fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
3292
- fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
3293
- const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
3294
- if (_date.getTime() >= startOfNextYear.getTime()) {
3295
- return year + 1;
3296
- } else if (_date.getTime() >= startOfThisYear.getTime()) {
3297
- return year;
3298
- } else {
3299
- return year - 1;
3366
+ if (isArrayItem) {
3367
+ return /* @__PURE__ */ jsx("div", { className: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden", children: childrenContent });
3300
3368
  }
3301
- }
3302
-
3303
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
3304
- function getTimezoneOffsetInMilliseconds(date) {
3305
- const _date = toDate(date);
3306
- const utcDate = new Date(
3307
- Date.UTC(
3308
- _date.getFullYear(),
3309
- _date.getMonth(),
3310
- _date.getDate(),
3311
- _date.getHours(),
3312
- _date.getMinutes(),
3313
- _date.getSeconds(),
3314
- _date.getMilliseconds()
3369
+ return /* @__PURE__ */ jsxs("div", { className: "tw-rounded-lg tw-border tw-border-solid tw-border-neutral-200 tw-bg-white tw-p-4", children: [
3370
+ title && /* @__PURE__ */ jsx("h3", { className: "tw-mb-2 tw-text-base tw-font-medium tw-text-neutral-800", children: title }),
3371
+ description && /* @__PURE__ */ jsx("p", { className: "tw-mb-3 tw-text-xs tw-text-neutral-400", children: description }),
3372
+ /* @__PURE__ */ jsx("div", { className: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden", children: childrenContent })
3373
+ ] });
3374
+ };
3375
+ var FieldBoxDescription = ({ className, ...props }) => /* @__PURE__ */ jsx(
3376
+ "span",
3377
+ {
3378
+ ...props,
3379
+ "data-slot": "field-box-description",
3380
+ className: cn(
3381
+ "tw-text-xs",
3382
+ "tw-text-muted-foreground",
3383
+ "group-has-[:disabled]/field-box:tw-opacity-50",
3384
+ className
3315
3385
  )
3316
- );
3317
- utcDate.setUTCFullYear(_date.getFullYear());
3318
- return +date - +utcDate;
3319
- }
3320
-
3321
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeDates.js
3322
- function normalizeDates(context, ...dates) {
3323
- const normalize = constructFrom.bind(
3324
- null,
3325
- dates.find((date) => typeof date === "object")
3326
- );
3327
- return dates.map(normalize);
3328
- }
3329
-
3330
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfDay.js
3331
- function startOfDay(date, options) {
3332
- const _date = toDate(date, options?.in);
3333
- _date.setHours(0, 0, 0, 0);
3334
- return _date;
3335
- }
3336
-
3337
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarDays.js
3338
- function differenceInCalendarDays(laterDate, earlierDate, options) {
3339
- const [laterDate_, earlierDate_] = normalizeDates(
3340
- options?.in,
3341
- laterDate,
3342
- earlierDate
3343
- );
3344
- const laterStartOfDay = startOfDay(laterDate_);
3345
- const earlierStartOfDay = startOfDay(earlierDate_);
3346
- const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
3347
- const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
3348
- return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
3349
- }
3350
-
3351
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeekYear.js
3352
- function startOfISOWeekYear(date, options) {
3353
- const year = getISOWeekYear(date, options);
3354
- const fourthOfJanuary = constructFrom(date, 0);
3355
- fourthOfJanuary.setFullYear(year, 0, 4);
3356
- fourthOfJanuary.setHours(0, 0, 0, 0);
3357
- return startOfISOWeek(fourthOfJanuary);
3358
- }
3359
-
3360
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addWeeks.js
3361
- function addWeeks(date, amount, options) {
3362
- return addDays(date, amount * 7, options);
3386
+ }
3387
+ );
3388
+ var FieldBoxTitle = ({ className, ...props }) => /* @__PURE__ */ jsx(
3389
+ "span",
3390
+ {
3391
+ ...props,
3392
+ "data-slot": "field-box-title",
3393
+ className: cn(
3394
+ "tw-text-sm",
3395
+ "tw-font-medium",
3396
+ "tw-text-foreground",
3397
+ "group-has-[:disabled]/field-box:tw-cursor-not-allowed",
3398
+ "group-has-[:disabled]/field-box:tw-opacity-50",
3399
+ className
3400
+ )
3401
+ }
3402
+ );
3403
+ var fieldBoxVariants = cva(
3404
+ [
3405
+ "tw-group/field-box",
3406
+ "tw-m-0",
3407
+ "tw-inline-flex",
3408
+ "tw-gap-3",
3409
+ "tw-items-center",
3410
+ "has-[[data-slot=field-box-description]]:tw-items-start",
3411
+ "tw-cursor-pointer",
3412
+ "tw-select-none",
3413
+ "has-[:disabled]:tw-cursor-not-allowed"
3414
+ ],
3415
+ {
3416
+ variants: {
3417
+ variant: {
3418
+ default: [],
3419
+ boxed: [
3420
+ "tw-rounded-lg",
3421
+ "tw-border",
3422
+ "tw-border-solid",
3423
+ "tw-border-border",
3424
+ "tw-p-3",
3425
+ "tw-transition-colors",
3426
+ "has-[[data-state=checked]]:tw-border-primary",
3427
+ "has-[[data-state=checked]]:tw-bg-accent",
3428
+ "has-[[data-state=indeterminate]]:tw-border-primary",
3429
+ "has-[[data-state=indeterminate]]:tw-bg-accent"
3430
+ ]
3431
+ }
3432
+ },
3433
+ defaultVariants: {
3434
+ variant: "default"
3435
+ }
3436
+ }
3437
+ );
3438
+ var FieldBoxRoot = ({
3439
+ ref,
3440
+ className,
3441
+ variant,
3442
+ position = "start",
3443
+ control,
3444
+ children,
3445
+ ...rest
3446
+ }) => /* @__PURE__ */ jsxs(
3447
+ "label",
3448
+ {
3449
+ ...rest,
3450
+ ref,
3451
+ className: cn(
3452
+ fieldBoxVariants({ variant, className }),
3453
+ position === "end" && "tw-flex-row-reverse"
3454
+ ),
3455
+ children: [
3456
+ /* @__PURE__ */ jsx("span", { className: "tw-inline-flex tw-min-h-5 tw-shrink-0 tw-items-center group-has-[[data-slot=field-box-description]]/field-box:tw-mt-0.5", children: control }),
3457
+ children != null && /* @__PURE__ */ jsx("span", { className: "tw-flex tw-flex-1 tw-flex-col tw-gap-0.5", children })
3458
+ ]
3459
+ }
3460
+ );
3461
+ var FieldBox = Object.assign(FieldBoxRoot, {
3462
+ Title: FieldBoxTitle,
3463
+ Description: FieldBoxDescription
3464
+ });
3465
+ var rootVariants = cva(
3466
+ [
3467
+ // reset
3468
+ "tailwindcss-preflight",
3469
+ // position
3470
+ "tw-flex",
3471
+ "tw-items-center",
3472
+ "tw-justify-center",
3473
+ "tw-peer",
3474
+ "tw-size-4",
3475
+ "tw-shrink-0",
3476
+ "tw-cursor-pointer",
3477
+ // border
3478
+ "tw-border",
3479
+ "tw-border-solid",
3480
+ // disabled
3481
+ "disabled:tw-opacity-50",
3482
+ "disabled:tw-cursor-not-allowed"
3483
+ ],
3484
+ {
3485
+ defaultVariants: {
3486
+ variant: "default"
3487
+ },
3488
+ variants: {
3489
+ variant: {
3490
+ default: [
3491
+ "tw-rounded",
3492
+ "tw-border-neutral-200",
3493
+ "data-[state=checked]:tw-bg-primary",
3494
+ "data-[state=checked]:tw-border-primary",
3495
+ "data-[state=indeterminate]:tw-bg-white",
3496
+ "data-[state=indeterminate]:tw-border-neutral-200"
3497
+ ],
3498
+ argo: [
3499
+ "tw-rounded",
3500
+ "tw-border-input",
3501
+ "tw-transition-colors",
3502
+ "data-[state=checked]:tw-bg-primary",
3503
+ "data-[state=checked]:tw-border-primary",
3504
+ "data-[state=indeterminate]:tw-bg-primary",
3505
+ "data-[state=indeterminate]:tw-border-primary",
3506
+ // focus
3507
+ "focus-visible:tw-outline-none",
3508
+ "focus-visible:tw-border-primary",
3509
+ "focus-visible:tw-ring-2",
3510
+ "focus-visible:tw-ring-ring/50"
3511
+ ]
3512
+ }
3513
+ }
3514
+ }
3515
+ );
3516
+ var indicatorVariants = cva(["tw-group", "tw-flex", "tw-items-center"], {
3517
+ defaultVariants: {
3518
+ variant: "default"
3519
+ },
3520
+ variants: {
3521
+ variant: {
3522
+ default: [
3523
+ "data-[state=checked]:tw-text-primary-foreground",
3524
+ "data-[state=indeterminate]:tw-text-neutral-200"
3525
+ ],
3526
+ argo: ["tw-text-primary-foreground"]
3527
+ }
3528
+ }
3529
+ });
3530
+ function Checkbox({
3531
+ className,
3532
+ id: idProp,
3533
+ children,
3534
+ description,
3535
+ variant,
3536
+ position,
3537
+ tooltip,
3538
+ tooltipPlacement = "top",
3539
+ ...rest
3540
+ }) {
3541
+ const fallbackId = useId();
3542
+ const id = idProp?.toString() ?? fallbackId;
3543
+ const styleVariant = useArgoDesign() ? "argo" : "default";
3544
+ const checkboxElement = /* @__PURE__ */ jsx(Root, { id, ...rest, className: cn(rootVariants({ variant: styleVariant, className })), children: /* @__PURE__ */ jsxs(Indicator, { className: cn(indicatorVariants({ variant: styleVariant })), children: [
3545
+ /* @__PURE__ */ jsx(icons_exports.Check, { className: "tw-hidden tw-size-3 tw-stroke-[4px] group-data-[state=checked]:tw-block" }),
3546
+ /* @__PURE__ */ jsx(icons_exports.Minus, { className: "tw-hidden tw-size-3 tw-stroke-[4px] group-data-[state=indeterminate]:tw-block" })
3547
+ ] }) });
3548
+ const rendered = !children ? checkboxElement : /* @__PURE__ */ jsxs(FieldBox, { htmlFor: id, variant, position, control: checkboxElement, children: [
3549
+ /* @__PURE__ */ jsx(FieldBox.Title, { children }),
3550
+ description && /* @__PURE__ */ jsx(FieldBox.Description, { children: description })
3551
+ ] });
3552
+ if (!tooltip) return rendered;
3553
+ return /* @__PURE__ */ jsx(Tooltip, { tooltip, placement: tooltipPlacement, triggerAsChild: !!children, children: rendered });
3363
3554
  }
3555
+ var CheckboxWidget = ({
3556
+ id,
3557
+ value,
3558
+ onChange,
3559
+ disabled,
3560
+ readonly,
3561
+ label,
3562
+ hideLabel
3563
+ }) => {
3564
+ const checked = !!value;
3565
+ return /* @__PURE__ */ jsx(Checkbox, { id, checked, onCheckedChange: onChange, disabled: disabled || readonly, children: hideLabel ? void 0 : label });
3566
+ };
3364
3567
 
3365
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addYears.js
3366
- function addYears(date, amount, options) {
3367
- return addMonths(date, amount * 12, options);
3568
+ // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tzName/index.js
3569
+ function tzName(timeZone, date, format2 = "long") {
3570
+ return new Intl.DateTimeFormat("en-US", {
3571
+ // Enforces engine to render the time. Without the option JavaScriptCore omits it.
3572
+ hour: "numeric",
3573
+ timeZone,
3574
+ timeZoneName: format2
3575
+ }).format(date).split(/\s/g).slice(2).join(" ");
3368
3576
  }
3369
3577
 
3370
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/max.js
3371
- function max(dates, options) {
3372
- let result;
3373
- let context = options?.in;
3374
- dates.forEach((date) => {
3375
- if (!context && typeof date === "object")
3376
- context = constructFrom.bind(null, date);
3377
- const date_ = toDate(date, context);
3378
- if (!result || result < date_ || isNaN(+date_)) result = date_;
3379
- });
3380
- return constructFrom(context, result || NaN);
3578
+ // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tzOffset/index.js
3579
+ var offsetFormatCache = {};
3580
+ var offsetCache = {};
3581
+ function tzOffset(timeZone, date) {
3582
+ try {
3583
+ const format2 = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat("en-US", {
3584
+ timeZone,
3585
+ timeZoneName: "longOffset"
3586
+ }).format;
3587
+ const offsetStr = format2(date).split("GMT")[1];
3588
+ if (offsetStr in offsetCache) return offsetCache[offsetStr];
3589
+ return calcOffset(offsetStr, offsetStr.split(":"));
3590
+ } catch {
3591
+ if (timeZone in offsetCache) return offsetCache[timeZone];
3592
+ const captures = timeZone?.match(offsetRe);
3593
+ if (captures) return calcOffset(timeZone, captures.slice(1));
3594
+ return NaN;
3595
+ }
3381
3596
  }
3382
-
3383
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/min.js
3384
- function min(dates, options) {
3385
- let result;
3386
- let context = options?.in;
3387
- dates.forEach((date) => {
3388
- if (!context && typeof date === "object")
3389
- context = constructFrom.bind(null, date);
3390
- const date_ = toDate(date, context);
3391
- if (!result || result > date_ || isNaN(+date_)) result = date_;
3392
- });
3393
- return constructFrom(context, result || NaN);
3597
+ var offsetRe = /([+-]\d\d):?(\d\d)?/;
3598
+ function calcOffset(cacheStr, values) {
3599
+ const hours = +(values[0] || 0);
3600
+ const minutes = +(values[1] || 0);
3601
+ const seconds = +(values[2] || 0) / 60;
3602
+ return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;
3394
3603
  }
3395
3604
 
3396
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isSameDay.js
3397
- function isSameDay(laterDate, earlierDate, options) {
3398
- const [dateLeft_, dateRight_] = normalizeDates(
3399
- options?.in,
3400
- laterDate,
3401
- earlierDate
3402
- );
3403
- return +startOfDay(dateLeft_) === +startOfDay(dateRight_);
3404
- }
3405
-
3406
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isDate.js
3407
- function isDate(value) {
3408
- return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
3605
+ // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/date/mini.js
3606
+ var TZDateMini = class _TZDateMini extends Date {
3607
+ //#region static
3608
+ constructor(...args) {
3609
+ super();
3610
+ if (args.length > 1 && typeof args[args.length - 1] === "string") {
3611
+ this.timeZone = args.pop();
3612
+ }
3613
+ this.internal = /* @__PURE__ */ new Date();
3614
+ if (isNaN(tzOffset(this.timeZone, this))) {
3615
+ this.setTime(NaN);
3616
+ } else {
3617
+ if (!args.length) {
3618
+ this.setTime(Date.now());
3619
+ } else if (typeof args[0] === "number" && (args.length === 1 || args.length === 2 && typeof args[1] !== "number")) {
3620
+ this.setTime(args[0]);
3621
+ } else if (typeof args[0] === "string") {
3622
+ this.setTime(+new Date(args[0]));
3623
+ } else if (args[0] instanceof Date) {
3624
+ this.setTime(+args[0]);
3625
+ } else {
3626
+ this.setTime(+new Date(...args));
3627
+ adjustToSystemTZ(this);
3628
+ syncToInternal(this);
3629
+ }
3630
+ }
3631
+ }
3632
+ static tz(tz, ...args) {
3633
+ return args.length ? new _TZDateMini(...args, tz) : new _TZDateMini(Date.now(), tz);
3634
+ }
3635
+ //#endregion
3636
+ //#region time zone
3637
+ withTimeZone(timeZone) {
3638
+ return new _TZDateMini(+this, timeZone);
3639
+ }
3640
+ getTimezoneOffset() {
3641
+ const offset = -tzOffset(this.timeZone, this);
3642
+ return offset > 0 ? Math.floor(offset) : Math.ceil(offset);
3643
+ }
3644
+ //#endregion
3645
+ //#region time
3646
+ setTime(time) {
3647
+ Date.prototype.setTime.apply(this, arguments);
3648
+ syncToInternal(this);
3649
+ return +this;
3650
+ }
3651
+ //#endregion
3652
+ //#region date-fns integration
3653
+ [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) {
3654
+ return new _TZDateMini(+new Date(date), this.timeZone);
3655
+ }
3656
+ //#endregion
3657
+ };
3658
+ var re = /^(get|set)(?!UTC)/;
3659
+ Object.getOwnPropertyNames(Date.prototype).forEach((method) => {
3660
+ if (!re.test(method)) return;
3661
+ const utcMethod = method.replace(re, "$1UTC");
3662
+ if (!TZDateMini.prototype[utcMethod]) return;
3663
+ if (method.startsWith("get")) {
3664
+ TZDateMini.prototype[method] = function() {
3665
+ return this.internal[utcMethod]();
3666
+ };
3667
+ } else {
3668
+ TZDateMini.prototype[method] = function() {
3669
+ Date.prototype[utcMethod].apply(this.internal, arguments);
3670
+ syncFromInternal(this);
3671
+ return +this;
3672
+ };
3673
+ TZDateMini.prototype[utcMethod] = function() {
3674
+ Date.prototype[utcMethod].apply(this, arguments);
3675
+ syncToInternal(this);
3676
+ return +this;
3677
+ };
3678
+ }
3679
+ });
3680
+ function syncToInternal(date) {
3681
+ date.internal.setTime(+date);
3682
+ date.internal.setUTCSeconds(date.internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, date) * 60));
3409
3683
  }
3410
-
3411
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isValid.js
3412
- function isValid(date) {
3413
- return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
3684
+ function syncFromInternal(date) {
3685
+ Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());
3686
+ Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());
3687
+ adjustToSystemTZ(date);
3414
3688
  }
3415
-
3416
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarMonths.js
3417
- function differenceInCalendarMonths(laterDate, earlierDate, options) {
3418
- const [laterDate_, earlierDate_] = normalizeDates(
3419
- options?.in,
3420
- laterDate,
3421
- earlierDate
3422
- );
3423
- const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();
3424
- const monthsDiff = laterDate_.getMonth() - earlierDate_.getMonth();
3425
- return yearsDiff * 12 + monthsDiff;
3689
+ function adjustToSystemTZ(date) {
3690
+ const baseOffset = tzOffset(date.timeZone, date);
3691
+ const offset = baseOffset > 0 ? Math.floor(baseOffset) : Math.ceil(baseOffset);
3692
+ const prevHour = /* @__PURE__ */ new Date(+date);
3693
+ prevHour.setUTCHours(prevHour.getUTCHours() - 1);
3694
+ const systemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset();
3695
+ const prevHourSystemOffset = -(/* @__PURE__ */ new Date(+prevHour)).getTimezoneOffset();
3696
+ const systemDSTChange = systemOffset - prevHourSystemOffset;
3697
+ const dstShift = Date.prototype.getHours.apply(date) !== date.internal.getUTCHours();
3698
+ if (systemDSTChange && dstShift) date.internal.setUTCMinutes(date.internal.getUTCMinutes() + systemDSTChange);
3699
+ const offsetDiff = systemOffset - offset;
3700
+ if (offsetDiff) Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);
3701
+ const systemDate = /* @__PURE__ */ new Date(+date);
3702
+ systemDate.setUTCSeconds(0);
3703
+ const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;
3704
+ const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;
3705
+ if (secondsOffset || systemSecondsOffset) {
3706
+ date.internal.setUTCSeconds(date.internal.getUTCSeconds() + secondsOffset);
3707
+ Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);
3708
+ }
3709
+ const postBaseOffset = tzOffset(date.timeZone, date);
3710
+ const postOffset = postBaseOffset > 0 ? Math.floor(postBaseOffset) : Math.ceil(postBaseOffset);
3711
+ const postSystemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset();
3712
+ const postOffsetDiff = postSystemOffset - postOffset;
3713
+ const offsetChanged = postOffset !== offset;
3714
+ const postDiff = postOffsetDiff - offsetDiff;
3715
+ if (offsetChanged && postDiff) {
3716
+ Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);
3717
+ const newBaseOffset = tzOffset(date.timeZone, date);
3718
+ const newOffset = newBaseOffset > 0 ? Math.floor(newBaseOffset) : Math.ceil(newBaseOffset);
3719
+ const offsetChange = postOffset - newOffset;
3720
+ if (offsetChange) {
3721
+ date.internal.setUTCMinutes(date.internal.getUTCMinutes() + offsetChange);
3722
+ Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);
3723
+ }
3724
+ }
3426
3725
  }
3427
3726
 
3428
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/endOfMonth.js
3429
- function endOfMonth(date, options) {
3430
- const _date = toDate(date, options?.in);
3431
- const month = _date.getMonth();
3432
- _date.setFullYear(_date.getFullYear(), month + 1, 0);
3433
- _date.setHours(23, 59, 59, 999);
3434
- return _date;
3435
- }
3727
+ // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/date/index.js
3728
+ var TZDate = class _TZDate extends TZDateMini {
3729
+ //#region static
3730
+ static tz(tz, ...args) {
3731
+ return args.length ? new _TZDate(...args, tz) : new _TZDate(Date.now(), tz);
3732
+ }
3733
+ //#endregion
3734
+ //#region representation
3735
+ toISOString() {
3736
+ const [sign, hours, minutes] = this.tzComponents();
3737
+ const tz = `${sign}${hours}:${minutes}`;
3738
+ return this.internal.toISOString().slice(0, -1) + tz;
3739
+ }
3740
+ toString() {
3741
+ return `${this.toDateString()} ${this.toTimeString()}`;
3742
+ }
3743
+ toDateString() {
3744
+ const [day, date, month, year] = this.internal.toUTCString().split(" ");
3745
+ return `${day?.slice(0, -1)} ${month} ${date} ${year}`;
3746
+ }
3747
+ toTimeString() {
3748
+ const time = this.internal.toUTCString().split(" ")[4];
3749
+ const [sign, hours, minutes] = this.tzComponents();
3750
+ return `${time} GMT${sign}${hours}${minutes} (${tzName(this.timeZone, this)})`;
3751
+ }
3752
+ toLocaleString(locales, options) {
3753
+ return Date.prototype.toLocaleString.call(this, locales, {
3754
+ ...options,
3755
+ timeZone: options?.timeZone || this.timeZone
3756
+ });
3757
+ }
3758
+ toLocaleDateString(locales, options) {
3759
+ return Date.prototype.toLocaleDateString.call(this, locales, {
3760
+ ...options,
3761
+ timeZone: options?.timeZone || this.timeZone
3762
+ });
3763
+ }
3764
+ toLocaleTimeString(locales, options) {
3765
+ return Date.prototype.toLocaleTimeString.call(this, locales, {
3766
+ ...options,
3767
+ timeZone: options?.timeZone || this.timeZone
3768
+ });
3769
+ }
3770
+ //#endregion
3771
+ //#region private
3772
+ tzComponents() {
3773
+ const offset = this.getTimezoneOffset();
3774
+ const sign = offset > 0 ? "-" : "+";
3775
+ const hours = String(Math.floor(Math.abs(offset) / 60)).padStart(2, "0");
3776
+ const minutes = String(Math.abs(offset) % 60).padStart(2, "0");
3777
+ return [sign, hours, minutes];
3778
+ }
3779
+ //#endregion
3780
+ withTimeZone(timeZone) {
3781
+ return new _TZDate(+this, timeZone);
3782
+ }
3783
+ //#region date-fns integration
3784
+ [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) {
3785
+ return new _TZDate(+new Date(date), this.timeZone);
3786
+ }
3787
+ //#endregion
3788
+ };
3789
+ var millisecondsInWeek = 6048e5;
3790
+ var millisecondsInDay = 864e5;
3791
+ var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom");
3436
3792
 
3437
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeInterval.js
3438
- function normalizeInterval(context, interval) {
3439
- const [start, end] = normalizeDates(context, interval.start, interval.end);
3440
- return { start, end };
3793
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/constructFrom.js
3794
+ function constructFrom(date, value) {
3795
+ if (typeof date === "function") return date(value);
3796
+ if (date && typeof date === "object" && constructFromSymbol in date)
3797
+ return date[constructFromSymbol](value);
3798
+ if (date instanceof Date) return new date.constructor(value);
3799
+ return new Date(value);
3441
3800
  }
3442
3801
 
3443
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/eachMonthOfInterval.js
3444
- function eachMonthOfInterval(interval, options) {
3445
- const { start, end } = normalizeInterval(options?.in, interval);
3446
- let reversed = +start > +end;
3447
- const endTime = reversed ? +start : +end;
3448
- const date = reversed ? end : start;
3449
- date.setHours(0, 0, 0, 0);
3450
- date.setDate(1);
3451
- let step = 1;
3452
- const dates = [];
3453
- while (+date <= endTime) {
3454
- dates.push(constructFrom(start, date));
3455
- date.setMonth(date.getMonth() + step);
3456
- }
3457
- return reversed ? dates.reverse() : dates;
3802
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/toDate.js
3803
+ function toDate(argument, context) {
3804
+ return constructFrom(context || argument, argument);
3458
3805
  }
3459
3806
 
3460
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfMonth.js
3461
- function startOfMonth(date, options) {
3807
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addDays.js
3808
+ function addDays(date, amount, options) {
3462
3809
  const _date = toDate(date, options?.in);
3463
- _date.setDate(1);
3464
- _date.setHours(0, 0, 0, 0);
3810
+ if (isNaN(amount)) return constructFrom(date, NaN);
3811
+ if (!amount) return _date;
3812
+ _date.setDate(_date.getDate() + amount);
3465
3813
  return _date;
3466
3814
  }
3467
3815
 
3468
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/endOfYear.js
3469
- function endOfYear(date, options) {
3816
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addMonths.js
3817
+ function addMonths(date, amount, options) {
3818
+ const _date = toDate(date, options?.in);
3819
+ if (isNaN(amount)) return constructFrom(date, NaN);
3820
+ if (!amount) {
3821
+ return _date;
3822
+ }
3823
+ const dayOfMonth = _date.getDate();
3824
+ const endOfDesiredMonth = constructFrom(date, _date.getTime());
3825
+ endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
3826
+ const daysInMonth = endOfDesiredMonth.getDate();
3827
+ if (dayOfMonth >= daysInMonth) {
3828
+ return endOfDesiredMonth;
3829
+ } else {
3830
+ _date.setFullYear(
3831
+ endOfDesiredMonth.getFullYear(),
3832
+ endOfDesiredMonth.getMonth(),
3833
+ dayOfMonth
3834
+ );
3835
+ return _date;
3836
+ }
3837
+ }
3838
+
3839
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/defaultOptions.js
3840
+ var defaultOptions = {};
3841
+ function getDefaultOptions() {
3842
+ return defaultOptions;
3843
+ }
3844
+
3845
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfWeek.js
3846
+ function startOfWeek(date, options) {
3847
+ const defaultOptions2 = getDefaultOptions();
3848
+ const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
3849
+ const _date = toDate(date, options?.in);
3850
+ const day = _date.getDay();
3851
+ const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
3852
+ _date.setDate(_date.getDate() - diff);
3853
+ _date.setHours(0, 0, 0, 0);
3854
+ return _date;
3855
+ }
3856
+
3857
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeek.js
3858
+ function startOfISOWeek(date, options) {
3859
+ return startOfWeek(date, { ...options, weekStartsOn: 1 });
3860
+ }
3861
+
3862
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISOWeekYear.js
3863
+ function getISOWeekYear(date, options) {
3864
+ const _date = toDate(date, options?.in);
3865
+ const year = _date.getFullYear();
3866
+ const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
3867
+ fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
3868
+ fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
3869
+ const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
3870
+ const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
3871
+ fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
3872
+ fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
3873
+ const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
3874
+ if (_date.getTime() >= startOfNextYear.getTime()) {
3875
+ return year + 1;
3876
+ } else if (_date.getTime() >= startOfThisYear.getTime()) {
3877
+ return year;
3878
+ } else {
3879
+ return year - 1;
3880
+ }
3881
+ }
3882
+
3883
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
3884
+ function getTimezoneOffsetInMilliseconds(date) {
3885
+ const _date = toDate(date);
3886
+ const utcDate = new Date(
3887
+ Date.UTC(
3888
+ _date.getFullYear(),
3889
+ _date.getMonth(),
3890
+ _date.getDate(),
3891
+ _date.getHours(),
3892
+ _date.getMinutes(),
3893
+ _date.getSeconds(),
3894
+ _date.getMilliseconds()
3895
+ )
3896
+ );
3897
+ utcDate.setUTCFullYear(_date.getFullYear());
3898
+ return +date - +utcDate;
3899
+ }
3900
+
3901
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeDates.js
3902
+ function normalizeDates(context, ...dates) {
3903
+ const normalize = constructFrom.bind(
3904
+ null,
3905
+ dates.find((date) => typeof date === "object")
3906
+ );
3907
+ return dates.map(normalize);
3908
+ }
3909
+
3910
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfDay.js
3911
+ function startOfDay(date, options) {
3912
+ const _date = toDate(date, options?.in);
3913
+ _date.setHours(0, 0, 0, 0);
3914
+ return _date;
3915
+ }
3916
+
3917
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarDays.js
3918
+ function differenceInCalendarDays(laterDate, earlierDate, options) {
3919
+ const [laterDate_, earlierDate_] = normalizeDates(
3920
+ options?.in,
3921
+ laterDate,
3922
+ earlierDate
3923
+ );
3924
+ const laterStartOfDay = startOfDay(laterDate_);
3925
+ const earlierStartOfDay = startOfDay(earlierDate_);
3926
+ const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
3927
+ const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
3928
+ return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
3929
+ }
3930
+
3931
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeekYear.js
3932
+ function startOfISOWeekYear(date, options) {
3933
+ const year = getISOWeekYear(date, options);
3934
+ const fourthOfJanuary = constructFrom(date, 0);
3935
+ fourthOfJanuary.setFullYear(year, 0, 4);
3936
+ fourthOfJanuary.setHours(0, 0, 0, 0);
3937
+ return startOfISOWeek(fourthOfJanuary);
3938
+ }
3939
+
3940
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addWeeks.js
3941
+ function addWeeks(date, amount, options) {
3942
+ return addDays(date, amount * 7, options);
3943
+ }
3944
+
3945
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addYears.js
3946
+ function addYears(date, amount, options) {
3947
+ return addMonths(date, amount * 12, options);
3948
+ }
3949
+
3950
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/max.js
3951
+ function max(dates, options) {
3952
+ let result;
3953
+ let context = options?.in;
3954
+ dates.forEach((date) => {
3955
+ if (!context && typeof date === "object")
3956
+ context = constructFrom.bind(null, date);
3957
+ const date_ = toDate(date, context);
3958
+ if (!result || result < date_ || isNaN(+date_)) result = date_;
3959
+ });
3960
+ return constructFrom(context, result || NaN);
3961
+ }
3962
+
3963
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/min.js
3964
+ function min(dates, options) {
3965
+ let result;
3966
+ let context = options?.in;
3967
+ dates.forEach((date) => {
3968
+ if (!context && typeof date === "object")
3969
+ context = constructFrom.bind(null, date);
3970
+ const date_ = toDate(date, context);
3971
+ if (!result || result > date_ || isNaN(+date_)) result = date_;
3972
+ });
3973
+ return constructFrom(context, result || NaN);
3974
+ }
3975
+
3976
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isSameDay.js
3977
+ function isSameDay(laterDate, earlierDate, options) {
3978
+ const [dateLeft_, dateRight_] = normalizeDates(
3979
+ options?.in,
3980
+ laterDate,
3981
+ earlierDate
3982
+ );
3983
+ return +startOfDay(dateLeft_) === +startOfDay(dateRight_);
3984
+ }
3985
+
3986
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isDate.js
3987
+ function isDate(value) {
3988
+ return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
3989
+ }
3990
+
3991
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isValid.js
3992
+ function isValid(date) {
3993
+ return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
3994
+ }
3995
+
3996
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarMonths.js
3997
+ function differenceInCalendarMonths(laterDate, earlierDate, options) {
3998
+ const [laterDate_, earlierDate_] = normalizeDates(
3999
+ options?.in,
4000
+ laterDate,
4001
+ earlierDate
4002
+ );
4003
+ const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();
4004
+ const monthsDiff = laterDate_.getMonth() - earlierDate_.getMonth();
4005
+ return yearsDiff * 12 + monthsDiff;
4006
+ }
4007
+
4008
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/endOfMonth.js
4009
+ function endOfMonth(date, options) {
4010
+ const _date = toDate(date, options?.in);
4011
+ const month = _date.getMonth();
4012
+ _date.setFullYear(_date.getFullYear(), month + 1, 0);
4013
+ _date.setHours(23, 59, 59, 999);
4014
+ return _date;
4015
+ }
4016
+
4017
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeInterval.js
4018
+ function normalizeInterval(context, interval) {
4019
+ const [start, end] = normalizeDates(context, interval.start, interval.end);
4020
+ return { start, end };
4021
+ }
4022
+
4023
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/eachMonthOfInterval.js
4024
+ function eachMonthOfInterval(interval, options) {
4025
+ const { start, end } = normalizeInterval(options?.in, interval);
4026
+ let reversed = +start > +end;
4027
+ const endTime = reversed ? +start : +end;
4028
+ const date = reversed ? end : start;
4029
+ date.setHours(0, 0, 0, 0);
4030
+ date.setDate(1);
4031
+ let step = 1;
4032
+ const dates = [];
4033
+ while (+date <= endTime) {
4034
+ dates.push(constructFrom(start, date));
4035
+ date.setMonth(date.getMonth() + step);
4036
+ }
4037
+ return reversed ? dates.reverse() : dates;
4038
+ }
4039
+
4040
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfMonth.js
4041
+ function startOfMonth(date, options) {
4042
+ const _date = toDate(date, options?.in);
4043
+ _date.setDate(1);
4044
+ _date.setHours(0, 0, 0, 0);
4045
+ return _date;
4046
+ }
4047
+
4048
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/endOfYear.js
4049
+ function endOfYear(date, options) {
3470
4050
  const _date = toDate(date, options?.in);
3471
4051
  const year = _date.getFullYear();
3472
4052
  _date.setFullYear(year + 1, 0, 0);
@@ -5400,7 +5980,7 @@ __export(custom_components_exports, {
5400
5980
  NextMonthButton: () => NextMonthButton,
5401
5981
  Option: () => Option,
5402
5982
  PreviousMonthButton: () => PreviousMonthButton,
5403
- Root: () => Root6,
5983
+ Root: () => Root8,
5404
5984
  Select: () => Select,
5405
5985
  Week: () => Week,
5406
5986
  WeekNumber: () => WeekNumber,
@@ -5580,7 +6160,7 @@ function Option(props) {
5580
6160
  function PreviousMonthButton(props) {
5581
6161
  return React26.createElement("button", { ...props });
5582
6162
  }
5583
- function Root6(props) {
6163
+ function Root8(props) {
5584
6164
  const { rootRef, ...rest } = props;
5585
6165
  return React26.createElement("div", { ...rest, ref: rootRef });
5586
6166
  }
@@ -7267,948 +7847,392 @@ function DayPicker(initialProps) {
7267
7847
  (() => {
7268
7848
  const monthControl = captionLayout === "dropdown" || captionLayout === "dropdown-months" ? React26.createElement(components.MonthsDropdown, { key: "month", className: classNames[UI.MonthsDropdown], "aria-label": labelMonthDropdown2(), disabled: Boolean(props.disableNavigation), onChange: handleMonthChange(calendarMonth.date, monthOffset), options: getMonthOptions(calendarMonth.date, navStart, navEnd, formatters2, dateLib), style: getDropdownStyle(UI.MonthsDropdown), value: dateLib.getMonth(calendarMonth.date) }) : React26.createElement("span", { key: "month" }, formatMonthDropdown2(calendarMonth.date, dateLib));
7269
7849
  const yearControl = captionLayout === "dropdown" || captionLayout === "dropdown-years" ? React26.createElement(components.YearsDropdown, { key: "year", className: classNames[UI.YearsDropdown], "aria-label": labelYearDropdown2(dateLib.options), disabled: Boolean(props.disableNavigation), onChange: handleYearChange(calendarMonth.date, monthOffset), options: getYearOptions(navStart, navEnd, formatters2, dateLib, Boolean(props.reverseYears)), style: getDropdownStyle(UI.YearsDropdown), value: dateLib.getYear(calendarMonth.date) }) : React26.createElement("span", { key: "year" }, formatYearDropdown2(calendarMonth.date, dateLib));
7270
- const controls = dateLib.getMonthYearOrder() === "year-first" ? [yearControl, monthControl] : [monthControl, yearControl];
7271
- return controls;
7272
- })(),
7273
- React26.createElement("span", { role: "status", "aria-live": "polite", style: {
7274
- border: 0,
7275
- clip: "rect(0 0 0 0)",
7276
- height: "1px",
7277
- margin: "-1px",
7278
- overflow: "hidden",
7279
- padding: 0,
7280
- position: "absolute",
7281
- width: "1px",
7282
- whiteSpace: "nowrap",
7283
- wordWrap: "normal"
7284
- } }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))
7285
- ) : React26.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))),
7286
- navLayout === "around" && !props.hideNavigation && displayIndex === numberOfMonths - 1 && React26.createElement(
7287
- components.NextMonthButton,
7288
- { type: "button", className: classNames[UI.NextMonthButton], style: styles?.[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick, "data-animated-button": props.animate ? "true" : void 0 },
7289
- React26.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" })
7290
- ),
7291
- displayIndex === numberOfMonths - 1 && navLayout === "after" && !props.hideNavigation && React26.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : void 0, className: classNames[UI.Nav], style: styles?.[UI.Nav], "aria-label": labelNav2(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth, nextMonth }),
7292
- React26.createElement(
7293
- components.MonthGrid,
7294
- { role: "grid", "aria-multiselectable": mode === "multiple" || mode === "range", "aria-label": labelGrid2(calendarMonth.date, dateLib.options, dateLib) || void 0, className: classNames[UI.MonthGrid], style: styles?.[UI.MonthGrid] },
7295
- !props.hideWeekdays && React26.createElement(
7296
- components.Weekdays,
7297
- { "data-animated-weekdays": props.animate ? "true" : void 0, className: classNames[UI.Weekdays], style: styles?.[UI.Weekdays] },
7298
- showWeekNumber && React26.createElement(components.WeekNumberHeader, { "aria-label": labelWeekNumberHeader2(dateLib.options), className: classNames[UI.WeekNumberHeader], style: styles?.[UI.WeekNumberHeader], scope: "col" }, formatWeekNumberHeader2()),
7299
- weekdays.map((weekday) => React26.createElement(components.Weekday, { "aria-label": labelWeekday2(weekday, dateLib.options, dateLib), className: classNames[UI.Weekday], key: String(weekday), style: styles?.[UI.Weekday], scope: "col" }, formatWeekdayName2(weekday, dateLib.options, dateLib)))
7300
- ),
7301
- React26.createElement(components.Weeks, { "data-animated-weeks": props.animate ? "true" : void 0, className: classNames[UI.Weeks], style: styles?.[UI.Weeks] }, calendarMonth.weeks.map((week) => {
7302
- return React26.createElement(
7303
- components.Week,
7304
- { className: classNames[UI.Week], key: week.weekNumber, style: styles?.[UI.Week], week },
7305
- showWeekNumber && React26.createElement(components.WeekNumber, { week, style: styles?.[UI.WeekNumber], "aria-label": labelWeekNumber2(week.weekNumber, {
7306
- locale
7307
- }), className: classNames[UI.WeekNumber], scope: "row", role: "rowheader" }, formatWeekNumber2(week.weekNumber, dateLib)),
7308
- week.days.map((day) => {
7309
- const { date } = day;
7310
- const modifiers = getModifiers(day);
7311
- modifiers[DayFlag.focused] = !modifiers.hidden && Boolean(focused?.isEqualTo(day));
7312
- modifiers[SelectionState.selected] = isSelected?.(date) || modifiers.selected;
7313
- if (isDateRange(selectedValue)) {
7314
- const { from, to } = selectedValue;
7315
- modifiers[SelectionState.range_start] = Boolean(from && to && dateLib.isSameDay(date, from));
7316
- modifiers[SelectionState.range_end] = Boolean(from && to && dateLib.isSameDay(date, to));
7317
- modifiers[SelectionState.range_middle] = rangeIncludesDate(selectedValue, date, true, dateLib);
7318
- }
7319
- const style2 = getStyleForModifiers(modifiers, styles, props.modifiersStyles);
7320
- const className2 = getClassNamesForModifiers(modifiers, classNames, props.modifiersClassNames);
7321
- const ariaLabel = !isInteractive && !modifiers.hidden ? labelGridcell2(date, modifiers, dateLib.options, dateLib) : void 0;
7322
- return React26.createElement(components.Day, { key: `${day.isoDate}_${day.displayMonthId}`, day, modifiers, className: className2.join(" "), style: style2, role: "gridcell", "aria-selected": modifiers.selected || void 0, "aria-label": ariaLabel, "data-day": day.isoDate, "data-month": day.outside ? day.dateMonthId : void 0, "data-selected": modifiers.selected || void 0, "data-disabled": modifiers.disabled || void 0, "data-hidden": modifiers.hidden || void 0, "data-outside": day.outside || void 0, "data-focused": modifiers.focused || void 0, "data-today": modifiers.today || void 0 }, !modifiers.hidden && isInteractive ? React26.createElement(components.DayButton, { className: classNames[UI.DayButton], style: styles?.[UI.DayButton], type: "button", day, modifiers, disabled: !modifiers.focused && modifiers.disabled || void 0, "aria-disabled": modifiers.focused && modifiers.disabled || void 0, tabIndex: isFocusTarget(day) ? 0 : -1, "aria-label": labelDayButton2(date, modifiers, dateLib.options, dateLib), onClick: handleDayClick(day, modifiers), onBlur: handleDayBlur(day, modifiers), onFocus: handleDayFocus(day, modifiers), onKeyDown: handleDayKeyDown(day, modifiers), onMouseEnter: handleDayMouseEnter(day, modifiers), onMouseLeave: handleDayMouseLeave(day, modifiers) }, formatDay2(date, dateLib.options, dateLib)) : !modifiers.hidden && formatDay2(day.date, dateLib.options, dateLib));
7323
- })
7324
- );
7325
- }))
7326
- )
7327
- );
7328
- })
7329
- ),
7330
- props.footer && React26.createElement(components.Footer, { className: classNames[UI.Footer], style: styles?.[UI.Footer], role: "status", "aria-live": "polite" }, props.footer)
7331
- )
7332
- );
7333
- }
7334
- var dayPickerClassNames = {
7335
- selected: `tw-bg-primary tw-border-primary tw-font-medium hover:tw-bg-primary/90 hover:tw-border-primary/90 tw-text-primary-foreground tw-rounded`
7336
- };
7337
- var rangePickerClassNames = {
7338
- range_start: `tw-bg-primary tw-rounded-r-none tw-font-medium tw-border-primary hover:tw-bg-primary/90 hover:tw-border-primary/90 tw-text-primary-foreground`,
7339
- range_end: `tw-bg-primary tw-rounded-l-none tw-font-medium tw-border-primary hover:tw-bg-primary/90 hover:tw-border-primary/90 tw-text-primary-foreground`,
7340
- selected: `tw-font-medium tw-rounded`,
7341
- range_middle: `tw-bg-accent tw-border-accent tw-text-accent-foreground tw-rounded-none tw-font-medium`
7342
- };
7343
- var Calendar = ({ className, classNames, ...props }) => {
7344
- const defaultClassNames = getDefaultClassNames();
7345
- return /* @__PURE__ */ jsx(
7346
- DayPicker,
7347
- {
7348
- ...props,
7349
- captionLayout: "dropdown",
7350
- className: cn(className, "tw-p-3"),
7351
- classNames: {
7352
- chevron: `${defaultClassNames.chevron} tw-fill-foreground`,
7353
- day: `${defaultClassNames.day} hover:tw-bg-accent tw-rounded`,
7354
- day_button: `${defaultClassNames.day_button} tw-rounded`,
7355
- today: `tw-bg-accent tw-text-accent-foreground tw-font-medium`,
7356
- ...dayPickerClassNames,
7357
- ...rangePickerClassNames,
7358
- selected: `${props.mode === "range" ? rangePickerClassNames.selected : dayPickerClassNames.selected}`,
7359
- ...classNames
7360
- },
7361
- required: false
7362
- }
7363
- );
7364
- };
7365
- Calendar.displayName = "Calendar";
7366
- var variants2 = cva(
7367
- [
7368
- "tailwindcss-preflight",
7369
- "tw-group/popover-content",
7370
- "tw-z-[1055]",
7371
- "focus-visible:tw-outline-none",
7372
- // sizing
7373
- "tw-min-w-32",
7374
- "tw-max-h-[var(--radix-popover-content-available-height)]",
7375
- "tw-origin-[--radix-popover-content-transform-origin]",
7376
- // layout
7377
- "tw-flex",
7378
- "tw-flex-col",
7379
- "tw-overflow-y-auto",
7380
- // border
7381
- "tw-box-border",
7382
- "tw-border",
7383
- "tw-border-solid",
7384
- "tw-shadow-lg",
7385
- // open animation
7386
- "data-[state=open]:tw-animate-in",
7387
- "data-[state=open]:tw-fade-in-0",
7388
- "data-[state=open]:tw-zoom-in-95",
7389
- // closed animation
7390
- "data-[state=closed]:tw-animate-out",
7391
- "data-[state=closed]:tw-fade-out-0",
7392
- "data-[state=closed]:tw-zoom-out-95",
7393
- // position animation
7394
- "data-[side=bottom]:tw-slide-in-from-top-2",
7395
- "data-[side=left]:tw-slide-in-from-right-2",
7396
- "data-[side=right]:tw-slide-in-from-left-2",
7397
- "data-[side=top]:tw-slide-in-from-bottom-2",
7398
- // Default size for nested Lucide icons; callers can override on the icon.
7399
- "[&_svg.lucide:not([class*='tw-size-'])]:tw-size-4",
7400
- "[&_svg]:tw-shrink-0"
7401
- ],
7402
- {
7403
- defaultVariants: {
7404
- matchTriggerWidth: false,
7405
- variant: "default"
7406
- },
7407
- variants: {
7408
- variant: {
7409
- // Legacy surface — fixed white panel.
7410
- default: ["tw-rounded-md", "tw-border-neutral-100", "tw-bg-white", "tw-text-neutral-800"],
7411
- // Argo surface — semantic popover tokens (brand + dark aware).
7412
- argo: ["tw-rounded-2xl", "tw-border-border", "tw-bg-popover", "tw-text-popover-foreground"]
7413
- },
7414
- matchTriggerWidth: {
7415
- true: ["tw-w-[var(--radix-popover-trigger-width)]"],
7416
- false: []
7417
- }
7418
- }
7419
- }
7420
- );
7421
- var PopoverContent = ({
7422
- ref,
7423
- className,
7424
- align = "center",
7425
- sideOffset = 4,
7426
- matchTriggerWidth = false,
7427
- children,
7428
- onEscapeKeyDown,
7429
- ...props
7430
- }) => {
7431
- const effectiveVariant = useArgoDesign() ? "argo" : "default";
7432
- return /* @__PURE__ */ jsx(Portal$1, { children: /* @__PURE__ */ jsx(
7433
- Content$2,
7434
- {
7435
- ref,
7436
- align: matchTriggerWidth ? "start" : align,
7437
- sideOffset,
7438
- className: cn(variants2({ className, matchTriggerWidth, variant: effectiveVariant })),
7439
- onEscapeKeyDown: (event) => {
7440
- event.stopPropagation();
7441
- onEscapeKeyDown?.(event);
7442
- },
7443
- ...props,
7444
- children
7445
- }
7446
- ) });
7447
- };
7448
- var Popover = (props) => /* @__PURE__ */ jsx(Root$3, { ...props });
7449
- Popover.Content = PopoverContent;
7450
- Popover.Trigger = Trigger$1;
7451
- Popover.Close = Close;
7452
- var DatePicker = ({
7453
- align = "end",
7454
- alignOffset = -18,
7455
- children,
7456
- defaultOpen,
7457
- onOpenChange,
7458
- open,
7459
- sideOffset = 12,
7460
- ...calendarProps
7461
- }) => /* @__PURE__ */ jsxs(Popover, { defaultOpen, open, onOpenChange, children: [
7462
- /* @__PURE__ */ jsx(Popover.Trigger, { asChild: true, children }),
7463
- /* @__PURE__ */ jsx(
7464
- Popover.Content,
7465
- {
7466
- align,
7467
- alignOffset,
7468
- className: "tw-w-auto tw-p-0",
7469
- sideOffset,
7470
- children: /* @__PURE__ */ jsx(Calendar, { ...calendarProps })
7471
- }
7472
- )
7473
- ] });
7474
- DatePicker.displayName = "DatePicker";
7475
-
7476
- // src/components/Input/utils.ts
7477
- var genInputTestId = (prefix = "") => {
7478
- const ps = createPrefixedString(prefix);
7479
- return {
7480
- toString: () => prefix,
7481
- inputWrapper: ps`input-wrapper`,
7482
- input: ps`input`,
7483
- clearButton: ps`clear-button`
7484
- };
7485
- };
7486
- var Input = ({
7487
- ref: forwardedRef,
7488
- state = "default",
7489
- sizing = "default",
7490
- className,
7491
- prefix = null,
7492
- rightSuffix = null,
7493
- rightSuffixVariant = "default",
7494
- leftSuffix = null,
7495
- allowClear = false,
7496
- onClear,
7497
- disabled = false,
7498
- testId: prefixTestId = "",
7499
- autoFocus = false,
7500
- id,
7501
- name,
7502
- variant,
7503
- readOnly,
7504
- type = "text",
7505
- focusVariant = "default",
7506
- onChange,
7507
- onBlur,
7508
- value,
7509
- defaultValue,
7510
- ...inputProps
7511
- }) => {
7512
- const [hasUncontrolledValue, setHasUncontrolledValue] = useState(() => !!defaultValue);
7513
- const hasValue = !!value || hasUncontrolledValue;
7514
- const inputRef = useRef(null);
7515
- const testId = genInputTestId(prefixTestId);
7516
- const isClearButtonVisible = hasValue && !disabled && !readOnly || !!onClear;
7517
- const handleChange = (event) => {
7518
- const val = event.target.value;
7519
- setHasUncontrolledValue(val !== "");
7520
- onChange?.(event);
7521
- };
7522
- const handleBlur = (event) => {
7523
- const val = event.target.value;
7524
- setHasUncontrolledValue(val !== "");
7525
- onBlur?.(event);
7526
- };
7527
- const handleClear = () => {
7528
- if (inputRef.current === null) return;
7529
- inputRef.current.value = "";
7530
- inputRef.current.focus();
7531
- onClear?.();
7532
- setHasUncontrolledValue(false);
7533
- onChange?.(createChangeInputEvent(inputRef.current));
7534
- };
7535
- const isControlled = value !== void 0;
7536
- const valueProp = isControlled ? { value: value ?? "" } : { defaultValue: defaultValue ?? "" };
7537
- return /* @__PURE__ */ jsxs(
7538
- InputGroup,
7539
- {
7540
- state,
7541
- variant,
7542
- sizing,
7543
- focusVariant,
7544
- className,
7545
- "data-testid": testId.inputWrapper,
7546
- children: [
7547
- prefix && /* @__PURE__ */ jsx(InputGroup.Addon, { align: "inline-start", children: prefix }),
7548
- /* @__PURE__ */ jsx(
7549
- InputGroup.Input,
7550
- {
7551
- ...inputProps,
7552
- ...valueProp,
7553
- autoFocus,
7554
- type,
7555
- onChange: handleChange,
7556
- onBlur: handleBlur,
7557
- ref: mergeRefs(forwardedRef ?? null, inputRef),
7558
- disabled,
7559
- id,
7560
- name,
7561
- readOnly,
7562
- "data-testid": testId.input
7563
- }
7564
- ),
7565
- (leftSuffix || allowClear || rightSuffix) && /* @__PURE__ */ jsxs(InputGroup.Addon, { align: "inline-end", children: [
7566
- leftSuffix,
7567
- allowClear && isClearButtonVisible && /* @__PURE__ */ jsx(
7568
- InputGroup.Button,
7569
- {
7570
- "aria-label": "Clear",
7571
- onMouseDown: (e) => e.preventDefault(),
7572
- onClick: handleClear,
7573
- "data-testid": testId.clearButton,
7574
- children: /* @__PURE__ */ jsx(icons_exports.X, { className: "tw-size-4" })
7575
- }
7576
- ),
7577
- rightSuffix && /* @__PURE__ */ jsx(
7578
- "div",
7579
- {
7580
- className: cn({
7581
- "tw-whitespace-nowrap tw-bg-muted tw-px-4 -tw-mr-4 tw-py-2.5": rightSuffixVariant === "addon"
7582
- }),
7583
- children: rightSuffix
7584
- }
7585
- )
7586
- ] })
7587
- ]
7588
- }
7589
- );
7590
- };
7591
-
7592
- // src/components/Input/DateInput/helpers.ts
7593
- var formatDate = (date, inputValue) => {
7594
- if (!date) {
7595
- return inputValue;
7596
- }
7597
- return date.toLocaleDateString();
7598
- };
7599
- var datePartOrder = new Intl.DateTimeFormat().formatToParts(new Date(2e3, 0, 2)).filter(
7600
- (p) => p.type === "day" || p.type === "month" || p.type === "year"
7601
- ).map((p) => p.type);
7602
- var parseDate = (value) => {
7603
- if (!value.trim()) return null;
7604
- const nums = value.match(/\d+/g)?.map(Number);
7605
- if (nums && nums.length >= 3) {
7606
- const parts = Object.fromEntries(datePartOrder.map((type, i) => [type, nums[i]]));
7607
- const year = parts.year;
7608
- const month = parts.month;
7609
- const day = parts.day;
7610
- if (year != null && month != null && day != null && month >= 1 && month <= 12 && day >= 1 && day <= 31) {
7611
- const date = new Date(year, month - 1, day);
7612
- if (date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day) {
7613
- return date;
7614
- }
7615
- }
7616
- }
7617
- const isoMatch = value.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);
7618
- if (isoMatch) {
7619
- const y = Number(isoMatch[1]);
7620
- const m = Number(isoMatch[2]) - 1;
7621
- const d = Number(isoMatch[3]);
7622
- const date = new Date(y, m, d);
7623
- if (date.getFullYear() === y && date.getMonth() === m && date.getDate() === d) {
7624
- return date;
7625
- }
7626
- return null;
7627
- }
7628
- const fallback = new Date(value);
7629
- return isNaN(fallback.getTime()) ? null : fallback;
7630
- };
7631
- var DateInput = ({
7632
- ref,
7633
- defaultValue,
7634
- disabled,
7635
- disabledDays,
7636
- endMonth,
7637
- onBlur,
7638
- onChange,
7639
- onValueBlur,
7640
- onValueChange,
7641
- placeholder = "Select a date",
7642
- readOnly,
7643
- startMonth,
7644
- value,
7645
- variant,
7646
- ...props
7647
- }) => {
7648
- const [inputValue, setInputValue] = useState("");
7649
- const [hasFocus, setHasFocus] = useState(false);
7650
- const [isOpen, setIsOpen] = useState(false);
7651
- const [internalValue, setInternalValue] = useState(defaultValue ?? null);
7652
- const [month, setMonth2] = useState(/* @__PURE__ */ new Date());
7653
- const isControlled = value !== void 0;
7654
- const currentValue = isControlled ? value : internalValue;
7655
- const handleChange = (event) => {
7656
- const newValue = event.target.value;
7657
- setInputValue(newValue);
7658
- onChange?.(event);
7659
- const parsedDate = parseDate(newValue);
7660
- if (parsedDate !== null || !newValue.trim()) {
7661
- onValueChange?.(parsedDate);
7662
- }
7663
- };
7664
- const handleFocus = (event) => {
7665
- const formatted = formatDate(currentValue, "");
7666
- setInputValue(formatted);
7667
- setHasFocus(true);
7668
- props.onFocus?.(event);
7669
- };
7670
- const handleBlur = (event) => {
7671
- setHasFocus(false);
7672
- onBlur?.(event);
7673
- const parsedDate = parseDate(event.target.value);
7674
- onValueBlur?.(parsedDate);
7675
- if (!isControlled) {
7676
- setInternalValue(parsedDate);
7677
- }
7678
- };
7679
- const handleDatePickerChange = (newValue) => {
7680
- const dateValue = newValue ?? null;
7681
- if (isControlled) {
7682
- onValueChange?.(dateValue);
7683
- } else {
7684
- setInternalValue(dateValue);
7685
- onValueChange?.(dateValue);
7686
- }
7687
- setHasFocus(false);
7688
- setIsOpen(false);
7689
- };
7690
- const handleClear = () => {
7691
- setInputValue("");
7692
- setInternalValue(null);
7693
- onValueChange?.(null);
7694
- };
7695
- const handleOpenChange = (open) => {
7696
- if (open) {
7697
- setMonth2(currentValue ?? /* @__PURE__ */ new Date());
7698
- }
7699
- setIsOpen(open);
7700
- };
7701
- const displayValue = hasFocus ? inputValue : formatDate(currentValue, "");
7702
- return /* @__PURE__ */ jsx(
7703
- Input,
7704
- {
7705
- ...props,
7706
- disabled,
7707
- onBlur: handleBlur,
7708
- onChange: handleChange,
7709
- onClear: handleClear,
7710
- onFocus: handleFocus,
7711
- placeholder,
7712
- readOnly,
7713
- ref,
7714
- value: displayValue,
7715
- variant,
7716
- rightSuffix: !disabled && !readOnly ? /* @__PURE__ */ jsx(
7717
- DatePicker,
7718
- {
7719
- disabled: disabledDays,
7720
- endMonth,
7721
- mode: "single",
7722
- month,
7723
- onMonthChange: setMonth2,
7724
- onOpenChange: handleOpenChange,
7725
- onSelect: handleDatePickerChange,
7726
- open: isOpen,
7727
- selected: currentValue ?? void 0,
7728
- startMonth,
7729
- children: /* @__PURE__ */ jsx(Button, { "aria-label": "Select Date", variant: "inline", size: "icon-3xs", children: /* @__PURE__ */ jsx(icons_exports.Calendar, { className: "tw-size-4" }) })
7730
- }
7731
- ) : void 0,
7732
- type: "text"
7733
- }
7734
- );
7735
- };
7736
- var sanitizeTextInputValue = (value) => {
7737
- if (typeof value === "string" && value.trim() === "") return "";
7738
- return value;
7739
- };
7740
- var TextInput = ({
7741
- ref,
7742
- value,
7743
- defaultValue,
7744
- type = "text",
7745
- variant,
7746
- onValueChange,
7747
- onChange,
7748
- onValueBlur,
7749
- onBlur,
7750
- ...props
7751
- }) => {
7752
- const handleChange = (event) => {
7753
- onValueChange?.(event.target.value);
7754
- onChange?.(event);
7755
- };
7756
- const handleBlur = (event) => {
7757
- onValueBlur?.(event.target.value);
7758
- onBlur?.(event);
7759
- };
7760
- return /* @__PURE__ */ jsx(
7761
- Input,
7762
- {
7763
- ...props,
7764
- ref,
7765
- onChange: handleChange,
7766
- onBlur: handleBlur,
7767
- type,
7768
- variant,
7769
- value: sanitizeTextInputValue(value),
7770
- defaultValue: sanitizeTextInputValue(defaultValue)
7771
- }
7772
- );
7773
- };
7774
- var FormGroupTextInput = ({
7775
- ref,
7776
- ...props
7777
- }) => {
7778
- const { state } = useFormGroupContext();
7779
- return /* @__PURE__ */ jsx(TextInput, { state, ...props, ref });
7780
- };
7781
- var FormGroup = ({ className, children, state, ...rest }) => {
7782
- return /* @__PURE__ */ jsx(FormGroupProvider, { value: { state }, children: /* @__PURE__ */ jsx("div", { ...rest, className: cn("tw-flex tw-flex-col tw-gap-1", className), children }) });
7783
- };
7784
- FormGroup.Help = FormGroupHelp;
7785
- FormGroup.Error = FormGroupError;
7786
- FormGroup.TextInput = FormGroupTextInput;
7787
- FormGroup.NumberInput = FormGroupNumberInput;
7788
- FormGroup.ColorInput = FormGroupColorInput;
7789
- FormGroup.Textarea = FormGroupTextarea;
7790
- var Optional = ({ className, ...props }) => /* @__PURE__ */ jsx("span", { ...props, "aria-hidden": true, className: cn("tw-ml-0.5", "tw-text-muted-foreground", className), children: "(optional)" });
7791
- var Required = ({ className, ...props }) => /* @__PURE__ */ jsx("span", { ...props, "aria-hidden": true, className: cn("tw-ml-0.5", "tw-text-primary", className), children: "*" });
7792
- var Label = ({ className, children, id, htmlFor, ...rest }) => /* @__PURE__ */ jsx(
7793
- RLabel.Root,
7794
- {
7795
- ...rest,
7796
- id: id?.toString(),
7797
- htmlFor: htmlFor?.toString(),
7798
- className: cn(
7799
- "tw-m-0 tw-text-foreground tw-font-normal peer-disabled:tw-opacity-50",
7800
- className
7801
- ),
7802
- children
7803
- }
7804
- );
7805
- Label.Optional = Optional;
7806
- Label.Required = Required;
7807
- var Link = ({
7808
- ref,
7809
- children,
7810
- target = "_blank",
7811
- rel = "noopener noreferrer",
7812
- onClick,
7813
- className,
7814
- ...rest
7815
- }) => {
7816
- const handleOnClick = (event) => {
7817
- event.stopPropagation();
7818
- onClick?.(event);
7819
- };
7820
- return (
7821
- // oxlint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
7822
- /* @__PURE__ */ jsx(
7823
- "a",
7824
- {
7825
- ...rest,
7826
- ref,
7827
- target,
7828
- rel,
7829
- onClick: handleOnClick,
7830
- className: cn(
7831
- "tw-text-primary tw-underline hover:tw-text-primary/90 hover:tw-no-underline",
7832
- className
7833
- ),
7834
- children
7835
- }
7836
- )
7837
- );
7838
- };
7839
- var RootFormDataContext = createContext({});
7840
- var RootFormDataProvider = RootFormDataContext;
7841
- var useRootFormData = () => use(RootFormDataContext);
7842
- var resolveByPath2 = (parts, data) => {
7843
- let current = data;
7844
- for (const part of parts) {
7845
- if (current == null || typeof current !== "object") return void 0;
7846
- current = current[part];
7847
- }
7848
- return current;
7849
- };
7850
- var resolveDependencyValue = (path, formData, parentPath) => {
7851
- if (path.startsWith("root.")) {
7852
- return resolveByPath2(path.replace(/^root\./, "").split("."), formData);
7853
- }
7854
- const parent = resolveByPath2(parentPath.map(String), formData);
7855
- if (parent && typeof parent === "object") {
7856
- const sibling = resolveByPath2(path.split("."), parent);
7857
- if (sibling !== void 0) return sibling;
7858
- }
7859
- return resolveByPath2(path.split("."), formData);
7860
- };
7861
- var evaluateDependencies = (dependencies, formData, parentPath) => {
7862
- for (const [path, expected] of Object.entries(dependencies)) {
7863
- const actual = resolveDependencyValue(path, formData, parentPath);
7864
- if (Array.isArray(expected)) {
7865
- if (!expected.includes(actual)) return false;
7866
- } else if (expected === "") {
7867
- if (actual !== "" && actual !== void 0 && actual !== null) return false;
7868
- } else {
7869
- if (actual !== expected) return false;
7870
- }
7871
- }
7872
- return true;
7873
- };
7874
- var DocumentationLinkIcon = ({
7875
- documentation
7876
- }) => /* @__PURE__ */ jsx(
7877
- Tooltip,
7878
- {
7879
- placement: "top",
7880
- variant: "explanatory",
7881
- tooltip: documentation.tooltip ?? "Open documentation",
7882
- triggerAsChild: true,
7883
- children: /* @__PURE__ */ jsx(Link, { href: documentation.link, children: /* @__PURE__ */ jsx("span", { className: "tw-cursor-pointer tw-text-neutral-400 hover:tw-text-neutral-600", children: /* @__PURE__ */ jsx(icons_exports.BookOpen, { className: "tw-size-4" }) }) })
7884
- }
7885
- );
7886
- var FieldTemplateBody = ({
7887
- id,
7888
- label,
7889
- rawHelp,
7890
- rawDescription,
7891
- rawErrors,
7892
- children,
7893
- schema,
7894
- uiSchema,
7895
- displayLabel
7896
- }) => {
7897
- const widget = uiSchema?.["ui:widget"];
7898
- if (widget === "test-connection" || widget === "sync-action") {
7899
- return /* @__PURE__ */ jsx(Fragment, { children });
7900
- }
7901
- if (schema.type === "object") {
7902
- return /* @__PURE__ */ jsx(Fragment, { children });
7903
- }
7904
- if (schema.type === "array" && !uiSchema?.["ui:widget"]) {
7905
- return /* @__PURE__ */ jsx(Fragment, { children });
7906
- }
7907
- const uiOptions = uiSchema?.["ui:options"];
7908
- const documentation = uiOptions?.documentation;
7909
- const hasErrors = rawErrors && rawErrors.length > 0;
7910
- const isCheckbox = schema.type === "boolean" && uiSchema?.["ui:widget"] !== "select";
7911
- const showLabel = displayLabel && label && !isCheckbox;
7912
- const hasHelpIcons = Boolean(rawHelp || documentation);
7913
- const helpIcons = /* @__PURE__ */ jsxs(Fragment, { children: [
7914
- rawHelp && /* @__PURE__ */ jsx(TooltipIcon, { rawHelp }),
7915
- documentation && /* @__PURE__ */ jsx(DocumentationLinkIcon, { documentation })
7916
- ] });
7917
- return /* @__PURE__ */ jsxs(FormGroup, { state: hasErrors ? "error" : "default", children: [
7918
- showLabel && /* @__PURE__ */ jsx(Label, { htmlFor: id, children: /* @__PURE__ */ jsxs("span", { className: "tw-inline-flex tw-items-center tw-gap-1", children: [
7919
- label,
7920
- helpIcons
7921
- ] }) }),
7922
- !showLabel && !isCheckbox && hasHelpIcons && /* @__PURE__ */ jsx("div", { className: "tw-flex tw-items-center tw-gap-1", children: helpIcons }),
7923
- isCheckbox && hasHelpIcons ? /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [
7924
- children,
7925
- helpIcons
7926
- ] }) : children,
7927
- rawDescription && /* @__PURE__ */ jsx(FormGroup.Help, { children: /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(rawDescription) } }) }),
7928
- hasErrors && /* @__PURE__ */ jsx(FormGroup.Help, { children: rawErrors.join(". ") })
7929
- ] });
7930
- };
7931
- var FieldTemplateWithDependencies = ({
7932
- dependencies,
7933
- ...props
7934
- }) => {
7935
- const rootFormData = useRootFormData();
7936
- const parentPath = props.fieldPathId.path.slice(0, -1);
7937
- if (!evaluateDependencies(dependencies, rootFormData, parentPath)) {
7938
- return null;
7939
- }
7940
- return /* @__PURE__ */ jsx(FieldTemplateBody, { ...props });
7941
- };
7942
- var FieldTemplate = (props) => {
7943
- if (props.hidden) return /* @__PURE__ */ jsx("div", { className: "tw-hidden", children: props.children });
7944
- if (props.uiSchema?.["ui:widget"] === "template-watch") {
7945
- return /* @__PURE__ */ jsx("div", { className: "tw-hidden", children: props.children });
7946
- }
7947
- const uiOptions = props.uiSchema?.["ui:options"];
7948
- const dependencies = uiOptions?.dependencies;
7949
- if (dependencies) {
7950
- return /* @__PURE__ */ jsx(FieldTemplateWithDependencies, { dependencies, ...props });
7951
- }
7952
- return /* @__PURE__ */ jsx(FieldTemplateBody, { ...props });
7953
- };
7954
- var ObjectFieldTemplate = ({
7955
- title,
7956
- description,
7957
- properties,
7958
- formData,
7959
- uiSchema,
7960
- schema,
7961
- fieldPathId
7962
- }) => {
7963
- const isRoot = !fieldPathId?.path?.length;
7964
- const uiOptions = uiSchema?.["ui:options"];
7965
- const hasCollapsed = uiOptions?.collapsed !== void 0;
7966
- const collapsed = !!uiOptions?.collapsed;
7967
- const disableCollapse = !!uiOptions?.disableCollapse;
7968
- const lastPathSegment = fieldPathId?.path?.at(-1);
7969
- const isArrayItem = typeof lastPathSegment === "number";
7970
- const childSchemas = schema.properties;
7971
- const isContainerSchema = (s) => {
7972
- if (!s) return false;
7973
- if (s.properties || s.items) return true;
7974
- if (Array.isArray(s.type)) return s.type.includes("object") || s.type.includes("array");
7975
- return s.type === "object" || s.type === "array";
7976
- };
7977
- const visibleProperties = properties.filter((prop) => {
7978
- const childUi = uiSchema?.[prop.name];
7979
- if (childUi?.["ui:widget"] !== "hidden") return true;
7980
- return !isContainerSchema(childSchemas?.[prop.name]);
7981
- });
7982
- const isHiddenMount = (name) => {
7983
- const w = uiSchema?.[name]?.["ui:widget"];
7984
- return w === "hidden" || w === "template-watch";
7985
- };
7986
- const renderChildren = (props) => props.map((prop) => /* @__PURE__ */ jsx("div", { className: isHiddenMount(prop.name) ? "tw-hidden" : void 0, children: prop.content }, prop.name));
7987
- if (isRoot) {
7988
- return /* @__PURE__ */ jsx("div", { className: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden", children: renderChildren(visibleProperties) });
7989
- }
7990
- const childrenContent = renderChildren(visibleProperties);
7991
- if (hasCollapsed && !disableCollapse) {
7992
- const data = formData ?? {};
7993
- const hasValues = Object.values(data).some(
7994
- (v) => v !== void 0 && v !== null && v !== "" && v !== false
7995
- );
7996
- const defaultExpanded = hasValues ? !collapsed : true;
7997
- return /* @__PURE__ */ jsxs(
7998
- CollapsiblePanel,
7999
- {
8000
- className: "tw-rounded-lg",
8001
- headerClassName: "tw-rounded-lg",
8002
- header: title || "Settings",
8003
- defaultExpanded,
8004
- bodyClassName: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden",
8005
- children: [
8006
- description,
8007
- childrenContent
8008
- ]
8009
- }
8010
- );
8011
- }
8012
- if (isArrayItem) {
8013
- return /* @__PURE__ */ jsx("div", { className: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden", children: childrenContent });
8014
- }
8015
- return /* @__PURE__ */ jsxs("div", { className: "tw-rounded-lg tw-border tw-border-solid tw-border-neutral-200 tw-bg-white tw-p-4", children: [
8016
- title && /* @__PURE__ */ jsx("h3", { className: "tw-mb-2 tw-text-base tw-font-medium tw-text-neutral-800", children: title }),
8017
- description && /* @__PURE__ */ jsx("p", { className: "tw-mb-3 tw-text-xs tw-text-neutral-400", children: description }),
8018
- /* @__PURE__ */ jsx("div", { className: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden", children: childrenContent })
8019
- ] });
8020
- };
8021
- var FieldBoxDescription = ({ className, ...props }) => /* @__PURE__ */ jsx(
8022
- "span",
8023
- {
8024
- ...props,
8025
- "data-slot": "field-box-description",
8026
- className: cn(
8027
- "tw-text-xs",
8028
- "tw-text-muted-foreground",
8029
- "group-has-[:disabled]/field-box:tw-opacity-50",
8030
- className
8031
- )
8032
- }
8033
- );
8034
- var FieldBoxTitle = ({ className, ...props }) => /* @__PURE__ */ jsx(
8035
- "span",
8036
- {
8037
- ...props,
8038
- "data-slot": "field-box-title",
8039
- className: cn(
8040
- "tw-text-sm",
8041
- "tw-font-medium",
8042
- "tw-text-foreground",
8043
- "group-has-[:disabled]/field-box:tw-cursor-not-allowed",
8044
- "group-has-[:disabled]/field-box:tw-opacity-50",
8045
- className
7850
+ const controls = dateLib.getMonthYearOrder() === "year-first" ? [yearControl, monthControl] : [monthControl, yearControl];
7851
+ return controls;
7852
+ })(),
7853
+ React26.createElement("span", { role: "status", "aria-live": "polite", style: {
7854
+ border: 0,
7855
+ clip: "rect(0 0 0 0)",
7856
+ height: "1px",
7857
+ margin: "-1px",
7858
+ overflow: "hidden",
7859
+ padding: 0,
7860
+ position: "absolute",
7861
+ width: "1px",
7862
+ whiteSpace: "nowrap",
7863
+ wordWrap: "normal"
7864
+ } }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))
7865
+ ) : React26.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))),
7866
+ navLayout === "around" && !props.hideNavigation && displayIndex === numberOfMonths - 1 && React26.createElement(
7867
+ components.NextMonthButton,
7868
+ { type: "button", className: classNames[UI.NextMonthButton], style: styles?.[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick, "data-animated-button": props.animate ? "true" : void 0 },
7869
+ React26.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" })
7870
+ ),
7871
+ displayIndex === numberOfMonths - 1 && navLayout === "after" && !props.hideNavigation && React26.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : void 0, className: classNames[UI.Nav], style: styles?.[UI.Nav], "aria-label": labelNav2(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth, nextMonth }),
7872
+ React26.createElement(
7873
+ components.MonthGrid,
7874
+ { role: "grid", "aria-multiselectable": mode === "multiple" || mode === "range", "aria-label": labelGrid2(calendarMonth.date, dateLib.options, dateLib) || void 0, className: classNames[UI.MonthGrid], style: styles?.[UI.MonthGrid] },
7875
+ !props.hideWeekdays && React26.createElement(
7876
+ components.Weekdays,
7877
+ { "data-animated-weekdays": props.animate ? "true" : void 0, className: classNames[UI.Weekdays], style: styles?.[UI.Weekdays] },
7878
+ showWeekNumber && React26.createElement(components.WeekNumberHeader, { "aria-label": labelWeekNumberHeader2(dateLib.options), className: classNames[UI.WeekNumberHeader], style: styles?.[UI.WeekNumberHeader], scope: "col" }, formatWeekNumberHeader2()),
7879
+ weekdays.map((weekday) => React26.createElement(components.Weekday, { "aria-label": labelWeekday2(weekday, dateLib.options, dateLib), className: classNames[UI.Weekday], key: String(weekday), style: styles?.[UI.Weekday], scope: "col" }, formatWeekdayName2(weekday, dateLib.options, dateLib)))
7880
+ ),
7881
+ React26.createElement(components.Weeks, { "data-animated-weeks": props.animate ? "true" : void 0, className: classNames[UI.Weeks], style: styles?.[UI.Weeks] }, calendarMonth.weeks.map((week) => {
7882
+ return React26.createElement(
7883
+ components.Week,
7884
+ { className: classNames[UI.Week], key: week.weekNumber, style: styles?.[UI.Week], week },
7885
+ showWeekNumber && React26.createElement(components.WeekNumber, { week, style: styles?.[UI.WeekNumber], "aria-label": labelWeekNumber2(week.weekNumber, {
7886
+ locale
7887
+ }), className: classNames[UI.WeekNumber], scope: "row", role: "rowheader" }, formatWeekNumber2(week.weekNumber, dateLib)),
7888
+ week.days.map((day) => {
7889
+ const { date } = day;
7890
+ const modifiers = getModifiers(day);
7891
+ modifiers[DayFlag.focused] = !modifiers.hidden && Boolean(focused?.isEqualTo(day));
7892
+ modifiers[SelectionState.selected] = isSelected?.(date) || modifiers.selected;
7893
+ if (isDateRange(selectedValue)) {
7894
+ const { from, to } = selectedValue;
7895
+ modifiers[SelectionState.range_start] = Boolean(from && to && dateLib.isSameDay(date, from));
7896
+ modifiers[SelectionState.range_end] = Boolean(from && to && dateLib.isSameDay(date, to));
7897
+ modifiers[SelectionState.range_middle] = rangeIncludesDate(selectedValue, date, true, dateLib);
7898
+ }
7899
+ const style2 = getStyleForModifiers(modifiers, styles, props.modifiersStyles);
7900
+ const className2 = getClassNamesForModifiers(modifiers, classNames, props.modifiersClassNames);
7901
+ const ariaLabel = !isInteractive && !modifiers.hidden ? labelGridcell2(date, modifiers, dateLib.options, dateLib) : void 0;
7902
+ return React26.createElement(components.Day, { key: `${day.isoDate}_${day.displayMonthId}`, day, modifiers, className: className2.join(" "), style: style2, role: "gridcell", "aria-selected": modifiers.selected || void 0, "aria-label": ariaLabel, "data-day": day.isoDate, "data-month": day.outside ? day.dateMonthId : void 0, "data-selected": modifiers.selected || void 0, "data-disabled": modifiers.disabled || void 0, "data-hidden": modifiers.hidden || void 0, "data-outside": day.outside || void 0, "data-focused": modifiers.focused || void 0, "data-today": modifiers.today || void 0 }, !modifiers.hidden && isInteractive ? React26.createElement(components.DayButton, { className: classNames[UI.DayButton], style: styles?.[UI.DayButton], type: "button", day, modifiers, disabled: !modifiers.focused && modifiers.disabled || void 0, "aria-disabled": modifiers.focused && modifiers.disabled || void 0, tabIndex: isFocusTarget(day) ? 0 : -1, "aria-label": labelDayButton2(date, modifiers, dateLib.options, dateLib), onClick: handleDayClick(day, modifiers), onBlur: handleDayBlur(day, modifiers), onFocus: handleDayFocus(day, modifiers), onKeyDown: handleDayKeyDown(day, modifiers), onMouseEnter: handleDayMouseEnter(day, modifiers), onMouseLeave: handleDayMouseLeave(day, modifiers) }, formatDay2(date, dateLib.options, dateLib)) : !modifiers.hidden && formatDay2(day.date, dateLib.options, dateLib));
7903
+ })
7904
+ );
7905
+ }))
7906
+ )
7907
+ );
7908
+ })
7909
+ ),
7910
+ props.footer && React26.createElement(components.Footer, { className: classNames[UI.Footer], style: styles?.[UI.Footer], role: "status", "aria-live": "polite" }, props.footer)
8046
7911
  )
8047
- }
8048
- );
8049
- var fieldBoxVariants = cva(
8050
- [
8051
- "tw-group/field-box",
8052
- "tw-m-0",
8053
- "tw-inline-flex",
8054
- "tw-gap-3",
8055
- "tw-items-center",
8056
- "has-[[data-slot=field-box-description]]:tw-items-start",
8057
- "tw-cursor-pointer",
8058
- "tw-select-none",
8059
- "has-[:disabled]:tw-cursor-not-allowed"
8060
- ],
8061
- {
8062
- variants: {
8063
- variant: {
8064
- default: [],
8065
- boxed: [
8066
- "tw-rounded-lg",
8067
- "tw-border",
8068
- "tw-border-solid",
8069
- "tw-border-border",
8070
- "tw-p-3",
8071
- "tw-transition-colors",
8072
- "has-[[data-state=checked]]:tw-border-primary",
8073
- "has-[[data-state=checked]]:tw-bg-accent",
8074
- "has-[[data-state=indeterminate]]:tw-border-primary",
8075
- "has-[[data-state=indeterminate]]:tw-bg-accent"
8076
- ]
8077
- }
8078
- },
8079
- defaultVariants: {
8080
- variant: "default"
7912
+ );
7913
+ }
7914
+ var dayPickerClassNames = {
7915
+ selected: `tw-bg-primary tw-border-primary tw-font-medium hover:tw-bg-primary/90 hover:tw-border-primary/90 tw-text-primary-foreground tw-rounded`
7916
+ };
7917
+ var rangePickerClassNames = {
7918
+ range_start: `tw-bg-primary tw-rounded-r-none tw-font-medium tw-border-primary hover:tw-bg-primary/90 hover:tw-border-primary/90 tw-text-primary-foreground`,
7919
+ range_end: `tw-bg-primary tw-rounded-l-none tw-font-medium tw-border-primary hover:tw-bg-primary/90 hover:tw-border-primary/90 tw-text-primary-foreground`,
7920
+ selected: `tw-font-medium tw-rounded`,
7921
+ range_middle: `tw-bg-accent tw-border-accent tw-text-accent-foreground tw-rounded-none tw-font-medium`
7922
+ };
7923
+ var Calendar = ({ className, classNames, ...props }) => {
7924
+ const defaultClassNames = getDefaultClassNames();
7925
+ return /* @__PURE__ */ jsx(
7926
+ DayPicker,
7927
+ {
7928
+ ...props,
7929
+ captionLayout: "dropdown",
7930
+ className: cn(className, "tw-p-3"),
7931
+ classNames: {
7932
+ chevron: `${defaultClassNames.chevron} tw-fill-foreground`,
7933
+ day: `${defaultClassNames.day} hover:tw-bg-accent tw-rounded`,
7934
+ day_button: `${defaultClassNames.day_button} tw-rounded`,
7935
+ today: `tw-bg-accent tw-text-accent-foreground tw-font-medium`,
7936
+ ...dayPickerClassNames,
7937
+ ...rangePickerClassNames,
7938
+ selected: `${props.mode === "range" ? rangePickerClassNames.selected : dayPickerClassNames.selected}`,
7939
+ ...classNames
7940
+ },
7941
+ required: false
8081
7942
  }
8082
- }
8083
- );
8084
- var FieldBoxRoot = ({
8085
- ref,
8086
- className,
8087
- variant,
8088
- position = "start",
8089
- control,
8090
- children,
8091
- ...rest
8092
- }) => /* @__PURE__ */ jsxs(
8093
- "label",
8094
- {
8095
- ...rest,
8096
- ref,
8097
- className: cn(
8098
- fieldBoxVariants({ variant, className }),
8099
- position === "end" && "tw-flex-row-reverse"
8100
- ),
8101
- children: [
8102
- /* @__PURE__ */ jsx("span", { className: "tw-inline-flex tw-min-h-5 tw-shrink-0 tw-items-center", children: control }),
8103
- children != null && /* @__PURE__ */ jsx("span", { className: "tw-flex tw-flex-1 tw-flex-col tw-gap-0.5", children })
8104
- ]
8105
- }
8106
- );
8107
- var FieldBox = Object.assign(FieldBoxRoot, {
8108
- Title: FieldBoxTitle,
8109
- Description: FieldBoxDescription
8110
- });
8111
- var rootVariants = cva(
7943
+ );
7944
+ };
7945
+ Calendar.displayName = "Calendar";
7946
+ var variants2 = cva(
8112
7947
  [
8113
- // reset
8114
7948
  "tailwindcss-preflight",
8115
- // position
7949
+ "tw-group/popover-content",
7950
+ "tw-z-[1055]",
7951
+ "focus-visible:tw-outline-none",
7952
+ // An open Radix Dialog locks `pointer-events: none` on <body>. Popover content
7953
+ // is portalled to <body> as a sibling of the dialog, so it inherits the lock
7954
+ // and clicks fall through — re-enable pointer events on the content itself
7955
+ // (dismiss-on-outside-click still works, it listens on document).
7956
+ "tw-pointer-events-auto",
7957
+ // sizing
7958
+ "tw-min-w-32",
7959
+ "tw-max-h-[var(--radix-popover-content-available-height)]",
7960
+ "tw-origin-[--radix-popover-content-transform-origin]",
7961
+ // layout
8116
7962
  "tw-flex",
8117
- "tw-items-center",
8118
- "tw-justify-center",
8119
- "tw-peer",
8120
- "tw-size-4",
8121
- "tw-shrink-0",
8122
- "tw-cursor-pointer",
7963
+ "tw-flex-col",
7964
+ "tw-overflow-y-auto",
8123
7965
  // border
7966
+ "tw-box-border",
8124
7967
  "tw-border",
8125
7968
  "tw-border-solid",
8126
- // disabled
8127
- "disabled:tw-opacity-50",
8128
- "disabled:tw-cursor-not-allowed"
7969
+ "tw-shadow-lg",
7970
+ // open animation
7971
+ "data-[state=open]:tw-animate-in",
7972
+ "data-[state=open]:tw-fade-in-0",
7973
+ "data-[state=open]:tw-zoom-in-95",
7974
+ // closed animation
7975
+ "data-[state=closed]:tw-animate-out",
7976
+ "data-[state=closed]:tw-fade-out-0",
7977
+ "data-[state=closed]:tw-zoom-out-95",
7978
+ // position animation
7979
+ "data-[side=bottom]:tw-slide-in-from-top-2",
7980
+ "data-[side=left]:tw-slide-in-from-right-2",
7981
+ "data-[side=right]:tw-slide-in-from-left-2",
7982
+ "data-[side=top]:tw-slide-in-from-bottom-2",
7983
+ // Default size for nested Lucide icons; callers can override on the icon.
7984
+ "[&_svg.lucide:not([class*='tw-size-'])]:tw-size-4",
7985
+ "[&_svg]:tw-shrink-0"
8129
7986
  ],
8130
7987
  {
8131
7988
  defaultVariants: {
7989
+ matchTriggerWidth: false,
8132
7990
  variant: "default"
8133
7991
  },
8134
7992
  variants: {
8135
7993
  variant: {
8136
- default: [
8137
- "tw-rounded",
8138
- "tw-border-neutral-200",
8139
- "data-[state=checked]:tw-bg-primary",
8140
- "data-[state=checked]:tw-border-primary",
8141
- "data-[state=indeterminate]:tw-bg-white",
8142
- "data-[state=indeterminate]:tw-border-neutral-200"
8143
- ],
8144
- argo: [
8145
- "tw-rounded",
8146
- "tw-border-input",
8147
- "tw-transition-colors",
8148
- "data-[state=checked]:tw-bg-primary",
8149
- "data-[state=checked]:tw-border-primary",
8150
- "data-[state=indeterminate]:tw-bg-primary",
8151
- "data-[state=indeterminate]:tw-border-primary",
8152
- // focus
8153
- "focus-visible:tw-outline-none",
8154
- "focus-visible:tw-border-primary",
8155
- "focus-visible:tw-ring-2",
8156
- "focus-visible:tw-ring-ring/50"
8157
- ]
7994
+ // Legacy surface — fixed white panel.
7995
+ default: ["tw-rounded-md", "tw-border-neutral-100", "tw-bg-white", "tw-text-neutral-800"],
7996
+ // Argo surface — semantic popover tokens (brand + dark aware).
7997
+ argo: ["tw-rounded-2xl", "tw-border-border", "tw-bg-popover", "tw-text-popover-foreground"]
7998
+ },
7999
+ matchTriggerWidth: {
8000
+ true: ["tw-w-[var(--radix-popover-trigger-width)]"],
8001
+ false: []
8002
+ }
8003
+ }
8004
+ }
8005
+ );
8006
+ var PopoverContent = ({
8007
+ ref,
8008
+ className,
8009
+ align = "center",
8010
+ sideOffset = 4,
8011
+ matchTriggerWidth = false,
8012
+ children,
8013
+ onEscapeKeyDown,
8014
+ ...props
8015
+ }) => {
8016
+ const effectiveVariant = useArgoDesign() ? "argo" : "default";
8017
+ return /* @__PURE__ */ jsx(Portal$1, { children: /* @__PURE__ */ jsx(
8018
+ Content$2,
8019
+ {
8020
+ ref,
8021
+ align: matchTriggerWidth ? "start" : align,
8022
+ sideOffset,
8023
+ className: cn(variants2({ className, matchTriggerWidth, variant: effectiveVariant })),
8024
+ onEscapeKeyDown: (event) => {
8025
+ event.stopPropagation();
8026
+ onEscapeKeyDown?.(event);
8027
+ },
8028
+ ...props,
8029
+ children
8030
+ }
8031
+ ) });
8032
+ };
8033
+ var Popover = (props) => /* @__PURE__ */ jsx(Root$3, { ...props });
8034
+ Popover.Content = PopoverContent;
8035
+ Popover.Trigger = Trigger$1;
8036
+ Popover.Close = Close;
8037
+ var DatePicker = ({
8038
+ align = "end",
8039
+ alignOffset = -18,
8040
+ children,
8041
+ defaultOpen,
8042
+ onOpenChange,
8043
+ open,
8044
+ sideOffset = 12,
8045
+ ...calendarProps
8046
+ }) => /* @__PURE__ */ jsxs(Popover, { defaultOpen, open, onOpenChange, children: [
8047
+ /* @__PURE__ */ jsx(Popover.Trigger, { asChild: true, children }),
8048
+ /* @__PURE__ */ jsx(
8049
+ Popover.Content,
8050
+ {
8051
+ align,
8052
+ alignOffset,
8053
+ className: "tw-w-auto tw-p-0",
8054
+ sideOffset,
8055
+ children: /* @__PURE__ */ jsx(Calendar, { ...calendarProps })
8056
+ }
8057
+ )
8058
+ ] });
8059
+ DatePicker.displayName = "DatePicker";
8060
+
8061
+ // src/blocks/DateInput/helpers.ts
8062
+ var formatDate = (date, inputValue) => {
8063
+ if (!date) {
8064
+ return inputValue;
8065
+ }
8066
+ return date.toLocaleDateString();
8067
+ };
8068
+ var datePartOrder = new Intl.DateTimeFormat().formatToParts(new Date(2e3, 0, 2)).filter(
8069
+ (p) => p.type === "day" || p.type === "month" || p.type === "year"
8070
+ ).map((p) => p.type);
8071
+ var parseDate = (value) => {
8072
+ if (!value.trim()) return null;
8073
+ const nums = value.match(/\d+/g)?.map(Number);
8074
+ if (nums && nums.length >= 3) {
8075
+ const parts = Object.fromEntries(datePartOrder.map((type, i) => [type, nums[i]]));
8076
+ const year = parts.year;
8077
+ const month = parts.month;
8078
+ const day = parts.day;
8079
+ if (year != null && month != null && day != null && month >= 1 && month <= 12 && day >= 1 && day <= 31) {
8080
+ const date = new Date(year, month - 1, day);
8081
+ if (date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day) {
8082
+ return date;
8158
8083
  }
8159
8084
  }
8160
8085
  }
8161
- );
8162
- var indicatorVariants = cva(["tw-group", "tw-flex", "tw-items-center"], {
8163
- defaultVariants: {
8164
- variant: "default"
8165
- },
8166
- variants: {
8167
- variant: {
8168
- default: [
8169
- "data-[state=checked]:tw-text-primary-foreground",
8170
- "data-[state=indeterminate]:tw-text-neutral-200"
8171
- ],
8172
- argo: ["tw-text-primary-foreground"]
8086
+ const isoMatch = value.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);
8087
+ if (isoMatch) {
8088
+ const y = Number(isoMatch[1]);
8089
+ const m = Number(isoMatch[2]) - 1;
8090
+ const d = Number(isoMatch[3]);
8091
+ const date = new Date(y, m, d);
8092
+ if (date.getFullYear() === y && date.getMonth() === m && date.getDate() === d) {
8093
+ return date;
8173
8094
  }
8095
+ return null;
8174
8096
  }
8175
- });
8176
- function Checkbox({
8177
- className,
8178
- id: idProp,
8179
- children,
8180
- description,
8097
+ const fallback = new Date(value);
8098
+ return isNaN(fallback.getTime()) ? null : fallback;
8099
+ };
8100
+ var DateInput = ({
8101
+ ref,
8102
+ // group props
8103
+ state,
8181
8104
  variant,
8182
- position,
8183
- tooltip,
8184
- tooltipPlacement = "top",
8185
- ...rest
8186
- }) {
8187
- const fallbackId = useId();
8188
- const id = idProp?.toString() ?? fallbackId;
8189
- const styleVariant = useArgoDesign() ? "argo" : "default";
8190
- const checkboxElement = /* @__PURE__ */ jsx(Root, { id, ...rest, className: cn(rootVariants({ variant: styleVariant, className })), children: /* @__PURE__ */ jsxs(Indicator, { className: cn(indicatorVariants({ variant: styleVariant })), children: [
8191
- /* @__PURE__ */ jsx(icons_exports.Check, { className: "tw-hidden tw-size-3 tw-stroke-[4px] group-data-[state=checked]:tw-block" }),
8192
- /* @__PURE__ */ jsx(icons_exports.Minus, { className: "tw-hidden tw-size-3 tw-stroke-[4px] group-data-[state=indeterminate]:tw-block" })
8193
- ] }) });
8194
- const rendered = !children ? checkboxElement : /* @__PURE__ */ jsxs(FieldBox, { htmlFor: id, variant, position, control: checkboxElement, children: [
8195
- /* @__PURE__ */ jsx(FieldBox.Title, { children }),
8196
- description && /* @__PURE__ */ jsx(FieldBox.Description, { children: description })
8197
- ] });
8198
- if (!tooltip) return rendered;
8199
- return /* @__PURE__ */ jsx(Tooltip, { tooltip, placement: tooltipPlacement, triggerAsChild: !!children, children: rendered });
8200
- }
8201
- var CheckboxWidget = ({
8202
- id,
8105
+ focusVariant,
8106
+ sizing,
8107
+ className,
8108
+ // own props
8203
8109
  value,
8110
+ defaultValue,
8111
+ onValueChange,
8112
+ onValueBlur,
8204
8113
  onChange,
8114
+ onBlur,
8115
+ onFocus,
8116
+ allowClear = false,
8117
+ disabledDays,
8118
+ endMonth,
8119
+ startMonth,
8120
+ // input props
8205
8121
  disabled,
8206
- readonly,
8207
- label,
8208
- hideLabel
8122
+ readOnly,
8123
+ placeholder = "Select a date",
8124
+ ...restInputProps
8209
8125
  }) => {
8210
- const checked = !!value;
8211
- return /* @__PURE__ */ jsx(Checkbox, { id, checked, onCheckedChange: onChange, disabled: disabled || readonly, children: hideLabel ? void 0 : label });
8126
+ const inputRef = useRef(null);
8127
+ const [inputValue, setInputValue] = useState("");
8128
+ const [hasFocus, setHasFocus] = useState(false);
8129
+ const [isOpen, setIsOpen] = useState(false);
8130
+ const [month, setMonth2] = useState(/* @__PURE__ */ new Date());
8131
+ const [currentValue, setCurrentValue] = useControllableState({
8132
+ prop: value,
8133
+ defaultProp: defaultValue ?? null
8134
+ });
8135
+ const canClear = allowClear && !!currentValue && !disabled && !readOnly;
8136
+ const showPicker2 = !disabled && !readOnly;
8137
+ const handleChange = (event) => {
8138
+ const newValue = event.target.value;
8139
+ setInputValue(newValue);
8140
+ onChange?.(event);
8141
+ const parsedDate = parseDate(newValue);
8142
+ if (parsedDate !== null || !newValue.trim()) {
8143
+ onValueChange?.(parsedDate);
8144
+ }
8145
+ };
8146
+ const handleFocus = (event) => {
8147
+ const formatted = formatDate(currentValue, "");
8148
+ setInputValue(formatted);
8149
+ setHasFocus(true);
8150
+ onFocus?.(event);
8151
+ };
8152
+ const handleBlur = (event) => {
8153
+ setHasFocus(false);
8154
+ onBlur?.(event);
8155
+ const text = event.target.value;
8156
+ const parsedDate = text === formatDate(currentValue, "") ? currentValue : parseDate(text);
8157
+ onValueBlur?.(parsedDate);
8158
+ setCurrentValue(parsedDate);
8159
+ };
8160
+ const handleDatePickerChange = (newValue) => {
8161
+ const dateValue = newValue ?? null;
8162
+ setCurrentValue(dateValue);
8163
+ onValueChange?.(dateValue);
8164
+ setHasFocus(false);
8165
+ setIsOpen(false);
8166
+ };
8167
+ const handleClear = () => {
8168
+ if (!inputRef.current) return;
8169
+ inputRef.current.value = "";
8170
+ setInputValue("");
8171
+ setCurrentValue(null);
8172
+ onValueChange?.(null);
8173
+ onChange?.(createChangeInputEvent(inputRef.current));
8174
+ };
8175
+ const handleOpenChange = (open) => {
8176
+ if (open) {
8177
+ setMonth2(currentValue ?? /* @__PURE__ */ new Date());
8178
+ }
8179
+ setIsOpen(open);
8180
+ };
8181
+ const displayValue = hasFocus ? inputValue : formatDate(currentValue, "");
8182
+ return /* @__PURE__ */ jsxs(
8183
+ InputGroup,
8184
+ {
8185
+ state,
8186
+ variant,
8187
+ sizing,
8188
+ focusVariant,
8189
+ className,
8190
+ children: [
8191
+ /* @__PURE__ */ jsx(
8192
+ InputGroup.Input,
8193
+ {
8194
+ ...restInputProps,
8195
+ ref: mergeRefs(ref ?? null, inputRef),
8196
+ type: "text",
8197
+ value: displayValue,
8198
+ placeholder,
8199
+ onChange: handleChange,
8200
+ onFocus: handleFocus,
8201
+ onBlur: handleBlur,
8202
+ disabled,
8203
+ readOnly
8204
+ }
8205
+ ),
8206
+ (canClear || showPicker2) && /* @__PURE__ */ jsxs(InputGroup.Addon, { align: "inline-end", children: [
8207
+ canClear && /* @__PURE__ */ jsx(
8208
+ InputGroup.Button,
8209
+ {
8210
+ "aria-label": "Clear date",
8211
+ onMouseDown: (event) => event.preventDefault(),
8212
+ onClick: handleClear,
8213
+ children: /* @__PURE__ */ jsx(icons_exports.X, { className: "tw-size-4" })
8214
+ }
8215
+ ),
8216
+ showPicker2 && /* @__PURE__ */ jsx(
8217
+ DatePicker,
8218
+ {
8219
+ disabled: disabledDays,
8220
+ endMonth,
8221
+ mode: "single",
8222
+ month,
8223
+ onMonthChange: setMonth2,
8224
+ onOpenChange: handleOpenChange,
8225
+ onSelect: handleDatePickerChange,
8226
+ open: isOpen,
8227
+ selected: currentValue ?? void 0,
8228
+ startMonth,
8229
+ children: /* @__PURE__ */ jsx(InputGroup.Button, { "aria-label": "Select Date", children: /* @__PURE__ */ jsx(icons_exports.Calendar, { className: "tw-size-4" }) })
8230
+ }
8231
+ )
8232
+ ] })
8233
+ ]
8234
+ }
8235
+ );
8212
8236
  };
8213
8237
  var DateWidget = ({
8214
8238
  id,
@@ -8309,13 +8333,7 @@ var BadgeAddon = ({
8309
8333
  className: cn(addonVariants2({ align, variant, className }))
8310
8334
  }
8311
8335
  );
8312
- var BadgeButton = ({
8313
- ref,
8314
- className,
8315
- type = "button",
8316
- children,
8317
- ...rest
8318
- }) => /* @__PURE__ */ jsx(
8336
+ var BadgeButton = ({ ref, className, type = "button", children, ...rest }) => /* @__PURE__ */ jsx(
8319
8337
  "button",
8320
8338
  {
8321
8339
  ...rest,
@@ -8340,12 +8358,7 @@ var BadgeButton = ({
8340
8358
  children
8341
8359
  }
8342
8360
  );
8343
- var BadgeLabel = ({
8344
- ref,
8345
- className,
8346
- asChild = false,
8347
- ...rest
8348
- }) => {
8361
+ var BadgeLabel = ({ ref, className, asChild = false, ...rest }) => {
8349
8362
  const Comp = asChild ? Slot : "span";
8350
8363
  return /* @__PURE__ */ jsx(
8351
8364
  Comp,
@@ -8371,7 +8384,7 @@ var BadgeLabel = ({
8371
8384
  var badgeColors = {
8372
8385
  gray: "tw-bg-neutral-400 tw-text-white tw-decoration-neutral-400",
8373
8386
  "gray-darker": "tw-bg-neutral-500 tw-text-white tw-decoration-neutral-500",
8374
- "gray-inverse": "tw-bg-neutral-100 tw-text-neutral-500 tw-decoration-neutral-100 [[data-theme=dark]_&]:tw-bg-neutral-800 [[data-theme=dark]_&]:tw-text-neutral-300 [[data-theme=dark]_&]:tw-decoration-neutral-800",
8387
+ "gray-inverse": "tw-bg-neutral-100 tw-text-neutral-500 tw-decoration-neutral-100 [[data-theme=dark]_&]:tw-bg-neutral-700 [[data-theme=dark]_&]:tw-text-neutral-300 [[data-theme=dark]_&]:tw-decoration-neutral-700",
8375
8388
  green: "tw-bg-green-500 tw-text-white tw-decoration-green-500",
8376
8389
  "green-darker": "tw-bg-green-600 tw-text-white tw-decoration-green-600",
8377
8390
  "green-inverse": "tw-bg-green-100 tw-text-green-900 tw-decoration-green-100 [[data-theme=dark]_&]:tw-bg-green-900 [[data-theme=dark]_&]:tw-text-green-200 [[data-theme=dark]_&]:tw-decoration-green-900",
@@ -8439,14 +8452,7 @@ var badgeRootVariants = cva(
8439
8452
  }
8440
8453
  }
8441
8454
  );
8442
- var BadgeRoot = ({
8443
- ref,
8444
- variant,
8445
- color,
8446
- className,
8447
- children,
8448
- ...rest
8449
- }) => /* @__PURE__ */ jsx(
8455
+ var BadgeRoot = ({ ref, variant, color, className, children, ...rest }) => /* @__PURE__ */ jsx(
8450
8456
  "div",
8451
8457
  {
8452
8458
  ...rest,
@@ -8649,11 +8655,7 @@ var ComboboxContent = ({
8649
8655
  }
8650
8656
  ) });
8651
8657
  };
8652
- var ComboboxEmpty = ({
8653
- ref,
8654
- className,
8655
- ...props
8656
- }) => /* @__PURE__ */ jsx(
8658
+ var ComboboxEmpty = ({ ref, className, ...props }) => /* @__PURE__ */ jsx(
8657
8659
  Combobox$1.Empty,
8658
8660
  {
8659
8661
  ref,
@@ -8697,12 +8699,7 @@ var ComboboxInputGroup = ({
8697
8699
  )
8698
8700
  }
8699
8701
  );
8700
- var ComboboxItemIndicator = ({
8701
- ref,
8702
- className,
8703
- variant = "check",
8704
- ...props
8705
- }) => {
8702
+ var ComboboxItemIndicator = ({ ref, className, variant = "check", ...props }) => {
8706
8703
  if (variant === "checkbox") {
8707
8704
  return /* @__PURE__ */ jsx(
8708
8705
  Combobox$1.ItemIndicator,
@@ -8815,11 +8812,7 @@ var ComboboxItem = ({
8815
8812
  ]
8816
8813
  }
8817
8814
  );
8818
- var ComboboxList = ({
8819
- ref,
8820
- className,
8821
- ...props
8822
- }) => /* @__PURE__ */ jsx(
8815
+ var ComboboxList = ({ ref, className, ...props }) => /* @__PURE__ */ jsx(
8823
8816
  Combobox$1.List,
8824
8817
  {
8825
8818
  ref,
@@ -8839,11 +8832,7 @@ var ComboboxList = ({
8839
8832
  }
8840
8833
  );
8841
8834
  var ComboboxRoot = (props) => /* @__PURE__ */ jsx(Combobox$1.Root, { ...props });
8842
- var ComboboxSeparator = ({
8843
- ref,
8844
- className,
8845
- ...props
8846
- }) => /* @__PURE__ */ jsx(
8835
+ var ComboboxSeparator = ({ ref, className, ...props }) => /* @__PURE__ */ jsx(
8847
8836
  Combobox$1.Separator,
8848
8837
  {
8849
8838
  ref,
@@ -8851,12 +8840,7 @@ var ComboboxSeparator = ({
8851
8840
  ...props
8852
8841
  }
8853
8842
  );
8854
- var ComboboxGroup = ({
8855
- ref,
8856
- className,
8857
- children,
8858
- ...props
8859
- }) => /* @__PURE__ */ jsx(
8843
+ var ComboboxGroup = ({ ref, className, children, ...props }) => /* @__PURE__ */ jsx(
8860
8844
  Combobox$1.Group,
8861
8845
  {
8862
8846
  ref,
@@ -8865,11 +8849,7 @@ var ComboboxGroup = ({
8865
8849
  children
8866
8850
  }
8867
8851
  );
8868
- var ComboboxGroupLabel = ({
8869
- ref,
8870
- className,
8871
- ...props
8872
- }) => /* @__PURE__ */ jsx(
8852
+ var ComboboxGroupLabel = ({ ref, className, ...props }) => /* @__PURE__ */ jsx(
8873
8853
  Combobox$1.GroupLabel,
8874
8854
  {
8875
8855
  ...props,
@@ -9163,6 +9143,7 @@ var PasswordInput = ({
9163
9143
  onMouseDown,
9164
9144
  allowClear = false,
9165
9145
  allowPasswordToggle = false,
9146
+ passwordToggleLabel,
9166
9147
  autoComplete = "new-password",
9167
9148
  defaultPasswordVisibility = false,
9168
9149
  // input props
@@ -9171,13 +9152,12 @@ var PasswordInput = ({
9171
9152
  ...restInputProps
9172
9153
  }) => {
9173
9154
  const inputRef = useRef(null);
9174
- const [internalValue, setInternalValue] = useState(defaultValue ?? "");
9175
- const isControlled = valueProp !== void 0;
9176
- const value = isControlled ? valueProp ?? "" : internalValue;
9177
- const setValue = (next) => {
9178
- if (!isControlled) setInternalValue(next);
9179
- onValueChange?.(next);
9180
- };
9155
+ const [value, setValue] = useControllableState({
9156
+ // A `null` controlled value stays controlled (coerced to ''); `undefined` is uncontrolled.
9157
+ prop: valueProp === null ? "" : valueProp,
9158
+ defaultProp: defaultValue ?? "",
9159
+ onChange: onValueChange
9160
+ });
9181
9161
  const [capsLock, setCapsLock] = useState(false);
9182
9162
  const [isPasswordVisible, setIsPasswordVisible] = useState(defaultPasswordVisibility);
9183
9163
  const canClear = allowClear && !!value && !disabled && !readOnly;
@@ -9254,7 +9234,7 @@ var PasswordInput = ({
9254
9234
  allowPasswordToggle && /* @__PURE__ */ jsx(
9255
9235
  InputGroup.Button,
9256
9236
  {
9257
- "aria-label": isPasswordVisible ? "Hide password" : "Show password",
9237
+ "aria-label": `${isPasswordVisible ? "Hide password" : "Show password"}${passwordToggleLabel ? `: ${passwordToggleLabel}` : ""}`,
9258
9238
  onMouseDown: (event) => event.preventDefault(),
9259
9239
  onClick: handleTogglePasswordVisibility,
9260
9240
  children: isPasswordVisible ? /* @__PURE__ */ jsx(icons_exports.EyeOff, { className: "tw-size-4" }) : /* @__PURE__ */ jsx(icons_exports.Eye, { className: "tw-size-4" })
@@ -10001,6 +9981,10 @@ var generateUiSchema = (schema, readOnly = false, definitions, globalConfig, has
10001
9981
  ...arrayOpts
10002
9982
  };
10003
9983
  }
9984
+ const itemsEnumTitles = propSchema.items?.options?.enum_titles;
9985
+ if (Array.isArray(itemsEnumTitles)) {
9986
+ fieldUi.items = { "ui:options": { enumNames: itemsEnumTitles } };
9987
+ }
10004
9988
  }
10005
9989
  if (type === "object" && propSchema.properties) {
10006
9990
  const nestedGlobal = globalValue && typeof globalValue === "object" && !Array.isArray(globalValue) ? globalValue : void 0;