@efiche/design 0.1.5 → 0.1.6
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/dist/index.cjs +87 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +0 -92
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +85 -40
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -54,7 +54,7 @@ __export(index_exports, {
|
|
|
54
54
|
Avatar: () => Avatar_default2,
|
|
55
55
|
Badge: () => Badge_default2,
|
|
56
56
|
Breadcrumb: () => Breadcrumb_default2,
|
|
57
|
-
Button: () =>
|
|
57
|
+
Button: () => Button_default,
|
|
58
58
|
Card: () => Card,
|
|
59
59
|
CardContent: () => CardContent,
|
|
60
60
|
CardDescription: () => CardDescription,
|
|
@@ -265,12 +265,39 @@ var Breadcrumb_default2 = Breadcrumb;
|
|
|
265
265
|
|
|
266
266
|
// src/components/Button/Button.tsx
|
|
267
267
|
var import_lucide_react4 = require("lucide-react");
|
|
268
|
-
|
|
269
|
-
// src/components/Button/Button.module.css
|
|
270
|
-
var Button_default = {};
|
|
271
|
-
|
|
272
|
-
// src/components/Button/Button.tsx
|
|
268
|
+
var import_react3 = require("react");
|
|
273
269
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
270
|
+
var variantStyles = {
|
|
271
|
+
solid: { backgroundColor: "var(--ds-primary, #3b82f6)", color: "#fff", borderColor: "transparent" },
|
|
272
|
+
outline: { backgroundColor: "transparent", color: "var(--ds-primary, #3b82f6)", borderColor: "var(--ds-primary, #3b82f6)" },
|
|
273
|
+
ghost: { backgroundColor: "var(--ds-muted, #f1f5f9)", color: "var(--ds-text-primary, #0f172a)", borderColor: "transparent" },
|
|
274
|
+
danger: { backgroundColor: "var(--ds-danger, #ef4444)", color: "#fff", borderColor: "transparent" },
|
|
275
|
+
warning: { backgroundColor: "var(--ds-warning, #f59e0b)", color: "#fff", borderColor: "transparent" },
|
|
276
|
+
info: { backgroundColor: "var(--ds-info, #3b82f6)", color: "#fff", borderColor: "transparent" },
|
|
277
|
+
success: { backgroundColor: "var(--ds-success, #22c55e)", color: "#fff", borderColor: "transparent" }
|
|
278
|
+
};
|
|
279
|
+
var variantHoverStyles = {
|
|
280
|
+
solid: { opacity: 0.88 },
|
|
281
|
+
outline: { backgroundColor: "var(--ds-muted, #f1f5f9)" },
|
|
282
|
+
ghost: { backgroundColor: "var(--ds-card, #ffffff)" },
|
|
283
|
+
danger: { opacity: 0.88 },
|
|
284
|
+
warning: { opacity: 0.88 },
|
|
285
|
+
info: { opacity: 0.88 },
|
|
286
|
+
success: { opacity: 0.88 }
|
|
287
|
+
};
|
|
288
|
+
var sizeStyles = {
|
|
289
|
+
sm: { padding: "0.25rem 0.625rem", fontSize: "0.8rem" },
|
|
290
|
+
md: { padding: "0.5rem 1rem", fontSize: "0.875rem" },
|
|
291
|
+
lg: { padding: "0.75rem 1.5rem", fontSize: "1rem" }
|
|
292
|
+
};
|
|
293
|
+
function injectSpinKeyframe() {
|
|
294
|
+
if (typeof document === "undefined") return;
|
|
295
|
+
if (document.getElementById("ds-spin-keyframe")) return;
|
|
296
|
+
const style = document.createElement("style");
|
|
297
|
+
style.id = "ds-spin-keyframe";
|
|
298
|
+
style.textContent = "@keyframes ds-spin { to { transform: rotate(360deg); } }";
|
|
299
|
+
document.head.appendChild(style);
|
|
300
|
+
}
|
|
274
301
|
var Button = (_a) => {
|
|
275
302
|
var _b = _a, {
|
|
276
303
|
text,
|
|
@@ -289,7 +316,7 @@ var Button = (_a) => {
|
|
|
289
316
|
small = false,
|
|
290
317
|
large = false,
|
|
291
318
|
size,
|
|
292
|
-
|
|
319
|
+
style: styleProp
|
|
293
320
|
} = _b, props = __objRest(_b, [
|
|
294
321
|
"text",
|
|
295
322
|
"children",
|
|
@@ -307,27 +334,45 @@ var Button = (_a) => {
|
|
|
307
334
|
"small",
|
|
308
335
|
"large",
|
|
309
336
|
"size",
|
|
310
|
-
"
|
|
337
|
+
"style"
|
|
311
338
|
]);
|
|
339
|
+
const [hovered, setHovered] = (0, import_react3.useState)(false);
|
|
340
|
+
(0, import_react3.useEffect)(() => {
|
|
341
|
+
injectSpinKeyframe();
|
|
342
|
+
}, []);
|
|
312
343
|
const resolvedVariant = variant != null ? variant : danger ? "danger" : warning ? "warning" : info ? "info" : success ? "success" : ghost ? "ghost" : outline ? "outline" : "solid";
|
|
313
344
|
const resolvedSize = size != null ? size : small ? "sm" : large ? "lg" : "md";
|
|
345
|
+
const isDisabled = disabled || loading;
|
|
314
346
|
const content = children != null ? children : text;
|
|
315
347
|
const showIcon = icon && !loading;
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
348
|
+
const computedStyle = __spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
349
|
+
display: "inline-flex",
|
|
350
|
+
alignItems: "center",
|
|
351
|
+
gap: "0.5rem",
|
|
352
|
+
border: "1px solid transparent",
|
|
353
|
+
borderRadius: "0.375rem",
|
|
354
|
+
fontWeight: 500,
|
|
355
|
+
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
356
|
+
transition: "opacity 0.15s, background-color 0.15s",
|
|
357
|
+
opacity: isDisabled ? 0.5 : 1,
|
|
358
|
+
pointerEvents: loading ? "none" : void 0
|
|
359
|
+
}, variantStyles[resolvedVariant]), sizeStyles[resolvedSize]), hovered && !isDisabled ? variantHoverStyles[resolvedVariant] : {}), styleProp);
|
|
323
360
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
324
361
|
"button",
|
|
325
362
|
__spreadProps(__spreadValues({
|
|
326
|
-
disabled:
|
|
327
|
-
|
|
363
|
+
disabled: isDisabled,
|
|
364
|
+
style: computedStyle,
|
|
365
|
+
onMouseEnter: () => setHovered(true),
|
|
366
|
+
onMouseLeave: () => setHovered(false)
|
|
328
367
|
}, props), {
|
|
329
368
|
children: [
|
|
330
|
-
loading ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
369
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
370
|
+
import_lucide_react4.LoaderCircle,
|
|
371
|
+
{
|
|
372
|
+
"aria-hidden": true,
|
|
373
|
+
style: { width: "1em", height: "1em", animation: "ds-spin 0.75s linear infinite" }
|
|
374
|
+
}
|
|
375
|
+
) : null,
|
|
331
376
|
showIcon && iconPosition === "left" ? icon : null,
|
|
332
377
|
content,
|
|
333
378
|
showIcon && iconPosition === "right" ? icon : null
|
|
@@ -335,7 +380,7 @@ var Button = (_a) => {
|
|
|
335
380
|
})
|
|
336
381
|
);
|
|
337
382
|
};
|
|
338
|
-
var
|
|
383
|
+
var Button_default = Button;
|
|
339
384
|
|
|
340
385
|
// src/components/Card/Card.module.css
|
|
341
386
|
var Card_default = {};
|
|
@@ -368,7 +413,7 @@ var CardFooter = (_a) => {
|
|
|
368
413
|
};
|
|
369
414
|
|
|
370
415
|
// src/components/Checkbox/Checkbox.tsx
|
|
371
|
-
var
|
|
416
|
+
var import_react4 = require("react");
|
|
372
417
|
|
|
373
418
|
// src/components/Checkbox/Checkbox.module.css
|
|
374
419
|
var Checkbox_default = {};
|
|
@@ -383,7 +428,7 @@ var Checkbox = ({
|
|
|
383
428
|
id,
|
|
384
429
|
onChange
|
|
385
430
|
}) => {
|
|
386
|
-
const [internal, setInternal] = (0,
|
|
431
|
+
const [internal, setInternal] = (0, import_react4.useState)(defaultChecked);
|
|
387
432
|
const isChecked = checked !== void 0 ? checked : internal;
|
|
388
433
|
const handleChange = () => {
|
|
389
434
|
if (disabled) return;
|
|
@@ -411,7 +456,7 @@ var Checkbox_default2 = Checkbox;
|
|
|
411
456
|
|
|
412
457
|
// src/components/CopyButton/CopyButton.tsx
|
|
413
458
|
var import_lucide_react5 = require("lucide-react");
|
|
414
|
-
var
|
|
459
|
+
var import_react5 = require("react");
|
|
415
460
|
|
|
416
461
|
// src/components/CopyButton/CopyButton.module.css
|
|
417
462
|
var CopyButton_default = {};
|
|
@@ -419,7 +464,7 @@ var CopyButton_default = {};
|
|
|
419
464
|
// src/components/CopyButton/CopyButton.tsx
|
|
420
465
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
421
466
|
var CopyButton = ({ text }) => {
|
|
422
|
-
const [copied, setCopied] = (0,
|
|
467
|
+
const [copied, setCopied] = (0, import_react5.useState)(false);
|
|
423
468
|
const handleCopy = () => {
|
|
424
469
|
navigator.clipboard.writeText(text);
|
|
425
470
|
setCopied(true);
|
|
@@ -439,7 +484,7 @@ var CopyButton_default2 = CopyButton;
|
|
|
439
484
|
|
|
440
485
|
// src/components/FileUpload/FileUpload.tsx
|
|
441
486
|
var import_lucide_react6 = require("lucide-react");
|
|
442
|
-
var
|
|
487
|
+
var import_react6 = require("react");
|
|
443
488
|
|
|
444
489
|
// src/components/FileUpload/FileUpload.module.css
|
|
445
490
|
var FileUpload_default = {};
|
|
@@ -447,9 +492,9 @@ var FileUpload_default = {};
|
|
|
447
492
|
// src/components/FileUpload/FileUpload.tsx
|
|
448
493
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
449
494
|
var FileUpload = ({ accept, multiple, disabled, onFileSelect }) => {
|
|
450
|
-
const [isDragging, setIsDragging] = (0,
|
|
451
|
-
const [fileNames, setFileNames] = (0,
|
|
452
|
-
const inputRef = (0,
|
|
495
|
+
const [isDragging, setIsDragging] = (0, import_react6.useState)(false);
|
|
496
|
+
const [fileNames, setFileNames] = (0, import_react6.useState)([]);
|
|
497
|
+
const inputRef = (0, import_react6.useRef)(null);
|
|
453
498
|
const handleFiles = (list) => {
|
|
454
499
|
setFileNames(Array.from(list).map((f) => f.name));
|
|
455
500
|
onFileSelect == null ? void 0 : onFileSelect(list);
|
|
@@ -547,10 +592,10 @@ var Label_default2 = Label;
|
|
|
547
592
|
|
|
548
593
|
// src/components/PasswordInput/PasswordInput.tsx
|
|
549
594
|
var import_lucide_react7 = require("lucide-react");
|
|
550
|
-
var
|
|
595
|
+
var import_react7 = require("react");
|
|
551
596
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
552
597
|
var PasswordInput = (props) => {
|
|
553
|
-
const [visible, setVisible] = (0,
|
|
598
|
+
const [visible, setVisible] = (0, import_react7.useState)(false);
|
|
554
599
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
555
600
|
Input_default2,
|
|
556
601
|
__spreadProps(__spreadValues({}, props), {
|
|
@@ -592,7 +637,7 @@ var Progress = ({ value = 0 }) => {
|
|
|
592
637
|
var Progress_default2 = Progress;
|
|
593
638
|
|
|
594
639
|
// src/components/RadioGroup/RadioGroup.tsx
|
|
595
|
-
var
|
|
640
|
+
var import_react8 = require("react");
|
|
596
641
|
|
|
597
642
|
// src/components/RadioGroup/RadioGroup.module.css
|
|
598
643
|
var RadioGroup_default = {};
|
|
@@ -607,7 +652,7 @@ var RadioGroup = ({
|
|
|
607
652
|
disabled,
|
|
608
653
|
onChange
|
|
609
654
|
}) => {
|
|
610
|
-
const [internal, setInternal] = (0,
|
|
655
|
+
const [internal, setInternal] = (0, import_react8.useState)(defaultValue);
|
|
611
656
|
const selected = value !== void 0 ? value : internal;
|
|
612
657
|
const handleChange = (val) => {
|
|
613
658
|
if (disabled) return;
|
|
@@ -642,7 +687,7 @@ var RadioGroup_default2 = RadioGroup;
|
|
|
642
687
|
|
|
643
688
|
// src/components/Select/Select.tsx
|
|
644
689
|
var import_lucide_react8 = require("lucide-react");
|
|
645
|
-
var
|
|
690
|
+
var import_react9 = require("react");
|
|
646
691
|
|
|
647
692
|
// src/components/Select/Select.module.css
|
|
648
693
|
var Select_default = {};
|
|
@@ -658,9 +703,9 @@ var Select = ({
|
|
|
658
703
|
onChange
|
|
659
704
|
}) => {
|
|
660
705
|
var _a;
|
|
661
|
-
const [internal, setInternal] = (0,
|
|
662
|
-
const [open, setOpen] = (0,
|
|
663
|
-
const ref = (0,
|
|
706
|
+
const [internal, setInternal] = (0, import_react9.useState)(defaultValue);
|
|
707
|
+
const [open, setOpen] = (0, import_react9.useState)(false);
|
|
708
|
+
const ref = (0, import_react9.useRef)(null);
|
|
664
709
|
const selected = value !== void 0 ? value : internal;
|
|
665
710
|
const selectedLabel = (_a = options.find((o) => o.value === selected)) == null ? void 0 : _a.label;
|
|
666
711
|
const handleSelect = (val) => {
|
|
@@ -668,7 +713,7 @@ var Select = ({
|
|
|
668
713
|
setOpen(false);
|
|
669
714
|
onChange == null ? void 0 : onChange(val);
|
|
670
715
|
};
|
|
671
|
-
(0,
|
|
716
|
+
(0, import_react9.useEffect)(() => {
|
|
672
717
|
const handleOutside = (e) => {
|
|
673
718
|
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
674
719
|
};
|
|
@@ -721,7 +766,7 @@ var Skeleton = ({ height = "1rem", width = "100%", circle = false }) => /* @__PU
|
|
|
721
766
|
var Skeleton_default2 = Skeleton;
|
|
722
767
|
|
|
723
768
|
// src/components/Slider/Slider.tsx
|
|
724
|
-
var
|
|
769
|
+
var import_react10 = require("react");
|
|
725
770
|
|
|
726
771
|
// src/components/Slider/Slider.module.css
|
|
727
772
|
var Slider_default = {};
|
|
@@ -737,7 +782,7 @@ var Slider = ({
|
|
|
737
782
|
disabled,
|
|
738
783
|
onChange
|
|
739
784
|
}) => {
|
|
740
|
-
const [internal, setInternal] = (0,
|
|
785
|
+
const [internal, setInternal] = (0, import_react10.useState)(defaultValue);
|
|
741
786
|
const current = value !== void 0 ? value : internal;
|
|
742
787
|
const fill = `${(current - min) / (max - min) * 100}%`;
|
|
743
788
|
const handleChange = (e) => {
|
|
@@ -775,7 +820,7 @@ var Spinner = ({ size = "md" }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)
|
|
|
775
820
|
var Spinner_default2 = Spinner;
|
|
776
821
|
|
|
777
822
|
// src/components/Switch/Switch.tsx
|
|
778
|
-
var
|
|
823
|
+
var import_react11 = require("react");
|
|
779
824
|
|
|
780
825
|
// src/components/Switch/Switch.module.css
|
|
781
826
|
var Switch_default = {};
|
|
@@ -790,7 +835,7 @@ var Switch = ({
|
|
|
790
835
|
id,
|
|
791
836
|
onChange
|
|
792
837
|
}) => {
|
|
793
|
-
const [internal, setInternal] = (0,
|
|
838
|
+
const [internal, setInternal] = (0, import_react11.useState)(defaultChecked);
|
|
794
839
|
const isOn = checked !== void 0 ? checked : internal;
|
|
795
840
|
const handleToggle = () => {
|
|
796
841
|
if (disabled) return;
|
|
@@ -841,7 +886,7 @@ var TableCell = (_a) => {
|
|
|
841
886
|
};
|
|
842
887
|
|
|
843
888
|
// src/components/Tabs/Tabs.tsx
|
|
844
|
-
var
|
|
889
|
+
var import_react12 = require("react");
|
|
845
890
|
|
|
846
891
|
// src/components/Tabs/Tabs.module.css
|
|
847
892
|
var Tabs_default = {};
|
|
@@ -850,7 +895,7 @@ var Tabs_default = {};
|
|
|
850
895
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
851
896
|
var Tabs = ({ tabs, defaultValue }) => {
|
|
852
897
|
var _a, _b;
|
|
853
|
-
const [active, setActive] = (0,
|
|
898
|
+
const [active, setActive] = (0, import_react12.useState)((_b = defaultValue != null ? defaultValue : (_a = tabs[0]) == null ? void 0 : _a.value) != null ? _b : "");
|
|
854
899
|
const activeTab = tabs.find((t) => t.value === active);
|
|
855
900
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: Tabs_default.root, children: [
|
|
856
901
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: Tabs_default.list, role: "tablist", children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|