@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.cjs CHANGED
@@ -30,10 +30,10 @@ var DOMPurify = require('dompurify');
30
30
  var reactCollapsible = require('@radix-ui/react-collapsible');
31
31
  var RadixTabs = require('@radix-ui/react-tabs');
32
32
  var ScrollAreaPrimitive2 = require('@radix-ui/react-scroll-area');
33
- var TextareaAutosize = require('react-textarea-autosize');
34
- var reactPopover = require('@radix-ui/react-popover');
35
33
  var RLabel = require('@radix-ui/react-label');
34
+ var TextareaAutosize = require('react-textarea-autosize');
36
35
  var reactCheckbox = require('@radix-ui/react-checkbox');
36
+ var reactPopover = require('@radix-ui/react-popover');
37
37
  var combobox = require('@base-ui/react/combobox');
38
38
  var RRadioGroup = require('@radix-ui/react-radio-group');
39
39
  var RSeparator = require('@radix-ui/react-separator');
@@ -67,8 +67,8 @@ var colors__default = /*#__PURE__*/_interopDefault(colors);
67
67
  var DOMPurify__default = /*#__PURE__*/_interopDefault(DOMPurify);
68
68
  var RadixTabs__namespace = /*#__PURE__*/_interopNamespace(RadixTabs);
69
69
  var ScrollAreaPrimitive2__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive2);
70
- var TextareaAutosize__default = /*#__PURE__*/_interopDefault(TextareaAutosize);
71
70
  var RLabel__namespace = /*#__PURE__*/_interopNamespace(RLabel);
71
+ var TextareaAutosize__default = /*#__PURE__*/_interopDefault(TextareaAutosize);
72
72
  var RRadioGroup__namespace = /*#__PURE__*/_interopNamespace(RRadioGroup);
73
73
  var RSeparator__namespace = /*#__PURE__*/_interopNamespace(RSeparator);
74
74
 
@@ -333,6 +333,7 @@ var Tooltip = ({
333
333
  placement = "right",
334
334
  forceHide = false,
335
335
  forceShow = false,
336
+ delayDuration,
336
337
  // trigger props
337
338
  triggerAsChild = false
338
339
  }) => {
@@ -352,6 +353,7 @@ var Tooltip = ({
352
353
  {
353
354
  open: !!tooltip && (open || forceShow) && !forceHide,
354
355
  onOpenChange: setOpen,
356
+ delayDuration,
355
357
  disableHoverableContent: isActionVariant,
356
358
  children: [
357
359
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -475,6 +477,7 @@ var Keboola = React26.forwardRef(
475
477
  width: size,
476
478
  height: size,
477
479
  viewBox: "0 0 300 512",
480
+ overflow: "visible",
478
481
  fill: color,
479
482
  className: cn("lucide", className),
480
483
  ...rest,
@@ -1039,14 +1042,9 @@ var getLanguageMode = (mode) => {
1039
1042
  return langJson.json();
1040
1043
  }
1041
1044
  };
1045
+ var shouldLintJson = (mode, readOnly) => mode === "application/json" && !readOnly;
1042
1046
  var KbdSeparator = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("span", { ...props, className: cn("tw-text-xs tw-text-muted-foreground", className) });
1043
- var KbdGroup = ({
1044
- ref,
1045
- className,
1046
- children,
1047
- separator,
1048
- ...props
1049
- }) => {
1047
+ var KbdGroup = ({ ref, className, children, separator, ...props }) => {
1050
1048
  return /* @__PURE__ */ jsxRuntime.jsx(
1051
1049
  "kbd",
1052
1050
  {
@@ -1137,7 +1135,7 @@ var CodeEditor = ({
1137
1135
  const commonExtensions = React26.useMemo(() => {
1138
1136
  return [
1139
1137
  getLanguageMode(mode),
1140
- mode === "application/json" && lint.linter(langJson.jsonParseLinter()),
1138
+ shouldLintJson(mode, readOnly) && lint.linter(langJson.jsonParseLinter()),
1141
1139
  withLineWrapping ? view.EditorView.lineWrapping : [],
1142
1140
  CodeMirror.EditorState.languageData.of(() => [
1143
1141
  { autocomplete: completeAny ? autocomplete.completeAnyWord : autocompletions }
@@ -1155,7 +1153,7 @@ var CodeEditor = ({
1155
1153
  autocomplete.autocompletion({ activateOnTyping: completeAny }),
1156
1154
  baseTheme
1157
1155
  ].filter(Boolean);
1158
- }, [autocompletions, completeAny, extraKeys, mode, withLineWrapping, baseTheme]);
1156
+ }, [autocompletions, completeAny, extraKeys, mode, readOnly, withLineWrapping, baseTheme]);
1159
1157
  const extensions = React26.useMemo(() => {
1160
1158
  return [
1161
1159
  ...commonExtensions,
@@ -1626,12 +1624,7 @@ var GridObjectField = ({
1626
1624
  gridContent
1627
1625
  ] });
1628
1626
  };
1629
- var CollapsibleContent = ({
1630
- ref,
1631
- className,
1632
- children,
1633
- ...props
1634
- }) => /* @__PURE__ */ jsxRuntime.jsx(
1627
+ var CollapsibleContent = ({ ref, className, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1635
1628
  reactCollapsible.Content,
1636
1629
  {
1637
1630
  ref,
@@ -1647,12 +1640,7 @@ var CollapsibleContent = ({
1647
1640
  var Collapsible = (props) => /* @__PURE__ */ jsxRuntime.jsx(reactCollapsible.Root, { ...props });
1648
1641
  Collapsible.Trigger = reactCollapsible.CollapsibleTrigger;
1649
1642
  Collapsible.Content = CollapsibleContent;
1650
- var AlertAction = ({
1651
- ref,
1652
- className,
1653
- asChild = false,
1654
- ...props
1655
- }) => {
1643
+ var AlertAction = ({ ref, className, asChild = false, ...props }) => {
1656
1644
  const Comp = asChild ? reactSlot.Slot : "div";
1657
1645
  return /* @__PURE__ */ jsxRuntime.jsx(
1658
1646
  Comp,
@@ -1690,12 +1678,7 @@ var AlertCollapsibleIcon = ({ open }) => /* @__PURE__ */ jsxRuntime.jsx(Tooltip,
1690
1678
  )
1691
1679
  }
1692
1680
  ) });
1693
- var AlertDescription = ({
1694
- ref,
1695
- children,
1696
- className,
1697
- ...rest
1698
- }) => /* @__PURE__ */ jsxRuntime.jsx(
1681
+ var AlertDescription = ({ ref, children, className, ...rest }) => /* @__PURE__ */ jsxRuntime.jsx(
1699
1682
  "div",
1700
1683
  {
1701
1684
  ...rest,
@@ -1748,13 +1731,7 @@ var AlertIcon = ({ variant, icon, className, ...rest }) => /* @__PURE__ */ jsxRu
1748
1731
  children: icon ?? VARIANT_ICONS[variant]
1749
1732
  }
1750
1733
  );
1751
- var AlertRoot = ({
1752
- ref,
1753
- children,
1754
- className,
1755
- variant,
1756
- ...rest
1757
- }) => {
1734
+ var AlertRoot = ({ ref, children, className, variant, ...rest }) => {
1758
1735
  const renderArgo = useArgoDesign();
1759
1736
  return /* @__PURE__ */ jsxRuntime.jsx(
1760
1737
  "div",
@@ -1811,11 +1788,7 @@ var AlertRoot = ({
1811
1788
  }
1812
1789
  );
1813
1790
  };
1814
- var AlertTitle = ({
1815
- ref,
1816
- className,
1817
- ...props
1818
- }) => /* @__PURE__ */ jsxRuntime.jsx(
1791
+ var AlertTitle = ({ ref, className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1819
1792
  "div",
1820
1793
  {
1821
1794
  ...props,
@@ -2345,6 +2318,55 @@ var ErrorListTemplate = ({ errors }) => {
2345
2318
  if (!errors.length) return null;
2346
2319
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tw-mb-4", children: errors.map((error) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "tw-text-xs tw-text-error-500", children: error.message }, `${error.property}:${error.message}`)) });
2347
2320
  };
2321
+ var Optional = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("span", { ...props, "aria-hidden": true, className: cn("tw-ml-0.5", "tw-text-muted-foreground", className), children: "(optional)" });
2322
+ var Required = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("span", { ...props, "aria-hidden": true, className: cn("tw-ml-0.5", "tw-text-primary", className), children: "*" });
2323
+ var Label = ({ className, children, id, htmlFor, ...rest }) => /* @__PURE__ */ jsxRuntime.jsx(
2324
+ RLabel__namespace.Root,
2325
+ {
2326
+ ...rest,
2327
+ id: id?.toString(),
2328
+ htmlFor: htmlFor?.toString(),
2329
+ className: cn(
2330
+ "tw-m-0 tw-text-foreground tw-font-normal peer-disabled:tw-opacity-50",
2331
+ className
2332
+ ),
2333
+ children
2334
+ }
2335
+ );
2336
+ Label.Optional = Optional;
2337
+ Label.Required = Required;
2338
+ var Link = ({
2339
+ ref,
2340
+ children,
2341
+ target = "_blank",
2342
+ rel = "noopener noreferrer",
2343
+ onClick,
2344
+ className,
2345
+ ...rest
2346
+ }) => {
2347
+ const handleOnClick = (event) => {
2348
+ event.stopPropagation();
2349
+ onClick?.(event);
2350
+ };
2351
+ return (
2352
+ // oxlint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
2353
+ /* @__PURE__ */ jsxRuntime.jsx(
2354
+ "a",
2355
+ {
2356
+ ...rest,
2357
+ ref,
2358
+ target,
2359
+ rel,
2360
+ onClick: handleOnClick,
2361
+ className: cn(
2362
+ "tw-text-primary tw-underline hover:tw-text-primary/90 hover:tw-no-underline",
2363
+ className
2364
+ ),
2365
+ children
2366
+ }
2367
+ )
2368
+ );
2369
+ };
2348
2370
  var FormGroupContext = React26.createContext({
2349
2371
  state: "default"
2350
2372
  });
@@ -2392,12 +2414,7 @@ var InputGroupAddon = ({
2392
2414
  className,
2393
2415
  ...props
2394
2416
  }) => /* @__PURE__ */ jsxRuntime.jsx("div", { ...props, "data-align": align, className: cn(addonVariants({ align, className })), children });
2395
- var InputGroupButton = ({
2396
- ref,
2397
- className,
2398
- tabIndex = -1,
2399
- ...props
2400
- }) => /* @__PURE__ */ jsxRuntime.jsx(
2417
+ var InputGroupButton = ({ ref, className, tabIndex = -1, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
2401
2418
  Button,
2402
2419
  {
2403
2420
  ...props,
@@ -2408,11 +2425,7 @@ var InputGroupButton = ({
2408
2425
  className: cn("tw-size-5", "[&_svg]:tw-text-muted-foreground", className)
2409
2426
  }
2410
2427
  );
2411
- var InputGroupInput = ({
2412
- ref,
2413
- className,
2414
- ...inputProps
2415
- }) => /* @__PURE__ */ jsxRuntime.jsx(
2428
+ var InputGroupInput = ({ ref, className, ...inputProps }) => /* @__PURE__ */ jsxRuntime.jsx(
2416
2429
  "input",
2417
2430
  {
2418
2431
  ...inputProps,
@@ -2740,6 +2753,29 @@ InputGroup.Addon = InputGroupAddon;
2740
2753
  InputGroup.Button = InputGroupButton;
2741
2754
  InputGroup.TextArea = InputGroupTextArea;
2742
2755
  InputGroup.Text = InputGroupText;
2756
+ var useControllableState = ({
2757
+ prop,
2758
+ defaultProp,
2759
+ onChange
2760
+ }) => {
2761
+ const [uncontrolled, setUncontrolled] = React26.useState(defaultProp);
2762
+ const isControlled = prop !== void 0;
2763
+ const value = prop !== void 0 ? prop : uncontrolled;
2764
+ const valueRef = React26.useRef(value);
2765
+ valueRef.current = value;
2766
+ const onChangeRef = React26.useRef(onChange);
2767
+ onChangeRef.current = onChange;
2768
+ const setValue = React26.useCallback(
2769
+ (next) => {
2770
+ const nextValue = typeof next === "function" ? next(valueRef.current) : next;
2771
+ valueRef.current = nextValue;
2772
+ if (!isControlled) setUncontrolled(nextValue);
2773
+ onChangeRef.current?.(nextValue);
2774
+ },
2775
+ [isControlled]
2776
+ );
2777
+ return [value, setValue];
2778
+ };
2743
2779
 
2744
2780
  // src/blocks/ColorInput/utils.ts
2745
2781
  var HEX_CHARSET = /^[0-9a-fA-F]+$/;
@@ -2831,13 +2867,13 @@ var ColorInput = ({
2831
2867
  ...restInputProps
2832
2868
  }) => {
2833
2869
  const inputRef = React26.useRef(null);
2834
- const [internalValue, setInternalValue] = React26.useState(defaultValue ?? "");
2870
+ const [value, setValue] = useControllableState({
2871
+ // A `null` controlled value stays controlled (coerced to ''); `undefined` is uncontrolled.
2872
+ prop: valueProp === null ? "" : valueProp,
2873
+ defaultProp: defaultValue ?? "",
2874
+ onChange: onValueChange
2875
+ });
2835
2876
  const isControlled = valueProp !== void 0;
2836
- const value = isControlled ? valueProp ?? "" : internalValue;
2837
- const setValue = (nextValue) => {
2838
- if (!isControlled) setInternalValue(nextValue);
2839
- onValueChange?.(nextValue);
2840
- };
2841
2877
  const canClear = allowClear && !!value && !disabled && !readOnly;
2842
2878
  const swatchColor = coerceHexInputValue(value);
2843
2879
  const isValidSwatch = isCompleteHexColor(swatchColor);
@@ -2940,10 +2976,7 @@ var ColorInput = ({
2940
2976
  }
2941
2977
  );
2942
2978
  };
2943
- var FormGroupColorInput = ({
2944
- ref,
2945
- ...props
2946
- }) => {
2979
+ var FormGroupColorInput = ({ ref, ...props }) => {
2947
2980
  const { state } = useFormGroupContext();
2948
2981
  return /* @__PURE__ */ jsxRuntime.jsx(ColorInput, { state, ...props, ref });
2949
2982
  };
@@ -3017,10 +3050,7 @@ var NumberInput = ({
3017
3050
  }
3018
3051
  );
3019
3052
  };
3020
- var FormGroupNumberInput = ({
3021
- ref,
3022
- ...props
3023
- }) => {
3053
+ var FormGroupNumberInput = ({ ref, ...props }) => {
3024
3054
  const { state } = useFormGroupContext();
3025
3055
  return /* @__PURE__ */ jsxRuntime.jsx(NumberInput, { ...props, ref, state });
3026
3056
  };
@@ -3032,8 +3062,18 @@ var Textarea = ({
3032
3062
  variant,
3033
3063
  sizing,
3034
3064
  focusVariant,
3065
+ // value handling
3066
+ value: valueProp,
3067
+ defaultValue,
3068
+ onValueChange,
3035
3069
  ...rest
3036
3070
  }) => {
3071
+ const [value, setValue] = useControllableState({
3072
+ // `undefined` stays uncontrolled; any provided value (incl. `null`) is controlled, coerced to ''.
3073
+ prop: valueProp === void 0 ? void 0 : valueProp ?? "",
3074
+ defaultProp: defaultValue ?? "",
3075
+ onChange: onValueChange
3076
+ });
3037
3077
  return /* @__PURE__ */ jsxRuntime.jsx(
3038
3078
  InputGroup,
3039
3079
  {
@@ -3042,7 +3082,7 @@ var Textarea = ({
3042
3082
  focusVariant,
3043
3083
  variant,
3044
3084
  className: containerClassName,
3045
- children: /* @__PURE__ */ jsxRuntime.jsx(InputGroup.TextArea, { ...rest, ref })
3085
+ children: /* @__PURE__ */ jsxRuntime.jsx(InputGroup.TextArea, { ...rest, ref, value, onValueChange: setValue })
3046
3086
  }
3047
3087
  );
3048
3088
  };
@@ -3051,495 +3091,1004 @@ var FormGroupTextarea = (props) => {
3051
3091
  return /* @__PURE__ */ jsxRuntime.jsx(Textarea, { state, ...props });
3052
3092
  };
3053
3093
 
3054
- // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tzName/index.js
3055
- function tzName(timeZone, date, format2 = "long") {
3056
- return new Intl.DateTimeFormat("en-US", {
3057
- // Enforces engine to render the time. Without the option JavaScriptCore omits it.
3058
- hour: "numeric",
3059
- timeZone,
3060
- timeZoneName: format2
3061
- }).format(date).split(/\s/g).slice(2).join(" ");
3062
- }
3063
-
3064
- // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tzOffset/index.js
3065
- var offsetFormatCache = {};
3066
- var offsetCache = {};
3067
- function tzOffset(timeZone, date) {
3068
- try {
3069
- const format2 = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat("en-US", {
3070
- timeZone,
3071
- timeZoneName: "longOffset"
3072
- }).format;
3073
- const offsetStr = format2(date).split("GMT")[1];
3074
- if (offsetStr in offsetCache) return offsetCache[offsetStr];
3075
- return calcOffset(offsetStr, offsetStr.split(":"));
3076
- } catch {
3077
- if (timeZone in offsetCache) return offsetCache[timeZone];
3078
- const captures = timeZone?.match(offsetRe);
3079
- if (captures) return calcOffset(timeZone, captures.slice(1));
3080
- return NaN;
3081
- }
3082
- }
3083
- var offsetRe = /([+-]\d\d):?(\d\d)?/;
3084
- function calcOffset(cacheStr, values) {
3085
- const hours = +(values[0] || 0);
3086
- const minutes = +(values[1] || 0);
3087
- const seconds = +(values[2] || 0) / 60;
3088
- return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;
3089
- }
3090
-
3091
- // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/date/mini.js
3092
- var TZDateMini = class _TZDateMini extends Date {
3093
- //#region static
3094
- constructor(...args) {
3095
- super();
3096
- if (args.length > 1 && typeof args[args.length - 1] === "string") {
3097
- this.timeZone = args.pop();
3098
- }
3099
- this.internal = /* @__PURE__ */ new Date();
3100
- if (isNaN(tzOffset(this.timeZone, this))) {
3101
- this.setTime(NaN);
3102
- } else {
3103
- if (!args.length) {
3104
- this.setTime(Date.now());
3105
- } else if (typeof args[0] === "number" && (args.length === 1 || args.length === 2 && typeof args[1] !== "number")) {
3106
- this.setTime(args[0]);
3107
- } else if (typeof args[0] === "string") {
3108
- this.setTime(+new Date(args[0]));
3109
- } else if (args[0] instanceof Date) {
3110
- this.setTime(+args[0]);
3111
- } else {
3112
- this.setTime(+new Date(...args));
3113
- adjustToSystemTZ(this);
3114
- syncToInternal(this);
3115
- }
3116
- }
3117
- }
3118
- static tz(tz, ...args) {
3119
- return args.length ? new _TZDateMini(...args, tz) : new _TZDateMini(Date.now(), tz);
3120
- }
3121
- //#endregion
3122
- //#region time zone
3123
- withTimeZone(timeZone) {
3124
- return new _TZDateMini(+this, timeZone);
3125
- }
3126
- getTimezoneOffset() {
3127
- const offset = -tzOffset(this.timeZone, this);
3128
- return offset > 0 ? Math.floor(offset) : Math.ceil(offset);
3129
- }
3130
- //#endregion
3131
- //#region time
3132
- setTime(time) {
3133
- Date.prototype.setTime.apply(this, arguments);
3134
- syncToInternal(this);
3135
- return +this;
3136
- }
3137
- //#endregion
3138
- //#region date-fns integration
3139
- [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) {
3140
- return new _TZDateMini(+new Date(date), this.timeZone);
3141
- }
3142
- //#endregion
3094
+ // src/blocks/TextInput/utils.ts
3095
+ var genInputTestId = (prefix = "") => {
3096
+ const ps = createPrefixedString(prefix);
3097
+ return {
3098
+ toString: () => prefix,
3099
+ inputWrapper: ps`input-wrapper`,
3100
+ input: ps`input`,
3101
+ clearButton: ps`clear-button`
3102
+ };
3143
3103
  };
3144
- var re = /^(get|set)(?!UTC)/;
3145
- Object.getOwnPropertyNames(Date.prototype).forEach((method) => {
3146
- if (!re.test(method)) return;
3147
- const utcMethod = method.replace(re, "$1UTC");
3148
- if (!TZDateMini.prototype[utcMethod]) return;
3149
- if (method.startsWith("get")) {
3150
- TZDateMini.prototype[method] = function() {
3151
- return this.internal[utcMethod]();
3152
- };
3153
- } else {
3154
- TZDateMini.prototype[method] = function() {
3155
- Date.prototype[utcMethod].apply(this.internal, arguments);
3156
- syncFromInternal(this);
3157
- return +this;
3158
- };
3159
- TZDateMini.prototype[utcMethod] = function() {
3160
- Date.prototype[utcMethod].apply(this, arguments);
3161
- syncToInternal(this);
3162
- return +this;
3163
- };
3164
- }
3165
- });
3166
- function syncToInternal(date) {
3167
- date.internal.setTime(+date);
3168
- date.internal.setUTCSeconds(date.internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, date) * 60));
3169
- }
3170
- function syncFromInternal(date) {
3171
- Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());
3172
- Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());
3173
- adjustToSystemTZ(date);
3174
- }
3175
- function adjustToSystemTZ(date) {
3176
- const baseOffset = tzOffset(date.timeZone, date);
3177
- const offset = baseOffset > 0 ? Math.floor(baseOffset) : Math.ceil(baseOffset);
3178
- const prevHour = /* @__PURE__ */ new Date(+date);
3179
- prevHour.setUTCHours(prevHour.getUTCHours() - 1);
3180
- const systemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset();
3181
- const prevHourSystemOffset = -(/* @__PURE__ */ new Date(+prevHour)).getTimezoneOffset();
3182
- const systemDSTChange = systemOffset - prevHourSystemOffset;
3183
- const dstShift = Date.prototype.getHours.apply(date) !== date.internal.getUTCHours();
3184
- if (systemDSTChange && dstShift) date.internal.setUTCMinutes(date.internal.getUTCMinutes() + systemDSTChange);
3185
- const offsetDiff = systemOffset - offset;
3186
- if (offsetDiff) Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);
3187
- const systemDate = /* @__PURE__ */ new Date(+date);
3188
- systemDate.setUTCSeconds(0);
3189
- const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;
3190
- const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;
3191
- if (secondsOffset || systemSecondsOffset) {
3192
- date.internal.setUTCSeconds(date.internal.getUTCSeconds() + secondsOffset);
3193
- Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);
3194
- }
3195
- const postBaseOffset = tzOffset(date.timeZone, date);
3196
- const postOffset = postBaseOffset > 0 ? Math.floor(postBaseOffset) : Math.ceil(postBaseOffset);
3197
- const postSystemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset();
3198
- const postOffsetDiff = postSystemOffset - postOffset;
3199
- const offsetChanged = postOffset !== offset;
3200
- const postDiff = postOffsetDiff - offsetDiff;
3201
- if (offsetChanged && postDiff) {
3202
- Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);
3203
- const newBaseOffset = tzOffset(date.timeZone, date);
3204
- const newOffset = newBaseOffset > 0 ? Math.floor(newBaseOffset) : Math.ceil(newBaseOffset);
3205
- const offsetChange = postOffset - newOffset;
3206
- if (offsetChange) {
3207
- date.internal.setUTCMinutes(date.internal.getUTCMinutes() + offsetChange);
3208
- Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);
3104
+ var sanitizeTextInputValue = (value) => {
3105
+ if (typeof value === "string" && value.trim() === "") return "";
3106
+ return value;
3107
+ };
3108
+ var TextInput = ({
3109
+ ref: forwardedRef,
3110
+ state = "default",
3111
+ sizing = "default",
3112
+ className,
3113
+ prefix = null,
3114
+ rightSuffix = null,
3115
+ rightSuffixVariant = "default",
3116
+ leftSuffix = null,
3117
+ allowClear = false,
3118
+ onClear,
3119
+ disabled = false,
3120
+ testId: prefixTestId = "",
3121
+ autoFocus = false,
3122
+ id,
3123
+ name,
3124
+ variant,
3125
+ readOnly,
3126
+ type = "text",
3127
+ focusVariant = "default",
3128
+ onChange,
3129
+ onBlur,
3130
+ onValueChange,
3131
+ onValueBlur,
3132
+ value: valueProp,
3133
+ defaultValue,
3134
+ ...inputProps
3135
+ }) => {
3136
+ const inputRef = React26.useRef(null);
3137
+ const [value, setValue] = useControllableState({
3138
+ // `undefined` stays uncontrolled; any provided value (incl. `null`) is controlled and coerced
3139
+ // to a string. Whitespace-only input collapses to '' via `sanitizeTextInputValue`.
3140
+ prop: valueProp === void 0 ? void 0 : sanitizeTextInputValue(valueProp) ?? "",
3141
+ defaultProp: sanitizeTextInputValue(defaultValue) ?? "",
3142
+ onChange: onValueChange
3143
+ });
3144
+ const testId = genInputTestId(prefixTestId);
3145
+ const isClearButtonVisible = !!value && !disabled && !readOnly || !!onClear;
3146
+ const handleChange = (event) => {
3147
+ setValue(event.target.value);
3148
+ onChange?.(event);
3149
+ };
3150
+ const handleBlur = (event) => {
3151
+ onValueBlur?.(event.target.value);
3152
+ onBlur?.(event);
3153
+ };
3154
+ const handleClear = () => {
3155
+ if (inputRef.current === null) return;
3156
+ inputRef.current.value = "";
3157
+ inputRef.current.focus();
3158
+ onClear?.();
3159
+ handleChange(createChangeInputEvent(inputRef.current));
3160
+ };
3161
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3162
+ InputGroup,
3163
+ {
3164
+ state,
3165
+ variant,
3166
+ sizing,
3167
+ focusVariant,
3168
+ className,
3169
+ "data-testid": testId.inputWrapper,
3170
+ children: [
3171
+ prefix && /* @__PURE__ */ jsxRuntime.jsx(InputGroup.Addon, { align: "inline-start", children: prefix }),
3172
+ /* @__PURE__ */ jsxRuntime.jsx(
3173
+ InputGroup.Input,
3174
+ {
3175
+ ...inputProps,
3176
+ value,
3177
+ autoFocus,
3178
+ type,
3179
+ onChange: handleChange,
3180
+ onBlur: handleBlur,
3181
+ ref: mergeRefs(forwardedRef ?? null, inputRef),
3182
+ disabled,
3183
+ id,
3184
+ name,
3185
+ readOnly,
3186
+ "data-testid": testId.input
3187
+ }
3188
+ ),
3189
+ (leftSuffix || allowClear || rightSuffix) && /* @__PURE__ */ jsxRuntime.jsxs(InputGroup.Addon, { align: "inline-end", children: [
3190
+ leftSuffix,
3191
+ allowClear && isClearButtonVisible && /* @__PURE__ */ jsxRuntime.jsx(
3192
+ InputGroup.Button,
3193
+ {
3194
+ "aria-label": "Clear",
3195
+ onMouseDown: (e) => e.preventDefault(),
3196
+ onClick: handleClear,
3197
+ "data-testid": testId.clearButton,
3198
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons_exports.X, { className: "tw-size-4" })
3199
+ }
3200
+ ),
3201
+ rightSuffix && /* @__PURE__ */ jsxRuntime.jsx(
3202
+ "div",
3203
+ {
3204
+ className: cn({
3205
+ "tw-whitespace-nowrap tw-bg-muted tw-px-4 -tw-mr-4 tw-py-2.5": rightSuffixVariant === "addon"
3206
+ }),
3207
+ children: rightSuffix
3208
+ }
3209
+ )
3210
+ ] })
3211
+ ]
3209
3212
  }
3213
+ );
3214
+ };
3215
+ var FormGroupTextInput = ({ ref, ...props }) => {
3216
+ const { state } = useFormGroupContext();
3217
+ return /* @__PURE__ */ jsxRuntime.jsx(TextInput, { state, ...props, ref });
3218
+ };
3219
+ var FormGroup = ({ className, children, state, ...rest }) => {
3220
+ return /* @__PURE__ */ jsxRuntime.jsx(FormGroupProvider, { value: { state }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ...rest, className: cn("tw-flex tw-flex-col tw-gap-1", className), children }) });
3221
+ };
3222
+ FormGroup.Help = FormGroupHelp;
3223
+ FormGroup.Error = FormGroupError;
3224
+ FormGroup.TextInput = FormGroupTextInput;
3225
+ FormGroup.NumberInput = FormGroupNumberInput;
3226
+ FormGroup.ColorInput = FormGroupColorInput;
3227
+ FormGroup.Textarea = FormGroupTextarea;
3228
+ var RootFormDataContext = React26.createContext({});
3229
+ var RootFormDataProvider = RootFormDataContext;
3230
+ var useRootFormData = () => React26.use(RootFormDataContext);
3231
+ var resolveByPath2 = (parts, data) => {
3232
+ let current = data;
3233
+ for (const part of parts) {
3234
+ if (current == null || typeof current !== "object") return void 0;
3235
+ current = current[part];
3210
3236
  }
3211
- }
3212
-
3213
- // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/date/index.js
3214
- var TZDate = class _TZDate extends TZDateMini {
3215
- //#region static
3216
- static tz(tz, ...args) {
3217
- return args.length ? new _TZDate(...args, tz) : new _TZDate(Date.now(), tz);
3218
- }
3219
- //#endregion
3220
- //#region representation
3221
- toISOString() {
3222
- const [sign, hours, minutes] = this.tzComponents();
3223
- const tz = `${sign}${hours}:${minutes}`;
3224
- return this.internal.toISOString().slice(0, -1) + tz;
3225
- }
3226
- toString() {
3227
- return `${this.toDateString()} ${this.toTimeString()}`;
3228
- }
3229
- toDateString() {
3230
- const [day, date, month, year] = this.internal.toUTCString().split(" ");
3231
- return `${day?.slice(0, -1)} ${month} ${date} ${year}`;
3232
- }
3233
- toTimeString() {
3234
- const time = this.internal.toUTCString().split(" ")[4];
3235
- const [sign, hours, minutes] = this.tzComponents();
3236
- return `${time} GMT${sign}${hours}${minutes} (${tzName(this.timeZone, this)})`;
3237
+ return current;
3238
+ };
3239
+ var resolveDependencyValue = (path, formData, parentPath) => {
3240
+ if (path.startsWith("root.")) {
3241
+ return resolveByPath2(path.replace(/^root\./, "").split("."), formData);
3237
3242
  }
3238
- toLocaleString(locales, options) {
3239
- return Date.prototype.toLocaleString.call(this, locales, {
3240
- ...options,
3241
- timeZone: options?.timeZone || this.timeZone
3242
- });
3243
+ const parent = resolveByPath2(parentPath.map(String), formData);
3244
+ if (parent && typeof parent === "object") {
3245
+ const sibling = resolveByPath2(path.split("."), parent);
3246
+ if (sibling !== void 0) return sibling;
3243
3247
  }
3244
- toLocaleDateString(locales, options) {
3245
- return Date.prototype.toLocaleDateString.call(this, locales, {
3246
- ...options,
3247
- timeZone: options?.timeZone || this.timeZone
3248
- });
3248
+ return resolveByPath2(path.split("."), formData);
3249
+ };
3250
+ var evaluateDependencies = (dependencies, formData, parentPath) => {
3251
+ for (const [path, expected] of Object.entries(dependencies)) {
3252
+ const actual = resolveDependencyValue(path, formData, parentPath);
3253
+ if (Array.isArray(expected)) {
3254
+ if (!expected.includes(actual)) return false;
3255
+ } else if (expected === "") {
3256
+ if (actual !== "" && actual !== void 0 && actual !== null) return false;
3257
+ } else {
3258
+ if (actual !== expected) return false;
3259
+ }
3249
3260
  }
3250
- toLocaleTimeString(locales, options) {
3251
- return Date.prototype.toLocaleTimeString.call(this, locales, {
3252
- ...options,
3253
- timeZone: options?.timeZone || this.timeZone
3254
- });
3261
+ return true;
3262
+ };
3263
+ var DocumentationLinkIcon = ({
3264
+ documentation
3265
+ }) => /* @__PURE__ */ jsxRuntime.jsx(
3266
+ Tooltip,
3267
+ {
3268
+ placement: "top",
3269
+ variant: "explanatory",
3270
+ tooltip: documentation.tooltip ?? "Open documentation",
3271
+ triggerAsChild: true,
3272
+ children: /* @__PURE__ */ jsxRuntime.jsx(Link, { href: documentation.link, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tw-cursor-pointer tw-text-neutral-400 hover:tw-text-neutral-600", children: /* @__PURE__ */ jsxRuntime.jsx(icons_exports.BookOpen, { className: "tw-size-4" }) }) })
3255
3273
  }
3256
- //#endregion
3257
- //#region private
3258
- tzComponents() {
3259
- const offset = this.getTimezoneOffset();
3260
- const sign = offset > 0 ? "-" : "+";
3261
- const hours = String(Math.floor(Math.abs(offset) / 60)).padStart(2, "0");
3262
- const minutes = String(Math.abs(offset) % 60).padStart(2, "0");
3263
- return [sign, hours, minutes];
3274
+ );
3275
+ var FieldTemplateBody = ({
3276
+ id,
3277
+ label,
3278
+ rawHelp,
3279
+ rawDescription,
3280
+ rawErrors,
3281
+ children,
3282
+ schema,
3283
+ uiSchema,
3284
+ displayLabel
3285
+ }) => {
3286
+ const widget = uiSchema?.["ui:widget"];
3287
+ if (widget === "test-connection" || widget === "sync-action") {
3288
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
3264
3289
  }
3265
- //#endregion
3266
- withTimeZone(timeZone) {
3267
- return new _TZDate(+this, timeZone);
3290
+ if (schema.type === "object") {
3291
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
3268
3292
  }
3269
- //#region date-fns integration
3270
- [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) {
3271
- return new _TZDate(+new Date(date), this.timeZone);
3293
+ if (schema.type === "array" && !uiSchema?.["ui:widget"]) {
3294
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
3272
3295
  }
3273
- //#endregion
3274
- };
3275
- var millisecondsInWeek = 6048e5;
3276
- var millisecondsInDay = 864e5;
3277
- var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom");
3278
-
3279
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/constructFrom.js
3280
- function constructFrom(date, value) {
3281
- if (typeof date === "function") return date(value);
3282
- if (date && typeof date === "object" && constructFromSymbol in date)
3283
- return date[constructFromSymbol](value);
3284
- if (date instanceof Date) return new date.constructor(value);
3285
- return new Date(value);
3286
- }
3287
-
3288
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/toDate.js
3289
- function toDate(argument, context) {
3290
- return constructFrom(context || argument, argument);
3291
- }
3292
-
3293
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addDays.js
3294
- function addDays(date, amount, options) {
3295
- const _date = toDate(date, options?.in);
3296
- if (isNaN(amount)) return constructFrom(date, NaN);
3297
- if (!amount) return _date;
3298
- _date.setDate(_date.getDate() + amount);
3299
- return _date;
3300
- }
3301
-
3302
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addMonths.js
3303
- function addMonths(date, amount, options) {
3304
- const _date = toDate(date, options?.in);
3305
- if (isNaN(amount)) return constructFrom(date, NaN);
3306
- if (!amount) {
3307
- return _date;
3296
+ const uiOptions = uiSchema?.["ui:options"];
3297
+ const documentation = uiOptions?.documentation;
3298
+ const hasErrors = rawErrors && rawErrors.length > 0;
3299
+ const isCheckbox = schema.type === "boolean" && uiSchema?.["ui:widget"] !== "select";
3300
+ const showLabel = displayLabel && label && !isCheckbox;
3301
+ const hasHelpIcons = Boolean(rawHelp || documentation);
3302
+ const helpIcons = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3303
+ rawHelp && /* @__PURE__ */ jsxRuntime.jsx(TooltipIcon, { rawHelp }),
3304
+ documentation && /* @__PURE__ */ jsxRuntime.jsx(DocumentationLinkIcon, { documentation })
3305
+ ] });
3306
+ return /* @__PURE__ */ jsxRuntime.jsxs(FormGroup, { state: hasErrors ? "error" : "default", children: [
3307
+ showLabel && /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: id, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "tw-inline-flex tw-items-center tw-gap-1", children: [
3308
+ label,
3309
+ helpIcons
3310
+ ] }) }),
3311
+ !showLabel && !isCheckbox && hasHelpIcons && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tw-flex tw-items-center tw-gap-1", children: helpIcons }),
3312
+ isCheckbox && hasHelpIcons ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [
3313
+ children,
3314
+ helpIcons
3315
+ ] }) : children,
3316
+ rawDescription && /* @__PURE__ */ jsxRuntime.jsx(FormGroup.Help, { children: /* @__PURE__ */ jsxRuntime.jsx("span", { dangerouslySetInnerHTML: { __html: DOMPurify__default.default.sanitize(rawDescription) } }) }),
3317
+ hasErrors && /* @__PURE__ */ jsxRuntime.jsx(FormGroup.Help, { children: rawErrors.join(". ") })
3318
+ ] });
3319
+ };
3320
+ var FieldTemplateWithDependencies = ({
3321
+ dependencies,
3322
+ ...props
3323
+ }) => {
3324
+ const rootFormData = useRootFormData();
3325
+ const parentPath = props.fieldPathId.path.slice(0, -1);
3326
+ if (!evaluateDependencies(dependencies, rootFormData, parentPath)) {
3327
+ return null;
3308
3328
  }
3309
- const dayOfMonth = _date.getDate();
3310
- const endOfDesiredMonth = constructFrom(date, _date.getTime());
3311
- endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
3312
- const daysInMonth = endOfDesiredMonth.getDate();
3313
- if (dayOfMonth >= daysInMonth) {
3314
- return endOfDesiredMonth;
3315
- } else {
3316
- _date.setFullYear(
3317
- endOfDesiredMonth.getFullYear(),
3318
- endOfDesiredMonth.getMonth(),
3319
- dayOfMonth
3329
+ return /* @__PURE__ */ jsxRuntime.jsx(FieldTemplateBody, { ...props });
3330
+ };
3331
+ var FieldTemplate = (props) => {
3332
+ if (props.hidden) return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tw-hidden", children: props.children });
3333
+ if (props.uiSchema?.["ui:widget"] === "template-watch") {
3334
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tw-hidden", children: props.children });
3335
+ }
3336
+ const uiOptions = props.uiSchema?.["ui:options"];
3337
+ const dependencies = uiOptions?.dependencies;
3338
+ if (dependencies) {
3339
+ return /* @__PURE__ */ jsxRuntime.jsx(FieldTemplateWithDependencies, { dependencies, ...props });
3340
+ }
3341
+ return /* @__PURE__ */ jsxRuntime.jsx(FieldTemplateBody, { ...props });
3342
+ };
3343
+ var ObjectFieldTemplate = ({
3344
+ title,
3345
+ description,
3346
+ properties,
3347
+ formData,
3348
+ uiSchema,
3349
+ schema,
3350
+ fieldPathId
3351
+ }) => {
3352
+ const isRoot = !fieldPathId?.path?.length;
3353
+ const uiOptions = uiSchema?.["ui:options"];
3354
+ const hasCollapsed = uiOptions?.collapsed !== void 0;
3355
+ const collapsed = !!uiOptions?.collapsed;
3356
+ const disableCollapse = !!uiOptions?.disableCollapse;
3357
+ const lastPathSegment = fieldPathId?.path?.at(-1);
3358
+ const isArrayItem = typeof lastPathSegment === "number";
3359
+ const childSchemas = schema.properties;
3360
+ const isContainerSchema = (s) => {
3361
+ if (!s) return false;
3362
+ if (s.properties || s.items) return true;
3363
+ if (Array.isArray(s.type)) return s.type.includes("object") || s.type.includes("array");
3364
+ return s.type === "object" || s.type === "array";
3365
+ };
3366
+ const visibleProperties = properties.filter((prop) => {
3367
+ const childUi = uiSchema?.[prop.name];
3368
+ if (childUi?.["ui:widget"] !== "hidden") return true;
3369
+ return !isContainerSchema(childSchemas?.[prop.name]);
3370
+ });
3371
+ const isHiddenMount = (name) => {
3372
+ const w = uiSchema?.[name]?.["ui:widget"];
3373
+ return w === "hidden" || w === "template-watch";
3374
+ };
3375
+ const renderChildren = (props) => props.map((prop) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: isHiddenMount(prop.name) ? "tw-hidden" : void 0, children: prop.content }, prop.name));
3376
+ if (isRoot) {
3377
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden", children: renderChildren(visibleProperties) });
3378
+ }
3379
+ const childrenContent = renderChildren(visibleProperties);
3380
+ if (hasCollapsed && !disableCollapse) {
3381
+ const data = formData ?? {};
3382
+ const hasValues = Object.values(data).some(
3383
+ (v) => v !== void 0 && v !== null && v !== "" && v !== false
3384
+ );
3385
+ const defaultExpanded = hasValues ? !collapsed : true;
3386
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3387
+ CollapsiblePanel,
3388
+ {
3389
+ className: "tw-rounded-lg",
3390
+ headerClassName: "tw-rounded-lg",
3391
+ header: title || "Settings",
3392
+ defaultExpanded,
3393
+ bodyClassName: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden",
3394
+ children: [
3395
+ description,
3396
+ childrenContent
3397
+ ]
3398
+ }
3320
3399
  );
3321
- return _date;
3322
3400
  }
3323
- }
3324
-
3325
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/defaultOptions.js
3326
- var defaultOptions = {};
3327
- function getDefaultOptions() {
3328
- return defaultOptions;
3329
- }
3330
-
3331
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfWeek.js
3332
- function startOfWeek(date, options) {
3333
- const defaultOptions2 = getDefaultOptions();
3334
- const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
3335
- const _date = toDate(date, options?.in);
3336
- const day = _date.getDay();
3337
- const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
3338
- _date.setDate(_date.getDate() - diff);
3339
- _date.setHours(0, 0, 0, 0);
3340
- return _date;
3341
- }
3342
-
3343
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeek.js
3344
- function startOfISOWeek(date, options) {
3345
- return startOfWeek(date, { ...options, weekStartsOn: 1 });
3346
- }
3347
-
3348
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISOWeekYear.js
3349
- function getISOWeekYear(date, options) {
3350
- const _date = toDate(date, options?.in);
3351
- const year = _date.getFullYear();
3352
- const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
3353
- fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
3354
- fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
3355
- const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
3356
- const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
3357
- fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
3358
- fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
3359
- const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
3360
- if (_date.getTime() >= startOfNextYear.getTime()) {
3361
- return year + 1;
3362
- } else if (_date.getTime() >= startOfThisYear.getTime()) {
3363
- return year;
3364
- } else {
3365
- return year - 1;
3401
+ if (isArrayItem) {
3402
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden", children: childrenContent });
3366
3403
  }
3367
- }
3368
-
3369
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
3370
- function getTimezoneOffsetInMilliseconds(date) {
3371
- const _date = toDate(date);
3372
- const utcDate = new Date(
3373
- Date.UTC(
3374
- _date.getFullYear(),
3375
- _date.getMonth(),
3376
- _date.getDate(),
3377
- _date.getHours(),
3378
- _date.getMinutes(),
3379
- _date.getSeconds(),
3380
- _date.getMilliseconds()
3404
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tw-rounded-lg tw-border tw-border-solid tw-border-neutral-200 tw-bg-white tw-p-4", children: [
3405
+ title && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "tw-mb-2 tw-text-base tw-font-medium tw-text-neutral-800", children: title }),
3406
+ description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "tw-mb-3 tw-text-xs tw-text-neutral-400", children: description }),
3407
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden", children: childrenContent })
3408
+ ] });
3409
+ };
3410
+ var FieldBoxDescription = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
3411
+ "span",
3412
+ {
3413
+ ...props,
3414
+ "data-slot": "field-box-description",
3415
+ className: cn(
3416
+ "tw-text-xs",
3417
+ "tw-text-muted-foreground",
3418
+ "group-has-[:disabled]/field-box:tw-opacity-50",
3419
+ className
3381
3420
  )
3382
- );
3383
- utcDate.setUTCFullYear(_date.getFullYear());
3384
- return +date - +utcDate;
3385
- }
3386
-
3387
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeDates.js
3388
- function normalizeDates(context, ...dates) {
3389
- const normalize = constructFrom.bind(
3390
- null,
3391
- dates.find((date) => typeof date === "object")
3392
- );
3393
- return dates.map(normalize);
3394
- }
3395
-
3396
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfDay.js
3397
- function startOfDay(date, options) {
3398
- const _date = toDate(date, options?.in);
3399
- _date.setHours(0, 0, 0, 0);
3400
- return _date;
3401
- }
3402
-
3403
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarDays.js
3404
- function differenceInCalendarDays(laterDate, earlierDate, options) {
3405
- const [laterDate_, earlierDate_] = normalizeDates(
3406
- options?.in,
3407
- laterDate,
3408
- earlierDate
3409
- );
3410
- const laterStartOfDay = startOfDay(laterDate_);
3411
- const earlierStartOfDay = startOfDay(earlierDate_);
3412
- const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
3413
- const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
3414
- return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
3415
- }
3416
-
3417
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeekYear.js
3418
- function startOfISOWeekYear(date, options) {
3419
- const year = getISOWeekYear(date, options);
3420
- const fourthOfJanuary = constructFrom(date, 0);
3421
- fourthOfJanuary.setFullYear(year, 0, 4);
3422
- fourthOfJanuary.setHours(0, 0, 0, 0);
3423
- return startOfISOWeek(fourthOfJanuary);
3424
- }
3425
-
3426
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addWeeks.js
3427
- function addWeeks(date, amount, options) {
3428
- return addDays(date, amount * 7, options);
3429
- }
3430
-
3431
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addYears.js
3432
- function addYears(date, amount, options) {
3433
- return addMonths(date, amount * 12, options);
3421
+ }
3422
+ );
3423
+ var FieldBoxTitle = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
3424
+ "span",
3425
+ {
3426
+ ...props,
3427
+ "data-slot": "field-box-title",
3428
+ className: cn(
3429
+ "tw-text-sm",
3430
+ "tw-font-medium",
3431
+ "tw-text-foreground",
3432
+ "group-has-[:disabled]/field-box:tw-cursor-not-allowed",
3433
+ "group-has-[:disabled]/field-box:tw-opacity-50",
3434
+ className
3435
+ )
3436
+ }
3437
+ );
3438
+ var fieldBoxVariants = classVarianceAuthority.cva(
3439
+ [
3440
+ "tw-group/field-box",
3441
+ "tw-m-0",
3442
+ "tw-inline-flex",
3443
+ "tw-gap-3",
3444
+ "tw-items-center",
3445
+ "has-[[data-slot=field-box-description]]:tw-items-start",
3446
+ "tw-cursor-pointer",
3447
+ "tw-select-none",
3448
+ "has-[:disabled]:tw-cursor-not-allowed"
3449
+ ],
3450
+ {
3451
+ variants: {
3452
+ variant: {
3453
+ default: [],
3454
+ boxed: [
3455
+ "tw-rounded-lg",
3456
+ "tw-border",
3457
+ "tw-border-solid",
3458
+ "tw-border-border",
3459
+ "tw-p-3",
3460
+ "tw-transition-colors",
3461
+ "has-[[data-state=checked]]:tw-border-primary",
3462
+ "has-[[data-state=checked]]:tw-bg-accent",
3463
+ "has-[[data-state=indeterminate]]:tw-border-primary",
3464
+ "has-[[data-state=indeterminate]]:tw-bg-accent"
3465
+ ]
3466
+ }
3467
+ },
3468
+ defaultVariants: {
3469
+ variant: "default"
3470
+ }
3471
+ }
3472
+ );
3473
+ var FieldBoxRoot = ({
3474
+ ref,
3475
+ className,
3476
+ variant,
3477
+ position = "start",
3478
+ control,
3479
+ children,
3480
+ ...rest
3481
+ }) => /* @__PURE__ */ jsxRuntime.jsxs(
3482
+ "label",
3483
+ {
3484
+ ...rest,
3485
+ ref,
3486
+ className: cn(
3487
+ fieldBoxVariants({ variant, className }),
3488
+ position === "end" && "tw-flex-row-reverse"
3489
+ ),
3490
+ children: [
3491
+ /* @__PURE__ */ jsxRuntime.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 }),
3492
+ children != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tw-flex tw-flex-1 tw-flex-col tw-gap-0.5", children })
3493
+ ]
3494
+ }
3495
+ );
3496
+ var FieldBox = Object.assign(FieldBoxRoot, {
3497
+ Title: FieldBoxTitle,
3498
+ Description: FieldBoxDescription
3499
+ });
3500
+ var rootVariants = classVarianceAuthority.cva(
3501
+ [
3502
+ // reset
3503
+ "tailwindcss-preflight",
3504
+ // position
3505
+ "tw-flex",
3506
+ "tw-items-center",
3507
+ "tw-justify-center",
3508
+ "tw-peer",
3509
+ "tw-size-4",
3510
+ "tw-shrink-0",
3511
+ "tw-cursor-pointer",
3512
+ // border
3513
+ "tw-border",
3514
+ "tw-border-solid",
3515
+ // disabled
3516
+ "disabled:tw-opacity-50",
3517
+ "disabled:tw-cursor-not-allowed"
3518
+ ],
3519
+ {
3520
+ defaultVariants: {
3521
+ variant: "default"
3522
+ },
3523
+ variants: {
3524
+ variant: {
3525
+ default: [
3526
+ "tw-rounded",
3527
+ "tw-border-neutral-200",
3528
+ "data-[state=checked]:tw-bg-primary",
3529
+ "data-[state=checked]:tw-border-primary",
3530
+ "data-[state=indeterminate]:tw-bg-white",
3531
+ "data-[state=indeterminate]:tw-border-neutral-200"
3532
+ ],
3533
+ argo: [
3534
+ "tw-rounded",
3535
+ "tw-border-input",
3536
+ "tw-transition-colors",
3537
+ "data-[state=checked]:tw-bg-primary",
3538
+ "data-[state=checked]:tw-border-primary",
3539
+ "data-[state=indeterminate]:tw-bg-primary",
3540
+ "data-[state=indeterminate]:tw-border-primary",
3541
+ // focus
3542
+ "focus-visible:tw-outline-none",
3543
+ "focus-visible:tw-border-primary",
3544
+ "focus-visible:tw-ring-2",
3545
+ "focus-visible:tw-ring-ring/50"
3546
+ ]
3547
+ }
3548
+ }
3549
+ }
3550
+ );
3551
+ var indicatorVariants = classVarianceAuthority.cva(["tw-group", "tw-flex", "tw-items-center"], {
3552
+ defaultVariants: {
3553
+ variant: "default"
3554
+ },
3555
+ variants: {
3556
+ variant: {
3557
+ default: [
3558
+ "data-[state=checked]:tw-text-primary-foreground",
3559
+ "data-[state=indeterminate]:tw-text-neutral-200"
3560
+ ],
3561
+ argo: ["tw-text-primary-foreground"]
3562
+ }
3563
+ }
3564
+ });
3565
+ function Checkbox({
3566
+ className,
3567
+ id: idProp,
3568
+ children,
3569
+ description,
3570
+ variant,
3571
+ position,
3572
+ tooltip,
3573
+ tooltipPlacement = "top",
3574
+ ...rest
3575
+ }) {
3576
+ const fallbackId = React26.useId();
3577
+ const id = idProp?.toString() ?? fallbackId;
3578
+ const styleVariant = useArgoDesign() ? "argo" : "default";
3579
+ const checkboxElement = /* @__PURE__ */ jsxRuntime.jsx(reactCheckbox.Root, { id, ...rest, className: cn(rootVariants({ variant: styleVariant, className })), children: /* @__PURE__ */ jsxRuntime.jsxs(reactCheckbox.Indicator, { className: cn(indicatorVariants({ variant: styleVariant })), children: [
3580
+ /* @__PURE__ */ jsxRuntime.jsx(icons_exports.Check, { className: "tw-hidden tw-size-3 tw-stroke-[4px] group-data-[state=checked]:tw-block" }),
3581
+ /* @__PURE__ */ jsxRuntime.jsx(icons_exports.Minus, { className: "tw-hidden tw-size-3 tw-stroke-[4px] group-data-[state=indeterminate]:tw-block" })
3582
+ ] }) });
3583
+ const rendered = !children ? checkboxElement : /* @__PURE__ */ jsxRuntime.jsxs(FieldBox, { htmlFor: id, variant, position, control: checkboxElement, children: [
3584
+ /* @__PURE__ */ jsxRuntime.jsx(FieldBox.Title, { children }),
3585
+ description && /* @__PURE__ */ jsxRuntime.jsx(FieldBox.Description, { children: description })
3586
+ ] });
3587
+ if (!tooltip) return rendered;
3588
+ return /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { tooltip, placement: tooltipPlacement, triggerAsChild: !!children, children: rendered });
3434
3589
  }
3590
+ var CheckboxWidget = ({
3591
+ id,
3592
+ value,
3593
+ onChange,
3594
+ disabled,
3595
+ readonly,
3596
+ label,
3597
+ hideLabel
3598
+ }) => {
3599
+ const checked = !!value;
3600
+ return /* @__PURE__ */ jsxRuntime.jsx(Checkbox, { id, checked, onCheckedChange: onChange, disabled: disabled || readonly, children: hideLabel ? void 0 : label });
3601
+ };
3435
3602
 
3436
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/max.js
3437
- function max(dates, options) {
3438
- let result;
3439
- let context = options?.in;
3440
- dates.forEach((date) => {
3441
- if (!context && typeof date === "object")
3442
- context = constructFrom.bind(null, date);
3443
- const date_ = toDate(date, context);
3444
- if (!result || result < date_ || isNaN(+date_)) result = date_;
3445
- });
3446
- return constructFrom(context, result || NaN);
3603
+ // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tzName/index.js
3604
+ function tzName(timeZone, date, format2 = "long") {
3605
+ return new Intl.DateTimeFormat("en-US", {
3606
+ // Enforces engine to render the time. Without the option JavaScriptCore omits it.
3607
+ hour: "numeric",
3608
+ timeZone,
3609
+ timeZoneName: format2
3610
+ }).format(date).split(/\s/g).slice(2).join(" ");
3447
3611
  }
3448
3612
 
3449
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/min.js
3450
- function min(dates, options) {
3451
- let result;
3452
- let context = options?.in;
3453
- dates.forEach((date) => {
3454
- if (!context && typeof date === "object")
3455
- context = constructFrom.bind(null, date);
3456
- const date_ = toDate(date, context);
3457
- if (!result || result > date_ || isNaN(+date_)) result = date_;
3458
- });
3459
- return constructFrom(context, result || NaN);
3613
+ // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tzOffset/index.js
3614
+ var offsetFormatCache = {};
3615
+ var offsetCache = {};
3616
+ function tzOffset(timeZone, date) {
3617
+ try {
3618
+ const format2 = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat("en-US", {
3619
+ timeZone,
3620
+ timeZoneName: "longOffset"
3621
+ }).format;
3622
+ const offsetStr = format2(date).split("GMT")[1];
3623
+ if (offsetStr in offsetCache) return offsetCache[offsetStr];
3624
+ return calcOffset(offsetStr, offsetStr.split(":"));
3625
+ } catch {
3626
+ if (timeZone in offsetCache) return offsetCache[timeZone];
3627
+ const captures = timeZone?.match(offsetRe);
3628
+ if (captures) return calcOffset(timeZone, captures.slice(1));
3629
+ return NaN;
3630
+ }
3460
3631
  }
3461
-
3462
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isSameDay.js
3463
- function isSameDay(laterDate, earlierDate, options) {
3464
- const [dateLeft_, dateRight_] = normalizeDates(
3465
- options?.in,
3466
- laterDate,
3467
- earlierDate
3468
- );
3469
- return +startOfDay(dateLeft_) === +startOfDay(dateRight_);
3632
+ var offsetRe = /([+-]\d\d):?(\d\d)?/;
3633
+ function calcOffset(cacheStr, values) {
3634
+ const hours = +(values[0] || 0);
3635
+ const minutes = +(values[1] || 0);
3636
+ const seconds = +(values[2] || 0) / 60;
3637
+ return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;
3470
3638
  }
3471
3639
 
3472
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isDate.js
3473
- function isDate(value) {
3474
- return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
3640
+ // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/date/mini.js
3641
+ var TZDateMini = class _TZDateMini extends Date {
3642
+ //#region static
3643
+ constructor(...args) {
3644
+ super();
3645
+ if (args.length > 1 && typeof args[args.length - 1] === "string") {
3646
+ this.timeZone = args.pop();
3647
+ }
3648
+ this.internal = /* @__PURE__ */ new Date();
3649
+ if (isNaN(tzOffset(this.timeZone, this))) {
3650
+ this.setTime(NaN);
3651
+ } else {
3652
+ if (!args.length) {
3653
+ this.setTime(Date.now());
3654
+ } else if (typeof args[0] === "number" && (args.length === 1 || args.length === 2 && typeof args[1] !== "number")) {
3655
+ this.setTime(args[0]);
3656
+ } else if (typeof args[0] === "string") {
3657
+ this.setTime(+new Date(args[0]));
3658
+ } else if (args[0] instanceof Date) {
3659
+ this.setTime(+args[0]);
3660
+ } else {
3661
+ this.setTime(+new Date(...args));
3662
+ adjustToSystemTZ(this);
3663
+ syncToInternal(this);
3664
+ }
3665
+ }
3666
+ }
3667
+ static tz(tz, ...args) {
3668
+ return args.length ? new _TZDateMini(...args, tz) : new _TZDateMini(Date.now(), tz);
3669
+ }
3670
+ //#endregion
3671
+ //#region time zone
3672
+ withTimeZone(timeZone) {
3673
+ return new _TZDateMini(+this, timeZone);
3674
+ }
3675
+ getTimezoneOffset() {
3676
+ const offset = -tzOffset(this.timeZone, this);
3677
+ return offset > 0 ? Math.floor(offset) : Math.ceil(offset);
3678
+ }
3679
+ //#endregion
3680
+ //#region time
3681
+ setTime(time) {
3682
+ Date.prototype.setTime.apply(this, arguments);
3683
+ syncToInternal(this);
3684
+ return +this;
3685
+ }
3686
+ //#endregion
3687
+ //#region date-fns integration
3688
+ [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) {
3689
+ return new _TZDateMini(+new Date(date), this.timeZone);
3690
+ }
3691
+ //#endregion
3692
+ };
3693
+ var re = /^(get|set)(?!UTC)/;
3694
+ Object.getOwnPropertyNames(Date.prototype).forEach((method) => {
3695
+ if (!re.test(method)) return;
3696
+ const utcMethod = method.replace(re, "$1UTC");
3697
+ if (!TZDateMini.prototype[utcMethod]) return;
3698
+ if (method.startsWith("get")) {
3699
+ TZDateMini.prototype[method] = function() {
3700
+ return this.internal[utcMethod]();
3701
+ };
3702
+ } else {
3703
+ TZDateMini.prototype[method] = function() {
3704
+ Date.prototype[utcMethod].apply(this.internal, arguments);
3705
+ syncFromInternal(this);
3706
+ return +this;
3707
+ };
3708
+ TZDateMini.prototype[utcMethod] = function() {
3709
+ Date.prototype[utcMethod].apply(this, arguments);
3710
+ syncToInternal(this);
3711
+ return +this;
3712
+ };
3713
+ }
3714
+ });
3715
+ function syncToInternal(date) {
3716
+ date.internal.setTime(+date);
3717
+ date.internal.setUTCSeconds(date.internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, date) * 60));
3475
3718
  }
3476
-
3477
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isValid.js
3478
- function isValid(date) {
3479
- return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
3719
+ function syncFromInternal(date) {
3720
+ Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());
3721
+ Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());
3722
+ adjustToSystemTZ(date);
3480
3723
  }
3481
-
3482
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarMonths.js
3483
- function differenceInCalendarMonths(laterDate, earlierDate, options) {
3484
- const [laterDate_, earlierDate_] = normalizeDates(
3485
- options?.in,
3486
- laterDate,
3487
- earlierDate
3488
- );
3489
- const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();
3490
- const monthsDiff = laterDate_.getMonth() - earlierDate_.getMonth();
3491
- return yearsDiff * 12 + monthsDiff;
3724
+ function adjustToSystemTZ(date) {
3725
+ const baseOffset = tzOffset(date.timeZone, date);
3726
+ const offset = baseOffset > 0 ? Math.floor(baseOffset) : Math.ceil(baseOffset);
3727
+ const prevHour = /* @__PURE__ */ new Date(+date);
3728
+ prevHour.setUTCHours(prevHour.getUTCHours() - 1);
3729
+ const systemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset();
3730
+ const prevHourSystemOffset = -(/* @__PURE__ */ new Date(+prevHour)).getTimezoneOffset();
3731
+ const systemDSTChange = systemOffset - prevHourSystemOffset;
3732
+ const dstShift = Date.prototype.getHours.apply(date) !== date.internal.getUTCHours();
3733
+ if (systemDSTChange && dstShift) date.internal.setUTCMinutes(date.internal.getUTCMinutes() + systemDSTChange);
3734
+ const offsetDiff = systemOffset - offset;
3735
+ if (offsetDiff) Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);
3736
+ const systemDate = /* @__PURE__ */ new Date(+date);
3737
+ systemDate.setUTCSeconds(0);
3738
+ const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;
3739
+ const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;
3740
+ if (secondsOffset || systemSecondsOffset) {
3741
+ date.internal.setUTCSeconds(date.internal.getUTCSeconds() + secondsOffset);
3742
+ Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);
3743
+ }
3744
+ const postBaseOffset = tzOffset(date.timeZone, date);
3745
+ const postOffset = postBaseOffset > 0 ? Math.floor(postBaseOffset) : Math.ceil(postBaseOffset);
3746
+ const postSystemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset();
3747
+ const postOffsetDiff = postSystemOffset - postOffset;
3748
+ const offsetChanged = postOffset !== offset;
3749
+ const postDiff = postOffsetDiff - offsetDiff;
3750
+ if (offsetChanged && postDiff) {
3751
+ Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);
3752
+ const newBaseOffset = tzOffset(date.timeZone, date);
3753
+ const newOffset = newBaseOffset > 0 ? Math.floor(newBaseOffset) : Math.ceil(newBaseOffset);
3754
+ const offsetChange = postOffset - newOffset;
3755
+ if (offsetChange) {
3756
+ date.internal.setUTCMinutes(date.internal.getUTCMinutes() + offsetChange);
3757
+ Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);
3758
+ }
3759
+ }
3492
3760
  }
3493
3761
 
3494
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/endOfMonth.js
3495
- function endOfMonth(date, options) {
3496
- const _date = toDate(date, options?.in);
3497
- const month = _date.getMonth();
3498
- _date.setFullYear(_date.getFullYear(), month + 1, 0);
3499
- _date.setHours(23, 59, 59, 999);
3500
- return _date;
3501
- }
3762
+ // ../../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/date/index.js
3763
+ var TZDate = class _TZDate extends TZDateMini {
3764
+ //#region static
3765
+ static tz(tz, ...args) {
3766
+ return args.length ? new _TZDate(...args, tz) : new _TZDate(Date.now(), tz);
3767
+ }
3768
+ //#endregion
3769
+ //#region representation
3770
+ toISOString() {
3771
+ const [sign, hours, minutes] = this.tzComponents();
3772
+ const tz = `${sign}${hours}:${minutes}`;
3773
+ return this.internal.toISOString().slice(0, -1) + tz;
3774
+ }
3775
+ toString() {
3776
+ return `${this.toDateString()} ${this.toTimeString()}`;
3777
+ }
3778
+ toDateString() {
3779
+ const [day, date, month, year] = this.internal.toUTCString().split(" ");
3780
+ return `${day?.slice(0, -1)} ${month} ${date} ${year}`;
3781
+ }
3782
+ toTimeString() {
3783
+ const time = this.internal.toUTCString().split(" ")[4];
3784
+ const [sign, hours, minutes] = this.tzComponents();
3785
+ return `${time} GMT${sign}${hours}${minutes} (${tzName(this.timeZone, this)})`;
3786
+ }
3787
+ toLocaleString(locales, options) {
3788
+ return Date.prototype.toLocaleString.call(this, locales, {
3789
+ ...options,
3790
+ timeZone: options?.timeZone || this.timeZone
3791
+ });
3792
+ }
3793
+ toLocaleDateString(locales, options) {
3794
+ return Date.prototype.toLocaleDateString.call(this, locales, {
3795
+ ...options,
3796
+ timeZone: options?.timeZone || this.timeZone
3797
+ });
3798
+ }
3799
+ toLocaleTimeString(locales, options) {
3800
+ return Date.prototype.toLocaleTimeString.call(this, locales, {
3801
+ ...options,
3802
+ timeZone: options?.timeZone || this.timeZone
3803
+ });
3804
+ }
3805
+ //#endregion
3806
+ //#region private
3807
+ tzComponents() {
3808
+ const offset = this.getTimezoneOffset();
3809
+ const sign = offset > 0 ? "-" : "+";
3810
+ const hours = String(Math.floor(Math.abs(offset) / 60)).padStart(2, "0");
3811
+ const minutes = String(Math.abs(offset) % 60).padStart(2, "0");
3812
+ return [sign, hours, minutes];
3813
+ }
3814
+ //#endregion
3815
+ withTimeZone(timeZone) {
3816
+ return new _TZDate(+this, timeZone);
3817
+ }
3818
+ //#region date-fns integration
3819
+ [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) {
3820
+ return new _TZDate(+new Date(date), this.timeZone);
3821
+ }
3822
+ //#endregion
3823
+ };
3824
+ var millisecondsInWeek = 6048e5;
3825
+ var millisecondsInDay = 864e5;
3826
+ var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom");
3502
3827
 
3503
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeInterval.js
3504
- function normalizeInterval(context, interval) {
3505
- const [start, end] = normalizeDates(context, interval.start, interval.end);
3506
- return { start, end };
3828
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/constructFrom.js
3829
+ function constructFrom(date, value) {
3830
+ if (typeof date === "function") return date(value);
3831
+ if (date && typeof date === "object" && constructFromSymbol in date)
3832
+ return date[constructFromSymbol](value);
3833
+ if (date instanceof Date) return new date.constructor(value);
3834
+ return new Date(value);
3507
3835
  }
3508
3836
 
3509
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/eachMonthOfInterval.js
3510
- function eachMonthOfInterval(interval, options) {
3511
- const { start, end } = normalizeInterval(options?.in, interval);
3512
- let reversed = +start > +end;
3513
- const endTime = reversed ? +start : +end;
3514
- const date = reversed ? end : start;
3515
- date.setHours(0, 0, 0, 0);
3516
- date.setDate(1);
3517
- let step = 1;
3518
- const dates = [];
3519
- while (+date <= endTime) {
3520
- dates.push(constructFrom(start, date));
3521
- date.setMonth(date.getMonth() + step);
3522
- }
3523
- return reversed ? dates.reverse() : dates;
3837
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/toDate.js
3838
+ function toDate(argument, context) {
3839
+ return constructFrom(context || argument, argument);
3524
3840
  }
3525
3841
 
3526
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfMonth.js
3527
- function startOfMonth(date, options) {
3842
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addDays.js
3843
+ function addDays(date, amount, options) {
3528
3844
  const _date = toDate(date, options?.in);
3529
- _date.setDate(1);
3530
- _date.setHours(0, 0, 0, 0);
3845
+ if (isNaN(amount)) return constructFrom(date, NaN);
3846
+ if (!amount) return _date;
3847
+ _date.setDate(_date.getDate() + amount);
3531
3848
  return _date;
3532
3849
  }
3533
3850
 
3534
- // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/endOfYear.js
3535
- function endOfYear(date, options) {
3851
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addMonths.js
3852
+ function addMonths(date, amount, options) {
3536
3853
  const _date = toDate(date, options?.in);
3537
- const year = _date.getFullYear();
3538
- _date.setFullYear(year + 1, 0, 0);
3539
- _date.setHours(23, 59, 59, 999);
3540
- return _date;
3541
- }
3542
-
3854
+ if (isNaN(amount)) return constructFrom(date, NaN);
3855
+ if (!amount) {
3856
+ return _date;
3857
+ }
3858
+ const dayOfMonth = _date.getDate();
3859
+ const endOfDesiredMonth = constructFrom(date, _date.getTime());
3860
+ endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
3861
+ const daysInMonth = endOfDesiredMonth.getDate();
3862
+ if (dayOfMonth >= daysInMonth) {
3863
+ return endOfDesiredMonth;
3864
+ } else {
3865
+ _date.setFullYear(
3866
+ endOfDesiredMonth.getFullYear(),
3867
+ endOfDesiredMonth.getMonth(),
3868
+ dayOfMonth
3869
+ );
3870
+ return _date;
3871
+ }
3872
+ }
3873
+
3874
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/defaultOptions.js
3875
+ var defaultOptions = {};
3876
+ function getDefaultOptions() {
3877
+ return defaultOptions;
3878
+ }
3879
+
3880
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfWeek.js
3881
+ function startOfWeek(date, options) {
3882
+ const defaultOptions2 = getDefaultOptions();
3883
+ const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
3884
+ const _date = toDate(date, options?.in);
3885
+ const day = _date.getDay();
3886
+ const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
3887
+ _date.setDate(_date.getDate() - diff);
3888
+ _date.setHours(0, 0, 0, 0);
3889
+ return _date;
3890
+ }
3891
+
3892
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeek.js
3893
+ function startOfISOWeek(date, options) {
3894
+ return startOfWeek(date, { ...options, weekStartsOn: 1 });
3895
+ }
3896
+
3897
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISOWeekYear.js
3898
+ function getISOWeekYear(date, options) {
3899
+ const _date = toDate(date, options?.in);
3900
+ const year = _date.getFullYear();
3901
+ const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
3902
+ fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
3903
+ fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
3904
+ const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
3905
+ const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
3906
+ fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
3907
+ fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
3908
+ const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
3909
+ if (_date.getTime() >= startOfNextYear.getTime()) {
3910
+ return year + 1;
3911
+ } else if (_date.getTime() >= startOfThisYear.getTime()) {
3912
+ return year;
3913
+ } else {
3914
+ return year - 1;
3915
+ }
3916
+ }
3917
+
3918
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
3919
+ function getTimezoneOffsetInMilliseconds(date) {
3920
+ const _date = toDate(date);
3921
+ const utcDate = new Date(
3922
+ Date.UTC(
3923
+ _date.getFullYear(),
3924
+ _date.getMonth(),
3925
+ _date.getDate(),
3926
+ _date.getHours(),
3927
+ _date.getMinutes(),
3928
+ _date.getSeconds(),
3929
+ _date.getMilliseconds()
3930
+ )
3931
+ );
3932
+ utcDate.setUTCFullYear(_date.getFullYear());
3933
+ return +date - +utcDate;
3934
+ }
3935
+
3936
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeDates.js
3937
+ function normalizeDates(context, ...dates) {
3938
+ const normalize = constructFrom.bind(
3939
+ null,
3940
+ dates.find((date) => typeof date === "object")
3941
+ );
3942
+ return dates.map(normalize);
3943
+ }
3944
+
3945
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfDay.js
3946
+ function startOfDay(date, options) {
3947
+ const _date = toDate(date, options?.in);
3948
+ _date.setHours(0, 0, 0, 0);
3949
+ return _date;
3950
+ }
3951
+
3952
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarDays.js
3953
+ function differenceInCalendarDays(laterDate, earlierDate, options) {
3954
+ const [laterDate_, earlierDate_] = normalizeDates(
3955
+ options?.in,
3956
+ laterDate,
3957
+ earlierDate
3958
+ );
3959
+ const laterStartOfDay = startOfDay(laterDate_);
3960
+ const earlierStartOfDay = startOfDay(earlierDate_);
3961
+ const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
3962
+ const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
3963
+ return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
3964
+ }
3965
+
3966
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeekYear.js
3967
+ function startOfISOWeekYear(date, options) {
3968
+ const year = getISOWeekYear(date, options);
3969
+ const fourthOfJanuary = constructFrom(date, 0);
3970
+ fourthOfJanuary.setFullYear(year, 0, 4);
3971
+ fourthOfJanuary.setHours(0, 0, 0, 0);
3972
+ return startOfISOWeek(fourthOfJanuary);
3973
+ }
3974
+
3975
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addWeeks.js
3976
+ function addWeeks(date, amount, options) {
3977
+ return addDays(date, amount * 7, options);
3978
+ }
3979
+
3980
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addYears.js
3981
+ function addYears(date, amount, options) {
3982
+ return addMonths(date, amount * 12, options);
3983
+ }
3984
+
3985
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/max.js
3986
+ function max(dates, options) {
3987
+ let result;
3988
+ let context = options?.in;
3989
+ dates.forEach((date) => {
3990
+ if (!context && typeof date === "object")
3991
+ context = constructFrom.bind(null, date);
3992
+ const date_ = toDate(date, context);
3993
+ if (!result || result < date_ || isNaN(+date_)) result = date_;
3994
+ });
3995
+ return constructFrom(context, result || NaN);
3996
+ }
3997
+
3998
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/min.js
3999
+ function min(dates, options) {
4000
+ let result;
4001
+ let context = options?.in;
4002
+ dates.forEach((date) => {
4003
+ if (!context && typeof date === "object")
4004
+ context = constructFrom.bind(null, date);
4005
+ const date_ = toDate(date, context);
4006
+ if (!result || result > date_ || isNaN(+date_)) result = date_;
4007
+ });
4008
+ return constructFrom(context, result || NaN);
4009
+ }
4010
+
4011
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isSameDay.js
4012
+ function isSameDay(laterDate, earlierDate, options) {
4013
+ const [dateLeft_, dateRight_] = normalizeDates(
4014
+ options?.in,
4015
+ laterDate,
4016
+ earlierDate
4017
+ );
4018
+ return +startOfDay(dateLeft_) === +startOfDay(dateRight_);
4019
+ }
4020
+
4021
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isDate.js
4022
+ function isDate(value) {
4023
+ return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
4024
+ }
4025
+
4026
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isValid.js
4027
+ function isValid(date) {
4028
+ return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
4029
+ }
4030
+
4031
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarMonths.js
4032
+ function differenceInCalendarMonths(laterDate, earlierDate, options) {
4033
+ const [laterDate_, earlierDate_] = normalizeDates(
4034
+ options?.in,
4035
+ laterDate,
4036
+ earlierDate
4037
+ );
4038
+ const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();
4039
+ const monthsDiff = laterDate_.getMonth() - earlierDate_.getMonth();
4040
+ return yearsDiff * 12 + monthsDiff;
4041
+ }
4042
+
4043
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/endOfMonth.js
4044
+ function endOfMonth(date, options) {
4045
+ const _date = toDate(date, options?.in);
4046
+ const month = _date.getMonth();
4047
+ _date.setFullYear(_date.getFullYear(), month + 1, 0);
4048
+ _date.setHours(23, 59, 59, 999);
4049
+ return _date;
4050
+ }
4051
+
4052
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeInterval.js
4053
+ function normalizeInterval(context, interval) {
4054
+ const [start, end] = normalizeDates(context, interval.start, interval.end);
4055
+ return { start, end };
4056
+ }
4057
+
4058
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/eachMonthOfInterval.js
4059
+ function eachMonthOfInterval(interval, options) {
4060
+ const { start, end } = normalizeInterval(options?.in, interval);
4061
+ let reversed = +start > +end;
4062
+ const endTime = reversed ? +start : +end;
4063
+ const date = reversed ? end : start;
4064
+ date.setHours(0, 0, 0, 0);
4065
+ date.setDate(1);
4066
+ let step = 1;
4067
+ const dates = [];
4068
+ while (+date <= endTime) {
4069
+ dates.push(constructFrom(start, date));
4070
+ date.setMonth(date.getMonth() + step);
4071
+ }
4072
+ return reversed ? dates.reverse() : dates;
4073
+ }
4074
+
4075
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfMonth.js
4076
+ function startOfMonth(date, options) {
4077
+ const _date = toDate(date, options?.in);
4078
+ _date.setDate(1);
4079
+ _date.setHours(0, 0, 0, 0);
4080
+ return _date;
4081
+ }
4082
+
4083
+ // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/endOfYear.js
4084
+ function endOfYear(date, options) {
4085
+ const _date = toDate(date, options?.in);
4086
+ const year = _date.getFullYear();
4087
+ _date.setFullYear(year + 1, 0, 0);
4088
+ _date.setHours(23, 59, 59, 999);
4089
+ return _date;
4090
+ }
4091
+
3543
4092
  // ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfYear.js
3544
4093
  function startOfYear(date, options) {
3545
4094
  const date_ = toDate(date, options?.in);
@@ -5466,7 +6015,7 @@ __export(custom_components_exports, {
5466
6015
  NextMonthButton: () => NextMonthButton,
5467
6016
  Option: () => Option,
5468
6017
  PreviousMonthButton: () => PreviousMonthButton,
5469
- Root: () => Root6,
6018
+ Root: () => Root8,
5470
6019
  Select: () => Select,
5471
6020
  Week: () => Week,
5472
6021
  WeekNumber: () => WeekNumber,
@@ -5646,7 +6195,7 @@ function Option(props) {
5646
6195
  function PreviousMonthButton(props) {
5647
6196
  return React26__default.default.createElement("button", { ...props });
5648
6197
  }
5649
- function Root6(props) {
6198
+ function Root8(props) {
5650
6199
  const { rootRef, ...rest } = props;
5651
6200
  return React26__default.default.createElement("div", { ...rest, ref: rootRef });
5652
6201
  }
@@ -7338,948 +7887,387 @@ function DayPicker(initialProps) {
7338
7887
  })(),
7339
7888
  React26__default.default.createElement("span", { role: "status", "aria-live": "polite", style: {
7340
7889
  border: 0,
7341
- clip: "rect(0 0 0 0)",
7342
- height: "1px",
7343
- margin: "-1px",
7344
- overflow: "hidden",
7345
- padding: 0,
7346
- position: "absolute",
7347
- width: "1px",
7348
- whiteSpace: "nowrap",
7349
- wordWrap: "normal"
7350
- } }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))
7351
- ) : React26__default.default.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))),
7352
- navLayout === "around" && !props.hideNavigation && displayIndex === numberOfMonths - 1 && React26__default.default.createElement(
7353
- components.NextMonthButton,
7354
- { 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 },
7355
- React26__default.default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" })
7356
- ),
7357
- displayIndex === numberOfMonths - 1 && navLayout === "after" && !props.hideNavigation && React26__default.default.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 }),
7358
- React26__default.default.createElement(
7359
- components.MonthGrid,
7360
- { 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] },
7361
- !props.hideWeekdays && React26__default.default.createElement(
7362
- components.Weekdays,
7363
- { "data-animated-weekdays": props.animate ? "true" : void 0, className: classNames[UI.Weekdays], style: styles?.[UI.Weekdays] },
7364
- showWeekNumber && React26__default.default.createElement(components.WeekNumberHeader, { "aria-label": labelWeekNumberHeader2(dateLib.options), className: classNames[UI.WeekNumberHeader], style: styles?.[UI.WeekNumberHeader], scope: "col" }, formatWeekNumberHeader2()),
7365
- weekdays.map((weekday) => React26__default.default.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)))
7366
- ),
7367
- React26__default.default.createElement(components.Weeks, { "data-animated-weeks": props.animate ? "true" : void 0, className: classNames[UI.Weeks], style: styles?.[UI.Weeks] }, calendarMonth.weeks.map((week) => {
7368
- return React26__default.default.createElement(
7369
- components.Week,
7370
- { className: classNames[UI.Week], key: week.weekNumber, style: styles?.[UI.Week], week },
7371
- showWeekNumber && React26__default.default.createElement(components.WeekNumber, { week, style: styles?.[UI.WeekNumber], "aria-label": labelWeekNumber2(week.weekNumber, {
7372
- locale
7373
- }), className: classNames[UI.WeekNumber], scope: "row", role: "rowheader" }, formatWeekNumber2(week.weekNumber, dateLib)),
7374
- week.days.map((day) => {
7375
- const { date } = day;
7376
- const modifiers = getModifiers(day);
7377
- modifiers[DayFlag.focused] = !modifiers.hidden && Boolean(focused?.isEqualTo(day));
7378
- modifiers[SelectionState.selected] = isSelected?.(date) || modifiers.selected;
7379
- if (isDateRange(selectedValue)) {
7380
- const { from, to } = selectedValue;
7381
- modifiers[SelectionState.range_start] = Boolean(from && to && dateLib.isSameDay(date, from));
7382
- modifiers[SelectionState.range_end] = Boolean(from && to && dateLib.isSameDay(date, to));
7383
- modifiers[SelectionState.range_middle] = rangeIncludesDate(selectedValue, date, true, dateLib);
7384
- }
7385
- const style2 = getStyleForModifiers(modifiers, styles, props.modifiersStyles);
7386
- const className2 = getClassNamesForModifiers(modifiers, classNames, props.modifiersClassNames);
7387
- const ariaLabel = !isInteractive && !modifiers.hidden ? labelGridcell2(date, modifiers, dateLib.options, dateLib) : void 0;
7388
- return React26__default.default.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__default.default.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));
7389
- })
7390
- );
7391
- }))
7392
- )
7393
- );
7394
- })
7395
- ),
7396
- props.footer && React26__default.default.createElement(components.Footer, { className: classNames[UI.Footer], style: styles?.[UI.Footer], role: "status", "aria-live": "polite" }, props.footer)
7397
- )
7398
- );
7399
- }
7400
- var dayPickerClassNames = {
7401
- 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`
7402
- };
7403
- var rangePickerClassNames = {
7404
- 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`,
7405
- 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`,
7406
- selected: `tw-font-medium tw-rounded`,
7407
- range_middle: `tw-bg-accent tw-border-accent tw-text-accent-foreground tw-rounded-none tw-font-medium`
7408
- };
7409
- var Calendar = ({ className, classNames, ...props }) => {
7410
- const defaultClassNames = getDefaultClassNames();
7411
- return /* @__PURE__ */ jsxRuntime.jsx(
7412
- DayPicker,
7413
- {
7414
- ...props,
7415
- captionLayout: "dropdown",
7416
- className: cn(className, "tw-p-3"),
7417
- classNames: {
7418
- chevron: `${defaultClassNames.chevron} tw-fill-foreground`,
7419
- day: `${defaultClassNames.day} hover:tw-bg-accent tw-rounded`,
7420
- day_button: `${defaultClassNames.day_button} tw-rounded`,
7421
- today: `tw-bg-accent tw-text-accent-foreground tw-font-medium`,
7422
- ...dayPickerClassNames,
7423
- ...rangePickerClassNames,
7424
- selected: `${props.mode === "range" ? rangePickerClassNames.selected : dayPickerClassNames.selected}`,
7425
- ...classNames
7426
- },
7427
- required: false
7428
- }
7429
- );
7430
- };
7431
- Calendar.displayName = "Calendar";
7432
- var variants2 = classVarianceAuthority.cva(
7433
- [
7434
- "tailwindcss-preflight",
7435
- "tw-group/popover-content",
7436
- "tw-z-[1055]",
7437
- "focus-visible:tw-outline-none",
7438
- // An open Radix Dialog locks `pointer-events: none` on <body>. Popover content
7439
- // is portalled to <body> as a sibling of the dialog, so it inherits the lock
7440
- // and clicks fall through — re-enable pointer events on the content itself
7441
- // (dismiss-on-outside-click still works, it listens on document).
7442
- "tw-pointer-events-auto",
7443
- // sizing
7444
- "tw-min-w-32",
7445
- "tw-max-h-[var(--radix-popover-content-available-height)]",
7446
- "tw-origin-[--radix-popover-content-transform-origin]",
7447
- // layout
7448
- "tw-flex",
7449
- "tw-flex-col",
7450
- "tw-overflow-y-auto",
7451
- // border
7452
- "tw-box-border",
7453
- "tw-border",
7454
- "tw-border-solid",
7455
- "tw-shadow-lg",
7456
- // open animation
7457
- "data-[state=open]:tw-animate-in",
7458
- "data-[state=open]:tw-fade-in-0",
7459
- "data-[state=open]:tw-zoom-in-95",
7460
- // closed animation
7461
- "data-[state=closed]:tw-animate-out",
7462
- "data-[state=closed]:tw-fade-out-0",
7463
- "data-[state=closed]:tw-zoom-out-95",
7464
- // position animation
7465
- "data-[side=bottom]:tw-slide-in-from-top-2",
7466
- "data-[side=left]:tw-slide-in-from-right-2",
7467
- "data-[side=right]:tw-slide-in-from-left-2",
7468
- "data-[side=top]:tw-slide-in-from-bottom-2",
7469
- // Default size for nested Lucide icons; callers can override on the icon.
7470
- "[&_svg.lucide:not([class*='tw-size-'])]:tw-size-4",
7471
- "[&_svg]:tw-shrink-0"
7472
- ],
7473
- {
7474
- defaultVariants: {
7475
- matchTriggerWidth: false,
7476
- variant: "default"
7477
- },
7478
- variants: {
7479
- variant: {
7480
- // Legacy surface — fixed white panel.
7481
- default: ["tw-rounded-md", "tw-border-neutral-100", "tw-bg-white", "tw-text-neutral-800"],
7482
- // Argo surface — semantic popover tokens (brand + dark aware).
7483
- argo: ["tw-rounded-2xl", "tw-border-border", "tw-bg-popover", "tw-text-popover-foreground"]
7484
- },
7485
- matchTriggerWidth: {
7486
- true: ["tw-w-[var(--radix-popover-trigger-width)]"],
7487
- false: []
7488
- }
7489
- }
7490
- }
7491
- );
7492
- var PopoverContent = ({
7493
- ref,
7494
- className,
7495
- align = "center",
7496
- sideOffset = 4,
7497
- matchTriggerWidth = false,
7498
- children,
7499
- onEscapeKeyDown,
7500
- ...props
7501
- }) => {
7502
- const effectiveVariant = useArgoDesign() ? "argo" : "default";
7503
- return /* @__PURE__ */ jsxRuntime.jsx(reactPopover.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
7504
- reactPopover.Content,
7505
- {
7506
- ref,
7507
- align: matchTriggerWidth ? "start" : align,
7508
- sideOffset,
7509
- className: cn(variants2({ className, matchTriggerWidth, variant: effectiveVariant })),
7510
- onEscapeKeyDown: (event) => {
7511
- event.stopPropagation();
7512
- onEscapeKeyDown?.(event);
7513
- },
7514
- ...props,
7515
- children
7516
- }
7517
- ) });
7518
- };
7519
- var Popover = (props) => /* @__PURE__ */ jsxRuntime.jsx(reactPopover.Root, { ...props });
7520
- Popover.Content = PopoverContent;
7521
- Popover.Trigger = reactPopover.Trigger;
7522
- Popover.Close = reactPopover.Close;
7523
- var DatePicker = ({
7524
- align = "end",
7525
- alignOffset = -18,
7526
- children,
7527
- defaultOpen,
7528
- onOpenChange,
7529
- open,
7530
- sideOffset = 12,
7531
- ...calendarProps
7532
- }) => /* @__PURE__ */ jsxRuntime.jsxs(Popover, { defaultOpen, open, onOpenChange, children: [
7533
- /* @__PURE__ */ jsxRuntime.jsx(Popover.Trigger, { asChild: true, children }),
7534
- /* @__PURE__ */ jsxRuntime.jsx(
7535
- Popover.Content,
7536
- {
7537
- align,
7538
- alignOffset,
7539
- className: "tw-w-auto tw-p-0",
7540
- sideOffset,
7541
- children: /* @__PURE__ */ jsxRuntime.jsx(Calendar, { ...calendarProps })
7542
- }
7543
- )
7544
- ] });
7545
- DatePicker.displayName = "DatePicker";
7546
-
7547
- // src/components/Input/utils.ts
7548
- var genInputTestId = (prefix = "") => {
7549
- const ps = createPrefixedString(prefix);
7550
- return {
7551
- toString: () => prefix,
7552
- inputWrapper: ps`input-wrapper`,
7553
- input: ps`input`,
7554
- clearButton: ps`clear-button`
7555
- };
7556
- };
7557
- var Input = ({
7558
- ref: forwardedRef,
7559
- state = "default",
7560
- sizing = "default",
7561
- className,
7562
- prefix = null,
7563
- rightSuffix = null,
7564
- rightSuffixVariant = "default",
7565
- leftSuffix = null,
7566
- allowClear = false,
7567
- onClear,
7568
- disabled = false,
7569
- testId: prefixTestId = "",
7570
- autoFocus = false,
7571
- id,
7572
- name,
7573
- variant,
7574
- readOnly,
7575
- type = "text",
7576
- focusVariant = "default",
7577
- onChange,
7578
- onBlur,
7579
- value,
7580
- defaultValue,
7581
- ...inputProps
7582
- }) => {
7583
- const [hasUncontrolledValue, setHasUncontrolledValue] = React26.useState(() => !!defaultValue);
7584
- const hasValue = !!value || hasUncontrolledValue;
7585
- const inputRef = React26.useRef(null);
7586
- const testId = genInputTestId(prefixTestId);
7587
- const isClearButtonVisible = hasValue && !disabled && !readOnly || !!onClear;
7588
- const handleChange = (event) => {
7589
- const val = event.target.value;
7590
- setHasUncontrolledValue(val !== "");
7591
- onChange?.(event);
7592
- };
7593
- const handleBlur = (event) => {
7594
- const val = event.target.value;
7595
- setHasUncontrolledValue(val !== "");
7596
- onBlur?.(event);
7597
- };
7598
- const handleClear = () => {
7599
- if (inputRef.current === null) return;
7600
- inputRef.current.value = "";
7601
- inputRef.current.focus();
7602
- onClear?.();
7603
- setHasUncontrolledValue(false);
7604
- onChange?.(createChangeInputEvent(inputRef.current));
7605
- };
7606
- const isControlled = value !== void 0;
7607
- const valueProp = isControlled ? { value: value ?? "" } : { defaultValue: defaultValue ?? "" };
7608
- return /* @__PURE__ */ jsxRuntime.jsxs(
7609
- InputGroup,
7610
- {
7611
- state,
7612
- variant,
7613
- sizing,
7614
- focusVariant,
7615
- className,
7616
- "data-testid": testId.inputWrapper,
7617
- children: [
7618
- prefix && /* @__PURE__ */ jsxRuntime.jsx(InputGroup.Addon, { align: "inline-start", children: prefix }),
7619
- /* @__PURE__ */ jsxRuntime.jsx(
7620
- InputGroup.Input,
7621
- {
7622
- ...inputProps,
7623
- ...valueProp,
7624
- autoFocus,
7625
- type,
7626
- onChange: handleChange,
7627
- onBlur: handleBlur,
7628
- ref: mergeRefs(forwardedRef ?? null, inputRef),
7629
- disabled,
7630
- id,
7631
- name,
7632
- readOnly,
7633
- "data-testid": testId.input
7634
- }
7635
- ),
7636
- (leftSuffix || allowClear || rightSuffix) && /* @__PURE__ */ jsxRuntime.jsxs(InputGroup.Addon, { align: "inline-end", children: [
7637
- leftSuffix,
7638
- allowClear && isClearButtonVisible && /* @__PURE__ */ jsxRuntime.jsx(
7639
- InputGroup.Button,
7640
- {
7641
- "aria-label": "Clear",
7642
- onMouseDown: (e) => e.preventDefault(),
7643
- onClick: handleClear,
7644
- "data-testid": testId.clearButton,
7645
- children: /* @__PURE__ */ jsxRuntime.jsx(icons_exports.X, { className: "tw-size-4" })
7646
- }
7647
- ),
7648
- rightSuffix && /* @__PURE__ */ jsxRuntime.jsx(
7649
- "div",
7650
- {
7651
- className: cn({
7652
- "tw-whitespace-nowrap tw-bg-muted tw-px-4 -tw-mr-4 tw-py-2.5": rightSuffixVariant === "addon"
7653
- }),
7654
- children: rightSuffix
7655
- }
7656
- )
7657
- ] })
7658
- ]
7659
- }
7660
- );
7661
- };
7662
-
7663
- // src/components/Input/DateInput/helpers.ts
7664
- var formatDate = (date, inputValue) => {
7665
- if (!date) {
7666
- return inputValue;
7667
- }
7668
- return date.toLocaleDateString();
7669
- };
7670
- var datePartOrder = new Intl.DateTimeFormat().formatToParts(new Date(2e3, 0, 2)).filter(
7671
- (p) => p.type === "day" || p.type === "month" || p.type === "year"
7672
- ).map((p) => p.type);
7673
- var parseDate = (value) => {
7674
- if (!value.trim()) return null;
7675
- const nums = value.match(/\d+/g)?.map(Number);
7676
- if (nums && nums.length >= 3) {
7677
- const parts = Object.fromEntries(datePartOrder.map((type, i) => [type, nums[i]]));
7678
- const year = parts.year;
7679
- const month = parts.month;
7680
- const day = parts.day;
7681
- if (year != null && month != null && day != null && month >= 1 && month <= 12 && day >= 1 && day <= 31) {
7682
- const date = new Date(year, month - 1, day);
7683
- if (date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day) {
7684
- return date;
7685
- }
7686
- }
7687
- }
7688
- const isoMatch = value.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);
7689
- if (isoMatch) {
7690
- const y = Number(isoMatch[1]);
7691
- const m = Number(isoMatch[2]) - 1;
7692
- const d = Number(isoMatch[3]);
7693
- const date = new Date(y, m, d);
7694
- if (date.getFullYear() === y && date.getMonth() === m && date.getDate() === d) {
7695
- return date;
7696
- }
7697
- return null;
7698
- }
7699
- const fallback = new Date(value);
7700
- return isNaN(fallback.getTime()) ? null : fallback;
7701
- };
7702
- var DateInput = ({
7703
- ref,
7704
- defaultValue,
7705
- disabled,
7706
- disabledDays,
7707
- endMonth,
7708
- onBlur,
7709
- onChange,
7710
- onValueBlur,
7711
- onValueChange,
7712
- placeholder = "Select a date",
7713
- readOnly,
7714
- startMonth,
7715
- value,
7716
- variant,
7717
- ...props
7718
- }) => {
7719
- const [inputValue, setInputValue] = React26.useState("");
7720
- const [hasFocus, setHasFocus] = React26.useState(false);
7721
- const [isOpen, setIsOpen] = React26.useState(false);
7722
- const [internalValue, setInternalValue] = React26.useState(defaultValue ?? null);
7723
- const [month, setMonth2] = React26.useState(/* @__PURE__ */ new Date());
7724
- const isControlled = value !== void 0;
7725
- const currentValue = isControlled ? value : internalValue;
7726
- const handleChange = (event) => {
7727
- const newValue = event.target.value;
7728
- setInputValue(newValue);
7729
- onChange?.(event);
7730
- const parsedDate = parseDate(newValue);
7731
- if (parsedDate !== null || !newValue.trim()) {
7732
- onValueChange?.(parsedDate);
7733
- }
7734
- };
7735
- const handleFocus = (event) => {
7736
- const formatted = formatDate(currentValue, "");
7737
- setInputValue(formatted);
7738
- setHasFocus(true);
7739
- props.onFocus?.(event);
7740
- };
7741
- const handleBlur = (event) => {
7742
- setHasFocus(false);
7743
- onBlur?.(event);
7744
- const parsedDate = parseDate(event.target.value);
7745
- onValueBlur?.(parsedDate);
7746
- if (!isControlled) {
7747
- setInternalValue(parsedDate);
7748
- }
7749
- };
7750
- const handleDatePickerChange = (newValue) => {
7751
- const dateValue = newValue ?? null;
7752
- if (isControlled) {
7753
- onValueChange?.(dateValue);
7754
- } else {
7755
- setInternalValue(dateValue);
7756
- onValueChange?.(dateValue);
7757
- }
7758
- setHasFocus(false);
7759
- setIsOpen(false);
7760
- };
7761
- const handleClear = () => {
7762
- setInputValue("");
7763
- setInternalValue(null);
7764
- onValueChange?.(null);
7765
- };
7766
- const handleOpenChange = (open) => {
7767
- if (open) {
7768
- setMonth2(currentValue ?? /* @__PURE__ */ new Date());
7769
- }
7770
- setIsOpen(open);
7771
- };
7772
- const displayValue = hasFocus ? inputValue : formatDate(currentValue, "");
7773
- return /* @__PURE__ */ jsxRuntime.jsx(
7774
- Input,
7775
- {
7776
- ...props,
7777
- disabled,
7778
- onBlur: handleBlur,
7779
- onChange: handleChange,
7780
- onClear: handleClear,
7781
- onFocus: handleFocus,
7782
- placeholder,
7783
- readOnly,
7784
- ref,
7785
- value: displayValue,
7786
- variant,
7787
- rightSuffix: !disabled && !readOnly ? /* @__PURE__ */ jsxRuntime.jsx(
7788
- DatePicker,
7789
- {
7790
- disabled: disabledDays,
7791
- endMonth,
7792
- mode: "single",
7793
- month,
7794
- onMonthChange: setMonth2,
7795
- onOpenChange: handleOpenChange,
7796
- onSelect: handleDatePickerChange,
7797
- open: isOpen,
7798
- selected: currentValue ?? void 0,
7799
- startMonth,
7800
- children: /* @__PURE__ */ jsxRuntime.jsx(Button, { "aria-label": "Select Date", variant: "inline", size: "icon-3xs", children: /* @__PURE__ */ jsxRuntime.jsx(icons_exports.Calendar, { className: "tw-size-4" }) })
7801
- }
7802
- ) : void 0,
7803
- type: "text"
7804
- }
7805
- );
7806
- };
7807
- var sanitizeTextInputValue = (value) => {
7808
- if (typeof value === "string" && value.trim() === "") return "";
7809
- return value;
7810
- };
7811
- var TextInput = ({
7812
- ref,
7813
- value,
7814
- defaultValue,
7815
- type = "text",
7816
- variant,
7817
- onValueChange,
7818
- onChange,
7819
- onValueBlur,
7820
- onBlur,
7821
- ...props
7822
- }) => {
7823
- const handleChange = (event) => {
7824
- onValueChange?.(event.target.value);
7825
- onChange?.(event);
7826
- };
7827
- const handleBlur = (event) => {
7828
- onValueBlur?.(event.target.value);
7829
- onBlur?.(event);
7830
- };
7831
- return /* @__PURE__ */ jsxRuntime.jsx(
7832
- Input,
7833
- {
7834
- ...props,
7835
- ref,
7836
- onChange: handleChange,
7837
- onBlur: handleBlur,
7838
- type,
7839
- variant,
7840
- value: sanitizeTextInputValue(value),
7841
- defaultValue: sanitizeTextInputValue(defaultValue)
7842
- }
7843
- );
7844
- };
7845
- var FormGroupTextInput = ({
7846
- ref,
7847
- ...props
7848
- }) => {
7849
- const { state } = useFormGroupContext();
7850
- return /* @__PURE__ */ jsxRuntime.jsx(TextInput, { state, ...props, ref });
7851
- };
7852
- var FormGroup = ({ className, children, state, ...rest }) => {
7853
- return /* @__PURE__ */ jsxRuntime.jsx(FormGroupProvider, { value: { state }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ...rest, className: cn("tw-flex tw-flex-col tw-gap-1", className), children }) });
7854
- };
7855
- FormGroup.Help = FormGroupHelp;
7856
- FormGroup.Error = FormGroupError;
7857
- FormGroup.TextInput = FormGroupTextInput;
7858
- FormGroup.NumberInput = FormGroupNumberInput;
7859
- FormGroup.ColorInput = FormGroupColorInput;
7860
- FormGroup.Textarea = FormGroupTextarea;
7861
- var Optional = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("span", { ...props, "aria-hidden": true, className: cn("tw-ml-0.5", "tw-text-muted-foreground", className), children: "(optional)" });
7862
- var Required = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("span", { ...props, "aria-hidden": true, className: cn("tw-ml-0.5", "tw-text-primary", className), children: "*" });
7863
- var Label = ({ className, children, id, htmlFor, ...rest }) => /* @__PURE__ */ jsxRuntime.jsx(
7864
- RLabel__namespace.Root,
7865
- {
7866
- ...rest,
7867
- id: id?.toString(),
7868
- htmlFor: htmlFor?.toString(),
7869
- className: cn(
7870
- "tw-m-0 tw-text-foreground tw-font-normal peer-disabled:tw-opacity-50",
7871
- className
7872
- ),
7873
- children
7874
- }
7875
- );
7876
- Label.Optional = Optional;
7877
- Label.Required = Required;
7878
- var Link = ({
7879
- ref,
7880
- children,
7881
- target = "_blank",
7882
- rel = "noopener noreferrer",
7883
- onClick,
7884
- className,
7885
- ...rest
7886
- }) => {
7887
- const handleOnClick = (event) => {
7888
- event.stopPropagation();
7889
- onClick?.(event);
7890
- };
7891
- return (
7892
- // oxlint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
7893
- /* @__PURE__ */ jsxRuntime.jsx(
7894
- "a",
7895
- {
7896
- ...rest,
7897
- ref,
7898
- target,
7899
- rel,
7900
- onClick: handleOnClick,
7901
- className: cn(
7902
- "tw-text-primary tw-underline hover:tw-text-primary/90 hover:tw-no-underline",
7903
- className
7904
- ),
7905
- children
7906
- }
7907
- )
7908
- );
7909
- };
7910
- var RootFormDataContext = React26.createContext({});
7911
- var RootFormDataProvider = RootFormDataContext;
7912
- var useRootFormData = () => React26.use(RootFormDataContext);
7913
- var resolveByPath2 = (parts, data) => {
7914
- let current = data;
7915
- for (const part of parts) {
7916
- if (current == null || typeof current !== "object") return void 0;
7917
- current = current[part];
7918
- }
7919
- return current;
7920
- };
7921
- var resolveDependencyValue = (path, formData, parentPath) => {
7922
- if (path.startsWith("root.")) {
7923
- return resolveByPath2(path.replace(/^root\./, "").split("."), formData);
7924
- }
7925
- const parent = resolveByPath2(parentPath.map(String), formData);
7926
- if (parent && typeof parent === "object") {
7927
- const sibling = resolveByPath2(path.split("."), parent);
7928
- if (sibling !== void 0) return sibling;
7929
- }
7930
- return resolveByPath2(path.split("."), formData);
7931
- };
7932
- var evaluateDependencies = (dependencies, formData, parentPath) => {
7933
- for (const [path, expected] of Object.entries(dependencies)) {
7934
- const actual = resolveDependencyValue(path, formData, parentPath);
7935
- if (Array.isArray(expected)) {
7936
- if (!expected.includes(actual)) return false;
7937
- } else if (expected === "") {
7938
- if (actual !== "" && actual !== void 0 && actual !== null) return false;
7939
- } else {
7940
- if (actual !== expected) return false;
7941
- }
7942
- }
7943
- return true;
7944
- };
7945
- var DocumentationLinkIcon = ({
7946
- documentation
7947
- }) => /* @__PURE__ */ jsxRuntime.jsx(
7948
- Tooltip,
7949
- {
7950
- placement: "top",
7951
- variant: "explanatory",
7952
- tooltip: documentation.tooltip ?? "Open documentation",
7953
- triggerAsChild: true,
7954
- children: /* @__PURE__ */ jsxRuntime.jsx(Link, { href: documentation.link, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tw-cursor-pointer tw-text-neutral-400 hover:tw-text-neutral-600", children: /* @__PURE__ */ jsxRuntime.jsx(icons_exports.BookOpen, { className: "tw-size-4" }) }) })
7955
- }
7956
- );
7957
- var FieldTemplateBody = ({
7958
- id,
7959
- label,
7960
- rawHelp,
7961
- rawDescription,
7962
- rawErrors,
7963
- children,
7964
- schema,
7965
- uiSchema,
7966
- displayLabel
7967
- }) => {
7968
- const widget = uiSchema?.["ui:widget"];
7969
- if (widget === "test-connection" || widget === "sync-action") {
7970
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
7971
- }
7972
- if (schema.type === "object") {
7973
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
7974
- }
7975
- if (schema.type === "array" && !uiSchema?.["ui:widget"]) {
7976
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
7977
- }
7978
- const uiOptions = uiSchema?.["ui:options"];
7979
- const documentation = uiOptions?.documentation;
7980
- const hasErrors = rawErrors && rawErrors.length > 0;
7981
- const isCheckbox = schema.type === "boolean" && uiSchema?.["ui:widget"] !== "select";
7982
- const showLabel = displayLabel && label && !isCheckbox;
7983
- const hasHelpIcons = Boolean(rawHelp || documentation);
7984
- const helpIcons = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7985
- rawHelp && /* @__PURE__ */ jsxRuntime.jsx(TooltipIcon, { rawHelp }),
7986
- documentation && /* @__PURE__ */ jsxRuntime.jsx(DocumentationLinkIcon, { documentation })
7987
- ] });
7988
- return /* @__PURE__ */ jsxRuntime.jsxs(FormGroup, { state: hasErrors ? "error" : "default", children: [
7989
- showLabel && /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: id, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "tw-inline-flex tw-items-center tw-gap-1", children: [
7990
- label,
7991
- helpIcons
7992
- ] }) }),
7993
- !showLabel && !isCheckbox && hasHelpIcons && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tw-flex tw-items-center tw-gap-1", children: helpIcons }),
7994
- isCheckbox && hasHelpIcons ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [
7995
- children,
7996
- helpIcons
7997
- ] }) : children,
7998
- rawDescription && /* @__PURE__ */ jsxRuntime.jsx(FormGroup.Help, { children: /* @__PURE__ */ jsxRuntime.jsx("span", { dangerouslySetInnerHTML: { __html: DOMPurify__default.default.sanitize(rawDescription) } }) }),
7999
- hasErrors && /* @__PURE__ */ jsxRuntime.jsx(FormGroup.Help, { children: rawErrors.join(". ") })
8000
- ] });
8001
- };
8002
- var FieldTemplateWithDependencies = ({
8003
- dependencies,
8004
- ...props
8005
- }) => {
8006
- const rootFormData = useRootFormData();
8007
- const parentPath = props.fieldPathId.path.slice(0, -1);
8008
- if (!evaluateDependencies(dependencies, rootFormData, parentPath)) {
8009
- return null;
8010
- }
8011
- return /* @__PURE__ */ jsxRuntime.jsx(FieldTemplateBody, { ...props });
8012
- };
8013
- var FieldTemplate = (props) => {
8014
- if (props.hidden) return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tw-hidden", children: props.children });
8015
- if (props.uiSchema?.["ui:widget"] === "template-watch") {
8016
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tw-hidden", children: props.children });
8017
- }
8018
- const uiOptions = props.uiSchema?.["ui:options"];
8019
- const dependencies = uiOptions?.dependencies;
8020
- if (dependencies) {
8021
- return /* @__PURE__ */ jsxRuntime.jsx(FieldTemplateWithDependencies, { dependencies, ...props });
8022
- }
8023
- return /* @__PURE__ */ jsxRuntime.jsx(FieldTemplateBody, { ...props });
8024
- };
8025
- var ObjectFieldTemplate = ({
8026
- title,
8027
- description,
8028
- properties,
8029
- formData,
8030
- uiSchema,
8031
- schema,
8032
- fieldPathId
8033
- }) => {
8034
- const isRoot = !fieldPathId?.path?.length;
8035
- const uiOptions = uiSchema?.["ui:options"];
8036
- const hasCollapsed = uiOptions?.collapsed !== void 0;
8037
- const collapsed = !!uiOptions?.collapsed;
8038
- const disableCollapse = !!uiOptions?.disableCollapse;
8039
- const lastPathSegment = fieldPathId?.path?.at(-1);
8040
- const isArrayItem = typeof lastPathSegment === "number";
8041
- const childSchemas = schema.properties;
8042
- const isContainerSchema = (s) => {
8043
- if (!s) return false;
8044
- if (s.properties || s.items) return true;
8045
- if (Array.isArray(s.type)) return s.type.includes("object") || s.type.includes("array");
8046
- return s.type === "object" || s.type === "array";
8047
- };
8048
- const visibleProperties = properties.filter((prop) => {
8049
- const childUi = uiSchema?.[prop.name];
8050
- if (childUi?.["ui:widget"] !== "hidden") return true;
8051
- return !isContainerSchema(childSchemas?.[prop.name]);
8052
- });
8053
- const isHiddenMount = (name) => {
8054
- const w = uiSchema?.[name]?.["ui:widget"];
8055
- return w === "hidden" || w === "template-watch";
8056
- };
8057
- const renderChildren = (props) => props.map((prop) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: isHiddenMount(prop.name) ? "tw-hidden" : void 0, children: prop.content }, prop.name));
8058
- if (isRoot) {
8059
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden", children: renderChildren(visibleProperties) });
8060
- }
8061
- const childrenContent = renderChildren(visibleProperties);
8062
- if (hasCollapsed && !disableCollapse) {
8063
- const data = formData ?? {};
8064
- const hasValues = Object.values(data).some(
8065
- (v) => v !== void 0 && v !== null && v !== "" && v !== false
8066
- );
8067
- const defaultExpanded = hasValues ? !collapsed : true;
8068
- return /* @__PURE__ */ jsxRuntime.jsxs(
8069
- CollapsiblePanel,
8070
- {
8071
- className: "tw-rounded-lg",
8072
- headerClassName: "tw-rounded-lg",
8073
- header: title || "Settings",
8074
- defaultExpanded,
8075
- bodyClassName: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden",
8076
- children: [
8077
- description,
8078
- childrenContent
8079
- ]
8080
- }
8081
- );
8082
- }
8083
- if (isArrayItem) {
8084
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden", children: childrenContent });
8085
- }
8086
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tw-rounded-lg tw-border tw-border-solid tw-border-neutral-200 tw-bg-white tw-p-4", children: [
8087
- title && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "tw-mb-2 tw-text-base tw-font-medium tw-text-neutral-800", children: title }),
8088
- description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "tw-mb-3 tw-text-xs tw-text-neutral-400", children: description }),
8089
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tw-flex tw-flex-col tw-gap-4 [&>div:empty]:tw-hidden", children: childrenContent })
8090
- ] });
8091
- };
8092
- var FieldBoxDescription = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
8093
- "span",
8094
- {
8095
- ...props,
8096
- "data-slot": "field-box-description",
8097
- className: cn(
8098
- "tw-text-xs",
8099
- "tw-text-muted-foreground",
8100
- "group-has-[:disabled]/field-box:tw-opacity-50",
8101
- className
8102
- )
8103
- }
8104
- );
8105
- var FieldBoxTitle = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
8106
- "span",
8107
- {
8108
- ...props,
8109
- "data-slot": "field-box-title",
8110
- className: cn(
8111
- "tw-text-sm",
8112
- "tw-font-medium",
8113
- "tw-text-foreground",
8114
- "group-has-[:disabled]/field-box:tw-cursor-not-allowed",
8115
- "group-has-[:disabled]/field-box:tw-opacity-50",
8116
- className
7890
+ clip: "rect(0 0 0 0)",
7891
+ height: "1px",
7892
+ margin: "-1px",
7893
+ overflow: "hidden",
7894
+ padding: 0,
7895
+ position: "absolute",
7896
+ width: "1px",
7897
+ whiteSpace: "nowrap",
7898
+ wordWrap: "normal"
7899
+ } }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))
7900
+ ) : React26__default.default.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))),
7901
+ navLayout === "around" && !props.hideNavigation && displayIndex === numberOfMonths - 1 && React26__default.default.createElement(
7902
+ components.NextMonthButton,
7903
+ { 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 },
7904
+ React26__default.default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" })
7905
+ ),
7906
+ displayIndex === numberOfMonths - 1 && navLayout === "after" && !props.hideNavigation && React26__default.default.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 }),
7907
+ React26__default.default.createElement(
7908
+ components.MonthGrid,
7909
+ { 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] },
7910
+ !props.hideWeekdays && React26__default.default.createElement(
7911
+ components.Weekdays,
7912
+ { "data-animated-weekdays": props.animate ? "true" : void 0, className: classNames[UI.Weekdays], style: styles?.[UI.Weekdays] },
7913
+ showWeekNumber && React26__default.default.createElement(components.WeekNumberHeader, { "aria-label": labelWeekNumberHeader2(dateLib.options), className: classNames[UI.WeekNumberHeader], style: styles?.[UI.WeekNumberHeader], scope: "col" }, formatWeekNumberHeader2()),
7914
+ weekdays.map((weekday) => React26__default.default.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)))
7915
+ ),
7916
+ React26__default.default.createElement(components.Weeks, { "data-animated-weeks": props.animate ? "true" : void 0, className: classNames[UI.Weeks], style: styles?.[UI.Weeks] }, calendarMonth.weeks.map((week) => {
7917
+ return React26__default.default.createElement(
7918
+ components.Week,
7919
+ { className: classNames[UI.Week], key: week.weekNumber, style: styles?.[UI.Week], week },
7920
+ showWeekNumber && React26__default.default.createElement(components.WeekNumber, { week, style: styles?.[UI.WeekNumber], "aria-label": labelWeekNumber2(week.weekNumber, {
7921
+ locale
7922
+ }), className: classNames[UI.WeekNumber], scope: "row", role: "rowheader" }, formatWeekNumber2(week.weekNumber, dateLib)),
7923
+ week.days.map((day) => {
7924
+ const { date } = day;
7925
+ const modifiers = getModifiers(day);
7926
+ modifiers[DayFlag.focused] = !modifiers.hidden && Boolean(focused?.isEqualTo(day));
7927
+ modifiers[SelectionState.selected] = isSelected?.(date) || modifiers.selected;
7928
+ if (isDateRange(selectedValue)) {
7929
+ const { from, to } = selectedValue;
7930
+ modifiers[SelectionState.range_start] = Boolean(from && to && dateLib.isSameDay(date, from));
7931
+ modifiers[SelectionState.range_end] = Boolean(from && to && dateLib.isSameDay(date, to));
7932
+ modifiers[SelectionState.range_middle] = rangeIncludesDate(selectedValue, date, true, dateLib);
7933
+ }
7934
+ const style2 = getStyleForModifiers(modifiers, styles, props.modifiersStyles);
7935
+ const className2 = getClassNamesForModifiers(modifiers, classNames, props.modifiersClassNames);
7936
+ const ariaLabel = !isInteractive && !modifiers.hidden ? labelGridcell2(date, modifiers, dateLib.options, dateLib) : void 0;
7937
+ return React26__default.default.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__default.default.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));
7938
+ })
7939
+ );
7940
+ }))
7941
+ )
7942
+ );
7943
+ })
7944
+ ),
7945
+ props.footer && React26__default.default.createElement(components.Footer, { className: classNames[UI.Footer], style: styles?.[UI.Footer], role: "status", "aria-live": "polite" }, props.footer)
8117
7946
  )
8118
- }
8119
- );
8120
- var fieldBoxVariants = classVarianceAuthority.cva(
8121
- [
8122
- "tw-group/field-box",
8123
- "tw-m-0",
8124
- "tw-inline-flex",
8125
- "tw-gap-3",
8126
- "tw-items-center",
8127
- "has-[[data-slot=field-box-description]]:tw-items-start",
8128
- "tw-cursor-pointer",
8129
- "tw-select-none",
8130
- "has-[:disabled]:tw-cursor-not-allowed"
8131
- ],
8132
- {
8133
- variants: {
8134
- variant: {
8135
- default: [],
8136
- boxed: [
8137
- "tw-rounded-lg",
8138
- "tw-border",
8139
- "tw-border-solid",
8140
- "tw-border-border",
8141
- "tw-p-3",
8142
- "tw-transition-colors",
8143
- "has-[[data-state=checked]]:tw-border-primary",
8144
- "has-[[data-state=checked]]:tw-bg-accent",
8145
- "has-[[data-state=indeterminate]]:tw-border-primary",
8146
- "has-[[data-state=indeterminate]]:tw-bg-accent"
8147
- ]
8148
- }
8149
- },
8150
- defaultVariants: {
8151
- variant: "default"
7947
+ );
7948
+ }
7949
+ var dayPickerClassNames = {
7950
+ 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`
7951
+ };
7952
+ var rangePickerClassNames = {
7953
+ 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`,
7954
+ 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`,
7955
+ selected: `tw-font-medium tw-rounded`,
7956
+ range_middle: `tw-bg-accent tw-border-accent tw-text-accent-foreground tw-rounded-none tw-font-medium`
7957
+ };
7958
+ var Calendar = ({ className, classNames, ...props }) => {
7959
+ const defaultClassNames = getDefaultClassNames();
7960
+ return /* @__PURE__ */ jsxRuntime.jsx(
7961
+ DayPicker,
7962
+ {
7963
+ ...props,
7964
+ captionLayout: "dropdown",
7965
+ className: cn(className, "tw-p-3"),
7966
+ classNames: {
7967
+ chevron: `${defaultClassNames.chevron} tw-fill-foreground`,
7968
+ day: `${defaultClassNames.day} hover:tw-bg-accent tw-rounded`,
7969
+ day_button: `${defaultClassNames.day_button} tw-rounded`,
7970
+ today: `tw-bg-accent tw-text-accent-foreground tw-font-medium`,
7971
+ ...dayPickerClassNames,
7972
+ ...rangePickerClassNames,
7973
+ selected: `${props.mode === "range" ? rangePickerClassNames.selected : dayPickerClassNames.selected}`,
7974
+ ...classNames
7975
+ },
7976
+ required: false
8152
7977
  }
8153
- }
8154
- );
8155
- var FieldBoxRoot = ({
8156
- ref,
8157
- className,
8158
- variant,
8159
- position = "start",
8160
- control,
8161
- children,
8162
- ...rest
8163
- }) => /* @__PURE__ */ jsxRuntime.jsxs(
8164
- "label",
8165
- {
8166
- ...rest,
8167
- ref,
8168
- className: cn(
8169
- fieldBoxVariants({ variant, className }),
8170
- position === "end" && "tw-flex-row-reverse"
8171
- ),
8172
- children: [
8173
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tw-inline-flex tw-min-h-5 tw-shrink-0 tw-items-center", children: control }),
8174
- children != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tw-flex tw-flex-1 tw-flex-col tw-gap-0.5", children })
8175
- ]
8176
- }
8177
- );
8178
- var FieldBox = Object.assign(FieldBoxRoot, {
8179
- Title: FieldBoxTitle,
8180
- Description: FieldBoxDescription
8181
- });
8182
- var rootVariants = classVarianceAuthority.cva(
7978
+ );
7979
+ };
7980
+ Calendar.displayName = "Calendar";
7981
+ var variants2 = classVarianceAuthority.cva(
8183
7982
  [
8184
- // reset
8185
7983
  "tailwindcss-preflight",
8186
- // position
7984
+ "tw-group/popover-content",
7985
+ "tw-z-[1055]",
7986
+ "focus-visible:tw-outline-none",
7987
+ // An open Radix Dialog locks `pointer-events: none` on <body>. Popover content
7988
+ // is portalled to <body> as a sibling of the dialog, so it inherits the lock
7989
+ // and clicks fall through — re-enable pointer events on the content itself
7990
+ // (dismiss-on-outside-click still works, it listens on document).
7991
+ "tw-pointer-events-auto",
7992
+ // sizing
7993
+ "tw-min-w-32",
7994
+ "tw-max-h-[var(--radix-popover-content-available-height)]",
7995
+ "tw-origin-[--radix-popover-content-transform-origin]",
7996
+ // layout
8187
7997
  "tw-flex",
8188
- "tw-items-center",
8189
- "tw-justify-center",
8190
- "tw-peer",
8191
- "tw-size-4",
8192
- "tw-shrink-0",
8193
- "tw-cursor-pointer",
7998
+ "tw-flex-col",
7999
+ "tw-overflow-y-auto",
8194
8000
  // border
8001
+ "tw-box-border",
8195
8002
  "tw-border",
8196
8003
  "tw-border-solid",
8197
- // disabled
8198
- "disabled:tw-opacity-50",
8199
- "disabled:tw-cursor-not-allowed"
8004
+ "tw-shadow-lg",
8005
+ // open animation
8006
+ "data-[state=open]:tw-animate-in",
8007
+ "data-[state=open]:tw-fade-in-0",
8008
+ "data-[state=open]:tw-zoom-in-95",
8009
+ // closed animation
8010
+ "data-[state=closed]:tw-animate-out",
8011
+ "data-[state=closed]:tw-fade-out-0",
8012
+ "data-[state=closed]:tw-zoom-out-95",
8013
+ // position animation
8014
+ "data-[side=bottom]:tw-slide-in-from-top-2",
8015
+ "data-[side=left]:tw-slide-in-from-right-2",
8016
+ "data-[side=right]:tw-slide-in-from-left-2",
8017
+ "data-[side=top]:tw-slide-in-from-bottom-2",
8018
+ // Default size for nested Lucide icons; callers can override on the icon.
8019
+ "[&_svg.lucide:not([class*='tw-size-'])]:tw-size-4",
8020
+ "[&_svg]:tw-shrink-0"
8200
8021
  ],
8201
8022
  {
8202
8023
  defaultVariants: {
8024
+ matchTriggerWidth: false,
8203
8025
  variant: "default"
8204
8026
  },
8205
8027
  variants: {
8206
8028
  variant: {
8207
- default: [
8208
- "tw-rounded",
8209
- "tw-border-neutral-200",
8210
- "data-[state=checked]:tw-bg-primary",
8211
- "data-[state=checked]:tw-border-primary",
8212
- "data-[state=indeterminate]:tw-bg-white",
8213
- "data-[state=indeterminate]:tw-border-neutral-200"
8214
- ],
8215
- argo: [
8216
- "tw-rounded",
8217
- "tw-border-input",
8218
- "tw-transition-colors",
8219
- "data-[state=checked]:tw-bg-primary",
8220
- "data-[state=checked]:tw-border-primary",
8221
- "data-[state=indeterminate]:tw-bg-primary",
8222
- "data-[state=indeterminate]:tw-border-primary",
8223
- // focus
8224
- "focus-visible:tw-outline-none",
8225
- "focus-visible:tw-border-primary",
8226
- "focus-visible:tw-ring-2",
8227
- "focus-visible:tw-ring-ring/50"
8228
- ]
8029
+ // Legacy surface — fixed white panel.
8030
+ default: ["tw-rounded-md", "tw-border-neutral-100", "tw-bg-white", "tw-text-neutral-800"],
8031
+ // Argo surface — semantic popover tokens (brand + dark aware).
8032
+ argo: ["tw-rounded-2xl", "tw-border-border", "tw-bg-popover", "tw-text-popover-foreground"]
8033
+ },
8034
+ matchTriggerWidth: {
8035
+ true: ["tw-w-[var(--radix-popover-trigger-width)]"],
8036
+ false: []
8037
+ }
8038
+ }
8039
+ }
8040
+ );
8041
+ var PopoverContent = ({
8042
+ ref,
8043
+ className,
8044
+ align = "center",
8045
+ sideOffset = 4,
8046
+ matchTriggerWidth = false,
8047
+ children,
8048
+ onEscapeKeyDown,
8049
+ ...props
8050
+ }) => {
8051
+ const effectiveVariant = useArgoDesign() ? "argo" : "default";
8052
+ return /* @__PURE__ */ jsxRuntime.jsx(reactPopover.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
8053
+ reactPopover.Content,
8054
+ {
8055
+ ref,
8056
+ align: matchTriggerWidth ? "start" : align,
8057
+ sideOffset,
8058
+ className: cn(variants2({ className, matchTriggerWidth, variant: effectiveVariant })),
8059
+ onEscapeKeyDown: (event) => {
8060
+ event.stopPropagation();
8061
+ onEscapeKeyDown?.(event);
8062
+ },
8063
+ ...props,
8064
+ children
8065
+ }
8066
+ ) });
8067
+ };
8068
+ var Popover = (props) => /* @__PURE__ */ jsxRuntime.jsx(reactPopover.Root, { ...props });
8069
+ Popover.Content = PopoverContent;
8070
+ Popover.Trigger = reactPopover.Trigger;
8071
+ Popover.Close = reactPopover.Close;
8072
+ var DatePicker = ({
8073
+ align = "end",
8074
+ alignOffset = -18,
8075
+ children,
8076
+ defaultOpen,
8077
+ onOpenChange,
8078
+ open,
8079
+ sideOffset = 12,
8080
+ ...calendarProps
8081
+ }) => /* @__PURE__ */ jsxRuntime.jsxs(Popover, { defaultOpen, open, onOpenChange, children: [
8082
+ /* @__PURE__ */ jsxRuntime.jsx(Popover.Trigger, { asChild: true, children }),
8083
+ /* @__PURE__ */ jsxRuntime.jsx(
8084
+ Popover.Content,
8085
+ {
8086
+ align,
8087
+ alignOffset,
8088
+ className: "tw-w-auto tw-p-0",
8089
+ sideOffset,
8090
+ children: /* @__PURE__ */ jsxRuntime.jsx(Calendar, { ...calendarProps })
8091
+ }
8092
+ )
8093
+ ] });
8094
+ DatePicker.displayName = "DatePicker";
8095
+
8096
+ // src/blocks/DateInput/helpers.ts
8097
+ var formatDate = (date, inputValue) => {
8098
+ if (!date) {
8099
+ return inputValue;
8100
+ }
8101
+ return date.toLocaleDateString();
8102
+ };
8103
+ var datePartOrder = new Intl.DateTimeFormat().formatToParts(new Date(2e3, 0, 2)).filter(
8104
+ (p) => p.type === "day" || p.type === "month" || p.type === "year"
8105
+ ).map((p) => p.type);
8106
+ var parseDate = (value) => {
8107
+ if (!value.trim()) return null;
8108
+ const nums = value.match(/\d+/g)?.map(Number);
8109
+ if (nums && nums.length >= 3) {
8110
+ const parts = Object.fromEntries(datePartOrder.map((type, i) => [type, nums[i]]));
8111
+ const year = parts.year;
8112
+ const month = parts.month;
8113
+ const day = parts.day;
8114
+ if (year != null && month != null && day != null && month >= 1 && month <= 12 && day >= 1 && day <= 31) {
8115
+ const date = new Date(year, month - 1, day);
8116
+ if (date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day) {
8117
+ return date;
8229
8118
  }
8230
8119
  }
8231
8120
  }
8232
- );
8233
- var indicatorVariants = classVarianceAuthority.cva(["tw-group", "tw-flex", "tw-items-center"], {
8234
- defaultVariants: {
8235
- variant: "default"
8236
- },
8237
- variants: {
8238
- variant: {
8239
- default: [
8240
- "data-[state=checked]:tw-text-primary-foreground",
8241
- "data-[state=indeterminate]:tw-text-neutral-200"
8242
- ],
8243
- argo: ["tw-text-primary-foreground"]
8121
+ const isoMatch = value.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);
8122
+ if (isoMatch) {
8123
+ const y = Number(isoMatch[1]);
8124
+ const m = Number(isoMatch[2]) - 1;
8125
+ const d = Number(isoMatch[3]);
8126
+ const date = new Date(y, m, d);
8127
+ if (date.getFullYear() === y && date.getMonth() === m && date.getDate() === d) {
8128
+ return date;
8244
8129
  }
8130
+ return null;
8245
8131
  }
8246
- });
8247
- function Checkbox({
8248
- className,
8249
- id: idProp,
8250
- children,
8251
- description,
8132
+ const fallback = new Date(value);
8133
+ return isNaN(fallback.getTime()) ? null : fallback;
8134
+ };
8135
+ var DateInput = ({
8136
+ ref,
8137
+ // group props
8138
+ state,
8252
8139
  variant,
8253
- position,
8254
- tooltip,
8255
- tooltipPlacement = "top",
8256
- ...rest
8257
- }) {
8258
- const fallbackId = React26.useId();
8259
- const id = idProp?.toString() ?? fallbackId;
8260
- const styleVariant = useArgoDesign() ? "argo" : "default";
8261
- const checkboxElement = /* @__PURE__ */ jsxRuntime.jsx(reactCheckbox.Root, { id, ...rest, className: cn(rootVariants({ variant: styleVariant, className })), children: /* @__PURE__ */ jsxRuntime.jsxs(reactCheckbox.Indicator, { className: cn(indicatorVariants({ variant: styleVariant })), children: [
8262
- /* @__PURE__ */ jsxRuntime.jsx(icons_exports.Check, { className: "tw-hidden tw-size-3 tw-stroke-[4px] group-data-[state=checked]:tw-block" }),
8263
- /* @__PURE__ */ jsxRuntime.jsx(icons_exports.Minus, { className: "tw-hidden tw-size-3 tw-stroke-[4px] group-data-[state=indeterminate]:tw-block" })
8264
- ] }) });
8265
- const rendered = !children ? checkboxElement : /* @__PURE__ */ jsxRuntime.jsxs(FieldBox, { htmlFor: id, variant, position, control: checkboxElement, children: [
8266
- /* @__PURE__ */ jsxRuntime.jsx(FieldBox.Title, { children }),
8267
- description && /* @__PURE__ */ jsxRuntime.jsx(FieldBox.Description, { children: description })
8268
- ] });
8269
- if (!tooltip) return rendered;
8270
- return /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { tooltip, placement: tooltipPlacement, triggerAsChild: !!children, children: rendered });
8271
- }
8272
- var CheckboxWidget = ({
8273
- id,
8140
+ focusVariant,
8141
+ sizing,
8142
+ className,
8143
+ // own props
8274
8144
  value,
8145
+ defaultValue,
8146
+ onValueChange,
8147
+ onValueBlur,
8275
8148
  onChange,
8149
+ onBlur,
8150
+ onFocus,
8151
+ allowClear = false,
8152
+ disabledDays,
8153
+ endMonth,
8154
+ startMonth,
8155
+ // input props
8276
8156
  disabled,
8277
- readonly,
8278
- label,
8279
- hideLabel
8157
+ readOnly,
8158
+ placeholder = "Select a date",
8159
+ ...restInputProps
8280
8160
  }) => {
8281
- const checked = !!value;
8282
- return /* @__PURE__ */ jsxRuntime.jsx(Checkbox, { id, checked, onCheckedChange: onChange, disabled: disabled || readonly, children: hideLabel ? void 0 : label });
8161
+ const inputRef = React26.useRef(null);
8162
+ const [inputValue, setInputValue] = React26.useState("");
8163
+ const [hasFocus, setHasFocus] = React26.useState(false);
8164
+ const [isOpen, setIsOpen] = React26.useState(false);
8165
+ const [month, setMonth2] = React26.useState(/* @__PURE__ */ new Date());
8166
+ const [currentValue, setCurrentValue] = useControllableState({
8167
+ prop: value,
8168
+ defaultProp: defaultValue ?? null
8169
+ });
8170
+ const canClear = allowClear && !!currentValue && !disabled && !readOnly;
8171
+ const showPicker2 = !disabled && !readOnly;
8172
+ const handleChange = (event) => {
8173
+ const newValue = event.target.value;
8174
+ setInputValue(newValue);
8175
+ onChange?.(event);
8176
+ const parsedDate = parseDate(newValue);
8177
+ if (parsedDate !== null || !newValue.trim()) {
8178
+ onValueChange?.(parsedDate);
8179
+ }
8180
+ };
8181
+ const handleFocus = (event) => {
8182
+ const formatted = formatDate(currentValue, "");
8183
+ setInputValue(formatted);
8184
+ setHasFocus(true);
8185
+ onFocus?.(event);
8186
+ };
8187
+ const handleBlur = (event) => {
8188
+ setHasFocus(false);
8189
+ onBlur?.(event);
8190
+ const text = event.target.value;
8191
+ const parsedDate = text === formatDate(currentValue, "") ? currentValue : parseDate(text);
8192
+ onValueBlur?.(parsedDate);
8193
+ setCurrentValue(parsedDate);
8194
+ };
8195
+ const handleDatePickerChange = (newValue) => {
8196
+ const dateValue = newValue ?? null;
8197
+ setCurrentValue(dateValue);
8198
+ onValueChange?.(dateValue);
8199
+ setHasFocus(false);
8200
+ setIsOpen(false);
8201
+ };
8202
+ const handleClear = () => {
8203
+ if (!inputRef.current) return;
8204
+ inputRef.current.value = "";
8205
+ setInputValue("");
8206
+ setCurrentValue(null);
8207
+ onValueChange?.(null);
8208
+ onChange?.(createChangeInputEvent(inputRef.current));
8209
+ };
8210
+ const handleOpenChange = (open) => {
8211
+ if (open) {
8212
+ setMonth2(currentValue ?? /* @__PURE__ */ new Date());
8213
+ }
8214
+ setIsOpen(open);
8215
+ };
8216
+ const displayValue = hasFocus ? inputValue : formatDate(currentValue, "");
8217
+ return /* @__PURE__ */ jsxRuntime.jsxs(
8218
+ InputGroup,
8219
+ {
8220
+ state,
8221
+ variant,
8222
+ sizing,
8223
+ focusVariant,
8224
+ className,
8225
+ children: [
8226
+ /* @__PURE__ */ jsxRuntime.jsx(
8227
+ InputGroup.Input,
8228
+ {
8229
+ ...restInputProps,
8230
+ ref: mergeRefs(ref ?? null, inputRef),
8231
+ type: "text",
8232
+ value: displayValue,
8233
+ placeholder,
8234
+ onChange: handleChange,
8235
+ onFocus: handleFocus,
8236
+ onBlur: handleBlur,
8237
+ disabled,
8238
+ readOnly
8239
+ }
8240
+ ),
8241
+ (canClear || showPicker2) && /* @__PURE__ */ jsxRuntime.jsxs(InputGroup.Addon, { align: "inline-end", children: [
8242
+ canClear && /* @__PURE__ */ jsxRuntime.jsx(
8243
+ InputGroup.Button,
8244
+ {
8245
+ "aria-label": "Clear date",
8246
+ onMouseDown: (event) => event.preventDefault(),
8247
+ onClick: handleClear,
8248
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons_exports.X, { className: "tw-size-4" })
8249
+ }
8250
+ ),
8251
+ showPicker2 && /* @__PURE__ */ jsxRuntime.jsx(
8252
+ DatePicker,
8253
+ {
8254
+ disabled: disabledDays,
8255
+ endMonth,
8256
+ mode: "single",
8257
+ month,
8258
+ onMonthChange: setMonth2,
8259
+ onOpenChange: handleOpenChange,
8260
+ onSelect: handleDatePickerChange,
8261
+ open: isOpen,
8262
+ selected: currentValue ?? void 0,
8263
+ startMonth,
8264
+ children: /* @__PURE__ */ jsxRuntime.jsx(InputGroup.Button, { "aria-label": "Select Date", children: /* @__PURE__ */ jsxRuntime.jsx(icons_exports.Calendar, { className: "tw-size-4" }) })
8265
+ }
8266
+ )
8267
+ ] })
8268
+ ]
8269
+ }
8270
+ );
8283
8271
  };
8284
8272
  var DateWidget = ({
8285
8273
  id,
@@ -8380,13 +8368,7 @@ var BadgeAddon = ({
8380
8368
  className: cn(addonVariants2({ align, variant, className }))
8381
8369
  }
8382
8370
  );
8383
- var BadgeButton = ({
8384
- ref,
8385
- className,
8386
- type = "button",
8387
- children,
8388
- ...rest
8389
- }) => /* @__PURE__ */ jsxRuntime.jsx(
8371
+ var BadgeButton = ({ ref, className, type = "button", children, ...rest }) => /* @__PURE__ */ jsxRuntime.jsx(
8390
8372
  "button",
8391
8373
  {
8392
8374
  ...rest,
@@ -8411,12 +8393,7 @@ var BadgeButton = ({
8411
8393
  children
8412
8394
  }
8413
8395
  );
8414
- var BadgeLabel = ({
8415
- ref,
8416
- className,
8417
- asChild = false,
8418
- ...rest
8419
- }) => {
8396
+ var BadgeLabel = ({ ref, className, asChild = false, ...rest }) => {
8420
8397
  const Comp = asChild ? reactSlot.Slot : "span";
8421
8398
  return /* @__PURE__ */ jsxRuntime.jsx(
8422
8399
  Comp,
@@ -8510,14 +8487,7 @@ var badgeRootVariants = classVarianceAuthority.cva(
8510
8487
  }
8511
8488
  }
8512
8489
  );
8513
- var BadgeRoot = ({
8514
- ref,
8515
- variant,
8516
- color,
8517
- className,
8518
- children,
8519
- ...rest
8520
- }) => /* @__PURE__ */ jsxRuntime.jsx(
8490
+ var BadgeRoot = ({ ref, variant, color, className, children, ...rest }) => /* @__PURE__ */ jsxRuntime.jsx(
8521
8491
  "div",
8522
8492
  {
8523
8493
  ...rest,
@@ -8720,11 +8690,7 @@ var ComboboxContent = ({
8720
8690
  }
8721
8691
  ) });
8722
8692
  };
8723
- var ComboboxEmpty = ({
8724
- ref,
8725
- className,
8726
- ...props
8727
- }) => /* @__PURE__ */ jsxRuntime.jsx(
8693
+ var ComboboxEmpty = ({ ref, className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
8728
8694
  combobox.Combobox.Empty,
8729
8695
  {
8730
8696
  ref,
@@ -8768,12 +8734,7 @@ var ComboboxInputGroup = ({
8768
8734
  )
8769
8735
  }
8770
8736
  );
8771
- var ComboboxItemIndicator = ({
8772
- ref,
8773
- className,
8774
- variant = "check",
8775
- ...props
8776
- }) => {
8737
+ var ComboboxItemIndicator = ({ ref, className, variant = "check", ...props }) => {
8777
8738
  if (variant === "checkbox") {
8778
8739
  return /* @__PURE__ */ jsxRuntime.jsx(
8779
8740
  combobox.Combobox.ItemIndicator,
@@ -8886,11 +8847,7 @@ var ComboboxItem = ({
8886
8847
  ]
8887
8848
  }
8888
8849
  );
8889
- var ComboboxList = ({
8890
- ref,
8891
- className,
8892
- ...props
8893
- }) => /* @__PURE__ */ jsxRuntime.jsx(
8850
+ var ComboboxList = ({ ref, className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
8894
8851
  combobox.Combobox.List,
8895
8852
  {
8896
8853
  ref,
@@ -8910,11 +8867,7 @@ var ComboboxList = ({
8910
8867
  }
8911
8868
  );
8912
8869
  var ComboboxRoot = (props) => /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Root, { ...props });
8913
- var ComboboxSeparator = ({
8914
- ref,
8915
- className,
8916
- ...props
8917
- }) => /* @__PURE__ */ jsxRuntime.jsx(
8870
+ var ComboboxSeparator = ({ ref, className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
8918
8871
  combobox.Combobox.Separator,
8919
8872
  {
8920
8873
  ref,
@@ -8922,12 +8875,7 @@ var ComboboxSeparator = ({
8922
8875
  ...props
8923
8876
  }
8924
8877
  );
8925
- var ComboboxGroup = ({
8926
- ref,
8927
- className,
8928
- children,
8929
- ...props
8930
- }) => /* @__PURE__ */ jsxRuntime.jsx(
8878
+ var ComboboxGroup = ({ ref, className, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
8931
8879
  combobox.Combobox.Group,
8932
8880
  {
8933
8881
  ref,
@@ -8936,11 +8884,7 @@ var ComboboxGroup = ({
8936
8884
  children
8937
8885
  }
8938
8886
  );
8939
- var ComboboxGroupLabel = ({
8940
- ref,
8941
- className,
8942
- ...props
8943
- }) => /* @__PURE__ */ jsxRuntime.jsx(
8887
+ var ComboboxGroupLabel = ({ ref, className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
8944
8888
  combobox.Combobox.GroupLabel,
8945
8889
  {
8946
8890
  ...props,
@@ -9234,6 +9178,7 @@ var PasswordInput = ({
9234
9178
  onMouseDown,
9235
9179
  allowClear = false,
9236
9180
  allowPasswordToggle = false,
9181
+ passwordToggleLabel,
9237
9182
  autoComplete = "new-password",
9238
9183
  defaultPasswordVisibility = false,
9239
9184
  // input props
@@ -9242,13 +9187,12 @@ var PasswordInput = ({
9242
9187
  ...restInputProps
9243
9188
  }) => {
9244
9189
  const inputRef = React26.useRef(null);
9245
- const [internalValue, setInternalValue] = React26.useState(defaultValue ?? "");
9246
- const isControlled = valueProp !== void 0;
9247
- const value = isControlled ? valueProp ?? "" : internalValue;
9248
- const setValue = (next) => {
9249
- if (!isControlled) setInternalValue(next);
9250
- onValueChange?.(next);
9251
- };
9190
+ const [value, setValue] = useControllableState({
9191
+ // A `null` controlled value stays controlled (coerced to ''); `undefined` is uncontrolled.
9192
+ prop: valueProp === null ? "" : valueProp,
9193
+ defaultProp: defaultValue ?? "",
9194
+ onChange: onValueChange
9195
+ });
9252
9196
  const [capsLock, setCapsLock] = React26.useState(false);
9253
9197
  const [isPasswordVisible, setIsPasswordVisible] = React26.useState(defaultPasswordVisibility);
9254
9198
  const canClear = allowClear && !!value && !disabled && !readOnly;
@@ -9325,7 +9269,7 @@ var PasswordInput = ({
9325
9269
  allowPasswordToggle && /* @__PURE__ */ jsxRuntime.jsx(
9326
9270
  InputGroup.Button,
9327
9271
  {
9328
- "aria-label": isPasswordVisible ? "Hide password" : "Show password",
9272
+ "aria-label": `${isPasswordVisible ? "Hide password" : "Show password"}${passwordToggleLabel ? `: ${passwordToggleLabel}` : ""}`,
9329
9273
  onMouseDown: (event) => event.preventDefault(),
9330
9274
  onClick: handleTogglePasswordVisibility,
9331
9275
  children: isPasswordVisible ? /* @__PURE__ */ jsxRuntime.jsx(icons_exports.EyeOff, { className: "tw-size-4" }) : /* @__PURE__ */ jsxRuntime.jsx(icons_exports.Eye, { className: "tw-size-4" })
@@ -10072,6 +10016,10 @@ var generateUiSchema = (schema, readOnly = false, definitions, globalConfig, has
10072
10016
  ...arrayOpts
10073
10017
  };
10074
10018
  }
10019
+ const itemsEnumTitles = propSchema.items?.options?.enum_titles;
10020
+ if (Array.isArray(itemsEnumTitles)) {
10021
+ fieldUi.items = { "ui:options": { enumNames: itemsEnumTitles } };
10022
+ }
10075
10023
  }
10076
10024
  if (type === "object" && propSchema.properties) {
10077
10025
  const nestedGlobal = globalValue && typeof globalValue === "object" && !Array.isArray(globalValue) ? globalValue : void 0;