@sps-woodland/core 8.56.0 → 8.56.2
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/lib/action-bar/action-bar/ActionBar.ve.js +1 -1
- package/lib/action-bar/index.js +1 -1
- package/lib/action-bar/index.umd.cjs +1 -1
- package/lib/action-bar/style.css +1 -1
- package/lib/add-to-list/add-to-list/AddToList.css.d.ts.map +1 -1
- package/lib/add-to-list/add-to-list/AddToList.d.ts.map +1 -1
- package/lib/add-to-list/add-to-list/AddToList.js +185 -178
- package/lib/add-to-list/add-to-list/AddToList.ve.js +1 -1
- package/lib/add-to-list/add-to-list/ItemsList.d.ts.map +1 -1
- package/lib/add-to-list/add-to-list/ItemsList.js +32 -31
- package/lib/add-to-list/index.js +244 -235
- package/lib/add-to-list/index.umd.cjs +1 -1
- package/lib/add-to-list/style.css +1 -1
- package/lib/buttons/button/Button.css.d.ts.map +1 -1
- package/lib/buttons/button/Button.ve.js +1 -1
- package/lib/buttons/index.js +1 -1
- package/lib/buttons/index.umd.cjs +1 -1
- package/lib/buttons/style.css +1 -1
- package/lib/cards/card/Card.css.d.ts.map +1 -1
- package/lib/cards/card/Card.ve.js +1 -1
- package/lib/cards/card-footer/CardFooter.ve.js +1 -1
- package/lib/cards/card-header/CardHeader.ve.js +1 -1
- package/lib/cards/card-title/CardTitle.ve.js +1 -1
- package/lib/cards/index.js +4 -4
- package/lib/cards/index.umd.cjs +1 -1
- package/lib/cards/style.css +1 -1
- package/lib/column-manager/column-manager/ColumnManager.d.ts.map +1 -1
- package/lib/column-manager/column-manager/ColumnManager.js +45 -45
- package/lib/components/icon/Icon.ve.js +1 -1
- package/lib/content-row/content-row/ContentRow.ve.js +1 -1
- package/lib/content-row/content-row-col/ContentRowCol.ve.js +1 -1
- package/lib/content-row/index.js +3 -3
- package/lib/content-row/index.umd.cjs +1 -1
- package/lib/content-row/row-list-auto-layout/RowListAutoLayout.ve.js +1 -1
- package/lib/content-row/style.css +1 -1
- package/lib/content-tiles/content-tile/ContentTile.css.d.ts.map +1 -1
- package/lib/content-tiles/content-tile/ContentTile.ve.js +1 -1
- package/lib/content-tiles/content-tile-list/ContentTileList.ve.js +1 -1
- package/lib/content-tiles/index.js +2 -2
- package/lib/content-tiles/index.umd.cjs +1 -1
- package/lib/content-tiles/style.css +1 -1
- package/lib/core.css +1 -1
- package/lib/dropdowns/dropdown/Dropdown.css.d.ts.map +1 -1
- package/lib/dropdowns/dropdown/Dropdown.ve.js +1 -1
- package/lib/dropdowns/index.js +3 -3
- package/lib/dropdowns/index.umd.cjs +1 -1
- package/lib/dropdowns/option-list/Option.css.d.ts.map +1 -1
- package/lib/dropdowns/option-list/Option.ve.js +1 -1
- package/lib/dropdowns/option-list/OptionList.ve.js +1 -1
- package/lib/dropdowns/style.css +1 -1
- package/lib/feedback-block/FeedbackBlock.ve.js +1 -1
- package/lib/feedback-block/index.js +1 -1
- package/lib/feedback-block/index.umd.cjs +1 -1
- package/lib/feedback-block/style.css +1 -1
- package/lib/file-upload/file-upload/FileUpload.ve.js +1 -1
- package/lib/file-upload/index.js +1 -1
- package/lib/file-upload/index.umd.cjs +1 -1
- package/lib/file-upload/style.css +1 -1
- package/lib/filter-tiles/filter-tile/FilterTile.css.d.ts.map +1 -1
- package/lib/filter-tiles/filter-tile/FilterTile.d.ts.map +1 -1
- package/lib/filter-tiles/filter-tile/FilterTile.js +30 -17
- package/lib/filter-tiles/filter-tile/FilterTile.ve.js +1 -1
- package/lib/filter-tiles/filter-tile-set/FilterTileSet.ve.js +1 -1
- package/lib/filter-tiles/index.js +66 -53
- package/lib/filter-tiles/index.umd.cjs +1 -1
- package/lib/filter-tiles/style.css +1 -1
- package/lib/focused-task/focused-task/FocusedTask.ve.js +1 -1
- package/lib/focused-task/index.js +1 -1
- package/lib/focused-task/index.umd.cjs +1 -1
- package/lib/focused-task/style.css +1 -1
- package/lib/growler/Growler.ve.js +1 -1
- package/lib/growler/Sonner.ve.js +1 -1
- package/lib/growler/index.js +2 -2
- package/lib/growler/index.umd.cjs +1 -1
- package/lib/growler/style.css +1 -1
- package/lib/index.js +8 -8
- package/lib/index.umd.cjs +1 -1
- package/lib/insight-card/InsightCard.ve.js +1 -1
- package/lib/insight-card/index.js +1 -1
- package/lib/insight-card/index.umd.cjs +1 -1
- package/lib/insight-card/style.css +1 -1
- package/lib/key-value-set/index.js +2 -2
- package/lib/key-value-set/index.umd.cjs +1 -1
- package/lib/key-value-set/key-value-set/KeyValueSet.ve.js +1 -1
- package/lib/key-value-set/key-value-set-item/KeyValueSetItem.ve.js +1 -1
- package/lib/key-value-set/style.css +1 -1
- package/lib/list-bar/advanced-search/AdvancedSearch.ve.js +1 -1
- package/lib/list-bar/index.js +3 -3
- package/lib/list-bar/index.umd.cjs +1 -1
- package/lib/list-bar/list-bar/ListBar.ve.js +1 -1
- package/lib/list-bar/search-results-bar/SearchResultsBar.ve.js +1 -1
- package/lib/list-bar/style.css +1 -1
- package/lib/matrix/index.js +1 -1
- package/lib/matrix/index.umd.cjs +1 -1
- package/lib/matrix/matrix/Matrix.ve.js +1 -1
- package/lib/matrix/style.css +1 -1
- package/lib/modal/index.js +1 -1
- package/lib/modal/index.umd.cjs +1 -1
- package/lib/modal/modal/Modal.ve.js +1 -1
- package/lib/modal/style.css +1 -1
- package/lib/page-title/index.js +2 -2
- package/lib/page-title/index.umd.cjs +1 -1
- package/lib/page-title/page-subtitle/PageSubtitle.ve.js +1 -1
- package/lib/page-title/page-title/PageTitle.ve.js +1 -1
- package/lib/page-title/style.css +1 -1
- package/lib/photo/index.js +68 -64
- package/lib/photo/index.umd.cjs +1 -1
- package/lib/photo/photo/Photo.ve.js +1 -1
- package/lib/photo/photo-carousel/PhotoCarousel.css.d.ts.map +1 -1
- package/lib/photo/photo-carousel/PhotoCarousel.d.ts.map +1 -1
- package/lib/photo/photo-carousel/PhotoCarousel.js +36 -32
- package/lib/photo/photo-carousel/PhotoCarousel.ve.js +1 -1
- package/lib/photo/style.css +1 -1
- package/lib/product-bar/index.js +115 -100
- package/lib/product-bar/index.umd.cjs +1 -1
- package/lib/product-bar/product-bar/ProductBar.css.d.ts +1 -0
- package/lib/product-bar/product-bar/ProductBar.css.d.ts.map +1 -1
- package/lib/product-bar/product-bar/ProductBar.ve.js +5 -4
- package/lib/product-bar/product-bar-name/ProductBarName.d.ts.map +1 -1
- package/lib/product-bar/product-bar-name/ProductBarName.js +31 -20
- package/lib/product-bar/product-bar-overflow-menu/ProductBarOverflowMenu.ve.js +1 -1
- package/lib/product-bar/product-bar-tab/ProductBarTab.d.ts +3 -4
- package/lib/product-bar/product-bar-tab/ProductBarTab.d.ts.map +1 -1
- package/lib/product-bar/product-bar-tab/ProductBarTab.js +17 -13
- package/lib/product-bar/slack-link/SlackLink.ve.js +1 -1
- package/lib/product-bar/style.css +1 -1
- package/lib/product-bar-vertical/index.js +1 -1
- package/lib/product-bar-vertical/index.umd.cjs +1 -1
- package/lib/product-bar-vertical/product-bar-vertical/ProductBarVertical.ve.js +1 -1
- package/lib/product-bar-vertical/style.css +1 -1
- package/lib/progress-indicators/index.js +1 -1
- package/lib/progress-indicators/index.umd.cjs +1 -1
- package/lib/progress-indicators/progress-bar/ProgressBar.ve.js +1 -1
- package/lib/progress-indicators/progress-bar/progress-bar-step/ProgressBarStep.ve.js +1 -1
- package/lib/progress-indicators/style.css +1 -1
- package/lib/rich-text-editor/index.js +2 -2
- package/lib/rich-text-editor/index.umd.cjs +1 -1
- package/lib/rich-text-editor/rich-text-editor/RTEToolbarButton.css.d.ts.map +1 -1
- package/lib/rich-text-editor/rich-text-editor/RTEToolbarButton.ve.js +1 -1
- package/lib/rich-text-editor/rich-text-editor/RichTextEditor.ve.js +1 -1
- package/lib/rich-text-editor/style.css +1 -1
- package/lib/scrollable-container/ScrollableContainer.ve.js +1 -1
- package/lib/scrollable-container/index.js +1 -1
- package/lib/scrollable-container/index.umd.cjs +1 -1
- package/lib/scrollable-container/style.css +1 -1
- package/lib/side-nav/index.js +84 -72
- package/lib/side-nav/index.umd.cjs +1 -1
- package/lib/side-nav/side-nav/SideNav.css.d.ts.map +1 -1
- package/lib/side-nav/side-nav/SideNav.ve.js +1 -1
- package/lib/side-nav/side-nav-item/SideNavItem.d.ts.map +1 -1
- package/lib/side-nav/side-nav-item/SideNavItem.js +51 -39
- package/lib/side-nav/style.css +1 -1
- package/lib/sorting-header/caret/caret.ve.js +1 -1
- package/lib/sorting-header/index.js +154 -146
- package/lib/sorting-header/index.umd.cjs +1 -1
- package/lib/sorting-header/sorting-header/SortingHeader.ve.js +1 -1
- package/lib/sorting-header/sorting-header-cell/SortingHeaderCell.css.d.ts +2 -0
- package/lib/sorting-header/sorting-header-cell/SortingHeaderCell.css.d.ts.map +1 -1
- package/lib/sorting-header/sorting-header-cell/SortingHeaderCell.d.ts.map +1 -1
- package/lib/sorting-header/sorting-header-cell/SortingHeaderCell.js +49 -41
- package/lib/sorting-header/sorting-header-cell/SortingHeaderCell.ve.js +4 -2
- package/lib/sorting-header/style.css +1 -1
- package/lib/style.css +1 -1
- package/lib/tabs/index.js +51 -50
- package/lib/tabs/index.umd.cjs +1 -1
- package/lib/tabs/style.css +1 -1
- package/lib/tabs/tab/Tab.css.d.ts.map +1 -1
- package/lib/tabs/tab/Tab.ve.js +1 -1
- package/lib/tabs/tab-panel/TabPanel.d.ts.map +1 -1
- package/lib/tabs/tab-panel/TabPanel.js +12 -10
- package/lib/tabs/tabs/Tabs.css.d.ts +1 -0
- package/lib/tabs/tabs/Tabs.css.d.ts.map +1 -1
- package/lib/tabs/tabs/Tabs.ve.js +2 -1
- package/lib/tags/clickable-tag/ClickableTag.css.d.ts +1 -1
- package/lib/tags/clickable-tag/ClickableTag.css.d.ts.map +1 -1
- package/lib/tags/clickable-tag/ClickableTag.d.ts.map +1 -1
- package/lib/tags/clickable-tag/ClickableTag.js +59 -39
- package/lib/tags/clickable-tag/ClickableTag.ve.js +1 -1
- package/lib/tags/index.js +109 -89
- package/lib/tags/index.umd.cjs +1 -1
- package/lib/tags/split-tag/SplitTag.css.d.ts.map +1 -1
- package/lib/tags/split-tag/SplitTag.ve.js +1 -1
- package/lib/tags/style.css +1 -1
- package/lib/tags/tag/Tag.ve.js +1 -1
- package/lib/zero-state/ZeroState.ve.js +1 -1
- package/lib/zero-state/index.js +1 -1
- package/lib/zero-state/index.umd.cjs +1 -1
- package/lib/zero-state/style.css +1 -1
- package/package.json +10 -10
|
@@ -1,120 +1,128 @@
|
|
|
1
1
|
import * as n from "react";
|
|
2
|
-
import { Metadata as
|
|
3
|
-
import { lockToAnimationFrames as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { Metadata as V, SortDirection as m, cl as b, getScrollParent as G, selectChildren as H, modChildren as W } from "@sps-woodland/core";
|
|
3
|
+
import { lockToAnimationFrames as L } from "@spscommerce/utils";
|
|
4
|
+
import { useWoodlandLanguage as T } from "@spscommerce/i18n";
|
|
5
|
+
function F(t, r, a) {
|
|
6
|
+
return r in t ? Object.defineProperty(t, r, {
|
|
7
|
+
value: a,
|
|
7
8
|
enumerable: !0,
|
|
8
9
|
configurable: !0,
|
|
9
10
|
writable: !0
|
|
10
|
-
}) :
|
|
11
|
+
}) : t[r] = a, t;
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
-
var
|
|
13
|
+
function j(t, r) {
|
|
14
|
+
var a = Object.keys(t);
|
|
14
15
|
if (Object.getOwnPropertySymbols) {
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
return Object.getOwnPropertyDescriptor(
|
|
18
|
-
})),
|
|
16
|
+
var e = Object.getOwnPropertySymbols(t);
|
|
17
|
+
r && (e = e.filter(function(o) {
|
|
18
|
+
return Object.getOwnPropertyDescriptor(t, o).enumerable;
|
|
19
|
+
})), a.push.apply(a, e);
|
|
19
20
|
}
|
|
20
|
-
return
|
|
21
|
+
return a;
|
|
21
22
|
}
|
|
22
|
-
function D(
|
|
23
|
-
for (var
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
|
28
|
-
Object.defineProperty(
|
|
23
|
+
function D(t) {
|
|
24
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
25
|
+
var a = arguments[r] != null ? arguments[r] : {};
|
|
26
|
+
r % 2 ? j(Object(a), !0).forEach(function(e) {
|
|
27
|
+
F(t, e, a[e]);
|
|
28
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(a)) : j(Object(a)).forEach(function(e) {
|
|
29
|
+
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(a, e));
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
|
-
return
|
|
32
|
+
return t;
|
|
32
33
|
}
|
|
33
|
-
var
|
|
34
|
-
for (var
|
|
35
|
-
var
|
|
36
|
-
if (e
|
|
34
|
+
var M = (t, r, a) => {
|
|
35
|
+
for (var e of Object.keys(t)) {
|
|
36
|
+
var o;
|
|
37
|
+
if (t[e] !== ((o = r[e]) !== null && o !== void 0 ? o : a[e]))
|
|
37
38
|
return !1;
|
|
38
39
|
}
|
|
39
40
|
return !0;
|
|
40
|
-
},
|
|
41
|
-
var
|
|
42
|
-
for (var
|
|
43
|
-
var
|
|
44
|
-
if (
|
|
45
|
-
var
|
|
46
|
-
typeof
|
|
47
|
-
var
|
|
41
|
+
}, A = (t) => (r) => {
|
|
42
|
+
var a = t.defaultClassName, e = D(D({}, t.defaultVariants), r);
|
|
43
|
+
for (var o in e) {
|
|
44
|
+
var u, l = (u = e[o]) !== null && u !== void 0 ? u : t.defaultVariants[o];
|
|
45
|
+
if (l != null) {
|
|
46
|
+
var f = l;
|
|
47
|
+
typeof f == "boolean" && (f = f === !0 ? "true" : "false");
|
|
48
|
+
var w = (
|
|
48
49
|
// @ts-expect-error
|
|
49
|
-
|
|
50
|
+
t.variantClassNames[o][f]
|
|
50
51
|
);
|
|
51
|
-
|
|
52
|
+
w && (a += " " + w);
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
|
-
for (var [i, p] of
|
|
55
|
-
|
|
56
|
-
return
|
|
57
|
-
}, I =
|
|
55
|
+
for (var [i, p] of t.compoundVariants)
|
|
56
|
+
M(i, e, t.defaultVariants) && (a += " " + p);
|
|
57
|
+
return a;
|
|
58
|
+
}, I = A({ defaultClassName: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_ax8xqf0", variantClassNames: { up: { true: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_ax8xqf1" }, down: { true: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_ax8xqf2" } }, defaultVariants: {}, compoundVariants: [] }), R = A({ defaultClassName: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_11ho8id0", variantClassNames: { disabled: { true: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_11ho8id1" }, active: { true: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_11ho8id2" }, __autoLayout: { true: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_11ho8id3", false: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_11ho8id4" } }, defaultVariants: { disabled: !1, active: !1, __autoLayout: !1 }, compoundVariants: [] }), Y = "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_11ho8id5", $ = "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_11ho8id6";
|
|
58
59
|
function B({
|
|
59
|
-
className:
|
|
60
|
-
sortKey:
|
|
61
|
-
sort:
|
|
62
|
-
sortDisabled:
|
|
63
|
-
onSortChange:
|
|
64
|
-
onClick:
|
|
65
|
-
children:
|
|
66
|
-
style:
|
|
67
|
-
widthPx:
|
|
60
|
+
className: t,
|
|
61
|
+
sortKey: r,
|
|
62
|
+
sort: a,
|
|
63
|
+
sortDisabled: e,
|
|
64
|
+
onSortChange: o,
|
|
65
|
+
onClick: u,
|
|
66
|
+
children: l,
|
|
67
|
+
style: f,
|
|
68
|
+
widthPx: w,
|
|
68
69
|
widthRem: i,
|
|
69
70
|
__autoLayout: p = !1,
|
|
70
|
-
...
|
|
71
|
+
...d
|
|
71
72
|
}) {
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
return
|
|
75
|
-
}, [r,
|
|
76
|
-
|
|
73
|
+
const _ = n.useMemo(() => {
|
|
74
|
+
const h = !!r && !e && Array.isArray(a) && a.find((g) => g.key === r);
|
|
75
|
+
return h ? h.direction : void 0;
|
|
76
|
+
}, [a, r, e]), { t: N } = T(), y = w ? w / 16 : i, S = y ? { ...f, width: `${y}rem` } : f, P = (h) => {
|
|
77
|
+
r && !e && o && o([
|
|
77
78
|
{
|
|
78
|
-
key:
|
|
79
|
-
direction:
|
|
79
|
+
key: r,
|
|
80
|
+
direction: _ === m.ASCENDING ? m.DESCENDING : m.ASCENDING
|
|
80
81
|
}
|
|
81
|
-
]),
|
|
82
|
-
};
|
|
82
|
+
]), u && u(h);
|
|
83
|
+
}, C = !!r && !!o && !e;
|
|
84
|
+
let E = "none";
|
|
85
|
+
_ === m.ASCENDING ? E = "ascending" : _ === m.DESCENDING && (E = "descending");
|
|
86
|
+
let s = null;
|
|
87
|
+
!p && _ && (s = /* @__PURE__ */ n.createElement("span", { className: $ }, " ", _ === m.ASCENDING ? N("sortingHeader.sortedAscending", { defaultValue: "sorted ascending" }) : N("sortingHeader.sortedDescending", { defaultValue: "sorted descending" })));
|
|
88
|
+
const c = C ? /* @__PURE__ */ n.createElement("button", { type: "button", className: Y }, l, s) : /* @__PURE__ */ n.createElement(n.Fragment, null, l, s);
|
|
83
89
|
return p ? /* @__PURE__ */ n.createElement(
|
|
84
90
|
"td",
|
|
85
91
|
{
|
|
86
|
-
className:
|
|
87
|
-
|
|
88
|
-
R({ disabled:
|
|
89
|
-
|
|
90
|
-
up:
|
|
91
|
-
down:
|
|
92
|
+
className: b(
|
|
93
|
+
t,
|
|
94
|
+
R({ disabled: e, active: !!_, __autoLayout: p }),
|
|
95
|
+
_ && I({
|
|
96
|
+
up: _ === m.ASCENDING,
|
|
97
|
+
down: _ === m.DESCENDING
|
|
92
98
|
})
|
|
93
99
|
),
|
|
94
|
-
onClick:
|
|
95
|
-
style:
|
|
96
|
-
|
|
100
|
+
onClick: P,
|
|
101
|
+
style: S,
|
|
102
|
+
role: "columnheader",
|
|
103
|
+
"aria-sort": C ? E : void 0,
|
|
104
|
+
...d
|
|
97
105
|
},
|
|
98
|
-
|
|
106
|
+
c
|
|
99
107
|
) : /* @__PURE__ */ n.createElement(
|
|
100
108
|
"div",
|
|
101
109
|
{
|
|
102
|
-
className:
|
|
103
|
-
|
|
104
|
-
R({ disabled:
|
|
105
|
-
|
|
106
|
-
up:
|
|
107
|
-
down:
|
|
110
|
+
className: b(
|
|
111
|
+
t,
|
|
112
|
+
R({ disabled: e, active: !!_, __autoLayout: p }),
|
|
113
|
+
_ && I({
|
|
114
|
+
up: _ === m.ASCENDING,
|
|
115
|
+
down: _ === m.DESCENDING
|
|
108
116
|
})
|
|
109
117
|
),
|
|
110
|
-
onClick:
|
|
111
|
-
style:
|
|
112
|
-
...
|
|
118
|
+
onClick: P,
|
|
119
|
+
style: S,
|
|
120
|
+
...d
|
|
113
121
|
},
|
|
114
|
-
|
|
122
|
+
c
|
|
115
123
|
);
|
|
116
124
|
}
|
|
117
|
-
|
|
125
|
+
V.set(B, {
|
|
118
126
|
name: "Sorting Header Cell",
|
|
119
127
|
props: {
|
|
120
128
|
sortKey: { type: "string" },
|
|
@@ -125,119 +133,119 @@ x.set(B, {
|
|
|
125
133
|
widthRem: { type: "number" }
|
|
126
134
|
}
|
|
127
135
|
});
|
|
128
|
-
var k =
|
|
129
|
-
function
|
|
130
|
-
sort:
|
|
131
|
-
onSortChange:
|
|
132
|
-
children:
|
|
133
|
-
className:
|
|
134
|
-
pinSortingHeader:
|
|
135
|
-
__autoLayout:
|
|
136
|
-
...
|
|
136
|
+
var k = A({ defaultClassName: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu0", variantClassNames: { pinned: { true: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu1", false: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu2" }, scrollParentIsWindow: { true: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu3", false: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu4" }, __autoLayout: { true: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu5", false: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu6" } }, defaultVariants: { pinned: !1, scrollParentIsWindow: !1, __autoLayout: !1 }, compoundVariants: [[{ pinned: !0, scrollParentIsWindow: !0 }, "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu7"]] }), q = "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu8";
|
|
137
|
+
function z({
|
|
138
|
+
sort: t,
|
|
139
|
+
onSortChange: r,
|
|
140
|
+
children: a,
|
|
141
|
+
className: e,
|
|
142
|
+
pinSortingHeader: o = !1,
|
|
143
|
+
__autoLayout: u = !1,
|
|
144
|
+
...l
|
|
137
145
|
}) {
|
|
138
|
-
const [
|
|
146
|
+
const [f, w] = n.useState(!1), i = n.useRef(null), p = n.useRef(null), d = n.useRef({
|
|
139
147
|
height: "",
|
|
140
148
|
width: "",
|
|
141
149
|
unpinAtTop: 0,
|
|
142
150
|
unpinAtBottom: 0,
|
|
143
151
|
cellWidths: []
|
|
144
|
-
}),
|
|
145
|
-
const
|
|
146
|
-
return
|
|
147
|
-
}, []),
|
|
152
|
+
}), _ = n.useCallback(() => i.current && G(i.current) || window, []), N = n.useCallback((s) => {
|
|
153
|
+
const c = s || _();
|
|
154
|
+
return c.scrollY || c.scrollTop || 0;
|
|
155
|
+
}, []), y = n.useCallback(
|
|
148
156
|
(s) => {
|
|
149
|
-
if (
|
|
150
|
-
const
|
|
151
|
-
if (
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
157
|
+
if (o && i.current) {
|
|
158
|
+
const c = s || _(), h = N(c), g = u ? i.current.parentElement?.parentElement?.getBoundingClientRect() : i.current.parentElement?.getBoundingClientRect();
|
|
159
|
+
if (g) {
|
|
160
|
+
const v = i.current.getBoundingClientRect();
|
|
161
|
+
d.current.height = `${v.height}px`, d.current.width = `${v.width}px`, c === window ? (d.current.unpinAtBottom = g.bottom + h - v.height * 2, d.current.unpinAtTop = v.top + h - v.height) : (d.current.unpinAtBottom = g.bottom + h - v.height * 2, d.current.unpinAtTop = g.top + h), d.current.cellWidths = [], i.current.childNodes.forEach((O, x) => {
|
|
162
|
+
O instanceof HTMLElement && (d.current.cellWidths[x] = `${O.getBoundingClientRect().width}px`);
|
|
155
163
|
});
|
|
156
164
|
}
|
|
157
165
|
}
|
|
158
166
|
},
|
|
159
|
-
[
|
|
160
|
-
),
|
|
161
|
-
p.current && (p.current.style.width =
|
|
162
|
-
s instanceof HTMLElement && (s.style.width =
|
|
167
|
+
[o]
|
|
168
|
+
), S = n.useCallback(() => {
|
|
169
|
+
p.current && (p.current.style.width = d.current.width, p.current.style.height = d.current.height, p.current.childNodes.forEach((s, c) => {
|
|
170
|
+
s instanceof HTMLElement && (s.style.width = d.current.cellWidths[c] || "");
|
|
163
171
|
}));
|
|
164
172
|
}, []);
|
|
165
173
|
n.useLayoutEffect(() => {
|
|
166
|
-
|
|
174
|
+
y();
|
|
167
175
|
}), n.useLayoutEffect(() => {
|
|
168
176
|
let s;
|
|
169
|
-
const
|
|
170
|
-
return
|
|
171
|
-
|
|
172
|
-
const { unpinAtTop:
|
|
173
|
-
|
|
174
|
-
}),
|
|
175
|
-
s &&
|
|
177
|
+
const c = _();
|
|
178
|
+
return o ? (s = L(() => {
|
|
179
|
+
y(c);
|
|
180
|
+
const { unpinAtTop: h, unpinAtBottom: g } = d.current, v = N(c);
|
|
181
|
+
h && g && (v >= h && v <= g ? (w(!0), i.current && (i.current.style.visibility = "hidden")) : (w(!1), i.current && (i.current.style.visibility = "visible")));
|
|
182
|
+
}), c.addEventListener("scroll", s), s()) : i.current && (i.current.style.visibility = "visible"), () => {
|
|
183
|
+
s && c.removeEventListener("scroll", s);
|
|
176
184
|
};
|
|
177
|
-
}, [
|
|
185
|
+
}, [o, y]), n.useLayoutEffect(() => {
|
|
178
186
|
let s;
|
|
179
|
-
return
|
|
180
|
-
|
|
187
|
+
return f && (s = () => {
|
|
188
|
+
y(), S();
|
|
181
189
|
}, window.addEventListener("resize", s), s()), () => {
|
|
182
190
|
s && window.removeEventListener("resize", s);
|
|
183
191
|
};
|
|
184
|
-
}, [
|
|
185
|
-
const [
|
|
186
|
-
if (
|
|
187
|
-
const s = /* @__PURE__ */ n.createElement("tr", null, /* @__PURE__ */ n.createElement("td", { className:
|
|
192
|
+
}, [f, y, S]);
|
|
193
|
+
const [P] = H(a, [{ type: B }]), C = W(P, () => [{ sort: t, onSortChange: r }]), E = _() === window;
|
|
194
|
+
if (u) {
|
|
195
|
+
const s = /* @__PURE__ */ n.createElement("tr", null, /* @__PURE__ */ n.createElement("td", { className: b(q), colSpan: 100 }));
|
|
188
196
|
return /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
189
197
|
"tr",
|
|
190
198
|
{
|
|
191
199
|
ref: i,
|
|
192
|
-
className:
|
|
193
|
-
k({ pinned: !1, scrollParentIsWindow:
|
|
194
|
-
|
|
200
|
+
className: b(
|
|
201
|
+
k({ pinned: !1, scrollParentIsWindow: E, __autoLayout: u }),
|
|
202
|
+
e
|
|
195
203
|
),
|
|
196
|
-
...
|
|
204
|
+
...l
|
|
197
205
|
},
|
|
198
|
-
|
|
199
|
-
), s,
|
|
206
|
+
C
|
|
207
|
+
), s, f && /* @__PURE__ */ n.createElement(
|
|
200
208
|
"tr",
|
|
201
209
|
{
|
|
202
210
|
ref: p,
|
|
203
|
-
className:
|
|
204
|
-
|
|
205
|
-
k({ pinned: !0, scrollParentIsWindow:
|
|
211
|
+
className: b(
|
|
212
|
+
e,
|
|
213
|
+
k({ pinned: !0, scrollParentIsWindow: E, __autoLayout: u })
|
|
206
214
|
),
|
|
207
|
-
...
|
|
208
|
-
id:
|
|
209
|
-
"data-testid":
|
|
215
|
+
...l,
|
|
216
|
+
id: l.id ? `pinned-${l.id}` : void 0,
|
|
217
|
+
"data-testid": l["data-testid"] ? `pinned-${l["data-testid"]}` : void 0
|
|
210
218
|
},
|
|
211
|
-
|
|
219
|
+
C
|
|
212
220
|
));
|
|
213
221
|
}
|
|
214
222
|
return /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
215
223
|
"div",
|
|
216
224
|
{
|
|
217
225
|
ref: i,
|
|
218
|
-
className:
|
|
219
|
-
|
|
220
|
-
k({ pinned: !1, scrollParentIsWindow:
|
|
226
|
+
className: b(
|
|
227
|
+
e,
|
|
228
|
+
k({ pinned: !1, scrollParentIsWindow: E, __autoLayout: u })
|
|
221
229
|
),
|
|
222
|
-
...
|
|
230
|
+
...l
|
|
223
231
|
},
|
|
224
|
-
|
|
225
|
-
),
|
|
232
|
+
C
|
|
233
|
+
), f && /* @__PURE__ */ n.createElement(
|
|
226
234
|
"div",
|
|
227
235
|
{
|
|
228
236
|
ref: p,
|
|
229
|
-
className:
|
|
230
|
-
|
|
231
|
-
k({ pinned: !0, scrollParentIsWindow:
|
|
237
|
+
className: b(
|
|
238
|
+
e,
|
|
239
|
+
k({ pinned: !0, scrollParentIsWindow: E, __autoLayout: u })
|
|
232
240
|
),
|
|
233
|
-
...
|
|
234
|
-
id:
|
|
235
|
-
"data-testid":
|
|
241
|
+
...l,
|
|
242
|
+
id: l.id ? `pinned-${l.id}` : void 0,
|
|
243
|
+
"data-testid": l["data-testid"] ? `pinned-${l["data-testid"]}` : void 0
|
|
236
244
|
},
|
|
237
|
-
|
|
245
|
+
C
|
|
238
246
|
));
|
|
239
247
|
}
|
|
240
|
-
|
|
248
|
+
V.set(z, {
|
|
241
249
|
name: "Sorting Header",
|
|
242
250
|
props: {
|
|
243
251
|
sort: { type: "SortedColumn[]" },
|
|
@@ -245,6 +253,6 @@ x.set(Y, {
|
|
|
245
253
|
}
|
|
246
254
|
});
|
|
247
255
|
export {
|
|
248
|
-
|
|
256
|
+
z as SortingHeader,
|
|
249
257
|
B as SortingHeaderCell
|
|
250
258
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(g,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("react"),require("@sps-woodland/core"),require("@spscommerce/utils"),require("@spscommerce/i18n")):typeof define=="function"&&define.amd?define(["exports","react","@sps-woodland/core","@spscommerce/utils","@spscommerce/i18n"],b):(g=typeof globalThis<"u"?globalThis:g||self,b(g.SortingHeader={},g.react,g.spsWoodlandCore,g.spscommerceUtils,g.spscommerceI18n))})(this,(function(g,b,a,B,x){"use strict";function G(e){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(i,n,t.get?t:{enumerable:!0,get:()=>e[n]})}}return i.default=e,Object.freeze(i)}const r=G(b);function W(e,i,n){return i in e?Object.defineProperty(e,i,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[i]=n,e}function A(e,i){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);i&&(t=t.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,t)}return n}function I(e){for(var i=1;i<arguments.length;i++){var n=arguments[i]!=null?arguments[i]:{};i%2?A(Object(n),!0).forEach(function(t){W(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var L=(e,i,n)=>{for(var t of Object.keys(e)){var l;if(e[t]!==((l=i[t])!==null&&l!==void 0?l:n[t]))return!1}return!0},j=e=>i=>{var n=e.defaultClassName,t=I(I({},e.defaultVariants),i);for(var l in t){var p,d=(p=t[l])!==null&&p!==void 0?p:e.defaultVariants[l];if(d!=null){var h=d;typeof h=="boolean"&&(h=h===!0?"true":"false");var y=e.variantClassNames[l][h];y&&(n+=" "+y)}}for(var[o,f]of e.compoundVariants)L(o,t,e.defaultVariants)&&(n+=" "+f);return n},H=j({defaultClassName:"pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_ax8xqf0",variantClassNames:{up:{true:"pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_ax8xqf1"},down:{true:"pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_ax8xqf2"}},defaultVariants:{},compoundVariants:[]}),R=j({defaultClassName:"pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_11ho8id0",variantClassNames:{disabled:{true:"pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_11ho8id1"},active:{true:"pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_11ho8id2"},__autoLayout:{true:"pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_11ho8id3",false:"pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_11ho8id4"}},defaultVariants:{disabled:!1,active:!1,__autoLayout:!1},compoundVariants:[]}),q="pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_11ho8id5",M="pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_11ho8id6";function k({className:e,sortKey:i,sort:n,sortDisabled:t,onSortChange:l,onClick:p,children:d,style:h,widthPx:y,widthRem:o,__autoLayout:f=!1,...c}){const _=r.useMemo(()=>{const m=!!i&&!t&&Array.isArray(n)&&n.find(v=>v.key===i);return m?m.direction:void 0},[n,i,t]),{t:N}=x.useWoodlandLanguage(),S=y?y/16:o,D=S?{...h,width:`${S}rem`}:h,O=m=>{i&&!t&&l&&l([{key:i,direction:_===a.SortDirection.ASCENDING?a.SortDirection.DESCENDING:a.SortDirection.ASCENDING}]),p&&p(m)},C=!!i&&!!l&&!t;let E="none";_===a.SortDirection.ASCENDING?E="ascending":_===a.SortDirection.DESCENDING&&(E="descending");let s=null;!f&&_&&(s=r.createElement("span",{className:M}," ",_===a.SortDirection.ASCENDING?N("sortingHeader.sortedAscending",{defaultValue:"sorted ascending"}):N("sortingHeader.sortedDescending",{defaultValue:"sorted descending"})));const u=C?r.createElement("button",{type:"button",className:q},d,s):r.createElement(r.Fragment,null,d,s);return f?r.createElement("td",{className:a.cl(e,R({disabled:t,active:!!_,__autoLayout:f}),_&&H({up:_===a.SortDirection.ASCENDING,down:_===a.SortDirection.DESCENDING})),onClick:O,style:D,role:"columnheader","aria-sort":C?E:void 0,...c},u):r.createElement("div",{className:a.cl(e,R({disabled:t,active:!!_,__autoLayout:f}),_&&H({up:_===a.SortDirection.ASCENDING,down:_===a.SortDirection.DESCENDING})),onClick:O,style:D,...c},u)}a.Metadata.set(k,{name:"Sorting Header Cell",props:{sortKey:{type:"string"},sort:{type:"SortedColumn[]"},sortDisabled:{type:"boolean"},onSortChange:{type:"SortChangeHandler"},widthPx:{type:"number"},widthRem:{type:"number"}}});var P=j({defaultClassName:"pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu0",variantClassNames:{pinned:{true:"pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu1",false:"pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu2"},scrollParentIsWindow:{true:"pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu3",false:"pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu4"},__autoLayout:{true:"pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu5",false:"pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu6"}},defaultVariants:{pinned:!1,scrollParentIsWindow:!1,__autoLayout:!1},compoundVariants:[[{pinned:!0,scrollParentIsWindow:!0},"pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu7"]]}),F="pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu8";function T({sort:e,onSortChange:i,children:n,className:t,pinSortingHeader:l=!1,__autoLayout:p=!1,...d}){const[h,y]=r.useState(!1),o=r.useRef(null),f=r.useRef(null),c=r.useRef({height:"",width:"",unpinAtTop:0,unpinAtBottom:0,cellWidths:[]}),_=r.useCallback(()=>o.current&&a.getScrollParent(o.current)||window,[]),N=r.useCallback(s=>{const u=s||_();return u.scrollY||u.scrollTop||0},[]),S=r.useCallback(s=>{if(l&&o.current){const u=s||_(),m=N(u),v=p?o.current.parentElement?.parentElement?.getBoundingClientRect():o.current.parentElement?.getBoundingClientRect();if(v){const w=o.current.getBoundingClientRect();c.current.height=`${w.height}px`,c.current.width=`${w.width}px`,u===window?(c.current.unpinAtBottom=v.bottom+m-w.height*2,c.current.unpinAtTop=w.top+m-w.height):(c.current.unpinAtBottom=v.bottom+m-w.height*2,c.current.unpinAtTop=v.top+m),c.current.cellWidths=[],o.current.childNodes.forEach((V,z)=>{V instanceof HTMLElement&&(c.current.cellWidths[z]=`${V.getBoundingClientRect().width}px`)})}}},[l]),D=r.useCallback(()=>{f.current&&(f.current.style.width=c.current.width,f.current.style.height=c.current.height,f.current.childNodes.forEach((s,u)=>{s instanceof HTMLElement&&(s.style.width=c.current.cellWidths[u]||"")}))},[]);r.useLayoutEffect(()=>{S()}),r.useLayoutEffect(()=>{let s;const u=_();return l?(s=B.lockToAnimationFrames(()=>{S(u);const{unpinAtTop:m,unpinAtBottom:v}=c.current,w=N(u);m&&v&&(w>=m&&w<=v?(y(!0),o.current&&(o.current.style.visibility="hidden")):(y(!1),o.current&&(o.current.style.visibility="visible")))}),u.addEventListener("scroll",s),s()):o.current&&(o.current.style.visibility="visible"),()=>{s&&u.removeEventListener("scroll",s)}},[l,S]),r.useLayoutEffect(()=>{let s;return h&&(s=()=>{S(),D()},window.addEventListener("resize",s),s()),()=>{s&&window.removeEventListener("resize",s)}},[h,S,D]);const[O]=a.selectChildren(n,[{type:k}]),C=a.modChildren(O,()=>[{sort:e,onSortChange:i}]),E=_()===window;if(p){const s=r.createElement("tr",null,r.createElement("td",{className:a.cl(F),colSpan:100}));return r.createElement(r.Fragment,null,r.createElement("tr",{ref:o,className:a.cl(P({pinned:!1,scrollParentIsWindow:E,__autoLayout:p}),t),...d},C),s,h&&r.createElement("tr",{ref:f,className:a.cl(t,P({pinned:!0,scrollParentIsWindow:E,__autoLayout:p})),...d,id:d.id?`pinned-${d.id}`:void 0,"data-testid":d["data-testid"]?`pinned-${d["data-testid"]}`:void 0},C))}return r.createElement(r.Fragment,null,r.createElement("div",{ref:o,className:a.cl(t,P({pinned:!1,scrollParentIsWindow:E,__autoLayout:p})),...d},C),h&&r.createElement("div",{ref:f,className:a.cl(t,P({pinned:!0,scrollParentIsWindow:E,__autoLayout:p})),...d,id:d.id?`pinned-${d.id}`:void 0,"data-testid":d["data-testid"]?`pinned-${d["data-testid"]}`:void 0},C))}a.Metadata.set(T,{name:"Sorting Header",props:{sort:{type:"SortedColumn[]"},onSortChange:{type:"SortChangeHandler"}}}),g.SortingHeader=T,g.SortingHeaderCell=k,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
import { createRuntimeFn as _ } from "../../node_modules/.pnpm/@vanilla-extract_recipes@0.2.5_@vanilla-extract_css@1.17.4/node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.esm.js";
|
|
3
|
-
var e = _({ defaultClassName: "pkg_sps-woodland_core__family_sorting-
|
|
3
|
+
var e = _({ defaultClassName: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu0", variantClassNames: { pinned: { true: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu1", false: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu2" }, scrollParentIsWindow: { true: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu3", false: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu4" }, __autoLayout: { true: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu5", false: "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu6" } }, defaultVariants: { pinned: !1, scrollParentIsWindow: !1, __autoLayout: !1 }, compoundVariants: [[{ pinned: !0, scrollParentIsWindow: !0 }, "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu7"]] }), o = "pkg_sps-woodland_core__family_sorting-header__version_8_56_2__hash_1jpcvsu8";
|
|
4
4
|
export {
|
|
5
5
|
e as sortingHeader,
|
|
6
6
|
o as sortingHeaderSpacer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortingHeaderCell.css.d.ts","sourceRoot":"","sources":["../../../src/sorting-header/sorting-header-cell/SortingHeaderCell.css.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SortingHeaderCell.css.d.ts","sourceRoot":"","sources":["../../../src/sorting-header/sorting-header-cell/SortingHeaderCell.css.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDrB,CAAC;AAEH,eAAO,MAAM,gBAAgB,QAiB3B,CAAC;AAEH,eAAO,MAAM,cAAc,QAA4B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortingHeaderCell.d.ts","sourceRoot":"","sources":["../../../src/sorting-header/sorting-header-cell/SortingHeaderCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"SortingHeaderCell.d.ts","sourceRoot":"","sources":["../../../src/sorting-header/sorting-header-cell/SortingHeaderCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAK1F,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,KAAK,EACL,OAAO,EACP,QAAQ,EACR,YAAoB,EACpB,GAAG,IAAI,EACR,EAAE,cAAc,CACf;IACE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,YAAY,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,EACD,cAAc,CACf,GAAG,KAAK,CAAC,YAAY,CA4GrB"}
|
|
@@ -1,67 +1,75 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Metadata as
|
|
3
|
-
import { headerCaret as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
import { Metadata as w, SortDirection as t, cl as A } from "@sps-woodland/core";
|
|
3
|
+
import { headerCaret as h } from "../caret/caret.ve.js";
|
|
4
|
+
import { useWoodlandLanguage as b } from "@spscommerce/i18n";
|
|
5
|
+
import { visuallyHidden as k, headerCell as y, headerCellButton as M } from "./SortingHeaderCell.ve.js";
|
|
6
|
+
function R({
|
|
7
|
+
className: m,
|
|
8
|
+
sortKey: r,
|
|
9
|
+
sort: d,
|
|
10
|
+
sortDisabled: i,
|
|
10
11
|
onSortChange: l,
|
|
11
|
-
onClick:
|
|
12
|
-
children:
|
|
13
|
-
style:
|
|
14
|
-
widthPx:
|
|
15
|
-
widthRem:
|
|
12
|
+
onClick: N,
|
|
13
|
+
children: E,
|
|
14
|
+
style: p,
|
|
15
|
+
widthPx: u,
|
|
16
|
+
widthRem: v,
|
|
16
17
|
__autoLayout: a = !1,
|
|
17
|
-
...
|
|
18
|
+
...C
|
|
18
19
|
}) {
|
|
19
|
-
const e =
|
|
20
|
-
const
|
|
21
|
-
return
|
|
22
|
-
}, [
|
|
23
|
-
|
|
20
|
+
const e = n.useMemo(() => {
|
|
21
|
+
const o = !!r && !i && Array.isArray(d) && d.find((H) => H.key === r);
|
|
22
|
+
return o ? o.direction : void 0;
|
|
23
|
+
}, [d, r, i]), { t: S } = b(), f = u ? u / 16 : v, g = f ? { ...p, width: `${f}rem` } : p, D = (o) => {
|
|
24
|
+
r && !i && l && l([
|
|
24
25
|
{
|
|
25
|
-
key:
|
|
26
|
+
key: r,
|
|
26
27
|
direction: e === t.ASCENDING ? t.DESCENDING : t.ASCENDING
|
|
27
28
|
}
|
|
28
|
-
]),
|
|
29
|
-
};
|
|
30
|
-
|
|
29
|
+
]), N && N(o);
|
|
30
|
+
}, G = !!r && !!l && !i;
|
|
31
|
+
let c = "none";
|
|
32
|
+
e === t.ASCENDING ? c = "ascending" : e === t.DESCENDING && (c = "descending");
|
|
33
|
+
let s = null;
|
|
34
|
+
!a && e && (s = /* @__PURE__ */ n.createElement("span", { className: k }, " ", e === t.ASCENDING ? S("sortingHeader.sortedAscending", { defaultValue: "sorted ascending" }) : S("sortingHeader.sortedDescending", { defaultValue: "sorted descending" })));
|
|
35
|
+
const I = G ? /* @__PURE__ */ n.createElement("button", { type: "button", className: M }, E, s) : /* @__PURE__ */ n.createElement(n.Fragment, null, E, s);
|
|
36
|
+
return a ? /* @__PURE__ */ n.createElement(
|
|
31
37
|
"td",
|
|
32
38
|
{
|
|
33
|
-
className:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
e &&
|
|
39
|
+
className: A(
|
|
40
|
+
m,
|
|
41
|
+
y({ disabled: i, active: !!e, __autoLayout: a }),
|
|
42
|
+
e && h({
|
|
37
43
|
up: e === t.ASCENDING,
|
|
38
44
|
down: e === t.DESCENDING
|
|
39
45
|
})
|
|
40
46
|
),
|
|
41
47
|
onClick: D,
|
|
42
|
-
style:
|
|
43
|
-
|
|
48
|
+
style: g,
|
|
49
|
+
role: "columnheader",
|
|
50
|
+
"aria-sort": G ? c : void 0,
|
|
51
|
+
...C
|
|
44
52
|
},
|
|
45
|
-
|
|
46
|
-
) : /* @__PURE__ */
|
|
53
|
+
I
|
|
54
|
+
) : /* @__PURE__ */ n.createElement(
|
|
47
55
|
"div",
|
|
48
56
|
{
|
|
49
|
-
className:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
e &&
|
|
57
|
+
className: A(
|
|
58
|
+
m,
|
|
59
|
+
y({ disabled: i, active: !!e, __autoLayout: a }),
|
|
60
|
+
e && h({
|
|
53
61
|
up: e === t.ASCENDING,
|
|
54
62
|
down: e === t.DESCENDING
|
|
55
63
|
})
|
|
56
64
|
),
|
|
57
65
|
onClick: D,
|
|
58
|
-
style:
|
|
59
|
-
...
|
|
66
|
+
style: g,
|
|
67
|
+
...C
|
|
60
68
|
},
|
|
61
|
-
|
|
69
|
+
I
|
|
62
70
|
);
|
|
63
71
|
}
|
|
64
|
-
|
|
72
|
+
w.set(R, {
|
|
65
73
|
name: "Sorting Header Cell",
|
|
66
74
|
props: {
|
|
67
75
|
sortKey: { type: "string" },
|
|
@@ -73,5 +81,5 @@ u.set(A, {
|
|
|
73
81
|
}
|
|
74
82
|
});
|
|
75
83
|
export {
|
|
76
|
-
|
|
84
|
+
R as SortingHeaderCell
|
|
77
85
|
};
|