@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.
@@ -1099,7 +1099,7 @@ var init_Button = __esm({
1099
1099
  "cursor-pointer",
1100
1100
  "chrome-button",
1101
1101
  "transition-all duration-normal",
1102
- "focus:outline-none focus:ring-[length:var(--focus-ring-width)] focus:ring-ring focus:ring-offset-[length:var(--focus-ring-offset)]",
1102
+ "focus:outline-none focus-visible:ring-[length:var(--focus-ring-width)] focus-visible:ring-ring focus-visible:ring-offset-[length:var(--focus-ring-offset)]",
1103
1103
  "disabled:opacity-50 disabled:cursor-not-allowed",
1104
1104
  variantStyles[variant],
1105
1105
  sizeStyles[size],
@@ -1846,7 +1846,7 @@ var init_Badge = __esm({
1846
1846
  },
1847
1847
  className: cn(
1848
1848
  "inline-flex items-center justify-center rounded-sm",
1849
- "hover:bg-foreground/10 focus:outline-none focus:ring-1 focus:ring-ring",
1849
+ "hover:bg-foreground/10 focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",
1850
1850
  "transition-colors",
1851
1851
  size === "sm" ? "w-4 h-4 ml-0.5" : size === "md" ? "w-5 h-5 ml-1" : "w-6 h-6 ml-1"
1852
1852
  ),
@@ -3204,7 +3204,7 @@ function NativeSelect({
3204
3204
  "block w-full border-[length:var(--border-width)] shadow-sm appearance-none",
3205
3205
  "px-3 py-2 pr-10 text-sm text-foreground font-medium",
3206
3206
  "bg-card",
3207
- "focus:outline-none focus:ring-2 focus:ring-offset-0 focus:ring-ring",
3207
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-ring",
3208
3208
  "disabled:bg-muted disabled:text-muted-foreground disabled:cursor-not-allowed",
3209
3209
  error ? "border-error focus:border-error" : "border-border focus:border-primary",
3210
3210
  className
@@ -3311,7 +3311,7 @@ function RichSelect({
3311
3311
  "block w-full border-[length:var(--border-width)] shadow-sm",
3312
3312
  "px-3 py-2 pr-10 text-sm text-start font-medium",
3313
3313
  "bg-card rounded-sm",
3314
- "focus:outline-none focus:ring-2 focus:ring-offset-0 focus:ring-ring",
3314
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-ring",
3315
3315
  "disabled:bg-muted disabled:text-muted-foreground disabled:cursor-not-allowed",
3316
3316
  error ? "border-error focus:border-error" : "border-border focus:border-primary",
3317
3317
  !hasValue && "text-muted-foreground"
@@ -4234,9 +4234,9 @@ var init_Radio = __esm({
4234
4234
  "flex items-center justify-center",
4235
4235
  "border-[length:var(--border-width)] transition-all cursor-pointer",
4236
4236
  sizeClasses4[size],
4237
- hasError ? "border-error peer-focus:ring-error/20" : "border-border peer-focus:ring-ring/20",
4237
+ hasError ? "border-error peer-focus-visible:ring-error/20" : "border-border peer-focus-visible:ring-ring/20",
4238
4238
  isChecked2 ? hasError ? "border-error" : "border-primary bg-primary" : "",
4239
- "peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-offset-2",
4239
+ "peer-focus:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2",
4240
4240
  disabled && "opacity-50 cursor-not-allowed",
4241
4241
  !disabled && "hover:border-[var(--color-border-hover)]"
4242
4242
  ),
@@ -4707,7 +4707,7 @@ var init_ThemeToggle = __esm({
4707
4707
  "inline-flex items-center justify-center gap-2",
4708
4708
  "text-foreground",
4709
4709
  "hover:bg-muted border-[length:var(--border-width)] border-transparent hover:border-border",
4710
- "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
4710
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
4711
4711
  "transition-colors duration-fast",
4712
4712
  sizeClasses5[size],
4713
4713
  className
@@ -11745,10 +11745,12 @@ var init_Container = __esm({
11745
11745
  };
11746
11746
  paddingStyles3 = {
11747
11747
  none: "px-0",
11748
- sm: "px-4",
11749
- md: "px-6",
11750
- lg: "px-8",
11751
- xl: "px-12"
11748
+ // Mobile-tighter, desktop-identical: fixed px-6 on a 360px phone eats ~13% of
11749
+ // the viewport, so each token steps down below the sm breakpoint.
11750
+ sm: "px-3 sm:px-4",
11751
+ md: "px-4 sm:px-6",
11752
+ lg: "px-4 sm:px-6 md:px-8",
11753
+ xl: "px-4 sm:px-8 md:px-12"
11752
11754
  };
11753
11755
  Container = ({
11754
11756
  size,
@@ -12447,7 +12449,7 @@ var init_Accordion = __esm({
12447
12449
  "bg-card",
12448
12450
  "hover:bg-muted",
12449
12451
  "transition-colors duration-fast",
12450
- "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-inset",
12452
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
12451
12453
  "disabled:opacity-50 disabled:cursor-not-allowed",
12452
12454
  isOpen && "bg-muted font-bold"
12453
12455
  ),
@@ -18652,7 +18654,7 @@ var init_Breadcrumb = __esm({
18652
18654
  },
18653
18655
  className: cn(
18654
18656
  "flex items-center gap-1.5 transition-colors",
18655
- "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
18657
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
18656
18658
  isLast ? "text-foreground font-bold cursor-default" : "text-muted-foreground hover:text-foreground"
18657
18659
  ),
18658
18660
  "aria-current": isLast ? "page" : void 0,
@@ -23287,7 +23289,7 @@ function DataGrid({
23287
23289
  ] }, field.name);
23288
23290
  }) })
23289
23291
  ] }),
23290
- dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
23292
+ dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsx(
23291
23293
  Button,
23292
23294
  {
23293
23295
  variant: "ghost",
@@ -23295,11 +23297,10 @@ function DataGrid({
23295
23297
  onClick: handleActionClick(action, itemData),
23296
23298
  "data-testid": `action-${action.event}`,
23297
23299
  "data-row-id": String(itemData.id),
23300
+ "aria-label": action.label,
23301
+ title: action.label,
23298
23302
  className: "text-error hover:text-error hover:bg-error/10 px-2",
23299
- children: [
23300
- action.icon && renderIconInput(action.icon, { size: "xs" }),
23301
- action.label
23302
- ]
23303
+ children: action.icon ? renderIconInput(action.icon, { size: "xs" }) : action.label
23303
23304
  },
23304
23305
  idx
23305
23306
  )) })
@@ -24101,10 +24102,7 @@ var init_FileTree = __esm({
24101
24102
  className,
24102
24103
  indent = 16
24103
24104
  }) => {
24104
- const { t } = useTranslate();
24105
- if (tree.length === 0) {
24106
- return /* @__PURE__ */ jsx(Box, { className: `p-4 ${className ?? ""}`, children: /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: t("fileTree.noFiles") }) });
24107
- }
24105
+ if (tree.length === 0) return null;
24108
24106
  return /* @__PURE__ */ jsx(Box, { className: `py-1 overflow-y-auto ${className ?? ""}`, role: "tree", children: tree.map((node) => /* @__PURE__ */ jsx(
24109
24107
  TreeNodeItem,
24110
24108
  {
@@ -24209,7 +24207,7 @@ var init_useQuerySingleton = __esm({
24209
24207
  queryStores = /* @__PURE__ */ new Map();
24210
24208
  }
24211
24209
  });
24212
- var resolveFilterType, lookStyles6, FilterGroup;
24210
+ var resolveFilterType, lookStyles6, FilterGroupControls, FilterGroupPopover, FilterGroup;
24213
24211
  var init_FilterGroup = __esm({
24214
24212
  "components/core/molecules/FilterGroup.tsx"() {
24215
24213
  "use client";
@@ -24227,10 +24225,10 @@ var init_FilterGroup = __esm({
24227
24225
  toolbar: "",
24228
24226
  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",
24229
24227
  pills: "gap-2 [&_input]:rounded-pill [&_select]:rounded-pill [&_button]:rounded-pill",
24230
- "popover-trigger": "[&>*:not(:first-child)]:hidden",
24228
+ "popover-trigger": "",
24231
24229
  "inline-column-header": "hidden"
24232
24230
  };
24233
- FilterGroup = ({
24231
+ FilterGroupControls = ({
24234
24232
  entity,
24235
24233
  filters,
24236
24234
  onFilterChange,
@@ -24566,7 +24564,7 @@ var init_FilterGroup = __esm({
24566
24564
  className: "text-muted-foreground",
24567
24565
  children: [
24568
24566
  /* @__PURE__ */ jsx(Icon, { name: "filter", className: "h-4 w-4" }),
24569
- /* @__PURE__ */ jsx("span", { className: "text-sm font-bold uppercase tracking-wide", children: t("filterGroup.filters") })
24567
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-bold uppercase tracking-wide", children: t("filterGroup.filters") })
24570
24568
  ]
24571
24569
  }
24572
24570
  ),
@@ -24657,6 +24655,42 @@ var init_FilterGroup = __esm({
24657
24655
  }
24658
24656
  );
24659
24657
  };
24658
+ FilterGroupControls.displayName = "FilterGroupControls";
24659
+ FilterGroupPopover = (props) => {
24660
+ const { t } = useTranslate();
24661
+ const [open, setOpen] = useState(false);
24662
+ const queryState = useQuerySingleton(props.query);
24663
+ const activeFilterCount = queryState?.filters ? Object.values(queryState.filters).filter((v) => v !== null && v !== void 0).length : 0;
24664
+ return /* @__PURE__ */ jsxs("div", { className: cn("relative inline-block", props.className), children: [
24665
+ /* @__PURE__ */ jsx(
24666
+ Button,
24667
+ {
24668
+ variant: activeFilterCount > 0 ? "secondary" : "ghost",
24669
+ size: "sm",
24670
+ leftIcon: "filter",
24671
+ onClick: () => setOpen((o) => !o),
24672
+ "aria-expanded": open,
24673
+ "aria-haspopup": "true",
24674
+ children: /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
24675
+ /* @__PURE__ */ jsx("span", { children: t("filterGroup.filters") }),
24676
+ activeFilterCount > 0 && /* @__PURE__ */ jsx(Badge, { variant: "primary", size: "sm", children: activeFilterCount })
24677
+ ] })
24678
+ }
24679
+ ),
24680
+ 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(
24681
+ FilterGroupControls,
24682
+ {
24683
+ ...props,
24684
+ className: void 0,
24685
+ look: "toolbar",
24686
+ variant: "vertical",
24687
+ showIcon: false
24688
+ }
24689
+ ) })
24690
+ ] });
24691
+ };
24692
+ FilterGroupPopover.displayName = "FilterGroupPopover";
24693
+ FilterGroup = (props) => props.look === "popover-trigger" ? /* @__PURE__ */ jsx(FilterGroupPopover, { ...props }) : /* @__PURE__ */ jsx(FilterGroupControls, { ...props });
24660
24694
  FilterGroup.displayName = "FilterGroup";
24661
24695
  }
24662
24696
  });
@@ -27571,7 +27605,7 @@ var init_NumberStepper = __esm({
27571
27605
  "active:bg-muted",
27572
27606
  "transition-colors duration-instant",
27573
27607
  "disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent",
27574
- "focus:outline-none focus:ring-[length:var(--focus-ring-width)] focus:ring-ring focus:ring-inset",
27608
+ "focus:outline-none focus-visible:ring-[length:var(--focus-ring-width)] focus-visible:ring-ring focus-visible:ring-inset",
27575
27609
  styles.button
27576
27610
  ),
27577
27611
  "aria-label": t("aria.decrease"),
@@ -27612,7 +27646,7 @@ var init_NumberStepper = __esm({
27612
27646
  "active:bg-muted",
27613
27647
  "transition-colors duration-instant",
27614
27648
  "disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent",
27615
- "focus:outline-none focus:ring-[length:var(--focus-ring-width)] focus:ring-ring focus:ring-inset",
27649
+ "focus:outline-none focus-visible:ring-[length:var(--focus-ring-width)] focus-visible:ring-ring focus-visible:ring-inset",
27616
27650
  styles.button
27617
27651
  ),
27618
27652
  "aria-label": t("aria.increase"),
@@ -28068,7 +28102,7 @@ var init_Lightbox = __esm({
28068
28102
  "p-2 rounded-full",
28069
28103
  "text-[var(--color-foreground)] bg-[var(--color-card)]",
28070
28104
  "hover:bg-opacity-70 transition-opacity",
28071
- "focus:outline-none focus:ring-2 focus:ring-ring"
28105
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"
28072
28106
  ),
28073
28107
  "aria-label": t("aria.closeModal"),
28074
28108
  children: /* @__PURE__ */ jsx(Icon, { name: "x", className: "w-6 h-6" })
@@ -28087,7 +28121,7 @@ var init_Lightbox = __esm({
28087
28121
  "p-2 rounded-full",
28088
28122
  "text-[var(--color-foreground)] bg-[var(--color-card)]",
28089
28123
  "hover:bg-opacity-70 transition-opacity",
28090
- "focus:outline-none focus:ring-2 focus:ring-ring"
28124
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"
28091
28125
  ),
28092
28126
  "aria-label": t("aria.previousImage"),
28093
28127
  children: /* @__PURE__ */ jsx(Icon, { name: "chevron-left", className: "w-8 h-8" })
@@ -28124,7 +28158,7 @@ var init_Lightbox = __esm({
28124
28158
  "p-2 rounded-full",
28125
28159
  "text-[var(--color-foreground)] bg-[var(--color-card)]",
28126
28160
  "hover:bg-opacity-70 transition-opacity",
28127
- "focus:outline-none focus:ring-2 focus:ring-ring"
28161
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"
28128
28162
  ),
28129
28163
  "aria-label": t("aria.nextImage"),
28130
28164
  children: /* @__PURE__ */ jsx(Icon, { name: "chevron-right", className: "w-8 h-8" })
@@ -28298,9 +28332,20 @@ function TableView({
28298
28332
  const inlineActionCount = hasActions ? maxInlineActions != null ? Math.min(itemActions.length, maxInlineActions) : itemActions.length : 0;
28299
28333
  const hasOverflowActions = hasActions && maxInlineActions != null && itemActions.length > maxInlineActions;
28300
28334
  const actionsTrack = hasActions ? `${inlineActionCount * 6 + (hasOverflowActions ? 3 : 0)}rem` : null;
28335
+ const colFloors = React84__default.useMemo(
28336
+ () => colDefs.map((col) => {
28337
+ const longest = data.reduce((widest, row) => {
28338
+ const cell = formatCell(asFieldValue(getNestedValue(row, col.field ?? col.key)), col.format);
28339
+ return Math.max(widest, cell.length);
28340
+ }, columnLabel(col).length);
28341
+ const chrome = col.format === "badge" ? BADGE_CHROME_CH : 0;
28342
+ return Math.min(longest + chrome, MAX_MEASURED_COL_CH);
28343
+ }),
28344
+ [colDefs, data]
28345
+ );
28301
28346
  const gridTemplateColumns = [
28302
28347
  selectable ? "auto" : null,
28303
- ...colDefs.map((c) => c.width ?? "minmax(0, 1fr)"),
28348
+ ...colDefs.map((c, i) => c.width ?? `minmax(${colFloors[i]}ch, 1fr)`),
28304
28349
  actionsTrack
28305
28350
  ].filter(Boolean).join(" ");
28306
28351
  const header = /* @__PURE__ */ jsxs(
@@ -28384,7 +28429,7 @@ function TableView({
28384
28429
  col.className
28385
28430
  );
28386
28431
  if (col.format === "badge" && raw != null && raw !== "") {
28387
- return /* @__PURE__ */ jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsx(Badge, { variant: statusVariant4(String(raw)), size: "sm", children: String(raw) }) }, col.key);
28432
+ 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);
28388
28433
  }
28389
28434
  return /* @__PURE__ */ jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsx("span", { className: "truncate", children: formatCell(raw, col.format) }) }, col.key);
28390
28435
  }),
@@ -28467,7 +28512,7 @@ function TableView({
28467
28512
  }
28468
28513
  );
28469
28514
  }
28470
- var alignClass, weightClass, LOOKS;
28515
+ var MAX_MEASURED_COL_CH, BADGE_CHROME_CH, alignClass, weightClass, LOOKS;
28471
28516
  var init_TableView = __esm({
28472
28517
  "components/core/molecules/TableView.tsx"() {
28473
28518
  "use client";
@@ -28485,6 +28530,8 @@ var init_TableView = __esm({
28485
28530
  init_Menu();
28486
28531
  init_useDataDnd();
28487
28532
  createLogger("almadar:ui:table-view");
28533
+ MAX_MEASURED_COL_CH = 32;
28534
+ BADGE_CHROME_CH = 4;
28488
28535
  alignClass = {
28489
28536
  left: "justify-start text-left",
28490
28537
  center: "justify-center text-center",
@@ -30720,7 +30767,7 @@ var init_VoteStack = __esm({
30720
30767
  "active:bg-muted",
30721
30768
  "transition-colors duration-instant",
30722
30769
  "disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent",
30723
- "focus:outline-none focus:ring-[length:var(--focus-ring-width)] focus:ring-ring focus:ring-inset",
30770
+ "focus:outline-none focus-visible:ring-[length:var(--focus-ring-width)] focus-visible:ring-ring focus-visible:ring-inset",
30724
30771
  styles.button
30725
30772
  ),
30726
30773
  children: /* @__PURE__ */ jsx(Icon, { name: "chevron-up", className: styles.icon })
@@ -30757,7 +30804,7 @@ var init_VoteStack = __esm({
30757
30804
  "active:bg-muted",
30758
30805
  "transition-colors duration-instant",
30759
30806
  "disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent",
30760
- "focus:outline-none focus:ring-[length:var(--focus-ring-width)] focus:ring-ring focus:ring-inset",
30807
+ "focus:outline-none focus-visible:ring-[length:var(--focus-ring-width)] focus-visible:ring-ring focus-visible:ring-inset",
30761
30808
  styles.button
30762
30809
  ),
30763
30810
  children: /* @__PURE__ */ jsx(Icon, { name: "chevron-down", className: styles.icon })
@@ -31278,7 +31325,7 @@ var init_QrScanner = __esm({
31278
31325
  // eslint-disable-next-line almadar/no-hardcoded-colors -- media overlay: always over a dark scrim
31279
31326
  "rounded-full bg-black bg-opacity-60 p-2 text-white",
31280
31327
  // eslint-disable-next-line almadar/no-hardcoded-colors -- media overlay: always over a dark scrim
31281
- "hover:bg-opacity-80 focus:outline-none focus:ring-2 focus:ring-white"
31328
+ "hover:bg-opacity-80 focus:outline-none focus-visible:ring-2 focus-visible:ring-white"
31282
31329
  ),
31283
31330
  "aria-label": isPaused ? t("qrScanner.resumeScanning") : t("qrScanner.pauseScanning"),
31284
31331
  children: isPaused ? /* @__PURE__ */ jsx(Icon, { name: "play", className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Icon, { name: "pause", className: "h-4 w-4" })
@@ -31293,7 +31340,7 @@ var init_QrScanner = __esm({
31293
31340
  // eslint-disable-next-line almadar/no-hardcoded-colors -- media overlay: always over a dark scrim
31294
31341
  "rounded-full bg-black bg-opacity-60 p-2 text-white",
31295
31342
  // eslint-disable-next-line almadar/no-hardcoded-colors -- media overlay: always over a dark scrim
31296
- "hover:bg-opacity-80 focus:outline-none focus:ring-2 focus:ring-white"
31343
+ "hover:bg-opacity-80 focus:outline-none focus-visible:ring-2 focus-visible:ring-white"
31297
31344
  ),
31298
31345
  "aria-label": currentFacing === "environment" ? t("qrScanner.switchToFrontCamera") : t("qrScanner.switchToRearCamera"),
31299
31346
  children: /* @__PURE__ */ jsx(Icon, { name: "refresh-cw", className: "h-4 w-4" })
@@ -31308,7 +31355,7 @@ var init_QrScanner = __esm({
31308
31355
  // eslint-disable-next-line almadar/no-hardcoded-colors -- media overlay: always over a dark scrim
31309
31356
  "rounded-full bg-black bg-opacity-60 px-3 py-2 text-xs text-white",
31310
31357
  // eslint-disable-next-line almadar/no-hardcoded-colors -- media overlay: always over a dark scrim
31311
- "hover:bg-opacity-80 focus:outline-none focus:ring-2 focus:ring-white"
31358
+ "hover:bg-opacity-80 focus:outline-none focus-visible:ring-2 focus-visible:ring-white"
31312
31359
  ),
31313
31360
  "aria-label": t("aria.mockScanDev"),
31314
31361
  children: t("qrScanner.mockScan")
@@ -43126,7 +43173,7 @@ var init_TabbedContainer = __esm({
43126
43173
  onClick: () => !isDisabled && handleTabChange(tab.id),
43127
43174
  className: cn(
43128
43175
  "flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors",
43129
- "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
43176
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
43130
43177
  "disabled:opacity-50 disabled:cursor-not-allowed",
43131
43178
  isActive ? "bg-primary text-primary-foreground" : "bg-card text-foreground hover:bg-muted",
43132
43179
  isVertical ? "justify-start" : "justify-center"