@sps-woodland/sorting-header 8.53.3 → 8.53.5
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/README.md +25 -1
- package/lib/index.d.ts +1 -2
- package/lib/index.js +9 -254
- package/lib/index.umd.cjs +2 -2
- package/lib/style.css +1 -1
- package/package.json +6 -9
- package/vite.config.mjs +6 -13
- package/lib/caret/caret.css.d.ts +0 -20
- package/lib/sorting-header/SortingHeader.css.d.ts +0 -38
- package/lib/sorting-header/SortingHeader.d.ts +0 -8
- package/lib/sorting-header-cell/SortingHeaderCell.css.d.ts +0 -34
- package/lib/sorting-header-cell/SortingHeaderCell.d.ts +0 -11
package/README.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
1
|
## [@sps-woodland/sorting-header](https://github.com/SPSCommerce/woodland/tree/master/packages/@sps-woodland/sorting-header#readme)
|
|
2
2
|
|
|
3
|
-
SPS Woodland Design System
|
|
3
|
+
SPS Woodland Design System sorting-header and sorting-header cell components.
|
|
4
|
+
|
|
5
|
+
> **Heads up — this is a wrapper package.** The component source now lives in
|
|
6
|
+
> [`@sps-woodland/core`](../core). This package re-exports from core so existing
|
|
7
|
+
> imports keep working, but new code should prefer the core paths.
|
|
8
|
+
|
|
9
|
+
### Preferred imports (core)
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { SortingHeader, SortingHeaderCell } from "@sps-woodland/core/sorting-header";
|
|
13
|
+
// or, if you only need the cell:
|
|
14
|
+
import { SortingHeaderCell } from "@sps-woodland/core/sorting-header-cell";
|
|
15
|
+
|
|
16
|
+
import "@sps-woodland/core/sorting-header/style.css";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`SortingHeader` is barrel-only (the family name and the parent component share a
|
|
20
|
+
name). `SortingHeaderCell` also has its own flat subpath.
|
|
21
|
+
|
|
22
|
+
### Legacy imports (still supported)
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { SortingHeader, SortingHeaderCell } from "@sps-woodland/sorting-header";
|
|
26
|
+
import "@sps-woodland/sorting-header/style.css";
|
|
27
|
+
```
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,257 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
value: r,
|
|
7
|
-
enumerable: !0,
|
|
8
|
-
configurable: !0,
|
|
9
|
-
writable: !0
|
|
10
|
-
}) : e[o] = r, e;
|
|
11
|
-
}
|
|
12
|
-
function D(e, o) {
|
|
13
|
-
var r = Object.keys(e);
|
|
14
|
-
if (Object.getOwnPropertySymbols) {
|
|
15
|
-
var t = Object.getOwnPropertySymbols(e);
|
|
16
|
-
o && (t = t.filter(function(l) {
|
|
17
|
-
return Object.getOwnPropertyDescriptor(e, l).enumerable;
|
|
18
|
-
})), r.push.apply(r, t);
|
|
19
|
-
}
|
|
20
|
-
return r;
|
|
21
|
-
}
|
|
22
|
-
function O(e) {
|
|
23
|
-
for (var o = 1; o < arguments.length; o++) {
|
|
24
|
-
var r = arguments[o] != null ? arguments[o] : {};
|
|
25
|
-
o % 2 ? D(Object(r), !0).forEach(function(t) {
|
|
26
|
-
W(e, t, r[t]);
|
|
27
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : D(Object(r)).forEach(function(t) {
|
|
28
|
-
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
return e;
|
|
32
|
-
}
|
|
33
|
-
var z = (e, o, r) => {
|
|
34
|
-
for (var t of Object.keys(e)) {
|
|
35
|
-
var l;
|
|
36
|
-
if (e[t] !== ((l = o[t]) !== null && l !== void 0 ? l : r[t]))
|
|
37
|
-
return !1;
|
|
38
|
-
}
|
|
39
|
-
return !0;
|
|
40
|
-
}, P = (e) => (o) => {
|
|
41
|
-
var r = e.defaultClassName, t = O(O({}, e.defaultVariants), o);
|
|
42
|
-
for (var l in t) {
|
|
43
|
-
var _, a = (_ = t[l]) !== null && _ !== void 0 ? _ : e.defaultVariants[l];
|
|
44
|
-
if (a != null) {
|
|
45
|
-
var u = a;
|
|
46
|
-
typeof u == "boolean" && (u = u === !0 ? "true" : "false");
|
|
47
|
-
var h = (
|
|
48
|
-
// @ts-expect-error
|
|
49
|
-
e.variantClassNames[l][u]
|
|
50
|
-
);
|
|
51
|
-
h && (r += " " + h);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
for (var [i, p] of e.compoundVariants)
|
|
55
|
-
z(i, t, e.defaultVariants) && (r += " " + p);
|
|
56
|
-
return r;
|
|
57
|
-
}, H = P({ defaultClassName: "pkg_sps-woodland_sorting-header__version_8_53_3__hash_7ljhcs0", variantClassNames: { up: { true: "pkg_sps-woodland_sorting-header__version_8_53_3__hash_7ljhcs1" }, down: { true: "pkg_sps-woodland_sorting-header__version_8_53_3__hash_7ljhcs2" } }, defaultVariants: {}, compoundVariants: [] }), T = P({ defaultClassName: "pkg_sps-woodland_sorting-header__version_8_53_3__hash_1crs4gl0", variantClassNames: { disabled: { true: "pkg_sps-woodland_sorting-header__version_8_53_3__hash_1crs4gl1" }, active: { true: "pkg_sps-woodland_sorting-header__version_8_53_3__hash_1crs4gl2" }, __autoLayout: { true: "pkg_sps-woodland_sorting-header__version_8_53_3__hash_1crs4gl3", false: "pkg_sps-woodland_sorting-header__version_8_53_3__hash_1crs4gl4" } }, defaultVariants: { disabled: !1, active: !1, __autoLayout: !1 }, compoundVariants: [] });
|
|
58
|
-
function R({
|
|
59
|
-
className: e,
|
|
60
|
-
sortKey: o,
|
|
61
|
-
sort: r,
|
|
62
|
-
sortDisabled: t,
|
|
63
|
-
onSortChange: l,
|
|
64
|
-
onClick: _,
|
|
65
|
-
children: a,
|
|
66
|
-
style: u,
|
|
67
|
-
widthPx: h,
|
|
68
|
-
widthRem: i,
|
|
69
|
-
__autoLayout: p = !1,
|
|
70
|
-
...d
|
|
71
|
-
}) {
|
|
72
|
-
const c = n.useMemo(() => {
|
|
73
|
-
const v = !!o && !t && Array.isArray(r) && r.find((E) => E.key === o);
|
|
74
|
-
return v ? v.direction : void 0;
|
|
75
|
-
}, [r, o, t]), k = h ? h / 16 : i, g = k ? { ...u, width: `${k}rem` } : u, b = (v) => {
|
|
76
|
-
o && !t && l && l([
|
|
77
|
-
{
|
|
78
|
-
key: o,
|
|
79
|
-
direction: c === C.ASCENDING ? C.DESCENDING : C.ASCENDING
|
|
80
|
-
}
|
|
81
|
-
]), _ && _(v);
|
|
82
|
-
};
|
|
83
|
-
return p ? /* @__PURE__ */ n.createElement(
|
|
84
|
-
"td",
|
|
85
|
-
{
|
|
86
|
-
className: y(
|
|
87
|
-
e,
|
|
88
|
-
T({ disabled: t, active: !!c, __autoLayout: p }),
|
|
89
|
-
c && H({
|
|
90
|
-
up: c === C.ASCENDING,
|
|
91
|
-
down: c === C.DESCENDING
|
|
92
|
-
})
|
|
93
|
-
),
|
|
94
|
-
onClick: b,
|
|
95
|
-
style: g,
|
|
96
|
-
...d
|
|
97
|
-
},
|
|
98
|
-
a
|
|
99
|
-
) : /* @__PURE__ */ n.createElement(
|
|
100
|
-
"div",
|
|
101
|
-
{
|
|
102
|
-
className: y(
|
|
103
|
-
e,
|
|
104
|
-
T({ disabled: t, active: !!c, __autoLayout: p }),
|
|
105
|
-
c && H({
|
|
106
|
-
up: c === C.ASCENDING,
|
|
107
|
-
down: c === C.DESCENDING
|
|
108
|
-
})
|
|
109
|
-
),
|
|
110
|
-
onClick: b,
|
|
111
|
-
style: g,
|
|
112
|
-
...d
|
|
113
|
-
},
|
|
114
|
-
a
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
V.set(R, {
|
|
118
|
-
name: "Sorting Header Cell",
|
|
119
|
-
props: {
|
|
120
|
-
sortKey: { type: "string" },
|
|
121
|
-
sort: { type: "SortedColumn[]" },
|
|
122
|
-
sortDisabled: { type: "boolean" },
|
|
123
|
-
onSortChange: { type: "SortChangeHandler" },
|
|
124
|
-
widthPx: { type: "number" },
|
|
125
|
-
widthRem: { type: "number" }
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
var I = P({ defaultClassName: "pkg_sps-woodland_sorting-header__version_8_53_3__hash_sk81640", variantClassNames: { pinned: { true: "pkg_sps-woodland_sorting-header__version_8_53_3__hash_sk81641", false: "pkg_sps-woodland_sorting-header__version_8_53_3__hash_sk81642" }, scrollParentIsWindow: { true: "pkg_sps-woodland_sorting-header__version_8_53_3__hash_sk81643", false: "pkg_sps-woodland_sorting-header__version_8_53_3__hash_sk81644" }, __autoLayout: { true: "pkg_sps-woodland_sorting-header__version_8_53_3__hash_sk81645", false: "pkg_sps-woodland_sorting-header__version_8_53_3__hash_sk81646" } }, defaultVariants: { pinned: !1, scrollParentIsWindow: !1, __autoLayout: !1 }, compoundVariants: [[{ pinned: !0, scrollParentIsWindow: !0 }, "pkg_sps-woodland_sorting-header__version_8_53_3__hash_sk81647"]] }), F = "pkg_sps-woodland_sorting-header__version_8_53_3__hash_sk81648";
|
|
129
|
-
function K({
|
|
130
|
-
sort: e,
|
|
131
|
-
onSortChange: o,
|
|
132
|
-
children: r,
|
|
133
|
-
className: t,
|
|
134
|
-
pinSortingHeader: l = !1,
|
|
135
|
-
__autoLayout: _ = !1,
|
|
136
|
-
...a
|
|
137
|
-
}) {
|
|
138
|
-
const [u, h] = n.useState(!1), i = n.useRef(null), p = n.useRef(null), d = n.useRef({
|
|
139
|
-
height: "",
|
|
140
|
-
width: "",
|
|
141
|
-
unpinAtTop: 0,
|
|
142
|
-
unpinAtBottom: 0,
|
|
143
|
-
cellWidths: []
|
|
144
|
-
}), c = n.useCallback(() => i.current && M(i.current) || window, []), k = n.useCallback((s) => {
|
|
145
|
-
const m = s || c();
|
|
146
|
-
return m.scrollY || m.scrollTop || 0;
|
|
147
|
-
}, []), g = n.useCallback(
|
|
148
|
-
(s) => {
|
|
149
|
-
if (l && i.current) {
|
|
150
|
-
const m = s || c(), S = k(m), w = _ ? i.current.parentElement?.parentElement?.getBoundingClientRect() : i.current.parentElement?.getBoundingClientRect();
|
|
151
|
-
if (w) {
|
|
152
|
-
const f = i.current.getBoundingClientRect();
|
|
153
|
-
d.current.height = `${f.height}px`, d.current.width = `${f.width}px`, m === window ? (d.current.unpinAtBottom = w.bottom + S - f.height * 2, d.current.unpinAtTop = f.top + S - f.height) : (d.current.unpinAtBottom = w.bottom + S - f.height * 2, d.current.unpinAtTop = w.top + S), d.current.cellWidths = [], i.current.childNodes.forEach((A, j) => {
|
|
154
|
-
A instanceof HTMLElement && (d.current.cellWidths[j] = `${A.getBoundingClientRect().width}px`);
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
[l]
|
|
160
|
-
), b = n.useCallback(() => {
|
|
161
|
-
p.current && (p.current.style.width = d.current.width, p.current.style.height = d.current.height, p.current.childNodes.forEach((s, m) => {
|
|
162
|
-
s instanceof HTMLElement && (s.style.width = d.current.cellWidths[m] || "");
|
|
163
|
-
}));
|
|
164
|
-
}, []);
|
|
165
|
-
n.useLayoutEffect(() => {
|
|
166
|
-
g();
|
|
167
|
-
}), n.useLayoutEffect(() => {
|
|
168
|
-
let s;
|
|
169
|
-
const m = c();
|
|
170
|
-
return l ? (s = x(() => {
|
|
171
|
-
g(m);
|
|
172
|
-
const { unpinAtTop: S, unpinAtBottom: w } = d.current, f = k(m);
|
|
173
|
-
S && w && (f >= S && f <= w ? (h(!0), i.current && (i.current.style.visibility = "hidden")) : (h(!1), i.current && (i.current.style.visibility = "visible")));
|
|
174
|
-
}), m.addEventListener("scroll", s), s()) : i.current && (i.current.style.visibility = "visible"), () => {
|
|
175
|
-
s && m.removeEventListener("scroll", s);
|
|
176
|
-
};
|
|
177
|
-
}, [l, g]), n.useLayoutEffect(() => {
|
|
178
|
-
let s;
|
|
179
|
-
return u && (s = () => {
|
|
180
|
-
g(), b();
|
|
181
|
-
}, window.addEventListener("resize", s), s()), () => {
|
|
182
|
-
s && window.removeEventListener("resize", s);
|
|
183
|
-
};
|
|
184
|
-
}, [u, g, b]);
|
|
185
|
-
const [v] = G(r, [{ type: R }]), E = B(v, () => [{ sort: e, onSortChange: o }]), N = c() === window;
|
|
186
|
-
if (_) {
|
|
187
|
-
const s = /* @__PURE__ */ n.createElement("tr", null, /* @__PURE__ */ n.createElement("td", { className: y(F), colSpan: 100 }));
|
|
188
|
-
return /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
189
|
-
"tr",
|
|
190
|
-
{
|
|
191
|
-
ref: i,
|
|
192
|
-
className: y(
|
|
193
|
-
I({ pinned: !1, scrollParentIsWindow: N, __autoLayout: _ }),
|
|
194
|
-
t
|
|
195
|
-
),
|
|
196
|
-
...a
|
|
197
|
-
},
|
|
198
|
-
E
|
|
199
|
-
), s, u && /* @__PURE__ */ n.createElement(
|
|
200
|
-
"tr",
|
|
201
|
-
{
|
|
202
|
-
ref: p,
|
|
203
|
-
className: y(
|
|
204
|
-
t,
|
|
205
|
-
I({ pinned: !0, scrollParentIsWindow: N, __autoLayout: _ })
|
|
206
|
-
),
|
|
207
|
-
...a,
|
|
208
|
-
id: a.id ? `pinned-${a.id}` : void 0,
|
|
209
|
-
"data-testid": a["data-testid"] ? `pinned-${a["data-testid"]}` : void 0
|
|
210
|
-
},
|
|
211
|
-
E
|
|
212
|
-
));
|
|
213
|
-
}
|
|
214
|
-
return /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
215
|
-
"div",
|
|
216
|
-
{
|
|
217
|
-
ref: i,
|
|
218
|
-
className: y(
|
|
219
|
-
t,
|
|
220
|
-
I({ pinned: !1, scrollParentIsWindow: N, __autoLayout: _ })
|
|
221
|
-
),
|
|
222
|
-
...a
|
|
223
|
-
},
|
|
224
|
-
E
|
|
225
|
-
), u && /* @__PURE__ */ n.createElement(
|
|
226
|
-
"div",
|
|
227
|
-
{
|
|
228
|
-
ref: p,
|
|
229
|
-
className: y(
|
|
230
|
-
t,
|
|
231
|
-
I({ pinned: !0, scrollParentIsWindow: N, __autoLayout: _ })
|
|
232
|
-
),
|
|
233
|
-
...a,
|
|
234
|
-
id: a.id ? `pinned-${a.id}` : void 0,
|
|
235
|
-
"data-testid": a["data-testid"] ? `pinned-${a["data-testid"]}` : void 0
|
|
236
|
-
},
|
|
237
|
-
E
|
|
238
|
-
));
|
|
239
|
-
}
|
|
240
|
-
V.set(K, {
|
|
241
|
-
name: "Sorting Header",
|
|
242
|
-
props: {
|
|
243
|
-
sort: { type: "SortedColumn[]" },
|
|
244
|
-
onSortChange: { type: "SortChangeHandler" }
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
const Y = {
|
|
248
|
-
components: [K, R],
|
|
1
|
+
import { SortingHeader as e, SortingHeaderCell as t } from "@sps-woodland/core/sorting-header";
|
|
2
|
+
export * from "@sps-woodland/core/sorting-header";
|
|
3
|
+
import { code as o } from "@spscommerce/utils";
|
|
4
|
+
const r = {
|
|
5
|
+
components: [e, t],
|
|
249
6
|
examples: {
|
|
250
7
|
basic: {
|
|
251
8
|
label: "Sorting Header",
|
|
252
9
|
examples: {
|
|
253
10
|
basic: {
|
|
254
|
-
react:
|
|
11
|
+
react: o`
|
|
255
12
|
import { SortingHeader, SortingHeaderCell } from "@sps-woodland/sorting-header";
|
|
256
13
|
import { Icon } from "@sps-woodland/core";
|
|
257
14
|
import { ContentRow } from "@sps-woodland/content-row";
|
|
@@ -350,11 +107,9 @@ const Y = {
|
|
|
350
107
|
}
|
|
351
108
|
}
|
|
352
109
|
}
|
|
353
|
-
},
|
|
354
|
-
"Sorting Header":
|
|
110
|
+
}, s = {
|
|
111
|
+
"Sorting Header": r
|
|
355
112
|
};
|
|
356
113
|
export {
|
|
357
|
-
|
|
358
|
-
K as SortingHeader,
|
|
359
|
-
R as SortingHeaderCell
|
|
114
|
+
s as MANIFEST
|
|
360
115
|
};
|
package/lib/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@sps-woodland/core/sorting-header"),require("@spscommerce/utils")):typeof define=="function"&&define.amd?define(["exports","@sps-woodland/core/sorting-header","@spscommerce/utils"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.SortingHeader={},e.sortingHeader,e.utils))})(this,(function(e,t,r){"use strict";const i={"Sorting Header":{components:[t.SortingHeader,t.SortingHeaderCell],examples:{basic:{label:"Sorting Header",examples:{basic:{react:r.code`
|
|
2
2
|
import { SortingHeader, SortingHeaderCell } from "@sps-woodland/sorting-header";
|
|
3
3
|
import { Icon } from "@sps-woodland/core";
|
|
4
4
|
import { ContentRow } from "@sps-woodland/content-row";
|
|
@@ -92,4 +92,4 @@
|
|
|
92
92
|
</>
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
|
-
`}}}}}};
|
|
95
|
+
`}}}}}};e.MANIFEST=i,Object.keys(t).forEach(o=>{o!=="default"&&!Object.prototype.hasOwnProperty.call(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:()=>t[o]})}),Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
package/lib/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.pkg_sps-
|
|
1
|
+
.pkg_sps-woodland_core__version_8_53_5__hash_ax8xqf0:after{content:"";border-left-color:transparent;border-right-color:transparent;border-style:solid;border-width:.375rem .25rem;height:0;position:absolute;right:.5rem}.pkg_sps-woodland_core__version_8_53_5__hash_ax8xqf1:after{border-bottom-color:#1f282c;border-top-color:transparent;top:calc(50% - 9px)}.pkg_sps-woodland_core__version_8_53_5__hash_ax8xqf2:after{border-top-color:#1f282c;border-bottom-color:transparent;top:calc(50% - 3px)}.pkg_sps-woodland_core__version_8_53_5__hash_11ho8id0{display:table-cell;vertical-align:middle;color:#4b5356;font-size:.75rem;font-weight:600;line-height:1.25rem;padding:.5rem;position:relative}.pkg_sps-woodland_core__version_8_53_5__hash_11ho8id0:hover{background-color:#f3f4f4}.pkg_sps-woodland_core__version_8_53_5__hash_11ho8id1{cursor:default}.pkg_sps-woodland_core__version_8_53_5__hash_11ho8id1:hover{background-color:#e9e9ea}.pkg_sps-woodland_core__version_8_53_5__hash_11ho8id2{color:#1f282c;background-color:#d2d4d4}.pkg_sps-woodland_core__version_8_53_5__hash_11ho8id3{text-align:left}.pkg_sps-woodland_core__version_8_53_5__hash_11ho8id3:first-child{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.pkg_sps-woodland_core__version_8_53_5__hash_11ho8id3:last-child{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.pkg_sps-woodland_core__version_8_53_5__hash_1jpcvsu0{padding:0;border-radius:.25rem;vertical-align:bottom;cursor:pointer;background-color:#e9e9ea}.pkg_sps-woodland_core__version_8_53_5__hash_1jpcvsu1{border-radius:0;position:fixed;top:0;z-index:999}.pkg_sps-woodland_core__version_8_53_5__hash_1jpcvsu1:after{content:"";background:linear-gradient(180deg,rgba(0,0,0,.1),transparent);display:block;height:.625rem;position:absolute;top:100%;left:-.0625rem;width:100%}.pkg_sps-woodland_core__version_8_53_5__hash_1jpcvsu5{display:table-row}.pkg_sps-woodland_core__version_8_53_5__hash_1jpcvsu6{display:table;table-layout:fixed;width:100%}.pkg_sps-woodland_core__version_8_53_5__hash_1jpcvsu7{top:3.75rem}.pkg_sps-woodland_core__version_8_53_5__hash_1jpcvsu8{height:1rem;background:transparent;border:0}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sps-woodland/sorting-header",
|
|
3
3
|
"description": "SPS Woodland Design System sorting-header and sorting-header cell components",
|
|
4
|
-
"version": "8.53.
|
|
4
|
+
"version": "8.53.5",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/SPSCommerce/woodland/tree/main/packages/@sps-woodland/sorting-header",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"import": "./lib/index.js",
|
|
18
18
|
"default": "./lib/index.js"
|
|
19
19
|
},
|
|
20
|
+
"./style.css": "./lib/style.css",
|
|
20
21
|
"./lib/style.css": {
|
|
21
22
|
"import": "./lib/style.css",
|
|
22
23
|
"require": "./lib/style.css"
|
|
@@ -29,23 +30,19 @@
|
|
|
29
30
|
"@spscommerce/utils": "^7.0.0 || ^8.0.0 || ^9.0.0",
|
|
30
31
|
"react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
31
32
|
"react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
32
|
-
"@sps-woodland/core": "8.53.
|
|
33
|
-
"@sps-woodland/tokens": "8.53.3"
|
|
33
|
+
"@sps-woodland/core": "8.53.5"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@spscommerce/utils": "9.0.3",
|
|
37
|
-
"@vanilla-extract/css": "1.17.4",
|
|
38
|
-
"@vanilla-extract/css-utils": "0.1.3",
|
|
39
|
-
"@vanilla-extract/recipes": "0.2.5",
|
|
40
37
|
"react": "16.14.0",
|
|
41
38
|
"react-dom": "16.14.0",
|
|
42
|
-
"@sps-woodland/core": "8.53.
|
|
43
|
-
"@sps-woodland/tokens": "8.53.3"
|
|
39
|
+
"@sps-woodland/core": "8.53.5"
|
|
44
40
|
},
|
|
45
41
|
"scripts": {
|
|
46
|
-
"build": "pnpm run build:js && pnpm run build:types",
|
|
42
|
+
"build": "pnpm run build:js && pnpm run build:types && pnpm run build:css",
|
|
47
43
|
"build:js": "vite build",
|
|
48
44
|
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib",
|
|
45
|
+
"build:css": "cp ../core/lib/sorting-header/style.css lib/style.css 2>/dev/null || echo 'sorting-header style.css not found, skipping'",
|
|
49
46
|
"watch": "vite build --watch",
|
|
50
47
|
"clean": "git clean -fdX",
|
|
51
48
|
"pub": "node ../../../scripts/publish-package.mjs"
|
package/vite.config.mjs
CHANGED
|
@@ -1,31 +1,24 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
|
|
3
2
|
import { defineConfig } from "vite";
|
|
4
|
-
import { getVanillaExtractPluginProps } from "../../../scripts/vanilla-extract-plugin-props.mjs";
|
|
5
3
|
import pkg from "./package.json";
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
// Sorting-header is now a wrapper package that re-exports from @sps-woodland/core.
|
|
6
|
+
// No vanilla-extract needed - CSS is provided by the mono-package.
|
|
7
|
+
|
|
8
|
+
const peerDeps = pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [];
|
|
8
9
|
|
|
9
10
|
export default defineConfig({
|
|
10
|
-
plugins: [
|
|
11
|
-
vanillaExtractPlugin(
|
|
12
|
-
getVanillaExtractPluginProps({
|
|
13
|
-
packageName: pkg.name,
|
|
14
|
-
packageVersion,
|
|
15
|
-
})
|
|
16
|
-
),
|
|
17
|
-
],
|
|
18
11
|
build: {
|
|
19
12
|
lib: {
|
|
20
13
|
entry: path.resolve(__dirname, "src/index.ts"),
|
|
21
14
|
name: "SortingHeader",
|
|
22
15
|
fileName: "index",
|
|
23
|
-
cssFileName: "style",
|
|
24
16
|
},
|
|
25
17
|
outDir: path.resolve(__dirname, "./lib"),
|
|
26
18
|
emptyOutDir: false,
|
|
27
19
|
rollupOptions: {
|
|
28
|
-
|
|
20
|
+
// External must match subpath imports like @sps-woodland/core/sorting-header
|
|
21
|
+
external: (id) => peerDeps.some((dep) => id === dep || id.startsWith(dep + "/")),
|
|
29
22
|
},
|
|
30
23
|
},
|
|
31
24
|
});
|
package/lib/caret/caret.css.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare const headerCaret: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<{
|
|
2
|
-
up: {
|
|
3
|
-
true: {
|
|
4
|
-
":after": {
|
|
5
|
-
borderBottomColor: string;
|
|
6
|
-
borderTopColor: "transparent";
|
|
7
|
-
top: string;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
down: {
|
|
12
|
-
true: {
|
|
13
|
-
":after": {
|
|
14
|
-
borderTopColor: string;
|
|
15
|
-
borderBottomColor: "transparent";
|
|
16
|
-
top: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
}>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export declare const sortingHeader: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<{
|
|
2
|
-
pinned: {
|
|
3
|
-
true: {
|
|
4
|
-
borderRadius: number;
|
|
5
|
-
position: "fixed";
|
|
6
|
-
top: "0";
|
|
7
|
-
zIndex: number;
|
|
8
|
-
selectors: {
|
|
9
|
-
"&:after": {
|
|
10
|
-
background: "linear-gradient(180deg, rgba(0, 0, 0, 0.1), transparent)";
|
|
11
|
-
content: "";
|
|
12
|
-
display: "block";
|
|
13
|
-
height: string;
|
|
14
|
-
position: "absolute";
|
|
15
|
-
top: "calc(100%)";
|
|
16
|
-
left: string;
|
|
17
|
-
width: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
false: {};
|
|
22
|
-
};
|
|
23
|
-
scrollParentIsWindow: {
|
|
24
|
-
true: {};
|
|
25
|
-
false: {};
|
|
26
|
-
};
|
|
27
|
-
__autoLayout: {
|
|
28
|
-
true: {
|
|
29
|
-
display: "table-row";
|
|
30
|
-
};
|
|
31
|
-
false: {
|
|
32
|
-
display: "table";
|
|
33
|
-
tableLayout: "fixed";
|
|
34
|
-
width: string;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
}>;
|
|
38
|
-
export declare const sortingHeaderSpacer: string;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import type { ComponentProps, SortChangeHandler, SortedColumn } from "@sps-woodland/core";
|
|
3
|
-
export declare function SortingHeader({ sort, onSortChange, children, className, pinSortingHeader, __autoLayout, ...rest }: ComponentProps<{
|
|
4
|
-
sort: SortedColumn[];
|
|
5
|
-
onSortChange: SortChangeHandler;
|
|
6
|
-
pinSortingHeader?: boolean;
|
|
7
|
-
__autoLayout?: boolean;
|
|
8
|
-
}, HTMLDivElement>): React.ReactElement;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export declare const headerCell: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<{
|
|
2
|
-
disabled: {
|
|
3
|
-
true: {
|
|
4
|
-
cursor: "default";
|
|
5
|
-
selectors: {
|
|
6
|
-
"&:hover": {
|
|
7
|
-
backgroundColor: string;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
active: {
|
|
13
|
-
true: {
|
|
14
|
-
color: string;
|
|
15
|
-
backgroundColor: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
__autoLayout: {
|
|
19
|
-
true: {
|
|
20
|
-
textAlign: "left";
|
|
21
|
-
selectors: {
|
|
22
|
-
"&:first-child": {
|
|
23
|
-
borderTopLeftRadius: string;
|
|
24
|
-
borderBottomLeftRadius: string;
|
|
25
|
-
};
|
|
26
|
-
"&:last-child": {
|
|
27
|
-
borderTopRightRadius: string;
|
|
28
|
-
borderBottomRightRadius: string;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
false: {};
|
|
33
|
-
};
|
|
34
|
-
}>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import type { SortedColumn, SortChangeHandler, ComponentProps } from "@sps-woodland/core";
|
|
3
|
-
export declare function SortingHeaderCell({ className, sortKey, sort, sortDisabled, onSortChange, onClick, children, style, widthPx, widthRem, __autoLayout, ...rest }: ComponentProps<{
|
|
4
|
-
sortKey?: string;
|
|
5
|
-
sortDisabled?: boolean;
|
|
6
|
-
sort?: SortedColumn[];
|
|
7
|
-
onSortChange?: SortChangeHandler;
|
|
8
|
-
widthPx?: number;
|
|
9
|
-
widthRem?: number;
|
|
10
|
-
__autoLayout?: boolean;
|
|
11
|
-
}, HTMLDivElement>): React.ReactElement;
|