@mediaradar/design-components 0.8.1 → 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 +72 -12
- package/dist/index.d.ts +72 -12
- 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} />
|
|
@@ -174,14 +176,22 @@ interface CheckBoxProps {
|
|
|
174
176
|
*/
|
|
175
177
|
indeterminate?: boolean;
|
|
176
178
|
/**
|
|
177
|
-
* Called on click with no argument -- flip `checked` yourself.
|
|
178
|
-
* doesn't bubble, so a row that toggles on its own click won't
|
|
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.
|
|
179
182
|
*/
|
|
180
183
|
onChange: () => void;
|
|
181
184
|
/** Accessible label -- required since the control carries no visible text of its own. */
|
|
182
185
|
ariaLabel: string;
|
|
183
186
|
/** Blocks clicks, dims the box to 50% opacity, and cancels its hover preview. */
|
|
184
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;
|
|
185
195
|
/** Forwarded as `data-testid`, for Playwright/test selectors. */
|
|
186
196
|
testId?: string;
|
|
187
197
|
/**
|
|
@@ -190,8 +200,46 @@ interface CheckBoxProps {
|
|
|
190
200
|
* be on any other disabled control.
|
|
191
201
|
*/
|
|
192
202
|
title?: string;
|
|
203
|
+
/** Extra classes merged onto the box -- e.g. a cursor or margin override. */
|
|
204
|
+
className?: string;
|
|
193
205
|
}
|
|
194
|
-
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;
|
|
195
243
|
|
|
196
244
|
/**
|
|
197
245
|
* @pattern DateRangeFilter
|
|
@@ -1281,8 +1329,16 @@ interface NameListModalProps {
|
|
|
1281
1329
|
*/
|
|
1282
1330
|
declare function NameListModal({ title, initialName, submitLabel, onCancel, onSubmit }: NameListModalProps): react.ReactPortal;
|
|
1283
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";
|
|
1284
1340
|
/** Shared styling for filter-bar chip triggers, so every dropdown chip matches. */
|
|
1285
|
-
declare function chipTriggerClass(): string;
|
|
1341
|
+
declare function chipTriggerClass(variant?: ChipVariant): string;
|
|
1286
1342
|
interface ChipContentProps {
|
|
1287
1343
|
/** Small uppercase label above the value. */
|
|
1288
1344
|
caption: string;
|
|
@@ -1296,14 +1352,18 @@ interface ChipContentProps {
|
|
|
1296
1352
|
* @description Shared foundation for filter-bar chip triggers — pairs
|
|
1297
1353
|
* `chipTriggerClass` with `ChipContent` for the caption/value/icon layout, so
|
|
1298
1354
|
* every dropdown chip across the app matches.
|
|
1299
|
-
* @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
|
|
1300
|
-
* @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
|
|
1301
1361
|
* treatment every dropdown trigger depends on — open/close, Escape, and
|
|
1302
1362
|
* outside-click dismissal all live in each consumer, not here. A new dropdown
|
|
1303
1363
|
* built on `chipTriggerClass` has to implement its own dismissal handling.
|
|
1304
1364
|
* @usage
|
|
1305
1365
|
* ```tsx
|
|
1306
|
-
* <button className={chipTriggerClass()}>
|
|
1366
|
+
* <button className={chipTriggerClass("box")}>
|
|
1307
1367
|
* <ChipContent caption="Media Type" value="All" />
|
|
1308
1368
|
* </button>
|
|
1309
1369
|
* ```
|
|
@@ -1540,7 +1600,7 @@ interface MultiSelectGroup {
|
|
|
1540
1600
|
* button shape (two-line caption + value with a chevron) and opens a
|
|
1541
1601
|
* searchable checkbox popover. Used for the page-level Media Type /
|
|
1542
1602
|
* Advertiser filters that share state with the filter tray.
|
|
1543
|
-
* @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
|
|
1544
1604
|
* @dependencies lucide-react
|
|
1545
1605
|
* @behavior Same draft/commit-on-close pattern as AdvertiserQuickFilter — the
|
|
1546
1606
|
* draft resyncs from `selected` every time the tray opens, and (without
|
|
@@ -1682,4 +1742,4 @@ interface FreshnessProps {
|
|
|
1682
1742
|
*/
|
|
1683
1743
|
declare function Freshness({ level }: FreshnessProps): react.JSX.Element;
|
|
1684
1744
|
|
|
1685
|
-
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} />
|
|
@@ -174,14 +176,22 @@ interface CheckBoxProps {
|
|
|
174
176
|
*/
|
|
175
177
|
indeterminate?: boolean;
|
|
176
178
|
/**
|
|
177
|
-
* Called on click with no argument -- flip `checked` yourself.
|
|
178
|
-
* doesn't bubble, so a row that toggles on its own click won't
|
|
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.
|
|
179
182
|
*/
|
|
180
183
|
onChange: () => void;
|
|
181
184
|
/** Accessible label -- required since the control carries no visible text of its own. */
|
|
182
185
|
ariaLabel: string;
|
|
183
186
|
/** Blocks clicks, dims the box to 50% opacity, and cancels its hover preview. */
|
|
184
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;
|
|
185
195
|
/** Forwarded as `data-testid`, for Playwright/test selectors. */
|
|
186
196
|
testId?: string;
|
|
187
197
|
/**
|
|
@@ -190,8 +200,46 @@ interface CheckBoxProps {
|
|
|
190
200
|
* be on any other disabled control.
|
|
191
201
|
*/
|
|
192
202
|
title?: string;
|
|
203
|
+
/** Extra classes merged onto the box -- e.g. a cursor or margin override. */
|
|
204
|
+
className?: string;
|
|
193
205
|
}
|
|
194
|
-
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;
|
|
195
243
|
|
|
196
244
|
/**
|
|
197
245
|
* @pattern DateRangeFilter
|
|
@@ -1281,8 +1329,16 @@ interface NameListModalProps {
|
|
|
1281
1329
|
*/
|
|
1282
1330
|
declare function NameListModal({ title, initialName, submitLabel, onCancel, onSubmit }: NameListModalProps): react.ReactPortal;
|
|
1283
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";
|
|
1284
1340
|
/** Shared styling for filter-bar chip triggers, so every dropdown chip matches. */
|
|
1285
|
-
declare function chipTriggerClass(): string;
|
|
1341
|
+
declare function chipTriggerClass(variant?: ChipVariant): string;
|
|
1286
1342
|
interface ChipContentProps {
|
|
1287
1343
|
/** Small uppercase label above the value. */
|
|
1288
1344
|
caption: string;
|
|
@@ -1296,14 +1352,18 @@ interface ChipContentProps {
|
|
|
1296
1352
|
* @description Shared foundation for filter-bar chip triggers — pairs
|
|
1297
1353
|
* `chipTriggerClass` with `ChipContent` for the caption/value/icon layout, so
|
|
1298
1354
|
* every dropdown chip across the app matches.
|
|
1299
|
-
* @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
|
|
1300
|
-
* @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
|
|
1301
1361
|
* treatment every dropdown trigger depends on — open/close, Escape, and
|
|
1302
1362
|
* outside-click dismissal all live in each consumer, not here. A new dropdown
|
|
1303
1363
|
* built on `chipTriggerClass` has to implement its own dismissal handling.
|
|
1304
1364
|
* @usage
|
|
1305
1365
|
* ```tsx
|
|
1306
|
-
* <button className={chipTriggerClass()}>
|
|
1366
|
+
* <button className={chipTriggerClass("box")}>
|
|
1307
1367
|
* <ChipContent caption="Media Type" value="All" />
|
|
1308
1368
|
* </button>
|
|
1309
1369
|
* ```
|
|
@@ -1540,7 +1600,7 @@ interface MultiSelectGroup {
|
|
|
1540
1600
|
* button shape (two-line caption + value with a chevron) and opens a
|
|
1541
1601
|
* searchable checkbox popover. Used for the page-level Media Type /
|
|
1542
1602
|
* Advertiser filters that share state with the filter tray.
|
|
1543
|
-
* @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
|
|
1544
1604
|
* @dependencies lucide-react
|
|
1545
1605
|
* @behavior Same draft/commit-on-close pattern as AdvertiserQuickFilter — the
|
|
1546
1606
|
* draft resyncs from `selected` every time the tray opens, and (without
|
|
@@ -1682,4 +1742,4 @@ interface FreshnessProps {
|
|
|
1682
1742
|
*/
|
|
1683
1743
|
declare function Freshness({ level }: FreshnessProps): react.JSX.Element;
|
|
1684
1744
|
|
|
1685
|
-
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,
|