design-zystem 1.0.328 → 1.0.330
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +5 -2
- package/dist/index.mjs +5 -2
- package/dist/ui/index.d.mts +2 -2
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +70 -54
- package/dist/ui/index.mjs +34 -18
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1059,8 +1059,9 @@ interface TooltipProps {
|
|
|
1059
1059
|
width?: string;
|
|
1060
1060
|
height?: string;
|
|
1061
1061
|
direction?: 'top' | 'bottom' | 'left' | 'right';
|
|
1062
|
+
fullWidth?: boolean;
|
|
1062
1063
|
}
|
|
1063
|
-
declare const Tooltip: ({ backgroundColor, data, width, height, direction, children, }: TooltipProps) => react.JSX.Element;
|
|
1064
|
+
declare const Tooltip: ({ backgroundColor, data, width, height, direction, fullWidth, children, }: TooltipProps) => react.JSX.Element;
|
|
1064
1065
|
|
|
1065
1066
|
interface PaginationProps {
|
|
1066
1067
|
currentPage: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1059,8 +1059,9 @@ interface TooltipProps {
|
|
|
1059
1059
|
width?: string;
|
|
1060
1060
|
height?: string;
|
|
1061
1061
|
direction?: 'top' | 'bottom' | 'left' | 'right';
|
|
1062
|
+
fullWidth?: boolean;
|
|
1062
1063
|
}
|
|
1063
|
-
declare const Tooltip: ({ backgroundColor, data, width, height, direction, children, }: TooltipProps) => react.JSX.Element;
|
|
1064
|
+
declare const Tooltip: ({ backgroundColor, data, width, height, direction, fullWidth, children, }: TooltipProps) => react.JSX.Element;
|
|
1064
1065
|
|
|
1065
1066
|
interface PaginationProps {
|
|
1066
1067
|
currentPage: number;
|
package/dist/index.js
CHANGED
|
@@ -1387,7 +1387,8 @@ var import_styled_components12 = __toESM(require("styled-components"));
|
|
|
1387
1387
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1388
1388
|
var StyledTooltipWrapper = import_styled_components12.default.div`
|
|
1389
1389
|
position: relative;
|
|
1390
|
-
display: inline-block;
|
|
1390
|
+
display: ${(props) => props.$fullWidth ? "block" : "inline-block"};
|
|
1391
|
+
width: ${(props) => props.$fullWidth ? "100%" : "auto"};
|
|
1391
1392
|
cursor: pointer;
|
|
1392
1393
|
`;
|
|
1393
1394
|
var StyledTooltipContent = import_styled_components12.default.div`
|
|
@@ -1484,6 +1485,7 @@ var Tooltip = ({
|
|
|
1484
1485
|
width,
|
|
1485
1486
|
height,
|
|
1486
1487
|
direction = "top",
|
|
1488
|
+
fullWidth = false,
|
|
1487
1489
|
children
|
|
1488
1490
|
}) => {
|
|
1489
1491
|
const [isVisible, setIsVisible] = (0, import_react6.useState)(false);
|
|
@@ -1492,6 +1494,7 @@ var Tooltip = ({
|
|
|
1492
1494
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1493
1495
|
StyledTooltipWrapper,
|
|
1494
1496
|
{
|
|
1497
|
+
$fullWidth: fullWidth,
|
|
1495
1498
|
onMouseEnter: handleMouseEnter,
|
|
1496
1499
|
onMouseLeave: handleMouseLeave,
|
|
1497
1500
|
children: [
|
|
@@ -1739,7 +1742,7 @@ var NewModal = ({
|
|
|
1739
1742
|
children: leftButtonLabel
|
|
1740
1743
|
}
|
|
1741
1744
|
) }),
|
|
1742
|
-
rightButtonLabel && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { flex: "1", children: confirmDisabled && rightButtonDisabledTooltip ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Tooltip, { data: [rightButtonDisabledTooltip], children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1745
|
+
rightButtonLabel && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { flex: "1", children: confirmDisabled && rightButtonDisabledTooltip ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Tooltip, { data: [rightButtonDisabledTooltip], fullWidth: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1743
1746
|
Button,
|
|
1744
1747
|
{
|
|
1745
1748
|
outline: isOutline,
|
package/dist/index.mjs
CHANGED
|
@@ -1244,7 +1244,8 @@ import styled12 from "styled-components";
|
|
|
1244
1244
|
import { jsx as jsx15, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1245
1245
|
var StyledTooltipWrapper = styled12.div`
|
|
1246
1246
|
position: relative;
|
|
1247
|
-
display: inline-block;
|
|
1247
|
+
display: ${(props) => props.$fullWidth ? "block" : "inline-block"};
|
|
1248
|
+
width: ${(props) => props.$fullWidth ? "100%" : "auto"};
|
|
1248
1249
|
cursor: pointer;
|
|
1249
1250
|
`;
|
|
1250
1251
|
var StyledTooltipContent = styled12.div`
|
|
@@ -1341,6 +1342,7 @@ var Tooltip = ({
|
|
|
1341
1342
|
width,
|
|
1342
1343
|
height,
|
|
1343
1344
|
direction = "top",
|
|
1345
|
+
fullWidth = false,
|
|
1344
1346
|
children
|
|
1345
1347
|
}) => {
|
|
1346
1348
|
const [isVisible, setIsVisible] = useState2(false);
|
|
@@ -1349,6 +1351,7 @@ var Tooltip = ({
|
|
|
1349
1351
|
return /* @__PURE__ */ jsxs5(
|
|
1350
1352
|
StyledTooltipWrapper,
|
|
1351
1353
|
{
|
|
1354
|
+
$fullWidth: fullWidth,
|
|
1352
1355
|
onMouseEnter: handleMouseEnter,
|
|
1353
1356
|
onMouseLeave: handleMouseLeave,
|
|
1354
1357
|
children: [
|
|
@@ -1596,7 +1599,7 @@ var NewModal = ({
|
|
|
1596
1599
|
children: leftButtonLabel
|
|
1597
1600
|
}
|
|
1598
1601
|
) }),
|
|
1599
|
-
rightButtonLabel && /* @__PURE__ */ jsx16(Row, { flex: "1", children: confirmDisabled && rightButtonDisabledTooltip ? /* @__PURE__ */ jsx16(Tooltip, { data: [rightButtonDisabledTooltip], children: /* @__PURE__ */ jsx16(
|
|
1602
|
+
rightButtonLabel && /* @__PURE__ */ jsx16(Row, { flex: "1", children: confirmDisabled && rightButtonDisabledTooltip ? /* @__PURE__ */ jsx16(Tooltip, { data: [rightButtonDisabledTooltip], fullWidth: true, children: /* @__PURE__ */ jsx16(
|
|
1600
1603
|
Button,
|
|
1601
1604
|
{
|
|
1602
1605
|
outline: isOutline,
|
package/dist/ui/index.d.mts
CHANGED
|
@@ -687,8 +687,8 @@ interface DrawerProps {
|
|
|
687
687
|
/**
|
|
688
688
|
* `false` : le panneau n'inerte plus la page et ne capture plus le focus — à
|
|
689
689
|
* utiliser dès qu'il ouvre lui-même une modale (sinon celle-ci, montée hors
|
|
690
|
-
* de son DOM, devient inerte et injoignable au clavier).
|
|
691
|
-
*
|
|
690
|
+
* de son DOM, devient inerte et injoignable au clavier). Le clic à côté le
|
|
691
|
+
* referme quand même, sauf s'il tombe dans une modale ouverte par-dessus.
|
|
692
692
|
*/
|
|
693
693
|
modal?: boolean;
|
|
694
694
|
className?: string;
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -687,8 +687,8 @@ interface DrawerProps {
|
|
|
687
687
|
/**
|
|
688
688
|
* `false` : le panneau n'inerte plus la page et ne capture plus le focus — à
|
|
689
689
|
* utiliser dès qu'il ouvre lui-même une modale (sinon celle-ci, montée hors
|
|
690
|
-
* de son DOM, devient inerte et injoignable au clavier).
|
|
691
|
-
*
|
|
690
|
+
* de son DOM, devient inerte et injoignable au clavier). Le clic à côté le
|
|
691
|
+
* referme quand même, sauf s'il tombe dans une modale ouverte par-dessus.
|
|
692
692
|
*/
|
|
693
693
|
modal?: boolean;
|
|
694
694
|
className?: string;
|
package/dist/ui/index.js
CHANGED
|
@@ -3376,6 +3376,7 @@ var CollapsibleContent = (_a) => {
|
|
|
3376
3376
|
};
|
|
3377
3377
|
|
|
3378
3378
|
// src/ui/components/ui/Drawer.tsx
|
|
3379
|
+
var import_react24 = require("react");
|
|
3379
3380
|
var import_vaul = require("vaul");
|
|
3380
3381
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3381
3382
|
var CONTENT_POSITION = {
|
|
@@ -3394,6 +3395,20 @@ var Drawer = ({
|
|
|
3394
3395
|
className
|
|
3395
3396
|
}) => {
|
|
3396
3397
|
const isVertical = direction === "left" || direction === "right";
|
|
3398
|
+
const contentRef = (0, import_react24.useRef)(null);
|
|
3399
|
+
(0, import_react24.useEffect)(() => {
|
|
3400
|
+
if (modal || !open || typeof document === "undefined") return;
|
|
3401
|
+
const handlePointerDown = (event) => {
|
|
3402
|
+
var _a;
|
|
3403
|
+
const target = event.target;
|
|
3404
|
+
if (!target) return;
|
|
3405
|
+
if ((_a = contentRef.current) == null ? void 0 : _a.contains(target)) return;
|
|
3406
|
+
if (target.closest('[role="dialog"], [data-drawer-keep-open]')) return;
|
|
3407
|
+
onClose == null ? void 0 : onClose();
|
|
3408
|
+
};
|
|
3409
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
3410
|
+
return () => document.removeEventListener("pointerdown", handlePointerDown);
|
|
3411
|
+
}, [modal, open, onClose]);
|
|
3397
3412
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3398
3413
|
import_vaul.Drawer.Root,
|
|
3399
3414
|
{
|
|
@@ -3406,6 +3421,7 @@ var Drawer = ({
|
|
|
3406
3421
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3407
3422
|
import_vaul.Drawer.Content,
|
|
3408
3423
|
{
|
|
3424
|
+
ref: contentRef,
|
|
3409
3425
|
onPointerDownOutside: (event) => {
|
|
3410
3426
|
const target = event.target;
|
|
3411
3427
|
if (target == null ? void 0 : target.closest('[role="dialog"], [data-drawer-keep-open]'))
|
|
@@ -3657,7 +3673,7 @@ var toast = {
|
|
|
3657
3673
|
};
|
|
3658
3674
|
|
|
3659
3675
|
// src/ui/components/ui/PageContainer.tsx
|
|
3660
|
-
var
|
|
3676
|
+
var import_react25 = require("react");
|
|
3661
3677
|
var import_class_variance_authority13 = require("class-variance-authority");
|
|
3662
3678
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3663
3679
|
var pageContainerVariants = (0, import_class_variance_authority13.cva)(
|
|
@@ -3674,7 +3690,7 @@ var pageContainerVariants = (0, import_class_variance_authority13.cva)(
|
|
|
3674
3690
|
defaultVariants: { padding: "md" }
|
|
3675
3691
|
}
|
|
3676
3692
|
);
|
|
3677
|
-
var PageContainer = (0,
|
|
3693
|
+
var PageContainer = (0, import_react25.forwardRef)(
|
|
3678
3694
|
(_a, ref) => {
|
|
3679
3695
|
var _b = _a, { padding, className } = _b, props = __objRest(_b, ["padding", "className"]);
|
|
3680
3696
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
@@ -3689,7 +3705,7 @@ var PageContainer = (0, import_react24.forwardRef)(
|
|
|
3689
3705
|
PageContainer.displayName = "PageContainer";
|
|
3690
3706
|
|
|
3691
3707
|
// src/ui/components/ui/IconTabs.tsx
|
|
3692
|
-
var
|
|
3708
|
+
var import_react26 = require("react");
|
|
3693
3709
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3694
3710
|
var IconTabs = ({
|
|
3695
3711
|
items,
|
|
@@ -3699,10 +3715,10 @@ var IconTabs = ({
|
|
|
3699
3715
|
className
|
|
3700
3716
|
}) => {
|
|
3701
3717
|
var _a;
|
|
3702
|
-
const listRef = (0,
|
|
3703
|
-
const tabRefs = (0,
|
|
3704
|
-
const [bar, setBar] = (0,
|
|
3705
|
-
const updateBar = (0,
|
|
3718
|
+
const listRef = (0, import_react26.useRef)(null);
|
|
3719
|
+
const tabRefs = (0, import_react26.useRef)([]);
|
|
3720
|
+
const [bar, setBar] = (0, import_react26.useState)({ left: 0, top: 0, width: 0, height: 0 });
|
|
3721
|
+
const updateBar = (0, import_react26.useCallback)(() => {
|
|
3706
3722
|
const root = listRef.current;
|
|
3707
3723
|
const activeEl = tabRefs.current[value];
|
|
3708
3724
|
if (!root || !activeEl) return;
|
|
@@ -3715,7 +3731,7 @@ var IconTabs = ({
|
|
|
3715
3731
|
height: box.height
|
|
3716
3732
|
});
|
|
3717
3733
|
}, [value]);
|
|
3718
|
-
(0,
|
|
3734
|
+
(0, import_react26.useEffect)(() => {
|
|
3719
3735
|
updateBar();
|
|
3720
3736
|
const ro = new ResizeObserver(updateBar);
|
|
3721
3737
|
if (listRef.current) ro.observe(listRef.current);
|
|
@@ -3862,7 +3878,7 @@ var Banner = ({
|
|
|
3862
3878
|
);
|
|
3863
3879
|
|
|
3864
3880
|
// src/ui/components/ui/FloatingButton.tsx
|
|
3865
|
-
var
|
|
3881
|
+
var import_react27 = require("react");
|
|
3866
3882
|
|
|
3867
3883
|
// src/ui/lib/floatingArc.ts
|
|
3868
3884
|
var MAX_STEP = 65;
|
|
@@ -4008,17 +4024,17 @@ var FloatingButton = ({
|
|
|
4008
4024
|
persistKey,
|
|
4009
4025
|
safeArea
|
|
4010
4026
|
}) => {
|
|
4011
|
-
const containerRef = (0,
|
|
4012
|
-
const [placement, setPlacement] = (0,
|
|
4027
|
+
const containerRef = (0, import_react27.useRef)(null);
|
|
4028
|
+
const [placement, setPlacement] = (0, import_react27.useState)(() => ({
|
|
4013
4029
|
geometry: __spreadValues({ base: 90 }, arcLayout(actions.length, ARC_RADIUS, SUB_SIZE)),
|
|
4014
4030
|
shift: { x: 0, y: 0 }
|
|
4015
4031
|
}));
|
|
4016
|
-
const [isDragging, setIsDragging] = (0,
|
|
4017
|
-
const [offset, setOffset] = (0,
|
|
4018
|
-
const offsetRef = (0,
|
|
4019
|
-
const lastPointRef = (0,
|
|
4020
|
-
const dragDistanceRef = (0,
|
|
4021
|
-
const clampOffset = (0,
|
|
4032
|
+
const [isDragging, setIsDragging] = (0, import_react27.useState)(false);
|
|
4033
|
+
const [offset, setOffset] = (0, import_react27.useState)(() => readStoredOffset(persistKey));
|
|
4034
|
+
const offsetRef = (0, import_react27.useRef)(offset);
|
|
4035
|
+
const lastPointRef = (0, import_react27.useRef)({ x: 0, y: 0 });
|
|
4036
|
+
const dragDistanceRef = (0, import_react27.useRef)(0);
|
|
4037
|
+
const clampOffset = (0, import_react27.useCallback)(
|
|
4022
4038
|
(next) => {
|
|
4023
4039
|
var _a, _b, _c, _d;
|
|
4024
4040
|
const el = containerRef.current;
|
|
@@ -4038,14 +4054,14 @@ var FloatingButton = ({
|
|
|
4038
4054
|
},
|
|
4039
4055
|
[safeArea == null ? void 0 : safeArea.left, safeArea == null ? void 0 : safeArea.top, safeArea == null ? void 0 : safeArea.right, safeArea == null ? void 0 : safeArea.bottom]
|
|
4040
4056
|
);
|
|
4041
|
-
(0,
|
|
4057
|
+
(0, import_react27.useLayoutEffect)(() => {
|
|
4042
4058
|
const corrected = clampOffset(offsetRef.current);
|
|
4043
4059
|
if (corrected.x === offsetRef.current.x && corrected.y === offsetRef.current.y)
|
|
4044
4060
|
return;
|
|
4045
4061
|
offsetRef.current = corrected;
|
|
4046
4062
|
setOffset(corrected);
|
|
4047
4063
|
}, [clampOffset]);
|
|
4048
|
-
(0,
|
|
4064
|
+
(0, import_react27.useEffect)(() => {
|
|
4049
4065
|
if (!draggable || !isDragging) return;
|
|
4050
4066
|
const onPointerMove = (e) => {
|
|
4051
4067
|
const dx = e.clientX - lastPointRef.current.x;
|
|
@@ -4081,7 +4097,7 @@ var FloatingButton = ({
|
|
|
4081
4097
|
window.removeEventListener("pointercancel", endDrag);
|
|
4082
4098
|
};
|
|
4083
4099
|
}, [draggable, isDragging, persistKey, clampOffset]);
|
|
4084
|
-
const resolvePlacement = (0,
|
|
4100
|
+
const resolvePlacement = (0, import_react27.useCallback)(() => {
|
|
4085
4101
|
var _a, _b, _c, _d;
|
|
4086
4102
|
const el = containerRef.current;
|
|
4087
4103
|
if (!el || typeof window === "undefined") return;
|
|
@@ -4110,13 +4126,13 @@ var FloatingButton = ({
|
|
|
4110
4126
|
safeArea == null ? void 0 : safeArea.right,
|
|
4111
4127
|
safeArea == null ? void 0 : safeArea.bottom
|
|
4112
4128
|
]);
|
|
4113
|
-
(0,
|
|
4129
|
+
(0, import_react27.useLayoutEffect)(() => {
|
|
4114
4130
|
if (isOpen) resolvePlacement();
|
|
4115
4131
|
}, [isOpen, offset, resolvePlacement]);
|
|
4116
|
-
(0,
|
|
4132
|
+
(0, import_react27.useLayoutEffect)(() => {
|
|
4117
4133
|
resolvePlacement();
|
|
4118
4134
|
}, [resolvePlacement]);
|
|
4119
|
-
(0,
|
|
4135
|
+
(0, import_react27.useEffect)(() => {
|
|
4120
4136
|
if (typeof window === "undefined") return;
|
|
4121
4137
|
const onResize = () => {
|
|
4122
4138
|
resolvePlacement();
|
|
@@ -4635,7 +4651,7 @@ var Timeline = ({
|
|
|
4635
4651
|
};
|
|
4636
4652
|
|
|
4637
4653
|
// src/ui/components/ui/ColorPicker.tsx
|
|
4638
|
-
var
|
|
4654
|
+
var import_react28 = require("react");
|
|
4639
4655
|
var import_class_variance_authority15 = require("class-variance-authority");
|
|
4640
4656
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4641
4657
|
var swatchVariants = (0, import_class_variance_authority15.cva)(
|
|
@@ -4664,7 +4680,7 @@ var inputVariants = (0, import_class_variance_authority15.cva)(
|
|
|
4664
4680
|
defaultVariants: { size: "m" }
|
|
4665
4681
|
}
|
|
4666
4682
|
);
|
|
4667
|
-
var ColorPicker = (0,
|
|
4683
|
+
var ColorPicker = (0, import_react28.forwardRef)(
|
|
4668
4684
|
({
|
|
4669
4685
|
label,
|
|
4670
4686
|
value,
|
|
@@ -4674,7 +4690,7 @@ var ColorPicker = (0, import_react27.forwardRef)(
|
|
|
4674
4690
|
size,
|
|
4675
4691
|
className
|
|
4676
4692
|
}, ref) => {
|
|
4677
|
-
const [internalColor, setInternalColor] = (0,
|
|
4693
|
+
const [internalColor, setInternalColor] = (0, import_react28.useState)(defaultValue);
|
|
4678
4694
|
const currentColor = value !== void 0 ? value : internalColor;
|
|
4679
4695
|
const handleChange = (e) => {
|
|
4680
4696
|
const next = e.target.value;
|
|
@@ -4738,7 +4754,7 @@ var ColorPicker = (0, import_react27.forwardRef)(
|
|
|
4738
4754
|
ColorPicker.displayName = "ColorPicker";
|
|
4739
4755
|
|
|
4740
4756
|
// src/ui/components/ui/FileUploadZone.tsx
|
|
4741
|
-
var
|
|
4757
|
+
var import_react29 = require("react");
|
|
4742
4758
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
4743
4759
|
var ACCEPT_MAP = {
|
|
4744
4760
|
png: "image/png",
|
|
@@ -4771,23 +4787,23 @@ var FileUploadZone = ({
|
|
|
4771
4787
|
showFileName = false,
|
|
4772
4788
|
className
|
|
4773
4789
|
}) => {
|
|
4774
|
-
const [isDragging, setIsDragging] = (0,
|
|
4775
|
-
const [internalPreviewUrl, setInternalPreviewUrl] = (0,
|
|
4790
|
+
const [isDragging, setIsDragging] = (0, import_react29.useState)(false);
|
|
4791
|
+
const [internalPreviewUrl, setInternalPreviewUrl] = (0, import_react29.useState)(
|
|
4776
4792
|
null
|
|
4777
4793
|
);
|
|
4778
|
-
const [fileType, setFileType] = (0,
|
|
4779
|
-
const [fileName, setFileName] = (0,
|
|
4780
|
-
const [inlineError, setInlineError] = (0,
|
|
4781
|
-
const inputRef = (0,
|
|
4794
|
+
const [fileType, setFileType] = (0, import_react29.useState)(null);
|
|
4795
|
+
const [fileName, setFileName] = (0, import_react29.useState)(null);
|
|
4796
|
+
const [inlineError, setInlineError] = (0, import_react29.useState)(null);
|
|
4797
|
+
const inputRef = (0, import_react29.useRef)(null);
|
|
4782
4798
|
const resolvedAccept = acceptOnlyPdf ? PDF_ONLY : accept;
|
|
4783
4799
|
const mimeTypes = getMimeTypes(resolvedAccept);
|
|
4784
4800
|
const acceptString = mimeTypes.join(",");
|
|
4785
4801
|
const previewUrl = multiple ? null : controlledPreviewUrl || (showPreview ? internalPreviewUrl : null);
|
|
4786
|
-
const emitError = (0,
|
|
4802
|
+
const emitError = (0, import_react29.useCallback)(
|
|
4787
4803
|
(message) => onError ? onError(message) : setInlineError(message),
|
|
4788
4804
|
[onError]
|
|
4789
4805
|
);
|
|
4790
|
-
const validateFile = (0,
|
|
4806
|
+
const validateFile = (0, import_react29.useCallback)(
|
|
4791
4807
|
(file) => {
|
|
4792
4808
|
if (!mimeTypes.includes(file.type))
|
|
4793
4809
|
return { ok: false, error: "Format de fichier non accept\xE9." };
|
|
@@ -4801,7 +4817,7 @@ var FileUploadZone = ({
|
|
|
4801
4817
|
},
|
|
4802
4818
|
[mimeTypes, maxSizeMB]
|
|
4803
4819
|
);
|
|
4804
|
-
const processFile = (0,
|
|
4820
|
+
const processFile = (0, import_react29.useCallback)(
|
|
4805
4821
|
(file) => {
|
|
4806
4822
|
setInlineError(null);
|
|
4807
4823
|
const result = validateFile(file);
|
|
@@ -4816,7 +4832,7 @@ var FileUploadZone = ({
|
|
|
4816
4832
|
},
|
|
4817
4833
|
[validateFile, onSave, showPreview, emitError]
|
|
4818
4834
|
);
|
|
4819
|
-
const processFiles = (0,
|
|
4835
|
+
const processFiles = (0, import_react29.useCallback)(
|
|
4820
4836
|
(files) => {
|
|
4821
4837
|
setInlineError(null);
|
|
4822
4838
|
for (const file of files) {
|
|
@@ -4975,7 +4991,7 @@ var FileUploadZone = ({
|
|
|
4975
4991
|
};
|
|
4976
4992
|
|
|
4977
4993
|
// src/ui/components/ui/FilePicker.tsx
|
|
4978
|
-
var
|
|
4994
|
+
var import_react30 = require("react");
|
|
4979
4995
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
4980
4996
|
var FilePicker = ({
|
|
4981
4997
|
label,
|
|
@@ -4989,7 +5005,7 @@ var FilePicker = ({
|
|
|
4989
5005
|
disabled = false,
|
|
4990
5006
|
className
|
|
4991
5007
|
}) => {
|
|
4992
|
-
const inputRef = (0,
|
|
5008
|
+
const inputRef = (0, import_react30.useRef)(null);
|
|
4993
5009
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
4994
5010
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
4995
5011
|
"input",
|
|
@@ -5027,7 +5043,7 @@ var FilePicker = ({
|
|
|
5027
5043
|
};
|
|
5028
5044
|
|
|
5029
5045
|
// src/ui/components/ui/Item.tsx
|
|
5030
|
-
var
|
|
5046
|
+
var import_react31 = require("react");
|
|
5031
5047
|
var import_class_variance_authority16 = require("class-variance-authority");
|
|
5032
5048
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
5033
5049
|
var itemVariants = (0, import_class_variance_authority16.cva)(
|
|
@@ -5047,7 +5063,7 @@ var itemVariants = (0, import_class_variance_authority16.cva)(
|
|
|
5047
5063
|
defaultVariants: { variant: "default", size: "default" }
|
|
5048
5064
|
}
|
|
5049
5065
|
);
|
|
5050
|
-
var Item3 = (0,
|
|
5066
|
+
var Item3 = (0, import_react31.forwardRef)(
|
|
5051
5067
|
(_a, ref) => {
|
|
5052
5068
|
var _b = _a, { variant, size, className } = _b, props = __objRest(_b, ["variant", "size", "className"]);
|
|
5053
5069
|
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
@@ -5206,7 +5222,7 @@ var Attachment = ({
|
|
|
5206
5222
|
};
|
|
5207
5223
|
|
|
5208
5224
|
// src/ui/components/ui/PdfPreview.tsx
|
|
5209
|
-
var
|
|
5225
|
+
var import_react32 = require("react");
|
|
5210
5226
|
var import_react_pdf = require("react-pdf");
|
|
5211
5227
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
5212
5228
|
import_react_pdf.pdfjs.GlobalWorkerOptions.workerSrc = `https://unpkg.com/pdfjs-dist@${import_react_pdf.pdfjs.version}/build/pdf.worker.min.mjs`;
|
|
@@ -5216,8 +5232,8 @@ var PdfPreview = ({
|
|
|
5216
5232
|
maxHeight = "600px",
|
|
5217
5233
|
className
|
|
5218
5234
|
}) => {
|
|
5219
|
-
const [hasError, setHasError] = (0,
|
|
5220
|
-
const [numPages, setNumPages] = (0,
|
|
5235
|
+
const [hasError, setHasError] = (0, import_react32.useState)(false);
|
|
5236
|
+
const [numPages, setNumPages] = (0, import_react32.useState)(0);
|
|
5221
5237
|
const height = Math.round(width * 1.3);
|
|
5222
5238
|
const thumbnailSkeleton = /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Skeleton, { width, height });
|
|
5223
5239
|
if (hasError) {
|
|
@@ -5324,7 +5340,7 @@ var ScrollArea = (_a) => {
|
|
|
5324
5340
|
};
|
|
5325
5341
|
|
|
5326
5342
|
// src/ui/components/ui/Message.tsx
|
|
5327
|
-
var
|
|
5343
|
+
var import_react33 = require("react");
|
|
5328
5344
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
5329
5345
|
var BUBBLE_BACKGROUND = {
|
|
5330
5346
|
own: { solid: "bg-blue-700", soft: "bg-blue-50" },
|
|
@@ -5334,7 +5350,7 @@ var BUBBLE_TAIL = {
|
|
|
5334
5350
|
own: "rounded-br-none",
|
|
5335
5351
|
other: "rounded-bl-none"
|
|
5336
5352
|
};
|
|
5337
|
-
var Message = (0,
|
|
5353
|
+
var Message = (0, import_react33.forwardRef)(
|
|
5338
5354
|
(_a, ref) => {
|
|
5339
5355
|
var _b = _a, {
|
|
5340
5356
|
variant = "other",
|
|
@@ -5443,7 +5459,7 @@ var Message = (0, import_react32.forwardRef)(
|
|
|
5443
5459
|
Message.displayName = "Message";
|
|
5444
5460
|
|
|
5445
5461
|
// src/ui/components/ui/MessageScroller.tsx
|
|
5446
|
-
var
|
|
5462
|
+
var import_react34 = require("react");
|
|
5447
5463
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
5448
5464
|
var SEPARATOR_LINE = {
|
|
5449
5465
|
neutral: "",
|
|
@@ -5494,9 +5510,9 @@ var MessageScroller = ({
|
|
|
5494
5510
|
viewportRef,
|
|
5495
5511
|
className
|
|
5496
5512
|
}) => {
|
|
5497
|
-
const fallbackRef = (0,
|
|
5513
|
+
const fallbackRef = (0, import_react34.useRef)(null);
|
|
5498
5514
|
const scrollerRef = viewportRef != null ? viewportRef : fallbackRef;
|
|
5499
|
-
(0,
|
|
5515
|
+
(0, import_react34.useLayoutEffect)(() => {
|
|
5500
5516
|
if (!autoScroll) return;
|
|
5501
5517
|
const viewport = scrollerRef.current;
|
|
5502
5518
|
if (!viewport) return;
|
|
@@ -5538,7 +5554,7 @@ var MessageScroller = ({
|
|
|
5538
5554
|
};
|
|
5539
5555
|
|
|
5540
5556
|
// src/ui/components/ui/Stepper.tsx
|
|
5541
|
-
var
|
|
5557
|
+
var import_react35 = require("react");
|
|
5542
5558
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
5543
5559
|
var Stepper = ({
|
|
5544
5560
|
numberOfSteps,
|
|
@@ -5556,7 +5572,7 @@ var Stepper = ({
|
|
|
5556
5572
|
children: Array.from({ length: numberOfSteps }, (_, i) => {
|
|
5557
5573
|
const isActive = i === current;
|
|
5558
5574
|
const isCompleted = i < current;
|
|
5559
|
-
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
5575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_react35.Fragment, { children: [
|
|
5560
5576
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
5561
5577
|
"div",
|
|
5562
5578
|
{
|
|
@@ -5576,7 +5592,7 @@ var Stepper = ({
|
|
|
5576
5592
|
);
|
|
5577
5593
|
|
|
5578
5594
|
// src/ui/components/ui/DatePicker.tsx
|
|
5579
|
-
var
|
|
5595
|
+
var import_react36 = require("react");
|
|
5580
5596
|
var import_react_day_picker = require("react-day-picker");
|
|
5581
5597
|
var import_locale = require("react-day-picker/locale");
|
|
5582
5598
|
var import_style2 = require("react-day-picker/style.css");
|
|
@@ -5637,8 +5653,8 @@ var DatePicker = ({
|
|
|
5637
5653
|
className
|
|
5638
5654
|
}) => {
|
|
5639
5655
|
const isRange = mode === "range";
|
|
5640
|
-
const [open, setOpen] = (0,
|
|
5641
|
-
const [activePreset, setActivePreset] = (0,
|
|
5656
|
+
const [open, setOpen] = (0, import_react36.useState)(false);
|
|
5657
|
+
const [activePreset, setActivePreset] = (0, import_react36.useState)(null);
|
|
5642
5658
|
const resolvedPresets = presets != null ? presets : isRange ? RANGE_PRESETS : SINGLE_PRESETS;
|
|
5643
5659
|
const displayText = isRange ? startDate && endDate ? `${(0, import_date_fns.format)(startDate, "dd/MM/yyyy")} \u2014 ${(0, import_date_fns.format)(endDate, "dd/MM/yyyy")}` : placeholder != null ? placeholder : "S\xE9lectionner une p\xE9riode" : value ? (0, import_date_fns.format)(value, "dd/MM/yyyy") : placeholder != null ? placeholder : "S\xE9lectionner une date";
|
|
5644
5660
|
const hasValue = isRange ? Boolean(startDate && endDate) : Boolean(value);
|
package/dist/ui/index.mjs
CHANGED
|
@@ -3219,6 +3219,7 @@ var CollapsibleContent = (_a) => {
|
|
|
3219
3219
|
};
|
|
3220
3220
|
|
|
3221
3221
|
// src/ui/components/ui/Drawer.tsx
|
|
3222
|
+
import { useEffect as useEffect5, useRef as useRef6 } from "react";
|
|
3222
3223
|
import { Drawer as VaulDrawer } from "vaul";
|
|
3223
3224
|
import { jsx as jsx45, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3224
3225
|
var CONTENT_POSITION = {
|
|
@@ -3237,6 +3238,20 @@ var Drawer = ({
|
|
|
3237
3238
|
className
|
|
3238
3239
|
}) => {
|
|
3239
3240
|
const isVertical = direction === "left" || direction === "right";
|
|
3241
|
+
const contentRef = useRef6(null);
|
|
3242
|
+
useEffect5(() => {
|
|
3243
|
+
if (modal || !open || typeof document === "undefined") return;
|
|
3244
|
+
const handlePointerDown = (event) => {
|
|
3245
|
+
var _a;
|
|
3246
|
+
const target = event.target;
|
|
3247
|
+
if (!target) return;
|
|
3248
|
+
if ((_a = contentRef.current) == null ? void 0 : _a.contains(target)) return;
|
|
3249
|
+
if (target.closest('[role="dialog"], [data-drawer-keep-open]')) return;
|
|
3250
|
+
onClose == null ? void 0 : onClose();
|
|
3251
|
+
};
|
|
3252
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
3253
|
+
return () => document.removeEventListener("pointerdown", handlePointerDown);
|
|
3254
|
+
}, [modal, open, onClose]);
|
|
3240
3255
|
return /* @__PURE__ */ jsx45(
|
|
3241
3256
|
VaulDrawer.Root,
|
|
3242
3257
|
{
|
|
@@ -3249,6 +3264,7 @@ var Drawer = ({
|
|
|
3249
3264
|
/* @__PURE__ */ jsx45(
|
|
3250
3265
|
VaulDrawer.Content,
|
|
3251
3266
|
{
|
|
3267
|
+
ref: contentRef,
|
|
3252
3268
|
onPointerDownOutside: (event) => {
|
|
3253
3269
|
const target = event.target;
|
|
3254
3270
|
if (target == null ? void 0 : target.closest('[role="dialog"], [data-drawer-keep-open]'))
|
|
@@ -3532,7 +3548,7 @@ var PageContainer = forwardRef17(
|
|
|
3532
3548
|
PageContainer.displayName = "PageContainer";
|
|
3533
3549
|
|
|
3534
3550
|
// src/ui/components/ui/IconTabs.tsx
|
|
3535
|
-
import { useCallback as useCallback2, useEffect as
|
|
3551
|
+
import { useCallback as useCallback2, useEffect as useEffect6, useRef as useRef7, useState as useState6 } from "react";
|
|
3536
3552
|
import { jsx as jsx51, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3537
3553
|
var IconTabs = ({
|
|
3538
3554
|
items,
|
|
@@ -3542,8 +3558,8 @@ var IconTabs = ({
|
|
|
3542
3558
|
className
|
|
3543
3559
|
}) => {
|
|
3544
3560
|
var _a;
|
|
3545
|
-
const listRef =
|
|
3546
|
-
const tabRefs =
|
|
3561
|
+
const listRef = useRef7(null);
|
|
3562
|
+
const tabRefs = useRef7([]);
|
|
3547
3563
|
const [bar, setBar] = useState6({ left: 0, top: 0, width: 0, height: 0 });
|
|
3548
3564
|
const updateBar = useCallback2(() => {
|
|
3549
3565
|
const root = listRef.current;
|
|
@@ -3558,7 +3574,7 @@ var IconTabs = ({
|
|
|
3558
3574
|
height: box.height
|
|
3559
3575
|
});
|
|
3560
3576
|
}, [value]);
|
|
3561
|
-
|
|
3577
|
+
useEffect6(() => {
|
|
3562
3578
|
updateBar();
|
|
3563
3579
|
const ro = new ResizeObserver(updateBar);
|
|
3564
3580
|
if (listRef.current) ro.observe(listRef.current);
|
|
@@ -3707,9 +3723,9 @@ var Banner = ({
|
|
|
3707
3723
|
// src/ui/components/ui/FloatingButton.tsx
|
|
3708
3724
|
import {
|
|
3709
3725
|
useCallback as useCallback3,
|
|
3710
|
-
useEffect as
|
|
3726
|
+
useEffect as useEffect7,
|
|
3711
3727
|
useLayoutEffect,
|
|
3712
|
-
useRef as
|
|
3728
|
+
useRef as useRef8,
|
|
3713
3729
|
useState as useState7
|
|
3714
3730
|
} from "react";
|
|
3715
3731
|
|
|
@@ -3857,16 +3873,16 @@ var FloatingButton = ({
|
|
|
3857
3873
|
persistKey,
|
|
3858
3874
|
safeArea
|
|
3859
3875
|
}) => {
|
|
3860
|
-
const containerRef =
|
|
3876
|
+
const containerRef = useRef8(null);
|
|
3861
3877
|
const [placement, setPlacement] = useState7(() => ({
|
|
3862
3878
|
geometry: __spreadValues({ base: 90 }, arcLayout(actions.length, ARC_RADIUS, SUB_SIZE)),
|
|
3863
3879
|
shift: { x: 0, y: 0 }
|
|
3864
3880
|
}));
|
|
3865
3881
|
const [isDragging, setIsDragging] = useState7(false);
|
|
3866
3882
|
const [offset, setOffset] = useState7(() => readStoredOffset(persistKey));
|
|
3867
|
-
const offsetRef =
|
|
3868
|
-
const lastPointRef =
|
|
3869
|
-
const dragDistanceRef =
|
|
3883
|
+
const offsetRef = useRef8(offset);
|
|
3884
|
+
const lastPointRef = useRef8({ x: 0, y: 0 });
|
|
3885
|
+
const dragDistanceRef = useRef8(0);
|
|
3870
3886
|
const clampOffset = useCallback3(
|
|
3871
3887
|
(next) => {
|
|
3872
3888
|
var _a, _b, _c, _d;
|
|
@@ -3894,7 +3910,7 @@ var FloatingButton = ({
|
|
|
3894
3910
|
offsetRef.current = corrected;
|
|
3895
3911
|
setOffset(corrected);
|
|
3896
3912
|
}, [clampOffset]);
|
|
3897
|
-
|
|
3913
|
+
useEffect7(() => {
|
|
3898
3914
|
if (!draggable || !isDragging) return;
|
|
3899
3915
|
const onPointerMove = (e) => {
|
|
3900
3916
|
const dx = e.clientX - lastPointRef.current.x;
|
|
@@ -3965,7 +3981,7 @@ var FloatingButton = ({
|
|
|
3965
3981
|
useLayoutEffect(() => {
|
|
3966
3982
|
resolvePlacement();
|
|
3967
3983
|
}, [resolvePlacement]);
|
|
3968
|
-
|
|
3984
|
+
useEffect7(() => {
|
|
3969
3985
|
if (typeof window === "undefined") return;
|
|
3970
3986
|
const onResize = () => {
|
|
3971
3987
|
resolvePlacement();
|
|
@@ -4587,7 +4603,7 @@ var ColorPicker = forwardRef18(
|
|
|
4587
4603
|
ColorPicker.displayName = "ColorPicker";
|
|
4588
4604
|
|
|
4589
4605
|
// src/ui/components/ui/FileUploadZone.tsx
|
|
4590
|
-
import { useCallback as useCallback4, useRef as
|
|
4606
|
+
import { useCallback as useCallback4, useRef as useRef9, useState as useState9 } from "react";
|
|
4591
4607
|
import { Fragment as Fragment3, jsx as jsx61, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
4592
4608
|
var ACCEPT_MAP = {
|
|
4593
4609
|
png: "image/png",
|
|
@@ -4627,7 +4643,7 @@ var FileUploadZone = ({
|
|
|
4627
4643
|
const [fileType, setFileType] = useState9(null);
|
|
4628
4644
|
const [fileName, setFileName] = useState9(null);
|
|
4629
4645
|
const [inlineError, setInlineError] = useState9(null);
|
|
4630
|
-
const inputRef =
|
|
4646
|
+
const inputRef = useRef9(null);
|
|
4631
4647
|
const resolvedAccept = acceptOnlyPdf ? PDF_ONLY : accept;
|
|
4632
4648
|
const mimeTypes = getMimeTypes(resolvedAccept);
|
|
4633
4649
|
const acceptString = mimeTypes.join(",");
|
|
@@ -4824,7 +4840,7 @@ var FileUploadZone = ({
|
|
|
4824
4840
|
};
|
|
4825
4841
|
|
|
4826
4842
|
// src/ui/components/ui/FilePicker.tsx
|
|
4827
|
-
import { useRef as
|
|
4843
|
+
import { useRef as useRef10 } from "react";
|
|
4828
4844
|
import { Fragment as Fragment4, jsx as jsx62, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
4829
4845
|
var FilePicker = ({
|
|
4830
4846
|
label,
|
|
@@ -4838,7 +4854,7 @@ var FilePicker = ({
|
|
|
4838
4854
|
disabled = false,
|
|
4839
4855
|
className
|
|
4840
4856
|
}) => {
|
|
4841
|
-
const inputRef =
|
|
4857
|
+
const inputRef = useRef10(null);
|
|
4842
4858
|
return /* @__PURE__ */ jsxs35(Fragment4, { children: [
|
|
4843
4859
|
/* @__PURE__ */ jsx62(
|
|
4844
4860
|
"input",
|
|
@@ -5292,7 +5308,7 @@ var Message = forwardRef20(
|
|
|
5292
5308
|
Message.displayName = "Message";
|
|
5293
5309
|
|
|
5294
5310
|
// src/ui/components/ui/MessageScroller.tsx
|
|
5295
|
-
import { useLayoutEffect as useLayoutEffect2, useRef as
|
|
5311
|
+
import { useLayoutEffect as useLayoutEffect2, useRef as useRef11 } from "react";
|
|
5296
5312
|
import { jsx as jsx68, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
5297
5313
|
var SEPARATOR_LINE = {
|
|
5298
5314
|
neutral: "",
|
|
@@ -5343,7 +5359,7 @@ var MessageScroller = ({
|
|
|
5343
5359
|
viewportRef,
|
|
5344
5360
|
className
|
|
5345
5361
|
}) => {
|
|
5346
|
-
const fallbackRef =
|
|
5362
|
+
const fallbackRef = useRef11(null);
|
|
5347
5363
|
const scrollerRef = viewportRef != null ? viewportRef : fallbackRef;
|
|
5348
5364
|
useLayoutEffect2(() => {
|
|
5349
5365
|
if (!autoScroll) return;
|