@sps-woodland/key-value-set 8.51.3 → 8.52.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/README.md +1 -25
- package/lib/index.d.ts +2 -1
- package/lib/index.js +107 -17
- package/lib/index.umd.cjs +9 -9
- package/lib/key-value-set/KeyValueSet.css.d.ts +6 -0
- package/lib/key-value-set/KeyValueSet.d.ts +5 -0
- package/lib/key-value-set-item/KeyValueSetItem.css.d.ts +13 -0
- package/lib/key-value-set-item/KeyValueSetItem.d.ts +6 -0
- package/lib/style.css +1 -1
- package/package.json +8 -6
- package/vite.config.mjs +13 -6
package/README.md
CHANGED
|
@@ -1,27 +1,3 @@
|
|
|
1
1
|
## [@sps-woodland/key-value-set](https://github.com/SPSCommerce/woodland/tree/master/packages/@sps-woodland/key-value-set#readme)
|
|
2
2
|
|
|
3
|
-
SPS Woodland Design System key value set component
|
|
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 { KeyValueSet, KeyValueSetItem } from "@sps-woodland/core/key-value-set";
|
|
13
|
-
// or, if you only need the item:
|
|
14
|
-
import { KeyValueSetItem } from "@sps-woodland/core/key-value-set-item";
|
|
15
|
-
|
|
16
|
-
import "@sps-woodland/core/key-value-set/style.css";
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
`KeyValueSet` is barrel-only (the family name and the parent component share a
|
|
20
|
-
name). `KeyValueSetItem` additionally has its own flat subpath.
|
|
21
|
-
|
|
22
|
-
### Legacy imports (still supported)
|
|
23
|
-
|
|
24
|
-
```ts
|
|
25
|
-
import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
|
|
26
|
-
import "@sps-woodland/key-value-set/style.css";
|
|
27
|
-
```
|
|
3
|
+
SPS Woodland Design System key value set component
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,10 +1,98 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export * from "@sps-woodland/core/key-value-set";
|
|
3
|
-
import { code as t } from "@spscommerce/utils";
|
|
1
|
+
import { Metadata as p, cl as y, useChildTestIdAttrBuilder as v } from "@sps-woodland/core";
|
|
4
2
|
import * as e from "react";
|
|
5
|
-
|
|
3
|
+
import { code as s } from "@spscommerce/utils";
|
|
4
|
+
function _(t, n, a) {
|
|
5
|
+
return n in t ? Object.defineProperty(t, n, {
|
|
6
|
+
value: a,
|
|
7
|
+
enumerable: !0,
|
|
8
|
+
configurable: !0,
|
|
9
|
+
writable: !0
|
|
10
|
+
}) : t[n] = a, t;
|
|
11
|
+
}
|
|
12
|
+
function c(t, n) {
|
|
13
|
+
var a = Object.keys(t);
|
|
14
|
+
if (Object.getOwnPropertySymbols) {
|
|
15
|
+
var l = Object.getOwnPropertySymbols(t);
|
|
16
|
+
n && (l = l.filter(function(r) {
|
|
17
|
+
return Object.getOwnPropertyDescriptor(t, r).enumerable;
|
|
18
|
+
})), a.push.apply(a, l);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
}
|
|
22
|
+
function d(t) {
|
|
23
|
+
for (var n = 1; n < arguments.length; n++) {
|
|
24
|
+
var a = arguments[n] != null ? arguments[n] : {};
|
|
25
|
+
n % 2 ? c(Object(a), !0).forEach(function(l) {
|
|
26
|
+
_(t, l, a[l]);
|
|
27
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(a)) : c(Object(a)).forEach(function(l) {
|
|
28
|
+
Object.defineProperty(t, l, Object.getOwnPropertyDescriptor(a, l));
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return t;
|
|
32
|
+
}
|
|
33
|
+
var E = (t, n, a) => {
|
|
34
|
+
for (var l of Object.keys(t)) {
|
|
35
|
+
var r;
|
|
36
|
+
if (t[l] !== ((r = n[l]) !== null && r !== void 0 ? r : a[l]))
|
|
37
|
+
return !1;
|
|
38
|
+
}
|
|
39
|
+
return !0;
|
|
40
|
+
}, V = (t) => (n) => {
|
|
41
|
+
var a = t.defaultClassName, l = d(d({}, t.defaultVariants), n);
|
|
42
|
+
for (var r in l) {
|
|
43
|
+
var o, u = (o = l[r]) !== null && o !== void 0 ? o : t.defaultVariants[r];
|
|
44
|
+
if (u != null) {
|
|
45
|
+
var i = u;
|
|
46
|
+
typeof i == "boolean" && (i = i === !0 ? "true" : "false");
|
|
47
|
+
var m = (
|
|
48
|
+
// @ts-expect-error
|
|
49
|
+
t.variantClassNames[r][i]
|
|
50
|
+
);
|
|
51
|
+
m && (a += " " + m);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
for (var [f, K] of t.compoundVariants)
|
|
55
|
+
E(f, l, t.defaultVariants) && (a += " " + K);
|
|
56
|
+
return a;
|
|
57
|
+
}, b = V({ defaultClassName: "pkg_sps-woodland_key-value-set__version_8_52_1__hash_1i7enhj1", variantClassNames: { inline: { true: "pkg_sps-woodland_key-value-set__version_8_52_1__hash_1i7enhj2 pkg_sps-woodland_key-value-set__version_8_52_1__hash_1i7enhj0" } }, defaultVariants: {}, compoundVariants: [] });
|
|
58
|
+
function S({
|
|
59
|
+
children: t,
|
|
60
|
+
className: n,
|
|
61
|
+
inline: a,
|
|
62
|
+
...l
|
|
63
|
+
}) {
|
|
64
|
+
return /* @__PURE__ */ e.createElement("div", { className: y(
|
|
65
|
+
b({ inline: a }),
|
|
66
|
+
n
|
|
67
|
+
), ...l }, t);
|
|
68
|
+
}
|
|
69
|
+
p.set(S, {
|
|
70
|
+
name: "KeyValueSet",
|
|
71
|
+
props: {
|
|
72
|
+
inline: { type: "boolean", default: "false" }
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
var g = "pkg_sps-woodland_key-value-set__version_8_52_1__hash_18tyj090", I = V({ defaultClassName: "pkg_sps-woodland_key-value-set__version_8_52_1__hash_18tyj091", variantClassNames: { wrap: { normal: "pkg_sps-woodland_key-value-set__version_8_52_1__hash_18tyj092", truncate: "pkg_sps-woodland_key-value-set__version_8_52_1__hash_18tyj093" } }, defaultVariants: {}, compoundVariants: [] });
|
|
76
|
+
function h({
|
|
77
|
+
children: t,
|
|
78
|
+
className: n,
|
|
79
|
+
itemKey: a,
|
|
80
|
+
wrap: l,
|
|
81
|
+
...r
|
|
82
|
+
}) {
|
|
83
|
+
const o = v(r), u = l === "truncate" && typeof t == "string" ? t : void 0;
|
|
84
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("span", { className: g, ...o("key") }, a), /* @__PURE__ */ e.createElement("span", { className: y(I({ wrap: l }), n), title: u, ...r }, t));
|
|
85
|
+
}
|
|
86
|
+
p.set(h, {
|
|
87
|
+
name: "KeyValueSetItem",
|
|
88
|
+
props: {
|
|
89
|
+
itemKey: { type: "React.ReactNode | (() => React.ReactNode)", required: !0 },
|
|
90
|
+
wrap: { type: "'normal' | 'truncate'" }
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
const w = {
|
|
6
94
|
description: () => /* @__PURE__ */ e.createElement("p", null, "Key Value Sets consist of a title and value, or values, paired together visually. They are ideal for displaying details (a value or values) that require additional context (title)."),
|
|
7
|
-
components: [
|
|
95
|
+
components: [S, h],
|
|
8
96
|
examples: {
|
|
9
97
|
vertical: {
|
|
10
98
|
label: "Vertical Key Value Sets",
|
|
@@ -12,7 +100,7 @@ const r = {
|
|
|
12
100
|
examples: {
|
|
13
101
|
standard: {
|
|
14
102
|
description: () => /* @__PURE__ */ e.createElement("h4", null, "Standard"),
|
|
15
|
-
react:
|
|
103
|
+
react: s`
|
|
16
104
|
import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
|
|
17
105
|
|
|
18
106
|
function Component() {
|
|
@@ -28,7 +116,7 @@ const r = {
|
|
|
28
116
|
},
|
|
29
117
|
multipleValues: {
|
|
30
118
|
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h4", null, "Multiple Values"), /* @__PURE__ */ e.createElement("p", null, /* @__PURE__ */ e.createElement("b", null, "Note:"), " There is no limit to the number of values that can be listed, but extensive lists should be avoided.")),
|
|
31
|
-
react:
|
|
119
|
+
react: s`
|
|
32
120
|
import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
|
|
33
121
|
|
|
34
122
|
function Component() {
|
|
@@ -46,7 +134,7 @@ const r = {
|
|
|
46
134
|
},
|
|
47
135
|
secondaryValues: {
|
|
48
136
|
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h5", null, "Secondary Values"), /* @__PURE__ */ e.createElement("p", null, /* @__PURE__ */ e.createElement("b", null, "Note:"), " When using a secondary value (styled in lighter grey text) the number of values listed should be limited to two (2).")),
|
|
49
|
-
react:
|
|
137
|
+
react: s`
|
|
50
138
|
import { Box } from "@sps-woodland/core";
|
|
51
139
|
import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
|
|
52
140
|
|
|
@@ -63,8 +151,8 @@ const r = {
|
|
|
63
151
|
`
|
|
64
152
|
},
|
|
65
153
|
tags: {
|
|
66
|
-
description: ({ NavigateTo:
|
|
67
|
-
react:
|
|
154
|
+
description: ({ NavigateTo: t }) => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h4", null, "Tags"), /* @__PURE__ */ e.createElement("p", null, /* @__PURE__ */ e.createElement("b", null, "Note:"), " Tags can appear inline or on individual lines as the length of content requires. Reference the ", /* @__PURE__ */ e.createElement(t, { to: "tags" }, "Tag"), " component for spacing rules.")),
|
|
155
|
+
react: s`
|
|
68
156
|
import { SpsTag } from "@spscommerce/ds-react";
|
|
69
157
|
import { Box } from "@sps-woodland/core";
|
|
70
158
|
import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
|
|
@@ -85,7 +173,7 @@ const r = {
|
|
|
85
173
|
},
|
|
86
174
|
hyperlinksAndIcons: {
|
|
87
175
|
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h4", null, "Hyperlinks & Icons"), /* @__PURE__ */ e.createElement("p", null, /* @__PURE__ */ e.createElement("b", null, "Note:"), " Icons and Hyperlinks can be used independently of one another.")),
|
|
88
|
-
react:
|
|
176
|
+
react: s`
|
|
89
177
|
import { Box } from "@sps-woodland/core";
|
|
90
178
|
import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
|
|
91
179
|
|
|
@@ -109,7 +197,7 @@ const r = {
|
|
|
109
197
|
examples: {
|
|
110
198
|
standard: {
|
|
111
199
|
description: () => /* @__PURE__ */ e.createElement("h4", null, "Standard"),
|
|
112
|
-
react:
|
|
200
|
+
react: s`
|
|
113
201
|
import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
|
|
114
202
|
|
|
115
203
|
function Component() {
|
|
@@ -125,7 +213,7 @@ const r = {
|
|
|
125
213
|
},
|
|
126
214
|
stacked: {
|
|
127
215
|
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h4", null, "Stacked"), /* @__PURE__ */ e.createElement("p", null, /* @__PURE__ */ e.createElement("b", null, "Note:"), " There is no limit to the number of stacked listings, but more than three in a single container should be avoided."), /* @__PURE__ */ e.createElement("p", null, /* @__PURE__ */ e.createElement("b", null, "Note:"), " Titles are right-aligned in the horizontal Key Value Sets to optimize scanability of the values.")),
|
|
128
|
-
react:
|
|
216
|
+
react: s`
|
|
129
217
|
import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
|
|
130
218
|
|
|
131
219
|
function Component() {
|
|
@@ -154,7 +242,7 @@ const r = {
|
|
|
154
242
|
},
|
|
155
243
|
withLinks: {
|
|
156
244
|
description: () => /* @__PURE__ */ e.createElement("h4", null, "With Links"),
|
|
157
|
-
react:
|
|
245
|
+
react: s`
|
|
158
246
|
import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
|
|
159
247
|
|
|
160
248
|
function Component() {
|
|
@@ -181,9 +269,11 @@ const r = {
|
|
|
181
269
|
}
|
|
182
270
|
}
|
|
183
271
|
}
|
|
184
|
-
},
|
|
185
|
-
"Key Value Sets":
|
|
272
|
+
}, k = {
|
|
273
|
+
"Key Value Sets": w
|
|
186
274
|
};
|
|
187
275
|
export {
|
|
188
|
-
|
|
276
|
+
S as KeyValueSet,
|
|
277
|
+
h as KeyValueSetItem,
|
|
278
|
+
k as MANIFEST
|
|
189
279
|
};
|
package/lib/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(s,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@sps-woodland/core"),require("react"),require("@spscommerce/utils")):typeof define=="function"&&define.amd?define(["exports","@sps-woodland/core","react","@spscommerce/utils"],o):(s=typeof globalThis<"u"?globalThis:s||self,o(s.KeyValueSet={},s.core,s.React,s.utils))})(this,(function(s,o,h,u){"use strict";function K(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const l=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,l.get?l:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const e=K(h);function _(t,n,a){return n in t?Object.defineProperty(t,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[n]=a,t}function y(t,n){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);n&&(l=l.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),a.push.apply(a,l)}return a}function f(t){for(var n=1;n<arguments.length;n++){var a=arguments[n]!=null?arguments[n]:{};n%2?y(Object(a),!0).forEach(function(l){_(t,l,a[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):y(Object(a)).forEach(function(l){Object.defineProperty(t,l,Object.getOwnPropertyDescriptor(a,l))})}return t}var b=(t,n,a)=>{for(var l of Object.keys(t)){var r;if(t[l]!==((r=n[l])!==null&&r!==void 0?r:a[l]))return!1}return!0},S=t=>n=>{var a=t.defaultClassName,l=f(f({},t.defaultVariants),n);for(var r in l){var i,m=(i=l[r])!==null&&i!==void 0?i:t.defaultVariants[r];if(m!=null){var c=m;typeof c=="boolean"&&(c=c===!0?"true":"false");var V=t.variantClassNames[r][c];V&&(a+=" "+V)}}for(var[I,N]of t.compoundVariants)b(I,l,t.defaultVariants)&&(a+=" "+N);return a},v=S({defaultClassName:"pkg_sps-woodland_key-value-set__version_8_52_1__hash_1i7enhj1",variantClassNames:{inline:{true:"pkg_sps-woodland_key-value-set__version_8_52_1__hash_1i7enhj2 pkg_sps-woodland_key-value-set__version_8_52_1__hash_1i7enhj0"}},defaultVariants:{},compoundVariants:[]});function d({children:t,className:n,inline:a,...l}){return e.createElement("div",{className:o.cl(v({inline:a}),n),...l},t)}o.Metadata.set(d,{name:"KeyValueSet",props:{inline:{type:"boolean",default:"false"}}});var E="pkg_sps-woodland_key-value-set__version_8_52_1__hash_18tyj090",g=S({defaultClassName:"pkg_sps-woodland_key-value-set__version_8_52_1__hash_18tyj091",variantClassNames:{wrap:{normal:"pkg_sps-woodland_key-value-set__version_8_52_1__hash_18tyj092",truncate:"pkg_sps-woodland_key-value-set__version_8_52_1__hash_18tyj093"}},defaultVariants:{},compoundVariants:[]});function p({children:t,className:n,itemKey:a,wrap:l,...r}){const i=o.useChildTestIdAttrBuilder(r),m=l==="truncate"&&typeof t=="string"?t:void 0;return e.createElement(e.Fragment,null,e.createElement("span",{className:E,...i("key")},a),e.createElement("span",{className:o.cl(g({wrap:l}),n),title:m,...r},t))}o.Metadata.set(p,{name:"KeyValueSetItem",props:{itemKey:{type:"React.ReactNode | (() => React.ReactNode)",required:!0},wrap:{type:"'normal' | 'truncate'"}}});const w={"Key Value Sets":{description:()=>e.createElement("p",null,"Key Value Sets consist of a title and value, or values, paired together visually. They are ideal for displaying details (a value or values) that require additional context (title)."),components:[d,p],examples:{vertical:{label:"Vertical Key Value Sets",description:()=>e.createElement(e.Fragment,null,e.createElement("h5",null,"Use:"),e.createElement("ul",null,e.createElement("li",{className:"mb-2"},"Vertical containers such as a side bar or general card")),e.createElement("h5",null,"Do Not Use:"),e.createElement("ul",null,e.createElement("li",{className:"mb-2"},"In Table cells or Description Lists")),e.createElement("h5",null,"Usage Rules"),e.createElement("ul",null,e.createElement("li",{className:"mb-2"},"Titles must be written in Title Case"),e.createElement("li",{className:"mb-2"},"Values can be written in Sentence Case or Title Case as best suits the content"),e.createElement("li",{className:"mb-2"},"Titles or Values can include hyperlinks and/or icons",e.createElement("ul",null,e.createElement("li",{className:"mb-2"},"Icons should always appear on the left before any text content"))),e.createElement("li",{className:"mb-2"},"Values can include tags"),e.createElement("li",{className:"mb-2"},"Can include multiple values on additional lines"))),examples:{standard:{description:()=>e.createElement("h4",null,"Standard"),react:u.code`
|
|
2
2
|
import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
|
|
3
3
|
|
|
4
4
|
function Component() {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</KeyValueSet>
|
|
11
11
|
)
|
|
12
12
|
}
|
|
13
|
-
`},multipleValues:{description:()=>e.createElement(e.Fragment,null,e.createElement("h4",null,"Multiple Values"),e.createElement("p",null,e.createElement("b",null,"Note:")," There is no limit to the number of values that can be listed, but extensive lists should be avoided.")),react:
|
|
13
|
+
`},multipleValues:{description:()=>e.createElement(e.Fragment,null,e.createElement("h4",null,"Multiple Values"),e.createElement("p",null,e.createElement("b",null,"Note:")," There is no limit to the number of values that can be listed, but extensive lists should be avoided.")),react:u.code`
|
|
14
14
|
import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
|
|
15
15
|
|
|
16
16
|
function Component() {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
</KeyValueSet>
|
|
25
25
|
)
|
|
26
26
|
}
|
|
27
|
-
`},secondaryValues:{description:()=>e.createElement(e.Fragment,null,e.createElement("h5",null,"Secondary Values"),e.createElement("p",null,e.createElement("b",null,"Note:")," When using a secondary value (styled in lighter grey text) the number of values listed should be limited to two (2).")),react:
|
|
27
|
+
`},secondaryValues:{description:()=>e.createElement(e.Fragment,null,e.createElement("h5",null,"Secondary Values"),e.createElement("p",null,e.createElement("b",null,"Note:")," When using a secondary value (styled in lighter grey text) the number of values listed should be limited to two (2).")),react:u.code`
|
|
28
28
|
import { Box } from "@sps-woodland/core";
|
|
29
29
|
import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
|
|
30
30
|
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
</KeyValueSet>
|
|
39
39
|
)
|
|
40
40
|
}
|
|
41
|
-
`},tags:{description:({NavigateTo:t})=>e.createElement(e.Fragment,null,e.createElement("h4",null,"Tags"),e.createElement("p",null,e.createElement("b",null,"Note:")," Tags can appear inline or on individual lines as the length of content requires. Reference the ",e.createElement(t,{to:"tags"},"Tag")," component for spacing rules.")),react:
|
|
41
|
+
`},tags:{description:({NavigateTo:t})=>e.createElement(e.Fragment,null,e.createElement("h4",null,"Tags"),e.createElement("p",null,e.createElement("b",null,"Note:")," Tags can appear inline or on individual lines as the length of content requires. Reference the ",e.createElement(t,{to:"tags"},"Tag")," component for spacing rules.")),react:u.code`
|
|
42
42
|
import { SpsTag } from "@spscommerce/ds-react";
|
|
43
43
|
import { Box } from "@sps-woodland/core";
|
|
44
44
|
import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
</KeyValueSet>
|
|
56
56
|
)
|
|
57
57
|
}
|
|
58
|
-
`},hyperlinksAndIcons:{description:()=>e.createElement(e.Fragment,null,e.createElement("h4",null,"Hyperlinks & Icons"),e.createElement("p",null,e.createElement("b",null,"Note:")," Icons and Hyperlinks can be used independently of one another.")),react:
|
|
58
|
+
`},hyperlinksAndIcons:{description:()=>e.createElement(e.Fragment,null,e.createElement("h4",null,"Hyperlinks & Icons"),e.createElement("p",null,e.createElement("b",null,"Note:")," Icons and Hyperlinks can be used independently of one another.")),react:u.code`
|
|
59
59
|
import { Box } from "@sps-woodland/core";
|
|
60
60
|
import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
|
|
61
61
|
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
</KeyValueSet>
|
|
70
70
|
)
|
|
71
71
|
}
|
|
72
|
-
`}}},horizontal:{label:"Horizontal Key Value Sets",description:()=>e.createElement(e.Fragment,null,e.createElement("h5",null,"Use:"),e.createElement("ul",null,e.createElement("li",{className:"mb-2"},"Horizontal containers such as a content row")),e.createElement("h5",null,"Do Not Use:"),e.createElement("ul",null,e.createElement("li",{className:"mb-2"},"In Table cells or Description Lists")),e.createElement("h5",null,"Usage Rules"),e.createElement("ul",null,e.createElement("li",{className:"mb-2"},"Titles must be written in Title Case"),e.createElement("li",{className:"mb-2"},"Values can be written in Sentence Case or Title Case as best suits the content"),e.createElement("li",{className:"mb-2"},"Titles or Values can include hyperlinks and/or icons",e.createElement("ul",null,e.createElement("li",{className:"mb-2"},"Icons should always appear on the left before any text content"))),e.createElement("li",{className:"mb-2"},"Can be used individually or stacked on top of one another",e.createElement("ul",null,e.createElement("li",{className:"mb-2"},"When stacking, the value lists should share a common category or theme"))))),examples:{standard:{description:()=>e.createElement("h4",null,"Standard"),react:
|
|
72
|
+
`}}},horizontal:{label:"Horizontal Key Value Sets",description:()=>e.createElement(e.Fragment,null,e.createElement("h5",null,"Use:"),e.createElement("ul",null,e.createElement("li",{className:"mb-2"},"Horizontal containers such as a content row")),e.createElement("h5",null,"Do Not Use:"),e.createElement("ul",null,e.createElement("li",{className:"mb-2"},"In Table cells or Description Lists")),e.createElement("h5",null,"Usage Rules"),e.createElement("ul",null,e.createElement("li",{className:"mb-2"},"Titles must be written in Title Case"),e.createElement("li",{className:"mb-2"},"Values can be written in Sentence Case or Title Case as best suits the content"),e.createElement("li",{className:"mb-2"},"Titles or Values can include hyperlinks and/or icons",e.createElement("ul",null,e.createElement("li",{className:"mb-2"},"Icons should always appear on the left before any text content"))),e.createElement("li",{className:"mb-2"},"Can be used individually or stacked on top of one another",e.createElement("ul",null,e.createElement("li",{className:"mb-2"},"When stacking, the value lists should share a common category or theme"))))),examples:{standard:{description:()=>e.createElement("h4",null,"Standard"),react:u.code`
|
|
73
73
|
import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
|
|
74
74
|
|
|
75
75
|
function Component() {
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
</KeyValueSet>
|
|
82
82
|
)
|
|
83
83
|
}
|
|
84
|
-
`},stacked:{description:()=>e.createElement(e.Fragment,null,e.createElement("h4",null,"Stacked"),e.createElement("p",null,e.createElement("b",null,"Note:")," There is no limit to the number of stacked listings, but more than three in a single container should be avoided."),e.createElement("p",null,e.createElement("b",null,"Note:")," Titles are right-aligned in the horizontal Key Value Sets to optimize scanability of the values.")),react:
|
|
84
|
+
`},stacked:{description:()=>e.createElement(e.Fragment,null,e.createElement("h4",null,"Stacked"),e.createElement("p",null,e.createElement("b",null,"Note:")," There is no limit to the number of stacked listings, but more than three in a single container should be avoided."),e.createElement("p",null,e.createElement("b",null,"Note:")," Titles are right-aligned in the horizontal Key Value Sets to optimize scanability of the values.")),react:u.code`
|
|
85
85
|
import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
|
|
86
86
|
|
|
87
87
|
function Component() {
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
</div>
|
|
107
107
|
)
|
|
108
108
|
}
|
|
109
|
-
`},withLinks:{description:()=>e.createElement("h4",null,"With Links"),react:
|
|
109
|
+
`},withLinks:{description:()=>e.createElement("h4",null,"With Links"),react:u.code`
|
|
110
110
|
import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
|
|
111
111
|
|
|
112
112
|
function Component() {
|
|
@@ -128,4 +128,4 @@
|
|
|
128
128
|
</div>
|
|
129
129
|
)
|
|
130
130
|
}
|
|
131
|
-
`}}}}}};
|
|
131
|
+
`}}}}}};s.KeyValueSet=d,s.KeyValueSetItem=p,s.MANIFEST=w,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const key: string;
|
|
2
|
+
export declare const value: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<{
|
|
3
|
+
wrap: {
|
|
4
|
+
normal: {
|
|
5
|
+
overflowWrap: "normal";
|
|
6
|
+
};
|
|
7
|
+
truncate: {
|
|
8
|
+
overflow: "hidden";
|
|
9
|
+
textOverflow: "ellipsis";
|
|
10
|
+
whiteSpace: "nowrap";
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ComponentProps } from "@sps-woodland/core";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export declare function KeyValueSetItem({ children, className, itemKey, wrap, ...rest }: ComponentProps<{
|
|
4
|
+
itemKey: React.ReactNode | (() => React.ReactNode);
|
|
5
|
+
wrap?: "normal" | "truncate";
|
|
6
|
+
}, HTMLSpanElement>): React.ReactElement;
|
package/lib/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.pkg_sps-
|
|
1
|
+
.pkg_sps-woodland_key-value-set__version_8_52_1__hash_1i7enhj0{grid-template-columns:auto auto}.pkg_sps-woodland_key-value-set__version_8_52_1__hash_1i7enhj1{column-gap:.5rem;display:inline-grid;font-size:.75rem;line-height:1.125rem;max-width:100%}.pkg_sps-woodland_key-value-set__version_8_52_1__hash_18tyj090{font-weight:600;min-width:0}.pkg_sps-woodland_key-value-set__version_8_52_1__hash_1i7enhj0 .pkg_sps-woodland_key-value-set__version_8_52_1__hash_18tyj090{text-align:right}.pkg_sps-woodland_key-value-set__version_8_52_1__hash_18tyj091{min-width:0;overflow-wrap:break-word}.pkg_sps-woodland_key-value-set__version_8_52_1__hash_18tyj092{overflow-wrap:normal}.pkg_sps-woodland_key-value-set__version_8_52_1__hash_18tyj093{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sps-woodland/key-value-set",
|
|
3
3
|
"description": "SPS Woodland Design System key value set component",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.52.1",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/SPSCommerce/woodland/tree/main/packages/@sps-woodland/key-value-set",
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"import": "./lib/index.js",
|
|
18
18
|
"default": "./lib/index.js"
|
|
19
19
|
},
|
|
20
|
-
"./style.css": "./lib/style.css",
|
|
21
20
|
"./lib/style.css": {
|
|
22
21
|
"import": "./lib/style.css",
|
|
23
22
|
"require": "./lib/style.css"
|
|
@@ -30,19 +29,22 @@
|
|
|
30
29
|
"@spscommerce/utils": "^7.0.0 || ^8.0.0 || ^9.0.0",
|
|
31
30
|
"react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
32
31
|
"react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
33
|
-
"@sps-woodland/core": "8.
|
|
32
|
+
"@sps-woodland/core": "8.52.1",
|
|
33
|
+
"@sps-woodland/tokens": "8.52.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@spscommerce/utils": "9.0.3",
|
|
37
|
+
"@vanilla-extract/css": "1.17.4",
|
|
38
|
+
"@vanilla-extract/recipes": "0.2.5",
|
|
37
39
|
"react": "16.14.0",
|
|
38
40
|
"react-dom": "16.14.0",
|
|
39
|
-
"@sps-woodland/core": "8.
|
|
41
|
+
"@sps-woodland/core": "8.52.1",
|
|
42
|
+
"@sps-woodland/tokens": "8.52.1"
|
|
40
43
|
},
|
|
41
44
|
"scripts": {
|
|
42
|
-
"build": "pnpm run build:js && pnpm run build:types
|
|
45
|
+
"build": "pnpm run build:js && pnpm run build:types",
|
|
43
46
|
"build:js": "vite build",
|
|
44
47
|
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib",
|
|
45
|
-
"build:css": "cp ../core/lib/key-value-set/style.css lib/style.css 2>/dev/null || echo 'key-value-set style.css not found, skipping'",
|
|
46
48
|
"watch": "vite build --watch",
|
|
47
49
|
"clean": "git clean -fdX",
|
|
48
50
|
"pub": "node ../../../scripts/publish-package.mjs"
|
package/vite.config.mjs
CHANGED
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
|
|
2
3
|
import { defineConfig } from "vite";
|
|
4
|
+
import { getVanillaExtractPluginProps } from "../../../scripts/vanilla-extract-plugin-props.mjs";
|
|
3
5
|
import pkg from "./package.json";
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
// No vanilla-extract needed - CSS is provided by the mono-package.
|
|
7
|
-
|
|
8
|
-
const peerDeps = pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [];
|
|
7
|
+
const packageVersion = process.env.PREDICTED_VERSION || pkg.version;
|
|
9
8
|
|
|
10
9
|
export default defineConfig({
|
|
10
|
+
plugins: [
|
|
11
|
+
vanillaExtractPlugin(
|
|
12
|
+
getVanillaExtractPluginProps({
|
|
13
|
+
packageName: pkg.name,
|
|
14
|
+
packageVersion,
|
|
15
|
+
})
|
|
16
|
+
),
|
|
17
|
+
],
|
|
11
18
|
build: {
|
|
12
19
|
lib: {
|
|
13
20
|
entry: path.resolve(__dirname, "src/index.ts"),
|
|
14
21
|
name: "KeyValueSet",
|
|
15
22
|
fileName: "index",
|
|
23
|
+
cssFileName: "style",
|
|
16
24
|
},
|
|
17
25
|
outDir: path.resolve(__dirname, "./lib"),
|
|
18
26
|
emptyOutDir: false,
|
|
19
27
|
rollupOptions: {
|
|
20
|
-
|
|
21
|
-
external: (id) => !id.endsWith(".css") && peerDeps.some((dep) => id === dep || id.startsWith(dep + "/")),
|
|
28
|
+
external: pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [],
|
|
22
29
|
},
|
|
23
30
|
},
|
|
24
31
|
});
|