@mediaradar/design-components 0.20.0 → 0.22.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.js CHANGED
@@ -233,7 +233,7 @@ function AdvertiserQuickFilter({
233
233
  "aria-label": caption,
234
234
  "data-testid": testIdPrefix && `${testIdPrefix}-popover`,
235
235
  children: [
236
- /* @__PURE__ */ jsx3("div", { className: "border-b border-border-default p-2", children: /* @__PURE__ */ jsxs3("div", { className: "flex h-9 items-center gap-2 rounded-control border border-border-strong bg-input px-2.5 focus-within:border-border-focus focus-within:ring-2 focus-within:ring-border-focus/30", children: [
236
+ /* @__PURE__ */ jsx3("div", { className: "border-b border-border-default p-2", children: /* @__PURE__ */ jsxs3("div", { className: "flex h-8 items-center gap-2 rounded-control border border-border-strong bg-input px-2.5 focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-border-focus", children: [
237
237
  /* @__PURE__ */ jsx3(Search2, { size: 14, className: "shrink-0 text-text-secondary", "aria-hidden": "true" }),
238
238
  /* @__PURE__ */ jsx3(
239
239
  "input",
@@ -910,8 +910,9 @@ function NavBtn({ children, onClick, ...rest }) {
910
910
 
911
911
  // src/SearchBar.tsx
912
912
  import { useEffect as useEffect4, useId as useId2, useRef as useRef4, useState as useState4 } from "react";
913
- import { AlertCircle, Check as Check3, ChevronDown as ChevronDown3, Search as Search3 } from "lucide-react";
913
+ import { AlertCircle, Check as Check3, ChevronDown as ChevronDown3, Search as Search3, X as X2 } from "lucide-react";
914
914
  import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
915
+ var HEIGHT = { sm: "h-8", md: "h-10", lg: "h-11" };
915
916
  var DEFAULT_SEARCH_MATCH = { mode: "anyWord", wordJoin: "Or" };
916
917
  var MODE_LABEL = {
917
918
  anyWord: "Any Word",
@@ -927,6 +928,7 @@ function SearchBar({
927
928
  value,
928
929
  onChange,
929
930
  variant = "default",
931
+ size = "lg",
930
932
  matchValue,
931
933
  onMatchChange,
932
934
  className,
@@ -934,6 +936,7 @@ function SearchBar({
934
936
  }) {
935
937
  const [open, setOpen] = useState4(false);
936
938
  const ref = useRef4(null);
939
+ const input = useRef4(null);
937
940
  useEffect4(() => {
938
941
  if (!open) return;
939
942
  const onKey = (e) => e.key === "Escape" && setOpen(false);
@@ -952,7 +955,8 @@ function SearchBar({
952
955
  "div",
953
956
  {
954
957
  className: cx2(
955
- "flex h-11 min-w-[200px] flex-1 items-stretch rounded-control border border-border-strong bg-input",
958
+ "flex min-w-[200px] flex-1 items-stretch rounded-control border border-border-strong bg-input focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-border-focus",
959
+ HEIGHT[size],
956
960
  className
957
961
  ),
958
962
  children: [
@@ -961,16 +965,31 @@ function SearchBar({
961
965
  /* @__PURE__ */ jsx8(
962
966
  "input",
963
967
  {
968
+ ref: input,
964
969
  type: "text",
965
970
  value,
966
971
  onChange: (e) => onChange?.(e.target.value),
967
972
  placeholder,
968
973
  "aria-label": placeholder,
969
974
  "data-testid": testIdPrefix && `${testIdPrefix}-search`,
970
- className: "min-w-0 flex-1 bg-transparent text-[13px] text-text-primary outline-hidden placeholder:text-text-tertiary"
975
+ className: "min-w-0 flex-1 bg-transparent text-dense text-text-primary outline-hidden placeholder:text-text-tertiary"
971
976
  }
972
977
  )
973
978
  ] }),
979
+ value && onChange && /* @__PURE__ */ jsx8(
980
+ "button",
981
+ {
982
+ type: "button",
983
+ onClick: () => {
984
+ onChange("");
985
+ input.current?.focus();
986
+ },
987
+ "aria-label": "Clear search",
988
+ "data-testid": testIdPrefix && `${testIdPrefix}-clear`,
989
+ className: "mr-1.5 flex size-6 shrink-0 items-center justify-center self-center rounded-control text-text-tertiary hover:bg-subtle hover:text-text-primary focus-visible:outline-2 focus-visible:outline-border-focus",
990
+ children: /* @__PURE__ */ jsx8(X2, { size: 14, "aria-hidden": "true" })
991
+ }
992
+ ),
974
993
  showMatch && // border-border-default, not the bare `border-border` both source
975
994
  // implementations used -- confirmed by actually compiling against
976
995
  // @mediaradar/design-tokens' real published theme.css (not assumed):
@@ -1609,7 +1628,7 @@ function NoResultsEmptyState({
1609
1628
 
1610
1629
  // src/WorkspaceSelectedCard.tsx
1611
1630
  import { useEffect as useEffect7, useRef as useRef8, useState as useState7 } from "react";
1612
- import { ChevronDown as ChevronDown6, X as X2 } from "lucide-react";
1631
+ import { ChevronDown as ChevronDown6, X as X3 } from "lucide-react";
1613
1632
  import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
1614
1633
  function cx5(...parts) {
1615
1634
  return parts.filter(Boolean).join(" ");
@@ -1673,7 +1692,7 @@ function SummaryGroupItem({
1673
1692
  "aria-label": `Remove ${item.name}`,
1674
1693
  onClick: () => group.onRemove(item.id),
1675
1694
  className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-control text-text-secondary hover:bg-subtle hover:text-text-danger",
1676
- children: /* @__PURE__ */ jsx14(X2, { size: 12, "aria-hidden": "true" })
1695
+ children: /* @__PURE__ */ jsx14(X3, { size: 12, "aria-hidden": "true" })
1677
1696
  }
1678
1697
  )
1679
1698
  ]
@@ -2322,7 +2341,7 @@ function SelectionPicker({
2322
2341
  }) }),
2323
2342
  source === "search" && /* @__PURE__ */ jsxs22("div", { className: "flex min-w-0 flex-col gap-3", children: [
2324
2343
  /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center gap-2", children: [
2325
- /* @__PURE__ */ jsxs22("div", { className: "flex h-9 min-w-[200px] flex-1 items-center gap-2 rounded-control border border-border-strong bg-input px-3", children: [
2344
+ /* @__PURE__ */ jsxs22("div", { className: "flex h-8 min-w-[200px] flex-1 items-center gap-2 rounded-control border border-border-strong bg-input px-3 focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-border-focus", children: [
2326
2345
  /* @__PURE__ */ jsx24(Search4, { size: 15, className: "text-text-secondary", "aria-hidden": "true" }),
2327
2346
  /* @__PURE__ */ jsx24(
2328
2347
  "input",
@@ -2636,7 +2655,7 @@ function FilterDropdown({
2636
2655
  onClick: () => setOpen((v) => !v),
2637
2656
  "aria-expanded": open,
2638
2657
  "data-testid": testIdPrefix && `${testIdPrefix}-filter-${filterSlug}`,
2639
- className: "inline-flex h-9 items-center gap-1.5 whitespace-nowrap rounded-control border border-border-strong bg-input px-3 text-[13px] font-medium text-text-secondary transition-colors hover:bg-subtle",
2658
+ className: "inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-control border border-border-strong bg-input px-3 text-[13px] font-medium text-text-secondary transition-colors hover:bg-subtle",
2640
2659
  children: [
2641
2660
  label,
2642
2661
  /* @__PURE__ */ jsx24(ChevronDown8, { size: 13, "aria-hidden": "true", className: cx8("transition-transform", open && "rotate-180") })
@@ -2842,7 +2861,10 @@ var buttonVariants = cva(
2842
2861
  size: {
2843
2862
  xs: "h-6 px-2 text-xs",
2844
2863
  sm: "h-8 px-3 text-sm",
2845
- md: "h-10 px-4 text-sm"
2864
+ md: "h-10 px-4 text-sm",
2865
+ // 44, the filter row's height, so a button at the end of a row of
2866
+ // filter dropdowns lines up with them. One control scale: 32 / 40 / 44.
2867
+ lg: "h-11 px-5 text-sm"
2846
2868
  },
2847
2869
  // Shape is orthogonal to size. As a fourth SIZE, `icon` could only ever
2848
2870
  // be one dimension, so an icon button never lined up with the labelled
@@ -2857,6 +2879,7 @@ var buttonVariants = cva(
2857
2879
  { size: "xs", iconOnly: true, class: "w-6" },
2858
2880
  { size: "sm", iconOnly: true, class: "w-8" },
2859
2881
  { size: "md", iconOnly: true, class: "w-10" },
2882
+ { size: "lg", iconOnly: true, class: "w-11" },
2860
2883
  // A boxed button is a target you aim at, so its label carries the weight
2861
2884
  // of one. `link` sits inline in a sentence, where semibold reads as
2862
2885
  // emphasis on the words rather than as a control.
@@ -2970,7 +2993,7 @@ function NameListModal({
2970
2993
  /* @__PURE__ */ jsx28(
2971
2994
  "div",
2972
2995
  {
2973
- className: "fixed inset-0 z-70 flex items-center justify-center bg-scrim px-4",
2996
+ className: "fixed inset-0 z-modal flex items-center justify-center bg-scrim px-4",
2974
2997
  onMouseDown: (e) => e.target === e.currentTarget && onCancel(),
2975
2998
  children: /* @__PURE__ */ jsxs26(
2976
2999
  "div",
@@ -2980,7 +3003,7 @@ function NameListModal({
2980
3003
  "aria-modal": "true",
2981
3004
  "aria-labelledby": titleId,
2982
3005
  onKeyDown: trapTab,
2983
- className: "w-full max-w-[420px] rounded-card border border-border-default bg-surface p-5 shadow-overlay",
3006
+ className: "w-full max-w-110 rounded-card border border-border-default bg-surface p-5 shadow-overlay",
2984
3007
  children: [
2985
3008
  /* @__PURE__ */ jsx28("h2", { id: titleId, className: "text-[16px] font-semibold text-text-primary", children: title }),
2986
3009
  /* @__PURE__ */ jsxs26("div", { className: "mt-4 flex flex-col gap-1.5", children: [
@@ -2993,7 +3016,7 @@ function NameListModal({
2993
3016
  value: name,
2994
3017
  onChange: (e) => setName(e.target.value),
2995
3018
  placeholder,
2996
- className: "h-10 rounded-control border border-border-strong bg-input px-3 text-sm outline-hidden focus:border-brand-primaryAction"
3019
+ className: "h-10 rounded-control border border-border-strong bg-input px-3 text-dense focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus"
2997
3020
  }
2998
3021
  )
2999
3022
  ] }),
@@ -3039,7 +3062,7 @@ function ChipContent({ caption, value, icon }) {
3039
3062
  }
3040
3063
 
3041
3064
  // src/FilterChipBar.tsx
3042
- import { CircleSlash, X as X3 } from "lucide-react";
3065
+ import { CircleSlash, X as X4 } from "lucide-react";
3043
3066
  import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
3044
3067
  function FilterChipBar({ chips, onRemove, onClearAll, parkedKeys }) {
3045
3068
  if (chips.length === 0) return null;
@@ -3085,7 +3108,7 @@ function Chip({
3085
3108
  onClick: onRemove,
3086
3109
  "aria-label": `Remove ${groupLabel}: ${label}`,
3087
3110
  className: "text-text-tertiary transition-colors hover:text-text-primary",
3088
- children: /* @__PURE__ */ jsx30(X3, { size: 12 })
3111
+ children: /* @__PURE__ */ jsx30(X4, { size: 12 })
3089
3112
  }
3090
3113
  )
3091
3114
  ]
@@ -3194,17 +3217,17 @@ function pageWindow(current, total) {
3194
3217
  }
3195
3218
  return out;
3196
3219
  }
3197
- function Pager({ page, totalPages, onPage }) {
3198
- const btn = "flex h-8 min-w-8 items-center justify-center rounded-control px-2 text-[13px] transition-colors";
3220
+ function Pager({ page, totalPages, onPage, disabled = false }) {
3221
+ const btn = "flex h-8 min-w-8 items-center justify-center rounded-control px-2 text-[13px] transition-colors disabled:pointer-events-none disabled:opacity-30";
3199
3222
  return /* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-1", children: [
3200
3223
  /* @__PURE__ */ jsx32(
3201
3224
  "button",
3202
3225
  {
3203
3226
  type: "button",
3204
3227
  onClick: () => onPage(page - 1),
3205
- disabled: page === 1,
3228
+ disabled: disabled || page === 1,
3206
3229
  "aria-label": "Previous page",
3207
- className: cn(btn, "text-text-secondary hover:bg-subtle hover:text-text-primary disabled:pointer-events-none disabled:opacity-30"),
3230
+ className: cn(btn, "text-text-secondary hover:bg-subtle hover:text-text-primary"),
3208
3231
  children: /* @__PURE__ */ jsx32(ChevronLeft3, { size: 16 })
3209
3232
  }
3210
3233
  ),
@@ -3214,6 +3237,7 @@ function Pager({ page, totalPages, onPage }) {
3214
3237
  {
3215
3238
  type: "button",
3216
3239
  onClick: () => onPage(p),
3240
+ disabled,
3217
3241
  "aria-current": p === page ? "page" : void 0,
3218
3242
  className: cn(
3219
3243
  btn,
@@ -3229,9 +3253,9 @@ function Pager({ page, totalPages, onPage }) {
3229
3253
  {
3230
3254
  type: "button",
3231
3255
  onClick: () => onPage(page + 1),
3232
- disabled: page === totalPages,
3256
+ disabled: disabled || page === totalPages,
3233
3257
  "aria-label": "Next page",
3234
- className: cn(btn, "text-text-secondary hover:bg-subtle hover:text-text-primary disabled:pointer-events-none disabled:opacity-30"),
3258
+ className: cn(btn, "text-text-secondary hover:bg-subtle hover:text-text-primary"),
3235
3259
  children: /* @__PURE__ */ jsx32(ChevronRight4, { size: 16 })
3236
3260
  }
3237
3261
  )
@@ -3375,6 +3399,7 @@ function TablePagination({
3375
3399
  onPerPageChange,
3376
3400
  perPageOptions = [25, 50, 100],
3377
3401
  itemLabel = "results",
3402
+ disabled = false,
3378
3403
  className,
3379
3404
  testIdPrefix
3380
3405
  }) {
@@ -3383,21 +3408,32 @@ function TablePagination({
3383
3408
  const rangeStart = totalItems === 0 ? 0 : (current - 1) * perPage + 1;
3384
3409
  const rangeEnd = Math.min(current * perPage, totalItems);
3385
3410
  const btn = "flex h-8 min-w-8 items-center justify-center rounded-control px-2 text-[13px] transition-colors";
3386
- const stepBtn = cn(
3387
- btn,
3388
- "text-text-secondary hover:bg-subtle hover:text-text-primary disabled:pointer-events-none disabled:opacity-30"
3389
- );
3411
+ const off = "disabled:pointer-events-none disabled:opacity-30";
3412
+ const stepBtn = cn(btn, "text-text-secondary hover:bg-subtle hover:text-text-primary", off);
3413
+ const range = /* @__PURE__ */ jsxs32("span", { className: "text-[13px] text-text-tertiary tabular-nums", children: [
3414
+ rangeStart.toLocaleString(),
3415
+ " \u2013 ",
3416
+ rangeEnd.toLocaleString(),
3417
+ " of ",
3418
+ totalItems.toLocaleString(),
3419
+ " ",
3420
+ itemLabel
3421
+ ] });
3390
3422
  return /* @__PURE__ */ jsxs32("div", { className: cn("flex flex-wrap items-center justify-between gap-x-4 gap-y-2", className), "data-testid": testIdPrefix, children: [
3391
- /* @__PURE__ */ jsxs32("label", { className: "flex items-center gap-2 text-[13px] text-text-secondary", children: [
3423
+ onPerPageChange ? /* @__PURE__ */ jsxs32("label", { className: "flex items-center gap-2 text-[13px] text-text-secondary", children: [
3392
3424
  /* @__PURE__ */ jsxs32("span", { className: "relative", children: [
3393
3425
  /* @__PURE__ */ jsx36(
3394
3426
  "select",
3395
3427
  {
3396
3428
  value: perPage,
3397
3429
  onChange: (e) => onPerPageChange(Number(e.target.value)),
3430
+ disabled,
3398
3431
  "aria-label": "Items per page",
3399
3432
  "data-testid": testIdPrefix && `${testIdPrefix}-per-page`,
3400
- className: "appearance-none rounded-control border border-border-strong bg-input py-1 pl-2.5 pr-7 text-[13px] font-medium text-text-primary focus:outline focus:outline-2 focus:outline-border-focus",
3433
+ className: cn(
3434
+ "appearance-none rounded-control border border-border-strong bg-input py-1 pl-2.5 pr-7 text-[13px] font-medium text-text-primary focus:outline focus:outline-2 focus:outline-border-focus",
3435
+ off
3436
+ ),
3401
3437
  children: perPageOptions.map((n) => /* @__PURE__ */ jsx36("option", { value: n, children: n }, n))
3402
3438
  }
3403
3439
  ),
@@ -3411,14 +3447,14 @@ function TablePagination({
3411
3447
  )
3412
3448
  ] }),
3413
3449
  "items per page"
3414
- ] }),
3450
+ ] }) : range,
3415
3451
  /* @__PURE__ */ jsxs32("nav", { className: "flex items-center gap-1", "aria-label": "Pagination", children: [
3416
3452
  /* @__PURE__ */ jsx36(
3417
3453
  "button",
3418
3454
  {
3419
3455
  type: "button",
3420
3456
  onClick: () => onPageChange(1),
3421
- disabled: current === 1,
3457
+ disabled: disabled || current === 1,
3422
3458
  "aria-label": "First page",
3423
3459
  "data-testid": testIdPrefix && `${testIdPrefix}-first`,
3424
3460
  className: stepBtn,
@@ -3430,7 +3466,7 @@ function TablePagination({
3430
3466
  {
3431
3467
  type: "button",
3432
3468
  onClick: () => onPageChange(current - 1),
3433
- disabled: current === 1,
3469
+ disabled: disabled || current === 1,
3434
3470
  "aria-label": "Previous page",
3435
3471
  "data-testid": testIdPrefix && `${testIdPrefix}-prev`,
3436
3472
  className: stepBtn,
@@ -3444,9 +3480,11 @@ function TablePagination({
3444
3480
  type: "button",
3445
3481
  "data-testid": testIdPrefix && `${testIdPrefix}-page-${p}`,
3446
3482
  onClick: () => onPageChange(p),
3483
+ disabled,
3447
3484
  "aria-current": p === current ? "page" : void 0,
3448
3485
  className: cn(
3449
3486
  btn,
3487
+ off,
3450
3488
  p === current ? "bg-brand-primaryAction font-semibold text-brand-onprimary" : "text-text-secondary hover:bg-subtle hover:text-text-primary"
3451
3489
  ),
3452
3490
  children: p
@@ -3459,7 +3497,7 @@ function TablePagination({
3459
3497
  {
3460
3498
  type: "button",
3461
3499
  onClick: () => onPageChange(current + 1),
3462
- disabled: current === totalPages,
3500
+ disabled: disabled || current === totalPages,
3463
3501
  "aria-label": "Next page",
3464
3502
  "data-testid": testIdPrefix && `${testIdPrefix}-next`,
3465
3503
  className: stepBtn,
@@ -3471,7 +3509,7 @@ function TablePagination({
3471
3509
  {
3472
3510
  type: "button",
3473
3511
  onClick: () => onPageChange(totalPages),
3474
- disabled: current === totalPages,
3512
+ disabled: disabled || current === totalPages,
3475
3513
  "aria-label": "Last page",
3476
3514
  "data-testid": testIdPrefix && `${testIdPrefix}-last`,
3477
3515
  className: stepBtn,
@@ -3479,15 +3517,7 @@ function TablePagination({
3479
3517
  }
3480
3518
  )
3481
3519
  ] }),
3482
- /* @__PURE__ */ jsxs32("span", { className: "text-[13px] text-text-tertiary tabular-nums", children: [
3483
- rangeStart.toLocaleString(),
3484
- " \u2013 ",
3485
- rangeEnd.toLocaleString(),
3486
- " of ",
3487
- totalItems.toLocaleString(),
3488
- " ",
3489
- itemLabel
3490
- ] })
3520
+ onPerPageChange && range
3491
3521
  ] });
3492
3522
  }
3493
3523
 
@@ -3538,7 +3568,7 @@ function MiniSelect({ value, onChange, options }) {
3538
3568
  const opt = options.find((o) => String(o.value) === e.target.value);
3539
3569
  if (opt) onChange(opt.value);
3540
3570
  },
3541
- className: "rounded-control border border-border-strong bg-input px-1.5 py-1 text-[12px] text-text-primary outline-hidden focus:border-border-focus",
3571
+ className: "rounded-control border border-border-strong bg-input px-1.5 py-1 text-[12px] text-text-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
3542
3572
  children: options.map((o) => /* @__PURE__ */ jsx37("option", { value: String(o.value), children: o.label }, String(o.value)))
3543
3573
  }
3544
3574
  );
@@ -3667,7 +3697,7 @@ function DateRangePicker({
3667
3697
 
3668
3698
  // src/MultiSelectFilter.tsx
3669
3699
  import { useCallback as useCallback4, useEffect as useEffect13, useRef as useRef14, useState as useState14 } from "react";
3670
- import { ChevronDown as ChevronDown11, Check as Check8, Minus as Minus2, Search as Search5, X as X4 } from "lucide-react";
3700
+ import { ChevronDown as ChevronDown11, Check as Check8, Minus as Minus2, Search as Search5, X as X5 } from "lucide-react";
3671
3701
  import { jsx as jsx38, jsxs as jsxs34 } from "react/jsx-runtime";
3672
3702
  function MultiSelectFilter({
3673
3703
  caption,
@@ -3791,7 +3821,7 @@ function MultiSelectFilter({
3791
3821
  role: "dialog",
3792
3822
  "aria-label": caption,
3793
3823
  children: [
3794
- searchable && /* @__PURE__ */ jsx38("div", { className: "border-b border-border-default p-2", children: /* @__PURE__ */ jsxs34("div", { className: "flex h-9 items-center gap-2 rounded-control border border-border-strong bg-input px-2.5", children: [
3824
+ searchable && /* @__PURE__ */ jsx38("div", { className: "border-b border-border-default p-2", children: /* @__PURE__ */ jsxs34("div", { className: "flex h-8 items-center gap-2 rounded-control border border-border-strong bg-input px-2.5 focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-border-focus", children: [
3795
3825
  /* @__PURE__ */ jsx38(Search5, { size: 14, className: "text-text-secondary", "aria-hidden": "true" }),
3796
3826
  /* @__PURE__ */ jsx38(
3797
3827
  "input",
@@ -3803,7 +3833,7 @@ function MultiSelectFilter({
3803
3833
  className: "h-full flex-1 bg-transparent text-[13px] outline-hidden placeholder:text-text-tertiary"
3804
3834
  }
3805
3835
  ),
3806
- q && /* @__PURE__ */ jsx38("button", { type: "button", onClick: () => setQ(""), "aria-label": "Clear search", className: "text-text-tertiary hover:text-text-primary", children: /* @__PURE__ */ jsx38(X4, { size: 13 }) })
3836
+ q && /* @__PURE__ */ jsx38("button", { type: "button", onClick: () => setQ(""), "aria-label": "Clear search", className: "text-text-tertiary hover:text-text-primary", children: /* @__PURE__ */ jsx38(X5, { size: 13 }) })
3807
3837
  ] }) }),
3808
3838
  /* @__PURE__ */ jsxs34("div", { className: "max-h-[280px] overflow-y-auto p-1", children: [
3809
3839
  groups ? visibleGroups.map((g) => {
@@ -4001,16 +4031,294 @@ function SectionHeading({ title, description, actions, as: Tag2 = "h2", id, clas
4001
4031
  }
4002
4032
 
4003
4033
  // src/PageHeader.tsx
4034
+ import { ArrowLeft } from "lucide-react";
4004
4035
  import { jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
4005
- function PageHeader({ title, description, actions, className }) {
4036
+ function PageHeader({ title, description, actions, back, className }) {
4006
4037
  return /* @__PURE__ */ jsxs37("header", { className: cn("flex flex-wrap items-center justify-between gap-x-6 gap-y-3", className), children: [
4007
4038
  /* @__PURE__ */ jsxs37("div", { className: "min-w-0", children: [
4039
+ back && /* @__PURE__ */ jsxs37(
4040
+ "a",
4041
+ {
4042
+ href: back.href ?? "#",
4043
+ onClick: back.onClick,
4044
+ className: "mb-1.5 inline-flex items-center gap-1.5 rounded-control text-micro font-semibold uppercase tracking-wider text-text-tertiary hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
4045
+ children: [
4046
+ /* @__PURE__ */ jsx43(ArrowLeft, { size: 13, "aria-hidden": "true" }),
4047
+ back.label
4048
+ ]
4049
+ }
4050
+ ),
4008
4051
  /* @__PURE__ */ jsx43("h1", { className: "text-xl font-semibold tracking-tight text-text-primary", children: title }),
4009
4052
  description && /* @__PURE__ */ jsx43("p", { className: "mt-0.5 max-w-2xl text-sm text-text-secondary", children: description })
4010
4053
  ] }),
4011
4054
  actions && /* @__PURE__ */ jsx43("div", { className: "flex shrink-0 items-center gap-2", children: actions })
4012
4055
  ] });
4013
4056
  }
4057
+
4058
+ // src/Modal.tsx
4059
+ import { useEffect as useEffect14, useId as useId6, useRef as useRef15 } from "react";
4060
+ import { createPortal as createPortal7 } from "react-dom";
4061
+ import { X as X6 } from "lucide-react";
4062
+ import { jsx as jsx44, jsxs as jsxs38 } from "react/jsx-runtime";
4063
+ var WIDTH = {
4064
+ sm: "max-w-110",
4065
+ md: "max-w-160",
4066
+ lg: "max-w-220"
4067
+ };
4068
+ var FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
4069
+ function Modal({ open, onClose, title, description, size = "md", footer, children, className }) {
4070
+ const titleId = useId6();
4071
+ const descId = useId6();
4072
+ const panel = useRef15(null);
4073
+ const close = useRef15(onClose);
4074
+ close.current = onClose;
4075
+ useEffect14(() => {
4076
+ if (!open) return;
4077
+ const opener = document.activeElement;
4078
+ const first = panel.current?.querySelector(`[data-modal-body] :is(${FOCUSABLE})`) ?? panel.current?.querySelector(`[data-modal-footer] :is(${FOCUSABLE})`);
4079
+ (first ?? panel.current)?.focus();
4080
+ const overflow = document.body.style.overflow;
4081
+ document.body.style.overflow = "hidden";
4082
+ const onKey = (e) => {
4083
+ if (e.key === "Escape") {
4084
+ e.stopPropagation();
4085
+ close.current();
4086
+ return;
4087
+ }
4088
+ if (e.key !== "Tab" || !panel.current) return;
4089
+ const items = Array.from(panel.current.querySelectorAll(FOCUSABLE));
4090
+ if (items.length === 0) return;
4091
+ const [head, tail] = [items[0], items[items.length - 1]];
4092
+ if (e.shiftKey && document.activeElement === head) {
4093
+ e.preventDefault();
4094
+ tail.focus();
4095
+ } else if (!e.shiftKey && document.activeElement === tail) {
4096
+ e.preventDefault();
4097
+ head.focus();
4098
+ }
4099
+ };
4100
+ document.addEventListener("keydown", onKey);
4101
+ return () => {
4102
+ document.removeEventListener("keydown", onKey);
4103
+ document.body.style.overflow = overflow;
4104
+ opener?.focus?.();
4105
+ };
4106
+ }, [open]);
4107
+ if (!open || typeof document === "undefined") return null;
4108
+ return createPortal7(
4109
+ /* @__PURE__ */ jsx44(
4110
+ "div",
4111
+ {
4112
+ className: "fixed inset-0 z-modal flex items-center justify-center bg-scrim px-4 py-6",
4113
+ onMouseDown: (e) => e.target === e.currentTarget && onClose(),
4114
+ children: /* @__PURE__ */ jsxs38(
4115
+ "div",
4116
+ {
4117
+ ref: panel,
4118
+ role: "dialog",
4119
+ "aria-modal": "true",
4120
+ "aria-labelledby": titleId,
4121
+ "aria-describedby": description ? descId : void 0,
4122
+ tabIndex: -1,
4123
+ className: cn(
4124
+ "flex max-h-full w-full flex-col rounded-card border border-border-default bg-surface shadow-overlay outline-hidden",
4125
+ WIDTH[size],
4126
+ className
4127
+ ),
4128
+ children: [
4129
+ /* @__PURE__ */ jsxs38("div", { className: "flex items-start gap-3 px-5 pt-5 pb-3", children: [
4130
+ /* @__PURE__ */ jsxs38("div", { className: "min-w-0 flex-1", children: [
4131
+ /* @__PURE__ */ jsx44("h2", { id: titleId, className: "text-base font-semibold text-text-primary", children: title }),
4132
+ description && /* @__PURE__ */ jsx44("p", { id: descId, className: "mt-0.5 text-sm text-text-secondary", children: description })
4133
+ ] }),
4134
+ /* @__PURE__ */ jsx44(
4135
+ "button",
4136
+ {
4137
+ type: "button",
4138
+ onClick: onClose,
4139
+ "aria-label": "Close",
4140
+ className: "-mr-1.5 -mt-1 flex size-8 shrink-0 items-center justify-center rounded-control text-text-tertiary hover:bg-subtle hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
4141
+ children: /* @__PURE__ */ jsx44(X6, { size: 16, "aria-hidden": "true" })
4142
+ }
4143
+ )
4144
+ ] }),
4145
+ children && /* @__PURE__ */ jsx44("div", { "data-modal-body": true, className: "min-h-0 flex-1 overflow-y-auto px-5 pb-5 text-sm text-text-primary", children }),
4146
+ footer && /* @__PURE__ */ jsx44("div", { "data-modal-footer": true, className: "flex items-center justify-end gap-2 border-t border-border-default px-5 py-3", children: footer })
4147
+ ]
4148
+ }
4149
+ )
4150
+ }
4151
+ ),
4152
+ document.body
4153
+ );
4154
+ }
4155
+
4156
+ // src/EmptyState.tsx
4157
+ import { jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
4158
+ function EmptyState({ icon, title, description, action, size = "sm", className }) {
4159
+ const md = size === "md";
4160
+ return /* @__PURE__ */ jsxs39(
4161
+ "div",
4162
+ {
4163
+ className: cn(
4164
+ "flex flex-col items-center text-center",
4165
+ md ? "gap-2 px-6 py-16" : "gap-1.5 px-4 py-8",
4166
+ className
4167
+ ),
4168
+ children: [
4169
+ icon && /* @__PURE__ */ jsx45(
4170
+ "span",
4171
+ {
4172
+ "aria-hidden": "true",
4173
+ className: cn(
4174
+ "flex items-center justify-center text-text-tertiary",
4175
+ md && "mb-1 size-11 rounded-full bg-subtle"
4176
+ ),
4177
+ children: icon
4178
+ }
4179
+ ),
4180
+ /* @__PURE__ */ jsx45("p", { className: cn("font-semibold text-text-primary", md ? "text-base" : "text-sm"), children: title }),
4181
+ description && /* @__PURE__ */ jsx45("p", { className: cn("max-w-sm text-text-secondary", md ? "text-sm" : "text-xs"), children: description }),
4182
+ action && /* @__PURE__ */ jsx45("div", { className: md ? "mt-3" : "mt-2", children: action })
4183
+ ]
4184
+ }
4185
+ );
4186
+ }
4187
+
4188
+ // src/Tabs.tsx
4189
+ import { useRef as useRef16 } from "react";
4190
+ import { jsx as jsx46, jsxs as jsxs40 } from "react/jsx-runtime";
4191
+ function arrowKeys(e, row) {
4192
+ if (!row || !["ArrowLeft", "ArrowRight", "Home", "End"].includes(e.key)) return;
4193
+ const items = Array.from(row.querySelectorAll("button:not([disabled])"));
4194
+ const at = items.indexOf(document.activeElement);
4195
+ const next = e.key === "Home" ? 0 : e.key === "End" ? items.length - 1 : (at + (e.key === "ArrowRight" ? 1 : -1) + items.length) % items.length;
4196
+ e.preventDefault();
4197
+ items[next]?.focus();
4198
+ items[next]?.click();
4199
+ }
4200
+ function Tabs({ items, value, onChange, idPrefix = "tabs", className, ...rest }) {
4201
+ const row = useRef16(null);
4202
+ return /* @__PURE__ */ jsx46(
4203
+ "div",
4204
+ {
4205
+ ref: row,
4206
+ role: "tablist",
4207
+ "aria-label": rest["aria-label"],
4208
+ onKeyDown: (e) => arrowKeys(e, row.current),
4209
+ className: cn("flex gap-6 border-b border-border-default", className),
4210
+ children: items.map((item) => {
4211
+ const on = item.value === value;
4212
+ return /* @__PURE__ */ jsxs40(
4213
+ "button",
4214
+ {
4215
+ type: "button",
4216
+ role: "tab",
4217
+ id: `${idPrefix}-tab-${item.value}`,
4218
+ "aria-controls": `${idPrefix}-panel-${item.value}`,
4219
+ "aria-selected": on,
4220
+ tabIndex: on ? 0 : -1,
4221
+ disabled: item.disabled,
4222
+ onClick: () => onChange(item.value),
4223
+ className: cn(
4224
+ "-mb-px flex items-center gap-1.5 rounded-control border-b-2 pt-1 pb-2.5 text-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus disabled:opacity-50",
4225
+ on ? "border-brand-primaryAction font-semibold text-text-primary" : "border-transparent text-text-secondary hover:text-text-primary"
4226
+ ),
4227
+ children: [
4228
+ item.label,
4229
+ item.count !== void 0 && /* @__PURE__ */ jsx46("span", { className: "text-xs text-text-tertiary", children: item.count })
4230
+ ]
4231
+ },
4232
+ item.value
4233
+ );
4234
+ })
4235
+ }
4236
+ );
4237
+ }
4238
+ function SegmentedControl({
4239
+ options,
4240
+ value,
4241
+ onChange,
4242
+ size = "sm",
4243
+ className,
4244
+ ...rest
4245
+ }) {
4246
+ const row = useRef16(null);
4247
+ return /* @__PURE__ */ jsx46(
4248
+ "div",
4249
+ {
4250
+ ref: row,
4251
+ role: "radiogroup",
4252
+ "aria-label": rest["aria-label"],
4253
+ onKeyDown: (e) => arrowKeys(e, row.current),
4254
+ className: cn("inline-flex w-fit items-stretch gap-0.5 rounded-full bg-subtle p-1", size === "md" ? "h-10" : "h-8", className),
4255
+ children: options.map((o) => {
4256
+ const on = o.value === value;
4257
+ return /* @__PURE__ */ jsx46(
4258
+ "button",
4259
+ {
4260
+ type: "button",
4261
+ role: "radio",
4262
+ "aria-checked": on,
4263
+ tabIndex: on ? 0 : -1,
4264
+ onClick: () => onChange(o.value),
4265
+ className: cn(
4266
+ "rounded-full px-3 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
4267
+ size === "md" ? "text-sm" : "text-xs",
4268
+ on ? "bg-surface font-semibold text-text-primary shadow-raised" : "text-text-secondary hover:text-text-primary"
4269
+ ),
4270
+ children: o.label
4271
+ },
4272
+ o.value
4273
+ );
4274
+ })
4275
+ }
4276
+ );
4277
+ }
4278
+
4279
+ // src/TextField.tsx
4280
+ import { forwardRef as forwardRef3, useId as useId7 } from "react";
4281
+ import { jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
4282
+ var HEIGHT2 = { sm: "h-8", md: "h-10", lg: "h-11" };
4283
+ var TextField = forwardRef3(
4284
+ ({ label, hint, error, size = "md", icon, className, id, disabled, ...props }, ref) => {
4285
+ const auto = useId7();
4286
+ const fieldId = id ?? auto;
4287
+ const noteId = `${fieldId}-note`;
4288
+ const note = error ?? hint;
4289
+ return /* @__PURE__ */ jsxs41("div", { className: cn("flex flex-col gap-1.5", className), children: [
4290
+ label && /* @__PURE__ */ jsx47("label", { htmlFor: fieldId, className: "text-xs font-medium text-text-secondary", children: label }),
4291
+ /* @__PURE__ */ jsxs41(
4292
+ "div",
4293
+ {
4294
+ className: cn(
4295
+ "flex items-center gap-2 rounded-control border bg-input px-3 focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-border-focus",
4296
+ HEIGHT2[size],
4297
+ error ? "border-status-danger" : "border-border-strong",
4298
+ disabled && "opacity-50"
4299
+ ),
4300
+ children: [
4301
+ icon && /* @__PURE__ */ jsx47("span", { "aria-hidden": "true", className: "flex shrink-0 text-text-tertiary", children: icon }),
4302
+ /* @__PURE__ */ jsx47(
4303
+ "input",
4304
+ {
4305
+ ref,
4306
+ id: fieldId,
4307
+ disabled,
4308
+ "aria-invalid": error ? true : void 0,
4309
+ "aria-describedby": note ? noteId : void 0,
4310
+ className: "min-w-0 flex-1 bg-transparent text-dense text-text-primary outline-hidden placeholder:text-text-tertiary",
4311
+ ...props
4312
+ }
4313
+ )
4314
+ ]
4315
+ }
4316
+ ),
4317
+ note && /* @__PURE__ */ jsx47("p", { id: noteId, className: cn("text-xs", error ? "text-text-danger" : "text-text-tertiary"), children: note })
4318
+ ] });
4319
+ }
4320
+ );
4321
+ TextField.displayName = "TextField";
4014
4322
  export {
4015
4323
  AISpark,
4016
4324
  AdvertiserNoResults,
@@ -4028,11 +4336,13 @@ export {
4028
4336
  DateRangeFilter,
4029
4337
  DateRangePicker,
4030
4338
  Delta,
4339
+ EmptyState,
4031
4340
  FilterChipBar,
4032
4341
  FilterDropdownFooter,
4033
4342
  Freshness,
4034
4343
  InfoTip,
4035
4344
  LineChartPlaceholder,
4345
+ Modal,
4036
4346
  MultiSelectFilter,
4037
4347
  NO_RESULTS_BODY,
4038
4348
  NO_RESULTS_TITLE,
@@ -4047,6 +4357,7 @@ export {
4047
4357
  SearchBar,
4048
4358
  SectionHeading,
4049
4359
  SectionRail,
4360
+ SegmentedControl,
4050
4361
  SelectAllVisible,
4051
4362
  SelectFilter,
4052
4363
  SelectedSection,
@@ -4054,7 +4365,9 @@ export {
4054
4365
  SortButton,
4055
4366
  StackedColumnPlaceholder,
4056
4367
  TablePagination,
4368
+ Tabs,
4057
4369
  Tag,
4370
+ TextField,
4058
4371
  Toast,
4059
4372
  Toggle,
4060
4373
  Tooltip,