@sps-woodland/key-value-set 7.0.0

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 ADDED
@@ -0,0 +1,3 @@
1
+ ## [@sps-woodland/key-value-set](https://github.com/SPSCommerce/woodland/tree/master/packages/@sps-woodland/key-value-set#readme)
2
+
3
+ SPS Woodland Design System key value set component
@@ -0,0 +1,2 @@
1
+ import type { ComponentManifestEntry } from "@sps-woodland/core";
2
+ export declare const KeyValueSetExamples: ComponentManifestEntry;
@@ -0,0 +1,112 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("@sps-woodland/core"),K=require("react"),s=require("@spscommerce/utils");function b(t){if(t&&t.__esModule)return t;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const l in t)if(l!=="default"){const a=Object.getOwnPropertyDescriptor(t,l);Object.defineProperty(n,l,a.get?a:{enumerable:!0,get:()=>t[l]})}}return n.default=t,Object.freeze(n)}const e=b(K);var h="_18tyj090";function i({children:t,itemKey:n,...l}){const a=o.useChildTestIdAttrBuilder(l);return e.createElement(e.Fragment,null,e.createElement("span",{className:h,...a("key")},n),e.createElement("span",{...l},t))}o.Metadata.set(i,{name:"KeyValueSetItem",props:{itemKey:{type:"React.ReactNode | (() => React.ReactNode)",required:!0}}});function E(t,n,l){return n in t?Object.defineProperty(t,n,{value:l,enumerable:!0,configurable:!0,writable:!0}):t[n]=l,t}function p(t,n){var l=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);n&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),l.push.apply(l,a)}return l}function S(t){for(var n=1;n<arguments.length;n++){var l=arguments[n]!=null?arguments[n]:{};n%2?p(Object(l),!0).forEach(function(a){E(t,a,l[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(l)):p(Object(l)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(l,a))})}return t}var g=(t,n,l)=>{for(var a of Object.keys(t)){var r;if(t[a]!==((r=n[a])!==null&&r!==void 0?r:l[a]))return!1}return!0},v=t=>n=>{var l=t.defaultClassName,a=S(S({},t.defaultVariants),n);for(var r in a){var m,d=(m=a[r])!==null&&m!==void 0?m:t.defaultVariants[r];if(d!=null){var u=d;typeof u=="boolean"&&(u=u===!0?"true":"false");var y=t.variantClassNames[r][u];y&&(l+=" "+y)}}for(var[V,f]of t.compoundVariants)g(V,a,t.defaultVariants)&&(l+=" "+f);return l},I=v({defaultClassName:"_1i7enhj1",variantClassNames:{inline:{true:"_1i7enhj0"}},defaultVariants:{},compoundVariants:[]});function c({children:t,className:n,inline:l,...a}){const[r]=o.selectChildren(t,[{type:i}]);return e.createElement("div",{className:o.cl(I({inline:l}),n),...a},r)}o.Metadata.set(c,{name:"KeyValueSet",props:{inline:{type:"boolean",default:"false"}}});const T={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:[c,i],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:s.code`
2
+ import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
3
+ function Component() {
4
+ return (
5
+ <KeyValueSet>
6
+ <KeyValueSetItem itemKey="Company">
7
+ SPS Commerce
8
+ </KeyValueSetItem>
9
+ </KeyValueSet>
10
+ )
11
+ }
12
+ `},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:s.code`
13
+ import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
14
+ function Component() {
15
+ return (
16
+ <KeyValueSet>
17
+ <KeyValueSetItem itemKey="Program Requirements">
18
+ Electronic Order
19
+ <br />
20
+ Fulfillment
21
+ </KeyValueSetItem>
22
+ </KeyValueSet>
23
+ )
24
+ }
25
+ `},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:s.code`
26
+ import { Box } from "@sps-woodland/core";
27
+ import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
28
+ function Component() {
29
+ return (
30
+ <KeyValueSet>
31
+ <KeyValueSetItem itemKey="Company">
32
+ SPS Commerce
33
+ <Box color="grey-medium">Minneapolis, MN</Box>
34
+ </KeyValueSetItem>
35
+ </KeyValueSet>
36
+ )
37
+ }
38
+ `},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:s.code`
39
+ import { SpsTag } from "@spscommerce/ds-react";
40
+ import { Box } from "@sps-woodland/core";
41
+ import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
42
+ function Component() {
43
+ return (
44
+ <KeyValueSet>
45
+ <KeyValueSetItem itemKey="Accepted Documents">
46
+ <Box mt="sm" display="flex" flexWrap="wrap" gap="xs">
47
+ <SpsTag>850</SpsTag>
48
+ <SpsTag>855</SpsTag>
49
+ </Box>
50
+ </KeyValueSetItem>
51
+ </KeyValueSet>
52
+ )
53
+ }
54
+ `},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:s.code`
55
+ import { Box } from "@sps-woodland/core";
56
+ import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
57
+ function Component() {
58
+ return (
59
+ <KeyValueSet>
60
+ <KeyValueSetItem itemKey="Company">
61
+ <a href="#" target="_blank">SPS Commerce</a>
62
+ <Box color="grey-medium">Minneapolis, MN</Box>
63
+ </KeyValueSetItem>
64
+ </KeyValueSet>
65
+ )
66
+ }
67
+ `}}},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:s.code`
68
+ import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
69
+ function Component() {
70
+ return (
71
+ <KeyValueSet inline>
72
+ <KeyValueSetItem itemKey="Company">
73
+ SPS Commerce
74
+ </KeyValueSetItem>
75
+ </KeyValueSet>
76
+ )
77
+ }
78
+ `},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:s.code`
79
+ import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
80
+ function Component() {
81
+ return (
82
+ <KeyValueSet inline>
83
+ <KeyValueSetItem itemKey="Title One">
84
+ Value
85
+ </KeyValueSetItem>
86
+ <KeyValueSetItem itemKey="Title Two">
87
+ Value that wraps to a second line
88
+ </KeyValueSetItem>
89
+ <KeyValueSetItem itemKey="Title Three">
90
+ Value
91
+ </KeyValueSetItem>
92
+ </KeyValueSet>
93
+ )
94
+ }
95
+ `},withLinks:{description:()=>e.createElement("h4",null,"With Links"),react:s.code`
96
+ import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
97
+ function Component() {
98
+ return (
99
+ <KeyValueSet inline>
100
+ <KeyValueSetItem itemKey="Title One">
101
+ Value
102
+ </KeyValueSetItem>
103
+ <KeyValueSetItem itemKey="Title Two">
104
+ Value that wraps to a <a href="#" target="_blank">second line</a>
105
+ </KeyValueSetItem>
106
+ <KeyValueSetItem itemKey="Title Three">
107
+ Value
108
+ </KeyValueSetItem>
109
+ </KeyValueSet>
110
+ )
111
+ }
112
+ `}}}}},w={"Key Value Sets":T};exports.KeyValueSet=c;exports.KeyValueSetItem=i;exports.MANIFEST=w;
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./key-value-set/KeyValueSet";
2
+ export * from "./key-value-set-item/KeyValueSetItem";
3
+ export * from "./manifest";
@@ -0,0 +1,297 @@
1
+ import { Metadata as d, useChildTestIdAttrBuilder as f, selectChildren as h, cl as E } from "@sps-woodland/core";
2
+ import * as e from "react";
3
+ import { code as s } from "@spscommerce/utils";
4
+ var b = "_18tyj090";
5
+ function m({
6
+ children: t,
7
+ itemKey: n,
8
+ ...l
9
+ }) {
10
+ const a = f(l);
11
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("span", {
12
+ className: b,
13
+ ...a("key")
14
+ }, n), /* @__PURE__ */ e.createElement("span", {
15
+ ...l
16
+ }, t));
17
+ }
18
+ d.set(m, {
19
+ name: "KeyValueSetItem",
20
+ props: {
21
+ itemKey: { type: "React.ReactNode | (() => React.ReactNode)", required: !0 }
22
+ }
23
+ });
24
+ function v(t, n, l) {
25
+ return n in t ? Object.defineProperty(t, n, {
26
+ value: l,
27
+ enumerable: !0,
28
+ configurable: !0,
29
+ writable: !0
30
+ }) : t[n] = l, t;
31
+ }
32
+ function p(t, n) {
33
+ var l = Object.keys(t);
34
+ if (Object.getOwnPropertySymbols) {
35
+ var a = Object.getOwnPropertySymbols(t);
36
+ n && (a = a.filter(function(r) {
37
+ return Object.getOwnPropertyDescriptor(t, r).enumerable;
38
+ })), l.push.apply(l, a);
39
+ }
40
+ return l;
41
+ }
42
+ function y(t) {
43
+ for (var n = 1; n < arguments.length; n++) {
44
+ var l = arguments[n] != null ? arguments[n] : {};
45
+ n % 2 ? p(Object(l), !0).forEach(function(a) {
46
+ v(t, a, l[a]);
47
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(l)) : p(Object(l)).forEach(function(a) {
48
+ Object.defineProperty(t, a, Object.getOwnPropertyDescriptor(l, a));
49
+ });
50
+ }
51
+ return t;
52
+ }
53
+ var I = (t, n, l) => {
54
+ for (var a of Object.keys(t)) {
55
+ var r;
56
+ if (t[a] !== ((r = n[a]) !== null && r !== void 0 ? r : l[a]))
57
+ return !1;
58
+ }
59
+ return !0;
60
+ }, g = (t) => (n) => {
61
+ var l = t.defaultClassName, a = y(y({}, t.defaultVariants), n);
62
+ for (var r in a) {
63
+ var u, i = (u = a[r]) !== null && u !== void 0 ? u : t.defaultVariants[r];
64
+ if (i != null) {
65
+ var o = i;
66
+ typeof o == "boolean" && (o = o === !0 ? "true" : "false");
67
+ var c = t.variantClassNames[r][o];
68
+ c && (l += " " + c);
69
+ }
70
+ }
71
+ for (var [S, K] of t.compoundVariants)
72
+ I(S, a, t.defaultVariants) && (l += " " + K);
73
+ return l;
74
+ }, T = g({ defaultClassName: "_1i7enhj1", variantClassNames: { inline: { true: "_1i7enhj0" } }, defaultVariants: {}, compoundVariants: [] });
75
+ function V({
76
+ children: t,
77
+ className: n,
78
+ inline: l,
79
+ ...a
80
+ }) {
81
+ const [r] = h(t, [{ type: m }]);
82
+ return /* @__PURE__ */ e.createElement("div", {
83
+ className: E(
84
+ T({ inline: l }),
85
+ n
86
+ ),
87
+ ...a
88
+ }, r);
89
+ }
90
+ d.set(V, {
91
+ name: "KeyValueSet",
92
+ props: {
93
+ inline: { type: "boolean", default: "false" }
94
+ }
95
+ });
96
+ const w = {
97
+ 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)."),
98
+ components: [V, m],
99
+ examples: {
100
+ vertical: {
101
+ label: "Vertical Key Value Sets",
102
+ description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h5", null, "Use:"), /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement("li", {
103
+ className: "mb-2"
104
+ }, "Vertical containers such as a side bar or general card")), /* @__PURE__ */ e.createElement("h5", null, "Do Not Use:"), /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement("li", {
105
+ className: "mb-2"
106
+ }, "In Table cells or Description Lists")), /* @__PURE__ */ e.createElement("h5", null, "Usage Rules"), /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement("li", {
107
+ className: "mb-2"
108
+ }, "Titles must be written in Title Case"), /* @__PURE__ */ e.createElement("li", {
109
+ className: "mb-2"
110
+ }, "Values can be written in Sentence Case or Title Case as best suits the content"), /* @__PURE__ */ e.createElement("li", {
111
+ className: "mb-2"
112
+ }, "Titles or Values can include hyperlinks and/or icons", /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement("li", {
113
+ className: "mb-2"
114
+ }, "Icons should always appear on the left before any text content"))), /* @__PURE__ */ e.createElement("li", {
115
+ className: "mb-2"
116
+ }, "Values can include tags"), /* @__PURE__ */ e.createElement("li", {
117
+ className: "mb-2"
118
+ }, "Can include multiple values on additional lines"))),
119
+ examples: {
120
+ standard: {
121
+ description: () => /* @__PURE__ */ e.createElement("h4", null, "Standard"),
122
+ react: s`
123
+ import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
124
+ function Component() {
125
+ return (
126
+ <KeyValueSet>
127
+ <KeyValueSetItem itemKey="Company">
128
+ SPS Commerce
129
+ </KeyValueSetItem>
130
+ </KeyValueSet>
131
+ )
132
+ }
133
+ `
134
+ },
135
+ multipleValues: {
136
+ 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.")),
137
+ react: s`
138
+ import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
139
+ function Component() {
140
+ return (
141
+ <KeyValueSet>
142
+ <KeyValueSetItem itemKey="Program Requirements">
143
+ Electronic Order
144
+ <br />
145
+ Fulfillment
146
+ </KeyValueSetItem>
147
+ </KeyValueSet>
148
+ )
149
+ }
150
+ `
151
+ },
152
+ secondaryValues: {
153
+ 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).")),
154
+ react: s`
155
+ import { Box } from "@sps-woodland/core";
156
+ import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
157
+ function Component() {
158
+ return (
159
+ <KeyValueSet>
160
+ <KeyValueSetItem itemKey="Company">
161
+ SPS Commerce
162
+ <Box color="grey-medium">Minneapolis, MN</Box>
163
+ </KeyValueSetItem>
164
+ </KeyValueSet>
165
+ )
166
+ }
167
+ `
168
+ },
169
+ tags: {
170
+ 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, {
171
+ to: "tags"
172
+ }, "Tag"), " component for spacing rules.")),
173
+ react: s`
174
+ import { SpsTag } from "@spscommerce/ds-react";
175
+ import { Box } from "@sps-woodland/core";
176
+ import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
177
+ function Component() {
178
+ return (
179
+ <KeyValueSet>
180
+ <KeyValueSetItem itemKey="Accepted Documents">
181
+ <Box mt="sm" display="flex" flexWrap="wrap" gap="xs">
182
+ <SpsTag>850</SpsTag>
183
+ <SpsTag>855</SpsTag>
184
+ </Box>
185
+ </KeyValueSetItem>
186
+ </KeyValueSet>
187
+ )
188
+ }
189
+ `
190
+ },
191
+ hyperlinksAndIcons: {
192
+ 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.")),
193
+ react: s`
194
+ import { Box } from "@sps-woodland/core";
195
+ import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
196
+ function Component() {
197
+ return (
198
+ <KeyValueSet>
199
+ <KeyValueSetItem itemKey="Company">
200
+ <a href="#" target="_blank">SPS Commerce</a>
201
+ <Box color="grey-medium">Minneapolis, MN</Box>
202
+ </KeyValueSetItem>
203
+ </KeyValueSet>
204
+ )
205
+ }
206
+ `
207
+ }
208
+ }
209
+ },
210
+ horizontal: {
211
+ label: "Horizontal Key Value Sets",
212
+ description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h5", null, "Use:"), /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement("li", {
213
+ className: "mb-2"
214
+ }, "Horizontal containers such as a content row")), /* @__PURE__ */ e.createElement("h5", null, "Do Not Use:"), /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement("li", {
215
+ className: "mb-2"
216
+ }, "In Table cells or Description Lists")), /* @__PURE__ */ e.createElement("h5", null, "Usage Rules"), /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement("li", {
217
+ className: "mb-2"
218
+ }, "Titles must be written in Title Case"), /* @__PURE__ */ e.createElement("li", {
219
+ className: "mb-2"
220
+ }, "Values can be written in Sentence Case or Title Case as best suits the content"), /* @__PURE__ */ e.createElement("li", {
221
+ className: "mb-2"
222
+ }, "Titles or Values can include hyperlinks and/or icons", /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement("li", {
223
+ className: "mb-2"
224
+ }, "Icons should always appear on the left before any text content"))), /* @__PURE__ */ e.createElement("li", {
225
+ className: "mb-2"
226
+ }, "Can be used individually or stacked on top of one another", /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement("li", {
227
+ className: "mb-2"
228
+ }, "When stacking, the value lists should share a common category or theme"))))),
229
+ examples: {
230
+ standard: {
231
+ description: () => /* @__PURE__ */ e.createElement("h4", null, "Standard"),
232
+ react: s`
233
+ import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
234
+ function Component() {
235
+ return (
236
+ <KeyValueSet inline>
237
+ <KeyValueSetItem itemKey="Company">
238
+ SPS Commerce
239
+ </KeyValueSetItem>
240
+ </KeyValueSet>
241
+ )
242
+ }
243
+ `
244
+ },
245
+ stacked: {
246
+ 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.")),
247
+ react: s`
248
+ import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
249
+ function Component() {
250
+ return (
251
+ <KeyValueSet inline>
252
+ <KeyValueSetItem itemKey="Title One">
253
+ Value
254
+ </KeyValueSetItem>
255
+ <KeyValueSetItem itemKey="Title Two">
256
+ Value that wraps to a second line
257
+ </KeyValueSetItem>
258
+ <KeyValueSetItem itemKey="Title Three">
259
+ Value
260
+ </KeyValueSetItem>
261
+ </KeyValueSet>
262
+ )
263
+ }
264
+ `
265
+ },
266
+ withLinks: {
267
+ description: () => /* @__PURE__ */ e.createElement("h4", null, "With Links"),
268
+ react: s`
269
+ import { KeyValueSet, KeyValueSetItem } from "@sps-woodland/key-value-set";
270
+ function Component() {
271
+ return (
272
+ <KeyValueSet inline>
273
+ <KeyValueSetItem itemKey="Title One">
274
+ Value
275
+ </KeyValueSetItem>
276
+ <KeyValueSetItem itemKey="Title Two">
277
+ Value that wraps to a <a href="#" target="_blank">second line</a>
278
+ </KeyValueSetItem>
279
+ <KeyValueSetItem itemKey="Title Three">
280
+ Value
281
+ </KeyValueSetItem>
282
+ </KeyValueSet>
283
+ )
284
+ }
285
+ `
286
+ }
287
+ }
288
+ }
289
+ }
290
+ }, x = {
291
+ "Key Value Sets": w
292
+ };
293
+ export {
294
+ V as KeyValueSet,
295
+ m as KeyValueSetItem,
296
+ x as MANIFEST
297
+ };
@@ -0,0 +1,6 @@
1
+ export declare const kvsInlineStyle: string;
2
+ export declare const keyValueSet: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<{
3
+ inline: {
4
+ true: string[];
5
+ };
6
+ }>;
@@ -0,0 +1,5 @@
1
+ import type { ComponentProps } from "@sps-woodland/core";
2
+ import * as React from "react";
3
+ export declare function KeyValueSet({ children, className, inline, ...rest }: ComponentProps<{
4
+ inline?: boolean;
5
+ }, HTMLDivElement>): React.ReactElement;
@@ -0,0 +1 @@
1
+ export declare const key: string;
@@ -0,0 +1,5 @@
1
+ import type { ComponentProps } from "@sps-woodland/core";
2
+ import * as React from "react";
3
+ export declare function KeyValueSetItem({ children, itemKey, ...rest }: ComponentProps<{
4
+ itemKey: React.ReactNode | (() => React.ReactNode);
5
+ }, HTMLSpanElement>): React.ReactElement;
@@ -0,0 +1,2 @@
1
+ import type { ComponentManifest } from "@sps-woodland/core";
2
+ export declare const MANIFEST: ComponentManifest;
package/lib/style.css ADDED
@@ -0,0 +1 @@
1
+ ._1i7enhj0{grid-template-columns:auto auto}._1i7enhj1{column-gap:.5rem;display:inline-grid;font-size:.75rem;line-height:1.125rem}._18tyj090{font-weight:600}._1i7enhj0 ._18tyj090{text-align:right}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@sps-woodland/key-value-set",
3
+ "description": "SPS Woodland Design System key value set component",
4
+ "version": "7.0.0",
5
+ "author": "SPS Commerce",
6
+ "license": "UNLICENSED",
7
+ "repository": "https://github.com/SPSCommerce/woodland/tree/main/packages/@sps-woodland/key-value-set",
8
+ "homepage": "https://github.com/SPSCommerce/woodland/tree/master/packages/@sps-woodland/key-value-set#readme",
9
+ "main": "./lib/index.es.js",
10
+ "module": "./lib/index.es.js",
11
+ "types": "./lib/index.d.ts",
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "peerDependencies": {
16
+ "@spscommerce/utils": "^6.12.1",
17
+ "@sps-woodland/core": "7.0.0",
18
+ "@sps-woodland/tokens": "7.0.0",
19
+ "react": "^16.9.0",
20
+ "react-dom": "^16.9.0"
21
+ },
22
+ "devDependencies": {
23
+ "@vanilla-extract/css": "^1.9.1",
24
+ "@vanilla-extract/recipes": "^0.2.5",
25
+ "@spscommerce/utils": "^6.12.1",
26
+ "@sps-woodland/core": "7.0.0",
27
+ "@sps-woodland/tokens": "7.0.0",
28
+ "react": "^16.9.0",
29
+ "react-dom": "^16.9.0"
30
+ },
31
+ "scripts": {
32
+ "build": "pnpm run build:js && pnpm run build:types",
33
+ "build:js": "vite build",
34
+ "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib",
35
+ "watch": "vite build --watch",
36
+ "clean": "git clean -fdX",
37
+ "pub": "node ../../../scripts/publish-package.js"
38
+ }
39
+ }
package/vite.config.js ADDED
@@ -0,0 +1,21 @@
1
+ import path from "path";
2
+ import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
3
+ import { defineConfig } from "vite";
4
+
5
+ import pkg from "./package.json";
6
+
7
+ export default defineConfig({
8
+ plugins: [vanillaExtractPlugin()],
9
+ build: {
10
+ lib: {
11
+ entry: path.resolve(__dirname, "src/index.ts"),
12
+ formats: ["es", "cjs"],
13
+ fileName: (format) => `index.${format}.js`,
14
+ },
15
+ outDir: path.resolve(__dirname, "./lib"),
16
+ emptyOutDir: false,
17
+ rollupOptions: {
18
+ external: pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [],
19
+ },
20
+ },
21
+ });