@keboola/design 6.4.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(
@@ -440,6 +442,7 @@ var Keboola = forwardRef(
440
442
  width: size,
441
443
  height: size,
442
444
  viewBox: "0 0 300 512",
445
+ overflow: "visible",
443
446
  fill: color,
444
447
  className: cn("lucide", className),
445
448
  ...rest,
@@ -1004,14 +1007,9 @@ var getLanguageMode = (mode) => {
1004
1007
  return json();
1005
1008
  }
1006
1009
  };
1010
+ var shouldLintJson = (mode, readOnly) => mode === "application/json" && !readOnly;
1007
1011
  var KbdSeparator = ({ className, ...props }) => /* @__PURE__ */ jsx("span", { ...props, className: cn("tw-text-xs tw-text-muted-foreground", className) });
1008
- var KbdGroup = ({
1009
- ref,
1010
- className,
1011
- children,
1012
- separator,
1013
- ...props
1014
- }) => {
1012
+ var KbdGroup = ({ ref, className, children, separator, ...props }) => {
1015
1013
  return /* @__PURE__ */ jsx(
1016
1014
  "kbd",
1017
1015
  {
@@ -1102,7 +1100,7 @@ var CodeEditor = ({
1102
1100
  const commonExtensions = useMemo(() => {
1103
1101
  return [
1104
1102
  getLanguageMode(mode),
1105
- mode === "application/json" && linter(jsonParseLinter()),
1103
+ shouldLintJson(mode, readOnly) && linter(jsonParseLinter()),
1106
1104
  withLineWrapping ? EditorView.lineWrapping : [],
1107
1105
  EditorState.languageData.of(() => [
1108
1106
  { autocomplete: completeAny ? completeAnyWord : autocompletions }
@@ -1120,7 +1118,7 @@ var CodeEditor = ({
1120
1118
  autocompletion({ activateOnTyping: completeAny }),
1121
1119
  baseTheme
1122
1120
  ].filter(Boolean);
1123
- }, [autocompletions, completeAny, extraKeys, mode, withLineWrapping, baseTheme]);
1121
+ }, [autocompletions, completeAny, extraKeys, mode, readOnly, withLineWrapping, baseTheme]);
1124
1122
  const extensions = useMemo(() => {
1125
1123
  return [
1126
1124
  ...commonExtensions,
@@ -1591,12 +1589,7 @@ var GridObjectField = ({
1591
1589
  gridContent
1592
1590
  ] });
1593
1591
  };
1594
- var CollapsibleContent = ({
1595
- ref,
1596
- className,
1597
- children,
1598
- ...props
1599
- }) => /* @__PURE__ */ jsx(
1592
+ var CollapsibleContent = ({ ref, className, children, ...props }) => /* @__PURE__ */ jsx(
1600
1593
  Content$1,
1601
1594
  {
1602
1595
  ref,
@@ -1612,12 +1605,7 @@ var CollapsibleContent = ({
1612
1605
  var Collapsible = (props) => /* @__PURE__ */ jsx(Root$2, { ...props });
1613
1606
  Collapsible.Trigger = CollapsibleTrigger;
1614
1607
  Collapsible.Content = CollapsibleContent;
1615
- var AlertAction = ({
1616
- ref,
1617
- className,
1618
- asChild = false,
1619
- ...props
1620
- }) => {
1608
+ var AlertAction = ({ ref, className, asChild = false, ...props }) => {
1621
1609
  const Comp = asChild ? Slot : "div";
1622
1610
  return /* @__PURE__ */ jsx(
1623
1611
  Comp,
@@ -1655,12 +1643,7 @@ var AlertCollapsibleIcon = ({ open }) => /* @__PURE__ */ jsx(Tooltip, { placemen
1655
1643
  )
1656
1644
  }
1657
1645
  ) });
1658
- var AlertDescription = ({
1659
- ref,
1660
- children,
1661
- className,
1662
- ...rest
1663
- }) => /* @__PURE__ */ jsx(
1646
+ var AlertDescription = ({ ref, children, className, ...rest }) => /* @__PURE__ */ jsx(
1664
1647
  "div",
1665
1648
  {
1666
1649
  ...rest,
@@ -1713,13 +1696,7 @@ var AlertIcon = ({ variant, icon, className, ...rest }) => /* @__PURE__ */ jsx(
1713
1696
  children: icon ?? VARIANT_ICONS[variant]
1714
1697
  }
1715
1698
  );
1716
- var AlertRoot = ({
1717
- ref,
1718
- children,
1719
- className,
1720
- variant,
1721
- ...rest
1722
- }) => {
1699
+ var AlertRoot = ({ ref, children, className, variant, ...rest }) => {
1723
1700
  const renderArgo = useArgoDesign();
1724
1701
  return /* @__PURE__ */ jsx(
1725
1702
  "div",
@@ -1776,11 +1753,7 @@ var AlertRoot = ({
1776
1753
  }
1777
1754
  );
1778
1755
  };
1779
- var AlertTitle = ({
1780
- ref,
1781
- className,
1782
- ...props
1783
- }) => /* @__PURE__ */ jsx(
1756
+ var AlertTitle = ({ ref, className, ...props }) => /* @__PURE__ */ jsx(
1784
1757
  "div",
1785
1758
  {
1786
1759
  ...props,
@@ -2310,6 +2283,55 @@ var ErrorListTemplate = ({ errors }) => {
2310
2283
  if (!errors.length) return null;
2311
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}`)) });
2312
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
+ };
2313
2335
  var FormGroupContext = createContext({
2314
2336
  state: "default"
2315
2337
  });
@@ -2357,12 +2379,7 @@ var InputGroupAddon = ({
2357
2379
  className,
2358
2380
  ...props
2359
2381
  }) => /* @__PURE__ */ jsx("div", { ...props, "data-align": align, className: cn(addonVariants({ align, className })), children });
2360
- var InputGroupButton = ({
2361
- ref,
2362
- className,
2363
- tabIndex = -1,
2364
- ...props
2365
- }) => /* @__PURE__ */ jsx(
2382
+ var InputGroupButton = ({ ref, className, tabIndex = -1, ...props }) => /* @__PURE__ */ jsx(
2366
2383
  Button,
2367
2384
  {
2368
2385
  ...props,
@@ -2373,11 +2390,7 @@ var InputGroupButton = ({
2373
2390
  className: cn("tw-size-5", "[&_svg]:tw-text-muted-foreground", className)
2374
2391
  }
2375
2392
  );
2376
- var InputGroupInput = ({
2377
- ref,
2378
- className,
2379
- ...inputProps
2380
- }) => /* @__PURE__ */ jsx(
2393
+ var InputGroupInput = ({ ref, className, ...inputProps }) => /* @__PURE__ */ jsx(
2381
2394
  "input",
2382
2395
  {
2383
2396
  ...inputProps,
@@ -2705,6 +2718,29 @@ InputGroup.Addon = InputGroupAddon;
2705
2718
  InputGroup.Button = InputGroupButton;
2706
2719
  InputGroup.TextArea = InputGroupTextArea;
2707
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
+ };
2708
2744
 
2709
2745
  // src/blocks/ColorInput/utils.ts
2710
2746
  var HEX_CHARSET = /^[0-9a-fA-F]+$/;
@@ -2796,13 +2832,13 @@ var ColorInput = ({
2796
2832
  ...restInputProps
2797
2833
  }) => {
2798
2834
  const inputRef = useRef(null);
2799
- 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
+ });
2800
2841
  const isControlled = valueProp !== void 0;
2801
- const value = isControlled ? valueProp ?? "" : internalValue;
2802
- const setValue = (nextValue) => {
2803
- if (!isControlled) setInternalValue(nextValue);
2804
- onValueChange?.(nextValue);
2805
- };
2806
2842
  const canClear = allowClear && !!value && !disabled && !readOnly;
2807
2843
  const swatchColor = coerceHexInputValue(value);
2808
2844
  const isValidSwatch = isCompleteHexColor(swatchColor);
@@ -2905,10 +2941,7 @@ var ColorInput = ({
2905
2941
  }
2906
2942
  );
2907
2943
  };
2908
- var FormGroupColorInput = ({
2909
- ref,
2910
- ...props
2911
- }) => {
2944
+ var FormGroupColorInput = ({ ref, ...props }) => {
2912
2945
  const { state } = useFormGroupContext();
2913
2946
  return /* @__PURE__ */ jsx(ColorInput, { state, ...props, ref });
2914
2947
  };
@@ -2982,10 +3015,7 @@ var NumberInput = ({
2982
3015
  }
2983
3016
  );
2984
3017
  };
2985
- var FormGroupNumberInput = ({
2986
- ref,
2987
- ...props
2988
- }) => {
3018
+ var FormGroupNumberInput = ({ ref, ...props }) => {
2989
3019
  const { state } = useFormGroupContext();
2990
3020
  return /* @__PURE__ */ jsx(NumberInput, { ...props, ref, state });
2991
3021
  };
@@ -2997,8 +3027,18 @@ var Textarea = ({
2997
3027
  variant,
2998
3028
  sizing,
2999
3029
  focusVariant,
3030
+ // value handling
3031
+ value: valueProp,
3032
+ defaultValue,
3033
+ onValueChange,
3000
3034
  ...rest
3001
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
+ });
3002
3042
  return /* @__PURE__ */ jsx(
3003
3043
  InputGroup,
3004
3044
  {
@@ -3007,7 +3047,7 @@ var Textarea = ({
3007
3047
  focusVariant,
3008
3048
  variant,
3009
3049
  className: containerClassName,
3010
- children: /* @__PURE__ */ jsx(InputGroup.TextArea, { ...rest, ref })
3050
+ children: /* @__PURE__ */ jsx(InputGroup.TextArea, { ...rest, ref, value, onValueChange: setValue })
3011
3051
  }
3012
3052
  );
3013
3053
  };
@@ -3016,497 +3056,1006 @@ var FormGroupTextarea = (props) => {
3016
3056
  return /* @__PURE__ */ jsx(Textarea, { state, ...props });
3017
3057
  };
3018
3058
 
3019
- // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tzName/index.js
3020
- function tzName(timeZone, date, format2 = "long") {
3021
- return new Intl.DateTimeFormat("en-US", {
3022
- // Enforces engine to render the time. Without the option JavaScriptCore omits it.
3023
- hour: "numeric",
3024
- timeZone,
3025
- timeZoneName: format2
3026
- }).format(date).split(/\s/g).slice(2).join(" ");
3027
- }
3028
-
3029
- // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tzOffset/index.js
3030
- var offsetFormatCache = {};
3031
- var offsetCache = {};
3032
- function tzOffset(timeZone, date) {
3033
- try {
3034
- const format2 = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat("en-US", {
3035
- timeZone,
3036
- timeZoneName: "longOffset"
3037
- }).format;
3038
- const offsetStr = format2(date).split("GMT")[1];
3039
- if (offsetStr in offsetCache) return offsetCache[offsetStr];
3040
- return calcOffset(offsetStr, offsetStr.split(":"));
3041
- } catch {
3042
- if (timeZone in offsetCache) return offsetCache[timeZone];
3043
- const captures = timeZone?.match(offsetRe);
3044
- if (captures) return calcOffset(timeZone, captures.slice(1));
3045
- return NaN;
3046
- }
3047
- }
3048
- var offsetRe = /([+-]\d\d):?(\d\d)?/;
3049
- function calcOffset(cacheStr, values) {
3050
- const hours = +(values[0] || 0);
3051
- const minutes = +(values[1] || 0);
3052
- const seconds = +(values[2] || 0) / 60;
3053
- return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;
3054
- }
3055
-
3056
- // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/date/mini.js
3057
- var TZDateMini = class _TZDateMini extends Date {
3058
- //#region static
3059
- constructor(...args) {
3060
- super();
3061
- if (args.length > 1 && typeof args[args.length - 1] === "string") {
3062
- this.timeZone = args.pop();
3063
- }
3064
- this.internal = /* @__PURE__ */ new Date();
3065
- if (isNaN(tzOffset(this.timeZone, this))) {
3066
- this.setTime(NaN);
3067
- } else {
3068
- if (!args.length) {
3069
- this.setTime(Date.now());
3070
- } else if (typeof args[0] === "number" && (args.length === 1 || args.length === 2 && typeof args[1] !== "number")) {
3071
- this.setTime(args[0]);
3072
- } else if (typeof args[0] === "string") {
3073
- this.setTime(+new Date(args[0]));
3074
- } else if (args[0] instanceof Date) {
3075
- this.setTime(+args[0]);
3076
- } else {
3077
- this.setTime(+new Date(...args));
3078
- adjustToSystemTZ(this);
3079
- syncToInternal(this);
3080
- }
3081
- }
3082
- }
3083
- static tz(tz, ...args) {
3084
- return args.length ? new _TZDateMini(...args, tz) : new _TZDateMini(Date.now(), tz);
3085
- }
3086
- //#endregion
3087
- //#region time zone
3088
- withTimeZone(timeZone) {
3089
- return new _TZDateMini(+this, timeZone);
3090
- }
3091
- getTimezoneOffset() {
3092
- const offset = -tzOffset(this.timeZone, this);
3093
- return offset > 0 ? Math.floor(offset) : Math.ceil(offset);
3094
- }
3095
- //#endregion
3096
- //#region time
3097
- setTime(time) {
3098
- Date.prototype.setTime.apply(this, arguments);
3099
- syncToInternal(this);
3100
- return +this;
3101
- }
3102
- //#endregion
3103
- //#region date-fns integration
3104
- [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) {
3105
- return new _TZDateMini(+new Date(date), this.timeZone);
3106
- }
3107
- //#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
+ };
3108
3068
  };
3109
- var re = /^(get|set)(?!UTC)/;
3110
- Object.getOwnPropertyNames(Date.prototype).forEach((method) => {
3111
- if (!re.test(method)) return;
3112
- const utcMethod = method.replace(re, "$1UTC");
3113
- if (!TZDateMini.prototype[utcMethod]) return;
3114
- if (method.startsWith("get")) {
3115
- TZDateMini.prototype[method] = function() {
3116
- return this.internal[utcMethod]();
3117
- };
3118
- } else {
3119
- TZDateMini.prototype[method] = function() {
3120
- Date.prototype[utcMethod].apply(this.internal, arguments);
3121
- syncFromInternal(this);
3122
- return +this;
3123
- };
3124
- TZDateMini.prototype[utcMethod] = function() {
3125
- Date.prototype[utcMethod].apply(this, arguments);
3126
- syncToInternal(this);
3127
- return +this;
3128
- };
3129
- }
3130
- });
3131
- function syncToInternal(date) {
3132
- date.internal.setTime(+date);
3133
- date.internal.setUTCSeconds(date.internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, date) * 60));
3134
- }
3135
- function syncFromInternal(date) {
3136
- Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());
3137
- Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());
3138
- adjustToSystemTZ(date);
3139
- }
3140
- function adjustToSystemTZ(date) {
3141
- const baseOffset = tzOffset(date.timeZone, date);
3142
- const offset = baseOffset > 0 ? Math.floor(baseOffset) : Math.ceil(baseOffset);
3143
- const prevHour = /* @__PURE__ */ new Date(+date);
3144
- prevHour.setUTCHours(prevHour.getUTCHours() - 1);
3145
- const systemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset();
3146
- const prevHourSystemOffset = -(/* @__PURE__ */ new Date(+prevHour)).getTimezoneOffset();
3147
- const systemDSTChange = systemOffset - prevHourSystemOffset;
3148
- const dstShift = Date.prototype.getHours.apply(date) !== date.internal.getUTCHours();
3149
- if (systemDSTChange && dstShift) date.internal.setUTCMinutes(date.internal.getUTCMinutes() + systemDSTChange);
3150
- const offsetDiff = systemOffset - offset;
3151
- if (offsetDiff) Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);
3152
- const systemDate = /* @__PURE__ */ new Date(+date);
3153
- systemDate.setUTCSeconds(0);
3154
- const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;
3155
- const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;
3156
- if (secondsOffset || systemSecondsOffset) {
3157
- date.internal.setUTCSeconds(date.internal.getUTCSeconds() + secondsOffset);
3158
- Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);
3159
- }
3160
- const postBaseOffset = tzOffset(date.timeZone, date);
3161
- const postOffset = postBaseOffset > 0 ? Math.floor(postBaseOffset) : Math.ceil(postBaseOffset);
3162
- const postSystemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset();
3163
- const postOffsetDiff = postSystemOffset - postOffset;
3164
- const offsetChanged = postOffset !== offset;
3165
- const postDiff = postOffsetDiff - offsetDiff;
3166
- if (offsetChanged && postDiff) {
3167
- Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);
3168
- const newBaseOffset = tzOffset(date.timeZone, date);
3169
- const newOffset = newBaseOffset > 0 ? Math.floor(newBaseOffset) : Math.ceil(newBaseOffset);
3170
- const offsetChange = postOffset - newOffset;
3171
- if (offsetChange) {
3172
- date.internal.setUTCMinutes(date.internal.getUTCMinutes() + offsetChange);
3173
- 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
+ ]
3174
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];
3175
3201
  }
3176
- }
3177
-
3178
- // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/date/index.js
3179
- var TZDate = class _TZDate extends TZDateMini {
3180
- //#region static
3181
- static tz(tz, ...args) {
3182
- return args.length ? new _TZDate(...args, tz) : new _TZDate(Date.now(), tz);
3183
- }
3184
- //#endregion
3185
- //#region representation
3186
- toISOString() {
3187
- const [sign, hours, minutes] = this.tzComponents();
3188
- const tz = `${sign}${hours}:${minutes}`;
3189
- return this.internal.toISOString().slice(0, -1) + tz;
3190
- }
3191
- toString() {
3192
- return `${this.toDateString()} ${this.toTimeString()}`;
3193
- }
3194
- toDateString() {
3195
- const [day, date, month, year] = this.internal.toUTCString().split(" ");
3196
- return `${day?.slice(0, -1)} ${month} ${date} ${year}`;
3197
- }
3198
- toTimeString() {
3199
- const time = this.internal.toUTCString().split(" ")[4];
3200
- const [sign, hours, minutes] = this.tzComponents();
3201
- return `${time} GMT${sign}${hours}${minutes} (${tzName(this.timeZone, this)})`;
3202
+ return current;
3203
+ };
3204
+ var resolveDependencyValue = (path, formData, parentPath) => {
3205
+ if (path.startsWith("root.")) {
3206
+ return resolveByPath2(path.replace(/^root\./, "").split("."), formData);
3202
3207
  }
3203
- toLocaleString(locales, options) {
3204
- return Date.prototype.toLocaleString.call(this, locales, {
3205
- ...options,
3206
- timeZone: options?.timeZone || this.timeZone
3207
- });
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;
3208
3212
  }
3209
- toLocaleDateString(locales, options) {
3210
- return Date.prototype.toLocaleDateString.call(this, locales, {
3211
- ...options,
3212
- timeZone: options?.timeZone || this.timeZone
3213
- });
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
+ }
3214
3225
  }
3215
- toLocaleTimeString(locales, options) {
3216
- return Date.prototype.toLocaleTimeString.call(this, locales, {
3217
- ...options,
3218
- timeZone: options?.timeZone || this.timeZone
3219
- });
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" }) }) })
3220
3238
  }
3221
- //#endregion
3222
- //#region private
3223
- tzComponents() {
3224
- const offset = this.getTimezoneOffset();
3225
- const sign = offset > 0 ? "-" : "+";
3226
- const hours = String(Math.floor(Math.abs(offset) / 60)).padStart(2, "0");
3227
- const minutes = String(Math.abs(offset) % 60).padStart(2, "0");
3228
- return [sign, hours, minutes];
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 });
3229
3254
  }
3230
- //#endregion
3231
- withTimeZone(timeZone) {
3232
- return new _TZDate(+this, timeZone);
3255
+ if (schema.type === "object") {
3256
+ return /* @__PURE__ */ jsx(Fragment, { children });
3233
3257
  }
3234
- //#region date-fns integration
3235
- [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) {
3236
- return new _TZDate(+new Date(date), this.timeZone);
3258
+ if (schema.type === "array" && !uiSchema?.["ui:widget"]) {
3259
+ return /* @__PURE__ */ jsx(Fragment, { children });
3237
3260
  }
3238
- //#endregion
3239
- };
3240
- var millisecondsInWeek = 6048e5;
3241
- var millisecondsInDay = 864e5;
3242
- var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom");
3243
-
3244
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/constructFrom.js
3245
- function constructFrom(date, value) {
3246
- if (typeof date === "function") return date(value);
3247
- if (date && typeof date === "object" && constructFromSymbol in date)
3248
- return date[constructFromSymbol](value);
3249
- if (date instanceof Date) return new date.constructor(value);
3250
- return new Date(value);
3251
- }
3252
-
3253
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/toDate.js
3254
- function toDate(argument, context) {
3255
- return constructFrom(context || argument, argument);
3256
- }
3257
-
3258
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addDays.js
3259
- function addDays(date, amount, options) {
3260
- const _date = toDate(date, options?.in);
3261
- if (isNaN(amount)) return constructFrom(date, NaN);
3262
- if (!amount) return _date;
3263
- _date.setDate(_date.getDate() + amount);
3264
- return _date;
3265
- }
3266
-
3267
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addMonths.js
3268
- function addMonths(date, amount, options) {
3269
- const _date = toDate(date, options?.in);
3270
- if (isNaN(amount)) return constructFrom(date, NaN);
3271
- if (!amount) {
3272
- return _date;
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;
3273
3293
  }
3274
- const dayOfMonth = _date.getDate();
3275
- const endOfDesiredMonth = constructFrom(date, _date.getTime());
3276
- endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
3277
- const daysInMonth = endOfDesiredMonth.getDate();
3278
- if (dayOfMonth >= daysInMonth) {
3279
- return endOfDesiredMonth;
3280
- } else {
3281
- _date.setFullYear(
3282
- endOfDesiredMonth.getFullYear(),
3283
- endOfDesiredMonth.getMonth(),
3284
- dayOfMonth
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 });
3300
+ }
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 });
3307
+ };
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) });
3343
+ }
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
+ }
3285
3364
  );
3286
- return _date;
3287
3365
  }
3288
- }
3289
-
3290
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/defaultOptions.js
3291
- var defaultOptions = {};
3292
- function getDefaultOptions() {
3293
- return defaultOptions;
3294
- }
3295
-
3296
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfWeek.js
3297
- function startOfWeek(date, options) {
3298
- const defaultOptions2 = getDefaultOptions();
3299
- const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
3300
- const _date = toDate(date, options?.in);
3301
- const day = _date.getDay();
3302
- const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
3303
- _date.setDate(_date.getDate() - diff);
3304
- _date.setHours(0, 0, 0, 0);
3305
- return _date;
3306
- }
3307
-
3308
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeek.js
3309
- function startOfISOWeek(date, options) {
3310
- return startOfWeek(date, { ...options, weekStartsOn: 1 });
3311
- }
3312
-
3313
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISOWeekYear.js
3314
- function getISOWeekYear(date, options) {
3315
- const _date = toDate(date, options?.in);
3316
- const year = _date.getFullYear();
3317
- const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
3318
- fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
3319
- fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
3320
- const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
3321
- const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
3322
- fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
3323
- fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
3324
- const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
3325
- if (_date.getTime() >= startOfNextYear.getTime()) {
3326
- return year + 1;
3327
- } else if (_date.getTime() >= startOfThisYear.getTime()) {
3328
- return year;
3329
- } else {
3330
- 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 });
3331
3368
  }
3332
- }
3333
-
3334
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
3335
- function getTimezoneOffsetInMilliseconds(date) {
3336
- const _date = toDate(date);
3337
- const utcDate = new Date(
3338
- Date.UTC(
3339
- _date.getFullYear(),
3340
- _date.getMonth(),
3341
- _date.getDate(),
3342
- _date.getHours(),
3343
- _date.getMinutes(),
3344
- _date.getSeconds(),
3345
- _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
3346
3385
  )
3347
- );
3348
- utcDate.setUTCFullYear(_date.getFullYear());
3349
- return +date - +utcDate;
3350
- }
3351
-
3352
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeDates.js
3353
- function normalizeDates(context, ...dates) {
3354
- const normalize = constructFrom.bind(
3355
- null,
3356
- dates.find((date) => typeof date === "object")
3357
- );
3358
- return dates.map(normalize);
3359
- }
3360
-
3361
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfDay.js
3362
- function startOfDay(date, options) {
3363
- const _date = toDate(date, options?.in);
3364
- _date.setHours(0, 0, 0, 0);
3365
- return _date;
3366
- }
3367
-
3368
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarDays.js
3369
- function differenceInCalendarDays(laterDate, earlierDate, options) {
3370
- const [laterDate_, earlierDate_] = normalizeDates(
3371
- options?.in,
3372
- laterDate,
3373
- earlierDate
3374
- );
3375
- const laterStartOfDay = startOfDay(laterDate_);
3376
- const earlierStartOfDay = startOfDay(earlierDate_);
3377
- const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
3378
- const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
3379
- return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
3380
- }
3381
-
3382
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeekYear.js
3383
- function startOfISOWeekYear(date, options) {
3384
- const year = getISOWeekYear(date, options);
3385
- const fourthOfJanuary = constructFrom(date, 0);
3386
- fourthOfJanuary.setFullYear(year, 0, 4);
3387
- fourthOfJanuary.setHours(0, 0, 0, 0);
3388
- return startOfISOWeek(fourthOfJanuary);
3389
- }
3390
-
3391
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addWeeks.js
3392
- function addWeeks(date, amount, options) {
3393
- return addDays(date, amount * 7, options);
3394
- }
3395
-
3396
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addYears.js
3397
- function addYears(date, amount, options) {
3398
- return addMonths(date, amount * 12, 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 });
3399
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
+ };
3400
3567
 
3401
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/max.js
3402
- function max(dates, options) {
3403
- let result;
3404
- let context = options?.in;
3405
- dates.forEach((date) => {
3406
- if (!context && typeof date === "object")
3407
- context = constructFrom.bind(null, date);
3408
- const date_ = toDate(date, context);
3409
- if (!result || result < date_ || isNaN(+date_)) result = date_;
3410
- });
3411
- return constructFrom(context, result || NaN);
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(" ");
3412
3576
  }
3413
3577
 
3414
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/min.js
3415
- function min(dates, options) {
3416
- let result;
3417
- let context = options?.in;
3418
- dates.forEach((date) => {
3419
- if (!context && typeof date === "object")
3420
- context = constructFrom.bind(null, date);
3421
- const date_ = toDate(date, context);
3422
- if (!result || result > date_ || isNaN(+date_)) result = date_;
3423
- });
3424
- 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
+ }
3425
3596
  }
3426
-
3427
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isSameDay.js
3428
- function isSameDay(laterDate, earlierDate, options) {
3429
- const [dateLeft_, dateRight_] = normalizeDates(
3430
- options?.in,
3431
- laterDate,
3432
- earlierDate
3433
- );
3434
- return +startOfDay(dateLeft_) === +startOfDay(dateRight_);
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;
3435
3603
  }
3436
3604
 
3437
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isDate.js
3438
- function isDate(value) {
3439
- 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));
3440
3683
  }
3441
-
3442
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isValid.js
3443
- function isValid(date) {
3444
- 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);
3445
3688
  }
3446
-
3447
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarMonths.js
3448
- function differenceInCalendarMonths(laterDate, earlierDate, options) {
3449
- const [laterDate_, earlierDate_] = normalizeDates(
3450
- options?.in,
3451
- laterDate,
3452
- earlierDate
3453
- );
3454
- const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();
3455
- const monthsDiff = laterDate_.getMonth() - earlierDate_.getMonth();
3456
- 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
+ }
3457
3725
  }
3458
3726
 
3459
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/endOfMonth.js
3460
- function endOfMonth(date, options) {
3461
- const _date = toDate(date, options?.in);
3462
- const month = _date.getMonth();
3463
- _date.setFullYear(_date.getFullYear(), month + 1, 0);
3464
- _date.setHours(23, 59, 59, 999);
3465
- return _date;
3466
- }
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");
3467
3792
 
3468
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeInterval.js
3469
- function normalizeInterval(context, interval) {
3470
- const [start, end] = normalizeDates(context, interval.start, interval.end);
3471
- 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);
3472
3800
  }
3473
3801
 
3474
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/eachMonthOfInterval.js
3475
- function eachMonthOfInterval(interval, options) {
3476
- const { start, end } = normalizeInterval(options?.in, interval);
3477
- let reversed = +start > +end;
3478
- const endTime = reversed ? +start : +end;
3479
- const date = reversed ? end : start;
3480
- date.setHours(0, 0, 0, 0);
3481
- date.setDate(1);
3482
- let step = 1;
3483
- const dates = [];
3484
- while (+date <= endTime) {
3485
- dates.push(constructFrom(start, date));
3486
- date.setMonth(date.getMonth() + step);
3487
- }
3488
- 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);
3489
3805
  }
3490
3806
 
3491
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfMonth.js
3492
- 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) {
3493
3809
  const _date = toDate(date, options?.in);
3494
- _date.setDate(1);
3495
- _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);
3496
3813
  return _date;
3497
3814
  }
3498
3815
 
3499
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/endOfYear.js
3500
- 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) {
3501
3818
  const _date = toDate(date, options?.in);
3502
- const year = _date.getFullYear();
3503
- _date.setFullYear(year + 1, 0, 0);
3504
- _date.setHours(23, 59, 59, 999);
3505
- return _date;
3506
- }
3507
-
3508
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfYear.js
3509
- function startOfYear(date, options) {
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) {
4050
+ const _date = toDate(date, options?.in);
4051
+ const year = _date.getFullYear();
4052
+ _date.setFullYear(year + 1, 0, 0);
4053
+ _date.setHours(23, 59, 59, 999);
4054
+ return _date;
4055
+ }
4056
+
4057
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfYear.js
4058
+ function startOfYear(date, options) {
3510
4059
  const date_ = toDate(date, options?.in);
3511
4060
  date_.setFullYear(date_.getFullYear(), 0, 1);
3512
4061
  date_.setHours(0, 0, 0, 0);
@@ -5431,7 +5980,7 @@ __export(custom_components_exports, {
5431
5980
  NextMonthButton: () => NextMonthButton,
5432
5981
  Option: () => Option,
5433
5982
  PreviousMonthButton: () => PreviousMonthButton,
5434
- Root: () => Root6,
5983
+ Root: () => Root8,
5435
5984
  Select: () => Select,
5436
5985
  Week: () => Week,
5437
5986
  WeekNumber: () => WeekNumber,
@@ -5611,7 +6160,7 @@ function Option(props) {
5611
6160
  function PreviousMonthButton(props) {
5612
6161
  return React26.createElement("button", { ...props });
5613
6162
  }
5614
- function Root6(props) {
6163
+ function Root8(props) {
5615
6164
  const { rootRef, ...rest } = props;
5616
6165
  return React26.createElement("div", { ...rest, ref: rootRef });
5617
6166
  }
@@ -7303,948 +7852,387 @@ function DayPicker(initialProps) {
7303
7852
  })(),
7304
7853
  React26.createElement("span", { role: "status", "aria-live": "polite", style: {
7305
7854
  border: 0,
7306
- clip: "rect(0 0 0 0)",
7307
- height: "1px",
7308
- margin: "-1px",
7309
- overflow: "hidden",
7310
- padding: 0,
7311
- position: "absolute",
7312
- width: "1px",
7313
- whiteSpace: "nowrap",
7314
- wordWrap: "normal"
7315
- } }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))
7316
- ) : React26.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))),
7317
- navLayout === "around" && !props.hideNavigation && displayIndex === numberOfMonths - 1 && React26.createElement(
7318
- components.NextMonthButton,
7319
- { 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 },
7320
- React26.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" })
7321
- ),
7322
- 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 }),
7323
- React26.createElement(
7324
- components.MonthGrid,
7325
- { 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] },
7326
- !props.hideWeekdays && React26.createElement(
7327
- components.Weekdays,
7328
- { "data-animated-weekdays": props.animate ? "true" : void 0, className: classNames[UI.Weekdays], style: styles?.[UI.Weekdays] },
7329
- showWeekNumber && React26.createElement(components.WeekNumberHeader, { "aria-label": labelWeekNumberHeader2(dateLib.options), className: classNames[UI.WeekNumberHeader], style: styles?.[UI.WeekNumberHeader], scope: "col" }, formatWeekNumberHeader2()),
7330
- 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)))
7331
- ),
7332
- React26.createElement(components.Weeks, { "data-animated-weeks": props.animate ? "true" : void 0, className: classNames[UI.Weeks], style: styles?.[UI.Weeks] }, calendarMonth.weeks.map((week) => {
7333
- return React26.createElement(
7334
- components.Week,
7335
- { className: classNames[UI.Week], key: week.weekNumber, style: styles?.[UI.Week], week },
7336
- showWeekNumber && React26.createElement(components.WeekNumber, { week, style: styles?.[UI.WeekNumber], "aria-label": labelWeekNumber2(week.weekNumber, {
7337
- locale
7338
- }), className: classNames[UI.WeekNumber], scope: "row", role: "rowheader" }, formatWeekNumber2(week.weekNumber, dateLib)),
7339
- week.days.map((day) => {
7340
- const { date } = day;
7341
- const modifiers = getModifiers(day);
7342
- modifiers[DayFlag.focused] = !modifiers.hidden && Boolean(focused?.isEqualTo(day));
7343
- modifiers[SelectionState.selected] = isSelected?.(date) || modifiers.selected;
7344
- if (isDateRange(selectedValue)) {
7345
- const { from, to } = selectedValue;
7346
- modifiers[SelectionState.range_start] = Boolean(from && to && dateLib.isSameDay(date, from));
7347
- modifiers[SelectionState.range_end] = Boolean(from && to && dateLib.isSameDay(date, to));
7348
- modifiers[SelectionState.range_middle] = rangeIncludesDate(selectedValue, date, true, dateLib);
7349
- }
7350
- const style2 = getStyleForModifiers(modifiers, styles, props.modifiersStyles);
7351
- const className2 = getClassNamesForModifiers(modifiers, classNames, props.modifiersClassNames);
7352
- const ariaLabel = !isInteractive && !modifiers.hidden ? labelGridcell2(date, modifiers, dateLib.options, dateLib) : void 0;
7353
- 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));
7354
- })
7355
- );
7356
- }))
7357
- )
7358
- );
7359
- })
7360
- ),
7361
- props.footer && React26.createElement(components.Footer, { className: classNames[UI.Footer], style: styles?.[UI.Footer], role: "status", "aria-live": "polite" }, props.footer)
7362
- )
7363
- );
7364
- }
7365
- var dayPickerClassNames = {
7366
- 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`
7367
- };
7368
- var rangePickerClassNames = {
7369
- 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`,
7370
- 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`,
7371
- selected: `tw-font-medium tw-rounded`,
7372
- range_middle: `tw-bg-accent tw-border-accent tw-text-accent-foreground tw-rounded-none tw-font-medium`
7373
- };
7374
- var Calendar = ({ className, classNames, ...props }) => {
7375
- const defaultClassNames = getDefaultClassNames();
7376
- return /* @__PURE__ */ jsx(
7377
- DayPicker,
7378
- {
7379
- ...props,
7380
- captionLayout: "dropdown",
7381
- className: cn(className, "tw-p-3"),
7382
- classNames: {
7383
- chevron: `${defaultClassNames.chevron} tw-fill-foreground`,
7384
- day: `${defaultClassNames.day} hover:tw-bg-accent tw-rounded`,
7385
- day_button: `${defaultClassNames.day_button} tw-rounded`,
7386
- today: `tw-bg-accent tw-text-accent-foreground tw-font-medium`,
7387
- ...dayPickerClassNames,
7388
- ...rangePickerClassNames,
7389
- selected: `${props.mode === "range" ? rangePickerClassNames.selected : dayPickerClassNames.selected}`,
7390
- ...classNames
7391
- },
7392
- required: false
7393
- }
7394
- );
7395
- };
7396
- Calendar.displayName = "Calendar";
7397
- var variants2 = cva(
7398
- [
7399
- "tailwindcss-preflight",
7400
- "tw-group/popover-content",
7401
- "tw-z-[1055]",
7402
- "focus-visible:tw-outline-none",
7403
- // An open Radix Dialog locks `pointer-events: none` on <body>. Popover content
7404
- // is portalled to <body> as a sibling of the dialog, so it inherits the lock
7405
- // and clicks fall through — re-enable pointer events on the content itself
7406
- // (dismiss-on-outside-click still works, it listens on document).
7407
- "tw-pointer-events-auto",
7408
- // sizing
7409
- "tw-min-w-32",
7410
- "tw-max-h-[var(--radix-popover-content-available-height)]",
7411
- "tw-origin-[--radix-popover-content-transform-origin]",
7412
- // layout
7413
- "tw-flex",
7414
- "tw-flex-col",
7415
- "tw-overflow-y-auto",
7416
- // border
7417
- "tw-box-border",
7418
- "tw-border",
7419
- "tw-border-solid",
7420
- "tw-shadow-lg",
7421
- // open animation
7422
- "data-[state=open]:tw-animate-in",
7423
- "data-[state=open]:tw-fade-in-0",
7424
- "data-[state=open]:tw-zoom-in-95",
7425
- // closed animation
7426
- "data-[state=closed]:tw-animate-out",
7427
- "data-[state=closed]:tw-fade-out-0",
7428
- "data-[state=closed]:tw-zoom-out-95",
7429
- // position animation
7430
- "data-[side=bottom]:tw-slide-in-from-top-2",
7431
- "data-[side=left]:tw-slide-in-from-right-2",
7432
- "data-[side=right]:tw-slide-in-from-left-2",
7433
- "data-[side=top]:tw-slide-in-from-bottom-2",
7434
- // Default size for nested Lucide icons; callers can override on the icon.
7435
- "[&_svg.lucide:not([class*='tw-size-'])]:tw-size-4",
7436
- "[&_svg]:tw-shrink-0"
7437
- ],
7438
- {
7439
- defaultVariants: {
7440
- matchTriggerWidth: false,
7441
- variant: "default"
7442
- },
7443
- variants: {
7444
- variant: {
7445
- // Legacy surface — fixed white panel.
7446
- default: ["tw-rounded-md", "tw-border-neutral-100", "tw-bg-white", "tw-text-neutral-800"],
7447
- // Argo surface — semantic popover tokens (brand + dark aware).
7448
- argo: ["tw-rounded-2xl", "tw-border-border", "tw-bg-popover", "tw-text-popover-foreground"]
7449
- },
7450
- matchTriggerWidth: {
7451
- true: ["tw-w-[var(--radix-popover-trigger-width)]"],
7452
- false: []
7453
- }
7454
- }
7455
- }
7456
- );
7457
- var PopoverContent = ({
7458
- ref,
7459
- className,
7460
- align = "center",
7461
- sideOffset = 4,
7462
- matchTriggerWidth = false,
7463
- children,
7464
- onEscapeKeyDown,
7465
- ...props
7466
- }) => {
7467
- const effectiveVariant = useArgoDesign() ? "argo" : "default";
7468
- return /* @__PURE__ */ jsx(Portal$1, { children: /* @__PURE__ */ jsx(
7469
- Content$2,
7470
- {
7471
- ref,
7472
- align: matchTriggerWidth ? "start" : align,
7473
- sideOffset,
7474
- className: cn(variants2({ className, matchTriggerWidth, variant: effectiveVariant })),
7475
- onEscapeKeyDown: (event) => {
7476
- event.stopPropagation();
7477
- onEscapeKeyDown?.(event);
7478
- },
7479
- ...props,
7480
- children
7481
- }
7482
- ) });
7483
- };
7484
- var Popover = (props) => /* @__PURE__ */ jsx(Root$3, { ...props });
7485
- Popover.Content = PopoverContent;
7486
- Popover.Trigger = Trigger$1;
7487
- Popover.Close = Close;
7488
- var DatePicker = ({
7489
- align = "end",
7490
- alignOffset = -18,
7491
- children,
7492
- defaultOpen,
7493
- onOpenChange,
7494
- open,
7495
- sideOffset = 12,
7496
- ...calendarProps
7497
- }) => /* @__PURE__ */ jsxs(Popover, { defaultOpen, open, onOpenChange, children: [
7498
- /* @__PURE__ */ jsx(Popover.Trigger, { asChild: true, children }),
7499
- /* @__PURE__ */ jsx(
7500
- Popover.Content,
7501
- {
7502
- align,
7503
- alignOffset,
7504
- className: "tw-w-auto tw-p-0",
7505
- sideOffset,
7506
- children: /* @__PURE__ */ jsx(Calendar, { ...calendarProps })
7507
- }
7508
- )
7509
- ] });
7510
- DatePicker.displayName = "DatePicker";
7511
-
7512
- // src/components/Input/utils.ts
7513
- var genInputTestId = (prefix = "") => {
7514
- const ps = createPrefixedString(prefix);
7515
- return {
7516
- toString: () => prefix,
7517
- inputWrapper: ps`input-wrapper`,
7518
- input: ps`input`,
7519
- clearButton: ps`clear-button`
7520
- };
7521
- };
7522
- var Input = ({
7523
- ref: forwardedRef,
7524
- state = "default",
7525
- sizing = "default",
7526
- className,
7527
- prefix = null,
7528
- rightSuffix = null,
7529
- rightSuffixVariant = "default",
7530
- leftSuffix = null,
7531
- allowClear = false,
7532
- onClear,
7533
- disabled = false,
7534
- testId: prefixTestId = "",
7535
- autoFocus = false,
7536
- id,
7537
- name,
7538
- variant,
7539
- readOnly,
7540
- type = "text",
7541
- focusVariant = "default",
7542
- onChange,
7543
- onBlur,
7544
- value,
7545
- defaultValue,
7546
- ...inputProps
7547
- }) => {
7548
- const [hasUncontrolledValue, setHasUncontrolledValue] = useState(() => !!defaultValue);
7549
- const hasValue = !!value || hasUncontrolledValue;
7550
- const inputRef = useRef(null);
7551
- const testId = genInputTestId(prefixTestId);
7552
- const isClearButtonVisible = hasValue && !disabled && !readOnly || !!onClear;
7553
- const handleChange = (event) => {
7554
- const val = event.target.value;
7555
- setHasUncontrolledValue(val !== "");
7556
- onChange?.(event);
7557
- };
7558
- const handleBlur = (event) => {
7559
- const val = event.target.value;
7560
- setHasUncontrolledValue(val !== "");
7561
- onBlur?.(event);
7562
- };
7563
- const handleClear = () => {
7564
- if (inputRef.current === null) return;
7565
- inputRef.current.value = "";
7566
- inputRef.current.focus();
7567
- onClear?.();
7568
- setHasUncontrolledValue(false);
7569
- onChange?.(createChangeInputEvent(inputRef.current));
7570
- };
7571
- const isControlled = value !== void 0;
7572
- const valueProp = isControlled ? { value: value ?? "" } : { defaultValue: defaultValue ?? "" };
7573
- return /* @__PURE__ */ jsxs(
7574
- InputGroup,
7575
- {
7576
- state,
7577
- variant,
7578
- sizing,
7579
- focusVariant,
7580
- className,
7581
- "data-testid": testId.inputWrapper,
7582
- children: [
7583
- prefix && /* @__PURE__ */ jsx(InputGroup.Addon, { align: "inline-start", children: prefix }),
7584
- /* @__PURE__ */ jsx(
7585
- InputGroup.Input,
7586
- {
7587
- ...inputProps,
7588
- ...valueProp,
7589
- autoFocus,
7590
- type,
7591
- onChange: handleChange,
7592
- onBlur: handleBlur,
7593
- ref: mergeRefs(forwardedRef ?? null, inputRef),
7594
- disabled,
7595
- id,
7596
- name,
7597
- readOnly,
7598
- "data-testid": testId.input
7599
- }
7600
- ),
7601
- (leftSuffix || allowClear || rightSuffix) && /* @__PURE__ */ jsxs(InputGroup.Addon, { align: "inline-end", children: [
7602
- leftSuffix,
7603
- allowClear && isClearButtonVisible && /* @__PURE__ */ jsx(
7604
- InputGroup.Button,
7605
- {
7606
- "aria-label": "Clear",
7607
- onMouseDown: (e) => e.preventDefault(),
7608
- onClick: handleClear,
7609
- "data-testid": testId.clearButton,
7610
- children: /* @__PURE__ */ jsx(icons_exports.X, { className: "tw-size-4" })
7611
- }
7612
- ),
7613
- rightSuffix && /* @__PURE__ */ jsx(
7614
- "div",
7615
- {
7616
- className: cn({
7617
- "tw-whitespace-nowrap tw-bg-muted tw-px-4 -tw-mr-4 tw-py-2.5": rightSuffixVariant === "addon"
7618
- }),
7619
- children: rightSuffix
7620
- }
7621
- )
7622
- ] })
7623
- ]
7624
- }
7625
- );
7626
- };
7627
-
7628
- // src/components/Input/DateInput/helpers.ts
7629
- var formatDate = (date, inputValue) => {
7630
- if (!date) {
7631
- return inputValue;
7632
- }
7633
- return date.toLocaleDateString();
7634
- };
7635
- var datePartOrder = new Intl.DateTimeFormat().formatToParts(new Date(2e3, 0, 2)).filter(
7636
- (p) => p.type === "day" || p.type === "month" || p.type === "year"
7637
- ).map((p) => p.type);
7638
- var parseDate = (value) => {
7639
- if (!value.trim()) return null;
7640
- const nums = value.match(/\d+/g)?.map(Number);
7641
- if (nums && nums.length >= 3) {
7642
- const parts = Object.fromEntries(datePartOrder.map((type, i) => [type, nums[i]]));
7643
- const year = parts.year;
7644
- const month = parts.month;
7645
- const day = parts.day;
7646
- if (year != null && month != null && day != null && month >= 1 && month <= 12 && day >= 1 && day <= 31) {
7647
- const date = new Date(year, month - 1, day);
7648
- if (date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day) {
7649
- return date;
7650
- }
7651
- }
7652
- }
7653
- const isoMatch = value.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);
7654
- if (isoMatch) {
7655
- const y = Number(isoMatch[1]);
7656
- const m = Number(isoMatch[2]) - 1;
7657
- const d = Number(isoMatch[3]);
7658
- const date = new Date(y, m, d);
7659
- if (date.getFullYear() === y && date.getMonth() === m && date.getDate() === d) {
7660
- return date;
7661
- }
7662
- return null;
7663
- }
7664
- const fallback = new Date(value);
7665
- return isNaN(fallback.getTime()) ? null : fallback;
7666
- };
7667
- var DateInput = ({
7668
- ref,
7669
- defaultValue,
7670
- disabled,
7671
- disabledDays,
7672
- endMonth,
7673
- onBlur,
7674
- onChange,
7675
- onValueBlur,
7676
- onValueChange,
7677
- placeholder = "Select a date",
7678
- readOnly,
7679
- startMonth,
7680
- value,
7681
- variant,
7682
- ...props
7683
- }) => {
7684
- const [inputValue, setInputValue] = useState("");
7685
- const [hasFocus, setHasFocus] = useState(false);
7686
- const [isOpen, setIsOpen] = useState(false);
7687
- const [internalValue, setInternalValue] = useState(defaultValue ?? null);
7688
- const [month, setMonth2] = useState(/* @__PURE__ */ new Date());
7689
- const isControlled = value !== void 0;
7690
- const currentValue = isControlled ? value : internalValue;
7691
- const handleChange = (event) => {
7692
- const newValue = event.target.value;
7693
- setInputValue(newValue);
7694
- onChange?.(event);
7695
- const parsedDate = parseDate(newValue);
7696
- if (parsedDate !== null || !newValue.trim()) {
7697
- onValueChange?.(parsedDate);
7698
- }
7699
- };
7700
- const handleFocus = (event) => {
7701
- const formatted = formatDate(currentValue, "");
7702
- setInputValue(formatted);
7703
- setHasFocus(true);
7704
- props.onFocus?.(event);
7705
- };
7706
- const handleBlur = (event) => {
7707
- setHasFocus(false);
7708
- onBlur?.(event);
7709
- const parsedDate = parseDate(event.target.value);
7710
- onValueBlur?.(parsedDate);
7711
- if (!isControlled) {
7712
- setInternalValue(parsedDate);
7713
- }
7714
- };
7715
- const handleDatePickerChange = (newValue) => {
7716
- const dateValue = newValue ?? null;
7717
- if (isControlled) {
7718
- onValueChange?.(dateValue);
7719
- } else {
7720
- setInternalValue(dateValue);
7721
- onValueChange?.(dateValue);
7722
- }
7723
- setHasFocus(false);
7724
- setIsOpen(false);
7725
- };
7726
- const handleClear = () => {
7727
- setInputValue("");
7728
- setInternalValue(null);
7729
- onValueChange?.(null);
7730
- };
7731
- const handleOpenChange = (open) => {
7732
- if (open) {
7733
- setMonth2(currentValue ?? /* @__PURE__ */ new Date());
7734
- }
7735
- setIsOpen(open);
7736
- };
7737
- const displayValue = hasFocus ? inputValue : formatDate(currentValue, "");
7738
- return /* @__PURE__ */ jsx(
7739
- Input,
7740
- {
7741
- ...props,
7742
- disabled,
7743
- onBlur: handleBlur,
7744
- onChange: handleChange,
7745
- onClear: handleClear,
7746
- onFocus: handleFocus,
7747
- placeholder,
7748
- readOnly,
7749
- ref,
7750
- value: displayValue,
7751
- variant,
7752
- rightSuffix: !disabled && !readOnly ? /* @__PURE__ */ jsx(
7753
- DatePicker,
7754
- {
7755
- disabled: disabledDays,
7756
- endMonth,
7757
- mode: "single",
7758
- month,
7759
- onMonthChange: setMonth2,
7760
- onOpenChange: handleOpenChange,
7761
- onSelect: handleDatePickerChange,
7762
- open: isOpen,
7763
- selected: currentValue ?? void 0,
7764
- startMonth,
7765
- children: /* @__PURE__ */ jsx(Button, { "aria-label": "Select Date", variant: "inline", size: "icon-3xs", children: /* @__PURE__ */ jsx(icons_exports.Calendar, { className: "tw-size-4" }) })
7766
- }
7767
- ) : void 0,
7768
- type: "text"
7769
- }
7770
- );
7771
- };
7772
- var sanitizeTextInputValue = (value) => {
7773
- if (typeof value === "string" && value.trim() === "") return "";
7774
- return value;
7775
- };
7776
- var TextInput = ({
7777
- ref,
7778
- value,
7779
- defaultValue,
7780
- type = "text",
7781
- variant,
7782
- onValueChange,
7783
- onChange,
7784
- onValueBlur,
7785
- onBlur,
7786
- ...props
7787
- }) => {
7788
- const handleChange = (event) => {
7789
- onValueChange?.(event.target.value);
7790
- onChange?.(event);
7791
- };
7792
- const handleBlur = (event) => {
7793
- onValueBlur?.(event.target.value);
7794
- onBlur?.(event);
7795
- };
7796
- return /* @__PURE__ */ jsx(
7797
- Input,
7798
- {
7799
- ...props,
7800
- ref,
7801
- onChange: handleChange,
7802
- onBlur: handleBlur,
7803
- type,
7804
- variant,
7805
- value: sanitizeTextInputValue(value),
7806
- defaultValue: sanitizeTextInputValue(defaultValue)
7807
- }
7808
- );
7809
- };
7810
- var FormGroupTextInput = ({
7811
- ref,
7812
- ...props
7813
- }) => {
7814
- const { state } = useFormGroupContext();
7815
- return /* @__PURE__ */ jsx(TextInput, { state, ...props, ref });
7816
- };
7817
- var FormGroup = ({ className, children, state, ...rest }) => {
7818
- return /* @__PURE__ */ jsx(FormGroupProvider, { value: { state }, children: /* @__PURE__ */ jsx("div", { ...rest, className: cn("tw-flex tw-flex-col tw-gap-1", className), children }) });
7819
- };
7820
- FormGroup.Help = FormGroupHelp;
7821
- FormGroup.Error = FormGroupError;
7822
- FormGroup.TextInput = FormGroupTextInput;
7823
- FormGroup.NumberInput = FormGroupNumberInput;
7824
- FormGroup.ColorInput = FormGroupColorInput;
7825
- FormGroup.Textarea = FormGroupTextarea;
7826
- var Optional = ({ className, ...props }) => /* @__PURE__ */ jsx("span", { ...props, "aria-hidden": true, className: cn("tw-ml-0.5", "tw-text-muted-foreground", className), children: "(optional)" });
7827
- var Required = ({ className, ...props }) => /* @__PURE__ */ jsx("span", { ...props, "aria-hidden": true, className: cn("tw-ml-0.5", "tw-text-primary", className), children: "*" });
7828
- var Label = ({ className, children, id, htmlFor, ...rest }) => /* @__PURE__ */ jsx(
7829
- RLabel.Root,
7830
- {
7831
- ...rest,
7832
- id: id?.toString(),
7833
- htmlFor: htmlFor?.toString(),
7834
- className: cn(
7835
- "tw-m-0 tw-text-foreground tw-font-normal peer-disabled:tw-opacity-50",
7836
- className
7837
- ),
7838
- children
7839
- }
7840
- );
7841
- Label.Optional = Optional;
7842
- Label.Required = Required;
7843
- var Link = ({
7844
- ref,
7845
- children,
7846
- target = "_blank",
7847
- rel = "noopener noreferrer",
7848
- onClick,
7849
- className,
7850
- ...rest
7851
- }) => {
7852
- const handleOnClick = (event) => {
7853
- event.stopPropagation();
7854
- onClick?.(event);
7855
- };
7856
- return (
7857
- // oxlint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
7858
- /* @__PURE__ */ jsx(
7859
- "a",
7860
- {
7861
- ...rest,
7862
- ref,
7863
- target,
7864
- rel,
7865
- onClick: handleOnClick,
7866
- className: cn(
7867
- "tw-text-primary tw-underline hover:tw-text-primary/90 hover:tw-no-underline",
7868
- className
7869
- ),
7870
- children
7871
- }
7872
- )
7873
- );
7874
- };
7875
- var RootFormDataContext = createContext({});
7876
- var RootFormDataProvider = RootFormDataContext;
7877
- var useRootFormData = () => use(RootFormDataContext);
7878
- var resolveByPath2 = (parts, data) => {
7879
- let current = data;
7880
- for (const part of parts) {
7881
- if (current == null || typeof current !== "object") return void 0;
7882
- current = current[part];
7883
- }
7884
- return current;
7885
- };
7886
- var resolveDependencyValue = (path, formData, parentPath) => {
7887
- if (path.startsWith("root.")) {
7888
- return resolveByPath2(path.replace(/^root\./, "").split("."), formData);
7889
- }
7890
- const parent = resolveByPath2(parentPath.map(String), formData);
7891
- if (parent && typeof parent === "object") {
7892
- const sibling = resolveByPath2(path.split("."), parent);
7893
- if (sibling !== void 0) return sibling;
7894
- }
7895
- return resolveByPath2(path.split("."), formData);
7896
- };
7897
- var evaluateDependencies = (dependencies, formData, parentPath) => {
7898
- for (const [path, expected] of Object.entries(dependencies)) {
7899
- const actual = resolveDependencyValue(path, formData, parentPath);
7900
- if (Array.isArray(expected)) {
7901
- if (!expected.includes(actual)) return false;
7902
- } else if (expected === "") {
7903
- if (actual !== "" && actual !== void 0 && actual !== null) return false;
7904
- } else {
7905
- if (actual !== expected) return false;
7906
- }
7907
- }
7908
- return true;
7909
- };
7910
- var DocumentationLinkIcon = ({
7911
- documentation
7912
- }) => /* @__PURE__ */ jsx(
7913
- Tooltip,
7914
- {
7915
- placement: "top",
7916
- variant: "explanatory",
7917
- tooltip: documentation.tooltip ?? "Open documentation",
7918
- triggerAsChild: true,
7919
- 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" }) }) })
7920
- }
7921
- );
7922
- var FieldTemplateBody = ({
7923
- id,
7924
- label,
7925
- rawHelp,
7926
- rawDescription,
7927
- rawErrors,
7928
- children,
7929
- schema,
7930
- uiSchema,
7931
- displayLabel
7932
- }) => {
7933
- const widget = uiSchema?.["ui:widget"];
7934
- if (widget === "test-connection" || widget === "sync-action") {
7935
- return /* @__PURE__ */ jsx(Fragment, { children });
7936
- }
7937
- if (schema.type === "object") {
7938
- return /* @__PURE__ */ jsx(Fragment, { children });
7939
- }
7940
- if (schema.type === "array" && !uiSchema?.["ui:widget"]) {
7941
- return /* @__PURE__ */ jsx(Fragment, { children });
7942
- }
7943
- const uiOptions = uiSchema?.["ui:options"];
7944
- const documentation = uiOptions?.documentation;
7945
- const hasErrors = rawErrors && rawErrors.length > 0;
7946
- const isCheckbox = schema.type === "boolean" && uiSchema?.["ui:widget"] !== "select";
7947
- const showLabel = displayLabel && label && !isCheckbox;
7948
- const hasHelpIcons = Boolean(rawHelp || documentation);
7949
- const helpIcons = /* @__PURE__ */ jsxs(Fragment, { children: [
7950
- rawHelp && /* @__PURE__ */ jsx(TooltipIcon, { rawHelp }),
7951
- documentation && /* @__PURE__ */ jsx(DocumentationLinkIcon, { documentation })
7952
- ] });
7953
- return /* @__PURE__ */ jsxs(FormGroup, { state: hasErrors ? "error" : "default", children: [
7954
- showLabel && /* @__PURE__ */ jsx(Label, { htmlFor: id, children: /* @__PURE__ */ jsxs("span", { className: "tw-inline-flex tw-items-center tw-gap-1", children: [
7955
- label,
7956
- helpIcons
7957
- ] }) }),
7958
- !showLabel && !isCheckbox && hasHelpIcons && /* @__PURE__ */ jsx("div", { className: "tw-flex tw-items-center tw-gap-1", children: helpIcons }),
7959
- isCheckbox && hasHelpIcons ? /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [
7960
- children,
7961
- helpIcons
7962
- ] }) : children,
7963
- rawDescription && /* @__PURE__ */ jsx(FormGroup.Help, { children: /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(rawDescription) } }) }),
7964
- hasErrors && /* @__PURE__ */ jsx(FormGroup.Help, { children: rawErrors.join(". ") })
7965
- ] });
7966
- };
7967
- var FieldTemplateWithDependencies = ({
7968
- dependencies,
7969
- ...props
7970
- }) => {
7971
- const rootFormData = useRootFormData();
7972
- const parentPath = props.fieldPathId.path.slice(0, -1);
7973
- if (!evaluateDependencies(dependencies, rootFormData, parentPath)) {
7974
- return null;
7975
- }
7976
- return /* @__PURE__ */ jsx(FieldTemplateBody, { ...props });
7977
- };
7978
- var FieldTemplate = (props) => {
7979
- if (props.hidden) return /* @__PURE__ */ jsx("div", { className: "tw-hidden", children: props.children });
7980
- if (props.uiSchema?.["ui:widget"] === "template-watch") {
7981
- return /* @__PURE__ */ jsx("div", { className: "tw-hidden", children: props.children });
7982
- }
7983
- const uiOptions = props.uiSchema?.["ui:options"];
7984
- const dependencies = uiOptions?.dependencies;
7985
- if (dependencies) {
7986
- return /* @__PURE__ */ jsx(FieldTemplateWithDependencies, { dependencies, ...props });
7987
- }
7988
- return /* @__PURE__ */ jsx(FieldTemplateBody, { ...props });
7989
- };
7990
- var ObjectFieldTemplate = ({
7991
- title,
7992
- description,
7993
- properties,
7994
- formData,
7995
- uiSchema,
7996
- schema,
7997
- fieldPathId
7998
- }) => {
7999
- const isRoot = !fieldPathId?.path?.length;
8000
- const uiOptions = uiSchema?.["ui:options"];
8001
- const hasCollapsed = uiOptions?.collapsed !== void 0;
8002
- const collapsed = !!uiOptions?.collapsed;
8003
- const disableCollapse = !!uiOptions?.disableCollapse;
8004
- const lastPathSegment = fieldPathId?.path?.at(-1);
8005
- const isArrayItem = typeof lastPathSegment === "number";
8006
- const childSchemas = schema.properties;
8007
- const isContainerSchema = (s) => {
8008
- if (!s) return false;
8009
- if (s.properties || s.items) return true;
8010
- if (Array.isArray(s.type)) return s.type.includes("object") || s.type.includes("array");
8011
- return s.type === "object" || s.type === "array";
8012
- };
8013
- const visibleProperties = properties.filter((prop) => {
8014
- const childUi = uiSchema?.[prop.name];
8015
- if (childUi?.["ui:widget"] !== "hidden") return true;
8016
- return !isContainerSchema(childSchemas?.[prop.name]);
8017
- });
8018
- const isHiddenMount = (name) => {
8019
- const w = uiSchema?.[name]?.["ui:widget"];
8020
- return w === "hidden" || w === "template-watch";
8021
- };
8022
- const renderChildren = (props) => props.map((prop) => /* @__PURE__ */ jsx("div", { className: isHiddenMount(prop.name) ? "tw-hidden" : void 0, children: prop.content }, prop.name));
8023
- if (isRoot) {
8024
- return /* @__PURE__ */ jsx("div", { className: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden", children: renderChildren(visibleProperties) });
8025
- }
8026
- const childrenContent = renderChildren(visibleProperties);
8027
- if (hasCollapsed && !disableCollapse) {
8028
- const data = formData ?? {};
8029
- const hasValues = Object.values(data).some(
8030
- (v) => v !== void 0 && v !== null && v !== "" && v !== false
8031
- );
8032
- const defaultExpanded = hasValues ? !collapsed : true;
8033
- return /* @__PURE__ */ jsxs(
8034
- CollapsiblePanel,
8035
- {
8036
- className: "tw-rounded-lg",
8037
- headerClassName: "tw-rounded-lg",
8038
- header: title || "Settings",
8039
- defaultExpanded,
8040
- bodyClassName: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden",
8041
- children: [
8042
- description,
8043
- childrenContent
8044
- ]
8045
- }
8046
- );
8047
- }
8048
- if (isArrayItem) {
8049
- return /* @__PURE__ */ jsx("div", { className: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden", children: childrenContent });
8050
- }
8051
- return /* @__PURE__ */ jsxs("div", { className: "tw-rounded-lg tw-border tw-border-solid tw-border-neutral-200 tw-bg-white tw-p-4", children: [
8052
- title && /* @__PURE__ */ jsx("h3", { className: "tw-mb-2 tw-text-base tw-font-medium tw-text-neutral-800", children: title }),
8053
- description && /* @__PURE__ */ jsx("p", { className: "tw-mb-3 tw-text-xs tw-text-neutral-400", children: description }),
8054
- /* @__PURE__ */ jsx("div", { className: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden", children: childrenContent })
8055
- ] });
8056
- };
8057
- var FieldBoxDescription = ({ className, ...props }) => /* @__PURE__ */ jsx(
8058
- "span",
8059
- {
8060
- ...props,
8061
- "data-slot": "field-box-description",
8062
- className: cn(
8063
- "tw-text-xs",
8064
- "tw-text-muted-foreground",
8065
- "group-has-[:disabled]/field-box:tw-opacity-50",
8066
- className
8067
- )
8068
- }
8069
- );
8070
- var FieldBoxTitle = ({ className, ...props }) => /* @__PURE__ */ jsx(
8071
- "span",
8072
- {
8073
- ...props,
8074
- "data-slot": "field-box-title",
8075
- className: cn(
8076
- "tw-text-sm",
8077
- "tw-font-medium",
8078
- "tw-text-foreground",
8079
- "group-has-[:disabled]/field-box:tw-cursor-not-allowed",
8080
- "group-has-[:disabled]/field-box:tw-opacity-50",
8081
- className
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)
8082
7911
  )
8083
- }
8084
- );
8085
- var fieldBoxVariants = cva(
8086
- [
8087
- "tw-group/field-box",
8088
- "tw-m-0",
8089
- "tw-inline-flex",
8090
- "tw-gap-3",
8091
- "tw-items-center",
8092
- "has-[[data-slot=field-box-description]]:tw-items-start",
8093
- "tw-cursor-pointer",
8094
- "tw-select-none",
8095
- "has-[:disabled]:tw-cursor-not-allowed"
8096
- ],
8097
- {
8098
- variants: {
8099
- variant: {
8100
- default: [],
8101
- boxed: [
8102
- "tw-rounded-lg",
8103
- "tw-border",
8104
- "tw-border-solid",
8105
- "tw-border-border",
8106
- "tw-p-3",
8107
- "tw-transition-colors",
8108
- "has-[[data-state=checked]]:tw-border-primary",
8109
- "has-[[data-state=checked]]:tw-bg-accent",
8110
- "has-[[data-state=indeterminate]]:tw-border-primary",
8111
- "has-[[data-state=indeterminate]]:tw-bg-accent"
8112
- ]
8113
- }
8114
- },
8115
- defaultVariants: {
8116
- 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
8117
7942
  }
8118
- }
8119
- );
8120
- var FieldBoxRoot = ({
8121
- ref,
8122
- className,
8123
- variant,
8124
- position = "start",
8125
- control,
8126
- children,
8127
- ...rest
8128
- }) => /* @__PURE__ */ jsxs(
8129
- "label",
8130
- {
8131
- ...rest,
8132
- ref,
8133
- className: cn(
8134
- fieldBoxVariants({ variant, className }),
8135
- position === "end" && "tw-flex-row-reverse"
8136
- ),
8137
- children: [
8138
- /* @__PURE__ */ jsx("span", { className: "tw-inline-flex tw-min-h-5 tw-shrink-0 tw-items-center", children: control }),
8139
- children != null && /* @__PURE__ */ jsx("span", { className: "tw-flex tw-flex-1 tw-flex-col tw-gap-0.5", children })
8140
- ]
8141
- }
8142
- );
8143
- var FieldBox = Object.assign(FieldBoxRoot, {
8144
- Title: FieldBoxTitle,
8145
- Description: FieldBoxDescription
8146
- });
8147
- var rootVariants = cva(
7943
+ );
7944
+ };
7945
+ Calendar.displayName = "Calendar";
7946
+ var variants2 = cva(
8148
7947
  [
8149
- // reset
8150
7948
  "tailwindcss-preflight",
8151
- // 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
8152
7962
  "tw-flex",
8153
- "tw-items-center",
8154
- "tw-justify-center",
8155
- "tw-peer",
8156
- "tw-size-4",
8157
- "tw-shrink-0",
8158
- "tw-cursor-pointer",
7963
+ "tw-flex-col",
7964
+ "tw-overflow-y-auto",
8159
7965
  // border
7966
+ "tw-box-border",
8160
7967
  "tw-border",
8161
7968
  "tw-border-solid",
8162
- // disabled
8163
- "disabled:tw-opacity-50",
8164
- "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"
8165
7986
  ],
8166
7987
  {
8167
7988
  defaultVariants: {
7989
+ matchTriggerWidth: false,
8168
7990
  variant: "default"
8169
7991
  },
8170
7992
  variants: {
8171
7993
  variant: {
8172
- default: [
8173
- "tw-rounded",
8174
- "tw-border-neutral-200",
8175
- "data-[state=checked]:tw-bg-primary",
8176
- "data-[state=checked]:tw-border-primary",
8177
- "data-[state=indeterminate]:tw-bg-white",
8178
- "data-[state=indeterminate]:tw-border-neutral-200"
8179
- ],
8180
- argo: [
8181
- "tw-rounded",
8182
- "tw-border-input",
8183
- "tw-transition-colors",
8184
- "data-[state=checked]:tw-bg-primary",
8185
- "data-[state=checked]:tw-border-primary",
8186
- "data-[state=indeterminate]:tw-bg-primary",
8187
- "data-[state=indeterminate]:tw-border-primary",
8188
- // focus
8189
- "focus-visible:tw-outline-none",
8190
- "focus-visible:tw-border-primary",
8191
- "focus-visible:tw-ring-2",
8192
- "focus-visible:tw-ring-ring/50"
8193
- ]
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;
8194
8083
  }
8195
8084
  }
8196
8085
  }
8197
- );
8198
- var indicatorVariants = cva(["tw-group", "tw-flex", "tw-items-center"], {
8199
- defaultVariants: {
8200
- variant: "default"
8201
- },
8202
- variants: {
8203
- variant: {
8204
- default: [
8205
- "data-[state=checked]:tw-text-primary-foreground",
8206
- "data-[state=indeterminate]:tw-text-neutral-200"
8207
- ],
8208
- 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;
8209
8094
  }
8095
+ return null;
8210
8096
  }
8211
- });
8212
- function Checkbox({
8213
- className,
8214
- id: idProp,
8215
- children,
8216
- 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,
8217
8104
  variant,
8218
- position,
8219
- tooltip,
8220
- tooltipPlacement = "top",
8221
- ...rest
8222
- }) {
8223
- const fallbackId = useId();
8224
- const id = idProp?.toString() ?? fallbackId;
8225
- const styleVariant = useArgoDesign() ? "argo" : "default";
8226
- const checkboxElement = /* @__PURE__ */ jsx(Root, { id, ...rest, className: cn(rootVariants({ variant: styleVariant, className })), children: /* @__PURE__ */ jsxs(Indicator, { className: cn(indicatorVariants({ variant: styleVariant })), children: [
8227
- /* @__PURE__ */ jsx(icons_exports.Check, { className: "tw-hidden tw-size-3 tw-stroke-[4px] group-data-[state=checked]:tw-block" }),
8228
- /* @__PURE__ */ jsx(icons_exports.Minus, { className: "tw-hidden tw-size-3 tw-stroke-[4px] group-data-[state=indeterminate]:tw-block" })
8229
- ] }) });
8230
- const rendered = !children ? checkboxElement : /* @__PURE__ */ jsxs(FieldBox, { htmlFor: id, variant, position, control: checkboxElement, children: [
8231
- /* @__PURE__ */ jsx(FieldBox.Title, { children }),
8232
- description && /* @__PURE__ */ jsx(FieldBox.Description, { children: description })
8233
- ] });
8234
- if (!tooltip) return rendered;
8235
- return /* @__PURE__ */ jsx(Tooltip, { tooltip, placement: tooltipPlacement, triggerAsChild: !!children, children: rendered });
8236
- }
8237
- var CheckboxWidget = ({
8238
- id,
8105
+ focusVariant,
8106
+ sizing,
8107
+ className,
8108
+ // own props
8239
8109
  value,
8110
+ defaultValue,
8111
+ onValueChange,
8112
+ onValueBlur,
8240
8113
  onChange,
8114
+ onBlur,
8115
+ onFocus,
8116
+ allowClear = false,
8117
+ disabledDays,
8118
+ endMonth,
8119
+ startMonth,
8120
+ // input props
8241
8121
  disabled,
8242
- readonly,
8243
- label,
8244
- hideLabel
8122
+ readOnly,
8123
+ placeholder = "Select a date",
8124
+ ...restInputProps
8245
8125
  }) => {
8246
- const checked = !!value;
8247
- 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
+ );
8248
8236
  };
8249
8237
  var DateWidget = ({
8250
8238
  id,
@@ -8345,13 +8333,7 @@ var BadgeAddon = ({
8345
8333
  className: cn(addonVariants2({ align, variant, className }))
8346
8334
  }
8347
8335
  );
8348
- var BadgeButton = ({
8349
- ref,
8350
- className,
8351
- type = "button",
8352
- children,
8353
- ...rest
8354
- }) => /* @__PURE__ */ jsx(
8336
+ var BadgeButton = ({ ref, className, type = "button", children, ...rest }) => /* @__PURE__ */ jsx(
8355
8337
  "button",
8356
8338
  {
8357
8339
  ...rest,
@@ -8376,12 +8358,7 @@ var BadgeButton = ({
8376
8358
  children
8377
8359
  }
8378
8360
  );
8379
- var BadgeLabel = ({
8380
- ref,
8381
- className,
8382
- asChild = false,
8383
- ...rest
8384
- }) => {
8361
+ var BadgeLabel = ({ ref, className, asChild = false, ...rest }) => {
8385
8362
  const Comp = asChild ? Slot : "span";
8386
8363
  return /* @__PURE__ */ jsx(
8387
8364
  Comp,
@@ -8475,14 +8452,7 @@ var badgeRootVariants = cva(
8475
8452
  }
8476
8453
  }
8477
8454
  );
8478
- var BadgeRoot = ({
8479
- ref,
8480
- variant,
8481
- color,
8482
- className,
8483
- children,
8484
- ...rest
8485
- }) => /* @__PURE__ */ jsx(
8455
+ var BadgeRoot = ({ ref, variant, color, className, children, ...rest }) => /* @__PURE__ */ jsx(
8486
8456
  "div",
8487
8457
  {
8488
8458
  ...rest,
@@ -8685,11 +8655,7 @@ var ComboboxContent = ({
8685
8655
  }
8686
8656
  ) });
8687
8657
  };
8688
- var ComboboxEmpty = ({
8689
- ref,
8690
- className,
8691
- ...props
8692
- }) => /* @__PURE__ */ jsx(
8658
+ var ComboboxEmpty = ({ ref, className, ...props }) => /* @__PURE__ */ jsx(
8693
8659
  Combobox$1.Empty,
8694
8660
  {
8695
8661
  ref,
@@ -8733,12 +8699,7 @@ var ComboboxInputGroup = ({
8733
8699
  )
8734
8700
  }
8735
8701
  );
8736
- var ComboboxItemIndicator = ({
8737
- ref,
8738
- className,
8739
- variant = "check",
8740
- ...props
8741
- }) => {
8702
+ var ComboboxItemIndicator = ({ ref, className, variant = "check", ...props }) => {
8742
8703
  if (variant === "checkbox") {
8743
8704
  return /* @__PURE__ */ jsx(
8744
8705
  Combobox$1.ItemIndicator,
@@ -8851,11 +8812,7 @@ var ComboboxItem = ({
8851
8812
  ]
8852
8813
  }
8853
8814
  );
8854
- var ComboboxList = ({
8855
- ref,
8856
- className,
8857
- ...props
8858
- }) => /* @__PURE__ */ jsx(
8815
+ var ComboboxList = ({ ref, className, ...props }) => /* @__PURE__ */ jsx(
8859
8816
  Combobox$1.List,
8860
8817
  {
8861
8818
  ref,
@@ -8875,11 +8832,7 @@ var ComboboxList = ({
8875
8832
  }
8876
8833
  );
8877
8834
  var ComboboxRoot = (props) => /* @__PURE__ */ jsx(Combobox$1.Root, { ...props });
8878
- var ComboboxSeparator = ({
8879
- ref,
8880
- className,
8881
- ...props
8882
- }) => /* @__PURE__ */ jsx(
8835
+ var ComboboxSeparator = ({ ref, className, ...props }) => /* @__PURE__ */ jsx(
8883
8836
  Combobox$1.Separator,
8884
8837
  {
8885
8838
  ref,
@@ -8887,12 +8840,7 @@ var ComboboxSeparator = ({
8887
8840
  ...props
8888
8841
  }
8889
8842
  );
8890
- var ComboboxGroup = ({
8891
- ref,
8892
- className,
8893
- children,
8894
- ...props
8895
- }) => /* @__PURE__ */ jsx(
8843
+ var ComboboxGroup = ({ ref, className, children, ...props }) => /* @__PURE__ */ jsx(
8896
8844
  Combobox$1.Group,
8897
8845
  {
8898
8846
  ref,
@@ -8901,11 +8849,7 @@ var ComboboxGroup = ({
8901
8849
  children
8902
8850
  }
8903
8851
  );
8904
- var ComboboxGroupLabel = ({
8905
- ref,
8906
- className,
8907
- ...props
8908
- }) => /* @__PURE__ */ jsx(
8852
+ var ComboboxGroupLabel = ({ ref, className, ...props }) => /* @__PURE__ */ jsx(
8909
8853
  Combobox$1.GroupLabel,
8910
8854
  {
8911
8855
  ...props,
@@ -9199,6 +9143,7 @@ var PasswordInput = ({
9199
9143
  onMouseDown,
9200
9144
  allowClear = false,
9201
9145
  allowPasswordToggle = false,
9146
+ passwordToggleLabel,
9202
9147
  autoComplete = "new-password",
9203
9148
  defaultPasswordVisibility = false,
9204
9149
  // input props
@@ -9207,13 +9152,12 @@ var PasswordInput = ({
9207
9152
  ...restInputProps
9208
9153
  }) => {
9209
9154
  const inputRef = useRef(null);
9210
- const [internalValue, setInternalValue] = useState(defaultValue ?? "");
9211
- const isControlled = valueProp !== void 0;
9212
- const value = isControlled ? valueProp ?? "" : internalValue;
9213
- const setValue = (next) => {
9214
- if (!isControlled) setInternalValue(next);
9215
- onValueChange?.(next);
9216
- };
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
+ });
9217
9161
  const [capsLock, setCapsLock] = useState(false);
9218
9162
  const [isPasswordVisible, setIsPasswordVisible] = useState(defaultPasswordVisibility);
9219
9163
  const canClear = allowClear && !!value && !disabled && !readOnly;
@@ -9290,7 +9234,7 @@ var PasswordInput = ({
9290
9234
  allowPasswordToggle && /* @__PURE__ */ jsx(
9291
9235
  InputGroup.Button,
9292
9236
  {
9293
- "aria-label": isPasswordVisible ? "Hide password" : "Show password",
9237
+ "aria-label": `${isPasswordVisible ? "Hide password" : "Show password"}${passwordToggleLabel ? `: ${passwordToggleLabel}` : ""}`,
9294
9238
  onMouseDown: (event) => event.preventDefault(),
9295
9239
  onClick: handleTogglePasswordVisibility,
9296
9240
  children: isPasswordVisible ? /* @__PURE__ */ jsx(icons_exports.EyeOff, { className: "tw-size-4" }) : /* @__PURE__ */ jsx(icons_exports.Eye, { className: "tw-size-4" })
@@ -10037,6 +9981,10 @@ var generateUiSchema = (schema, readOnly = false, definitions, globalConfig, has
10037
9981
  ...arrayOpts
10038
9982
  };
10039
9983
  }
9984
+ const itemsEnumTitles = propSchema.items?.options?.enum_titles;
9985
+ if (Array.isArray(itemsEnumTitles)) {
9986
+ fieldUi.items = { "ui:options": { enumNames: itemsEnumTitles } };
9987
+ }
10040
9988
  }
10041
9989
  if (type === "object" && propSchema.properties) {
10042
9990
  const nestedGlobal = globalValue && typeof globalValue === "object" && !Array.isArray(globalValue) ? globalValue : void 0;