@almadar/ui 5.129.0 → 5.131.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/avl/index.js CHANGED
@@ -5050,7 +5050,7 @@ var init_Button = __esm({
5050
5050
  "cursor-pointer",
5051
5051
  "chrome-button",
5052
5052
  "transition-all duration-normal",
5053
- "focus:outline-none focus:ring-[length:var(--focus-ring-width)] focus:ring-ring focus:ring-offset-[length:var(--focus-ring-offset)]",
5053
+ "focus:outline-none focus-visible:ring-[length:var(--focus-ring-width)] focus-visible:ring-ring focus-visible:ring-offset-[length:var(--focus-ring-offset)]",
5054
5054
  "disabled:opacity-50 disabled:cursor-not-allowed",
5055
5055
  variantStyles2[variant],
5056
5056
  sizeStyles[size],
@@ -5673,7 +5673,7 @@ var init_Badge = __esm({
5673
5673
  },
5674
5674
  className: cn(
5675
5675
  "inline-flex items-center justify-center rounded-sm",
5676
- "hover:bg-foreground/10 focus:outline-none focus:ring-1 focus:ring-ring",
5676
+ "hover:bg-foreground/10 focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",
5677
5677
  "transition-colors",
5678
5678
  size === "sm" ? "w-4 h-4 ml-0.5" : size === "md" ? "w-5 h-5 ml-1" : "w-6 h-6 ml-1"
5679
5679
  ),
@@ -7031,7 +7031,7 @@ function NativeSelect({
7031
7031
  "block w-full border-[length:var(--border-width)] shadow-sm appearance-none",
7032
7032
  "px-3 py-2 pr-10 text-sm text-foreground font-medium",
7033
7033
  "bg-card",
7034
- "focus:outline-none focus:ring-2 focus:ring-offset-0 focus:ring-ring",
7034
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-ring",
7035
7035
  "disabled:bg-muted disabled:text-muted-foreground disabled:cursor-not-allowed",
7036
7036
  error ? "border-error focus:border-error" : "border-border focus:border-primary",
7037
7037
  className
@@ -7138,7 +7138,7 @@ function RichSelect({
7138
7138
  "block w-full border-[length:var(--border-width)] shadow-sm",
7139
7139
  "px-3 py-2 pr-10 text-sm text-start font-medium",
7140
7140
  "bg-card rounded-sm",
7141
- "focus:outline-none focus:ring-2 focus:ring-offset-0 focus:ring-ring",
7141
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-ring",
7142
7142
  "disabled:bg-muted disabled:text-muted-foreground disabled:cursor-not-allowed",
7143
7143
  error ? "border-error focus:border-error" : "border-border focus:border-primary",
7144
7144
  !hasValue && "text-muted-foreground"
@@ -8061,9 +8061,9 @@ var init_Radio = __esm({
8061
8061
  "flex items-center justify-center",
8062
8062
  "border-[length:var(--border-width)] transition-all cursor-pointer",
8063
8063
  sizeClasses4[size],
8064
- hasError ? "border-error peer-focus:ring-error/20" : "border-border peer-focus:ring-ring/20",
8064
+ hasError ? "border-error peer-focus-visible:ring-error/20" : "border-border peer-focus-visible:ring-ring/20",
8065
8065
  isChecked2 ? hasError ? "border-error" : "border-primary bg-primary" : "",
8066
- "peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-offset-2",
8066
+ "peer-focus:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2",
8067
8067
  disabled && "opacity-50 cursor-not-allowed",
8068
8068
  !disabled && "hover:border-[var(--color-border-hover)]"
8069
8069
  ),
@@ -8449,7 +8449,7 @@ var init_ThemeToggle = __esm({
8449
8449
  "inline-flex items-center justify-center gap-2",
8450
8450
  "text-foreground",
8451
8451
  "hover:bg-muted border-[length:var(--border-width)] border-transparent hover:border-border",
8452
- "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
8452
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
8453
8453
  "transition-colors duration-fast",
8454
8454
  sizeClasses5[size],
8455
8455
  className
@@ -14836,10 +14836,12 @@ var init_Container = __esm({
14836
14836
  };
14837
14837
  paddingStyles3 = {
14838
14838
  none: "px-0",
14839
- sm: "px-4",
14840
- md: "px-6",
14841
- lg: "px-8",
14842
- xl: "px-12"
14839
+ // Mobile-tighter, desktop-identical: fixed px-6 on a 360px phone eats ~13% of
14840
+ // the viewport, so each token steps down below the sm breakpoint.
14841
+ sm: "px-3 sm:px-4",
14842
+ md: "px-4 sm:px-6",
14843
+ lg: "px-4 sm:px-6 md:px-8",
14844
+ xl: "px-4 sm:px-8 md:px-12"
14843
14845
  };
14844
14846
  Container = ({
14845
14847
  size,
@@ -15538,7 +15540,7 @@ var init_Accordion = __esm({
15538
15540
  "bg-card",
15539
15541
  "hover:bg-muted",
15540
15542
  "transition-colors duration-fast",
15541
- "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-inset",
15543
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
15542
15544
  "disabled:opacity-50 disabled:cursor-not-allowed",
15543
15545
  isOpen && "bg-muted font-bold"
15544
15546
  ),
@@ -20916,7 +20918,7 @@ var init_Breadcrumb = __esm({
20916
20918
  },
20917
20919
  className: cn(
20918
20920
  "flex items-center gap-1.5 transition-colors",
20919
- "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
20921
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
20920
20922
  isLast ? "text-foreground font-bold cursor-default" : "text-muted-foreground hover:text-foreground"
20921
20923
  ),
20922
20924
  "aria-current": isLast ? "page" : void 0,
@@ -25551,7 +25553,7 @@ function DataGrid({
25551
25553
  ] }, field.name);
25552
25554
  }) })
25553
25555
  ] }),
25554
- dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
25556
+ dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsx(
25555
25557
  Button,
25556
25558
  {
25557
25559
  variant: "ghost",
@@ -25559,11 +25561,10 @@ function DataGrid({
25559
25561
  onClick: handleActionClick(action, itemData),
25560
25562
  "data-testid": `action-${action.event}`,
25561
25563
  "data-row-id": String(itemData.id),
25564
+ "aria-label": action.label,
25565
+ title: action.label,
25562
25566
  className: "text-error hover:text-error hover:bg-error/10 px-2",
25563
- children: [
25564
- action.icon && renderIconInput(action.icon, { size: "xs" }),
25565
- action.label
25566
- ]
25567
+ children: action.icon ? renderIconInput(action.icon, { size: "xs" }) : action.label
25567
25568
  },
25568
25569
  idx
25569
25570
  )) })
@@ -26365,10 +26366,7 @@ var init_FileTree = __esm({
26365
26366
  className,
26366
26367
  indent = 16
26367
26368
  }) => {
26368
- const { t } = useTranslate();
26369
- if (tree.length === 0) {
26370
- return /* @__PURE__ */ jsx(Box, { className: `p-4 ${className ?? ""}`, children: /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: t("fileTree.noFiles") }) });
26371
- }
26369
+ if (tree.length === 0) return null;
26372
26370
  return /* @__PURE__ */ jsx(Box, { className: `py-1 overflow-y-auto ${className ?? ""}`, role: "tree", children: tree.map((node) => /* @__PURE__ */ jsx(
26373
26371
  TreeNodeItem,
26374
26372
  {
@@ -26473,7 +26471,7 @@ var init_useQuerySingleton = __esm({
26473
26471
  queryStores = /* @__PURE__ */ new Map();
26474
26472
  }
26475
26473
  });
26476
- var resolveFilterType, lookStyles6, FilterGroup;
26474
+ var resolveFilterType, lookStyles6, FilterGroupControls, FilterGroupPopover, FilterGroup;
26477
26475
  var init_FilterGroup = __esm({
26478
26476
  "components/core/molecules/FilterGroup.tsx"() {
26479
26477
  "use client";
@@ -26491,10 +26489,10 @@ var init_FilterGroup = __esm({
26491
26489
  toolbar: "",
26492
26490
  chips: "gap-1 [&_input]:rounded-pill [&_select]:rounded-pill [&_button]:rounded-pill [&_input]:!px-3 [&_select]:!px-3 [&_input]:bg-muted [&_select]:bg-muted [&_label]:hidden",
26493
26491
  pills: "gap-2 [&_input]:rounded-pill [&_select]:rounded-pill [&_button]:rounded-pill",
26494
- "popover-trigger": "[&>*:not(:first-child)]:hidden",
26492
+ "popover-trigger": "",
26495
26493
  "inline-column-header": "hidden"
26496
26494
  };
26497
- FilterGroup = ({
26495
+ FilterGroupControls = ({
26498
26496
  entity,
26499
26497
  filters,
26500
26498
  onFilterChange,
@@ -26830,7 +26828,7 @@ var init_FilterGroup = __esm({
26830
26828
  className: "text-muted-foreground",
26831
26829
  children: [
26832
26830
  /* @__PURE__ */ jsx(Icon, { name: "filter", className: "h-4 w-4" }),
26833
- /* @__PURE__ */ jsx("span", { className: "text-sm font-bold uppercase tracking-wide", children: t("filterGroup.filters") })
26831
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-bold uppercase tracking-wide", children: t("filterGroup.filters") })
26834
26832
  ]
26835
26833
  }
26836
26834
  ),
@@ -26921,6 +26919,42 @@ var init_FilterGroup = __esm({
26921
26919
  }
26922
26920
  );
26923
26921
  };
26922
+ FilterGroupControls.displayName = "FilterGroupControls";
26923
+ FilterGroupPopover = (props) => {
26924
+ const { t } = useTranslate();
26925
+ const [open, setOpen] = useState(false);
26926
+ const queryState = useQuerySingleton(props.query);
26927
+ const activeFilterCount = queryState?.filters ? Object.values(queryState.filters).filter((v) => v !== null && v !== void 0).length : 0;
26928
+ return /* @__PURE__ */ jsxs("div", { className: cn("relative inline-block", props.className), children: [
26929
+ /* @__PURE__ */ jsx(
26930
+ Button,
26931
+ {
26932
+ variant: activeFilterCount > 0 ? "secondary" : "ghost",
26933
+ size: "sm",
26934
+ leftIcon: "filter",
26935
+ onClick: () => setOpen((o) => !o),
26936
+ "aria-expanded": open,
26937
+ "aria-haspopup": "true",
26938
+ children: /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
26939
+ /* @__PURE__ */ jsx("span", { children: t("filterGroup.filters") }),
26940
+ activeFilterCount > 0 && /* @__PURE__ */ jsx(Badge, { variant: "primary", size: "sm", children: activeFilterCount })
26941
+ ] })
26942
+ }
26943
+ ),
26944
+ open && /* @__PURE__ */ jsx("div", { className: "absolute left-0 z-50 mt-2 min-w-[16rem] rounded-lg border border-[var(--color-border)] bg-[var(--color-card)] p-card-md shadow-main", children: /* @__PURE__ */ jsx(
26945
+ FilterGroupControls,
26946
+ {
26947
+ ...props,
26948
+ className: void 0,
26949
+ look: "toolbar",
26950
+ variant: "vertical",
26951
+ showIcon: false
26952
+ }
26953
+ ) })
26954
+ ] });
26955
+ };
26956
+ FilterGroupPopover.displayName = "FilterGroupPopover";
26957
+ FilterGroup = (props) => props.look === "popover-trigger" ? /* @__PURE__ */ jsx(FilterGroupPopover, { ...props }) : /* @__PURE__ */ jsx(FilterGroupControls, { ...props });
26924
26958
  FilterGroup.displayName = "FilterGroup";
26925
26959
  }
26926
26960
  });
@@ -29835,7 +29869,7 @@ var init_NumberStepper = __esm({
29835
29869
  "active:bg-muted",
29836
29870
  "transition-colors duration-instant",
29837
29871
  "disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent",
29838
- "focus:outline-none focus:ring-[length:var(--focus-ring-width)] focus:ring-ring focus:ring-inset",
29872
+ "focus:outline-none focus-visible:ring-[length:var(--focus-ring-width)] focus-visible:ring-ring focus-visible:ring-inset",
29839
29873
  styles.button
29840
29874
  ),
29841
29875
  "aria-label": t("aria.decrease"),
@@ -29876,7 +29910,7 @@ var init_NumberStepper = __esm({
29876
29910
  "active:bg-muted",
29877
29911
  "transition-colors duration-instant",
29878
29912
  "disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent",
29879
- "focus:outline-none focus:ring-[length:var(--focus-ring-width)] focus:ring-ring focus:ring-inset",
29913
+ "focus:outline-none focus-visible:ring-[length:var(--focus-ring-width)] focus-visible:ring-ring focus-visible:ring-inset",
29880
29914
  styles.button
29881
29915
  ),
29882
29916
  "aria-label": t("aria.increase"),
@@ -30332,7 +30366,7 @@ var init_Lightbox = __esm({
30332
30366
  "p-2 rounded-full",
30333
30367
  "text-[var(--color-foreground)] bg-[var(--color-card)]",
30334
30368
  "hover:bg-opacity-70 transition-opacity",
30335
- "focus:outline-none focus:ring-2 focus:ring-ring"
30369
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"
30336
30370
  ),
30337
30371
  "aria-label": t("aria.closeModal"),
30338
30372
  children: /* @__PURE__ */ jsx(Icon, { name: "x", className: "w-6 h-6" })
@@ -30351,7 +30385,7 @@ var init_Lightbox = __esm({
30351
30385
  "p-2 rounded-full",
30352
30386
  "text-[var(--color-foreground)] bg-[var(--color-card)]",
30353
30387
  "hover:bg-opacity-70 transition-opacity",
30354
- "focus:outline-none focus:ring-2 focus:ring-ring"
30388
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"
30355
30389
  ),
30356
30390
  "aria-label": t("aria.previousImage"),
30357
30391
  children: /* @__PURE__ */ jsx(Icon, { name: "chevron-left", className: "w-8 h-8" })
@@ -30388,7 +30422,7 @@ var init_Lightbox = __esm({
30388
30422
  "p-2 rounded-full",
30389
30423
  "text-[var(--color-foreground)] bg-[var(--color-card)]",
30390
30424
  "hover:bg-opacity-70 transition-opacity",
30391
- "focus:outline-none focus:ring-2 focus:ring-ring"
30425
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"
30392
30426
  ),
30393
30427
  "aria-label": t("aria.nextImage"),
30394
30428
  children: /* @__PURE__ */ jsx(Icon, { name: "chevron-right", className: "w-8 h-8" })
@@ -30562,9 +30596,20 @@ function TableView({
30562
30596
  const inlineActionCount = hasActions ? maxInlineActions != null ? Math.min(itemActions.length, maxInlineActions) : itemActions.length : 0;
30563
30597
  const hasOverflowActions = hasActions && maxInlineActions != null && itemActions.length > maxInlineActions;
30564
30598
  const actionsTrack = hasActions ? `${inlineActionCount * 6 + (hasOverflowActions ? 3 : 0)}rem` : null;
30599
+ const colFloors = React91__default.useMemo(
30600
+ () => colDefs.map((col) => {
30601
+ const longest = data.reduce((widest, row) => {
30602
+ const cell = formatCell(asFieldValue(getNestedValue(row, col.field ?? col.key)), col.format);
30603
+ return Math.max(widest, cell.length);
30604
+ }, columnLabel(col).length);
30605
+ const chrome = col.format === "badge" ? BADGE_CHROME_CH : 0;
30606
+ return Math.min(longest + chrome, MAX_MEASURED_COL_CH);
30607
+ }),
30608
+ [colDefs, data]
30609
+ );
30565
30610
  const gridTemplateColumns = [
30566
30611
  selectable ? "auto" : null,
30567
- ...colDefs.map((c) => c.width ?? "minmax(0, 1fr)"),
30612
+ ...colDefs.map((c, i) => c.width ?? `minmax(${colFloors[i]}ch, 1fr)`),
30568
30613
  actionsTrack
30569
30614
  ].filter(Boolean).join(" ");
30570
30615
  const header = /* @__PURE__ */ jsxs(
@@ -30648,7 +30693,7 @@ function TableView({
30648
30693
  col.className
30649
30694
  );
30650
30695
  if (col.format === "badge" && raw != null && raw !== "") {
30651
- return /* @__PURE__ */ jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsx(Badge, { variant: statusVariant4(String(raw)), size: "sm", children: String(raw) }) }, col.key);
30696
+ return /* @__PURE__ */ jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsx(Badge, { variant: statusVariant4(String(raw)), size: "sm", className: "whitespace-nowrap", children: String(raw) }) }, col.key);
30652
30697
  }
30653
30698
  return /* @__PURE__ */ jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsx("span", { className: "truncate", children: formatCell(raw, col.format) }) }, col.key);
30654
30699
  }),
@@ -30731,7 +30776,7 @@ function TableView({
30731
30776
  }
30732
30777
  );
30733
30778
  }
30734
- var alignClass, weightClass, LOOKS;
30779
+ var MAX_MEASURED_COL_CH, BADGE_CHROME_CH, alignClass, weightClass, LOOKS;
30735
30780
  var init_TableView = __esm({
30736
30781
  "components/core/molecules/TableView.tsx"() {
30737
30782
  "use client";
@@ -30749,6 +30794,8 @@ var init_TableView = __esm({
30749
30794
  init_Menu();
30750
30795
  init_useDataDnd();
30751
30796
  createLogger("almadar:ui:table-view");
30797
+ MAX_MEASURED_COL_CH = 32;
30798
+ BADGE_CHROME_CH = 4;
30752
30799
  alignClass = {
30753
30800
  left: "justify-start text-left",
30754
30801
  center: "justify-center text-center",
@@ -32984,7 +33031,7 @@ var init_VoteStack = __esm({
32984
33031
  "active:bg-muted",
32985
33032
  "transition-colors duration-instant",
32986
33033
  "disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent",
32987
- "focus:outline-none focus:ring-[length:var(--focus-ring-width)] focus:ring-ring focus:ring-inset",
33034
+ "focus:outline-none focus-visible:ring-[length:var(--focus-ring-width)] focus-visible:ring-ring focus-visible:ring-inset",
32988
33035
  styles.button
32989
33036
  ),
32990
33037
  children: /* @__PURE__ */ jsx(Icon, { name: "chevron-up", className: styles.icon })
@@ -33021,7 +33068,7 @@ var init_VoteStack = __esm({
33021
33068
  "active:bg-muted",
33022
33069
  "transition-colors duration-instant",
33023
33070
  "disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent",
33024
- "focus:outline-none focus:ring-[length:var(--focus-ring-width)] focus:ring-ring focus:ring-inset",
33071
+ "focus:outline-none focus-visible:ring-[length:var(--focus-ring-width)] focus-visible:ring-ring focus-visible:ring-inset",
33025
33072
  styles.button
33026
33073
  ),
33027
33074
  children: /* @__PURE__ */ jsx(Icon, { name: "chevron-down", className: styles.icon })
@@ -33542,7 +33589,7 @@ var init_QrScanner = __esm({
33542
33589
  // eslint-disable-next-line almadar/no-hardcoded-colors -- media overlay: always over a dark scrim
33543
33590
  "rounded-full bg-black bg-opacity-60 p-2 text-white",
33544
33591
  // eslint-disable-next-line almadar/no-hardcoded-colors -- media overlay: always over a dark scrim
33545
- "hover:bg-opacity-80 focus:outline-none focus:ring-2 focus:ring-white"
33592
+ "hover:bg-opacity-80 focus:outline-none focus-visible:ring-2 focus-visible:ring-white"
33546
33593
  ),
33547
33594
  "aria-label": isPaused ? t("qrScanner.resumeScanning") : t("qrScanner.pauseScanning"),
33548
33595
  children: isPaused ? /* @__PURE__ */ jsx(Icon, { name: "play", className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Icon, { name: "pause", className: "h-4 w-4" })
@@ -33557,7 +33604,7 @@ var init_QrScanner = __esm({
33557
33604
  // eslint-disable-next-line almadar/no-hardcoded-colors -- media overlay: always over a dark scrim
33558
33605
  "rounded-full bg-black bg-opacity-60 p-2 text-white",
33559
33606
  // eslint-disable-next-line almadar/no-hardcoded-colors -- media overlay: always over a dark scrim
33560
- "hover:bg-opacity-80 focus:outline-none focus:ring-2 focus:ring-white"
33607
+ "hover:bg-opacity-80 focus:outline-none focus-visible:ring-2 focus-visible:ring-white"
33561
33608
  ),
33562
33609
  "aria-label": currentFacing === "environment" ? t("qrScanner.switchToFrontCamera") : t("qrScanner.switchToRearCamera"),
33563
33610
  children: /* @__PURE__ */ jsx(Icon, { name: "refresh-cw", className: "h-4 w-4" })
@@ -33572,7 +33619,7 @@ var init_QrScanner = __esm({
33572
33619
  // eslint-disable-next-line almadar/no-hardcoded-colors -- media overlay: always over a dark scrim
33573
33620
  "rounded-full bg-black bg-opacity-60 px-3 py-2 text-xs text-white",
33574
33621
  // eslint-disable-next-line almadar/no-hardcoded-colors -- media overlay: always over a dark scrim
33575
- "hover:bg-opacity-80 focus:outline-none focus:ring-2 focus:ring-white"
33622
+ "hover:bg-opacity-80 focus:outline-none focus-visible:ring-2 focus-visible:ring-white"
33576
33623
  ),
33577
33624
  "aria-label": t("aria.mockScanDev"),
33578
33625
  children: t("qrScanner.mockScan")
@@ -45000,7 +45047,7 @@ var init_TabbedContainer = __esm({
45000
45047
  onClick: () => !isDisabled && handleTabChange(tab.id),
45001
45048
  className: cn(
45002
45049
  "flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors",
45003
- "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
45050
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
45004
45051
  "disabled:opacity-50 disabled:cursor-not-allowed",
45005
45052
  isActive ? "bg-primary text-primary-foreground" : "bg-card text-foreground hover:bg-muted",
45006
45053
  isVertical ? "justify-start" : "justify-center"