@mediaradar/design-components 0.60.0 → 0.62.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
@@ -3597,8 +3597,23 @@ interface DataTableProps<T, K extends string = string> extends CommonProps {
3597
3597
  renderExpanded?: (row: T) => ReactNode;
3598
3598
  /** Which rows can open. Default: every row, when `renderExpanded` is set. */
3599
3599
  canExpand?: (row: T) => boolean;
3600
- /** Names a row for the chevron's screen-reader label ("Show details for Nike"). */
3600
+ /** Names a row for the chevron's and checkbox's screen-reader labels ("Show details for Nike"). */
3601
3601
  rowLabel?: (row: T) => string;
3602
+ /**
3603
+ * Keys of the ticked rows. Set it (with `onSelectedChange`) for a checkbox
3604
+ * column at the row's start. Keep it across sort and pages; clear it when
3605
+ * filters change, since the rows may be gone.
3606
+ */
3607
+ selected?: string[];
3608
+ onSelectedChange?: (keys: string[]) => void;
3609
+ /** Every matching row, across pages: offers "Select all 1,240" once the page is ticked. */
3610
+ totalCount?: number;
3611
+ /** "Select all 1,240": the app selects every matching row. */
3612
+ onSelectAll?: () => void;
3613
+ /** The count to show when it isn't `selected.length` (after Select all). */
3614
+ selectedCount?: number;
3615
+ /** What can be done with the ticked rows (Export, Add to list): shown with the count, where the title's actions were. */
3616
+ selectionActions?: ReactNode;
3602
3617
  /** `default` for tables people read and act on; `compact` for reference data and long lists. */
3603
3618
  density?: DataTableDensity;
3604
3619
  /** Shows skeleton rows in the real columns, at the real row height. */
@@ -3656,7 +3671,7 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3656
3671
  * tracking-wider, text-text-secondary, text-right, text-dense,
3657
3672
  * text-text-primary, hover:bg-subtle, tabular-nums, rounded-full,
3658
3673
  * animate-pulse, border-t, decoration-text-tertiary, rounded-control,
3659
- * focus-visible:outline-border-focus
3674
+ * focus-visible:outline-border-focus, border-r-border-default
3660
3675
  * @behavior Sorting: a `sortable` column's header gets a SortButton; clicks
3661
3676
  * cycle the column's `firstDir`, then the reverse, then back to
3662
3677
  * `defaultSort` (`cycleSort`), and call `onSortChange`. The sorted column
@@ -3720,7 +3735,7 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3720
3735
  * />
3721
3736
  * ```
3722
3737
  */
3723
- declare function DataTable<T, K extends string = string>({ columns, rows, rowKey, title, subtitle, action, variant, titleAs, sort, onSortChange, defaultSort, renderExpanded, canExpand, rowLabel, density, loading, loadingRows, refreshing, onRetry, empty, maxHeight, footer, className, testIdPrefix, ...rest }: DataTableProps<T, K>): react.JSX.Element;
3738
+ declare function DataTable<T, K extends string = string>({ columns, rows, rowKey, title, subtitle, action, variant, titleAs, sort, onSortChange, defaultSort, renderExpanded, canExpand, rowLabel, selected, onSelectedChange, totalCount, onSelectAll, selectedCount, selectionActions, density, loading, loadingRows, refreshing, onRetry, empty, maxHeight, footer, className, testIdPrefix, ...rest }: DataTableProps<T, K>): react.JSX.Element;
3724
3739
 
3725
3740
  type MediaType = "TV" | "CTV" | "Digital" | "Social" | "Radio" | "Newspaper" | "Magazine";
3726
3741
  interface MediaLabelProps extends CommonProps {
@@ -3945,7 +3960,13 @@ interface FilterDrawerSection<Id extends string = string> {
3945
3960
  className?: string;
3946
3961
  "aria-hidden"?: boolean | "true" | "false";
3947
3962
  }>;
3948
- /** Shown on the row once the filter narrows anything: "3 selected", "Off". Empty hides it. */
3963
+ /**
3964
+ * How many picks the filter holds. Above 0 it shows as a count badge on the
3965
+ * row and beside the filter's title in its panel ("3"; screen readers hear
3966
+ * "3 selected").
3967
+ */
3968
+ count?: number;
3969
+ /** For a filter that isn't a count ("Off"): a text badge on the row instead. Ignored when `count` is above 0. */
3949
3970
  badge?: string | null;
3950
3971
  /** One line saying what the filter means; an info tip beside its name in its panel. */
3951
3972
  info?: string;
@@ -3957,7 +3978,10 @@ interface FilterDrawerProps<Id extends string = string> extends CommonProps {
3957
3978
  sections: FilterDrawerSection<Id>[];
3958
3979
  /** One filter's contents, shown when its row is opened. The page owns the draft. */
3959
3980
  renderSection: (id: Id) => ReactNode;
3960
- /** Filters narrowing anything in the draft -- the count beside the title. */
3981
+ /**
3982
+ * @deprecated No longer shown: the AllFiltersButton on the page carries the
3983
+ * total, and each row carries its own count. Kept so existing pages compile.
3984
+ */
3961
3985
  activeCount?: number;
3962
3986
  /** Empties one filter in the draft: Clear inside a filter's panel. */
3963
3987
  onClearSection: (id: Id) => void;
@@ -3980,7 +4004,10 @@ interface FilterDrawerProps<Id extends string = string> extends CommonProps {
3980
4004
  * title. The page keeps the draft and renders each filter's contents;
3981
4005
  * FilterDrawer owns the list, the navigation, the slide between the two and
3982
4006
  * the footer: Clear inside a filter; Clear all, Cancel and See
3983
- * results on the list. Opened from AllFiltersButton.
4007
+ * results on the list. Opened from AllFiltersButton, which carries the
4008
+ * total. A filter with picks shows their number as a count badge (the
4009
+ * style guide's Badge, brandSolid, count) on its row and beside its title
4010
+ * in its panel.
3984
4011
  * @tokens border-t, border-b, border-border-default, px-5, py-3.5, text-sm,
3985
4012
  * font-medium, text-text-primary, text-text-secondary, text-brand-primaryAction,
3986
4013
  * hover:bg-subtle, rounded-control, focus-visible:outline-border-focus,
@@ -4013,8 +4040,7 @@ interface FilterDrawerProps<Id extends string = string> extends CommonProps {
4013
4040
  * <FilterDrawer
4014
4041
  * open={open}
4015
4042
  * onClose={() => setOpen(false)}
4016
- * activeCount={count(draft)}
4017
- * sections={[{ id: "brand", label: "Brand", icon: Package, badge: draft.brands.length ? `${draft.brands.length} selected` : null }]}
4043
+ * sections={[{ id: "brand", label: "Brand", icon: Package, count: draft.brands.length }]}
4018
4044
  * renderSection={(id) => <BrandPicker value={draft.brands} onChange={...} />}
4019
4045
  * onClearSection={(id) => setDraft((d) => ({ ...d, [id]: [] }))}
4020
4046
  * onClearAll={() => setDraft(empty)}
@@ -4022,7 +4048,7 @@ interface FilterDrawerProps<Id extends string = string> extends CommonProps {
4022
4048
  * />
4023
4049
  * ```
4024
4050
  */
4025
- declare function FilterDrawer<Id extends string>({ open, onClose, sections, renderSection, activeCount, onClearSection, onClearAll, onApply, focus, size, testIdPrefix, }: FilterDrawerProps<Id>): react.JSX.Element;
4051
+ declare function FilterDrawer<Id extends string>({ open, onClose, sections, renderSection, activeCount: _activeCount, onClearSection, onClearAll, onApply, focus, size, testIdPrefix, }: FilterDrawerProps<Id>): react.JSX.Element;
4026
4052
 
4027
4053
  interface AllFiltersButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children">, CommonProps {
4028
4054
  /** Filters narrowing the page; the badge shows when above 0. */
package/dist/index.d.ts CHANGED
@@ -3597,8 +3597,23 @@ interface DataTableProps<T, K extends string = string> extends CommonProps {
3597
3597
  renderExpanded?: (row: T) => ReactNode;
3598
3598
  /** Which rows can open. Default: every row, when `renderExpanded` is set. */
3599
3599
  canExpand?: (row: T) => boolean;
3600
- /** Names a row for the chevron's screen-reader label ("Show details for Nike"). */
3600
+ /** Names a row for the chevron's and checkbox's screen-reader labels ("Show details for Nike"). */
3601
3601
  rowLabel?: (row: T) => string;
3602
+ /**
3603
+ * Keys of the ticked rows. Set it (with `onSelectedChange`) for a checkbox
3604
+ * column at the row's start. Keep it across sort and pages; clear it when
3605
+ * filters change, since the rows may be gone.
3606
+ */
3607
+ selected?: string[];
3608
+ onSelectedChange?: (keys: string[]) => void;
3609
+ /** Every matching row, across pages: offers "Select all 1,240" once the page is ticked. */
3610
+ totalCount?: number;
3611
+ /** "Select all 1,240": the app selects every matching row. */
3612
+ onSelectAll?: () => void;
3613
+ /** The count to show when it isn't `selected.length` (after Select all). */
3614
+ selectedCount?: number;
3615
+ /** What can be done with the ticked rows (Export, Add to list): shown with the count, where the title's actions were. */
3616
+ selectionActions?: ReactNode;
3602
3617
  /** `default` for tables people read and act on; `compact` for reference data and long lists. */
3603
3618
  density?: DataTableDensity;
3604
3619
  /** Shows skeleton rows in the real columns, at the real row height. */
@@ -3656,7 +3671,7 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3656
3671
  * tracking-wider, text-text-secondary, text-right, text-dense,
3657
3672
  * text-text-primary, hover:bg-subtle, tabular-nums, rounded-full,
3658
3673
  * animate-pulse, border-t, decoration-text-tertiary, rounded-control,
3659
- * focus-visible:outline-border-focus
3674
+ * focus-visible:outline-border-focus, border-r-border-default
3660
3675
  * @behavior Sorting: a `sortable` column's header gets a SortButton; clicks
3661
3676
  * cycle the column's `firstDir`, then the reverse, then back to
3662
3677
  * `defaultSort` (`cycleSort`), and call `onSortChange`. The sorted column
@@ -3720,7 +3735,7 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3720
3735
  * />
3721
3736
  * ```
3722
3737
  */
3723
- declare function DataTable<T, K extends string = string>({ columns, rows, rowKey, title, subtitle, action, variant, titleAs, sort, onSortChange, defaultSort, renderExpanded, canExpand, rowLabel, density, loading, loadingRows, refreshing, onRetry, empty, maxHeight, footer, className, testIdPrefix, ...rest }: DataTableProps<T, K>): react.JSX.Element;
3738
+ declare function DataTable<T, K extends string = string>({ columns, rows, rowKey, title, subtitle, action, variant, titleAs, sort, onSortChange, defaultSort, renderExpanded, canExpand, rowLabel, selected, onSelectedChange, totalCount, onSelectAll, selectedCount, selectionActions, density, loading, loadingRows, refreshing, onRetry, empty, maxHeight, footer, className, testIdPrefix, ...rest }: DataTableProps<T, K>): react.JSX.Element;
3724
3739
 
3725
3740
  type MediaType = "TV" | "CTV" | "Digital" | "Social" | "Radio" | "Newspaper" | "Magazine";
3726
3741
  interface MediaLabelProps extends CommonProps {
@@ -3945,7 +3960,13 @@ interface FilterDrawerSection<Id extends string = string> {
3945
3960
  className?: string;
3946
3961
  "aria-hidden"?: boolean | "true" | "false";
3947
3962
  }>;
3948
- /** Shown on the row once the filter narrows anything: "3 selected", "Off". Empty hides it. */
3963
+ /**
3964
+ * How many picks the filter holds. Above 0 it shows as a count badge on the
3965
+ * row and beside the filter's title in its panel ("3"; screen readers hear
3966
+ * "3 selected").
3967
+ */
3968
+ count?: number;
3969
+ /** For a filter that isn't a count ("Off"): a text badge on the row instead. Ignored when `count` is above 0. */
3949
3970
  badge?: string | null;
3950
3971
  /** One line saying what the filter means; an info tip beside its name in its panel. */
3951
3972
  info?: string;
@@ -3957,7 +3978,10 @@ interface FilterDrawerProps<Id extends string = string> extends CommonProps {
3957
3978
  sections: FilterDrawerSection<Id>[];
3958
3979
  /** One filter's contents, shown when its row is opened. The page owns the draft. */
3959
3980
  renderSection: (id: Id) => ReactNode;
3960
- /** Filters narrowing anything in the draft -- the count beside the title. */
3981
+ /**
3982
+ * @deprecated No longer shown: the AllFiltersButton on the page carries the
3983
+ * total, and each row carries its own count. Kept so existing pages compile.
3984
+ */
3961
3985
  activeCount?: number;
3962
3986
  /** Empties one filter in the draft: Clear inside a filter's panel. */
3963
3987
  onClearSection: (id: Id) => void;
@@ -3980,7 +4004,10 @@ interface FilterDrawerProps<Id extends string = string> extends CommonProps {
3980
4004
  * title. The page keeps the draft and renders each filter's contents;
3981
4005
  * FilterDrawer owns the list, the navigation, the slide between the two and
3982
4006
  * the footer: Clear inside a filter; Clear all, Cancel and See
3983
- * results on the list. Opened from AllFiltersButton.
4007
+ * results on the list. Opened from AllFiltersButton, which carries the
4008
+ * total. A filter with picks shows their number as a count badge (the
4009
+ * style guide's Badge, brandSolid, count) on its row and beside its title
4010
+ * in its panel.
3984
4011
  * @tokens border-t, border-b, border-border-default, px-5, py-3.5, text-sm,
3985
4012
  * font-medium, text-text-primary, text-text-secondary, text-brand-primaryAction,
3986
4013
  * hover:bg-subtle, rounded-control, focus-visible:outline-border-focus,
@@ -4013,8 +4040,7 @@ interface FilterDrawerProps<Id extends string = string> extends CommonProps {
4013
4040
  * <FilterDrawer
4014
4041
  * open={open}
4015
4042
  * onClose={() => setOpen(false)}
4016
- * activeCount={count(draft)}
4017
- * sections={[{ id: "brand", label: "Brand", icon: Package, badge: draft.brands.length ? `${draft.brands.length} selected` : null }]}
4043
+ * sections={[{ id: "brand", label: "Brand", icon: Package, count: draft.brands.length }]}
4018
4044
  * renderSection={(id) => <BrandPicker value={draft.brands} onChange={...} />}
4019
4045
  * onClearSection={(id) => setDraft((d) => ({ ...d, [id]: [] }))}
4020
4046
  * onClearAll={() => setDraft(empty)}
@@ -4022,7 +4048,7 @@ interface FilterDrawerProps<Id extends string = string> extends CommonProps {
4022
4048
  * />
4023
4049
  * ```
4024
4050
  */
4025
- declare function FilterDrawer<Id extends string>({ open, onClose, sections, renderSection, activeCount, onClearSection, onClearAll, onApply, focus, size, testIdPrefix, }: FilterDrawerProps<Id>): react.JSX.Element;
4051
+ declare function FilterDrawer<Id extends string>({ open, onClose, sections, renderSection, activeCount: _activeCount, onClearSection, onClearAll, onApply, focus, size, testIdPrefix, }: FilterDrawerProps<Id>): react.JSX.Element;
4026
4052
 
4027
4053
  interface AllFiltersButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children">, CommonProps {
4028
4054
  /** Filters narrowing the page; the badge shows when above 0. */