@mediaradar/design-components 0.32.0 → 0.32.1

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
@@ -122,10 +122,12 @@ interface AdvertiserQuickFilterProps {
122
122
  /** The clear link in footerless mode (unused when `showFooter` is set). */
123
123
  clearLabel?: string;
124
124
  /**
125
- * Optional prefix for `data-testid` attributes on the trigger, popover,
126
- * search input, selected-section toggle, select-all-visible row, each
127
- * option row (`${testIdPrefix}-option-<slugified-id>`), and the
128
- * Apply/Clear All footer. Omit entirely for no test-id wiring at all --
125
+ * Optional prefix for `data-testid` attributes on the trigger
126
+ * (`${testIdPrefix}-trigger`), the popover (`-popover`), the search input
127
+ * (`-search`), the selected-section toggle (`-selected-toggle`), the
128
+ * select-all-visible row (`-select-all-visible`), each option row
129
+ * (`-option-<slugified-id>`), and the footer's Clear All (`-clear-all`) and
130
+ * Apply (`-apply`). Omit entirely for no test-id wiring at all --
129
131
  * added specifically so an existing Playwright suite keyed off these ids
130
132
  * (mr-clientapps' `AdvertisersPicker`) doesn't lose its locators when
131
133
  * swapped over to this shared component.
@@ -494,7 +496,12 @@ interface DateRangeFilterProps {
494
496
  icon?: React.ReactNode;
495
497
  /** 'creativeIntel' swaps in the day-level shortcut list (Today/Yesterday/Last N days/All available history) used by that dashboard. */
496
498
  presetSet?: "default" | "creativeIntel";
497
- /** Prefix for data-testid attributes on the trigger, popover, each preset option, and Cancel/Apply. Omit for no test-id wiring. */
499
+ /**
500
+ * Prefix for `data-testid` attributes on the trigger (`${testIdPrefix}-trigger`),
501
+ * the popover (`-popover`), each preset (`-option-<slugified-label>`, e.g.
502
+ * `-option-last-7-days`), and Cancel (`-cancel`) / Apply (`-apply`). Omit for
503
+ * no test-id wiring.
504
+ */
498
505
  testIdPrefix?: string;
499
506
  /**
500
507
  * 'month' for screens whose data comes by month: every range rounds out to
@@ -575,10 +582,11 @@ interface SearchBarProps {
575
582
  onMatchChange?: (v: SearchMatchValue) => void;
576
583
  className?: string;
577
584
  /**
578
- * Optional prefix for `data-testid` attributes on the input, the
579
- * match-type trigger/popover, each mode row, and the Or/And radio pair
580
- * (e.g. `${testIdPrefix}-search`, `${testIdPrefix}-mode-trigger`,
581
- * `${testIdPrefix}-mode-anyWord`, `${testIdPrefix}-word-join-or`). Omit
585
+ * Optional prefix for `data-testid` attributes on the input
586
+ * (`${testIdPrefix}-search`), its clear button (`-clear`), the match-type
587
+ * trigger (`-mode-trigger`) and popover (`-mode-popover`), each mode row
588
+ * (`-mode-anyWord`, `-mode-exactMatch`, `-mode-contextual`, `-mode-adCode`),
589
+ * and the Or/And radio pair (`-word-join-or`, `-word-join-and`). Omit
582
590
  * entirely for no test-id wiring at all -- added specifically so an
583
591
  * existing Playwright suite keyed off these ids (mr-clientapps'
584
592
  * `KeywordSearchBar`) doesn't lose its locators when swapped over to
@@ -1252,7 +1260,7 @@ interface TooltipProps {
1252
1260
  delay?: number;
1253
1261
  /** 'surface' (default) or 'inverted' -- see the pattern description. */
1254
1262
  variant?: "surface" | "inverted";
1255
- /** Optional prefix for a `data-testid` on the floating tooltip bubble. */
1263
+ /** Optional prefix for the floating bubble's `data-testid` (`${testIdPrefix}-tooltip`). */
1256
1264
  testIdPrefix?: string;
1257
1265
  }
1258
1266
  declare function Tooltip({ label, children, anchorRef, className, whenTruncated, interactive, placement, align, delay, variant, testIdPrefix, }: TooltipProps): react.JSX.Element | null;
@@ -1312,7 +1320,7 @@ interface SelectAllVisibleProps {
1312
1320
  /** Whether every visible result is already selected. */
1313
1321
  allSelected: boolean;
1314
1322
  onToggle: () => void;
1315
- /** Optional prefix for a `data-testid` on the row. */
1323
+ /** Optional prefix for the row's `data-testid` (`${testIdPrefix}-select-all-visible`). */
1316
1324
  testIdPrefix?: string;
1317
1325
  }
1318
1326
  declare function SelectAllVisible({ count, allSelected, onToggle, testIdPrefix }: SelectAllVisibleProps): react.JSX.Element;
@@ -1349,7 +1357,7 @@ interface SelectedSectionProps {
1349
1357
  onToggle: () => void;
1350
1358
  /** The caller renders each selected row itself. */
1351
1359
  children: React.ReactNode;
1352
- /** Optional prefix for a `data-testid` on the toggle button. */
1360
+ /** Optional prefix for the toggle button's `data-testid` (`${testIdPrefix}-selected-toggle`). */
1353
1361
  testIdPrefix?: string;
1354
1362
  }
1355
1363
  declare function SelectedSection({ count, open, onToggle, children, testIdPrefix }: SelectedSectionProps): react.JSX.Element | null;
@@ -1452,8 +1460,10 @@ interface SelectionPickerProps<T extends PickerRow> {
1452
1460
  /**
1453
1461
  * Optional prefix for `data-testid` attributes on the search input
1454
1462
  * (`${testIdPrefix}-search`), the source toggle buttons
1455
- * (`${testIdPrefix}-source-search` / `-lists`), each filter dropdown
1456
- * trigger (`${testIdPrefix}-filter-<slug>`) and its options, the
1463
+ * (`${testIdPrefix}-source-search` / `${testIdPrefix}-source-lists`),
1464
+ * each filter dropdown trigger (`${testIdPrefix}-filter-<slug>`) and each
1465
+ * of its options
1466
+ * (`${testIdPrefix}-filter-<slug>-<option-slug>`), the
1457
1467
  * select-all checkbox (`${testIdPrefix}-select-all`), each row
1458
1468
  * (`${testIdPrefix}-row-<slug>`), the Load more button
1459
1469
  * (`${testIdPrefix}-load-more`), and each Account lists row/count
@@ -2167,9 +2177,11 @@ declare function TablePagination({ page, perPage, totalItems, onPageChange, onPe
2167
2177
  className?: string;
2168
2178
  /**
2169
2179
  * Optional prefix for `data-testid` attributes on the bar (`testIdPrefix`
2170
- * itself), the per-page select (`-per-page`), the step buttons (`-first`,
2171
- * `-prev`, `-next`, `-last`) and each page button (`-page-<n>`). Omit for no
2172
- * test-id wiring.
2180
+ * itself), the rows-per-page menu (a `SelectFilter`: its button
2181
+ * `-per-page-trigger`, its list `-per-page-popover` and each size
2182
+ * `-per-page-option-<n>`, e.g. `-per-page-option-50`), the step buttons
2183
+ * (`-first`, `-prev`, `-next`, `-last`) and each page button (`-page-<n>`).
2184
+ * Omit for no test-id wiring.
2173
2185
  */
2174
2186
  testIdPrefix?: string;
2175
2187
  }): react.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -122,10 +122,12 @@ interface AdvertiserQuickFilterProps {
122
122
  /** The clear link in footerless mode (unused when `showFooter` is set). */
123
123
  clearLabel?: string;
124
124
  /**
125
- * Optional prefix for `data-testid` attributes on the trigger, popover,
126
- * search input, selected-section toggle, select-all-visible row, each
127
- * option row (`${testIdPrefix}-option-<slugified-id>`), and the
128
- * Apply/Clear All footer. Omit entirely for no test-id wiring at all --
125
+ * Optional prefix for `data-testid` attributes on the trigger
126
+ * (`${testIdPrefix}-trigger`), the popover (`-popover`), the search input
127
+ * (`-search`), the selected-section toggle (`-selected-toggle`), the
128
+ * select-all-visible row (`-select-all-visible`), each option row
129
+ * (`-option-<slugified-id>`), and the footer's Clear All (`-clear-all`) and
130
+ * Apply (`-apply`). Omit entirely for no test-id wiring at all --
129
131
  * added specifically so an existing Playwright suite keyed off these ids
130
132
  * (mr-clientapps' `AdvertisersPicker`) doesn't lose its locators when
131
133
  * swapped over to this shared component.
@@ -494,7 +496,12 @@ interface DateRangeFilterProps {
494
496
  icon?: React.ReactNode;
495
497
  /** 'creativeIntel' swaps in the day-level shortcut list (Today/Yesterday/Last N days/All available history) used by that dashboard. */
496
498
  presetSet?: "default" | "creativeIntel";
497
- /** Prefix for data-testid attributes on the trigger, popover, each preset option, and Cancel/Apply. Omit for no test-id wiring. */
499
+ /**
500
+ * Prefix for `data-testid` attributes on the trigger (`${testIdPrefix}-trigger`),
501
+ * the popover (`-popover`), each preset (`-option-<slugified-label>`, e.g.
502
+ * `-option-last-7-days`), and Cancel (`-cancel`) / Apply (`-apply`). Omit for
503
+ * no test-id wiring.
504
+ */
498
505
  testIdPrefix?: string;
499
506
  /**
500
507
  * 'month' for screens whose data comes by month: every range rounds out to
@@ -575,10 +582,11 @@ interface SearchBarProps {
575
582
  onMatchChange?: (v: SearchMatchValue) => void;
576
583
  className?: string;
577
584
  /**
578
- * Optional prefix for `data-testid` attributes on the input, the
579
- * match-type trigger/popover, each mode row, and the Or/And radio pair
580
- * (e.g. `${testIdPrefix}-search`, `${testIdPrefix}-mode-trigger`,
581
- * `${testIdPrefix}-mode-anyWord`, `${testIdPrefix}-word-join-or`). Omit
585
+ * Optional prefix for `data-testid` attributes on the input
586
+ * (`${testIdPrefix}-search`), its clear button (`-clear`), the match-type
587
+ * trigger (`-mode-trigger`) and popover (`-mode-popover`), each mode row
588
+ * (`-mode-anyWord`, `-mode-exactMatch`, `-mode-contextual`, `-mode-adCode`),
589
+ * and the Or/And radio pair (`-word-join-or`, `-word-join-and`). Omit
582
590
  * entirely for no test-id wiring at all -- added specifically so an
583
591
  * existing Playwright suite keyed off these ids (mr-clientapps'
584
592
  * `KeywordSearchBar`) doesn't lose its locators when swapped over to
@@ -1252,7 +1260,7 @@ interface TooltipProps {
1252
1260
  delay?: number;
1253
1261
  /** 'surface' (default) or 'inverted' -- see the pattern description. */
1254
1262
  variant?: "surface" | "inverted";
1255
- /** Optional prefix for a `data-testid` on the floating tooltip bubble. */
1263
+ /** Optional prefix for the floating bubble's `data-testid` (`${testIdPrefix}-tooltip`). */
1256
1264
  testIdPrefix?: string;
1257
1265
  }
1258
1266
  declare function Tooltip({ label, children, anchorRef, className, whenTruncated, interactive, placement, align, delay, variant, testIdPrefix, }: TooltipProps): react.JSX.Element | null;
@@ -1312,7 +1320,7 @@ interface SelectAllVisibleProps {
1312
1320
  /** Whether every visible result is already selected. */
1313
1321
  allSelected: boolean;
1314
1322
  onToggle: () => void;
1315
- /** Optional prefix for a `data-testid` on the row. */
1323
+ /** Optional prefix for the row's `data-testid` (`${testIdPrefix}-select-all-visible`). */
1316
1324
  testIdPrefix?: string;
1317
1325
  }
1318
1326
  declare function SelectAllVisible({ count, allSelected, onToggle, testIdPrefix }: SelectAllVisibleProps): react.JSX.Element;
@@ -1349,7 +1357,7 @@ interface SelectedSectionProps {
1349
1357
  onToggle: () => void;
1350
1358
  /** The caller renders each selected row itself. */
1351
1359
  children: React.ReactNode;
1352
- /** Optional prefix for a `data-testid` on the toggle button. */
1360
+ /** Optional prefix for the toggle button's `data-testid` (`${testIdPrefix}-selected-toggle`). */
1353
1361
  testIdPrefix?: string;
1354
1362
  }
1355
1363
  declare function SelectedSection({ count, open, onToggle, children, testIdPrefix }: SelectedSectionProps): react.JSX.Element | null;
@@ -1452,8 +1460,10 @@ interface SelectionPickerProps<T extends PickerRow> {
1452
1460
  /**
1453
1461
  * Optional prefix for `data-testid` attributes on the search input
1454
1462
  * (`${testIdPrefix}-search`), the source toggle buttons
1455
- * (`${testIdPrefix}-source-search` / `-lists`), each filter dropdown
1456
- * trigger (`${testIdPrefix}-filter-<slug>`) and its options, the
1463
+ * (`${testIdPrefix}-source-search` / `${testIdPrefix}-source-lists`),
1464
+ * each filter dropdown trigger (`${testIdPrefix}-filter-<slug>`) and each
1465
+ * of its options
1466
+ * (`${testIdPrefix}-filter-<slug>-<option-slug>`), the
1457
1467
  * select-all checkbox (`${testIdPrefix}-select-all`), each row
1458
1468
  * (`${testIdPrefix}-row-<slug>`), the Load more button
1459
1469
  * (`${testIdPrefix}-load-more`), and each Account lists row/count
@@ -2167,9 +2177,11 @@ declare function TablePagination({ page, perPage, totalItems, onPageChange, onPe
2167
2177
  className?: string;
2168
2178
  /**
2169
2179
  * Optional prefix for `data-testid` attributes on the bar (`testIdPrefix`
2170
- * itself), the per-page select (`-per-page`), the step buttons (`-first`,
2171
- * `-prev`, `-next`, `-last`) and each page button (`-page-<n>`). Omit for no
2172
- * test-id wiring.
2180
+ * itself), the rows-per-page menu (a `SelectFilter`: its button
2181
+ * `-per-page-trigger`, its list `-per-page-popover` and each size
2182
+ * `-per-page-option-<n>`, e.g. `-per-page-option-50`), the step buttons
2183
+ * (`-first`, `-prev`, `-next`, `-last`) and each page button (`-page-<n>`).
2184
+ * Omit for no test-id wiring.
2173
2185
  */
2174
2186
  testIdPrefix?: string;
2175
2187
  }): react.JSX.Element;
package/dist/index.js CHANGED
@@ -4111,7 +4111,8 @@ function Modal({ open, onClose, title, description, size = "md", footer, childre
4111
4111
  useEffect14(() => {
4112
4112
  if (!open) return;
4113
4113
  const opener = document.activeElement;
4114
- const first = panel.current?.querySelector(`[data-modal-body] :is(${FOCUSABLE})`) ?? panel.current?.querySelector(`[data-modal-footer] :is(${FOCUSABLE})`);
4114
+ const firstIn = (region) => panel.current?.querySelector(region)?.querySelector(FOCUSABLE) ?? null;
4115
+ const first = firstIn("[data-modal-body]") ?? firstIn("[data-modal-footer]");
4115
4116
  (first ?? panel.current)?.focus();
4116
4117
  const overflow = document.body.style.overflow;
4117
4118
  document.body.style.overflow = "hidden";