@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.mjs CHANGED
@@ -1,19 +1,30 @@
1
1
  import { createContext, Children, isValidElement, useMemo, useRef, useState, useCallback, useEffect, useId, createElement, useContext, Fragment as Fragment$1 } from 'react';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { Accordion as Accordion$1, AccordionContent as AccordionContent$1, useAccordionItemContext, AccordionTrigger as AccordionTrigger$1, AccordionHeader as AccordionHeader$1, AccordionItem as AccordionItem$1, Breadcrumb as Breadcrumb$1, BreadcrumbSeparator as BreadcrumbSeparator$1, BreadcrumbPage as BreadcrumbPage$1, BreadcrumbLink as BreadcrumbLink$1, BreadcrumbItem as BreadcrumbItem$1, BreadcrumbList as BreadcrumbList$1, Checkbox as Checkbox$1, Dialog as Dialog$1, DialogClose as DialogClose$1, DialogDescription as DialogDescription$1, DialogTitle as DialogTitle$1, DialogContent, DialogOverlay as DialogOverlay$1, DialogTrigger as DialogTrigger$1, DropdownMenu, DropdownMenuArrow, DropdownMenuSeparator, DropdownMenuLabel, DropdownMenuGroup, DropdownMenuItem, DropdownMenuViewport, useDropdownMenuContext, DropdownMenuContent, DropdownMenuTrigger, Field as Field$1, FieldErrorMessage as FieldErrorMessage$1, FieldDescription as FieldDescription$1, useFieldContext, FieldLabel as FieldLabel$1, Input as Input$1, useInputContext, InputField as InputField$1, Radio as Radio$1, RadioItem as RadioItem$1, Popover as Popover$1, PopoverClose as PopoverClose$1, PopoverArrow as PopoverArrow$1, PopoverContent as PopoverContent$1, PopoverTrigger as PopoverTrigger$1, useOptionalFieldContext, Select as Select$1, SelectArrow as SelectArrow$1, SelectSeparator as SelectSeparator$1, SelectLabel as SelectLabel$1, SelectGroup as SelectGroup$1, SelectItem as SelectItem$1, SelectViewport as SelectViewport$1, useSelectContext, SelectContent as SelectContent$1, SelectTrigger as SelectTrigger$1, Switch as Switch$1, Tabs as Tabs$1, TabsContent as TabsContent$1, TabsTrigger as TabsTrigger$1, TabsList as TabsList$1, Tooltip as Tooltip$1, TooltipArrow as TooltipArrow$1, TooltipContent as TooltipContent$1, TooltipTrigger as TooltipTrigger$1, TooltipProvider as TooltipProvider$1, Button as Button$1, Label as Label$1, Toast as Toast$1, Toaster as Toaster$1 } from '@turkish-technology/spar';
4
- export { createToaster } from '@turkish-technology/spar';
4
+ export { createDateMask, createNumberMask, createTimeMask, createToaster } from '@turkish-technology/spar';
5
5
  import { clsx } from 'clsx';
6
6
  import { ChevronBottomIconOutlinedRounded } from '@takeoff-icons/react/chevron-bottom';
7
7
  import { ChevronTopIconOutlinedRounded } from '@takeoff-icons/react/chevron-top';
8
+ import { CloseIconOutlinedRounded } from '@takeoff-icons/react/close';
8
9
  import { ChevronRightIconOutlinedRounded } from '@takeoff-icons/react/chevron-right';
10
+ import { ChevronLeftIconOutlinedRounded } from '@takeoff-icons/react/chevron-left';
11
+ import { DoubleChevronLeftIconOutlinedRounded } from '@takeoff-icons/react/double-chevron-left';
12
+ import { DoubleChevronRightIconOutlinedRounded } from '@takeoff-icons/react/double-chevron-right';
13
+ import { UI, DayFlag, SelectionState, Animation, DayPicker, MonthCaption, useDayPicker, CaptionLabel, MonthGrid, DayButton, DateLib, defaultLocale, PreviousMonthButton, NextMonthButton, Footer, Day, WeekNumberHeader, WeekNumber, Week, Weeks, Weekday, Weekdays, Dropdown as Dropdown$1, DropdownNav, Month, Months } from 'react-day-picker';
9
14
  import { CheckIconOutlinedRounded } from '@takeoff-icons/react/check';
10
- import { CloseIconOutlinedRounded } from '@takeoff-icons/react/close';
15
+ import { RemoveIconOutlinedRounded } from '@takeoff-icons/react/remove';
16
+ import { InfoIconFilledRounded } from '@takeoff-icons/react/info';
17
+ import { AlertCircleIconFilledRounded } from '@takeoff-icons/react/alert-circle';
18
+ import { EyeClosedIconOutlinedRounded } from '@takeoff-icons/react/eye-closed';
19
+ import { EyeOpenIconOutlinedRounded } from '@takeoff-icons/react/eye-open';
11
20
  import { useReactTable, getPaginationRowModel, getExpandedRowModel, getFilteredRowModel, getSortedRowModel, getCoreRowModel, functionalUpdate, flexRender } from '@tanstack/react-table';
21
+ import { ArrowBottomIconOutlinedRounded } from '@takeoff-icons/react/arrow-bottom';
22
+ import { ArrowTopIconOutlinedRounded } from '@takeoff-icons/react/arrow-top';
12
23
  import { SwapIconOutlinedRounded } from '@takeoff-icons/react/swap';
13
24
  import { SearchIconOutlinedRounded } from '@takeoff-icons/react/search';
14
- import { ArrowLeftIconOutlinedRounded } from '@takeoff-icons/react/arrow-left';
15
- import { ArrowRightIconOutlinedRounded } from '@takeoff-icons/react/arrow-right';
16
- import { ChevronLeftIconOutlinedRounded } from '@takeoff-icons/react/chevron-left';
25
+ import { ArrowDownloadIconOutlinedRounded } from '@takeoff-icons/react/arrow-download';
26
+ import { CheckCircleIconFilledRounded } from '@takeoff-icons/react/check-circle';
27
+ import { CloseCircleIconFilledRounded } from '@takeoff-icons/react/close-circle';
17
28
 
18
29
  // src/provider.tsx
19
30
 
@@ -245,7 +256,79 @@ function useControllableState(controlledValue, defaultValue, onChange) {
245
256
  },
246
257
  [isControlled, onChange]
247
258
  );
248
- return [value, setValue];
259
+ return [value, setValue, isControlled];
260
+ }
261
+ var pad = (value) => String(value).padStart(2, "0");
262
+ var toISODate = (value) => `${value.getFullYear()}-${pad(value.getMonth() + 1)}-${pad(value.getDate())}`;
263
+ var fromISODate = (iso) => {
264
+ const [year, month, day] = iso.split("-").map(Number);
265
+ if (!year || !month || !day) return void 0;
266
+ return new Date(year, month - 1, day);
267
+ };
268
+ function useDatePicker({ min, max, defaultValue, delimiter = "/", format, onValueChange } = {}) {
269
+ const formatDate = useMemo(
270
+ () => format ?? ((value2) => `${pad(value2.getDate())}${delimiter}${pad(value2.getMonth() + 1)}${delimiter}${value2.getFullYear()}`),
271
+ [format, delimiter]
272
+ );
273
+ const [value, setValueState] = useState(defaultValue);
274
+ const [text, setText] = useState(() => defaultValue ? formatDate(defaultValue) : "");
275
+ const [open, setOpen] = useState(false);
276
+ const mask = useMemo(
277
+ () => ({
278
+ date: true,
279
+ delimiter,
280
+ ...min ? { dateMin: toISODate(min) } : {},
281
+ ...max ? { dateMax: toISODate(max) } : {}
282
+ }),
283
+ [delimiter, min, max]
284
+ );
285
+ const commit = useCallback(
286
+ (next) => {
287
+ setValueState(next);
288
+ setText(next ? formatDate(next) : "");
289
+ onValueChange?.(next);
290
+ },
291
+ [formatDate, onValueChange]
292
+ );
293
+ const handleTyped = useCallback(
294
+ (next, meta) => {
295
+ setText(next);
296
+ if (next === "") {
297
+ setValueState(void 0);
298
+ onValueChange?.(void 0);
299
+ return;
300
+ }
301
+ if (!meta.completed || !meta.iso) {
302
+ setValueState(void 0);
303
+ return;
304
+ }
305
+ const parsed = fromISODate(meta.iso);
306
+ setValueState(parsed);
307
+ onValueChange?.(parsed);
308
+ },
309
+ [onValueChange]
310
+ );
311
+ const handleKeyDown = useCallback((event) => {
312
+ if (event.key !== "ArrowDown") return;
313
+ event.preventDefault();
314
+ setOpen(true);
315
+ }, []);
316
+ const handlePicked = useCallback(
317
+ (next) => {
318
+ commit(next);
319
+ setOpen(false);
320
+ },
321
+ [commit]
322
+ );
323
+ return {
324
+ value,
325
+ text,
326
+ open,
327
+ setValue: commit,
328
+ popoverProps: { open, onOpenChange: setOpen },
329
+ inputProps: { mask, value: text, onValueChange: handleTyped, onKeyDown: handleKeyDown },
330
+ calendarProps: { value, minDate: min, maxDate: max, onValueChange: handlePicked }
331
+ };
249
332
  }
250
333
 
251
334
  // src/components/accordion/context.ts
@@ -422,40 +505,6 @@ var AlertActions = (props) => {
422
505
  return /* @__PURE__ */ jsx(Component, { ...actionsProps, ref, ...rootAttrs, children });
423
506
  };
424
507
  AlertActions.displayName = "Alert.Actions";
425
- var baseSvgProps = {
426
- "xmlns": "http://www.w3.org/2000/svg",
427
- "width": "1em",
428
- "height": "1em",
429
- "viewBox": "0 0 24 24",
430
- "fill": "none",
431
- "stroke": "currentColor",
432
- "strokeWidth": 2,
433
- "strokeLinecap": "round",
434
- "strokeLinejoin": "round",
435
- "focusable": false,
436
- "aria-hidden": true
437
- };
438
- var filledSvgProps = {
439
- "xmlns": "http://www.w3.org/2000/svg",
440
- "width": "1em",
441
- "height": "1em",
442
- "viewBox": "0 0 24 24",
443
- "fill": "currentColor",
444
- "focusable": false,
445
- "aria-hidden": true
446
- };
447
- var PlaceholderChevronDown = (props) => /* @__PURE__ */ jsx("svg", { ...baseSvgProps, "data-placeholder-icon": "chevron-down", ...props, children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" }) });
448
- var PlaceholderChevronUp = (props) => /* @__PURE__ */ jsx("svg", { ...baseSvgProps, "data-placeholder-icon": "chevron-up", ...props, children: /* @__PURE__ */ jsx("path", { d: "m18 15-6-6-6 6" }) });
449
- var PlaceholderClose = (props) => /* @__PURE__ */ jsxs("svg", { ...baseSvgProps, "data-placeholder-icon": "close", ...props, children: [
450
- /* @__PURE__ */ jsx("path", { d: "M18 6 6 18" }),
451
- /* @__PURE__ */ jsx("path", { d: "m6 6 12 12" })
452
- ] });
453
- var PlaceholderInfo = (props) => /* @__PURE__ */ jsx("svg", { ...filledSvgProps, "data-placeholder-icon": "info", ...props, children: /* @__PURE__ */ jsx("g", { transform: "translate(2 2) scale(1.714)", children: /* @__PURE__ */ 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" }) }) });
454
- var PlaceholderError = (props) => /* @__PURE__ */ jsx("svg", { ...filledSvgProps, "data-placeholder-icon": "error", ...props, children: /* @__PURE__ */ jsx("g", { transform: "translate(2 2) scale(1.714)", fillRule: "evenodd", clipRule: "evenodd", children: /* @__PURE__ */ 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" }) }) });
455
- var PlaceholderCheck = (props) => /* @__PURE__ */ jsx("svg", { ...baseSvgProps, "data-placeholder-icon": "check", ...props, children: /* @__PURE__ */ jsx("path", { d: "M5 12l5 5L20 7" }) });
456
- var PlaceholderRemove = (props) => /* @__PURE__ */ jsx("svg", { ...baseSvgProps, "data-placeholder-icon": "remove", ...props, children: /* @__PURE__ */ jsx("path", { d: "M5 12h14" }) });
457
- var PlaceholderEye = (props) => /* @__PURE__ */ jsx("svg", { ...filledSvgProps, "data-placeholder-icon": "eye", ...props, children: /* @__PURE__ */ jsx("g", { transform: "translate(1 4.5) scale(1.2)", fillRule: "evenodd", clipRule: "evenodd", children: /* @__PURE__ */ 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" }) }) });
458
- var PlaceholderEyeOff = (props) => /* @__PURE__ */ jsx("svg", { ...filledSvgProps, "data-placeholder-icon": "eye-off", ...props, children: /* @__PURE__ */ jsx("g", { transform: "translate(1 2.42) scale(1.2)", fillRule: "evenodd", clipRule: "evenodd", children: /* @__PURE__ */ 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" }) }) });
459
508
  var AlertClose = (props) => {
460
509
  const theme = useComponentTheme("AlertClose");
461
510
  const { onClose } = useAlertContext("Alert.Close");
@@ -478,7 +527,7 @@ var AlertClose = (props) => {
478
527
  "aria-label": ariaLabel ?? (hasCustomChildren ? void 0 : DEFAULT_CLOSE_LABEL),
479
528
  onClick: handleClick,
480
529
  ...closeRootAttrs,
481
- children: hasCustomChildren ? children : /* @__PURE__ */ jsx(PlaceholderClose, {})
530
+ children: hasCustomChildren ? children : /* @__PURE__ */ jsx(CloseIconOutlinedRounded, {})
482
531
  }
483
532
  );
484
533
  };
@@ -742,6 +791,650 @@ var Button = (props) => {
742
791
  };
743
792
  Button.displayName = "Button";
744
793
 
794
+ // src/components/calendar/base.ts
795
+ var CalendarBase = createComponentBase({
796
+ name: "Calendar",
797
+ slots: [
798
+ "root",
799
+ "months",
800
+ "month",
801
+ "nav",
802
+ "previousMonthButton",
803
+ "nextMonthButton",
804
+ "previousYearButton",
805
+ "nextYearButton",
806
+ "chevron",
807
+ "monthCaption",
808
+ "captionLabel",
809
+ "captionTrigger",
810
+ "dropdowns",
811
+ "dropdownRoot",
812
+ "dropdown",
813
+ "monthGrid",
814
+ "monthYearGrid",
815
+ "monthYearCell",
816
+ "weekdays",
817
+ "weekday",
818
+ "weeks",
819
+ "week",
820
+ "weekNumber",
821
+ "weekNumberHeader",
822
+ "day",
823
+ "dayButton",
824
+ "footer"
825
+ ],
826
+ classes: {
827
+ root: "tk-calendar",
828
+ months: "tk-calendar-months",
829
+ month: "tk-calendar-month",
830
+ nav: "tk-calendar-nav",
831
+ previousMonthButton: "tk-calendar-nav-previous-month",
832
+ nextMonthButton: "tk-calendar-nav-next-month",
833
+ previousYearButton: "tk-calendar-nav-previous-year",
834
+ nextYearButton: "tk-calendar-nav-next-year",
835
+ chevron: "tk-calendar-chevron",
836
+ monthCaption: "tk-calendar-month-caption",
837
+ captionLabel: "tk-calendar-caption-label",
838
+ captionTrigger: "tk-calendar-caption-trigger",
839
+ dropdowns: "tk-calendar-dropdowns",
840
+ dropdownRoot: "tk-calendar-dropdown-root",
841
+ dropdown: "tk-calendar-dropdown",
842
+ monthGrid: "tk-calendar-month-grid",
843
+ monthYearGrid: "tk-calendar-month-year-grid",
844
+ monthYearCell: "tk-calendar-month-year-cell",
845
+ weekdays: "tk-calendar-weekdays",
846
+ weekday: "tk-calendar-weekday",
847
+ weeks: "tk-calendar-weeks",
848
+ week: "tk-calendar-week",
849
+ weekNumber: "tk-calendar-week-number",
850
+ weekNumberHeader: "tk-calendar-week-number-header",
851
+ day: "tk-calendar-day",
852
+ dayButton: "tk-calendar-day-button",
853
+ footer: "tk-calendar-footer"
854
+ }
855
+ });
856
+ var calendarRangeClassNames = {
857
+ range_start: "tk-calendar-day-range-start",
858
+ range_middle: "tk-calendar-day-range-middle",
859
+ range_end: "tk-calendar-day-range-end"
860
+ };
861
+
862
+ // src/components/calendar/defaults.ts
863
+ var DEFAULT_MODE2 = "single";
864
+ var DEFAULT_SIZE5 = "base";
865
+ var DEFAULT_HEADER_TYPE = "basic";
866
+ var DEFAULT_VIEW = "day";
867
+
868
+ // src/components/calendar/helpers.ts
869
+ var isSameCalendarDay = (left, right) => left.getFullYear() === right.getFullYear() && left.getMonth() === right.getMonth() && left.getDate() === right.getDate();
870
+ var isSameCalendarMonth = (left, right) => left.getFullYear() === right.getFullYear() && left.getMonth() === right.getMonth();
871
+ var selectionAnchor = (value) => {
872
+ if (!value) return void 0;
873
+ if (value instanceof Date) return value;
874
+ if (Array.isArray(value)) return value.length ? value[value.length - 1] : void 0;
875
+ return value.from;
876
+ };
877
+ var buildDisabledMatchers = ({ minDate, maxDate, disabledDates, allowedDates, disabledWeekDays }) => {
878
+ const matchers = [];
879
+ if (minDate) matchers.push({ before: minDate });
880
+ if (maxDate) matchers.push({ after: maxDate });
881
+ if (disabledDates?.length) matchers.push(disabledDates);
882
+ if (disabledWeekDays?.length) matchers.push({ dayOfWeek: disabledWeekDays });
883
+ if (allowedDates?.length) {
884
+ const allowed = allowedDates;
885
+ matchers.push((date) => !allowed.some((candidate) => isSameCalendarDay(candidate, date)));
886
+ }
887
+ return matchers.length ? matchers : void 0;
888
+ };
889
+ var assignRef = (ref, node) => {
890
+ if (typeof ref === "function") {
891
+ ref(node);
892
+ } else if (ref) {
893
+ ref.current = node;
894
+ }
895
+ };
896
+ var YEARS_PER_PAGE = 12;
897
+ var yearPageStart = (year) => Math.floor(year / YEARS_PER_PAGE) * YEARS_PER_PAGE;
898
+ var isMonthInBounds = (year, month, minDate, maxDate) => {
899
+ if (minDate && new Date(year, month + 1, 0, 23, 59, 59, 999) < minDate) return false;
900
+ if (maxDate && new Date(year, month, 1) > maxDate) return false;
901
+ return true;
902
+ };
903
+ var isYearInBounds = (year, minDate, maxDate) => {
904
+ if (minDate && year < minDate.getFullYear()) return false;
905
+ if (maxDate && year > maxDate.getFullYear()) return false;
906
+ return true;
907
+ };
908
+ var isYearPageInBounds = (year, minDate, maxDate) => {
909
+ const start = yearPageStart(year);
910
+ return isYearInBounds(start + YEARS_PER_PAGE - 1, minDate, void 0) && isYearInBounds(start, void 0, maxDate);
911
+ };
912
+ var SLOT_TO_UI = {
913
+ root: UI.Root,
914
+ months: UI.Months,
915
+ month: UI.Month,
916
+ nav: UI.Nav,
917
+ previousMonthButton: UI.PreviousMonthButton,
918
+ nextMonthButton: UI.NextMonthButton,
919
+ chevron: UI.Chevron,
920
+ monthCaption: UI.MonthCaption,
921
+ captionLabel: UI.CaptionLabel,
922
+ dropdowns: UI.Dropdowns,
923
+ dropdownRoot: UI.DropdownRoot,
924
+ dropdown: UI.Dropdown,
925
+ monthGrid: UI.MonthGrid,
926
+ weekdays: UI.Weekdays,
927
+ weekday: UI.Weekday,
928
+ weeks: UI.Weeks,
929
+ week: UI.Week,
930
+ weekNumber: UI.WeekNumber,
931
+ weekNumberHeader: UI.WeekNumberHeader,
932
+ day: UI.Day,
933
+ dayButton: UI.DayButton,
934
+ footer: UI.Footer
935
+ };
936
+ var ENGINE_CLASSNAME_RESET = Object.fromEntries(
937
+ [...Object.values(UI), ...Object.values(DayFlag), ...Object.values(SelectionState), ...Object.values(Animation)].map((key) => [key, ""])
938
+ );
939
+ var mergeSlotAttrs = (slotAttrs, engineProps) => {
940
+ const merged = { ...slotAttrs };
941
+ for (const key in engineProps) {
942
+ const value = engineProps[key];
943
+ if (value !== void 0) merged[key] = value;
944
+ }
945
+ return merged;
946
+ };
947
+ var CaptionMonthContext = createContext(null);
948
+ var PANEL_COLUMNS = 4;
949
+ var visuallyHidden = {
950
+ position: "absolute",
951
+ width: 1,
952
+ height: 1,
953
+ margin: -1,
954
+ padding: 0,
955
+ overflow: "hidden",
956
+ clip: "rect(0 0 0 0)",
957
+ whiteSpace: "nowrap",
958
+ border: 0
959
+ };
960
+ var displayContents = { display: "contents" };
961
+ var createEngineComponents = (attrsRef, refRef, viewRef, renderDayRef) => {
962
+ const withSlot = (Component, slot) => {
963
+ const Slotted = (props) => /* @__PURE__ */ jsx(Component, { ...mergeSlotAttrs(attrsRef.current[slot], props) });
964
+ Slotted.displayName = `Calendar.${slot}`;
965
+ return Slotted;
966
+ };
967
+ const Root = ({ rootRef, ...engineProps }) => /* @__PURE__ */ jsx(
968
+ "div",
969
+ {
970
+ ...mergeSlotAttrs(attrsRef.current.root, engineProps),
971
+ ref: (node) => {
972
+ assignRef(refRef.current, node);
973
+ assignRef(rootRef, node);
974
+ }
975
+ }
976
+ );
977
+ Root.displayName = "Calendar.root";
978
+ const Chevron = ({ orientation = "left", size, ...engineProps }) => {
979
+ const Icon = orientation === "left" ? ChevronLeftIconOutlinedRounded : orientation === "right" ? ChevronRightIconOutlinedRounded : orientation === "up" ? ChevronTopIconOutlinedRounded : ChevronBottomIconOutlinedRounded;
980
+ const { disabled: _disabled, ...svgProps } = engineProps;
981
+ return /* @__PURE__ */ jsx(Icon, { "aria-hidden": "true", ...mergeSlotAttrs(attrsRef.current.chevron, { ...svgProps, width: size, height: size }) });
982
+ };
983
+ Chevron.displayName = "Calendar.chevron";
984
+ const useDisplayedMonth = () => {
985
+ const { months, dayPickerProps } = useDayPicker();
986
+ const first = dayPickerProps.reverseMonths ? months[months.length - 1] : months[0];
987
+ return first?.date ?? /* @__PURE__ */ new Date();
988
+ };
989
+ const useDateLib = () => {
990
+ const { locale, timeZone, numerals, dateLib } = useDayPicker().dayPickerProps;
991
+ return useMemo(
992
+ // The same merge the engine makes, so a partial `locale` still resolves
993
+ // against `en-US` rather than leaving fields undefined.
994
+ () => new DateLib({ locale: { ...defaultLocale, ...locale }, timeZone, numerals }, dateLib),
995
+ [locale, timeZone, numerals, dateLib]
996
+ );
997
+ };
998
+ const MonthCaption$1 = ({ calendarMonth, displayIndex, ...engineProps }) => /* @__PURE__ */ jsx(CaptionMonthContext.Provider, { value: calendarMonth.date, children: /* @__PURE__ */ jsx(
999
+ MonthCaption,
1000
+ {
1001
+ calendarMonth,
1002
+ displayIndex,
1003
+ ...mergeSlotAttrs(attrsRef.current.monthCaption, engineProps)
1004
+ }
1005
+ ) });
1006
+ MonthCaption$1.displayName = "Calendar.monthCaption";
1007
+ const CaptionLabel$1 = ({ children, ...engineProps }) => {
1008
+ const { triggersEnabled, view, setView, navigationDisabled, panelId, pendingFocusRef, restoreRef } = viewRef.current;
1009
+ const { formatters, labels } = useDayPicker();
1010
+ const caption = useContext(CaptionMonthContext);
1011
+ const anchor = useDisplayedMonth();
1012
+ const dateLib = useDateLib();
1013
+ const displayed = caption ?? anchor;
1014
+ const slotProps = mergeSlotAttrs(attrsRef.current.captionLabel, engineProps);
1015
+ if (!triggersEnabled || displayed.getTime() !== anchor.getTime())
1016
+ return /* @__PURE__ */ jsx(CaptionLabel, { ...slotProps, children });
1017
+ const trigger = (target, label, describe) => {
1018
+ const opens = view !== target;
1019
+ const disabled = navigationDisabled && opens;
1020
+ return /* @__PURE__ */ jsx(
1021
+ "button",
1022
+ {
1023
+ type: "button",
1024
+ ...mergeSlotAttrs(attrsRef.current.captionTrigger, {
1025
+ "data-view": target,
1026
+ // The engine's own label, so `labels` translates the panel too; a
1027
+ // per-instance override still wins through `slotProps`.
1028
+ "aria-label": attrsRef.current.captionTrigger["aria-label"] ?? `${label}, ${describe}`,
1029
+ "aria-expanded": view === target,
1030
+ "aria-controls": view === target ? panelId : void 0,
1031
+ "aria-disabled": disabled || void 0,
1032
+ "onClick": (event) => {
1033
+ if (disabled) return;
1034
+ const next = opens ? target : "day";
1035
+ restoreRef.current = next === "day" ? null : event.currentTarget;
1036
+ pendingFocusRef.current = next !== "day";
1037
+ setView(next);
1038
+ }
1039
+ }),
1040
+ children: label
1041
+ }
1042
+ );
1043
+ };
1044
+ const monthLabel = formatters.formatMonthDropdown(displayed, dateLib);
1045
+ const yearLabel = formatters.formatYearDropdown(displayed, dateLib);
1046
+ return /* @__PURE__ */ jsxs(
1047
+ CaptionLabel,
1048
+ {
1049
+ ...slotProps,
1050
+ role: void 0,
1051
+ "aria-live": void 0,
1052
+ children: [
1053
+ trigger("month", monthLabel, labels.labelMonthDropdown()),
1054
+ trigger("year", yearLabel, labels.labelYearDropdown()),
1055
+ /* @__PURE__ */ jsx("span", { role: "status", "aria-live": "polite", style: visuallyHidden, children: view === "day" ? `${monthLabel} ${yearLabel}` : view === "month" ? labels.labelMonthDropdown() : labels.labelYearDropdown() })
1056
+ ]
1057
+ }
1058
+ );
1059
+ };
1060
+ CaptionLabel$1.displayName = "Calendar.captionLabel";
1061
+ const MonthGrid$1 = ({ children, ...engineProps }) => {
1062
+ const { view, setView, navigationDisabled, minDate, maxDate, panelId, panelRef, pendingFocusRef, restoreRef } = viewRef.current;
1063
+ const { dayPickerProps, formatters, goToMonth, labels } = useDayPicker();
1064
+ const displayed = useDisplayedMonth();
1065
+ const dateLib = useDateLib();
1066
+ useEffect(() => {
1067
+ if (view === "day" || !pendingFocusRef.current) return;
1068
+ pendingFocusRef.current = false;
1069
+ panelRef.current?.querySelector('[role="gridcell"][tabindex="0"]')?.focus();
1070
+ }, [view, panelRef, pendingFocusRef]);
1071
+ if (view === "day") {
1072
+ return /* @__PURE__ */ jsx(MonthGrid, { ...mergeSlotAttrs(attrsRef.current.monthGrid, { ...engineProps, children }) });
1073
+ }
1074
+ const year = displayed.getFullYear();
1075
+ const pageStart = yearPageStart(year);
1076
+ const restoreFocus = () => {
1077
+ const trigger = panelRef.current?.closest('[data-slot="root"]')?.querySelector(`[data-slot="caption-trigger"][data-view="${view}"]`);
1078
+ (restoreRef.current ?? trigger)?.focus();
1079
+ };
1080
+ const items = view === "month" ? Array.from({ length: 12 }, (_, month) => {
1081
+ const date = new Date(year, month, 1);
1082
+ return {
1083
+ key: String(month),
1084
+ // No engine formatter abbreviates a month — the dropdown spells
1085
+ // it out — so this is the one label built from a pattern; the
1086
+ // date library is still the engine's, so locale and numerals
1087
+ // hold.
1088
+ label: dateLib.format(date, "LLL"),
1089
+ name: formatters.formatCaption(date, dateLib.options, dateLib),
1090
+ current: displayed.getMonth() === month,
1091
+ // Picking a cell is navigation, so `disableNavigation` takes the
1092
+ // whole board down with the arrows — `goToMonth` would no-op and
1093
+ // leave an enabled-looking cell that does nothing.
1094
+ enabled: !navigationDisabled && isMonthInBounds(year, month, minDate, maxDate),
1095
+ select: () => {
1096
+ goToMonth(date);
1097
+ setView("day");
1098
+ restoreFocus();
1099
+ }
1100
+ };
1101
+ }) : Array.from({ length: YEARS_PER_PAGE }, (_, offset) => {
1102
+ const candidate = pageStart + offset;
1103
+ const label2 = formatters.formatYearDropdown(new Date(candidate, 0, 1), dateLib);
1104
+ return {
1105
+ key: String(candidate),
1106
+ label: label2,
1107
+ name: label2,
1108
+ current: candidate === year,
1109
+ enabled: !navigationDisabled && isYearInBounds(candidate, minDate, maxDate),
1110
+ select: () => {
1111
+ goToMonth(new Date(candidate, displayed.getMonth(), 1));
1112
+ restoreRef.current = null;
1113
+ pendingFocusRef.current = true;
1114
+ setView("month");
1115
+ }
1116
+ };
1117
+ });
1118
+ const seek = (start, delta, min = 0, max = items.length - 1) => {
1119
+ for (let index = start; index >= min && index <= max; index += delta) if (items[index]?.enabled) return index;
1120
+ return void 0;
1121
+ };
1122
+ const current = items.findIndex((item) => item.current && item.enabled);
1123
+ const activeIndex = current >= 0 ? current : seek(0, 1) ?? -1;
1124
+ const inline = dayPickerProps.dir === "rtl" ? -1 : 1;
1125
+ const move = (event, from) => {
1126
+ const step = { ArrowLeft: -inline, ArrowRight: inline, ArrowUp: -PANEL_COLUMNS, ArrowDown: PANEL_COLUMNS }[event.key];
1127
+ const rowStart = from - from % PANEL_COLUMNS;
1128
+ const rowEnd = rowStart + PANEL_COLUMNS - 1;
1129
+ let next;
1130
+ if (step !== void 0) next = seek(from + step, step);
1131
+ else if (event.key === "Home") next = seek(rowStart, 1, rowStart, rowEnd);
1132
+ else if (event.key === "End") next = seek(rowEnd, -1, rowStart, rowEnd);
1133
+ if (next === void 0) return;
1134
+ event.preventDefault();
1135
+ const cells = event.currentTarget.querySelectorAll('[role="gridcell"]');
1136
+ cells[next]?.focus();
1137
+ };
1138
+ const label = view === "month" ? `${labels.labelMonthDropdown()}, ${formatters.formatYearDropdown(displayed, dateLib)}` : `${labels.labelYearDropdown()}, ${dateLib.formatNumber(pageStart)}\u2013${dateLib.formatNumber(pageStart + YEARS_PER_PAGE - 1)}`;
1139
+ return /* @__PURE__ */ jsx(
1140
+ "div",
1141
+ {
1142
+ ...mergeSlotAttrs(attrsRef.current.monthYearGrid, {
1143
+ "id": panelId,
1144
+ "role": "grid",
1145
+ "aria-label": attrsRef.current.monthYearGrid["aria-label"] ?? label,
1146
+ "data-view": view,
1147
+ "ref": panelRef,
1148
+ "onKeyDown": (event) => {
1149
+ if (event.key === "Escape") {
1150
+ event.stopPropagation();
1151
+ setView("day");
1152
+ restoreFocus();
1153
+ return;
1154
+ }
1155
+ const cells = [...event.currentTarget.querySelectorAll('[role="gridcell"]')];
1156
+ const from = cells.indexOf(event.target);
1157
+ if (from >= 0) move(event, from);
1158
+ }
1159
+ }),
1160
+ children: Array.from({ length: items.length / PANEL_COLUMNS }, (_, row) => /* @__PURE__ */ jsx("div", { role: "row", style: displayContents, children: items.slice(row * PANEL_COLUMNS, row * PANEL_COLUMNS + PANEL_COLUMNS).map((item, column) => {
1161
+ const index = row * PANEL_COLUMNS + column;
1162
+ return /* @__PURE__ */ jsx(
1163
+ "button",
1164
+ {
1165
+ type: "button",
1166
+ disabled: !item.enabled,
1167
+ ...mergeSlotAttrs(attrsRef.current.monthYearCell, {
1168
+ "role": "gridcell",
1169
+ "aria-label": item.name,
1170
+ "aria-selected": item.current,
1171
+ "data-selected": item.current || void 0,
1172
+ "data-disabled": item.enabled ? void 0 : true,
1173
+ "tabIndex": index === activeIndex ? 0 : -1,
1174
+ "onClick": item.select
1175
+ }),
1176
+ children: item.label
1177
+ },
1178
+ item.key
1179
+ );
1180
+ }) }, row))
1181
+ }
1182
+ );
1183
+ };
1184
+ MonthGrid$1.displayName = "Calendar.monthGrid";
1185
+ const aroundArrow = (slot) => {
1186
+ const Engine = slot === "previousMonthButton" ? PreviousMonthButton : NextMonthButton;
1187
+ const Arrow = ({ children, ...engineProps }) => {
1188
+ const { view, navigationDisabled, minDate, maxDate } = viewRef.current;
1189
+ const { formatters, goToMonth } = useDayPicker();
1190
+ const displayed = useDisplayedMonth();
1191
+ const dateLib = useDateLib();
1192
+ const slotProps = mergeSlotAttrs(attrsRef.current[slot], engineProps);
1193
+ if (view !== "year") return /* @__PURE__ */ jsx(Engine, { ...slotProps, children });
1194
+ const target = new Date(displayed.getFullYear() + (slot === "previousMonthButton" ? -1 : 1), displayed.getMonth(), 1);
1195
+ const disabled = navigationDisabled || !isYearInBounds(target.getFullYear(), minDate, maxDate);
1196
+ return /* @__PURE__ */ jsx(
1197
+ Engine,
1198
+ {
1199
+ ...slotProps,
1200
+ "aria-label": formatters.formatYearDropdown(target, dateLib),
1201
+ "aria-disabled": disabled || void 0,
1202
+ tabIndex: disabled ? -1 : void 0,
1203
+ onClick: () => {
1204
+ if (!disabled) goToMonth(target);
1205
+ },
1206
+ children
1207
+ }
1208
+ );
1209
+ };
1210
+ Arrow.displayName = `Calendar.${slot}`;
1211
+ return Arrow;
1212
+ };
1213
+ const Nav = (engineProps) => {
1214
+ const { triggersEnabled, view, navigationDisabled, minDate, maxDate } = viewRef.current;
1215
+ const { classNames: engineClassNames, components, formatters, goToMonth, labels } = useDayPicker();
1216
+ const displayed = useDisplayedMonth();
1217
+ const dateLib = useDateLib();
1218
+ const slotProps = mergeSlotAttrs(attrsRef.current.nav, engineProps);
1219
+ const { onPreviousClick, onNextClick, previousMonth, nextMonth, ...navAttrs } = slotProps;
1220
+ const singleStep = view === "year" ? 12 : 1;
1221
+ const doubleStep = view === "year" ? YEARS_PER_PAGE * 12 : 12;
1222
+ const singleGrain = view === "year" ? "year" : "month";
1223
+ const doubleGrain = view === "year" ? "page" : "year";
1224
+ const shift = (months) => new Date(displayed.getFullYear(), displayed.getMonth() + months, 1);
1225
+ 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);
1226
+ const formatYear = (target) => formatters.formatYearDropdown(target, dateLib);
1227
+ const formatPage = (target) => {
1228
+ const start = yearPageStart(target.getFullYear());
1229
+ return `${dateLib.formatNumber(start)}\u2013${dateLib.formatNumber(start + YEARS_PER_PAGE - 1)}`;
1230
+ };
1231
+ const arrowLabel = (grain, target, previous) => grain === "month" ? previous ? labels.labelPrevious(target) : labels.labelNext(target) : grain === "year" ? formatYear(target) : formatPage(target);
1232
+ const arrow = (slot, months, grain, icon) => {
1233
+ const target = shift(months);
1234
+ const label = arrowLabel(grain, target, months < 0);
1235
+ const engineOwned = slot === "previousMonthButton" || slot === "nextMonthButton";
1236
+ const delegated = engineOwned && view === "day";
1237
+ const disabled = navigationDisabled || (delegated ? !(months < 0 ? previousMonth : nextMonth) : !reachable(target, grain));
1238
+ const Button2 = slot.startsWith("previous") ? PreviousMonthButton : NextMonthButton;
1239
+ return /* @__PURE__ */ jsx(
1240
+ Button2,
1241
+ {
1242
+ type: "button",
1243
+ ...mergeSlotAttrs(attrsRef.current[slot], {
1244
+ "className": engineOwned ? engineClassNames[slot === "previousMonthButton" ? UI.PreviousMonthButton : UI.NextMonthButton] : void 0,
1245
+ "aria-label": label,
1246
+ "aria-disabled": disabled || void 0,
1247
+ "tabIndex": disabled ? -1 : void 0,
1248
+ "onClick": (event) => {
1249
+ if (disabled) return;
1250
+ if (delegated) return months < 0 ? onPreviousClick?.(event) : onNextClick?.(event);
1251
+ goToMonth(target);
1252
+ }
1253
+ }),
1254
+ children: icon
1255
+ }
1256
+ );
1257
+ };
1258
+ const chevron = (orientation) => /* @__PURE__ */ jsx(components.Chevron, { orientation, className: engineClassNames[UI.Chevron] });
1259
+ const doubleChevron = (Icon) => /* @__PURE__ */ jsx(Icon, { "aria-hidden": "true", ...mergeSlotAttrs(attrsRef.current.chevron, { className: engineClassNames[UI.Chevron] }) });
1260
+ return /* @__PURE__ */ jsxs("nav", { ...navAttrs, children: [
1261
+ triggersEnabled && arrow("previousYearButton", -doubleStep, doubleGrain, doubleChevron(DoubleChevronLeftIconOutlinedRounded)),
1262
+ arrow("previousMonthButton", -singleStep, singleGrain, chevron("left")),
1263
+ arrow("nextMonthButton", singleStep, singleGrain, chevron("right")),
1264
+ triggersEnabled && arrow("nextYearButton", doubleStep, doubleGrain, doubleChevron(DoubleChevronRightIconOutlinedRounded))
1265
+ ] });
1266
+ };
1267
+ Nav.displayName = "Calendar.nav";
1268
+ const DayButton$1 = ({ day, modifiers, children, ...engineProps }) => {
1269
+ const slotProps = mergeSlotAttrs(attrsRef.current.dayButton, engineProps);
1270
+ return /* @__PURE__ */ jsx(DayButton, { ...slotProps, day, modifiers, children: renderDayRef.current ? renderDayRef.current(day.date, modifiers) : children });
1271
+ };
1272
+ DayButton$1.displayName = "Calendar.dayButton";
1273
+ return {
1274
+ Root,
1275
+ Chevron,
1276
+ CaptionLabel: CaptionLabel$1,
1277
+ MonthCaption: MonthCaption$1,
1278
+ MonthGrid: MonthGrid$1,
1279
+ Nav,
1280
+ Months: withSlot(Months, "months"),
1281
+ Month: withSlot(Month, "month"),
1282
+ PreviousMonthButton: aroundArrow("previousMonthButton"),
1283
+ NextMonthButton: aroundArrow("nextMonthButton"),
1284
+ DropdownNav: withSlot(DropdownNav, "dropdowns"),
1285
+ // The engine hands these props to its own `<select>`, so `dropdown` is the
1286
+ // select's anchor. Its wrapping span (`dropdownRoot`) is class-only — see
1287
+ // `base.ts`.
1288
+ Dropdown: withSlot(Dropdown$1, "dropdown"),
1289
+ Weekdays: withSlot(Weekdays, "weekdays"),
1290
+ Weekday: withSlot(Weekday, "weekday"),
1291
+ Weeks: withSlot(Weeks, "weeks"),
1292
+ Week: withSlot(Week, "week"),
1293
+ WeekNumber: withSlot(WeekNumber, "weekNumber"),
1294
+ WeekNumberHeader: withSlot(WeekNumberHeader, "weekNumberHeader"),
1295
+ Day: withSlot(Day, "day"),
1296
+ DayButton: DayButton$1,
1297
+ Footer: withSlot(Footer, "footer")
1298
+ };
1299
+ };
1300
+ var Calendar = (props) => {
1301
+ const theme = useComponentTheme("Calendar");
1302
+ const { rootAttrs, rest } = composeRootAttrs(CalendarBase, props, theme, {
1303
+ // `data-size` is takeoff-v2's own visual vocabulary. The engine's root
1304
+ // already emits `data-mode`, `data-multiple-months`, `data-week-numbers`
1305
+ // and `data-nav-layout`, so those are not mirrored here (rule 7).
1306
+ stateAttrs: ({ size = DEFAULT_SIZE5, headerType = DEFAULT_HEADER_TYPE }) => ({
1307
+ "data-size": size,
1308
+ "data-header-type": headerType
1309
+ })
1310
+ });
1311
+ const {
1312
+ mode = DEFAULT_MODE2,
1313
+ value,
1314
+ defaultValue,
1315
+ onValueChange,
1316
+ minDate,
1317
+ maxDate,
1318
+ disabledDates,
1319
+ allowedDates,
1320
+ disabledWeekDays,
1321
+ firstDayOfWeekIndex,
1322
+ size: _size,
1323
+ headerType: _headerType,
1324
+ view: viewProp,
1325
+ defaultView = DEFAULT_VIEW,
1326
+ onViewChange,
1327
+ ref,
1328
+ min,
1329
+ max,
1330
+ excludeDisabled,
1331
+ renderDay,
1332
+ ...engine
1333
+ } = rest;
1334
+ const isControlled = "value" in props;
1335
+ const [uncontrolledValue, setUncontrolledValue] = useState(isControlled ? void 0 : value ?? defaultValue);
1336
+ const selected = isControlled ? value : uncontrolledValue;
1337
+ const setSelected = (next) => {
1338
+ if (!isControlled) setUncontrolledValue(next);
1339
+ onValueChange?.(next);
1340
+ };
1341
+ const isMonthControlled = engine.month !== void 0;
1342
+ const anchor = selectionAnchor(selected);
1343
+ const [followedMonth, setFollowedMonth] = useState(void 0);
1344
+ const displayedMonthRef = useRef(void 0);
1345
+ const anchorYear = anchor?.getFullYear();
1346
+ const anchorMonth = anchor?.getMonth();
1347
+ useEffect(() => {
1348
+ if (isMonthControlled || anchorYear === void 0 || anchorMonth === void 0) return;
1349
+ const displayed = displayedMonthRef.current;
1350
+ const target = new Date(anchorYear, anchorMonth, 1);
1351
+ if (displayed && isSameCalendarMonth(displayed, target)) return;
1352
+ displayedMonthRef.current = target;
1353
+ setFollowedMonth(target);
1354
+ }, [isMonthControlled, anchorYear, anchorMonth]);
1355
+ const handleMonthChange = (next) => {
1356
+ displayedMonthRef.current = next;
1357
+ setFollowedMonth(next);
1358
+ engine.onMonthChange?.(next);
1359
+ };
1360
+ const triggersEnabled = !engine.captionLayout?.startsWith("dropdown");
1361
+ const isViewControlled = props.view !== void 0;
1362
+ const [uncontrolledView, setUncontrolledView] = useState(viewProp ?? defaultView);
1363
+ const view = isViewControlled ? props.view : uncontrolledView;
1364
+ const setView = (next) => {
1365
+ if (!isViewControlled) setUncontrolledView(next);
1366
+ onViewChange?.(next);
1367
+ };
1368
+ const panelId = useId();
1369
+ const panelRef = useRef(null);
1370
+ const restoreRef = useRef(null);
1371
+ const pendingFocusRef = useRef(false);
1372
+ const navigationDisabled = Boolean(engine.disableNavigation);
1373
+ const viewState = { triggersEnabled, view, setView, navigationDisabled, minDate, maxDate, panelId, panelRef, restoreRef, pendingFocusRef };
1374
+ const viewRef = useRef(viewState);
1375
+ viewRef.current = viewState;
1376
+ const slotAttrs = {};
1377
+ const classNames = { ...ENGINE_CLASSNAME_RESET, ...calendarRangeClassNames };
1378
+ for (const slot of CalendarBase.slots) {
1379
+ const composed = slot === "root" ? (
1380
+ // `data-view` is live state, not a resolved prop, so it is layered on
1381
+ // here rather than through `stateAttrs`.
1382
+ { ...rootAttrs, "data-view": view }
1383
+ ) : buildSlotAttrs(CalendarBase.getSlotProps(slot), slot, {
1384
+ themeSlotProps: theme?.slotProps,
1385
+ themeClassNames: theme?.classNames,
1386
+ instanceSlotProps: props.slotProps,
1387
+ instanceClassNames: props.classNames
1388
+ });
1389
+ const uiKey = SLOT_TO_UI[slot];
1390
+ if (uiKey === void 0) {
1391
+ slotAttrs[slot] = composed;
1392
+ continue;
1393
+ }
1394
+ const { className, ...attrs } = composed;
1395
+ slotAttrs[slot] = attrs;
1396
+ classNames[uiKey] = className ?? "";
1397
+ }
1398
+ const attrsRef = useRef(slotAttrs);
1399
+ attrsRef.current = slotAttrs;
1400
+ const refRef = useRef(ref);
1401
+ refRef.current = ref;
1402
+ const renderDayRef = useRef(renderDay);
1403
+ renderDayRef.current = renderDay;
1404
+ const components = useMemo(() => createEngineComponents(attrsRef, refRef, viewRef, renderDayRef), []);
1405
+ const disabled = buildDisabledMatchers({ minDate, maxDate, disabledDates, allowedDates, disabledWeekDays });
1406
+ const engineProps = {
1407
+ ...engine,
1408
+ // A board belongs to the calendar, not to a month, so only one month is
1409
+ // displayed while one is open — the board would otherwise be repeated per
1410
+ // month, `id` and all. Mapped on the prop rather than by dropping the extra
1411
+ // months from the `Month` override, which would take the engine's
1412
+ // navigation down with them: `navLayout="after"` and `"around"` render it
1413
+ // inside a month.
1414
+ numberOfMonths: view === "day" ? engine.numberOfMonths : 1,
1415
+ // A passed `month` stays in charge; otherwise the month the grid follows is
1416
+ // whatever it was last moved to — by the user's own navigation or by the
1417
+ // selection above. `defaultMonth` still seeds the first render, because
1418
+ // `followedMonth` is undefined until something moves.
1419
+ month: isMonthControlled ? engine.month : followedMonth,
1420
+ onMonthChange: handleMonthChange,
1421
+ mode,
1422
+ selected,
1423
+ onSelect: setSelected,
1424
+ disabled,
1425
+ startMonth: minDate,
1426
+ endMonth: maxDate,
1427
+ weekStartsOn: firstDayOfWeekIndex,
1428
+ min,
1429
+ max,
1430
+ excludeDisabled,
1431
+ classNames,
1432
+ components
1433
+ };
1434
+ return /* @__PURE__ */ jsx(DayPicker, { ...engineProps });
1435
+ };
1436
+ Calendar.displayName = "Calendar";
1437
+
745
1438
  // src/components/card/base.ts
746
1439
  var CardBase = createComponentBase({
747
1440
  name: "Card",
@@ -783,12 +1476,12 @@ var Card = (props) => {
783
1476
  Card.displayName = "Card";
784
1477
 
785
1478
  // src/components/card/defaults.ts
786
- var DEFAULT_HEADER_TYPE = "basic";
1479
+ var DEFAULT_HEADER_TYPE2 = "basic";
787
1480
  var DEFAULT_FOOTER_TYPE = "basic";
788
1481
  var CardHeader = (props) => {
789
1482
  const theme = useComponentTheme("CardHeader");
790
1483
  const { rootAttrs, rest } = composeRootAttrs(CardHeaderBase, props, theme, {
791
- stateAttrs: ({ headerType = DEFAULT_HEADER_TYPE }) => ({
1484
+ stateAttrs: ({ headerType = DEFAULT_HEADER_TYPE2 }) => ({
792
1485
  "data-header-type": headerType
793
1486
  })
794
1487
  });
@@ -866,11 +1559,11 @@ var CheckboxBase = createComponentBase({
866
1559
  var [CheckboxProvider, useCheckboxOwnContext] = createSafeContext("CheckboxProvider");
867
1560
 
868
1561
  // src/components/checkbox/defaults.ts
869
- var DEFAULT_SIZE5 = "base";
1562
+ var DEFAULT_SIZE6 = "base";
870
1563
  var Checkbox = (props) => {
871
1564
  const theme = useComponentTheme("Checkbox");
872
1565
  const { rootAttrs, rest } = composeRootAttrs(CheckboxBase, props, theme, {
873
- stateAttrs: ({ size = DEFAULT_SIZE5 }) => ({
1566
+ stateAttrs: ({ size = DEFAULT_SIZE6 }) => ({
874
1567
  "data-size": size
875
1568
  })
876
1569
  });
@@ -938,7 +1631,7 @@ var CheckboxIndicator = (props) => {
938
1631
  instanceSlotProps: slotProps,
939
1632
  instanceClassNames: classNames
940
1633
  });
941
- const resolvedChildren = typeof children === "function" ? children({ checked, indeterminate }) : children ?? /* @__PURE__ */ jsx("span", { ...iconAttrs, "aria-hidden": true, children: indeterminate ? /* @__PURE__ */ jsx(PlaceholderRemove, {}) : /* @__PURE__ */ jsx(PlaceholderCheck, {}) });
1634
+ const resolvedChildren = typeof children === "function" ? children({ checked, indeterminate }) : children ?? /* @__PURE__ */ jsx("span", { ...iconAttrs, "aria-hidden": true, children: indeterminate ? /* @__PURE__ */ jsx(RemoveIconOutlinedRounded, {}) : /* @__PURE__ */ jsx(CheckIconOutlinedRounded, {}) });
942
1635
  return /* @__PURE__ */ jsx("span", { ...rest, ...indicatorAttrs, ref, children: resolvedChildren });
943
1636
  };
944
1637
  CheckboxIndicator.displayName = "Checkbox.Indicator";
@@ -962,13 +1655,13 @@ var ChipBase = createComponentBase({
962
1655
  // src/components/chip/defaults.ts
963
1656
  var DEFAULT_VARIANT4 = "primary";
964
1657
  var DEFAULT_APPEARANCE4 = "filled";
965
- var DEFAULT_SIZE6 = "base";
1658
+ var DEFAULT_SIZE7 = "base";
966
1659
  var DEFAULT_REMOVE_LABEL = "Remove";
967
1660
  var Chip = (props) => {
968
1661
  const theme = useComponentTheme("Chip");
969
1662
  const [dismissed, setDismissed] = useState(false);
970
1663
  const { rootAttrs, rest } = composeRootAttrs(ChipBase, props, theme, {
971
- stateAttrs: ({ variant = DEFAULT_VARIANT4, appearance = DEFAULT_APPEARANCE4, size = DEFAULT_SIZE6, clickable: clickable2 = false, disabled: disabled2 = false, removable: removable2 = false }) => ({
1664
+ stateAttrs: ({ variant = DEFAULT_VARIANT4, appearance = DEFAULT_APPEARANCE4, size = DEFAULT_SIZE7, clickable: clickable2 = false, disabled: disabled2 = false, removable: removable2 = false }) => ({
972
1665
  "data-variant": variant,
973
1666
  "data-type": appearance,
974
1667
  "data-size": size,
@@ -1063,7 +1756,7 @@ var Chip = (props) => {
1063
1756
  isRenderableNode(children) && /* @__PURE__ */ jsx("span", { ...labelSlotAttrs, children }),
1064
1757
  removable && // The icon-only remove control needs an accessible name. Default it,
1065
1758
  // but let `slotProps.remove` (spread after) override via `aria-label`.
1066
- /* @__PURE__ */ jsx("button", { "aria-label": DEFAULT_REMOVE_LABEL, ...removeButtonAttrs, disabled, onClick: handleRemoveClick, type: "button", children: /* @__PURE__ */ jsx(PlaceholderClose, {}) })
1759
+ /* @__PURE__ */ jsx("button", { "aria-label": DEFAULT_REMOVE_LABEL, ...removeButtonAttrs, disabled, onClick: handleRemoveClick, type: "button", children: /* @__PURE__ */ jsx(CloseIconOutlinedRounded, {}) })
1067
1760
  ]
1068
1761
  }
1069
1762
  );
@@ -1075,14 +1768,15 @@ var [DrawerProvider, useDrawerOwnContext] = createSafeContext("DrawerProvider");
1075
1768
 
1076
1769
  // src/components/drawer/defaults.ts
1077
1770
  var DEFAULT_PLACEMENT = "right";
1078
- var DEFAULT_HEADER_TYPE2 = "basic";
1771
+ var DEFAULT_HEADER_TYPE3 = "basic";
1079
1772
  var DEFAULT_FOOTER_TYPE2 = "basic";
1080
1773
  var DEFAULT_INTENSITY = "base";
1774
+ var DEFAULT_CLOSE_LABEL2 = "Close";
1081
1775
  var Drawer = (props) => {
1082
1776
  const theme = useComponentTheme("Drawer");
1083
1777
  const merged = { ...theme?.defaultProps, ...props };
1084
- const { placement = DEFAULT_PLACEMENT, dismissible = true, disabled = false, children, ...sparProps } = merged;
1085
- return /* @__PURE__ */ jsx(DrawerProvider, { value: { placement, dismissible }, children: /* @__PURE__ */ jsx(Dialog$1, { ...sparProps, disabled, forceMount: true, children }) });
1778
+ const { placement = DEFAULT_PLACEMENT, dismissible = true, disabled = false, forceMount = true, children, ...sparProps } = merged;
1779
+ return /* @__PURE__ */ jsx(DrawerProvider, { value: { placement, dismissible }, children: /* @__PURE__ */ jsx(Dialog$1, { ...sparProps, disabled, forceMount, children }) });
1086
1780
  };
1087
1781
  Drawer.displayName = "Drawer";
1088
1782
 
@@ -1177,7 +1871,7 @@ DrawerPanel.displayName = "Drawer.Panel";
1177
1871
  var DrawerHeader = (props) => {
1178
1872
  const theme = useComponentTheme("DrawerHeader");
1179
1873
  const { rootAttrs, rest } = composeRootAttrs(DrawerHeaderBase, props, theme, {
1180
- stateAttrs: ({ headerType = DEFAULT_HEADER_TYPE2 }) => ({
1874
+ stateAttrs: ({ headerType = DEFAULT_HEADER_TYPE3 }) => ({
1181
1875
  "data-header-type": headerType
1182
1876
  })
1183
1877
  });
@@ -1223,8 +1917,9 @@ DrawerFooter.displayName = "Drawer.Footer";
1223
1917
  var DrawerClose = (props) => {
1224
1918
  const theme = useComponentTheme("DrawerClose");
1225
1919
  const { rootAttrs, rest } = composeRootAttrs(DrawerCloseBase, props, theme);
1226
- const { children, ref, ...closeProps } = rest;
1227
- return /* @__PURE__ */ jsx(DialogClose$1, { ...closeProps, ref, ...rootAttrs, children });
1920
+ const { children, ref, "aria-label": ariaLabel, ...closeProps } = rest;
1921
+ const hasCustomChildren = typeof children === "function" || isRenderableNode(children);
1922
+ return /* @__PURE__ */ jsx(DialogClose$1, { ...closeProps, "aria-label": ariaLabel ?? (hasCustomChildren ? void 0 : DEFAULT_CLOSE_LABEL2), ref, ...rootAttrs, children: hasCustomChildren ? children : /* @__PURE__ */ jsx(CloseIconOutlinedRounded, {}) });
1228
1923
  };
1229
1924
  DrawerClose.displayName = "Drawer.Close";
1230
1925
 
@@ -1325,8 +2020,9 @@ DialogTrigger.displayName = "Dialog.Trigger";
1325
2020
 
1326
2021
  // src/components/dialog/defaults.ts
1327
2022
  var DEFAULT_INTENSITY2 = "base";
1328
- var DEFAULT_HEADER_TYPE3 = "basic";
2023
+ var DEFAULT_HEADER_TYPE4 = "basic";
1329
2024
  var DEFAULT_FOOTER_TYPE3 = "basic";
2025
+ var DEFAULT_CLOSE_LABEL3 = "Close";
1330
2026
  var DialogOverlay = (props) => {
1331
2027
  const theme = useComponentTheme("DialogOverlay");
1332
2028
  const { rootAttrs, rest } = composeRootAttrs(DialogOverlayBase, props, theme, {
@@ -1356,7 +2052,7 @@ DialogPanel.displayName = "Dialog.Panel";
1356
2052
  var DialogHeader = (props) => {
1357
2053
  const theme = useComponentTheme("DialogHeader");
1358
2054
  const { rootAttrs, rest } = composeRootAttrs(DialogHeaderBase, props, theme, {
1359
- stateAttrs: ({ headerType = DEFAULT_HEADER_TYPE3 }) => ({
2055
+ stateAttrs: ({ headerType = DEFAULT_HEADER_TYPE4 }) => ({
1360
2056
  "data-header-type": headerType
1361
2057
  })
1362
2058
  });
@@ -1402,8 +2098,9 @@ DialogFooter.displayName = "Dialog.Footer";
1402
2098
  var DialogClose = (props) => {
1403
2099
  const theme = useComponentTheme("DialogClose");
1404
2100
  const { rootAttrs, rest } = composeRootAttrs(DialogCloseBase, props, theme);
1405
- const { children, ref, ...sparProps } = rest;
1406
- return /* @__PURE__ */ jsx(DialogClose$1, { ...sparProps, ...rootAttrs, ref, children });
2101
+ const { children, ref, "aria-label": ariaLabel, ...sparProps } = rest;
2102
+ const hasCustomChildren = typeof children === "function" || isRenderableNode(children);
2103
+ return /* @__PURE__ */ jsx(DialogClose$1, { ...sparProps, "aria-label": ariaLabel ?? (hasCustomChildren ? void 0 : DEFAULT_CLOSE_LABEL3), ...rootAttrs, ref, children: hasCustomChildren ? children : /* @__PURE__ */ jsx(CloseIconOutlinedRounded, {}) });
1407
2104
  };
1408
2105
  DialogClose.displayName = "Dialog.Close";
1409
2106
 
@@ -1462,12 +2159,12 @@ Divider.displayName = "Divider";
1462
2159
  var [DropdownProvider, useDropdownOwnContext] = createSafeContext("DropdownProvider");
1463
2160
 
1464
2161
  // src/components/dropdown/defaults.ts
1465
- var DEFAULT_SIZE7 = "base";
2162
+ var DEFAULT_SIZE8 = "base";
1466
2163
  var DEFAULT_CONTENT_WIDTH = "content";
1467
2164
  var Dropdown = (props) => {
1468
2165
  const theme = useComponentTheme("Dropdown");
1469
2166
  const merged = { ...theme?.defaultProps, ...props };
1470
- const { size = DEFAULT_SIZE7, contentWidth = DEFAULT_CONTENT_WIDTH, children, ...sparProps } = merged;
2167
+ const { size = DEFAULT_SIZE8, contentWidth = DEFAULT_CONTENT_WIDTH, children, ...sparProps } = merged;
1471
2168
  return /* @__PURE__ */ jsx(DropdownProvider, { value: { size, contentWidth }, children: /* @__PURE__ */ jsx(DropdownMenu, { ...sparProps, children }) });
1472
2169
  };
1473
2170
  Dropdown.displayName = "Dropdown";
@@ -1653,7 +2350,7 @@ var FieldDescription = (props) => {
1653
2350
  });
1654
2351
  const hasContent = children != null && children !== "";
1655
2352
  return /* @__PURE__ */ jsxs(FieldDescription$1, { ...spar, ref, ...rootAttrs, children: [
1656
- hasContent && /* @__PURE__ */ jsx("span", { ...iconAttrs, "aria-hidden": "true", children: /* @__PURE__ */ jsx(PlaceholderInfo, {}) }),
2353
+ hasContent && /* @__PURE__ */ jsx("span", { ...iconAttrs, "aria-hidden": "true", children: /* @__PURE__ */ jsx(InfoIconFilledRounded, {}) }),
1657
2354
  children
1658
2355
  ] });
1659
2356
  };
@@ -1670,7 +2367,7 @@ var FieldErrorMessage = (props) => {
1670
2367
  });
1671
2368
  const hasContent = children != null && children !== "";
1672
2369
  return /* @__PURE__ */ jsxs(FieldErrorMessage$1, { ...spar, ref, ...rootAttrs, children: [
1673
- hasContent && /* @__PURE__ */ jsx("span", { ...iconAttrs, "aria-hidden": "true", children: /* @__PURE__ */ jsx(PlaceholderError, {}) }),
2370
+ hasContent && /* @__PURE__ */ jsx("span", { ...iconAttrs, "aria-hidden": "true", children: /* @__PURE__ */ jsx(AlertCircleIconFilledRounded, {}) }),
1674
2371
  children
1675
2372
  ] });
1676
2373
  };
@@ -1759,7 +2456,7 @@ var InputChipsBase = createComponentBase({
1759
2456
  var [InputProvider, useInputOwnContext] = createSafeContext("InputProvider");
1760
2457
 
1761
2458
  // src/components/input/defaults.ts
1762
- var DEFAULT_SIZE8 = "base";
2459
+ var DEFAULT_SIZE9 = "base";
1763
2460
  var SEGMENT_COUNT = 4;
1764
2461
  var computeStrength = (value) => {
1765
2462
  let strength = 0;
@@ -1811,11 +2508,11 @@ var Input = (props) => {
1811
2508
  for (const value of clearablesRef.current.values()) value.clear();
1812
2509
  }, []);
1813
2510
  const { rootAttrs, rest } = composeRootAttrs(InputBase, props, theme, {
1814
- stateAttrs: ({ size: size2 = DEFAULT_SIZE8 }) => ({
2511
+ stateAttrs: ({ size: size2 = DEFAULT_SIZE9 }) => ({
1815
2512
  "data-size": size2
1816
2513
  })
1817
2514
  });
1818
- const { size = DEFAULT_SIZE8, children, ref, ...sparProps } = rest;
2515
+ const { size = DEFAULT_SIZE9, children, ref, ...sparProps } = rest;
1819
2516
  const contextValue = useMemo(
1820
2517
  () => ({
1821
2518
  size,
@@ -1999,7 +2696,7 @@ var InputClearButton = (props) => {
1999
2696
  "aria-label": ariaLabel,
2000
2697
  onClick: handleClick,
2001
2698
  onKeyDown: handleKeyDown,
2002
- startContent: children ?? /* @__PURE__ */ jsx(PlaceholderClose, {})
2699
+ startContent: children ?? /* @__PURE__ */ jsx(CloseIconOutlinedRounded, {})
2003
2700
  }
2004
2701
  );
2005
2702
  };
@@ -2030,7 +2727,7 @@ var InputDecrement = (props) => {
2030
2727
  disabled: disabled || readOnly,
2031
2728
  "aria-label": ariaLabel,
2032
2729
  onClick: handleClick,
2033
- startContent: children ?? /* @__PURE__ */ jsx(PlaceholderChevronDown, {})
2730
+ startContent: children ?? /* @__PURE__ */ jsx(ChevronBottomIconOutlinedRounded, {})
2034
2731
  }
2035
2732
  );
2036
2733
  };
@@ -2039,7 +2736,7 @@ var InputField = (props) => {
2039
2736
  const theme = useComponentTheme("InputField");
2040
2737
  const { fieldRef, setFieldNode, setFieldValue, revealed, setRevealed } = useInputOwnContext("Input.Field");
2041
2738
  const { rootAttrs, rest } = composeRootAttrs(InputFieldBase, props, theme);
2042
- const { as, ref, type, onInput, onChange, ...spar } = rest;
2739
+ const { as, ref, type, onInput, onChange, onValueChange, ...spar } = rest;
2043
2740
  const effectiveType = type === "password" && revealed ? "text" : type;
2044
2741
  const renderedType = as === "textarea" ? void 0 : effectiveType;
2045
2742
  const setFieldRef = useCallback(
@@ -2068,6 +2765,10 @@ var InputField = (props) => {
2068
2765
  onChange?.(event);
2069
2766
  setFieldValue(event.currentTarget.value);
2070
2767
  };
2768
+ const handleValueChange = (value, meta) => {
2769
+ setFieldValue(value);
2770
+ onValueChange?.(value, meta);
2771
+ };
2071
2772
  return /* @__PURE__ */ jsx(
2072
2773
  InputField$1,
2073
2774
  {
@@ -2076,6 +2777,7 @@ var InputField = (props) => {
2076
2777
  type: renderedType,
2077
2778
  onInput: handleInput,
2078
2779
  onChange: handleChange,
2780
+ onValueChange: handleValueChange,
2079
2781
  ref: setFieldRef,
2080
2782
  ...rootAttrs
2081
2783
  }
@@ -2108,7 +2810,7 @@ var InputIncrement = (props) => {
2108
2810
  disabled: disabled || readOnly,
2109
2811
  "aria-label": ariaLabel,
2110
2812
  onClick: handleClick,
2111
- startContent: children ?? /* @__PURE__ */ jsx(PlaceholderChevronUp, {})
2813
+ startContent: children ?? /* @__PURE__ */ jsx(ChevronTopIconOutlinedRounded, {})
2112
2814
  }
2113
2815
  );
2114
2816
  };
@@ -2167,7 +2869,7 @@ var InputRevealButton = (props) => {
2167
2869
  "aria-label": "Toggle password visibility",
2168
2870
  "aria-pressed": revealed,
2169
2871
  onClick: handleClick,
2170
- startContent: children ?? (revealed ? /* @__PURE__ */ jsx(PlaceholderEyeOff, {}) : /* @__PURE__ */ jsx(PlaceholderEye, {}))
2872
+ startContent: children ?? (revealed ? /* @__PURE__ */ jsx(EyeClosedIconOutlinedRounded, {}) : /* @__PURE__ */ jsx(EyeOpenIconOutlinedRounded, {}))
2171
2873
  }
2172
2874
  );
2173
2875
  };
@@ -2208,8 +2910,6 @@ var InputTrailingIcon = (props) => {
2208
2910
  return /* @__PURE__ */ jsx(Component, { "aria-hidden": "true", ...rendered, ref, ...rootAttrs, children });
2209
2911
  };
2210
2912
  InputTrailingIcon.displayName = "Input.TrailingIcon";
2211
-
2212
- // src/components/input/index.ts
2213
2913
  var Input2 = Object.assign(Input, {
2214
2914
  Field: InputField,
2215
2915
  Prefix: InputPrefix,
@@ -2271,19 +2971,19 @@ var RADIO_ITEM_CONTEXT_VALUE = { inside: true };
2271
2971
  var [RadioItemProvider, useRadioItemOwnContext] = createSafeContext("RadioItemProvider");
2272
2972
 
2273
2973
  // src/components/radio/defaults.ts
2274
- var DEFAULT_SIZE9 = "base";
2974
+ var DEFAULT_SIZE10 = "base";
2275
2975
  var DEFAULT_POSITION = "left";
2276
2976
  var Radio = (props) => {
2277
2977
  const theme = useComponentTheme("Radio");
2278
2978
  const { rootAttrs, rest } = composeRootAttrs(RadioBase, props, theme, {
2279
- stateAttrs: ({ size: size2 = DEFAULT_SIZE9, position: position2 = DEFAULT_POSITION, spread }) => ({
2979
+ stateAttrs: ({ size: size2 = DEFAULT_SIZE10, position: position2 = DEFAULT_POSITION, spread }) => ({
2280
2980
  "data-size": size2,
2281
2981
  "data-position": position2,
2282
2982
  "data-spread": spread ? "" : void 0
2283
2983
  })
2284
2984
  });
2285
2985
  const {
2286
- size = DEFAULT_SIZE9,
2986
+ size = DEFAULT_SIZE10,
2287
2987
  position = DEFAULT_POSITION,
2288
2988
  invalid,
2289
2989
  // `spread` is consumed only as a data-attr above; destructure to keep it
@@ -2402,6 +3102,7 @@ PopoverTrigger.displayName = "Popover.Trigger";
2402
3102
 
2403
3103
  // src/components/popover/defaults.ts
2404
3104
  var DEFAULT_VARIANT5 = "white";
3105
+ var DEFAULT_CLOSE_LABEL4 = "Close";
2405
3106
  var PopoverContent = (props) => {
2406
3107
  const theme = useComponentTheme("PopoverContent");
2407
3108
  const { rootAttrs, rest } = composeRootAttrs(PopoverContentBase, props, theme, {
@@ -2437,8 +3138,9 @@ PopoverArrow.displayName = "Popover.Arrow";
2437
3138
  var PopoverClose = (props) => {
2438
3139
  const theme = useComponentTheme("PopoverClose");
2439
3140
  const { rootAttrs, rest } = composeRootAttrs(PopoverCloseBase, props, theme);
2440
- const { children, ref, ...sparProps } = rest;
2441
- return /* @__PURE__ */ jsx(PopoverClose$1, { ...sparProps, ...rootAttrs, ref, children });
3141
+ const { children, ref, "aria-label": ariaLabel, ...sparProps } = rest;
3142
+ const hasCustomChildren = typeof children === "function" || isRenderableNode(children);
3143
+ return /* @__PURE__ */ jsx(PopoverClose$1, { ...sparProps, "aria-label": ariaLabel ?? (hasCustomChildren ? void 0 : DEFAULT_CLOSE_LABEL4), ...rootAttrs, ref, children: hasCustomChildren ? children : /* @__PURE__ */ jsx(CloseIconOutlinedRounded, {}) });
2442
3144
  };
2443
3145
  PopoverClose.displayName = "Popover.Close";
2444
3146
 
@@ -2479,7 +3181,7 @@ var [ProgressProvider, useProgressContext] = createSafeContext("ProgressProvider
2479
3181
 
2480
3182
  // src/components/progress/defaults.ts
2481
3183
  var DEFAULT_APPEARANCE6 = "linear";
2482
- var DEFAULT_SIZE10 = "base";
3184
+ var DEFAULT_SIZE11 = "base";
2483
3185
  var DEFAULT_VARIANT6 = "primary";
2484
3186
  var DEFAULT_MIN = 0;
2485
3187
  var DEFAULT_MAX = 100;
@@ -2560,7 +3262,7 @@ var Progress = (props) => {
2560
3262
  const resolveState = ({
2561
3263
  indeterminate: indeterminate2 = false,
2562
3264
  appearance: appearance2 = DEFAULT_APPEARANCE6,
2563
- size: size2 = DEFAULT_SIZE10,
3265
+ size: size2 = DEFAULT_SIZE11,
2564
3266
  variant: variant2 = DEFAULT_VARIANT6,
2565
3267
  disabled: disabled2 = field?.disabled ?? false
2566
3268
  }) => ({ indeterminate: indeterminate2, appearance: appearance2, size: size2, variant: variant2, disabled: disabled2 });
@@ -2704,17 +3406,17 @@ var SelectArrowBase = createComponentBase({
2704
3406
  var [SelectProvider, useSelectOwnContext] = createSafeContext("SelectProvider");
2705
3407
 
2706
3408
  // src/components/select/defaults.ts
2707
- var DEFAULT_SIZE11 = "base";
3409
+ var DEFAULT_SIZE12 = "base";
2708
3410
  var DEFAULT_CONTENT_WIDTH2 = "trigger";
2709
3411
  var Select = (props) => {
2710
3412
  const theme = useComponentTheme("Select");
2711
3413
  const { rootAttrs, rest } = composeRootAttrs(SelectBase, props, theme, {
2712
- stateAttrs: ({ size: size2 = DEFAULT_SIZE11, invalid: invalid2 }) => ({
3414
+ stateAttrs: ({ size: size2 = DEFAULT_SIZE12, invalid: invalid2 }) => ({
2713
3415
  "data-size": size2,
2714
3416
  "data-invalid": invalid2 ? "" : void 0
2715
3417
  })
2716
3418
  });
2717
- const { size = DEFAULT_SIZE11, invalid = false, contentWidth = DEFAULT_CONTENT_WIDTH2, children, ref, ...sparProps } = rest;
3419
+ const { size = DEFAULT_SIZE12, invalid = false, contentWidth = DEFAULT_CONTENT_WIDTH2, children, ref, ...sparProps } = rest;
2718
3420
  return /* @__PURE__ */ jsx(SelectProvider, { value: { size, invalid, contentWidth }, children: /* @__PURE__ */ jsx(Select$1, { ...sparProps, ref, ...rootAttrs, children }) });
2719
3421
  };
2720
3422
  Select.displayName = "Select";
@@ -2874,7 +3576,7 @@ var [SliderProvider, useSliderContext] = createSafeContext("SliderProvider");
2874
3576
 
2875
3577
  // src/components/slider/defaults.ts
2876
3578
  var DEFAULT_ORIENTATION2 = "horizontal";
2877
- var DEFAULT_SIZE12 = "base";
3579
+ var DEFAULT_SIZE13 = "base";
2878
3580
  var DEFAULT_VARIANT7 = "primary";
2879
3581
  var DEFAULT_TOOLTIP = "auto";
2880
3582
  var DEFAULT_TRACK = "normal";
@@ -3174,7 +3876,7 @@ var Slider = (props) => {
3174
3876
  const { rootAttrs, rest } = composeRootAttrs(SliderBase, props, theme, {
3175
3877
  stateAttrs: (merged) => {
3176
3878
  const {
3177
- size = DEFAULT_SIZE12,
3879
+ size = DEFAULT_SIZE13,
3178
3880
  variant = DEFAULT_VARIANT7,
3179
3881
  orientation: orientation2 = DEFAULT_ORIENTATION2,
3180
3882
  tooltip = DEFAULT_TOOLTIP,
@@ -3397,8 +4099,8 @@ var Slider = (props) => {
3397
4099
  name && !disabled && (range ? (
3398
4100
  // One input per handle so a 3+ thumb range submits every value; a
3399
4101
  // two-handle range keeps the conventional `-min` / `-max` pair.
3400
- values.map((entry, index) => /* @__PURE__ */ jsx("input", { type: "hidden", name: rangeInputName(name, index, values.length), value: entry, form }, index))
3401
- ) : /* @__PURE__ */ jsx("input", { type: "hidden", name, value: values[0], form }))
4102
+ values.map((entry, index) => /* @__PURE__ */ jsx(InputField$1, { type: "hidden", name: rangeInputName(name, index, values.length), value: entry, form }, index))
4103
+ ) : /* @__PURE__ */ jsx(InputField$1, { type: "hidden", name, value: values[0], form }))
3402
4104
  ] })
3403
4105
  }
3404
4106
  );
@@ -3462,7 +4164,7 @@ var SpinnerBase = createComponentBase({
3462
4164
 
3463
4165
  // src/components/spinner/defaults.ts
3464
4166
  var DEFAULT_APPEARANCE7 = "rounded";
3465
- var DEFAULT_SIZE13 = "base";
4167
+ var DEFAULT_SIZE14 = "base";
3466
4168
  var DEFAULT_VARIANT8 = "neutral";
3467
4169
  var DEFAULT_ARIA_LABEL2 = "Loading";
3468
4170
  var SPINNER_RADIAL_PARTS = 8;
@@ -3501,7 +4203,7 @@ var renderIndicatorContent = (appearance) => {
3501
4203
  var Spinner = (props) => {
3502
4204
  const theme = useComponentTheme("Spinner");
3503
4205
  const { rootAttrs, rest } = composeRootAttrs(SpinnerBase, props, theme, {
3504
- stateAttrs: ({ variant = DEFAULT_VARIANT8, size = DEFAULT_SIZE13, appearance: appearance2 = DEFAULT_APPEARANCE7 }) => ({
4206
+ stateAttrs: ({ variant = DEFAULT_VARIANT8, size = DEFAULT_SIZE14, appearance: appearance2 = DEFAULT_APPEARANCE7 }) => ({
3505
4207
  "data-variant": variant,
3506
4208
  "data-size": size,
3507
4209
  "data-type": appearance2
@@ -3558,8 +4260,8 @@ var [StepperItemProvider, useStepperItem] = createSafeContext("Stepper.Item");
3558
4260
 
3559
4261
  // src/components/stepper/defaults.ts
3560
4262
  var DEFAULT_ORIENTATION3 = "horizontal";
3561
- var DEFAULT_MODE2 = "default";
3562
- var DEFAULT_SIZE14 = "base";
4263
+ var DEFAULT_MODE3 = "default";
4264
+ var DEFAULT_SIZE15 = "base";
3563
4265
  var DEFAULT_ACTIVE = 0;
3564
4266
  var DEFAULT_COMPLETED_LABEL = "completed";
3565
4267
  var DEFAULT_ERROR_LABEL = "error";
@@ -3567,7 +4269,7 @@ var FOCUSABLE_TRIGGER_SELECTOR = '.tk-stepper-trigger:not(:disabled):not([tabind
3567
4269
  var Stepper = (props) => {
3568
4270
  const theme = useComponentTheme("Stepper");
3569
4271
  const { rootAttrs, rest } = composeRootAttrs(StepperBase, props, theme, {
3570
- stateAttrs: ({ orientation: orientation2 = DEFAULT_ORIENTATION3, mode: mode2 = DEFAULT_MODE2, size = DEFAULT_SIZE14, linear: linear2 = false, reverse = false }) => ({
4272
+ stateAttrs: ({ orientation: orientation2 = DEFAULT_ORIENTATION3, mode: mode2 = DEFAULT_MODE3, size = DEFAULT_SIZE15, linear: linear2 = false, reverse = false }) => ({
3571
4273
  "data-orientation": orientation2,
3572
4274
  "data-mode": mode2,
3573
4275
  "data-size": size,
@@ -3581,7 +4283,7 @@ var Stepper = (props) => {
3581
4283
  onActiveChange,
3582
4284
  onStepClick,
3583
4285
  orientation = DEFAULT_ORIENTATION3,
3584
- mode = DEFAULT_MODE2,
4286
+ mode = DEFAULT_MODE3,
3585
4287
  // Consumed only as root data-* hooks above; destructured so the <ol>
3586
4288
  // doesn't receive unknown DOM attributes.
3587
4289
  size: _size,
@@ -3698,7 +4400,7 @@ var StepperTitle = (props) => {
3698
4400
  return /* @__PURE__ */ jsx(Component, { ...nativeProps, ...rootAttrs, ref, children });
3699
4401
  };
3700
4402
  StepperTitle.displayName = "Stepper.Title";
3701
- var visuallyHidden = {
4403
+ var visuallyHidden2 = {
3702
4404
  position: "absolute",
3703
4405
  width: 1,
3704
4406
  height: 1,
@@ -3784,7 +4486,7 @@ var StepperItem = (props) => {
3784
4486
  children: [
3785
4487
  /* @__PURE__ */ jsx("span", { "aria-hidden": "true", ...indicatorAttrs, children: indicatorContent }),
3786
4488
  /* @__PURE__ */ jsx("span", { ...contentAttrs, children }),
3787
- statusLabel ? /* @__PURE__ */ jsx("span", { style: visuallyHidden, children: `, ${statusLabel}` }) : null
4489
+ statusLabel ? /* @__PURE__ */ jsx("span", { style: visuallyHidden2, children: `, ${statusLabel}` }) : null
3788
4490
  ]
3789
4491
  }
3790
4492
  )
@@ -3835,12 +4537,12 @@ var SwitchBase = createComponentBase({
3835
4537
  var [SwitchProvider, useSwitchOwnContext] = createSafeContext("SwitchProvider");
3836
4538
 
3837
4539
  // src/components/switch/defaults.ts
3838
- var DEFAULT_SIZE15 = "base";
4540
+ var DEFAULT_SIZE16 = "base";
3839
4541
  var DEFAULT_VARIANT9 = "info";
3840
4542
  var Switch = (props) => {
3841
4543
  const theme = useComponentTheme("Switch");
3842
4544
  const { rootAttrs, rest } = composeRootAttrs(SwitchBase, props, theme, {
3843
- stateAttrs: ({ size = DEFAULT_SIZE15, variant = DEFAULT_VARIANT9 }) => ({
4545
+ stateAttrs: ({ size = DEFAULT_SIZE16, variant = DEFAULT_VARIANT9 }) => ({
3844
4546
  "data-size": size,
3845
4547
  "data-variant": variant
3846
4548
  })
@@ -3967,7 +4669,7 @@ var TableBase = createComponentBase({
3967
4669
  var [TableProvider, useTableContext] = createSafeContext("Table");
3968
4670
 
3969
4671
  // src/components/table/defaults.ts
3970
- var DEFAULT_SIZE16 = "base";
4672
+ var DEFAULT_SIZE17 = "base";
3971
4673
  var DEFAULT_PAGE_SIZE = 10;
3972
4674
  var DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100];
3973
4675
  var DEFAULT_COLUMN_WIDTH = 150;
@@ -4337,7 +5039,7 @@ var TableHeaderCell = ({ header }) => {
4337
5039
  children: /* @__PURE__ */ jsxs("div", { ...slotAttrs("headerContent"), children: [
4338
5040
  canSort ? /* @__PURE__ */ jsxs("button", { ...slotAttrs("sortTrigger"), type: "button", onClick: column.getToggleSortingHandler(), children: [
4339
5041
  content,
4340
- /* @__PURE__ */ jsx("span", { ...slotAttrs("sortIcon"), "data-direction": sorted || "none", "aria-hidden": "true", children: sorted === "asc" ? /* @__PURE__ */ jsx(ChevronTopIconOutlinedRounded, {}) : sorted === "desc" ? /* @__PURE__ */ jsx(ChevronBottomIconOutlinedRounded, {}) : /* @__PURE__ */ jsx(SwapIconOutlinedRounded, {}) })
5042
+ /* @__PURE__ */ jsx("span", { ...slotAttrs("sortIcon"), "data-direction": sorted || "none", "aria-hidden": "true", children: sorted === "asc" ? /* @__PURE__ */ jsx(ArrowTopIconOutlinedRounded, {}) : sorted === "desc" ? /* @__PURE__ */ jsx(ArrowBottomIconOutlinedRounded, {}) : /* @__PURE__ */ jsx(SwapIconOutlinedRounded, {}) })
4341
5043
  ] }) : content,
4342
5044
  canFilter && /* @__PURE__ */ jsx(TableColumnFilter, { header })
4343
5045
  ] })
@@ -4391,7 +5093,7 @@ var TablePagination = () => {
4391
5093
  variant: "neutral",
4392
5094
  appearance: "text",
4393
5095
  "aria-label": "First page",
4394
- startContent: /* @__PURE__ */ jsx(ArrowLeftIconOutlinedRounded, {}),
5096
+ startContent: /* @__PURE__ */ jsx(DoubleChevronLeftIconOutlinedRounded, {}),
4395
5097
  disabled: !table.getCanPreviousPage(),
4396
5098
  onClick: () => table.setPageIndex(0)
4397
5099
  }
@@ -4448,7 +5150,7 @@ var TablePagination = () => {
4448
5150
  variant: "neutral",
4449
5151
  appearance: "text",
4450
5152
  "aria-label": "Last page",
4451
- startContent: /* @__PURE__ */ jsx(ArrowRightIconOutlinedRounded, {}),
5153
+ startContent: /* @__PURE__ */ jsx(DoubleChevronRightIconOutlinedRounded, {}),
4452
5154
  disabled: !table.getCanNextPage() || pageCount <= 0,
4453
5155
  onClick: () => table.setPageIndex(pageCount - 1)
4454
5156
  }
@@ -4493,7 +5195,7 @@ var Table = (props) => {
4493
5195
  // Visual vocabulary lives on the root so recipes cascade
4494
5196
  // to the portal-free table descendants. `data-loading` mirrors the
4495
5197
  // boolean-presence convention (rule 5).
4496
- stateAttrs: ({ size: size2 = DEFAULT_SIZE16, striped: striped2, bordered: bordered2, stickyHeader: stickyHeader2, loading: loading2 }) => ({
5198
+ stateAttrs: ({ size: size2 = DEFAULT_SIZE17, striped: striped2, bordered: bordered2, stickyHeader: stickyHeader2, loading: loading2 }) => ({
4497
5199
  "data-size": size2,
4498
5200
  "data-striped": striped2 ? "" : void 0,
4499
5201
  "data-bordered": bordered2 ? "" : void 0,
@@ -4507,7 +5209,7 @@ var Table = (props) => {
4507
5209
  getRowId,
4508
5210
  manual = false,
4509
5211
  loading = false,
4510
- size = DEFAULT_SIZE16,
5212
+ size = DEFAULT_SIZE17,
4511
5213
  striped = false,
4512
5214
  bordered = false,
4513
5215
  stickyHeader = false,
@@ -4707,19 +5409,19 @@ var TabsContentBase = createComponentBase({
4707
5409
  var [TabsOwnProvider, useTabsOwnContext] = createSafeContext("Tabs");
4708
5410
 
4709
5411
  // src/components/tabs/defaults.ts
4710
- var DEFAULT_SIZE17 = "base";
5412
+ var DEFAULT_SIZE18 = "base";
4711
5413
  var DEFAULT_VARIANT10 = "primary";
4712
5414
  var DEFAULT_APPEARANCE8 = "basic";
4713
5415
  var Tabs = (props) => {
4714
5416
  const theme = useComponentTheme("Tabs");
4715
5417
  const { rootAttrs, rest } = composeRootAttrs(TabsBase, props, theme, {
4716
- stateAttrs: ({ size: size2 = DEFAULT_SIZE17, variant: variant2 = DEFAULT_VARIANT10, appearance: appearance2 = DEFAULT_APPEARANCE8 }) => ({
5418
+ stateAttrs: ({ size: size2 = DEFAULT_SIZE18, variant: variant2 = DEFAULT_VARIANT10, appearance: appearance2 = DEFAULT_APPEARANCE8 }) => ({
4717
5419
  "data-size": size2,
4718
5420
  "data-variant": variant2,
4719
5421
  "data-type": appearance2
4720
5422
  })
4721
5423
  });
4722
- const { size = DEFAULT_SIZE17, variant = DEFAULT_VARIANT10, appearance = DEFAULT_APPEARANCE8, children, ref, ...sparProps } = rest;
5424
+ const { size = DEFAULT_SIZE18, variant = DEFAULT_VARIANT10, appearance = DEFAULT_APPEARANCE8, children, ref, ...sparProps } = rest;
4723
5425
  return /* @__PURE__ */ jsx(TabsOwnProvider, { value: { size, variant, appearance }, children: /* @__PURE__ */ jsx(Tabs$1, { ...sparProps, ...rootAttrs, ref, children }) });
4724
5426
  };
4725
5427
  Tabs.displayName = "Tabs";
@@ -4881,7 +5583,7 @@ var ToastBase = createComponentBase({
4881
5583
 
4882
5584
  // src/components/toast/defaults.ts
4883
5585
  var DEFAULT_TOAST_APPEARANCE = "filled";
4884
- var DEFAULT_CLOSE_LABEL2 = "Dismiss notification";
5586
+ var DEFAULT_CLOSE_LABEL5 = "Dismiss notification";
4885
5587
 
4886
5588
  // src/components/toast/utils.ts
4887
5589
  var toastTypeToVariant = (type) => {
@@ -4902,7 +5604,7 @@ var toastTypeToVariant = (type) => {
4902
5604
  var Toast = (props) => {
4903
5605
  const theme = useComponentTheme("Toast");
4904
5606
  const { rootAttrs, rest } = composeRootAttrs(ToastBase, props, theme);
4905
- const { as, toast, toaster, appearance = DEFAULT_TOAST_APPEARANCE, closeLabel = DEFAULT_CLOSE_LABEL2, children, ref, ...toastProps } = rest;
5607
+ const { as, toast, toaster, appearance = DEFAULT_TOAST_APPEARANCE, closeLabel = DEFAULT_CLOSE_LABEL5, children, ref, ...toastProps } = rest;
4906
5608
  const Component = as ?? "div";
4907
5609
  const variant = toastTypeToVariant(toast.type);
4908
5610
  return /* @__PURE__ */ jsx(Toast$1.Root, { ...toastProps, as: Component, ref, toast, toaster, ...rootAttrs, children: children ?? /* @__PURE__ */ jsxs(Alert2, { variant, appearance, role: "presentation", children: [
@@ -4922,7 +5624,7 @@ var Toaster = (props) => {
4922
5624
  "data-placement": toaster2.placement
4923
5625
  })
4924
5626
  });
4925
- const { as, toaster, appearance = DEFAULT_TOAST_APPEARANCE, closeLabel = DEFAULT_CLOSE_LABEL2, overlap = false, children, ref, ...toasterProps } = rest;
5627
+ const { as, toaster, appearance = DEFAULT_TOAST_APPEARANCE, closeLabel = DEFAULT_CLOSE_LABEL5, overlap = false, children, ref, ...toasterProps } = rest;
4926
5628
  const Component = as ?? "div";
4927
5629
  return /* @__PURE__ */ jsx(Toaster$1, { ...toasterProps, as: Component, ref, toaster, overlap, ...rootAttrs, children: (toast) => (
4928
5630
  // Spar renders each item directly into a mapped array, so the key must
@@ -4971,4 +5673,1041 @@ var Skeleton = (props) => {
4971
5673
  };
4972
5674
  Skeleton.displayName = "Skeleton";
4973
5675
 
4974
- export { Accordion2 as Accordion, Alert2 as Alert, Badge, Breadcrumb2 as Breadcrumb, Button, Card2 as Card, Checkbox2 as Checkbox, Chip, Dialog2 as Dialog, Divider, Drawer2 as Drawer, Dropdown2 as Dropdown, Field2 as Field, Input2 as Input, Label, Popover2 as Popover, Progress2 as Progress, Radio2 as Radio, Select2 as Select, Skeleton, Slider2 as Slider, Spinner, Stepper2 as Stepper, Switch2 as Switch, Table, Tabs2 as Tabs, TakeoffSparProvider, Toast, Toaster, Tooltip2 as Tooltip, getExportRows, useComponentTheme, useTheme };
5676
+ // src/components/upload/base.ts
5677
+ var UploadBase = createComponentBase({
5678
+ name: "Upload",
5679
+ slots: ["root"],
5680
+ classes: { root: "tk-upload" }
5681
+ });
5682
+ var UploadDropzoneBase = createComponentBase({
5683
+ name: "UploadDropzone",
5684
+ slots: ["root"],
5685
+ classes: { root: "tk-upload-dropzone" }
5686
+ });
5687
+ var UploadActionsBase = createComponentBase({
5688
+ name: "UploadActions",
5689
+ slots: ["root"],
5690
+ classes: { root: "tk-upload-actions" }
5691
+ });
5692
+ var UploadTriggerBase = createComponentBase({
5693
+ name: "UploadTrigger",
5694
+ slots: ["root"],
5695
+ classes: { root: "tk-upload-trigger" }
5696
+ });
5697
+ var UploadSubmitBase = createComponentBase({
5698
+ name: "UploadSubmit",
5699
+ slots: ["root"],
5700
+ classes: { root: "tk-upload-submit" }
5701
+ });
5702
+ var UploadListBase = createComponentBase({
5703
+ name: "UploadList",
5704
+ slots: ["root"],
5705
+ classes: { root: "tk-upload-list" }
5706
+ });
5707
+ var UploadItemBase = createComponentBase({
5708
+ name: "UploadItem",
5709
+ slots: ["root"],
5710
+ classes: { root: "tk-upload-item" }
5711
+ });
5712
+ var UploadItemContentBase = createComponentBase({
5713
+ name: "UploadItemContent",
5714
+ slots: ["root", "name", "size", "status", "progress"],
5715
+ classes: {
5716
+ root: "tk-upload-item-content",
5717
+ name: "tk-upload-item-name",
5718
+ size: "tk-upload-item-size",
5719
+ status: "tk-upload-item-status",
5720
+ progress: "tk-upload-item-progress"
5721
+ }
5722
+ });
5723
+ var UploadItemPreviewBase = createComponentBase({
5724
+ name: "UploadItemPreview",
5725
+ slots: ["root", "image", "icon", "extension"],
5726
+ classes: {
5727
+ root: "tk-upload-item-preview",
5728
+ image: "tk-upload-item-preview-image",
5729
+ icon: "tk-upload-item-preview-icon",
5730
+ extension: "tk-upload-item-preview-extension"
5731
+ }
5732
+ });
5733
+ var UploadItemActionsBase = createComponentBase({
5734
+ name: "UploadItemActions",
5735
+ slots: ["root"],
5736
+ classes: { root: "tk-upload-item-actions" }
5737
+ });
5738
+ var UploadItemActionBase = createComponentBase({
5739
+ name: "UploadItemAction",
5740
+ slots: ["root"],
5741
+ classes: { root: "tk-upload-item-action" }
5742
+ });
5743
+
5744
+ // src/components/upload/context.ts
5745
+ var [UploadProvider, useUploadContext] = createSafeContext("UploadProvider");
5746
+ var [UploadItemProvider, useUploadItemContext] = createSafeContext("UploadItemProvider");
5747
+
5748
+ // src/components/upload/defaults.ts
5749
+ var DEFAULT_MULTIPLE = false;
5750
+ var DEFAULT_DIRECTORY = false;
5751
+ var DEFAULT_STATUS = "idle";
5752
+ var DEFAULT_UPLOADING_LABEL = "Uploading\u2026";
5753
+ var DEFAULT_PROCESSING_LABEL = "Processing\u2026";
5754
+ var DEFAULT_COMPLETED_LABEL2 = "Completed";
5755
+ var DEFAULT_ERROR_LABEL2 = "Failed";
5756
+ var DEFAULT_PROGRESS_LABEL = "{name} upload progress";
5757
+ var DEFAULT_DOWNLOAD_LABEL = "Download {name}";
5758
+ var DEFAULT_REMOVE_LABEL2 = "Remove {name}";
5759
+
5760
+ // src/components/upload/helpers.ts
5761
+ var fileKey = (file) => `${file.webkitRelativePath || file.name}:${file.size}:${file.lastModified}`;
5762
+ var idCounter = 0;
5763
+ var generateId = () => {
5764
+ const cryptoObj = typeof globalThis !== "undefined" ? globalThis.crypto : void 0;
5765
+ if (cryptoObj && typeof cryptoObj.randomUUID === "function") {
5766
+ try {
5767
+ return cryptoObj.randomUUID();
5768
+ } catch {
5769
+ }
5770
+ }
5771
+ idCounter += 1;
5772
+ return `tk-upload-${idCounter}-${Date.now().toString(36)}`;
5773
+ };
5774
+ var createUploadFile = (file) => ({
5775
+ id: generateId(),
5776
+ file,
5777
+ name: file.name,
5778
+ size: file.size,
5779
+ type: file.type,
5780
+ status: DEFAULT_STATUS
5781
+ });
5782
+ var fileName = (item) => item.name ?? item.file?.name ?? "";
5783
+ var fileSize = (item) => item.size ?? item.file?.size;
5784
+ var fileType = (item) => item.type ?? item.file?.type;
5785
+ var fileStatus = (item) => item.status ?? DEFAULT_STATUS;
5786
+ var formatFileLabel = (template, name) => template.split("{name}").join(name);
5787
+ var isConsumerVeto = (event, preventedOnEntry) => event.defaultPrevented && !preventedOnEntry;
5788
+ var SIZE_UNITS = ["byte", "kilobyte", "megabyte", "gigabyte", "terabyte"];
5789
+ var sizeFormatters = /* @__PURE__ */ new Map();
5790
+ var sizeFormatter = (exponent) => {
5791
+ let formatter = sizeFormatters.get(exponent);
5792
+ if (!formatter) {
5793
+ formatter = new Intl.NumberFormat(void 0, { style: "unit", unit: SIZE_UNITS[exponent], unitDisplay: "short" });
5794
+ sizeFormatters.set(exponent, formatter);
5795
+ }
5796
+ return formatter;
5797
+ };
5798
+ var roundForUnit = (value, exponent) => exponent === 0 || value >= 100 ? Math.round(value) : Math.round(value * 10) / 10;
5799
+ var formatFileSize = (bytes) => {
5800
+ if (!Number.isFinite(bytes) || bytes <= 0) return sizeFormatter(0).format(0);
5801
+ let exponent = Math.max(0, Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), SIZE_UNITS.length - 1));
5802
+ let rounded = roundForUnit(bytes / 1024 ** exponent, exponent);
5803
+ if (rounded >= 1024 && exponent < SIZE_UNITS.length - 1) {
5804
+ exponent += 1;
5805
+ rounded = roundForUnit(bytes / 1024 ** exponent, exponent);
5806
+ }
5807
+ return sizeFormatter(exponent).format(rounded);
5808
+ };
5809
+ var OBJECT_URL_TTL_MS = 1e3;
5810
+ var canSaveUploadFile = (item) => Boolean(item.file || item.url);
5811
+ var saveUploadFile = (item) => {
5812
+ const canCreate = typeof URL !== "undefined" && typeof URL.createObjectURL === "function";
5813
+ const objectUrl = item.file && canCreate ? URL.createObjectURL(item.file) : void 0;
5814
+ const href = objectUrl ?? item.url;
5815
+ if (!href) return;
5816
+ const link = document.createElement("a");
5817
+ link.href = href;
5818
+ link.download = fileName(item);
5819
+ document.body.append(link);
5820
+ link.click();
5821
+ link.remove();
5822
+ if (objectUrl) setTimeout(() => URL.revokeObjectURL(objectUrl), OBJECT_URL_TTL_MS);
5823
+ };
5824
+ var IMAGE_TYPES = /* @__PURE__ */ new Set(["image/jpeg", "image/png", "image/gif", "image/webp", "image/avif", "image/svg+xml"]);
5825
+ var isImageType = (type) => type !== void 0 && IMAGE_TYPES.has(type);
5826
+ var nameExtension = (name) => {
5827
+ const dot = name.lastIndexOf(".");
5828
+ return dot > 0 ? name.slice(dot + 1).toUpperCase() : "";
5829
+ };
5830
+ var ICON_BY_EXTENSION = {
5831
+ DOC: "word",
5832
+ DOCX: "word",
5833
+ JPEG: "jpg",
5834
+ JPG: "jpg",
5835
+ MP4: "mp4",
5836
+ PDF: "pdf",
5837
+ PNG: "png",
5838
+ PPT: "powerpoint",
5839
+ PPTX: "powerpoint",
5840
+ TXT: "text",
5841
+ XLS: "excel",
5842
+ XLSX: "excel",
5843
+ ZIP: "zip"
5844
+ };
5845
+ var ICON_BY_TYPE = {
5846
+ "application/msword": "word",
5847
+ "application/pdf": "pdf",
5848
+ "application/vnd.ms-excel": "excel",
5849
+ "application/vnd.ms-powerpoint": "powerpoint",
5850
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation": "powerpoint",
5851
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "excel",
5852
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "word",
5853
+ "application/zip": "zip",
5854
+ "image/jpeg": "jpg",
5855
+ "image/png": "png",
5856
+ "text/plain": "text",
5857
+ "video/mp4": "mp4"
5858
+ };
5859
+ var fileIconName = (item) => {
5860
+ const type = fileType(item);
5861
+ return ICON_BY_EXTENSION[nameExtension(fileName(item))] ?? (type ? ICON_BY_TYPE[type.toLowerCase()] : void 0);
5862
+ };
5863
+ var isWildcard = (token) => token === "*" || token === "*/*";
5864
+ var acceptTokens = (accept) => accept ? accept.split(",").map((token) => token.trim().toLowerCase()).filter((token) => token !== "") : [];
5865
+ var acceptsAnything = (tokens) => tokens.length === 0 || tokens.some(isWildcard);
5866
+ var tokenMatchesFile = (token, file) => {
5867
+ if (token.startsWith(".")) return file.name.toLowerCase().endsWith(token);
5868
+ const type = file.type.toLowerCase();
5869
+ if (token.endsWith("/*")) return type.startsWith(token.slice(0, -1));
5870
+ return type === token;
5871
+ };
5872
+ var matchesAccept = (file, accept) => {
5873
+ const tokens = acceptTokens(accept);
5874
+ if (acceptsAnything(tokens)) return true;
5875
+ return tokens.some((token) => tokenMatchesFile(token, file));
5876
+ };
5877
+ var acceptMatchesType = (type, accept) => {
5878
+ const tokens = acceptTokens(accept);
5879
+ if (acceptsAnything(tokens)) return true;
5880
+ const t = type.toLowerCase();
5881
+ let unjudgeable = false;
5882
+ for (const token of tokens) {
5883
+ if (token.startsWith(".")) {
5884
+ unjudgeable = true;
5885
+ continue;
5886
+ }
5887
+ if (token.endsWith("/*") ? t.startsWith(token.slice(0, -1)) : t === token) return true;
5888
+ }
5889
+ return unjudgeable;
5890
+ };
5891
+ var validateFiles = (incoming, options) => {
5892
+ const { accept, maxFileSize, maxFileCount, multiple, currentCount } = options;
5893
+ const accepted = [];
5894
+ const rejected = [];
5895
+ const limit = multiple ? maxFileCount : 1;
5896
+ let slots = limit === void 0 ? Number.POSITIVE_INFINITY : Math.max(0, limit - (multiple ? currentCount : 0));
5897
+ for (const file of incoming) {
5898
+ if (!matchesAccept(file, accept)) {
5899
+ rejected.push({ file, code: "file-invalid-type", accept });
5900
+ continue;
5901
+ }
5902
+ if (maxFileSize !== void 0 && file.size > maxFileSize) {
5903
+ rejected.push({ file, code: "file-too-large", maxFileSize });
5904
+ continue;
5905
+ }
5906
+ if (slots <= 0) {
5907
+ rejected.push({ file, code: "too-many-files", maxFileCount: limit });
5908
+ continue;
5909
+ }
5910
+ accepted.push(file);
5911
+ slots -= 1;
5912
+ }
5913
+ return { accepted, rejected };
5914
+ };
5915
+ var Upload = (props) => {
5916
+ const theme = useComponentTheme("Upload");
5917
+ const field = useOptionalFieldContext();
5918
+ const inputRef = useRef(null);
5919
+ const { rootAttrs, rest } = composeRootAttrs(UploadBase, props, theme);
5920
+ const {
5921
+ value,
5922
+ defaultValue,
5923
+ onValueChange,
5924
+ accept,
5925
+ multiple: ownMultiple = DEFAULT_MULTIPLE,
5926
+ directory = DEFAULT_DIRECTORY,
5927
+ maxFileSize,
5928
+ maxFileCount,
5929
+ onFileAccept,
5930
+ onFilesReject,
5931
+ // The status four resolve here, at the destructure site: `??`, so an empty
5932
+ // one is honoured and the support line goes away with its glyph.
5933
+ uploadingLabel = DEFAULT_UPLOADING_LABEL,
5934
+ processingLabel = DEFAULT_PROCESSING_LABEL,
5935
+ completedLabel = DEFAULT_COMPLETED_LABEL2,
5936
+ errorLabel = DEFAULT_ERROR_LABEL2,
5937
+ // The accessible-name three cannot resolve here — see below.
5938
+ progressLabel: ownProgressLabel,
5939
+ downloadLabel: ownDownloadLabel,
5940
+ removeLabel: ownRemoveLabel,
5941
+ disabled: ownDisabled,
5942
+ readOnly: ownReadOnly,
5943
+ invalid: ownInvalid,
5944
+ as,
5945
+ children,
5946
+ ref,
5947
+ ...nativeProps
5948
+ } = rest;
5949
+ const multiple = ownMultiple || directory;
5950
+ const disabled = ownDisabled ?? field?.disabled ?? false;
5951
+ const readOnly = ownReadOnly ?? field?.readOnly ?? false;
5952
+ const invalid = ownInvalid ?? field?.invalid ?? false;
5953
+ const [files = [], setFiles, isControlled] = useControllableState(value, defaultValue ?? [], onValueChange);
5954
+ const latestFiles = useRef(files);
5955
+ latestFiles.current = files;
5956
+ const commitFiles = useCallback(
5957
+ (next) => {
5958
+ if (!isControlled) latestFiles.current = next;
5959
+ setFiles(next);
5960
+ },
5961
+ [isControlled, setFiles]
5962
+ );
5963
+ const processFiles = useCallback(
5964
+ (incoming) => {
5965
+ if (disabled || readOnly) return;
5966
+ const list = Array.from(incoming);
5967
+ if (list.length === 0) return;
5968
+ const current = latestFiles.current;
5969
+ const seen = new Set(current.filter((entry) => entry.file).map((entry) => fileKey(entry.file)));
5970
+ const fresh = list.filter((file) => {
5971
+ const key = fileKey(file);
5972
+ if (seen.has(key)) return false;
5973
+ seen.add(key);
5974
+ return true;
5975
+ });
5976
+ const { accepted, rejected } = validateFiles(fresh, { accept, maxFileSize, maxFileCount, multiple, currentCount: current.length });
5977
+ const added = accepted.map(createUploadFile);
5978
+ if (added.length > 0) {
5979
+ commitFiles(multiple ? [...current, ...added] : added);
5980
+ onFileAccept?.(added);
5981
+ }
5982
+ if (rejected.length > 0) {
5983
+ onFilesReject?.(rejected);
5984
+ }
5985
+ },
5986
+ [disabled, readOnly, accept, maxFileSize, maxFileCount, multiple, commitFiles, onFileAccept, onFilesReject]
5987
+ );
5988
+ const openFileDialog = useCallback(() => {
5989
+ if (disabled || readOnly) return;
5990
+ inputRef.current?.click();
5991
+ }, [disabled, readOnly]);
5992
+ const removeFile = useCallback(
5993
+ (id) => {
5994
+ if (disabled || readOnly) return;
5995
+ commitFiles(latestFiles.current.filter((entry) => entry.id !== id));
5996
+ if (inputRef.current) inputRef.current.value = "";
5997
+ },
5998
+ [disabled, readOnly, commitFiles]
5999
+ );
6000
+ const handleInputChange = (event) => {
6001
+ processFiles(event.target.files ?? []);
6002
+ event.target.value = "";
6003
+ };
6004
+ const progressLabel = ownProgressLabel || DEFAULT_PROGRESS_LABEL;
6005
+ const downloadLabel = ownDownloadLabel || DEFAULT_DOWNLOAD_LABEL;
6006
+ const removeLabel = ownRemoveLabel || DEFAULT_REMOVE_LABEL2;
6007
+ const contextValue = useMemo(
6008
+ () => ({
6009
+ files,
6010
+ disabled,
6011
+ readOnly,
6012
+ invalid,
6013
+ accept,
6014
+ multiple,
6015
+ openFileDialog,
6016
+ removeFile,
6017
+ processFiles,
6018
+ // Keyed by the status it stands for, so a row looks one up rather than
6019
+ // mapping names to states. Built inside this memo rather than one of its
6020
+ // own: it changes exactly when the four strings do, which is when the
6021
+ // context is rebuilt anyway.
6022
+ statusLabels: { uploading: uploadingLabel, processing: processingLabel, completed: completedLabel, error: errorLabel },
6023
+ progressLabel,
6024
+ downloadLabel,
6025
+ removeLabel
6026
+ }),
6027
+ [
6028
+ files,
6029
+ disabled,
6030
+ readOnly,
6031
+ invalid,
6032
+ accept,
6033
+ multiple,
6034
+ openFileDialog,
6035
+ removeFile,
6036
+ processFiles,
6037
+ uploadingLabel,
6038
+ processingLabel,
6039
+ completedLabel,
6040
+ errorLabel,
6041
+ progressLabel,
6042
+ downloadLabel,
6043
+ removeLabel
6044
+ ]
6045
+ );
6046
+ const Component = as ?? "div";
6047
+ const htmlProps = nativeProps;
6048
+ const named = htmlProps["aria-label"] !== void 0 || htmlProps["aria-labelledby"] !== void 0;
6049
+ const groupAttrs = {
6050
+ "id": htmlProps.id ?? field?.fieldId,
6051
+ "role": htmlProps.role ?? "group",
6052
+ "aria-labelledby": named ? htmlProps["aria-labelledby"] : field?.labelId,
6053
+ // Mirrors Spar's own controls: the error message replaces the description
6054
+ // while invalid, rather than both being announced.
6055
+ "aria-describedby": htmlProps["aria-describedby"] ?? (invalid ? field?.errorId : field?.descriptionId)
6056
+ };
6057
+ const stateAttrs = {
6058
+ ...disabled ? { "data-disabled": "" } : null,
6059
+ ...readOnly ? { "data-readonly": "" } : null,
6060
+ ...invalid ? { "data-invalid": "" } : null
6061
+ };
6062
+ return /* @__PURE__ */ jsx(UploadProvider, { value: contextValue, children: /* @__PURE__ */ jsxs(Component, { ...nativeProps, ...groupAttrs, ...rootAttrs, ...stateAttrs, ref, children: [
6063
+ children,
6064
+ /* @__PURE__ */ jsx(
6065
+ InputField$1,
6066
+ {
6067
+ ref: inputRef,
6068
+ type: "file",
6069
+ accept,
6070
+ multiple,
6071
+ ...directory ? { webkitdirectory: "" } : null,
6072
+ disabled: disabled || readOnly,
6073
+ onChange: handleInputChange,
6074
+ hidden: true,
6075
+ tabIndex: -1,
6076
+ "aria-hidden": "true"
6077
+ }
6078
+ )
6079
+ ] }) });
6080
+ };
6081
+ Upload.displayName = "Upload";
6082
+ var UploadActions = (props) => {
6083
+ const theme = useComponentTheme("UploadActions");
6084
+ useUploadContext("Upload.Actions");
6085
+ const { rootAttrs, rest } = composeRootAttrs(UploadActionsBase, props, theme);
6086
+ const { as, children, ref, ...nativeProps } = rest;
6087
+ const Component = as ?? "div";
6088
+ return /* @__PURE__ */ jsx(Component, { ...nativeProps, ...rootAttrs, ref, children });
6089
+ };
6090
+ UploadActions.displayName = "Upload.Actions";
6091
+ var dragStateFor = (event, accept) => {
6092
+ const items = event.dataTransfer?.items;
6093
+ if (!items || items.length === 0) return "accept";
6094
+ for (const item of Array.from(items)) {
6095
+ if (item.kind === "file" && !acceptMatchesType(item.type, accept)) return "reject";
6096
+ }
6097
+ return "accept";
6098
+ };
6099
+ var UploadDropzone = (props) => {
6100
+ const theme = useComponentTheme("UploadDropzone");
6101
+ const { disabled, readOnly, accept, processFiles } = useUploadContext("Upload.Dropzone");
6102
+ const { rootAttrs, rest } = composeRootAttrs(UploadDropzoneBase, props, theme);
6103
+ const {
6104
+ onDragEnter: slotOnDragEnter,
6105
+ onDragOver: slotOnDragOver,
6106
+ onDragLeave: slotOnDragLeave,
6107
+ onDrop: slotOnDrop,
6108
+ ...dropzoneRootAttrs
6109
+ } = rootAttrs;
6110
+ const { as, children, ref, onDragEnter, onDragOver, onDragLeave, onDrop, ...nativeProps } = rest;
6111
+ const [dragState, setDragState] = useState(null);
6112
+ const depth = useRef(0);
6113
+ const active = !disabled && !readOnly;
6114
+ const handleDragEnter = (event) => {
6115
+ onDragEnter?.(event);
6116
+ slotOnDragEnter?.(event);
6117
+ event.preventDefault();
6118
+ if (!active) return;
6119
+ depth.current += 1;
6120
+ setDragState(dragStateFor(event, accept));
6121
+ };
6122
+ const handleDragOver = (event) => {
6123
+ onDragOver?.(event);
6124
+ slotOnDragOver?.(event);
6125
+ event.preventDefault();
6126
+ if (!active) return;
6127
+ if (dragState === null) setDragState(dragStateFor(event, accept));
6128
+ };
6129
+ const handleDragLeave = (event) => {
6130
+ onDragLeave?.(event);
6131
+ slotOnDragLeave?.(event);
6132
+ depth.current = Math.max(0, depth.current - 1);
6133
+ if (depth.current === 0) setDragState(null);
6134
+ };
6135
+ const handleDrop = (event) => {
6136
+ onDrop?.(event);
6137
+ slotOnDrop?.(event);
6138
+ event.preventDefault();
6139
+ depth.current = 0;
6140
+ setDragState(null);
6141
+ if (!active) return;
6142
+ if (event.dataTransfer?.files?.length) processFiles(event.dataTransfer.files);
6143
+ };
6144
+ const Component = as ?? "div";
6145
+ return /* @__PURE__ */ jsx(
6146
+ Component,
6147
+ {
6148
+ ...nativeProps,
6149
+ ...dropzoneRootAttrs,
6150
+ "data-drag-state": dragState ?? void 0,
6151
+ onDragEnter: handleDragEnter,
6152
+ onDragOver: handleDragOver,
6153
+ onDragLeave: handleDragLeave,
6154
+ onDrop: handleDrop,
6155
+ ref,
6156
+ children
6157
+ }
6158
+ );
6159
+ };
6160
+ UploadDropzone.displayName = "Upload.Dropzone";
6161
+ var ACTION_ICON = {
6162
+ download: /* @__PURE__ */ jsx(ArrowDownloadIconOutlinedRounded, { "aria-hidden": "true", focusable: "false" }),
6163
+ remove: /* @__PURE__ */ jsx(CloseIconOutlinedRounded, { "aria-hidden": "true", focusable: "false" })
6164
+ };
6165
+ var isBuiltInAction = (action) => action === "download" || action === "remove";
6166
+ var siblingRow = (row) => {
6167
+ const next = row.nextElementSibling;
6168
+ if (next?.matches(".tk-upload-item")) return next;
6169
+ const previous = row.previousElementSibling;
6170
+ return previous?.matches(".tk-upload-item") ? previous : null;
6171
+ };
6172
+ var moveFocusOffRow = (button) => {
6173
+ const row = button.closest(".tk-upload-item");
6174
+ const neighbour = row ? siblingRow(row) : null;
6175
+ const target = neighbour?.querySelector('[data-action="remove"]') ?? neighbour?.querySelector('button, [role="button"], a[href]') ?? button.closest(".tk-upload")?.querySelector(".tk-upload-trigger") ?? null;
6176
+ target?.focus();
6177
+ };
6178
+ var DEFAULT_ACTION_APPEARANCE = "outlined";
6179
+ var DEFAULT_ACTION_VARIANT = "neutral";
6180
+ var DEFAULT_ACTION_SIZE = "small";
6181
+ var UploadItemAction = (props) => {
6182
+ const theme = useComponentTheme("UploadItemAction");
6183
+ const { disabled, readOnly, removeFile, downloadLabel, removeLabel } = useUploadContext("Upload.ItemAction");
6184
+ const { item } = useUploadItemContext("Upload.ItemAction");
6185
+ const { rootAttrs, rest } = composeRootAttrs(UploadItemActionBase, props, theme, {
6186
+ // Which action this is: documented for consumers styling one action out of a
6187
+ // row. The look itself comes from Button's variant, not from this hook.
6188
+ stateAttrs: (merged) => ({ "data-action": merged.action })
6189
+ });
6190
+ const { onClick: slotOnClick, ...actionRootAttrs } = rootAttrs;
6191
+ const {
6192
+ as,
6193
+ action,
6194
+ label,
6195
+ children,
6196
+ ref,
6197
+ href,
6198
+ role,
6199
+ onClick,
6200
+ "disabled": ownDisabled,
6201
+ "aria-label": ariaLabel,
6202
+ // An icon button in the row: the anatomy and the look come from Button, so
6203
+ // the appearance knobs live here rather than in the Upload recipe. Applied
6204
+ // at the destructure site (the coding-standards rule) rather than pinned
6205
+ // after the spread, so they layer as defaults — a theme's
6206
+ // `UploadItemAction.defaultProps` is already merged into `rest` by
6207
+ // `composeRootAttrs`, and a value pinned after the spread would silently
6208
+ // outrank it.
6209
+ "appearance": appearance = DEFAULT_ACTION_APPEARANCE,
6210
+ "variant": variant = DEFAULT_ACTION_VARIANT,
6211
+ "size": size = DEFAULT_ACTION_SIZE,
6212
+ ...buttonProps
6213
+ } = rest;
6214
+ const isDisabled = disabled || ownDisabled === true;
6215
+ if (action === "remove" && readOnly) return null;
6216
+ const isButton = (as ?? "button") === "button";
6217
+ const hasHref = !isButton && href !== void 0;
6218
+ if (action === "download" && !canSaveUploadFile(item) && !hasHref && !onClick && !slotOnClick) return null;
6219
+ const nameTemplate = label || (action === "download" ? downloadLabel : action === "remove" ? removeLabel : void 0);
6220
+ const handleClick = (event) => {
6221
+ const button = event.currentTarget;
6222
+ const preventedOnEntry = event.defaultPrevented;
6223
+ onClick?.(event);
6224
+ slotOnClick?.(event);
6225
+ if (isConsumerVeto(event, preventedOnEntry)) return;
6226
+ if (action === "remove") {
6227
+ moveFocusOffRow(button);
6228
+ removeFile(item.id);
6229
+ } else if (action === "download" && !hasHref) saveUploadFile(item);
6230
+ };
6231
+ const renderedHref = isDisabled ? void 0 : href;
6232
+ const resolvedRole = role ?? (!isButton && as === "a" && renderedHref !== void 0 ? "link" : void 0);
6233
+ const roleProps = resolvedRole !== void 0 ? { role: resolvedRole } : void 0;
6234
+ return /* @__PURE__ */ jsx(
6235
+ Button,
6236
+ {
6237
+ ...buttonProps,
6238
+ ...isButton ? null : { href: renderedHref },
6239
+ ...roleProps,
6240
+ ...actionRootAttrs,
6241
+ as,
6242
+ appearance,
6243
+ variant,
6244
+ size,
6245
+ disabled: isDisabled,
6246
+ "aria-label": ariaLabel ?? (nameTemplate ? formatFileLabel(nameTemplate, fileName(item)) : void 0),
6247
+ onClick: handleClick,
6248
+ startContent: isRenderableNode(children) ? children : isBuiltInAction(action) ? ACTION_ICON[action] : null,
6249
+ ref
6250
+ }
6251
+ );
6252
+ };
6253
+ UploadItemAction.displayName = "Upload.ItemAction";
6254
+ var UploadItemActions = (props) => {
6255
+ const theme = useComponentTheme("UploadItemActions");
6256
+ const { readOnly } = useUploadContext("Upload.ItemActions");
6257
+ const { item } = useUploadItemContext("Upload.ItemActions");
6258
+ const { rootAttrs, rest } = composeRootAttrs(UploadItemActionsBase, props, theme);
6259
+ const { as, children, ref, ...nativeProps } = rest;
6260
+ const Component = as ?? "div";
6261
+ const hasChildren = isRenderableNode(children);
6262
+ const showDownload = canSaveUploadFile(item);
6263
+ const showRemove = !readOnly;
6264
+ if (!hasChildren && !showDownload && !showRemove) return null;
6265
+ return /* @__PURE__ */ jsx(Component, { ...nativeProps, ...rootAttrs, ref, children: hasChildren ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
6266
+ showDownload && /* @__PURE__ */ jsx(UploadItemAction, { action: "download" }),
6267
+ showRemove && /* @__PURE__ */ jsx(UploadItemAction, { action: "remove" })
6268
+ ] }) });
6269
+ };
6270
+ UploadItemActions.displayName = "Upload.ItemActions";
6271
+ var statusLabelOf = (status, statusLabels) => status === "idle" ? null : statusLabels[status];
6272
+ var statusIcon = (status) => {
6273
+ switch (status) {
6274
+ case "uploading":
6275
+ case "processing":
6276
+ return /* @__PURE__ */ jsx(Spinner, { size: "small", appearance: "rounded", variant: "info", "aria-hidden": "true" });
6277
+ case "completed":
6278
+ return /* @__PURE__ */ jsx(CheckCircleIconFilledRounded, { "aria-hidden": "true", focusable: "false" });
6279
+ case "error":
6280
+ return /* @__PURE__ */ jsx(CloseCircleIconFilledRounded, { "aria-hidden": "true", focusable: "false" });
6281
+ default:
6282
+ return null;
6283
+ }
6284
+ };
6285
+ var UploadItemContent = (props) => {
6286
+ const theme = useComponentTheme("UploadItemContent");
6287
+ const { item } = useUploadItemContext("Upload.ItemContent");
6288
+ const { statusLabels, progressLabel } = useUploadContext("Upload.ItemContent");
6289
+ const { rootAttrs, rest } = composeRootAttrs(UploadItemContentBase, props, theme);
6290
+ const { as, children, ref, ...nativeProps } = rest;
6291
+ const slotAttrs = (slot) => buildSlotAttrs(UploadItemContentBase.getSlotProps(slot), slot, {
6292
+ themeSlotProps: theme?.slotProps,
6293
+ themeClassNames: theme?.classNames,
6294
+ instanceSlotProps: props.slotProps,
6295
+ instanceClassNames: props.classNames
6296
+ });
6297
+ const Component = as ?? "div";
6298
+ const name = fileName(item);
6299
+ const size = fileSize(item);
6300
+ const status = fileStatus(item);
6301
+ const icon = statusIcon(status);
6302
+ const statusLabel = statusLabelOf(status, statusLabels);
6303
+ const statusText = status === "error" ? item.error ?? statusLabel : statusLabel;
6304
+ const defaultContent = /* @__PURE__ */ jsxs(Fragment, { children: [
6305
+ /* @__PURE__ */ jsx("span", { ...slotAttrs("name"), children: name }),
6306
+ size !== void 0 && /* @__PURE__ */ jsx("span", { ...slotAttrs("size"), children: formatFileSize(size) }),
6307
+ icon && statusText ? (
6308
+ // Icon plus its label, as one line: the glyph is decorative and the
6309
+ // text carries the meaning, so nothing here needs an aria-label of its
6310
+ // own. `title` keeps a long failure message reachable in full while the
6311
+ // line itself stays one row high.
6312
+ //
6313
+ // No text, no line — a status label emptied at the root takes the glyph
6314
+ // with it. The alternative is a lone `aria-hidden` icon: a mark that
6315
+ // says something to sighted users and nothing to anyone else, which is
6316
+ // the split this line exists to avoid.
6317
+ /* @__PURE__ */ jsxs("span", { ...slotAttrs("status"), title: status === "error" ? item.error : void 0, children: [
6318
+ icon,
6319
+ statusText
6320
+ ] })
6321
+ ) : null,
6322
+ status === "uploading" && typeof item.progress === "number" && // The bar is the *determinate* face of uploading — it only appears once
6323
+ // there is a percentage to show. Without one, the spinner and its
6324
+ // "Uploading…" label above are already the indeterminate indicator, so
6325
+ // a second (looping) bar would say the same thing twice. `processing`
6326
+ // never gets one: a server-side step reports that it is running, not
6327
+ // how far along it is.
6328
+ /* @__PURE__ */ jsx("div", { ...slotAttrs("progress"), children: /* @__PURE__ */ jsx(Progress2, { value: item.progress, size: "small", "aria-label": formatFileLabel(progressLabel, name) }) })
6329
+ ] });
6330
+ return /* @__PURE__ */ jsx(Component, { ...nativeProps, ...rootAttrs, ref, children: isRenderableNode(children) ? children : defaultContent });
6331
+ };
6332
+ UploadItemContent.displayName = "Upload.ItemContent";
6333
+ var FileExcelIcon = (props) => /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: [
6334
+ /* @__PURE__ */ 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" }),
6335
+ /* @__PURE__ */ jsx(
6336
+ "path",
6337
+ {
6338
+ 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",
6339
+ stroke: "#CACFD8",
6340
+ strokeWidth: "1.875"
6341
+ }
6342
+ ),
6343
+ /* @__PURE__ */ jsx("rect", { y: "15", width: "35", height: "20", rx: "5", fill: "#136C34" }),
6344
+ /* @__PURE__ */ jsx(
6345
+ "path",
6346
+ {
6347
+ 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",
6348
+ fill: "white"
6349
+ }
6350
+ )
6351
+ ] });
6352
+ var FileJpgIcon = (props) => /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: [
6353
+ /* @__PURE__ */ 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" }),
6354
+ /* @__PURE__ */ jsx(
6355
+ "path",
6356
+ {
6357
+ 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",
6358
+ stroke: "#CACFD8",
6359
+ strokeWidth: "1.875"
6360
+ }
6361
+ ),
6362
+ /* @__PURE__ */ jsx("rect", { y: "15", width: "35", height: "20", rx: "5", fill: "#EAB308" }),
6363
+ /* @__PURE__ */ jsx(
6364
+ "path",
6365
+ {
6366
+ 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",
6367
+ fill: "white"
6368
+ }
6369
+ )
6370
+ ] });
6371
+ var FileMp4Icon = (props) => /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: [
6372
+ /* @__PURE__ */ 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" }),
6373
+ /* @__PURE__ */ jsx(
6374
+ "path",
6375
+ {
6376
+ 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",
6377
+ stroke: "#CACFD8",
6378
+ strokeWidth: "1.875"
6379
+ }
6380
+ ),
6381
+ /* @__PURE__ */ jsx("rect", { y: "15", width: "35", height: "20", rx: "5", fill: "#3B82F6" }),
6382
+ /* @__PURE__ */ jsx(
6383
+ "path",
6384
+ {
6385
+ 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",
6386
+ fill: "white"
6387
+ }
6388
+ )
6389
+ ] });
6390
+ var FilePdfIcon = (props) => /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: [
6391
+ /* @__PURE__ */ 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" }),
6392
+ /* @__PURE__ */ jsx(
6393
+ "path",
6394
+ {
6395
+ 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",
6396
+ stroke: "#CACFD8",
6397
+ strokeWidth: "1.875"
6398
+ }
6399
+ ),
6400
+ /* @__PURE__ */ jsx("rect", { y: "15", width: "35", height: "20", rx: "5", fill: "#C90019" }),
6401
+ /* @__PURE__ */ jsx(
6402
+ "path",
6403
+ {
6404
+ 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",
6405
+ fill: "white"
6406
+ }
6407
+ )
6408
+ ] });
6409
+ var FilePngIcon = (props) => /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: [
6410
+ /* @__PURE__ */ 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" }),
6411
+ /* @__PURE__ */ jsx(
6412
+ "path",
6413
+ {
6414
+ 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",
6415
+ stroke: "#CACFD8",
6416
+ strokeWidth: "1.875"
6417
+ }
6418
+ ),
6419
+ /* @__PURE__ */ jsx("rect", { y: "15", width: "35", height: "20", rx: "5", fill: "#A47D06" }),
6420
+ /* @__PURE__ */ jsx(
6421
+ "path",
6422
+ {
6423
+ 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",
6424
+ fill: "white"
6425
+ }
6426
+ )
6427
+ ] });
6428
+ var FilePowerpointIcon = (props) => /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: [
6429
+ /* @__PURE__ */ 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" }),
6430
+ /* @__PURE__ */ jsx(
6431
+ "path",
6432
+ {
6433
+ 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",
6434
+ stroke: "#CACFD8",
6435
+ strokeWidth: "1.875"
6436
+ }
6437
+ ),
6438
+ /* @__PURE__ */ jsx("rect", { y: "15", width: "35", height: "20", rx: "5", fill: "#FF6259" }),
6439
+ /* @__PURE__ */ jsx(
6440
+ "path",
6441
+ {
6442
+ 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",
6443
+ fill: "white"
6444
+ }
6445
+ )
6446
+ ] });
6447
+ var FileTextIcon = (props) => /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: [
6448
+ /* @__PURE__ */ 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" }),
6449
+ /* @__PURE__ */ jsx(
6450
+ "path",
6451
+ {
6452
+ 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",
6453
+ stroke: "#CACFD8",
6454
+ strokeWidth: "1.875"
6455
+ }
6456
+ ),
6457
+ /* @__PURE__ */ jsx("rect", { y: "15", width: "35", height: "20", rx: "5", fill: "#3B82F6" }),
6458
+ /* @__PURE__ */ jsx(
6459
+ "path",
6460
+ {
6461
+ 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",
6462
+ fill: "white"
6463
+ }
6464
+ )
6465
+ ] });
6466
+ var FileWordIcon = (props) => /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: [
6467
+ /* @__PURE__ */ 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" }),
6468
+ /* @__PURE__ */ jsx(
6469
+ "path",
6470
+ {
6471
+ 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",
6472
+ stroke: "#CACFD8",
6473
+ strokeWidth: "1.875"
6474
+ }
6475
+ ),
6476
+ /* @__PURE__ */ jsx("rect", { y: "15", width: "35", height: "20", rx: "5", fill: "#295BAC" }),
6477
+ /* @__PURE__ */ jsx(
6478
+ "path",
6479
+ {
6480
+ 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",
6481
+ fill: "white"
6482
+ }
6483
+ )
6484
+ ] });
6485
+ var FileZipIcon = (props) => /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: [
6486
+ /* @__PURE__ */ 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" }),
6487
+ /* @__PURE__ */ jsx(
6488
+ "path",
6489
+ {
6490
+ 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",
6491
+ stroke: "#CACFD8",
6492
+ strokeWidth: "1.875"
6493
+ }
6494
+ ),
6495
+ /* @__PURE__ */ jsx("rect", { y: "15", width: "35", height: "20", rx: "5", fill: "#79889A" }),
6496
+ /* @__PURE__ */ jsx(
6497
+ "path",
6498
+ {
6499
+ 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",
6500
+ fill: "white"
6501
+ }
6502
+ )
6503
+ ] });
6504
+ var FILE_ICONS = {
6505
+ excel: FileExcelIcon,
6506
+ jpg: FileJpgIcon,
6507
+ mp4: FileMp4Icon,
6508
+ pdf: FilePdfIcon,
6509
+ png: FilePngIcon,
6510
+ powerpoint: FilePowerpointIcon,
6511
+ text: FileTextIcon,
6512
+ word: FileWordIcon,
6513
+ zip: FileZipIcon
6514
+ };
6515
+ var NO_BROKEN_SRCS = [];
6516
+ var useImageObjectUrl = (file, type) => {
6517
+ const [objectUrl, setObjectUrl] = useState(null);
6518
+ useEffect(() => {
6519
+ const canCreate = typeof URL !== "undefined" && typeof URL.createObjectURL === "function";
6520
+ if (file && isImageType(type) && canCreate) {
6521
+ const url = URL.createObjectURL(file);
6522
+ setObjectUrl(url);
6523
+ return () => URL.revokeObjectURL(url);
6524
+ }
6525
+ setObjectUrl(null);
6526
+ }, [file, type]);
6527
+ return objectUrl;
6528
+ };
6529
+ var UploadItemPreview = (props) => {
6530
+ const theme = useComponentTheme("UploadItemPreview");
6531
+ const { item } = useUploadItemContext("Upload.ItemPreview");
6532
+ const { rootAttrs, rest } = composeRootAttrs(UploadItemPreviewBase, props, theme);
6533
+ const { as, children, ref, ...nativeProps } = rest;
6534
+ const hasChildren = isRenderableNode(children);
6535
+ const sourceKey = `${item.id}\0${item.thumbUrl ?? ""}\0${item.url ?? ""}\0${item.file ? fileKey(item.file) : ""}`;
6536
+ const [broken, setBroken] = useState({ key: sourceKey, srcs: NO_BROKEN_SRCS });
6537
+ const brokenSrcs = broken.key === sourceKey ? broken.srcs : NO_BROKEN_SRCS;
6538
+ const markBroken = (src2) => setBroken((previous) => {
6539
+ if (previous.key !== sourceKey) return { key: sourceKey, srcs: [src2] };
6540
+ if (previous.srcs.includes(src2)) return previous;
6541
+ return { key: sourceKey, srcs: [...previous.srcs, src2] };
6542
+ });
6543
+ const thumbUsable = item.thumbUrl !== void 0 && !brokenSrcs.includes(item.thumbUrl);
6544
+ const objectUrl = useImageObjectUrl(hasChildren || thumbUsable ? void 0 : item.file, fileType(item));
6545
+ const slotAttrs = (slot) => buildSlotAttrs(UploadItemPreviewBase.getSlotProps(slot), slot, {
6546
+ themeSlotProps: theme?.slotProps,
6547
+ themeClassNames: theme?.classNames,
6548
+ instanceSlotProps: props.slotProps,
6549
+ instanceClassNames: props.classNames
6550
+ });
6551
+ const Component = as ?? "span";
6552
+ const remoteImage = item.url && isImageType(fileType(item)) ? item.url : void 0;
6553
+ const src = [item.thumbUrl, objectUrl ?? void 0, remoteImage].find((candidate) => candidate !== void 0 && !brokenSrcs.includes(candidate));
6554
+ const iconName = fileIconName(item);
6555
+ const FileIcon = iconName ? FILE_ICONS[iconName] : void 0;
6556
+ const { onError: slotOnError, ...imageAttrs } = slotAttrs("image");
6557
+ const defaultContent = src ? (
6558
+ // The defaults sit ahead of the slot layer so `slotProps.image` can still
6559
+ // override them — a consumer wanting a real `alt`, or eager loading for an
6560
+ // above-the-fold row, should not have to fight the part for it.
6561
+ /* @__PURE__ */ jsx(
6562
+ "img",
6563
+ {
6564
+ alt: "",
6565
+ loading: "lazy",
6566
+ decoding: "async",
6567
+ ...imageAttrs,
6568
+ src,
6569
+ onError: (event) => {
6570
+ markBroken(src);
6571
+ slotOnError?.(event);
6572
+ }
6573
+ }
6574
+ )
6575
+ ) : FileIcon ? /* @__PURE__ */ jsx(FileIcon, { ...slotAttrs("icon") }) : /* @__PURE__ */ jsx("span", { ...slotAttrs("extension"), "aria-hidden": "true", children: nameExtension(fileName(item)) || "FILE" });
6576
+ return /* @__PURE__ */ jsx(Component, { ...nativeProps, ...rootAttrs, ref, children: hasChildren ? children : defaultContent });
6577
+ };
6578
+ UploadItemPreview.displayName = "Upload.ItemPreview";
6579
+ var flattenRowChildren = (children, out = []) => {
6580
+ Children.forEach(children, (child) => {
6581
+ if (isValidElement(child) && child.type === Fragment$1) flattenRowChildren(child.props.children, out);
6582
+ else out.push(child);
6583
+ });
6584
+ return out;
6585
+ };
6586
+ var UploadItem = (props) => {
6587
+ const theme = useComponentTheme("UploadItem");
6588
+ const { rootAttrs, rest } = composeRootAttrs(UploadItemBase, props, theme);
6589
+ const { as, file: item, children, ref, ...nativeProps } = rest;
6590
+ const Component = as ?? "div";
6591
+ const previewNodes = [];
6592
+ const contentNodes = [];
6593
+ const actionsNodes = [];
6594
+ const looseNodes = [];
6595
+ for (const child of flattenRowChildren(children)) {
6596
+ const type = isValidElement(child) ? child.type : void 0;
6597
+ if (type === UploadItemPreview) previewNodes.push(child);
6598
+ else if (type === UploadItemContent) contentNodes.push(child);
6599
+ else if (type === UploadItemActions) actionsNodes.push(child);
6600
+ else looseNodes.push(child);
6601
+ }
6602
+ const hasComposedActions = actionsNodes.length > 0;
6603
+ const actionsRegion = hasComposedActions ? actionsNodes : /* @__PURE__ */ jsx(UploadItemActions, { children: looseNodes.length > 0 ? looseNodes : void 0 });
6604
+ return (
6605
+ // The row publishes its own file to its parts, so an `Upload.ItemAction`,
6606
+ // `Upload.ItemContent`, or `Upload.ItemPreview` needs no per-instance wiring
6607
+ // to know which entry it renders.
6608
+ /* @__PURE__ */ jsx(UploadItemProvider, { value: { item }, children: /* @__PURE__ */ jsxs(Component, { ...nativeProps, ...rootAttrs, "data-status": fileStatus(item), ref, children: [
6609
+ previewNodes.length > 0 ? previewNodes : /* @__PURE__ */ jsx(UploadItemPreview, {}),
6610
+ contentNodes.length > 0 ? contentNodes : /* @__PURE__ */ jsx(UploadItemContent, {}),
6611
+ hasComposedActions && looseNodes,
6612
+ actionsRegion
6613
+ ] }) })
6614
+ );
6615
+ };
6616
+ UploadItem.displayName = "Upload.Item";
6617
+ var UploadList = (props) => {
6618
+ const theme = useComponentTheme("UploadList");
6619
+ const { files } = useUploadContext("Upload.List");
6620
+ const { rootAttrs, rest } = composeRootAttrs(UploadListBase, props, theme);
6621
+ const { as, children, ref, ...nativeProps } = rest;
6622
+ if (files.length === 0) return null;
6623
+ const Component = as ?? "div";
6624
+ const rows = typeof children === "function" ? children(files) : isRenderableNode(children) ? children : files.map((item) => /* @__PURE__ */ jsx(UploadItem, { file: item }, item.id));
6625
+ return /* @__PURE__ */ jsx(Component, { ...nativeProps, ...rootAttrs, ref, children: rows });
6626
+ };
6627
+ UploadList.displayName = "Upload.List";
6628
+ var DEFAULT_SUBMIT_APPEARANCE = "outlined";
6629
+ var DEFAULT_SUBMIT_VARIANT = "neutral";
6630
+ var UploadSubmit = (props) => {
6631
+ const theme = useComponentTheme("UploadSubmit");
6632
+ const { disabled, files } = useUploadContext("Upload.Submit");
6633
+ const { rootAttrs, rest } = composeRootAttrs(UploadSubmitBase, props, theme);
6634
+ const { onClick: slotOnClick, ...submitRootAttrs } = rootAttrs;
6635
+ const {
6636
+ as,
6637
+ children,
6638
+ ref,
6639
+ disabled: ownDisabled,
6640
+ href,
6641
+ onClick,
6642
+ appearance = DEFAULT_SUBMIT_APPEARANCE,
6643
+ variant = DEFAULT_SUBMIT_VARIANT,
6644
+ ...buttonProps
6645
+ } = rest;
6646
+ const handleClick = (event) => {
6647
+ onClick?.(event);
6648
+ slotOnClick?.(event);
6649
+ };
6650
+ const inFlight = files.some((entry) => {
6651
+ const status = fileStatus(entry);
6652
+ return status === "uploading" || status === "processing";
6653
+ });
6654
+ const isDisabled = disabled || ownDisabled || files.length === 0 || inFlight;
6655
+ const isButton = (as ?? "button") === "button";
6656
+ const linkProps = isButton ? void 0 : { href: isDisabled ? void 0 : href };
6657
+ return /* @__PURE__ */ jsx(Button, { ...buttonProps, ...linkProps, ...submitRootAttrs, as, appearance, variant, disabled: isDisabled, onClick: handleClick, ref, children });
6658
+ };
6659
+ UploadSubmit.displayName = "Upload.Submit";
6660
+ var DEFAULT_TRIGGER_APPEARANCE = "outlined";
6661
+ var DEFAULT_TRIGGER_VARIANT = "neutral";
6662
+ var UploadTrigger = (props) => {
6663
+ const theme = useComponentTheme("UploadTrigger");
6664
+ const { disabled, readOnly, openFileDialog } = useUploadContext("Upload.Trigger");
6665
+ const { rootAttrs, rest } = composeRootAttrs(UploadTriggerBase, props, theme);
6666
+ const { onClick: slotOnClick, ...triggerRootAttrs } = rootAttrs;
6667
+ const {
6668
+ as,
6669
+ children,
6670
+ ref,
6671
+ disabled: ownDisabled,
6672
+ href,
6673
+ onClick,
6674
+ appearance = DEFAULT_TRIGGER_APPEARANCE,
6675
+ variant = DEFAULT_TRIGGER_VARIANT,
6676
+ ...buttonProps
6677
+ } = rest;
6678
+ const isDisabled = disabled || readOnly || ownDisabled;
6679
+ const isButton = (as ?? "button") === "button";
6680
+ const linkProps = isButton ? void 0 : { href: isDisabled ? void 0 : href };
6681
+ const handleClick = (event) => {
6682
+ const preventedOnEntry = event.defaultPrevented;
6683
+ onClick?.(event);
6684
+ slotOnClick?.(event);
6685
+ if (isConsumerVeto(event, preventedOnEntry)) return;
6686
+ openFileDialog();
6687
+ };
6688
+ return (
6689
+ // Read-only freezes the Trigger rather than unmounting it, which is the
6690
+ // opposite of what the ItemAction's remove does under the same state. The
6691
+ // asymmetry is the point: a file row without its remove still reads as a
6692
+ // whole row, but the zone's browse button is most of what the zone shows —
6693
+ // drop it and a dashed box is left offering a drop that never lands.
6694
+ /* @__PURE__ */ jsx(Button, { ...buttonProps, ...linkProps, ...triggerRootAttrs, as, appearance, variant, disabled: isDisabled, onClick: handleClick, ref, children })
6695
+ );
6696
+ };
6697
+ UploadTrigger.displayName = "Upload.Trigger";
6698
+
6699
+ // src/components/upload/index.ts
6700
+ var Upload2 = Object.assign(Upload, {
6701
+ Dropzone: UploadDropzone,
6702
+ Actions: UploadActions,
6703
+ Trigger: UploadTrigger,
6704
+ Submit: UploadSubmit,
6705
+ List: UploadList,
6706
+ Item: UploadItem,
6707
+ ItemPreview: UploadItemPreview,
6708
+ ItemContent: UploadItemContent,
6709
+ ItemActions: UploadItemActions,
6710
+ ItemAction: UploadItemAction
6711
+ });
6712
+
6713
+ export { Accordion2 as Accordion, Alert2 as Alert, Badge, Breadcrumb2 as Breadcrumb, Button, Calendar, Card2 as Card, Checkbox2 as Checkbox, Chip, Dialog2 as Dialog, Divider, Drawer2 as Drawer, Dropdown2 as Dropdown, Field2 as Field, Input2 as Input, Label, Popover2 as Popover, Progress2 as Progress, Radio2 as Radio, Select2 as Select, Skeleton, Slider2 as Slider, Spinner, Stepper2 as Stepper, Switch2 as Switch, Table, Tabs2 as Tabs, TakeoffSparProvider, Toast, Toaster, Tooltip2 as Tooltip, Upload2 as Upload, getExportRows, useComponentTheme, useDatePicker, useTheme };