@efiche/design 0.1.5 → 0.1.7
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 +90 -53
- 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 +88 -51
- 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,31 @@ 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
|
+
};
|
|
274
293
|
var Button = (_a) => {
|
|
275
294
|
var _b = _a, {
|
|
276
295
|
text,
|
|
@@ -289,7 +308,7 @@ var Button = (_a) => {
|
|
|
289
308
|
small = false,
|
|
290
309
|
large = false,
|
|
291
310
|
size,
|
|
292
|
-
|
|
311
|
+
style: styleProp
|
|
293
312
|
} = _b, props = __objRest(_b, [
|
|
294
313
|
"text",
|
|
295
314
|
"children",
|
|
@@ -307,35 +326,53 @@ var Button = (_a) => {
|
|
|
307
326
|
"small",
|
|
308
327
|
"large",
|
|
309
328
|
"size",
|
|
310
|
-
"
|
|
329
|
+
"style"
|
|
311
330
|
]);
|
|
331
|
+
const [hovered, setHovered] = (0, import_react3.useState)(false);
|
|
312
332
|
const resolvedVariant = variant != null ? variant : danger ? "danger" : warning ? "warning" : info ? "info" : success ? "success" : ghost ? "ghost" : outline ? "outline" : "solid";
|
|
313
333
|
const resolvedSize = size != null ? size : small ? "sm" : large ? "lg" : "md";
|
|
334
|
+
const isDisabled = disabled || loading;
|
|
314
335
|
const content = children != null ? children : text;
|
|
315
336
|
const showIcon = icon && !loading;
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
"
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
+
const computedStyle = __spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
338
|
+
display: "inline-flex",
|
|
339
|
+
alignItems: "center",
|
|
340
|
+
gap: "0.5rem",
|
|
341
|
+
border: "1px solid transparent",
|
|
342
|
+
borderRadius: "0.375rem",
|
|
343
|
+
fontWeight: 500,
|
|
344
|
+
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
345
|
+
transition: "opacity 0.15s, background-color 0.15s",
|
|
346
|
+
opacity: isDisabled ? 0.5 : 1,
|
|
347
|
+
pointerEvents: loading ? "none" : void 0
|
|
348
|
+
}, variantStyles[resolvedVariant]), sizeStyles[resolvedSize]), hovered && !isDisabled ? variantHoverStyles[resolvedVariant] : {}), styleProp);
|
|
349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
350
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("style", { href: "ds-spin", precedence: "low", children: `@keyframes ds-spin { to { transform: rotate(360deg); } }` }),
|
|
351
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
352
|
+
"button",
|
|
353
|
+
__spreadProps(__spreadValues({
|
|
354
|
+
disabled: isDisabled,
|
|
355
|
+
style: computedStyle,
|
|
356
|
+
onMouseEnter: () => setHovered(true),
|
|
357
|
+
onMouseLeave: () => setHovered(false)
|
|
358
|
+
}, props), {
|
|
359
|
+
children: [
|
|
360
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
361
|
+
import_lucide_react4.LoaderCircle,
|
|
362
|
+
{
|
|
363
|
+
"aria-hidden": true,
|
|
364
|
+
style: { width: "1em", height: "1em", animation: "ds-spin 0.75s linear infinite" }
|
|
365
|
+
}
|
|
366
|
+
) : null,
|
|
367
|
+
showIcon && iconPosition === "left" ? icon : null,
|
|
368
|
+
content,
|
|
369
|
+
showIcon && iconPosition === "right" ? icon : null
|
|
370
|
+
]
|
|
371
|
+
})
|
|
372
|
+
)
|
|
373
|
+
] });
|
|
337
374
|
};
|
|
338
|
-
var
|
|
375
|
+
var Button_default = Button;
|
|
339
376
|
|
|
340
377
|
// src/components/Card/Card.module.css
|
|
341
378
|
var Card_default = {};
|
|
@@ -368,7 +405,7 @@ var CardFooter = (_a) => {
|
|
|
368
405
|
};
|
|
369
406
|
|
|
370
407
|
// src/components/Checkbox/Checkbox.tsx
|
|
371
|
-
var
|
|
408
|
+
var import_react4 = require("react");
|
|
372
409
|
|
|
373
410
|
// src/components/Checkbox/Checkbox.module.css
|
|
374
411
|
var Checkbox_default = {};
|
|
@@ -383,7 +420,7 @@ var Checkbox = ({
|
|
|
383
420
|
id,
|
|
384
421
|
onChange
|
|
385
422
|
}) => {
|
|
386
|
-
const [internal, setInternal] = (0,
|
|
423
|
+
const [internal, setInternal] = (0, import_react4.useState)(defaultChecked);
|
|
387
424
|
const isChecked = checked !== void 0 ? checked : internal;
|
|
388
425
|
const handleChange = () => {
|
|
389
426
|
if (disabled) return;
|
|
@@ -411,7 +448,7 @@ var Checkbox_default2 = Checkbox;
|
|
|
411
448
|
|
|
412
449
|
// src/components/CopyButton/CopyButton.tsx
|
|
413
450
|
var import_lucide_react5 = require("lucide-react");
|
|
414
|
-
var
|
|
451
|
+
var import_react5 = require("react");
|
|
415
452
|
|
|
416
453
|
// src/components/CopyButton/CopyButton.module.css
|
|
417
454
|
var CopyButton_default = {};
|
|
@@ -419,7 +456,7 @@ var CopyButton_default = {};
|
|
|
419
456
|
// src/components/CopyButton/CopyButton.tsx
|
|
420
457
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
421
458
|
var CopyButton = ({ text }) => {
|
|
422
|
-
const [copied, setCopied] = (0,
|
|
459
|
+
const [copied, setCopied] = (0, import_react5.useState)(false);
|
|
423
460
|
const handleCopy = () => {
|
|
424
461
|
navigator.clipboard.writeText(text);
|
|
425
462
|
setCopied(true);
|
|
@@ -439,7 +476,7 @@ var CopyButton_default2 = CopyButton;
|
|
|
439
476
|
|
|
440
477
|
// src/components/FileUpload/FileUpload.tsx
|
|
441
478
|
var import_lucide_react6 = require("lucide-react");
|
|
442
|
-
var
|
|
479
|
+
var import_react6 = require("react");
|
|
443
480
|
|
|
444
481
|
// src/components/FileUpload/FileUpload.module.css
|
|
445
482
|
var FileUpload_default = {};
|
|
@@ -447,9 +484,9 @@ var FileUpload_default = {};
|
|
|
447
484
|
// src/components/FileUpload/FileUpload.tsx
|
|
448
485
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
449
486
|
var FileUpload = ({ accept, multiple, disabled, onFileSelect }) => {
|
|
450
|
-
const [isDragging, setIsDragging] = (0,
|
|
451
|
-
const [fileNames, setFileNames] = (0,
|
|
452
|
-
const inputRef = (0,
|
|
487
|
+
const [isDragging, setIsDragging] = (0, import_react6.useState)(false);
|
|
488
|
+
const [fileNames, setFileNames] = (0, import_react6.useState)([]);
|
|
489
|
+
const inputRef = (0, import_react6.useRef)(null);
|
|
453
490
|
const handleFiles = (list) => {
|
|
454
491
|
setFileNames(Array.from(list).map((f) => f.name));
|
|
455
492
|
onFileSelect == null ? void 0 : onFileSelect(list);
|
|
@@ -547,10 +584,10 @@ var Label_default2 = Label;
|
|
|
547
584
|
|
|
548
585
|
// src/components/PasswordInput/PasswordInput.tsx
|
|
549
586
|
var import_lucide_react7 = require("lucide-react");
|
|
550
|
-
var
|
|
587
|
+
var import_react7 = require("react");
|
|
551
588
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
552
589
|
var PasswordInput = (props) => {
|
|
553
|
-
const [visible, setVisible] = (0,
|
|
590
|
+
const [visible, setVisible] = (0, import_react7.useState)(false);
|
|
554
591
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
555
592
|
Input_default2,
|
|
556
593
|
__spreadProps(__spreadValues({}, props), {
|
|
@@ -592,7 +629,7 @@ var Progress = ({ value = 0 }) => {
|
|
|
592
629
|
var Progress_default2 = Progress;
|
|
593
630
|
|
|
594
631
|
// src/components/RadioGroup/RadioGroup.tsx
|
|
595
|
-
var
|
|
632
|
+
var import_react8 = require("react");
|
|
596
633
|
|
|
597
634
|
// src/components/RadioGroup/RadioGroup.module.css
|
|
598
635
|
var RadioGroup_default = {};
|
|
@@ -607,7 +644,7 @@ var RadioGroup = ({
|
|
|
607
644
|
disabled,
|
|
608
645
|
onChange
|
|
609
646
|
}) => {
|
|
610
|
-
const [internal, setInternal] = (0,
|
|
647
|
+
const [internal, setInternal] = (0, import_react8.useState)(defaultValue);
|
|
611
648
|
const selected = value !== void 0 ? value : internal;
|
|
612
649
|
const handleChange = (val) => {
|
|
613
650
|
if (disabled) return;
|
|
@@ -642,7 +679,7 @@ var RadioGroup_default2 = RadioGroup;
|
|
|
642
679
|
|
|
643
680
|
// src/components/Select/Select.tsx
|
|
644
681
|
var import_lucide_react8 = require("lucide-react");
|
|
645
|
-
var
|
|
682
|
+
var import_react9 = require("react");
|
|
646
683
|
|
|
647
684
|
// src/components/Select/Select.module.css
|
|
648
685
|
var Select_default = {};
|
|
@@ -658,9 +695,9 @@ var Select = ({
|
|
|
658
695
|
onChange
|
|
659
696
|
}) => {
|
|
660
697
|
var _a;
|
|
661
|
-
const [internal, setInternal] = (0,
|
|
662
|
-
const [open, setOpen] = (0,
|
|
663
|
-
const ref = (0,
|
|
698
|
+
const [internal, setInternal] = (0, import_react9.useState)(defaultValue);
|
|
699
|
+
const [open, setOpen] = (0, import_react9.useState)(false);
|
|
700
|
+
const ref = (0, import_react9.useRef)(null);
|
|
664
701
|
const selected = value !== void 0 ? value : internal;
|
|
665
702
|
const selectedLabel = (_a = options.find((o) => o.value === selected)) == null ? void 0 : _a.label;
|
|
666
703
|
const handleSelect = (val) => {
|
|
@@ -668,7 +705,7 @@ var Select = ({
|
|
|
668
705
|
setOpen(false);
|
|
669
706
|
onChange == null ? void 0 : onChange(val);
|
|
670
707
|
};
|
|
671
|
-
(0,
|
|
708
|
+
(0, import_react9.useEffect)(() => {
|
|
672
709
|
const handleOutside = (e) => {
|
|
673
710
|
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
674
711
|
};
|
|
@@ -721,7 +758,7 @@ var Skeleton = ({ height = "1rem", width = "100%", circle = false }) => /* @__PU
|
|
|
721
758
|
var Skeleton_default2 = Skeleton;
|
|
722
759
|
|
|
723
760
|
// src/components/Slider/Slider.tsx
|
|
724
|
-
var
|
|
761
|
+
var import_react10 = require("react");
|
|
725
762
|
|
|
726
763
|
// src/components/Slider/Slider.module.css
|
|
727
764
|
var Slider_default = {};
|
|
@@ -737,7 +774,7 @@ var Slider = ({
|
|
|
737
774
|
disabled,
|
|
738
775
|
onChange
|
|
739
776
|
}) => {
|
|
740
|
-
const [internal, setInternal] = (0,
|
|
777
|
+
const [internal, setInternal] = (0, import_react10.useState)(defaultValue);
|
|
741
778
|
const current = value !== void 0 ? value : internal;
|
|
742
779
|
const fill = `${(current - min) / (max - min) * 100}%`;
|
|
743
780
|
const handleChange = (e) => {
|
|
@@ -775,7 +812,7 @@ var Spinner = ({ size = "md" }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)
|
|
|
775
812
|
var Spinner_default2 = Spinner;
|
|
776
813
|
|
|
777
814
|
// src/components/Switch/Switch.tsx
|
|
778
|
-
var
|
|
815
|
+
var import_react11 = require("react");
|
|
779
816
|
|
|
780
817
|
// src/components/Switch/Switch.module.css
|
|
781
818
|
var Switch_default = {};
|
|
@@ -790,7 +827,7 @@ var Switch = ({
|
|
|
790
827
|
id,
|
|
791
828
|
onChange
|
|
792
829
|
}) => {
|
|
793
|
-
const [internal, setInternal] = (0,
|
|
830
|
+
const [internal, setInternal] = (0, import_react11.useState)(defaultChecked);
|
|
794
831
|
const isOn = checked !== void 0 ? checked : internal;
|
|
795
832
|
const handleToggle = () => {
|
|
796
833
|
if (disabled) return;
|
|
@@ -841,7 +878,7 @@ var TableCell = (_a) => {
|
|
|
841
878
|
};
|
|
842
879
|
|
|
843
880
|
// src/components/Tabs/Tabs.tsx
|
|
844
|
-
var
|
|
881
|
+
var import_react12 = require("react");
|
|
845
882
|
|
|
846
883
|
// src/components/Tabs/Tabs.module.css
|
|
847
884
|
var Tabs_default = {};
|
|
@@ -850,7 +887,7 @@ var Tabs_default = {};
|
|
|
850
887
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
851
888
|
var Tabs = ({ tabs, defaultValue }) => {
|
|
852
889
|
var _a, _b;
|
|
853
|
-
const [active, setActive] = (0,
|
|
890
|
+
const [active, setActive] = (0, import_react12.useState)((_b = defaultValue != null ? defaultValue : (_a = tabs[0]) == null ? void 0 : _a.value) != null ? _b : "");
|
|
854
891
|
const activeTab = tabs.find((t) => t.value === active);
|
|
855
892
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: Tabs_default.root, children: [
|
|
856
893
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: Tabs_default.list, role: "tablist", children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|