impact-nova 1.7.2 → 1.7.4
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/components/ui/accordion.d.ts +5 -0
- package/dist/components/ui/accordion.js +51 -39
- package/dist/components/ui/ag-grid-react/headers/header-search-input.js +207 -209
- package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.js +58 -47
- package/dist/components/ui/ag-grid-react/index.js +86 -84
- package/dist/components/ui/ag-grid-react/theme.js +3 -0
- package/dist/components/ui/data-table/data-table-column-list.js +84 -78
- package/dist/components/ui/expandable-sku/expandable-sku.d.ts +38 -0
- package/dist/components/ui/expandable-sku/expandable-sku.js +244 -0
- package/dist/components/ui/expandable-sku/expandable-sku.types.d.ts +35 -0
- package/dist/components/ui/expandable-sku/index.d.ts +2 -0
- package/dist/components/ui/expandable-sku/index.js +4 -0
- package/dist/components/ui/filter-strip/filter-tag-list.d.ts +8 -1
- package/dist/components/ui/filter-strip/filter-tag-list.js +1 -0
- package/dist/components/ui/select/select.js +221 -210
- package/dist/impact-nova.css +1 -1
- package/dist/index.d.ts +57 -0
- package/dist/index.js +318 -300
- package/dist/lib/virtualized/index.d.ts +9 -0
- package/dist/lib/virtualized/sectioned.d.ts +37 -0
- package/dist/lib/virtualized/sectioned.js +38 -0
- package/dist/lib/virtualized/selection-counts.d.ts +14 -0
- package/dist/lib/virtualized/selection-counts.js +12 -0
- package/dist/lib/virtualized/types.d.ts +131 -0
- package/dist/lib/virtualized/useDataGrid.d.ts +15 -0
- package/dist/lib/virtualized/useDataGrid.js +12 -0
- package/dist/lib/virtualized/useDataSource.d.ts +8 -0
- package/dist/lib/virtualized/useDataSource.js +34 -0
- package/dist/lib/virtualized/useDebouncedValue.d.ts +4 -0
- package/dist/lib/virtualized/useDebouncedValue.js +11 -0
- package/dist/lib/virtualized/useRowState.d.ts +15 -0
- package/dist/lib/virtualized/useRowState.js +127 -0
- package/dist/lib/virtualized/useVirtualizedList.d.ts +72 -0
- package/dist/lib/virtualized/useVirtualizedList.js +155 -0
- package/dist/lib/virtualized/useVirtualizedRows.d.ts +22 -0
- package/dist/lib/virtualized/useVirtualizedRows.js +27 -0
- package/package.json +23 -1
- package/tailwind.config.js +2 -0
|
@@ -1,82 +1,82 @@
|
|
|
1
1
|
import { jsx as M } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useDataTable as
|
|
4
|
-
import { NestedList as
|
|
5
|
-
import { SelectionMode as
|
|
6
|
-
import { mergePartialOrderedColumnState as
|
|
7
|
-
import { useImpactNovaI18n as
|
|
8
|
-
const
|
|
2
|
+
import { useState as E, useRef as P, useCallback as m, useEffect as q } from "react";
|
|
3
|
+
import { useDataTable as B } from "./data-table-context.js";
|
|
4
|
+
import { NestedList as H } from "../nested-list/nested-list.js";
|
|
5
|
+
import { SelectionMode as J } from "../types/nested-list.types.js";
|
|
6
|
+
import { mergePartialOrderedColumnState as Q } from "./data-table-column-state.js";
|
|
7
|
+
import { useImpactNovaI18n as X } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
8
|
+
const ne = ({
|
|
9
9
|
enableApplyDiscard: b = !1,
|
|
10
10
|
showSearch: R = !0,
|
|
11
11
|
showSelectAll: w = !0,
|
|
12
12
|
showCollapse: L = !0
|
|
13
13
|
}) => {
|
|
14
|
-
const { gridApi: l } =
|
|
15
|
-
if (!l ||
|
|
16
|
-
const
|
|
17
|
-
U.current =
|
|
18
|
-
const
|
|
14
|
+
const { gridApi: l } = B(), { t: f } = X(), [j, x] = E([]), [A, F] = E(!1), d = P(!1), [K, V] = E(!1), U = P(/* @__PURE__ */ new Map()), y = m(() => {
|
|
15
|
+
if (!l || d.current) return;
|
|
16
|
+
const o = l.getColumnState(), c = new Map(o.map((t) => [t.colId, t]));
|
|
17
|
+
U.current = c;
|
|
18
|
+
const n = l.getColumns() || [], u = new Map(n.map((t) => [t.getColId(), t])), a = [], e = [], S = /* @__PURE__ */ new Map(), D = (t, s) => {
|
|
19
19
|
const r = t.getGroupId();
|
|
20
|
-
let
|
|
21
|
-
if (
|
|
22
|
-
const
|
|
23
|
-
return
|
|
20
|
+
let i = S.get(r);
|
|
21
|
+
if (i) return i;
|
|
22
|
+
const h = t.getOriginalParent(), g = h ? D(h, s).children : s, C = t.getColGroupDef();
|
|
23
|
+
return i = {
|
|
24
24
|
id: r,
|
|
25
25
|
label: C?.headerName || r,
|
|
26
26
|
checked: !0,
|
|
27
27
|
children: [],
|
|
28
28
|
category: "group"
|
|
29
|
-
}, S.set(r,
|
|
29
|
+
}, S.set(r, i), g.push(i), i;
|
|
30
30
|
};
|
|
31
|
-
let
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
35
|
-
let r = l.getDisplayNameForColumn(
|
|
31
|
+
let T = 0, O = 0, v = 0, z = 0;
|
|
32
|
+
o.forEach((t) => {
|
|
33
|
+
const s = u.get(t.colId);
|
|
34
|
+
if (!s) return;
|
|
35
|
+
let r = l.getDisplayNameForColumn(s, "header");
|
|
36
36
|
if (r === "") return;
|
|
37
37
|
if (r == null) {
|
|
38
|
-
const G =
|
|
38
|
+
const G = s.getColDef();
|
|
39
39
|
if (G.headerName === "") return;
|
|
40
40
|
r = G.headerName || G.field || t.colId;
|
|
41
41
|
}
|
|
42
42
|
if (!r || r.trim() === "")
|
|
43
43
|
return;
|
|
44
|
-
const
|
|
44
|
+
const i = !t.hide, h = {
|
|
45
45
|
id: t.colId,
|
|
46
46
|
label: r,
|
|
47
|
-
checked:
|
|
47
|
+
checked: i
|
|
48
48
|
};
|
|
49
|
-
t.pinned ? (
|
|
50
|
-
const g = t.pinned ?
|
|
51
|
-
C?.getColGroupDef().children ?
|
|
49
|
+
t.pinned ? (T++, i && O++) : (v++, i && z++);
|
|
50
|
+
const g = t.pinned ? a : e, C = s.getOriginalParent();
|
|
51
|
+
C?.getColGroupDef().children ? D(C, g).children.push(h) : g.push(h);
|
|
52
52
|
});
|
|
53
|
-
const
|
|
54
|
-
let
|
|
53
|
+
const I = (t) => {
|
|
54
|
+
let s = t.length > 0;
|
|
55
55
|
for (const r of t)
|
|
56
|
-
r.children && (r.checked =
|
|
57
|
-
return
|
|
56
|
+
r.children && (r.checked = I(r.children)), r.checked || (s = !1);
|
|
57
|
+
return s;
|
|
58
58
|
};
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
59
|
+
I(a), I(e);
|
|
60
|
+
const k = [];
|
|
61
|
+
a.length > 0 && k.push({
|
|
62
62
|
id: "root-frozen",
|
|
63
|
-
label:
|
|
64
|
-
checked:
|
|
65
|
-
children:
|
|
63
|
+
label: f("dataTable.frozenColumns"),
|
|
64
|
+
checked: T > 0 && O === T,
|
|
65
|
+
children: a,
|
|
66
66
|
category: "structure",
|
|
67
67
|
isDragDisabled: !0
|
|
68
|
-
}), e.length > 0 &&
|
|
68
|
+
}), e.length > 0 && k.push({
|
|
69
69
|
id: "root-scrollable",
|
|
70
|
-
label:
|
|
71
|
-
checked:
|
|
70
|
+
label: f("dataTable.scrollableColumns"),
|
|
71
|
+
checked: v > 0 && z === v,
|
|
72
72
|
children: e,
|
|
73
73
|
category: "structure",
|
|
74
74
|
isDragDisabled: !0
|
|
75
|
-
}),
|
|
76
|
-
}, [l,
|
|
77
|
-
|
|
75
|
+
}), x(k), F(!0);
|
|
76
|
+
}, [l, f]);
|
|
77
|
+
q(() => {
|
|
78
78
|
if (!l) return;
|
|
79
|
-
const
|
|
79
|
+
const o = setTimeout(() => y(), 0), c = [
|
|
80
80
|
"columnVisible",
|
|
81
81
|
"columnPinned",
|
|
82
82
|
"columnMoved",
|
|
@@ -85,77 +85,83 @@ const le = ({
|
|
|
85
85
|
"columnGroupOpened",
|
|
86
86
|
"columnRowGroupChanged",
|
|
87
87
|
"columnPivotModeChanged",
|
|
88
|
-
"columnEverythingChanged"
|
|
88
|
+
"columnEverythingChanged",
|
|
89
|
+
"dragStopped",
|
|
90
|
+
"columnValueChanged",
|
|
91
|
+
"displayedColumnsChanged"
|
|
89
92
|
];
|
|
90
|
-
let
|
|
93
|
+
let n = null;
|
|
91
94
|
const u = () => {
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
n && clearTimeout(n), n = setTimeout(() => {
|
|
96
|
+
n = null;
|
|
97
|
+
const a = !d.current;
|
|
98
|
+
d.current = !1, y(), a && V((e) => !e);
|
|
94
99
|
}, 150);
|
|
95
100
|
};
|
|
96
|
-
return l.isDestroyed() ||
|
|
97
|
-
clearTimeout(
|
|
101
|
+
return l.isDestroyed() || c.forEach((a) => l.addEventListener(a, u)), () => {
|
|
102
|
+
clearTimeout(o), n && clearTimeout(n), l.isDestroyed() || c.forEach((a) => l.removeEventListener(a, u));
|
|
98
103
|
};
|
|
99
|
-
}, [l,
|
|
100
|
-
const
|
|
101
|
-
const
|
|
104
|
+
}, [l, y]);
|
|
105
|
+
const N = m((o) => {
|
|
106
|
+
const c = [], n = (u, a) => {
|
|
102
107
|
u.forEach((e) => {
|
|
103
108
|
if (e.id === "root-frozen") {
|
|
104
|
-
e.children &&
|
|
109
|
+
e.children && n(e.children, "left");
|
|
105
110
|
return;
|
|
106
111
|
}
|
|
107
112
|
if (e.id === "root-scrollable") {
|
|
108
|
-
e.children &&
|
|
113
|
+
e.children && n(e.children, null);
|
|
109
114
|
return;
|
|
110
115
|
}
|
|
111
|
-
e.category === "group" || e.children && e.children.length > 0 ? e.children &&
|
|
116
|
+
e.category === "group" || e.children && e.children.length > 0 ? e.children && n(e.children, a) : l?.getColumn(e.id) && c.push({
|
|
112
117
|
colId: e.id,
|
|
113
|
-
pinned:
|
|
118
|
+
pinned: a,
|
|
114
119
|
hide: !e.checked
|
|
115
120
|
});
|
|
116
121
|
});
|
|
117
122
|
};
|
|
118
|
-
return o
|
|
119
|
-
}, [l]), p =
|
|
123
|
+
return n(o, null), c;
|
|
124
|
+
}, [l]), p = m((o) => {
|
|
120
125
|
if (!l) return;
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
126
|
+
d.current = !0;
|
|
127
|
+
const c = N(o);
|
|
128
|
+
if (c.length === 0) {
|
|
124
129
|
setTimeout(() => {
|
|
125
|
-
|
|
130
|
+
d.current = !1;
|
|
126
131
|
}, 300);
|
|
127
132
|
return;
|
|
128
133
|
}
|
|
129
|
-
const
|
|
134
|
+
const n = l.getColumnState(), u = Q(n, c);
|
|
130
135
|
l.applyColumnState({
|
|
131
136
|
state: u,
|
|
132
137
|
applyOrder: !0
|
|
133
138
|
}), setTimeout(() => {
|
|
134
|
-
|
|
139
|
+
d.current = !1;
|
|
135
140
|
}, 300);
|
|
136
|
-
}, [l,
|
|
137
|
-
p(
|
|
138
|
-
}, [p]),
|
|
139
|
-
b || p(
|
|
141
|
+
}, [l, N]), W = m((o) => {
|
|
142
|
+
p(o);
|
|
143
|
+
}, [p]), _ = m((o) => {
|
|
144
|
+
b || p(o), x(o);
|
|
140
145
|
}, [b, p]);
|
|
141
146
|
return A ? /* @__PURE__ */ M("div", { className: "flex flex-col h-full bg-canvas-elevated", children: /* @__PURE__ */ M(
|
|
142
|
-
|
|
147
|
+
H,
|
|
143
148
|
{
|
|
144
149
|
items: j,
|
|
145
|
-
onChange:
|
|
146
|
-
onSubmit:
|
|
150
|
+
onChange: _,
|
|
151
|
+
onSubmit: W,
|
|
147
152
|
enableApplyDiscard: b,
|
|
148
153
|
enableSearch: R,
|
|
149
154
|
enableSelectAll: w,
|
|
150
155
|
enableDragDrop: !0,
|
|
151
156
|
enableCollapse: !0,
|
|
152
157
|
enableGlobalCollapse: L,
|
|
153
|
-
selectionMode:
|
|
154
|
-
searchPlaceholder:
|
|
158
|
+
selectionMode: J.CASCADE_DOWN,
|
|
159
|
+
searchPlaceholder: f("dataTable.searchColumnsPlaceholder"),
|
|
155
160
|
className: "h-full"
|
|
156
|
-
}
|
|
157
|
-
|
|
161
|
+
},
|
|
162
|
+
K ? "sync-a" : "sync-b"
|
|
163
|
+
) }) : /* @__PURE__ */ M("div", { className: "p-4 text-[13px] text-content-placeholder", children: f("dataTable.loadingColumns") });
|
|
158
164
|
};
|
|
159
165
|
export {
|
|
160
|
-
|
|
166
|
+
ne as DataTableColumnList
|
|
161
167
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { SkuRowSelection, SkuRowSection } from './expandable-sku.types';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type { SkuRowAttributesSection, SkuRowCustomSection, SkuRowMetricColumn, SkuRowMetricsSection, SkuRowSelection, SkuRowSection, } from './expandable-sku.types';
|
|
4
|
+
export interface ExpandableSkuProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "onChange"> {
|
|
5
|
+
/** Primary line (e.g. SKU code). */
|
|
6
|
+
sku: string;
|
|
7
|
+
/** Secondary line (e.g. product title). */
|
|
8
|
+
subtitle?: React.ReactNode;
|
|
9
|
+
/** Optional slot next to the SKU (e.g. Mapped badge). */
|
|
10
|
+
badge?: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* When set, a checkbox is shown. Omit entirely to hide selection (read-only / detail rows).
|
|
13
|
+
*/
|
|
14
|
+
selection?: SkuRowSelection;
|
|
15
|
+
/**
|
|
16
|
+
* Row highlight (lavender shell + white detail card). Also applied when `selection.checked` is true
|
|
17
|
+
* so checkbox-only usage picks up the same UI without passing `selected`.
|
|
18
|
+
*/
|
|
19
|
+
selected?: boolean;
|
|
20
|
+
/** Controlled expanded state. */
|
|
21
|
+
expanded?: boolean;
|
|
22
|
+
/** Uncontrolled default. Ignored when `expanded` is passed. */
|
|
23
|
+
defaultExpanded?: boolean;
|
|
24
|
+
onExpandedChange?: (open: boolean) => void;
|
|
25
|
+
/** Disable expand/collapse interaction. */
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/** Ordered blocks inside the expanded panel. */
|
|
28
|
+
sections?: ReadonlyArray<SkuRowSection>;
|
|
29
|
+
/** Extra content after preset `sections` (inside the panel card). */
|
|
30
|
+
panelFooter?: React.ReactNode;
|
|
31
|
+
expandAriaLabel?: string;
|
|
32
|
+
collapseAriaLabel?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Expandable SKU : optional checkbox, title stack, chevron when there is panel content,
|
|
36
|
+
* and a collapsible body with metrics, attribute pills, or custom sections.
|
|
37
|
+
*/
|
|
38
|
+
export declare const ExpandableSku: React.ForwardRefExoticComponent<ExpandableSkuProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import * as B from "react";
|
|
3
|
+
import { ChevronDown as E } from "lucide-react";
|
|
4
|
+
import { Accordion as P, AccordionItem as V, AccordionTrigger as _, AccordionContent as R } from "../accordion.js";
|
|
5
|
+
import { Badge as I } from "../badge.js";
|
|
6
|
+
import { Checkbox as z } from "../checkbox.js";
|
|
7
|
+
import { FilterPopoverContent as D } from "../filter-strip/filter-tag-list.js";
|
|
8
|
+
import { Popover as M, PopoverTrigger as j } from "../popover.js";
|
|
9
|
+
import { Tag as K } from "../tag.js";
|
|
10
|
+
import { Tooltip as L, TooltipTrigger as O, TooltipContent as U } from "../tooltip.js";
|
|
11
|
+
import { cn as p } from "../../../lib/utils.js";
|
|
12
|
+
function W({ section: a }) {
|
|
13
|
+
return a.columns.length === 0 ? null : /* @__PURE__ */ e("div", { className: "min-w-0 bg-transparent", children: /* @__PURE__ */ e("div", { className: "scrollbar-hide overflow-x-auto overscroll-x-contain [-webkit-overflow-scrolling:touch]", children: /* @__PURE__ */ e("div", { className: "flex min-w-0 flex-nowrap divide-x divide-stroke-hairline px-4 py-4 sm:px-5", children: a.columns.map((l, s) => /* @__PURE__ */ t(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
className: "flex min-w-[7.5rem] flex-1 basis-0 flex-col gap-1 overflow-hidden px-3 first:pl-0 last:pr-0 sm:min-w-[8rem] sm:px-4",
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ e("p", { className: "truncate text-xs font-semibold leading-5 text-content-heading", title: l.label, children: l.label }),
|
|
19
|
+
/* @__PURE__ */ e("p", { className: "truncate text-sm font-semibold leading-5 text-content", title: String(l.value), children: l.value })
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
`${a.id}-metric-${s}`
|
|
23
|
+
)) }) }) });
|
|
24
|
+
}
|
|
25
|
+
function X({ section: a }) {
|
|
26
|
+
const i = a.maxVisibleTags ?? 4, l = a.tags, s = l.slice(0, i), n = l.slice(i), o = n.length, d = a.formatOverflow?.(o) ?? (o > 0 ? `+${o}` : null);
|
|
27
|
+
return /* @__PURE__ */ t("div", { className: "px-4 py-4 pt-0 sm:px-5", children: [
|
|
28
|
+
/* @__PURE__ */ e("p", { className: "text-xs font-semibold leading-5 text-content-heading", children: a.title ?? "Attributes" }),
|
|
29
|
+
/* @__PURE__ */ t("div", { className: "mt-2 flex flex-wrap gap-1.5", children: [
|
|
30
|
+
s.map((c, u) => /* @__PURE__ */ e(
|
|
31
|
+
I,
|
|
32
|
+
{
|
|
33
|
+
variant: "subtle",
|
|
34
|
+
color: "neutral",
|
|
35
|
+
size: "sm",
|
|
36
|
+
shape: "circle",
|
|
37
|
+
className: "max-w-full",
|
|
38
|
+
children: c
|
|
39
|
+
},
|
|
40
|
+
`${u}-${c}`
|
|
41
|
+
)),
|
|
42
|
+
n.length > 0 ? /* @__PURE__ */ t(M, { children: [
|
|
43
|
+
/* @__PURE__ */ t(L, { children: [
|
|
44
|
+
/* @__PURE__ */ e(O, { asChild: !0, children: /* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ e(
|
|
45
|
+
K,
|
|
46
|
+
{
|
|
47
|
+
variant: "secondary",
|
|
48
|
+
size: "md",
|
|
49
|
+
shape: "rounded",
|
|
50
|
+
className: "whitespace-nowrap border-0 bg-[#eceefd] px-2 font-['Manrope'] text-xs font-medium text-[#4259ee] hover:bg-[#dce1fc] h-6 cursor-pointer",
|
|
51
|
+
tabIndex: 0,
|
|
52
|
+
role: "button",
|
|
53
|
+
"aria-label": `${n.length} more attributes for ${a.title ?? "Attributes"}`,
|
|
54
|
+
children: d
|
|
55
|
+
}
|
|
56
|
+
) }) }),
|
|
57
|
+
/* @__PURE__ */ t(U, { variant: "tertiary", side: "top", children: [
|
|
58
|
+
n.length,
|
|
59
|
+
" more"
|
|
60
|
+
] })
|
|
61
|
+
] }),
|
|
62
|
+
/* @__PURE__ */ e(
|
|
63
|
+
D,
|
|
64
|
+
{
|
|
65
|
+
remainingValues: n,
|
|
66
|
+
onItemRemove: () => {
|
|
67
|
+
},
|
|
68
|
+
isRemovable: !1
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] }) : null
|
|
72
|
+
] })
|
|
73
|
+
] });
|
|
74
|
+
}
|
|
75
|
+
function q({ section: a }) {
|
|
76
|
+
return /* @__PURE__ */ e("div", { className: "px-4 py-4 sm:px-5", children: a.content });
|
|
77
|
+
}
|
|
78
|
+
const h = "expandable-sku-row-item";
|
|
79
|
+
function G(a) {
|
|
80
|
+
switch (a.type) {
|
|
81
|
+
case "metrics":
|
|
82
|
+
return /* @__PURE__ */ e(W, { section: a }, a.id);
|
|
83
|
+
case "attributes":
|
|
84
|
+
return /* @__PURE__ */ e(X, { section: a }, a.id);
|
|
85
|
+
case "custom":
|
|
86
|
+
return /* @__PURE__ */ e(q, { section: a }, a.id);
|
|
87
|
+
default:
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const H = B.forwardRef(
|
|
92
|
+
({
|
|
93
|
+
className: a,
|
|
94
|
+
sku: i,
|
|
95
|
+
subtitle: l,
|
|
96
|
+
badge: s,
|
|
97
|
+
selection: n,
|
|
98
|
+
selected: o,
|
|
99
|
+
expanded: d,
|
|
100
|
+
defaultExpanded: c = !1,
|
|
101
|
+
onExpandedChange: u,
|
|
102
|
+
disabled: x,
|
|
103
|
+
sections: f,
|
|
104
|
+
panelFooter: v,
|
|
105
|
+
expandAriaLabel: A = "Expand details",
|
|
106
|
+
collapseAriaLabel: T = "Collapse details",
|
|
107
|
+
...b
|
|
108
|
+
}, g) => {
|
|
109
|
+
const w = d !== void 0, S = w ? d ? h : "" : void 0, m = !!(o || n?.checked), $ = f != null && f.length > 0 || v != null, N = (r) => /* @__PURE__ */ t(
|
|
110
|
+
"div",
|
|
111
|
+
{
|
|
112
|
+
className: p(
|
|
113
|
+
"min-w-0 flex-1",
|
|
114
|
+
r && "pointer-events-none opacity-50"
|
|
115
|
+
),
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
118
|
+
/* @__PURE__ */ e(
|
|
119
|
+
"span",
|
|
120
|
+
{
|
|
121
|
+
className: p(
|
|
122
|
+
"text-sm font-semibold leading-6 text-content",
|
|
123
|
+
m && "tracking-tight"
|
|
124
|
+
),
|
|
125
|
+
children: i
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
s
|
|
129
|
+
] }),
|
|
130
|
+
l ? /* @__PURE__ */ e("div", { className: "mt-0.5 text-xs font-medium leading-4 text-[#60697d]", children: l }) : null
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
), k = p(
|
|
134
|
+
"rounded-xl transition-[background-color,border-color,box-shadow] duration-200",
|
|
135
|
+
m ? "border-stroke-accent/40 bg-canvas-accent shadow-sm" : "border-stroke bg-canvas-elevated",
|
|
136
|
+
a
|
|
137
|
+
), C = n ? /* @__PURE__ */ e(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
className: "pt-0.5",
|
|
141
|
+
onClick: (r) => r.stopPropagation(),
|
|
142
|
+
onKeyDown: (r) => r.stopPropagation(),
|
|
143
|
+
children: /* @__PURE__ */ e(
|
|
144
|
+
z,
|
|
145
|
+
{
|
|
146
|
+
checked: n.checked,
|
|
147
|
+
disabled: n.disabled,
|
|
148
|
+
onCheckedChange: (r) => {
|
|
149
|
+
const y = r === !0;
|
|
150
|
+
y !== n.checked && n.onCheckedChange(y);
|
|
151
|
+
},
|
|
152
|
+
"aria-label": n["aria-label"] ?? `Select ${i}`
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
) : null;
|
|
157
|
+
return $ ? /* @__PURE__ */ e(
|
|
158
|
+
"div",
|
|
159
|
+
{
|
|
160
|
+
ref: g,
|
|
161
|
+
"data-component": "expandable-sku-row",
|
|
162
|
+
"data-expandable": "true",
|
|
163
|
+
"data-expanded": d ?? void 0,
|
|
164
|
+
"data-selected": o ? "" : void 0,
|
|
165
|
+
"data-selection-chrome": m ? "" : void 0,
|
|
166
|
+
className: k,
|
|
167
|
+
...b,
|
|
168
|
+
children: /* @__PURE__ */ e(
|
|
169
|
+
P,
|
|
170
|
+
{
|
|
171
|
+
type: "single",
|
|
172
|
+
collapsible: !0,
|
|
173
|
+
disabled: x,
|
|
174
|
+
...w ? { value: S } : {
|
|
175
|
+
defaultValue: c ? h : void 0
|
|
176
|
+
},
|
|
177
|
+
onValueChange: (r) => u?.(r === h),
|
|
178
|
+
children: /* @__PURE__ */ t(
|
|
179
|
+
V,
|
|
180
|
+
{
|
|
181
|
+
value: h,
|
|
182
|
+
className: "border-0 bg-transparent p-0 shadow-none rounded-none overflow-visible",
|
|
183
|
+
children: [
|
|
184
|
+
/* @__PURE__ */ t("div", { className: "flex items-start gap-3 px-3 py-3", children: [
|
|
185
|
+
C,
|
|
186
|
+
/* @__PURE__ */ t(
|
|
187
|
+
_,
|
|
188
|
+
{
|
|
189
|
+
variant: "plain",
|
|
190
|
+
className: p(
|
|
191
|
+
"min-w-0 gap-2 text-left items-center ",
|
|
192
|
+
x && "pointer-events-none opacity-50"
|
|
193
|
+
),
|
|
194
|
+
children: [
|
|
195
|
+
N(!1),
|
|
196
|
+
/* @__PURE__ */ e(
|
|
197
|
+
"span",
|
|
198
|
+
{
|
|
199
|
+
className: "expandable-sku-row__chev mt-0.5 inline-flex shrink-0 text-content-muted transition-transform duration-200 group-data-[state=open]:rotate-180",
|
|
200
|
+
"aria-hidden": !0,
|
|
201
|
+
children: /* @__PURE__ */ e(E, { className: "size-4" })
|
|
202
|
+
}
|
|
203
|
+
),
|
|
204
|
+
/* @__PURE__ */ t("span", { className: "sr-only", children: [
|
|
205
|
+
A,
|
|
206
|
+
" / ",
|
|
207
|
+
T
|
|
208
|
+
] })
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
] }),
|
|
213
|
+
/* @__PURE__ */ e(R, { className: "border-0 bg-transparent p-0 pb-[0.01rem]", children: /* @__PURE__ */ t("div", { className: "mx-2 mb-2 overflow-hidden bg-[#f8f9fb] pt-2 rounded-lg", children: [
|
|
214
|
+
f?.map((r) => G(r)),
|
|
215
|
+
v ? /* @__PURE__ */ e("div", { className: "px-4 py-3 sm:px-5", children: v }) : null
|
|
216
|
+
] }) })
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
)
|
|
222
|
+
}
|
|
223
|
+
) : /* @__PURE__ */ e(
|
|
224
|
+
"div",
|
|
225
|
+
{
|
|
226
|
+
ref: g,
|
|
227
|
+
"data-component": "expandable-sku-row",
|
|
228
|
+
"data-expandable": "false",
|
|
229
|
+
"data-selected": o ? "" : void 0,
|
|
230
|
+
"data-selection-chrome": m ? "" : void 0,
|
|
231
|
+
className: k,
|
|
232
|
+
...b,
|
|
233
|
+
children: /* @__PURE__ */ t("div", { className: "flex items-start gap-3 px-3 py-3", children: [
|
|
234
|
+
C,
|
|
235
|
+
N(!!x)
|
|
236
|
+
] })
|
|
237
|
+
}
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
H.displayName = "ExpandableSku";
|
|
242
|
+
export {
|
|
243
|
+
H as ExpandableSku
|
|
244
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type SkuRowMetricColumn = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
};
|
|
6
|
+
/** Horizontal metrics row (any column count). */
|
|
7
|
+
export type SkuRowMetricsSection = {
|
|
8
|
+
id: string;
|
|
9
|
+
type: "metrics";
|
|
10
|
+
columns: ReadonlyArray<SkuRowMetricColumn>;
|
|
11
|
+
};
|
|
12
|
+
/** Tag pills with optional overflow summary (e.g. `+64`). */
|
|
13
|
+
export type SkuRowAttributesSection = {
|
|
14
|
+
id: string;
|
|
15
|
+
type: "attributes";
|
|
16
|
+
title?: string;
|
|
17
|
+
tags: ReadonlyArray<string>;
|
|
18
|
+
/** Max tags before overflow pill (default 4). */
|
|
19
|
+
maxVisibleTags?: number;
|
|
20
|
+
/** Default: `(n) => \`+\${n}\``. */
|
|
21
|
+
formatOverflow?: (hiddenCount: number) => string;
|
|
22
|
+
};
|
|
23
|
+
/** Arbitrary block inside the expanded panel. */
|
|
24
|
+
export type SkuRowCustomSection = {
|
|
25
|
+
id: string;
|
|
26
|
+
type: "custom";
|
|
27
|
+
content: ReactNode;
|
|
28
|
+
};
|
|
29
|
+
export type SkuRowSection = SkuRowMetricsSection | SkuRowAttributesSection | SkuRowCustomSection;
|
|
30
|
+
export type SkuRowSelection = {
|
|
31
|
+
checked: boolean;
|
|
32
|
+
onCheckedChange: (checked: boolean) => void;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
"aria-label"?: string;
|
|
35
|
+
};
|
|
@@ -5,5 +5,12 @@ interface FilterTagListProps {
|
|
|
5
5
|
onOverflowClick?: (id: string) => void;
|
|
6
6
|
onViewAll?: () => void;
|
|
7
7
|
}
|
|
8
|
+
declare const FilterPopoverContent: ({ remainingValues, viewAllTrigger, onViewAll, onItemRemove, isRemovable }: {
|
|
9
|
+
remainingValues: (string | number)[];
|
|
10
|
+
viewAllTrigger?: "expand" | "custom";
|
|
11
|
+
onViewAll?: () => void;
|
|
12
|
+
onItemRemove: (val: string | number) => void;
|
|
13
|
+
isRemovable?: boolean;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
15
|
declare const FilterTagList: ({ filters, onFilterRemove: _onFilterRemove, onOverflowClick, onViewAll, }: FilterTagListProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export { FilterTagList };
|
|
16
|
+
export { FilterTagList, FilterPopoverContent };
|