@sps-woodland/filter-tiles 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/filter-tiles](https://github.com/SPSCommerce/woodland/tree/master/packages/@sps-woodland/filter-tiles#readme)
2
+
3
+ SPS Woodland Design System filter-tile and filter-tile-set components
@@ -0,0 +1,2 @@
1
+ import type { ComponentManifestEntry } from "@sps-woodland/core";
2
+ export declare const FilterTileExamples: ComponentManifestEntry;
@@ -0,0 +1,41 @@
1
+ import { Tokens } from "@sps-woodland/tokens";
2
+ export declare type FilterTileKind = keyof typeof Tokens.component["filter-tile"]["kind"];
3
+ export declare const tile: string;
4
+ export declare const tileBody: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<{
5
+ kind: {
6
+ general: {};
7
+ error: {};
8
+ success: {};
9
+ warning: {};
10
+ processing: {};
11
+ };
12
+ active: {
13
+ true: {};
14
+ };
15
+ }>;
16
+ export declare const tileValue: string;
17
+ export declare const tileTitle: string;
18
+ export declare const tileFooter: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<{
19
+ kind: {
20
+ general: {
21
+ backgroundColor: string;
22
+ };
23
+ error: {
24
+ backgroundColor: string;
25
+ };
26
+ success: {
27
+ backgroundColor: string;
28
+ };
29
+ warning: {
30
+ backgroundColor: string;
31
+ };
32
+ processing: {
33
+ backgroundColor: string;
34
+ };
35
+ };
36
+ active: {
37
+ true: {
38
+ height: string;
39
+ };
40
+ };
41
+ }>;
@@ -0,0 +1,8 @@
1
+ import type { ComponentProps } from "@sps-woodland/core";
2
+ import type { FilterTileKind } from "./FilterTile.css";
3
+ export declare function FilterTile({ value, title, active: isActiveProp, kind, className, ...rest }: ComponentProps<{
4
+ value: number;
5
+ title: string;
6
+ active?: boolean;
7
+ kind?: FilterTileKind;
8
+ }>): JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const tileSet: string;
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ import type { ComponentProps } from "@sps-woodland/core";
3
+ export declare function FilterTileSet({ className, children, ...rest }: ComponentProps<unknown, HTMLDivElement>): React.ReactElement;
@@ -0,0 +1,43 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const _=require("react"),c=require("@sps-woodland/core"),O=require("@spscommerce/utils");function T(e){if(e&&e.__esModule)return e;const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,i.get?i:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const n=T(_);function y(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function v(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),t.push.apply(t,i)}return t}function f(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?v(Object(t),!0).forEach(function(i){y(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):v(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}var F=(e,r,t)=>{for(var i of Object.keys(e)){var a;if(e[i]!==((a=r[i])!==null&&a!==void 0?a:t[i]))return!1}return!0},m=e=>r=>{var t=e.defaultClassName,i=f(f({},e.defaultVariants),r);for(var a in i){var u,o=(u=i[a])!==null&&u!==void 0?u:e.defaultVariants[a];if(o!=null){var l=o;typeof l=="boolean"&&(l=l===!0?"true":"false");var s=e.variantClassNames[a][l];s&&(t+=" "+s)}}for(var[p,b]of e.compoundVariants)F(p,i,e.defaultVariants)&&(t+=" "+b);return t},S="_1ub5g6g0",w=m({defaultClassName:"_1ub5g6g1",variantClassNames:{kind:{general:"_1ub5g6g2",error:"_1ub5g6g3",success:"_1ub5g6g4",warning:"_1ub5g6g5",processing:"_1ub5g6g6"},active:{true:"_1ub5g6g7"}},defaultVariants:{},compoundVariants:[[{kind:"general",active:!0},"_1ub5g6g8"],[{kind:"warning",active:!0},"_1ub5g6g9"],[{kind:"error",active:!0},"_1ub5g6ga"],[{kind:"processing",active:!0},"_1ub5g6gb"],[{kind:"success",active:!0},"_1ub5g6gc"]]}),j=m({defaultClassName:"_1ub5g6gf",variantClassNames:{kind:{general:"_1ub5g6gg",error:"_1ub5g6gh",success:"_1ub5g6gi",warning:"_1ub5g6gj",processing:"_1ub5g6gk"},active:{true:"_1ub5g6gl"}},defaultVariants:{kind:"general",active:!1},compoundVariants:[]}),P="_1ub5g6ge",E="_1ub5g6gd";function g({value:e,title:r,active:t,kind:i="general",className:a,...u}){const[o,l]=n.useState(!1),s=t||o;return n.createElement("div",{className:c.cl(S,a),...u},n.createElement("div",{className:w({kind:i,active:s}),onMouseOver:()=>l(!0),onMouseOut:()=>l(!1)},n.createElement("div",{className:E},e),n.createElement("div",{className:P},r)),n.createElement("div",{className:c.cl(j({active:s,kind:i}))}))}c.Metadata.set(g,{name:"Fitler tile",props:{value:{type:"number",required:!0},title:{type:"string",required:!0},active:{type:"boolean"},kind:{type:"FilterTileKind",default:"general"}}});var k="wqmu9d0";function d({className:e,children:r,...t}){return n.createElement("div",{className:c.cl(k,e),...t},r)}c.Metadata.set(d,{name:"Filter Tile Set"});const M={components:[g,d],examples:{basic:{label:"Filter Tiles",examples:{basic:{react:O.code`
2
+ import { FilterTile, FilterTileSet } from "@sps-woodland/filter-tiles";
3
+ function MyComponent() {
4
+ const data = [
5
+
6
+ {
7
+ value: 34,
8
+ title: 'Uncommitted - SPS Outreach Expiring'
9
+ },
10
+ {
11
+ value: 523,
12
+ title: 'Buying Org Review',
13
+ kind: "warning"
14
+ },
15
+ {
16
+ value: 7128,
17
+ title: 'Buying Org to Send Email',
18
+ kind: "error"
19
+ },
20
+ {
21
+ value: 19235,
22
+ title: 'Production Ready',
23
+ kind: "processing"
24
+ },
25
+ ];
26
+ const [activeTile, setActiveTile] = React.useState(null);
27
+
28
+ return (
29
+ <FilterTileSet>
30
+ {data.map(item => {
31
+ return <FilterTile
32
+ key={item.title}
33
+ value={item.value}
34
+ title={item.title}
35
+ kind={item.kind}
36
+ active={item.title === activeTile}
37
+ onClick={() => setActiveTile(item.title)} />
38
+ }
39
+ )}
40
+ </FilterTileSet>
41
+ );
42
+ }
43
+ `}}}}},N={"Filter Tiles":M};exports.FilterTile=g;exports.FilterTileSet=d;exports.MANIFEST=N;
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./filter-tile/FilterTile";
2
+ export * from "./filter-tile-set/FilterTileSet";
3
+ export * from "./manifest";
@@ -0,0 +1,163 @@
1
+ import * as n from "react";
2
+ import { Metadata as d, cl as o } from "@sps-woodland/core";
3
+ import { code as O } from "@spscommerce/utils";
4
+ function T(e, i, t) {
5
+ return i in e ? Object.defineProperty(e, i, {
6
+ value: t,
7
+ enumerable: !0,
8
+ configurable: !0,
9
+ writable: !0
10
+ }) : e[i] = t, e;
11
+ }
12
+ function g(e, i) {
13
+ var t = Object.keys(e);
14
+ if (Object.getOwnPropertySymbols) {
15
+ var r = Object.getOwnPropertySymbols(e);
16
+ i && (r = r.filter(function(a) {
17
+ return Object.getOwnPropertyDescriptor(e, a).enumerable;
18
+ })), t.push.apply(t, r);
19
+ }
20
+ return t;
21
+ }
22
+ function v(e) {
23
+ for (var i = 1; i < arguments.length; i++) {
24
+ var t = arguments[i] != null ? arguments[i] : {};
25
+ i % 2 ? g(Object(t), !0).forEach(function(r) {
26
+ T(e, r, t[r]);
27
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : g(Object(t)).forEach(function(r) {
28
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
29
+ });
30
+ }
31
+ return e;
32
+ }
33
+ var y = (e, i, t) => {
34
+ for (var r of Object.keys(e)) {
35
+ var a;
36
+ if (e[r] !== ((a = i[r]) !== null && a !== void 0 ? a : t[r]))
37
+ return !1;
38
+ }
39
+ return !0;
40
+ }, m = (e) => (i) => {
41
+ var t = e.defaultClassName, r = v(v({}, e.defaultVariants), i);
42
+ for (var a in r) {
43
+ var u, c = (u = r[a]) !== null && u !== void 0 ? u : e.defaultVariants[a];
44
+ if (c != null) {
45
+ var l = c;
46
+ typeof l == "boolean" && (l = l === !0 ? "true" : "false");
47
+ var s = e.variantClassNames[a][l];
48
+ s && (t += " " + s);
49
+ }
50
+ }
51
+ for (var [b, _] of e.compoundVariants)
52
+ y(b, r, e.defaultVariants) && (t += " " + _);
53
+ return t;
54
+ }, F = "_1ub5g6g0", w = m({ defaultClassName: "_1ub5g6g1", variantClassNames: { kind: { general: "_1ub5g6g2", error: "_1ub5g6g3", success: "_1ub5g6g4", warning: "_1ub5g6g5", processing: "_1ub5g6g6" }, active: { true: "_1ub5g6g7" } }, defaultVariants: {}, compoundVariants: [[{ kind: "general", active: !0 }, "_1ub5g6g8"], [{ kind: "warning", active: !0 }, "_1ub5g6g9"], [{ kind: "error", active: !0 }, "_1ub5g6ga"], [{ kind: "processing", active: !0 }, "_1ub5g6gb"], [{ kind: "success", active: !0 }, "_1ub5g6gc"]] }), S = m({ defaultClassName: "_1ub5g6gf", variantClassNames: { kind: { general: "_1ub5g6gg", error: "_1ub5g6gh", success: "_1ub5g6gi", warning: "_1ub5g6gj", processing: "_1ub5g6gk" }, active: { true: "_1ub5g6gl" } }, defaultVariants: { kind: "general", active: !1 }, compoundVariants: [] }), E = "_1ub5g6ge", P = "_1ub5g6gd";
55
+ function f({
56
+ value: e,
57
+ title: i,
58
+ active: t,
59
+ kind: r = "general",
60
+ className: a,
61
+ ...u
62
+ }) {
63
+ const [c, l] = n.useState(!1), s = t || c;
64
+ return /* @__PURE__ */ n.createElement("div", {
65
+ className: o(F, a),
66
+ ...u
67
+ }, /* @__PURE__ */ n.createElement("div", {
68
+ className: w({ kind: r, active: s }),
69
+ onMouseOver: () => l(!0),
70
+ onMouseOut: () => l(!1)
71
+ }, /* @__PURE__ */ n.createElement("div", {
72
+ className: P
73
+ }, e), /* @__PURE__ */ n.createElement("div", {
74
+ className: E
75
+ }, i)), /* @__PURE__ */ n.createElement("div", {
76
+ className: o(S({ active: s, kind: r }))
77
+ }));
78
+ }
79
+ d.set(f, {
80
+ name: "Fitler tile",
81
+ props: {
82
+ value: { type: "number", required: !0 },
83
+ title: { type: "string", required: !0 },
84
+ active: { type: "boolean" },
85
+ kind: { type: "FilterTileKind", default: "general" }
86
+ }
87
+ });
88
+ var j = "wqmu9d0";
89
+ function p({
90
+ className: e,
91
+ children: i,
92
+ ...t
93
+ }) {
94
+ return /* @__PURE__ */ n.createElement("div", {
95
+ className: o(j, e),
96
+ ...t
97
+ }, i);
98
+ }
99
+ d.set(p, {
100
+ name: "Filter Tile Set"
101
+ });
102
+ const k = {
103
+ components: [f, p],
104
+ examples: {
105
+ basic: {
106
+ label: "Filter Tiles",
107
+ examples: {
108
+ basic: {
109
+ react: O`
110
+ import { FilterTile, FilterTileSet } from "@sps-woodland/filter-tiles";
111
+ function MyComponent() {
112
+ const data = [
113
+
114
+ {
115
+ value: 34,
116
+ title: 'Uncommitted - SPS Outreach Expiring'
117
+ },
118
+ {
119
+ value: 523,
120
+ title: 'Buying Org Review',
121
+ kind: "warning"
122
+ },
123
+ {
124
+ value: 7128,
125
+ title: 'Buying Org to Send Email',
126
+ kind: "error"
127
+ },
128
+ {
129
+ value: 19235,
130
+ title: 'Production Ready',
131
+ kind: "processing"
132
+ },
133
+ ];
134
+ const [activeTile, setActiveTile] = React.useState(null);
135
+
136
+ return (
137
+ <FilterTileSet>
138
+ {data.map(item => {
139
+ return <FilterTile
140
+ key={item.title}
141
+ value={item.value}
142
+ title={item.title}
143
+ kind={item.kind}
144
+ active={item.title === activeTile}
145
+ onClick={() => setActiveTile(item.title)} />
146
+ }
147
+ )}
148
+ </FilterTileSet>
149
+ );
150
+ }
151
+ `
152
+ }
153
+ }
154
+ }
155
+ }
156
+ }, C = {
157
+ "Filter Tiles": k
158
+ };
159
+ export {
160
+ f as FilterTile,
161
+ p as FilterTileSet,
162
+ C as MANIFEST
163
+ };
@@ -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
+ ._1ub5g6g0{height:6.625rem;max-width:15.625rem;min-width:6.875rem;flex:1;display:flex;flex-direction:column;justify-content:flex-end;margin-right:.25rem;margin-left:.25rem}._1ub5g6g0:first-child{margin-left:0}._1ub5g6g0:last-child{margin-right:0}._1ub5g6g1{padding:1rem;color:#1f282c;background-color:#fff;border-width:.0625rem;border-color:#d2d4d4;border-style:solid;border-top-left-radius:.25rem;border-top-right-radius:.25rem;cursor:pointer}._1ub5g6g8{border-color:#007db8}._1ub5g6g9{border-color:#e7760b}._1ub5g6ga{border-color:#de002e}._1ub5g6gb{border-color:#91467f}._1ub5g6gc{border-color:#0b8940}._1ub5g6gd{height:1.875rem;font-size:1.875rem;line-height:1.875rem;font-weight:600;text-align:center}._1ub5g6ge{height:2.25rem;font-size:.875rem;line-height:1.125rem;display:flex;justify-content:center;align-items:center;text-align:center}._1ub5g6gf{height:.25rem;transition:all .25s ease}._1ub5g6gg{background-color:#007db8}._1ub5g6gh{background-color:#de002e}._1ub5g6gi{background-color:#0b8940}._1ub5g6gj{background-color:#e7760b}._1ub5g6gk{background-color:#91467f}._1ub5g6gl{height:.5rem}.wqmu9d0{display:flex}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@sps-woodland/filter-tiles",
3
+ "description": "SPS Woodland Design System filter tile 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/filter-tiles",
8
+ "homepage": "https://github.com/SPSCommerce/woodland/tree/master/packages/@sps-woodland/filter-tiles#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
+ "@sps-woodland/core": "7.0.0",
17
+ "@sps-woodland/tokens": "7.0.0",
18
+ "@spscommerce/utils": "^6.12.1",
19
+ "react": "^16.9.0",
20
+ "react-dom": "^16.9.0"
21
+ },
22
+ "devDependencies": {
23
+ "@spscommerce/utils": "^6.12.1",
24
+ "@sps-woodland/core": "7.0.0",
25
+ "@sps-woodland/tokens": "7.0.0",
26
+ "@vanilla-extract/css": "^1.9.1",
27
+ "@vanilla-extract/recipes": "^0.2.5",
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
+ });