@factorialco/f0-react 4.44.0 → 4.45.0

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.
@@ -1,10 +1,10 @@
1
- import { gV as LayoutProvider$1, ah as withDataTestId, cd as Component, x as cn, z as cva, gD as useDeepCompareEffect, y as motion, eY as isEqual, gW as Text, ao as withSkeleton, S as Skeleton, u as useI18n, V as F0Icon, dx as ForwardRef, O as AnimatePresence, r as DropdownInternal, Y as ButtonInternal, bX as ForwardRef$2, ai as experimentalComponent, ae as Dropdown, gX as require_baseFlatten, an as OneEllipsis, gA as Tag$1, gY as useNormalizeNumericValueWithFormatter, gZ as numericFormatter, g_ as numericFinalValue, e7 as F0TagBalance, g$ as actionButtonVariants, h0 as actionSizes, fx as useControllableState, h1 as createContextScope, h2 as createCollection, h3 as composeEventHandlers, h4 as Primitive, h5 as useComposedRefs, h6 as useDirection, h7 as clamp$1, h8 as useSize, h9 as usePrevious, c6 as ForwardRef$3, c7 as ForwardRef$4, J as focusRing, W as DropdownMenu, X as DropdownMenuTrigger, a0 as F0Button, $ as DropdownMenuContent, g1 as DropdownMenuLabel, a5 as DropdownMenuItem, am as ForwardRef$5, a7 as DropdownMenuSeparator, aX as useReducedMotion, av as ScrollArea, ha as actionLinkVariants, bg as Collapsible, e4 as CollapsibleTrigger, bV as ForwardRef$6, bh as ForwardRef$7, bi as CollapsibleContent, aL as Popover, aM as PopoverTrigger, aN as PopoverContent, cY as Chip, fL as ScrollBar, hb as OverflowList, gC as getDataCollectionStorageKey, fC as INPUTFIELD_SIZES, hc as getFilterType, fv as DataTestIdWrapper, hd as FilterPickerInternal, aj as ForwardRef$8, aA as Counter, d7 as ForwardRef$9, c1 as ForwardRef$a, g9 as unwrapToZodObject, ga as getF0Config, gc as objectType, gJ as inferFieldType, f$ as InputMessages, he as getAugmentedNamespace, n as getDefaultExportFromCjs, hf as invariant, eD as clsx, h as ForwardRef$b, i as ForwardRef$c, j as F0Select, dM as ForwardRef$d, k as ForwardRef$f, f_ as Label, hg as F0AvatarIcon, dG as ForwardRef$g, gq as GroupHeader, ac as F0TagStatus, fu as Progress, cw as ForwardRef$h, gS as Metadata, bE as ForwardRef$j, bJ as HoverCard, bK as HoverCardTrigger, bL as HoverCardContent, d as F0OneIcon, U as ForwardRef$k, dd as ForwardRef$l, dT as ForwardRef$m, dF as ForwardRef$o, cz as ForwardRef$p, bT as ForwardRef$q, d1 as ForwardRef$r, g3 as DropdownMenuSub, g4 as DropdownMenuSubTrigger, _ as DropdownMenuPortal, g5 as DropdownMenuSubContent, g2 as DropdownMenuGroup, c2 as ForwardRef$t, dD as ForwardRef$u, bt as ForwardRef$v, bl as F0Icon$1, cG as Switch, ab as Tooltip, dH as ForwardRef$x, e5 as F0Checkbox, cF as F0TextInput, a8 as ForwardRef$y, b4 as F0TagRaw, aK as F0DialogContext, gj as f0FormField, hh as unknownType, hi as booleanType, hj as arrayType, hk as stringType, hl as numberType, hm as dateType, bY as ForwardRef$A, bZ as ForwardRef$B, e2 as F0Dialog$1, hn as ProgressBarCell, a_ as F0AvatarModule, b_ as Dialog$1, b$ as DialogContent, c0 as DialogTitle, ce as Card, ci as CardContent, cp as CardFooter, dV as ForwardRef$C, cf as CardHeader, bf as ForwardRef$D, a1 as ForwardRef$E, bk as F0Avatar, aa as ForwardRef$F, bC as ForwardRef$G, dS as ForwardRef$H, fy as ToggleGroup, fz as ToggleGroupItem, ho as F0ButtonToggleInternal, b3 as F0RichTextDisplay2, cj as ForwardRef$I, af as ForwardRef$O, cc as ForwardRef$P, gG as OneFilterPicker, fM as toArray, bQ as F0AvatarAlert, b7 as F0Link, M as useMediaQuery, hp as useIsomorphicLayoutEffect, hq as UserPlatformProvider, hr as L10nProvider, I as I18nProvider, hs as LinkProvider, ht as XRayProvider, hu as ImageProvider, hv as DataCollectionStorageProvider } from "./F0CanvasPanel-VGTPb68G.js";
1
+ import { gV as LayoutProvider$1, ah as withDataTestId, cd as Component, x as cn, z as cva, gD as useDeepCompareEffect, y as motion, eY as isEqual, gW as Text, ao as withSkeleton, S as Skeleton, u as useI18n, V as F0Icon, dx as ForwardRef, O as AnimatePresence, r as DropdownInternal, Y as ButtonInternal, bX as ForwardRef$2, ai as experimentalComponent, ae as Dropdown, gX as require_baseFlatten, an as OneEllipsis, gA as Tag$1, gY as useNormalizeNumericValueWithFormatter, gZ as numericFormatter, g_ as numericFinalValue, e7 as F0TagBalance, g$ as actionButtonVariants, h0 as actionSizes, fx as useControllableState, h1 as createContextScope, h2 as createCollection, h3 as composeEventHandlers, h4 as Primitive, h5 as useComposedRefs, h6 as useDirection, h7 as clamp$1, h8 as useSize, h9 as usePrevious, c6 as ForwardRef$3, c7 as ForwardRef$4, J as focusRing, W as DropdownMenu, X as DropdownMenuTrigger, a0 as F0Button, $ as DropdownMenuContent, g1 as DropdownMenuLabel, a5 as DropdownMenuItem, am as ForwardRef$5, a7 as DropdownMenuSeparator, aX as useReducedMotion, av as ScrollArea, ha as actionLinkVariants, bg as Collapsible, e4 as CollapsibleTrigger, bV as ForwardRef$6, bh as ForwardRef$7, bi as CollapsibleContent, aL as Popover, aM as PopoverTrigger, aN as PopoverContent, cY as Chip, fL as ScrollBar, hb as OverflowList, gC as getDataCollectionStorageKey, fC as INPUTFIELD_SIZES, hc as getFilterType, fv as DataTestIdWrapper, hd as FilterPickerInternal, bQ as F0AvatarAlert, c0 as DialogTitle, fM as toArray, aj as ForwardRef$8, aA as Counter, d7 as ForwardRef$9, c1 as ForwardRef$a, g9 as unwrapToZodObject, ga as getF0Config, gc as objectType, gJ as inferFieldType, f$ as InputMessages, he as getAugmentedNamespace, n as getDefaultExportFromCjs, hf as invariant, eD as clsx, h as ForwardRef$b, i as ForwardRef$c, j as F0Select, dM as ForwardRef$d, k as ForwardRef$f, f_ as Label, hg as F0AvatarIcon, dG as ForwardRef$g, gq as GroupHeader, ac as F0TagStatus, fu as Progress, cw as ForwardRef$h, gS as Metadata, bE as ForwardRef$j, bJ as HoverCard, bK as HoverCardTrigger, bL as HoverCardContent, d as F0OneIcon, U as ForwardRef$k, dd as ForwardRef$l, dT as ForwardRef$m, dF as ForwardRef$o, cz as ForwardRef$p, bT as ForwardRef$q, d1 as ForwardRef$r, g3 as DropdownMenuSub, g4 as DropdownMenuSubTrigger, _ as DropdownMenuPortal, g5 as DropdownMenuSubContent, g2 as DropdownMenuGroup, c2 as ForwardRef$t, dD as ForwardRef$u, bt as ForwardRef$v, bl as F0Icon$1, cG as Switch, ab as Tooltip, dH as ForwardRef$x, e5 as F0Checkbox, cF as F0TextInput, a8 as ForwardRef$y, b4 as F0TagRaw, aK as F0DialogContext, gj as f0FormField, hh as unknownType, hi as booleanType, hj as arrayType, hk as stringType, hl as numberType, hm as dateType, bY as ForwardRef$A, bZ as ForwardRef$B, e2 as F0Dialog$1, hn as ProgressBarCell, a_ as F0AvatarModule, b_ as Dialog$1, b$ as DialogContent, ce as Card, ci as CardContent, cp as CardFooter, dV as ForwardRef$C, cf as CardHeader, bf as ForwardRef$D, a1 as ForwardRef$E, bk as F0Avatar, aa as ForwardRef$F, bC as ForwardRef$G, dS as ForwardRef$H, fy as ToggleGroup, fz as ToggleGroupItem, ho as F0ButtonToggleInternal, b3 as F0RichTextDisplay2, cj as ForwardRef$I, af as ForwardRef$O, cc as ForwardRef$P, gG as OneFilterPicker, b7 as F0Link, M as useMediaQuery, hp as useIsomorphicLayoutEffect, hq as UserPlatformProvider, hr as L10nProvider, I as I18nProvider, hs as LinkProvider, ht as XRayProvider, hu as ImageProvider, hv as DataCollectionStorageProvider } from "./F0CanvasPanel-VGTPb68G.js";
2
2
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import React__default, { forwardRef, useRef, useImperativeHandle, Children, createContext, useContext, useState, useMemo, useEffect, useCallback, useLayoutEffect, isValidElement, Fragment as Fragment$1, useSyncExternalStore, useId, useReducer, lazy, Suspense, memo } from "react";
5
5
  import { D as AIButton, E as ForwardRef$1, G as ForwardRef$e, H as ForwardRef$i, I as ForwardRef$n, J as ForwardRef$s, K as ForwardRef$w, L as ForwardRef$z, M as F0Box, N as ForwardRef$J, O as ForwardRef$K, P as ForwardRef$L, Q as ForwardRef$M, R as ForwardRef$N, F as FormCardValueFormatterProvider } from "./F0AiProcessingOverlay-rViVqtAb.js";
6
6
  import { createPortal } from "react-dom";
7
- import { C as Carousel, aj as useSortable, ak as CSS$1, al as useSensors, am as useSensor, an as sortableKeyboardCoordinates, ao as KeyboardSensor, ap as PointerSensor, aq as DndContext, ar as SortableContext, as as DragOverlay, at as arrayMove, h as useAudioPlayer, F as F0SegmentedControl, au as Header, av as Content, aw as Footer, ax as DialogWrapper, ay as dialogAlikePrivateProps, az as F0Dialog, aA as useF0Form, aB as F0Form, H as F0ActionBar, aC as F0FormSection, aD as formOverlaysStore, aE as isFieldRequired, aF as evaluateRenderIf, aG as buildDynamicSchema, aH as renderFieldInput, aI as nanoid, aJ as mountFormOverlay, aK as unmountFormOverlay, aL as openFormDialog, aM as dequal, Z as F0TableOfContent, aa as Dialog, aN as FormMessage, T as F0NumberInput, aO as EmojiPicker, aP as data, c as ReorderItem, R as ReorderGroup, u as useDragControls, X as ResourceHeader, O as OneEmptyState, aQ as UpsellRequestResponseDialog, aR as Label$1, aS as UpsellingButton, q as BaseBanner, d as useDataCollectionSource, a1 as OneDataCollection, aT as extractDisplayValue, aU as navigationFilterTypes, aV as NavigationFilters, aW as DialogInternal, aX as DialogDescription, aY as PrivacyModeProvider, M as MotionConfig } from "./index-DoDUaTro.js";
7
+ import { C as Carousel, aj as useSortable, ak as CSS$1, al as useSensors, am as useSensor, an as sortableKeyboardCoordinates, ao as KeyboardSensor, ap as PointerSensor, aq as DndContext, ar as SortableContext, as as DragOverlay, at as arrayMove, h as useAudioPlayer, F as F0SegmentedControl, au as Header, av as Content, aw as Footer, ax as DialogWrapper, ay as dialogAlikePrivateProps, az as DialogInternal, aA as DialogDescription, aB as nanoid, aC as dialogsAlikeStore, aD as F0Dialog, aE as useF0Form, aF as F0Form, H as F0ActionBar, aG as F0FormSection, aH as formOverlaysStore, aI as isFieldRequired, aJ as evaluateRenderIf, aK as buildDynamicSchema, aL as renderFieldInput, aM as mountFormOverlay, aN as unmountFormOverlay, aO as openFormDialog, aP as dequal, Z as F0TableOfContent, aa as Dialog, aQ as FormMessage, T as F0NumberInput, aR as EmojiPicker, aS as data, c as ReorderItem, R as ReorderGroup, u as useDragControls, X as ResourceHeader, O as OneEmptyState, aT as UpsellRequestResponseDialog, aU as Label$1, aV as UpsellingButton, q as BaseBanner, d as useDataCollectionSource, a1 as OneDataCollection, aW as extractDisplayValue, aX as navigationFilterTypes, aY as NavigationFilters, aZ as PrivacyModeProvider, M as MotionConfig } from "./index-CNi_8WQC.js";
8
8
  import { utils, write as writeSync } from "./xlsx-CzlURDDb.js";
9
9
  import "./i18n-provider-defaults.js";
10
10
  import './f0.css';const CAROUSEL_COLUMNS = {
@@ -56085,7 +56085,188 @@ function _F0FilterPickerContent({
56085
56085
  ) });
56086
56086
  }
56087
56087
  _F0FilterPickerContent.displayName = "F0FilterPickerContent";
56088
- const F0FilterPickerContent = _F0FilterPickerContent, F0WizardContext = createContext(null);
56088
+ const F0FilterPickerContent = _F0FilterPickerContent, DialogNotificationInternal = ({
56089
+ isOpen: G = !1,
56090
+ onClose: Z = () => {
56091
+ },
56092
+ type: W,
56093
+ title: T,
56094
+ description: L,
56095
+ primaryAction: Y,
56096
+ secondaryAction: X
56097
+ }) => /* @__PURE__ */ jsx(
56098
+ DialogInternal,
56099
+ {
56100
+ isOpen: G,
56101
+ onClose: Z,
56102
+ variant: "notification",
56103
+ size: "sm",
56104
+ primaryAction: Y,
56105
+ secondaryAction: X,
56106
+ type: W === "critical" ? "critical" : "default",
56107
+ modal: !0,
56108
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 py-2", children: [
56109
+ /* @__PURE__ */ jsx(F0AvatarAlert, { type: W, size: "lg" }),
56110
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
56111
+ /* @__PURE__ */ jsx(DialogTitle, { className: "text-xl sm:text-lg", children: T }),
56112
+ /* @__PURE__ */ jsx(DialogDescription, { className: "text-lg sm:text-base", children: L })
56113
+ ] })
56114
+ ] })
56115
+ }
56116
+ ), EXIT_ANIMATION_MS$1 = 200, materializeActionValue = async (G) => Promise.resolve(
56117
+ typeof G.value == "function" ? await G.value() : G.value
56118
+ ), DialogsAlike = ({ items: G }) => {
56119
+ const [Z, W] = useState({}), [T, L] = useState(G), Y = useRef(G), X = useRef(/* @__PURE__ */ new Map());
56120
+ useEffect(() => {
56121
+ const D = new Set(G.map((O) => O.id)), C = Y.current;
56122
+ Y.current = G;
56123
+ for (const O of D) {
56124
+ const F = X.current.get(O);
56125
+ F && (clearTimeout(F), X.current.delete(O));
56126
+ }
56127
+ for (const O of C) {
56128
+ if (D.has(O.id) || X.current.has(O.id)) continue;
56129
+ const F = setTimeout(() => {
56130
+ X.current.delete(O.id), L(
56131
+ (E) => E.filter((U) => U.id !== O.id)
56132
+ );
56133
+ }, EXIT_ANIMATION_MS$1);
56134
+ X.current.set(O.id, F);
56135
+ }
56136
+ L((O) => {
56137
+ const F = [...G];
56138
+ for (const U of O)
56139
+ D.has(U.id) || F.some((J) => J.id === U.id) || F.push(U);
56140
+ return F.length === O.length && F.every((U, J) => U === O[J]) ? O : F;
56141
+ });
56142
+ }, [G]), useEffect(() => {
56143
+ const D = X.current;
56144
+ return () => {
56145
+ for (const C of D.values()) clearTimeout(C);
56146
+ D.clear();
56147
+ };
56148
+ }, []);
56149
+ const S = useMemo(() => new Set(G.map((D) => D.id)), [G]), V = (D) => Z[D] > 0, I = (D, C) => {
56150
+ W((O) => ({
56151
+ ...O,
56152
+ [D]: (O[D] || 0) + C
56153
+ }));
56154
+ }, R = useMemo(() => {
56155
+ const D = (C, O) => ({
56156
+ ...O,
56157
+ value: nanoid(),
56158
+ onClick: async () => {
56159
+ O.nonBlocking || I(C.id, 1);
56160
+ try {
56161
+ const F = await materializeActionValue(O);
56162
+ C.onClickAction(O, F);
56163
+ } finally {
56164
+ O.nonBlocking || I(C.id, -1);
56165
+ }
56166
+ return Promise.resolve();
56167
+ }
56168
+ });
56169
+ return T.map((C) => ({
56170
+ ...C,
56171
+ actions: {
56172
+ primary: toArray(C.actions.primary).map(
56173
+ (O) => D(C, O)
56174
+ ),
56175
+ secondary: toArray(C.actions.secondary).map(
56176
+ (O) => D(C, O)
56177
+ )
56178
+ }
56179
+ }));
56180
+ }, [T]), z = useMemo(() => {
56181
+ const D = (C, O) => ({
56182
+ ...O,
56183
+ disabled: O.disabled || V(C)
56184
+ });
56185
+ return R.map((C) => ({
56186
+ ...C,
56187
+ actions: {
56188
+ primary: C.actions.primary.map(
56189
+ (O) => D(C.id, O)
56190
+ ),
56191
+ secondary: C.actions.secondary.map(
56192
+ (O) => D(C.id, O)
56193
+ )
56194
+ }
56195
+ }));
56196
+ }, [R, Z]);
56197
+ return /* @__PURE__ */ jsx(Fragment, { children: z.map((D) => /* @__PURE__ */ jsx(Fragment$1, { children: D.variant === "notification" ? /* @__PURE__ */ jsx(
56198
+ DialogNotificationInternal,
56199
+ {
56200
+ title: D.title,
56201
+ description: D.description ?? "",
56202
+ type: D.type,
56203
+ isOpen: S.has(D.id),
56204
+ onClose: D.onCloseDialog,
56205
+ primaryAction: D.actions.primary[0],
56206
+ secondaryAction: D.actions.secondary
56207
+ },
56208
+ D.id
56209
+ ) : D.variant === "drawer" ? /* @__PURE__ */ jsx(
56210
+ DrawerInternal,
56211
+ {
56212
+ disableClose: V(D.id),
56213
+ isOpen: S.has(D.id),
56214
+ size: D.size,
56215
+ onClose: D.onCloseDialog,
56216
+ title: D.title,
56217
+ description: D.description,
56218
+ primaryAction: D.actions.primary,
56219
+ secondaryAction: D.actions.secondary,
56220
+ modal: D.modal,
56221
+ position: D.position,
56222
+ module: D.module,
56223
+ children: D.content
56224
+ },
56225
+ D.id
56226
+ ) : /* @__PURE__ */ jsx(
56227
+ DialogInternal,
56228
+ {
56229
+ disableClose: V(D.id),
56230
+ isOpen: S.has(D.id),
56231
+ size: D.size,
56232
+ onClose: D.onCloseDialog,
56233
+ title: D.title,
56234
+ description: D.description,
56235
+ primaryAction: D.actions.primary,
56236
+ secondaryAction: D.actions.secondary,
56237
+ modal: D.modal,
56238
+ module: D.module,
56239
+ children: D.content
56240
+ },
56241
+ D.id
56242
+ ) }, D.id)) });
56243
+ }, DialogsAlikeLayoutProvider = ({
56244
+ children: G
56245
+ }) => {
56246
+ const Z = useSyncExternalStore(
56247
+ dialogsAlikeStore.subscribe,
56248
+ dialogsAlikeStore.getSnapshot,
56249
+ dialogsAlikeStore.getServerSnapshot
56250
+ ), W = useI18n(), [T, L] = useState(null);
56251
+ useEffect(() => {
56252
+ const S = dialogsAlikeStore.acquireRenderer();
56253
+ return L(S.id), S.release;
56254
+ }, []);
56255
+ const Y = useSyncExternalStore(
56256
+ dialogsAlikeStore.subscribeRenderer,
56257
+ dialogsAlikeStore.getActiveRendererId,
56258
+ () => null
56259
+ ), X = T !== null && T === Y;
56260
+ return useEffect(() => {
56261
+ dialogsAlikeStore.setDefaultActionLabels({
56262
+ ok: W.actions.ok,
56263
+ cancel: W.actions.cancel
56264
+ });
56265
+ }, [W]), /* @__PURE__ */ jsxs(Fragment, { children: [
56266
+ X && typeof document < "u" && createPortal(/* @__PURE__ */ jsx(DialogsAlike, { items: Z }), document.body),
56267
+ G
56268
+ ] });
56269
+ }, F0WizardContext = createContext(null);
56089
56270
  function useF0Wizard() {
56090
56271
  const G = useContext(F0WizardContext);
56091
56272
  if (!G)
@@ -56793,7 +56974,7 @@ function F0WizardForm$1(G) {
56793
56974
  );
56794
56975
  }
56795
56976
  F0WizardForm$1.displayName = "F0WizardForm";
56796
- const F0WizardForm = withDataTestId(F0WizardForm$1), EXIT_ANIMATION_MS$1 = 200, FormOverlaysProvider = ({
56977
+ const F0WizardForm = withDataTestId(F0WizardForm$1), EXIT_ANIMATION_MS = 200, FormOverlaysProvider = ({
56797
56978
  children: G
56798
56979
  }) => {
56799
56980
  const Z = useSyncExternalStore(
@@ -56829,7 +57010,7 @@ const F0WizardForm = withDataTestId(F0WizardForm$1), EXIT_ANIMATION_MS$1 = 200,
56829
57010
  L.current.delete(V.id), W(
56830
57011
  (R) => R.filter((z) => z.id !== V.id)
56831
57012
  );
56832
- }, EXIT_ANIMATION_MS$1);
57013
+ }, EXIT_ANIMATION_MS);
56833
57014
  L.current.set(V.id, I);
56834
57015
  }
56835
57016
  W((V) => {
@@ -70395,7 +70576,7 @@ const configurePdfWorker = (G) => {
70395
70576
  }), T;
70396
70577
  };
70397
70578
  ensurePdfWorker();
70398
- const SheetViewer = lazy(() => import("./SheetViewer-HsR5toIL.js")), DocxViewer = lazy(() => import("./DocxViewer-BIZmtyWY.js")), TextViewer = lazy(() => import("./TextViewer-Dn0MDAXs.js")), PAGE_VIEWPORT_PADDING = 48, F0PdfViewerBase = forwardRef(
70579
+ const SheetViewer = lazy(() => import("./SheetViewer-huUU5vFM.js")), DocxViewer = lazy(() => import("./DocxViewer-Dpj4i6ig.js")), TextViewer = lazy(() => import("./TextViewer-DXDZcvag.js")), PAGE_VIEWPORT_PADDING = 48, F0PdfViewerBase = forwardRef(
70399
70580
  (G, Z) => {
70400
70581
  const { kind: W = "pdf", mimeType: T, ...L } = G;
70401
70582
  if (W === "pdf") return /* @__PURE__ */ jsx(PdfViewerBase, { ref: Z, ...L });
@@ -78553,45 +78734,45 @@ const useIsDesktop = () => useMediaQuery("(min-width: 640px)", {
78553
78734
  initializeWithValue: !1
78554
78735
  }), useIsMobile = () => useMediaQuery("(max-width: 639px)", {
78555
78736
  initializeWithValue: !1
78556
- }), EMPTY$1 = [];
78557
- let items$1 = EMPTY$1;
78558
- const listeners$1 = /* @__PURE__ */ new Set();
78559
- let rendererSeq$1 = 0;
78560
- const mountedRenderers$1 = /* @__PURE__ */ new Set(), rendererListeners$1 = /* @__PURE__ */ new Set(), emit$1 = () => {
78561
- for (const G of listeners$1) G();
78562
- }, emitRenderer$1 = () => {
78563
- for (const G of rendererListeners$1) G();
78737
+ }), EMPTY = [];
78738
+ let items = EMPTY;
78739
+ const listeners = /* @__PURE__ */ new Set();
78740
+ let rendererSeq = 0;
78741
+ const mountedRenderers = /* @__PURE__ */ new Set(), rendererListeners = /* @__PURE__ */ new Set(), emit = () => {
78742
+ for (const G of listeners) G();
78743
+ }, emitRenderer = () => {
78744
+ for (const G of rendererListeners) G();
78564
78745
  }, toastStore = {
78565
78746
  subscribe(G) {
78566
- return listeners$1.add(G), () => {
78567
- listeners$1.delete(G);
78747
+ return listeners.add(G), () => {
78748
+ listeners.delete(G);
78568
78749
  };
78569
78750
  },
78570
78751
  getSnapshot() {
78571
- return items$1;
78752
+ return items;
78572
78753
  },
78573
78754
  getServerSnapshot() {
78574
- return EMPTY$1;
78755
+ return EMPTY;
78575
78756
  },
78576
78757
  /**
78577
78758
  * Add a toast, or replace an existing one when an item with the same id is
78578
78759
  * already open (so repeated `toasts.open({ id })` calls update in place).
78579
78760
  */
78580
78761
  addItem(G) {
78581
- const Z = items$1.findIndex((W) => W.id === G.id);
78762
+ const Z = items.findIndex((W) => W.id === G.id);
78582
78763
  if (Z !== -1) {
78583
- const W = [...items$1];
78584
- W[Z] = G, items$1 = W;
78764
+ const W = [...items];
78765
+ W[Z] = G, items = W;
78585
78766
  } else
78586
- items$1 = [...items$1, G];
78587
- emit$1();
78767
+ items = [...items, G];
78768
+ emit();
78588
78769
  },
78589
78770
  removeItem(G) {
78590
- items$1.some((Z) => Z.id === G) && (items$1 = items$1.filter((Z) => Z.id !== G), emit$1());
78771
+ items.some((Z) => Z.id === G) && (items = items.filter((Z) => Z.id !== G), emit());
78591
78772
  },
78592
78773
  /** Remove all open toasts. */
78593
78774
  clear() {
78594
- items$1.length !== 0 && (items$1 = EMPTY$1, emit$1());
78775
+ items.length !== 0 && (items = EMPTY, emit());
78595
78776
  },
78596
78777
  /**
78597
78778
  * Register a mounted provider as a candidate renderer. Returns the assigned
@@ -78599,29 +78780,29 @@ const mountedRenderers$1 = /* @__PURE__ */ new Set(), rendererListeners$1 = /* @
78599
78780
  * `getActiveRendererId` to know whether this instance should render.
78600
78781
  */
78601
78782
  acquireRenderer() {
78602
- rendererSeq$1 += 1;
78603
- const G = rendererSeq$1;
78604
- return mountedRenderers$1.add(G), emitRenderer$1(), {
78783
+ rendererSeq += 1;
78784
+ const G = rendererSeq;
78785
+ return mountedRenderers.add(G), emitRenderer(), {
78605
78786
  id: G,
78606
78787
  release() {
78607
- mountedRenderers$1.delete(G), emitRenderer$1();
78788
+ mountedRenderers.delete(G), emitRenderer();
78608
78789
  }
78609
78790
  };
78610
78791
  },
78611
78792
  /** The elected renderer (lowest mounted id), or null if none mounted. */
78612
78793
  getActiveRendererId() {
78613
78794
  let G = null;
78614
- for (const Z of mountedRenderers$1)
78795
+ for (const Z of mountedRenderers)
78615
78796
  (G === null || Z < G) && (G = Z);
78616
78797
  return G;
78617
78798
  },
78618
78799
  subscribeRenderer(G) {
78619
- return rendererListeners$1.add(G), () => {
78620
- rendererListeners$1.delete(G);
78800
+ return rendererListeners.add(G), () => {
78801
+ rendererListeners.delete(G);
78621
78802
  };
78622
78803
  },
78623
78804
  hasProvider() {
78624
- return mountedRenderers$1.size > 0;
78805
+ return mountedRenderers.size > 0;
78625
78806
  }
78626
78807
  }, toastContainerPositionClasses = {
78627
78808
  "bottom-left": "items-end justify-start"
@@ -78902,19 +79083,19 @@ const mountedRenderers$1 = /* @__PURE__ */ new Set(), rendererListeners$1 = /* @
78902
79083
  ),
78903
79084
  G
78904
79085
  ] });
78905
- }, DEFAULT_DURATION = 1e4, warnIfNoProvider$1 = (G) => {
79086
+ }, DEFAULT_DURATION = 1e4, warnIfNoProvider = (G) => {
78906
79087
  process.env.NODE_ENV !== "production" && !toastStore.hasProvider() && console.warn(
78907
79088
  `[f0] ${G} was called but no <F0Provider> is mounted, so the toast will not render. Make sure your app is wrapped in <F0Provider>.`
78908
79089
  );
78909
79090
  }, open = (G) => {
78910
79091
  const Z = G.id ?? nanoid();
78911
- return warnIfNoProvider$1("toasts.open()"), toastStore.addItem({
79092
+ return warnIfNoProvider("toasts.open()"), toastStore.addItem({
78912
79093
  duration: G.persistent ? void 0 : DEFAULT_DURATION,
78913
79094
  ...G,
78914
79095
  id: Z,
78915
79096
  onClose: () => toastStore.removeItem(Z)
78916
79097
  }), Z;
78917
- }, close$1 = (G) => {
79098
+ }, close = (G) => {
78918
79099
  toastStore.removeItem(G);
78919
79100
  }, closeAll = () => {
78920
79101
  toastStore.clear();
@@ -78929,256 +79110,9 @@ const mountedRenderers$1 = /* @__PURE__ */ new Set(), rendererListeners$1 = /* @
78929
79110
  * Dismiss a toast by id.
78930
79111
  * @param id The id returned by `toasts.open`
78931
79112
  */
78932
- close: close$1,
79113
+ close,
78933
79114
  /** Dismiss every open toast. */
78934
79115
  closeAll
78935
- }, DialogNotificationInternal = ({
78936
- isOpen: G = !1,
78937
- onClose: Z = () => {
78938
- },
78939
- type: W,
78940
- title: T,
78941
- description: L,
78942
- primaryAction: Y,
78943
- secondaryAction: X
78944
- }) => /* @__PURE__ */ jsx(
78945
- DialogInternal,
78946
- {
78947
- isOpen: G,
78948
- onClose: Z,
78949
- variant: "notification",
78950
- size: "sm",
78951
- primaryAction: Y,
78952
- secondaryAction: X,
78953
- type: W === "critical" ? "critical" : "default",
78954
- modal: !0,
78955
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 py-2", children: [
78956
- /* @__PURE__ */ jsx(F0AvatarAlert, { type: W, size: "lg" }),
78957
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
78958
- /* @__PURE__ */ jsx(DialogTitle, { className: "text-xl sm:text-lg", children: T }),
78959
- /* @__PURE__ */ jsx(DialogDescription, { className: "text-lg sm:text-base", children: L })
78960
- ] })
78961
- ] })
78962
- }
78963
- ), EXIT_ANIMATION_MS = 200, materializeActionValue = async (G) => Promise.resolve(
78964
- typeof G.value == "function" ? await G.value() : G.value
78965
- ), DialogsAlike = ({ items: G }) => {
78966
- const [Z, W] = useState({}), [T, L] = useState(G), Y = useRef(G), X = useRef(/* @__PURE__ */ new Map());
78967
- useEffect(() => {
78968
- const D = new Set(G.map((O) => O.id)), C = Y.current;
78969
- Y.current = G;
78970
- for (const O of D) {
78971
- const F = X.current.get(O);
78972
- F && (clearTimeout(F), X.current.delete(O));
78973
- }
78974
- for (const O of C) {
78975
- if (D.has(O.id) || X.current.has(O.id)) continue;
78976
- const F = setTimeout(() => {
78977
- X.current.delete(O.id), L(
78978
- (E) => E.filter((U) => U.id !== O.id)
78979
- );
78980
- }, EXIT_ANIMATION_MS);
78981
- X.current.set(O.id, F);
78982
- }
78983
- L((O) => {
78984
- const F = [...G];
78985
- for (const U of O)
78986
- D.has(U.id) || F.some((J) => J.id === U.id) || F.push(U);
78987
- return F.length === O.length && F.every((U, J) => U === O[J]) ? O : F;
78988
- });
78989
- }, [G]), useEffect(() => {
78990
- const D = X.current;
78991
- return () => {
78992
- for (const C of D.values()) clearTimeout(C);
78993
- D.clear();
78994
- };
78995
- }, []);
78996
- const S = useMemo(() => new Set(G.map((D) => D.id)), [G]), V = (D) => Z[D] > 0, I = (D, C) => {
78997
- W((O) => ({
78998
- ...O,
78999
- [D]: (O[D] || 0) + C
79000
- }));
79001
- }, R = useMemo(() => {
79002
- const D = (C, O) => ({
79003
- ...O,
79004
- value: nanoid(),
79005
- onClick: async () => {
79006
- O.nonBlocking || I(C.id, 1);
79007
- try {
79008
- const F = await materializeActionValue(O);
79009
- C.onClickAction(O, F);
79010
- } finally {
79011
- O.nonBlocking || I(C.id, -1);
79012
- }
79013
- return Promise.resolve();
79014
- }
79015
- });
79016
- return T.map((C) => ({
79017
- ...C,
79018
- actions: {
79019
- primary: toArray(C.actions.primary).map(
79020
- (O) => D(C, O)
79021
- ),
79022
- secondary: toArray(C.actions.secondary).map(
79023
- (O) => D(C, O)
79024
- )
79025
- }
79026
- }));
79027
- }, [T]), z = useMemo(() => {
79028
- const D = (C, O) => ({
79029
- ...O,
79030
- disabled: O.disabled || V(C)
79031
- });
79032
- return R.map((C) => ({
79033
- ...C,
79034
- actions: {
79035
- primary: C.actions.primary.map(
79036
- (O) => D(C.id, O)
79037
- ),
79038
- secondary: C.actions.secondary.map(
79039
- (O) => D(C.id, O)
79040
- )
79041
- }
79042
- }));
79043
- }, [R, Z]);
79044
- return /* @__PURE__ */ jsx(Fragment, { children: z.map((D) => /* @__PURE__ */ jsx(Fragment$1, { children: D.variant === "notification" ? /* @__PURE__ */ jsx(
79045
- DialogNotificationInternal,
79046
- {
79047
- title: D.title,
79048
- description: D.description ?? "",
79049
- type: D.type,
79050
- isOpen: S.has(D.id),
79051
- onClose: D.onCloseDialog,
79052
- primaryAction: D.actions.primary[0],
79053
- secondaryAction: D.actions.secondary
79054
- },
79055
- D.id
79056
- ) : D.variant === "drawer" ? /* @__PURE__ */ jsx(
79057
- DrawerInternal,
79058
- {
79059
- disableClose: V(D.id),
79060
- isOpen: S.has(D.id),
79061
- size: D.size,
79062
- onClose: D.onCloseDialog,
79063
- title: D.title,
79064
- description: D.description,
79065
- primaryAction: D.actions.primary,
79066
- secondaryAction: D.actions.secondary,
79067
- modal: D.modal,
79068
- position: D.position,
79069
- module: D.module,
79070
- children: D.content
79071
- },
79072
- D.id
79073
- ) : /* @__PURE__ */ jsx(
79074
- DialogInternal,
79075
- {
79076
- disableClose: V(D.id),
79077
- isOpen: S.has(D.id),
79078
- size: D.size,
79079
- onClose: D.onCloseDialog,
79080
- title: D.title,
79081
- description: D.description,
79082
- primaryAction: D.actions.primary,
79083
- secondaryAction: D.actions.secondary,
79084
- modal: D.modal,
79085
- module: D.module,
79086
- children: D.content
79087
- },
79088
- D.id
79089
- ) }, D.id)) });
79090
- }, EMPTY = [];
79091
- let items = EMPTY;
79092
- const listeners = /* @__PURE__ */ new Set();
79093
- let defaultActionLabels = { ok: "Ok", cancel: "Cancel" }, rendererSeq = 0;
79094
- const mountedRenderers = /* @__PURE__ */ new Set(), rendererListeners = /* @__PURE__ */ new Set(), emit = () => {
79095
- for (const G of listeners) G();
79096
- }, emitRenderer = () => {
79097
- for (const G of rendererListeners) G();
79098
- }, dialogsAlikeStore = {
79099
- subscribe(G) {
79100
- return listeners.add(G), () => {
79101
- listeners.delete(G);
79102
- };
79103
- },
79104
- getSnapshot() {
79105
- return items;
79106
- },
79107
- getServerSnapshot() {
79108
- return EMPTY;
79109
- },
79110
- addItem(G) {
79111
- items = [...items, G], emit();
79112
- },
79113
- removeItem(G) {
79114
- items.some((Z) => Z.id === G) && (items = items.filter((Z) => Z.id !== G), emit());
79115
- },
79116
- /** Remove all open items. Mainly useful to isolate Storybook stories/tests. */
79117
- clear() {
79118
- items.length !== 0 && (items = EMPTY, emit());
79119
- },
79120
- setDefaultActionLabels(G) {
79121
- defaultActionLabels = G;
79122
- },
79123
- getDefaultActionLabels() {
79124
- return defaultActionLabels;
79125
- },
79126
- /**
79127
- * Register a mounted provider as a candidate renderer. Returns the assigned
79128
- * id and a `release` to call on unmount. Pair with `subscribeRenderer` +
79129
- * `getActiveRendererId` to know whether this instance should render.
79130
- */
79131
- acquireRenderer() {
79132
- rendererSeq += 1;
79133
- const G = rendererSeq;
79134
- return mountedRenderers.add(G), emitRenderer(), {
79135
- id: G,
79136
- release() {
79137
- mountedRenderers.delete(G), emitRenderer();
79138
- }
79139
- };
79140
- },
79141
- /** The elected renderer (lowest mounted id), or null if none mounted. */
79142
- getActiveRendererId() {
79143
- let G = null;
79144
- for (const Z of mountedRenderers)
79145
- (G === null || Z < G) && (G = Z);
79146
- return G;
79147
- },
79148
- subscribeRenderer(G) {
79149
- return rendererListeners.add(G), () => {
79150
- rendererListeners.delete(G);
79151
- };
79152
- },
79153
- hasProvider() {
79154
- return mountedRenderers.size > 0;
79155
- }
79156
- }, DialogsAlikeLayoutProvider = ({
79157
- children: G
79158
- }) => {
79159
- const Z = useSyncExternalStore(
79160
- dialogsAlikeStore.subscribe,
79161
- dialogsAlikeStore.getSnapshot,
79162
- dialogsAlikeStore.getServerSnapshot
79163
- ), W = useI18n(), [T, L] = useState(null);
79164
- useEffect(() => {
79165
- const S = dialogsAlikeStore.acquireRenderer();
79166
- return L(S.id), S.release;
79167
- }, []);
79168
- const Y = useSyncExternalStore(
79169
- dialogsAlikeStore.subscribeRenderer,
79170
- dialogsAlikeStore.getActiveRendererId,
79171
- () => null
79172
- ), X = T !== null && T === Y;
79173
- return useEffect(() => {
79174
- dialogsAlikeStore.setDefaultActionLabels({
79175
- ok: W.actions.ok,
79176
- cancel: W.actions.cancel
79177
- });
79178
- }, [W]), /* @__PURE__ */ jsxs(Fragment, { children: [
79179
- X && typeof document < "u" && createPortal(/* @__PURE__ */ jsx(DialogsAlike, { items: Z }), document.body),
79180
- G
79181
- ] });
79182
79116
  }, LayoutContext = createContext(
79183
79117
  null
79184
79118
  ), LayoutProvider = ({ children: G, fullScreen: Z = !0 }) => {
@@ -79251,101 +79185,7 @@ const mountedRenderers = /* @__PURE__ */ new Set(), rendererListeners = /* @__PU
79251
79185
  }
79252
79186
  ) }) }) }) }) })
79253
79187
  }
79254
- ) }), closeCallbacks = /* @__PURE__ */ new Map(), warnIfNoProvider = (G) => {
79255
- process.env.NODE_ENV !== "production" && !dialogsAlikeStore.hasProvider() && console.warn(
79256
- `[f0] ${G} was called but no <F0Provider> is mounted, so the dialog/drawer will not render. Make sure your app is wrapped in <F0Provider>.`
79257
- );
79258
- }, makeActionHandler = (G, Z) => (W, T) => {
79259
- Z(T ?? void 0), !W?.keepOpen && (closeCallbacks.delete(G), dialogsAlikeStore.removeItem(G));
79260
- }, openDialogInternal = (G) => new Promise((Z) => {
79261
- const W = G.id || nanoid(), T = makeActionHandler(W, Z), L = () => T(void 0, void 0), Y = {
79262
- id: W,
79263
- actions: G.actions,
79264
- onCloseDialog: L,
79265
- onClickAction: (S, V) => T(S, V)
79266
- };
79267
- let X;
79268
- if (G.variant === "notification") {
79269
- if (!G.type || G.type === "default")
79270
- throw new Error("Notification dialog must have a type");
79271
- X = {
79272
- ...G,
79273
- ...Y,
79274
- variant: "notification",
79275
- type: G.type
79276
- };
79277
- } else
79278
- X = { ...G, ...Y, variant: "default", type: void 0 };
79279
- closeCallbacks.set(W, L), warnIfNoProvider("dialogs.open()"), dialogsAlikeStore.addItem(X);
79280
- }), openDrawerInternal = (G) => new Promise((Z) => {
79281
- const W = G.id || nanoid(), T = makeActionHandler(W, Z), L = () => T(void 0, void 0), Y = {
79282
- ...G,
79283
- id: W,
79284
- onCloseDialog: L,
79285
- onClickAction: (X, S) => T(X, S)
79286
- };
79287
- closeCallbacks.set(W, L), warnIfNoProvider("drawers.open()"), dialogsAlikeStore.addItem(Y);
79288
- }), close = (G) => {
79289
- const Z = closeCallbacks.get(G);
79290
- Z ? Z() : dialogsAlikeStore.removeItem(G);
79291
- }, notification = (G) => openDialogInternal({
79292
- type: G.type ?? "info",
79293
- variant: "notification",
79294
- description: G.msg,
79295
- id: G.id || nanoid(),
79296
- title: G.title,
79297
- content: /* @__PURE__ */ jsx(Fragment, {}),
79298
- actions: G.actions
79299
- }), confirmation = (G) => {
79300
- const Z = dialogsAlikeStore.getDefaultActionLabels();
79301
- return notification({
79302
- ...G,
79303
- actions: {
79304
- primary: {
79305
- value: G.confirm?.value ?? !0,
79306
- label: G.confirm?.label || Z.ok
79307
- },
79308
- secondary: {
79309
- value: G.cancel?.value ?? !1,
79310
- label: G.cancel?.label || Z.cancel
79311
- }
79312
- }
79313
- });
79314
- }, dialogs = {
79315
- /** Open a dialog. Resolves with the value of the action the user picked. */
79316
- open: (G) => openDialogInternal({ ...G, variant: "default" }),
79317
- /** Open a notification-style dialog (info/warning/critical/positive). */
79318
- notification,
79319
- /** Notification dialog with a single confirm action (defaults to "Ok"). */
79320
- alert: (G) => {
79321
- const Z = dialogsAlikeStore.getDefaultActionLabels();
79322
- return notification({
79323
- ...G,
79324
- actions: {
79325
- primary: {
79326
- value: G.confirm?.value ?? !0,
79327
- label: G.confirm?.label || Z.ok
79328
- }
79329
- }
79330
- });
79331
- },
79332
- /** Notification dialog with confirm + cancel actions (defaults to Ok/Cancel). */
79333
- confirmation,
79334
- /**
79335
- * Back-compat alias for {@link confirmation} — the v3 `dialog.confirm(...)`.
79336
- * Same options shape (`type`, `title`, `msg`, `confirm`, `cancel`), so legacy
79337
- * call sites keep working through the `dialogs as dialog` re-export.
79338
- * @deprecated Use `confirmation` instead.
79339
- */
79340
- confirm: confirmation,
79341
- /** Programmatically close a dialog by id (resolves its promise with undefined). */
79342
- close
79343
- }, drawers = {
79344
- /** Open a drawer. Resolves with the value of the action the user picked. */
79345
- open: (G) => openDrawerInternal({ ...G, variant: "drawer" }),
79346
- /** Programmatically close a drawer by id (resolves its promise with undefined). */
79347
- close
79348
- };
79188
+ ) });
79349
79189
  export {
79350
79190
  sliderTooltipModes as $,
79351
79191
  F0ChipList as A,
@@ -79386,7 +79226,6 @@ export {
79386
79226
  SurveyFormBuilder as a7,
79387
79227
  flattenElements as a8,
79388
79228
  reconstructElements as a9,
79389
- dataCollectionLocalStorageHandler as aA,
79390
79229
  computeSectionEndIds as aa,
79391
79230
  injectSectionEnds as ab,
79392
79231
  SurveyAnsweringForm as ac,
@@ -79409,10 +79248,9 @@ export {
79409
79248
  toasts as at,
79410
79249
  F0Provider as au,
79411
79250
  useFormComponent as av,
79412
- dialogs as aw,
79413
- drawers as ax,
79414
- useIsDesktop as ay,
79415
- useIsMobile as az,
79251
+ useIsDesktop as aw,
79252
+ useIsMobile as ax,
79253
+ dataCollectionLocalStorageHandler as ay,
79416
79254
  TwoColumnLayout as b,
79417
79255
  commonjsRequire as c,
79418
79256
  downloadFromUrl as d,