@mediaradar/design-components 0.16.2 → 0.18.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.cjs +42 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -10
- package/dist/index.d.ts +58 -10
- package/dist/index.js +41 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -683,7 +683,8 @@ declare function SelectFilter({ caption, value, options, onChange, align, fullWi
|
|
|
683
683
|
* switches the card into a padded content layout, replacing the header/body
|
|
684
684
|
* shell mr-clientapps-insights-studio's own `CardShell` used to hand-roll.
|
|
685
685
|
* @tokens rounded-card, border-border-default, bg-surface, shadow-raised,
|
|
686
|
-
* hover:shadow-overlay, p-card-padding, text-
|
|
686
|
+
* hover:shadow-overlay, p-card-padding, text-style-card-title, text-xs,
|
|
687
|
+
* text-text-tertiary
|
|
687
688
|
* @behavior Without `title`, children render directly as the card's only
|
|
688
689
|
* content -- no padding is applied, so callers that need a full-bleed image
|
|
689
690
|
* or gradient flush against the card edge (the common case in
|
|
@@ -693,6 +694,10 @@ declare function SelectFilter({ caption, value, options, onChange, align, fullWi
|
|
|
693
694
|
* standard padding, matching `CardShell`'s layout so it can be swapped in
|
|
694
695
|
* directly. `staticCard` drops the hover-shadow transition for non-clickable
|
|
695
696
|
* content (a KPI tile, a read-only summary) -- there's nothing to respond to.
|
|
697
|
+
* @a11y With `title`, the title renders as a real heading (`titleAs`,
|
|
698
|
+
* default `h3`) so screen-reader users can jump between cards; pick the
|
|
699
|
+
* level that fits the page outline rather than one that looks right --
|
|
700
|
+
* every level is styled the same. The card itself is an `<article>`.
|
|
696
701
|
* @variant interactive - Default. Clickable/hoverable content -- deeper
|
|
697
702
|
* shadow on hover signals it responds to the cursor.
|
|
698
703
|
* @variant static - Set `staticCard`. Non-clickable content -- no hover
|
|
@@ -704,7 +709,7 @@ declare function SelectFilter({ caption, value, options, onChange, align, fullWi
|
|
|
704
709
|
* <p>Body content</p>
|
|
705
710
|
* </Card>
|
|
706
711
|
* <Card staticCard>Non-interactive content</Card>
|
|
707
|
-
* <Card title="Spend trend" subtitle="Last 90 days" action={<Link to="/spend">View all</Link>}>
|
|
712
|
+
* <Card title="Spend trend" subtitle="Last 90 days" titleAs="h2" action={<Link to="/spend">View all</Link>}>
|
|
708
713
|
* <SpendChart />
|
|
709
714
|
* </Card>
|
|
710
715
|
* ```
|
|
@@ -718,6 +723,13 @@ interface CardProps extends Omit<React.HTMLAttributes<HTMLElement>, "title"> {
|
|
|
718
723
|
* plus the card's standard content padding, matching `CardShell`.
|
|
719
724
|
*/
|
|
720
725
|
title?: string;
|
|
726
|
+
/**
|
|
727
|
+
* Heading level for `title`. Defaults to `h3`; pass `h2` where the card's
|
|
728
|
+
* title is the first heading under the page's `h1`, so the page doesn't skip
|
|
729
|
+
* a level. Only the element changes: every level looks the same
|
|
730
|
+
* (`text-style-card-title`). Ignored without `title`.
|
|
731
|
+
*/
|
|
732
|
+
titleAs?: "h2" | "h3" | "h4";
|
|
721
733
|
/** Shown under `title` in a muted tertiary color. Ignored without `title`. */
|
|
722
734
|
subtitle?: string;
|
|
723
735
|
/** Trailing header content, e.g. a "View all" link. Ignored without `title`. */
|
|
@@ -1733,6 +1745,15 @@ declare function sortProp<K extends string>(sort: SortState<K>): {
|
|
|
1733
1745
|
key: K | null;
|
|
1734
1746
|
dir: SortDir;
|
|
1735
1747
|
};
|
|
1748
|
+
/**
|
|
1749
|
+
* The `aria-sort` value for column `key`'s <th>: "ascending"/"descending" on
|
|
1750
|
+
* the active column, nothing on the rest. aria-sort belongs on the column
|
|
1751
|
+
* header, not on the SortButton inside it, and only the sorted column carries it.
|
|
1752
|
+
*/
|
|
1753
|
+
declare function ariaSortFor<K extends string>(sort: SortState<K> | {
|
|
1754
|
+
key: K | null;
|
|
1755
|
+
dir: SortDir;
|
|
1756
|
+
}, key: K): "ascending" | "descending" | undefined;
|
|
1736
1757
|
|
|
1737
1758
|
interface SortButtonProps<K extends string> {
|
|
1738
1759
|
label: string;
|
|
@@ -1745,6 +1766,15 @@ interface SortButtonProps<K extends string> {
|
|
|
1745
1766
|
onSort: (key: K) => void;
|
|
1746
1767
|
/** True when there are no rows to order — hides the arrow, drops the click. */
|
|
1747
1768
|
disabled?: boolean;
|
|
1769
|
+
/**
|
|
1770
|
+
* False renders the label alone, as plain text with no button, for a column
|
|
1771
|
+
* that can never be sorted. Unlike `disabled`, nothing about it is a control.
|
|
1772
|
+
*/
|
|
1773
|
+
sortable?: boolean;
|
|
1774
|
+
/** Matches the column's alignment, so a label that wraps lines up with the cells under it. */
|
|
1775
|
+
align?: "left" | "center" | "right";
|
|
1776
|
+
/** Optional prefix for the button's `data-testid` (`${testIdPrefix}-sort-${sortKey}`). Omit for no test-id wiring. */
|
|
1777
|
+
testIdPrefix?: string;
|
|
1748
1778
|
}
|
|
1749
1779
|
/**
|
|
1750
1780
|
* @pattern SortButton
|
|
@@ -1759,16 +1789,25 @@ interface SortButtonProps<K extends string> {
|
|
|
1759
1789
|
* standard three-state cycle — sort, reverse, then unsorted. `disabled` keeps
|
|
1760
1790
|
* the column's inherited header color rather than dimming it — the column
|
|
1761
1791
|
* isn't unavailable, there's just no data under it.
|
|
1762
|
-
*
|
|
1763
|
-
*
|
|
1764
|
-
*
|
|
1792
|
+
* `sortable={false}` renders just the label, for a column that is never
|
|
1793
|
+
* sortable; `align` matches the column's alignment.
|
|
1794
|
+
* @a11y Renders a <button> inside the <th>. The sort state is announced from
|
|
1795
|
+
* the column header, not the button: aria-sort is only valid on a
|
|
1796
|
+
* columnheader, so the caller sets it on the <th> with `ariaSortFor` (exported
|
|
1797
|
+
* alongside). It gives the active column "ascending"/"descending" and leaves
|
|
1798
|
+
* every other header without the attribute.
|
|
1765
1799
|
* @usage
|
|
1766
1800
|
* ```tsx
|
|
1767
1801
|
* const [sort, setSort] = useState<SortState<'spend'>>(null)
|
|
1768
|
-
* <
|
|
1802
|
+
* <th aria-sort={ariaSortFor(sort, 'spend')}>
|
|
1803
|
+
* <SortButton label="Spend" sortKey="spend" sort={sortProp(sort)} onSort={(k) => setSort(cycleSort(sort, k))} />
|
|
1804
|
+
* </th>
|
|
1805
|
+
* <th className="text-right" aria-sort={ariaSortFor(sort, 'units')}>
|
|
1806
|
+
* <SortButton label="Units" sortKey="units" align="right" sort={sortProp(sort)} onSort={onSort} />
|
|
1807
|
+
* </th>
|
|
1769
1808
|
* ```
|
|
1770
1809
|
*/
|
|
1771
|
-
declare function SortButton<K extends string>({ label, sortKey, sort, onSort, disabled }: SortButtonProps<K>): react.JSX.Element;
|
|
1810
|
+
declare function SortButton<K extends string>({ label, sortKey, sort, onSort, disabled, sortable, align, testIdPrefix, }: SortButtonProps<K>): react.JSX.Element;
|
|
1772
1811
|
|
|
1773
1812
|
interface PagerProps {
|
|
1774
1813
|
/** The current page, 1-indexed. */
|
|
@@ -1883,7 +1922,7 @@ declare function Tag({ children, className }: TagProps): react.JSX.Element;
|
|
|
1883
1922
|
* />
|
|
1884
1923
|
* ```
|
|
1885
1924
|
*/
|
|
1886
|
-
declare function TablePagination({ page, perPage, totalItems, onPageChange, onPerPageChange, perPageOptions, itemLabel, className, }: {
|
|
1925
|
+
declare function TablePagination({ page, perPage, totalItems, onPageChange, onPerPageChange, perPageOptions, itemLabel, className, testIdPrefix, }: {
|
|
1887
1926
|
page: number;
|
|
1888
1927
|
perPage: number;
|
|
1889
1928
|
totalItems: number;
|
|
@@ -1892,6 +1931,13 @@ declare function TablePagination({ page, perPage, totalItems, onPageChange, onPe
|
|
|
1892
1931
|
perPageOptions?: number[];
|
|
1893
1932
|
itemLabel?: string;
|
|
1894
1933
|
className?: string;
|
|
1934
|
+
/**
|
|
1935
|
+
* Optional prefix for `data-testid` attributes on the bar (`testIdPrefix`
|
|
1936
|
+
* itself), the per-page select (`-per-page`), the step buttons (`-first`,
|
|
1937
|
+
* `-prev`, `-next`, `-last`) and each page button (`-page-<n>`). Omit for no
|
|
1938
|
+
* test-id wiring.
|
|
1939
|
+
*/
|
|
1940
|
+
testIdPrefix?: string;
|
|
1895
1941
|
}): react.JSX.Element;
|
|
1896
1942
|
type TablePaginationProps = Parameters<typeof TablePagination>[0];
|
|
1897
1943
|
|
|
@@ -2041,6 +2087,8 @@ interface ToggleProps {
|
|
|
2041
2087
|
disabled?: boolean;
|
|
2042
2088
|
/** Extra classes merged onto the track (the outer `<button>`). */
|
|
2043
2089
|
className?: string;
|
|
2090
|
+
/** Optional prefix for the switch's `data-testid` (`${testIdPrefix}-toggle`). Omit for no test-id wiring. */
|
|
2091
|
+
testIdPrefix?: string;
|
|
2044
2092
|
}
|
|
2045
2093
|
/**
|
|
2046
2094
|
* @pattern Toggle
|
|
@@ -2069,7 +2117,7 @@ interface ToggleProps {
|
|
|
2069
2117
|
* <Toggle size="sm" checked={enabled} onChange={setEnabled} label="Only include enriched creatives" />
|
|
2070
2118
|
* ```
|
|
2071
2119
|
*/
|
|
2072
|
-
declare function Toggle({ checked, onChange, label, size, disabled, className }: ToggleProps): react.JSX.Element;
|
|
2120
|
+
declare function Toggle({ checked, onChange, label, size, disabled, className, testIdPrefix }: ToggleProps): react.JSX.Element;
|
|
2073
2121
|
|
|
2074
2122
|
interface AISparkProps {
|
|
2075
2123
|
size?: number;
|
|
@@ -2108,4 +2156,4 @@ interface FreshnessProps {
|
|
|
2108
2156
|
*/
|
|
2109
2157
|
declare function Freshness({ level }: FreshnessProps): react.JSX.Element;
|
|
2110
2158
|
|
|
2111
|
-
export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionRail, type SectionRailProps, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, type SummaryGroup, type SummaryGroupItemValue, TablePagination, type TablePaginationProps, Tag, type TagProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
|
|
2159
|
+
export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionRail, type SectionRailProps, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, type SummaryGroup, type SummaryGroupItemValue, TablePagination, type TablePaginationProps, Tag, type TagProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
|
package/dist/index.d.ts
CHANGED
|
@@ -683,7 +683,8 @@ declare function SelectFilter({ caption, value, options, onChange, align, fullWi
|
|
|
683
683
|
* switches the card into a padded content layout, replacing the header/body
|
|
684
684
|
* shell mr-clientapps-insights-studio's own `CardShell` used to hand-roll.
|
|
685
685
|
* @tokens rounded-card, border-border-default, bg-surface, shadow-raised,
|
|
686
|
-
* hover:shadow-overlay, p-card-padding, text-
|
|
686
|
+
* hover:shadow-overlay, p-card-padding, text-style-card-title, text-xs,
|
|
687
|
+
* text-text-tertiary
|
|
687
688
|
* @behavior Without `title`, children render directly as the card's only
|
|
688
689
|
* content -- no padding is applied, so callers that need a full-bleed image
|
|
689
690
|
* or gradient flush against the card edge (the common case in
|
|
@@ -693,6 +694,10 @@ declare function SelectFilter({ caption, value, options, onChange, align, fullWi
|
|
|
693
694
|
* standard padding, matching `CardShell`'s layout so it can be swapped in
|
|
694
695
|
* directly. `staticCard` drops the hover-shadow transition for non-clickable
|
|
695
696
|
* content (a KPI tile, a read-only summary) -- there's nothing to respond to.
|
|
697
|
+
* @a11y With `title`, the title renders as a real heading (`titleAs`,
|
|
698
|
+
* default `h3`) so screen-reader users can jump between cards; pick the
|
|
699
|
+
* level that fits the page outline rather than one that looks right --
|
|
700
|
+
* every level is styled the same. The card itself is an `<article>`.
|
|
696
701
|
* @variant interactive - Default. Clickable/hoverable content -- deeper
|
|
697
702
|
* shadow on hover signals it responds to the cursor.
|
|
698
703
|
* @variant static - Set `staticCard`. Non-clickable content -- no hover
|
|
@@ -704,7 +709,7 @@ declare function SelectFilter({ caption, value, options, onChange, align, fullWi
|
|
|
704
709
|
* <p>Body content</p>
|
|
705
710
|
* </Card>
|
|
706
711
|
* <Card staticCard>Non-interactive content</Card>
|
|
707
|
-
* <Card title="Spend trend" subtitle="Last 90 days" action={<Link to="/spend">View all</Link>}>
|
|
712
|
+
* <Card title="Spend trend" subtitle="Last 90 days" titleAs="h2" action={<Link to="/spend">View all</Link>}>
|
|
708
713
|
* <SpendChart />
|
|
709
714
|
* </Card>
|
|
710
715
|
* ```
|
|
@@ -718,6 +723,13 @@ interface CardProps extends Omit<React.HTMLAttributes<HTMLElement>, "title"> {
|
|
|
718
723
|
* plus the card's standard content padding, matching `CardShell`.
|
|
719
724
|
*/
|
|
720
725
|
title?: string;
|
|
726
|
+
/**
|
|
727
|
+
* Heading level for `title`. Defaults to `h3`; pass `h2` where the card's
|
|
728
|
+
* title is the first heading under the page's `h1`, so the page doesn't skip
|
|
729
|
+
* a level. Only the element changes: every level looks the same
|
|
730
|
+
* (`text-style-card-title`). Ignored without `title`.
|
|
731
|
+
*/
|
|
732
|
+
titleAs?: "h2" | "h3" | "h4";
|
|
721
733
|
/** Shown under `title` in a muted tertiary color. Ignored without `title`. */
|
|
722
734
|
subtitle?: string;
|
|
723
735
|
/** Trailing header content, e.g. a "View all" link. Ignored without `title`. */
|
|
@@ -1733,6 +1745,15 @@ declare function sortProp<K extends string>(sort: SortState<K>): {
|
|
|
1733
1745
|
key: K | null;
|
|
1734
1746
|
dir: SortDir;
|
|
1735
1747
|
};
|
|
1748
|
+
/**
|
|
1749
|
+
* The `aria-sort` value for column `key`'s <th>: "ascending"/"descending" on
|
|
1750
|
+
* the active column, nothing on the rest. aria-sort belongs on the column
|
|
1751
|
+
* header, not on the SortButton inside it, and only the sorted column carries it.
|
|
1752
|
+
*/
|
|
1753
|
+
declare function ariaSortFor<K extends string>(sort: SortState<K> | {
|
|
1754
|
+
key: K | null;
|
|
1755
|
+
dir: SortDir;
|
|
1756
|
+
}, key: K): "ascending" | "descending" | undefined;
|
|
1736
1757
|
|
|
1737
1758
|
interface SortButtonProps<K extends string> {
|
|
1738
1759
|
label: string;
|
|
@@ -1745,6 +1766,15 @@ interface SortButtonProps<K extends string> {
|
|
|
1745
1766
|
onSort: (key: K) => void;
|
|
1746
1767
|
/** True when there are no rows to order — hides the arrow, drops the click. */
|
|
1747
1768
|
disabled?: boolean;
|
|
1769
|
+
/**
|
|
1770
|
+
* False renders the label alone, as plain text with no button, for a column
|
|
1771
|
+
* that can never be sorted. Unlike `disabled`, nothing about it is a control.
|
|
1772
|
+
*/
|
|
1773
|
+
sortable?: boolean;
|
|
1774
|
+
/** Matches the column's alignment, so a label that wraps lines up with the cells under it. */
|
|
1775
|
+
align?: "left" | "center" | "right";
|
|
1776
|
+
/** Optional prefix for the button's `data-testid` (`${testIdPrefix}-sort-${sortKey}`). Omit for no test-id wiring. */
|
|
1777
|
+
testIdPrefix?: string;
|
|
1748
1778
|
}
|
|
1749
1779
|
/**
|
|
1750
1780
|
* @pattern SortButton
|
|
@@ -1759,16 +1789,25 @@ interface SortButtonProps<K extends string> {
|
|
|
1759
1789
|
* standard three-state cycle — sort, reverse, then unsorted. `disabled` keeps
|
|
1760
1790
|
* the column's inherited header color rather than dimming it — the column
|
|
1761
1791
|
* isn't unavailable, there's just no data under it.
|
|
1762
|
-
*
|
|
1763
|
-
*
|
|
1764
|
-
*
|
|
1792
|
+
* `sortable={false}` renders just the label, for a column that is never
|
|
1793
|
+
* sortable; `align` matches the column's alignment.
|
|
1794
|
+
* @a11y Renders a <button> inside the <th>. The sort state is announced from
|
|
1795
|
+
* the column header, not the button: aria-sort is only valid on a
|
|
1796
|
+
* columnheader, so the caller sets it on the <th> with `ariaSortFor` (exported
|
|
1797
|
+
* alongside). It gives the active column "ascending"/"descending" and leaves
|
|
1798
|
+
* every other header without the attribute.
|
|
1765
1799
|
* @usage
|
|
1766
1800
|
* ```tsx
|
|
1767
1801
|
* const [sort, setSort] = useState<SortState<'spend'>>(null)
|
|
1768
|
-
* <
|
|
1802
|
+
* <th aria-sort={ariaSortFor(sort, 'spend')}>
|
|
1803
|
+
* <SortButton label="Spend" sortKey="spend" sort={sortProp(sort)} onSort={(k) => setSort(cycleSort(sort, k))} />
|
|
1804
|
+
* </th>
|
|
1805
|
+
* <th className="text-right" aria-sort={ariaSortFor(sort, 'units')}>
|
|
1806
|
+
* <SortButton label="Units" sortKey="units" align="right" sort={sortProp(sort)} onSort={onSort} />
|
|
1807
|
+
* </th>
|
|
1769
1808
|
* ```
|
|
1770
1809
|
*/
|
|
1771
|
-
declare function SortButton<K extends string>({ label, sortKey, sort, onSort, disabled }: SortButtonProps<K>): react.JSX.Element;
|
|
1810
|
+
declare function SortButton<K extends string>({ label, sortKey, sort, onSort, disabled, sortable, align, testIdPrefix, }: SortButtonProps<K>): react.JSX.Element;
|
|
1772
1811
|
|
|
1773
1812
|
interface PagerProps {
|
|
1774
1813
|
/** The current page, 1-indexed. */
|
|
@@ -1883,7 +1922,7 @@ declare function Tag({ children, className }: TagProps): react.JSX.Element;
|
|
|
1883
1922
|
* />
|
|
1884
1923
|
* ```
|
|
1885
1924
|
*/
|
|
1886
|
-
declare function TablePagination({ page, perPage, totalItems, onPageChange, onPerPageChange, perPageOptions, itemLabel, className, }: {
|
|
1925
|
+
declare function TablePagination({ page, perPage, totalItems, onPageChange, onPerPageChange, perPageOptions, itemLabel, className, testIdPrefix, }: {
|
|
1887
1926
|
page: number;
|
|
1888
1927
|
perPage: number;
|
|
1889
1928
|
totalItems: number;
|
|
@@ -1892,6 +1931,13 @@ declare function TablePagination({ page, perPage, totalItems, onPageChange, onPe
|
|
|
1892
1931
|
perPageOptions?: number[];
|
|
1893
1932
|
itemLabel?: string;
|
|
1894
1933
|
className?: string;
|
|
1934
|
+
/**
|
|
1935
|
+
* Optional prefix for `data-testid` attributes on the bar (`testIdPrefix`
|
|
1936
|
+
* itself), the per-page select (`-per-page`), the step buttons (`-first`,
|
|
1937
|
+
* `-prev`, `-next`, `-last`) and each page button (`-page-<n>`). Omit for no
|
|
1938
|
+
* test-id wiring.
|
|
1939
|
+
*/
|
|
1940
|
+
testIdPrefix?: string;
|
|
1895
1941
|
}): react.JSX.Element;
|
|
1896
1942
|
type TablePaginationProps = Parameters<typeof TablePagination>[0];
|
|
1897
1943
|
|
|
@@ -2041,6 +2087,8 @@ interface ToggleProps {
|
|
|
2041
2087
|
disabled?: boolean;
|
|
2042
2088
|
/** Extra classes merged onto the track (the outer `<button>`). */
|
|
2043
2089
|
className?: string;
|
|
2090
|
+
/** Optional prefix for the switch's `data-testid` (`${testIdPrefix}-toggle`). Omit for no test-id wiring. */
|
|
2091
|
+
testIdPrefix?: string;
|
|
2044
2092
|
}
|
|
2045
2093
|
/**
|
|
2046
2094
|
* @pattern Toggle
|
|
@@ -2069,7 +2117,7 @@ interface ToggleProps {
|
|
|
2069
2117
|
* <Toggle size="sm" checked={enabled} onChange={setEnabled} label="Only include enriched creatives" />
|
|
2070
2118
|
* ```
|
|
2071
2119
|
*/
|
|
2072
|
-
declare function Toggle({ checked, onChange, label, size, disabled, className }: ToggleProps): react.JSX.Element;
|
|
2120
|
+
declare function Toggle({ checked, onChange, label, size, disabled, className, testIdPrefix }: ToggleProps): react.JSX.Element;
|
|
2073
2121
|
|
|
2074
2122
|
interface AISparkProps {
|
|
2075
2123
|
size?: number;
|
|
@@ -2108,4 +2156,4 @@ interface FreshnessProps {
|
|
|
2108
2156
|
*/
|
|
2109
2157
|
declare function Freshness({ level }: FreshnessProps): react.JSX.Element;
|
|
2110
2158
|
|
|
2111
|
-
export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionRail, type SectionRailProps, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, type SummaryGroup, type SummaryGroupItemValue, TablePagination, type TablePaginationProps, Tag, type TagProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
|
|
2159
|
+
export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionRail, type SectionRailProps, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, type SummaryGroup, type SummaryGroupItemValue, TablePagination, type TablePaginationProps, Tag, type TagProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
|
package/dist/index.js
CHANGED
|
@@ -1485,7 +1485,7 @@ function SelectFilter({
|
|
|
1485
1485
|
// src/Card.tsx
|
|
1486
1486
|
import { forwardRef } from "react";
|
|
1487
1487
|
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1488
|
-
var Card = forwardRef(function Card2({ staticCard, title, subtitle, action, className, children, ...rest }, ref) {
|
|
1488
|
+
var Card = forwardRef(function Card2({ staticCard, title, titleAs: TitleTag = "h3", subtitle, action, className, children, ...rest }, ref) {
|
|
1489
1489
|
return /* @__PURE__ */ jsx12(
|
|
1490
1490
|
"article",
|
|
1491
1491
|
{
|
|
@@ -1500,8 +1500,8 @@ var Card = forwardRef(function Card2({ staticCard, title, subtitle, action, clas
|
|
|
1500
1500
|
children: title ? /* @__PURE__ */ jsxs11("div", { className: "flex flex-1 flex-col p-card-padding", children: [
|
|
1501
1501
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-start justify-between gap-2", children: [
|
|
1502
1502
|
/* @__PURE__ */ jsxs11("div", { children: [
|
|
1503
|
-
/* @__PURE__ */ jsx12(
|
|
1504
|
-
subtitle && /* @__PURE__ */ jsx12("p", { className: "mt-0.5 text-
|
|
1503
|
+
/* @__PURE__ */ jsx12(TitleTag, { className: "text-style-card-title", children: title }),
|
|
1504
|
+
subtitle && /* @__PURE__ */ jsx12("p", { className: "mt-0.5 text-xs leading-snug text-text-tertiary", children: subtitle })
|
|
1505
1505
|
] }),
|
|
1506
1506
|
action && /* @__PURE__ */ jsx12("div", { className: "shrink-0 text-text-tertiary", children: action })
|
|
1507
1507
|
] }),
|
|
@@ -3023,7 +3023,22 @@ function Chip({
|
|
|
3023
3023
|
// src/SortButton.tsx
|
|
3024
3024
|
import { ArrowUp, ArrowDown, ArrowUpDown } from "lucide-react";
|
|
3025
3025
|
import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3026
|
-
|
|
3026
|
+
var ALIGN = {
|
|
3027
|
+
left: "justify-start text-left",
|
|
3028
|
+
center: "justify-center text-center",
|
|
3029
|
+
right: "justify-end text-right"
|
|
3030
|
+
};
|
|
3031
|
+
function SortButton({
|
|
3032
|
+
label,
|
|
3033
|
+
sortKey,
|
|
3034
|
+
sort,
|
|
3035
|
+
onSort,
|
|
3036
|
+
disabled = false,
|
|
3037
|
+
sortable = true,
|
|
3038
|
+
align = "left",
|
|
3039
|
+
testIdPrefix
|
|
3040
|
+
}) {
|
|
3041
|
+
if (!sortable) return /* @__PURE__ */ jsx31("span", { className: cn("inline-flex", ALIGN[align]), children: label });
|
|
3027
3042
|
const active = !disabled && sort.key === sortKey;
|
|
3028
3043
|
return /* @__PURE__ */ jsxs29(
|
|
3029
3044
|
"button",
|
|
@@ -3031,9 +3046,9 @@ function SortButton({ label, sortKey, sort, onSort, disabled = false }) {
|
|
|
3031
3046
|
type: "button",
|
|
3032
3047
|
disabled,
|
|
3033
3048
|
onClick: () => onSort(sortKey),
|
|
3034
|
-
"
|
|
3049
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-sort-${sortKey}`,
|
|
3035
3050
|
className: cn(
|
|
3036
|
-
// text
|
|
3051
|
+
// ALIGN's text-* overrides the UA default on <button>, which would centre a
|
|
3037
3052
|
// label that wraps onto two lines, out of step with the column under it.
|
|
3038
3053
|
// `uppercase` is NOT this control imposing a treatment -- it is
|
|
3039
3054
|
// restoring one. Every table header row sets uppercase on the <tr>,
|
|
@@ -3048,15 +3063,17 @@ function SortButton({ label, sortKey, sort, onSort, disabled = false }) {
|
|
|
3048
3063
|
// subtly tighter than the fixed headers next to them. A control
|
|
3049
3064
|
// should carry exactly the properties that do not inherit, and
|
|
3050
3065
|
// nothing more.
|
|
3051
|
-
"group inline-flex items-center gap-1
|
|
3066
|
+
"group inline-flex items-center gap-1 uppercase transition-colors",
|
|
3067
|
+
ALIGN[align],
|
|
3052
3068
|
!disabled && "hover:text-text-primary"
|
|
3053
3069
|
),
|
|
3054
3070
|
children: [
|
|
3055
3071
|
label,
|
|
3056
|
-
!disabled && (active ? sort.dir === "asc" ? /* @__PURE__ */ jsx31(ArrowUp, { size: 12, className: "shrink-0 text-brand-primaryAction" }) : /* @__PURE__ */ jsx31(ArrowDown, { size: 12, className: "shrink-0 text-brand-primaryAction" }) : /* @__PURE__ */ jsx31(
|
|
3072
|
+
!disabled && (active ? sort.dir === "asc" ? /* @__PURE__ */ jsx31(ArrowUp, { size: 12, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }) : /* @__PURE__ */ jsx31(ArrowDown, { size: 12, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }) : /* @__PURE__ */ jsx31(
|
|
3057
3073
|
ArrowUpDown,
|
|
3058
3074
|
{
|
|
3059
3075
|
size: 12,
|
|
3076
|
+
"aria-hidden": "true",
|
|
3060
3077
|
className: "shrink-0 text-text-tertiary opacity-50 transition-opacity group-hover:opacity-100"
|
|
3061
3078
|
}
|
|
3062
3079
|
))
|
|
@@ -3074,6 +3091,10 @@ function cycleSort(current, key, firstDir = "desc") {
|
|
|
3074
3091
|
function sortProp(sort) {
|
|
3075
3092
|
return sort ?? { key: null, dir: "desc" };
|
|
3076
3093
|
}
|
|
3094
|
+
function ariaSortFor(sort, key) {
|
|
3095
|
+
if (!sort || sort.key !== key) return void 0;
|
|
3096
|
+
return sort.dir === "asc" ? "ascending" : "descending";
|
|
3097
|
+
}
|
|
3077
3098
|
|
|
3078
3099
|
// src/Pager.tsx
|
|
3079
3100
|
import { ChevronLeft as ChevronLeft3, ChevronRight as ChevronRight4 } from "lucide-react";
|
|
@@ -3197,7 +3218,8 @@ function TablePagination({
|
|
|
3197
3218
|
onPerPageChange,
|
|
3198
3219
|
perPageOptions = [25, 50, 100],
|
|
3199
3220
|
itemLabel = "results",
|
|
3200
|
-
className
|
|
3221
|
+
className,
|
|
3222
|
+
testIdPrefix
|
|
3201
3223
|
}) {
|
|
3202
3224
|
const totalPages = Math.max(1, Math.ceil(totalItems / perPage));
|
|
3203
3225
|
const current = Math.min(page, totalPages);
|
|
@@ -3208,7 +3230,7 @@ function TablePagination({
|
|
|
3208
3230
|
btn,
|
|
3209
3231
|
"text-text-secondary hover:bg-subtle hover:text-text-primary disabled:pointer-events-none disabled:opacity-30"
|
|
3210
3232
|
);
|
|
3211
|
-
return /* @__PURE__ */ jsxs31("div", { className: cn("flex flex-wrap items-center justify-between gap-x-4 gap-y-2", className), children: [
|
|
3233
|
+
return /* @__PURE__ */ jsxs31("div", { className: cn("flex flex-wrap items-center justify-between gap-x-4 gap-y-2", className), "data-testid": testIdPrefix, children: [
|
|
3212
3234
|
/* @__PURE__ */ jsxs31("label", { className: "flex items-center gap-2 text-[13px] text-text-secondary", children: [
|
|
3213
3235
|
/* @__PURE__ */ jsxs31("span", { className: "relative", children: [
|
|
3214
3236
|
/* @__PURE__ */ jsx35(
|
|
@@ -3217,6 +3239,7 @@ function TablePagination({
|
|
|
3217
3239
|
value: perPage,
|
|
3218
3240
|
onChange: (e) => onPerPageChange(Number(e.target.value)),
|
|
3219
3241
|
"aria-label": "Items per page",
|
|
3242
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-per-page`,
|
|
3220
3243
|
className: "appearance-none rounded-control border border-border-default 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",
|
|
3221
3244
|
children: perPageOptions.map((n) => /* @__PURE__ */ jsx35("option", { value: n, children: n }, n))
|
|
3222
3245
|
}
|
|
@@ -3240,6 +3263,7 @@ function TablePagination({
|
|
|
3240
3263
|
onClick: () => onPageChange(1),
|
|
3241
3264
|
disabled: current === 1,
|
|
3242
3265
|
"aria-label": "First page",
|
|
3266
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-first`,
|
|
3243
3267
|
className: stepBtn,
|
|
3244
3268
|
children: /* @__PURE__ */ jsx35(ChevronFirst, { size: 16, "aria-hidden": "true" })
|
|
3245
3269
|
}
|
|
@@ -3251,6 +3275,7 @@ function TablePagination({
|
|
|
3251
3275
|
onClick: () => onPageChange(current - 1),
|
|
3252
3276
|
disabled: current === 1,
|
|
3253
3277
|
"aria-label": "Previous page",
|
|
3278
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-prev`,
|
|
3254
3279
|
className: stepBtn,
|
|
3255
3280
|
children: /* @__PURE__ */ jsx35(ChevronLeft4, { size: 16, "aria-hidden": "true" })
|
|
3256
3281
|
}
|
|
@@ -3260,6 +3285,7 @@ function TablePagination({
|
|
|
3260
3285
|
"button",
|
|
3261
3286
|
{
|
|
3262
3287
|
type: "button",
|
|
3288
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-page-${p}`,
|
|
3263
3289
|
onClick: () => onPageChange(p),
|
|
3264
3290
|
"aria-current": p === current ? "page" : void 0,
|
|
3265
3291
|
className: cn(
|
|
@@ -3278,6 +3304,7 @@ function TablePagination({
|
|
|
3278
3304
|
onClick: () => onPageChange(current + 1),
|
|
3279
3305
|
disabled: current === totalPages,
|
|
3280
3306
|
"aria-label": "Next page",
|
|
3307
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-next`,
|
|
3281
3308
|
className: stepBtn,
|
|
3282
3309
|
children: /* @__PURE__ */ jsx35(ChevronRight5, { size: 16, "aria-hidden": "true" })
|
|
3283
3310
|
}
|
|
@@ -3289,6 +3316,7 @@ function TablePagination({
|
|
|
3289
3316
|
onClick: () => onPageChange(totalPages),
|
|
3290
3317
|
disabled: current === totalPages,
|
|
3291
3318
|
"aria-label": "Last page",
|
|
3319
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-last`,
|
|
3292
3320
|
className: stepBtn,
|
|
3293
3321
|
children: /* @__PURE__ */ jsx35(ChevronLast, { size: 16, "aria-hidden": "true" })
|
|
3294
3322
|
}
|
|
@@ -3730,7 +3758,7 @@ var SIZES2 = {
|
|
|
3730
3758
|
sm: { track: "h-5 w-9", knob: "h-4 w-4", on: "translate-x-[18px]" },
|
|
3731
3759
|
md: { track: "h-6 w-11", knob: "h-5 w-5", on: "translate-x-[22px]" }
|
|
3732
3760
|
};
|
|
3733
|
-
function Toggle({ checked, onChange, label, size = "md", disabled, className }) {
|
|
3761
|
+
function Toggle({ checked, onChange, label, size = "md", disabled, className, testIdPrefix }) {
|
|
3734
3762
|
const s = SIZES2[size];
|
|
3735
3763
|
return /* @__PURE__ */ jsx38(
|
|
3736
3764
|
"button",
|
|
@@ -3740,6 +3768,7 @@ function Toggle({ checked, onChange, label, size = "md", disabled, className })
|
|
|
3740
3768
|
"aria-checked": checked,
|
|
3741
3769
|
"aria-label": label,
|
|
3742
3770
|
disabled,
|
|
3771
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-toggle`,
|
|
3743
3772
|
onClick: () => onChange(!checked),
|
|
3744
3773
|
className: cn(
|
|
3745
3774
|
"relative inline-flex shrink-0 items-center rounded-full transition-colors focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
@@ -3845,6 +3874,7 @@ export {
|
|
|
3845
3874
|
Tooltip,
|
|
3846
3875
|
WorkspaceAvatar,
|
|
3847
3876
|
WorkspaceSelectedCard,
|
|
3877
|
+
ariaSortFor,
|
|
3848
3878
|
buttonVariants,
|
|
3849
3879
|
chipTriggerClass,
|
|
3850
3880
|
cycleSort,
|