@sps-woodland/tags 7.17.9 → 8.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/lib/clickable-tag/ClickableTag.css.d.ts +1 -1
- package/lib/index.cjs.js +28 -30
- package/lib/index.d.ts +1 -1
- package/lib/index.es.js +94 -96
- package/lib/{key-value-tag/KeyValueTag.css.d.ts → split-tag/SplitTag.css.d.ts} +4 -4
- package/lib/{key-value-tag/KeyValueTag.d.ts → split-tag/SplitTag.d.ts} +1 -1
- package/lib/{key-value-tag/KeyValueTag.examples.d.ts → split-tag/SplitTag.examples.d.ts} +1 -1
- package/lib/style.css +1 -1
- package/lib/tag/Tag.d.ts +1 -1
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Tokens } from "@sps-woodland/tokens";
|
|
2
2
|
import type { VariantDefinitions, RecipeVariant, BooleanRecipeVariant } from "@sps-woodland/core";
|
|
3
|
-
export type ClickableTagKind = keyof typeof Tokens.component["clickable-tag"]["kind"];
|
|
3
|
+
export declare type ClickableTagKind = keyof typeof Tokens.component["clickable-tag"]["kind"];
|
|
4
4
|
interface ClickableTagVariantDefinitions extends VariantDefinitions {
|
|
5
5
|
kind: RecipeVariant<ClickableTagKind>;
|
|
6
6
|
disabled: BooleanRecipeVariant;
|
package/lib/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const _=require("react"),i=require("@sps-woodland/core"),c=require("@spscommerce/utils");function N(a){if(a&&a.__esModule)return a;const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const l=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(r,e,l.get?l:{enumerable:!0,get:()=>a[e]})}}return r.default=a,Object.freeze(r)}const n=N(_);function O(a,r,e){return r in a?Object.defineProperty(a,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[r]=e,a}function v(a,r){var e=Object.keys(a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);r&&(l=l.filter(function(t){return Object.getOwnPropertyDescriptor(a,t).enumerable})),e.push.apply(e,l)}return e}function C(a){for(var r=1;r<arguments.length;r++){var e=arguments[r]!=null?arguments[r]:{};r%2?v(Object(e),!0).forEach(function(l){O(a,l,e[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(e)):v(Object(e)).forEach(function(l){Object.defineProperty(a,l,Object.getOwnPropertyDescriptor(e,l))})}return a}var S=(a,r,e)=>{for(var l of Object.keys(a)){var t;if(a[l]!==((t=r[l])!==null&&t!==void 0?t:e[l]))return!1}return!0},f=a=>r=>{var e=a.defaultClassName,l=C(C({},a.defaultVariants),r);for(var t in l){var m,o=(m=l[t])!==null&&m!==void 0?m:a.defaultVariants[t];if(o!=null){var s=o;typeof s=="boolean"&&(s=s===!0?"true":"false");var u=a.variantClassNames[t][s];u&&(e+=" "+u)}}for(var[p,b]of a.compoundVariants)S(p,l,a.defaultVariants)&&(e+=" "+b);return e},E=f({defaultClassName:"_160drw10",variantClassNames:{kind:{blue:"_160drw11",gray:"_160drw12"},disabled:{true:"_160drw13",false:"_160drw14"}},defaultVariants:{kind:"blue",disabled:!1},compoundVariants:[]}),h="_160drw1e",K="_160drw1d",P=f({defaultClassName:"_160drw15",variantClassNames:{link:{true:"_160drw16",false:"_160drw17"},disabled:{true:"_160drw18",false:"_160drw19"},addOrRemove:{true:"_160drw1a",false:"_160drw1b"}},defaultVariants:{link:!1,disabled:!1,addOrRemove:!1},compoundVariants:[[{disabled:!1,addOrRemove:!0},"_160drw1c"]]}),j="_160drw1f";function T({children:a,className:r,onClick:e,disabled:l,href:t,kind:m,onAdd:o,onRemove:s,...u}){const p=n.Children.toArray(a).filter(d=>typeof d=="string").join("");n.useEffect(()=>{if(s&&o)throw new Error("Clickable tag should have onRemove or onAdd, not both")},[o,s]);function b(d){o?o():s&&s(),d.stopPropagation()}function y(d){d.stopPropagation(),e&&e(d)}return n.createElement("div",{className:i.cl(E({kind:m,disabled:l}),r),...u},n.createElement("span",{className:i.cl(P({link:!!t||!!e,disabled:l,addOrRemove:o||s})),onClick:y,title:p},t?n.createElement("a",{className:j,href:t},a):a),(o||s)&&!l&&n.createElement("div",{className:K,onClick:l?void 0:b,tabIndex:-1,"aria-label":o?"Add":"Remove"},n.createElement(i.Icon,{className:h,"aria-hidden":"true",icon:o?"plus-sign":"x"})))}i.Metadata.set(T,{name:"Clickable Tag",props:{disabled:{type:"boolean",default:"false"},href:{type:"string"},kind:{type:"ClickableTagKind",default:"blue"},onAdd:{type:"() => void"},onRemove:{type:"() => void"}}});var x=f({defaultClassName:"_5f3efi0",variantClassNames:{kind:{default:"_5f3efi1",key:"_5f3efi2",warning:"_5f3efi3",error:"_5f3efi4",pending:"_5f3efi5",success:"_5f3efi6",info:"_5f3efi7"}},defaultVariants:{kind:"default"},compoundVariants:[]}),F=f({defaultClassName:"_5f3efi8",variantClassNames:{kind:{default:"_5f3efi9",key:"_5f3efia",warning:"_5f3efib",error:"_5f3efic",pending:"_5f3efid",success:"_5f3efie",info:"_5f3efif"}},defaultVariants:{kind:"default"},compoundVariants:[]});const w=Object.freeze({default:"info-circle",key:"info-circle",warning:"status-warning",error:"status-error",pending:"status-in-process",success:"status-ok",info:"info-circle"});function g({children:a,className:r,kind:e="default",icon:l,...t}){return n.createElement("span",{className:i.cl(x({kind:e}),r),...t},l&&n.createElement(i.Icon,{className:i.cl(F({kind:e})),icon:w[e]}),a)}i.Metadata.set(g,{name:"Tag",props:{kind:{type:"TagKind",default:"default"},icon:{type:"boolean",default:"false"}}});var V="_79ofse0",I="_79ofse1",M="_79ofsec",R=f({defaultClassName:"_79ofse2",variantClassNames:{href:{true:"_79ofse3",false:"_79ofse4"},kind:{default:"_79ofse5",key:"_79ofse6",warning:"_79ofse7",error:"_79ofse8",pending:"_79ofse9",success:"_79ofsea",info:"_79ofseb"}},defaultVariants:{href:!1,kind:"default"},compoundVariants:[]});function k({children:a,className:r,color:e="default",href:l,icon:t,tagKey:m,value:o,...s}){return n.createElement("span",{className:i.cl(V,r),...s},n.createElement(g,{className:i.cl(I),icon:t,kind:e},m),n.createElement(g,{className:i.cl(R({href:!!l,kind:e}))},l?n.createElement("a",{className:M,href:l},o):o))}i.Metadata.set(k,{name:"Split Tag",props:{color:{type:"TagKind",default:"key"},href:{type:"string"},icon:{type:"boolean",default:"false"},tagKey:{type:"string",required:!0},value:{type:"string",required:!0}}});const D={components:[T],examples:{basic:{label:"Basic Tag",examples:{basic:{react:c.code`
|
|
2
2
|
import { ClickableTag } from "@sps-woodland/tags";
|
|
3
3
|
|
|
4
4
|
function Component() {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</>
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
|
-
`},disabled:{react:
|
|
12
|
+
`},disabled:{react:c.code`
|
|
13
13
|
import { ClickableTag } from "@sps-woodland/tags";
|
|
14
14
|
|
|
15
15
|
function Component() {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
</>
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
|
-
`}}},button:{label:"Button",examples:{remove:{react:
|
|
22
|
+
`}}},button:{label:"Button",examples:{remove:{react:c.code`
|
|
23
23
|
import { ClickableTag } from "@sps-woodland/tags";
|
|
24
24
|
|
|
25
25
|
function Component() {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
</>
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
|
-
`},add:{react:
|
|
33
|
+
`},add:{react:c.code`
|
|
34
34
|
import { ClickableTag } from "@sps-woodland/tags";
|
|
35
35
|
|
|
36
36
|
function Component() {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
</>
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
|
-
`}}},link:{label:"Link",examples:{basic:{react:
|
|
44
|
+
`}}},link:{label:"Link",examples:{basic:{react:c.code`
|
|
45
45
|
import { ClickableTag } from "@sps-woodland/tags";
|
|
46
46
|
|
|
47
47
|
function Component() {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
</>
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
|
-
`},button:{react:
|
|
55
|
+
`},button:{react:c.code`
|
|
56
56
|
import { ClickableTag } from "@sps-woodland/tags";
|
|
57
57
|
|
|
58
58
|
function Component() {
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
</>
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
|
-
`}}}}},
|
|
66
|
+
`}}}}},L={components:[g],examples:{basic:{label:"Basic Tag",examples:{basic:{react:c.code`
|
|
67
67
|
import { Tag } from "@sps-woodland/tag";
|
|
68
68
|
|
|
69
69
|
function Component() {
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
</>
|
|
80
80
|
)
|
|
81
81
|
}
|
|
82
|
-
`}}},withIcon:{label:"Tag with icon",examples:{basic:{react:
|
|
82
|
+
`}}},withIcon:{label:"Tag with icon",examples:{basic:{react:c.code`
|
|
83
83
|
import { Tag } from "@sps-woodland/tag";
|
|
84
84
|
|
|
85
85
|
function Component() {
|
|
@@ -95,44 +95,42 @@
|
|
|
95
95
|
</>
|
|
96
96
|
)
|
|
97
97
|
}
|
|
98
|
-
`}}}}},
|
|
99
|
-
import {
|
|
98
|
+
`}}}}},q={components:[k],examples:{basic:{label:"Basic",examples:{basic:{react:c.code`
|
|
99
|
+
import { SplitTag } from "@sps-woodland/tag";
|
|
100
100
|
|
|
101
101
|
function Component() {
|
|
102
102
|
return (
|
|
103
103
|
<>
|
|
104
|
-
<
|
|
105
|
-
<
|
|
106
|
-
<
|
|
107
|
-
<
|
|
108
|
-
<
|
|
109
|
-
<
|
|
110
|
-
<KeyValueTag className="mr-1" tagKey="Foo" value="1234" color="info" />
|
|
104
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="key" />
|
|
105
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="warning" />
|
|
106
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="error" />
|
|
107
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="pending" />
|
|
108
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="success" />
|
|
109
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="info" />
|
|
111
110
|
</>
|
|
112
111
|
);
|
|
113
112
|
}
|
|
114
|
-
`}}},icon:{label:"Icon",examples:{basic:{react:
|
|
115
|
-
import {
|
|
113
|
+
`}}},icon:{label:"Icon",examples:{basic:{react:c.code`
|
|
114
|
+
import { SplitTag } from "@sps-woodland/tag";
|
|
116
115
|
|
|
117
116
|
function Component() {
|
|
118
117
|
return (
|
|
119
118
|
<>
|
|
120
|
-
<
|
|
121
|
-
<
|
|
122
|
-
<
|
|
123
|
-
<
|
|
124
|
-
<
|
|
125
|
-
<
|
|
126
|
-
<KeyValueTag className="mr-1" tagKey="Foo" value="1234" color="info" icon />
|
|
119
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="key" icon />
|
|
120
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="warning" icon />
|
|
121
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="error" icon />
|
|
122
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="pending" icon />
|
|
123
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="success" icon />
|
|
124
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="info" icon />
|
|
127
125
|
</>
|
|
128
126
|
);
|
|
129
127
|
}
|
|
130
|
-
`}}},link:{label:"Link",examples:{basic:{react:
|
|
131
|
-
import {
|
|
128
|
+
`}}},link:{label:"Link",examples:{basic:{react:c.code`
|
|
129
|
+
import { SplitTag } from "@sps-woodland/tag";
|
|
132
130
|
|
|
133
131
|
function Component() {
|
|
134
132
|
return (
|
|
135
|
-
<
|
|
133
|
+
<SplitTag tagKey="Foo" value="1234" icon href="https://www.google.com" />
|
|
136
134
|
);
|
|
137
135
|
}
|
|
138
|
-
`}}}}},B={"Clickable Tags":
|
|
136
|
+
`}}}}},B={"Clickable Tags":D,Tags:L,"Split Tags":q};exports.ClickableTag=T;exports.MANIFEST=B;exports.SplitTag=k;exports.Tag=g;exports.TagIcons=w;
|
package/lib/index.d.ts
CHANGED
package/lib/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Metadata as
|
|
1
|
+
import * as o from "react";
|
|
2
|
+
import { Metadata as T, cl as m, Icon as C } from "@sps-woodland/core";
|
|
3
3
|
import { code as i } from "@spscommerce/utils";
|
|
4
|
-
function
|
|
4
|
+
function _(a, r, e) {
|
|
5
5
|
return r in a ? Object.defineProperty(a, r, {
|
|
6
6
|
value: e,
|
|
7
7
|
enumerable: !0,
|
|
@@ -13,95 +13,95 @@ function k(a, r) {
|
|
|
13
13
|
var e = Object.keys(a);
|
|
14
14
|
if (Object.getOwnPropertySymbols) {
|
|
15
15
|
var l = Object.getOwnPropertySymbols(a);
|
|
16
|
-
r && (l = l.filter(function(
|
|
17
|
-
return Object.getOwnPropertyDescriptor(a,
|
|
16
|
+
r && (l = l.filter(function(s) {
|
|
17
|
+
return Object.getOwnPropertyDescriptor(a, s).enumerable;
|
|
18
18
|
})), e.push.apply(e, l);
|
|
19
19
|
}
|
|
20
20
|
return e;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function v(a) {
|
|
23
23
|
for (var r = 1; r < arguments.length; r++) {
|
|
24
24
|
var e = arguments[r] != null ? arguments[r] : {};
|
|
25
25
|
r % 2 ? k(Object(e), !0).forEach(function(l) {
|
|
26
|
-
|
|
26
|
+
_(a, l, e[l]);
|
|
27
27
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(e)) : k(Object(e)).forEach(function(l) {
|
|
28
28
|
Object.defineProperty(a, l, Object.getOwnPropertyDescriptor(e, l));
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
return a;
|
|
32
32
|
}
|
|
33
|
-
var
|
|
33
|
+
var O = (a, r, e) => {
|
|
34
34
|
for (var l of Object.keys(a)) {
|
|
35
|
-
var
|
|
36
|
-
if (a[l] !== ((
|
|
35
|
+
var s;
|
|
36
|
+
if (a[l] !== ((s = r[l]) !== null && s !== void 0 ? s : e[l]))
|
|
37
37
|
return !1;
|
|
38
38
|
}
|
|
39
39
|
return !0;
|
|
40
|
-
},
|
|
41
|
-
var e = a.defaultClassName, l =
|
|
42
|
-
for (var
|
|
43
|
-
var c,
|
|
44
|
-
if (
|
|
45
|
-
var
|
|
46
|
-
typeof
|
|
47
|
-
var d = a.variantClassNames[
|
|
40
|
+
}, f = (a) => (r) => {
|
|
41
|
+
var e = a.defaultClassName, l = v(v({}, a.defaultVariants), r);
|
|
42
|
+
for (var s in l) {
|
|
43
|
+
var c, t = (c = l[s]) !== null && c !== void 0 ? c : a.defaultVariants[s];
|
|
44
|
+
if (t != null) {
|
|
45
|
+
var n = t;
|
|
46
|
+
typeof n == "boolean" && (n = n === !0 ? "true" : "false");
|
|
47
|
+
var d = a.variantClassNames[s][n];
|
|
48
48
|
d && (e += " " + d);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
for (var [
|
|
52
|
-
|
|
51
|
+
for (var [u, b] of a.compoundVariants)
|
|
52
|
+
O(u, l, a.defaultVariants) && (e += " " + b);
|
|
53
53
|
return e;
|
|
54
|
-
},
|
|
55
|
-
function
|
|
54
|
+
}, S = f({ defaultClassName: "_160drw10", variantClassNames: { kind: { blue: "_160drw11", gray: "_160drw12" }, disabled: { true: "_160drw13", false: "_160drw14" } }, defaultVariants: { kind: "blue", disabled: !1 }, compoundVariants: [] }), E = "_160drw1e", h = "_160drw1d", K = f({ defaultClassName: "_160drw15", variantClassNames: { link: { true: "_160drw16", false: "_160drw17" }, disabled: { true: "_160drw18", false: "_160drw19" }, addOrRemove: { true: "_160drw1a", false: "_160drw1b" } }, defaultVariants: { link: !1, disabled: !1, addOrRemove: !1 }, compoundVariants: [[{ disabled: !1, addOrRemove: !0 }, "_160drw1c"]] }), x = "_160drw1f";
|
|
55
|
+
function w({
|
|
56
56
|
children: a,
|
|
57
57
|
className: r,
|
|
58
58
|
onClick: e,
|
|
59
59
|
disabled: l,
|
|
60
|
-
href:
|
|
60
|
+
href: s,
|
|
61
61
|
kind: c,
|
|
62
|
-
onAdd:
|
|
63
|
-
onRemove:
|
|
62
|
+
onAdd: t,
|
|
63
|
+
onRemove: n,
|
|
64
64
|
...d
|
|
65
65
|
}) {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
if (
|
|
66
|
+
const u = o.Children.toArray(a).filter((g) => typeof g == "string").join("");
|
|
67
|
+
o.useEffect(() => {
|
|
68
|
+
if (n && t)
|
|
69
69
|
throw new Error("Clickable tag should have onRemove or onAdd, not both");
|
|
70
|
-
}, [
|
|
71
|
-
function
|
|
72
|
-
|
|
70
|
+
}, [t, n]);
|
|
71
|
+
function b(g) {
|
|
72
|
+
t ? t() : n && n(), g.stopPropagation();
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function y(g) {
|
|
75
75
|
g.stopPropagation(), e && e(g);
|
|
76
76
|
}
|
|
77
|
-
return /* @__PURE__ */
|
|
78
|
-
className: m(
|
|
77
|
+
return /* @__PURE__ */ o.createElement("div", {
|
|
78
|
+
className: m(S({ kind: c, disabled: l }), r),
|
|
79
79
|
...d
|
|
80
|
-
}, /* @__PURE__ */
|
|
80
|
+
}, /* @__PURE__ */ o.createElement("span", {
|
|
81
81
|
className: m(
|
|
82
|
-
|
|
83
|
-
link: !!
|
|
82
|
+
K({
|
|
83
|
+
link: !!s || !!e,
|
|
84
84
|
disabled: l,
|
|
85
|
-
addOrRemove:
|
|
85
|
+
addOrRemove: t || n
|
|
86
86
|
})
|
|
87
87
|
),
|
|
88
|
-
onClick:
|
|
89
|
-
title:
|
|
90
|
-
},
|
|
88
|
+
onClick: y,
|
|
89
|
+
title: u
|
|
90
|
+
}, s ? /* @__PURE__ */ o.createElement("a", {
|
|
91
91
|
className: x,
|
|
92
|
-
href:
|
|
93
|
-
}, a) : a), (
|
|
94
|
-
className:
|
|
95
|
-
onClick: l ? void 0 :
|
|
92
|
+
href: s
|
|
93
|
+
}, a) : a), (t || n) && !l && /* @__PURE__ */ o.createElement("div", {
|
|
94
|
+
className: h,
|
|
95
|
+
onClick: l ? void 0 : b,
|
|
96
96
|
tabIndex: -1,
|
|
97
|
-
"aria-label":
|
|
98
|
-
}, /* @__PURE__ */
|
|
99
|
-
className:
|
|
97
|
+
"aria-label": t ? "Add" : "Remove"
|
|
98
|
+
}, /* @__PURE__ */ o.createElement(C, {
|
|
99
|
+
className: E,
|
|
100
100
|
"aria-hidden": "true",
|
|
101
|
-
icon:
|
|
101
|
+
icon: t ? "plus-sign" : "x"
|
|
102
102
|
})));
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
T.set(w, {
|
|
105
105
|
name: "Clickable Tag",
|
|
106
106
|
props: {
|
|
107
107
|
disabled: { type: "boolean", default: "false" },
|
|
@@ -111,7 +111,7 @@ b.set(C, {
|
|
|
111
111
|
onRemove: { type: "() => void" }
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
|
-
var F =
|
|
114
|
+
var F = f({ defaultClassName: "_5f3efi0", variantClassNames: { kind: { default: "_5f3efi1", key: "_5f3efi2", warning: "_5f3efi3", error: "_5f3efi4", pending: "_5f3efi5", success: "_5f3efi6", info: "_5f3efi7" } }, defaultVariants: { kind: "default" }, compoundVariants: [] }), V = f({ defaultClassName: "_5f3efi8", variantClassNames: { kind: { default: "_5f3efi9", key: "_5f3efia", warning: "_5f3efib", error: "_5f3efic", pending: "_5f3efid", success: "_5f3efie", info: "_5f3efif" } }, defaultVariants: { kind: "default" }, compoundVariants: [] });
|
|
115
115
|
const P = Object.freeze({
|
|
116
116
|
default: "info-circle",
|
|
117
117
|
key: "info-circle",
|
|
@@ -121,55 +121,55 @@ const P = Object.freeze({
|
|
|
121
121
|
success: "status-ok",
|
|
122
122
|
info: "info-circle"
|
|
123
123
|
});
|
|
124
|
-
function
|
|
124
|
+
function p({
|
|
125
125
|
children: a,
|
|
126
126
|
className: r,
|
|
127
127
|
kind: e = "default",
|
|
128
128
|
icon: l,
|
|
129
|
-
...
|
|
129
|
+
...s
|
|
130
130
|
}) {
|
|
131
|
-
return /* @__PURE__ */
|
|
131
|
+
return /* @__PURE__ */ o.createElement("span", {
|
|
132
132
|
className: m(F({ kind: e }), r),
|
|
133
|
-
...
|
|
134
|
-
}, l && /* @__PURE__ */
|
|
135
|
-
className: m(
|
|
133
|
+
...s
|
|
134
|
+
}, l && /* @__PURE__ */ o.createElement(C, {
|
|
135
|
+
className: m(V({ kind: e })),
|
|
136
136
|
icon: P[e]
|
|
137
137
|
}), a);
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
T.set(p, {
|
|
140
140
|
name: "Tag",
|
|
141
141
|
props: {
|
|
142
142
|
kind: { type: "TagKind", default: "default" },
|
|
143
143
|
icon: { type: "boolean", default: "false" }
|
|
144
144
|
}
|
|
145
145
|
});
|
|
146
|
-
var j = "
|
|
146
|
+
var j = "_79ofse0", I = "_79ofse1", R = "_79ofsec", D = f({ defaultClassName: "_79ofse2", variantClassNames: { href: { true: "_79ofse3", false: "_79ofse4" }, kind: { default: "_79ofse5", key: "_79ofse6", warning: "_79ofse7", error: "_79ofse8", pending: "_79ofse9", success: "_79ofsea", info: "_79ofseb" } }, defaultVariants: { href: !1, kind: "default" }, compoundVariants: [] });
|
|
147
147
|
function N({
|
|
148
148
|
children: a,
|
|
149
149
|
className: r,
|
|
150
150
|
color: e = "default",
|
|
151
151
|
href: l,
|
|
152
|
-
icon:
|
|
152
|
+
icon: s,
|
|
153
153
|
tagKey: c,
|
|
154
|
-
value:
|
|
155
|
-
...
|
|
154
|
+
value: t,
|
|
155
|
+
...n
|
|
156
156
|
}) {
|
|
157
|
-
return /* @__PURE__ */
|
|
157
|
+
return /* @__PURE__ */ o.createElement("span", {
|
|
158
158
|
className: m(j, r),
|
|
159
|
-
...
|
|
160
|
-
}, /* @__PURE__ */
|
|
159
|
+
...n
|
|
160
|
+
}, /* @__PURE__ */ o.createElement(p, {
|
|
161
161
|
className: m(I),
|
|
162
|
-
icon:
|
|
162
|
+
icon: s,
|
|
163
163
|
kind: e
|
|
164
|
-
}, c), /* @__PURE__ */
|
|
164
|
+
}, c), /* @__PURE__ */ o.createElement(p, {
|
|
165
165
|
className: m(D({ href: !!l, kind: e }))
|
|
166
|
-
}, l ? /* @__PURE__ */
|
|
166
|
+
}, l ? /* @__PURE__ */ o.createElement("a", {
|
|
167
167
|
className: R,
|
|
168
168
|
href: l
|
|
169
|
-
},
|
|
169
|
+
}, t) : t));
|
|
170
170
|
}
|
|
171
|
-
|
|
172
|
-
name: "
|
|
171
|
+
T.set(N, {
|
|
172
|
+
name: "Split Tag",
|
|
173
173
|
props: {
|
|
174
174
|
color: { type: "TagKind", default: "key" },
|
|
175
175
|
href: { type: "string" },
|
|
@@ -179,7 +179,7 @@ b.set(N, {
|
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
181
|
const L = {
|
|
182
|
-
components: [
|
|
182
|
+
components: [w],
|
|
183
183
|
examples: {
|
|
184
184
|
basic: {
|
|
185
185
|
label: "Basic Tag",
|
|
@@ -281,7 +281,7 @@ const L = {
|
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
}, B = {
|
|
284
|
-
components: [
|
|
284
|
+
components: [p],
|
|
285
285
|
examples: {
|
|
286
286
|
basic: {
|
|
287
287
|
label: "Basic Tag",
|
|
@@ -332,7 +332,7 @@ const L = {
|
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
},
|
|
335
|
+
}, A = {
|
|
336
336
|
components: [N],
|
|
337
337
|
examples: {
|
|
338
338
|
basic: {
|
|
@@ -340,18 +340,17 @@ const L = {
|
|
|
340
340
|
examples: {
|
|
341
341
|
basic: {
|
|
342
342
|
react: i`
|
|
343
|
-
import {
|
|
343
|
+
import { SplitTag } from "@sps-woodland/tag";
|
|
344
344
|
|
|
345
345
|
function Component() {
|
|
346
346
|
return (
|
|
347
347
|
<>
|
|
348
|
-
<
|
|
349
|
-
<
|
|
350
|
-
<
|
|
351
|
-
<
|
|
352
|
-
<
|
|
353
|
-
<
|
|
354
|
-
<KeyValueTag className="mr-1" tagKey="Foo" value="1234" color="info" />
|
|
348
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="key" />
|
|
349
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="warning" />
|
|
350
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="error" />
|
|
351
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="pending" />
|
|
352
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="success" />
|
|
353
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="info" />
|
|
355
354
|
</>
|
|
356
355
|
);
|
|
357
356
|
}
|
|
@@ -364,18 +363,17 @@ const L = {
|
|
|
364
363
|
examples: {
|
|
365
364
|
basic: {
|
|
366
365
|
react: i`
|
|
367
|
-
import {
|
|
366
|
+
import { SplitTag } from "@sps-woodland/tag";
|
|
368
367
|
|
|
369
368
|
function Component() {
|
|
370
369
|
return (
|
|
371
370
|
<>
|
|
372
|
-
<
|
|
373
|
-
<
|
|
374
|
-
<
|
|
375
|
-
<
|
|
376
|
-
<
|
|
377
|
-
<
|
|
378
|
-
<KeyValueTag className="mr-1" tagKey="Foo" value="1234" color="info" icon />
|
|
371
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="key" icon />
|
|
372
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="warning" icon />
|
|
373
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="error" icon />
|
|
374
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="pending" icon />
|
|
375
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="success" icon />
|
|
376
|
+
<SplitTag className="mr-1" tagKey="Foo" value="1234" color="info" icon />
|
|
379
377
|
</>
|
|
380
378
|
);
|
|
381
379
|
}
|
|
@@ -388,11 +386,11 @@ const L = {
|
|
|
388
386
|
examples: {
|
|
389
387
|
basic: {
|
|
390
388
|
react: i`
|
|
391
|
-
import {
|
|
389
|
+
import { SplitTag } from "@sps-woodland/tag";
|
|
392
390
|
|
|
393
391
|
function Component() {
|
|
394
392
|
return (
|
|
395
|
-
<
|
|
393
|
+
<SplitTag tagKey="Foo" value="1234" icon href="https://www.google.com" />
|
|
396
394
|
);
|
|
397
395
|
}
|
|
398
396
|
`
|
|
@@ -403,12 +401,12 @@ const L = {
|
|
|
403
401
|
}, M = {
|
|
404
402
|
"Clickable Tags": L,
|
|
405
403
|
Tags: B,
|
|
406
|
-
"
|
|
404
|
+
"Split Tags": A
|
|
407
405
|
};
|
|
408
406
|
export {
|
|
409
|
-
|
|
410
|
-
N as KeyValueTag,
|
|
407
|
+
w as ClickableTag,
|
|
411
408
|
M as MANIFEST,
|
|
412
|
-
|
|
409
|
+
N as SplitTag,
|
|
410
|
+
p as Tag,
|
|
413
411
|
P as TagIcons
|
|
414
412
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
1
|
+
export declare const splitTag: string;
|
|
2
|
+
export declare const splitTagKey: string;
|
|
3
|
+
export declare const splitTagValue: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<{
|
|
4
4
|
href: {
|
|
5
5
|
true: {
|
|
6
6
|
cursor: "pointer";
|
|
@@ -31,4 +31,4 @@ export declare const keyValueTagValue: import("@vanilla-extract/recipes/dist/dec
|
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
}>;
|
|
34
|
-
export declare const
|
|
34
|
+
export declare const splitTagLink: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { ComponentProps } from "@sps-woodland/core";
|
|
3
3
|
import type { TagKind } from "../tag/Tag";
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function SplitTag({ children, className, color, href, icon, tagKey, value, ...rest }: ComponentProps<{
|
|
5
5
|
color: TagKind;
|
|
6
6
|
href?: string;
|
|
7
7
|
icon?: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ComponentManifestEntry } from "@sps-woodland/core";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const SplitTagExamples: ComponentManifestEntry;
|
package/lib/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._160drw10{border-radius:.125rem;display:inline-flex;color:#09638d;font-size:.75rem;font-weight:600;height:1.125rem;line-height:.75rem;max-width:100%}._160drw11{background-color:#e6f2f8}._160drw12{background-color:#e9e9ea}._160drw13{background-color:#fff;border-width:.0625rem;border-style:solid;border-color:#d2d4d4;color:#717779;cursor:not-allowed}._160drw15{border-radius:.125rem;flex-grow:1;flex-shrink:1;height:1.125rem;overflow:hidden;padding:.125rem .25rem;text-overflow:ellipsis;white-space:nowrap}._160drw16{cursor:pointer;text-decoration:underline}._160drw16:hover{color:#e6f2f8;background-color:#09638d;border-radius:.125rem}._160drw1c{border-top-left-radius:.125rem;border-top-right-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:.125rem}._160drw1d{border-top-left-radius:0;border-top-right-radius:.125rem;border-bottom-right-radius:.125rem;border-bottom-left-radius:0;color:#09638d;height:1.125rem;line-height:.75rem;padding:.125rem .25rem}._160drw1d:focus,._160drw1d:hover{background-color:#09638d;color:#e6f2f8;cursor:pointer}._160drw1e{cursor:pointer;font-size:.625rem;position:relative;text-decoration:none;top:-.0625rem;vertical-align:middle}span>._160drw1f{color:#09638d}span:hover>._160drw1f{color:#e6f2f8}._5f3efi0{border-radius:.125rem;display:inline-block;font-size:.75rem;font-weight:600;line-height:.75rem;overflow:hidden;padding:.125rem .25rem;text-align:left;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}._5f3efi1{background:#e9e9ea;color:#4b5356}._5f3efi2{background:#4b5356;color:#fff}._5f3efi3{background:#e7760b;color:#fff}._5f3efi4{background:#de002e;color:#fff}._5f3efi5{background:#91467f;color:#fff}._5f3efi6{background:#0b8940;color:#fff}._5f3efi7{background:#007db8;color:#fff}._5f3efi8{font-size:.75rem;line-height:.625rem;margin-right:.25rem}._5f3efi8:before{vertical-align:text-bottom}._5f3efi9{display:none}.
|
|
1
|
+
._160drw10{border-radius:.125rem;display:inline-flex;color:#09638d;font-size:.75rem;font-weight:600;height:1.125rem;line-height:.75rem;max-width:100%}._160drw11{background-color:#e6f2f8}._160drw12{background-color:#e9e9ea}._160drw13{background-color:#fff;border-width:.0625rem;border-style:solid;border-color:#d2d4d4;color:#717779;cursor:not-allowed}._160drw15{border-radius:.125rem;flex-grow:1;flex-shrink:1;height:1.125rem;overflow:hidden;padding:.125rem .25rem;text-overflow:ellipsis;white-space:nowrap}._160drw16{cursor:pointer;text-decoration:underline}._160drw16:hover{color:#e6f2f8;background-color:#09638d;border-radius:.125rem}._160drw1c{border-top-left-radius:.125rem;border-top-right-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:.125rem}._160drw1d{border-top-left-radius:0;border-top-right-radius:.125rem;border-bottom-right-radius:.125rem;border-bottom-left-radius:0;color:#09638d;height:1.125rem;line-height:.75rem;padding:.125rem .25rem}._160drw1d:focus,._160drw1d:hover{background-color:#09638d;color:#e6f2f8;cursor:pointer}._160drw1e{cursor:pointer;font-size:.625rem;position:relative;text-decoration:none;top:-.0625rem;vertical-align:middle}span>._160drw1f{color:#09638d}span:hover>._160drw1f{color:#e6f2f8}._5f3efi0{border-radius:.125rem;display:inline-block;font-size:.75rem;font-weight:600;line-height:.75rem;overflow:hidden;padding:.125rem .25rem;text-align:left;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}._5f3efi1{background:#e9e9ea;color:#4b5356}._5f3efi2{background:#4b5356;color:#fff}._5f3efi3{background:#e7760b;color:#fff}._5f3efi4{background:#de002e;color:#fff}._5f3efi5{background:#91467f;color:#fff}._5f3efi6{background:#0b8940;color:#fff}._5f3efi7{background:#007db8;color:#fff}._5f3efi8{font-size:.75rem;line-height:.625rem;margin-right:.25rem}._5f3efi8:before{vertical-align:text-bottom}._5f3efi9{display:none}._79ofse0{display:inline-block}._79ofse1{border-top-left-radius:.125rem;border-top-right-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:.125rem}._79ofse2{background:#ffffff;border-top-left-radius:0;border-top-right-radius:.125rem;border-bottom-right-radius:.125rem;border-bottom-left-radius:0;padding:.125rem .25rem;box-shadow:.0625rem 0 #e9e9ea inset,-.0625rem 0 #e9e9ea inset,0 .0625rem #e9e9ea inset,0 -.0625rem #e9e9ea inset}._79ofse3{cursor:pointer;text-decoration:underline;color:#4b5356}._79ofse6{box-shadow:.0625rem 0 #4b5356 inset,-.0625rem 0 #4b5356 inset,0 .0625rem #4b5356 inset,0 -.0625rem #4b5356 inset}._79ofse7{box-shadow:.0625rem 0 #e7760b inset,-.0625rem 0 #e7760b inset,0 .0625rem #e7760b inset,0 -.0625rem #e7760b inset}._79ofse8{box-shadow:.0625rem 0 #de002e inset,-.0625rem 0 #de002e inset,0 .0625rem #de002e inset,0 -.0625rem #de002e inset}._79ofse9{box-shadow:.0625rem 0 #91467f inset,-.0625rem 0 #91467f inset,0 .0625rem #91467f inset,0 -.0625rem #91467f inset}._79ofsea{box-shadow:.0625rem 0 #0b8940 inset,-.0625rem 0 #0b8940 inset,0 .0625rem #0b8940 inset,0 -.0625rem #0b8940 inset}._79ofseb{box-shadow:.0625rem 0 #007db8 inset,-.0625rem 0 #007db8 inset,0 .0625rem #007db8 inset,0 -.0625rem #007db8 inset}._79ofsec,._79ofsec:hover{color:#4b5356}
|
package/lib/tag/Tag.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { ComponentProps } from "@sps-woodland/core";
|
|
|
3
3
|
import type { IconName } from "@sps-woodland/tokens";
|
|
4
4
|
import type { RecipeVariants } from "@vanilla-extract/recipes";
|
|
5
5
|
import { tag } from "./Tag.css";
|
|
6
|
-
export type TagKind = Required<NonNullable<RecipeVariants<typeof tag>>>["kind"];
|
|
6
|
+
export declare type TagKind = Required<NonNullable<RecipeVariants<typeof tag>>>["kind"];
|
|
7
7
|
export declare const TagIcons: Record<TagKind, IconName>;
|
|
8
8
|
export declare function Tag({ children, className, kind, icon, ...rest }: ComponentProps<{
|
|
9
9
|
kind?: TagKind;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sps-woodland/tags",
|
|
3
3
|
"description": "SPS Woodland Design System tag components",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "8.0.0",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/SPSCommerce/woodland/tree/main/packages/@sps-woodland/cards",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"@spscommerce/utils": "^6.12.1",
|
|
30
30
|
"react": "^16.14.0",
|
|
31
31
|
"react-dom": "^16.14.0",
|
|
32
|
-
"@sps-woodland/core": "
|
|
33
|
-
"@sps-woodland/tokens": "
|
|
32
|
+
"@sps-woodland/core": "8.0.0",
|
|
33
|
+
"@sps-woodland/tokens": "8.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@spscommerce/utils": "^6.12.1",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"@vanilla-extract/recipes": "^0.2.5",
|
|
39
39
|
"react": "^16.14.0",
|
|
40
40
|
"react-dom": "^16.14.0",
|
|
41
|
-
"@sps-woodland/core": "
|
|
42
|
-
"@sps-woodland/tokens": "
|
|
41
|
+
"@sps-woodland/core": "8.0.0",
|
|
42
|
+
"@sps-woodland/tokens": "8.0.0"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "pnpm run build:js && pnpm run build:types",
|