@mediaradar/design-components 0.8.0 → 0.9.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 +50 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +85 -10
- package/dist/index.d.ts +85 -10
- package/dist/index.js +49 -25
- package/dist/index.js.map +1 -1
- package/package.json +63 -63
package/dist/index.d.cts
CHANGED
|
@@ -145,7 +145,8 @@ declare function AdvertiserSearchPrompt({ label }: AdvertiserSearchPromptProps):
|
|
|
145
145
|
* `<input type="checkbox">`), so it can carry an indeterminate "some but not
|
|
146
146
|
* all" state without the native element's limited styling hooks. Designed to
|
|
147
147
|
* be dropped into a row that already has its own click-to-toggle handler
|
|
148
|
-
* (a common list/table pattern) without double-firing.
|
|
148
|
+
* (a common list/table pattern) without double-firing. Where the row itself
|
|
149
|
+
* is the control, use `CheckBoxBox` instead.
|
|
149
150
|
* @tokens bg-brand-primaryAction, border-border-interactive, bg-input,
|
|
150
151
|
* hover:border-brand-primaryAction, focus-visible:outline-border-focus
|
|
151
152
|
* @dependencies lucide-react
|
|
@@ -155,8 +156,9 @@ declare function AdvertiserSearchPrompt({ label }: AdvertiserSearchPromptProps):
|
|
|
155
156
|
* unchecked state previews the brand action color on hover, matching the
|
|
156
157
|
* color the box fills with once checked -- the hover state is a preview of
|
|
157
158
|
* the click's effect, not an unrelated highlight. `onClick` calls
|
|
158
|
-
* `stopPropagation` before firing `onChange
|
|
159
|
-
* that toggles on its own click can't fire the toggle twice
|
|
159
|
+
* `stopPropagation` before firing `onChange` by default, so nesting this
|
|
160
|
+
* inside a row that toggles on its own click can't fire the toggle twice;
|
|
161
|
+
* pass `stopPropagation={false}` where the row should also see the click.
|
|
160
162
|
* @usage
|
|
161
163
|
* ```tsx
|
|
162
164
|
* <CheckBox checked={selected} ariaLabel="Select row" onChange={toggle} />
|
|
@@ -165,6 +167,7 @@ declare function AdvertiserSearchPrompt({ label }: AdvertiserSearchPromptProps):
|
|
|
165
167
|
* ```
|
|
166
168
|
*/
|
|
167
169
|
interface CheckBoxProps {
|
|
170
|
+
/** Whether the box is checked. Controlled: the parent owns this value. */
|
|
168
171
|
checked: boolean;
|
|
169
172
|
/**
|
|
170
173
|
* Some-but-not-all state for a "select all" checkbox -- shows a dash
|
|
@@ -172,10 +175,23 @@ interface CheckBoxProps {
|
|
|
172
175
|
* plain boolean.
|
|
173
176
|
*/
|
|
174
177
|
indeterminate?: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Called on click with no argument -- flip `checked` yourself. By default
|
|
180
|
+
* the click doesn't bubble, so a row that toggles on its own click won't
|
|
181
|
+
* fire twice.
|
|
182
|
+
*/
|
|
175
183
|
onChange: () => void;
|
|
176
184
|
/** Accessible label -- required since the control carries no visible text of its own. */
|
|
177
185
|
ariaLabel: string;
|
|
186
|
+
/** Blocks clicks, dims the box to 50% opacity, and cancels its hover preview. */
|
|
178
187
|
disabled?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Whether the click stops bubbling to an ancestor. Defaults to `true`,
|
|
190
|
+
* which is what a row that toggles on its own click needs. Set `false`
|
|
191
|
+
* when the ancestor should also see the click -- e.g. a row that both
|
|
192
|
+
* selects and opens a detail panel.
|
|
193
|
+
*/
|
|
194
|
+
stopPropagation?: boolean;
|
|
179
195
|
/** Forwarded as `data-testid`, for Playwright/test selectors. */
|
|
180
196
|
testId?: string;
|
|
181
197
|
/**
|
|
@@ -184,8 +200,46 @@ interface CheckBoxProps {
|
|
|
184
200
|
* be on any other disabled control.
|
|
185
201
|
*/
|
|
186
202
|
title?: string;
|
|
203
|
+
/** Extra classes merged onto the box -- e.g. a cursor or margin override. */
|
|
204
|
+
className?: string;
|
|
187
205
|
}
|
|
188
|
-
declare function CheckBox({ checked, indeterminate, onChange, ariaLabel, disabled, testId, title }: CheckBoxProps): react.JSX.Element;
|
|
206
|
+
declare function CheckBox({ checked, indeterminate, onChange, ariaLabel, disabled, stopPropagation, testId, title, className, }: CheckBoxProps): react.JSX.Element;
|
|
207
|
+
/**
|
|
208
|
+
* @pattern CheckBoxBox
|
|
209
|
+
* @description Presentational checkbox -- draws the same box as `CheckBox`
|
|
210
|
+
* and nothing else. Use it when an ancestor already carries the interaction
|
|
211
|
+
* and the checkbox semantics (a clickable option row, a `<label>`), since a
|
|
212
|
+
* `<button>` inside a `<button>` is invalid markup and a second focus stop on
|
|
213
|
+
* the same control is worse for keyboard users, not better. The owning
|
|
214
|
+
* element supplies `role="checkbox"` and `aria-checked`; this is
|
|
215
|
+
* `aria-hidden` so the state isn't announced twice.
|
|
216
|
+
* @tokens bg-brand-primaryAction, border-border-interactive, bg-input
|
|
217
|
+
* @dependencies lucide-react
|
|
218
|
+
* @behavior Renders through the same `boxClass` as `CheckBox`, so geometry
|
|
219
|
+
* and fill can't drift. Takes neither the focus ring nor the hover border,
|
|
220
|
+
* because the row around it owns both. Without this, a row that is itself
|
|
221
|
+
* the control has no correct option: nesting the interactive `CheckBox`
|
|
222
|
+
* produces a button inside a button, and dropping to a `<div>` with a click
|
|
223
|
+
* handler loses keyboard access entirely.
|
|
224
|
+
* @usage
|
|
225
|
+
* ```tsx
|
|
226
|
+
* <button type="button" role="checkbox" aria-checked={on} onClick={toggle}>
|
|
227
|
+
* <CheckBoxBox checked={on} />
|
|
228
|
+
* <span>Cable TV</span>
|
|
229
|
+
* </button>
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
interface CheckBoxBoxProps {
|
|
233
|
+
/** Whether the box is checked. The owning element reports this to AT. */
|
|
234
|
+
checked: boolean;
|
|
235
|
+
/** Some-but-not-all state -- shows a dash instead of a check. */
|
|
236
|
+
indeterminate?: boolean;
|
|
237
|
+
/** Dims the box to 50% opacity, matching `CheckBox`'s disabled treatment. */
|
|
238
|
+
disabled?: boolean;
|
|
239
|
+
/** Extra classes merged onto the box. */
|
|
240
|
+
className?: string;
|
|
241
|
+
}
|
|
242
|
+
declare function CheckBoxBox({ checked, indeterminate, disabled, className }: CheckBoxBoxProps): react.JSX.Element;
|
|
189
243
|
|
|
190
244
|
/**
|
|
191
245
|
* @pattern DateRangeFilter
|
|
@@ -493,6 +547,8 @@ interface CardProps extends Omit<React.HTMLAttributes<HTMLElement>, "title"> {
|
|
|
493
547
|
subtitle?: string;
|
|
494
548
|
/** Trailing header content, e.g. a "View all" link. Ignored without `title`. */
|
|
495
549
|
action?: ReactNode;
|
|
550
|
+
/** Card body. Rendered edge to edge without `title`; inside the standard padding with it. */
|
|
551
|
+
children?: ReactNode;
|
|
496
552
|
}
|
|
497
553
|
declare const Card: react.ForwardRefExoticComponent<CardProps & react.RefAttributes<HTMLElement>>;
|
|
498
554
|
|
|
@@ -1194,6 +1250,8 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantPr
|
|
|
1194
1250
|
asChild?: boolean;
|
|
1195
1251
|
/** Shows a spinner in place of the leading edge and disables the button. */
|
|
1196
1252
|
loading?: boolean;
|
|
1253
|
+
/** Button label and/or icon. With `asChild`, the single element that receives the button styling. */
|
|
1254
|
+
children?: ReactNode;
|
|
1197
1255
|
}
|
|
1198
1256
|
/**
|
|
1199
1257
|
* @pattern Button
|
|
@@ -1271,8 +1329,16 @@ interface NameListModalProps {
|
|
|
1271
1329
|
*/
|
|
1272
1330
|
declare function NameListModal({ title, initialName, submitLabel, onCancel, onSubmit }: NameListModalProps): react.ReactPortal;
|
|
1273
1331
|
|
|
1332
|
+
/**
|
|
1333
|
+
* Which stroke a chip trigger carries.
|
|
1334
|
+
* - `box` : the boxed two-line chip (caption over value), on the default
|
|
1335
|
+
* border. The common filter-bar chip.
|
|
1336
|
+
* - `inline` : the same white fill with a darker stroke, for chips sitting
|
|
1337
|
+
* directly on the warm canvas with no boxed shell around them.
|
|
1338
|
+
*/
|
|
1339
|
+
type ChipVariant = "box" | "inline";
|
|
1274
1340
|
/** Shared styling for filter-bar chip triggers, so every dropdown chip matches. */
|
|
1275
|
-
declare function chipTriggerClass(): string;
|
|
1341
|
+
declare function chipTriggerClass(variant?: ChipVariant): string;
|
|
1276
1342
|
interface ChipContentProps {
|
|
1277
1343
|
/** Small uppercase label above the value. */
|
|
1278
1344
|
caption: string;
|
|
@@ -1286,14 +1352,18 @@ interface ChipContentProps {
|
|
|
1286
1352
|
* @description Shared foundation for filter-bar chip triggers — pairs
|
|
1287
1353
|
* `chipTriggerClass` with `ChipContent` for the caption/value/icon layout, so
|
|
1288
1354
|
* every dropdown chip across the app matches.
|
|
1289
|
-
* @tokens rounded-control, bg-input, border-border-strong, text-text-secondary, text-text-tertiary, text-text-primary, hover:bg-subtle, focus-visible:outline-border-focus, hover:text-text-primary
|
|
1290
|
-
* @behavior
|
|
1355
|
+
* @tokens rounded-control, bg-input, border-border-default, border-border-strong, text-text-secondary, text-text-tertiary, text-text-primary, hover:bg-subtle, focus-visible:outline-border-focus, hover:text-text-primary
|
|
1356
|
+
* @behavior `chipTriggerClass` takes a `ChipVariant`: `box` (default, the
|
|
1357
|
+
* boxed two-line chip on the default border) or `inline` (same fill, darker
|
|
1358
|
+
* stroke, for chips sitting directly on the canvas). It is an argument to
|
|
1359
|
+
* that function, not a prop on `ChipContent`.
|
|
1360
|
+
* Provides only the shared `focus-visible:outline-2` keyboard-focus
|
|
1291
1361
|
* treatment every dropdown trigger depends on — open/close, Escape, and
|
|
1292
1362
|
* outside-click dismissal all live in each consumer, not here. A new dropdown
|
|
1293
1363
|
* built on `chipTriggerClass` has to implement its own dismissal handling.
|
|
1294
1364
|
* @usage
|
|
1295
1365
|
* ```tsx
|
|
1296
|
-
* <button className={chipTriggerClass()}>
|
|
1366
|
+
* <button className={chipTriggerClass("box")}>
|
|
1297
1367
|
* <ChipContent caption="Media Type" value="All" />
|
|
1298
1368
|
* </button>
|
|
1299
1369
|
* ```
|
|
@@ -1438,6 +1508,7 @@ interface WorkspaceAvatarProps {
|
|
|
1438
1508
|
declare function WorkspaceAvatar({ name, size }: WorkspaceAvatarProps): react.JSX.Element;
|
|
1439
1509
|
|
|
1440
1510
|
interface TagProps {
|
|
1511
|
+
/** The tag's text, e.g. "Digital". Keep it short: the chip doesn't wrap or truncate. */
|
|
1441
1512
|
children: ReactNode;
|
|
1442
1513
|
/** Extra classes merged onto the chip. */
|
|
1443
1514
|
className?: string;
|
|
@@ -1529,7 +1600,7 @@ interface MultiSelectGroup {
|
|
|
1529
1600
|
* button shape (two-line caption + value with a chevron) and opens a
|
|
1530
1601
|
* searchable checkbox popover. Used for the page-level Media Type /
|
|
1531
1602
|
* Advertiser filters that share state with the filter tray.
|
|
1532
|
-
* @tokens rounded-control, rounded-card, border-border-default, bg-surface, shadow-overlay, text-text-primary, text-text-secondary, text-text-tertiary, text-text-link, border-border-interactive, bg-brand-primaryAction, bg-input, hover:bg-subtle, hover:text-text-primary, placeholder:text-text-tertiary
|
|
1603
|
+
* @tokens rounded-control, rounded-card, border-border-default, bg-surface, shadow-overlay, text-text-primary, text-text-secondary, text-text-tertiary, text-text-link, border-border-interactive, bg-brand-primaryAction, bg-input, hover:bg-subtle, hover:text-text-primary, placeholder:text-text-tertiary, text-brand-onprimary
|
|
1533
1604
|
* @dependencies lucide-react
|
|
1534
1605
|
* @behavior Same draft/commit-on-close pattern as AdvertiserQuickFilter — the
|
|
1535
1606
|
* draft resyncs from `selected` every time the tray opens, and (without
|
|
@@ -1599,13 +1670,17 @@ declare const SIZES: {
|
|
|
1599
1670
|
};
|
|
1600
1671
|
};
|
|
1601
1672
|
interface ToggleProps {
|
|
1673
|
+
/** Whether the switch is on. Controlled: the parent owns this value. */
|
|
1602
1674
|
checked: boolean;
|
|
1603
1675
|
/** Receives the value being switched TO, not the current one. */
|
|
1604
1676
|
onChange: (next: boolean) => void;
|
|
1605
1677
|
/** Accessible name; the visible label lives in the row around it. */
|
|
1606
1678
|
label: string;
|
|
1679
|
+
/** `md` for settings rows where the switch is the subject; `sm` for dense rows next to 13px text. */
|
|
1607
1680
|
size?: keyof typeof SIZES;
|
|
1681
|
+
/** Blocks clicks and dims the switch to 50% opacity. */
|
|
1608
1682
|
disabled?: boolean;
|
|
1683
|
+
/** Extra classes merged onto the track (the outer `<button>`). */
|
|
1609
1684
|
className?: string;
|
|
1610
1685
|
}
|
|
1611
1686
|
/**
|
|
@@ -1667,4 +1742,4 @@ interface FreshnessProps {
|
|
|
1667
1742
|
*/
|
|
1668
1743
|
declare function Freshness({ level }: FreshnessProps): react.JSX.Element;
|
|
1669
1744
|
|
|
1670
|
-
export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, type CheckBoxProps, ChipContent, type ChipContentProps, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, 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 };
|
|
1745
|
+
export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, 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, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -145,7 +145,8 @@ declare function AdvertiserSearchPrompt({ label }: AdvertiserSearchPromptProps):
|
|
|
145
145
|
* `<input type="checkbox">`), so it can carry an indeterminate "some but not
|
|
146
146
|
* all" state without the native element's limited styling hooks. Designed to
|
|
147
147
|
* be dropped into a row that already has its own click-to-toggle handler
|
|
148
|
-
* (a common list/table pattern) without double-firing.
|
|
148
|
+
* (a common list/table pattern) without double-firing. Where the row itself
|
|
149
|
+
* is the control, use `CheckBoxBox` instead.
|
|
149
150
|
* @tokens bg-brand-primaryAction, border-border-interactive, bg-input,
|
|
150
151
|
* hover:border-brand-primaryAction, focus-visible:outline-border-focus
|
|
151
152
|
* @dependencies lucide-react
|
|
@@ -155,8 +156,9 @@ declare function AdvertiserSearchPrompt({ label }: AdvertiserSearchPromptProps):
|
|
|
155
156
|
* unchecked state previews the brand action color on hover, matching the
|
|
156
157
|
* color the box fills with once checked -- the hover state is a preview of
|
|
157
158
|
* the click's effect, not an unrelated highlight. `onClick` calls
|
|
158
|
-
* `stopPropagation` before firing `onChange
|
|
159
|
-
* that toggles on its own click can't fire the toggle twice
|
|
159
|
+
* `stopPropagation` before firing `onChange` by default, so nesting this
|
|
160
|
+
* inside a row that toggles on its own click can't fire the toggle twice;
|
|
161
|
+
* pass `stopPropagation={false}` where the row should also see the click.
|
|
160
162
|
* @usage
|
|
161
163
|
* ```tsx
|
|
162
164
|
* <CheckBox checked={selected} ariaLabel="Select row" onChange={toggle} />
|
|
@@ -165,6 +167,7 @@ declare function AdvertiserSearchPrompt({ label }: AdvertiserSearchPromptProps):
|
|
|
165
167
|
* ```
|
|
166
168
|
*/
|
|
167
169
|
interface CheckBoxProps {
|
|
170
|
+
/** Whether the box is checked. Controlled: the parent owns this value. */
|
|
168
171
|
checked: boolean;
|
|
169
172
|
/**
|
|
170
173
|
* Some-but-not-all state for a "select all" checkbox -- shows a dash
|
|
@@ -172,10 +175,23 @@ interface CheckBoxProps {
|
|
|
172
175
|
* plain boolean.
|
|
173
176
|
*/
|
|
174
177
|
indeterminate?: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Called on click with no argument -- flip `checked` yourself. By default
|
|
180
|
+
* the click doesn't bubble, so a row that toggles on its own click won't
|
|
181
|
+
* fire twice.
|
|
182
|
+
*/
|
|
175
183
|
onChange: () => void;
|
|
176
184
|
/** Accessible label -- required since the control carries no visible text of its own. */
|
|
177
185
|
ariaLabel: string;
|
|
186
|
+
/** Blocks clicks, dims the box to 50% opacity, and cancels its hover preview. */
|
|
178
187
|
disabled?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Whether the click stops bubbling to an ancestor. Defaults to `true`,
|
|
190
|
+
* which is what a row that toggles on its own click needs. Set `false`
|
|
191
|
+
* when the ancestor should also see the click -- e.g. a row that both
|
|
192
|
+
* selects and opens a detail panel.
|
|
193
|
+
*/
|
|
194
|
+
stopPropagation?: boolean;
|
|
179
195
|
/** Forwarded as `data-testid`, for Playwright/test selectors. */
|
|
180
196
|
testId?: string;
|
|
181
197
|
/**
|
|
@@ -184,8 +200,46 @@ interface CheckBoxProps {
|
|
|
184
200
|
* be on any other disabled control.
|
|
185
201
|
*/
|
|
186
202
|
title?: string;
|
|
203
|
+
/** Extra classes merged onto the box -- e.g. a cursor or margin override. */
|
|
204
|
+
className?: string;
|
|
187
205
|
}
|
|
188
|
-
declare function CheckBox({ checked, indeterminate, onChange, ariaLabel, disabled, testId, title }: CheckBoxProps): react.JSX.Element;
|
|
206
|
+
declare function CheckBox({ checked, indeterminate, onChange, ariaLabel, disabled, stopPropagation, testId, title, className, }: CheckBoxProps): react.JSX.Element;
|
|
207
|
+
/**
|
|
208
|
+
* @pattern CheckBoxBox
|
|
209
|
+
* @description Presentational checkbox -- draws the same box as `CheckBox`
|
|
210
|
+
* and nothing else. Use it when an ancestor already carries the interaction
|
|
211
|
+
* and the checkbox semantics (a clickable option row, a `<label>`), since a
|
|
212
|
+
* `<button>` inside a `<button>` is invalid markup and a second focus stop on
|
|
213
|
+
* the same control is worse for keyboard users, not better. The owning
|
|
214
|
+
* element supplies `role="checkbox"` and `aria-checked`; this is
|
|
215
|
+
* `aria-hidden` so the state isn't announced twice.
|
|
216
|
+
* @tokens bg-brand-primaryAction, border-border-interactive, bg-input
|
|
217
|
+
* @dependencies lucide-react
|
|
218
|
+
* @behavior Renders through the same `boxClass` as `CheckBox`, so geometry
|
|
219
|
+
* and fill can't drift. Takes neither the focus ring nor the hover border,
|
|
220
|
+
* because the row around it owns both. Without this, a row that is itself
|
|
221
|
+
* the control has no correct option: nesting the interactive `CheckBox`
|
|
222
|
+
* produces a button inside a button, and dropping to a `<div>` with a click
|
|
223
|
+
* handler loses keyboard access entirely.
|
|
224
|
+
* @usage
|
|
225
|
+
* ```tsx
|
|
226
|
+
* <button type="button" role="checkbox" aria-checked={on} onClick={toggle}>
|
|
227
|
+
* <CheckBoxBox checked={on} />
|
|
228
|
+
* <span>Cable TV</span>
|
|
229
|
+
* </button>
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
interface CheckBoxBoxProps {
|
|
233
|
+
/** Whether the box is checked. The owning element reports this to AT. */
|
|
234
|
+
checked: boolean;
|
|
235
|
+
/** Some-but-not-all state -- shows a dash instead of a check. */
|
|
236
|
+
indeterminate?: boolean;
|
|
237
|
+
/** Dims the box to 50% opacity, matching `CheckBox`'s disabled treatment. */
|
|
238
|
+
disabled?: boolean;
|
|
239
|
+
/** Extra classes merged onto the box. */
|
|
240
|
+
className?: string;
|
|
241
|
+
}
|
|
242
|
+
declare function CheckBoxBox({ checked, indeterminate, disabled, className }: CheckBoxBoxProps): react.JSX.Element;
|
|
189
243
|
|
|
190
244
|
/**
|
|
191
245
|
* @pattern DateRangeFilter
|
|
@@ -493,6 +547,8 @@ interface CardProps extends Omit<React.HTMLAttributes<HTMLElement>, "title"> {
|
|
|
493
547
|
subtitle?: string;
|
|
494
548
|
/** Trailing header content, e.g. a "View all" link. Ignored without `title`. */
|
|
495
549
|
action?: ReactNode;
|
|
550
|
+
/** Card body. Rendered edge to edge without `title`; inside the standard padding with it. */
|
|
551
|
+
children?: ReactNode;
|
|
496
552
|
}
|
|
497
553
|
declare const Card: react.ForwardRefExoticComponent<CardProps & react.RefAttributes<HTMLElement>>;
|
|
498
554
|
|
|
@@ -1194,6 +1250,8 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantPr
|
|
|
1194
1250
|
asChild?: boolean;
|
|
1195
1251
|
/** Shows a spinner in place of the leading edge and disables the button. */
|
|
1196
1252
|
loading?: boolean;
|
|
1253
|
+
/** Button label and/or icon. With `asChild`, the single element that receives the button styling. */
|
|
1254
|
+
children?: ReactNode;
|
|
1197
1255
|
}
|
|
1198
1256
|
/**
|
|
1199
1257
|
* @pattern Button
|
|
@@ -1271,8 +1329,16 @@ interface NameListModalProps {
|
|
|
1271
1329
|
*/
|
|
1272
1330
|
declare function NameListModal({ title, initialName, submitLabel, onCancel, onSubmit }: NameListModalProps): react.ReactPortal;
|
|
1273
1331
|
|
|
1332
|
+
/**
|
|
1333
|
+
* Which stroke a chip trigger carries.
|
|
1334
|
+
* - `box` : the boxed two-line chip (caption over value), on the default
|
|
1335
|
+
* border. The common filter-bar chip.
|
|
1336
|
+
* - `inline` : the same white fill with a darker stroke, for chips sitting
|
|
1337
|
+
* directly on the warm canvas with no boxed shell around them.
|
|
1338
|
+
*/
|
|
1339
|
+
type ChipVariant = "box" | "inline";
|
|
1274
1340
|
/** Shared styling for filter-bar chip triggers, so every dropdown chip matches. */
|
|
1275
|
-
declare function chipTriggerClass(): string;
|
|
1341
|
+
declare function chipTriggerClass(variant?: ChipVariant): string;
|
|
1276
1342
|
interface ChipContentProps {
|
|
1277
1343
|
/** Small uppercase label above the value. */
|
|
1278
1344
|
caption: string;
|
|
@@ -1286,14 +1352,18 @@ interface ChipContentProps {
|
|
|
1286
1352
|
* @description Shared foundation for filter-bar chip triggers — pairs
|
|
1287
1353
|
* `chipTriggerClass` with `ChipContent` for the caption/value/icon layout, so
|
|
1288
1354
|
* every dropdown chip across the app matches.
|
|
1289
|
-
* @tokens rounded-control, bg-input, border-border-strong, text-text-secondary, text-text-tertiary, text-text-primary, hover:bg-subtle, focus-visible:outline-border-focus, hover:text-text-primary
|
|
1290
|
-
* @behavior
|
|
1355
|
+
* @tokens rounded-control, bg-input, border-border-default, border-border-strong, text-text-secondary, text-text-tertiary, text-text-primary, hover:bg-subtle, focus-visible:outline-border-focus, hover:text-text-primary
|
|
1356
|
+
* @behavior `chipTriggerClass` takes a `ChipVariant`: `box` (default, the
|
|
1357
|
+
* boxed two-line chip on the default border) or `inline` (same fill, darker
|
|
1358
|
+
* stroke, for chips sitting directly on the canvas). It is an argument to
|
|
1359
|
+
* that function, not a prop on `ChipContent`.
|
|
1360
|
+
* Provides only the shared `focus-visible:outline-2` keyboard-focus
|
|
1291
1361
|
* treatment every dropdown trigger depends on — open/close, Escape, and
|
|
1292
1362
|
* outside-click dismissal all live in each consumer, not here. A new dropdown
|
|
1293
1363
|
* built on `chipTriggerClass` has to implement its own dismissal handling.
|
|
1294
1364
|
* @usage
|
|
1295
1365
|
* ```tsx
|
|
1296
|
-
* <button className={chipTriggerClass()}>
|
|
1366
|
+
* <button className={chipTriggerClass("box")}>
|
|
1297
1367
|
* <ChipContent caption="Media Type" value="All" />
|
|
1298
1368
|
* </button>
|
|
1299
1369
|
* ```
|
|
@@ -1438,6 +1508,7 @@ interface WorkspaceAvatarProps {
|
|
|
1438
1508
|
declare function WorkspaceAvatar({ name, size }: WorkspaceAvatarProps): react.JSX.Element;
|
|
1439
1509
|
|
|
1440
1510
|
interface TagProps {
|
|
1511
|
+
/** The tag's text, e.g. "Digital". Keep it short: the chip doesn't wrap or truncate. */
|
|
1441
1512
|
children: ReactNode;
|
|
1442
1513
|
/** Extra classes merged onto the chip. */
|
|
1443
1514
|
className?: string;
|
|
@@ -1529,7 +1600,7 @@ interface MultiSelectGroup {
|
|
|
1529
1600
|
* button shape (two-line caption + value with a chevron) and opens a
|
|
1530
1601
|
* searchable checkbox popover. Used for the page-level Media Type /
|
|
1531
1602
|
* Advertiser filters that share state with the filter tray.
|
|
1532
|
-
* @tokens rounded-control, rounded-card, border-border-default, bg-surface, shadow-overlay, text-text-primary, text-text-secondary, text-text-tertiary, text-text-link, border-border-interactive, bg-brand-primaryAction, bg-input, hover:bg-subtle, hover:text-text-primary, placeholder:text-text-tertiary
|
|
1603
|
+
* @tokens rounded-control, rounded-card, border-border-default, bg-surface, shadow-overlay, text-text-primary, text-text-secondary, text-text-tertiary, text-text-link, border-border-interactive, bg-brand-primaryAction, bg-input, hover:bg-subtle, hover:text-text-primary, placeholder:text-text-tertiary, text-brand-onprimary
|
|
1533
1604
|
* @dependencies lucide-react
|
|
1534
1605
|
* @behavior Same draft/commit-on-close pattern as AdvertiserQuickFilter — the
|
|
1535
1606
|
* draft resyncs from `selected` every time the tray opens, and (without
|
|
@@ -1599,13 +1670,17 @@ declare const SIZES: {
|
|
|
1599
1670
|
};
|
|
1600
1671
|
};
|
|
1601
1672
|
interface ToggleProps {
|
|
1673
|
+
/** Whether the switch is on. Controlled: the parent owns this value. */
|
|
1602
1674
|
checked: boolean;
|
|
1603
1675
|
/** Receives the value being switched TO, not the current one. */
|
|
1604
1676
|
onChange: (next: boolean) => void;
|
|
1605
1677
|
/** Accessible name; the visible label lives in the row around it. */
|
|
1606
1678
|
label: string;
|
|
1679
|
+
/** `md` for settings rows where the switch is the subject; `sm` for dense rows next to 13px text. */
|
|
1607
1680
|
size?: keyof typeof SIZES;
|
|
1681
|
+
/** Blocks clicks and dims the switch to 50% opacity. */
|
|
1608
1682
|
disabled?: boolean;
|
|
1683
|
+
/** Extra classes merged onto the track (the outer `<button>`). */
|
|
1609
1684
|
className?: string;
|
|
1610
1685
|
}
|
|
1611
1686
|
/**
|
|
@@ -1667,4 +1742,4 @@ interface FreshnessProps {
|
|
|
1667
1742
|
*/
|
|
1668
1743
|
declare function Freshness({ level }: FreshnessProps): react.JSX.Element;
|
|
1669
1744
|
|
|
1670
|
-
export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, type CheckBoxProps, ChipContent, type ChipContentProps, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, 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 };
|
|
1745
|
+
export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, 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, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, 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 };
|
package/dist/index.js
CHANGED
|
@@ -390,9 +390,39 @@ function OptionRow({
|
|
|
390
390
|
|
|
391
391
|
// src/CheckBox.tsx
|
|
392
392
|
import { Check as Check2, Minus } from "lucide-react";
|
|
393
|
+
|
|
394
|
+
// src/cn.ts
|
|
395
|
+
import { clsx } from "clsx";
|
|
396
|
+
import { twMerge } from "tailwind-merge";
|
|
397
|
+
function cn(...inputs) {
|
|
398
|
+
return twMerge(clsx(inputs));
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// src/CheckBox.tsx
|
|
393
402
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
394
|
-
function
|
|
395
|
-
|
|
403
|
+
function boxClass(on, disabled) {
|
|
404
|
+
return cn(
|
|
405
|
+
"flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-[5px] border transition-colors",
|
|
406
|
+
on ? "border-transparent bg-brand-primaryAction text-white" : "border-border-interactive bg-input",
|
|
407
|
+
disabled && "cursor-not-allowed opacity-50"
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
function Glyph({ checked, indeterminate }) {
|
|
411
|
+
if (indeterminate) return /* @__PURE__ */ jsx4(Minus, { size: 13, strokeWidth: 3 });
|
|
412
|
+
return checked ? /* @__PURE__ */ jsx4(Check2, { size: 13, strokeWidth: 3 }) : null;
|
|
413
|
+
}
|
|
414
|
+
function CheckBox({
|
|
415
|
+
checked,
|
|
416
|
+
indeterminate,
|
|
417
|
+
onChange,
|
|
418
|
+
ariaLabel,
|
|
419
|
+
disabled,
|
|
420
|
+
stopPropagation = true,
|
|
421
|
+
testId,
|
|
422
|
+
title,
|
|
423
|
+
className
|
|
424
|
+
}) {
|
|
425
|
+
const on = checked || !!indeterminate;
|
|
396
426
|
return /* @__PURE__ */ jsx4(
|
|
397
427
|
"button",
|
|
398
428
|
{
|
|
@@ -404,25 +434,26 @@ function CheckBox({ checked, indeterminate, onChange, ariaLabel, disabled, testI
|
|
|
404
434
|
disabled,
|
|
405
435
|
"data-testid": testId,
|
|
406
436
|
onClick: (e) => {
|
|
407
|
-
e.stopPropagation();
|
|
437
|
+
if (stopPropagation) e.stopPropagation();
|
|
408
438
|
onChange();
|
|
409
439
|
},
|
|
410
|
-
className:
|
|
411
|
-
|
|
440
|
+
className: cn(
|
|
441
|
+
boxClass(on, disabled),
|
|
412
442
|
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus",
|
|
413
|
-
on
|
|
443
|
+
!on && "hover:border-brand-primaryAction",
|
|
414
444
|
// Cancels the unchecked hover-border preview when disabled -- without
|
|
415
445
|
// this, a disabled box still visually previews the "you can click
|
|
416
446
|
// this" affordance on hover even though the click does nothing.
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
].filter(Boolean).join(" "),
|
|
422
|
-
children: indeterminate ? /* @__PURE__ */ jsx4(Minus, { size: 13, strokeWidth: 3 }) : checked ? /* @__PURE__ */ jsx4(Check2, { size: 13, strokeWidth: 3 }) : null
|
|
447
|
+
disabled && "hover:border-border-interactive",
|
|
448
|
+
className
|
|
449
|
+
),
|
|
450
|
+
children: /* @__PURE__ */ jsx4(Glyph, { checked, indeterminate })
|
|
423
451
|
}
|
|
424
452
|
);
|
|
425
453
|
}
|
|
454
|
+
function CheckBoxBox({ checked, indeterminate, disabled, className }) {
|
|
455
|
+
return /* @__PURE__ */ jsx4("span", { "aria-hidden": "true", className: cn(boxClass(checked || !!indeterminate, disabled), className), children: /* @__PURE__ */ jsx4(Glyph, { checked, indeterminate }) });
|
|
456
|
+
}
|
|
426
457
|
|
|
427
458
|
// src/DateRangeFilter.tsx
|
|
428
459
|
import { useEffect as useEffect3, useMemo as useMemo2, useRef as useRef3, useState as useState3 } from "react";
|
|
@@ -2558,15 +2589,6 @@ import { forwardRef as forwardRef2 } from "react";
|
|
|
2558
2589
|
import { Slot } from "@radix-ui/react-slot";
|
|
2559
2590
|
import { cva } from "class-variance-authority";
|
|
2560
2591
|
import { Loader2 as Loader22 } from "lucide-react";
|
|
2561
|
-
|
|
2562
|
-
// src/cn.ts
|
|
2563
|
-
import { clsx } from "clsx";
|
|
2564
|
-
import { twMerge } from "tailwind-merge";
|
|
2565
|
-
function cn(...inputs) {
|
|
2566
|
-
return twMerge(clsx(inputs));
|
|
2567
|
-
}
|
|
2568
|
-
|
|
2569
|
-
// src/Button.tsx
|
|
2570
2592
|
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2571
2593
|
var buttonVariants = cva(
|
|
2572
2594
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-control font-medium transition-all duration-(--mr-motion-duration-interactive) ease-interactive disabled:pointer-events-none disabled:opacity-40 focus-visible:outline-hidden focus-visible:ring-0",
|
|
@@ -2694,12 +2716,13 @@ function NameListModal({ title, initialName, submitLabel, onCancel, onSubmit })
|
|
|
2694
2716
|
|
|
2695
2717
|
// src/ChipTrigger.tsx
|
|
2696
2718
|
import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2697
|
-
function chipTriggerClass() {
|
|
2719
|
+
function chipTriggerClass(variant = "box") {
|
|
2698
2720
|
return cn(
|
|
2699
2721
|
"flex h-11 items-center gap-2 rounded-control border bg-input px-2.5 text-text-secondary transition-colors hover:bg-subtle hover:text-text-primary focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus",
|
|
2700
|
-
//
|
|
2701
|
-
// control against the warm canvas
|
|
2702
|
-
|
|
2722
|
+
// Both variants sit on the input fill. `inline` carries the darker stroke
|
|
2723
|
+
// so it still reads as a control against the warm canvas with no boxed
|
|
2724
|
+
// shell behind it.
|
|
2725
|
+
variant === "inline" ? "border-border-strong" : "border-border-default"
|
|
2703
2726
|
);
|
|
2704
2727
|
}
|
|
2705
2728
|
function ChipContent({ caption, value, icon }) {
|
|
@@ -3525,6 +3548,7 @@ export {
|
|
|
3525
3548
|
Button,
|
|
3526
3549
|
Card,
|
|
3527
3550
|
CheckBox,
|
|
3551
|
+
CheckBoxBox,
|
|
3528
3552
|
ChipContent,
|
|
3529
3553
|
DEFAULT_SEARCH_MATCH,
|
|
3530
3554
|
DataScopeFilter,
|