@dmsi/wedgekit-react 0.0.65 → 0.0.67

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.
@@ -0,0 +1,488 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __objRest = (source, exclude) => {
26
+ var target = {};
27
+ for (var prop in source)
28
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
+ target[prop] = source[prop];
30
+ if (source != null && __getOwnPropSymbols)
31
+ for (var prop of __getOwnPropSymbols(source)) {
32
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
+ target[prop] = source[prop];
34
+ }
35
+ return target;
36
+ };
37
+ var __export = (target, all) => {
38
+ for (var name in all)
39
+ __defProp(target, name, { get: all[name], enumerable: true });
40
+ };
41
+ var __copyProps = (to, from, except, desc) => {
42
+ if (from && typeof from === "object" || typeof from === "function") {
43
+ for (let key of __getOwnPropNames(from))
44
+ if (!__hasOwnProp.call(to, key) && key !== except)
45
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
46
+ }
47
+ return to;
48
+ };
49
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
50
+ // If the importer is in node compatibility mode or this is not an ESM
51
+ // file that has been converted to a CommonJS file using a Babel-
52
+ // compatible transform (i.e. "__esModule" has not been set), then set
53
+ // "default" to the CommonJS "module.exports" for node compatibility.
54
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
55
+ mod
56
+ ));
57
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
58
+
59
+ // src/components/Upload.tsx
60
+ var Upload_exports = {};
61
+ __export(Upload_exports, {
62
+ Upload: () => Upload
63
+ });
64
+ module.exports = __toCommonJS(Upload_exports);
65
+ var import_clsx5 = __toESM(require("clsx"), 1);
66
+
67
+ // src/classNames.ts
68
+ var import_clsx = __toESM(require("clsx"), 1);
69
+ var typography = {
70
+ display1: (0, import_clsx.default)(
71
+ "font-sans font-semibold",
72
+ "text-display-1-mobile desktop:text-display-1-desktop compact:text-display-1-desktop-compact",
73
+ "leading-display-1-mobile desktop:leading-display-1-desktop"
74
+ ),
75
+ display2: (0, import_clsx.default)(
76
+ "font-sans font-bold",
77
+ "text-display-2-mobile desktop:text-display-2-desktop compact:text-display-2-desktop-compact",
78
+ "leading-display-2-mobile desktop:leading-display-2-desktop"
79
+ ),
80
+ heading1: (0, import_clsx.default)(
81
+ "font-sans font-semibold",
82
+ "text-heading-1-mobile desktop:text-heading-1-desktop compact:text-heading-1-desktop-compact",
83
+ "leading-heading-1-mobile desktop:leading-heading-1-desktop"
84
+ ),
85
+ heading2: (0, import_clsx.default)(
86
+ "font-sans font-normal",
87
+ "text-heading-2-mobile desktop:text-heading-2-desktop compact:text-heading-2-desktop-compact",
88
+ "leading-heading-2-mobile desktop:leading-heading-2-desktop"
89
+ ),
90
+ heading3: (0, import_clsx.default)(
91
+ "font-sans font-semibold",
92
+ "text-heading-3-mobile desktop:text-heading-3-desktop compact:text-heading-3-desktop-compact",
93
+ "leading-heading-3-mobile desktop:leading-heading-3-desktop"
94
+ ),
95
+ subheader: (0, import_clsx.default)(
96
+ "font-sans font-semibold",
97
+ "text-subheader-mobile desktop:text-subheader-desktop compact:text-subheader-desktop-compact",
98
+ "leading-subheader-mobile desktop:leading-subheader-desktop"
99
+ ),
100
+ link: (0, import_clsx.default)(
101
+ "font-sans font-normal",
102
+ "text-link-mobile desktop:text-link-desktop compact:text-link-desktop-compact",
103
+ "leading-link-mobile desktop:leading-link-desktop"
104
+ ),
105
+ buttonLabel: (0, import_clsx.default)(
106
+ "font-sans font-semibold",
107
+ "text-label-mobile desktop:text-label-desktop compact:text-label-desktop-compact",
108
+ "leading-label-mobile desktop:leading-label-desktop"
109
+ ),
110
+ label: (0, import_clsx.default)(
111
+ "font-sans font-semibold",
112
+ "text-label-mobile desktop:text-label-desktop compact:text-label-desktop-compact",
113
+ "leading-label-mobile desktop:leading-label-desktop"
114
+ ),
115
+ paragraph: (0, import_clsx.default)(
116
+ "font-sans font-normal",
117
+ "text-paragraph-mobile desktop:text-paragraph-desktop compact:text-paragraph-desktop-compact",
118
+ "leading-paragraph-mobile desktop:leading-paragraph-desktop"
119
+ ),
120
+ caption: (0, import_clsx.default)(
121
+ "font-sans font-normal",
122
+ "text-caption-mobile desktop:text-caption-desktop compact:text-caption-desktop-compact",
123
+ "leading-caption-mobile desktop:leading-caption-desktop"
124
+ )
125
+ };
126
+ var baseTransition = (0, import_clsx.default)(
127
+ "transition-colors duration-100 ease-in-out"
128
+ );
129
+ var componentGap = (0, import_clsx.default)(
130
+ "gap-mobile-component-gap desktop:gap-desktop-component-gap compact:gap-desktop-compact-component-gap"
131
+ );
132
+ var paddingUsingComponentGap = (0, import_clsx.default)(
133
+ "p-mobile-component-gap desktop:p-desktop-component-gap compact:p-desktop-compact-component-gap"
134
+ );
135
+ var paddingXUsingLayoutGroupGap = (0, import_clsx.default)(
136
+ "px-mobile-layout-group-gap desktop:px-desktop-layout-group-gap compact:px-desktop-compact-layout-group-gap"
137
+ );
138
+ var paddingYUsingLayoutGroupGap = (0, import_clsx.default)(
139
+ "py-mobile-layout-group-gap desktop:py-desktop-layout-group-gap compact:py-desktop-compact-layout-group-gap"
140
+ );
141
+ var componentPadding = (0, import_clsx.default)(
142
+ "p-mobile-component-padding desktop:p-desktop-component-padding compact:p-desktop-compact-component-padding"
143
+ );
144
+ var componentPaddingBottom = (0, import_clsx.default)(
145
+ "pb-mobile-component-padding desktop:pb-desktop-component-padding compact:pb-desktop-compact-component-padding"
146
+ );
147
+ var componentPaddingX = (0, import_clsx.default)(
148
+ "px-mobile-component-padding desktop:px-desktop-component-padding compact:px-desktop-compact-component-padding"
149
+ );
150
+ var componentPaddingY = (0, import_clsx.default)(
151
+ "py-mobile-component-padding desktop:py-desktop-component-padding compact:py-desktop-compact-component-padding"
152
+ );
153
+ var componentPaddingXUsingComponentGap = (0, import_clsx.default)(
154
+ "px-mobile-component-gap desktop:px-desktop-component-gap compact:px-desktop-compact-component-gap"
155
+ );
156
+ var componentPaddingYUsingComponentGap = (0, import_clsx.default)(
157
+ "py-mobile-component-gap desktop:py-desktop-component-gap compact:py-desktop-compact-component-gap"
158
+ );
159
+ var componentPaddingMinusBorder = (0, import_clsx.default)(
160
+ "p-[calc(var(--spacing-mobile-component-padding)_-_1px)] desktop:p-[calc(var(--spacing-desktop-component-padding)_-_1px)] compact:p-[calc(var(--spacing-desktop-compact-component-padding)_-_1px)]"
161
+ );
162
+ var componentPaddingMinus2pxBorder = (0, import_clsx.default)(
163
+ "p-[calc(var(--spacing-mobile-component-padding)_-_2px)] desktop:p-[calc(var(--spacing-desktop-component-padding)_-_2px)] compact:p-[calc(var(--spacing-desktop-compact-component-padding)_-_2px)]"
164
+ );
165
+ var layoutPaddding = (0, import_clsx.default)(
166
+ "p-mobile-layout-padding desktop:p-desktop-layout-padding compact:p-desktop-compact-layout-padding"
167
+ );
168
+ var layoutPaddingBottom = (0, import_clsx.default)(
169
+ "pb-mobile-layout-padding desktop:pb-desktop-layout-padding compact:pb-desktop-compact-layout-padding"
170
+ );
171
+ var layoutPaddingY = (0, import_clsx.default)(
172
+ "py-mobile-layout-padding desktop:py-desktop-layout-padding compact:py-desktop-compact-layout-padding"
173
+ );
174
+ var containerPaddingX = (0, import_clsx.default)(
175
+ "px-mobile-container-padding desktop:px-desktop-container-padding compact:px-desktop-compact-container-padding"
176
+ );
177
+ var containerPaddingY = (0, import_clsx.default)(
178
+ "py-mobile-container-padding desktop:py-desktop-container-padding compact:py-desktop-compact-container-padding"
179
+ );
180
+ var layoutGroupGapPaddingY = (0, import_clsx.default)(
181
+ "py-mobile-layout-group-gap desktop:py-desktop-layout-group-gap compact:py-desktop-compact-layout-group-gap"
182
+ );
183
+ var layoutGroupGap = (0, import_clsx.default)(
184
+ "gap-mobile-layout-group-gap desktop:gap-desktop-layout-group-gap compact:gap-desktop-compact-layout-group-gap"
185
+ );
186
+ var layoutGap = (0, import_clsx.default)(
187
+ "gap-mobile-layout-gap desktop:gap-desktop-layout-gap compact:gap-desktop-compact-layout-gap"
188
+ );
189
+ var gapUsingContainerPadding = (0, import_clsx.default)(
190
+ "gap-mobile-container-padding desktop:gap-desktop-container-padding compact:gap-desktop-compact-container-padding"
191
+ );
192
+
193
+ // src/components/Icon.tsx
194
+ var import_clsx2 = __toESM(require("clsx"), 1);
195
+ var import_jsx_runtime = require("react/jsx-runtime");
196
+ function Icon(_a) {
197
+ var _b = _a, {
198
+ name,
199
+ size = 24,
200
+ variant = "outline"
201
+ } = _b, props = __objRest(_b, [
202
+ "name",
203
+ "size",
204
+ "variant"
205
+ ]);
206
+ const variantStyle = variant === "filled" ? '"FILL" 1' : '"FILL" 0';
207
+ const weightStyle = size === 16 ? '"wght" 400' : '"wght" 300';
208
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
209
+ "span",
210
+ __spreadProps(__spreadValues({}, props), {
211
+ className: (0, import_clsx2.default)(
212
+ "icon",
213
+ `icon-${size}`,
214
+ // size === 16 ? "font-normal" : "font-light", // size 16 font weight is not working as normal from before
215
+ props.className
216
+ ),
217
+ style: __spreadValues({
218
+ fontVariationSettings: variantStyle + `, ${weightStyle}`
219
+ }, props.style),
220
+ children: name
221
+ })
222
+ );
223
+ }
224
+
225
+ // src/components/Paragraph.tsx
226
+ var import_clsx3 = __toESM(require("clsx"), 1);
227
+ var import_jsx_runtime2 = require("react/jsx-runtime");
228
+ var Paragraph = (_a) => {
229
+ var _b = _a, {
230
+ className,
231
+ color,
232
+ padded,
233
+ align = "left",
234
+ tall,
235
+ addOverflow,
236
+ children,
237
+ as = "p",
238
+ id
239
+ } = _b, props = __objRest(_b, [
240
+ "className",
241
+ "color",
242
+ "padded",
243
+ "align",
244
+ "tall",
245
+ "addOverflow",
246
+ "children",
247
+ "as",
248
+ "id"
249
+ ]);
250
+ const Element = as;
251
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
252
+ Element,
253
+ __spreadProps(__spreadValues({
254
+ id
255
+ }, props), {
256
+ className: (0, import_clsx3.default)(
257
+ typography.paragraph,
258
+ className,
259
+ padded && componentPaddingXUsingComponentGap,
260
+ align === "left" && "text-left",
261
+ align === "center" && "text-center",
262
+ align === "right" && "text-right",
263
+ tall && "!leading-6",
264
+ addOverflow && "whitespace-nowrap text-ellipsis overflow-hidden"
265
+ ),
266
+ style: __spreadProps(__spreadValues({}, props.style), {
267
+ color: color ? `var(--color-${color})` : void 0
268
+ }),
269
+ children
270
+ })
271
+ );
272
+ };
273
+ Paragraph.displayName = "Paragraph";
274
+
275
+ // src/components/Button.tsx
276
+ var import_clsx4 = __toESM(require("clsx"), 1);
277
+ var import_jsx_runtime3 = require("react/jsx-runtime");
278
+ var Button = (_a) => {
279
+ var _b = _a, {
280
+ variant = "primary",
281
+ as = "button",
282
+ block,
283
+ leftIcon,
284
+ rightIcon,
285
+ className,
286
+ classNameLabel,
287
+ disabled = false,
288
+ children,
289
+ iconOnly = false,
290
+ colorClassName,
291
+ href,
292
+ id
293
+ } = _b, props = __objRest(_b, [
294
+ "variant",
295
+ "as",
296
+ "block",
297
+ "leftIcon",
298
+ "rightIcon",
299
+ "className",
300
+ "classNameLabel",
301
+ "disabled",
302
+ "children",
303
+ "iconOnly",
304
+ "colorClassName",
305
+ "href",
306
+ "id"
307
+ ]);
308
+ const primaryVariantStyles = variant === "primary" && (0, import_clsx4.default)(
309
+ (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
310
+ "bg-background-action-primary-normal border-background-action-primary-normal",
311
+ "hover:bg-background-action-primary-hover hover:border-background-action-primary-hover",
312
+ "focus:bg-background-action-primary-hover focus:border-background-action-primary-hover focus:outline-0",
313
+ "active:bg-background-action-primary-active active:border-background-action-primary-active",
314
+ "disabled:bg-background-action-primary-disabled disabled:border-background-action-primary-disabled disabled:text-text-on-action-primary-disabled"
315
+ );
316
+ const secondaryVariantStyles = variant === "secondary" && (0, import_clsx4.default)(
317
+ (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-primary-normal",
318
+ "bg-background-action-secondary-normal border-border-action-normal",
319
+ "hover:bg-background-action-secondary-hover hover:border-border-action-hover hover:text-text-action-primary-hover",
320
+ "focus:bg-background-action-secondary-hover focus:border-border-action-hover focus:text-text-action-primary-hover focus:outline-0",
321
+ "active:bg-background-action-secondary-active active:border-border-action-active active:text-text-action-primary-active",
322
+ "disabled:bg-background-action-primary-disabled disabled:border-border-action-disabled disabled:text-text-action-primary-disabled"
323
+ );
324
+ const tertiaryVariantStyles = variant === "tertiary" && (0, import_clsx4.default)(
325
+ "bg-transparent border-transparent",
326
+ iconOnly ? (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-icon-action-primary-normal" : (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-primary-normal",
327
+ "bg-transparent border-transparent",
328
+ "hover:bg-background-action-secondary-hover hover:border-background-action-secondary-hover hover:text-text-action-primary-hover",
329
+ "focus:bg-background-action-secondary-hover focus:border-background-action-secondary-hover focus:text-text-action-primary-hover focus:outline-0",
330
+ "active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
331
+ "disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
332
+ );
333
+ const primaryCriticalVariantStyles = variant === "primary-critical" && (0, import_clsx4.default)(
334
+ (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
335
+ "bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
336
+ "hover:bg-background-action-critical-primary-hover hover:border-background-action-critical-primary-hover",
337
+ "focus:bg-background-action-critical-primary-hover focus:border-background-action-critical-primary-hover focus:outline-0",
338
+ "active:bg-background-action-critical-primary-active active:border-background-action-critical-primary-active",
339
+ "disabled:bg-background-action-critical-primary-disabled disabled:border-background-action-critical-primary-disabled disabled:text-text-on-action-primary-disabled"
340
+ );
341
+ const secondaryCriticalVariantStyles = variant === "secondary-critical" && (0, import_clsx4.default)(
342
+ (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-critical-normal",
343
+ "bg-background-action-critical-secondary-normal border-border-action-critical-normal",
344
+ "hover:bg-background-action-critical-secondary-hover hover:border-border-action-critical-hover hover:text-text-action-critical-hover",
345
+ "focus:bg-background-action-critical-secondary-hover focus:border-border-action-critical-hover focus:text-text-action-critical-hover focus:outline-0",
346
+ "active:bg-background-action-critical-secondary-active active:border-border-action-critical-active active:text-text-action-critical-active",
347
+ "disabled:bg-background-action-critical-disabled disabled:border-border-action-critical-disabled disabled:text-text-action-critical-disabled"
348
+ );
349
+ const tertiaryCriticalVariantStyles = variant === "tertiary-critical" && (0, import_clsx4.default)(
350
+ (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-critical-normal",
351
+ "bg-transparent border-transparent text-text-action-critical-normal",
352
+ "hover:bg-background-action-critical-secondary-hover hover:border-background-action-critical-secondary-hover hover:text-text-action-critical-hover",
353
+ "focus:bg-background-action-critical-secondary-hover focus:border-background-action-critical-secondary-hover focus:text-text-action-critical-hover focus:outline-0",
354
+ "active:bg-background-action-critical-secondary-active active:border-background-action-critical-secondary-active active:text-text-action-critical-active",
355
+ "disabled:bg-transparent disabled:border-transparent disabled:text-text-action-critical-disabled"
356
+ );
357
+ const navigationVarianStyles = variant === "navigation" && (0, import_clsx4.default)(
358
+ (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
359
+ "bg-transparent",
360
+ "hover:bg-background-on-action-secondary-hover hover:text-brand-text-action-primary-hover",
361
+ // "hover:bg-background-action-secondary-hover hover:text-text-action-primary-hover", // Will use this once colors are finalized
362
+ "focus:bg-background-on-action-secondary-hover focus:text-brand-text-action-primary-hover focus:outline-0",
363
+ // "focus:bg-background-action-secondary-hover focus:text-text-action-primary-hover", // Will use this once colors are finalized
364
+ "active:bg-background-on-action-secondary-active active:text-brand-text-action-primary-active",
365
+ // "active:bg-background-action-secondary-active active:text-text-action-primary-active", // Will use this once colors are finalized
366
+ "disabled:bg-transparent disabled:text-text-on-action-primary-disabled",
367
+ "flex-col",
368
+ paddingUsingComponentGap
369
+ );
370
+ const notNavigationVariantStyles = variant !== "navigation" && (0, import_clsx4.default)("border-2 flex-row", componentPaddingMinus2pxBorder, componentGap);
371
+ const buttonClasses = (0, import_clsx4.default)(
372
+ disabled ? "cursor-default" : "cursor-pointer",
373
+ block ? "w-full" : "w-fit",
374
+ baseTransition,
375
+ "rounded-sm whitespace-nowrap inline-flex items-center justify-center group/btn",
376
+ primaryVariantStyles,
377
+ secondaryVariantStyles,
378
+ tertiaryVariantStyles,
379
+ primaryCriticalVariantStyles,
380
+ secondaryCriticalVariantStyles,
381
+ tertiaryCriticalVariantStyles,
382
+ navigationVarianStyles,
383
+ notNavigationVariantStyles,
384
+ className
385
+ );
386
+ const labelClasses = (0, import_clsx4.default)(
387
+ "min-h-6 flex items-center justify-center",
388
+ classNameLabel,
389
+ componentPaddingXUsingComponentGap,
390
+ typography.buttonLabel
391
+ );
392
+ const Element = href ? "a" : as;
393
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
394
+ Element,
395
+ __spreadProps(__spreadValues({
396
+ id,
397
+ type: Element === "button" ? "button" : void 0,
398
+ className: buttonClasses
399
+ }, props), {
400
+ disabled,
401
+ href,
402
+ children: [
403
+ leftIcon && leftIcon,
404
+ !iconOnly && children && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { id: id ? `${id}-label` : void 0, className: labelClasses, children }),
405
+ rightIcon && rightIcon
406
+ ]
407
+ })
408
+ );
409
+ };
410
+ Button.displayName = "Button";
411
+
412
+ // src/components/Upload.tsx
413
+ var import_jsx_runtime4 = require("react/jsx-runtime");
414
+ function Upload(props) {
415
+ const _a = props, {
416
+ isLoading,
417
+ style,
418
+ errorText,
419
+ text = "Upload your file",
420
+ value,
421
+ onRemove
422
+ } = _a, rest = __objRest(_a, [
423
+ "isLoading",
424
+ "style",
425
+ "errorText",
426
+ "text",
427
+ "value",
428
+ "onRemove"
429
+ ]);
430
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
431
+ "label",
432
+ {
433
+ style: __spreadValues({}, style),
434
+ className: (0, import_clsx5.default)(
435
+ "border border-dashed border-border-primary-normal",
436
+ "flex flex-col items-center justify-center",
437
+ "p-6",
438
+ "cursor-pointer",
439
+ "relative",
440
+ "w-full h-[166px] desktop:w-[340px] desktop:h-[190px]",
441
+ componentGap
442
+ ),
443
+ children: [
444
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
445
+ "input",
446
+ __spreadProps(__spreadValues({}, rest), {
447
+ type: "file",
448
+ className: "sr-only"
449
+ })
450
+ ),
451
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
452
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "cached", className: "text-icon-primary-normal animate-spin" }),
453
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Paragraph, { color: "text-secondary-normal", children: "Loading..." })
454
+ ] }),
455
+ !value && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
456
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "cloud_upload", className: "text-icon-primary-normal" }),
457
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Paragraph, { color: errorText ? "text-primary-error" : "text-secondary-normal", children: errorText ? errorText : text })
458
+ ] }),
459
+ value && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
460
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
461
+ "img",
462
+ {
463
+ src: value,
464
+ alt: "",
465
+ className: "absolute inset-0 object-contain object-center max-h-full max-w-full self-center justify-self-center"
466
+ }
467
+ ),
468
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "absolute right-2 top-2", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
469
+ Button,
470
+ {
471
+ onClick: (e) => {
472
+ e.preventDefault();
473
+ e.stopPropagation();
474
+ onRemove == null ? void 0 : onRemove();
475
+ },
476
+ iconOnly: true,
477
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "delete" })
478
+ }
479
+ ) })
480
+ ] })
481
+ ]
482
+ }
483
+ );
484
+ }
485
+ // Annotate the CommonJS export names for ESM import in node:
486
+ 0 && (module.exports = {
487
+ Upload
488
+ });
@@ -0,0 +1,95 @@
1
+ import {
2
+ Paragraph
3
+ } from "../chunk-VG4EPHJA.js";
4
+ import {
5
+ Button
6
+ } from "../chunk-MZJS2ZAU.js";
7
+ import {
8
+ Icon
9
+ } from "../chunk-IGQVA7SC.js";
10
+ import {
11
+ componentGap
12
+ } from "../chunk-RDLEIAQU.js";
13
+ import {
14
+ __objRest,
15
+ __spreadProps,
16
+ __spreadValues
17
+ } from "../chunk-ORMEWXMH.js";
18
+
19
+ // src/components/Upload.tsx
20
+ import clsx from "clsx";
21
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
22
+ function Upload(props) {
23
+ const _a = props, {
24
+ isLoading,
25
+ style,
26
+ errorText,
27
+ text = "Upload your file",
28
+ value,
29
+ onRemove
30
+ } = _a, rest = __objRest(_a, [
31
+ "isLoading",
32
+ "style",
33
+ "errorText",
34
+ "text",
35
+ "value",
36
+ "onRemove"
37
+ ]);
38
+ return /* @__PURE__ */ jsxs(
39
+ "label",
40
+ {
41
+ style: __spreadValues({}, style),
42
+ className: clsx(
43
+ "border border-dashed border-border-primary-normal",
44
+ "flex flex-col items-center justify-center",
45
+ "p-6",
46
+ "cursor-pointer",
47
+ "relative",
48
+ "w-full h-[166px] desktop:w-[340px] desktop:h-[190px]",
49
+ componentGap
50
+ ),
51
+ children: [
52
+ /* @__PURE__ */ jsx(
53
+ "input",
54
+ __spreadProps(__spreadValues({}, rest), {
55
+ type: "file",
56
+ className: "sr-only"
57
+ })
58
+ ),
59
+ isLoading && /* @__PURE__ */ jsxs(Fragment, { children: [
60
+ /* @__PURE__ */ jsx(Icon, { name: "cached", className: "text-icon-primary-normal animate-spin" }),
61
+ /* @__PURE__ */ jsx(Paragraph, { color: "text-secondary-normal", children: "Loading..." })
62
+ ] }),
63
+ !value && !isLoading && /* @__PURE__ */ jsxs(Fragment, { children: [
64
+ /* @__PURE__ */ jsx(Icon, { name: "cloud_upload", className: "text-icon-primary-normal" }),
65
+ /* @__PURE__ */ jsx(Paragraph, { color: errorText ? "text-primary-error" : "text-secondary-normal", children: errorText ? errorText : text })
66
+ ] }),
67
+ value && /* @__PURE__ */ jsxs(Fragment, { children: [
68
+ /* @__PURE__ */ jsx(
69
+ "img",
70
+ {
71
+ src: value,
72
+ alt: "",
73
+ className: "absolute inset-0 object-contain object-center max-h-full max-w-full self-center justify-self-center"
74
+ }
75
+ ),
76
+ /* @__PURE__ */ jsx("div", { className: "absolute right-2 top-2", children: /* @__PURE__ */ jsx(
77
+ Button,
78
+ {
79
+ onClick: (e) => {
80
+ e.preventDefault();
81
+ e.stopPropagation();
82
+ onRemove == null ? void 0 : onRemove();
83
+ },
84
+ iconOnly: true,
85
+ leftIcon: /* @__PURE__ */ jsx(Icon, { name: "delete" })
86
+ }
87
+ ) })
88
+ ] })
89
+ ]
90
+ }
91
+ );
92
+ }
93
+ export {
94
+ Upload
95
+ };
package/dist/index.css CHANGED
@@ -31,6 +31,7 @@
31
31
  --radius-md: 0.375rem;
32
32
  --radius-xl: 0.75rem;
33
33
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
34
+ --animate-spin: spin 1s linear infinite;
34
35
  --default-transition-duration: 150ms;
35
36
  --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
36
37
  --default-font-family: var(--font-sans);
@@ -532,6 +533,9 @@
532
533
  .top-0 {
533
534
  top: calc(var(--spacing) * 0);
534
535
  }
536
+ .top-2 {
537
+ top: calc(var(--spacing) * 2);
538
+ }
535
539
  .right-0 {
536
540
  right: calc(var(--spacing) * 0);
537
541
  }
@@ -740,6 +744,9 @@
740
744
  .h-\[120px\] {
741
745
  height: 120px;
742
746
  }
747
+ .h-\[166px\] {
748
+ height: 166px;
749
+ }
743
750
  .h-auto {
744
751
  height: auto;
745
752
  }
@@ -898,6 +905,9 @@
898
905
  .transform {
899
906
  transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);
900
907
  }
908
+ .animate-spin {
909
+ animation: var(--animate-spin);
910
+ }
901
911
  .\!cursor-default {
902
912
  cursor: default !important;
903
913
  }
@@ -1070,9 +1080,15 @@
1070
1080
  border-color: var(--color-neutral-500);
1071
1081
  }
1072
1082
  }
1083
+ .self-center {
1084
+ align-self: center;
1085
+ }
1073
1086
  .self-stretch {
1074
1087
  align-self: stretch;
1075
1088
  }
1089
+ .justify-self-center {
1090
+ justify-self: center;
1091
+ }
1076
1092
  .truncate {
1077
1093
  overflow: hidden;
1078
1094
  text-overflow: ellipsis;
@@ -1196,6 +1212,10 @@
1196
1212
  border-left-style: var(--tw-border-style);
1197
1213
  border-left-width: 1px;
1198
1214
  }
1215
+ .border-dashed {
1216
+ --tw-border-style: dashed;
1217
+ border-style: dashed;
1218
+ }
1199
1219
  .border-solid {
1200
1220
  --tw-border-style: solid;
1201
1221
  border-style: solid;
@@ -1728,6 +1748,12 @@
1728
1748
  --tw-gradient-to: transparent;
1729
1749
  --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
1730
1750
  }
1751
+ .object-contain {
1752
+ object-fit: contain;
1753
+ }
1754
+ .object-center {
1755
+ object-position: center;
1756
+ }
1731
1757
  .p-0\.5 {
1732
1758
  padding: calc(var(--spacing) * 0.5);
1733
1759
  }
@@ -1743,6 +1769,9 @@
1743
1769
  .p-4 {
1744
1770
  padding: calc(var(--spacing) * 4);
1745
1771
  }
1772
+ .p-6 {
1773
+ padding: calc(var(--spacing) * 6);
1774
+ }
1746
1775
  .p-\[calc\(var\(--spacing-mobile-component-padding\)_-_1px\)\] {
1747
1776
  padding: calc(var(--spacing-mobile-component-padding) - 1px);
1748
1777
  }
@@ -3792,6 +3821,11 @@
3792
3821
  display: none;
3793
3822
  }
3794
3823
  }
3824
+ .desktop\:h-\[190px\] {
3825
+ @container root (width >= 48rem) {
3826
+ height: 190px;
3827
+ }
3828
+ }
3795
3829
  .desktop\:h-auto {
3796
3830
  @container root (width >= 48rem) {
3797
3831
  height: auto;
@@ -3807,6 +3841,11 @@
3807
3841
  max-height: calc(100vh - 32px);
3808
3842
  }
3809
3843
  }
3844
+ .desktop\:w-\[340px\] {
3845
+ @container root (width >= 48rem) {
3846
+ width: 340px;
3847
+ }
3848
+ }
3810
3849
  .desktop\:w-full {
3811
3850
  @container root (width >= 48rem) {
3812
3851
  width: 100%;
@@ -4656,6 +4695,11 @@ body {
4656
4695
  @property --tw-contain-paint { syntax: "*"; inherits: false; }
4657
4696
  @property --tw-contain-style { syntax: "*"; inherits: false; }
4658
4697
  @property --tw-content { syntax: "*"; initial-value: ""; inherits: false; }
4698
+ @keyframes spin {
4699
+ to {
4700
+ transform: rotate(360deg);
4701
+ }
4702
+ }
4659
4703
  @layer properties {
4660
4704
  @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
4661
4705
  *,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dmsi/wedgekit-react",
3
3
  "private": false,
4
- "version": "0.0.65",
4
+ "version": "0.0.67",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsup",
@@ -0,0 +1,85 @@
1
+ import clsx from "clsx";
2
+ import { ComponentProps, MouseEvent } from "react";
3
+ import { componentGap } from "../classNames";
4
+ import { Icon } from "./Icon";
5
+ import { Paragraph } from "./Paragraph";
6
+ import { Button } from "./Button";
7
+
8
+ export type UploadProps = {
9
+ isLoading?: boolean;
10
+ text?: string;
11
+ errorText?: string;
12
+ onRemove?: () => void;
13
+ } & ComponentProps<"input">;
14
+
15
+ export function Upload(props: UploadProps) {
16
+ const {
17
+ isLoading,
18
+ style,
19
+ errorText,
20
+ text = 'Upload your file',
21
+ value,
22
+ onRemove,
23
+ ...rest
24
+ } = props;
25
+
26
+ return (
27
+ <label
28
+ style={{
29
+ ...style,
30
+ }}
31
+ className={clsx(
32
+ "border border-dashed border-border-primary-normal",
33
+ "flex flex-col items-center justify-center",
34
+ "p-6",
35
+ "cursor-pointer",
36
+ "relative",
37
+ "w-full h-[166px] desktop:w-[340px] desktop:h-[190px]",
38
+ componentGap,
39
+ )}
40
+ >
41
+ <input
42
+ {...rest}
43
+ type="file"
44
+ className="sr-only"
45
+ />
46
+
47
+ {isLoading && (
48
+ <>
49
+ <Icon name="cached" className="text-icon-primary-normal animate-spin" />
50
+ <Paragraph color="text-secondary-normal">Loading...</Paragraph>
51
+ </>
52
+ )}
53
+
54
+ {!value && !isLoading && (
55
+ <>
56
+ <Icon name="cloud_upload" className="text-icon-primary-normal" />
57
+ <Paragraph color={errorText ? 'text-primary-error' : 'text-secondary-normal'}>{errorText ? errorText : text}</Paragraph>
58
+ </>
59
+ )}
60
+
61
+ {value && (
62
+ <>
63
+ <img
64
+ src={value as string}
65
+ alt=""
66
+ className="absolute inset-0 object-contain object-center max-h-full max-w-full self-center justify-self-center"
67
+ />
68
+
69
+ <div className="absolute right-2 top-2">
70
+ <Button
71
+ onClick={(e: MouseEvent) => {
72
+ e.preventDefault();
73
+ e.stopPropagation();
74
+
75
+ onRemove?.();
76
+ }}
77
+ iconOnly
78
+ leftIcon={<Icon name="delete" />}
79
+ />
80
+ </div>
81
+ </>
82
+ )}
83
+ </label>
84
+ )
85
+ }