design-zystem 1.0.305 → 1.0.307
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 +16 -4
- package/dist/index.d.ts +16 -4
- package/dist/index.js +81 -31
- package/dist/index.mjs +81 -31
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -267,6 +267,7 @@ type ToastType = 'success' | 'error' | 'warning' | 'info';
|
|
|
267
267
|
interface ToastOptions {
|
|
268
268
|
timeOut?: number;
|
|
269
269
|
title?: string;
|
|
270
|
+
onClick?: () => void;
|
|
270
271
|
}
|
|
271
272
|
|
|
272
273
|
declare const toast: {
|
|
@@ -1139,9 +1140,19 @@ interface FloatingButtonProps {
|
|
|
1139
1140
|
}
|
|
1140
1141
|
declare const FloatingButton: ({ isOpen, onToggle, actions, mainBadge, label, icon, openIcon, variant, }: FloatingButtonProps) => react_jsx_runtime.JSX.Element;
|
|
1141
1142
|
|
|
1142
|
-
interface
|
|
1143
|
-
/**
|
|
1143
|
+
interface ProgressBarSegment {
|
|
1144
|
+
/** Share of the track, 0–100. */
|
|
1144
1145
|
value: number;
|
|
1146
|
+
/** Segment color (DZ color token). */
|
|
1147
|
+
color: string;
|
|
1148
|
+
/** Native tooltip on hover. */
|
|
1149
|
+
label?: string;
|
|
1150
|
+
}
|
|
1151
|
+
interface ProgressBarProps {
|
|
1152
|
+
/** Filled portion, 0–100. Values outside the range are clamped. Ignored when `segments` is set. */
|
|
1153
|
+
value?: number;
|
|
1154
|
+
/** Stacked shares drawn side by side, truncated once they fill the track. */
|
|
1155
|
+
segments?: ProgressBarSegment[];
|
|
1145
1156
|
/** Fill color (DZ color token). */
|
|
1146
1157
|
color?: string;
|
|
1147
1158
|
/** Track (unfilled) color (DZ color token). */
|
|
@@ -1153,8 +1164,9 @@ interface ProgressBarProps {
|
|
|
1153
1164
|
}
|
|
1154
1165
|
/**
|
|
1155
1166
|
* Horizontal coverage/progress bar. Track + fill, optional right-aligned label.
|
|
1167
|
+
* Pass `segments` instead of `value` to stack the parts of a single total.
|
|
1156
1168
|
*/
|
|
1157
|
-
declare const ProgressBar: ({ value, color, trackColor, height, showLabel, }: ProgressBarProps) => react_jsx_runtime.JSX.Element;
|
|
1169
|
+
declare const ProgressBar: ({ value, segments, color, trackColor, height, showLabel, }: ProgressBarProps) => react_jsx_runtime.JSX.Element;
|
|
1158
1170
|
|
|
1159
1171
|
interface TimelineItem {
|
|
1160
1172
|
/** Stable key for the row. */
|
|
@@ -1374,4 +1386,4 @@ declare const formatKM: (value: string | number | null | undefined) => string;
|
|
|
1374
1386
|
|
|
1375
1387
|
declare const parseAmount: (value: string) => number | null;
|
|
1376
1388
|
|
|
1377
|
-
export { Accordion, type AccordionItem, Avatar, Banner, type BannerAction, type BannerProps, Box, Bubble, Bulk, Button, Card, type CardProps, CardSkeleton, Checkbox, Col, Collapse, ColorPicker, DatePicker, type DatePickerProps, type DatePreset, Divider, Drawer, EmptyState, FileUploadZone, type FloatingAction, FloatingButton, type FloatingButtonProps, Gantt, type GanttBand, type GanttBar, type GanttDay, GanttDot, type GanttProps, type GanttRow, GanttSwatch, Grid, Icon, IconTabs, Image, Input, Link, List, ListItem, MetricCard, Modal, ModalConfirmation, MultiSelect, NewModal, Options, PageContainer, Pagination, type PastelColorPair, Popover, ProgressBar, Radio, Row, Select, type SelectOption, type SelectProps, SkeletonRow, SliderInput, type SortOrder, Spinner, Stepper, Switch, Table, TableBody, TableCell, TableFooter, TableFooterCell, TableFooterRow, TableHeader, TableHeaderCell, type TableHeaderCellProps, TableHeaderRow, TableRow, Tabs, TagBubble, Text, Timeline, type TimelineItem, type ToastOptions, type ToastType, Toaster, Tooltip, addBusinessDays, appendCacheBuster, appendQueryParam, capitalizeFirstLetter, colors, easterDate, formatAddress, formatCityFromFormattedAddress, formatCityWithPostalCode, formatDate, formatDateWithTime, formatDistance, formatDuration, formatEuro, formatKM, formatLocality, formatName, formatNameWithInitial, formatPhoneNumber, formatPlate, formatPlateWithoutDashes, formatPostalCodeFromFormattedAddress, formatRegionCode, formatTime, formatVin, generateHexColor, getAvatarColor, getCleanFileName, getElapsedTime, getFileIconByMimeType, getFileKind, getFileNameFromUrl, getInitials, getMimeCategory, getPastelColorPair, getRelativeTime, isHoliday, isSameDay, isolateCity, optimizeImage, parseAmount, parseIsoDate, toast, truncateFileName, truncateText };
|
|
1389
|
+
export { Accordion, type AccordionItem, Avatar, Banner, type BannerAction, type BannerProps, Box, Bubble, Bulk, Button, Card, type CardProps, CardSkeleton, Checkbox, Col, Collapse, ColorPicker, DatePicker, type DatePickerProps, type DatePreset, Divider, Drawer, EmptyState, FileUploadZone, type FloatingAction, FloatingButton, type FloatingButtonProps, Gantt, type GanttBand, type GanttBar, type GanttDay, GanttDot, type GanttProps, type GanttRow, GanttSwatch, Grid, Icon, IconTabs, Image, Input, Link, List, ListItem, MetricCard, Modal, ModalConfirmation, MultiSelect, NewModal, Options, PageContainer, Pagination, type PastelColorPair, Popover, ProgressBar, type ProgressBarProps, type ProgressBarSegment, Radio, Row, Select, type SelectOption, type SelectProps, SkeletonRow, SliderInput, type SortOrder, Spinner, Stepper, Switch, Table, TableBody, TableCell, TableFooter, TableFooterCell, TableFooterRow, TableHeader, TableHeaderCell, type TableHeaderCellProps, TableHeaderRow, TableRow, Tabs, TagBubble, Text, Timeline, type TimelineItem, type ToastOptions, type ToastType, Toaster, Tooltip, addBusinessDays, appendCacheBuster, appendQueryParam, capitalizeFirstLetter, colors, easterDate, formatAddress, formatCityFromFormattedAddress, formatCityWithPostalCode, formatDate, formatDateWithTime, formatDistance, formatDuration, formatEuro, formatKM, formatLocality, formatName, formatNameWithInitial, formatPhoneNumber, formatPlate, formatPlateWithoutDashes, formatPostalCodeFromFormattedAddress, formatRegionCode, formatTime, formatVin, generateHexColor, getAvatarColor, getCleanFileName, getElapsedTime, getFileIconByMimeType, getFileKind, getFileNameFromUrl, getInitials, getMimeCategory, getPastelColorPair, getRelativeTime, isHoliday, isSameDay, isolateCity, optimizeImage, parseAmount, parseIsoDate, toast, truncateFileName, truncateText };
|
package/dist/index.d.ts
CHANGED
|
@@ -267,6 +267,7 @@ type ToastType = 'success' | 'error' | 'warning' | 'info';
|
|
|
267
267
|
interface ToastOptions {
|
|
268
268
|
timeOut?: number;
|
|
269
269
|
title?: string;
|
|
270
|
+
onClick?: () => void;
|
|
270
271
|
}
|
|
271
272
|
|
|
272
273
|
declare const toast: {
|
|
@@ -1139,9 +1140,19 @@ interface FloatingButtonProps {
|
|
|
1139
1140
|
}
|
|
1140
1141
|
declare const FloatingButton: ({ isOpen, onToggle, actions, mainBadge, label, icon, openIcon, variant, }: FloatingButtonProps) => react_jsx_runtime.JSX.Element;
|
|
1141
1142
|
|
|
1142
|
-
interface
|
|
1143
|
-
/**
|
|
1143
|
+
interface ProgressBarSegment {
|
|
1144
|
+
/** Share of the track, 0–100. */
|
|
1144
1145
|
value: number;
|
|
1146
|
+
/** Segment color (DZ color token). */
|
|
1147
|
+
color: string;
|
|
1148
|
+
/** Native tooltip on hover. */
|
|
1149
|
+
label?: string;
|
|
1150
|
+
}
|
|
1151
|
+
interface ProgressBarProps {
|
|
1152
|
+
/** Filled portion, 0–100. Values outside the range are clamped. Ignored when `segments` is set. */
|
|
1153
|
+
value?: number;
|
|
1154
|
+
/** Stacked shares drawn side by side, truncated once they fill the track. */
|
|
1155
|
+
segments?: ProgressBarSegment[];
|
|
1145
1156
|
/** Fill color (DZ color token). */
|
|
1146
1157
|
color?: string;
|
|
1147
1158
|
/** Track (unfilled) color (DZ color token). */
|
|
@@ -1153,8 +1164,9 @@ interface ProgressBarProps {
|
|
|
1153
1164
|
}
|
|
1154
1165
|
/**
|
|
1155
1166
|
* Horizontal coverage/progress bar. Track + fill, optional right-aligned label.
|
|
1167
|
+
* Pass `segments` instead of `value` to stack the parts of a single total.
|
|
1156
1168
|
*/
|
|
1157
|
-
declare const ProgressBar: ({ value, color, trackColor, height, showLabel, }: ProgressBarProps) => react_jsx_runtime.JSX.Element;
|
|
1169
|
+
declare const ProgressBar: ({ value, segments, color, trackColor, height, showLabel, }: ProgressBarProps) => react_jsx_runtime.JSX.Element;
|
|
1158
1170
|
|
|
1159
1171
|
interface TimelineItem {
|
|
1160
1172
|
/** Stable key for the row. */
|
|
@@ -1374,4 +1386,4 @@ declare const formatKM: (value: string | number | null | undefined) => string;
|
|
|
1374
1386
|
|
|
1375
1387
|
declare const parseAmount: (value: string) => number | null;
|
|
1376
1388
|
|
|
1377
|
-
export { Accordion, type AccordionItem, Avatar, Banner, type BannerAction, type BannerProps, Box, Bubble, Bulk, Button, Card, type CardProps, CardSkeleton, Checkbox, Col, Collapse, ColorPicker, DatePicker, type DatePickerProps, type DatePreset, Divider, Drawer, EmptyState, FileUploadZone, type FloatingAction, FloatingButton, type FloatingButtonProps, Gantt, type GanttBand, type GanttBar, type GanttDay, GanttDot, type GanttProps, type GanttRow, GanttSwatch, Grid, Icon, IconTabs, Image, Input, Link, List, ListItem, MetricCard, Modal, ModalConfirmation, MultiSelect, NewModal, Options, PageContainer, Pagination, type PastelColorPair, Popover, ProgressBar, Radio, Row, Select, type SelectOption, type SelectProps, SkeletonRow, SliderInput, type SortOrder, Spinner, Stepper, Switch, Table, TableBody, TableCell, TableFooter, TableFooterCell, TableFooterRow, TableHeader, TableHeaderCell, type TableHeaderCellProps, TableHeaderRow, TableRow, Tabs, TagBubble, Text, Timeline, type TimelineItem, type ToastOptions, type ToastType, Toaster, Tooltip, addBusinessDays, appendCacheBuster, appendQueryParam, capitalizeFirstLetter, colors, easterDate, formatAddress, formatCityFromFormattedAddress, formatCityWithPostalCode, formatDate, formatDateWithTime, formatDistance, formatDuration, formatEuro, formatKM, formatLocality, formatName, formatNameWithInitial, formatPhoneNumber, formatPlate, formatPlateWithoutDashes, formatPostalCodeFromFormattedAddress, formatRegionCode, formatTime, formatVin, generateHexColor, getAvatarColor, getCleanFileName, getElapsedTime, getFileIconByMimeType, getFileKind, getFileNameFromUrl, getInitials, getMimeCategory, getPastelColorPair, getRelativeTime, isHoliday, isSameDay, isolateCity, optimizeImage, parseAmount, parseIsoDate, toast, truncateFileName, truncateText };
|
|
1389
|
+
export { Accordion, type AccordionItem, Avatar, Banner, type BannerAction, type BannerProps, Box, Bubble, Bulk, Button, Card, type CardProps, CardSkeleton, Checkbox, Col, Collapse, ColorPicker, DatePicker, type DatePickerProps, type DatePreset, Divider, Drawer, EmptyState, FileUploadZone, type FloatingAction, FloatingButton, type FloatingButtonProps, Gantt, type GanttBand, type GanttBar, type GanttDay, GanttDot, type GanttProps, type GanttRow, GanttSwatch, Grid, Icon, IconTabs, Image, Input, Link, List, ListItem, MetricCard, Modal, ModalConfirmation, MultiSelect, NewModal, Options, PageContainer, Pagination, type PastelColorPair, Popover, ProgressBar, type ProgressBarProps, type ProgressBarSegment, Radio, Row, Select, type SelectOption, type SelectProps, SkeletonRow, SliderInput, type SortOrder, Spinner, Stepper, Switch, Table, TableBody, TableCell, TableFooter, TableFooterCell, TableFooterRow, TableHeader, TableHeaderCell, type TableHeaderCellProps, TableHeaderRow, TableRow, Tabs, TagBubble, Text, Timeline, type TimelineItem, type ToastOptions, type ToastType, Toaster, Tooltip, addBusinessDays, appendCacheBuster, appendQueryParam, capitalizeFirstLetter, colors, easterDate, formatAddress, formatCityFromFormattedAddress, formatCityWithPostalCode, formatDate, formatDateWithTime, formatDistance, formatDuration, formatEuro, formatKM, formatLocality, formatName, formatNameWithInitial, formatPhoneNumber, formatPlate, formatPlateWithoutDashes, formatPostalCodeFromFormattedAddress, formatRegionCode, formatTime, formatVin, generateHexColor, getAvatarColor, getCleanFileName, getElapsedTime, getFileIconByMimeType, getFileKind, getFileNameFromUrl, getInitials, getMimeCategory, getPastelColorPair, getRelativeTime, isHoliday, isSameDay, isolateCity, optimizeImage, parseAmount, parseIsoDate, toast, truncateFileName, truncateText };
|
package/dist/index.js
CHANGED
|
@@ -1797,7 +1797,8 @@ var pushToast = (type, message, options = {}) => {
|
|
|
1797
1797
|
type,
|
|
1798
1798
|
message,
|
|
1799
1799
|
title: options.title,
|
|
1800
|
-
timeOut: (_a = options.timeOut) != null ? _a : DEFAULT_TIMEOUT_BY_TYPE[type]
|
|
1800
|
+
timeOut: (_a = options.timeOut) != null ? _a : DEFAULT_TIMEOUT_BY_TYPE[type],
|
|
1801
|
+
onClick: options.onClick
|
|
1801
1802
|
}
|
|
1802
1803
|
];
|
|
1803
1804
|
emitChange();
|
|
@@ -1821,33 +1822,50 @@ var ToastCard = ({ toastItem }) => {
|
|
|
1821
1822
|
return () => clearTimeout(dismissTimer);
|
|
1822
1823
|
}, [handleDismiss, toastItem.timeOut]);
|
|
1823
1824
|
const { icon, accent, background } = TOAST[toastItem.type];
|
|
1824
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
name: "
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1826
|
+
Card,
|
|
1827
|
+
{
|
|
1828
|
+
$accent: accent,
|
|
1829
|
+
$isExiting: isExiting,
|
|
1830
|
+
$isClickable: !!toastItem.onClick,
|
|
1831
|
+
role: "status",
|
|
1832
|
+
onClick: toastItem.onClick,
|
|
1833
|
+
children: [
|
|
1834
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(IconBadge, { $background: background, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { name: icon, family: "regular", size: "m", color: accent }) }),
|
|
1835
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Content, { children: [
|
|
1836
|
+
toastItem.title && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { size: "s", weight: "700", children: toastItem.title }),
|
|
1837
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { size: "s", children: toastItem.message })
|
|
1838
|
+
] }),
|
|
1839
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1840
|
+
DismissButton,
|
|
1841
|
+
{
|
|
1842
|
+
onClick: (event) => {
|
|
1843
|
+
event.stopPropagation();
|
|
1844
|
+
handleDismiss();
|
|
1845
|
+
},
|
|
1846
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1847
|
+
Icon,
|
|
1848
|
+
{
|
|
1849
|
+
name: "xmark",
|
|
1850
|
+
family: "regular",
|
|
1851
|
+
size: "s",
|
|
1852
|
+
color: colors.grey_500,
|
|
1853
|
+
"aria-label": "Fermer"
|
|
1854
|
+
}
|
|
1855
|
+
)
|
|
1856
|
+
}
|
|
1857
|
+
),
|
|
1858
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1859
|
+
ProgressBar,
|
|
1860
|
+
{
|
|
1861
|
+
$accent: accent,
|
|
1862
|
+
$timeOut: toastItem.timeOut,
|
|
1863
|
+
$isExiting: isExiting
|
|
1864
|
+
}
|
|
1865
|
+
)
|
|
1866
|
+
]
|
|
1867
|
+
}
|
|
1868
|
+
);
|
|
1851
1869
|
};
|
|
1852
1870
|
var TOAST = {
|
|
1853
1871
|
success: {
|
|
@@ -1896,9 +1914,16 @@ var Card = import_styled_components13.default.div`
|
|
|
1896
1914
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
|
|
1897
1915
|
overflow: hidden;
|
|
1898
1916
|
pointer-events: auto;
|
|
1917
|
+
cursor: ${({ $isClickable }) => $isClickable ? "pointer" : "default"};
|
|
1899
1918
|
animation: ${({ $isExiting }) => $isExiting ? slideOut : slideIn} 180ms
|
|
1900
1919
|
ease-out forwards;
|
|
1901
1920
|
`;
|
|
1921
|
+
var DismissButton = import_styled_components13.default.span`
|
|
1922
|
+
position: absolute;
|
|
1923
|
+
top: 10px;
|
|
1924
|
+
right: 10px;
|
|
1925
|
+
cursor: pointer;
|
|
1926
|
+
`;
|
|
1902
1927
|
var IconBadge = import_styled_components13.default.div`
|
|
1903
1928
|
display: flex;
|
|
1904
1929
|
align-items: center;
|
|
@@ -6332,6 +6357,14 @@ var CountBadge = import_styled_components49.default.span`
|
|
|
6332
6357
|
var import_styled_components50 = __toESM(require("styled-components"));
|
|
6333
6358
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
6334
6359
|
var clampPercent = (value) => Math.max(0, Math.min(100, value));
|
|
6360
|
+
var stackSegments = (segments) => {
|
|
6361
|
+
let remaining = 100;
|
|
6362
|
+
return segments.map((segment) => {
|
|
6363
|
+
const width = clampPercent(Math.min(segment.value, remaining));
|
|
6364
|
+
remaining -= width;
|
|
6365
|
+
return __spreadProps(__spreadValues({}, segment), { width });
|
|
6366
|
+
});
|
|
6367
|
+
};
|
|
6335
6368
|
var Wrapper6 = import_styled_components50.default.div`
|
|
6336
6369
|
display: flex;
|
|
6337
6370
|
align-items: center;
|
|
@@ -6340,6 +6373,7 @@ var Wrapper6 = import_styled_components50.default.div`
|
|
|
6340
6373
|
`;
|
|
6341
6374
|
var Track2 = import_styled_components50.default.div`
|
|
6342
6375
|
position: relative;
|
|
6376
|
+
display: flex;
|
|
6343
6377
|
flex: 1;
|
|
6344
6378
|
height: ${({ $height }) => $height}px;
|
|
6345
6379
|
background: ${({ $trackColor }) => $trackColor};
|
|
@@ -6353,16 +6387,32 @@ var Fill = import_styled_components50.default.div`
|
|
|
6353
6387
|
border-radius: ${({ $height }) => $height}px;
|
|
6354
6388
|
transition: width 0.2s ease;
|
|
6355
6389
|
`;
|
|
6390
|
+
var Segment = import_styled_components50.default.div`
|
|
6391
|
+
height: 100%;
|
|
6392
|
+
flex: 0 0 ${({ $percent }) => $percent}%;
|
|
6393
|
+
background: ${({ $color }) => $color};
|
|
6394
|
+
transition: flex-basis 0.2s ease;
|
|
6395
|
+
`;
|
|
6356
6396
|
var ProgressBar2 = ({
|
|
6357
|
-
value,
|
|
6397
|
+
value = 0,
|
|
6398
|
+
segments,
|
|
6358
6399
|
color = colors.blue_700,
|
|
6359
6400
|
trackColor = colors.grey_200,
|
|
6360
6401
|
height = 8,
|
|
6361
6402
|
showLabel = false
|
|
6362
6403
|
}) => {
|
|
6363
|
-
const
|
|
6404
|
+
const stacked = segments ? stackSegments(segments) : null;
|
|
6405
|
+
const percent = stacked ? stacked.reduce((total, segment) => total + segment.width, 0) : clampPercent(value);
|
|
6364
6406
|
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(Wrapper6, { children: [
|
|
6365
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Track2, { $height: height, $trackColor: trackColor, children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6407
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Track2, { $height: height, $trackColor: trackColor, children: stacked ? stacked.map((segment, index) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6408
|
+
Segment,
|
|
6409
|
+
{
|
|
6410
|
+
$color: segment.color,
|
|
6411
|
+
$percent: segment.width,
|
|
6412
|
+
title: segment.label
|
|
6413
|
+
},
|
|
6414
|
+
`${segment.color}-${index}`
|
|
6415
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Fill, { $height: height, $color: color, $percent: percent }) }),
|
|
6366
6416
|
showLabel && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(Text, { size: "s", weight: "600", children: [
|
|
6367
6417
|
Math.round(percent),
|
|
6368
6418
|
" %"
|
package/dist/index.mjs
CHANGED
|
@@ -1656,7 +1656,8 @@ var pushToast = (type, message, options = {}) => {
|
|
|
1656
1656
|
type,
|
|
1657
1657
|
message,
|
|
1658
1658
|
title: options.title,
|
|
1659
|
-
timeOut: (_a = options.timeOut) != null ? _a : DEFAULT_TIMEOUT_BY_TYPE[type]
|
|
1659
|
+
timeOut: (_a = options.timeOut) != null ? _a : DEFAULT_TIMEOUT_BY_TYPE[type],
|
|
1660
|
+
onClick: options.onClick
|
|
1660
1661
|
}
|
|
1661
1662
|
];
|
|
1662
1663
|
emitChange();
|
|
@@ -1680,33 +1681,50 @@ var ToastCard = ({ toastItem }) => {
|
|
|
1680
1681
|
return () => clearTimeout(dismissTimer);
|
|
1681
1682
|
}, [handleDismiss, toastItem.timeOut]);
|
|
1682
1683
|
const { icon, accent, background } = TOAST[toastItem.type];
|
|
1683
|
-
return /* @__PURE__ */ jsxs7(
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
name: "
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1684
|
+
return /* @__PURE__ */ jsxs7(
|
|
1685
|
+
Card,
|
|
1686
|
+
{
|
|
1687
|
+
$accent: accent,
|
|
1688
|
+
$isExiting: isExiting,
|
|
1689
|
+
$isClickable: !!toastItem.onClick,
|
|
1690
|
+
role: "status",
|
|
1691
|
+
onClick: toastItem.onClick,
|
|
1692
|
+
children: [
|
|
1693
|
+
/* @__PURE__ */ jsx17(IconBadge, { $background: background, children: /* @__PURE__ */ jsx17(Icon, { name: icon, family: "regular", size: "m", color: accent }) }),
|
|
1694
|
+
/* @__PURE__ */ jsxs7(Content, { children: [
|
|
1695
|
+
toastItem.title && /* @__PURE__ */ jsx17(Text, { size: "s", weight: "700", children: toastItem.title }),
|
|
1696
|
+
/* @__PURE__ */ jsx17(Text, { size: "s", children: toastItem.message })
|
|
1697
|
+
] }),
|
|
1698
|
+
/* @__PURE__ */ jsx17(
|
|
1699
|
+
DismissButton,
|
|
1700
|
+
{
|
|
1701
|
+
onClick: (event) => {
|
|
1702
|
+
event.stopPropagation();
|
|
1703
|
+
handleDismiss();
|
|
1704
|
+
},
|
|
1705
|
+
children: /* @__PURE__ */ jsx17(
|
|
1706
|
+
Icon,
|
|
1707
|
+
{
|
|
1708
|
+
name: "xmark",
|
|
1709
|
+
family: "regular",
|
|
1710
|
+
size: "s",
|
|
1711
|
+
color: colors.grey_500,
|
|
1712
|
+
"aria-label": "Fermer"
|
|
1713
|
+
}
|
|
1714
|
+
)
|
|
1715
|
+
}
|
|
1716
|
+
),
|
|
1717
|
+
/* @__PURE__ */ jsx17(
|
|
1718
|
+
ProgressBar,
|
|
1719
|
+
{
|
|
1720
|
+
$accent: accent,
|
|
1721
|
+
$timeOut: toastItem.timeOut,
|
|
1722
|
+
$isExiting: isExiting
|
|
1723
|
+
}
|
|
1724
|
+
)
|
|
1725
|
+
]
|
|
1726
|
+
}
|
|
1727
|
+
);
|
|
1710
1728
|
};
|
|
1711
1729
|
var TOAST = {
|
|
1712
1730
|
success: {
|
|
@@ -1755,9 +1773,16 @@ var Card = styled13.div`
|
|
|
1755
1773
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
|
|
1756
1774
|
overflow: hidden;
|
|
1757
1775
|
pointer-events: auto;
|
|
1776
|
+
cursor: ${({ $isClickable }) => $isClickable ? "pointer" : "default"};
|
|
1758
1777
|
animation: ${({ $isExiting }) => $isExiting ? slideOut : slideIn} 180ms
|
|
1759
1778
|
ease-out forwards;
|
|
1760
1779
|
`;
|
|
1780
|
+
var DismissButton = styled13.span`
|
|
1781
|
+
position: absolute;
|
|
1782
|
+
top: 10px;
|
|
1783
|
+
right: 10px;
|
|
1784
|
+
cursor: pointer;
|
|
1785
|
+
`;
|
|
1761
1786
|
var IconBadge = styled13.div`
|
|
1762
1787
|
display: flex;
|
|
1763
1788
|
align-items: center;
|
|
@@ -6211,6 +6236,14 @@ var CountBadge = styled49.span`
|
|
|
6211
6236
|
import styled50 from "styled-components";
|
|
6212
6237
|
import { jsx as jsx61, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
6213
6238
|
var clampPercent = (value) => Math.max(0, Math.min(100, value));
|
|
6239
|
+
var stackSegments = (segments) => {
|
|
6240
|
+
let remaining = 100;
|
|
6241
|
+
return segments.map((segment) => {
|
|
6242
|
+
const width = clampPercent(Math.min(segment.value, remaining));
|
|
6243
|
+
remaining -= width;
|
|
6244
|
+
return __spreadProps(__spreadValues({}, segment), { width });
|
|
6245
|
+
});
|
|
6246
|
+
};
|
|
6214
6247
|
var Wrapper6 = styled50.div`
|
|
6215
6248
|
display: flex;
|
|
6216
6249
|
align-items: center;
|
|
@@ -6219,6 +6252,7 @@ var Wrapper6 = styled50.div`
|
|
|
6219
6252
|
`;
|
|
6220
6253
|
var Track2 = styled50.div`
|
|
6221
6254
|
position: relative;
|
|
6255
|
+
display: flex;
|
|
6222
6256
|
flex: 1;
|
|
6223
6257
|
height: ${({ $height }) => $height}px;
|
|
6224
6258
|
background: ${({ $trackColor }) => $trackColor};
|
|
@@ -6232,16 +6266,32 @@ var Fill = styled50.div`
|
|
|
6232
6266
|
border-radius: ${({ $height }) => $height}px;
|
|
6233
6267
|
transition: width 0.2s ease;
|
|
6234
6268
|
`;
|
|
6269
|
+
var Segment = styled50.div`
|
|
6270
|
+
height: 100%;
|
|
6271
|
+
flex: 0 0 ${({ $percent }) => $percent}%;
|
|
6272
|
+
background: ${({ $color }) => $color};
|
|
6273
|
+
transition: flex-basis 0.2s ease;
|
|
6274
|
+
`;
|
|
6235
6275
|
var ProgressBar2 = ({
|
|
6236
|
-
value,
|
|
6276
|
+
value = 0,
|
|
6277
|
+
segments,
|
|
6237
6278
|
color = colors.blue_700,
|
|
6238
6279
|
trackColor = colors.grey_200,
|
|
6239
6280
|
height = 8,
|
|
6240
6281
|
showLabel = false
|
|
6241
6282
|
}) => {
|
|
6242
|
-
const
|
|
6283
|
+
const stacked = segments ? stackSegments(segments) : null;
|
|
6284
|
+
const percent = stacked ? stacked.reduce((total, segment) => total + segment.width, 0) : clampPercent(value);
|
|
6243
6285
|
return /* @__PURE__ */ jsxs34(Wrapper6, { children: [
|
|
6244
|
-
/* @__PURE__ */ jsx61(Track2, { $height: height, $trackColor: trackColor, children:
|
|
6286
|
+
/* @__PURE__ */ jsx61(Track2, { $height: height, $trackColor: trackColor, children: stacked ? stacked.map((segment, index) => /* @__PURE__ */ jsx61(
|
|
6287
|
+
Segment,
|
|
6288
|
+
{
|
|
6289
|
+
$color: segment.color,
|
|
6290
|
+
$percent: segment.width,
|
|
6291
|
+
title: segment.label
|
|
6292
|
+
},
|
|
6293
|
+
`${segment.color}-${index}`
|
|
6294
|
+
)) : /* @__PURE__ */ jsx61(Fill, { $height: height, $color: color, $percent: percent }) }),
|
|
6245
6295
|
showLabel && /* @__PURE__ */ jsxs34(Text, { size: "s", weight: "600", children: [
|
|
6246
6296
|
Math.round(percent),
|
|
6247
6297
|
" %"
|