@mediaradar/design-components 0.32.1 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -2769,6 +2769,76 @@ interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "si
2769
2769
  */
2770
2770
  declare const TextField: react.ForwardRefExoticComponent<TextFieldProps & react.RefAttributes<HTMLInputElement>>;
2771
2771
 
2772
+ type DrawerSize = "sm" | "md" | "lg";
2773
+ interface DrawerProps {
2774
+ /** Whether the drawer is showing. It slides in when this turns true and out when it turns false. */
2775
+ open: boolean;
2776
+ /** Called on Escape, a click on the dimmed page, or the close button. */
2777
+ onClose: () => void;
2778
+ /** The drawer's title -- "Filters", "Saved views", the advertiser's name. */
2779
+ title: ReactNode;
2780
+ /** One line under the title. */
2781
+ description?: ReactNode;
2782
+ /** sm 440 for filters, md 640 for lists and saved views, lg 920 for a detail panel. */
2783
+ size?: DrawerSize;
2784
+ /** Pinned at the bottom, right-aligned -- "Clear all" and "Apply" for filters. */
2785
+ footer?: ReactNode;
2786
+ children?: ReactNode;
2787
+ className?: string;
2788
+ }
2789
+ /**
2790
+ * @pattern Drawer
2791
+ * @description A panel that slides in from the right over the dimmed page:
2792
+ * title, optional one-line description, a scrolling body, and an optional
2793
+ * footer pinned at the bottom. Three widths -- sm 440 for filters, md 640 for
2794
+ * lists and saved views, lg 920 for a detail panel -- over the same warm
2795
+ * scrim as Modal, with no blur. Same header, footer and keyboard behaviour as
2796
+ * Modal, so the two read as one family.
2797
+ * @variant sm - 440px. Default. Filters.
2798
+ * @variant md - 640px. A list, saved views, a comparison.
2799
+ * @variant lg - 920px. A detail panel: a battle card, an event breakdown.
2800
+ * @tokens bg-scrim, z-modal, transition-opacity,
2801
+ * duration-(--mr-motion-duration-interactive), ease-interactive,
2802
+ * motion-reduce:transition-none, border-l, border-border-default, bg-surface,
2803
+ * shadow-overlay, transition-transform, text-base, font-semibold,
2804
+ * text-text-primary, text-sm, text-text-secondary, text-text-tertiary,
2805
+ * hover:bg-subtle, hover:text-text-primary, rounded-control, border-t,
2806
+ * focus-visible:outline-border-focus
2807
+ * @dependencies lucide-react, react-dom
2808
+ * @behavior Portals to <body>. Slides in from the right over 200ms while the
2809
+ * scrim fades in, and slides back out before it unmounts; with reduced motion
2810
+ * it appears and goes without moving. Escape, a click on the dimmed page and
2811
+ * the × all call `onClose` -- in a filter drawer, unapplied changes are dropped,
2812
+ * as with Cancel. Focus moves to the first field (else the first footer
2813
+ * button) on open, Tab stays inside, and focus goes back to whatever opened it
2814
+ * on close. The page behind stops scrolling while it's open.
2815
+ * @a11y role="dialog" with aria-modal, named by its title and described by
2816
+ * `description`. The close button is labelled "Close".
2817
+ * @use for work alongside the page that the page's own context explains:
2818
+ * filters, saved views, a detail panel for a row.
2819
+ * @use `sm` for filters, `md` for lists, `lg` for a detail panel -- pick by
2820
+ * content, never a custom width.
2821
+ * @use the footer for the drawer's actions, primary last: "Clear all" then
2822
+ * "Apply".
2823
+ * @avoid a drawer for a decision that needs the user's full attention -- a
2824
+ * confirm or a short form is a Modal.
2825
+ * @avoid a drawer opened from another drawer. A Modal opened from a drawer is
2826
+ * fine and sits on top.
2827
+ * @avoid a `className` width override, or a blur behind it.
2828
+ * @usage
2829
+ * ```tsx
2830
+ * <Drawer
2831
+ * open={open}
2832
+ * onClose={() => setOpen(false)}
2833
+ * title="Filters"
2834
+ * footer={<><Button variant="secondary" onClick={clear}>Clear all</Button><Button onClick={apply}>Apply</Button></>}
2835
+ * >
2836
+ * …filter groups…
2837
+ * </Drawer>
2838
+ * ```
2839
+ */
2840
+ declare function Drawer({ open, onClose, title, description, size, footer, children, className }: DrawerProps): react.ReactPortal | null;
2841
+
2772
2842
  type DataTableColumnWidth = "fill" | "sm" | "md" | "lg";
2773
2843
  type DataTableDensity = "default" | "compact";
2774
2844
  interface DataTableColumn<T, K extends string = string> {
@@ -3082,4 +3152,4 @@ interface InlineMessageProps {
3082
3152
  */
3083
3153
  declare function InlineMessage({ tone, title, children, actions, onDismiss, className }: InlineMessageProps): react.JSX.Element;
3084
3154
 
3085
- 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, CopyButton, type CopyButtonProps, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, DataTable, type DataTableColumn, type DataTableColumnWidth, type DataTableDensity, type DataTableProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, EmptyState, type EmptyStateProps, type EmptyStateSize, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, InlineMessage, type InlineMessageProps, type InlineMessageTone, LineChartPlaceholder, type LineChartPlaceholderProps, MediaLabel, type MediaLabelProps, type MediaType, Modal, type ModalProps, type ModalSize, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, PageHeader, type PageHeaderProps, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarSize, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionHeading, type SectionHeadingProps, SectionRail, type SectionRailProps, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, type SegmentedOption, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, SuggestionChip, type SuggestionChipProps, type SummaryGroup, type SummaryGroupItemValue, type TabItem, TablePagination, type TablePaginationProps, Tabs, type TabsProps, Tag, type TagProps, TextField, type TextFieldProps, type TextFieldSize, Toast, type ToastProps, type ToastTone, Toggle, ToggleChip, type ToggleChipProps, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
3155
+ 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, CopyButton, type CopyButtonProps, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, DataTable, type DataTableColumn, type DataTableColumnWidth, type DataTableDensity, type DataTableProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, Drawer, type DrawerProps, type DrawerSize, EmptyState, type EmptyStateProps, type EmptyStateSize, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, InlineMessage, type InlineMessageProps, type InlineMessageTone, LineChartPlaceholder, type LineChartPlaceholderProps, MediaLabel, type MediaLabelProps, type MediaType, Modal, type ModalProps, type ModalSize, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, PageHeader, type PageHeaderProps, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarSize, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionHeading, type SectionHeadingProps, SectionRail, type SectionRailProps, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, type SegmentedOption, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, SuggestionChip, type SuggestionChipProps, type SummaryGroup, type SummaryGroupItemValue, type TabItem, TablePagination, type TablePaginationProps, Tabs, type TabsProps, Tag, type TagProps, TextField, type TextFieldProps, type TextFieldSize, Toast, type ToastProps, type ToastTone, Toggle, ToggleChip, type ToggleChipProps, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
package/dist/index.d.ts CHANGED
@@ -2769,6 +2769,76 @@ interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "si
2769
2769
  */
2770
2770
  declare const TextField: react.ForwardRefExoticComponent<TextFieldProps & react.RefAttributes<HTMLInputElement>>;
2771
2771
 
2772
+ type DrawerSize = "sm" | "md" | "lg";
2773
+ interface DrawerProps {
2774
+ /** Whether the drawer is showing. It slides in when this turns true and out when it turns false. */
2775
+ open: boolean;
2776
+ /** Called on Escape, a click on the dimmed page, or the close button. */
2777
+ onClose: () => void;
2778
+ /** The drawer's title -- "Filters", "Saved views", the advertiser's name. */
2779
+ title: ReactNode;
2780
+ /** One line under the title. */
2781
+ description?: ReactNode;
2782
+ /** sm 440 for filters, md 640 for lists and saved views, lg 920 for a detail panel. */
2783
+ size?: DrawerSize;
2784
+ /** Pinned at the bottom, right-aligned -- "Clear all" and "Apply" for filters. */
2785
+ footer?: ReactNode;
2786
+ children?: ReactNode;
2787
+ className?: string;
2788
+ }
2789
+ /**
2790
+ * @pattern Drawer
2791
+ * @description A panel that slides in from the right over the dimmed page:
2792
+ * title, optional one-line description, a scrolling body, and an optional
2793
+ * footer pinned at the bottom. Three widths -- sm 440 for filters, md 640 for
2794
+ * lists and saved views, lg 920 for a detail panel -- over the same warm
2795
+ * scrim as Modal, with no blur. Same header, footer and keyboard behaviour as
2796
+ * Modal, so the two read as one family.
2797
+ * @variant sm - 440px. Default. Filters.
2798
+ * @variant md - 640px. A list, saved views, a comparison.
2799
+ * @variant lg - 920px. A detail panel: a battle card, an event breakdown.
2800
+ * @tokens bg-scrim, z-modal, transition-opacity,
2801
+ * duration-(--mr-motion-duration-interactive), ease-interactive,
2802
+ * motion-reduce:transition-none, border-l, border-border-default, bg-surface,
2803
+ * shadow-overlay, transition-transform, text-base, font-semibold,
2804
+ * text-text-primary, text-sm, text-text-secondary, text-text-tertiary,
2805
+ * hover:bg-subtle, hover:text-text-primary, rounded-control, border-t,
2806
+ * focus-visible:outline-border-focus
2807
+ * @dependencies lucide-react, react-dom
2808
+ * @behavior Portals to <body>. Slides in from the right over 200ms while the
2809
+ * scrim fades in, and slides back out before it unmounts; with reduced motion
2810
+ * it appears and goes without moving. Escape, a click on the dimmed page and
2811
+ * the × all call `onClose` -- in a filter drawer, unapplied changes are dropped,
2812
+ * as with Cancel. Focus moves to the first field (else the first footer
2813
+ * button) on open, Tab stays inside, and focus goes back to whatever opened it
2814
+ * on close. The page behind stops scrolling while it's open.
2815
+ * @a11y role="dialog" with aria-modal, named by its title and described by
2816
+ * `description`. The close button is labelled "Close".
2817
+ * @use for work alongside the page that the page's own context explains:
2818
+ * filters, saved views, a detail panel for a row.
2819
+ * @use `sm` for filters, `md` for lists, `lg` for a detail panel -- pick by
2820
+ * content, never a custom width.
2821
+ * @use the footer for the drawer's actions, primary last: "Clear all" then
2822
+ * "Apply".
2823
+ * @avoid a drawer for a decision that needs the user's full attention -- a
2824
+ * confirm or a short form is a Modal.
2825
+ * @avoid a drawer opened from another drawer. A Modal opened from a drawer is
2826
+ * fine and sits on top.
2827
+ * @avoid a `className` width override, or a blur behind it.
2828
+ * @usage
2829
+ * ```tsx
2830
+ * <Drawer
2831
+ * open={open}
2832
+ * onClose={() => setOpen(false)}
2833
+ * title="Filters"
2834
+ * footer={<><Button variant="secondary" onClick={clear}>Clear all</Button><Button onClick={apply}>Apply</Button></>}
2835
+ * >
2836
+ * …filter groups…
2837
+ * </Drawer>
2838
+ * ```
2839
+ */
2840
+ declare function Drawer({ open, onClose, title, description, size, footer, children, className }: DrawerProps): react.ReactPortal | null;
2841
+
2772
2842
  type DataTableColumnWidth = "fill" | "sm" | "md" | "lg";
2773
2843
  type DataTableDensity = "default" | "compact";
2774
2844
  interface DataTableColumn<T, K extends string = string> {
@@ -3082,4 +3152,4 @@ interface InlineMessageProps {
3082
3152
  */
3083
3153
  declare function InlineMessage({ tone, title, children, actions, onDismiss, className }: InlineMessageProps): react.JSX.Element;
3084
3154
 
3085
- 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, CopyButton, type CopyButtonProps, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, DataTable, type DataTableColumn, type DataTableColumnWidth, type DataTableDensity, type DataTableProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, EmptyState, type EmptyStateProps, type EmptyStateSize, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, InlineMessage, type InlineMessageProps, type InlineMessageTone, LineChartPlaceholder, type LineChartPlaceholderProps, MediaLabel, type MediaLabelProps, type MediaType, Modal, type ModalProps, type ModalSize, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, PageHeader, type PageHeaderProps, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarSize, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionHeading, type SectionHeadingProps, SectionRail, type SectionRailProps, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, type SegmentedOption, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, SuggestionChip, type SuggestionChipProps, type SummaryGroup, type SummaryGroupItemValue, type TabItem, TablePagination, type TablePaginationProps, Tabs, type TabsProps, Tag, type TagProps, TextField, type TextFieldProps, type TextFieldSize, Toast, type ToastProps, type ToastTone, Toggle, ToggleChip, type ToggleChipProps, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
3155
+ 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, CopyButton, type CopyButtonProps, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, DataTable, type DataTableColumn, type DataTableColumnWidth, type DataTableDensity, type DataTableProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, Drawer, type DrawerProps, type DrawerSize, EmptyState, type EmptyStateProps, type EmptyStateSize, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, InlineMessage, type InlineMessageProps, type InlineMessageTone, LineChartPlaceholder, type LineChartPlaceholderProps, MediaLabel, type MediaLabelProps, type MediaType, Modal, type ModalProps, type ModalSize, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, PageHeader, type PageHeaderProps, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarSize, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionHeading, type SectionHeadingProps, SectionRail, type SectionRailProps, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, type SegmentedOption, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, SuggestionChip, type SuggestionChipProps, type SummaryGroup, type SummaryGroupItemValue, type TabItem, TablePagination, type TablePaginationProps, Tabs, type TabsProps, Tag, type TagProps, TextField, type TextFieldProps, type TextFieldSize, Toast, type ToastProps, type ToastTone, Toggle, ToggleChip, type ToggleChipProps, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
package/dist/index.js CHANGED
@@ -4357,10 +4357,132 @@ var TextField = forwardRef3(
4357
4357
  );
4358
4358
  TextField.displayName = "TextField";
4359
4359
 
4360
- // src/DataTable.tsx
4361
- import { useId as useId8 } from "react";
4360
+ // src/Drawer.tsx
4361
+ import { useEffect as useEffect15, useId as useId8, useRef as useRef17, useState as useState15 } from "react";
4362
+ import { createPortal as createPortal8 } from "react-dom";
4363
+ import { X as X7 } from "lucide-react";
4362
4364
  import { jsx as jsx49, jsxs as jsxs43 } from "react/jsx-runtime";
4363
- var WIDTH2 = { fill: "", sm: "w-24", md: "w-36", lg: "w-48" };
4365
+ var WIDTH2 = {
4366
+ sm: "max-w-110",
4367
+ md: "max-w-160",
4368
+ lg: "max-w-230"
4369
+ };
4370
+ var EXIT_MS = 200;
4371
+ var FOCUSABLE2 = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
4372
+ function Drawer({ open, onClose, title, description, size = "sm", footer, children, className }) {
4373
+ const titleId = useId8();
4374
+ const descId = useId8();
4375
+ const panel = useRef17(null);
4376
+ const close = useRef17(onClose);
4377
+ close.current = onClose;
4378
+ const [mounted, setMounted] = useState15(open);
4379
+ const [shown, setShown] = useState15(false);
4380
+ useEffect15(() => {
4381
+ if (open) {
4382
+ setMounted(true);
4383
+ const raf = requestAnimationFrame(() => requestAnimationFrame(() => setShown(true)));
4384
+ return () => cancelAnimationFrame(raf);
4385
+ }
4386
+ setShown(false);
4387
+ const t = setTimeout(() => setMounted(false), EXIT_MS);
4388
+ return () => clearTimeout(t);
4389
+ }, [open]);
4390
+ useEffect15(() => {
4391
+ if (!open || !mounted) return;
4392
+ const opener = document.activeElement;
4393
+ const firstIn = (region) => panel.current?.querySelector(region)?.querySelector(FOCUSABLE2) ?? null;
4394
+ const first = firstIn("[data-drawer-body]") ?? firstIn("[data-drawer-footer]");
4395
+ (first ?? panel.current)?.focus({ preventScroll: true });
4396
+ const overflow = document.body.style.overflow;
4397
+ document.body.style.overflow = "hidden";
4398
+ const onKey = (e) => {
4399
+ if (e.key === "Escape") {
4400
+ e.stopPropagation();
4401
+ close.current();
4402
+ return;
4403
+ }
4404
+ if (e.key !== "Tab" || !panel.current) return;
4405
+ const items = Array.from(panel.current.querySelectorAll(FOCUSABLE2));
4406
+ if (items.length === 0) return;
4407
+ const [head, tail] = [items[0], items[items.length - 1]];
4408
+ if (e.shiftKey && document.activeElement === head) {
4409
+ e.preventDefault();
4410
+ tail.focus();
4411
+ } else if (!e.shiftKey && document.activeElement === tail) {
4412
+ e.preventDefault();
4413
+ head.focus();
4414
+ }
4415
+ };
4416
+ document.addEventListener("keydown", onKey);
4417
+ return () => {
4418
+ document.removeEventListener("keydown", onKey);
4419
+ document.body.style.overflow = overflow;
4420
+ opener?.focus?.();
4421
+ };
4422
+ }, [open, mounted]);
4423
+ if (!mounted || typeof document === "undefined") return null;
4424
+ return createPortal8(
4425
+ /* @__PURE__ */ jsxs43("div", { className: "fixed inset-0 z-modal", children: [
4426
+ /* @__PURE__ */ jsx49(
4427
+ "div",
4428
+ {
4429
+ "aria-hidden": "true",
4430
+ onMouseDown: (e) => {
4431
+ e.preventDefault();
4432
+ onClose();
4433
+ },
4434
+ className: cn(
4435
+ "absolute inset-0 bg-scrim transition-opacity duration-(--mr-motion-duration-interactive) ease-interactive motion-reduce:transition-none",
4436
+ shown ? "opacity-100" : "opacity-0"
4437
+ )
4438
+ }
4439
+ ),
4440
+ /* @__PURE__ */ jsxs43(
4441
+ "div",
4442
+ {
4443
+ ref: panel,
4444
+ role: "dialog",
4445
+ "aria-modal": "true",
4446
+ "aria-labelledby": titleId,
4447
+ "aria-describedby": description ? descId : void 0,
4448
+ tabIndex: -1,
4449
+ className: cn(
4450
+ "absolute inset-y-0 right-0 flex w-full flex-col border-l border-border-default bg-surface shadow-overlay outline-hidden transition-transform duration-(--mr-motion-duration-interactive) ease-interactive motion-reduce:transition-none",
4451
+ shown ? "translate-x-0" : "translate-x-full",
4452
+ WIDTH2[size],
4453
+ className
4454
+ ),
4455
+ children: [
4456
+ /* @__PURE__ */ jsxs43("div", { className: "flex items-start gap-3 px-5 pt-5 pb-3", children: [
4457
+ /* @__PURE__ */ jsxs43("div", { className: "min-w-0 flex-1", children: [
4458
+ /* @__PURE__ */ jsx49("h2", { id: titleId, className: "text-base font-semibold text-text-primary", children: title }),
4459
+ description && /* @__PURE__ */ jsx49("p", { id: descId, className: "mt-0.5 text-sm text-text-secondary", children: description })
4460
+ ] }),
4461
+ /* @__PURE__ */ jsx49(
4462
+ "button",
4463
+ {
4464
+ type: "button",
4465
+ onClick: onClose,
4466
+ "aria-label": "Close",
4467
+ className: "-mr-1.5 -mt-1 flex size-8 shrink-0 items-center justify-center rounded-control text-text-tertiary hover:bg-subtle hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
4468
+ children: /* @__PURE__ */ jsx49(X7, { size: 16, "aria-hidden": "true" })
4469
+ }
4470
+ )
4471
+ ] }),
4472
+ /* @__PURE__ */ jsx49("div", { "data-drawer-body": true, className: "min-h-0 flex-1 overflow-y-auto px-5 pb-5 text-sm text-text-primary", children }),
4473
+ footer && /* @__PURE__ */ jsx49("div", { "data-drawer-footer": true, className: "flex items-center justify-end gap-2 border-t border-border-default px-5 py-3", children: footer })
4474
+ ]
4475
+ }
4476
+ )
4477
+ ] }),
4478
+ document.body
4479
+ );
4480
+ }
4481
+
4482
+ // src/DataTable.tsx
4483
+ import { useId as useId9 } from "react";
4484
+ import { jsx as jsx50, jsxs as jsxs44 } from "react/jsx-runtime";
4485
+ var WIDTH3 = { fill: "", sm: "w-24", md: "w-36", lg: "w-48" };
4364
4486
  var MAX_H = { sm: "max-h-80", md: "max-h-120", lg: "max-h-160" };
4365
4487
  var HEAD_PAD = { default: "px-4 py-3", compact: "px-3 py-2" };
4366
4488
  var CELL_PAD = { default: "px-4 py-3.5", compact: "px-3 py-2" };
@@ -4382,24 +4504,24 @@ function DataTable({
4382
4504
  className,
4383
4505
  ...rest
4384
4506
  }) {
4385
- const titleId = useId8();
4507
+ const titleId = useId9();
4386
4508
  const head = HEAD_PAD[density];
4387
4509
  const pad = CELL_PAD[density];
4388
4510
  const align = (c) => c.numeric ? "text-right" : "text-left";
4389
- const width = (c) => WIDTH2[c.width ?? (c.numeric ? "md" : "fill")];
4511
+ const width = (c) => WIDTH3[c.width ?? (c.numeric ? "md" : "fill")];
4390
4512
  const onSort = (key) => {
4391
4513
  const col = columns.find((c) => c.key === key);
4392
4514
  onSortChange?.(cycleSort(sort, key, col?.firstDir ?? (col?.numeric ? "desc" : "asc")));
4393
4515
  };
4394
- return /* @__PURE__ */ jsxs43("div", { className: cn("flex w-full flex-col overflow-hidden rounded-card border border-border-default bg-surface", className), children: [
4395
- title && /* @__PURE__ */ jsxs43("div", { className: "flex items-start justify-between gap-2 p-card-padding", children: [
4396
- /* @__PURE__ */ jsxs43("div", { className: "min-w-0", children: [
4397
- /* @__PURE__ */ jsx49("h3", { id: titleId, className: "text-style-card-title", children: title }),
4398
- subtitle && /* @__PURE__ */ jsx49("p", { className: "mt-0.5 text-xs text-text-tertiary", children: subtitle })
4516
+ return /* @__PURE__ */ jsxs44("div", { className: cn("flex w-full flex-col overflow-hidden rounded-card border border-border-default bg-surface", className), children: [
4517
+ title && /* @__PURE__ */ jsxs44("div", { className: "flex items-start justify-between gap-2 p-card-padding", children: [
4518
+ /* @__PURE__ */ jsxs44("div", { className: "min-w-0", children: [
4519
+ /* @__PURE__ */ jsx50("h3", { id: titleId, className: "text-style-card-title", children: title }),
4520
+ subtitle && /* @__PURE__ */ jsx50("p", { className: "mt-0.5 text-xs text-text-tertiary", children: subtitle })
4399
4521
  ] }),
4400
- action && /* @__PURE__ */ jsx49("div", { className: "shrink-0", children: action })
4522
+ action && /* @__PURE__ */ jsx50("div", { className: "shrink-0", children: action })
4401
4523
  ] }),
4402
- /* @__PURE__ */ jsx49("div", { className: cn("overflow-x-auto", maxHeight && cn("overflow-y-auto", MAX_H[maxHeight])), children: /* @__PURE__ */ jsxs43(
4524
+ /* @__PURE__ */ jsx50("div", { className: cn("overflow-x-auto", maxHeight && cn("overflow-y-auto", MAX_H[maxHeight])), children: /* @__PURE__ */ jsxs44(
4403
4525
  "table",
4404
4526
  {
4405
4527
  "aria-labelledby": title ? titleId : void 0,
@@ -4407,13 +4529,13 @@ function DataTable({
4407
4529
  "aria-busy": loading || void 0,
4408
4530
  className: "w-full border-collapse text-left",
4409
4531
  children: [
4410
- /* @__PURE__ */ jsx49("thead", { className: cn(maxHeight && "sticky top-0 z-10"), children: /* @__PURE__ */ jsx49("tr", { className: "bg-subtle text-micro font-semibold uppercase tracking-wider text-text-secondary", children: columns.map((c) => /* @__PURE__ */ jsx49(
4532
+ /* @__PURE__ */ jsx50("thead", { className: cn(maxHeight && "sticky top-0 z-10"), children: /* @__PURE__ */ jsx50("tr", { className: "bg-subtle text-micro font-semibold uppercase tracking-wider text-text-secondary", children: columns.map((c) => /* @__PURE__ */ jsx50(
4411
4533
  "th",
4412
4534
  {
4413
4535
  scope: "col",
4414
4536
  "aria-sort": c.sortable ? ariaSortFor(sort, c.key) : void 0,
4415
4537
  className: cn("border-b border-border-default font-semibold", head, align(c), width(c)),
4416
- children: c.sortable && onSortChange ? /* @__PURE__ */ jsx49(
4538
+ children: c.sortable && onSortChange ? /* @__PURE__ */ jsx50(
4417
4539
  SortButton,
4418
4540
  {
4419
4541
  label: c.label,
@@ -4426,7 +4548,7 @@ function DataTable({
4426
4548
  },
4427
4549
  c.key
4428
4550
  )) }) }),
4429
- /* @__PURE__ */ jsx49("tbody", { className: "text-dense text-text-primary", children: loading ? Array.from({ length: loadingRows }, (_, i) => /* @__PURE__ */ jsx49("tr", { "aria-hidden": "true", className: "[&:last-child>td]:border-b-0", children: columns.map((c) => /* @__PURE__ */ jsx49("td", { className: cn("border-b border-border-default", pad, align(c)), children: /* @__PURE__ */ jsx49(
4551
+ /* @__PURE__ */ jsx50("tbody", { className: "text-dense text-text-primary", children: loading ? Array.from({ length: loadingRows }, (_, i) => /* @__PURE__ */ jsx50("tr", { "aria-hidden": "true", className: "[&:last-child>td]:border-b-0", children: columns.map((c) => /* @__PURE__ */ jsx50("td", { className: cn("border-b border-border-default", pad, align(c)), children: /* @__PURE__ */ jsx50(
4430
4552
  "span",
4431
4553
  {
4432
4554
  className: cn(
@@ -4434,7 +4556,7 @@ function DataTable({
4434
4556
  c.numeric ? "w-12" : "w-2/3"
4435
4557
  )
4436
4558
  }
4437
- ) }, c.key)) }, i)) : rows.length === 0 ? /* @__PURE__ */ jsx49("tr", { children: /* @__PURE__ */ jsx49("td", { colSpan: columns.length, className: "px-6 py-12", children: empty ?? /* @__PURE__ */ jsx49(NoResultsEmptyState, {}) }) }) : rows.map((row) => /* @__PURE__ */ jsx49("tr", { className: "hover:bg-subtle [&:last-child>td]:border-b-0", children: columns.map((c) => /* @__PURE__ */ jsx49(
4559
+ ) }, c.key)) }, i)) : rows.length === 0 ? /* @__PURE__ */ jsx50("tr", { children: /* @__PURE__ */ jsx50("td", { colSpan: columns.length, className: "px-6 py-12", children: empty ?? /* @__PURE__ */ jsx50(NoResultsEmptyState, {}) }) }) : rows.map((row) => /* @__PURE__ */ jsx50("tr", { className: "hover:bg-subtle [&:last-child>td]:border-b-0", children: columns.map((c) => /* @__PURE__ */ jsx50(
4438
4560
  "td",
4439
4561
  {
4440
4562
  className: cn("border-b border-border-default", pad, align(c), c.numeric && "tabular-nums"),
@@ -4445,12 +4567,12 @@ function DataTable({
4445
4567
  ]
4446
4568
  }
4447
4569
  ) }),
4448
- footer && /* @__PURE__ */ jsx49("div", { className: "border-t border-border-default px-4 py-3", children: footer })
4570
+ footer && /* @__PURE__ */ jsx50("div", { className: "border-t border-border-default px-4 py-3", children: footer })
4449
4571
  ] });
4450
4572
  }
4451
4573
 
4452
4574
  // src/MediaLabel.tsx
4453
- import { jsx as jsx50 } from "react/jsx-runtime";
4575
+ import { jsx as jsx51 } from "react/jsx-runtime";
4454
4576
  var FILL = {
4455
4577
  TV: "bg-media-tv",
4456
4578
  CTV: "bg-media-ctv",
@@ -4461,7 +4583,7 @@ var FILL = {
4461
4583
  Magazine: "bg-media-magazine"
4462
4584
  };
4463
4585
  function MediaLabel({ type, className }) {
4464
- return /* @__PURE__ */ jsx50(
4586
+ return /* @__PURE__ */ jsx51(
4465
4587
  "span",
4466
4588
  {
4467
4589
  className: cn(
@@ -4475,9 +4597,9 @@ function MediaLabel({ type, className }) {
4475
4597
  }
4476
4598
 
4477
4599
  // src/SuggestionChip.tsx
4478
- import { jsx as jsx51 } from "react/jsx-runtime";
4600
+ import { jsx as jsx52 } from "react/jsx-runtime";
4479
4601
  function SuggestionChip({ children, className, type = "button", ...props }) {
4480
- return /* @__PURE__ */ jsx51(
4602
+ return /* @__PURE__ */ jsx52(
4481
4603
  "button",
4482
4604
  {
4483
4605
  type,
@@ -4486,16 +4608,16 @@ function SuggestionChip({ children, className, type = "button", ...props }) {
4486
4608
  "inline-flex h-8 max-w-full items-center rounded-full border border-border-default bg-surface px-3 text-sm text-text-primary transition-colors duration-(--mr-motion-duration-interactive) ease-interactive hover:border-border-strong hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
4487
4609
  className
4488
4610
  ),
4489
- children: /* @__PURE__ */ jsx51("span", { className: "truncate", children })
4611
+ children: /* @__PURE__ */ jsx52("span", { className: "truncate", children })
4490
4612
  }
4491
4613
  );
4492
4614
  }
4493
4615
 
4494
4616
  // src/ToggleChip.tsx
4495
4617
  import { Check as Check9 } from "lucide-react";
4496
- import { jsx as jsx52, jsxs as jsxs44 } from "react/jsx-runtime";
4618
+ import { jsx as jsx53, jsxs as jsxs45 } from "react/jsx-runtime";
4497
4619
  function ToggleChip({ selected, onChange, children, className, type = "button", onClick, ...props }) {
4498
- return /* @__PURE__ */ jsxs44(
4620
+ return /* @__PURE__ */ jsxs45(
4499
4621
  "button",
4500
4622
  {
4501
4623
  type,
@@ -4511,7 +4633,7 @@ function ToggleChip({ selected, onChange, children, className, type = "button",
4511
4633
  className
4512
4634
  ),
4513
4635
  children: [
4514
- selected && /* @__PURE__ */ jsx52(Check9, { size: 14, "aria-hidden": "true", className: "-ml-0.5 shrink-0" }),
4636
+ selected && /* @__PURE__ */ jsx53(Check9, { size: 14, "aria-hidden": "true", className: "-ml-0.5 shrink-0" }),
4515
4637
  children
4516
4638
  ]
4517
4639
  }
@@ -4519,14 +4641,14 @@ function ToggleChip({ selected, onChange, children, className, type = "button",
4519
4641
  }
4520
4642
 
4521
4643
  // src/CopyButton.tsx
4522
- import { useEffect as useEffect15, useRef as useRef17, useState as useState15 } from "react";
4644
+ import { useEffect as useEffect16, useRef as useRef18, useState as useState16 } from "react";
4523
4645
  import { Check as Check10, Copy } from "lucide-react";
4524
- import { jsx as jsx53, jsxs as jsxs45 } from "react/jsx-runtime";
4646
+ import { jsx as jsx54, jsxs as jsxs46 } from "react/jsx-runtime";
4525
4647
  var CONFIRM_MS = 2e3;
4526
4648
  function CopyButton({ value, label, "aria-label": ariaLabel, size = "xs", className }) {
4527
- const [copied, setCopied] = useState15(false);
4528
- const timer = useRef17(void 0);
4529
- useEffect15(() => () => clearTimeout(timer.current), []);
4649
+ const [copied, setCopied] = useState16(false);
4650
+ const timer = useRef18(void 0);
4651
+ useEffect16(() => () => clearTimeout(timer.current), []);
4530
4652
  const copy = async () => {
4531
4653
  try {
4532
4654
  await navigator.clipboard.writeText(typeof value === "function" ? value() : value);
@@ -4538,8 +4660,8 @@ function CopyButton({ value, label, "aria-label": ariaLabel, size = "xs", classN
4538
4660
  timer.current = setTimeout(() => setCopied(false), CONFIRM_MS);
4539
4661
  };
4540
4662
  const iconSize = size === "xs" ? 13 : 15;
4541
- const icon = copied ? /* @__PURE__ */ jsx53(Check10, { size: iconSize, "aria-hidden": "true", className: "shrink-0 text-text-success" }) : /* @__PURE__ */ jsx53(Copy, { size: iconSize, "aria-hidden": "true", className: "shrink-0" });
4542
- return /* @__PURE__ */ jsxs45(
4663
+ const icon = copied ? /* @__PURE__ */ jsx54(Check10, { size: iconSize, "aria-hidden": "true", className: "shrink-0 text-text-success" }) : /* @__PURE__ */ jsx54(Copy, { size: iconSize, "aria-hidden": "true", className: "shrink-0" });
4664
+ return /* @__PURE__ */ jsxs46(
4543
4665
  Button,
4544
4666
  {
4545
4667
  type: "button",
@@ -4551,16 +4673,16 @@ function CopyButton({ value, label, "aria-label": ariaLabel, size = "xs", classN
4551
4673
  className: cn(!copied && "text-text-secondary", className),
4552
4674
  children: [
4553
4675
  icon,
4554
- label && /* @__PURE__ */ jsx53("span", { children: copied ? "Copied" : label }),
4555
- /* @__PURE__ */ jsx53("span", { role: "status", className: "sr-only", children: copied ? "Copied" : "" })
4676
+ label && /* @__PURE__ */ jsx54("span", { children: copied ? "Copied" : label }),
4677
+ /* @__PURE__ */ jsx54("span", { role: "status", className: "sr-only", children: copied ? "Copied" : "" })
4556
4678
  ]
4557
4679
  }
4558
4680
  );
4559
4681
  }
4560
4682
 
4561
4683
  // src/InlineMessage.tsx
4562
- import { AlertTriangle as AlertTriangle2, CheckCircle2, Info as Info3, X as X7, XCircle } from "lucide-react";
4563
- import { jsx as jsx54, jsxs as jsxs46 } from "react/jsx-runtime";
4684
+ import { AlertTriangle as AlertTriangle2, CheckCircle2, Info as Info3, X as X8, XCircle } from "lucide-react";
4685
+ import { jsx as jsx55, jsxs as jsxs47 } from "react/jsx-runtime";
4564
4686
  var BOX = {
4565
4687
  info: "border-brand-primaryAction/30 bg-brand-primaryAction/10",
4566
4688
  success: "border-status-success/40 bg-status-success/10",
@@ -4577,26 +4699,26 @@ var ICON_INK = {
4577
4699
  var ICON2 = { info: Info3, success: CheckCircle2, warning: AlertTriangle2, danger: XCircle };
4578
4700
  function InlineMessage({ tone = "info", title, children, actions, onDismiss, className }) {
4579
4701
  const Icon = ICON2[tone];
4580
- return /* @__PURE__ */ jsxs46(
4702
+ return /* @__PURE__ */ jsxs47(
4581
4703
  "div",
4582
4704
  {
4583
4705
  role: tone === "warning" || tone === "danger" ? "alert" : "status",
4584
4706
  className: cn("flex items-start gap-2.5 rounded-control border px-3 py-2.5 text-sm", BOX[tone], className),
4585
4707
  children: [
4586
- /* @__PURE__ */ jsx54(Icon, { size: 16, "aria-hidden": "true", className: cn("mt-0.5 shrink-0", ICON_INK[tone]) }),
4587
- /* @__PURE__ */ jsxs46("div", { className: "min-w-0 flex-1", children: [
4588
- /* @__PURE__ */ jsx54("p", { className: "font-semibold text-text-primary", children: title }),
4589
- children && /* @__PURE__ */ jsx54("div", { className: "mt-0.5 text-text-secondary", children }),
4590
- actions && /* @__PURE__ */ jsx54("div", { className: "mt-2 flex flex-wrap items-center gap-2", children: actions })
4708
+ /* @__PURE__ */ jsx55(Icon, { size: 16, "aria-hidden": "true", className: cn("mt-0.5 shrink-0", ICON_INK[tone]) }),
4709
+ /* @__PURE__ */ jsxs47("div", { className: "min-w-0 flex-1", children: [
4710
+ /* @__PURE__ */ jsx55("p", { className: "font-semibold text-text-primary", children: title }),
4711
+ children && /* @__PURE__ */ jsx55("div", { className: "mt-0.5 text-text-secondary", children }),
4712
+ actions && /* @__PURE__ */ jsx55("div", { className: "mt-2 flex flex-wrap items-center gap-2", children: actions })
4591
4713
  ] }),
4592
- onDismiss && /* @__PURE__ */ jsx54(
4714
+ onDismiss && /* @__PURE__ */ jsx55(
4593
4715
  "button",
4594
4716
  {
4595
4717
  type: "button",
4596
4718
  onClick: onDismiss,
4597
4719
  "aria-label": "Dismiss",
4598
4720
  className: "-mr-1 -mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-control text-text-tertiary hover:bg-subtle hover:text-text-primary focus-visible:outline-2 focus-visible:outline-border-focus",
4599
- children: /* @__PURE__ */ jsx54(X7, { size: 14, "aria-hidden": "true" })
4721
+ children: /* @__PURE__ */ jsx55(X8, { size: 14, "aria-hidden": "true" })
4600
4722
  }
4601
4723
  )
4602
4724
  ]
@@ -4622,6 +4744,7 @@ export {
4622
4744
  DateRangeFilter,
4623
4745
  DateRangePicker,
4624
4746
  Delta,
4747
+ Drawer,
4625
4748
  EmptyState,
4626
4749
  FilterChipBar,
4627
4750
  FilterDropdownFooter,