@sps-woodland/matrix 8.18.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 +3 -0
- package/lib/Matrix.css.d.ts +4 -0
- package/lib/Matrix.d.ts +5 -0
- package/lib/Matrix.examples.d.ts +2 -0
- package/lib/MatrixBody.d.ts +3 -0
- package/lib/MatrixCell.d.ts +3 -0
- package/lib/MatrixHead.d.ts +3 -0
- package/lib/MatrixHeader.d.ts +8 -0
- package/lib/MatrixRow.d.ts +3 -0
- package/lib/index.cjs.js +261 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.es.js +395 -0
- package/lib/manifest.d.ts +2 -0
- package/lib/style.css +1 -0
- package/package.json +57 -0
- package/vite.config.mjs +21 -0
package/README.md
ADDED
package/lib/Matrix.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SpsTooltip } from "@spscommerce/ds-react";
|
|
3
|
+
import { ComponentProps, Icon } from "@sps-woodland/core";
|
|
4
|
+
export declare function MatrixHeader({ icon, tooltip, width, className, children, "data-testid": testId, ...rest }: ComponentProps<{
|
|
5
|
+
width?: string;
|
|
6
|
+
icon?: typeof Icon;
|
|
7
|
+
tooltip?: typeof SpsTooltip;
|
|
8
|
+
}, HTMLTableCellElement>): React.ReactElement;
|
package/lib/index.cjs.js
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),l=require("@sps-woodland/core"),o=require("@spscommerce/utils");function g(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(i,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return i.default=t,Object.freeze(i)}const e=g(a);var m="_67ajyb0",s="_67ajyb2",w="_67ajyb1",y="_67ajyb3";function d({title:t,children:i,"data-testid":r,...n}){return a.createElement("div",{className:l.cl(m),"data-testid":"matrix"},a.createElement(l.Title,{size:"lg"},t),a.createElement("table",{className:l.cl(m),"data-testid":`${r}`,...n},i))}l.Metadata.set(d,{name:"Matrix",props:{title:"string"}});function u({children:t,"data-testid":i,...r}){return a.createElement(a.Fragment,null,a.createElement("thead",{"data-testid":`${i}`,...r},t))}l.Metadata.set(u,{name:"Matrix Head"});function c({icon:t,tooltip:i,width:r,className:n,children:f,"data-testid":b,...p}){return a.createElement(a.Fragment,null,a.createElement("th",{className:l.cl(w),style:{width:`${r}`},"data-testid":`${b}`,...p},f,a.createElement("div",{className:l.cl(y)},t,i)))}l.Metadata.set(c,{name:"Matrix Header",props:{icon:"Icon",tooltip:"SpsTooltip",width:"string"}});function x({children:t,"data-testid":i,...r}){return a.createElement(a.Fragment,null,a.createElement("tbody",{"data-testid":`${i}`,...r},t))}l.Metadata.set(x,{name:"Matrix Body"});function h({children:t,"data-testid":i,...r}){return a.createElement(a.Fragment,null,a.createElement("tr",{"data-testid":`${i}`,...r},t))}l.Metadata.set(h,{name:"Matrix Row"});function M({className:t,children:i,"data-testid":r,...n}){return i!==void 0?i===null?a.createElement("td",{className:l.cl(s),"data-testid":`${r}`,...n},"null"):a.createElement("td",{className:l.cl(s),"data-testid":`${r}`,...n},i):a.createElement("td",{className:l.cl(s),"data-testid":`${r}`,...n},"—")}l.Metadata.set(M,{name:"Matrix Cell"});const H={components:[d,c],description:({NavigateTo:t})=>e.createElement(e.Fragment,null,e.createElement("p",null,"The Matrix component displays a grid of information utilizing a title on both the X- and Y-axes. It is an alternate to the ",e.createElement(t,{to:"tables"},"Table")," or ",e.createElement(t,{to:"description-lists"},"Description List")," for displaying a list of information where the value in each cell corresponds to both of its parent headers.")),examples:{general:{label:"General Usage",description:({NavigateTo:t})=>e.createElement(e.Fragment,null,e.createElement("p",null,"The decision to use a Matrix to visualize a grid of information, as opposed to a traditional Table or Description List, is largely subjective. The following guidelines provide a reliable framework for making the correct choice."),e.createElement("h5",null," When to Use "),e.createElement("ul",null,e.createElement("li",null," If the data set requires an identifier on both the X-axis and a Y-axis. "),e.createElement("li",null," If the data set requires six (6) or fewer columns (including the header column). "),e.createElement("li",null," If the data set is small, or if using a matrix is more aesthetically pleasing (without sacrificing functionality) than a table or description list. ")),e.createElement("h5",null," When Not to Use "),e.createElement("ul",null,e.createElement("li",null," If form elements are required, consider a ",e.createElement(t,{to:"tables"},"Table")," or ",e.createElement(t,{to:"description-lists"},"Description List"),". "),e.createElement("li",null," If the data set requires more than six (6) columns (including the header column), use a ",e.createElement(t,{to:"tables"},"Table")," instead. "),e.createElement("li",null," If the data needs to be searchable, filterable or sortable, use a ",e.createElement(t,{to:"tables"},"Table")," instead. ")),e.createElement("h5",null," Avoid Over-Crowding "),e.createElement("p",null," Use the following guidelines to determine the ideal maximum number of columns based on container width. Following these guidelines will preserve content readability. ")),examples:{general:{react:o.code`
|
|
2
|
+
import {
|
|
3
|
+
Matrix,
|
|
4
|
+
MatrixHead,
|
|
5
|
+
MatrixHeader,
|
|
6
|
+
MatrixRow,
|
|
7
|
+
MatrixCell,
|
|
8
|
+
} from "@sps-woodland/matrix";
|
|
9
|
+
|
|
10
|
+
function Component() {
|
|
11
|
+
return(
|
|
12
|
+
<Matrix>
|
|
13
|
+
<MatrixHead>
|
|
14
|
+
<MatrixRow>
|
|
15
|
+
<MatrixHeader></MatrixHeader>
|
|
16
|
+
<MatrixHeader>1/3 Width or smaller</MatrixHeader>
|
|
17
|
+
<MatrixHeader>1/2 Width</MatrixHeader>
|
|
18
|
+
<MatrixHeader>2/3 Width</MatrixHeader>
|
|
19
|
+
<MatrixHeader>3/4 Width</MatrixHeader>
|
|
20
|
+
<MatrixHeader>Full Width</MatrixHeader>
|
|
21
|
+
</MatrixRow>
|
|
22
|
+
</MatrixHead>
|
|
23
|
+
<MatrixBody>
|
|
24
|
+
<MatrixRow>
|
|
25
|
+
<MatrixHeader>Maximum Columns</MatrixHeader>
|
|
26
|
+
<MatrixCell>2</MatrixCell>
|
|
27
|
+
<MatrixCell>3</MatrixCell>
|
|
28
|
+
<MatrixCell>4</MatrixCell>
|
|
29
|
+
<MatrixCell>5</MatrixCell>
|
|
30
|
+
<MatrixCell>6</MatrixCell>
|
|
31
|
+
</MatrixRow>
|
|
32
|
+
</MatrixBody>
|
|
33
|
+
</Matrix>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
`}}},basic:{label:"Basic Matrix",description:e.createElement(e.Fragment,null,e.createElement("h5",null,"Matrix Characteristics"),e.createElement("ul",null,e.createElement("li",null," A header row across the top horizontal axis (X-axis). "),e.createElement("li",null," A header “column” along the left-most vertical axis (Y-axis). "),e.createElement("ul",null,e.createElement("li",null," A header row across the top horizontal axis (X-axis). "))),e.createElement("h5",null,"Matrix Rules"),e.createElement("ul",null,e.createElement("li",null," Non-header cells can contain any type of content. "),e.createElement("li",null," Text and content should remain left-aligned. "),e.createElement("li",null," Column widths are evenly divided amongst the horizontal space. "),e.createElement("li",null," A title describing the contents of the matrix is suggested but not required. "),e.createElement("ul",null,e.createElement("li",null,e.createElement("i",null,"Note: for accessibility reasons, a Matrix without a visible title should still include an HTML description for identification."))))),examples:{basic:{react:o.code`
|
|
37
|
+
import {
|
|
38
|
+
Matrix,
|
|
39
|
+
MatrixHead,
|
|
40
|
+
MatrixHeader,
|
|
41
|
+
MatrixRow,
|
|
42
|
+
MatrixCell,
|
|
43
|
+
} from "@sps-woodland/matrix";
|
|
44
|
+
import { Tag } from "@sps-woodland/tags";
|
|
45
|
+
import { Icon } from "@sps-woodland/core";
|
|
46
|
+
import { SpsTooltip } from "@spscommerce/ds-react";
|
|
47
|
+
|
|
48
|
+
function Component() {
|
|
49
|
+
const columnHeaders = ["", "Affiliation", "Lightsaber Color"];
|
|
50
|
+
const lightsaberUsers = [
|
|
51
|
+
{
|
|
52
|
+
user: "Ahsoka Tano",
|
|
53
|
+
affiliation: "Unaffiliated",
|
|
54
|
+
lightsaberColor: "white",
|
|
55
|
+
numberOfLightsabers: 2,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
user: "Anakin Skywalker",
|
|
59
|
+
affiliation: "Jedi",
|
|
60
|
+
lightsaberColor: "blue",
|
|
61
|
+
numberOfLightsabers: 1,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
user: "Darth Sidious",
|
|
65
|
+
affiliation: "Sith",
|
|
66
|
+
lightsaberColor: "red",
|
|
67
|
+
numberOfLightsabers: 1,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
user: "Darth Tyranus",
|
|
71
|
+
affiliation: "Sith",
|
|
72
|
+
lightsaberColor: "red",
|
|
73
|
+
numberOfLightsabers: 1,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
user: "Mace Windu",
|
|
77
|
+
affiliation: "Jedi",
|
|
78
|
+
lightsaberColor: "purple",
|
|
79
|
+
numberOfLightsabers: 1,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
user: "Maul",
|
|
83
|
+
affiliation: "Crimson Dawn",
|
|
84
|
+
lightsaberColor: "red",
|
|
85
|
+
numberOfLightsabers: 1,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
user: "Obi-Wan Kenobi",
|
|
89
|
+
affiliation: "Jedi",
|
|
90
|
+
lightsaberColor: "blue",
|
|
91
|
+
numberOfLightsabers: 1,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
user: "Yoda",
|
|
95
|
+
affiliation: "Jedi",
|
|
96
|
+
lightsaberColor: "green",
|
|
97
|
+
numberOfLightsabers: 1,
|
|
98
|
+
},
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
function darkSideIcon(index) {
|
|
102
|
+
return <Icon id={\`darkSide\${index}\`} className="red200" size="sm" icon="status-error"/>;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function darkSideTooltip(index) {
|
|
106
|
+
return <SpsTooltip for={\`darkSide\${index}\`}> The Dark Side </SpsTooltip>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function lightsaberFormatter(color, number) {
|
|
110
|
+
switch (color) {
|
|
111
|
+
case "white": return <Tag className="mr-1 mb-1">White</Tag>;
|
|
112
|
+
case "red": return <Tag className="mr-1 mb-1" kind="error">Red</Tag>;
|
|
113
|
+
case "purple": return <Tag className="mr-1 mb-1" kind="pending">Purple</Tag>;
|
|
114
|
+
case "green": return <Tag className="mr-1 mb-1" kind="success">Green</Tag>;
|
|
115
|
+
case "blue": return <Tag className="mr-1 mb-1" kind="info">Blue</Tag>;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return(
|
|
120
|
+
<Matrix
|
|
121
|
+
title="Lightsaber Users"
|
|
122
|
+
>
|
|
123
|
+
<MatrixHead>
|
|
124
|
+
<MatrixRow>
|
|
125
|
+
{ columnHeaders.map((object, index) => <MatrixHeader key={index}>{object}</MatrixHeader>) }
|
|
126
|
+
</MatrixRow>
|
|
127
|
+
</MatrixHead>
|
|
128
|
+
<MatrixBody>
|
|
129
|
+
{
|
|
130
|
+
lightsaberUsers.map((object, index) => {
|
|
131
|
+
return (
|
|
132
|
+
<MatrixRow key={index}>
|
|
133
|
+
{(object.affiliation === "Sith" || object.affiliation === "Crimson Dawn" ?
|
|
134
|
+
<MatrixHeader icon={darkSideIcon(index)} tooltip={darkSideTooltip(index)}> {object.user} </MatrixHeader> :
|
|
135
|
+
<MatrixHeader> {object.user} </MatrixHeader>)}
|
|
136
|
+
<MatrixCell> {object.affiliation} </MatrixCell>
|
|
137
|
+
<MatrixCell>
|
|
138
|
+
{lightsaberFormatter(object.lightsaberColor)}
|
|
139
|
+
{(object.numberOfLightsabers > 1 ? \`x\${object.numberOfLightsabers}\` : "")}
|
|
140
|
+
</MatrixCell>
|
|
141
|
+
</MatrixRow>
|
|
142
|
+
);
|
|
143
|
+
})
|
|
144
|
+
}
|
|
145
|
+
</MatrixBody>
|
|
146
|
+
</Matrix>
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
`}}},variations:{label:"Matrix Variations",examples:{customColumn:{description:e.createElement(e.Fragment,null,e.createElement("h5",null," Customizable Column Widths "),e.createElement("p",null,"Individual columns can be set to custom widths if desired. This can be done to one or all columns in the Matrix. Any columns without a specified custom width will divide the remaining horizontal space evenly.")),react:o.code`
|
|
150
|
+
import {
|
|
151
|
+
Matrix,
|
|
152
|
+
MatrixHead,
|
|
153
|
+
MatrixHeader,
|
|
154
|
+
MatrixRow,
|
|
155
|
+
MatrixCell,
|
|
156
|
+
} from "@sps-woodland/matrix";
|
|
157
|
+
|
|
158
|
+
function Component() {
|
|
159
|
+
const columnHeaders = ["", "Year", "Synopsis"];
|
|
160
|
+
const movies = [
|
|
161
|
+
{
|
|
162
|
+
title: "A New Hope",
|
|
163
|
+
year: 1977,
|
|
164
|
+
synopsis: "Princess Leia is captured and held hostage by the evil Imperial forces in their effort to take over the galactic Empire. Venturesome Luke Skywalker and dashing captain Han Solo team together with the loveable robot duo R2-D2 and C-3PO to rescue the beautiful princess and restore peace and justice in the Empire."
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
title: "The Empire Strikes Back",
|
|
168
|
+
year: 1980,
|
|
169
|
+
synopsis: "The epic saga continues as Luke Skywalker, in hopes of defeating the evil Galactic Empire, learns the ways of the Jedi from aging master Yoda. But Darth Vader is more determined than ever to capture Luke. Meanwhile, rebel leader Princess Leia, cocky Han Solo, Chewbacca, and droids C-3PO and R2-D2 are thrown into various stages of capture, betrayal and despair."
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
title: "Return of the Jedi",
|
|
173
|
+
year: 1983,
|
|
174
|
+
synopsis: "Luke Skywalker leads a mission to rescue his friend Han Solo from the clutches of Jabba the Hutt, while the Emperor seeks to destroy the Rebellion once and for all with a second dreaded Death Star."
|
|
175
|
+
}
|
|
176
|
+
];
|
|
177
|
+
|
|
178
|
+
return(
|
|
179
|
+
<Matrix
|
|
180
|
+
title="Star Wars: Original Trilogy"
|
|
181
|
+
>
|
|
182
|
+
<MatrixHead>
|
|
183
|
+
<MatrixRow>
|
|
184
|
+
<MatrixHeader> {columnHeaders[0]} </MatrixHeader>
|
|
185
|
+
<MatrixHeader width={"6%"}> {columnHeaders[1]} </MatrixHeader>
|
|
186
|
+
<MatrixHeader width={"70%"}> {columnHeaders[2]} </MatrixHeader>
|
|
187
|
+
</MatrixRow>
|
|
188
|
+
</MatrixHead>
|
|
189
|
+
<MatrixBody>
|
|
190
|
+
{
|
|
191
|
+
movies.map((object, index) => {
|
|
192
|
+
return (
|
|
193
|
+
<MatrixRow>
|
|
194
|
+
<MatrixHeader> {object.title} </MatrixHeader>
|
|
195
|
+
<MatrixCell> {object.year} </MatrixCell>
|
|
196
|
+
<MatrixCell> {object.synopsis} </MatrixCell>
|
|
197
|
+
</MatrixRow>
|
|
198
|
+
);
|
|
199
|
+
})
|
|
200
|
+
}
|
|
201
|
+
</MatrixBody>
|
|
202
|
+
</Matrix>
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
`},omitHeaderColumn:{description:e.createElement(e.Fragment,null,e.createElement("h5",null," Optional Left-hand Header Column "),e.createElement("p",null,"The left-hand Header Column can be omitted if desired. This option can apply to default- or customizable-width Matrix components.")),react:o.code`
|
|
206
|
+
import {
|
|
207
|
+
Matrix,
|
|
208
|
+
MatrixHead,
|
|
209
|
+
MatrixHeader,
|
|
210
|
+
MatrixRow,
|
|
211
|
+
MatrixCell,
|
|
212
|
+
} from "@sps-woodland/matrix";
|
|
213
|
+
|
|
214
|
+
function Component() {
|
|
215
|
+
const columnHeaders = ["Title", "Year", "Synopsis"];
|
|
216
|
+
const movies = [
|
|
217
|
+
{
|
|
218
|
+
title: "The Force Awakens",
|
|
219
|
+
year: 2015,
|
|
220
|
+
synopsis: "Thirty years after defeating the Galactic Empire, Han Solo and his allies face a new threat from the evil Kylo Ren and his army of Stormtroopers."
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
title: "The Last Jedi",
|
|
224
|
+
year: 2017,
|
|
225
|
+
synopsis: "Rey develops her newly discovered abilities with the guidance of Luke Skywalker, who is unsettled by the strength of her powers. Meanwhile, the Resistance prepares to do battle with the First Order."
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
title: "The Rise of Skywalker",
|
|
229
|
+
year: 2019,
|
|
230
|
+
synopsis: "The surviving Resistance faces the First Order once again as the journey of Rey, Finn and Poe Dameron continues. With the power and knowledge of generations behind them, the final battle begins."
|
|
231
|
+
}
|
|
232
|
+
];
|
|
233
|
+
|
|
234
|
+
return(
|
|
235
|
+
<Matrix
|
|
236
|
+
title="Star Wars: Sequel Trilogy"
|
|
237
|
+
>
|
|
238
|
+
<MatrixHead>
|
|
239
|
+
<MatrixRow>
|
|
240
|
+
<MatrixHeader> {columnHeaders[0]} </MatrixHeader>
|
|
241
|
+
<MatrixHeader width={"6%"}> {columnHeaders[1]} </MatrixHeader>
|
|
242
|
+
<MatrixHeader width={"70%"}> {columnHeaders[2]} </MatrixHeader>
|
|
243
|
+
</MatrixRow>
|
|
244
|
+
</MatrixHead>
|
|
245
|
+
<MatrixBody>
|
|
246
|
+
{
|
|
247
|
+
movies.map((object, index) => {
|
|
248
|
+
return (
|
|
249
|
+
<MatrixRow>
|
|
250
|
+
<MatrixCell> {object.title} </MatrixCell>
|
|
251
|
+
<MatrixCell> {object.year} </MatrixCell>
|
|
252
|
+
<MatrixCell> {object.synopsis} </MatrixCell>
|
|
253
|
+
</MatrixRow>
|
|
254
|
+
);
|
|
255
|
+
})
|
|
256
|
+
}
|
|
257
|
+
</MatrixBody>
|
|
258
|
+
</Matrix>
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
`}}}}},E={Matrix:H};exports.MANIFEST=E;exports.Matrix=d;exports.MatrixBody=x;exports.MatrixCell=M;exports.MatrixHead=u;exports.MatrixHeader=c;exports.MatrixRow=h;
|
package/lib/index.d.ts
ADDED
package/lib/index.es.js
ADDED
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
import t from "react";
|
|
3
|
+
import { Metadata as o, cl as l, Title as f } from "@sps-woodland/core";
|
|
4
|
+
import { code as s } from "@spscommerce/utils";
|
|
5
|
+
var c = "_67ajyb0", d = "_67ajyb2", p = "_67ajyb1", b = "_67ajyb3";
|
|
6
|
+
function m({
|
|
7
|
+
title: a,
|
|
8
|
+
children: r,
|
|
9
|
+
"data-testid": i,
|
|
10
|
+
...n
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ t.createElement(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
className: l(c),
|
|
16
|
+
"data-testid": "matrix"
|
|
17
|
+
},
|
|
18
|
+
/* @__PURE__ */ t.createElement(f, { size: "lg" }, a),
|
|
19
|
+
/* @__PURE__ */ t.createElement("table", { className: l(c), "data-testid": `${i}`, ...n }, r)
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
o.set(m, {
|
|
23
|
+
name: "Matrix",
|
|
24
|
+
props: {
|
|
25
|
+
title: "string"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
function g({
|
|
29
|
+
children: a,
|
|
30
|
+
"data-testid": r,
|
|
31
|
+
...i
|
|
32
|
+
}) {
|
|
33
|
+
return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("thead", { "data-testid": `${r}`, ...i }, a));
|
|
34
|
+
}
|
|
35
|
+
o.set(g, {
|
|
36
|
+
name: "Matrix Head"
|
|
37
|
+
});
|
|
38
|
+
function u({
|
|
39
|
+
icon: a,
|
|
40
|
+
tooltip: r,
|
|
41
|
+
width: i,
|
|
42
|
+
className: n,
|
|
43
|
+
children: x,
|
|
44
|
+
"data-testid": h,
|
|
45
|
+
...M
|
|
46
|
+
}) {
|
|
47
|
+
return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("th", { className: l(p), style: { width: `${i}` }, "data-testid": `${h}`, ...M }, x, /* @__PURE__ */ t.createElement("div", { className: l(b) }, a, r)));
|
|
48
|
+
}
|
|
49
|
+
o.set(u, {
|
|
50
|
+
name: "Matrix Header",
|
|
51
|
+
props: {
|
|
52
|
+
icon: "Icon",
|
|
53
|
+
tooltip: "SpsTooltip",
|
|
54
|
+
width: "string"
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
function w({
|
|
58
|
+
children: a,
|
|
59
|
+
"data-testid": r,
|
|
60
|
+
...i
|
|
61
|
+
}) {
|
|
62
|
+
return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("tbody", { "data-testid": `${r}`, ...i }, a));
|
|
63
|
+
}
|
|
64
|
+
o.set(w, {
|
|
65
|
+
name: "Matrix Body"
|
|
66
|
+
});
|
|
67
|
+
function H({
|
|
68
|
+
children: a,
|
|
69
|
+
"data-testid": r,
|
|
70
|
+
...i
|
|
71
|
+
}) {
|
|
72
|
+
return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("tr", { "data-testid": `${r}`, ...i }, a));
|
|
73
|
+
}
|
|
74
|
+
o.set(H, {
|
|
75
|
+
name: "Matrix Row"
|
|
76
|
+
});
|
|
77
|
+
function y({
|
|
78
|
+
className: a,
|
|
79
|
+
children: r,
|
|
80
|
+
"data-testid": i,
|
|
81
|
+
...n
|
|
82
|
+
}) {
|
|
83
|
+
return r !== void 0 ? r === null ? /* @__PURE__ */ t.createElement("td", { className: l(d), "data-testid": `${i}`, ...n }, "null") : /* @__PURE__ */ t.createElement("td", { className: l(d), "data-testid": `${i}`, ...n }, r) : /* @__PURE__ */ t.createElement("td", { className: l(d), "data-testid": `${i}`, ...n }, "—");
|
|
84
|
+
}
|
|
85
|
+
o.set(y, {
|
|
86
|
+
name: "Matrix Cell"
|
|
87
|
+
});
|
|
88
|
+
const E = {
|
|
89
|
+
components: [m, u],
|
|
90
|
+
description: ({ NavigateTo: a }) => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("p", null, "The Matrix component displays a grid of information utilizing a title on both the X- and Y-axes. It is an alternate to the ", /* @__PURE__ */ e.createElement(a, { to: "tables" }, "Table"), " or ", /* @__PURE__ */ e.createElement(a, { to: "description-lists" }, "Description List"), " for displaying a list of information where the value in each cell corresponds to both of its parent headers.")),
|
|
91
|
+
examples: {
|
|
92
|
+
general: {
|
|
93
|
+
label: "General Usage",
|
|
94
|
+
description: ({ NavigateTo: a }) => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("p", null, "The decision to use a Matrix to visualize a grid of information, as opposed to a traditional Table or Description List, is largely subjective. The following guidelines provide a reliable framework for making the correct choice."), /* @__PURE__ */ e.createElement("h5", null, " When to Use "), /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement("li", null, " If the data set requires an identifier on both the X-axis and a Y-axis. "), /* @__PURE__ */ e.createElement("li", null, " If the data set requires six (6) or fewer columns (including the header column). "), /* @__PURE__ */ e.createElement("li", null, " If the data set is small, or if using a matrix is more aesthetically pleasing (without sacrificing functionality) than a table or description list. ")), /* @__PURE__ */ e.createElement("h5", null, " When Not to Use "), /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement("li", null, " If form elements are required, consider a ", /* @__PURE__ */ e.createElement(a, { to: "tables" }, "Table"), " or ", /* @__PURE__ */ e.createElement(a, { to: "description-lists" }, "Description List"), ". "), /* @__PURE__ */ e.createElement("li", null, " If the data set requires more than six (6) columns (including the header column), use a ", /* @__PURE__ */ e.createElement(a, { to: "tables" }, "Table"), " instead. "), /* @__PURE__ */ e.createElement("li", null, " If the data needs to be searchable, filterable or sortable, use a ", /* @__PURE__ */ e.createElement(a, { to: "tables" }, "Table"), " instead. ")), /* @__PURE__ */ e.createElement("h5", null, " Avoid Over-Crowding "), /* @__PURE__ */ e.createElement("p", null, " Use the following guidelines to determine the ideal maximum number of columns based on container width. Following these guidelines will preserve content readability. ")),
|
|
95
|
+
examples: {
|
|
96
|
+
general: {
|
|
97
|
+
react: s`
|
|
98
|
+
import {
|
|
99
|
+
Matrix,
|
|
100
|
+
MatrixHead,
|
|
101
|
+
MatrixHeader,
|
|
102
|
+
MatrixRow,
|
|
103
|
+
MatrixCell,
|
|
104
|
+
} from "@sps-woodland/matrix";
|
|
105
|
+
|
|
106
|
+
function Component() {
|
|
107
|
+
return(
|
|
108
|
+
<Matrix>
|
|
109
|
+
<MatrixHead>
|
|
110
|
+
<MatrixRow>
|
|
111
|
+
<MatrixHeader></MatrixHeader>
|
|
112
|
+
<MatrixHeader>1/3 Width or smaller</MatrixHeader>
|
|
113
|
+
<MatrixHeader>1/2 Width</MatrixHeader>
|
|
114
|
+
<MatrixHeader>2/3 Width</MatrixHeader>
|
|
115
|
+
<MatrixHeader>3/4 Width</MatrixHeader>
|
|
116
|
+
<MatrixHeader>Full Width</MatrixHeader>
|
|
117
|
+
</MatrixRow>
|
|
118
|
+
</MatrixHead>
|
|
119
|
+
<MatrixBody>
|
|
120
|
+
<MatrixRow>
|
|
121
|
+
<MatrixHeader>Maximum Columns</MatrixHeader>
|
|
122
|
+
<MatrixCell>2</MatrixCell>
|
|
123
|
+
<MatrixCell>3</MatrixCell>
|
|
124
|
+
<MatrixCell>4</MatrixCell>
|
|
125
|
+
<MatrixCell>5</MatrixCell>
|
|
126
|
+
<MatrixCell>6</MatrixCell>
|
|
127
|
+
</MatrixRow>
|
|
128
|
+
</MatrixBody>
|
|
129
|
+
</Matrix>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
`
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
basic: {
|
|
137
|
+
label: "Basic Matrix",
|
|
138
|
+
description: /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h5", null, "Matrix Characteristics"), /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement("li", null, " A header row across the top horizontal axis (X-axis). "), /* @__PURE__ */ e.createElement("li", null, " A header “column” along the left-most vertical axis (Y-axis). "), /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement("li", null, " A header row across the top horizontal axis (X-axis). "))), /* @__PURE__ */ e.createElement("h5", null, "Matrix Rules"), /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement("li", null, " Non-header cells can contain any type of content. "), /* @__PURE__ */ e.createElement("li", null, " Text and content should remain left-aligned. "), /* @__PURE__ */ e.createElement("li", null, " Column widths are evenly divided amongst the horizontal space. "), /* @__PURE__ */ e.createElement("li", null, " A title describing the contents of the matrix is suggested but not required. "), /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement("li", null, /* @__PURE__ */ e.createElement("i", null, "Note: for accessibility reasons, a Matrix without a visible title should still include an HTML description for identification."))))),
|
|
139
|
+
examples: {
|
|
140
|
+
basic: {
|
|
141
|
+
react: s`
|
|
142
|
+
import {
|
|
143
|
+
Matrix,
|
|
144
|
+
MatrixHead,
|
|
145
|
+
MatrixHeader,
|
|
146
|
+
MatrixRow,
|
|
147
|
+
MatrixCell,
|
|
148
|
+
} from "@sps-woodland/matrix";
|
|
149
|
+
import { Tag } from "@sps-woodland/tags";
|
|
150
|
+
import { Icon } from "@sps-woodland/core";
|
|
151
|
+
import { SpsTooltip } from "@spscommerce/ds-react";
|
|
152
|
+
|
|
153
|
+
function Component() {
|
|
154
|
+
const columnHeaders = ["", "Affiliation", "Lightsaber Color"];
|
|
155
|
+
const lightsaberUsers = [
|
|
156
|
+
{
|
|
157
|
+
user: "Ahsoka Tano",
|
|
158
|
+
affiliation: "Unaffiliated",
|
|
159
|
+
lightsaberColor: "white",
|
|
160
|
+
numberOfLightsabers: 2,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
user: "Anakin Skywalker",
|
|
164
|
+
affiliation: "Jedi",
|
|
165
|
+
lightsaberColor: "blue",
|
|
166
|
+
numberOfLightsabers: 1,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
user: "Darth Sidious",
|
|
170
|
+
affiliation: "Sith",
|
|
171
|
+
lightsaberColor: "red",
|
|
172
|
+
numberOfLightsabers: 1,
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
user: "Darth Tyranus",
|
|
176
|
+
affiliation: "Sith",
|
|
177
|
+
lightsaberColor: "red",
|
|
178
|
+
numberOfLightsabers: 1,
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
user: "Mace Windu",
|
|
182
|
+
affiliation: "Jedi",
|
|
183
|
+
lightsaberColor: "purple",
|
|
184
|
+
numberOfLightsabers: 1,
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
user: "Maul",
|
|
188
|
+
affiliation: "Crimson Dawn",
|
|
189
|
+
lightsaberColor: "red",
|
|
190
|
+
numberOfLightsabers: 1,
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
user: "Obi-Wan Kenobi",
|
|
194
|
+
affiliation: "Jedi",
|
|
195
|
+
lightsaberColor: "blue",
|
|
196
|
+
numberOfLightsabers: 1,
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
user: "Yoda",
|
|
200
|
+
affiliation: "Jedi",
|
|
201
|
+
lightsaberColor: "green",
|
|
202
|
+
numberOfLightsabers: 1,
|
|
203
|
+
},
|
|
204
|
+
];
|
|
205
|
+
|
|
206
|
+
function darkSideIcon(index) {
|
|
207
|
+
return <Icon id={\`darkSide\${index}\`} className="red200" size="sm" icon="status-error"/>;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function darkSideTooltip(index) {
|
|
211
|
+
return <SpsTooltip for={\`darkSide\${index}\`}> The Dark Side </SpsTooltip>;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function lightsaberFormatter(color, number) {
|
|
215
|
+
switch (color) {
|
|
216
|
+
case "white": return <Tag className="mr-1 mb-1">White</Tag>;
|
|
217
|
+
case "red": return <Tag className="mr-1 mb-1" kind="error">Red</Tag>;
|
|
218
|
+
case "purple": return <Tag className="mr-1 mb-1" kind="pending">Purple</Tag>;
|
|
219
|
+
case "green": return <Tag className="mr-1 mb-1" kind="success">Green</Tag>;
|
|
220
|
+
case "blue": return <Tag className="mr-1 mb-1" kind="info">Blue</Tag>;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return(
|
|
225
|
+
<Matrix
|
|
226
|
+
title="Lightsaber Users"
|
|
227
|
+
>
|
|
228
|
+
<MatrixHead>
|
|
229
|
+
<MatrixRow>
|
|
230
|
+
{ columnHeaders.map((object, index) => <MatrixHeader key={index}>{object}</MatrixHeader>) }
|
|
231
|
+
</MatrixRow>
|
|
232
|
+
</MatrixHead>
|
|
233
|
+
<MatrixBody>
|
|
234
|
+
{
|
|
235
|
+
lightsaberUsers.map((object, index) => {
|
|
236
|
+
return (
|
|
237
|
+
<MatrixRow key={index}>
|
|
238
|
+
{(object.affiliation === "Sith" || object.affiliation === "Crimson Dawn" ?
|
|
239
|
+
<MatrixHeader icon={darkSideIcon(index)} tooltip={darkSideTooltip(index)}> {object.user} </MatrixHeader> :
|
|
240
|
+
<MatrixHeader> {object.user} </MatrixHeader>)}
|
|
241
|
+
<MatrixCell> {object.affiliation} </MatrixCell>
|
|
242
|
+
<MatrixCell>
|
|
243
|
+
{lightsaberFormatter(object.lightsaberColor)}
|
|
244
|
+
{(object.numberOfLightsabers > 1 ? \`x\${object.numberOfLightsabers}\` : "")}
|
|
245
|
+
</MatrixCell>
|
|
246
|
+
</MatrixRow>
|
|
247
|
+
);
|
|
248
|
+
})
|
|
249
|
+
}
|
|
250
|
+
</MatrixBody>
|
|
251
|
+
</Matrix>
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
`
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
variations: {
|
|
259
|
+
label: "Matrix Variations",
|
|
260
|
+
examples: {
|
|
261
|
+
customColumn: {
|
|
262
|
+
description: /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h5", null, " Customizable Column Widths "), /* @__PURE__ */ e.createElement("p", null, "Individual columns can be set to custom widths if desired. This can be done to one or all columns in the Matrix. Any columns without a specified custom width will divide the remaining horizontal space evenly.")),
|
|
263
|
+
react: s`
|
|
264
|
+
import {
|
|
265
|
+
Matrix,
|
|
266
|
+
MatrixHead,
|
|
267
|
+
MatrixHeader,
|
|
268
|
+
MatrixRow,
|
|
269
|
+
MatrixCell,
|
|
270
|
+
} from "@sps-woodland/matrix";
|
|
271
|
+
|
|
272
|
+
function Component() {
|
|
273
|
+
const columnHeaders = ["", "Year", "Synopsis"];
|
|
274
|
+
const movies = [
|
|
275
|
+
{
|
|
276
|
+
title: "A New Hope",
|
|
277
|
+
year: 1977,
|
|
278
|
+
synopsis: "Princess Leia is captured and held hostage by the evil Imperial forces in their effort to take over the galactic Empire. Venturesome Luke Skywalker and dashing captain Han Solo team together with the loveable robot duo R2-D2 and C-3PO to rescue the beautiful princess and restore peace and justice in the Empire."
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
title: "The Empire Strikes Back",
|
|
282
|
+
year: 1980,
|
|
283
|
+
synopsis: "The epic saga continues as Luke Skywalker, in hopes of defeating the evil Galactic Empire, learns the ways of the Jedi from aging master Yoda. But Darth Vader is more determined than ever to capture Luke. Meanwhile, rebel leader Princess Leia, cocky Han Solo, Chewbacca, and droids C-3PO and R2-D2 are thrown into various stages of capture, betrayal and despair."
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
title: "Return of the Jedi",
|
|
287
|
+
year: 1983,
|
|
288
|
+
synopsis: "Luke Skywalker leads a mission to rescue his friend Han Solo from the clutches of Jabba the Hutt, while the Emperor seeks to destroy the Rebellion once and for all with a second dreaded Death Star."
|
|
289
|
+
}
|
|
290
|
+
];
|
|
291
|
+
|
|
292
|
+
return(
|
|
293
|
+
<Matrix
|
|
294
|
+
title="Star Wars: Original Trilogy"
|
|
295
|
+
>
|
|
296
|
+
<MatrixHead>
|
|
297
|
+
<MatrixRow>
|
|
298
|
+
<MatrixHeader> {columnHeaders[0]} </MatrixHeader>
|
|
299
|
+
<MatrixHeader width={"6%"}> {columnHeaders[1]} </MatrixHeader>
|
|
300
|
+
<MatrixHeader width={"70%"}> {columnHeaders[2]} </MatrixHeader>
|
|
301
|
+
</MatrixRow>
|
|
302
|
+
</MatrixHead>
|
|
303
|
+
<MatrixBody>
|
|
304
|
+
{
|
|
305
|
+
movies.map((object, index) => {
|
|
306
|
+
return (
|
|
307
|
+
<MatrixRow>
|
|
308
|
+
<MatrixHeader> {object.title} </MatrixHeader>
|
|
309
|
+
<MatrixCell> {object.year} </MatrixCell>
|
|
310
|
+
<MatrixCell> {object.synopsis} </MatrixCell>
|
|
311
|
+
</MatrixRow>
|
|
312
|
+
);
|
|
313
|
+
})
|
|
314
|
+
}
|
|
315
|
+
</MatrixBody>
|
|
316
|
+
</Matrix>
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
`
|
|
320
|
+
},
|
|
321
|
+
omitHeaderColumn: {
|
|
322
|
+
description: /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h5", null, " Optional Left-hand Header Column "), /* @__PURE__ */ e.createElement("p", null, "The left-hand Header Column can be omitted if desired. This option can apply to default- or customizable-width Matrix components.")),
|
|
323
|
+
react: s`
|
|
324
|
+
import {
|
|
325
|
+
Matrix,
|
|
326
|
+
MatrixHead,
|
|
327
|
+
MatrixHeader,
|
|
328
|
+
MatrixRow,
|
|
329
|
+
MatrixCell,
|
|
330
|
+
} from "@sps-woodland/matrix";
|
|
331
|
+
|
|
332
|
+
function Component() {
|
|
333
|
+
const columnHeaders = ["Title", "Year", "Synopsis"];
|
|
334
|
+
const movies = [
|
|
335
|
+
{
|
|
336
|
+
title: "The Force Awakens",
|
|
337
|
+
year: 2015,
|
|
338
|
+
synopsis: "Thirty years after defeating the Galactic Empire, Han Solo and his allies face a new threat from the evil Kylo Ren and his army of Stormtroopers."
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
title: "The Last Jedi",
|
|
342
|
+
year: 2017,
|
|
343
|
+
synopsis: "Rey develops her newly discovered abilities with the guidance of Luke Skywalker, who is unsettled by the strength of her powers. Meanwhile, the Resistance prepares to do battle with the First Order."
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
title: "The Rise of Skywalker",
|
|
347
|
+
year: 2019,
|
|
348
|
+
synopsis: "The surviving Resistance faces the First Order once again as the journey of Rey, Finn and Poe Dameron continues. With the power and knowledge of generations behind them, the final battle begins."
|
|
349
|
+
}
|
|
350
|
+
];
|
|
351
|
+
|
|
352
|
+
return(
|
|
353
|
+
<Matrix
|
|
354
|
+
title="Star Wars: Sequel Trilogy"
|
|
355
|
+
>
|
|
356
|
+
<MatrixHead>
|
|
357
|
+
<MatrixRow>
|
|
358
|
+
<MatrixHeader> {columnHeaders[0]} </MatrixHeader>
|
|
359
|
+
<MatrixHeader width={"6%"}> {columnHeaders[1]} </MatrixHeader>
|
|
360
|
+
<MatrixHeader width={"70%"}> {columnHeaders[2]} </MatrixHeader>
|
|
361
|
+
</MatrixRow>
|
|
362
|
+
</MatrixHead>
|
|
363
|
+
<MatrixBody>
|
|
364
|
+
{
|
|
365
|
+
movies.map((object, index) => {
|
|
366
|
+
return (
|
|
367
|
+
<MatrixRow>
|
|
368
|
+
<MatrixCell> {object.title} </MatrixCell>
|
|
369
|
+
<MatrixCell> {object.year} </MatrixCell>
|
|
370
|
+
<MatrixCell> {object.synopsis} </MatrixCell>
|
|
371
|
+
</MatrixRow>
|
|
372
|
+
);
|
|
373
|
+
})
|
|
374
|
+
}
|
|
375
|
+
</MatrixBody>
|
|
376
|
+
</Matrix>
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
`
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}, R = {
|
|
385
|
+
Matrix: E
|
|
386
|
+
};
|
|
387
|
+
export {
|
|
388
|
+
R as MANIFEST,
|
|
389
|
+
m as Matrix,
|
|
390
|
+
w as MatrixBody,
|
|
391
|
+
y as MatrixCell,
|
|
392
|
+
g as MatrixHead,
|
|
393
|
+
u as MatrixHeader,
|
|
394
|
+
H as MatrixRow
|
|
395
|
+
};
|
package/lib/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._67ajyb0{width:100%;flex-direction:column;word-wrap:break-word;table-layout:fixed;overflow:hidden;border-radius:.125rem;font-size:.875rem}._67ajyb1{background-color:#f3f4f4;border-color:#d2d4d4;border-style:solid;border-width:.0625rem;padding:.5rem;vertical-align:top;line-height:1.25rem}._67ajyb2{border-style:solid;border-color:#d2d4d4;border-width:.0625rem;padding:.5rem;vertical-align:top}._67ajyb3{float:right}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sps-woodland/matrix",
|
|
3
|
+
"description": "SPS Woodland Design System Matrix component",
|
|
4
|
+
"version": "8.18.0",
|
|
5
|
+
"author": "SPS Commerce",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"repository": "https://github.com/SPSCommerce/woodland/tree/main/packages/@sps-woodland/matrix",
|
|
8
|
+
"homepage": "https://github.com/SPSCommerce/woodland/tree/master/packages/@sps-woodland/matrix#readme",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"module": "./lib/index.es.js",
|
|
11
|
+
"main": "./lib/index.cjs.js",
|
|
12
|
+
"types": "./lib/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./lib/index.es.js",
|
|
16
|
+
"require": "./lib/index.cjs.js",
|
|
17
|
+
"default": "./lib/index.cjs.js",
|
|
18
|
+
"types": "./lib/index.d.ts"
|
|
19
|
+
},
|
|
20
|
+
"./lib/style.css": {
|
|
21
|
+
"import": "./lib/style.css",
|
|
22
|
+
"require": "./lib/style.css"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@spscommerce/utils": "^7.0.0",
|
|
30
|
+
"react": "^16.14.0",
|
|
31
|
+
"react-dom": "^16.14.0",
|
|
32
|
+
"@sps-woodland/core": "8.18.0",
|
|
33
|
+
"@sps-woodland/tokens": "8.18.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@react-stately/collections": "^3.6.0",
|
|
37
|
+
"@spscommerce/utils": "^7.0.0",
|
|
38
|
+
"@vanilla-extract/css": "^1.9.3",
|
|
39
|
+
"react": "^16.14.0",
|
|
40
|
+
"react-dom": "^16.14.0",
|
|
41
|
+
"@sps-woodland/core": "8.18.0",
|
|
42
|
+
"@sps-woodland/tabs": "8.18.0",
|
|
43
|
+
"@sps-woodland/tokens": "8.18.0"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@spscommerce/ds-react": "^8.16.1",
|
|
47
|
+
"@spscommerce/ds-shared": "^8.16.1"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "pnpm run build:js && pnpm run build:types",
|
|
51
|
+
"build:js": "vite build",
|
|
52
|
+
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib",
|
|
53
|
+
"watch": "vite build --watch",
|
|
54
|
+
"clean": "git clean -fdX",
|
|
55
|
+
"pub": "node ../../../scripts/publish-package.mjs"
|
|
56
|
+
}
|
|
57
|
+
}
|
package/vite.config.mjs
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
|
+
});
|