@mediaradar/design-components 0.19.0 → 0.20.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
@@ -1888,6 +1888,96 @@ interface WorkspaceAvatarProps {
1888
1888
  */
1889
1889
  declare function WorkspaceAvatar({ name, size }: WorkspaceAvatarProps): react.JSX.Element;
1890
1890
 
1891
+ type ToastTone = "neutral" | "success" | "warning";
1892
+ interface ToastProps {
1893
+ /** What happened, in a short sentence. Past tense: "12 accounts removed". */
1894
+ message: ReactNode;
1895
+ /**
1896
+ * One follow-up, usually Undo. Giving a toast an action extends how long it
1897
+ * stays, since the reader now has to notice it, read it, decide and reach.
1898
+ */
1899
+ action?: {
1900
+ label: string;
1901
+ onClick: () => void;
1902
+ };
1903
+ /** Called when the toast has dismissed itself, or the action closed it. */
1904
+ onClose: () => void;
1905
+ /**
1906
+ * Carried by a leading icon, never by the surface. The surface stays the
1907
+ * same on every toast on purpose -- see @behavior.
1908
+ */
1909
+ tone?: ToastTone;
1910
+ /**
1911
+ * Override the duration. The defaults are 5s, or 10s when there is an
1912
+ * action; both pause while hovered or focused. Set deliberately or not at
1913
+ * all -- a one-off number here is how the product ended up with six.
1914
+ */
1915
+ duration?: number;
1916
+ className?: string;
1917
+ }
1918
+ /**
1919
+ * @pattern Toast
1920
+ * @description Transient feedback about the page or the task: "12 accounts
1921
+ * removed", "Export started". Floats at the bottom of the window so it never
1922
+ * pushes the page around, dismisses itself, and may carry one action.
1923
+ *
1924
+ * It is one of three shapes of feedback, and the shape is the first decision:
1925
+ * feedback about the control you just used stays ON it (a copy button's icon
1926
+ * becoming a tick); feedback about the page or task floats, which is this;
1927
+ * and feedback you have to act on before continuing stays inline where the
1928
+ * action is, and does not dismiss.
1929
+ * @props
1930
+ * message: ReactNode
1931
+ * action?: { label: string; onClick: () => void }
1932
+ * onClose: () => void
1933
+ * tone?: 'neutral' | 'success' | 'warning' (default 'neutral')
1934
+ * duration?: number -- ms; defaults to 5000, or 10000 with an action
1935
+ * @tokens bg-inverseSurface, text-text-inverse, text-text-inverseSuccess,
1936
+ * text-text-inverseWarning, rounded-control, shadow-overlay,
1937
+ * z-toast, duration-(--mr-motion-duration-interactive), ease-interactive,
1938
+ * focus-visible:outline-border-focus
1939
+ * @dependencies lucide-react
1940
+ * @behavior The surface is the same on every toast. Tone is a leading icon in
1941
+ * green or amber, not a colour wash: a toast already has the reader's attention because it
1942
+ * appeared, so colouring the whole surface adds nothing and makes a failure
1943
+ * read as an alarm. It also keeps one object rather than one per mood -- the
1944
+ * product had a dark pill, a light pill and a green pill doing the same job.
1945
+ *
1946
+ * Timing is tied to whether there is an action, not set per call site. 5s
1947
+ * reads comfortably; 10s is what an Undo needs, because the reader has to
1948
+ * notice the toast, read it, decide and then reach for it. Both pause on
1949
+ * hover and on keyboard focus, which is the real fix for the two toasts that
1950
+ * previously never dismissed at all -- they were held open so an Undo could
1951
+ * be caught, at the cost of a message that never left.
1952
+ * @a11y role="status" with aria-live="polite", so it is announced without
1953
+ * interrupting. The action is a real button inside the live region, reachable
1954
+ * by keyboard; focusing it pauses the timer, so a keyboard user is never
1955
+ * racing the dismissal. The icon is decorative -- the message carries the
1956
+ * meaning, since tone shown only as an icon cannot be the sole signal.
1957
+ * @variant neutral - Something happened. The default, and most toasts.
1958
+ * @variant success - A thing completed that the reader was waiting on.
1959
+ * @variant warning - It completed with something worth knowing. Not for failure -- a failure the reader must act on belongs inline, not in a message that leaves.
1960
+ * @use when reporting something that already happened, that the reader does
1961
+ * not have to act on.
1962
+ * @use with an action when the thing is reversible and reversing it is cheap
1963
+ * -- an Undo on a bulk delete.
1964
+ * @avoid when the reader must act before continuing. A toast leaves; anything
1965
+ * load-bearing belongs inline, next to what it is about.
1966
+ * @avoid when the feedback is about the control just used. A copy button's
1967
+ * tick belongs on the button, where the reader is already looking.
1968
+ * @avoid for errors that lose work. An error that leaves after ten seconds is
1969
+ * an error nobody can act on.
1970
+ * @avoid stacking several at once. Toasts queue; two at the same time means
1971
+ * the second is read and the first is not.
1972
+ * @usage
1973
+ * ```tsx
1974
+ * <Toast message="Export started" onClose={clear} />
1975
+ * <Toast message="12 accounts removed" action={{ label: 'Undo', onClick: undo }} onClose={clear} />
1976
+ * <Toast tone="success" message="Account created" onClose={clear} />
1977
+ * ```
1978
+ */
1979
+ declare function Toast({ message, action, onClose, tone, duration, className }: ToastProps): react.ReactPortal;
1980
+
1891
1981
  interface TagProps {
1892
1982
  /** The tag's text, e.g. "Digital". Keep it short: the chip doesn't wrap or truncate. */
1893
1983
  children: ReactNode;
@@ -2279,4 +2369,4 @@ interface PageHeaderProps {
2279
2369
  */
2280
2370
  declare function PageHeader({ title, description, actions, className }: PageHeaderProps): react.JSX.Element;
2281
2371
 
2282
- export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, 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 SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionHeading, type SectionHeadingProps, SectionRail, type SectionRailProps, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, type SummaryGroup, type SummaryGroupItemValue, TablePagination, type TablePaginationProps, Tag, type TagProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
2372
+ export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, 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 SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionHeading, type SectionHeadingProps, 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, Toast, type ToastProps, type ToastTone, Toggle, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
package/dist/index.d.ts CHANGED
@@ -1888,6 +1888,96 @@ interface WorkspaceAvatarProps {
1888
1888
  */
1889
1889
  declare function WorkspaceAvatar({ name, size }: WorkspaceAvatarProps): react.JSX.Element;
1890
1890
 
1891
+ type ToastTone = "neutral" | "success" | "warning";
1892
+ interface ToastProps {
1893
+ /** What happened, in a short sentence. Past tense: "12 accounts removed". */
1894
+ message: ReactNode;
1895
+ /**
1896
+ * One follow-up, usually Undo. Giving a toast an action extends how long it
1897
+ * stays, since the reader now has to notice it, read it, decide and reach.
1898
+ */
1899
+ action?: {
1900
+ label: string;
1901
+ onClick: () => void;
1902
+ };
1903
+ /** Called when the toast has dismissed itself, or the action closed it. */
1904
+ onClose: () => void;
1905
+ /**
1906
+ * Carried by a leading icon, never by the surface. The surface stays the
1907
+ * same on every toast on purpose -- see @behavior.
1908
+ */
1909
+ tone?: ToastTone;
1910
+ /**
1911
+ * Override the duration. The defaults are 5s, or 10s when there is an
1912
+ * action; both pause while hovered or focused. Set deliberately or not at
1913
+ * all -- a one-off number here is how the product ended up with six.
1914
+ */
1915
+ duration?: number;
1916
+ className?: string;
1917
+ }
1918
+ /**
1919
+ * @pattern Toast
1920
+ * @description Transient feedback about the page or the task: "12 accounts
1921
+ * removed", "Export started". Floats at the bottom of the window so it never
1922
+ * pushes the page around, dismisses itself, and may carry one action.
1923
+ *
1924
+ * It is one of three shapes of feedback, and the shape is the first decision:
1925
+ * feedback about the control you just used stays ON it (a copy button's icon
1926
+ * becoming a tick); feedback about the page or task floats, which is this;
1927
+ * and feedback you have to act on before continuing stays inline where the
1928
+ * action is, and does not dismiss.
1929
+ * @props
1930
+ * message: ReactNode
1931
+ * action?: { label: string; onClick: () => void }
1932
+ * onClose: () => void
1933
+ * tone?: 'neutral' | 'success' | 'warning' (default 'neutral')
1934
+ * duration?: number -- ms; defaults to 5000, or 10000 with an action
1935
+ * @tokens bg-inverseSurface, text-text-inverse, text-text-inverseSuccess,
1936
+ * text-text-inverseWarning, rounded-control, shadow-overlay,
1937
+ * z-toast, duration-(--mr-motion-duration-interactive), ease-interactive,
1938
+ * focus-visible:outline-border-focus
1939
+ * @dependencies lucide-react
1940
+ * @behavior The surface is the same on every toast. Tone is a leading icon in
1941
+ * green or amber, not a colour wash: a toast already has the reader's attention because it
1942
+ * appeared, so colouring the whole surface adds nothing and makes a failure
1943
+ * read as an alarm. It also keeps one object rather than one per mood -- the
1944
+ * product had a dark pill, a light pill and a green pill doing the same job.
1945
+ *
1946
+ * Timing is tied to whether there is an action, not set per call site. 5s
1947
+ * reads comfortably; 10s is what an Undo needs, because the reader has to
1948
+ * notice the toast, read it, decide and then reach for it. Both pause on
1949
+ * hover and on keyboard focus, which is the real fix for the two toasts that
1950
+ * previously never dismissed at all -- they were held open so an Undo could
1951
+ * be caught, at the cost of a message that never left.
1952
+ * @a11y role="status" with aria-live="polite", so it is announced without
1953
+ * interrupting. The action is a real button inside the live region, reachable
1954
+ * by keyboard; focusing it pauses the timer, so a keyboard user is never
1955
+ * racing the dismissal. The icon is decorative -- the message carries the
1956
+ * meaning, since tone shown only as an icon cannot be the sole signal.
1957
+ * @variant neutral - Something happened. The default, and most toasts.
1958
+ * @variant success - A thing completed that the reader was waiting on.
1959
+ * @variant warning - It completed with something worth knowing. Not for failure -- a failure the reader must act on belongs inline, not in a message that leaves.
1960
+ * @use when reporting something that already happened, that the reader does
1961
+ * not have to act on.
1962
+ * @use with an action when the thing is reversible and reversing it is cheap
1963
+ * -- an Undo on a bulk delete.
1964
+ * @avoid when the reader must act before continuing. A toast leaves; anything
1965
+ * load-bearing belongs inline, next to what it is about.
1966
+ * @avoid when the feedback is about the control just used. A copy button's
1967
+ * tick belongs on the button, where the reader is already looking.
1968
+ * @avoid for errors that lose work. An error that leaves after ten seconds is
1969
+ * an error nobody can act on.
1970
+ * @avoid stacking several at once. Toasts queue; two at the same time means
1971
+ * the second is read and the first is not.
1972
+ * @usage
1973
+ * ```tsx
1974
+ * <Toast message="Export started" onClose={clear} />
1975
+ * <Toast message="12 accounts removed" action={{ label: 'Undo', onClick: undo }} onClose={clear} />
1976
+ * <Toast tone="success" message="Account created" onClose={clear} />
1977
+ * ```
1978
+ */
1979
+ declare function Toast({ message, action, onClose, tone, duration, className }: ToastProps): react.ReactPortal;
1980
+
1891
1981
  interface TagProps {
1892
1982
  /** The tag's text, e.g. "Digital". Keep it short: the chip doesn't wrap or truncate. */
1893
1983
  children: ReactNode;
@@ -2279,4 +2369,4 @@ interface PageHeaderProps {
2279
2369
  */
2280
2370
  declare function PageHeader({ title, description, actions, className }: PageHeaderProps): react.JSX.Element;
2281
2371
 
2282
- export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, 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 SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionHeading, type SectionHeadingProps, SectionRail, type SectionRailProps, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, type SummaryGroup, type SummaryGroupItemValue, TablePagination, type TablePaginationProps, Tag, type TagProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
2372
+ export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, 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 SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionHeading, type SectionHeadingProps, 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, Toast, type ToastProps, type ToastTone, Toggle, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };