@mediaradar/design-components 0.65.0 → 0.66.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.d.cts CHANGED
@@ -3634,8 +3634,8 @@ interface DataTableHeaderMenuChoice<V = string> {
3634
3634
  }
3635
3635
  /**
3636
3636
  * Turns the name column's header into a dropdown for how the rows are built:
3637
- * what they're grouped by, what each group breaks out into, and A to Z / Z to
3638
- * A. The header reads the choices ("Subsidiary › League").
3637
+ * what they're grouped by and what each group breaks out into, side by side
3638
+ * in two columns. The header reads the choices ("Subsidiary › League").
3639
3639
  */
3640
3640
  interface DataTableHeaderMenu {
3641
3641
  /** What each row is: "Subsidiary", "Brand". One pick, required. */
@@ -3698,10 +3698,10 @@ interface DataTableColumn<T, K extends string = string> {
3698
3698
  highlight?: boolean;
3699
3699
  /**
3700
3700
  * The name column only: its header becomes a dropdown ("Subsidiary ›
3701
- * League") for what the rows are grouped by, what they break out into, and
3702
- * A to Z / Z to A. A click opens it, never sorts. Picks are staged until
3703
- * Apply, which calls each changed choice's `onChange` (the sort calls the
3704
- * table's `onSortChange`); Cancel and every other close drop them. The
3701
+ * League") for what the rows are grouped by and what they break out into,
3702
+ * in two columns. A click opens it, never sorts. Picks are staged until
3703
+ * Apply, which calls each changed choice's `onChange`; every other close
3704
+ * drops them. The
3705
3705
  * header shows the choices instead of `label`, which names the panel for
3706
3706
  * screen readers.
3707
3707
  */
@@ -3900,7 +3900,7 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3900
3900
  * always shows a thin scroll bar. A figure column's sort arrow sits before
3901
3901
  * its label, so the label ends where the figures do. The name column's
3902
3902
  * header can be a dropdown (`headerMenu`) for how the rows are grouped and
3903
- * broken out, with A to Z / Z to A.
3903
+ * broken out, in two columns.
3904
3904
  * @variant default - Default. Tables people read and act on.
3905
3905
  * @variant compact - Reference data and long lists.
3906
3906
  * @tokens rounded-card, rounded-small, border, border-border-default, bg-surface,
@@ -3984,14 +3984,14 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3984
3984
  * `headerMenu` on the name column turns its header into a quiet dropdown
3985
3985
  * trigger reading the current choices ("Subsidiary › League", a chevron
3986
3986
  * after), with a darker fill on hover and while open. A click opens a panel
3987
- * (never sorts) with menu rows in three pick-one groups: "Group rows by",
3987
+ * (never sorts) with two pick-one groups side by side, as Advertising
3988
+ * Trends' Group by (420px, a hairline between them): "Group rows by" and
3988
3989
  * "Then break out by" ("None" first, then the options; the one equal to the
3989
- * staged group-by is unavailable), and "Sort" (A to Z / Z to A, ticked when
3990
- * the table is sorted by this column; left out without `onSortChange`), and
3991
- * a FilterDropdownFooter with Cancel and Apply. Picks are staged: the ticks
3992
- * move, the table doesn't. Apply calls `onChange` only for what changed (the
3993
- * sort calls `onSortChange` with this column) and closes; with nothing
3994
- * changed it just closes. Cancel, Escape, a click outside and tabbing out
3990
+ * staged group-by is unavailable), and a FilterDropdownFooter with Apply
3991
+ * only. No sort in it: the column isn't sorted from its header. Picks are
3992
+ * staged: the ticks move, the table doesn't. Apply calls `onChange` only
3993
+ * for what changed and closes; with nothing changed it just closes. Escape,
3994
+ * a click outside and tabbing out
3995
3995
  * close it and drop the staged picks, without asking; it reopens on the
3996
3996
  * applied values. Picking a group-by equal to the break-out stages the
3997
3997
  * break-out back to None. The panel is portalled, so the frame never clips
@@ -4032,14 +4032,13 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
4032
4032
  * row or column header beside it, and colour alone says nothing to someone
4033
4033
  * who can't see it. `NoValue` reads its reason, not "dash". `loading` sets aria-busy.
4034
4034
  * The `headerMenu` trigger is a button with aria-haspopup="dialog" and
4035
- * aria-expanded (the panel holds Cancel and Apply, so it's a dialog, as
4035
+ * aria-expanded (the panel holds Apply, so it's a dialog, as
4036
4036
  * MultiSelectFilter's, not a menu); Enter, Space or the down arrow opens it
4037
4037
  * and focus moves to the first group's picked row. Each group is a
4038
4038
  * radiogroup named by its heading, its rows role="radio" with aria-checked
4039
4039
  * and one tab stop; the arrows, Home and End move the pick within a group,
4040
- * Tab goes to the next group, then Cancel and Apply. Escape, Cancel, Apply
4041
- * and tabbing past either end close it and return focus to the trigger. The
4042
- * <th> keeps aria-sort. The "›" is
4040
+ * Tab goes to the next group, then Apply. Escape, Apply and tabbing past
4041
+ * either end close it and return focus to the trigger. The "›" is
4043
4042
  * hidden from screen readers, which hear "Subsidiary then League"; the panel
4044
4043
  * is named by the column's `label`.
4045
4044
  * With `sticky`, the header copy is aria-hidden and out of the tab order
package/dist/index.d.ts CHANGED
@@ -3634,8 +3634,8 @@ interface DataTableHeaderMenuChoice<V = string> {
3634
3634
  }
3635
3635
  /**
3636
3636
  * Turns the name column's header into a dropdown for how the rows are built:
3637
- * what they're grouped by, what each group breaks out into, and A to Z / Z to
3638
- * A. The header reads the choices ("Subsidiary › League").
3637
+ * what they're grouped by and what each group breaks out into, side by side
3638
+ * in two columns. The header reads the choices ("Subsidiary › League").
3639
3639
  */
3640
3640
  interface DataTableHeaderMenu {
3641
3641
  /** What each row is: "Subsidiary", "Brand". One pick, required. */
@@ -3698,10 +3698,10 @@ interface DataTableColumn<T, K extends string = string> {
3698
3698
  highlight?: boolean;
3699
3699
  /**
3700
3700
  * The name column only: its header becomes a dropdown ("Subsidiary ›
3701
- * League") for what the rows are grouped by, what they break out into, and
3702
- * A to Z / Z to A. A click opens it, never sorts. Picks are staged until
3703
- * Apply, which calls each changed choice's `onChange` (the sort calls the
3704
- * table's `onSortChange`); Cancel and every other close drop them. The
3701
+ * League") for what the rows are grouped by and what they break out into,
3702
+ * in two columns. A click opens it, never sorts. Picks are staged until
3703
+ * Apply, which calls each changed choice's `onChange`; every other close
3704
+ * drops them. The
3705
3705
  * header shows the choices instead of `label`, which names the panel for
3706
3706
  * screen readers.
3707
3707
  */
@@ -3900,7 +3900,7 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3900
3900
  * always shows a thin scroll bar. A figure column's sort arrow sits before
3901
3901
  * its label, so the label ends where the figures do. The name column's
3902
3902
  * header can be a dropdown (`headerMenu`) for how the rows are grouped and
3903
- * broken out, with A to Z / Z to A.
3903
+ * broken out, in two columns.
3904
3904
  * @variant default - Default. Tables people read and act on.
3905
3905
  * @variant compact - Reference data and long lists.
3906
3906
  * @tokens rounded-card, rounded-small, border, border-border-default, bg-surface,
@@ -3984,14 +3984,14 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3984
3984
  * `headerMenu` on the name column turns its header into a quiet dropdown
3985
3985
  * trigger reading the current choices ("Subsidiary › League", a chevron
3986
3986
  * after), with a darker fill on hover and while open. A click opens a panel
3987
- * (never sorts) with menu rows in three pick-one groups: "Group rows by",
3987
+ * (never sorts) with two pick-one groups side by side, as Advertising
3988
+ * Trends' Group by (420px, a hairline between them): "Group rows by" and
3988
3989
  * "Then break out by" ("None" first, then the options; the one equal to the
3989
- * staged group-by is unavailable), and "Sort" (A to Z / Z to A, ticked when
3990
- * the table is sorted by this column; left out without `onSortChange`), and
3991
- * a FilterDropdownFooter with Cancel and Apply. Picks are staged: the ticks
3992
- * move, the table doesn't. Apply calls `onChange` only for what changed (the
3993
- * sort calls `onSortChange` with this column) and closes; with nothing
3994
- * changed it just closes. Cancel, Escape, a click outside and tabbing out
3990
+ * staged group-by is unavailable), and a FilterDropdownFooter with Apply
3991
+ * only. No sort in it: the column isn't sorted from its header. Picks are
3992
+ * staged: the ticks move, the table doesn't. Apply calls `onChange` only
3993
+ * for what changed and closes; with nothing changed it just closes. Escape,
3994
+ * a click outside and tabbing out
3995
3995
  * close it and drop the staged picks, without asking; it reopens on the
3996
3996
  * applied values. Picking a group-by equal to the break-out stages the
3997
3997
  * break-out back to None. The panel is portalled, so the frame never clips
@@ -4032,14 +4032,13 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
4032
4032
  * row or column header beside it, and colour alone says nothing to someone
4033
4033
  * who can't see it. `NoValue` reads its reason, not "dash". `loading` sets aria-busy.
4034
4034
  * The `headerMenu` trigger is a button with aria-haspopup="dialog" and
4035
- * aria-expanded (the panel holds Cancel and Apply, so it's a dialog, as
4035
+ * aria-expanded (the panel holds Apply, so it's a dialog, as
4036
4036
  * MultiSelectFilter's, not a menu); Enter, Space or the down arrow opens it
4037
4037
  * and focus moves to the first group's picked row. Each group is a
4038
4038
  * radiogroup named by its heading, its rows role="radio" with aria-checked
4039
4039
  * and one tab stop; the arrows, Home and End move the pick within a group,
4040
- * Tab goes to the next group, then Cancel and Apply. Escape, Cancel, Apply
4041
- * and tabbing past either end close it and return focus to the trigger. The
4042
- * <th> keeps aria-sort. The "›" is
4040
+ * Tab goes to the next group, then Apply. Escape, Apply and tabbing past
4041
+ * either end close it and return focus to the trigger. The "›" is
4043
4042
  * hidden from screen readers, which hear "Subsidiary then League"; the panel
4044
4043
  * is named by the column's `label`.
4045
4044
  * With `sticky`, the header copy is aria-hidden and out of the tab order
package/dist/index.js CHANGED
@@ -5711,6 +5711,7 @@ function RadioSection({
5711
5711
  value,
5712
5712
  onPick,
5713
5713
  first,
5714
+ className,
5714
5715
  testId
5715
5716
  }) {
5716
5717
  const id = useId10();
@@ -5726,7 +5727,7 @@ function RadioSection({
5726
5727
  const el = e.currentTarget.querySelectorAll('[role="radio"]:not([aria-disabled="true"])')[next];
5727
5728
  el?.focus();
5728
5729
  };
5729
- return /* @__PURE__ */ jsxs50(Fragment7, { children: [
5730
+ return /* @__PURE__ */ jsxs50("div", { className: cn("flex min-w-0 flex-col p-1", className), children: [
5730
5731
  /* @__PURE__ */ jsx57(MenuLabel, { id, children: label }),
5731
5732
  /* @__PURE__ */ jsx57("div", { role: "radiogroup", "aria-labelledby": id, onKeyDown: onKey, "data-testid": testId, "data-first-group": first ? "" : void 0, className: "flex flex-col", children: rows.map((r) => {
5732
5733
  const checked = r.id === value;
@@ -5758,8 +5759,6 @@ function RadioSection({
5758
5759
  function HeaderMenuTrigger({
5759
5760
  menu,
5760
5761
  columnLabel,
5761
- sortDir,
5762
- onSort,
5763
5762
  testId
5764
5763
  }) {
5765
5764
  const [open, setOpen] = useState19(false);
@@ -5771,11 +5770,9 @@ function HeaderMenuTrigger({
5771
5770
  const breakLabel = breakOutBy?.value != null ? breakOutBy.options.find((o) => o.id === breakOutBy.value)?.label : void 0;
5772
5771
  const [draftGroup, setDraftGroup] = useState19(groupBy.value);
5773
5772
  const [draftBreak, setDraftBreak] = useState19(breakOutBy?.value ?? null);
5774
- const [draftSort, setDraftSort] = useState19(sortDir);
5775
5773
  const openPanel = () => {
5776
5774
  setDraftGroup(groupBy.value);
5777
5775
  setDraftBreak(breakOutBy?.value ?? null);
5778
- setDraftSort(sortDir);
5779
5776
  setOpen(true);
5780
5777
  };
5781
5778
  const close = useCallback5((refocus) => {
@@ -5785,7 +5782,6 @@ function HeaderMenuTrigger({
5785
5782
  const apply = () => {
5786
5783
  if (draftGroup !== groupBy.value) groupBy.onChange(draftGroup);
5787
5784
  if (breakOutBy && draftBreak !== breakOutBy.value) breakOutBy.onChange(draftBreak);
5788
- if (onSort && draftSort && draftSort !== sortDir) onSort(draftSort);
5789
5785
  close(true);
5790
5786
  };
5791
5787
  const place = useCallback5(() => {
@@ -5889,9 +5885,13 @@ function HeaderMenuTrigger({
5889
5885
  "data-testid": testId && `${testId}-menu`,
5890
5886
  onKeyDown: onPanelKey,
5891
5887
  style: { position: "fixed", top: pos?.top ?? 0, left: pos?.left ?? 0, visibility: pos ? void 0 : "hidden" },
5892
- className: "z-dropdown flex max-h-120 w-60 flex-col overflow-hidden rounded-card border border-border-default bg-surface text-left normal-case tracking-normal shadow-overlay",
5888
+ className: cn(
5889
+ "z-dropdown flex max-h-120 flex-col overflow-hidden rounded-card border border-border-default bg-surface text-left normal-case tracking-normal shadow-overlay",
5890
+ // Two columns side by side, as Advertising Trends' Group by.
5891
+ breakOutBy ? "w-105" : "w-60"
5892
+ ),
5893
5893
  children: [
5894
- /* @__PURE__ */ jsxs50("div", { className: "flex min-h-0 flex-col overflow-y-auto p-1", children: [
5894
+ /* @__PURE__ */ jsxs50("div", { className: cn("grid min-h-0 overflow-y-auto", breakOutBy && "grid-cols-2"), children: [
5895
5895
  /* @__PURE__ */ jsx57(
5896
5896
  RadioSection,
5897
5897
  {
@@ -5899,38 +5899,21 @@ function HeaderMenuTrigger({
5899
5899
  label: groupBy.label ?? "Group rows by",
5900
5900
  rows: groupBy.options,
5901
5901
  value: draftGroup,
5902
- onPick: pickGroup
5902
+ onPick: pickGroup,
5903
+ className: breakOutBy ? "border-r border-border-default" : void 0
5903
5904
  }
5904
5905
  ),
5905
- breakOutBy && /* @__PURE__ */ jsxs50(Fragment7, { children: [
5906
- /* @__PURE__ */ jsx57(MenuSeparator, {}),
5907
- /* @__PURE__ */ jsx57(
5908
- RadioSection,
5909
- {
5910
- label: breakOutBy.label ?? "Then break out by",
5911
- rows: [{ id: null, label: "None" }, ...breakOutBy.options.map((o) => ({ ...o, disabled: o.id === draftGroup }))],
5912
- value: draftBreak,
5913
- onPick: setDraftBreak
5914
- }
5915
- )
5916
- ] }),
5917
- onSort && /* @__PURE__ */ jsxs50(Fragment7, { children: [
5918
- /* @__PURE__ */ jsx57(MenuSeparator, {}),
5919
- /* @__PURE__ */ jsx57(
5920
- RadioSection,
5921
- {
5922
- label: "Sort",
5923
- rows: [
5924
- { id: "asc", label: "A to Z" },
5925
- { id: "desc", label: "Z to A" }
5926
- ],
5927
- value: draftSort ?? void 0,
5928
- onPick: setDraftSort
5929
- }
5930
- )
5931
- ] })
5906
+ breakOutBy && /* @__PURE__ */ jsx57(
5907
+ RadioSection,
5908
+ {
5909
+ label: breakOutBy.label ?? "Then break out by",
5910
+ rows: [{ id: null, label: "None" }, ...breakOutBy.options.map((o) => ({ ...o, disabled: o.id === draftGroup }))],
5911
+ value: draftBreak,
5912
+ onPick: setDraftBreak
5913
+ }
5914
+ )
5932
5915
  ] }),
5933
- /* @__PURE__ */ jsx57(FilterDropdownFooter, { onCancel: () => close(true), onApply: apply })
5916
+ /* @__PURE__ */ jsx57(FilterDropdownFooter, { onApply: apply })
5934
5917
  ]
5935
5918
  }
5936
5919
  ),
@@ -6271,7 +6254,7 @@ function DataTable({
6271
6254
  {
6272
6255
  ref: !clone && ci <= nameIdx ? headRef(ci) : void 0,
6273
6256
  scope: "col",
6274
- "aria-sort": c.sortable || c.headerMenu && onSortChange ? ariaSortFor(shown, c.key) : void 0,
6257
+ "aria-sort": c.sortable && !c.headerMenu ? ariaSortFor(shown, c.key) : void 0,
6275
6258
  className: cn(
6276
6259
  "group/head whitespace-nowrap border-b border-border-default font-semibold",
6277
6260
  head,
@@ -6287,8 +6270,6 @@ function DataTable({
6287
6270
  {
6288
6271
  menu: c.headerMenu,
6289
6272
  columnLabel: c.label,
6290
- sortDir: shown?.key === c.key ? shown.dir : null,
6291
- onSort: onSortChange ? (dir) => onSortChange({ key: c.key, dir }) : void 0,
6292
6273
  testId: clone || !testIdPrefix ? void 0 : `${testIdPrefix}-header-menu-${c.key}`
6293
6274
  }
6294
6275
  ) : c.sortable && onSortChange ? /* @__PURE__ */ jsx58(