@bizapps/design-system-testing 1.8.0 → 1.9.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/main.cjs CHANGED
@@ -1700,37 +1700,31 @@ function SelectContent({
1700
1700
  className,
1701
1701
  children,
1702
1702
  position = "popper",
1703
- maxHeight,
1704
- style,
1705
1703
  ...props
1706
1704
  }) {
1707
- const resolvedMaxHeight = typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight;
1708
1705
  return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
1709
1706
  radixUi.Select.Content,
1710
1707
  {
1711
1708
  "data-slot": "select-content",
1712
1709
  className: cn(
1713
- "border-border bg-popover text-popover-foreground relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-hidden rounded-md border shadow-md",
1710
+ "border-border bg-popover text-popover-foreground relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
1714
1711
  "data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
1715
1712
  "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
1716
1713
  "data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",
1717
- position === "popper" && "w-(--radix-select-trigger-width)",
1714
+ position === "popper" && "w-[--radix-select-trigger-width]",
1718
1715
  className
1719
1716
  ),
1720
1717
  position,
1721
- style: {
1722
- ...resolvedMaxHeight ? {
1723
- maxHeight: `min(${resolvedMaxHeight}, var(--radix-select-content-available-height))`
1724
- } : null,
1725
- ...style
1726
- },
1727
1718
  ...props,
1728
1719
  children: [
1729
1720
  /* @__PURE__ */ jsxRuntime.jsx(SelectScrollUpButton, {}),
1730
1721
  /* @__PURE__ */ jsxRuntime.jsx(
1731
1722
  radixUi.Select.Viewport,
1732
1723
  {
1733
- className: cn("scroll-my-1 p-1", position === "popper" && "w-full"),
1724
+ className: cn(
1725
+ "p-1",
1726
+ position === "popper" && "h-[--radix-select-trigger-height]"
1727
+ ),
1734
1728
  children
1735
1729
  }
1736
1730
  ),
@@ -4392,7 +4386,6 @@ ColorPickerPresets.displayName = "ColorPickerPresets";
4392
4386
  function Calendar({
4393
4387
  className,
4394
4388
  classNames,
4395
- modifiersClassNames,
4396
4389
  showOutsideDays = true,
4397
4390
  captionLayout = "dropdown",
4398
4391
  buttonVariant = "ghost",
@@ -4404,36 +4397,6 @@ function Calendar({
4404
4397
  ...props
4405
4398
  }) {
4406
4399
  const defaultClassNames = reactDayPicker.getDefaultClassNames();
4407
- const resolvedComponents = react.useMemo(
4408
- () => ({
4409
- Root: ({ className: className2, rootRef, ...rootProps }) => {
4410
- return /* @__PURE__ */ jsxRuntime.jsx(
4411
- "div",
4412
- {
4413
- "data-slot": "calendar",
4414
- ref: rootRef,
4415
- className: cn(className2),
4416
- ...rootProps
4417
- }
4418
- );
4419
- },
4420
- Chevron: ({ className: className2, orientation, ...chevronProps }) => {
4421
- if (orientation === "left") {
4422
- return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { className: cn("size-4", className2), ...chevronProps });
4423
- }
4424
- if (orientation === "right") {
4425
- return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRightIcon, { className: cn("size-4", className2), ...chevronProps });
4426
- }
4427
- return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: cn("size-4", className2), ...chevronProps });
4428
- },
4429
- DayButton: (dayButtonProps) => /* @__PURE__ */ jsxRuntime.jsx(CalendarDayButton, { locale, ...dayButtonProps }),
4430
- WeekNumber: ({ children, ...weekNumberProps }) => {
4431
- return /* @__PURE__ */ jsxRuntime.jsx("td", { ...weekNumberProps, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
4432
- },
4433
- ...components
4434
- }),
4435
- [locale, components]
4436
- );
4437
4400
  return /* @__PURE__ */ jsxRuntime.jsx(
4438
4401
  reactDayPicker.DayPicker,
4439
4402
  {
@@ -4525,13 +4488,33 @@ function Calendar({
4525
4488
  hidden: cn("invisible", defaultClassNames.hidden),
4526
4489
  ...classNames
4527
4490
  },
4528
- modifiersClassNames: {
4529
- preview_start: "relative isolate z-0 rounded-l-md bg-primary/8 after:absolute after:inset-y-0 after:right-0 after:w-3 after:bg-primary/8",
4530
- preview_middle: "rounded-none bg-primary/8",
4531
- preview_end: "relative isolate z-0 rounded-r-md bg-primary/8 after:absolute after:inset-y-0 after:left-0 after:w-3 after:bg-primary/8",
4532
- ...modifiersClassNames
4491
+ components: {
4492
+ Root: ({ className: className2, rootRef, ...props2 }) => {
4493
+ return /* @__PURE__ */ jsxRuntime.jsx(
4494
+ "div",
4495
+ {
4496
+ "data-slot": "calendar",
4497
+ ref: rootRef,
4498
+ className: cn(className2),
4499
+ ...props2
4500
+ }
4501
+ );
4502
+ },
4503
+ Chevron: ({ className: className2, orientation, ...props2 }) => {
4504
+ if (orientation === "left") {
4505
+ return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { className: cn("size-4", className2), ...props2 });
4506
+ }
4507
+ if (orientation === "right") {
4508
+ return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRightIcon, { className: cn("size-4", className2), ...props2 });
4509
+ }
4510
+ return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: cn("size-4", className2), ...props2 });
4511
+ },
4512
+ DayButton: ({ ...props2 }) => /* @__PURE__ */ jsxRuntime.jsx(CalendarDayButton, { locale, ...props2 }),
4513
+ WeekNumber: ({ children, ...props2 }) => {
4514
+ return /* @__PURE__ */ jsxRuntime.jsx("td", { ...props2, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
4515
+ },
4516
+ ...components
4533
4517
  },
4534
- components: resolvedComponents,
4535
4518
  ...props
4536
4519
  }
4537
4520
  );
@@ -4548,9 +4531,6 @@ function CalendarDayButton({
4548
4531
  react.useEffect(() => {
4549
4532
  if (modifiers.focused) ref.current?.focus();
4550
4533
  }, [modifiers.focused]);
4551
- const isPreviewEdge = Boolean(
4552
- (modifiers.preview_start || modifiers.preview_end) && !modifiers.selected
4553
- );
4554
4534
  return /* @__PURE__ */ jsxRuntime.jsx(
4555
4535
  Button,
4556
4536
  {
@@ -4562,10 +4542,8 @@ function CalendarDayButton({
4562
4542
  "data-range-start": modifiers.range_start,
4563
4543
  "data-range-end": modifiers.range_end,
4564
4544
  "data-range-middle": modifiers.range_middle,
4565
- "data-preview-middle": Boolean(modifiers.preview_middle),
4566
- "data-preview-edge": isPreviewEdge,
4567
4545
  className: cn(
4568
- "group-data-[focused=true]/day:ring-primary/40 data-[preview-edge=true]:ring-primary/50 data-[preview-edge=true]:text-primary data-[preview-middle=true]:text-primary data-[range-end=true]:!bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:!bg-primary/8 data-[range-middle=true]:text-foreground data-[range-start=true]:!bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:!bg-primary data-[selected-single=true]:text-primary-foreground relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 !rounded-md border-0 !bg-transparent leading-none font-normal transition-colors duration-150 group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:rounded-md group-data-[focused=true]/day:ring-[2px] hover:!bg-transparent data-[preview-edge=true]:rounded-md data-[preview-edge=true]:font-medium data-[preview-edge=true]:ring-[2px] data-[preview-middle=true]:font-medium data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[selected-single=true]:rounded-md [&>span]:text-xs [&>span]:font-medium [&>span]:opacity-75",
4546
+ "group-data-[focused=true]/day:ring-primary/40 data-[range-end=true]:!bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:!bg-primary/8 data-[range-middle=true]:text-foreground data-[range-start=true]:!bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:!bg-primary data-[selected-single=true]:text-primary-foreground relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 !rounded-md border-0 !bg-transparent leading-none font-normal transition-colors duration-150 group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:rounded-md group-data-[focused=true]/day:ring-[2px] hover:!bg-transparent data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[selected-single=true]:rounded-md [&>span]:text-xs [&>span]:font-medium [&>span]:opacity-75",
4569
4547
  defaultClassNames.day,
4570
4548
  className
4571
4549
  ),
@@ -4573,79 +4551,30 @@ function CalendarDayButton({
4573
4551
  }
4574
4552
  );
4575
4553
  }
4576
- function DatePicker(props) {
4577
- const {
4578
- placeholder = "Pick a date",
4579
- disabled = false,
4580
- className,
4581
- fromDate,
4582
- toDate,
4583
- numberOfMonths = 1
4584
- } = props;
4554
+ function DatePicker({
4555
+ mode = "single",
4556
+ selected,
4557
+ onSelect,
4558
+ placeholder = "Pick a date",
4559
+ disabled = false,
4560
+ className,
4561
+ fromDate,
4562
+ toDate
4563
+ }) {
4585
4564
  const [open, setOpen] = react.useState(false);
4586
- const [awaitingRangeEnd, setAwaitingRangeEnd] = react.useState(false);
4587
- const [previewDate, setPreviewDate] = react.useState(void 0);
4588
4565
  const label = react.useMemo(() => {
4589
- if (props.mode === "range") {
4590
- const range = props.selected;
4591
- if (!range?.from) return placeholder;
4592
- if (!range.to) return `${dateFns.format(range.from, "MMM d, yyyy")} \u2013 \u2026`;
4593
- return `${dateFns.format(range.from, "MMM d, yyyy")} \u2013 ${dateFns.format(range.to, "MMM d, yyyy")}`;
4594
- }
4595
- return props.selected ? dateFns.format(props.selected, "MMM d, yyyy") : placeholder;
4596
- }, [props.mode, props.selected, placeholder]);
4597
- const handleOpenChange = (nextOpen) => {
4598
- setOpen(nextOpen);
4599
- if (!nextOpen) {
4600
- setAwaitingRangeEnd(false);
4601
- setPreviewDate(void 0);
4602
- }
4603
- };
4604
- const handleRangeSelect = (range, triggerDate) => {
4605
- if (props.mode !== "range") return;
4606
- const emit = props.onSelect;
4607
- if (!awaitingRangeEnd) {
4608
- setAwaitingRangeEnd(true);
4609
- emit?.({ from: triggerDate, to: void 0 });
4610
- return;
4611
- }
4612
- emit?.(range);
4613
- if (!range?.from || !range.to) {
4614
- setAwaitingRangeEnd(!!range?.from);
4615
- return;
4616
- }
4617
- setAwaitingRangeEnd(false);
4618
- setPreviewDate(void 0);
4619
- setOpen(false);
4620
- };
4621
- const rangeFrom = props.mode === "range" ? props.selected?.from : void 0;
4622
- const previewModifiers = react.useMemo(() => {
4623
- if (!awaitingRangeEnd || !rangeFrom || !previewDate) return void 0;
4624
- if (dateFns.isSameDay(rangeFrom, previewDate)) return void 0;
4625
- const [start, end] = previewDate < rangeFrom ? [previewDate, rangeFrom] : [rangeFrom, previewDate];
4626
- return {
4627
- preview_start: start,
4628
- preview_middle: { after: start, before: end },
4629
- preview_end: end
4630
- };
4631
- }, [awaitingRangeEnd, rangeFrom, previewDate]);
4632
- const handleDayPreview = (day, dayModifiers) => {
4633
- if (!awaitingRangeEnd) return;
4634
- if (dayModifiers.disabled || dayModifiers.hidden) return;
4635
- setPreviewDate((current) => current && dateFns.isSameDay(current, day) ? current : day);
4636
- };
4637
- const dateConstraints = react.useMemo(() => {
4638
- const disabledMatchers = [];
4639
- if (fromDate) disabledMatchers.push({ before: fromDate });
4640
- if (toDate) disabledMatchers.push({ after: toDate });
4641
- return {
4642
- ...disabledMatchers.length > 0 && { disabled: disabledMatchers },
4643
- ...fromDate && { startMonth: fromDate },
4644
- ...toDate && { endMonth: toDate }
4645
- };
4646
- }, [fromDate, toDate]);
4647
- const hasValue = props.mode === "range" ? !!props.selected?.from : !!props.selected;
4648
- return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
4566
+ if (mode === "range") {
4567
+ const range = selected;
4568
+ if (range?.from && range?.to)
4569
+ return `${dateFns.format(range.from, "MMM d, yyyy")} \u2013 ${dateFns.format(range.to, "MMM d, yyyy")}`;
4570
+ if (range?.from) return `${dateFns.format(range.from, "MMM d, yyyy")} \u2013 \u2026`;
4571
+ return placeholder;
4572
+ }
4573
+ const date = selected;
4574
+ return date ? dateFns.format(date, "MMM d, yyyy") : placeholder;
4575
+ }, [mode, selected, placeholder]);
4576
+ const hasValue = mode === "range" ? !!selected?.from : !!selected;
4577
+ return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: setOpen, children: [
4649
4578
  /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
4650
4579
  Button,
4651
4580
  {
@@ -4663,36 +4592,36 @@ function DatePicker(props) {
4663
4592
  ]
4664
4593
  }
4665
4594
  ) }),
4666
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { "data-slot": "date-picker-content", className: "w-auto p-0", align: "start", children: props.mode === "range" ? (
4667
- // Clearing the preview on the wrapper instead of per day
4668
- // avoids the blank frame `onDayMouseLeave` would cause when
4669
- // the pointer travels from one day to the next.
4670
- /* @__PURE__ */ jsxRuntime.jsx("div", { onMouseLeave: () => setPreviewDate(void 0), children: /* @__PURE__ */ jsxRuntime.jsx(
4671
- Calendar,
4672
- {
4595
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { "data-slot": "date-picker-content", className: "w-auto p-0", align: "start", children: mode === "range" ? /* @__PURE__ */ jsxRuntime.jsx(
4596
+ Calendar,
4597
+ {
4598
+ ...{
4673
4599
  mode: "range",
4674
- selected: props.selected,
4675
- onSelect: handleRangeSelect,
4676
- modifiers: previewModifiers,
4677
- onDayMouseEnter: handleDayPreview,
4678
- onDayFocus: handleDayPreview,
4679
- numberOfMonths,
4680
- autoFocus: true,
4681
- ...dateConstraints
4600
+ selected,
4601
+ onSelect: (range) => {
4602
+ onSelect?.(range);
4603
+ if (range?.to) setOpen(false);
4604
+ },
4605
+ fromDate,
4606
+ toDate,
4607
+ numberOfMonths: 2,
4608
+ initialFocus: true
4682
4609
  }
4683
- ) })
4610
+ }
4684
4611
  ) : /* @__PURE__ */ jsxRuntime.jsx(
4685
4612
  Calendar,
4686
4613
  {
4687
- mode: "single",
4688
- selected: props.selected,
4689
- onSelect: (date) => {
4690
- props.onSelect?.(date);
4691
- setOpen(false);
4692
- },
4693
- numberOfMonths,
4694
- autoFocus: true,
4695
- ...dateConstraints
4614
+ ...{
4615
+ mode: "single",
4616
+ selected,
4617
+ onSelect: (date) => {
4618
+ onSelect?.(date);
4619
+ setOpen(false);
4620
+ },
4621
+ fromDate,
4622
+ toDate,
4623
+ initialFocus: true
4624
+ }
4696
4625
  }
4697
4626
  ) })
4698
4627
  ] });
@@ -5134,8 +5063,6 @@ function NavigationMenuIndicator({
5134
5063
  }
5135
5064
  );
5136
5065
  }
5137
-
5138
- // src/components/authorization/policy.ts
5139
5066
  function matchPermission(pattern, permission) {
5140
5067
  if (pattern === "*") return true;
5141
5068
  if (pattern === permission) return true;
@@ -5151,46 +5078,41 @@ function matchesAny(permissionSet, permission) {
5151
5078
  }
5152
5079
  return false;
5153
5080
  }
5154
- function can(permissionSet, perms, mode = "any") {
5155
- const list = Array.isArray(perms) ? perms : [perms];
5156
- if (list.length === 0) return false;
5157
- if (permissionSet.has("*")) return true;
5158
- if (mode === "all") {
5159
- return list.every((p) => matchesAny(permissionSet, p));
5160
- }
5161
- return list.some((p) => matchesAny(permissionSet, p));
5162
- }
5163
5081
  var AbilityContext = react.createContext(void 0);
5164
5082
  AbilityContext.displayName = "AbilityContext";
5165
5083
  function AbilityProvider({ children, permissions }) {
5166
5084
  const [permissionSet, setPermissionSet] = react.useState(
5167
5085
  () => new Set(permissions ?? [])
5168
5086
  );
5169
- const [imperativelyResolved, setImperativelyResolved] = react.useState(false);
5170
- const status = permissions !== void 0 || imperativelyResolved ? "ready" : "loading";
5171
- const can2 = react.useCallback(
5172
- (perms, mode = "any") => can(permissionSet, perms, mode),
5087
+ const can = react.useCallback(
5088
+ (perms, mode = "any") => {
5089
+ const list = Array.isArray(perms) ? perms : [perms];
5090
+ if (list.length === 0) return false;
5091
+ if (permissionSet.has("*")) return true;
5092
+ if (mode === "all") {
5093
+ return list.every((p) => matchesAny(permissionSet, p));
5094
+ }
5095
+ return list.some((p) => matchesAny(permissionSet, p));
5096
+ },
5173
5097
  [permissionSet]
5174
5098
  );
5175
5099
  const setAbilities = react.useCallback((perms) => {
5176
5100
  setPermissionSet(new Set(perms));
5177
- setImperativelyResolved(true);
5178
5101
  }, []);
5179
5102
  const clearAbilities = react.useCallback(() => {
5180
5103
  setPermissionSet(/* @__PURE__ */ new Set());
5181
- setImperativelyResolved(true);
5182
5104
  }, []);
5183
- const permissionKey = permissions === void 0 ? null : [...permissions].sort().join("|");
5184
- const syncedKey = react.useRef(permissionKey);
5105
+ const syncedKey = react.useRef(permissions ? permissions.join("|") : null);
5185
5106
  react.useEffect(() => {
5186
- if (permissionKey === null) return;
5187
- if (permissionKey === syncedKey.current) return;
5188
- syncedKey.current = permissionKey;
5107
+ if (permissions === void 0) return;
5108
+ const key = permissions.join("|");
5109
+ if (key === syncedKey.current) return;
5110
+ syncedKey.current = key;
5189
5111
  setPermissionSet(new Set(permissions));
5190
- }, [permissionKey, permissions]);
5112
+ }, [permissions]);
5191
5113
  const value = react.useMemo(
5192
- () => ({ can: can2, setAbilities, clearAbilities, status }),
5193
- [can2, setAbilities, clearAbilities, status]
5114
+ () => ({ can, setAbilities, clearAbilities }),
5115
+ [can, setAbilities, clearAbilities]
5194
5116
  );
5195
5117
  return /* @__PURE__ */ jsxRuntime.jsx(AbilityContext.Provider, { value, children });
5196
5118
  }
@@ -5202,176 +5124,21 @@ function useAbility() {
5202
5124
  return context;
5203
5125
  }
5204
5126
  function useCan(permissions, mode = "any") {
5205
- const { can: can2 } = useAbility();
5206
- return can2(permissions, mode);
5127
+ const { can } = useAbility();
5128
+ return can(permissions, mode);
5207
5129
  }
5208
- function useAbilityStatus() {
5209
- return useAbility().status;
5210
- }
5211
-
5212
- // src/components/authorization/permissions.generated.ts
5213
- var KNOWN_PERMISSIONS = [];
5214
-
5215
- // src/components/authorization/permission-catalog.ts
5216
- var CATALOG = new Set(KNOWN_PERMISSIONS);
5217
- var warned = /* @__PURE__ */ new Set();
5218
- function warnUnknownPermission(permission) {
5219
- if (process.env.NODE_ENV === "production") return;
5220
- if (CATALOG.size === 0) return;
5221
- const requested = Array.isArray(permission) ? permission : [permission];
5222
- for (const entry of requested) {
5223
- if (entry.includes("*")) continue;
5224
- if (CATALOG.has(entry) || warned.has(entry)) continue;
5225
- warned.add(entry);
5226
- console.warn(
5227
- `[Can] Unknown permission "${entry}". It is not in the generated permission catalog. Check for a typo, or regenerate the catalog with \`pnpm generate-permissions\`.`
5228
- );
5229
- }
5230
- }
5231
- var FOCUS_TRAVERSAL_KEYS = /* @__PURE__ */ new Set(["Tab", "Escape"]);
5232
- function blockInteraction(event) {
5233
- event.preventDefault();
5234
- event.stopPropagation();
5235
- }
5236
- function blockNonTraversalKey(event) {
5237
- if (!FOCUS_TRAVERSAL_KEYS.has(event.key)) blockInteraction(event);
5238
- }
5239
- var warnedRenderPropMisuse = /* @__PURE__ */ new Set();
5240
- function warnRenderPropVoidsProps(voided) {
5241
- if (process.env.NODE_ENV === "production") return;
5242
- if (voided.length === 0) return;
5243
- const key = voided.join(",");
5244
- if (warnedRenderPropMisuse.has(key)) return;
5245
- warnedRenderPropMisuse.add(key);
5246
- console.warn(
5247
- `[Can] \`children\` is a function, so ${voided.map((prop) => `\`${prop}\``).join(", ")} ${voided.length === 1 ? "is" : "are"} ignored. A render prop owns every state: read \`allowed\` and \`status\` and render the disabled, loading and denied cases yourself, or pass an element instead of a function.`
5248
- );
5249
- }
5250
- function disableElement(child) {
5251
- return react.cloneElement(child, {
5252
- "aria-disabled": "true",
5253
- className: cn(child.props.className, "cursor-not-allowed opacity-50"),
5254
- onClickCapture: blockInteraction,
5255
- onKeyDownCapture: blockNonTraversalKey,
5256
- onKeyUpCapture: blockNonTraversalKey,
5257
- onPointerDownCapture: blockInteraction,
5258
- onMouseDownCapture: blockInteraction
5259
- });
5260
- }
5261
- function InteractionFirewall({ children }) {
5262
- return /* @__PURE__ */ jsxRuntime.jsx(
5263
- "span",
5264
- {
5265
- "data-slot": "can-blocked",
5266
- className: "contents",
5267
- onClickCapture: blockInteraction,
5268
- onPointerDownCapture: blockInteraction,
5269
- onMouseDownCapture: blockInteraction,
5270
- onKeyDownCapture: blockNonTraversalKey,
5271
- onKeyUpCapture: blockNonTraversalKey,
5272
- children
5273
- }
5274
- );
5275
- }
5276
- function DisabledSubtree({
5277
- children,
5278
- className,
5279
- ...props
5280
- }) {
5281
- const { "data-slot": _incomingDataSlot, ...restProps } = props;
5282
- return /* @__PURE__ */ jsxRuntime.jsx(
5283
- "span",
5284
- {
5285
- "data-slot": "can-disabled",
5286
- "aria-disabled": "true",
5287
- className: cn(
5288
- "inline-flex cursor-not-allowed opacity-50",
5289
- "*:pointer-events-none",
5290
- className
5291
- ),
5292
- onClickCapture: blockInteraction,
5293
- onPointerDownCapture: blockInteraction,
5294
- onMouseDownCapture: blockInteraction,
5295
- onKeyDownCapture: blockNonTraversalKey,
5296
- onKeyUpCapture: blockNonTraversalKey,
5297
- ...restProps,
5298
- children
5299
- }
5300
- );
5301
- }
5302
- function Can({
5303
- permission,
5304
- mode = "any",
5305
- negate = false,
5306
- behavior = "hide",
5307
- reason = null,
5308
- fallback = null,
5309
- loading,
5310
- children
5311
- }) {
5312
- warnUnknownPermission(permission);
5313
- const { can: can2, status } = useAbility();
5314
- const hasPermission = status === "ready" && can2(permission, mode);
5130
+ function Can({ permission, mode = "any", negate = false, fallback = null, children }) {
5131
+ const { can } = useAbility();
5132
+ const hasPermission = can(permission, mode);
5315
5133
  const show = negate ? !hasPermission : hasPermission;
5316
5134
  if (typeof children === "function") {
5317
- warnRenderPropVoidsProps([
5318
- ...behavior === "disable" ? ["behavior='disable'"] : [],
5319
- ...reason !== null ? ["reason"] : [],
5320
- ...fallback !== null ? ["fallback"] : [],
5321
- ...loading !== void 0 ? ["loading"] : []
5322
- ]);
5323
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: children({ allowed: show, status }) });
5324
- }
5325
- if (status === "loading" && loading !== void 0) {
5326
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: loading });
5327
- }
5328
- if (show) {
5329
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
5135
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: children(show) });
5330
5136
  }
5331
- if (behavior === "disable") {
5332
- if (react.isValidElement(children) && children.type !== react.Fragment) {
5333
- const disabledChild = disableElement(children);
5334
- if (reason === null) {
5335
- return /* @__PURE__ */ jsxRuntime.jsx(InteractionFirewall, { children: disabledChild });
5336
- }
5337
- return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
5338
- /* @__PURE__ */ jsxRuntime.jsx(InteractionFirewall, { children: /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: disabledChild }) }),
5339
- /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: reason })
5340
- ] });
5341
- }
5342
- if (reason === null) {
5343
- return /* @__PURE__ */ jsxRuntime.jsx(DisabledSubtree, { children });
5344
- }
5345
- return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
5346
- /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(DisabledSubtree, { children }) }),
5347
- /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: reason })
5348
- ] });
5349
- }
5350
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback });
5137
+ return show ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback });
5351
5138
  }
5352
5139
  Can.displayName = "Can";
5353
- function CanNot({
5354
- permission,
5355
- mode = "any",
5356
- behavior = "hide",
5357
- reason = null,
5358
- fallback = null,
5359
- loading,
5360
- children
5361
- }) {
5362
- return /* @__PURE__ */ jsxRuntime.jsx(
5363
- Can,
5364
- {
5365
- permission,
5366
- mode,
5367
- negate: true,
5368
- behavior,
5369
- reason,
5370
- fallback,
5371
- loading,
5372
- children
5373
- }
5374
- );
5140
+ function CanNot({ permission, mode = "any", fallback = null, children }) {
5141
+ return /* @__PURE__ */ jsxRuntime.jsx(Can, { permission, mode, negate: true, fallback, children });
5375
5142
  }
5376
5143
  CanNot.displayName = "CanNot";
5377
5144
  function useMediaQuery(query) {
@@ -7103,6 +6870,7 @@ function useAppForm(schema, options) {
7103
6870
  // src/lib/cdn.ts
7104
6871
  var CDN_BASE = "https://dibt9vplwriap.cloudfront.net";
7105
6872
  var logos = {
6873
+ // Total Civil
7106
6874
  color: `${CDN_BASE}/logos/Logo_Total_Color.webp`,
7107
6875
  colorAna: `${CDN_BASE}/logos/Logo_Total_Color-ANA.webp`,
7108
6876
  colorAnaa: `${CDN_BASE}/logos/Logo_Total_Color-ANAA.webp`,
@@ -7110,7 +6878,11 @@ var logos = {
7110
6878
  positive: `${CDN_BASE}/logos/Logo_Total_Positive.webp`,
7111
6879
  grayScale: `${CDN_BASE}/logos/Logo_Total_gray_scale.webp`,
7112
6880
  monochBlack: `${CDN_BASE}/logos/Logo_Total_monochB.webp`,
7113
- monochOrange: `${CDN_BASE}/logos/Logo_Total_monochO.webp`
6881
+ monochOrange: `${CDN_BASE}/logos/Logo_Total_monochO.webp`,
6882
+ isotype: `${CDN_BASE}/logos/Isotipo_Total_Color.webp`,
6883
+ // Total Millwork
6884
+ millworkColor: `${CDN_BASE}/logos/Logo_Millwork_Color.webp`,
6885
+ millworkNegative: `${CDN_BASE}/logos/Logo_Millwork_Negative.webp`
7114
6886
  };
7115
6887
  function Table({
7116
6888
  className,
@@ -7168,7 +6940,7 @@ function TableHead({ className, ...props }) {
7168
6940
  {
7169
6941
  "data-slot": "table-head",
7170
6942
  className: cn(
7171
- "text-foreground has-[[role=checkbox]]:pr-0 h-12 px-3 text-left align-middle font-medium whitespace-nowrap",
6943
+ "text-foreground has([role=checkbox])]:pr-0 h-12 px-3 text-left align-middle font-medium whitespace-nowrap",
7172
6944
  className
7173
6945
  ),
7174
6946
  ...props
@@ -7181,7 +6953,7 @@ function TableCell({ className, ...props }) {
7181
6953
  {
7182
6954
  "data-slot": "table-cell",
7183
6955
  className: cn(
7184
- "has-[[role=checkbox]]:pr-0 p-3 align-middle whitespace-nowrap",
6956
+ "has([role=checkbox])]:pr-0 p-3 align-middle whitespace-nowrap",
7185
6957
  className
7186
6958
  ),
7187
6959
  ...props
@@ -7442,13 +7214,6 @@ function useTableContext() {
7442
7214
  function useTableContextSafe() {
7443
7215
  return react.useContext(TableContext);
7444
7216
  }
7445
-
7446
- // src/components/compounds/Table/cell-size-class.ts
7447
- var cellSizeClass = {
7448
- sm: "px-3 py-1.5 text-xs",
7449
- md: "px-5 py-2.5 text-sm",
7450
- lg: "px-6 py-3 text-sm"
7451
- };
7452
7217
  var cardPadding = {
7453
7218
  sm: "p-3",
7454
7219
  md: "p-4",
@@ -7786,9 +7551,6 @@ function DataTableHeaderCell({ header }) {
7786
7551
  },
7787
7552
  className: cn(
7788
7553
  "bg-primary text-primary-foreground",
7789
- // Same density padding as the body cells: without it the header
7790
- // label and the cell value below it sit at different offsets.
7791
- cellSizeClass[meta.size ?? tableSize],
7792
7554
  canResize && "relative",
7793
7555
  meta.align === "center" && "text-center",
7794
7556
  meta.align === "right" && "text-right",
@@ -8178,6 +7940,11 @@ function useTablePersistence({
8178
7940
  persistDensity
8179
7941
  };
8180
7942
  }
7943
+ var cellSizeClass = {
7944
+ sm: "px-1 py-0 text-xs",
7945
+ md: "px-5 py-2.5 text-sm",
7946
+ lg: "px-6 py-3 text-sm"
7947
+ };
8181
7948
  function resolveClassName(value, row) {
8182
7949
  return typeof value === "function" ? value(row) : value;
8183
7950
  }
@@ -8218,13 +7985,6 @@ function DataTableCell({
8218
7985
  }
8219
7986
  );
8220
7987
  }
8221
- var INTERACTIVE_CELL_CONTENT = 'button, a, input, select, textarea, [role="button"], [role="checkbox"], [role="menuitem"], [role="link"]';
8222
- function isInteractiveCellEvent(event) {
8223
- const target = event.target;
8224
- if (!(target instanceof Element)) return false;
8225
- const match = target.closest(INTERACTIVE_CELL_CONTENT);
8226
- return match !== null && match !== event.currentTarget;
8227
- }
8228
7988
  function DataTableRow({ row, classNames }) {
8229
7989
  const { onRowClick, variant } = useTableContext();
8230
7990
  const clickable = Boolean(onRowClick);
@@ -8237,15 +7997,12 @@ function DataTableRow({ row, classNames }) {
8237
7997
  "data-clickable": clickable || void 0,
8238
7998
  role: clickable ? "button" : void 0,
8239
7999
  tabIndex: clickable ? 0 : void 0,
8240
- onClick: clickable ? (e) => {
8241
- if (isInteractiveCellEvent(e)) return;
8242
- onRowClick?.(row.original);
8243
- } : void 0,
8000
+ onClick: clickable ? () => onRowClick?.(row.original) : void 0,
8244
8001
  onKeyDown: clickable ? (e) => {
8245
- if (e.key !== "Enter" && e.key !== " ") return;
8246
- if (isInteractiveCellEvent(e)) return;
8247
- e.preventDefault();
8248
- onRowClick?.(row.original);
8002
+ if (e.key === "Enter" || e.key === " ") {
8003
+ e.preventDefault();
8004
+ onRowClick?.(row.original);
8005
+ }
8249
8006
  } : void 0,
8250
8007
  className: cn("hover:bg-muted", clickable && "cursor-pointer", rowClassName),
8251
8008
  children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsxRuntime.jsx(DataTableCell, { cell, cellClassName }, cell.id))
@@ -8846,7 +8603,7 @@ function DataTableFooter({ pagination, selectedCount, className }) {
8846
8603
  className: cn("flex items-center justify-between border-t px-4 py-2", className),
8847
8604
  children: [
8848
8605
  selectedCount != null && selectedCount > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-live": "polite", className: "text-muted-foreground text-xs", children: `${selectedCount} row${selectedCount > 1 ? "s" : ""} selected` }),
8849
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto", children: /* @__PURE__ */ jsxRuntime.jsx(TablePagination, { ...pagination }) })
8606
+ /* @__PURE__ */ jsxRuntime.jsx(TablePagination, { ...pagination })
8850
8607
  ]
8851
8608
  }
8852
8609
  );
@@ -8955,21 +8712,18 @@ function DataTableSearch({
8955
8712
  debounce = 300
8956
8713
  }) {
8957
8714
  const ctx = useTableContextSafe();
8715
+ const [inputValue, setInputValue] = react.useState("");
8958
8716
  const globalFilter = ctx?.globalFilter;
8959
8717
  const setGlobalFilter = ctx?.setGlobalFilter;
8960
- const committedValue = globalFilter ?? "";
8961
- const [inputValue, setInputValue] = react.useState(committedValue);
8962
8718
  react.useEffect(() => {
8963
- if (globalFilter === void 0) return;
8964
- setInputValue(globalFilter);
8719
+ if (globalFilter === "") setInputValue("");
8965
8720
  }, [globalFilter]);
8966
8721
  react.useEffect(() => {
8967
- if (inputValue === committedValue) return;
8968
8722
  const timer = setTimeout(() => {
8969
8723
  setGlobalFilter?.(inputValue);
8970
8724
  }, debounce);
8971
8725
  return () => clearTimeout(timer);
8972
- }, [inputValue, committedValue, debounce, setGlobalFilter]);
8726
+ }, [inputValue, debounce, setGlobalFilter]);
8973
8727
  const handleClear = () => {
8974
8728
  setInputValue("");
8975
8729
  setGlobalFilter?.("");
@@ -8990,13 +8744,7 @@ function DataTableSearch({
8990
8744
  onChange: (e) => setInputValue(e.target.value),
8991
8745
  placeholder,
8992
8746
  "aria-label": placeholder,
8993
- className: cn(
8994
- "h-8 w-48 pr-9 pl-9 text-sm",
8995
- "[&::-webkit-search-cancel-button]:appearance-none",
8996
- "[&::-webkit-search-decoration]:appearance-none",
8997
- "[&::-webkit-search-results-button]:appearance-none",
8998
- "[&::-webkit-search-results-decoration]:appearance-none"
8999
- )
8747
+ className: "h-8 w-48 pr-8 pl-8 text-sm"
9000
8748
  }
9001
8749
  ),
9002
8750
  inputValue && /* @__PURE__ */ jsxRuntime.jsx(
@@ -9006,7 +8754,7 @@ function DataTableSearch({
9006
8754
  size: "icon-sm",
9007
8755
  onClick: handleClear,
9008
8756
  "aria-label": "Clear search",
9009
- className: "text-muted-foreground hover:text-foreground absolute top-1/2 right-1.5 size-6 -translate-y-1/2",
8757
+ className: "text-muted-foreground hover:text-foreground absolute right-0.5 size-6",
9010
8758
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-3.5", "aria-hidden": "true" })
9011
8759
  }
9012
8760
  )
@@ -9541,7 +9289,6 @@ exports.ItemHeader = ItemHeader;
9541
9289
  exports.ItemMedia = ItemMedia;
9542
9290
  exports.ItemSeparator = ItemSeparator;
9543
9291
  exports.ItemTitle = ItemTitle;
9544
- exports.KNOWN_PERMISSIONS = KNOWN_PERMISSIONS;
9545
9292
  exports.Label = Label;
9546
9293
  exports.Link = Link;
9547
9294
  exports.Logo = Logo;
@@ -9702,7 +9449,6 @@ exports.toggleVariants = toggleVariants;
9702
9449
  exports.tooltipContentVariants = tooltipContentVariants;
9703
9450
  exports.transition = transition;
9704
9451
  exports.useAbility = useAbility;
9705
- exports.useAbilityStatus = useAbilityStatus;
9706
9452
  exports.useAppForm = useAppForm;
9707
9453
  exports.useCan = useCan;
9708
9454
  exports.useCarousel = useCarousel;