@takeoff-ui/react-spar 0.3.0 → 0.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/index.cjs CHANGED
@@ -6,15 +6,26 @@ var spar = require('@turkish-technology/spar');
6
6
  var clsx = require('clsx');
7
7
  var chevronBottom = require('@takeoff-icons/react/chevron-bottom');
8
8
  var chevronTop = require('@takeoff-icons/react/chevron-top');
9
+ var close = require('@takeoff-icons/react/close');
9
10
  var chevronRight = require('@takeoff-icons/react/chevron-right');
11
+ var chevronLeft = require('@takeoff-icons/react/chevron-left');
12
+ var doubleChevronLeft = require('@takeoff-icons/react/double-chevron-left');
13
+ var doubleChevronRight = require('@takeoff-icons/react/double-chevron-right');
14
+ var reactDayPicker = require('react-day-picker');
10
15
  var check = require('@takeoff-icons/react/check');
11
- var close = require('@takeoff-icons/react/close');
16
+ var remove = require('@takeoff-icons/react/remove');
17
+ var info = require('@takeoff-icons/react/info');
18
+ var alertCircle = require('@takeoff-icons/react/alert-circle');
19
+ var eyeClosed = require('@takeoff-icons/react/eye-closed');
20
+ var eyeOpen = require('@takeoff-icons/react/eye-open');
12
21
  var reactTable = require('@tanstack/react-table');
22
+ var arrowBottom = require('@takeoff-icons/react/arrow-bottom');
23
+ var arrowTop = require('@takeoff-icons/react/arrow-top');
13
24
  var swap = require('@takeoff-icons/react/swap');
14
25
  var search = require('@takeoff-icons/react/search');
15
- var arrowLeft = require('@takeoff-icons/react/arrow-left');
16
- var arrowRight = require('@takeoff-icons/react/arrow-right');
17
- var chevronLeft = require('@takeoff-icons/react/chevron-left');
26
+ var arrowDownload = require('@takeoff-icons/react/arrow-download');
27
+ var checkCircle = require('@takeoff-icons/react/check-circle');
28
+ var closeCircle = require('@takeoff-icons/react/close-circle');
18
29
 
19
30
  // src/provider.tsx
20
31
 
@@ -246,7 +257,79 @@ function useControllableState(controlledValue, defaultValue, onChange) {
246
257
  },
247
258
  [isControlled, onChange]
248
259
  );
249
- return [value, setValue];
260
+ return [value, setValue, isControlled];
261
+ }
262
+ var pad = (value) => String(value).padStart(2, "0");
263
+ var toISODate = (value) => `${value.getFullYear()}-${pad(value.getMonth() + 1)}-${pad(value.getDate())}`;
264
+ var fromISODate = (iso) => {
265
+ const [year, month, day] = iso.split("-").map(Number);
266
+ if (!year || !month || !day) return void 0;
267
+ return new Date(year, month - 1, day);
268
+ };
269
+ function useDatePicker({ min, max, defaultValue, delimiter = "/", format, onValueChange } = {}) {
270
+ const formatDate = react.useMemo(
271
+ () => format ?? ((value2) => `${pad(value2.getDate())}${delimiter}${pad(value2.getMonth() + 1)}${delimiter}${value2.getFullYear()}`),
272
+ [format, delimiter]
273
+ );
274
+ const [value, setValueState] = react.useState(defaultValue);
275
+ const [text, setText] = react.useState(() => defaultValue ? formatDate(defaultValue) : "");
276
+ const [open, setOpen] = react.useState(false);
277
+ const mask = react.useMemo(
278
+ () => ({
279
+ date: true,
280
+ delimiter,
281
+ ...min ? { dateMin: toISODate(min) } : {},
282
+ ...max ? { dateMax: toISODate(max) } : {}
283
+ }),
284
+ [delimiter, min, max]
285
+ );
286
+ const commit = react.useCallback(
287
+ (next) => {
288
+ setValueState(next);
289
+ setText(next ? formatDate(next) : "");
290
+ onValueChange?.(next);
291
+ },
292
+ [formatDate, onValueChange]
293
+ );
294
+ const handleTyped = react.useCallback(
295
+ (next, meta) => {
296
+ setText(next);
297
+ if (next === "") {
298
+ setValueState(void 0);
299
+ onValueChange?.(void 0);
300
+ return;
301
+ }
302
+ if (!meta.completed || !meta.iso) {
303
+ setValueState(void 0);
304
+ return;
305
+ }
306
+ const parsed = fromISODate(meta.iso);
307
+ setValueState(parsed);
308
+ onValueChange?.(parsed);
309
+ },
310
+ [onValueChange]
311
+ );
312
+ const handleKeyDown = react.useCallback((event) => {
313
+ if (event.key !== "ArrowDown") return;
314
+ event.preventDefault();
315
+ setOpen(true);
316
+ }, []);
317
+ const handlePicked = react.useCallback(
318
+ (next) => {
319
+ commit(next);
320
+ setOpen(false);
321
+ },
322
+ [commit]
323
+ );
324
+ return {
325
+ value,
326
+ text,
327
+ open,
328
+ setValue: commit,
329
+ popoverProps: { open, onOpenChange: setOpen },
330
+ inputProps: { mask, value: text, onValueChange: handleTyped, onKeyDown: handleKeyDown },
331
+ calendarProps: { value, minDate: min, maxDate: max, onValueChange: handlePicked }
332
+ };
250
333
  }
251
334
 
252
335
  // src/components/accordion/context.ts
@@ -423,40 +506,6 @@ var AlertActions = (props) => {
423
506
  return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...actionsProps, ref, ...rootAttrs, children });
424
507
  };
425
508
  AlertActions.displayName = "Alert.Actions";
426
- var baseSvgProps = {
427
- "xmlns": "http://www.w3.org/2000/svg",
428
- "width": "1em",
429
- "height": "1em",
430
- "viewBox": "0 0 24 24",
431
- "fill": "none",
432
- "stroke": "currentColor",
433
- "strokeWidth": 2,
434
- "strokeLinecap": "round",
435
- "strokeLinejoin": "round",
436
- "focusable": false,
437
- "aria-hidden": true
438
- };
439
- var filledSvgProps = {
440
- "xmlns": "http://www.w3.org/2000/svg",
441
- "width": "1em",
442
- "height": "1em",
443
- "viewBox": "0 0 24 24",
444
- "fill": "currentColor",
445
- "focusable": false,
446
- "aria-hidden": true
447
- };
448
- var PlaceholderChevronDown = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { ...baseSvgProps, "data-placeholder-icon": "chevron-down", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6 9 6 6 6-6" }) });
449
- var PlaceholderChevronUp = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { ...baseSvgProps, "data-placeholder-icon": "chevron-up", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m18 15-6-6-6 6" }) });
450
- var PlaceholderClose = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...baseSvgProps, "data-placeholder-icon": "close", ...props, children: [
451
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6 6 18" }),
452
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6 6 12 12" })
453
- ] });
454
- var PlaceholderInfo = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { ...filledSvgProps, "data-placeholder-icon": "info", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("g", { transform: "translate(2 2) scale(1.714)", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5.83333 0C2.61333 0 0 2.61333 0 5.83333C0 9.05333 2.61333 11.6667 5.83333 11.6667C9.05333 11.6667 11.6667 9.05333 11.6667 5.83333C11.6667 2.61333 9.05333 0 5.83333 0ZM5.83333 8.75C5.5125 8.75 5.25 8.4875 5.25 8.16667V5.83333C5.25 5.5125 5.5125 5.25 5.83333 5.25C6.15417 5.25 6.41667 5.5125 6.41667 5.83333V8.16667C6.41667 8.4875 6.15417 8.75 5.83333 8.75ZM6.41667 4.08333H5.25V2.91667H6.41667V4.08333Z" }) }) });
455
- var PlaceholderError = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { ...filledSvgProps, "data-placeholder-icon": "error", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("g", { transform: "translate(2 2) scale(1.714)", fillRule: "evenodd", clipRule: "evenodd", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5.83333 0C2.61333 0 0 2.61333 0 5.83333C0 9.05333 2.61333 11.6667 5.83333 11.6667C9.05333 11.6667 11.6667 9.05333 11.6667 5.83333C11.6667 2.61333 9.05333 0 5.83333 0ZM5.83333 2.91667C6.15417 2.91667 6.41667 3.17917 6.41667 3.5V5.83333C6.41667 6.15417 6.15417 6.41667 5.83333 6.41667C5.5125 6.41667 5.25 6.15417 5.25 5.83333V3.5C5.25 3.17917 5.5125 2.91667 5.83333 2.91667ZM5.25 7.58333H6.41667V8.75H5.25V7.58333Z" }) }) });
456
- var PlaceholderCheck = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { ...baseSvgProps, "data-placeholder-icon": "check", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 12l5 5L20 7" }) });
457
- var PlaceholderRemove = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { ...baseSvgProps, "data-placeholder-icon": "remove", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 12h14" }) });
458
- var PlaceholderEye = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { ...filledSvgProps, "data-placeholder-icon": "eye", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("g", { transform: "translate(1 4.5) scale(1.2)", fillRule: "evenodd", clipRule: "evenodd", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9.16667 1.66667C12.325 1.66667 15.1417 3.44167 16.5167 6.25C15.1417 9.05833 12.325 10.8333 9.16667 10.8333C6.00833 10.8333 3.19167 9.05833 1.81667 6.25C3.19167 3.44167 6.00833 1.66667 9.16667 1.66667ZM9.16667 0C5 0 1.44167 2.59167 0 6.25C1.44167 9.90833 5 12.5 9.16667 12.5C13.3333 12.5 16.8917 9.90833 18.3333 6.25C16.8917 2.59167 13.3333 0 9.16667 0ZM9.16667 4.16667C10.3167 4.16667 11.25 5.1 11.25 6.25C11.25 7.4 10.3167 8.33333 9.16667 8.33333C8.01667 8.33333 7.08333 7.4 7.08333 6.25C7.08333 5.1 8.01667 4.16667 9.16667 4.16667ZM9.16667 2.5C7.1 2.5 5.41667 4.18333 5.41667 6.25C5.41667 8.31667 7.1 10 9.16667 10C11.2333 10 12.9167 8.31667 12.9167 6.25C12.9167 4.18333 11.2333 2.5 9.16667 2.5Z" }) }) });
459
- var PlaceholderEyeOff = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { ...filledSvgProps, "data-placeholder-icon": "eye-off", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("g", { transform: "translate(1 2.42) scale(1.2)", fillRule: "evenodd", clipRule: "evenodd", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9.16667 2.95833C12.325 2.95833 15.1417 4.73333 16.5167 7.54167C16.025 8.55833 15.3333 9.43333 14.5083 10.1417L15.6833 11.3167C16.8417 10.2917 17.7583 9.00833 18.3333 7.54167C16.8917 3.88333 13.3333 1.29167 9.16667 1.29167C8.10833 1.29167 7.09167 1.45833 6.13333 1.76667L7.50833 3.14167C8.05 3.03333 8.6 2.95833 9.16667 2.95833ZM8.275 3.90833L10 5.63333C10.475 5.84167 10.8583 6.225 11.0667 6.7L12.7917 8.425C12.8583 8.14167 12.9083 7.84167 12.9083 7.53333C12.9167 5.46667 11.2333 3.79167 9.16667 3.79167C8.85833 3.79167 8.56667 3.83333 8.275 3.90833ZM0.841667 1.18333L3.075 3.41667C1.71667 4.48333 0.641667 5.9 0 7.54167C1.44167 11.2 5 13.7917 9.16667 13.7917C10.4333 13.7917 11.65 13.55 12.7667 13.1083L15.6167 15.9583L16.7917 14.7833L2.01667 0L0.841667 1.18333ZM7.09167 7.43333L9.26667 9.60833C9.23333 9.61667 9.2 9.625 9.16667 9.625C8.01667 9.625 7.08333 8.69167 7.08333 7.54167C7.08333 7.5 7.09167 7.475 7.09167 7.43333ZM4.25833 4.6L5.71667 6.05833C5.525 6.51667 5.41667 7.01667 5.41667 7.54167C5.41667 9.60833 7.1 11.2917 9.16667 11.2917C9.69167 11.2917 10.1917 11.1833 10.6417 10.9917L11.4583 11.8083C10.725 12.0083 9.95833 12.125 9.16667 12.125C6.00833 12.125 3.19167 10.35 1.81667 7.54167C2.4 6.35 3.25 5.36667 4.25833 4.6Z" }) }) });
460
509
  var AlertClose = (props) => {
461
510
  const theme = useComponentTheme("AlertClose");
462
511
  const { onClose } = useAlertContext("Alert.Close");
@@ -479,7 +528,7 @@ var AlertClose = (props) => {
479
528
  "aria-label": ariaLabel ?? (hasCustomChildren ? void 0 : DEFAULT_CLOSE_LABEL),
480
529
  onClick: handleClick,
481
530
  ...closeRootAttrs,
482
- children: hasCustomChildren ? children : /* @__PURE__ */ jsxRuntime.jsx(PlaceholderClose, {})
531
+ children: hasCustomChildren ? children : /* @__PURE__ */ jsxRuntime.jsx(close.CloseIconOutlinedRounded, {})
483
532
  }
484
533
  );
485
534
  };
@@ -743,6 +792,650 @@ var Button = (props) => {
743
792
  };
744
793
  Button.displayName = "Button";
745
794
 
795
+ // src/components/calendar/base.ts
796
+ var CalendarBase = createComponentBase({
797
+ name: "Calendar",
798
+ slots: [
799
+ "root",
800
+ "months",
801
+ "month",
802
+ "nav",
803
+ "previousMonthButton",
804
+ "nextMonthButton",
805
+ "previousYearButton",
806
+ "nextYearButton",
807
+ "chevron",
808
+ "monthCaption",
809
+ "captionLabel",
810
+ "captionTrigger",
811
+ "dropdowns",
812
+ "dropdownRoot",
813
+ "dropdown",
814
+ "monthGrid",
815
+ "monthYearGrid",
816
+ "monthYearCell",
817
+ "weekdays",
818
+ "weekday",
819
+ "weeks",
820
+ "week",
821
+ "weekNumber",
822
+ "weekNumberHeader",
823
+ "day",
824
+ "dayButton",
825
+ "footer"
826
+ ],
827
+ classes: {
828
+ root: "tk-calendar",
829
+ months: "tk-calendar-months",
830
+ month: "tk-calendar-month",
831
+ nav: "tk-calendar-nav",
832
+ previousMonthButton: "tk-calendar-nav-previous-month",
833
+ nextMonthButton: "tk-calendar-nav-next-month",
834
+ previousYearButton: "tk-calendar-nav-previous-year",
835
+ nextYearButton: "tk-calendar-nav-next-year",
836
+ chevron: "tk-calendar-chevron",
837
+ monthCaption: "tk-calendar-month-caption",
838
+ captionLabel: "tk-calendar-caption-label",
839
+ captionTrigger: "tk-calendar-caption-trigger",
840
+ dropdowns: "tk-calendar-dropdowns",
841
+ dropdownRoot: "tk-calendar-dropdown-root",
842
+ dropdown: "tk-calendar-dropdown",
843
+ monthGrid: "tk-calendar-month-grid",
844
+ monthYearGrid: "tk-calendar-month-year-grid",
845
+ monthYearCell: "tk-calendar-month-year-cell",
846
+ weekdays: "tk-calendar-weekdays",
847
+ weekday: "tk-calendar-weekday",
848
+ weeks: "tk-calendar-weeks",
849
+ week: "tk-calendar-week",
850
+ weekNumber: "tk-calendar-week-number",
851
+ weekNumberHeader: "tk-calendar-week-number-header",
852
+ day: "tk-calendar-day",
853
+ dayButton: "tk-calendar-day-button",
854
+ footer: "tk-calendar-footer"
855
+ }
856
+ });
857
+ var calendarRangeClassNames = {
858
+ range_start: "tk-calendar-day-range-start",
859
+ range_middle: "tk-calendar-day-range-middle",
860
+ range_end: "tk-calendar-day-range-end"
861
+ };
862
+
863
+ // src/components/calendar/defaults.ts
864
+ var DEFAULT_MODE2 = "single";
865
+ var DEFAULT_SIZE5 = "base";
866
+ var DEFAULT_HEADER_TYPE = "basic";
867
+ var DEFAULT_VIEW = "day";
868
+
869
+ // src/components/calendar/helpers.ts
870
+ var isSameCalendarDay = (left, right) => left.getFullYear() === right.getFullYear() && left.getMonth() === right.getMonth() && left.getDate() === right.getDate();
871
+ var isSameCalendarMonth = (left, right) => left.getFullYear() === right.getFullYear() && left.getMonth() === right.getMonth();
872
+ var selectionAnchor = (value) => {
873
+ if (!value) return void 0;
874
+ if (value instanceof Date) return value;
875
+ if (Array.isArray(value)) return value.length ? value[value.length - 1] : void 0;
876
+ return value.from;
877
+ };
878
+ var buildDisabledMatchers = ({ minDate, maxDate, disabledDates, allowedDates, disabledWeekDays }) => {
879
+ const matchers = [];
880
+ if (minDate) matchers.push({ before: minDate });
881
+ if (maxDate) matchers.push({ after: maxDate });
882
+ if (disabledDates?.length) matchers.push(disabledDates);
883
+ if (disabledWeekDays?.length) matchers.push({ dayOfWeek: disabledWeekDays });
884
+ if (allowedDates?.length) {
885
+ const allowed = allowedDates;
886
+ matchers.push((date) => !allowed.some((candidate) => isSameCalendarDay(candidate, date)));
887
+ }
888
+ return matchers.length ? matchers : void 0;
889
+ };
890
+ var assignRef = (ref, node) => {
891
+ if (typeof ref === "function") {
892
+ ref(node);
893
+ } else if (ref) {
894
+ ref.current = node;
895
+ }
896
+ };
897
+ var YEARS_PER_PAGE = 12;
898
+ var yearPageStart = (year) => Math.floor(year / YEARS_PER_PAGE) * YEARS_PER_PAGE;
899
+ var isMonthInBounds = (year, month, minDate, maxDate) => {
900
+ if (minDate && new Date(year, month + 1, 0, 23, 59, 59, 999) < minDate) return false;
901
+ if (maxDate && new Date(year, month, 1) > maxDate) return false;
902
+ return true;
903
+ };
904
+ var isYearInBounds = (year, minDate, maxDate) => {
905
+ if (minDate && year < minDate.getFullYear()) return false;
906
+ if (maxDate && year > maxDate.getFullYear()) return false;
907
+ return true;
908
+ };
909
+ var isYearPageInBounds = (year, minDate, maxDate) => {
910
+ const start = yearPageStart(year);
911
+ return isYearInBounds(start + YEARS_PER_PAGE - 1, minDate, void 0) && isYearInBounds(start, void 0, maxDate);
912
+ };
913
+ var SLOT_TO_UI = {
914
+ root: reactDayPicker.UI.Root,
915
+ months: reactDayPicker.UI.Months,
916
+ month: reactDayPicker.UI.Month,
917
+ nav: reactDayPicker.UI.Nav,
918
+ previousMonthButton: reactDayPicker.UI.PreviousMonthButton,
919
+ nextMonthButton: reactDayPicker.UI.NextMonthButton,
920
+ chevron: reactDayPicker.UI.Chevron,
921
+ monthCaption: reactDayPicker.UI.MonthCaption,
922
+ captionLabel: reactDayPicker.UI.CaptionLabel,
923
+ dropdowns: reactDayPicker.UI.Dropdowns,
924
+ dropdownRoot: reactDayPicker.UI.DropdownRoot,
925
+ dropdown: reactDayPicker.UI.Dropdown,
926
+ monthGrid: reactDayPicker.UI.MonthGrid,
927
+ weekdays: reactDayPicker.UI.Weekdays,
928
+ weekday: reactDayPicker.UI.Weekday,
929
+ weeks: reactDayPicker.UI.Weeks,
930
+ week: reactDayPicker.UI.Week,
931
+ weekNumber: reactDayPicker.UI.WeekNumber,
932
+ weekNumberHeader: reactDayPicker.UI.WeekNumberHeader,
933
+ day: reactDayPicker.UI.Day,
934
+ dayButton: reactDayPicker.UI.DayButton,
935
+ footer: reactDayPicker.UI.Footer
936
+ };
937
+ var ENGINE_CLASSNAME_RESET = Object.fromEntries(
938
+ [...Object.values(reactDayPicker.UI), ...Object.values(reactDayPicker.DayFlag), ...Object.values(reactDayPicker.SelectionState), ...Object.values(reactDayPicker.Animation)].map((key) => [key, ""])
939
+ );
940
+ var mergeSlotAttrs = (slotAttrs, engineProps) => {
941
+ const merged = { ...slotAttrs };
942
+ for (const key in engineProps) {
943
+ const value = engineProps[key];
944
+ if (value !== void 0) merged[key] = value;
945
+ }
946
+ return merged;
947
+ };
948
+ var CaptionMonthContext = react.createContext(null);
949
+ var PANEL_COLUMNS = 4;
950
+ var visuallyHidden = {
951
+ position: "absolute",
952
+ width: 1,
953
+ height: 1,
954
+ margin: -1,
955
+ padding: 0,
956
+ overflow: "hidden",
957
+ clip: "rect(0 0 0 0)",
958
+ whiteSpace: "nowrap",
959
+ border: 0
960
+ };
961
+ var displayContents = { display: "contents" };
962
+ var createEngineComponents = (attrsRef, refRef, viewRef, renderDayRef) => {
963
+ const withSlot = (Component, slot) => {
964
+ const Slotted = (props) => /* @__PURE__ */ jsxRuntime.jsx(Component, { ...mergeSlotAttrs(attrsRef.current[slot], props) });
965
+ Slotted.displayName = `Calendar.${slot}`;
966
+ return Slotted;
967
+ };
968
+ const Root = ({ rootRef, ...engineProps }) => /* @__PURE__ */ jsxRuntime.jsx(
969
+ "div",
970
+ {
971
+ ...mergeSlotAttrs(attrsRef.current.root, engineProps),
972
+ ref: (node) => {
973
+ assignRef(refRef.current, node);
974
+ assignRef(rootRef, node);
975
+ }
976
+ }
977
+ );
978
+ Root.displayName = "Calendar.root";
979
+ const Chevron = ({ orientation = "left", size, ...engineProps }) => {
980
+ const Icon = orientation === "left" ? chevronLeft.ChevronLeftIconOutlinedRounded : orientation === "right" ? chevronRight.ChevronRightIconOutlinedRounded : orientation === "up" ? chevronTop.ChevronTopIconOutlinedRounded : chevronBottom.ChevronBottomIconOutlinedRounded;
981
+ const { disabled: _disabled, ...svgProps } = engineProps;
982
+ return /* @__PURE__ */ jsxRuntime.jsx(Icon, { "aria-hidden": "true", ...mergeSlotAttrs(attrsRef.current.chevron, { ...svgProps, width: size, height: size }) });
983
+ };
984
+ Chevron.displayName = "Calendar.chevron";
985
+ const useDisplayedMonth = () => {
986
+ const { months, dayPickerProps } = reactDayPicker.useDayPicker();
987
+ const first = dayPickerProps.reverseMonths ? months[months.length - 1] : months[0];
988
+ return first?.date ?? /* @__PURE__ */ new Date();
989
+ };
990
+ const useDateLib = () => {
991
+ const { locale, timeZone, numerals, dateLib } = reactDayPicker.useDayPicker().dayPickerProps;
992
+ return react.useMemo(
993
+ // The same merge the engine makes, so a partial `locale` still resolves
994
+ // against `en-US` rather than leaving fields undefined.
995
+ () => new reactDayPicker.DateLib({ locale: { ...reactDayPicker.defaultLocale, ...locale }, timeZone, numerals }, dateLib),
996
+ [locale, timeZone, numerals, dateLib]
997
+ );
998
+ };
999
+ const MonthCaption = ({ calendarMonth, displayIndex, ...engineProps }) => /* @__PURE__ */ jsxRuntime.jsx(CaptionMonthContext.Provider, { value: calendarMonth.date, children: /* @__PURE__ */ jsxRuntime.jsx(
1000
+ reactDayPicker.MonthCaption,
1001
+ {
1002
+ calendarMonth,
1003
+ displayIndex,
1004
+ ...mergeSlotAttrs(attrsRef.current.monthCaption, engineProps)
1005
+ }
1006
+ ) });
1007
+ MonthCaption.displayName = "Calendar.monthCaption";
1008
+ const CaptionLabel = ({ children, ...engineProps }) => {
1009
+ const { triggersEnabled, view, setView, navigationDisabled, panelId, pendingFocusRef, restoreRef } = viewRef.current;
1010
+ const { formatters, labels } = reactDayPicker.useDayPicker();
1011
+ const caption = react.useContext(CaptionMonthContext);
1012
+ const anchor = useDisplayedMonth();
1013
+ const dateLib = useDateLib();
1014
+ const displayed = caption ?? anchor;
1015
+ const slotProps = mergeSlotAttrs(attrsRef.current.captionLabel, engineProps);
1016
+ if (!triggersEnabled || displayed.getTime() !== anchor.getTime())
1017
+ return /* @__PURE__ */ jsxRuntime.jsx(reactDayPicker.CaptionLabel, { ...slotProps, children });
1018
+ const trigger = (target, label, describe) => {
1019
+ const opens = view !== target;
1020
+ const disabled = navigationDisabled && opens;
1021
+ return /* @__PURE__ */ jsxRuntime.jsx(
1022
+ "button",
1023
+ {
1024
+ type: "button",
1025
+ ...mergeSlotAttrs(attrsRef.current.captionTrigger, {
1026
+ "data-view": target,
1027
+ // The engine's own label, so `labels` translates the panel too; a
1028
+ // per-instance override still wins through `slotProps`.
1029
+ "aria-label": attrsRef.current.captionTrigger["aria-label"] ?? `${label}, ${describe}`,
1030
+ "aria-expanded": view === target,
1031
+ "aria-controls": view === target ? panelId : void 0,
1032
+ "aria-disabled": disabled || void 0,
1033
+ "onClick": (event) => {
1034
+ if (disabled) return;
1035
+ const next = opens ? target : "day";
1036
+ restoreRef.current = next === "day" ? null : event.currentTarget;
1037
+ pendingFocusRef.current = next !== "day";
1038
+ setView(next);
1039
+ }
1040
+ }),
1041
+ children: label
1042
+ }
1043
+ );
1044
+ };
1045
+ const monthLabel = formatters.formatMonthDropdown(displayed, dateLib);
1046
+ const yearLabel = formatters.formatYearDropdown(displayed, dateLib);
1047
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1048
+ reactDayPicker.CaptionLabel,
1049
+ {
1050
+ ...slotProps,
1051
+ role: void 0,
1052
+ "aria-live": void 0,
1053
+ children: [
1054
+ trigger("month", monthLabel, labels.labelMonthDropdown()),
1055
+ trigger("year", yearLabel, labels.labelYearDropdown()),
1056
+ /* @__PURE__ */ jsxRuntime.jsx("span", { role: "status", "aria-live": "polite", style: visuallyHidden, children: view === "day" ? `${monthLabel} ${yearLabel}` : view === "month" ? labels.labelMonthDropdown() : labels.labelYearDropdown() })
1057
+ ]
1058
+ }
1059
+ );
1060
+ };
1061
+ CaptionLabel.displayName = "Calendar.captionLabel";
1062
+ const MonthGrid = ({ children, ...engineProps }) => {
1063
+ const { view, setView, navigationDisabled, minDate, maxDate, panelId, panelRef, pendingFocusRef, restoreRef } = viewRef.current;
1064
+ const { dayPickerProps, formatters, goToMonth, labels } = reactDayPicker.useDayPicker();
1065
+ const displayed = useDisplayedMonth();
1066
+ const dateLib = useDateLib();
1067
+ react.useEffect(() => {
1068
+ if (view === "day" || !pendingFocusRef.current) return;
1069
+ pendingFocusRef.current = false;
1070
+ panelRef.current?.querySelector('[role="gridcell"][tabindex="0"]')?.focus();
1071
+ }, [view, panelRef, pendingFocusRef]);
1072
+ if (view === "day") {
1073
+ return /* @__PURE__ */ jsxRuntime.jsx(reactDayPicker.MonthGrid, { ...mergeSlotAttrs(attrsRef.current.monthGrid, { ...engineProps, children }) });
1074
+ }
1075
+ const year = displayed.getFullYear();
1076
+ const pageStart = yearPageStart(year);
1077
+ const restoreFocus = () => {
1078
+ const trigger = panelRef.current?.closest('[data-slot="root"]')?.querySelector(`[data-slot="caption-trigger"][data-view="${view}"]`);
1079
+ (restoreRef.current ?? trigger)?.focus();
1080
+ };
1081
+ const items = view === "month" ? Array.from({ length: 12 }, (_, month) => {
1082
+ const date = new Date(year, month, 1);
1083
+ return {
1084
+ key: String(month),
1085
+ // No engine formatter abbreviates a month — the dropdown spells
1086
+ // it out — so this is the one label built from a pattern; the
1087
+ // date library is still the engine's, so locale and numerals
1088
+ // hold.
1089
+ label: dateLib.format(date, "LLL"),
1090
+ name: formatters.formatCaption(date, dateLib.options, dateLib),
1091
+ current: displayed.getMonth() === month,
1092
+ // Picking a cell is navigation, so `disableNavigation` takes the
1093
+ // whole board down with the arrows — `goToMonth` would no-op and
1094
+ // leave an enabled-looking cell that does nothing.
1095
+ enabled: !navigationDisabled && isMonthInBounds(year, month, minDate, maxDate),
1096
+ select: () => {
1097
+ goToMonth(date);
1098
+ setView("day");
1099
+ restoreFocus();
1100
+ }
1101
+ };
1102
+ }) : Array.from({ length: YEARS_PER_PAGE }, (_, offset) => {
1103
+ const candidate = pageStart + offset;
1104
+ const label2 = formatters.formatYearDropdown(new Date(candidate, 0, 1), dateLib);
1105
+ return {
1106
+ key: String(candidate),
1107
+ label: label2,
1108
+ name: label2,
1109
+ current: candidate === year,
1110
+ enabled: !navigationDisabled && isYearInBounds(candidate, minDate, maxDate),
1111
+ select: () => {
1112
+ goToMonth(new Date(candidate, displayed.getMonth(), 1));
1113
+ restoreRef.current = null;
1114
+ pendingFocusRef.current = true;
1115
+ setView("month");
1116
+ }
1117
+ };
1118
+ });
1119
+ const seek = (start, delta, min = 0, max = items.length - 1) => {
1120
+ for (let index = start; index >= min && index <= max; index += delta) if (items[index]?.enabled) return index;
1121
+ return void 0;
1122
+ };
1123
+ const current = items.findIndex((item) => item.current && item.enabled);
1124
+ const activeIndex = current >= 0 ? current : seek(0, 1) ?? -1;
1125
+ const inline = dayPickerProps.dir === "rtl" ? -1 : 1;
1126
+ const move = (event, from) => {
1127
+ const step = { ArrowLeft: -inline, ArrowRight: inline, ArrowUp: -PANEL_COLUMNS, ArrowDown: PANEL_COLUMNS }[event.key];
1128
+ const rowStart = from - from % PANEL_COLUMNS;
1129
+ const rowEnd = rowStart + PANEL_COLUMNS - 1;
1130
+ let next;
1131
+ if (step !== void 0) next = seek(from + step, step);
1132
+ else if (event.key === "Home") next = seek(rowStart, 1, rowStart, rowEnd);
1133
+ else if (event.key === "End") next = seek(rowEnd, -1, rowStart, rowEnd);
1134
+ if (next === void 0) return;
1135
+ event.preventDefault();
1136
+ const cells = event.currentTarget.querySelectorAll('[role="gridcell"]');
1137
+ cells[next]?.focus();
1138
+ };
1139
+ const label = view === "month" ? `${labels.labelMonthDropdown()}, ${formatters.formatYearDropdown(displayed, dateLib)}` : `${labels.labelYearDropdown()}, ${dateLib.formatNumber(pageStart)}\u2013${dateLib.formatNumber(pageStart + YEARS_PER_PAGE - 1)}`;
1140
+ return /* @__PURE__ */ jsxRuntime.jsx(
1141
+ "div",
1142
+ {
1143
+ ...mergeSlotAttrs(attrsRef.current.monthYearGrid, {
1144
+ "id": panelId,
1145
+ "role": "grid",
1146
+ "aria-label": attrsRef.current.monthYearGrid["aria-label"] ?? label,
1147
+ "data-view": view,
1148
+ "ref": panelRef,
1149
+ "onKeyDown": (event) => {
1150
+ if (event.key === "Escape") {
1151
+ event.stopPropagation();
1152
+ setView("day");
1153
+ restoreFocus();
1154
+ return;
1155
+ }
1156
+ const cells = [...event.currentTarget.querySelectorAll('[role="gridcell"]')];
1157
+ const from = cells.indexOf(event.target);
1158
+ if (from >= 0) move(event, from);
1159
+ }
1160
+ }),
1161
+ children: Array.from({ length: items.length / PANEL_COLUMNS }, (_, row) => /* @__PURE__ */ jsxRuntime.jsx("div", { role: "row", style: displayContents, children: items.slice(row * PANEL_COLUMNS, row * PANEL_COLUMNS + PANEL_COLUMNS).map((item, column) => {
1162
+ const index = row * PANEL_COLUMNS + column;
1163
+ return /* @__PURE__ */ jsxRuntime.jsx(
1164
+ "button",
1165
+ {
1166
+ type: "button",
1167
+ disabled: !item.enabled,
1168
+ ...mergeSlotAttrs(attrsRef.current.monthYearCell, {
1169
+ "role": "gridcell",
1170
+ "aria-label": item.name,
1171
+ "aria-selected": item.current,
1172
+ "data-selected": item.current || void 0,
1173
+ "data-disabled": item.enabled ? void 0 : true,
1174
+ "tabIndex": index === activeIndex ? 0 : -1,
1175
+ "onClick": item.select
1176
+ }),
1177
+ children: item.label
1178
+ },
1179
+ item.key
1180
+ );
1181
+ }) }, row))
1182
+ }
1183
+ );
1184
+ };
1185
+ MonthGrid.displayName = "Calendar.monthGrid";
1186
+ const aroundArrow = (slot) => {
1187
+ const Engine = slot === "previousMonthButton" ? reactDayPicker.PreviousMonthButton : reactDayPicker.NextMonthButton;
1188
+ const Arrow = ({ children, ...engineProps }) => {
1189
+ const { view, navigationDisabled, minDate, maxDate } = viewRef.current;
1190
+ const { formatters, goToMonth } = reactDayPicker.useDayPicker();
1191
+ const displayed = useDisplayedMonth();
1192
+ const dateLib = useDateLib();
1193
+ const slotProps = mergeSlotAttrs(attrsRef.current[slot], engineProps);
1194
+ if (view !== "year") return /* @__PURE__ */ jsxRuntime.jsx(Engine, { ...slotProps, children });
1195
+ const target = new Date(displayed.getFullYear() + (slot === "previousMonthButton" ? -1 : 1), displayed.getMonth(), 1);
1196
+ const disabled = navigationDisabled || !isYearInBounds(target.getFullYear(), minDate, maxDate);
1197
+ return /* @__PURE__ */ jsxRuntime.jsx(
1198
+ Engine,
1199
+ {
1200
+ ...slotProps,
1201
+ "aria-label": formatters.formatYearDropdown(target, dateLib),
1202
+ "aria-disabled": disabled || void 0,
1203
+ tabIndex: disabled ? -1 : void 0,
1204
+ onClick: () => {
1205
+ if (!disabled) goToMonth(target);
1206
+ },
1207
+ children
1208
+ }
1209
+ );
1210
+ };
1211
+ Arrow.displayName = `Calendar.${slot}`;
1212
+ return Arrow;
1213
+ };
1214
+ const Nav = (engineProps) => {
1215
+ const { triggersEnabled, view, navigationDisabled, minDate, maxDate } = viewRef.current;
1216
+ const { classNames: engineClassNames, components, formatters, goToMonth, labels } = reactDayPicker.useDayPicker();
1217
+ const displayed = useDisplayedMonth();
1218
+ const dateLib = useDateLib();
1219
+ const slotProps = mergeSlotAttrs(attrsRef.current.nav, engineProps);
1220
+ const { onPreviousClick, onNextClick, previousMonth, nextMonth, ...navAttrs } = slotProps;
1221
+ const singleStep = view === "year" ? 12 : 1;
1222
+ const doubleStep = view === "year" ? YEARS_PER_PAGE * 12 : 12;
1223
+ const singleGrain = view === "year" ? "year" : "month";
1224
+ const doubleGrain = view === "year" ? "page" : "year";
1225
+ const shift = (months) => new Date(displayed.getFullYear(), displayed.getMonth() + months, 1);
1226
+ const reachable = (target, grain) => grain === "month" ? isMonthInBounds(target.getFullYear(), target.getMonth(), minDate, maxDate) : grain === "year" ? isYearInBounds(target.getFullYear(), minDate, maxDate) : isYearPageInBounds(target.getFullYear(), minDate, maxDate);
1227
+ const formatYear = (target) => formatters.formatYearDropdown(target, dateLib);
1228
+ const formatPage = (target) => {
1229
+ const start = yearPageStart(target.getFullYear());
1230
+ return `${dateLib.formatNumber(start)}\u2013${dateLib.formatNumber(start + YEARS_PER_PAGE - 1)}`;
1231
+ };
1232
+ const arrowLabel = (grain, target, previous) => grain === "month" ? previous ? labels.labelPrevious(target) : labels.labelNext(target) : grain === "year" ? formatYear(target) : formatPage(target);
1233
+ const arrow = (slot, months, grain, icon) => {
1234
+ const target = shift(months);
1235
+ const label = arrowLabel(grain, target, months < 0);
1236
+ const engineOwned = slot === "previousMonthButton" || slot === "nextMonthButton";
1237
+ const delegated = engineOwned && view === "day";
1238
+ const disabled = navigationDisabled || (delegated ? !(months < 0 ? previousMonth : nextMonth) : !reachable(target, grain));
1239
+ const Button2 = slot.startsWith("previous") ? reactDayPicker.PreviousMonthButton : reactDayPicker.NextMonthButton;
1240
+ return /* @__PURE__ */ jsxRuntime.jsx(
1241
+ Button2,
1242
+ {
1243
+ type: "button",
1244
+ ...mergeSlotAttrs(attrsRef.current[slot], {
1245
+ "className": engineOwned ? engineClassNames[slot === "previousMonthButton" ? reactDayPicker.UI.PreviousMonthButton : reactDayPicker.UI.NextMonthButton] : void 0,
1246
+ "aria-label": label,
1247
+ "aria-disabled": disabled || void 0,
1248
+ "tabIndex": disabled ? -1 : void 0,
1249
+ "onClick": (event) => {
1250
+ if (disabled) return;
1251
+ if (delegated) return months < 0 ? onPreviousClick?.(event) : onNextClick?.(event);
1252
+ goToMonth(target);
1253
+ }
1254
+ }),
1255
+ children: icon
1256
+ }
1257
+ );
1258
+ };
1259
+ const chevron = (orientation) => /* @__PURE__ */ jsxRuntime.jsx(components.Chevron, { orientation, className: engineClassNames[reactDayPicker.UI.Chevron] });
1260
+ const doubleChevron = (Icon) => /* @__PURE__ */ jsxRuntime.jsx(Icon, { "aria-hidden": "true", ...mergeSlotAttrs(attrsRef.current.chevron, { className: engineClassNames[reactDayPicker.UI.Chevron] }) });
1261
+ return /* @__PURE__ */ jsxRuntime.jsxs("nav", { ...navAttrs, children: [
1262
+ triggersEnabled && arrow("previousYearButton", -doubleStep, doubleGrain, doubleChevron(doubleChevronLeft.DoubleChevronLeftIconOutlinedRounded)),
1263
+ arrow("previousMonthButton", -singleStep, singleGrain, chevron("left")),
1264
+ arrow("nextMonthButton", singleStep, singleGrain, chevron("right")),
1265
+ triggersEnabled && arrow("nextYearButton", doubleStep, doubleGrain, doubleChevron(doubleChevronRight.DoubleChevronRightIconOutlinedRounded))
1266
+ ] });
1267
+ };
1268
+ Nav.displayName = "Calendar.nav";
1269
+ const DayButton = ({ day, modifiers, children, ...engineProps }) => {
1270
+ const slotProps = mergeSlotAttrs(attrsRef.current.dayButton, engineProps);
1271
+ return /* @__PURE__ */ jsxRuntime.jsx(reactDayPicker.DayButton, { ...slotProps, day, modifiers, children: renderDayRef.current ? renderDayRef.current(day.date, modifiers) : children });
1272
+ };
1273
+ DayButton.displayName = "Calendar.dayButton";
1274
+ return {
1275
+ Root,
1276
+ Chevron,
1277
+ CaptionLabel,
1278
+ MonthCaption,
1279
+ MonthGrid,
1280
+ Nav,
1281
+ Months: withSlot(reactDayPicker.Months, "months"),
1282
+ Month: withSlot(reactDayPicker.Month, "month"),
1283
+ PreviousMonthButton: aroundArrow("previousMonthButton"),
1284
+ NextMonthButton: aroundArrow("nextMonthButton"),
1285
+ DropdownNav: withSlot(reactDayPicker.DropdownNav, "dropdowns"),
1286
+ // The engine hands these props to its own `<select>`, so `dropdown` is the
1287
+ // select's anchor. Its wrapping span (`dropdownRoot`) is class-only — see
1288
+ // `base.ts`.
1289
+ Dropdown: withSlot(reactDayPicker.Dropdown, "dropdown"),
1290
+ Weekdays: withSlot(reactDayPicker.Weekdays, "weekdays"),
1291
+ Weekday: withSlot(reactDayPicker.Weekday, "weekday"),
1292
+ Weeks: withSlot(reactDayPicker.Weeks, "weeks"),
1293
+ Week: withSlot(reactDayPicker.Week, "week"),
1294
+ WeekNumber: withSlot(reactDayPicker.WeekNumber, "weekNumber"),
1295
+ WeekNumberHeader: withSlot(reactDayPicker.WeekNumberHeader, "weekNumberHeader"),
1296
+ Day: withSlot(reactDayPicker.Day, "day"),
1297
+ DayButton,
1298
+ Footer: withSlot(reactDayPicker.Footer, "footer")
1299
+ };
1300
+ };
1301
+ var Calendar = (props) => {
1302
+ const theme = useComponentTheme("Calendar");
1303
+ const { rootAttrs, rest } = composeRootAttrs(CalendarBase, props, theme, {
1304
+ // `data-size` is takeoff-v2's own visual vocabulary. The engine's root
1305
+ // already emits `data-mode`, `data-multiple-months`, `data-week-numbers`
1306
+ // and `data-nav-layout`, so those are not mirrored here (rule 7).
1307
+ stateAttrs: ({ size = DEFAULT_SIZE5, headerType = DEFAULT_HEADER_TYPE }) => ({
1308
+ "data-size": size,
1309
+ "data-header-type": headerType
1310
+ })
1311
+ });
1312
+ const {
1313
+ mode = DEFAULT_MODE2,
1314
+ value,
1315
+ defaultValue,
1316
+ onValueChange,
1317
+ minDate,
1318
+ maxDate,
1319
+ disabledDates,
1320
+ allowedDates,
1321
+ disabledWeekDays,
1322
+ firstDayOfWeekIndex,
1323
+ size: _size,
1324
+ headerType: _headerType,
1325
+ view: viewProp,
1326
+ defaultView = DEFAULT_VIEW,
1327
+ onViewChange,
1328
+ ref,
1329
+ min,
1330
+ max,
1331
+ excludeDisabled,
1332
+ renderDay,
1333
+ ...engine
1334
+ } = rest;
1335
+ const isControlled = "value" in props;
1336
+ const [uncontrolledValue, setUncontrolledValue] = react.useState(isControlled ? void 0 : value ?? defaultValue);
1337
+ const selected = isControlled ? value : uncontrolledValue;
1338
+ const setSelected = (next) => {
1339
+ if (!isControlled) setUncontrolledValue(next);
1340
+ onValueChange?.(next);
1341
+ };
1342
+ const isMonthControlled = engine.month !== void 0;
1343
+ const anchor = selectionAnchor(selected);
1344
+ const [followedMonth, setFollowedMonth] = react.useState(void 0);
1345
+ const displayedMonthRef = react.useRef(void 0);
1346
+ const anchorYear = anchor?.getFullYear();
1347
+ const anchorMonth = anchor?.getMonth();
1348
+ react.useEffect(() => {
1349
+ if (isMonthControlled || anchorYear === void 0 || anchorMonth === void 0) return;
1350
+ const displayed = displayedMonthRef.current;
1351
+ const target = new Date(anchorYear, anchorMonth, 1);
1352
+ if (displayed && isSameCalendarMonth(displayed, target)) return;
1353
+ displayedMonthRef.current = target;
1354
+ setFollowedMonth(target);
1355
+ }, [isMonthControlled, anchorYear, anchorMonth]);
1356
+ const handleMonthChange = (next) => {
1357
+ displayedMonthRef.current = next;
1358
+ setFollowedMonth(next);
1359
+ engine.onMonthChange?.(next);
1360
+ };
1361
+ const triggersEnabled = !engine.captionLayout?.startsWith("dropdown");
1362
+ const isViewControlled = props.view !== void 0;
1363
+ const [uncontrolledView, setUncontrolledView] = react.useState(viewProp ?? defaultView);
1364
+ const view = isViewControlled ? props.view : uncontrolledView;
1365
+ const setView = (next) => {
1366
+ if (!isViewControlled) setUncontrolledView(next);
1367
+ onViewChange?.(next);
1368
+ };
1369
+ const panelId = react.useId();
1370
+ const panelRef = react.useRef(null);
1371
+ const restoreRef = react.useRef(null);
1372
+ const pendingFocusRef = react.useRef(false);
1373
+ const navigationDisabled = Boolean(engine.disableNavigation);
1374
+ const viewState = { triggersEnabled, view, setView, navigationDisabled, minDate, maxDate, panelId, panelRef, restoreRef, pendingFocusRef };
1375
+ const viewRef = react.useRef(viewState);
1376
+ viewRef.current = viewState;
1377
+ const slotAttrs = {};
1378
+ const classNames = { ...ENGINE_CLASSNAME_RESET, ...calendarRangeClassNames };
1379
+ for (const slot of CalendarBase.slots) {
1380
+ const composed = slot === "root" ? (
1381
+ // `data-view` is live state, not a resolved prop, so it is layered on
1382
+ // here rather than through `stateAttrs`.
1383
+ { ...rootAttrs, "data-view": view }
1384
+ ) : buildSlotAttrs(CalendarBase.getSlotProps(slot), slot, {
1385
+ themeSlotProps: theme?.slotProps,
1386
+ themeClassNames: theme?.classNames,
1387
+ instanceSlotProps: props.slotProps,
1388
+ instanceClassNames: props.classNames
1389
+ });
1390
+ const uiKey = SLOT_TO_UI[slot];
1391
+ if (uiKey === void 0) {
1392
+ slotAttrs[slot] = composed;
1393
+ continue;
1394
+ }
1395
+ const { className, ...attrs } = composed;
1396
+ slotAttrs[slot] = attrs;
1397
+ classNames[uiKey] = className ?? "";
1398
+ }
1399
+ const attrsRef = react.useRef(slotAttrs);
1400
+ attrsRef.current = slotAttrs;
1401
+ const refRef = react.useRef(ref);
1402
+ refRef.current = ref;
1403
+ const renderDayRef = react.useRef(renderDay);
1404
+ renderDayRef.current = renderDay;
1405
+ const components = react.useMemo(() => createEngineComponents(attrsRef, refRef, viewRef, renderDayRef), []);
1406
+ const disabled = buildDisabledMatchers({ minDate, maxDate, disabledDates, allowedDates, disabledWeekDays });
1407
+ const engineProps = {
1408
+ ...engine,
1409
+ // A board belongs to the calendar, not to a month, so only one month is
1410
+ // displayed while one is open — the board would otherwise be repeated per
1411
+ // month, `id` and all. Mapped on the prop rather than by dropping the extra
1412
+ // months from the `Month` override, which would take the engine's
1413
+ // navigation down with them: `navLayout="after"` and `"around"` render it
1414
+ // inside a month.
1415
+ numberOfMonths: view === "day" ? engine.numberOfMonths : 1,
1416
+ // A passed `month` stays in charge; otherwise the month the grid follows is
1417
+ // whatever it was last moved to — by the user's own navigation or by the
1418
+ // selection above. `defaultMonth` still seeds the first render, because
1419
+ // `followedMonth` is undefined until something moves.
1420
+ month: isMonthControlled ? engine.month : followedMonth,
1421
+ onMonthChange: handleMonthChange,
1422
+ mode,
1423
+ selected,
1424
+ onSelect: setSelected,
1425
+ disabled,
1426
+ startMonth: minDate,
1427
+ endMonth: maxDate,
1428
+ weekStartsOn: firstDayOfWeekIndex,
1429
+ min,
1430
+ max,
1431
+ excludeDisabled,
1432
+ classNames,
1433
+ components
1434
+ };
1435
+ return /* @__PURE__ */ jsxRuntime.jsx(reactDayPicker.DayPicker, { ...engineProps });
1436
+ };
1437
+ Calendar.displayName = "Calendar";
1438
+
746
1439
  // src/components/card/base.ts
747
1440
  var CardBase = createComponentBase({
748
1441
  name: "Card",
@@ -784,12 +1477,12 @@ var Card = (props) => {
784
1477
  Card.displayName = "Card";
785
1478
 
786
1479
  // src/components/card/defaults.ts
787
- var DEFAULT_HEADER_TYPE = "basic";
1480
+ var DEFAULT_HEADER_TYPE2 = "basic";
788
1481
  var DEFAULT_FOOTER_TYPE = "basic";
789
1482
  var CardHeader = (props) => {
790
1483
  const theme = useComponentTheme("CardHeader");
791
1484
  const { rootAttrs, rest } = composeRootAttrs(CardHeaderBase, props, theme, {
792
- stateAttrs: ({ headerType = DEFAULT_HEADER_TYPE }) => ({
1485
+ stateAttrs: ({ headerType = DEFAULT_HEADER_TYPE2 }) => ({
793
1486
  "data-header-type": headerType
794
1487
  })
795
1488
  });
@@ -867,11 +1560,11 @@ var CheckboxBase = createComponentBase({
867
1560
  var [CheckboxProvider, useCheckboxOwnContext] = createSafeContext("CheckboxProvider");
868
1561
 
869
1562
  // src/components/checkbox/defaults.ts
870
- var DEFAULT_SIZE5 = "base";
1563
+ var DEFAULT_SIZE6 = "base";
871
1564
  var Checkbox = (props) => {
872
1565
  const theme = useComponentTheme("Checkbox");
873
1566
  const { rootAttrs, rest } = composeRootAttrs(CheckboxBase, props, theme, {
874
- stateAttrs: ({ size = DEFAULT_SIZE5 }) => ({
1567
+ stateAttrs: ({ size = DEFAULT_SIZE6 }) => ({
875
1568
  "data-size": size
876
1569
  })
877
1570
  });
@@ -939,7 +1632,7 @@ var CheckboxIndicator = (props) => {
939
1632
  instanceSlotProps: slotProps,
940
1633
  instanceClassNames: classNames
941
1634
  });
942
- const resolvedChildren = typeof children === "function" ? children({ checked, indeterminate }) : children ?? /* @__PURE__ */ jsxRuntime.jsx("span", { ...iconAttrs, "aria-hidden": true, children: indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(PlaceholderRemove, {}) : /* @__PURE__ */ jsxRuntime.jsx(PlaceholderCheck, {}) });
1635
+ const resolvedChildren = typeof children === "function" ? children({ checked, indeterminate }) : children ?? /* @__PURE__ */ jsxRuntime.jsx("span", { ...iconAttrs, "aria-hidden": true, children: indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(remove.RemoveIconOutlinedRounded, {}) : /* @__PURE__ */ jsxRuntime.jsx(check.CheckIconOutlinedRounded, {}) });
943
1636
  return /* @__PURE__ */ jsxRuntime.jsx("span", { ...rest, ...indicatorAttrs, ref, children: resolvedChildren });
944
1637
  };
945
1638
  CheckboxIndicator.displayName = "Checkbox.Indicator";
@@ -963,13 +1656,13 @@ var ChipBase = createComponentBase({
963
1656
  // src/components/chip/defaults.ts
964
1657
  var DEFAULT_VARIANT4 = "primary";
965
1658
  var DEFAULT_APPEARANCE4 = "filled";
966
- var DEFAULT_SIZE6 = "base";
1659
+ var DEFAULT_SIZE7 = "base";
967
1660
  var DEFAULT_REMOVE_LABEL = "Remove";
968
1661
  var Chip = (props) => {
969
1662
  const theme = useComponentTheme("Chip");
970
1663
  const [dismissed, setDismissed] = react.useState(false);
971
1664
  const { rootAttrs, rest } = composeRootAttrs(ChipBase, props, theme, {
972
- stateAttrs: ({ variant = DEFAULT_VARIANT4, appearance = DEFAULT_APPEARANCE4, size = DEFAULT_SIZE6, clickable: clickable2 = false, disabled: disabled2 = false, removable: removable2 = false }) => ({
1665
+ stateAttrs: ({ variant = DEFAULT_VARIANT4, appearance = DEFAULT_APPEARANCE4, size = DEFAULT_SIZE7, clickable: clickable2 = false, disabled: disabled2 = false, removable: removable2 = false }) => ({
973
1666
  "data-variant": variant,
974
1667
  "data-type": appearance,
975
1668
  "data-size": size,
@@ -1064,7 +1757,7 @@ var Chip = (props) => {
1064
1757
  isRenderableNode(children) && /* @__PURE__ */ jsxRuntime.jsx("span", { ...labelSlotAttrs, children }),
1065
1758
  removable && // The icon-only remove control needs an accessible name. Default it,
1066
1759
  // but let `slotProps.remove` (spread after) override via `aria-label`.
1067
- /* @__PURE__ */ jsxRuntime.jsx("button", { "aria-label": DEFAULT_REMOVE_LABEL, ...removeButtonAttrs, disabled, onClick: handleRemoveClick, type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(PlaceholderClose, {}) })
1760
+ /* @__PURE__ */ jsxRuntime.jsx("button", { "aria-label": DEFAULT_REMOVE_LABEL, ...removeButtonAttrs, disabled, onClick: handleRemoveClick, type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(close.CloseIconOutlinedRounded, {}) })
1068
1761
  ]
1069
1762
  }
1070
1763
  );
@@ -1076,14 +1769,15 @@ var [DrawerProvider, useDrawerOwnContext] = createSafeContext("DrawerProvider");
1076
1769
 
1077
1770
  // src/components/drawer/defaults.ts
1078
1771
  var DEFAULT_PLACEMENT = "right";
1079
- var DEFAULT_HEADER_TYPE2 = "basic";
1772
+ var DEFAULT_HEADER_TYPE3 = "basic";
1080
1773
  var DEFAULT_FOOTER_TYPE2 = "basic";
1081
1774
  var DEFAULT_INTENSITY = "base";
1775
+ var DEFAULT_CLOSE_LABEL2 = "Close";
1082
1776
  var Drawer = (props) => {
1083
1777
  const theme = useComponentTheme("Drawer");
1084
1778
  const merged = { ...theme?.defaultProps, ...props };
1085
- const { placement = DEFAULT_PLACEMENT, dismissible = true, disabled = false, children, ...sparProps } = merged;
1086
- return /* @__PURE__ */ jsxRuntime.jsx(DrawerProvider, { value: { placement, dismissible }, children: /* @__PURE__ */ jsxRuntime.jsx(spar.Dialog, { ...sparProps, disabled, forceMount: true, children }) });
1779
+ const { placement = DEFAULT_PLACEMENT, dismissible = true, disabled = false, forceMount = true, children, ...sparProps } = merged;
1780
+ return /* @__PURE__ */ jsxRuntime.jsx(DrawerProvider, { value: { placement, dismissible }, children: /* @__PURE__ */ jsxRuntime.jsx(spar.Dialog, { ...sparProps, disabled, forceMount, children }) });
1087
1781
  };
1088
1782
  Drawer.displayName = "Drawer";
1089
1783
 
@@ -1178,7 +1872,7 @@ DrawerPanel.displayName = "Drawer.Panel";
1178
1872
  var DrawerHeader = (props) => {
1179
1873
  const theme = useComponentTheme("DrawerHeader");
1180
1874
  const { rootAttrs, rest } = composeRootAttrs(DrawerHeaderBase, props, theme, {
1181
- stateAttrs: ({ headerType = DEFAULT_HEADER_TYPE2 }) => ({
1875
+ stateAttrs: ({ headerType = DEFAULT_HEADER_TYPE3 }) => ({
1182
1876
  "data-header-type": headerType
1183
1877
  })
1184
1878
  });
@@ -1224,8 +1918,9 @@ DrawerFooter.displayName = "Drawer.Footer";
1224
1918
  var DrawerClose = (props) => {
1225
1919
  const theme = useComponentTheme("DrawerClose");
1226
1920
  const { rootAttrs, rest } = composeRootAttrs(DrawerCloseBase, props, theme);
1227
- const { children, ref, ...closeProps } = rest;
1228
- return /* @__PURE__ */ jsxRuntime.jsx(spar.DialogClose, { ...closeProps, ref, ...rootAttrs, children });
1921
+ const { children, ref, "aria-label": ariaLabel, ...closeProps } = rest;
1922
+ const hasCustomChildren = typeof children === "function" || isRenderableNode(children);
1923
+ return /* @__PURE__ */ jsxRuntime.jsx(spar.DialogClose, { ...closeProps, "aria-label": ariaLabel ?? (hasCustomChildren ? void 0 : DEFAULT_CLOSE_LABEL2), ref, ...rootAttrs, children: hasCustomChildren ? children : /* @__PURE__ */ jsxRuntime.jsx(close.CloseIconOutlinedRounded, {}) });
1229
1924
  };
1230
1925
  DrawerClose.displayName = "Drawer.Close";
1231
1926
 
@@ -1326,8 +2021,9 @@ DialogTrigger.displayName = "Dialog.Trigger";
1326
2021
 
1327
2022
  // src/components/dialog/defaults.ts
1328
2023
  var DEFAULT_INTENSITY2 = "base";
1329
- var DEFAULT_HEADER_TYPE3 = "basic";
2024
+ var DEFAULT_HEADER_TYPE4 = "basic";
1330
2025
  var DEFAULT_FOOTER_TYPE3 = "basic";
2026
+ var DEFAULT_CLOSE_LABEL3 = "Close";
1331
2027
  var DialogOverlay = (props) => {
1332
2028
  const theme = useComponentTheme("DialogOverlay");
1333
2029
  const { rootAttrs, rest } = composeRootAttrs(DialogOverlayBase, props, theme, {
@@ -1357,7 +2053,7 @@ DialogPanel.displayName = "Dialog.Panel";
1357
2053
  var DialogHeader = (props) => {
1358
2054
  const theme = useComponentTheme("DialogHeader");
1359
2055
  const { rootAttrs, rest } = composeRootAttrs(DialogHeaderBase, props, theme, {
1360
- stateAttrs: ({ headerType = DEFAULT_HEADER_TYPE3 }) => ({
2056
+ stateAttrs: ({ headerType = DEFAULT_HEADER_TYPE4 }) => ({
1361
2057
  "data-header-type": headerType
1362
2058
  })
1363
2059
  });
@@ -1403,8 +2099,9 @@ DialogFooter.displayName = "Dialog.Footer";
1403
2099
  var DialogClose = (props) => {
1404
2100
  const theme = useComponentTheme("DialogClose");
1405
2101
  const { rootAttrs, rest } = composeRootAttrs(DialogCloseBase, props, theme);
1406
- const { children, ref, ...sparProps } = rest;
1407
- return /* @__PURE__ */ jsxRuntime.jsx(spar.DialogClose, { ...sparProps, ...rootAttrs, ref, children });
2102
+ const { children, ref, "aria-label": ariaLabel, ...sparProps } = rest;
2103
+ const hasCustomChildren = typeof children === "function" || isRenderableNode(children);
2104
+ return /* @__PURE__ */ jsxRuntime.jsx(spar.DialogClose, { ...sparProps, "aria-label": ariaLabel ?? (hasCustomChildren ? void 0 : DEFAULT_CLOSE_LABEL3), ...rootAttrs, ref, children: hasCustomChildren ? children : /* @__PURE__ */ jsxRuntime.jsx(close.CloseIconOutlinedRounded, {}) });
1408
2105
  };
1409
2106
  DialogClose.displayName = "Dialog.Close";
1410
2107
 
@@ -1463,12 +2160,12 @@ Divider.displayName = "Divider";
1463
2160
  var [DropdownProvider, useDropdownOwnContext] = createSafeContext("DropdownProvider");
1464
2161
 
1465
2162
  // src/components/dropdown/defaults.ts
1466
- var DEFAULT_SIZE7 = "base";
2163
+ var DEFAULT_SIZE8 = "base";
1467
2164
  var DEFAULT_CONTENT_WIDTH = "content";
1468
2165
  var Dropdown = (props) => {
1469
2166
  const theme = useComponentTheme("Dropdown");
1470
2167
  const merged = { ...theme?.defaultProps, ...props };
1471
- const { size = DEFAULT_SIZE7, contentWidth = DEFAULT_CONTENT_WIDTH, children, ...sparProps } = merged;
2168
+ const { size = DEFAULT_SIZE8, contentWidth = DEFAULT_CONTENT_WIDTH, children, ...sparProps } = merged;
1472
2169
  return /* @__PURE__ */ jsxRuntime.jsx(DropdownProvider, { value: { size, contentWidth }, children: /* @__PURE__ */ jsxRuntime.jsx(spar.DropdownMenu, { ...sparProps, children }) });
1473
2170
  };
1474
2171
  Dropdown.displayName = "Dropdown";
@@ -1654,7 +2351,7 @@ var FieldDescription = (props) => {
1654
2351
  });
1655
2352
  const hasContent = children != null && children !== "";
1656
2353
  return /* @__PURE__ */ jsxRuntime.jsxs(spar.FieldDescription, { ...spar$1, ref, ...rootAttrs, children: [
1657
- hasContent && /* @__PURE__ */ jsxRuntime.jsx("span", { ...iconAttrs, "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(PlaceholderInfo, {}) }),
2354
+ hasContent && /* @__PURE__ */ jsxRuntime.jsx("span", { ...iconAttrs, "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(info.InfoIconFilledRounded, {}) }),
1658
2355
  children
1659
2356
  ] });
1660
2357
  };
@@ -1671,7 +2368,7 @@ var FieldErrorMessage = (props) => {
1671
2368
  });
1672
2369
  const hasContent = children != null && children !== "";
1673
2370
  return /* @__PURE__ */ jsxRuntime.jsxs(spar.FieldErrorMessage, { ...spar$1, ref, ...rootAttrs, children: [
1674
- hasContent && /* @__PURE__ */ jsxRuntime.jsx("span", { ...iconAttrs, "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(PlaceholderError, {}) }),
2371
+ hasContent && /* @__PURE__ */ jsxRuntime.jsx("span", { ...iconAttrs, "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(alertCircle.AlertCircleIconFilledRounded, {}) }),
1675
2372
  children
1676
2373
  ] });
1677
2374
  };
@@ -1760,7 +2457,7 @@ var InputChipsBase = createComponentBase({
1760
2457
  var [InputProvider, useInputOwnContext] = createSafeContext("InputProvider");
1761
2458
 
1762
2459
  // src/components/input/defaults.ts
1763
- var DEFAULT_SIZE8 = "base";
2460
+ var DEFAULT_SIZE9 = "base";
1764
2461
  var SEGMENT_COUNT = 4;
1765
2462
  var computeStrength = (value) => {
1766
2463
  let strength = 0;
@@ -1812,11 +2509,11 @@ var Input = (props) => {
1812
2509
  for (const value of clearablesRef.current.values()) value.clear();
1813
2510
  }, []);
1814
2511
  const { rootAttrs, rest } = composeRootAttrs(InputBase, props, theme, {
1815
- stateAttrs: ({ size: size2 = DEFAULT_SIZE8 }) => ({
2512
+ stateAttrs: ({ size: size2 = DEFAULT_SIZE9 }) => ({
1816
2513
  "data-size": size2
1817
2514
  })
1818
2515
  });
1819
- const { size = DEFAULT_SIZE8, children, ref, ...sparProps } = rest;
2516
+ const { size = DEFAULT_SIZE9, children, ref, ...sparProps } = rest;
1820
2517
  const contextValue = react.useMemo(
1821
2518
  () => ({
1822
2519
  size,
@@ -2000,7 +2697,7 @@ var InputClearButton = (props) => {
2000
2697
  "aria-label": ariaLabel,
2001
2698
  onClick: handleClick,
2002
2699
  onKeyDown: handleKeyDown,
2003
- startContent: children ?? /* @__PURE__ */ jsxRuntime.jsx(PlaceholderClose, {})
2700
+ startContent: children ?? /* @__PURE__ */ jsxRuntime.jsx(close.CloseIconOutlinedRounded, {})
2004
2701
  }
2005
2702
  );
2006
2703
  };
@@ -2031,7 +2728,7 @@ var InputDecrement = (props) => {
2031
2728
  disabled: disabled || readOnly,
2032
2729
  "aria-label": ariaLabel,
2033
2730
  onClick: handleClick,
2034
- startContent: children ?? /* @__PURE__ */ jsxRuntime.jsx(PlaceholderChevronDown, {})
2731
+ startContent: children ?? /* @__PURE__ */ jsxRuntime.jsx(chevronBottom.ChevronBottomIconOutlinedRounded, {})
2035
2732
  }
2036
2733
  );
2037
2734
  };
@@ -2040,7 +2737,7 @@ var InputField = (props) => {
2040
2737
  const theme = useComponentTheme("InputField");
2041
2738
  const { fieldRef, setFieldNode, setFieldValue, revealed, setRevealed } = useInputOwnContext("Input.Field");
2042
2739
  const { rootAttrs, rest } = composeRootAttrs(InputFieldBase, props, theme);
2043
- const { as, ref, type, onInput, onChange, ...spar$1 } = rest;
2740
+ const { as, ref, type, onInput, onChange, onValueChange, ...spar$1 } = rest;
2044
2741
  const effectiveType = type === "password" && revealed ? "text" : type;
2045
2742
  const renderedType = as === "textarea" ? void 0 : effectiveType;
2046
2743
  const setFieldRef = react.useCallback(
@@ -2069,6 +2766,10 @@ var InputField = (props) => {
2069
2766
  onChange?.(event);
2070
2767
  setFieldValue(event.currentTarget.value);
2071
2768
  };
2769
+ const handleValueChange = (value, meta) => {
2770
+ setFieldValue(value);
2771
+ onValueChange?.(value, meta);
2772
+ };
2072
2773
  return /* @__PURE__ */ jsxRuntime.jsx(
2073
2774
  spar.InputField,
2074
2775
  {
@@ -2077,6 +2778,7 @@ var InputField = (props) => {
2077
2778
  type: renderedType,
2078
2779
  onInput: handleInput,
2079
2780
  onChange: handleChange,
2781
+ onValueChange: handleValueChange,
2080
2782
  ref: setFieldRef,
2081
2783
  ...rootAttrs
2082
2784
  }
@@ -2109,7 +2811,7 @@ var InputIncrement = (props) => {
2109
2811
  disabled: disabled || readOnly,
2110
2812
  "aria-label": ariaLabel,
2111
2813
  onClick: handleClick,
2112
- startContent: children ?? /* @__PURE__ */ jsxRuntime.jsx(PlaceholderChevronUp, {})
2814
+ startContent: children ?? /* @__PURE__ */ jsxRuntime.jsx(chevronTop.ChevronTopIconOutlinedRounded, {})
2113
2815
  }
2114
2816
  );
2115
2817
  };
@@ -2168,7 +2870,7 @@ var InputRevealButton = (props) => {
2168
2870
  "aria-label": "Toggle password visibility",
2169
2871
  "aria-pressed": revealed,
2170
2872
  onClick: handleClick,
2171
- startContent: children ?? (revealed ? /* @__PURE__ */ jsxRuntime.jsx(PlaceholderEyeOff, {}) : /* @__PURE__ */ jsxRuntime.jsx(PlaceholderEye, {}))
2873
+ startContent: children ?? (revealed ? /* @__PURE__ */ jsxRuntime.jsx(eyeClosed.EyeClosedIconOutlinedRounded, {}) : /* @__PURE__ */ jsxRuntime.jsx(eyeOpen.EyeOpenIconOutlinedRounded, {}))
2172
2874
  }
2173
2875
  );
2174
2876
  };
@@ -2209,8 +2911,6 @@ var InputTrailingIcon = (props) => {
2209
2911
  return /* @__PURE__ */ jsxRuntime.jsx(Component, { "aria-hidden": "true", ...rendered, ref, ...rootAttrs, children });
2210
2912
  };
2211
2913
  InputTrailingIcon.displayName = "Input.TrailingIcon";
2212
-
2213
- // src/components/input/index.ts
2214
2914
  var Input2 = Object.assign(Input, {
2215
2915
  Field: InputField,
2216
2916
  Prefix: InputPrefix,
@@ -2272,19 +2972,19 @@ var RADIO_ITEM_CONTEXT_VALUE = { inside: true };
2272
2972
  var [RadioItemProvider, useRadioItemOwnContext] = createSafeContext("RadioItemProvider");
2273
2973
 
2274
2974
  // src/components/radio/defaults.ts
2275
- var DEFAULT_SIZE9 = "base";
2975
+ var DEFAULT_SIZE10 = "base";
2276
2976
  var DEFAULT_POSITION = "left";
2277
2977
  var Radio = (props) => {
2278
2978
  const theme = useComponentTheme("Radio");
2279
2979
  const { rootAttrs, rest } = composeRootAttrs(RadioBase, props, theme, {
2280
- stateAttrs: ({ size: size2 = DEFAULT_SIZE9, position: position2 = DEFAULT_POSITION, spread }) => ({
2980
+ stateAttrs: ({ size: size2 = DEFAULT_SIZE10, position: position2 = DEFAULT_POSITION, spread }) => ({
2281
2981
  "data-size": size2,
2282
2982
  "data-position": position2,
2283
2983
  "data-spread": spread ? "" : void 0
2284
2984
  })
2285
2985
  });
2286
2986
  const {
2287
- size = DEFAULT_SIZE9,
2987
+ size = DEFAULT_SIZE10,
2288
2988
  position = DEFAULT_POSITION,
2289
2989
  invalid,
2290
2990
  // `spread` is consumed only as a data-attr above; destructure to keep it
@@ -2403,6 +3103,7 @@ PopoverTrigger.displayName = "Popover.Trigger";
2403
3103
 
2404
3104
  // src/components/popover/defaults.ts
2405
3105
  var DEFAULT_VARIANT5 = "white";
3106
+ var DEFAULT_CLOSE_LABEL4 = "Close";
2406
3107
  var PopoverContent = (props) => {
2407
3108
  const theme = useComponentTheme("PopoverContent");
2408
3109
  const { rootAttrs, rest } = composeRootAttrs(PopoverContentBase, props, theme, {
@@ -2438,8 +3139,9 @@ PopoverArrow.displayName = "Popover.Arrow";
2438
3139
  var PopoverClose = (props) => {
2439
3140
  const theme = useComponentTheme("PopoverClose");
2440
3141
  const { rootAttrs, rest } = composeRootAttrs(PopoverCloseBase, props, theme);
2441
- const { children, ref, ...sparProps } = rest;
2442
- return /* @__PURE__ */ jsxRuntime.jsx(spar.PopoverClose, { ...sparProps, ...rootAttrs, ref, children });
3142
+ const { children, ref, "aria-label": ariaLabel, ...sparProps } = rest;
3143
+ const hasCustomChildren = typeof children === "function" || isRenderableNode(children);
3144
+ return /* @__PURE__ */ jsxRuntime.jsx(spar.PopoverClose, { ...sparProps, "aria-label": ariaLabel ?? (hasCustomChildren ? void 0 : DEFAULT_CLOSE_LABEL4), ...rootAttrs, ref, children: hasCustomChildren ? children : /* @__PURE__ */ jsxRuntime.jsx(close.CloseIconOutlinedRounded, {}) });
2443
3145
  };
2444
3146
  PopoverClose.displayName = "Popover.Close";
2445
3147
 
@@ -2480,7 +3182,7 @@ var [ProgressProvider, useProgressContext] = createSafeContext("ProgressProvider
2480
3182
 
2481
3183
  // src/components/progress/defaults.ts
2482
3184
  var DEFAULT_APPEARANCE6 = "linear";
2483
- var DEFAULT_SIZE10 = "base";
3185
+ var DEFAULT_SIZE11 = "base";
2484
3186
  var DEFAULT_VARIANT6 = "primary";
2485
3187
  var DEFAULT_MIN = 0;
2486
3188
  var DEFAULT_MAX = 100;
@@ -2561,7 +3263,7 @@ var Progress = (props) => {
2561
3263
  const resolveState = ({
2562
3264
  indeterminate: indeterminate2 = false,
2563
3265
  appearance: appearance2 = DEFAULT_APPEARANCE6,
2564
- size: size2 = DEFAULT_SIZE10,
3266
+ size: size2 = DEFAULT_SIZE11,
2565
3267
  variant: variant2 = DEFAULT_VARIANT6,
2566
3268
  disabled: disabled2 = field?.disabled ?? false
2567
3269
  }) => ({ indeterminate: indeterminate2, appearance: appearance2, size: size2, variant: variant2, disabled: disabled2 });
@@ -2705,17 +3407,17 @@ var SelectArrowBase = createComponentBase({
2705
3407
  var [SelectProvider, useSelectOwnContext] = createSafeContext("SelectProvider");
2706
3408
 
2707
3409
  // src/components/select/defaults.ts
2708
- var DEFAULT_SIZE11 = "base";
3410
+ var DEFAULT_SIZE12 = "base";
2709
3411
  var DEFAULT_CONTENT_WIDTH2 = "trigger";
2710
3412
  var Select = (props) => {
2711
3413
  const theme = useComponentTheme("Select");
2712
3414
  const { rootAttrs, rest } = composeRootAttrs(SelectBase, props, theme, {
2713
- stateAttrs: ({ size: size2 = DEFAULT_SIZE11, invalid: invalid2 }) => ({
3415
+ stateAttrs: ({ size: size2 = DEFAULT_SIZE12, invalid: invalid2 }) => ({
2714
3416
  "data-size": size2,
2715
3417
  "data-invalid": invalid2 ? "" : void 0
2716
3418
  })
2717
3419
  });
2718
- const { size = DEFAULT_SIZE11, invalid = false, contentWidth = DEFAULT_CONTENT_WIDTH2, children, ref, ...sparProps } = rest;
3420
+ const { size = DEFAULT_SIZE12, invalid = false, contentWidth = DEFAULT_CONTENT_WIDTH2, children, ref, ...sparProps } = rest;
2719
3421
  return /* @__PURE__ */ jsxRuntime.jsx(SelectProvider, { value: { size, invalid, contentWidth }, children: /* @__PURE__ */ jsxRuntime.jsx(spar.Select, { ...sparProps, ref, ...rootAttrs, children }) });
2720
3422
  };
2721
3423
  Select.displayName = "Select";
@@ -2875,7 +3577,7 @@ var [SliderProvider, useSliderContext] = createSafeContext("SliderProvider");
2875
3577
 
2876
3578
  // src/components/slider/defaults.ts
2877
3579
  var DEFAULT_ORIENTATION2 = "horizontal";
2878
- var DEFAULT_SIZE12 = "base";
3580
+ var DEFAULT_SIZE13 = "base";
2879
3581
  var DEFAULT_VARIANT7 = "primary";
2880
3582
  var DEFAULT_TOOLTIP = "auto";
2881
3583
  var DEFAULT_TRACK = "normal";
@@ -3175,7 +3877,7 @@ var Slider = (props) => {
3175
3877
  const { rootAttrs, rest } = composeRootAttrs(SliderBase, props, theme, {
3176
3878
  stateAttrs: (merged) => {
3177
3879
  const {
3178
- size = DEFAULT_SIZE12,
3880
+ size = DEFAULT_SIZE13,
3179
3881
  variant = DEFAULT_VARIANT7,
3180
3882
  orientation: orientation2 = DEFAULT_ORIENTATION2,
3181
3883
  tooltip = DEFAULT_TOOLTIP,
@@ -3398,8 +4100,8 @@ var Slider = (props) => {
3398
4100
  name && !disabled && (range ? (
3399
4101
  // One input per handle so a 3+ thumb range submits every value; a
3400
4102
  // two-handle range keeps the conventional `-min` / `-max` pair.
3401
- values.map((entry, index) => /* @__PURE__ */ jsxRuntime.jsx("input", { type: "hidden", name: rangeInputName(name, index, values.length), value: entry, form }, index))
3402
- ) : /* @__PURE__ */ jsxRuntime.jsx("input", { type: "hidden", name, value: values[0], form }))
4103
+ values.map((entry, index) => /* @__PURE__ */ jsxRuntime.jsx(spar.InputField, { type: "hidden", name: rangeInputName(name, index, values.length), value: entry, form }, index))
4104
+ ) : /* @__PURE__ */ jsxRuntime.jsx(spar.InputField, { type: "hidden", name, value: values[0], form }))
3403
4105
  ] })
3404
4106
  }
3405
4107
  );
@@ -3463,7 +4165,7 @@ var SpinnerBase = createComponentBase({
3463
4165
 
3464
4166
  // src/components/spinner/defaults.ts
3465
4167
  var DEFAULT_APPEARANCE7 = "rounded";
3466
- var DEFAULT_SIZE13 = "base";
4168
+ var DEFAULT_SIZE14 = "base";
3467
4169
  var DEFAULT_VARIANT8 = "neutral";
3468
4170
  var DEFAULT_ARIA_LABEL2 = "Loading";
3469
4171
  var SPINNER_RADIAL_PARTS = 8;
@@ -3502,7 +4204,7 @@ var renderIndicatorContent = (appearance) => {
3502
4204
  var Spinner = (props) => {
3503
4205
  const theme = useComponentTheme("Spinner");
3504
4206
  const { rootAttrs, rest } = composeRootAttrs(SpinnerBase, props, theme, {
3505
- stateAttrs: ({ variant = DEFAULT_VARIANT8, size = DEFAULT_SIZE13, appearance: appearance2 = DEFAULT_APPEARANCE7 }) => ({
4207
+ stateAttrs: ({ variant = DEFAULT_VARIANT8, size = DEFAULT_SIZE14, appearance: appearance2 = DEFAULT_APPEARANCE7 }) => ({
3506
4208
  "data-variant": variant,
3507
4209
  "data-size": size,
3508
4210
  "data-type": appearance2
@@ -3559,8 +4261,8 @@ var [StepperItemProvider, useStepperItem] = createSafeContext("Stepper.Item");
3559
4261
 
3560
4262
  // src/components/stepper/defaults.ts
3561
4263
  var DEFAULT_ORIENTATION3 = "horizontal";
3562
- var DEFAULT_MODE2 = "default";
3563
- var DEFAULT_SIZE14 = "base";
4264
+ var DEFAULT_MODE3 = "default";
4265
+ var DEFAULT_SIZE15 = "base";
3564
4266
  var DEFAULT_ACTIVE = 0;
3565
4267
  var DEFAULT_COMPLETED_LABEL = "completed";
3566
4268
  var DEFAULT_ERROR_LABEL = "error";
@@ -3568,7 +4270,7 @@ var FOCUSABLE_TRIGGER_SELECTOR = '.tk-stepper-trigger:not(:disabled):not([tabind
3568
4270
  var Stepper = (props) => {
3569
4271
  const theme = useComponentTheme("Stepper");
3570
4272
  const { rootAttrs, rest } = composeRootAttrs(StepperBase, props, theme, {
3571
- stateAttrs: ({ orientation: orientation2 = DEFAULT_ORIENTATION3, mode: mode2 = DEFAULT_MODE2, size = DEFAULT_SIZE14, linear: linear2 = false, reverse = false }) => ({
4273
+ stateAttrs: ({ orientation: orientation2 = DEFAULT_ORIENTATION3, mode: mode2 = DEFAULT_MODE3, size = DEFAULT_SIZE15, linear: linear2 = false, reverse = false }) => ({
3572
4274
  "data-orientation": orientation2,
3573
4275
  "data-mode": mode2,
3574
4276
  "data-size": size,
@@ -3582,7 +4284,7 @@ var Stepper = (props) => {
3582
4284
  onActiveChange,
3583
4285
  onStepClick,
3584
4286
  orientation = DEFAULT_ORIENTATION3,
3585
- mode = DEFAULT_MODE2,
4287
+ mode = DEFAULT_MODE3,
3586
4288
  // Consumed only as root data-* hooks above; destructured so the <ol>
3587
4289
  // doesn't receive unknown DOM attributes.
3588
4290
  size: _size,
@@ -3699,7 +4401,7 @@ var StepperTitle = (props) => {
3699
4401
  return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...nativeProps, ...rootAttrs, ref, children });
3700
4402
  };
3701
4403
  StepperTitle.displayName = "Stepper.Title";
3702
- var visuallyHidden = {
4404
+ var visuallyHidden2 = {
3703
4405
  position: "absolute",
3704
4406
  width: 1,
3705
4407
  height: 1,
@@ -3785,7 +4487,7 @@ var StepperItem = (props) => {
3785
4487
  children: [
3786
4488
  /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", ...indicatorAttrs, children: indicatorContent }),
3787
4489
  /* @__PURE__ */ jsxRuntime.jsx("span", { ...contentAttrs, children }),
3788
- statusLabel ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: visuallyHidden, children: `, ${statusLabel}` }) : null
4490
+ statusLabel ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: visuallyHidden2, children: `, ${statusLabel}` }) : null
3789
4491
  ]
3790
4492
  }
3791
4493
  )
@@ -3836,12 +4538,12 @@ var SwitchBase = createComponentBase({
3836
4538
  var [SwitchProvider, useSwitchOwnContext] = createSafeContext("SwitchProvider");
3837
4539
 
3838
4540
  // src/components/switch/defaults.ts
3839
- var DEFAULT_SIZE15 = "base";
4541
+ var DEFAULT_SIZE16 = "base";
3840
4542
  var DEFAULT_VARIANT9 = "info";
3841
4543
  var Switch = (props) => {
3842
4544
  const theme = useComponentTheme("Switch");
3843
4545
  const { rootAttrs, rest } = composeRootAttrs(SwitchBase, props, theme, {
3844
- stateAttrs: ({ size = DEFAULT_SIZE15, variant = DEFAULT_VARIANT9 }) => ({
4546
+ stateAttrs: ({ size = DEFAULT_SIZE16, variant = DEFAULT_VARIANT9 }) => ({
3845
4547
  "data-size": size,
3846
4548
  "data-variant": variant
3847
4549
  })
@@ -3968,7 +4670,7 @@ var TableBase = createComponentBase({
3968
4670
  var [TableProvider, useTableContext] = createSafeContext("Table");
3969
4671
 
3970
4672
  // src/components/table/defaults.ts
3971
- var DEFAULT_SIZE16 = "base";
4673
+ var DEFAULT_SIZE17 = "base";
3972
4674
  var DEFAULT_PAGE_SIZE = 10;
3973
4675
  var DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100];
3974
4676
  var DEFAULT_COLUMN_WIDTH = 150;
@@ -4338,7 +5040,7 @@ var TableHeaderCell = ({ header }) => {
4338
5040
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ...slotAttrs("headerContent"), children: [
4339
5041
  canSort ? /* @__PURE__ */ jsxRuntime.jsxs("button", { ...slotAttrs("sortTrigger"), type: "button", onClick: column.getToggleSortingHandler(), children: [
4340
5042
  content,
4341
- /* @__PURE__ */ jsxRuntime.jsx("span", { ...slotAttrs("sortIcon"), "data-direction": sorted || "none", "aria-hidden": "true", children: sorted === "asc" ? /* @__PURE__ */ jsxRuntime.jsx(chevronTop.ChevronTopIconOutlinedRounded, {}) : sorted === "desc" ? /* @__PURE__ */ jsxRuntime.jsx(chevronBottom.ChevronBottomIconOutlinedRounded, {}) : /* @__PURE__ */ jsxRuntime.jsx(swap.SwapIconOutlinedRounded, {}) })
5043
+ /* @__PURE__ */ jsxRuntime.jsx("span", { ...slotAttrs("sortIcon"), "data-direction": sorted || "none", "aria-hidden": "true", children: sorted === "asc" ? /* @__PURE__ */ jsxRuntime.jsx(arrowTop.ArrowTopIconOutlinedRounded, {}) : sorted === "desc" ? /* @__PURE__ */ jsxRuntime.jsx(arrowBottom.ArrowBottomIconOutlinedRounded, {}) : /* @__PURE__ */ jsxRuntime.jsx(swap.SwapIconOutlinedRounded, {}) })
4342
5044
  ] }) : content,
4343
5045
  canFilter && /* @__PURE__ */ jsxRuntime.jsx(TableColumnFilter, { header })
4344
5046
  ] })
@@ -4392,7 +5094,7 @@ var TablePagination = () => {
4392
5094
  variant: "neutral",
4393
5095
  appearance: "text",
4394
5096
  "aria-label": "First page",
4395
- startContent: /* @__PURE__ */ jsxRuntime.jsx(arrowLeft.ArrowLeftIconOutlinedRounded, {}),
5097
+ startContent: /* @__PURE__ */ jsxRuntime.jsx(doubleChevronLeft.DoubleChevronLeftIconOutlinedRounded, {}),
4396
5098
  disabled: !table.getCanPreviousPage(),
4397
5099
  onClick: () => table.setPageIndex(0)
4398
5100
  }
@@ -4449,7 +5151,7 @@ var TablePagination = () => {
4449
5151
  variant: "neutral",
4450
5152
  appearance: "text",
4451
5153
  "aria-label": "Last page",
4452
- startContent: /* @__PURE__ */ jsxRuntime.jsx(arrowRight.ArrowRightIconOutlinedRounded, {}),
5154
+ startContent: /* @__PURE__ */ jsxRuntime.jsx(doubleChevronRight.DoubleChevronRightIconOutlinedRounded, {}),
4453
5155
  disabled: !table.getCanNextPage() || pageCount <= 0,
4454
5156
  onClick: () => table.setPageIndex(pageCount - 1)
4455
5157
  }
@@ -4494,7 +5196,7 @@ var Table = (props) => {
4494
5196
  // Visual vocabulary lives on the root so recipes cascade
4495
5197
  // to the portal-free table descendants. `data-loading` mirrors the
4496
5198
  // boolean-presence convention (rule 5).
4497
- stateAttrs: ({ size: size2 = DEFAULT_SIZE16, striped: striped2, bordered: bordered2, stickyHeader: stickyHeader2, loading: loading2 }) => ({
5199
+ stateAttrs: ({ size: size2 = DEFAULT_SIZE17, striped: striped2, bordered: bordered2, stickyHeader: stickyHeader2, loading: loading2 }) => ({
4498
5200
  "data-size": size2,
4499
5201
  "data-striped": striped2 ? "" : void 0,
4500
5202
  "data-bordered": bordered2 ? "" : void 0,
@@ -4508,7 +5210,7 @@ var Table = (props) => {
4508
5210
  getRowId,
4509
5211
  manual = false,
4510
5212
  loading = false,
4511
- size = DEFAULT_SIZE16,
5213
+ size = DEFAULT_SIZE17,
4512
5214
  striped = false,
4513
5215
  bordered = false,
4514
5216
  stickyHeader = false,
@@ -4708,19 +5410,19 @@ var TabsContentBase = createComponentBase({
4708
5410
  var [TabsOwnProvider, useTabsOwnContext] = createSafeContext("Tabs");
4709
5411
 
4710
5412
  // src/components/tabs/defaults.ts
4711
- var DEFAULT_SIZE17 = "base";
5413
+ var DEFAULT_SIZE18 = "base";
4712
5414
  var DEFAULT_VARIANT10 = "primary";
4713
5415
  var DEFAULT_APPEARANCE8 = "basic";
4714
5416
  var Tabs = (props) => {
4715
5417
  const theme = useComponentTheme("Tabs");
4716
5418
  const { rootAttrs, rest } = composeRootAttrs(TabsBase, props, theme, {
4717
- stateAttrs: ({ size: size2 = DEFAULT_SIZE17, variant: variant2 = DEFAULT_VARIANT10, appearance: appearance2 = DEFAULT_APPEARANCE8 }) => ({
5419
+ stateAttrs: ({ size: size2 = DEFAULT_SIZE18, variant: variant2 = DEFAULT_VARIANT10, appearance: appearance2 = DEFAULT_APPEARANCE8 }) => ({
4718
5420
  "data-size": size2,
4719
5421
  "data-variant": variant2,
4720
5422
  "data-type": appearance2
4721
5423
  })
4722
5424
  });
4723
- const { size = DEFAULT_SIZE17, variant = DEFAULT_VARIANT10, appearance = DEFAULT_APPEARANCE8, children, ref, ...sparProps } = rest;
5425
+ const { size = DEFAULT_SIZE18, variant = DEFAULT_VARIANT10, appearance = DEFAULT_APPEARANCE8, children, ref, ...sparProps } = rest;
4724
5426
  return /* @__PURE__ */ jsxRuntime.jsx(TabsOwnProvider, { value: { size, variant, appearance }, children: /* @__PURE__ */ jsxRuntime.jsx(spar.Tabs, { ...sparProps, ...rootAttrs, ref, children }) });
4725
5427
  };
4726
5428
  Tabs.displayName = "Tabs";
@@ -4882,7 +5584,7 @@ var ToastBase = createComponentBase({
4882
5584
 
4883
5585
  // src/components/toast/defaults.ts
4884
5586
  var DEFAULT_TOAST_APPEARANCE = "filled";
4885
- var DEFAULT_CLOSE_LABEL2 = "Dismiss notification";
5587
+ var DEFAULT_CLOSE_LABEL5 = "Dismiss notification";
4886
5588
 
4887
5589
  // src/components/toast/utils.ts
4888
5590
  var toastTypeToVariant = (type) => {
@@ -4903,7 +5605,7 @@ var toastTypeToVariant = (type) => {
4903
5605
  var Toast = (props) => {
4904
5606
  const theme = useComponentTheme("Toast");
4905
5607
  const { rootAttrs, rest } = composeRootAttrs(ToastBase, props, theme);
4906
- const { as, toast, toaster, appearance = DEFAULT_TOAST_APPEARANCE, closeLabel = DEFAULT_CLOSE_LABEL2, children, ref, ...toastProps } = rest;
5608
+ const { as, toast, toaster, appearance = DEFAULT_TOAST_APPEARANCE, closeLabel = DEFAULT_CLOSE_LABEL5, children, ref, ...toastProps } = rest;
4907
5609
  const Component = as ?? "div";
4908
5610
  const variant = toastTypeToVariant(toast.type);
4909
5611
  return /* @__PURE__ */ jsxRuntime.jsx(spar.Toast.Root, { ...toastProps, as: Component, ref, toast, toaster, ...rootAttrs, children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(Alert2, { variant, appearance, role: "presentation", children: [
@@ -4923,7 +5625,7 @@ var Toaster = (props) => {
4923
5625
  "data-placement": toaster2.placement
4924
5626
  })
4925
5627
  });
4926
- const { as, toaster, appearance = DEFAULT_TOAST_APPEARANCE, closeLabel = DEFAULT_CLOSE_LABEL2, overlap = false, children, ref, ...toasterProps } = rest;
5628
+ const { as, toaster, appearance = DEFAULT_TOAST_APPEARANCE, closeLabel = DEFAULT_CLOSE_LABEL5, overlap = false, children, ref, ...toasterProps } = rest;
4927
5629
  const Component = as ?? "div";
4928
5630
  return /* @__PURE__ */ jsxRuntime.jsx(spar.Toaster, { ...toasterProps, as: Component, ref, toaster, overlap, ...rootAttrs, children: (toast) => (
4929
5631
  // Spar renders each item directly into a mapped array, so the key must
@@ -4972,6 +5674,1055 @@ var Skeleton = (props) => {
4972
5674
  };
4973
5675
  Skeleton.displayName = "Skeleton";
4974
5676
 
5677
+ // src/components/upload/base.ts
5678
+ var UploadBase = createComponentBase({
5679
+ name: "Upload",
5680
+ slots: ["root"],
5681
+ classes: { root: "tk-upload" }
5682
+ });
5683
+ var UploadDropzoneBase = createComponentBase({
5684
+ name: "UploadDropzone",
5685
+ slots: ["root"],
5686
+ classes: { root: "tk-upload-dropzone" }
5687
+ });
5688
+ var UploadActionsBase = createComponentBase({
5689
+ name: "UploadActions",
5690
+ slots: ["root"],
5691
+ classes: { root: "tk-upload-actions" }
5692
+ });
5693
+ var UploadTriggerBase = createComponentBase({
5694
+ name: "UploadTrigger",
5695
+ slots: ["root"],
5696
+ classes: { root: "tk-upload-trigger" }
5697
+ });
5698
+ var UploadSubmitBase = createComponentBase({
5699
+ name: "UploadSubmit",
5700
+ slots: ["root"],
5701
+ classes: { root: "tk-upload-submit" }
5702
+ });
5703
+ var UploadListBase = createComponentBase({
5704
+ name: "UploadList",
5705
+ slots: ["root"],
5706
+ classes: { root: "tk-upload-list" }
5707
+ });
5708
+ var UploadItemBase = createComponentBase({
5709
+ name: "UploadItem",
5710
+ slots: ["root"],
5711
+ classes: { root: "tk-upload-item" }
5712
+ });
5713
+ var UploadItemContentBase = createComponentBase({
5714
+ name: "UploadItemContent",
5715
+ slots: ["root", "name", "size", "status", "progress"],
5716
+ classes: {
5717
+ root: "tk-upload-item-content",
5718
+ name: "tk-upload-item-name",
5719
+ size: "tk-upload-item-size",
5720
+ status: "tk-upload-item-status",
5721
+ progress: "tk-upload-item-progress"
5722
+ }
5723
+ });
5724
+ var UploadItemPreviewBase = createComponentBase({
5725
+ name: "UploadItemPreview",
5726
+ slots: ["root", "image", "icon", "extension"],
5727
+ classes: {
5728
+ root: "tk-upload-item-preview",
5729
+ image: "tk-upload-item-preview-image",
5730
+ icon: "tk-upload-item-preview-icon",
5731
+ extension: "tk-upload-item-preview-extension"
5732
+ }
5733
+ });
5734
+ var UploadItemActionsBase = createComponentBase({
5735
+ name: "UploadItemActions",
5736
+ slots: ["root"],
5737
+ classes: { root: "tk-upload-item-actions" }
5738
+ });
5739
+ var UploadItemActionBase = createComponentBase({
5740
+ name: "UploadItemAction",
5741
+ slots: ["root"],
5742
+ classes: { root: "tk-upload-item-action" }
5743
+ });
5744
+
5745
+ // src/components/upload/context.ts
5746
+ var [UploadProvider, useUploadContext] = createSafeContext("UploadProvider");
5747
+ var [UploadItemProvider, useUploadItemContext] = createSafeContext("UploadItemProvider");
5748
+
5749
+ // src/components/upload/defaults.ts
5750
+ var DEFAULT_MULTIPLE = false;
5751
+ var DEFAULT_DIRECTORY = false;
5752
+ var DEFAULT_STATUS = "idle";
5753
+ var DEFAULT_UPLOADING_LABEL = "Uploading\u2026";
5754
+ var DEFAULT_PROCESSING_LABEL = "Processing\u2026";
5755
+ var DEFAULT_COMPLETED_LABEL2 = "Completed";
5756
+ var DEFAULT_ERROR_LABEL2 = "Failed";
5757
+ var DEFAULT_PROGRESS_LABEL = "{name} upload progress";
5758
+ var DEFAULT_DOWNLOAD_LABEL = "Download {name}";
5759
+ var DEFAULT_REMOVE_LABEL2 = "Remove {name}";
5760
+
5761
+ // src/components/upload/helpers.ts
5762
+ var fileKey = (file) => `${file.webkitRelativePath || file.name}:${file.size}:${file.lastModified}`;
5763
+ var idCounter = 0;
5764
+ var generateId = () => {
5765
+ const cryptoObj = typeof globalThis !== "undefined" ? globalThis.crypto : void 0;
5766
+ if (cryptoObj && typeof cryptoObj.randomUUID === "function") {
5767
+ try {
5768
+ return cryptoObj.randomUUID();
5769
+ } catch {
5770
+ }
5771
+ }
5772
+ idCounter += 1;
5773
+ return `tk-upload-${idCounter}-${Date.now().toString(36)}`;
5774
+ };
5775
+ var createUploadFile = (file) => ({
5776
+ id: generateId(),
5777
+ file,
5778
+ name: file.name,
5779
+ size: file.size,
5780
+ type: file.type,
5781
+ status: DEFAULT_STATUS
5782
+ });
5783
+ var fileName = (item) => item.name ?? item.file?.name ?? "";
5784
+ var fileSize = (item) => item.size ?? item.file?.size;
5785
+ var fileType = (item) => item.type ?? item.file?.type;
5786
+ var fileStatus = (item) => item.status ?? DEFAULT_STATUS;
5787
+ var formatFileLabel = (template, name) => template.split("{name}").join(name);
5788
+ var isConsumerVeto = (event, preventedOnEntry) => event.defaultPrevented && !preventedOnEntry;
5789
+ var SIZE_UNITS = ["byte", "kilobyte", "megabyte", "gigabyte", "terabyte"];
5790
+ var sizeFormatters = /* @__PURE__ */ new Map();
5791
+ var sizeFormatter = (exponent) => {
5792
+ let formatter = sizeFormatters.get(exponent);
5793
+ if (!formatter) {
5794
+ formatter = new Intl.NumberFormat(void 0, { style: "unit", unit: SIZE_UNITS[exponent], unitDisplay: "short" });
5795
+ sizeFormatters.set(exponent, formatter);
5796
+ }
5797
+ return formatter;
5798
+ };
5799
+ var roundForUnit = (value, exponent) => exponent === 0 || value >= 100 ? Math.round(value) : Math.round(value * 10) / 10;
5800
+ var formatFileSize = (bytes) => {
5801
+ if (!Number.isFinite(bytes) || bytes <= 0) return sizeFormatter(0).format(0);
5802
+ let exponent = Math.max(0, Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), SIZE_UNITS.length - 1));
5803
+ let rounded = roundForUnit(bytes / 1024 ** exponent, exponent);
5804
+ if (rounded >= 1024 && exponent < SIZE_UNITS.length - 1) {
5805
+ exponent += 1;
5806
+ rounded = roundForUnit(bytes / 1024 ** exponent, exponent);
5807
+ }
5808
+ return sizeFormatter(exponent).format(rounded);
5809
+ };
5810
+ var OBJECT_URL_TTL_MS = 1e3;
5811
+ var canSaveUploadFile = (item) => Boolean(item.file || item.url);
5812
+ var saveUploadFile = (item) => {
5813
+ const canCreate = typeof URL !== "undefined" && typeof URL.createObjectURL === "function";
5814
+ const objectUrl = item.file && canCreate ? URL.createObjectURL(item.file) : void 0;
5815
+ const href = objectUrl ?? item.url;
5816
+ if (!href) return;
5817
+ const link = document.createElement("a");
5818
+ link.href = href;
5819
+ link.download = fileName(item);
5820
+ document.body.append(link);
5821
+ link.click();
5822
+ link.remove();
5823
+ if (objectUrl) setTimeout(() => URL.revokeObjectURL(objectUrl), OBJECT_URL_TTL_MS);
5824
+ };
5825
+ var IMAGE_TYPES = /* @__PURE__ */ new Set(["image/jpeg", "image/png", "image/gif", "image/webp", "image/avif", "image/svg+xml"]);
5826
+ var isImageType = (type) => type !== void 0 && IMAGE_TYPES.has(type);
5827
+ var nameExtension = (name) => {
5828
+ const dot = name.lastIndexOf(".");
5829
+ return dot > 0 ? name.slice(dot + 1).toUpperCase() : "";
5830
+ };
5831
+ var ICON_BY_EXTENSION = {
5832
+ DOC: "word",
5833
+ DOCX: "word",
5834
+ JPEG: "jpg",
5835
+ JPG: "jpg",
5836
+ MP4: "mp4",
5837
+ PDF: "pdf",
5838
+ PNG: "png",
5839
+ PPT: "powerpoint",
5840
+ PPTX: "powerpoint",
5841
+ TXT: "text",
5842
+ XLS: "excel",
5843
+ XLSX: "excel",
5844
+ ZIP: "zip"
5845
+ };
5846
+ var ICON_BY_TYPE = {
5847
+ "application/msword": "word",
5848
+ "application/pdf": "pdf",
5849
+ "application/vnd.ms-excel": "excel",
5850
+ "application/vnd.ms-powerpoint": "powerpoint",
5851
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation": "powerpoint",
5852
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "excel",
5853
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "word",
5854
+ "application/zip": "zip",
5855
+ "image/jpeg": "jpg",
5856
+ "image/png": "png",
5857
+ "text/plain": "text",
5858
+ "video/mp4": "mp4"
5859
+ };
5860
+ var fileIconName = (item) => {
5861
+ const type = fileType(item);
5862
+ return ICON_BY_EXTENSION[nameExtension(fileName(item))] ?? (type ? ICON_BY_TYPE[type.toLowerCase()] : void 0);
5863
+ };
5864
+ var isWildcard = (token) => token === "*" || token === "*/*";
5865
+ var acceptTokens = (accept) => accept ? accept.split(",").map((token) => token.trim().toLowerCase()).filter((token) => token !== "") : [];
5866
+ var acceptsAnything = (tokens) => tokens.length === 0 || tokens.some(isWildcard);
5867
+ var tokenMatchesFile = (token, file) => {
5868
+ if (token.startsWith(".")) return file.name.toLowerCase().endsWith(token);
5869
+ const type = file.type.toLowerCase();
5870
+ if (token.endsWith("/*")) return type.startsWith(token.slice(0, -1));
5871
+ return type === token;
5872
+ };
5873
+ var matchesAccept = (file, accept) => {
5874
+ const tokens = acceptTokens(accept);
5875
+ if (acceptsAnything(tokens)) return true;
5876
+ return tokens.some((token) => tokenMatchesFile(token, file));
5877
+ };
5878
+ var acceptMatchesType = (type, accept) => {
5879
+ const tokens = acceptTokens(accept);
5880
+ if (acceptsAnything(tokens)) return true;
5881
+ const t = type.toLowerCase();
5882
+ let unjudgeable = false;
5883
+ for (const token of tokens) {
5884
+ if (token.startsWith(".")) {
5885
+ unjudgeable = true;
5886
+ continue;
5887
+ }
5888
+ if (token.endsWith("/*") ? t.startsWith(token.slice(0, -1)) : t === token) return true;
5889
+ }
5890
+ return unjudgeable;
5891
+ };
5892
+ var validateFiles = (incoming, options) => {
5893
+ const { accept, maxFileSize, maxFileCount, multiple, currentCount } = options;
5894
+ const accepted = [];
5895
+ const rejected = [];
5896
+ const limit = multiple ? maxFileCount : 1;
5897
+ let slots = limit === void 0 ? Number.POSITIVE_INFINITY : Math.max(0, limit - (multiple ? currentCount : 0));
5898
+ for (const file of incoming) {
5899
+ if (!matchesAccept(file, accept)) {
5900
+ rejected.push({ file, code: "file-invalid-type", accept });
5901
+ continue;
5902
+ }
5903
+ if (maxFileSize !== void 0 && file.size > maxFileSize) {
5904
+ rejected.push({ file, code: "file-too-large", maxFileSize });
5905
+ continue;
5906
+ }
5907
+ if (slots <= 0) {
5908
+ rejected.push({ file, code: "too-many-files", maxFileCount: limit });
5909
+ continue;
5910
+ }
5911
+ accepted.push(file);
5912
+ slots -= 1;
5913
+ }
5914
+ return { accepted, rejected };
5915
+ };
5916
+ var Upload = (props) => {
5917
+ const theme = useComponentTheme("Upload");
5918
+ const field = spar.useOptionalFieldContext();
5919
+ const inputRef = react.useRef(null);
5920
+ const { rootAttrs, rest } = composeRootAttrs(UploadBase, props, theme);
5921
+ const {
5922
+ value,
5923
+ defaultValue,
5924
+ onValueChange,
5925
+ accept,
5926
+ multiple: ownMultiple = DEFAULT_MULTIPLE,
5927
+ directory = DEFAULT_DIRECTORY,
5928
+ maxFileSize,
5929
+ maxFileCount,
5930
+ onFileAccept,
5931
+ onFilesReject,
5932
+ // The status four resolve here, at the destructure site: `??`, so an empty
5933
+ // one is honoured and the support line goes away with its glyph.
5934
+ uploadingLabel = DEFAULT_UPLOADING_LABEL,
5935
+ processingLabel = DEFAULT_PROCESSING_LABEL,
5936
+ completedLabel = DEFAULT_COMPLETED_LABEL2,
5937
+ errorLabel = DEFAULT_ERROR_LABEL2,
5938
+ // The accessible-name three cannot resolve here — see below.
5939
+ progressLabel: ownProgressLabel,
5940
+ downloadLabel: ownDownloadLabel,
5941
+ removeLabel: ownRemoveLabel,
5942
+ disabled: ownDisabled,
5943
+ readOnly: ownReadOnly,
5944
+ invalid: ownInvalid,
5945
+ as,
5946
+ children,
5947
+ ref,
5948
+ ...nativeProps
5949
+ } = rest;
5950
+ const multiple = ownMultiple || directory;
5951
+ const disabled = ownDisabled ?? field?.disabled ?? false;
5952
+ const readOnly = ownReadOnly ?? field?.readOnly ?? false;
5953
+ const invalid = ownInvalid ?? field?.invalid ?? false;
5954
+ const [files = [], setFiles, isControlled] = useControllableState(value, defaultValue ?? [], onValueChange);
5955
+ const latestFiles = react.useRef(files);
5956
+ latestFiles.current = files;
5957
+ const commitFiles = react.useCallback(
5958
+ (next) => {
5959
+ if (!isControlled) latestFiles.current = next;
5960
+ setFiles(next);
5961
+ },
5962
+ [isControlled, setFiles]
5963
+ );
5964
+ const processFiles = react.useCallback(
5965
+ (incoming) => {
5966
+ if (disabled || readOnly) return;
5967
+ const list = Array.from(incoming);
5968
+ if (list.length === 0) return;
5969
+ const current = latestFiles.current;
5970
+ const seen = new Set(current.filter((entry) => entry.file).map((entry) => fileKey(entry.file)));
5971
+ const fresh = list.filter((file) => {
5972
+ const key = fileKey(file);
5973
+ if (seen.has(key)) return false;
5974
+ seen.add(key);
5975
+ return true;
5976
+ });
5977
+ const { accepted, rejected } = validateFiles(fresh, { accept, maxFileSize, maxFileCount, multiple, currentCount: current.length });
5978
+ const added = accepted.map(createUploadFile);
5979
+ if (added.length > 0) {
5980
+ commitFiles(multiple ? [...current, ...added] : added);
5981
+ onFileAccept?.(added);
5982
+ }
5983
+ if (rejected.length > 0) {
5984
+ onFilesReject?.(rejected);
5985
+ }
5986
+ },
5987
+ [disabled, readOnly, accept, maxFileSize, maxFileCount, multiple, commitFiles, onFileAccept, onFilesReject]
5988
+ );
5989
+ const openFileDialog = react.useCallback(() => {
5990
+ if (disabled || readOnly) return;
5991
+ inputRef.current?.click();
5992
+ }, [disabled, readOnly]);
5993
+ const removeFile = react.useCallback(
5994
+ (id) => {
5995
+ if (disabled || readOnly) return;
5996
+ commitFiles(latestFiles.current.filter((entry) => entry.id !== id));
5997
+ if (inputRef.current) inputRef.current.value = "";
5998
+ },
5999
+ [disabled, readOnly, commitFiles]
6000
+ );
6001
+ const handleInputChange = (event) => {
6002
+ processFiles(event.target.files ?? []);
6003
+ event.target.value = "";
6004
+ };
6005
+ const progressLabel = ownProgressLabel || DEFAULT_PROGRESS_LABEL;
6006
+ const downloadLabel = ownDownloadLabel || DEFAULT_DOWNLOAD_LABEL;
6007
+ const removeLabel = ownRemoveLabel || DEFAULT_REMOVE_LABEL2;
6008
+ const contextValue = react.useMemo(
6009
+ () => ({
6010
+ files,
6011
+ disabled,
6012
+ readOnly,
6013
+ invalid,
6014
+ accept,
6015
+ multiple,
6016
+ openFileDialog,
6017
+ removeFile,
6018
+ processFiles,
6019
+ // Keyed by the status it stands for, so a row looks one up rather than
6020
+ // mapping names to states. Built inside this memo rather than one of its
6021
+ // own: it changes exactly when the four strings do, which is when the
6022
+ // context is rebuilt anyway.
6023
+ statusLabels: { uploading: uploadingLabel, processing: processingLabel, completed: completedLabel, error: errorLabel },
6024
+ progressLabel,
6025
+ downloadLabel,
6026
+ removeLabel
6027
+ }),
6028
+ [
6029
+ files,
6030
+ disabled,
6031
+ readOnly,
6032
+ invalid,
6033
+ accept,
6034
+ multiple,
6035
+ openFileDialog,
6036
+ removeFile,
6037
+ processFiles,
6038
+ uploadingLabel,
6039
+ processingLabel,
6040
+ completedLabel,
6041
+ errorLabel,
6042
+ progressLabel,
6043
+ downloadLabel,
6044
+ removeLabel
6045
+ ]
6046
+ );
6047
+ const Component = as ?? "div";
6048
+ const htmlProps = nativeProps;
6049
+ const named = htmlProps["aria-label"] !== void 0 || htmlProps["aria-labelledby"] !== void 0;
6050
+ const groupAttrs = {
6051
+ "id": htmlProps.id ?? field?.fieldId,
6052
+ "role": htmlProps.role ?? "group",
6053
+ "aria-labelledby": named ? htmlProps["aria-labelledby"] : field?.labelId,
6054
+ // Mirrors Spar's own controls: the error message replaces the description
6055
+ // while invalid, rather than both being announced.
6056
+ "aria-describedby": htmlProps["aria-describedby"] ?? (invalid ? field?.errorId : field?.descriptionId)
6057
+ };
6058
+ const stateAttrs = {
6059
+ ...disabled ? { "data-disabled": "" } : null,
6060
+ ...readOnly ? { "data-readonly": "" } : null,
6061
+ ...invalid ? { "data-invalid": "" } : null
6062
+ };
6063
+ return /* @__PURE__ */ jsxRuntime.jsx(UploadProvider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(Component, { ...nativeProps, ...groupAttrs, ...rootAttrs, ...stateAttrs, ref, children: [
6064
+ children,
6065
+ /* @__PURE__ */ jsxRuntime.jsx(
6066
+ spar.InputField,
6067
+ {
6068
+ ref: inputRef,
6069
+ type: "file",
6070
+ accept,
6071
+ multiple,
6072
+ ...directory ? { webkitdirectory: "" } : null,
6073
+ disabled: disabled || readOnly,
6074
+ onChange: handleInputChange,
6075
+ hidden: true,
6076
+ tabIndex: -1,
6077
+ "aria-hidden": "true"
6078
+ }
6079
+ )
6080
+ ] }) });
6081
+ };
6082
+ Upload.displayName = "Upload";
6083
+ var UploadActions = (props) => {
6084
+ const theme = useComponentTheme("UploadActions");
6085
+ useUploadContext("Upload.Actions");
6086
+ const { rootAttrs, rest } = composeRootAttrs(UploadActionsBase, props, theme);
6087
+ const { as, children, ref, ...nativeProps } = rest;
6088
+ const Component = as ?? "div";
6089
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...nativeProps, ...rootAttrs, ref, children });
6090
+ };
6091
+ UploadActions.displayName = "Upload.Actions";
6092
+ var dragStateFor = (event, accept) => {
6093
+ const items = event.dataTransfer?.items;
6094
+ if (!items || items.length === 0) return "accept";
6095
+ for (const item of Array.from(items)) {
6096
+ if (item.kind === "file" && !acceptMatchesType(item.type, accept)) return "reject";
6097
+ }
6098
+ return "accept";
6099
+ };
6100
+ var UploadDropzone = (props) => {
6101
+ const theme = useComponentTheme("UploadDropzone");
6102
+ const { disabled, readOnly, accept, processFiles } = useUploadContext("Upload.Dropzone");
6103
+ const { rootAttrs, rest } = composeRootAttrs(UploadDropzoneBase, props, theme);
6104
+ const {
6105
+ onDragEnter: slotOnDragEnter,
6106
+ onDragOver: slotOnDragOver,
6107
+ onDragLeave: slotOnDragLeave,
6108
+ onDrop: slotOnDrop,
6109
+ ...dropzoneRootAttrs
6110
+ } = rootAttrs;
6111
+ const { as, children, ref, onDragEnter, onDragOver, onDragLeave, onDrop, ...nativeProps } = rest;
6112
+ const [dragState, setDragState] = react.useState(null);
6113
+ const depth = react.useRef(0);
6114
+ const active = !disabled && !readOnly;
6115
+ const handleDragEnter = (event) => {
6116
+ onDragEnter?.(event);
6117
+ slotOnDragEnter?.(event);
6118
+ event.preventDefault();
6119
+ if (!active) return;
6120
+ depth.current += 1;
6121
+ setDragState(dragStateFor(event, accept));
6122
+ };
6123
+ const handleDragOver = (event) => {
6124
+ onDragOver?.(event);
6125
+ slotOnDragOver?.(event);
6126
+ event.preventDefault();
6127
+ if (!active) return;
6128
+ if (dragState === null) setDragState(dragStateFor(event, accept));
6129
+ };
6130
+ const handleDragLeave = (event) => {
6131
+ onDragLeave?.(event);
6132
+ slotOnDragLeave?.(event);
6133
+ depth.current = Math.max(0, depth.current - 1);
6134
+ if (depth.current === 0) setDragState(null);
6135
+ };
6136
+ const handleDrop = (event) => {
6137
+ onDrop?.(event);
6138
+ slotOnDrop?.(event);
6139
+ event.preventDefault();
6140
+ depth.current = 0;
6141
+ setDragState(null);
6142
+ if (!active) return;
6143
+ if (event.dataTransfer?.files?.length) processFiles(event.dataTransfer.files);
6144
+ };
6145
+ const Component = as ?? "div";
6146
+ return /* @__PURE__ */ jsxRuntime.jsx(
6147
+ Component,
6148
+ {
6149
+ ...nativeProps,
6150
+ ...dropzoneRootAttrs,
6151
+ "data-drag-state": dragState ?? void 0,
6152
+ onDragEnter: handleDragEnter,
6153
+ onDragOver: handleDragOver,
6154
+ onDragLeave: handleDragLeave,
6155
+ onDrop: handleDrop,
6156
+ ref,
6157
+ children
6158
+ }
6159
+ );
6160
+ };
6161
+ UploadDropzone.displayName = "Upload.Dropzone";
6162
+ var ACTION_ICON = {
6163
+ download: /* @__PURE__ */ jsxRuntime.jsx(arrowDownload.ArrowDownloadIconOutlinedRounded, { "aria-hidden": "true", focusable: "false" }),
6164
+ remove: /* @__PURE__ */ jsxRuntime.jsx(close.CloseIconOutlinedRounded, { "aria-hidden": "true", focusable: "false" })
6165
+ };
6166
+ var isBuiltInAction = (action) => action === "download" || action === "remove";
6167
+ var siblingRow = (row) => {
6168
+ const next = row.nextElementSibling;
6169
+ if (next?.matches(".tk-upload-item")) return next;
6170
+ const previous = row.previousElementSibling;
6171
+ return previous?.matches(".tk-upload-item") ? previous : null;
6172
+ };
6173
+ var moveFocusOffRow = (button) => {
6174
+ const row = button.closest(".tk-upload-item");
6175
+ const neighbour = row ? siblingRow(row) : null;
6176
+ const target = neighbour?.querySelector('[data-action="remove"]') ?? neighbour?.querySelector('button, [role="button"], a[href]') ?? button.closest(".tk-upload")?.querySelector(".tk-upload-trigger") ?? null;
6177
+ target?.focus();
6178
+ };
6179
+ var DEFAULT_ACTION_APPEARANCE = "outlined";
6180
+ var DEFAULT_ACTION_VARIANT = "neutral";
6181
+ var DEFAULT_ACTION_SIZE = "small";
6182
+ var UploadItemAction = (props) => {
6183
+ const theme = useComponentTheme("UploadItemAction");
6184
+ const { disabled, readOnly, removeFile, downloadLabel, removeLabel } = useUploadContext("Upload.ItemAction");
6185
+ const { item } = useUploadItemContext("Upload.ItemAction");
6186
+ const { rootAttrs, rest } = composeRootAttrs(UploadItemActionBase, props, theme, {
6187
+ // Which action this is: documented for consumers styling one action out of a
6188
+ // row. The look itself comes from Button's variant, not from this hook.
6189
+ stateAttrs: (merged) => ({ "data-action": merged.action })
6190
+ });
6191
+ const { onClick: slotOnClick, ...actionRootAttrs } = rootAttrs;
6192
+ const {
6193
+ as,
6194
+ action,
6195
+ label,
6196
+ children,
6197
+ ref,
6198
+ href,
6199
+ role,
6200
+ onClick,
6201
+ "disabled": ownDisabled,
6202
+ "aria-label": ariaLabel,
6203
+ // An icon button in the row: the anatomy and the look come from Button, so
6204
+ // the appearance knobs live here rather than in the Upload recipe. Applied
6205
+ // at the destructure site (the coding-standards rule) rather than pinned
6206
+ // after the spread, so they layer as defaults — a theme's
6207
+ // `UploadItemAction.defaultProps` is already merged into `rest` by
6208
+ // `composeRootAttrs`, and a value pinned after the spread would silently
6209
+ // outrank it.
6210
+ "appearance": appearance = DEFAULT_ACTION_APPEARANCE,
6211
+ "variant": variant = DEFAULT_ACTION_VARIANT,
6212
+ "size": size = DEFAULT_ACTION_SIZE,
6213
+ ...buttonProps
6214
+ } = rest;
6215
+ const isDisabled = disabled || ownDisabled === true;
6216
+ if (action === "remove" && readOnly) return null;
6217
+ const isButton = (as ?? "button") === "button";
6218
+ const hasHref = !isButton && href !== void 0;
6219
+ if (action === "download" && !canSaveUploadFile(item) && !hasHref && !onClick && !slotOnClick) return null;
6220
+ const nameTemplate = label || (action === "download" ? downloadLabel : action === "remove" ? removeLabel : void 0);
6221
+ const handleClick = (event) => {
6222
+ const button = event.currentTarget;
6223
+ const preventedOnEntry = event.defaultPrevented;
6224
+ onClick?.(event);
6225
+ slotOnClick?.(event);
6226
+ if (isConsumerVeto(event, preventedOnEntry)) return;
6227
+ if (action === "remove") {
6228
+ moveFocusOffRow(button);
6229
+ removeFile(item.id);
6230
+ } else if (action === "download" && !hasHref) saveUploadFile(item);
6231
+ };
6232
+ const renderedHref = isDisabled ? void 0 : href;
6233
+ const resolvedRole = role ?? (!isButton && as === "a" && renderedHref !== void 0 ? "link" : void 0);
6234
+ const roleProps = resolvedRole !== void 0 ? { role: resolvedRole } : void 0;
6235
+ return /* @__PURE__ */ jsxRuntime.jsx(
6236
+ Button,
6237
+ {
6238
+ ...buttonProps,
6239
+ ...isButton ? null : { href: renderedHref },
6240
+ ...roleProps,
6241
+ ...actionRootAttrs,
6242
+ as,
6243
+ appearance,
6244
+ variant,
6245
+ size,
6246
+ disabled: isDisabled,
6247
+ "aria-label": ariaLabel ?? (nameTemplate ? formatFileLabel(nameTemplate, fileName(item)) : void 0),
6248
+ onClick: handleClick,
6249
+ startContent: isRenderableNode(children) ? children : isBuiltInAction(action) ? ACTION_ICON[action] : null,
6250
+ ref
6251
+ }
6252
+ );
6253
+ };
6254
+ UploadItemAction.displayName = "Upload.ItemAction";
6255
+ var UploadItemActions = (props) => {
6256
+ const theme = useComponentTheme("UploadItemActions");
6257
+ const { readOnly } = useUploadContext("Upload.ItemActions");
6258
+ const { item } = useUploadItemContext("Upload.ItemActions");
6259
+ const { rootAttrs, rest } = composeRootAttrs(UploadItemActionsBase, props, theme);
6260
+ const { as, children, ref, ...nativeProps } = rest;
6261
+ const Component = as ?? "div";
6262
+ const hasChildren = isRenderableNode(children);
6263
+ const showDownload = canSaveUploadFile(item);
6264
+ const showRemove = !readOnly;
6265
+ if (!hasChildren && !showDownload && !showRemove) return null;
6266
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...nativeProps, ...rootAttrs, ref, children: hasChildren ? children : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6267
+ showDownload && /* @__PURE__ */ jsxRuntime.jsx(UploadItemAction, { action: "download" }),
6268
+ showRemove && /* @__PURE__ */ jsxRuntime.jsx(UploadItemAction, { action: "remove" })
6269
+ ] }) });
6270
+ };
6271
+ UploadItemActions.displayName = "Upload.ItemActions";
6272
+ var statusLabelOf = (status, statusLabels) => status === "idle" ? null : statusLabels[status];
6273
+ var statusIcon = (status) => {
6274
+ switch (status) {
6275
+ case "uploading":
6276
+ case "processing":
6277
+ return /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: "small", appearance: "rounded", variant: "info", "aria-hidden": "true" });
6278
+ case "completed":
6279
+ return /* @__PURE__ */ jsxRuntime.jsx(checkCircle.CheckCircleIconFilledRounded, { "aria-hidden": "true", focusable: "false" });
6280
+ case "error":
6281
+ return /* @__PURE__ */ jsxRuntime.jsx(closeCircle.CloseCircleIconFilledRounded, { "aria-hidden": "true", focusable: "false" });
6282
+ default:
6283
+ return null;
6284
+ }
6285
+ };
6286
+ var UploadItemContent = (props) => {
6287
+ const theme = useComponentTheme("UploadItemContent");
6288
+ const { item } = useUploadItemContext("Upload.ItemContent");
6289
+ const { statusLabels, progressLabel } = useUploadContext("Upload.ItemContent");
6290
+ const { rootAttrs, rest } = composeRootAttrs(UploadItemContentBase, props, theme);
6291
+ const { as, children, ref, ...nativeProps } = rest;
6292
+ const slotAttrs = (slot) => buildSlotAttrs(UploadItemContentBase.getSlotProps(slot), slot, {
6293
+ themeSlotProps: theme?.slotProps,
6294
+ themeClassNames: theme?.classNames,
6295
+ instanceSlotProps: props.slotProps,
6296
+ instanceClassNames: props.classNames
6297
+ });
6298
+ const Component = as ?? "div";
6299
+ const name = fileName(item);
6300
+ const size = fileSize(item);
6301
+ const status = fileStatus(item);
6302
+ const icon = statusIcon(status);
6303
+ const statusLabel = statusLabelOf(status, statusLabels);
6304
+ const statusText = status === "error" ? item.error ?? statusLabel : statusLabel;
6305
+ const defaultContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6306
+ /* @__PURE__ */ jsxRuntime.jsx("span", { ...slotAttrs("name"), children: name }),
6307
+ size !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { ...slotAttrs("size"), children: formatFileSize(size) }),
6308
+ icon && statusText ? (
6309
+ // Icon plus its label, as one line: the glyph is decorative and the
6310
+ // text carries the meaning, so nothing here needs an aria-label of its
6311
+ // own. `title` keeps a long failure message reachable in full while the
6312
+ // line itself stays one row high.
6313
+ //
6314
+ // No text, no line — a status label emptied at the root takes the glyph
6315
+ // with it. The alternative is a lone `aria-hidden` icon: a mark that
6316
+ // says something to sighted users and nothing to anyone else, which is
6317
+ // the split this line exists to avoid.
6318
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { ...slotAttrs("status"), title: status === "error" ? item.error : void 0, children: [
6319
+ icon,
6320
+ statusText
6321
+ ] })
6322
+ ) : null,
6323
+ status === "uploading" && typeof item.progress === "number" && // The bar is the *determinate* face of uploading — it only appears once
6324
+ // there is a percentage to show. Without one, the spinner and its
6325
+ // "Uploading…" label above are already the indeterminate indicator, so
6326
+ // a second (looping) bar would say the same thing twice. `processing`
6327
+ // never gets one: a server-side step reports that it is running, not
6328
+ // how far along it is.
6329
+ /* @__PURE__ */ jsxRuntime.jsx("div", { ...slotAttrs("progress"), children: /* @__PURE__ */ jsxRuntime.jsx(Progress2, { value: item.progress, size: "small", "aria-label": formatFileLabel(progressLabel, name) }) })
6330
+ ] });
6331
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...nativeProps, ...rootAttrs, ref, children: isRenderableNode(children) ? children : defaultContent });
6332
+ };
6333
+ UploadItemContent.displayName = "Upload.ItemContent";
6334
+ var FileExcelIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: [
6335
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M28.75 1.25V9.58333C28.75 10.5042 29.4958 11.25 30.4167 11.25H38.75", stroke: "#CACFD8", strokeWidth: "1.875" }),
6336
+ /* @__PURE__ */ jsxRuntime.jsx(
6337
+ "path",
6338
+ {
6339
+ d: "M15 0.9375H26.8936C28.634 0.937541 30.3035 1.6287 31.5342 2.85938L37.1406 8.46582C38.3713 9.69649 39.0625 11.366 39.0625 13.1064V32.5C39.0625 36.1244 36.1244 39.0625 32.5 39.0625H15C11.3756 39.0625 8.4375 36.1244 8.4375 32.5V7.5C8.4375 3.87563 11.3756 0.9375 15 0.9375Z",
6340
+ stroke: "#CACFD8",
6341
+ strokeWidth: "1.875"
6342
+ }
6343
+ ),
6344
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { y: "15", width: "35", height: "20", rx: "5", fill: "#136C34" }),
6345
+ /* @__PURE__ */ jsxRuntime.jsx(
6346
+ "path",
6347
+ {
6348
+ d: "M6.76722 29L9.49122 24.692L6.91122 20.6H8.51922L10.4572 23.702L12.5272 20.6H14.0872L11.3752 24.728L14.1652 29H12.5512L10.4032 25.694L8.33322 29H6.76722ZM15.5803 29V20.6H16.9243V27.764H20.5843V29H15.5803ZM24.8436 29.18C24.2636 29.18 23.6956 29.098 23.1396 28.934C22.5876 28.766 22.1216 28.526 21.7416 28.214L22.4016 27.188C22.6016 27.36 22.8336 27.508 23.0976 27.632C23.3656 27.756 23.6496 27.852 23.9496 27.92C24.2496 27.984 24.5496 28.016 24.8496 28.016C25.3976 28.016 25.8396 27.912 26.1756 27.704C26.5156 27.496 26.6856 27.192 26.6856 26.792C26.6856 26.492 26.5696 26.238 26.3376 26.03C26.1096 25.822 25.6856 25.63 25.0656 25.454L24.2016 25.202C23.4096 24.974 22.8316 24.672 22.4676 24.296C22.1076 23.92 21.9276 23.452 21.9276 22.892C21.9276 22.52 22.0016 22.184 22.1496 21.884C22.3016 21.584 22.5136 21.324 22.7856 21.104C23.0616 20.884 23.3856 20.716 23.7576 20.6C24.1296 20.484 24.5376 20.426 24.9816 20.426C25.5456 20.426 26.0696 20.508 26.5536 20.672C27.0376 20.836 27.4376 21.056 27.7536 21.332L27.0696 22.328C26.8976 22.172 26.6956 22.038 26.4636 21.926C26.2356 21.814 25.9896 21.728 25.7256 21.668C25.4616 21.608 25.1936 21.578 24.9216 21.578C24.5856 21.578 24.2876 21.628 24.0276 21.728C23.7716 21.824 23.5716 21.964 23.4276 22.148C23.2836 22.332 23.2116 22.556 23.2116 22.82C23.2116 23.012 23.2596 23.18 23.3556 23.324C23.4516 23.468 23.6156 23.6 23.8476 23.72C24.0836 23.836 24.4076 23.954 24.8196 24.074L25.7316 24.344C26.5076 24.572 27.0756 24.87 27.4356 25.238C27.7956 25.602 27.9756 26.076 27.9756 26.66C27.9756 27.16 27.8516 27.6 27.6036 27.98C27.3596 28.356 27.0036 28.65 26.5356 28.862C26.0676 29.074 25.5036 29.18 24.8436 29.18Z",
6349
+ fill: "white"
6350
+ }
6351
+ )
6352
+ ] });
6353
+ var FileJpgIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: [
6354
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M28.75 1.25V9.58333C28.75 10.5042 29.4958 11.25 30.4167 11.25H38.75", stroke: "#CACFD8", strokeWidth: "1.875" }),
6355
+ /* @__PURE__ */ jsxRuntime.jsx(
6356
+ "path",
6357
+ {
6358
+ d: "M15 0.9375H26.8936C28.634 0.937541 30.3035 1.6287 31.5342 2.85938L37.1406 8.46582C38.3713 9.69649 39.0625 11.366 39.0625 13.1064V32.5C39.0625 36.1244 36.1244 39.0625 32.5 39.0625H15C11.3756 39.0625 8.4375 36.1244 8.4375 32.5V7.5C8.4375 3.87563 11.3756 0.9375 15 0.9375Z",
6359
+ stroke: "#CACFD8",
6360
+ strokeWidth: "1.875"
6361
+ }
6362
+ ),
6363
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { y: "15", width: "35", height: "20", rx: "5", fill: "#EAB308" }),
6364
+ /* @__PURE__ */ jsxRuntime.jsx(
6365
+ "path",
6366
+ {
6367
+ d: "M8.38769 29.18C8.01169 29.18 7.65369 29.13 7.31369 29.03C6.97769 28.934 6.66169 28.798 6.36569 28.622L6.80369 27.518C7.03969 27.654 7.27369 27.76 7.50569 27.836C7.74169 27.908 7.97969 27.944 8.21969 27.944C8.72369 27.944 9.10969 27.824 9.37769 27.584C9.64569 27.344 9.77969 26.954 9.77969 26.414V20.6H11.1237V26.636C11.1237 27.148 11.0177 27.596 10.8057 27.98C10.5937 28.36 10.2837 28.656 9.87569 28.868C9.46769 29.076 8.97169 29.18 8.38769 29.18ZM13.2951 29V20.6H16.3371C16.9331 20.6 17.4591 20.704 17.9151 20.912C18.3751 21.116 18.7351 21.412 18.9951 21.8C19.2551 22.184 19.3851 22.646 19.3851 23.186C19.3851 23.742 19.2651 24.212 19.0251 24.596C18.7851 24.976 18.4351 25.266 17.9751 25.466C17.5191 25.662 16.9631 25.76 16.3071 25.76H14.6391V29H13.2951ZM14.6391 24.608H16.3251C16.8691 24.608 17.2911 24.494 17.5911 24.266C17.8911 24.034 18.0411 23.684 18.0411 23.216C18.0411 22.752 17.8871 22.396 17.5791 22.148C17.2711 21.9 16.8571 21.776 16.3371 21.776H14.6391V24.608ZM25.0706 29.18C24.4026 29.18 23.7846 29.078 23.2166 28.874C22.6486 28.67 22.1506 28.378 21.7226 27.998C21.2986 27.614 20.9686 27.154 20.7326 26.618C20.4966 26.082 20.3786 25.48 20.3786 24.812C20.3786 24.148 20.4926 23.548 20.7206 23.012C20.9486 22.472 21.2666 22.01 21.6746 21.626C22.0866 21.238 22.5686 20.94 23.1206 20.732C23.6766 20.524 24.2826 20.42 24.9386 20.42C25.2426 20.42 25.5506 20.444 25.8626 20.492C26.1746 20.54 26.4806 20.62 26.7806 20.732C27.0846 20.84 27.3726 20.988 27.6446 21.176L27.0566 22.232C26.7526 22.04 26.4226 21.896 26.0666 21.8C25.7146 21.704 25.3506 21.656 24.9746 21.656C24.4866 21.656 24.0446 21.73 23.6486 21.878C23.2526 22.022 22.9146 22.232 22.6346 22.508C22.3546 22.78 22.1386 23.11 21.9866 23.498C21.8386 23.886 21.7646 24.322 21.7646 24.806C21.7646 25.486 21.9086 26.064 22.1966 26.54C22.4846 27.016 22.8806 27.378 23.3846 27.626C23.8926 27.87 24.4766 27.992 25.1366 27.992C25.4606 27.992 25.7526 27.962 26.0126 27.902C26.2726 27.838 26.4826 27.766 26.6426 27.686V25.658H24.7346V24.542H27.8486V28.466C27.6286 28.614 27.3526 28.742 27.0206 28.85C26.6926 28.958 26.3526 29.04 26.0006 29.096C25.6526 29.152 25.3426 29.18 25.0706 29.18Z",
6368
+ fill: "white"
6369
+ }
6370
+ )
6371
+ ] });
6372
+ var FileMp4Icon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: [
6373
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M28.75 1.25V9.58333C28.75 10.5042 29.4958 11.25 30.4167 11.25H38.75", stroke: "#CACFD8", strokeWidth: "1.875" }),
6374
+ /* @__PURE__ */ jsxRuntime.jsx(
6375
+ "path",
6376
+ {
6377
+ d: "M15 0.9375H26.8936C28.634 0.937541 30.3035 1.6287 31.5342 2.85938L37.1406 8.46582C38.3713 9.69649 39.0625 11.366 39.0625 13.1064V32.5C39.0625 36.1244 36.1244 39.0625 32.5 39.0625H15C11.3756 39.0625 8.4375 36.1244 8.4375 32.5V7.5C8.4375 3.87563 11.3756 0.9375 15 0.9375Z",
6378
+ stroke: "#CACFD8",
6379
+ strokeWidth: "1.875"
6380
+ }
6381
+ ),
6382
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { y: "15", width: "35", height: "20", rx: "5", fill: "#3B82F6" }),
6383
+ /* @__PURE__ */ jsxRuntime.jsx(
6384
+ "path",
6385
+ {
6386
+ d: "M5.70138 29V20.6H7.00338L10.4294 26.174L9.90738 26.18L13.2074 20.6H14.4854V29H13.1714L13.1894 22.388L13.4474 22.478L10.5914 27.188H9.60738L6.69738 22.478L6.91338 22.388L6.93138 29H5.70138ZM16.6701 29V20.6H19.7121C20.3081 20.6 20.8341 20.704 21.2901 20.912C21.7501 21.116 22.1101 21.412 22.3701 21.8C22.6301 22.184 22.7601 22.646 22.7601 23.186C22.7601 23.742 22.6401 24.212 22.4001 24.596C22.1601 24.976 21.8101 25.266 21.3501 25.466C20.8941 25.662 20.3381 25.76 19.6821 25.76H18.0141V29H16.6701ZM18.0141 24.608H19.7001C20.2441 24.608 20.6661 24.494 20.9661 24.266C21.2661 24.034 21.4161 23.684 21.4161 23.216C21.4161 22.752 21.2621 22.396 20.9541 22.148C20.6461 21.9 20.2321 21.776 19.7121 21.776H18.0141V24.608ZM27.5756 29V27.278H23.3936V26.264L26.4056 20.6H27.7736L24.8036 26.156H27.5756V24.29H28.7336V26.156H30.0296V27.278H28.7336V29H27.5756Z",
6387
+ fill: "white"
6388
+ }
6389
+ )
6390
+ ] });
6391
+ var FilePdfIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: [
6392
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M28.75 1.25V9.58333C28.75 10.5042 29.4958 11.25 30.4167 11.25H38.75", stroke: "#CACFD8", strokeWidth: "1.875" }),
6393
+ /* @__PURE__ */ jsxRuntime.jsx(
6394
+ "path",
6395
+ {
6396
+ d: "M15 0.9375H26.8936C28.634 0.937541 30.3035 1.6287 31.5342 2.85938L37.1406 8.46582C38.3713 9.69649 39.0625 11.366 39.0625 13.1064V32.5C39.0625 36.1244 36.1244 39.0625 32.5 39.0625H15C11.3756 39.0625 8.4375 36.1244 8.4375 32.5V7.5C8.4375 3.87563 11.3756 0.9375 15 0.9375Z",
6397
+ stroke: "#CACFD8",
6398
+ strokeWidth: "1.875"
6399
+ }
6400
+ ),
6401
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { y: "15", width: "35", height: "20", rx: "5", fill: "#C90019" }),
6402
+ /* @__PURE__ */ jsxRuntime.jsx(
6403
+ "path",
6404
+ {
6405
+ d: "M7.03145 29V20.6H10.0735C10.6695 20.6 11.1955 20.704 11.6515 20.912C12.1115 21.116 12.4715 21.412 12.7315 21.8C12.9915 22.184 13.1215 22.646 13.1215 23.186C13.1215 23.742 13.0015 24.212 12.7615 24.596C12.5215 24.976 12.1715 25.266 11.7115 25.466C11.2555 25.662 10.6995 25.76 10.0435 25.76H8.37545V29H7.03145ZM8.37545 24.608H10.0615C10.6055 24.608 11.0275 24.494 11.3275 24.266C11.6275 24.034 11.7775 23.684 11.7775 23.216C11.7775 22.752 11.6235 22.396 11.3155 22.148C11.0075 21.9 10.5935 21.776 10.0735 21.776H8.37545V24.608ZM14.6369 29V20.6H17.2649C18.1009 20.6 18.8389 20.78 19.4789 21.14C20.1189 21.496 20.6189 21.99 20.9789 22.622C21.3429 23.254 21.5249 23.982 21.5249 24.806C21.5249 25.418 21.4209 25.982 21.2129 26.498C21.0089 27.01 20.7169 27.452 20.3369 27.824C19.9569 28.196 19.5069 28.486 18.9869 28.694C18.4669 28.898 17.8929 29 17.2649 29H14.6369ZM15.9809 27.746H17.1029C17.5549 27.746 17.9649 27.68 18.3329 27.548C18.7049 27.412 19.0229 27.216 19.2869 26.96C19.5549 26.704 19.7609 26.396 19.9049 26.036C20.0489 25.672 20.1209 25.262 20.1209 24.806C20.1209 24.194 19.9949 23.668 19.7429 23.228C19.4949 22.784 19.1449 22.444 18.6929 22.208C18.2409 21.968 17.7109 21.848 17.1029 21.848H15.9809V27.746ZM23.1916 29V20.6H28.3816V21.83H24.5356V24.248H28.0216V25.448H24.5356V29H23.1916Z",
6406
+ fill: "white"
6407
+ }
6408
+ )
6409
+ ] });
6410
+ var FilePngIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: [
6411
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M28.75 1.25V9.58333C28.75 10.5042 29.4958 11.25 30.4167 11.25H38.75", stroke: "#CACFD8", strokeWidth: "1.875" }),
6412
+ /* @__PURE__ */ jsxRuntime.jsx(
6413
+ "path",
6414
+ {
6415
+ d: "M15 0.9375H26.8936C28.634 0.937541 30.3035 1.6287 31.5342 2.85938L37.1406 8.46582C38.3713 9.69649 39.0625 11.366 39.0625 13.1064V32.5C39.0625 36.1244 36.1244 39.0625 32.5 39.0625H15C11.3756 39.0625 8.4375 36.1244 8.4375 32.5V7.5C8.4375 3.87563 11.3756 0.9375 15 0.9375Z",
6416
+ stroke: "#CACFD8",
6417
+ strokeWidth: "1.875"
6418
+ }
6419
+ ),
6420
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { y: "15", width: "35", height: "20", rx: "5", fill: "#A47D06" }),
6421
+ /* @__PURE__ */ jsxRuntime.jsx(
6422
+ "path",
6423
+ {
6424
+ d: "M5.77169 29V20.6H8.81369C9.40969 20.6 9.93569 20.704 10.3917 20.912C10.8517 21.116 11.2117 21.412 11.4717 21.8C11.7317 22.184 11.8617 22.646 11.8617 23.186C11.8617 23.742 11.7417 24.212 11.5017 24.596C11.2617 24.976 10.9117 25.266 10.4517 25.466C9.99569 25.662 9.43969 25.76 8.78369 25.76H7.11569V29H5.77169ZM7.11569 24.608H8.80169C9.34569 24.608 9.76769 24.494 10.0677 24.266C10.3677 24.034 10.5177 23.684 10.5177 23.216C10.5177 22.752 10.3637 22.396 10.0557 22.148C9.74769 21.9 9.33369 21.776 8.81369 21.776H7.11569V24.608ZM13.3772 29V20.6H14.6612L18.9032 26.702V20.6H20.2112V29H18.9272L14.6912 22.826V29H13.3772ZM26.5706 29.18C25.9026 29.18 25.2846 29.078 24.7166 28.874C24.1486 28.67 23.6506 28.378 23.2226 27.998C22.7986 27.614 22.4686 27.154 22.2326 26.618C21.9966 26.082 21.8786 25.48 21.8786 24.812C21.8786 24.148 21.9926 23.548 22.2206 23.012C22.4486 22.472 22.7666 22.01 23.1746 21.626C23.5866 21.238 24.0686 20.94 24.6206 20.732C25.1766 20.524 25.7826 20.42 26.4386 20.42C26.7426 20.42 27.0506 20.444 27.3626 20.492C27.6746 20.54 27.9806 20.62 28.2806 20.732C28.5846 20.84 28.8726 20.988 29.1446 21.176L28.5566 22.232C28.2526 22.04 27.9226 21.896 27.5666 21.8C27.2146 21.704 26.8506 21.656 26.4746 21.656C25.9866 21.656 25.5446 21.73 25.1486 21.878C24.7526 22.022 24.4146 22.232 24.1346 22.508C23.8546 22.78 23.6386 23.11 23.4866 23.498C23.3386 23.886 23.2646 24.322 23.2646 24.806C23.2646 25.486 23.4086 26.064 23.6966 26.54C23.9846 27.016 24.3806 27.378 24.8846 27.626C25.3926 27.87 25.9766 27.992 26.6366 27.992C26.9606 27.992 27.2526 27.962 27.5126 27.902C27.7726 27.838 27.9826 27.766 28.1426 27.686V25.658H26.2346V24.542H29.3486V28.466C29.1286 28.614 28.8526 28.742 28.5206 28.85C28.1926 28.958 27.8526 29.04 27.5006 29.096C27.1526 29.152 26.8426 29.18 26.5706 29.18Z",
6425
+ fill: "white"
6426
+ }
6427
+ )
6428
+ ] });
6429
+ var FilePowerpointIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: [
6430
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M28.75 1.25V9.58333C28.75 10.5042 29.4958 11.25 30.4167 11.25H38.75", stroke: "#CACFD8", strokeWidth: "1.875" }),
6431
+ /* @__PURE__ */ jsxRuntime.jsx(
6432
+ "path",
6433
+ {
6434
+ d: "M15 0.9375H26.8936C28.634 0.937541 30.3035 1.6287 31.5342 2.85938L37.1406 8.46582C38.3713 9.69649 39.0625 11.366 39.0625 13.1064V32.5C39.0625 36.1244 36.1244 39.0625 32.5 39.0625H15C11.3756 39.0625 8.4375 36.1244 8.4375 32.5V7.5C8.4375 3.87563 11.3756 0.9375 15 0.9375Z",
6435
+ stroke: "#CACFD8",
6436
+ strokeWidth: "1.875"
6437
+ }
6438
+ ),
6439
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { y: "15", width: "35", height: "20", rx: "5", fill: "#FF6259" }),
6440
+ /* @__PURE__ */ jsxRuntime.jsx(
6441
+ "path",
6442
+ {
6443
+ d: "M3.60958 29V20.6H6.65158C7.24758 20.6 7.77358 20.704 8.22958 20.912C8.68958 21.116 9.04958 21.412 9.30958 21.8C9.56958 22.184 9.69958 22.646 9.69958 23.186C9.69958 23.742 9.57958 24.212 9.33958 24.596C9.09958 24.976 8.74958 25.266 8.28958 25.466C7.83358 25.662 7.27758 25.76 6.62158 25.76H4.95358V29H3.60958ZM4.95358 24.608H6.63958C7.18358 24.608 7.60558 24.494 7.90558 24.266C8.20558 24.034 8.35558 23.684 8.35558 23.216C8.35558 22.752 8.20158 22.396 7.89358 22.148C7.58558 21.9 7.17158 21.776 6.65158 21.776H4.95358V24.608ZM11.215 29V20.6H14.257C14.853 20.6 15.379 20.704 15.835 20.912C16.295 21.116 16.655 21.412 16.915 21.8C17.175 22.184 17.305 22.646 17.305 23.186C17.305 23.742 17.185 24.212 16.945 24.596C16.705 24.976 16.355 25.266 15.895 25.466C15.439 25.662 14.883 25.76 14.227 25.76H12.559V29H11.215ZM12.559 24.608H14.245C14.789 24.608 15.211 24.494 15.511 24.266C15.811 24.034 15.961 23.684 15.961 23.216C15.961 22.752 15.807 22.396 15.499 22.148C15.191 21.9 14.777 21.776 14.257 21.776H12.559V24.608ZM20.4165 29V21.83H18.0525V20.6H24.1245V21.83H21.7605V29H20.4165ZM24.7614 29L27.4854 24.692L24.9054 20.6H26.5134L28.4514 23.702L30.5214 20.6H32.0814L29.3694 24.728L32.1594 29H30.5454L28.3974 25.694L26.3274 29H24.7614Z",
6444
+ fill: "white"
6445
+ }
6446
+ )
6447
+ ] });
6448
+ var FileTextIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: [
6449
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M28.75 1.25V9.58333C28.75 10.5042 29.4958 11.25 30.4167 11.25H38.75", stroke: "#CACFD8", strokeWidth: "1.875" }),
6450
+ /* @__PURE__ */ jsxRuntime.jsx(
6451
+ "path",
6452
+ {
6453
+ d: "M15 0.9375H26.8936C28.634 0.937541 30.3035 1.6287 31.5342 2.85938L37.1406 8.46582C38.3713 9.69649 39.0625 11.366 39.0625 13.1064V32.5C39.0625 36.1244 36.1244 39.0625 32.5 39.0625H15C11.3756 39.0625 8.4375 36.1244 8.4375 32.5V7.5C8.4375 3.87563 11.3756 0.9375 15 0.9375Z",
6454
+ stroke: "#CACFD8",
6455
+ strokeWidth: "1.875"
6456
+ }
6457
+ ),
6458
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { y: "15", width: "35", height: "20", rx: "5", fill: "#3B82F6" }),
6459
+ /* @__PURE__ */ jsxRuntime.jsx(
6460
+ "path",
6461
+ {
6462
+ d: "M9.45363 29V21.83H7.08963V20.6H13.1616V21.83H10.7976V29H9.45363ZM13.7985 29L16.5225 24.692L13.9425 20.6H15.5505L17.4885 23.702L19.5585 20.6H21.1185L18.4065 24.728L21.1965 29H19.5825L17.4345 25.694L15.3645 29H13.7985ZM24.2075 29V21.83H21.8435V20.6H27.9155V21.83H25.5515V29H24.2075Z",
6463
+ fill: "white"
6464
+ }
6465
+ )
6466
+ ] });
6467
+ var FileWordIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: [
6468
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M28.75 1.25V9.58333C28.75 10.5042 29.4958 11.25 30.4167 11.25H38.75", stroke: "#CACFD8", strokeWidth: "1.875" }),
6469
+ /* @__PURE__ */ jsxRuntime.jsx(
6470
+ "path",
6471
+ {
6472
+ d: "M15 0.9375H26.8936C28.634 0.937541 30.3035 1.6287 31.5342 2.85938L37.1406 8.46582C38.3713 9.69649 39.0625 11.366 39.0625 13.1064V32.5C39.0625 36.1244 36.1244 39.0625 32.5 39.0625H15C11.3756 39.0625 8.4375 36.1244 8.4375 32.5V7.5C8.4375 3.87563 11.3756 0.9375 15 0.9375Z",
6473
+ stroke: "#CACFD8",
6474
+ strokeWidth: "1.875"
6475
+ }
6476
+ ),
6477
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { y: "15", width: "35", height: "20", rx: "5", fill: "#295BAC" }),
6478
+ /* @__PURE__ */ jsxRuntime.jsx(
6479
+ "path",
6480
+ {
6481
+ d: "M5.02755 29V20.6H7.65555C8.49155 20.6 9.22955 20.78 9.86955 21.14C10.5095 21.496 11.0095 21.99 11.3695 22.622C11.7335 23.254 11.9155 23.982 11.9155 24.806C11.9155 25.418 11.8115 25.982 11.6035 26.498C11.3995 27.01 11.1075 27.452 10.7275 27.824C10.3475 28.196 9.89755 28.486 9.37755 28.694C8.85755 28.898 8.28355 29 7.65555 29H5.02755ZM6.37155 27.746H7.49355C7.94555 27.746 8.35555 27.68 8.72355 27.548C9.09555 27.412 9.41355 27.216 9.67755 26.96C9.94555 26.704 10.1515 26.396 10.2955 26.036C10.4395 25.672 10.5115 25.262 10.5115 24.806C10.5115 24.194 10.3855 23.668 10.1335 23.228C9.88555 22.784 9.53555 22.444 9.08355 22.208C8.63155 21.968 8.10155 21.848 7.49355 21.848H6.37155V27.746ZM17.5994 29.18C16.9674 29.18 16.3814 29.07 15.8414 28.85C15.3054 28.626 14.8374 28.316 14.4374 27.92C14.0414 27.524 13.7314 27.06 13.5074 26.528C13.2874 25.996 13.1774 25.42 13.1774 24.8C13.1774 24.176 13.2874 23.598 13.5074 23.066C13.7314 22.534 14.0414 22.07 14.4374 21.674C14.8374 21.278 15.3054 20.97 15.8414 20.75C16.3814 20.53 16.9674 20.42 17.5994 20.42C18.2274 20.42 18.8094 20.532 19.3454 20.756C19.8814 20.98 20.3494 21.292 20.7494 21.692C21.1494 22.092 21.4594 22.558 21.6794 23.09C21.9034 23.618 22.0154 24.188 22.0154 24.8C22.0154 25.42 21.9034 25.996 21.6794 26.528C21.4594 27.06 21.1494 27.524 20.7494 27.92C20.3494 28.316 19.8814 28.626 19.3454 28.85C18.8094 29.07 18.2274 29.18 17.5994 29.18ZM17.5994 27.908C18.0234 27.908 18.4174 27.836 18.7814 27.692C19.1494 27.544 19.4694 27.334 19.7414 27.062C20.0134 26.786 20.2254 26.458 20.3774 26.078C20.5334 25.694 20.6114 25.268 20.6114 24.8C20.6114 24.172 20.4774 23.626 20.2094 23.162C19.9454 22.694 19.5854 22.332 19.1294 22.076C18.6734 21.82 18.1634 21.692 17.5994 21.692C17.1754 21.692 16.7794 21.766 16.4114 21.914C16.0474 22.058 15.7274 22.266 15.4514 22.538C15.1794 22.81 14.9654 23.138 14.8094 23.522C14.6574 23.902 14.5814 24.328 14.5814 24.8C14.5814 25.428 14.7154 25.976 14.9834 26.444C15.2514 26.908 15.6114 27.268 16.0634 27.524C16.5194 27.78 17.0314 27.908 17.5994 27.908ZM27.6173 29.18C26.7453 29.18 25.9833 29 25.3313 28.64C24.6793 28.28 24.1713 27.772 23.8073 27.116C23.4473 26.456 23.2673 25.686 23.2673 24.806C23.2673 24.166 23.3733 23.58 23.5853 23.048C23.8013 22.512 24.1033 22.048 24.4913 21.656C24.8833 21.264 25.3453 20.96 25.8773 20.744C26.4093 20.528 26.9933 20.42 27.6293 20.42C28.2693 20.42 28.8213 20.5 29.2853 20.66C29.7533 20.82 30.1613 21.048 30.5093 21.344L29.8133 22.442C29.5493 22.198 29.2413 22.016 28.8893 21.896C28.5373 21.776 28.1493 21.716 27.7253 21.716C27.2573 21.716 26.8353 21.788 26.4593 21.932C26.0833 22.076 25.7613 22.282 25.4933 22.55C25.2293 22.814 25.0253 23.136 24.8813 23.516C24.7413 23.892 24.6713 24.318 24.6713 24.794C24.6713 25.442 24.7973 25.996 25.0493 26.456C25.3053 26.916 25.6653 27.268 26.1293 27.512C26.5973 27.752 27.1493 27.872 27.7853 27.872C28.2093 27.872 28.6173 27.81 29.0093 27.686C29.4053 27.558 29.7753 27.352 30.1193 27.068L30.7433 28.202C30.3393 28.518 29.8773 28.76 29.3573 28.928C28.8413 29.096 28.2613 29.18 27.6173 29.18Z",
6482
+ fill: "white"
6483
+ }
6484
+ )
6485
+ ] });
6486
+ var FileZipIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: [
6487
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M28.75 1.25V9.58333C28.75 10.5042 29.4958 11.25 30.4167 11.25H38.75", stroke: "#CACFD8", strokeWidth: "1.875" }),
6488
+ /* @__PURE__ */ jsxRuntime.jsx(
6489
+ "path",
6490
+ {
6491
+ d: "M15 0.9375H26.8936C28.634 0.937541 30.3035 1.6287 31.5342 2.85938L37.1406 8.46582C38.3713 9.69649 39.0625 11.366 39.0625 13.1064V32.5C39.0625 36.1244 36.1244 39.0625 32.5 39.0625H15C11.3756 39.0625 8.4375 36.1244 8.4375 32.5V7.5C8.4375 3.87563 11.3756 0.9375 15 0.9375Z",
6492
+ stroke: "#CACFD8",
6493
+ strokeWidth: "1.875"
6494
+ }
6495
+ ),
6496
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { y: "15", width: "35", height: "20", rx: "5", fill: "#79889A" }),
6497
+ /* @__PURE__ */ jsxRuntime.jsx(
6498
+ "path",
6499
+ {
6500
+ d: "M8.97569 29V27.878L13.2777 21.83H9.11369V20.6H14.8977V21.716L10.6137 27.764H14.9337V29H8.97569ZM16.5178 29V20.6H17.8618V29H16.5178ZM20.0568 29V20.6H23.0988C23.6948 20.6 24.2208 20.704 24.6768 20.912C25.1368 21.116 25.4968 21.412 25.7568 21.8C26.0168 22.184 26.1468 22.646 26.1468 23.186C26.1468 23.742 26.0268 24.212 25.7868 24.596C25.5468 24.976 25.1968 25.266 24.7368 25.466C24.2808 25.662 23.7248 25.76 23.0688 25.76H21.4008V29H20.0568ZM21.4008 24.608H23.0868C23.6308 24.608 24.0528 24.494 24.3528 24.266C24.6528 24.034 24.8028 23.684 24.8028 23.216C24.8028 22.752 24.6488 22.396 24.3408 22.148C24.0328 21.9 23.6188 21.776 23.0988 21.776H21.4008V24.608Z",
6501
+ fill: "white"
6502
+ }
6503
+ )
6504
+ ] });
6505
+ var FILE_ICONS = {
6506
+ excel: FileExcelIcon,
6507
+ jpg: FileJpgIcon,
6508
+ mp4: FileMp4Icon,
6509
+ pdf: FilePdfIcon,
6510
+ png: FilePngIcon,
6511
+ powerpoint: FilePowerpointIcon,
6512
+ text: FileTextIcon,
6513
+ word: FileWordIcon,
6514
+ zip: FileZipIcon
6515
+ };
6516
+ var NO_BROKEN_SRCS = [];
6517
+ var useImageObjectUrl = (file, type) => {
6518
+ const [objectUrl, setObjectUrl] = react.useState(null);
6519
+ react.useEffect(() => {
6520
+ const canCreate = typeof URL !== "undefined" && typeof URL.createObjectURL === "function";
6521
+ if (file && isImageType(type) && canCreate) {
6522
+ const url = URL.createObjectURL(file);
6523
+ setObjectUrl(url);
6524
+ return () => URL.revokeObjectURL(url);
6525
+ }
6526
+ setObjectUrl(null);
6527
+ }, [file, type]);
6528
+ return objectUrl;
6529
+ };
6530
+ var UploadItemPreview = (props) => {
6531
+ const theme = useComponentTheme("UploadItemPreview");
6532
+ const { item } = useUploadItemContext("Upload.ItemPreview");
6533
+ const { rootAttrs, rest } = composeRootAttrs(UploadItemPreviewBase, props, theme);
6534
+ const { as, children, ref, ...nativeProps } = rest;
6535
+ const hasChildren = isRenderableNode(children);
6536
+ const sourceKey = `${item.id}\0${item.thumbUrl ?? ""}\0${item.url ?? ""}\0${item.file ? fileKey(item.file) : ""}`;
6537
+ const [broken, setBroken] = react.useState({ key: sourceKey, srcs: NO_BROKEN_SRCS });
6538
+ const brokenSrcs = broken.key === sourceKey ? broken.srcs : NO_BROKEN_SRCS;
6539
+ const markBroken = (src2) => setBroken((previous) => {
6540
+ if (previous.key !== sourceKey) return { key: sourceKey, srcs: [src2] };
6541
+ if (previous.srcs.includes(src2)) return previous;
6542
+ return { key: sourceKey, srcs: [...previous.srcs, src2] };
6543
+ });
6544
+ const thumbUsable = item.thumbUrl !== void 0 && !brokenSrcs.includes(item.thumbUrl);
6545
+ const objectUrl = useImageObjectUrl(hasChildren || thumbUsable ? void 0 : item.file, fileType(item));
6546
+ const slotAttrs = (slot) => buildSlotAttrs(UploadItemPreviewBase.getSlotProps(slot), slot, {
6547
+ themeSlotProps: theme?.slotProps,
6548
+ themeClassNames: theme?.classNames,
6549
+ instanceSlotProps: props.slotProps,
6550
+ instanceClassNames: props.classNames
6551
+ });
6552
+ const Component = as ?? "span";
6553
+ const remoteImage = item.url && isImageType(fileType(item)) ? item.url : void 0;
6554
+ const src = [item.thumbUrl, objectUrl ?? void 0, remoteImage].find((candidate) => candidate !== void 0 && !brokenSrcs.includes(candidate));
6555
+ const iconName = fileIconName(item);
6556
+ const FileIcon = iconName ? FILE_ICONS[iconName] : void 0;
6557
+ const { onError: slotOnError, ...imageAttrs } = slotAttrs("image");
6558
+ const defaultContent = src ? (
6559
+ // The defaults sit ahead of the slot layer so `slotProps.image` can still
6560
+ // override them — a consumer wanting a real `alt`, or eager loading for an
6561
+ // above-the-fold row, should not have to fight the part for it.
6562
+ /* @__PURE__ */ jsxRuntime.jsx(
6563
+ "img",
6564
+ {
6565
+ alt: "",
6566
+ loading: "lazy",
6567
+ decoding: "async",
6568
+ ...imageAttrs,
6569
+ src,
6570
+ onError: (event) => {
6571
+ markBroken(src);
6572
+ slotOnError?.(event);
6573
+ }
6574
+ }
6575
+ )
6576
+ ) : FileIcon ? /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { ...slotAttrs("icon") }) : /* @__PURE__ */ jsxRuntime.jsx("span", { ...slotAttrs("extension"), "aria-hidden": "true", children: nameExtension(fileName(item)) || "FILE" });
6577
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...nativeProps, ...rootAttrs, ref, children: hasChildren ? children : defaultContent });
6578
+ };
6579
+ UploadItemPreview.displayName = "Upload.ItemPreview";
6580
+ var flattenRowChildren = (children, out = []) => {
6581
+ react.Children.forEach(children, (child) => {
6582
+ if (react.isValidElement(child) && child.type === react.Fragment) flattenRowChildren(child.props.children, out);
6583
+ else out.push(child);
6584
+ });
6585
+ return out;
6586
+ };
6587
+ var UploadItem = (props) => {
6588
+ const theme = useComponentTheme("UploadItem");
6589
+ const { rootAttrs, rest } = composeRootAttrs(UploadItemBase, props, theme);
6590
+ const { as, file: item, children, ref, ...nativeProps } = rest;
6591
+ const Component = as ?? "div";
6592
+ const previewNodes = [];
6593
+ const contentNodes = [];
6594
+ const actionsNodes = [];
6595
+ const looseNodes = [];
6596
+ for (const child of flattenRowChildren(children)) {
6597
+ const type = react.isValidElement(child) ? child.type : void 0;
6598
+ if (type === UploadItemPreview) previewNodes.push(child);
6599
+ else if (type === UploadItemContent) contentNodes.push(child);
6600
+ else if (type === UploadItemActions) actionsNodes.push(child);
6601
+ else looseNodes.push(child);
6602
+ }
6603
+ const hasComposedActions = actionsNodes.length > 0;
6604
+ const actionsRegion = hasComposedActions ? actionsNodes : /* @__PURE__ */ jsxRuntime.jsx(UploadItemActions, { children: looseNodes.length > 0 ? looseNodes : void 0 });
6605
+ return (
6606
+ // The row publishes its own file to its parts, so an `Upload.ItemAction`,
6607
+ // `Upload.ItemContent`, or `Upload.ItemPreview` needs no per-instance wiring
6608
+ // to know which entry it renders.
6609
+ /* @__PURE__ */ jsxRuntime.jsx(UploadItemProvider, { value: { item }, children: /* @__PURE__ */ jsxRuntime.jsxs(Component, { ...nativeProps, ...rootAttrs, "data-status": fileStatus(item), ref, children: [
6610
+ previewNodes.length > 0 ? previewNodes : /* @__PURE__ */ jsxRuntime.jsx(UploadItemPreview, {}),
6611
+ contentNodes.length > 0 ? contentNodes : /* @__PURE__ */ jsxRuntime.jsx(UploadItemContent, {}),
6612
+ hasComposedActions && looseNodes,
6613
+ actionsRegion
6614
+ ] }) })
6615
+ );
6616
+ };
6617
+ UploadItem.displayName = "Upload.Item";
6618
+ var UploadList = (props) => {
6619
+ const theme = useComponentTheme("UploadList");
6620
+ const { files } = useUploadContext("Upload.List");
6621
+ const { rootAttrs, rest } = composeRootAttrs(UploadListBase, props, theme);
6622
+ const { as, children, ref, ...nativeProps } = rest;
6623
+ if (files.length === 0) return null;
6624
+ const Component = as ?? "div";
6625
+ const rows = typeof children === "function" ? children(files) : isRenderableNode(children) ? children : files.map((item) => /* @__PURE__ */ jsxRuntime.jsx(UploadItem, { file: item }, item.id));
6626
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...nativeProps, ...rootAttrs, ref, children: rows });
6627
+ };
6628
+ UploadList.displayName = "Upload.List";
6629
+ var DEFAULT_SUBMIT_APPEARANCE = "outlined";
6630
+ var DEFAULT_SUBMIT_VARIANT = "neutral";
6631
+ var UploadSubmit = (props) => {
6632
+ const theme = useComponentTheme("UploadSubmit");
6633
+ const { disabled, files } = useUploadContext("Upload.Submit");
6634
+ const { rootAttrs, rest } = composeRootAttrs(UploadSubmitBase, props, theme);
6635
+ const { onClick: slotOnClick, ...submitRootAttrs } = rootAttrs;
6636
+ const {
6637
+ as,
6638
+ children,
6639
+ ref,
6640
+ disabled: ownDisabled,
6641
+ href,
6642
+ onClick,
6643
+ appearance = DEFAULT_SUBMIT_APPEARANCE,
6644
+ variant = DEFAULT_SUBMIT_VARIANT,
6645
+ ...buttonProps
6646
+ } = rest;
6647
+ const handleClick = (event) => {
6648
+ onClick?.(event);
6649
+ slotOnClick?.(event);
6650
+ };
6651
+ const inFlight = files.some((entry) => {
6652
+ const status = fileStatus(entry);
6653
+ return status === "uploading" || status === "processing";
6654
+ });
6655
+ const isDisabled = disabled || ownDisabled || files.length === 0 || inFlight;
6656
+ const isButton = (as ?? "button") === "button";
6657
+ const linkProps = isButton ? void 0 : { href: isDisabled ? void 0 : href };
6658
+ return /* @__PURE__ */ jsxRuntime.jsx(Button, { ...buttonProps, ...linkProps, ...submitRootAttrs, as, appearance, variant, disabled: isDisabled, onClick: handleClick, ref, children });
6659
+ };
6660
+ UploadSubmit.displayName = "Upload.Submit";
6661
+ var DEFAULT_TRIGGER_APPEARANCE = "outlined";
6662
+ var DEFAULT_TRIGGER_VARIANT = "neutral";
6663
+ var UploadTrigger = (props) => {
6664
+ const theme = useComponentTheme("UploadTrigger");
6665
+ const { disabled, readOnly, openFileDialog } = useUploadContext("Upload.Trigger");
6666
+ const { rootAttrs, rest } = composeRootAttrs(UploadTriggerBase, props, theme);
6667
+ const { onClick: slotOnClick, ...triggerRootAttrs } = rootAttrs;
6668
+ const {
6669
+ as,
6670
+ children,
6671
+ ref,
6672
+ disabled: ownDisabled,
6673
+ href,
6674
+ onClick,
6675
+ appearance = DEFAULT_TRIGGER_APPEARANCE,
6676
+ variant = DEFAULT_TRIGGER_VARIANT,
6677
+ ...buttonProps
6678
+ } = rest;
6679
+ const isDisabled = disabled || readOnly || ownDisabled;
6680
+ const isButton = (as ?? "button") === "button";
6681
+ const linkProps = isButton ? void 0 : { href: isDisabled ? void 0 : href };
6682
+ const handleClick = (event) => {
6683
+ const preventedOnEntry = event.defaultPrevented;
6684
+ onClick?.(event);
6685
+ slotOnClick?.(event);
6686
+ if (isConsumerVeto(event, preventedOnEntry)) return;
6687
+ openFileDialog();
6688
+ };
6689
+ return (
6690
+ // Read-only freezes the Trigger rather than unmounting it, which is the
6691
+ // opposite of what the ItemAction's remove does under the same state. The
6692
+ // asymmetry is the point: a file row without its remove still reads as a
6693
+ // whole row, but the zone's browse button is most of what the zone shows —
6694
+ // drop it and a dashed box is left offering a drop that never lands.
6695
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { ...buttonProps, ...linkProps, ...triggerRootAttrs, as, appearance, variant, disabled: isDisabled, onClick: handleClick, ref, children })
6696
+ );
6697
+ };
6698
+ UploadTrigger.displayName = "Upload.Trigger";
6699
+
6700
+ // src/components/upload/index.ts
6701
+ var Upload2 = Object.assign(Upload, {
6702
+ Dropzone: UploadDropzone,
6703
+ Actions: UploadActions,
6704
+ Trigger: UploadTrigger,
6705
+ Submit: UploadSubmit,
6706
+ List: UploadList,
6707
+ Item: UploadItem,
6708
+ ItemPreview: UploadItemPreview,
6709
+ ItemContent: UploadItemContent,
6710
+ ItemActions: UploadItemActions,
6711
+ ItemAction: UploadItemAction
6712
+ });
6713
+
6714
+ Object.defineProperty(exports, "createDateMask", {
6715
+ enumerable: true,
6716
+ get: function () { return spar.createDateMask; }
6717
+ });
6718
+ Object.defineProperty(exports, "createNumberMask", {
6719
+ enumerable: true,
6720
+ get: function () { return spar.createNumberMask; }
6721
+ });
6722
+ Object.defineProperty(exports, "createTimeMask", {
6723
+ enumerable: true,
6724
+ get: function () { return spar.createTimeMask; }
6725
+ });
4975
6726
  Object.defineProperty(exports, "createToaster", {
4976
6727
  enumerable: true,
4977
6728
  get: function () { return spar.createToaster; }
@@ -4981,6 +6732,7 @@ exports.Alert = Alert2;
4981
6732
  exports.Badge = Badge;
4982
6733
  exports.Breadcrumb = Breadcrumb2;
4983
6734
  exports.Button = Button;
6735
+ exports.Calendar = Calendar;
4984
6736
  exports.Card = Card2;
4985
6737
  exports.Checkbox = Checkbox2;
4986
6738
  exports.Chip = Chip;
@@ -5006,6 +6758,8 @@ exports.TakeoffSparProvider = TakeoffSparProvider;
5006
6758
  exports.Toast = Toast;
5007
6759
  exports.Toaster = Toaster;
5008
6760
  exports.Tooltip = Tooltip2;
6761
+ exports.Upload = Upload2;
5009
6762
  exports.getExportRows = getExportRows;
5010
6763
  exports.useComponentTheme = useComponentTheme;
6764
+ exports.useDatePicker = useDatePicker;
5011
6765
  exports.useTheme = useTheme;