design-zystem 1.0.403 → 1.0.404
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/ui/index.d.mts +3 -3
- package/dist/ui/index.d.ts +3 -3
- package/dist/ui/index.js +157 -262
- package/dist/ui/index.mjs +159 -271
- package/dist/ui/style.css +3 -1
- package/package.json +2 -1
package/dist/ui/index.d.mts
CHANGED
|
@@ -1957,8 +1957,8 @@ interface TourStep {
|
|
|
1957
1957
|
id: string;
|
|
1958
1958
|
/** Identifiant(s) de `TourTarget` : le premier présent dans la page est mis en lumière. Absent : bulle centrée. */
|
|
1959
1959
|
target?: string | string[];
|
|
1960
|
-
title?:
|
|
1961
|
-
content:
|
|
1960
|
+
title?: string;
|
|
1961
|
+
content: string;
|
|
1962
1962
|
placement?: TourPlacement;
|
|
1963
1963
|
/** La zone éclairée reste cliquable (défaut). `false` : elle est seulement montrée. */
|
|
1964
1964
|
interactive?: boolean;
|
|
@@ -1987,6 +1987,6 @@ interface TourTargetProps {
|
|
|
1987
1987
|
}
|
|
1988
1988
|
/** Enveloppe sans boîte (`display: contents`) : marque une cible sans toucher à la mise en page. */
|
|
1989
1989
|
declare const TourTarget: ({ id, children }: TourTargetProps) => react.JSX.Element;
|
|
1990
|
-
declare const Tour: ({ steps, open, step, onStepChange, onClose, labels, targetTimeout, }: TourProps) =>
|
|
1990
|
+
declare const Tour: ({ steps, open, step, onStepChange, onClose, labels, targetTimeout, }: TourProps) => null;
|
|
1991
1991
|
|
|
1992
1992
|
export { type ActivityFeedItem, ActivityFeedPanel, type ActivityFeedPanelProps, Attachment, type AttachmentProps, type AttachmentStatus, Avatar, AvatarBadge, type AvatarBadgeConfig, type AvatarBadgeProps, AvatarFallback, type AvatarFallbackProps, AvatarGroup, type AvatarGroupProps, AvatarImage, type AvatarImageProps, type AvatarProps, Badge, type BadgeProps, Banner, type BannerAction, type BannerJustify, type BannerProps, type BannerToggle, Box, type BoxProps, Bulk, type BulkProps, type BulkSection, Button, type ButtonProps, COLOR_TOKENS, Checkbox, type CheckboxProps, Collapsible, CollapsibleContent, CollapsibleTrigger, type ColorKey, ColorPicker, type ColorPickerProps, type ColorToken, DatePicker, type DatePickerMode, type DatePickerProps, type DatePreset, Divider, type DividerProps, Drawer, DrawerBody, DrawerClose, DrawerDescription, type DrawerDirection, DrawerFooter, DrawerHeader, type DrawerProps, DrawerTitle, EmailInput, type EmailInputProps, EmptyState, type EmptyStateProps, FAB_EDGE_MARGIN, FAB_SIZE, FilePicker, type FilePickerProps, FileUploadZone, type FileUploadZoneProps, type FloatingAction, FloatingButton, type FloatingButtonProps, type FloatingSafeArea, Gantt, type GanttBand, type GanttBar, type GanttDay, GanttDot, type GanttProps, type GanttRow, GanttSwatch, type HexColor, HistoryButton, type HistoryButtonProps, type HistoryChange, HistoryDrawer, type HistoryDrawerProps, type HistoryEntry, type HistoryFilter, HistoryList, type HistoryListProps, Icon, IconBadge, type IconBadgeProps, type IconColor, type IconFamily, type IconProps, type IconSize, type IconTabItem, IconTabs, type IconTabsProps, IconTooltip, type IconTooltipProps, type IconVariant, Image, type ImageProps, InfoTooltip, type InfoTooltipProps, type InfoTooltipVariant, Input, InputGroup, InputGroupAddon, type InputGroupAddonProps, InputGroupButton, type InputGroupButtonProps, type InputGroupProps, type InputProps, Item, ItemActions, ItemContent, ItemDescription, ItemMedia, type ItemMediaProps, type ItemProps, ItemTitle, Label, type LabelProps, Layout, type LayoutProps, Link, type LinkProps, Message, MessageDateSeparator, type MessageDateSeparatorProps, type MessageProps, MessageScroller, type MessageScrollerProps, type MessageSeparatorTone, type MessageVariant, MetricCard, type MetricCardProps, Modal, ModalBody, ModalClose, ModalDescription, ModalFooter, ModalHeader, type ModalProps, ModalTitle, type MultiSelectProps, type OptimizeImageOptions, type OptimizeImageResult, PageContainer, type PageContainerProps, Pagination, type PaginationProps, PasswordInput, type PasswordInputProps, PdfPreview, type PdfPreviewProps, PhoneInput, type PhoneInputMeta, type PhoneInputProps, Popover, type PopoverMenuItem, type PopoverProps, ProgressBar, type ProgressBarProps, Radio, type RadioOption, type RadioProps, ScrollArea, type ScrollAreaProps, SearchInput, type SearchInputProps, Select, type SelectBubbleOption, type SelectOption, type SelectProps, Sidebar, SidebarContent, type SidebarContentProps, SidebarFooter, type SidebarFooterProps, SidebarGroup, type SidebarGroupProps, SidebarHeader, type SidebarHeaderProps, SidebarMenuButton, type SidebarMenuButtonProps, SidebarMenuSearchInput, type SidebarMenuSearchInputProps, SidebarMenuSub, SidebarMenuSubButton, type SidebarMenuSubButtonProps, SidebarMenuSubItem, type SidebarMenuSubItemProps, type SidebarMenuSubProps, type SidebarProps, SidebarSupportInfo, type SidebarSupportInfoProps, SidebarTrigger, type SidebarTriggerProps, SidebarUserMenu, type SidebarUserMenuAction, type SidebarUserMenuLeafAction, type SidebarUserMenuProps, type SingleSelectProps, Skeleton, type SkeletonProps, Spinner, type SpinnerProps, type SpinnerSize, Stepper, type StepperProps, Switch, type SwitchProps, TOUR_TARGET_ATTRIBUTE, type TabItem, Table, TableCell, type TableCellProps, type TableEmptyState, TableFooter, TableFooterCell, type TableFooterCellProps, type TableFooterProps, TableFooterRow, type TableFooterRowProps, TableHeader, TableHeaderCell, type TableHeaderCellProps, type TableHeaderProps, TableHeaderRow, type TableHeaderRowProps, type TablePagination, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, type TabsVariant, TagBubble, type TagBubbleProps, type TagLevelItem, TagLevelPicker, type TagLevelPickerProps, type TagOption, type TagSearchOption, TagSelect, type TagSelectProps, Text, type TextProps, Textarea, type TextareaProps, type TextareaVariant, Timeline, type TimelineItem, type TimelineProps, type ToastId, type ToastOptions, type ToastType, Toaster, Tooltip, type TooltipProps, Tour, type TourCloseReason, type TourLabels, type TourPlacement, type TourProps, type TourStep, TourTarget, type TourTargetProps, VideoPlayer, type VideoPlayerProps, addBusinessDays, allowAutofill, appendCacheBuster, appendQueryParam, buttonVariants, capitalizeFirstLetter, colors, easterDate, formatAddress, formatCityFromFormattedAddress, formatCityWithPostalCode, formatDate, formatDateWithTime, formatDistance, formatDuration, formatEuro, formatKM, formatLocality, formatName, formatNameWithInitial, formatPhoneNumber, formatPlate, formatPlateWithoutDashes, formatPostalCodeFromFormattedAddress, formatRegionCode, formatTime, formatVideoDuration, formatVin, generateHexColor, getAvatarColor, getCleanFileName, getElapsedTime, getFileIconByMimeType, getFileKind, getFileNameFromUrl, getInitials, getMimeCategory, getPastelColorPair, getRelativeTime, isHoliday, isSameDay, isolateCity, linkVariants, noAutofillProps, optimizeImage, parseAmount, parseIsoDate, toast, truncateFileName, truncateText, useAvatarSize };
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1957,8 +1957,8 @@ interface TourStep {
|
|
|
1957
1957
|
id: string;
|
|
1958
1958
|
/** Identifiant(s) de `TourTarget` : le premier présent dans la page est mis en lumière. Absent : bulle centrée. */
|
|
1959
1959
|
target?: string | string[];
|
|
1960
|
-
title?:
|
|
1961
|
-
content:
|
|
1960
|
+
title?: string;
|
|
1961
|
+
content: string;
|
|
1962
1962
|
placement?: TourPlacement;
|
|
1963
1963
|
/** La zone éclairée reste cliquable (défaut). `false` : elle est seulement montrée. */
|
|
1964
1964
|
interactive?: boolean;
|
|
@@ -1987,6 +1987,6 @@ interface TourTargetProps {
|
|
|
1987
1987
|
}
|
|
1988
1988
|
/** Enveloppe sans boîte (`display: contents`) : marque une cible sans toucher à la mise en page. */
|
|
1989
1989
|
declare const TourTarget: ({ id, children }: TourTargetProps) => react.JSX.Element;
|
|
1990
|
-
declare const Tour: ({ steps, open, step, onStepChange, onClose, labels, targetTimeout, }: TourProps) =>
|
|
1990
|
+
declare const Tour: ({ steps, open, step, onStepChange, onClose, labels, targetTimeout, }: TourProps) => null;
|
|
1991
1991
|
|
|
1992
1992
|
export { type ActivityFeedItem, ActivityFeedPanel, type ActivityFeedPanelProps, Attachment, type AttachmentProps, type AttachmentStatus, Avatar, AvatarBadge, type AvatarBadgeConfig, type AvatarBadgeProps, AvatarFallback, type AvatarFallbackProps, AvatarGroup, type AvatarGroupProps, AvatarImage, type AvatarImageProps, type AvatarProps, Badge, type BadgeProps, Banner, type BannerAction, type BannerJustify, type BannerProps, type BannerToggle, Box, type BoxProps, Bulk, type BulkProps, type BulkSection, Button, type ButtonProps, COLOR_TOKENS, Checkbox, type CheckboxProps, Collapsible, CollapsibleContent, CollapsibleTrigger, type ColorKey, ColorPicker, type ColorPickerProps, type ColorToken, DatePicker, type DatePickerMode, type DatePickerProps, type DatePreset, Divider, type DividerProps, Drawer, DrawerBody, DrawerClose, DrawerDescription, type DrawerDirection, DrawerFooter, DrawerHeader, type DrawerProps, DrawerTitle, EmailInput, type EmailInputProps, EmptyState, type EmptyStateProps, FAB_EDGE_MARGIN, FAB_SIZE, FilePicker, type FilePickerProps, FileUploadZone, type FileUploadZoneProps, type FloatingAction, FloatingButton, type FloatingButtonProps, type FloatingSafeArea, Gantt, type GanttBand, type GanttBar, type GanttDay, GanttDot, type GanttProps, type GanttRow, GanttSwatch, type HexColor, HistoryButton, type HistoryButtonProps, type HistoryChange, HistoryDrawer, type HistoryDrawerProps, type HistoryEntry, type HistoryFilter, HistoryList, type HistoryListProps, Icon, IconBadge, type IconBadgeProps, type IconColor, type IconFamily, type IconProps, type IconSize, type IconTabItem, IconTabs, type IconTabsProps, IconTooltip, type IconTooltipProps, type IconVariant, Image, type ImageProps, InfoTooltip, type InfoTooltipProps, type InfoTooltipVariant, Input, InputGroup, InputGroupAddon, type InputGroupAddonProps, InputGroupButton, type InputGroupButtonProps, type InputGroupProps, type InputProps, Item, ItemActions, ItemContent, ItemDescription, ItemMedia, type ItemMediaProps, type ItemProps, ItemTitle, Label, type LabelProps, Layout, type LayoutProps, Link, type LinkProps, Message, MessageDateSeparator, type MessageDateSeparatorProps, type MessageProps, MessageScroller, type MessageScrollerProps, type MessageSeparatorTone, type MessageVariant, MetricCard, type MetricCardProps, Modal, ModalBody, ModalClose, ModalDescription, ModalFooter, ModalHeader, type ModalProps, ModalTitle, type MultiSelectProps, type OptimizeImageOptions, type OptimizeImageResult, PageContainer, type PageContainerProps, Pagination, type PaginationProps, PasswordInput, type PasswordInputProps, PdfPreview, type PdfPreviewProps, PhoneInput, type PhoneInputMeta, type PhoneInputProps, Popover, type PopoverMenuItem, type PopoverProps, ProgressBar, type ProgressBarProps, Radio, type RadioOption, type RadioProps, ScrollArea, type ScrollAreaProps, SearchInput, type SearchInputProps, Select, type SelectBubbleOption, type SelectOption, type SelectProps, Sidebar, SidebarContent, type SidebarContentProps, SidebarFooter, type SidebarFooterProps, SidebarGroup, type SidebarGroupProps, SidebarHeader, type SidebarHeaderProps, SidebarMenuButton, type SidebarMenuButtonProps, SidebarMenuSearchInput, type SidebarMenuSearchInputProps, SidebarMenuSub, SidebarMenuSubButton, type SidebarMenuSubButtonProps, SidebarMenuSubItem, type SidebarMenuSubItemProps, type SidebarMenuSubProps, type SidebarProps, SidebarSupportInfo, type SidebarSupportInfoProps, SidebarTrigger, type SidebarTriggerProps, SidebarUserMenu, type SidebarUserMenuAction, type SidebarUserMenuLeafAction, type SidebarUserMenuProps, type SingleSelectProps, Skeleton, type SkeletonProps, Spinner, type SpinnerProps, type SpinnerSize, Stepper, type StepperProps, Switch, type SwitchProps, TOUR_TARGET_ATTRIBUTE, type TabItem, Table, TableCell, type TableCellProps, type TableEmptyState, TableFooter, TableFooterCell, type TableFooterCellProps, type TableFooterProps, TableFooterRow, type TableFooterRowProps, TableHeader, TableHeaderCell, type TableHeaderCellProps, type TableHeaderProps, TableHeaderRow, type TableHeaderRowProps, type TablePagination, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, type TabsVariant, TagBubble, type TagBubbleProps, type TagLevelItem, TagLevelPicker, type TagLevelPickerProps, type TagOption, type TagSearchOption, TagSelect, type TagSelectProps, Text, type TextProps, Textarea, type TextareaProps, type TextareaVariant, Timeline, type TimelineItem, type TimelineProps, type ToastId, type ToastOptions, type ToastType, Toaster, Tooltip, type TooltipProps, Tour, type TourCloseReason, type TourLabels, type TourPlacement, type TourProps, type TourStep, TourTarget, type TourTargetProps, VideoPlayer, type VideoPlayerProps, addBusinessDays, allowAutofill, appendCacheBuster, appendQueryParam, buttonVariants, capitalizeFirstLetter, colors, easterDate, formatAddress, formatCityFromFormattedAddress, formatCityWithPostalCode, formatDate, formatDateWithTime, formatDistance, formatDuration, formatEuro, formatKM, formatLocality, formatName, formatNameWithInitial, formatPhoneNumber, formatPlate, formatPlateWithoutDashes, formatPostalCodeFromFormattedAddress, formatRegionCode, formatTime, formatVideoDuration, formatVin, generateHexColor, getAvatarColor, getCleanFileName, getElapsedTime, getFileIconByMimeType, getFileKind, getFileNameFromUrl, getInitials, getMimeCategory, getPastelColorPair, getRelativeTime, isHoliday, isSameDay, isolateCity, linkVariants, noAutofillProps, optimizeImage, parseAmount, parseIsoDate, toast, truncateFileName, truncateText, useAvatarSize };
|
package/dist/ui/index.js
CHANGED
|
@@ -8676,7 +8676,7 @@ var optimizeImage = async (file, desiredBaseName, opts = {}) => {
|
|
|
8676
8676
|
|
|
8677
8677
|
// src/ui/components/ui/Tour.tsx
|
|
8678
8678
|
var import_react57 = require("react");
|
|
8679
|
-
var
|
|
8679
|
+
var import_driver = require("driver.js");
|
|
8680
8680
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
8681
8681
|
var TOUR_TARGET_ATTRIBUTE = "data-tour-target";
|
|
8682
8682
|
var DEFAULT_LABELS = {
|
|
@@ -8686,23 +8686,13 @@ var DEFAULT_LABELS = {
|
|
|
8686
8686
|
close: "Quitter le tutoriel",
|
|
8687
8687
|
counter: (current, total) => `${current} / ${total}`
|
|
8688
8688
|
};
|
|
8689
|
-
var
|
|
8690
|
-
var
|
|
8691
|
-
var
|
|
8692
|
-
var MARGIN = 12;
|
|
8689
|
+
var STAGE_PADDING = 6;
|
|
8690
|
+
var GHOST_TRANSITION_MS = 200;
|
|
8691
|
+
var HIGHLIGHT_DURATION_MS = 400;
|
|
8693
8692
|
var TourTarget = ({ id, children }) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", __spreadProps(__spreadValues({}, { [TOUR_TARGET_ATTRIBUTE]: id }), { className: "contents", children }));
|
|
8694
|
-
var
|
|
8695
|
-
const ids = Array.isArray(target) ? target : target ? [target] : [];
|
|
8696
|
-
for (const id of ids) {
|
|
8697
|
-
const element = document.querySelector(
|
|
8698
|
-
`[${TOUR_TARGET_ATTRIBUTE}="${id.replace(/"/g, '\\"')}"]`
|
|
8699
|
-
);
|
|
8700
|
-
if (element && measure(element)) return element;
|
|
8701
|
-
}
|
|
8702
|
-
return null;
|
|
8703
|
-
};
|
|
8693
|
+
var isContents = (element) => getComputedStyle(element).display === "contents";
|
|
8704
8694
|
var measure = (element) => {
|
|
8705
|
-
if (
|
|
8695
|
+
if (!isContents(element)) {
|
|
8706
8696
|
const { top: top2, left: left2, width, height } = element.getBoundingClientRect();
|
|
8707
8697
|
return width || height ? { top: top2, left: left2, width, height } : null;
|
|
8708
8698
|
}
|
|
@@ -8714,47 +8704,18 @@ var measure = (element) => {
|
|
|
8714
8704
|
const right = Math.max(...rects.map((r) => r.left + r.width));
|
|
8715
8705
|
return { top, left, width: right - left, height: bottom - top };
|
|
8716
8706
|
};
|
|
8717
|
-
var
|
|
8718
|
-
var
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
const vw = window.innerWidth;
|
|
8723
|
-
const vh = window.innerHeight;
|
|
8724
|
-
const fits = {
|
|
8725
|
-
bottom: vh - (hole.top + hole.height) >= cardHeight + GAP2 + MARGIN,
|
|
8726
|
-
top: hole.top >= cardHeight + GAP2 + MARGIN,
|
|
8727
|
-
right: vw - (hole.left + hole.width) >= CARD_WIDTH + GAP2 + MARGIN,
|
|
8728
|
-
left: hole.left >= CARD_WIDTH + GAP2 + MARGIN
|
|
8729
|
-
};
|
|
8730
|
-
const order = ["bottom", "top", "left", "right"];
|
|
8731
|
-
const side = (_a = preferred && fits[preferred] ? preferred : order.find((p) => fits[p])) != null ? _a : "bottom";
|
|
8732
|
-
const centerX = hole.left + hole.width / 2;
|
|
8733
|
-
const centerY = hole.top + hole.height / 2;
|
|
8734
|
-
if (side === "bottom" || side === "top") {
|
|
8735
|
-
const left2 = clamp(
|
|
8736
|
-
centerX - CARD_WIDTH / 2,
|
|
8737
|
-
MARGIN,
|
|
8738
|
-
vw - CARD_WIDTH - MARGIN
|
|
8707
|
+
var boxesOf = (element) => isContents(element) ? Array.from(element.children).flatMap(boxesOf) : [element];
|
|
8708
|
+
var findTarget = (ids) => {
|
|
8709
|
+
for (const id of ids) {
|
|
8710
|
+
const element = document.querySelector(
|
|
8711
|
+
`[${TOUR_TARGET_ATTRIBUTE}="${id.replace(/"/g, '\\"')}"]`
|
|
8739
8712
|
);
|
|
8740
|
-
|
|
8741
|
-
return {
|
|
8742
|
-
side,
|
|
8743
|
-
top: top2,
|
|
8744
|
-
left: left2,
|
|
8745
|
-
arrow: clamp(centerX - left2, 18, CARD_WIDTH - 18)
|
|
8746
|
-
};
|
|
8713
|
+
if (element && measure(element)) return element;
|
|
8747
8714
|
}
|
|
8748
|
-
|
|
8749
|
-
const left = side === "right" ? hole.left + hole.width + GAP2 : hole.left - GAP2 - CARD_WIDTH;
|
|
8750
|
-
return { side, top, left, arrow: clamp(centerY - top, 18, cardHeight - 18) };
|
|
8751
|
-
};
|
|
8752
|
-
var ARROW_CLASS = {
|
|
8753
|
-
bottom: "-top-[7px] -translate-x-1/2",
|
|
8754
|
-
top: "-bottom-[7px] -translate-x-1/2",
|
|
8755
|
-
right: "-left-[7px] -translate-y-1/2",
|
|
8756
|
-
left: "-right-[7px] -translate-y-1/2"
|
|
8715
|
+
return null;
|
|
8757
8716
|
};
|
|
8717
|
+
var sameRect = (a, b) => a === b || !!a && !!b && Math.abs(a.top - b.top) < 0.5 && Math.abs(a.left - b.left) < 0.5 && Math.abs(a.width - b.width) < 0.5 && Math.abs(a.height - b.height) < 0.5;
|
|
8718
|
+
var isOutOfView = (rect) => rect.top < 0 || rect.left < 0 || rect.top + rect.height > window.innerHeight || rect.left + rect.width > window.innerWidth;
|
|
8758
8719
|
var Tour = ({
|
|
8759
8720
|
steps,
|
|
8760
8721
|
open,
|
|
@@ -8767,234 +8728,168 @@ var Tour = ({
|
|
|
8767
8728
|
var _a;
|
|
8768
8729
|
const text = __spreadValues(__spreadValues({}, DEFAULT_LABELS), labels);
|
|
8769
8730
|
const current = steps[step];
|
|
8770
|
-
const hasStep = Boolean(current);
|
|
8771
|
-
const targetKey = [(_a = current == null ? void 0 : current.target) != null ? _a : []].flat().join("|");
|
|
8772
8731
|
const total = steps.length;
|
|
8773
8732
|
const isLast = step === total - 1;
|
|
8774
|
-
const
|
|
8775
|
-
const
|
|
8776
|
-
const
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
|
|
8733
|
+
const driverRef = (0, import_react57.useRef)(null);
|
|
8734
|
+
const ghostRef = (0, import_react57.useRef)(null);
|
|
8735
|
+
const actions = (0, import_react57.useRef)({
|
|
8736
|
+
next: () => {
|
|
8737
|
+
},
|
|
8738
|
+
previous: () => {
|
|
8739
|
+
},
|
|
8740
|
+
close: () => {
|
|
8741
|
+
}
|
|
8742
|
+
});
|
|
8743
|
+
actions.current = {
|
|
8744
|
+
next: () => isLast ? onClose("finish") : onStepChange(step + 1),
|
|
8745
|
+
previous: () => {
|
|
8746
|
+
if (step > 0) onStepChange(step - 1);
|
|
8747
|
+
},
|
|
8748
|
+
close: () => onClose("close")
|
|
8749
|
+
};
|
|
8750
|
+
(0, import_react57.useEffect)(() => {
|
|
8751
|
+
if (!open) return;
|
|
8752
|
+
const ghost = document.createElement("div");
|
|
8753
|
+
ghost.className = "dz-tour-target";
|
|
8754
|
+
document.body.appendChild(ghost);
|
|
8755
|
+
const instance = (0, import_driver.driver)({
|
|
8756
|
+
duration: HIGHLIGHT_DURATION_MS,
|
|
8757
|
+
allowKeyboardControl: false,
|
|
8758
|
+
overlayClickBehavior: () => {
|
|
8759
|
+
},
|
|
8760
|
+
overlayColor: "rgb(15, 23, 42)",
|
|
8761
|
+
overlayOpacity: 0.6,
|
|
8762
|
+
stagePadding: STAGE_PADDING,
|
|
8763
|
+
stageRadius: 8,
|
|
8764
|
+
popoverOffset: 8,
|
|
8765
|
+
popoverClass: "dz-tour"
|
|
8766
|
+
});
|
|
8767
|
+
driverRef.current = instance;
|
|
8768
|
+
ghostRef.current = ghost;
|
|
8769
|
+
return () => {
|
|
8770
|
+
instance.destroy();
|
|
8771
|
+
ghost.remove();
|
|
8772
|
+
driverRef.current = null;
|
|
8773
|
+
ghostRef.current = null;
|
|
8774
|
+
};
|
|
8775
|
+
}, [open]);
|
|
8780
8776
|
(0, import_react57.useEffect)(() => {
|
|
8781
|
-
if (!open
|
|
8782
|
-
const
|
|
8777
|
+
if (!open) return;
|
|
8778
|
+
const onKeyDown = (event) => {
|
|
8779
|
+
if (event.key === "Escape") {
|
|
8780
|
+
event.stopPropagation();
|
|
8781
|
+
actions.current.close();
|
|
8782
|
+
} else if (event.key === "ArrowRight") actions.current.next();
|
|
8783
|
+
else if (event.key === "ArrowLeft") actions.current.previous();
|
|
8784
|
+
};
|
|
8785
|
+
window.addEventListener("keydown", onKeyDown, true);
|
|
8786
|
+
return () => window.removeEventListener("keydown", onKeyDown, true);
|
|
8787
|
+
}, [open]);
|
|
8788
|
+
const view = (0, import_react57.useRef)({ current, text, step, total, isLast });
|
|
8789
|
+
view.current = { current, text, step, total, isLast };
|
|
8790
|
+
const targetKey = [(_a = current == null ? void 0 : current.target) != null ? _a : []].flat().join("|");
|
|
8791
|
+
const popoverKey = [
|
|
8792
|
+
current == null ? void 0 : current.title,
|
|
8793
|
+
current == null ? void 0 : current.content,
|
|
8794
|
+
current == null ? void 0 : current.placement,
|
|
8795
|
+
current == null ? void 0 : current.interactive,
|
|
8796
|
+
text.counter(step + 1, total),
|
|
8797
|
+
text.previous,
|
|
8798
|
+
isLast ? text.finish : text.next,
|
|
8799
|
+
text.close
|
|
8800
|
+
].join("|");
|
|
8801
|
+
(0, import_react57.useEffect)(() => {
|
|
8802
|
+
const instance = driverRef.current;
|
|
8803
|
+
const ghost = ghostRef.current;
|
|
8804
|
+
const { current: current2, text: text2, step: step2, total: total2, isLast: isLast2 } = view.current;
|
|
8805
|
+
if (!open || !current2 || !instance || !ghost) return;
|
|
8806
|
+
const targets = targetKey ? targetKey.split("|") : [];
|
|
8807
|
+
const interactive = current2.interactive !== false;
|
|
8808
|
+
const popover = {
|
|
8809
|
+
title: current2.title,
|
|
8810
|
+
description: current2.content,
|
|
8811
|
+
side: current2.placement,
|
|
8812
|
+
showButtons: step2 > 0 ? ["next", "previous", "close"] : ["next", "close"],
|
|
8813
|
+
showProgress: true,
|
|
8814
|
+
progressText: text2.counter(step2 + 1, total2),
|
|
8815
|
+
nextBtnText: isLast2 ? text2.finish : text2.next,
|
|
8816
|
+
prevBtnText: text2.previous,
|
|
8817
|
+
onNextClick: () => actions.current.next(),
|
|
8818
|
+
onPrevClick: () => actions.current.previous(),
|
|
8819
|
+
onCloseClick: () => actions.current.close(),
|
|
8820
|
+
onPopoverRender: (dom) => {
|
|
8821
|
+
var _a2;
|
|
8822
|
+
dom.closeButton.setAttribute("aria-label", text2.close);
|
|
8823
|
+
dom.wrapper.setAttribute("aria-label", (_a2 = current2.title) != null ? _a2 : current2.content);
|
|
8824
|
+
dom.nextButton.focus({ preventScroll: true });
|
|
8825
|
+
}
|
|
8826
|
+
};
|
|
8783
8827
|
const startedAt = performance.now();
|
|
8828
|
+
let shown = "none";
|
|
8784
8829
|
let scrolled = false;
|
|
8830
|
+
let lastRect = null;
|
|
8831
|
+
let refreshUntil = 0;
|
|
8832
|
+
let animatingUntil = 0;
|
|
8833
|
+
let clickable = [];
|
|
8785
8834
|
let frame = 0;
|
|
8786
|
-
|
|
8787
|
-
|
|
8835
|
+
const setClickable = (elements) => {
|
|
8836
|
+
clickable.forEach((el) => el.classList.remove("driver-active-element"));
|
|
8837
|
+
clickable = elements;
|
|
8838
|
+
clickable.forEach((el) => el.classList.add("driver-active-element"));
|
|
8839
|
+
};
|
|
8788
8840
|
const track = () => {
|
|
8841
|
+
var _a2;
|
|
8789
8842
|
const element = findTarget(targets);
|
|
8790
|
-
const
|
|
8791
|
-
if (element &&
|
|
8843
|
+
const rect = element ? measure(element) : null;
|
|
8844
|
+
if (element && rect) {
|
|
8792
8845
|
if (!scrolled) {
|
|
8793
8846
|
scrolled = true;
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
firstBox(element).scrollIntoView({
|
|
8847
|
+
if (isOutOfView(rect)) {
|
|
8848
|
+
(_a2 = boxesOf(element)[0]) == null ? void 0 : _a2.scrollIntoView({
|
|
8797
8849
|
block: "center",
|
|
8798
8850
|
inline: "nearest"
|
|
8799
8851
|
});
|
|
8800
8852
|
}
|
|
8801
8853
|
}
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8854
|
+
if (!sameRect(lastRect, rect)) {
|
|
8855
|
+
lastRect = rect;
|
|
8856
|
+
refreshUntil = Math.max(
|
|
8857
|
+
refreshUntil,
|
|
8858
|
+
performance.now() + GHOST_TRANSITION_MS + 50
|
|
8859
|
+
);
|
|
8860
|
+
Object.assign(ghost.style, {
|
|
8861
|
+
top: `${rect.top}px`,
|
|
8862
|
+
left: `${rect.left}px`,
|
|
8863
|
+
width: `${rect.width}px`,
|
|
8864
|
+
height: `${rect.height}px`
|
|
8865
|
+
});
|
|
8866
|
+
}
|
|
8867
|
+
if (shown !== "target") {
|
|
8868
|
+
shown = "target";
|
|
8869
|
+
ghost.style.pointerEvents = interactive ? "none" : "auto";
|
|
8870
|
+
ghost.style.display = "block";
|
|
8871
|
+
instance.highlight({ element: ghost, popover });
|
|
8872
|
+
animatingUntil = performance.now() + HIGHLIGHT_DURATION_MS;
|
|
8873
|
+
refreshUntil = animatingUntil + GHOST_TRANSITION_MS;
|
|
8874
|
+
setClickable(interactive ? boxesOf(element) : []);
|
|
8875
|
+
} else if (performance.now() >= animatingUntil && performance.now() < refreshUntil) {
|
|
8876
|
+
instance.refresh();
|
|
8877
|
+
}
|
|
8878
|
+
} else if (shown !== "center" && (!targets.length || performance.now() - startedAt > targetTimeout)) {
|
|
8879
|
+
shown = "center";
|
|
8880
|
+
ghost.style.display = "none";
|
|
8881
|
+
setClickable([]);
|
|
8882
|
+
instance.highlight({ popover });
|
|
8809
8883
|
}
|
|
8810
8884
|
frame = requestAnimationFrame(track);
|
|
8811
8885
|
};
|
|
8812
8886
|
track();
|
|
8813
|
-
return () =>
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
if (cardRef.current) setCardHeight(cardRef.current.offsetHeight);
|
|
8817
|
-
});
|
|
8818
|
-
(0, import_react57.useEffect)(() => {
|
|
8819
|
-
var _a2;
|
|
8820
|
-
if (open && status !== "pending")
|
|
8821
|
-
(_a2 = nextRef.current) == null ? void 0 : _a2.focus({ preventScroll: true });
|
|
8822
|
-
}, [open, step, status]);
|
|
8823
|
-
const goNext = (0, import_react57.useCallback)(() => {
|
|
8824
|
-
if (isLast) onClose("finish");
|
|
8825
|
-
else onStepChange(step + 1);
|
|
8826
|
-
}, [isLast, onClose, onStepChange, step]);
|
|
8827
|
-
const goPrevious = (0, import_react57.useCallback)(() => {
|
|
8828
|
-
if (step > 0) onStepChange(step - 1);
|
|
8829
|
-
}, [onStepChange, step]);
|
|
8830
|
-
(0, import_react57.useEffect)(() => {
|
|
8831
|
-
if (!open) return;
|
|
8832
|
-
const onKeyDown = (event) => {
|
|
8833
|
-
if (event.key === "Escape") {
|
|
8834
|
-
event.stopPropagation();
|
|
8835
|
-
onClose("close");
|
|
8836
|
-
} else if (event.key === "ArrowRight") goNext();
|
|
8837
|
-
else if (event.key === "ArrowLeft") goPrevious();
|
|
8887
|
+
return () => {
|
|
8888
|
+
cancelAnimationFrame(frame);
|
|
8889
|
+
setClickable([]);
|
|
8838
8890
|
};
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
}, [open, goNext, goPrevious, onClose]);
|
|
8842
|
-
if (!open || !current) return null;
|
|
8843
|
-
const hole = rect && {
|
|
8844
|
-
top: rect.top - HOLE_PADDING,
|
|
8845
|
-
left: rect.left - HOLE_PADDING,
|
|
8846
|
-
width: rect.width + HOLE_PADDING * 2,
|
|
8847
|
-
height: rect.height + HOLE_PADDING * 2
|
|
8848
|
-
};
|
|
8849
|
-
const placement = hole && placeCard(hole, cardHeight, current.placement);
|
|
8850
|
-
const blockClick = (event) => event.stopPropagation();
|
|
8851
|
-
const blocker = "fixed z-[10000]";
|
|
8852
|
-
return (0, import_react_dom.createPortal)(
|
|
8853
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_jsx_runtime94.Fragment, { children: [
|
|
8854
|
-
hole ? /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_jsx_runtime94.Fragment, { children: [
|
|
8855
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8856
|
-
"div",
|
|
8857
|
-
{
|
|
8858
|
-
"aria-hidden": true,
|
|
8859
|
-
className: "pointer-events-none fixed z-[10000] rounded-[8px] shadow-[0_0_0_9999px_rgba(15,23,42,0.6)] ring-[3px] ring-yellow-300 transition-all duration-200 ease-out",
|
|
8860
|
-
style: hole
|
|
8861
|
-
}
|
|
8862
|
-
),
|
|
8863
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8864
|
-
"div",
|
|
8865
|
-
{
|
|
8866
|
-
className: cn(blocker, "inset-x-0 top-0"),
|
|
8867
|
-
style: { height: Math.max(hole.top, 0) },
|
|
8868
|
-
onMouseDown: blockClick,
|
|
8869
|
-
onClick: blockClick
|
|
8870
|
-
}
|
|
8871
|
-
),
|
|
8872
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8873
|
-
"div",
|
|
8874
|
-
{
|
|
8875
|
-
className: cn(blocker, "inset-x-0 bottom-0"),
|
|
8876
|
-
style: { top: hole.top + hole.height },
|
|
8877
|
-
onMouseDown: blockClick,
|
|
8878
|
-
onClick: blockClick
|
|
8879
|
-
}
|
|
8880
|
-
),
|
|
8881
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8882
|
-
"div",
|
|
8883
|
-
{
|
|
8884
|
-
className: cn(blocker, "left-0"),
|
|
8885
|
-
style: {
|
|
8886
|
-
top: hole.top,
|
|
8887
|
-
height: hole.height,
|
|
8888
|
-
width: Math.max(hole.left, 0)
|
|
8889
|
-
},
|
|
8890
|
-
onMouseDown: blockClick,
|
|
8891
|
-
onClick: blockClick
|
|
8892
|
-
}
|
|
8893
|
-
),
|
|
8894
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8895
|
-
"div",
|
|
8896
|
-
{
|
|
8897
|
-
className: cn(blocker, "right-0"),
|
|
8898
|
-
style: {
|
|
8899
|
-
top: hole.top,
|
|
8900
|
-
height: hole.height,
|
|
8901
|
-
left: hole.left + hole.width
|
|
8902
|
-
},
|
|
8903
|
-
onMouseDown: blockClick,
|
|
8904
|
-
onClick: blockClick
|
|
8905
|
-
}
|
|
8906
|
-
),
|
|
8907
|
-
current.interactive === false && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: blocker, style: hole, onClick: blockClick })
|
|
8908
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8909
|
-
"div",
|
|
8910
|
-
{
|
|
8911
|
-
className: cn(blocker, "inset-0 bg-[rgba(15,23,42,0.6)]"),
|
|
8912
|
-
onMouseDown: blockClick,
|
|
8913
|
-
onClick: blockClick
|
|
8914
|
-
}
|
|
8915
|
-
),
|
|
8916
|
-
status !== "pending" && /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
8917
|
-
"div",
|
|
8918
|
-
{
|
|
8919
|
-
ref: cardRef,
|
|
8920
|
-
role: "dialog",
|
|
8921
|
-
"aria-modal": "true",
|
|
8922
|
-
"aria-labelledby": titleId,
|
|
8923
|
-
className: cn(
|
|
8924
|
-
"fixed z-[10001] rounded-[12px] bg-yellow-300 p-5 shadow-[0_10px_30px_rgba(0,0,0,0.25)]",
|
|
8925
|
-
!placement && "left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
8926
|
-
placement && "transition-[top,left] duration-200 ease-out"
|
|
8927
|
-
),
|
|
8928
|
-
style: __spreadValues({
|
|
8929
|
-
width: CARD_WIDTH
|
|
8930
|
-
}, placement && { top: placement.top, left: placement.left }),
|
|
8931
|
-
children: [
|
|
8932
|
-
placement && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8933
|
-
"span",
|
|
8934
|
-
{
|
|
8935
|
-
"aria-hidden": true,
|
|
8936
|
-
className: cn(
|
|
8937
|
-
"absolute h-3 w-3 rotate-45 bg-yellow-300",
|
|
8938
|
-
ARROW_CLASS[placement.side]
|
|
8939
|
-
),
|
|
8940
|
-
style: placement.side === "bottom" || placement.side === "top" ? { left: placement.arrow } : { top: placement.arrow }
|
|
8941
|
-
}
|
|
8942
|
-
),
|
|
8943
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(Layout, { column: true, gap: 3, children: [
|
|
8944
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(Layout, { row: true, justify: "between", align: "center", children: [
|
|
8945
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Text, { size: "xs", weight: "semibold", color: "white", children: text.counter(step + 1, total) }),
|
|
8946
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8947
|
-
Icon,
|
|
8948
|
-
{
|
|
8949
|
-
name: "xmark",
|
|
8950
|
-
size: "s",
|
|
8951
|
-
color: "white",
|
|
8952
|
-
onClick: () => onClose("close"),
|
|
8953
|
-
"aria-label": text.close
|
|
8954
|
-
}
|
|
8955
|
-
)
|
|
8956
|
-
] }),
|
|
8957
|
-
current.title && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Text, { id: titleId, size: "m", weight: "bold", color: "white", children: current.title }),
|
|
8958
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8959
|
-
Text,
|
|
8960
|
-
{
|
|
8961
|
-
id: current.title ? void 0 : titleId,
|
|
8962
|
-
size: "m",
|
|
8963
|
-
weight: "medium",
|
|
8964
|
-
color: "white",
|
|
8965
|
-
className: "leading-relaxed",
|
|
8966
|
-
children: current.content
|
|
8967
|
-
}
|
|
8968
|
-
),
|
|
8969
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(Layout, { row: true, justify: "end", gap: 2, children: [
|
|
8970
|
-
step > 0 && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8971
|
-
Button,
|
|
8972
|
-
{
|
|
8973
|
-
label: text.previous,
|
|
8974
|
-
variant: "outline",
|
|
8975
|
-
size: "s",
|
|
8976
|
-
className: "border-white text-white",
|
|
8977
|
-
onClick: goPrevious
|
|
8978
|
-
}
|
|
8979
|
-
),
|
|
8980
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8981
|
-
Button,
|
|
8982
|
-
{
|
|
8983
|
-
ref: nextRef,
|
|
8984
|
-
label: isLast ? text.finish : text.next,
|
|
8985
|
-
size: "s",
|
|
8986
|
-
className: "bg-white text-yellow-500",
|
|
8987
|
-
onClick: goNext
|
|
8988
|
-
}
|
|
8989
|
-
)
|
|
8990
|
-
] })
|
|
8991
|
-
] })
|
|
8992
|
-
]
|
|
8993
|
-
}
|
|
8994
|
-
)
|
|
8995
|
-
] }),
|
|
8996
|
-
document.body
|
|
8997
|
-
);
|
|
8891
|
+
}, [open, step, targetKey, popoverKey, targetTimeout]);
|
|
8892
|
+
return null;
|
|
8998
8893
|
};
|
|
8999
8894
|
// Annotate the CommonJS export names for ESM import in node:
|
|
9000
8895
|
0 && (module.exports = {
|