@mediaradar/design-components 0.55.0 → 0.56.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 +6 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
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
|
package/dist/index.js
CHANGED
|
@@ -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
|
{
|
|
@@ -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
|
{
|