@sps-woodland/sorting-header 8.45.5 → 8.45.7
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/index.js +2 -2
- package/lib/index.umd.cjs +1 -1
- package/lib/style.css +1 -1
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -54,7 +54,7 @@ var z = (e, o, r) => {
|
|
|
54
54
|
for (var [i, p] of e.compoundVariants)
|
|
55
55
|
z(i, t, e.defaultVariants) && (r += " " + p);
|
|
56
56
|
return r;
|
|
57
|
-
}, H = P({ defaultClassName: "pkg_sps-woodland_sorting-
|
|
57
|
+
}, H = P({ defaultClassName: "pkg_sps-woodland_sorting-header__version_8_45_7__hash_7ljhcs0", variantClassNames: { up: { true: "pkg_sps-woodland_sorting-header__version_8_45_7__hash_7ljhcs1" }, down: { true: "pkg_sps-woodland_sorting-header__version_8_45_7__hash_7ljhcs2" } }, defaultVariants: {}, compoundVariants: [] }), T = P({ defaultClassName: "pkg_sps-woodland_sorting-header__version_8_45_7__hash_1crs4gl0", variantClassNames: { disabled: { true: "pkg_sps-woodland_sorting-header__version_8_45_7__hash_1crs4gl1" }, active: { true: "pkg_sps-woodland_sorting-header__version_8_45_7__hash_1crs4gl2" }, __autoLayout: { true: "pkg_sps-woodland_sorting-header__version_8_45_7__hash_1crs4gl3", false: "pkg_sps-woodland_sorting-header__version_8_45_7__hash_1crs4gl4" } }, defaultVariants: { disabled: !1, active: !1, __autoLayout: !1 }, compoundVariants: [] });
|
|
58
58
|
function R({
|
|
59
59
|
className: e,
|
|
60
60
|
sortKey: o,
|
|
@@ -125,7 +125,7 @@ V.set(R, {
|
|
|
125
125
|
widthRem: { type: "number" }
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
|
-
var I = P({ defaultClassName: "pkg_sps-woodland_sorting-
|
|
128
|
+
var I = P({ defaultClassName: "pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81640", variantClassNames: { pinned: { true: "pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81641", false: "pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81642" }, scrollParentIsWindow: { true: "pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81643", false: "pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81644" }, __autoLayout: { true: "pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81645", false: "pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81646" } }, defaultVariants: { pinned: !1, scrollParentIsWindow: !1, __autoLayout: !1 }, compoundVariants: [[{ pinned: !0, scrollParentIsWindow: !0 }, "pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81647"]] }), F = "pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81648";
|
|
129
129
|
function K({
|
|
130
130
|
sort: e,
|
|
131
131
|
onSortChange: o,
|
package/lib/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(h,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("react"),require("@sps-woodland/core"),require("@spscommerce/utils")):typeof define=="function"&&define.amd?define(["exports","react","@sps-woodland/core","@spscommerce/utils"],b):(h=typeof globalThis<"u"?globalThis:h||self,b(h.SortingHeader={},h.React,h.core,h.utils))})(this,(function(h,b,s,T){"use strict";function K(e){const r=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(r,n,t.get?t:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const o=K(b);function G(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function A(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(d){return Object.getOwnPropertyDescriptor(e,d).enumerable})),n.push.apply(n,t)}return n}function H(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?A(Object(n),!0).forEach(function(t){G(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 B=(e,r,n)=>{for(var t of Object.keys(e)){var d;if(e[t]!==((d=r[t])!==null&&d!==void 0?d:n[t]))return!1}return!0},O=e=>r=>{var n=e.defaultClassName,t=H(H({},e.defaultVariants),r);for(var d in t){var p,l=(p=t[d])!==null&&p!==void 0?p:e.defaultVariants[d];if(l!=null){var _=l;typeof _=="boolean"&&(_=_===!0?"true":"false");var S=e.variantClassNames[d][_];S&&(n+=" "+S)}}for(var[a,m]of e.compoundVariants)B(a,t,e.defaultVariants)&&(n+=" "+m);return n},V=O({defaultClassName:"pkg_sps-woodland_sorting-
|
|
1
|
+
(function(h,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("react"),require("@sps-woodland/core"),require("@spscommerce/utils")):typeof define=="function"&&define.amd?define(["exports","react","@sps-woodland/core","@spscommerce/utils"],b):(h=typeof globalThis<"u"?globalThis:h||self,b(h.SortingHeader={},h.React,h.core,h.utils))})(this,(function(h,b,s,T){"use strict";function K(e){const r=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(r,n,t.get?t:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const o=K(b);function G(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function A(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(d){return Object.getOwnPropertyDescriptor(e,d).enumerable})),n.push.apply(n,t)}return n}function H(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?A(Object(n),!0).forEach(function(t){G(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 B=(e,r,n)=>{for(var t of Object.keys(e)){var d;if(e[t]!==((d=r[t])!==null&&d!==void 0?d:n[t]))return!1}return!0},O=e=>r=>{var n=e.defaultClassName,t=H(H({},e.defaultVariants),r);for(var d in t){var p,l=(p=t[d])!==null&&p!==void 0?p:e.defaultVariants[d];if(l!=null){var _=l;typeof _=="boolean"&&(_=_===!0?"true":"false");var S=e.variantClassNames[d][_];S&&(n+=" "+S)}}for(var[a,m]of e.compoundVariants)B(a,t,e.defaultVariants)&&(n+=" "+m);return n},V=O({defaultClassName:"pkg_sps-woodland_sorting-header__version_8_45_7__hash_7ljhcs0",variantClassNames:{up:{true:"pkg_sps-woodland_sorting-header__version_8_45_7__hash_7ljhcs1"},down:{true:"pkg_sps-woodland_sorting-header__version_8_45_7__hash_7ljhcs2"}},defaultVariants:{},compoundVariants:[]}),j=O({defaultClassName:"pkg_sps-woodland_sorting-header__version_8_45_7__hash_1crs4gl0",variantClassNames:{disabled:{true:"pkg_sps-woodland_sorting-header__version_8_45_7__hash_1crs4gl1"},active:{true:"pkg_sps-woodland_sorting-header__version_8_45_7__hash_1crs4gl2"},__autoLayout:{true:"pkg_sps-woodland_sorting-header__version_8_45_7__hash_1crs4gl3",false:"pkg_sps-woodland_sorting-header__version_8_45_7__hash_1crs4gl4"}},defaultVariants:{disabled:!1,active:!1,__autoLayout:!1},compoundVariants:[]});function P({className:e,sortKey:r,sort:n,sortDisabled:t,onSortChange:d,onClick:p,children:l,style:_,widthPx:S,widthRem:a,__autoLayout:m=!1,...c}){const u=o.useMemo(()=>{const v=!!r&&!t&&Array.isArray(n)&&n.find(E=>E.key===r);return v?v.direction:void 0},[n,r,t]),k=S?S/16:a,w=k?{..._,width:`${k}rem`}:_,N=v=>{r&&!t&&d&&d([{key:r,direction:u===s.SortDirection.ASCENDING?s.SortDirection.DESCENDING:s.SortDirection.ASCENDING}]),p&&p(v)};return m?o.createElement("td",{className:s.cl(e,j({disabled:t,active:!!u,__autoLayout:m}),u&&V({up:u===s.SortDirection.ASCENDING,down:u===s.SortDirection.DESCENDING})),onClick:N,style:w,...c},l):o.createElement("div",{className:s.cl(e,j({disabled:t,active:!!u,__autoLayout:m}),u&&V({up:u===s.SortDirection.ASCENDING,down:u===s.SortDirection.DESCENDING})),onClick:N,style:w,...c},l)}s.Metadata.set(P,{name:"Sorting Header Cell",props:{sortKey:{type:"string"},sort:{type:"SortedColumn[]"},sortDisabled:{type:"boolean"},onSortChange:{type:"SortChangeHandler"},widthPx:{type:"number"},widthRem:{type:"number"}}});var D=O({defaultClassName:"pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81640",variantClassNames:{pinned:{true:"pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81641",false:"pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81642"},scrollParentIsWindow:{true:"pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81643",false:"pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81644"},__autoLayout:{true:"pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81645",false:"pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81646"}},defaultVariants:{pinned:!1,scrollParentIsWindow:!1,__autoLayout:!1},compoundVariants:[[{pinned:!0,scrollParentIsWindow:!0},"pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81647"]]}),x="pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81648";function R({sort:e,onSortChange:r,children:n,className:t,pinSortingHeader:d=!1,__autoLayout:p=!1,...l}){const[_,S]=o.useState(!1),a=o.useRef(null),m=o.useRef(null),c=o.useRef({height:"",width:"",unpinAtTop:0,unpinAtBottom:0,cellWidths:[]}),u=o.useCallback(()=>a.current&&s.getScrollParent(a.current)||window,[]),k=o.useCallback(i=>{const f=i||u();return f.scrollY||f.scrollTop||0},[]),w=o.useCallback(i=>{if(d&&a.current){const f=i||u(),y=k(f),C=p?a.current.parentElement?.parentElement?.getBoundingClientRect():a.current.parentElement?.getBoundingClientRect();if(C){const g=a.current.getBoundingClientRect();c.current.height=`${g.height}px`,c.current.width=`${g.width}px`,f===window?(c.current.unpinAtBottom=C.bottom+y-g.height*2,c.current.unpinAtTop=g.top+y-g.height):(c.current.unpinAtBottom=C.bottom+y-g.height*2,c.current.unpinAtTop=C.top+y),c.current.cellWidths=[],a.current.childNodes.forEach((M,W)=>{M instanceof HTMLElement&&(c.current.cellWidths[W]=`${M.getBoundingClientRect().width}px`)})}}},[d]),N=o.useCallback(()=>{m.current&&(m.current.style.width=c.current.width,m.current.style.height=c.current.height,m.current.childNodes.forEach((i,f)=>{i instanceof HTMLElement&&(i.style.width=c.current.cellWidths[f]||"")}))},[]);o.useLayoutEffect(()=>{w()}),o.useLayoutEffect(()=>{let i;const f=u();return d?(i=T.lockToAnimationFrames(()=>{w(f);const{unpinAtTop:y,unpinAtBottom:C}=c.current,g=k(f);y&&C&&(g>=y&&g<=C?(S(!0),a.current&&(a.current.style.visibility="hidden")):(S(!1),a.current&&(a.current.style.visibility="visible")))}),f.addEventListener("scroll",i),i()):a.current&&(a.current.style.visibility="visible"),()=>{i&&f.removeEventListener("scroll",i)}},[d,w]),o.useLayoutEffect(()=>{let i;return _&&(i=()=>{w(),N()},window.addEventListener("resize",i),i()),()=>{i&&window.removeEventListener("resize",i)}},[_,w,N]);const[v]=s.selectChildren(n,[{type:P}]),E=s.modChildren(v,()=>[{sort:e,onSortChange:r}]),I=u()===window;if(p){const i=o.createElement("tr",null,o.createElement("td",{className:s.cl(x),colSpan:100}));return o.createElement(o.Fragment,null,o.createElement("tr",{ref:a,className:s.cl(D({pinned:!1,scrollParentIsWindow:I,__autoLayout:p}),t),...l},E),i,_&&o.createElement("tr",{ref:m,className:s.cl(t,D({pinned:!0,scrollParentIsWindow:I,__autoLayout:p})),...l,id:l.id?`pinned-${l.id}`:void 0,"data-testid":l["data-testid"]?`pinned-${l["data-testid"]}`:void 0},E))}return o.createElement(o.Fragment,null,o.createElement("div",{ref:a,className:s.cl(t,D({pinned:!1,scrollParentIsWindow:I,__autoLayout:p})),...l},E),_&&o.createElement("div",{ref:m,className:s.cl(t,D({pinned:!0,scrollParentIsWindow:I,__autoLayout:p})),...l,id:l.id?`pinned-${l.id}`:void 0,"data-testid":l["data-testid"]?`pinned-${l["data-testid"]}`:void 0},E))}s.Metadata.set(R,{name:"Sorting Header",props:{sort:{type:"SortedColumn[]"},onSortChange:{type:"SortChangeHandler"}}});const L={"Sorting Header":{components:[R,P],examples:{basic:{label:"Sorting Header",examples:{basic:{react:T.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";
|
package/lib/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.pkg_sps-woodland_sorting-
|
|
1
|
+
.pkg_sps-woodland_sorting-header__version_8_45_7__hash_7ljhcs0: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_sorting-header__version_8_45_7__hash_7ljhcs1:after{border-bottom-color:#1f282c;border-top-color:transparent;top:calc(50% - 9px)}.pkg_sps-woodland_sorting-header__version_8_45_7__hash_7ljhcs2:after{border-top-color:#1f282c;border-bottom-color:transparent;top:calc(50% - 3px)}.pkg_sps-woodland_sorting-header__version_8_45_7__hash_1crs4gl0{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_sorting-header__version_8_45_7__hash_1crs4gl0:hover{background-color:#f3f4f4}.pkg_sps-woodland_sorting-header__version_8_45_7__hash_1crs4gl1{cursor:default}.pkg_sps-woodland_sorting-header__version_8_45_7__hash_1crs4gl1:hover{background-color:#e9e9ea}.pkg_sps-woodland_sorting-header__version_8_45_7__hash_1crs4gl2{color:#1f282c;background-color:#d2d4d4}.pkg_sps-woodland_sorting-header__version_8_45_7__hash_1crs4gl3{text-align:left}.pkg_sps-woodland_sorting-header__version_8_45_7__hash_1crs4gl3:first-child{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.pkg_sps-woodland_sorting-header__version_8_45_7__hash_1crs4gl3:last-child{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81640{padding:0;border-radius:.25rem;vertical-align:bottom;cursor:pointer;background-color:#e9e9ea}.pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81641{border-radius:0;position:fixed;top:0;z-index:999}.pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81641: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_sorting-header__version_8_45_7__hash_sk81645{display:table-row}.pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81646{display:table;table-layout:fixed;width:100%}.pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81647{top:3.75rem}.pkg_sps-woodland_sorting-header__version_8_45_7__hash_sk81648{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.45.
|
|
4
|
+
"version": "8.45.7",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/SPSCommerce/woodland/tree/main/packages/@sps-woodland/sorting-header",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"@spscommerce/utils": "^7.0.0 || ^8.0.0 || ^9.0.0",
|
|
30
30
|
"react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
31
31
|
"react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
32
|
-
"@sps-woodland/core": "8.45.
|
|
33
|
-
"@sps-woodland/tokens": "8.45.
|
|
32
|
+
"@sps-woodland/core": "8.45.7",
|
|
33
|
+
"@sps-woodland/tokens": "8.45.7"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@spscommerce/utils": "9.0.3",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"@vanilla-extract/recipes": "0.2.5",
|
|
40
40
|
"react": "16.14.0",
|
|
41
41
|
"react-dom": "16.14.0",
|
|
42
|
-
"@sps-woodland/core": "8.45.
|
|
43
|
-
"@sps-woodland/tokens": "8.45.
|
|
42
|
+
"@sps-woodland/core": "8.45.7",
|
|
43
|
+
"@sps-woodland/tokens": "8.45.7"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "pnpm run build:js && pnpm run build:types",
|