@mediaradar/design-components 0.56.0 → 0.58.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 +212 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +103 -1
- package/dist/index.d.ts +103 -1
- package/dist/index.js +194 -10
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/scripts/tailwind-coverage.mjs +3 -1
package/dist/index.d.cts
CHANGED
|
@@ -3999,4 +3999,106 @@ declare function MenuLabel({ className, testIdPrefix, children }: CommonProps &
|
|
|
3999
3999
|
/** A line between groups of rows. */
|
|
4000
4000
|
declare function MenuSeparator({ className, testIdPrefix }: CommonProps): react.JSX.Element;
|
|
4001
4001
|
|
|
4002
|
-
|
|
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
|
+
type Currency = "USD" | "CAD" | "GBP" | "EUR";
|
|
4074
|
+
interface NumberFormatOptions {
|
|
4075
|
+
/** The person's interface language (`en-US`, `en-GB`, `en-CA`, …). Default `en-US`. */
|
|
4076
|
+
language?: string;
|
|
4077
|
+
}
|
|
4078
|
+
interface MoneyFormatOptions extends NumberFormatOptions {
|
|
4079
|
+
/** Default `USD`. */
|
|
4080
|
+
currency?: Currency;
|
|
4081
|
+
/**
|
|
4082
|
+
* True where US and Canadian dollars can appear together (multi-country
|
|
4083
|
+
* accounts, comparisons): CAD shows "CA$" and USD "US$". Otherwise both
|
|
4084
|
+
* are a plain "$", as each country writes its own dollar.
|
|
4085
|
+
*/
|
|
4086
|
+
mixedDollars?: boolean;
|
|
4087
|
+
}
|
|
4088
|
+
/** The missing-value mark. The table explains it on hover ("No data"). */
|
|
4089
|
+
declare const NO_VALUE = "\u2014";
|
|
4090
|
+
/** A count (ads, impressions, advertisers): "12.4K", "8,450". */
|
|
4091
|
+
declare function formatCount(value: number | null | undefined, opts?: NumberFormatOptions): string;
|
|
4092
|
+
/** A count in full, for the hover: "12,400". */
|
|
4093
|
+
declare function formatCountFull(value: number | null | undefined): string;
|
|
4094
|
+
/** Spend: "$448.7M", "£1.2bn", "−$85K", "$8,450". */
|
|
4095
|
+
declare function formatMoney(value: number | null | undefined, opts?: MoneyFormatOptions): string;
|
|
4096
|
+
/** Spend in full, for the hover: "$448,700,000". */
|
|
4097
|
+
declare function formatMoneyFull(value: number | null | undefined, opts?: MoneyFormatOptions): string;
|
|
4098
|
+
/**
|
|
4099
|
+
* A percentage, given in percent (18.4 for 18.4%): always one decimal
|
|
4100
|
+
* ("3.0%"), and "<0.1%" for anything above zero that would round to 0.0.
|
|
4101
|
+
*/
|
|
4102
|
+
declare function formatPercent(value: number | null | undefined, _opts?: NumberFormatOptions): string;
|
|
4103
|
+
|
|
4104
|
+
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, type Currency, 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, type MoneyFormatOptions, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NO_VALUE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, type NumberFormatOptions, 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, formatCount, formatCountFull, formatDate, formatDateRange, formatDateTime, formatIsoDate, formatMoney, formatMoneyFull, formatMonth, formatMonthAxis, formatOpenRange, formatPercent, formatQuarter, formatRelative, formatTime, formatWeek, noResultsBody, resolveRange, sortProp };
|
package/dist/index.d.ts
CHANGED
|
@@ -3999,4 +3999,106 @@ declare function MenuLabel({ className, testIdPrefix, children }: CommonProps &
|
|
|
3999
3999
|
/** A line between groups of rows. */
|
|
4000
4000
|
declare function MenuSeparator({ className, testIdPrefix }: CommonProps): react.JSX.Element;
|
|
4001
4001
|
|
|
4002
|
-
|
|
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
|
+
type Currency = "USD" | "CAD" | "GBP" | "EUR";
|
|
4074
|
+
interface NumberFormatOptions {
|
|
4075
|
+
/** The person's interface language (`en-US`, `en-GB`, `en-CA`, …). Default `en-US`. */
|
|
4076
|
+
language?: string;
|
|
4077
|
+
}
|
|
4078
|
+
interface MoneyFormatOptions extends NumberFormatOptions {
|
|
4079
|
+
/** Default `USD`. */
|
|
4080
|
+
currency?: Currency;
|
|
4081
|
+
/**
|
|
4082
|
+
* True where US and Canadian dollars can appear together (multi-country
|
|
4083
|
+
* accounts, comparisons): CAD shows "CA$" and USD "US$". Otherwise both
|
|
4084
|
+
* are a plain "$", as each country writes its own dollar.
|
|
4085
|
+
*/
|
|
4086
|
+
mixedDollars?: boolean;
|
|
4087
|
+
}
|
|
4088
|
+
/** The missing-value mark. The table explains it on hover ("No data"). */
|
|
4089
|
+
declare const NO_VALUE = "\u2014";
|
|
4090
|
+
/** A count (ads, impressions, advertisers): "12.4K", "8,450". */
|
|
4091
|
+
declare function formatCount(value: number | null | undefined, opts?: NumberFormatOptions): string;
|
|
4092
|
+
/** A count in full, for the hover: "12,400". */
|
|
4093
|
+
declare function formatCountFull(value: number | null | undefined): string;
|
|
4094
|
+
/** Spend: "$448.7M", "£1.2bn", "−$85K", "$8,450". */
|
|
4095
|
+
declare function formatMoney(value: number | null | undefined, opts?: MoneyFormatOptions): string;
|
|
4096
|
+
/** Spend in full, for the hover: "$448,700,000". */
|
|
4097
|
+
declare function formatMoneyFull(value: number | null | undefined, opts?: MoneyFormatOptions): string;
|
|
4098
|
+
/**
|
|
4099
|
+
* A percentage, given in percent (18.4 for 18.4%): always one decimal
|
|
4100
|
+
* ("3.0%"), and "<0.1%" for anything above zero that would round to 0.0.
|
|
4101
|
+
*/
|
|
4102
|
+
declare function formatPercent(value: number | null | undefined, _opts?: NumberFormatOptions): string;
|
|
4103
|
+
|
|
4104
|
+
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, type Currency, 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, type MoneyFormatOptions, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NO_VALUE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, type NumberFormatOptions, 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, formatCount, formatCountFull, formatDate, formatDateRange, formatDateTime, formatIsoDate, formatMoney, formatMoneyFull, formatMonth, formatMonthAxis, formatOpenRange, formatPercent, 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];
|
|
@@ -4410,10 +4410,10 @@ function resolveRange(label, today = startOfToday()) {
|
|
|
4410
4410
|
}
|
|
4411
4411
|
return [new Date(end.getFullYear(), end.getMonth() - 6, 1), end];
|
|
4412
4412
|
}
|
|
4413
|
-
function spanLabel2(label, today,
|
|
4413
|
+
function spanLabel2(label, today, formatDate2, formatRange) {
|
|
4414
4414
|
const [s, e] = resolveRange(label, today);
|
|
4415
4415
|
if (formatRange) return formatRange(s, e);
|
|
4416
|
-
const f =
|
|
4416
|
+
const f = formatDate2 ?? fmtDate;
|
|
4417
4417
|
return `${f(s)} \u2013 ${f(e)}`;
|
|
4418
4418
|
}
|
|
4419
4419
|
function MiniSelect({ value, onChange, options }) {
|
|
@@ -4440,7 +4440,7 @@ function DateRangePicker({
|
|
|
4440
4440
|
showFooter = false,
|
|
4441
4441
|
today,
|
|
4442
4442
|
years,
|
|
4443
|
-
formatDate,
|
|
4443
|
+
formatDate: formatDate2,
|
|
4444
4444
|
formatRange,
|
|
4445
4445
|
className,
|
|
4446
4446
|
testIdPrefix
|
|
@@ -4502,7 +4502,7 @@ function DateRangePicker({
|
|
|
4502
4502
|
className: chipTriggerClass(),
|
|
4503
4503
|
children: [
|
|
4504
4504
|
/* @__PURE__ */ jsxs39("span", { className: "flex flex-col gap-1 text-left leading-none", children: [
|
|
4505
|
-
/* @__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) }),
|
|
4506
4506
|
/* @__PURE__ */ jsx43("span", { className: "text-xs leading-none font-medium text-text-primary", children: value })
|
|
4507
4507
|
] }),
|
|
4508
4508
|
/* @__PURE__ */ jsx43(ChevronDown9, { size: 14, "aria-hidden": "true", className: cn("shrink-0 text-text-secondary transition-transform", open && "rotate-180") })
|
|
@@ -5270,7 +5270,7 @@ function DataTable({
|
|
|
5270
5270
|
}) {
|
|
5271
5271
|
const titleId = useId10();
|
|
5272
5272
|
const head = HEAD_PAD[density];
|
|
5273
|
-
const
|
|
5273
|
+
const pad2 = CELL_PAD[density];
|
|
5274
5274
|
const align = (c) => c.numeric ? "text-right" : "text-left";
|
|
5275
5275
|
const width = (c) => WIDTH3[c.width ?? (c.numeric ? "md" : "fill")];
|
|
5276
5276
|
const onSort = (key) => {
|
|
@@ -5318,7 +5318,7 @@ function DataTable({
|
|
|
5318
5318
|
},
|
|
5319
5319
|
c.key
|
|
5320
5320
|
)) }) }),
|
|
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",
|
|
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(
|
|
5322
5322
|
"span",
|
|
5323
5323
|
{
|
|
5324
5324
|
className: cn(
|
|
@@ -5329,7 +5329,7 @@ function DataTable({
|
|
|
5329
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(
|
|
5330
5330
|
"td",
|
|
5331
5331
|
{
|
|
5332
|
-
className: cn("border-b border-border-default",
|
|
5332
|
+
className: cn("border-b border-border-default", pad2, align(c), c.numeric && "tabular-nums"),
|
|
5333
5333
|
children: c.cell(row)
|
|
5334
5334
|
},
|
|
5335
5335
|
c.key
|
|
@@ -5792,6 +5792,172 @@ function MenuLabel({ className, testIdPrefix, children }) {
|
|
|
5792
5792
|
function MenuSeparator({ className, testIdPrefix }) {
|
|
5793
5793
|
return /* @__PURE__ */ jsx62("div", { role: "separator", "data-testid": testIdPrefix, className: cn("-mx-1 my-1 border-t border-border-default", className) });
|
|
5794
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
|
+
}
|
|
5905
|
+
|
|
5906
|
+
// src/numbers.ts
|
|
5907
|
+
var US = { units: ["K", "M", "B", "T"] };
|
|
5908
|
+
var STYLES = {
|
|
5909
|
+
"en-US": US,
|
|
5910
|
+
"en-CA": US,
|
|
5911
|
+
"en-GB": { units: ["k", "m", "bn", "tn"] }
|
|
5912
|
+
};
|
|
5913
|
+
var styleFor = (language) => STYLES[language ?? "en-US"] ?? US;
|
|
5914
|
+
var NO_VALUE = "\u2014";
|
|
5915
|
+
var MINUS = "\u2212";
|
|
5916
|
+
var SHORTEN_FROM = 1e4;
|
|
5917
|
+
var isMissing = (v) => v === null || v === void 0 || Number.isNaN(v);
|
|
5918
|
+
var withCommas = (n) => Math.round(n).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
5919
|
+
function shortAbs(abs, style) {
|
|
5920
|
+
if (abs < SHORTEN_FROM) return withCommas(abs);
|
|
5921
|
+
let tier = Math.min(Math.floor(Math.log10(abs) / 3), 4);
|
|
5922
|
+
let scaled = Math.round(abs / 1e3 ** tier * 10) / 10;
|
|
5923
|
+
if (scaled >= 1e3 && tier < 4) {
|
|
5924
|
+
tier += 1;
|
|
5925
|
+
scaled = Math.round(abs / 1e3 ** tier * 10) / 10;
|
|
5926
|
+
}
|
|
5927
|
+
const text = Number.isInteger(scaled) ? withCommas(scaled) : scaled.toFixed(1);
|
|
5928
|
+
return `${text}${style.units[tier - 1]}`;
|
|
5929
|
+
}
|
|
5930
|
+
function symbol(opts) {
|
|
5931
|
+
const currency = opts.currency ?? "USD";
|
|
5932
|
+
if (currency === "GBP") return "\xA3";
|
|
5933
|
+
if (currency === "EUR") return "\u20AC";
|
|
5934
|
+
if (opts.mixedDollars) return currency === "CAD" ? "CA$" : "US$";
|
|
5935
|
+
return "$";
|
|
5936
|
+
}
|
|
5937
|
+
var sign = (v) => v < 0 ? MINUS : "";
|
|
5938
|
+
function formatCount(value, opts = {}) {
|
|
5939
|
+
if (isMissing(value)) return NO_VALUE;
|
|
5940
|
+
return sign(value) + shortAbs(Math.abs(value), styleFor(opts.language));
|
|
5941
|
+
}
|
|
5942
|
+
function formatCountFull(value) {
|
|
5943
|
+
if (isMissing(value)) return NO_VALUE;
|
|
5944
|
+
return sign(value) + withCommas(Math.abs(value));
|
|
5945
|
+
}
|
|
5946
|
+
function formatMoney(value, opts = {}) {
|
|
5947
|
+
if (isMissing(value)) return NO_VALUE;
|
|
5948
|
+
return sign(value) + symbol(opts) + shortAbs(Math.abs(value), styleFor(opts.language));
|
|
5949
|
+
}
|
|
5950
|
+
function formatMoneyFull(value, opts = {}) {
|
|
5951
|
+
if (isMissing(value)) return NO_VALUE;
|
|
5952
|
+
return sign(value) + symbol(opts) + withCommas(Math.abs(value));
|
|
5953
|
+
}
|
|
5954
|
+
function formatPercent(value, _opts = {}) {
|
|
5955
|
+
if (isMissing(value)) return NO_VALUE;
|
|
5956
|
+
const abs = Math.abs(value);
|
|
5957
|
+
if (abs > 0 && abs < 0.05) return `${value < 0 ? MINUS : ""}<0.1%`;
|
|
5958
|
+
const text = (Math.round(abs * 10) / 10).toFixed(1);
|
|
5959
|
+
return text === "0.0" ? "0.0%" : `${sign(value)}${text}%`;
|
|
5960
|
+
}
|
|
5795
5961
|
export {
|
|
5796
5962
|
AISpark,
|
|
5797
5963
|
AdvertiserNoResults,
|
|
@@ -5833,6 +5999,7 @@ export {
|
|
|
5833
5999
|
MultiSelectFilter,
|
|
5834
6000
|
NO_RESULTS_BODY,
|
|
5835
6001
|
NO_RESULTS_TITLE,
|
|
6002
|
+
NO_VALUE,
|
|
5836
6003
|
NameListModal,
|
|
5837
6004
|
NoResultsEmptyState,
|
|
5838
6005
|
PRIMARY_ACTION_CLASS,
|
|
@@ -5869,6 +6036,23 @@ export {
|
|
|
5869
6036
|
buttonVariants,
|
|
5870
6037
|
chipTriggerClass,
|
|
5871
6038
|
cycleSort,
|
|
6039
|
+
defaultDateOrder,
|
|
6040
|
+
formatCount,
|
|
6041
|
+
formatCountFull,
|
|
6042
|
+
formatDate,
|
|
6043
|
+
formatDateRange,
|
|
6044
|
+
formatDateTime,
|
|
6045
|
+
formatIsoDate,
|
|
6046
|
+
formatMoney,
|
|
6047
|
+
formatMoneyFull,
|
|
6048
|
+
formatMonth,
|
|
6049
|
+
formatMonthAxis,
|
|
6050
|
+
formatOpenRange,
|
|
6051
|
+
formatPercent,
|
|
6052
|
+
formatQuarter,
|
|
6053
|
+
formatRelative,
|
|
6054
|
+
formatTime,
|
|
6055
|
+
formatWeek,
|
|
5872
6056
|
noResultsBody,
|
|
5873
6057
|
resolveRange,
|
|
5874
6058
|
sortProp
|