@mediaradar/design-components 0.55.0 → 0.57.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/approved-components.json +1 -1
- package/dist/index.cjs +150 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +84 -2
- package/dist/index.d.ts +84 -2
- package/dist/index.js +138 -14
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1005,6 +1005,8 @@ declare function DataScopeFilter({ value, onChange, align, className, testIdPref
|
|
|
1005
1005
|
* @use `size="sm"` (32px) for a control in a card or panel header (a card's
|
|
1006
1006
|
* Measure or Compare by), with `inlineCaption` when the value alone doesn't
|
|
1007
1007
|
* say what it sets ("Sort by: Name"). There is no 36px step.
|
|
1008
|
+
* @use `hideCaption` (40px, value only) in a toolbar above a table, beside a
|
|
1009
|
+
* SearchBar `md`, when the value names the field itself ("All statuses").
|
|
1008
1010
|
* @avoid a hand-built 36px "slim" chip; use `sm`.
|
|
1009
1011
|
* @avoid a native <select> or a hand-built dropdown.
|
|
1010
1012
|
* @avoid it for several values at once -- that's MultiSelectFilter.
|
|
@@ -1012,6 +1014,7 @@ declare function DataScopeFilter({ value, onChange, align, className, testIdPref
|
|
|
1012
1014
|
* ```tsx
|
|
1013
1015
|
* <SelectFilter caption="Rank" value={rankFilter} onChange={setRankFilter} options={['All', 'VP / Director', 'Manager', 'Coordinator']} />
|
|
1014
1016
|
* <SelectFilter caption="Group by" value={groupBy} onChange={setGroupBy} options={['Parent', 'Advertiser', 'Brand']} fullWidth testIdPrefix="dropdown-group-by" />
|
|
1017
|
+
* <SelectFilter caption="Status" hideCaption value={status} onChange={setStatus} options={['All statuses', 'Completed', 'Error']} />
|
|
1015
1018
|
* <SelectFilter caption="Sort by" size="sm" inlineCaption value={sort} onChange={setSort} options={['Name', 'Spend']} align="right" />
|
|
1016
1019
|
* <SelectFilter caption="Country" value={country} onChange={setCountry} options={['United States', 'Canada', 'United Kingdom']} renderIcon={(c) => <img src={FLAGS[c]} alt="" />} />
|
|
1017
1020
|
* ```
|
|
@@ -1057,6 +1060,14 @@ interface SelectFilterProps extends CommonProps {
|
|
|
1057
1060
|
* doesn't say what it sets.
|
|
1058
1061
|
*/
|
|
1059
1062
|
inlineCaption?: boolean;
|
|
1063
|
+
/**
|
|
1064
|
+
* With `size="md"`: drop the visible caption for a 40px trigger showing only
|
|
1065
|
+
* the value -- the height of SearchBar `md` and Button `md`, for a toolbar
|
|
1066
|
+
* above a table where the value names itself ("All statuses"). The caption
|
|
1067
|
+
* becomes the accessible name.
|
|
1068
|
+
* @since 0.56.0
|
|
1069
|
+
*/
|
|
1070
|
+
hideCaption?: boolean;
|
|
1060
1071
|
/** Fades the trigger to 40% and blocks it, e.g. while a table loads. */
|
|
1061
1072
|
disabled?: boolean;
|
|
1062
1073
|
/**
|
|
@@ -1068,7 +1079,7 @@ interface SelectFilterProps extends CommonProps {
|
|
|
1068
1079
|
*/
|
|
1069
1080
|
renderIcon?: (option: string) => ReactNode;
|
|
1070
1081
|
}
|
|
1071
|
-
declare function SelectFilter({ caption, value, options, onChange, align, fullWidth, className, testIdPrefix, loading, error, onRetry, size, inlineCaption, disabled, renderIcon, }: SelectFilterProps): react.JSX.Element;
|
|
1082
|
+
declare function SelectFilter({ caption, value, options, onChange, align, fullWidth, className, testIdPrefix, loading, error, onRetry, size, inlineCaption, hideCaption, disabled, renderIcon, }: SelectFilterProps): react.JSX.Element;
|
|
1072
1083
|
|
|
1073
1084
|
/**
|
|
1074
1085
|
* @pattern Card
|
|
@@ -3988,4 +3999,75 @@ declare function MenuLabel({ className, testIdPrefix, children }: CommonProps &
|
|
|
3988
3999
|
/** A line between groups of rows. */
|
|
3989
4000
|
declare function MenuSeparator({ className, testIdPrefix }: CommonProps): react.JSX.Element;
|
|
3990
4001
|
|
|
3991
|
-
|
|
4002
|
+
/** The order a date is written in: the person's Settings → Profile choice. */
|
|
4003
|
+
type DateOrder = "mdy" | "dmy" | "ymd";
|
|
4004
|
+
interface DateFormatOptions {
|
|
4005
|
+
/** The person's order. Default `mdy`. */
|
|
4006
|
+
order?: DateOrder;
|
|
4007
|
+
/**
|
|
4008
|
+
* `always` (default) writes the year. `auto` drops it when the date is in
|
|
4009
|
+
* the current year: only for tight spots (table cells, chips, chart
|
|
4010
|
+
* tooltips). Year first always writes the year.
|
|
4011
|
+
*/
|
|
4012
|
+
year?: "always" | "auto";
|
|
4013
|
+
/** "November" instead of "Nov": only in sentences (emails, PDF body text). Ignored by Year first. */
|
|
4014
|
+
long?: boolean;
|
|
4015
|
+
/** "Mon, Nov 14, 2026": only where the day matters, such as schedules. */
|
|
4016
|
+
weekday?: boolean;
|
|
4017
|
+
/** "Today", for `year: "auto"` and relative dates. Default: now. */
|
|
4018
|
+
now?: Date;
|
|
4019
|
+
}
|
|
4020
|
+
/** "2026-11-14": Year first, CSV exports and anything a machine reads back. */
|
|
4021
|
+
declare function formatIsoDate(d: Date): string;
|
|
4022
|
+
/**
|
|
4023
|
+
* One date in the person's order.
|
|
4024
|
+
* mdy "Nov 14, 2026" · dmy "14 Nov 2026" · ymd "2026-11-14".
|
|
4025
|
+
*/
|
|
4026
|
+
declare function formatDate(d: Date, opts?: DateFormatOptions): string;
|
|
4027
|
+
interface DateRangeFormatOptions extends Omit<DateFormatOptions, "weekday"> {
|
|
4028
|
+
/** In a sentence, the dash becomes "to": "Oct 4 to 17, 2026". */
|
|
4029
|
+
sentence?: boolean;
|
|
4030
|
+
}
|
|
4031
|
+
/**
|
|
4032
|
+
* A span, with the parts both ends share written once.
|
|
4033
|
+
* mdy "Oct 4 – 17, 2026", "Oct 4 – Nov 2, 2026", "Dec 20, 2025 – Jan 5, 2026"
|
|
4034
|
+
* dmy "4–17 Oct 2026", "4 Oct – 2 Nov 2026", "20 Dec 2025 – 5 Jan 2026"
|
|
4035
|
+
* ymd "2026-10-04 – 2026-10-17" (always both in full)
|
|
4036
|
+
* The dash is tight between two bare numbers and spaced otherwise; in a
|
|
4037
|
+
* sentence it's "to".
|
|
4038
|
+
*/
|
|
4039
|
+
declare function formatDateRange(start: Date, end: Date, opts?: DateRangeFormatOptions): string;
|
|
4040
|
+
/** A range with one end open: "Since Oct 4, 2026" / "Until Oct 4, 2026". */
|
|
4041
|
+
declare function formatOpenRange(start: Date | null | undefined, end: Date | null | undefined, opts?: DateFormatOptions): string;
|
|
4042
|
+
/** The time alone: mdy "9:14 AM"; dmy and ymd "09:14". */
|
|
4043
|
+
declare function formatTime(d: Date, opts?: Pick<DateFormatOptions, "order">): string;
|
|
4044
|
+
/** Date and time, joined by a comma: "Nov 14, 2026, 9:14 AM" / "14 Nov 2026, 09:14". */
|
|
4045
|
+
declare function formatDateTime(d: Date, opts?: DateFormatOptions): string;
|
|
4046
|
+
/** A month with no day: "Jun 2026", the same in every order. */
|
|
4047
|
+
declare function formatMonth(d: Date): string;
|
|
4048
|
+
/** "Q3 2026". */
|
|
4049
|
+
declare function formatQuarter(d: Date): string;
|
|
4050
|
+
/** "Week of Nov 14" (the week's first day, in the person's order). */
|
|
4051
|
+
declare function formatWeek(firstDay: Date, opts?: DateFormatOptions): string;
|
|
4052
|
+
interface AxisMonthLabel {
|
|
4053
|
+
/** "Jan" on every tick. */
|
|
4054
|
+
month: string;
|
|
4055
|
+
/** "2026" under the first tick and wherever the year changes; otherwise undefined. */
|
|
4056
|
+
year?: string;
|
|
4057
|
+
}
|
|
4058
|
+
/** Monthly chart axis: the month on every tick, the year once and where it changes. */
|
|
4059
|
+
declare function formatMonthAxis(months: Date[]): AxisMonthLabel[];
|
|
4060
|
+
/**
|
|
4061
|
+
* For activity only (last updated, created, last viewed), never for data,
|
|
4062
|
+
* filters, run dates, exports, PDFs or emails. Up to 7 days:
|
|
4063
|
+
* "Just now", "5 min ago", "3 hr ago", "Yesterday", "3 days ago"; then the
|
|
4064
|
+
* date. Show `formatDateTime` on hover so the exact time is always one step away.
|
|
4065
|
+
*/
|
|
4066
|
+
declare function formatRelative(d: Date, opts?: DateFormatOptions): string;
|
|
4067
|
+
/**
|
|
4068
|
+
* A new person's order before they choose one, from the account's market
|
|
4069
|
+
* (ISO country code): US and Canada Month first; everywhere else Day first.
|
|
4070
|
+
*/
|
|
4071
|
+
declare function defaultDateOrder(country: string | null | undefined): DateOrder;
|
|
4072
|
+
|
|
4073
|
+
export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, AllFiltersButton, type AllFiltersButtonProps, type AxisMonthLabel, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, BarList, type BarListProps, type BarListRow, Button, type ButtonProps, Card, type CardProps, ChartLegend, type ChartLegendProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, type CommonProps, CopyButton, type CopyButtonProps, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, DataTable, type DataTableColumn, type DataTableColumnWidth, type DataTableDensity, type DataTableProps, type DateFormatOptions, type DateGranularity, type DateOrder, DateRangeFilter, type DateRangeFilterProps, type DateRangeFormatOptions, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, Drawer, type DrawerProps, type DrawerSize, EmptyState, type EmptyStateProps, type EmptyStateSize, FilterChipBar, type FilterChipBarProps, FilterDrawer, type FilterDrawerProps, type FilterDrawerSection, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, InlineMessage, type InlineMessageProps, type InlineMessageTone, LegendItem, type LegendItemProps, type LegendMark, LineChartPlaceholder, type LineChartPlaceholderProps, MediaLabel, type MediaLabelProps, type MediaType, Menu, MenuItem, type MenuItemProps, MenuLabel, type MenuProps, MenuSeparator, 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, PrimaryBadge, type PrimaryBadgeProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarSize, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, type SearchScope, 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, StatStrip, type StatStripProps, StatTile, type StatTileProps, 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, defaultDateOrder, formatDate, formatDateRange, formatDateTime, formatIsoDate, formatMonth, formatMonthAxis, formatOpenRange, formatQuarter, formatRelative, formatTime, formatWeek, noResultsBody, resolveRange, sortProp };
|
package/dist/index.d.ts
CHANGED
|
@@ -1005,6 +1005,8 @@ declare function DataScopeFilter({ value, onChange, align, className, testIdPref
|
|
|
1005
1005
|
* @use `size="sm"` (32px) for a control in a card or panel header (a card's
|
|
1006
1006
|
* Measure or Compare by), with `inlineCaption` when the value alone doesn't
|
|
1007
1007
|
* say what it sets ("Sort by: Name"). There is no 36px step.
|
|
1008
|
+
* @use `hideCaption` (40px, value only) in a toolbar above a table, beside a
|
|
1009
|
+
* SearchBar `md`, when the value names the field itself ("All statuses").
|
|
1008
1010
|
* @avoid a hand-built 36px "slim" chip; use `sm`.
|
|
1009
1011
|
* @avoid a native <select> or a hand-built dropdown.
|
|
1010
1012
|
* @avoid it for several values at once -- that's MultiSelectFilter.
|
|
@@ -1012,6 +1014,7 @@ declare function DataScopeFilter({ value, onChange, align, className, testIdPref
|
|
|
1012
1014
|
* ```tsx
|
|
1013
1015
|
* <SelectFilter caption="Rank" value={rankFilter} onChange={setRankFilter} options={['All', 'VP / Director', 'Manager', 'Coordinator']} />
|
|
1014
1016
|
* <SelectFilter caption="Group by" value={groupBy} onChange={setGroupBy} options={['Parent', 'Advertiser', 'Brand']} fullWidth testIdPrefix="dropdown-group-by" />
|
|
1017
|
+
* <SelectFilter caption="Status" hideCaption value={status} onChange={setStatus} options={['All statuses', 'Completed', 'Error']} />
|
|
1015
1018
|
* <SelectFilter caption="Sort by" size="sm" inlineCaption value={sort} onChange={setSort} options={['Name', 'Spend']} align="right" />
|
|
1016
1019
|
* <SelectFilter caption="Country" value={country} onChange={setCountry} options={['United States', 'Canada', 'United Kingdom']} renderIcon={(c) => <img src={FLAGS[c]} alt="" />} />
|
|
1017
1020
|
* ```
|
|
@@ -1057,6 +1060,14 @@ interface SelectFilterProps extends CommonProps {
|
|
|
1057
1060
|
* doesn't say what it sets.
|
|
1058
1061
|
*/
|
|
1059
1062
|
inlineCaption?: boolean;
|
|
1063
|
+
/**
|
|
1064
|
+
* With `size="md"`: drop the visible caption for a 40px trigger showing only
|
|
1065
|
+
* the value -- the height of SearchBar `md` and Button `md`, for a toolbar
|
|
1066
|
+
* above a table where the value names itself ("All statuses"). The caption
|
|
1067
|
+
* becomes the accessible name.
|
|
1068
|
+
* @since 0.56.0
|
|
1069
|
+
*/
|
|
1070
|
+
hideCaption?: boolean;
|
|
1060
1071
|
/** Fades the trigger to 40% and blocks it, e.g. while a table loads. */
|
|
1061
1072
|
disabled?: boolean;
|
|
1062
1073
|
/**
|
|
@@ -1068,7 +1079,7 @@ interface SelectFilterProps extends CommonProps {
|
|
|
1068
1079
|
*/
|
|
1069
1080
|
renderIcon?: (option: string) => ReactNode;
|
|
1070
1081
|
}
|
|
1071
|
-
declare function SelectFilter({ caption, value, options, onChange, align, fullWidth, className, testIdPrefix, loading, error, onRetry, size, inlineCaption, disabled, renderIcon, }: SelectFilterProps): react.JSX.Element;
|
|
1082
|
+
declare function SelectFilter({ caption, value, options, onChange, align, fullWidth, className, testIdPrefix, loading, error, onRetry, size, inlineCaption, hideCaption, disabled, renderIcon, }: SelectFilterProps): react.JSX.Element;
|
|
1072
1083
|
|
|
1073
1084
|
/**
|
|
1074
1085
|
* @pattern Card
|
|
@@ -3988,4 +3999,75 @@ declare function MenuLabel({ className, testIdPrefix, children }: CommonProps &
|
|
|
3988
3999
|
/** A line between groups of rows. */
|
|
3989
4000
|
declare function MenuSeparator({ className, testIdPrefix }: CommonProps): react.JSX.Element;
|
|
3990
4001
|
|
|
3991
|
-
|
|
4002
|
+
/** The order a date is written in: the person's Settings → Profile choice. */
|
|
4003
|
+
type DateOrder = "mdy" | "dmy" | "ymd";
|
|
4004
|
+
interface DateFormatOptions {
|
|
4005
|
+
/** The person's order. Default `mdy`. */
|
|
4006
|
+
order?: DateOrder;
|
|
4007
|
+
/**
|
|
4008
|
+
* `always` (default) writes the year. `auto` drops it when the date is in
|
|
4009
|
+
* the current year: only for tight spots (table cells, chips, chart
|
|
4010
|
+
* tooltips). Year first always writes the year.
|
|
4011
|
+
*/
|
|
4012
|
+
year?: "always" | "auto";
|
|
4013
|
+
/** "November" instead of "Nov": only in sentences (emails, PDF body text). Ignored by Year first. */
|
|
4014
|
+
long?: boolean;
|
|
4015
|
+
/** "Mon, Nov 14, 2026": only where the day matters, such as schedules. */
|
|
4016
|
+
weekday?: boolean;
|
|
4017
|
+
/** "Today", for `year: "auto"` and relative dates. Default: now. */
|
|
4018
|
+
now?: Date;
|
|
4019
|
+
}
|
|
4020
|
+
/** "2026-11-14": Year first, CSV exports and anything a machine reads back. */
|
|
4021
|
+
declare function formatIsoDate(d: Date): string;
|
|
4022
|
+
/**
|
|
4023
|
+
* One date in the person's order.
|
|
4024
|
+
* mdy "Nov 14, 2026" · dmy "14 Nov 2026" · ymd "2026-11-14".
|
|
4025
|
+
*/
|
|
4026
|
+
declare function formatDate(d: Date, opts?: DateFormatOptions): string;
|
|
4027
|
+
interface DateRangeFormatOptions extends Omit<DateFormatOptions, "weekday"> {
|
|
4028
|
+
/** In a sentence, the dash becomes "to": "Oct 4 to 17, 2026". */
|
|
4029
|
+
sentence?: boolean;
|
|
4030
|
+
}
|
|
4031
|
+
/**
|
|
4032
|
+
* A span, with the parts both ends share written once.
|
|
4033
|
+
* mdy "Oct 4 – 17, 2026", "Oct 4 – Nov 2, 2026", "Dec 20, 2025 – Jan 5, 2026"
|
|
4034
|
+
* dmy "4–17 Oct 2026", "4 Oct – 2 Nov 2026", "20 Dec 2025 – 5 Jan 2026"
|
|
4035
|
+
* ymd "2026-10-04 – 2026-10-17" (always both in full)
|
|
4036
|
+
* The dash is tight between two bare numbers and spaced otherwise; in a
|
|
4037
|
+
* sentence it's "to".
|
|
4038
|
+
*/
|
|
4039
|
+
declare function formatDateRange(start: Date, end: Date, opts?: DateRangeFormatOptions): string;
|
|
4040
|
+
/** A range with one end open: "Since Oct 4, 2026" / "Until Oct 4, 2026". */
|
|
4041
|
+
declare function formatOpenRange(start: Date | null | undefined, end: Date | null | undefined, opts?: DateFormatOptions): string;
|
|
4042
|
+
/** The time alone: mdy "9:14 AM"; dmy and ymd "09:14". */
|
|
4043
|
+
declare function formatTime(d: Date, opts?: Pick<DateFormatOptions, "order">): string;
|
|
4044
|
+
/** Date and time, joined by a comma: "Nov 14, 2026, 9:14 AM" / "14 Nov 2026, 09:14". */
|
|
4045
|
+
declare function formatDateTime(d: Date, opts?: DateFormatOptions): string;
|
|
4046
|
+
/** A month with no day: "Jun 2026", the same in every order. */
|
|
4047
|
+
declare function formatMonth(d: Date): string;
|
|
4048
|
+
/** "Q3 2026". */
|
|
4049
|
+
declare function formatQuarter(d: Date): string;
|
|
4050
|
+
/** "Week of Nov 14" (the week's first day, in the person's order). */
|
|
4051
|
+
declare function formatWeek(firstDay: Date, opts?: DateFormatOptions): string;
|
|
4052
|
+
interface AxisMonthLabel {
|
|
4053
|
+
/** "Jan" on every tick. */
|
|
4054
|
+
month: string;
|
|
4055
|
+
/** "2026" under the first tick and wherever the year changes; otherwise undefined. */
|
|
4056
|
+
year?: string;
|
|
4057
|
+
}
|
|
4058
|
+
/** Monthly chart axis: the month on every tick, the year once and where it changes. */
|
|
4059
|
+
declare function formatMonthAxis(months: Date[]): AxisMonthLabel[];
|
|
4060
|
+
/**
|
|
4061
|
+
* For activity only (last updated, created, last viewed), never for data,
|
|
4062
|
+
* filters, run dates, exports, PDFs or emails. Up to 7 days:
|
|
4063
|
+
* "Just now", "5 min ago", "3 hr ago", "Yesterday", "3 days ago"; then the
|
|
4064
|
+
* date. Show `formatDateTime` on hover so the exact time is always one step away.
|
|
4065
|
+
*/
|
|
4066
|
+
declare function formatRelative(d: Date, opts?: DateFormatOptions): string;
|
|
4067
|
+
/**
|
|
4068
|
+
* A new person's order before they choose one, from the account's market
|
|
4069
|
+
* (ISO country code): US and Canada Month first; everywhere else Day first.
|
|
4070
|
+
*/
|
|
4071
|
+
declare function defaultDateOrder(country: string | null | undefined): DateOrder;
|
|
4072
|
+
|
|
4073
|
+
export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, AllFiltersButton, type AllFiltersButtonProps, type AxisMonthLabel, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, BarList, type BarListProps, type BarListRow, Button, type ButtonProps, Card, type CardProps, ChartLegend, type ChartLegendProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, type CommonProps, CopyButton, type CopyButtonProps, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, DataTable, type DataTableColumn, type DataTableColumnWidth, type DataTableDensity, type DataTableProps, type DateFormatOptions, type DateGranularity, type DateOrder, DateRangeFilter, type DateRangeFilterProps, type DateRangeFormatOptions, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, Drawer, type DrawerProps, type DrawerSize, EmptyState, type EmptyStateProps, type EmptyStateSize, FilterChipBar, type FilterChipBarProps, FilterDrawer, type FilterDrawerProps, type FilterDrawerSection, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, InlineMessage, type InlineMessageProps, type InlineMessageTone, LegendItem, type LegendItemProps, type LegendMark, LineChartPlaceholder, type LineChartPlaceholderProps, MediaLabel, type MediaLabelProps, type MediaType, Menu, MenuItem, type MenuItemProps, MenuLabel, type MenuProps, MenuSeparator, 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, PrimaryBadge, type PrimaryBadgeProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarSize, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, type SearchScope, 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, StatStrip, type StatStripProps, StatTile, type StatTileProps, 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, defaultDateOrder, formatDate, formatDateRange, formatDateTime, formatIsoDate, formatMonth, formatMonthAxis, formatOpenRange, formatQuarter, formatRelative, formatTime, formatWeek, noResultsBody, resolveRange, sortProp };
|
package/dist/index.js
CHANGED
|
@@ -862,12 +862,12 @@ function DateRangeFilter({
|
|
|
862
862
|
className,
|
|
863
863
|
testIdPrefix,
|
|
864
864
|
granularity = "day",
|
|
865
|
-
formatDate,
|
|
865
|
+
formatDate: formatDate2,
|
|
866
866
|
formatRange
|
|
867
867
|
}) {
|
|
868
868
|
const monthly = granularity === "month";
|
|
869
|
-
const formatted = !!(
|
|
870
|
-
const showDate =
|
|
869
|
+
const formatted = !!(formatDate2 || formatRange);
|
|
870
|
+
const showDate = formatDate2 ?? fmt;
|
|
871
871
|
const showRange = (s, e) => formatRange ? formatRange(s, e) : sameDay(s, e) ? showDate(s) : `${showDate(s)} \u2013 ${showDate(e)}`;
|
|
872
872
|
const showValue = (v, s, e) => formatted && !monthly && (v === `${fmt(s)} \u2014 ${fmt(e)}` || v === `${fmt(s)} \u2013 ${fmt(e)}`) ? showRange(s, e) : v;
|
|
873
873
|
const snap = (s, e) => monthly ? [firstOfMonth(s), lastOfMonth(e)] : [s, e];
|
|
@@ -2010,10 +2010,12 @@ function SelectFilter({
|
|
|
2010
2010
|
onRetry,
|
|
2011
2011
|
size = "md",
|
|
2012
2012
|
inlineCaption = false,
|
|
2013
|
+
hideCaption = false,
|
|
2013
2014
|
disabled = false,
|
|
2014
2015
|
renderIcon
|
|
2015
2016
|
}) {
|
|
2016
2017
|
const sm = size === "sm";
|
|
2018
|
+
const bare = !sm && hideCaption;
|
|
2017
2019
|
const [open, setOpen] = useState6(false);
|
|
2018
2020
|
const [pos, setPos] = useState6(null);
|
|
2019
2021
|
const ref = useRef7(null);
|
|
@@ -2074,16 +2076,16 @@ function SelectFilter({
|
|
|
2074
2076
|
onClick: () => setOpen((o) => !o),
|
|
2075
2077
|
"aria-expanded": open,
|
|
2076
2078
|
"aria-haspopup": "listbox",
|
|
2077
|
-
"aria-label": sm && !inlineCaption ? caption : void 0,
|
|
2079
|
+
"aria-label": sm && !inlineCaption || bare ? caption : void 0,
|
|
2078
2080
|
disabled,
|
|
2079
2081
|
className: cn(
|
|
2080
|
-
sm ? "flex h-8 items-center gap-1.5 rounded-control border border-border-strong bg-input pl-2.5 pr-2 text-dense font-medium text-text-primary transition-colors hover:bg-subtle focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus" : chipTriggerClass(),
|
|
2082
|
+
sm ? "flex h-8 items-center gap-1.5 rounded-control border border-border-strong bg-input pl-2.5 pr-2 text-dense font-medium text-text-primary transition-colors hover:bg-subtle focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus" : bare ? "flex h-10 items-center gap-2 rounded-control border border-border-strong bg-input pl-3 pr-2.5 text-sm font-medium text-text-primary transition-colors hover:bg-subtle focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus" : chipTriggerClass(),
|
|
2081
2083
|
"disabled:pointer-events-none disabled:opacity-40",
|
|
2082
2084
|
fullWidth && "w-full justify-between",
|
|
2083
2085
|
className
|
|
2084
2086
|
),
|
|
2085
2087
|
children: [
|
|
2086
|
-
sm ? triggerValue : /* @__PURE__ */ jsx14(ChipContent, { caption, value: triggerValue }),
|
|
2088
|
+
sm || bare ? triggerValue : /* @__PURE__ */ jsx14(ChipContent, { caption, value: triggerValue }),
|
|
2087
2089
|
/* @__PURE__ */ jsx14(
|
|
2088
2090
|
ChevronDown5,
|
|
2089
2091
|
{
|
|
@@ -4408,10 +4410,10 @@ function resolveRange(label, today = startOfToday()) {
|
|
|
4408
4410
|
}
|
|
4409
4411
|
return [new Date(end.getFullYear(), end.getMonth() - 6, 1), end];
|
|
4410
4412
|
}
|
|
4411
|
-
function spanLabel2(label, today,
|
|
4413
|
+
function spanLabel2(label, today, formatDate2, formatRange) {
|
|
4412
4414
|
const [s, e] = resolveRange(label, today);
|
|
4413
4415
|
if (formatRange) return formatRange(s, e);
|
|
4414
|
-
const f =
|
|
4416
|
+
const f = formatDate2 ?? fmtDate;
|
|
4415
4417
|
return `${f(s)} \u2013 ${f(e)}`;
|
|
4416
4418
|
}
|
|
4417
4419
|
function MiniSelect({ value, onChange, options }) {
|
|
@@ -4438,7 +4440,7 @@ function DateRangePicker({
|
|
|
4438
4440
|
showFooter = false,
|
|
4439
4441
|
today,
|
|
4440
4442
|
years,
|
|
4441
|
-
formatDate,
|
|
4443
|
+
formatDate: formatDate2,
|
|
4442
4444
|
formatRange,
|
|
4443
4445
|
className,
|
|
4444
4446
|
testIdPrefix
|
|
@@ -4500,7 +4502,7 @@ function DateRangePicker({
|
|
|
4500
4502
|
className: chipTriggerClass(),
|
|
4501
4503
|
children: [
|
|
4502
4504
|
/* @__PURE__ */ jsxs39("span", { className: "flex flex-col gap-1 text-left leading-none", children: [
|
|
4503
|
-
/* @__PURE__ */ jsx43("span", { className: "text-control-caption leading-none text-text-tertiary", children: spanLabel2(value, end,
|
|
4505
|
+
/* @__PURE__ */ jsx43("span", { className: "text-control-caption leading-none text-text-tertiary", children: spanLabel2(value, end, formatDate2, formatRange) }),
|
|
4504
4506
|
/* @__PURE__ */ jsx43("span", { className: "text-xs leading-none font-medium text-text-primary", children: value })
|
|
4505
4507
|
] }),
|
|
4506
4508
|
/* @__PURE__ */ jsx43(ChevronDown9, { size: 14, "aria-hidden": "true", className: cn("shrink-0 text-text-secondary transition-transform", open && "rotate-180") })
|
|
@@ -5268,7 +5270,7 @@ function DataTable({
|
|
|
5268
5270
|
}) {
|
|
5269
5271
|
const titleId = useId10();
|
|
5270
5272
|
const head = HEAD_PAD[density];
|
|
5271
|
-
const
|
|
5273
|
+
const pad2 = CELL_PAD[density];
|
|
5272
5274
|
const align = (c) => c.numeric ? "text-right" : "text-left";
|
|
5273
5275
|
const width = (c) => WIDTH3[c.width ?? (c.numeric ? "md" : "fill")];
|
|
5274
5276
|
const onSort = (key) => {
|
|
@@ -5301,7 +5303,7 @@ function DataTable({
|
|
|
5301
5303
|
{
|
|
5302
5304
|
scope: "col",
|
|
5303
5305
|
"aria-sort": c.sortable ? ariaSortFor(sort, c.key) : void 0,
|
|
5304
|
-
className: cn("border-b border-border-default font-semibold", head, align(c), width(c)),
|
|
5306
|
+
className: cn("whitespace-nowrap border-b border-border-default font-semibold", head, align(c), width(c)),
|
|
5305
5307
|
children: c.sortable && onSortChange ? /* @__PURE__ */ jsx54(
|
|
5306
5308
|
SortButton,
|
|
5307
5309
|
{
|
|
@@ -5316,7 +5318,7 @@ function DataTable({
|
|
|
5316
5318
|
},
|
|
5317
5319
|
c.key
|
|
5318
5320
|
)) }) }),
|
|
5319
|
-
/* @__PURE__ */ jsx54("tbody", { className: "text-dense text-text-primary", children: loading ? Array.from({ length: loadingRows }, (_, i) => /* @__PURE__ */ jsx54("tr", { "aria-hidden": "true", className: "[&:last-child>td]:border-b-0", children: columns.map((c) => /* @__PURE__ */ jsx54("td", { className: cn("border-b border-border-default",
|
|
5321
|
+
/* @__PURE__ */ jsx54("tbody", { className: "text-dense text-text-primary", children: loading ? Array.from({ length: loadingRows }, (_, i) => /* @__PURE__ */ jsx54("tr", { "aria-hidden": "true", className: "[&:last-child>td]:border-b-0", children: columns.map((c) => /* @__PURE__ */ jsx54("td", { className: cn("border-b border-border-default", pad2, align(c)), children: /* @__PURE__ */ jsx54(
|
|
5320
5322
|
"span",
|
|
5321
5323
|
{
|
|
5322
5324
|
className: cn(
|
|
@@ -5327,7 +5329,7 @@ function DataTable({
|
|
|
5327
5329
|
) }, c.key)) }, i)) : rows.length === 0 ? /* @__PURE__ */ jsx54("tr", { children: /* @__PURE__ */ jsx54("td", { colSpan: columns.length, className: "px-6 py-12", children: empty ?? /* @__PURE__ */ jsx54(NoResultsEmptyState, {}) }) }) : rows.map((row) => /* @__PURE__ */ jsx54("tr", { className: "hover:bg-subtle [&:last-child>td]:border-b-0", children: columns.map((c) => /* @__PURE__ */ jsx54(
|
|
5328
5330
|
"td",
|
|
5329
5331
|
{
|
|
5330
|
-
className: cn("border-b border-border-default",
|
|
5332
|
+
className: cn("border-b border-border-default", pad2, align(c), c.numeric && "tabular-nums"),
|
|
5331
5333
|
children: c.cell(row)
|
|
5332
5334
|
},
|
|
5333
5335
|
c.key
|
|
@@ -5790,6 +5792,116 @@ function MenuLabel({ className, testIdPrefix, children }) {
|
|
|
5790
5792
|
function MenuSeparator({ className, testIdPrefix }) {
|
|
5791
5793
|
return /* @__PURE__ */ jsx62("div", { role: "separator", "data-testid": testIdPrefix, className: cn("-mx-1 my-1 border-t border-border-default", className) });
|
|
5792
5794
|
}
|
|
5795
|
+
|
|
5796
|
+
// src/dates.ts
|
|
5797
|
+
var MONTHS2 = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
5798
|
+
var MONTHS_LONG = [
|
|
5799
|
+
"January",
|
|
5800
|
+
"February",
|
|
5801
|
+
"March",
|
|
5802
|
+
"April",
|
|
5803
|
+
"May",
|
|
5804
|
+
"June",
|
|
5805
|
+
"July",
|
|
5806
|
+
"August",
|
|
5807
|
+
"September",
|
|
5808
|
+
"October",
|
|
5809
|
+
"November",
|
|
5810
|
+
"December"
|
|
5811
|
+
];
|
|
5812
|
+
var WEEKDAYS2 = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
5813
|
+
var EN_DASH = "\u2013";
|
|
5814
|
+
var pad = (n) => String(n).padStart(2, "0");
|
|
5815
|
+
function formatIsoDate(d) {
|
|
5816
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
|
|
5817
|
+
}
|
|
5818
|
+
function showYear(d, opts) {
|
|
5819
|
+
if (opts.year !== "auto") return true;
|
|
5820
|
+
return d.getFullYear() !== (opts.now ?? /* @__PURE__ */ new Date()).getFullYear();
|
|
5821
|
+
}
|
|
5822
|
+
function formatDate(d, opts = {}) {
|
|
5823
|
+
const order = opts.order ?? "mdy";
|
|
5824
|
+
const weekday = opts.weekday ? `${WEEKDAYS2[d.getDay()]}, ` : "";
|
|
5825
|
+
if (order === "ymd") return weekday + formatIsoDate(d);
|
|
5826
|
+
const mon = (opts.long ? MONTHS_LONG : MONTHS2)[d.getMonth()];
|
|
5827
|
+
const day = d.getDate();
|
|
5828
|
+
const year = showYear(d, opts);
|
|
5829
|
+
if (order === "dmy") return weekday + (year ? `${day} ${mon} ${d.getFullYear()}` : `${day} ${mon}`);
|
|
5830
|
+
return weekday + (year ? `${mon} ${day}, ${d.getFullYear()}` : `${mon} ${day}`);
|
|
5831
|
+
}
|
|
5832
|
+
var sameDay2 = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
5833
|
+
function formatDateRange(start, end, opts = {}) {
|
|
5834
|
+
const order = opts.order ?? "mdy";
|
|
5835
|
+
if (sameDay2(start, end)) return formatDate(start, opts);
|
|
5836
|
+
const join = (a, b, tight = false) => opts.sentence ? `${a} to ${b}` : tight ? `${a}${EN_DASH}${b}` : `${a} ${EN_DASH} ${b}`;
|
|
5837
|
+
if (order === "ymd") return join(formatIsoDate(start), formatIsoDate(end));
|
|
5838
|
+
const sameYear = start.getFullYear() === end.getFullYear();
|
|
5839
|
+
if (!sameYear) {
|
|
5840
|
+
const full = { ...opts, year: "always" };
|
|
5841
|
+
return join(formatDate(start, full), formatDate(end, full));
|
|
5842
|
+
}
|
|
5843
|
+
const year = showYear(end, opts) ? end.getFullYear() : void 0;
|
|
5844
|
+
const mons = opts.long ? MONTHS_LONG : MONTHS2;
|
|
5845
|
+
const ms = mons[start.getMonth()];
|
|
5846
|
+
const me = mons[end.getMonth()];
|
|
5847
|
+
const sameMonth = start.getMonth() === end.getMonth();
|
|
5848
|
+
const s = start.getDate();
|
|
5849
|
+
const e = end.getDate();
|
|
5850
|
+
if (order === "dmy") {
|
|
5851
|
+
const tail2 = year === void 0 ? "" : ` ${year}`;
|
|
5852
|
+
return sameMonth ? `${join(String(s), String(e), true)} ${me}${tail2}` : `${join(`${s} ${ms}`, `${e} ${me}`)}${tail2}`;
|
|
5853
|
+
}
|
|
5854
|
+
const tail = year === void 0 ? "" : `, ${year}`;
|
|
5855
|
+
return sameMonth ? `${join(`${ms} ${s}`, String(e))}${tail}` : `${join(`${ms} ${s}`, `${me} ${e}`)}${tail}`;
|
|
5856
|
+
}
|
|
5857
|
+
function formatOpenRange(start, end, opts = {}) {
|
|
5858
|
+
if (start && end) return formatDateRange(start, end, opts);
|
|
5859
|
+
if (start) return `Since ${formatDate(start, opts)}`;
|
|
5860
|
+
if (end) return `Until ${formatDate(end, opts)}`;
|
|
5861
|
+
return "";
|
|
5862
|
+
}
|
|
5863
|
+
function formatTime(d, opts = {}) {
|
|
5864
|
+
const h = d.getHours();
|
|
5865
|
+
const m = pad(d.getMinutes());
|
|
5866
|
+
if ((opts.order ?? "mdy") !== "mdy") return `${pad(h)}:${m}`;
|
|
5867
|
+
return `${h % 12 || 12}:${m} ${h < 12 ? "AM" : "PM"}`;
|
|
5868
|
+
}
|
|
5869
|
+
function formatDateTime(d, opts = {}) {
|
|
5870
|
+
return `${formatDate(d, opts)}, ${formatTime(d, opts)}`;
|
|
5871
|
+
}
|
|
5872
|
+
function formatMonth(d) {
|
|
5873
|
+
return `${MONTHS2[d.getMonth()]} ${d.getFullYear()}`;
|
|
5874
|
+
}
|
|
5875
|
+
function formatQuarter(d) {
|
|
5876
|
+
return `Q${Math.floor(d.getMonth() / 3) + 1} ${d.getFullYear()}`;
|
|
5877
|
+
}
|
|
5878
|
+
function formatWeek(firstDay, opts = {}) {
|
|
5879
|
+
return `Week of ${formatDate(firstDay, { ...opts, year: opts.year ?? "auto" })}`;
|
|
5880
|
+
}
|
|
5881
|
+
function formatMonthAxis(months) {
|
|
5882
|
+
return months.map((d, i) => {
|
|
5883
|
+
const changed = i === 0 || d.getFullYear() !== months[i - 1].getFullYear();
|
|
5884
|
+
return { month: MONTHS2[d.getMonth()], year: changed ? String(d.getFullYear()) : void 0 };
|
|
5885
|
+
});
|
|
5886
|
+
}
|
|
5887
|
+
var DAY_MS = 864e5;
|
|
5888
|
+
var startOfDay2 = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();
|
|
5889
|
+
function formatRelative(d, opts = {}) {
|
|
5890
|
+
const now = opts.now ?? /* @__PURE__ */ new Date();
|
|
5891
|
+
const ms = now.getTime() - d.getTime();
|
|
5892
|
+
if (ms < 0) return formatDate(d, opts);
|
|
5893
|
+
if (ms < 6e4) return "Just now";
|
|
5894
|
+
if (ms < 36e5) return `${Math.floor(ms / 6e4)} min ago`;
|
|
5895
|
+
if (ms < DAY_MS) return `${Math.floor(ms / 36e5)} hr ago`;
|
|
5896
|
+
const days = Math.round((startOfDay2(now) - startOfDay2(d)) / DAY_MS);
|
|
5897
|
+
if (days <= 1) return "Yesterday";
|
|
5898
|
+
if (days <= 7) return `${days} days ago`;
|
|
5899
|
+
return formatDate(d, opts);
|
|
5900
|
+
}
|
|
5901
|
+
function defaultDateOrder(country) {
|
|
5902
|
+
const c = (country ?? "").toUpperCase();
|
|
5903
|
+
return c === "US" || c === "CA" || c === "" ? "mdy" : "dmy";
|
|
5904
|
+
}
|
|
5793
5905
|
export {
|
|
5794
5906
|
AISpark,
|
|
5795
5907
|
AdvertiserNoResults,
|
|
@@ -5867,6 +5979,18 @@ export {
|
|
|
5867
5979
|
buttonVariants,
|
|
5868
5980
|
chipTriggerClass,
|
|
5869
5981
|
cycleSort,
|
|
5982
|
+
defaultDateOrder,
|
|
5983
|
+
formatDate,
|
|
5984
|
+
formatDateRange,
|
|
5985
|
+
formatDateTime,
|
|
5986
|
+
formatIsoDate,
|
|
5987
|
+
formatMonth,
|
|
5988
|
+
formatMonthAxis,
|
|
5989
|
+
formatOpenRange,
|
|
5990
|
+
formatQuarter,
|
|
5991
|
+
formatRelative,
|
|
5992
|
+
formatTime,
|
|
5993
|
+
formatWeek,
|
|
5870
5994
|
noResultsBody,
|
|
5871
5995
|
resolveRange,
|
|
5872
5996
|
sortProp
|