@sps-woodland/side-nav 8.7.3 → 8.7.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/lib/index.cjs.js +1 -1
- package/lib/index.es.js +13 -10
- package/lib/style.css +1 -1
- package/package.json +5 -5
- /package/{vite.config.js → vite.config.mjs} +0 -0
package/lib/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),r=require("@sps-woodland/core"),u=require("@spscommerce/utils");function _(a){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:()=>a[t]})}}return n.default=a,Object.freeze(n)}const e=_(w);function H(a,n,t){return n in a?Object.defineProperty(a,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[n]=t,a}function C(a,n){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);n&&(i=i.filter(function(d){return Object.getOwnPropertyDescriptor(a,d).enumerable})),t.push.apply(t,i)}return t}function T(a){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?C(Object(t),!0).forEach(function(i){H(a,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):C(Object(t)).forEach(function(i){Object.defineProperty(a,i,Object.getOwnPropertyDescriptor(t,i))})}return a}var F=(a,n,t)=>{for(var i of Object.keys(a)){var d;if(a[i]!==((d=n[i])!==null&&d!==void 0?d:t[i]))return!1}return!0},V=a=>n=>{var t=a.defaultClassName,i=T(T({},a.defaultVariants),n);for(var d in i){var o,c=(o=i[d])!==null&&o!==void 0?o:a.defaultVariants[d];if(c!=null){var s=c;typeof s=="boolean"&&(s=s===!0?"true":"false");var m=a.variantClassNames[d][s];m&&(t+=" "+m)}}for(var[l,S]of a.compoundVariants)F(l,i,a.defaultVariants)&&(t+=" "+S);return t},O="_1j8bvco7",A="_1j8bvco0",G="_1j8bvco8",D="_1j8bvcof",M="_1j8bvcoe",q="_1j8bvco3",U="_1j8bvco4",R="_1j8bvco1",z=V({defaultClassName:"_1j8bvco9",variantClassNames:{selected:{true:"_1j8bvcoa",false:"_1j8bvcob"},inFilter:{true:"_1j8bvcoc",false:"_1j8bvcod"}},defaultVariants:{selected:!1,inFilter:!0},compoundVariants:[]}),j="_1j8bvcog",B="_1j8bvco5",L="_1j8bvco6",K="_1j8bvco2";function y({children:a,className:n,...t}){return e.createElement("div",{className:R,...t},e.createElement("div",{className:K},a))}r.Metadata.set(y,{name:"SideNavHeader",props:{}});const P=w.createContext({filterValue:"",activeItem:""});function v({children:a,className:n,onSelect:t,as:i,keyId:d,...o}){const c=i??"a",[s,m]=r.selectChildren(a,[{type:v}]),[l,S]=e.useState(!0),[g,b]=e.useState(!0),p=e.useContext(P),I=e.useRef(null);return e.useEffect(()=>{var h;b(((h=I.current)==null?void 0:h.innerText.includes(p.filterValue))||!1)},[p]),e.createElement(e.Fragment,null,s.length?e.createElement("ul",{className:G},e.createElement("li",{ref:I,className:M,onClick:()=>S(!l)},e.createElement(c,{className:j,...o},e.createElement("div",null,e.createElement(r.Icon,{className:D,icon:l?"chevron-down":"chevron-up"})),m)),l&&s):e.createElement("li",{ref:I,className:z({selected:p.activeItem===d,inFilter:g})},e.createElement(c,{className:j,onClick:()=>{t(d)},...o},a)))}r.Metadata.set(v,{name:"SideNavItem",props:{keyId:{type:"string",required:!0},as:{type:"string"}}});function f({children:a,className:n,title:t,onSelect:i,...d}){const[o,c]=r.selectChildren(a,[{type:v}]),s=r.modChildren(o,m=>m.type===v?[{onSelect:i?l=>i(l):()=>{}}]:[]);return e.createElement("div",{className:B,...d},t&&e.createElement("div",{className:L},t),e.createElement("ul",{className:O},s),c)}r.Metadata.set(f,{name:"SideNavSection",props:{title:{type:"string"}}});function E({children:a,className:n,activeNavItem:t,filterable:i,filterInputPlaceholder:d,...o}){const[c,s,m]=r.selectChildren(a,[{type:y},{type:f},{type:v}]),l=e.useRef(t),[S,g]=e.useState(t),[b,p]=e.useState(""),I=N=>{g(N)},h=r.modChildren(m,N=>N.type===v?[{onSelect:k=>I(k)}]:[]),x=r.modChildren(s,N=>N.type===f?[{onSelect:k=>I(k)}]:[]);return t!==l.current&&(g(t),l.current=t),e.createElement(P.Provider,{value:{filterValue:b,activeItem:S}},e.createElement("div",{className:r.cl(A),...o},c,i&&e.createElement("div",{className:q},e.createElement("div",{className:U},e.createElement("div",{className:"sps-text-input"},e.createElement("div",{className:"sps-form-control"},e.createElement("i",{className:"sps-text-input__icon sps-icon sps-icon-filter"}),e.createElement("input",{type:"text",className:"sps-text-input__input",placeholder:d,onChange:N=>{p(N.target.value)}}))))),x,e.createElement("ul",{className:O},h)))}r.Metadata.set(E,{name:"SideNav",props:{activeNavItem:{type:"string",required:!0},filterable:{type:"boolean"},filterInputPlaceholder:{type:"string"}}});const W={description:()=>e.createElement("p",null,"Side Navigations are used to provide quick access to a series of related pages or content. It can be used to navigate between different page views, or as an anchor-style menu to scroll to specific content on the same page."),components:[E,y,f,v],examples:{general:{label:"Usage",description:()=>e.createElement(e.Fragment,null,e.createElement("p",null,"Use the Side Navigation if:"),e.createElement("ul",null,e.createElement("li",null,"The navigation benefits from subsections or nested structures"),e.createElement("li",null,"There are too many items for Tabbed Navigation"),e.createElement("li",null,"The navigation items have long names")),e.createElement("p",null,"Avoid using the Side Navigation if:"),e.createElement("ul",null,e.createElement("li",null,"Tabbed Navigation is sufficient"),e.createElement("li",null,"The full width of the page is required to sufficiently display content")))},filter:{label:"Filter",description:"Use Filters when the Side Navigation benefits from filtering, usually when it contains a long list of navigation items.",examples:{filter:{react:u.code`
|
|
2
2
|
import { SideNav, SideNavHeader, SideNavItem } from "@sps-woodland/side-nav";
|
|
3
3
|
import { Icon } from "@sps-woodland/core";
|
|
4
4
|
|
package/lib/index.es.js
CHANGED
|
@@ -45,7 +45,10 @@ var A = (a, n, t) => {
|
|
|
45
45
|
if (l != null) {
|
|
46
46
|
var r = l;
|
|
47
47
|
typeof r == "boolean" && (r = r === !0 ? "true" : "false");
|
|
48
|
-
var m =
|
|
48
|
+
var m = (
|
|
49
|
+
// @ts-expect-error
|
|
50
|
+
a.variantClassNames[d][r]
|
|
51
|
+
);
|
|
49
52
|
m && (t += " " + m);
|
|
50
53
|
}
|
|
51
54
|
}
|
|
@@ -64,7 +67,7 @@ h.set(C, {
|
|
|
64
67
|
name: "SideNavHeader",
|
|
65
68
|
props: {}
|
|
66
69
|
});
|
|
67
|
-
const
|
|
70
|
+
const P = H({
|
|
68
71
|
filterValue: "",
|
|
69
72
|
activeItem: ""
|
|
70
73
|
});
|
|
@@ -76,7 +79,7 @@ function c({
|
|
|
76
79
|
keyId: d,
|
|
77
80
|
...s
|
|
78
81
|
}) {
|
|
79
|
-
const l = i
|
|
82
|
+
const l = i ?? "a", [r, m] = E(a, [{ type: c }]), [o, I] = e.useState(!0), [u, y] = e.useState(!0), S = e.useContext(P), N = e.useRef(null);
|
|
80
83
|
return e.useEffect(() => {
|
|
81
84
|
var f;
|
|
82
85
|
y(((f = N.current) == null ? void 0 : f.innerText.includes(S.filterValue)) || !1);
|
|
@@ -144,7 +147,7 @@ h.set(g, {
|
|
|
144
147
|
title: { type: "string" }
|
|
145
148
|
}
|
|
146
149
|
});
|
|
147
|
-
function
|
|
150
|
+
function O({
|
|
148
151
|
children: a,
|
|
149
152
|
className: n,
|
|
150
153
|
activeNavItem: t,
|
|
@@ -166,7 +169,7 @@ function P({
|
|
|
166
169
|
{
|
|
167
170
|
onSelect: (k) => N(k)
|
|
168
171
|
}
|
|
169
|
-
] : []),
|
|
172
|
+
] : []), _ = b(
|
|
170
173
|
r,
|
|
171
174
|
(v) => v.type === g ? [
|
|
172
175
|
{
|
|
@@ -174,7 +177,7 @@ function P({
|
|
|
174
177
|
}
|
|
175
178
|
] : []
|
|
176
179
|
);
|
|
177
|
-
return t !== o.current && (u(t), o.current = t), /* @__PURE__ */ e.createElement(
|
|
180
|
+
return t !== o.current && (u(t), o.current = t), /* @__PURE__ */ e.createElement(P.Provider, { value: { filterValue: y, activeItem: I } }, /* @__PURE__ */ e.createElement("div", { className: V(D), ...s }, l, i && /* @__PURE__ */ e.createElement("div", { className: L }, /* @__PURE__ */ e.createElement("div", { className: z }, /* @__PURE__ */ e.createElement("div", { className: "sps-text-input" }, /* @__PURE__ */ e.createElement("div", { className: "sps-form-control" }, /* @__PURE__ */ e.createElement("i", { className: "sps-text-input__icon sps-icon sps-icon-filter" }), /* @__PURE__ */ e.createElement(
|
|
178
181
|
"input",
|
|
179
182
|
{
|
|
180
183
|
type: "text",
|
|
@@ -184,9 +187,9 @@ function P({
|
|
|
184
187
|
S(v.target.value);
|
|
185
188
|
}
|
|
186
189
|
}
|
|
187
|
-
))))),
|
|
190
|
+
))))), _, /* @__PURE__ */ e.createElement("ul", { className: x }, f)));
|
|
188
191
|
}
|
|
189
|
-
h.set(
|
|
192
|
+
h.set(O, {
|
|
190
193
|
name: "SideNav",
|
|
191
194
|
props: {
|
|
192
195
|
activeNavItem: { type: "string", required: !0 },
|
|
@@ -197,7 +200,7 @@ h.set(P, {
|
|
|
197
200
|
const X = {
|
|
198
201
|
description: () => /* @__PURE__ */ e.createElement("p", null, "Side Navigations are used to provide quick access to a series of related pages or content. It can be used to navigate between different page views, or as an anchor-style menu to scroll to specific content on the same page."),
|
|
199
202
|
components: [
|
|
200
|
-
|
|
203
|
+
O,
|
|
201
204
|
C,
|
|
202
205
|
g,
|
|
203
206
|
c
|
|
@@ -498,7 +501,7 @@ const X = {
|
|
|
498
501
|
};
|
|
499
502
|
export {
|
|
500
503
|
ee as MANIFEST,
|
|
501
|
-
|
|
504
|
+
O as SideNav,
|
|
502
505
|
C as SideNavHeader,
|
|
503
506
|
c as SideNavItem,
|
|
504
507
|
g as SideNavSection
|
package/lib/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._1j8bvco0{word-wrap:break-word;background-clip:border-box;background-color
|
|
1
|
+
._1j8bvco0{word-wrap:break-word;background-clip:border-box;background-color:#fff;border-width:.0625rem;border-style:solid;border-color:#d2d4d4;border-radius:.125rem;display:flex;flex-direction:column;min-width:0;position:relative}._1j8bvco1{background-color:#fff;border-bottom:.0625rem solid oklch(86.84% .002 197.12);margin-bottom:0;padding:.5rem}._1j8bvco2{align-items:center;display:flex;float:left;font-size:.75rem;font-weight:600;line-height:1.5rem;margin-bottom:0;padding-left:.5rem;text-transform:uppercase}._1j8bvco2>i{font-size:.875rem;margin-right:.25rem}._1j8bvco3{border-bottom:.0625rem solid oklch(86.84% .002 197.12);padding:.5rem 0}._1j8bvco4{margin:6px 21px}._1j8bvco5{margin:0;padding:.5rem 0}._1j8bvco5+._1j8bvco5{border-top:.0625rem solid oklch(86.84% .002 197.12)}._1j8bvco6{color:#717779;font-size:1rem;font-weight:400;margin:.25rem 0 .5rem 1rem}._1j8bvco7{list-style:none;margin-top:0;margin-bottom:0;padding:0;font-size:.875rem;line-height:1.25rem}._1j8bvco8{padding-left:0}._1j8bvco9{display:block;width:100%}._1j8bvcoa{background-color:#e6f2f8;box-shadow:inset .125rem 0 #027db8;color:#1f282c;font-weight:700}._1j8bvcod{display:none}._1j8bvcoe{display:block;width:100%}._1j8bvcof{font-size:.625rem;vertical-align:middle;display:inline-block;line-height:1.25rem;margin-top:0;margin-right:.25rem;margin-bottom:0;margin-left:-.875rem}._1j8bvcog{color:#1f282c;cursor:pointer;display:flex;font-size:.875rem;line-height:1.25rem;padding:.5rem 1rem .5rem 1.25rem;text-decoration:none}._1j8bvcog:hover{background-color:#f3f4f4}._1j8bvco8>._1j8bvco9>._1j8bvcog{padding-left:2.125rem}._1j8bvco8>._1j8bvco8>._1j8bvco9>._1j8bvcog{padding-left:3rem}._1j8bvco8>._1j8bvco8>._1j8bvco8>._1j8bvco9>._1j8bvcog{padding-left:3.875rem}._1j8bvco8>._1j8bvco8>._1j8bvco8>._1j8bvco8>._1j8bvco9>._1j8bvcog{padding-left:undefined}._1j8bvco8>._1j8bvco8>._1j8bvcoe>._1j8bvcog{padding-left:2.125rem}._1j8bvco8>._1j8bvco8>._1j8bvco8>._1j8bvcoe>._1j8bvcog{padding-left:3rem}._1j8bvco8>._1j8bvco8>._1j8bvco8>._1j8bvco8>._1j8bvcoe>._1j8bvcog{padding-left:3.875rem}._1j8bvco8>._1j8bvco8>._1j8bvco8>._1j8bvco8>._1j8bvco8>._1j8bvcoe>._1j8bvcog{padding-left:undefined}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sps-woodland/side-nav",
|
|
3
3
|
"description": "SPS Woodland Design System side navigation components",
|
|
4
|
-
"version": "8.7.
|
|
4
|
+
"version": "8.7.5",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/SPSCommerce/woodland/tree/main/packages/@sps-woodland/side-nav",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"@spscommerce/utils": "^6.12.1",
|
|
30
30
|
"react": "^16.9.0",
|
|
31
31
|
"react-dom": "^16.9.0",
|
|
32
|
-
"@sps-woodland/core": "8.7.
|
|
33
|
-
"@sps-woodland/tokens": "8.7.
|
|
32
|
+
"@sps-woodland/core": "8.7.5",
|
|
33
|
+
"@sps-woodland/tokens": "8.7.5"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@vanilla-extract/css": "^1.9.3",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"@spscommerce/utils": "^6.12.1",
|
|
39
39
|
"react": "^16.9.0",
|
|
40
40
|
"react-dom": "^16.9.0",
|
|
41
|
-
"@sps-woodland/core": "8.7.
|
|
42
|
-
"@sps-woodland/tokens": "8.7.
|
|
41
|
+
"@sps-woodland/core": "8.7.5",
|
|
42
|
+
"@sps-woodland/tokens": "8.7.5"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "pnpm run build:js && pnpm run build:types",
|
|
File without changes
|