@spscommerce/ds-react 7.13.0 → 7.14.1

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.cjs.js CHANGED
@@ -4015,7 +4015,7 @@ var r=n.defineLocale("zh-tw",{months:"\u4E00\u6708_\u4E8C\u6708_\u4E09\u6708_\u5
4015
4015
  ></SpsTextInput>
4016
4016
  </>;
4017
4017
  }
4018
- `}}}},$N={clearSelected:{type:"() => void",required:!0},itemsSelected:{type:"string | number",required:!0}};function zi(e){const{itemsSelected:t,clearSelected:n,children:r,className:a,"data-testid":o,unsafelyReplaceClassName:l,...c}=e,{t:p}=s.useContext(Pe),u=()=>{typeof n=="function"&&n()},m=H(l||"sps-list-action-bar-container","z-stratum-actionbar",a);return t?s.createElement("div",{className:m,...c,"data-testid":o},s.createElement("div",{className:"sps-list-action-bar"},s.createElement("div",{className:"sps-list-action-bar__details"},s.createElement("span",{className:"sps-tag sps-tag--info","data-testid":`${o}__badge`},t),p("design-system:listActionBar.itemsSelected")),s.createElement("div",{className:"sps-list-action-bar__actions"},s.createElement(Ct.Provider,{value:{fixed:!0}},r)),s.createElement("div",{className:"sps-list-action-bar__clear"},s.createElement(We,{kind:V.ButtonKind.LINK,icon:V.SpsIcon.X,onClick:u,"data-testid":`${o}__clear-button`},p("design-system:listActionBar.clearSelected"))))):s.createElement(s.Fragment,null)}Object.assign(zi,{props:$N,displayName:"SpsListActionBar"});const va=s.createContext({resizeable:!1,resizeState:{},setResizeState:()=>{},setSingleResizeState:()=>{},sort:[],setSort:()=>{}}),VN=({children:e,resizeable:t=!1,resizeState:n,onResizeStateChange:r,sort:a,onSortChange:o})=>{const[l,c]=s.useState(n||{}),[p,u]=s.useState(a||[]),m=s.useRef(o);m.current=o;const f=s.useRef(r);f.current=r;const h=s.useCallback(T=>{var C;u(T),(C=m.current)==null||C.call(m,T)},[]),g=s.useCallback(T=>{var C;c(T),(C=f.current)==null||C.call(f,T)},[]),E=s.useCallback((T,C)=>{c(k=>{var b;const I={...k,[T]:C};return(b=f.current)==null||b.call(f,I),I})},[]),w=s.useMemo(()=>({resizeable:t,resizeState:l,setResizeState:g,setSingleResizeState:E,sort:p,setSort:h}),[t,l,g,E,p,h]);return s.createElement(va.Provider,{value:w},e)},KN=e=>{const t=/(auto|scroll)/,n=(c,p)=>c.parentNode===null?p:n(c.parentNode,p.concat([c])),r=(c,p)=>getComputedStyle(c,null).getPropertyValue(p),a=c=>r(c,"overflow")+r(c,"overflow-y"),o=c=>t.test(a(c));return(c=>{if(!(c instanceof HTMLElement||c instanceof SVGElement))return;const p=n(c.parentNode,[]);for(let u=0;u<p.length;u+=1)if(o(p[u]))return p[u];return null})(e)},Pm=(e,t)=>{s.useLayoutEffect(()=>{if(e&&t.current){let n=0,r=!0,a=t.current.previousElementSibling;for(;a!==null;){if(!a.classList.contains("sps-table__cell--pinned")){r=!1;break}a=a.previousElementSibling}if(r){for(a=t.current.previousElementSibling;a!==null;)n+=a.clientWidth,a=a.previousElementSibling;t.current.style.left=`${n}px`}else{let o=t.current.nextElementSibling;for(;o!==null;)n+=o.clientWidth,o=o.nextElementSibling;t.current.style.right=`${n}px`}}})},HN=e=>{s.useLayoutEffect(()=>{const t=()=>{if(!e.current)return;const n=e.current.querySelectorAll("table > thead > tr:first-child > .sps-table__cell--pinned"),r=e.current.offsetWidth-e.current.clientWidth,a=e.current.offsetHeight-e.current.clientHeight;if(n.length>0){const o=[],l=[];n.forEach(u=>{let m=!0,f=u.previousElementSibling;for(;f!==null;){if(!f.classList.contains("sps-table__cell--pinned")){m=!1;break}f=f.previousElementSibling}m?o.push(u):l.push(u)});const c=o.reduce((u,m)=>u+m.clientWidth,0),p=l.reduce((u,m)=>u+m.clientWidth,0);e.current.style.backgroundPosition=`${c}px 0,
4018
+ `}}}},$N={clearSelected:{type:"() => void",required:!0},itemsSelected:{type:"string | number",required:!0}};function zi(e){const{itemsSelected:t,clearSelected:n,children:r,className:a,"data-testid":o,unsafelyReplaceClassName:l,...c}=e,{t:p}=s.useContext(Pe),u=()=>{typeof n=="function"&&n()},m=H(l||"sps-list-action-bar-container","z-stratum-actionbar",a);return t?s.createElement("div",{className:m,...c,"data-testid":o},s.createElement("div",{className:"sps-list-action-bar"},s.createElement("div",{className:"sps-list-action-bar__details"},s.createElement("span",{className:"sps-tag sps-tag--info","data-testid":`${o}__badge`},t),p("design-system:listActionBar.itemsSelected")),s.createElement("div",{className:"sps-list-action-bar__actions"},s.createElement(Ct.Provider,{value:{fixed:!0}},r)),s.createElement("div",{className:"sps-list-action-bar__clear"},s.createElement(We,{kind:V.ButtonKind.LINK,icon:V.SpsIcon.X,onClick:u,"data-testid":`${o}__clear-button`},p("design-system:listActionBar.clearSelected"))))):s.createElement(s.Fragment,null)}Object.assign(zi,{props:$N,displayName:"SpsListActionBar"});const va=s.createContext({resizeable:!1,resizeState:{},setResizeState:()=>{},setSingleResizeState:()=>{},sort:[],setSort:()=>{}}),VN=({children:e,resizeable:t=!1,resizeState:n,onResizeStateChange:r,sort:a,onSortChange:o})=>{const[l,c]=s.useState(n||{}),[p,u]=s.useState(a||[]),m=s.useRef(o);m.current=o;const f=s.useRef(r);f.current=r,s.useEffect(()=>{a&&a!==p&&u(a)},[a]);const h=s.useCallback(T=>{var C;u(T),(C=m.current)==null||C.call(m,T)},[]),g=s.useCallback(T=>{var C;c(T),(C=f.current)==null||C.call(f,T)},[]),E=s.useCallback((T,C)=>{c(k=>{var b;const I={...k,[T]:C};return(b=f.current)==null||b.call(f,I),I})},[]),w=s.useMemo(()=>({resizeable:t,resizeState:l,setResizeState:g,setSingleResizeState:E,sort:p,setSort:h}),[t,l,g,E,p,h]);return s.createElement(va.Provider,{value:w},e)},KN=e=>{const t=/(auto|scroll)/,n=(c,p)=>c.parentNode===null?p:n(c.parentNode,p.concat([c])),r=(c,p)=>getComputedStyle(c,null).getPropertyValue(p),a=c=>r(c,"overflow")+r(c,"overflow-y"),o=c=>t.test(a(c));return(c=>{if(!(c instanceof HTMLElement||c instanceof SVGElement))return;const p=n(c.parentNode,[]);for(let u=0;u<p.length;u+=1)if(o(p[u]))return p[u];return null})(e)},Pm=(e,t)=>{s.useLayoutEffect(()=>{if(e&&t.current){let n=0,r=!0,a=t.current.previousElementSibling;for(;a!==null;){if(!a.classList.contains("sps-table__cell--pinned")){r=!1;break}a=a.previousElementSibling}if(r){for(a=t.current.previousElementSibling;a!==null;)n+=a.clientWidth,a=a.previousElementSibling;t.current.style.left=`${n}px`}else{let o=t.current.nextElementSibling;for(;o!==null;)n+=o.clientWidth,o=o.nextElementSibling;t.current.style.right=`${n}px`}}})},HN=e=>{s.useLayoutEffect(()=>{const t=()=>{if(!e.current)return;const n=e.current.querySelectorAll("table > thead > tr:first-child > .sps-table__cell--pinned"),r=e.current.offsetWidth-e.current.clientWidth,a=e.current.offsetHeight-e.current.clientHeight;if(n.length>0){const o=[],l=[];n.forEach(u=>{let m=!0,f=u.previousElementSibling;for(;f!==null;){if(!f.classList.contains("sps-table__cell--pinned")){m=!1;break}f=f.previousElementSibling}m?o.push(u):l.push(u)});const c=o.reduce((u,m)=>u+m.clientWidth,0),p=l.reduce((u,m)=>u+m.clientWidth,0);e.current.style.backgroundPosition=`${c}px 0,
4019
4019
  calc(100% - ${p}px) 0,
4020
4020
  ${c}px ${-a}px,
4021
4021
  calc(100% - ${p+r}px) ${-a}px`}else e.current.style.backgroundPosition=`0 0, 100% 0, 0 ${-a}px,
package/lib/index.es.js CHANGED
@@ -19900,7 +19900,9 @@ const wa = s.createContext({
19900
19900
  const [l, c] = s.useState(n || {}), [p, u] = s.useState(a || []), m = s.useRef(o);
19901
19901
  m.current = o;
19902
19902
  const f = s.useRef(r);
19903
- f.current = r;
19903
+ f.current = r, s.useEffect(() => {
19904
+ a && a !== p && u(a);
19905
+ }, [a]);
19904
19906
  const h = s.useCallback((T) => {
19905
19907
  var C;
19906
19908
  u(T), (C = m.current) == null || C.call(m, T);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spscommerce/ds-react",
3
3
  "description": "SPS Design System React components",
4
- "version": "7.13.0",
4
+ "version": "7.14.1",
5
5
  "author": "SPS Commerce",
6
6
  "license": "UNLICENSED",
7
7
  "repository": "https://github.com/spscommerce/woodland/tree/main/packages/@spscommerce/ds-react",
@@ -41,11 +41,11 @@
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@react-stately/collections": "^3.6.0",
44
- "@sps-woodland/illustrations": "7.13.0",
45
- "@sps-woodland/tabs": "7.13.0",
46
- "@spscommerce/ds-colors": "7.13.0",
47
- "@spscommerce/ds-shared": "7.13.0",
48
- "@spscommerce/positioning": "7.13.0",
44
+ "@sps-woodland/illustrations": "7.14.1",
45
+ "@sps-woodland/tabs": "7.14.1",
46
+ "@spscommerce/ds-colors": "7.14.1",
47
+ "@spscommerce/ds-shared": "7.14.1",
48
+ "@spscommerce/positioning": "7.14.1",
49
49
  "@spscommerce/utils": "^6.11.3",
50
50
  "moment": "^2.25.3",
51
51
  "moment-timezone": "^0.5.28",
@@ -59,11 +59,11 @@
59
59
  "@react-types/select": "^3.6.1",
60
60
  "@react-types/shared": "^3.8.0",
61
61
  "@react-types/tabs": "^3.0.1",
62
- "@sps-woodland/illustrations": "7.13.0",
63
- "@sps-woodland/tabs": "7.13.0",
64
- "@spscommerce/ds-colors": "7.13.0",
65
- "@spscommerce/ds-shared": "7.13.0",
66
- "@spscommerce/positioning": "7.13.0",
62
+ "@sps-woodland/illustrations": "7.14.1",
63
+ "@sps-woodland/tabs": "7.14.1",
64
+ "@spscommerce/ds-colors": "7.14.1",
65
+ "@spscommerce/ds-shared": "7.14.1",
66
+ "@spscommerce/positioning": "7.14.1",
67
67
  "@spscommerce/utils": "^6.12.1",
68
68
  "@testing-library/dom": "^8.17.1",
69
69
  "@testing-library/react": "^10.0.0",
@@ -77,7 +77,7 @@
77
77
  "raf-stub": "^2.0.2",
78
78
  "react": "^16.9.0",
79
79
  "react-dom": "^16.9.0",
80
- "test": "7.13.0"
80
+ "test": "7.14.1"
81
81
  },
82
82
  "scripts": {
83
83
  "build": "pnpm run build:js && pnpm run build:types",