@sps-woodland/photo 8.0.0-rc1

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/photo](https://github.com/SPSCommerce/woodland/tree/master/packages/@sps-woodland/photo#readme)
2
+
3
+ SPS Woodland Design System photo component
@@ -0,0 +1,11 @@
1
+ import { Tokens } from "@sps-woodland/tokens";
2
+ import type { VariantDefinitions, RecipeVariant, BooleanRecipeVariant } from "@sps-woodland/core";
3
+ export declare type PhotoDisplayMode = keyof typeof Tokens.component.photo["display-mode"];
4
+ interface PhotoVariantDefinition extends VariantDefinitions {
5
+ mode: RecipeVariant<PhotoDisplayMode>;
6
+ placeholder: BooleanRecipeVariant;
7
+ }
8
+ export declare const photoWrapper: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<Pick<PhotoVariantDefinition, "placeholder">>;
9
+ export declare const photo: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<Pick<PhotoVariantDefinition, "mode">>;
10
+ export declare const photoPlaceholder: string;
11
+ export {};
package/lib/Photo.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import { ComponentProps } from "@sps-woodland/core";
3
+ import { IconName } from "@sps-woodland/tokens";
4
+ import type { PhotoDisplayMode } from "./Photo.css";
5
+ export declare function Photo({ className, src, altText, mode, placeholderIcon, ...rest }: ComponentProps<{
6
+ src?: string;
7
+ altText?: string;
8
+ mode?: PhotoDisplayMode;
9
+ placeholderIcon?: IconName;
10
+ }, HTMLDivElement>): React.ReactElement;
@@ -0,0 +1,2 @@
1
+ import type { ComponentManifestEntry } from "@sps-woodland/core";
2
+ export declare const PhotoExamples: ComponentManifestEntry;
@@ -0,0 +1,126 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=require("react"),h=require("@sps-woodland/core"),u=require("@spscommerce/utils");function R(e){if(e&&e.__esModule)return e;const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const a=R(x);function F(e,o,t){return o in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t,e}function b(e,o){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);o&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,r)}return t}function C(e){for(var o=1;o<arguments.length;o++){var t=arguments[o]!=null?arguments[o]:{};o%2?b(Object(t),!0).forEach(function(r){F(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):b(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}var M=(e,o,t)=>{for(var r of Object.keys(e)){var n;if(e[r]!==((n=o[r])!==null&&n!==void 0?n:t[r]))return!1}return!0},N=e=>o=>{var t=e.defaultClassName,r=C(C({},e.defaultVariants),o);for(var n in r){var f,p=(f=r[n])!==null&&f!==void 0?f:e.defaultVariants[n];if(p!=null){var i=p;typeof i=="boolean"&&(i=i===!0?"true":"false");var s=e.variantClassNames[n][i];s&&(t+=" "+s)}}for(var[l,d]of e.compoundVariants)M(l,r,e.defaultVariants)&&(t+=" "+d);return t},V=N({defaultClassName:"_1ofindv3",variantClassNames:{mode:{fill:"_1ofindv4",fit:"_1ofindv5"}},defaultVariants:{mode:"fill"},compoundVariants:[]}),z="_1ofindv6",T=N({defaultClassName:"_1ofindv0",variantClassNames:{placeholder:{true:"_1ofindv1",false:"_1ofindv2"}},defaultVariants:{placeholder:!1},compoundVariants:[]});function v({className:e,src:o,altText:t,mode:r="fill",placeholderIcon:n="photo",...f}){const p=a.useRef(null),i=a.useRef(null),s=a.useRef(null),l=a.useRef(null),[d,y]=a.useState(),[O,I]=a.useState(!1);a.useEffect(()=>{i.current&&(s.current&&(window.clearInterval(s.current),s.current=null),s.current=window.setInterval(()=>{if(i.current){const c=i.current.getBoundingClientRect();if(c.height){s.current&&(window.clearInterval(s.current),s.current=null);let m=!0;m=c.width/c.height>1,I(m===(r==="fit"))}}},1e3/60))},[p.current,i.current,o]),a.useEffect(()=>{l.current&&(window.clearInterval(l.current),l.current=null),l.current=window.setInterval(()=>{if(p.current){const c=p.current.getBoundingClientRect();c.width&&(j(c.width),l.current&&(window.clearInterval(l.current),l.current=null))}},1e3/60)},[p.current]);function j(c){var m,g,P;if(c){const w=((P=(g=(m=document==null?void 0:document.body)==null?void 0:m.parentElement)==null?void 0:g.style)==null?void 0:P.fontSize)||"16px",_=Number(w.substring(0,w.length-2));y(c/_)}}function E(){if(typeof d<"u")return d*.05}function S(){if(typeof d<"u")return .75*d}return a.createElement("div",{ref:p,className:h.cl(T({placeholder:!o}),e),style:{width:`${d}`&&`${d}rem`,fontSize:`${E()}rem`,height:`${S()}rem`},...f},o?d?a.createElement("img",{className:V({mode:O?"fit":"fill"}),ref:i,src:o,alt:t}):a.createElement("span",null):a.createElement(h.Icon,{className:z,icon:n}))}h.Metadata.set(v,{name:"Photo",props:{src:"string",altText:"string",mode:{type:'"fill" | "fit"',default:'"fill"'},placeholderIcon:"IconName"}});const W={components:[v],examples:{sizing:{label:"Sizing",description:"Photos are block elements, so a photo fills its container's width unless an explicit width is set. It is always a 4:3 aspect ratio. In this example, photos have been placed in cards which have different widths in the 12 column grid.",examples:{basic:{react:u.code`
2
+ import { Photo } from "@sps-woodland/photo";
3
+ import { Card } from "@sps-woodland/cards";
4
+
5
+ function Component () {
6
+ return (
7
+ <div className={grid.root}>
8
+ <div className={grid[2]}>
9
+ <Card>
10
+ <Photo src="assets/images/photo-landscape.jpg" />
11
+ </Card>
12
+ </div>
13
+ <div className={grid[4]}>
14
+ <Card>
15
+ <Photo src="assets/images/photo-landscape.jpg" />
16
+ </Card>
17
+ </div>
18
+ <div className={grid[6]}>
19
+ <Card>
20
+ <Photo src="assets/images/photo-landscape.jpg" />
21
+ </Card>
22
+ </div>
23
+ </div>
24
+ )
25
+ }
26
+ `}}},displayMode:{label:"Fill vs. Fit",description:()=>a.createElement("p",null,"There are two display modes available:",a.createElement("ul",null,a.createElement("li",null,a.createElement("b",null,'"fill"')," fills the entire 4:3 container, cropping off any excess portions of the image."),a.createElement("li",null,a.createElement("b",null,'"fit"')," fits the entire image into the container, leaving any excess portions of the container blank."))),examples:{landscape:{description:"Landscape oriented photo",react:u.code`
27
+ import { Photo } from "@sps-woodland/photo";
28
+ import { Card } from "@sps-woodland/cards";
29
+
30
+ function Component () {
31
+ return (
32
+ <div className={grid.root}>
33
+ <div className={grid[4]}>
34
+ <Card>
35
+ <Photo mode="fill" src="assets/images/photo-landscape.jpg" />
36
+ </Card>
37
+ </div>
38
+ <div className={grid[4]}>
39
+ <Card>
40
+ <Photo mode="fit" src="assets/images/photo-landscape.jpg" />
41
+ </Card>
42
+ </div>
43
+ </div>
44
+ )
45
+ }
46
+ `},portrait:{description:"Portrait oriented photo ",react:u.code`
47
+ import { Photo } from "@sps-woodland/photo";
48
+ import { Card } from "@sps-woodland/cards";
49
+
50
+ function Component () {
51
+ return (
52
+ <div className={grid.root}>
53
+ <div className={grid[4]}>
54
+ <Card>
55
+ <Photo mode="fill" src="assets/images/photo-portrait.jpg" />
56
+ </Card>
57
+ </div>
58
+ <div className={grid[4]}>
59
+ <Card>
60
+ <Photo mode="fit" src="assets/images/photo-portrait.jpg" />
61
+ </Card>
62
+ </div>
63
+ </div>
64
+ )
65
+ }
66
+ `}}},placeholder:{label:"Placeholders",description:"When an image is not provided for a particular use case (such as a user avatar, a company photo, item image, etc.), a placeholder should be shown in its place. The placeholder's icon, selected from our SPS icon set, should represent the type of image it is substituting for.",examples:{general:{description:"General Photo",react:u.code`
67
+ import { Photo } from "@sps-woodland/photo";
68
+
69
+ function Component () {
70
+ return (
71
+ <div className={grid.root}>
72
+ <div className={grid[3]}>
73
+ <Photo />
74
+ </div>
75
+ </div>
76
+ )
77
+ }
78
+ `},photoAlt:{description:"Photo Alt",react:u.code`
79
+ import { Photo } from "@sps-woodland/photo";
80
+
81
+ function Component () {
82
+ return (
83
+ <div className={grid.root}>
84
+ <div className={grid[3]}>
85
+ <Photo placeholderIcon="camera" />
86
+ </div>
87
+ </div>
88
+ )
89
+ }
90
+ `},user:{description:"User / Single Person",react:u.code`
91
+ import { Photo } from "@sps-woodland/photo";
92
+
93
+ function Component () {
94
+ return (
95
+ <div className={grid.root}>
96
+ <div className={grid[3]}>
97
+ <Photo placeholderIcon="user" />
98
+ </div>
99
+ </div>
100
+ )
101
+ }
102
+ `},group:{description:"Group / Multiple People",react:u.code`
103
+ import { Photo } from "@sps-woodland/photo";
104
+
105
+ function Component () {
106
+ return (
107
+ <div className={grid.root}>
108
+ <div className={grid[3]}>
109
+ <Photo placeholderIcon="group" />
110
+ </div>
111
+ </div>
112
+ )
113
+ }
114
+ `},company:{description:"Company / Building",react:u.code`
115
+ import { Photo } from "@sps-woodland/photo";
116
+
117
+ function Component () {
118
+ return (
119
+ <div className={grid.root}>
120
+ <div className={grid[3]}>
121
+ <Photo placeholderIcon="building" />
122
+ </div>
123
+ </div>
124
+ )
125
+ }
126
+ `}}}}},A={Photos:W};exports.MANIFEST=A;exports.Photo=v;
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./Photo";
2
+ export * from "./manifest";
@@ -0,0 +1,313 @@
1
+ import * as a from "react";
2
+ import { Metadata as S, cl as R, Icon as F } from "@sps-woodland/core";
3
+ import { code as u } from "@spscommerce/utils";
4
+ function V(e, t, o) {
5
+ return t in e ? Object.defineProperty(e, t, {
6
+ value: o,
7
+ enumerable: !0,
8
+ configurable: !0,
9
+ writable: !0
10
+ }) : e[t] = o, e;
11
+ }
12
+ function w(e, t) {
13
+ var o = Object.keys(e);
14
+ if (Object.getOwnPropertySymbols) {
15
+ var r = Object.getOwnPropertySymbols(e);
16
+ t && (r = r.filter(function(n) {
17
+ return Object.getOwnPropertyDescriptor(e, n).enumerable;
18
+ })), o.push.apply(o, r);
19
+ }
20
+ return o;
21
+ }
22
+ function P(e) {
23
+ for (var t = 1; t < arguments.length; t++) {
24
+ var o = arguments[t] != null ? arguments[t] : {};
25
+ t % 2 ? w(Object(o), !0).forEach(function(r) {
26
+ V(e, r, o[r]);
27
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(o)) : w(Object(o)).forEach(function(r) {
28
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(o, r));
29
+ });
30
+ }
31
+ return e;
32
+ }
33
+ var _ = (e, t, o) => {
34
+ for (var r of Object.keys(e)) {
35
+ var n;
36
+ if (e[r] !== ((n = t[r]) !== null && n !== void 0 ? n : o[r]))
37
+ return !1;
38
+ }
39
+ return !0;
40
+ }, C = (e) => (t) => {
41
+ var o = e.defaultClassName, r = P(P({}, e.defaultVariants), t);
42
+ for (var n in r) {
43
+ var m, p = (m = r[n]) !== null && m !== void 0 ? m : e.defaultVariants[n];
44
+ if (p != null) {
45
+ var i = p;
46
+ typeof i == "boolean" && (i = i === !0 ? "true" : "false");
47
+ var s = e.variantClassNames[n][i];
48
+ s && (o += " " + s);
49
+ }
50
+ }
51
+ for (var [l, d] of e.compoundVariants)
52
+ _(l, r, e.defaultVariants) && (o += " " + d);
53
+ return o;
54
+ }, z = C({ defaultClassName: "_1ofindv3", variantClassNames: { mode: { fill: "_1ofindv4", fit: "_1ofindv5" } }, defaultVariants: { mode: "fill" }, compoundVariants: [] }), W = "_1ofindv6", A = C({ defaultClassName: "_1ofindv0", variantClassNames: { placeholder: { true: "_1ofindv1", false: "_1ofindv2" } }, defaultVariants: { placeholder: !1 }, compoundVariants: [] });
55
+ function b({
56
+ className: e,
57
+ src: t,
58
+ altText: o,
59
+ mode: r = "fill",
60
+ placeholderIcon: n = "photo",
61
+ ...m
62
+ }) {
63
+ const p = a.useRef(null), i = a.useRef(null), s = a.useRef(null), l = a.useRef(null), [d, N] = a.useState(), [y, I] = a.useState(!1);
64
+ a.useEffect(() => {
65
+ i.current && (s.current && (window.clearInterval(s.current), s.current = null), s.current = window.setInterval(() => {
66
+ if (i.current) {
67
+ const c = i.current.getBoundingClientRect();
68
+ if (c.height) {
69
+ s.current && (window.clearInterval(s.current), s.current = null);
70
+ let f = !0;
71
+ f = c.width / c.height > 1, I(f === (r === "fit"));
72
+ }
73
+ }
74
+ }, 1e3 / 60));
75
+ }, [p.current, i.current, t]), a.useEffect(() => {
76
+ l.current && (window.clearInterval(l.current), l.current = null), l.current = window.setInterval(() => {
77
+ if (p.current) {
78
+ const c = p.current.getBoundingClientRect();
79
+ c.width && (O(c.width), l.current && (window.clearInterval(l.current), l.current = null));
80
+ }
81
+ }, 1e3 / 60);
82
+ }, [p.current]);
83
+ function O(c) {
84
+ var f, h, v;
85
+ if (c) {
86
+ const g = ((v = (h = (f = document == null ? void 0 : document.body) == null ? void 0 : f.parentElement) == null ? void 0 : h.style) == null ? void 0 : v.fontSize) || "16px", x = Number(g.substring(0, g.length - 2));
87
+ N(c / x);
88
+ }
89
+ }
90
+ function E() {
91
+ if (typeof d < "u")
92
+ return d * 0.05;
93
+ }
94
+ function j() {
95
+ if (typeof d < "u")
96
+ return 0.75 * d;
97
+ }
98
+ return /* @__PURE__ */ a.createElement("div", {
99
+ ref: p,
100
+ className: R(A({ placeholder: !t }), e),
101
+ style: {
102
+ width: `${d}` && `${d}rem`,
103
+ fontSize: `${E()}rem`,
104
+ height: `${j()}rem`
105
+ },
106
+ ...m
107
+ }, t ? d ? /* @__PURE__ */ a.createElement("img", {
108
+ className: z({ mode: y ? "fit" : "fill" }),
109
+ ref: i,
110
+ src: t,
111
+ alt: o
112
+ }) : /* @__PURE__ */ a.createElement("span", null) : /* @__PURE__ */ a.createElement(F, {
113
+ className: W,
114
+ icon: n
115
+ }));
116
+ }
117
+ S.set(b, {
118
+ name: "Photo",
119
+ props: {
120
+ src: "string",
121
+ altText: "string",
122
+ mode: {
123
+ type: '"fill" | "fit"',
124
+ default: '"fill"'
125
+ },
126
+ placeholderIcon: "IconName"
127
+ }
128
+ });
129
+ const D = {
130
+ components: [b],
131
+ examples: {
132
+ sizing: {
133
+ label: "Sizing",
134
+ description: "Photos are block elements, so a photo fills its container's width unless an explicit width is set. It is always a 4:3 aspect ratio. In this example, photos have been placed in cards which have different widths in the 12 column grid.",
135
+ examples: {
136
+ basic: {
137
+ react: u`
138
+ import { Photo } from "@sps-woodland/photo";
139
+ import { Card } from "@sps-woodland/cards";
140
+
141
+ function Component () {
142
+ return (
143
+ <div className={grid.root}>
144
+ <div className={grid[2]}>
145
+ <Card>
146
+ <Photo src="assets/images/photo-landscape.jpg" />
147
+ </Card>
148
+ </div>
149
+ <div className={grid[4]}>
150
+ <Card>
151
+ <Photo src="assets/images/photo-landscape.jpg" />
152
+ </Card>
153
+ </div>
154
+ <div className={grid[6]}>
155
+ <Card>
156
+ <Photo src="assets/images/photo-landscape.jpg" />
157
+ </Card>
158
+ </div>
159
+ </div>
160
+ )
161
+ }
162
+ `
163
+ }
164
+ }
165
+ },
166
+ displayMode: {
167
+ label: "Fill vs. Fit",
168
+ description: () => /* @__PURE__ */ a.createElement("p", null, "There are two display modes available:", /* @__PURE__ */ a.createElement("ul", null, /* @__PURE__ */ a.createElement("li", null, /* @__PURE__ */ a.createElement("b", null, '"fill"'), " fills the entire 4:3 container, cropping off any excess portions of the image."), /* @__PURE__ */ a.createElement("li", null, /* @__PURE__ */ a.createElement("b", null, '"fit"'), " fits the entire image into the container, leaving any excess portions of the container blank."))),
169
+ examples: {
170
+ landscape: {
171
+ description: "Landscape oriented photo",
172
+ react: u`
173
+ import { Photo } from "@sps-woodland/photo";
174
+ import { Card } from "@sps-woodland/cards";
175
+
176
+ function Component () {
177
+ return (
178
+ <div className={grid.root}>
179
+ <div className={grid[4]}>
180
+ <Card>
181
+ <Photo mode="fill" src="assets/images/photo-landscape.jpg" />
182
+ </Card>
183
+ </div>
184
+ <div className={grid[4]}>
185
+ <Card>
186
+ <Photo mode="fit" src="assets/images/photo-landscape.jpg" />
187
+ </Card>
188
+ </div>
189
+ </div>
190
+ )
191
+ }
192
+ `
193
+ },
194
+ portrait: {
195
+ description: "Portrait oriented photo ",
196
+ react: u`
197
+ import { Photo } from "@sps-woodland/photo";
198
+ import { Card } from "@sps-woodland/cards";
199
+
200
+ function Component () {
201
+ return (
202
+ <div className={grid.root}>
203
+ <div className={grid[4]}>
204
+ <Card>
205
+ <Photo mode="fill" src="assets/images/photo-portrait.jpg" />
206
+ </Card>
207
+ </div>
208
+ <div className={grid[4]}>
209
+ <Card>
210
+ <Photo mode="fit" src="assets/images/photo-portrait.jpg" />
211
+ </Card>
212
+ </div>
213
+ </div>
214
+ )
215
+ }
216
+ `
217
+ }
218
+ }
219
+ },
220
+ placeholder: {
221
+ label: "Placeholders",
222
+ description: "When an image is not provided for a particular use case (such as a user avatar, a company photo, item image, etc.), a placeholder should be shown in its place. The placeholder's icon, selected from our SPS icon set, should represent the type of image it is substituting for.",
223
+ examples: {
224
+ general: {
225
+ description: "General Photo",
226
+ react: u`
227
+ import { Photo } from "@sps-woodland/photo";
228
+
229
+ function Component () {
230
+ return (
231
+ <div className={grid.root}>
232
+ <div className={grid[3]}>
233
+ <Photo />
234
+ </div>
235
+ </div>
236
+ )
237
+ }
238
+ `
239
+ },
240
+ photoAlt: {
241
+ description: "Photo Alt",
242
+ react: u`
243
+ import { Photo } from "@sps-woodland/photo";
244
+
245
+ function Component () {
246
+ return (
247
+ <div className={grid.root}>
248
+ <div className={grid[3]}>
249
+ <Photo placeholderIcon="camera" />
250
+ </div>
251
+ </div>
252
+ )
253
+ }
254
+ `
255
+ },
256
+ user: {
257
+ description: "User / Single Person",
258
+ react: u`
259
+ import { Photo } from "@sps-woodland/photo";
260
+
261
+ function Component () {
262
+ return (
263
+ <div className={grid.root}>
264
+ <div className={grid[3]}>
265
+ <Photo placeholderIcon="user" />
266
+ </div>
267
+ </div>
268
+ )
269
+ }
270
+ `
271
+ },
272
+ group: {
273
+ description: "Group / Multiple People",
274
+ react: u`
275
+ import { Photo } from "@sps-woodland/photo";
276
+
277
+ function Component () {
278
+ return (
279
+ <div className={grid.root}>
280
+ <div className={grid[3]}>
281
+ <Photo placeholderIcon="group" />
282
+ </div>
283
+ </div>
284
+ )
285
+ }
286
+ `
287
+ },
288
+ company: {
289
+ description: "Company / Building",
290
+ react: u`
291
+ import { Photo } from "@sps-woodland/photo";
292
+
293
+ function Component () {
294
+ return (
295
+ <div className={grid.root}>
296
+ <div className={grid[3]}>
297
+ <Photo placeholderIcon="building" />
298
+ </div>
299
+ </div>
300
+ )
301
+ }
302
+ `
303
+ }
304
+ }
305
+ }
306
+ }
307
+ }, B = {
308
+ Photos: D
309
+ };
310
+ export {
311
+ B as MANIFEST,
312
+ b as Photo
313
+ };
@@ -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
+ ._1ofindv0{align-items:center;display:flex;justify-content:center;overflow:hidden;padding:0!important;vertical-align:middle}._1ofindv1{background:#f3f4f4;box-shadow:inset .0625rem 0 #d2d4d4,inset -.0625rem 0 #d2d4d4,inset 0 .0625rem #d2d4d4,inset 0 -.0625rem #d2d4d4,inset 1em 0 #fff,inset -1em 0 #fff,inset 0 1em #fff,inset 0 -1em #fff}._1ofindv3{visibility:hidden}._1ofindv4{height:100%;visibility:visible;width:auto}._1ofindv5{height:auto;visibility:visible;width:100%}._1ofindv6{flex:1;font-size:6em;text-align:center;color:#717779}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@sps-woodland/photo",
3
+ "description": "SPS Woodland Design System photo component",
4
+ "version": "8.0.0-rc1",
5
+ "author": "SPS Commerce",
6
+ "license": "UNLICENSED",
7
+ "repository": "https://github.com/SPSCommerce/woodland/tree/main/packages/@sps-woodland/photo",
8
+ "homepage": "https://github.com/SPSCommerce/woodland/tree/master/packages/@sps-woodland/photo#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
+ "react": "^16.9.0",
18
+ "react-dom": "^16.9.0",
19
+ "@sps-woodland/tokens": "8.0.0-rc1",
20
+ "@sps-woodland/core": "8.0.0-rc1"
21
+ },
22
+ "devDependencies": {
23
+ "@spscommerce/utils": "^6.12.1",
24
+ "@vanilla-extract/css": "^1.9.3",
25
+ "@vanilla-extract/recipes": "^0.2.5",
26
+ "react": "^16.9.0",
27
+ "react-dom": "^16.9.0",
28
+ "@sps-woodland/core": "8.0.0-rc1",
29
+ "@sps-woodland/tokens": "8.0.0-rc1"
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
+ });