@mediaradar/design-components 0.65.0 → 0.66.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 +21 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -18
- package/dist/index.d.ts +17 -18
- package/dist/index.js +21 -40
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5844,6 +5844,7 @@ function RadioSection({
|
|
|
5844
5844
|
value,
|
|
5845
5845
|
onPick,
|
|
5846
5846
|
first,
|
|
5847
|
+
className,
|
|
5847
5848
|
testId
|
|
5848
5849
|
}) {
|
|
5849
5850
|
const id = (0, import_react32.useId)();
|
|
@@ -5859,7 +5860,7 @@ function RadioSection({
|
|
|
5859
5860
|
const el = e.currentTarget.querySelectorAll('[role="radio"]:not([aria-disabled="true"])')[next];
|
|
5860
5861
|
el?.focus();
|
|
5861
5862
|
};
|
|
5862
|
-
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
5863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: cn("flex min-w-0 flex-col p-1", className), children: [
|
|
5863
5864
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(MenuLabel, { id, children: label }),
|
|
5864
5865
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { role: "radiogroup", "aria-labelledby": id, onKeyDown: onKey, "data-testid": testId, "data-first-group": first ? "" : void 0, className: "flex flex-col", children: rows.map((r) => {
|
|
5865
5866
|
const checked = r.id === value;
|
|
@@ -5891,8 +5892,6 @@ function RadioSection({
|
|
|
5891
5892
|
function HeaderMenuTrigger({
|
|
5892
5893
|
menu,
|
|
5893
5894
|
columnLabel,
|
|
5894
|
-
sortDir,
|
|
5895
|
-
onSort,
|
|
5896
5895
|
testId
|
|
5897
5896
|
}) {
|
|
5898
5897
|
const [open, setOpen] = (0, import_react32.useState)(false);
|
|
@@ -5904,11 +5903,9 @@ function HeaderMenuTrigger({
|
|
|
5904
5903
|
const breakLabel = breakOutBy?.value != null ? breakOutBy.options.find((o) => o.id === breakOutBy.value)?.label : void 0;
|
|
5905
5904
|
const [draftGroup, setDraftGroup] = (0, import_react32.useState)(groupBy.value);
|
|
5906
5905
|
const [draftBreak, setDraftBreak] = (0, import_react32.useState)(breakOutBy?.value ?? null);
|
|
5907
|
-
const [draftSort, setDraftSort] = (0, import_react32.useState)(sortDir);
|
|
5908
5906
|
const openPanel = () => {
|
|
5909
5907
|
setDraftGroup(groupBy.value);
|
|
5910
5908
|
setDraftBreak(breakOutBy?.value ?? null);
|
|
5911
|
-
setDraftSort(sortDir);
|
|
5912
5909
|
setOpen(true);
|
|
5913
5910
|
};
|
|
5914
5911
|
const close = (0, import_react32.useCallback)((refocus) => {
|
|
@@ -5918,7 +5915,6 @@ function HeaderMenuTrigger({
|
|
|
5918
5915
|
const apply = () => {
|
|
5919
5916
|
if (draftGroup !== groupBy.value) groupBy.onChange(draftGroup);
|
|
5920
5917
|
if (breakOutBy && draftBreak !== breakOutBy.value) breakOutBy.onChange(draftBreak);
|
|
5921
|
-
if (onSort && draftSort && draftSort !== sortDir) onSort(draftSort);
|
|
5922
5918
|
close(true);
|
|
5923
5919
|
};
|
|
5924
5920
|
const place = (0, import_react32.useCallback)(() => {
|
|
@@ -6022,9 +6018,13 @@ function HeaderMenuTrigger({
|
|
|
6022
6018
|
"data-testid": testId && `${testId}-menu`,
|
|
6023
6019
|
onKeyDown: onPanelKey,
|
|
6024
6020
|
style: { position: "fixed", top: pos?.top ?? 0, left: pos?.left ?? 0, visibility: pos ? void 0 : "hidden" },
|
|
6025
|
-
className:
|
|
6021
|
+
className: cn(
|
|
6022
|
+
"z-dropdown flex max-h-120 flex-col overflow-hidden rounded-card border border-border-default bg-surface text-left normal-case tracking-normal shadow-overlay",
|
|
6023
|
+
// Two columns side by side, as Advertising Trends' Group by.
|
|
6024
|
+
breakOutBy ? "w-105" : "w-60"
|
|
6025
|
+
),
|
|
6026
6026
|
children: [
|
|
6027
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "
|
|
6027
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: cn("grid min-h-0 overflow-y-auto", breakOutBy && "grid-cols-2"), children: [
|
|
6028
6028
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
6029
6029
|
RadioSection,
|
|
6030
6030
|
{
|
|
@@ -6032,38 +6032,21 @@ function HeaderMenuTrigger({
|
|
|
6032
6032
|
label: groupBy.label ?? "Group rows by",
|
|
6033
6033
|
rows: groupBy.options,
|
|
6034
6034
|
value: draftGroup,
|
|
6035
|
-
onPick: pickGroup
|
|
6035
|
+
onPick: pickGroup,
|
|
6036
|
+
className: breakOutBy ? "border-r border-border-default" : void 0
|
|
6036
6037
|
}
|
|
6037
6038
|
),
|
|
6038
|
-
breakOutBy && /* @__PURE__ */ (0, import_jsx_runtime57.
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
{
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
}
|
|
6048
|
-
)
|
|
6049
|
-
] }),
|
|
6050
|
-
onSort && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
6051
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(MenuSeparator, {}),
|
|
6052
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
6053
|
-
RadioSection,
|
|
6054
|
-
{
|
|
6055
|
-
label: "Sort",
|
|
6056
|
-
rows: [
|
|
6057
|
-
{ id: "asc", label: "A to Z" },
|
|
6058
|
-
{ id: "desc", label: "Z to A" }
|
|
6059
|
-
],
|
|
6060
|
-
value: draftSort ?? void 0,
|
|
6061
|
-
onPick: setDraftSort
|
|
6062
|
-
}
|
|
6063
|
-
)
|
|
6064
|
-
] })
|
|
6039
|
+
breakOutBy && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
6040
|
+
RadioSection,
|
|
6041
|
+
{
|
|
6042
|
+
label: breakOutBy.label ?? "Then break out by",
|
|
6043
|
+
rows: [{ id: null, label: "None" }, ...breakOutBy.options.map((o) => ({ ...o, disabled: o.id === draftGroup }))],
|
|
6044
|
+
value: draftBreak,
|
|
6045
|
+
onPick: setDraftBreak
|
|
6046
|
+
}
|
|
6047
|
+
)
|
|
6065
6048
|
] }),
|
|
6066
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(FilterDropdownFooter, {
|
|
6049
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(FilterDropdownFooter, { onApply: apply })
|
|
6067
6050
|
]
|
|
6068
6051
|
}
|
|
6069
6052
|
),
|
|
@@ -6404,7 +6387,7 @@ function DataTable({
|
|
|
6404
6387
|
{
|
|
6405
6388
|
ref: !clone && ci <= nameIdx ? headRef(ci) : void 0,
|
|
6406
6389
|
scope: "col",
|
|
6407
|
-
"aria-sort": c.sortable
|
|
6390
|
+
"aria-sort": c.sortable && !c.headerMenu ? ariaSortFor(shown, c.key) : void 0,
|
|
6408
6391
|
className: cn(
|
|
6409
6392
|
"group/head whitespace-nowrap border-b border-border-default font-semibold",
|
|
6410
6393
|
head,
|
|
@@ -6420,8 +6403,6 @@ function DataTable({
|
|
|
6420
6403
|
{
|
|
6421
6404
|
menu: c.headerMenu,
|
|
6422
6405
|
columnLabel: c.label,
|
|
6423
|
-
sortDir: shown?.key === c.key ? shown.dir : null,
|
|
6424
|
-
onSort: onSortChange ? (dir) => onSortChange({ key: c.key, dir }) : void 0,
|
|
6425
6406
|
testId: clone || !testIdPrefix ? void 0 : `${testIdPrefix}-header-menu-${c.key}`
|
|
6426
6407
|
}
|
|
6427
6408
|
) : c.sortable && onSortChange ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|