@layers-app/shared 0.4.1 → 0.4.2

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.
Files changed (53) hide show
  1. package/dist/components/AnimatedFigurePage/AnimatedFigurePage.module.css.js +13 -13
  2. package/dist/components/AttachmentsGalleryModal/components/ModalHeader.d.ts.map +1 -1
  3. package/dist/components/AttachmentsGalleryModal/components/ModalHeader.js +55 -59
  4. package/dist/components/AttachmentsGalleryModal/styles.module.css.js +24 -22
  5. package/dist/components/ColorPicker/ColorPicker.d.ts.map +1 -1
  6. package/dist/components/ColorPicker/ColorPicker.js +109 -83
  7. package/dist/components/ColorPicker/ColorPickerList.d.ts.map +1 -1
  8. package/dist/components/ColorPicker/ColorPickerList.js +62 -63
  9. package/dist/components/ColorPicker/ColorPickerToolbar.d.ts.map +1 -1
  10. package/dist/components/ColorPicker/ColorPickerToolbar.js +128 -120
  11. package/dist/components/ColorPicker/icons.js +3 -3
  12. package/dist/components/ColorPicker/types.d.ts +3 -1
  13. package/dist/components/ColorPicker/types.d.ts.map +1 -1
  14. package/dist/components/ColorPicker/types.js +11 -5
  15. package/dist/components/CommentComposer/CommentEditorHotkeys.d.ts.map +1 -1
  16. package/dist/components/CommentComposer/CommentEditorHotkeys.js +55 -45
  17. package/dist/components/FilePicker/FilePicker.d.ts +3 -1
  18. package/dist/components/FilePicker/FilePicker.d.ts.map +1 -1
  19. package/dist/components/FilePicker/FilePicker.js +44 -42
  20. package/dist/components/FilePicker/FilePickerUpload.d.ts +3 -1
  21. package/dist/components/FilePicker/FilePickerUpload.d.ts.map +1 -1
  22. package/dist/components/FilePicker/FilePickerUpload.js +28 -28
  23. package/dist/components/LanguagePicker/LanguagePicker.d.ts +13 -3
  24. package/dist/components/LanguagePicker/LanguagePicker.d.ts.map +1 -1
  25. package/dist/components/LanguagePicker/LanguagePicker.js +65 -43
  26. package/dist/components/OnboardingTour/OnboardingTourFooter.d.ts +6 -1
  27. package/dist/components/OnboardingTour/OnboardingTourFooter.d.ts.map +1 -1
  28. package/dist/components/OnboardingTour/OnboardingTourFooter.js +39 -21
  29. package/dist/components/OnboardingTour/OnboardingTourWrapper.d.ts +4 -5
  30. package/dist/components/OnboardingTour/OnboardingTourWrapper.d.ts.map +1 -1
  31. package/dist/components/OnboardingTour/OnboardingTourWrapper.js +86 -118
  32. package/dist/components/OnboardingTour/index.d.ts +1 -1
  33. package/dist/components/OnboardingTour/index.d.ts.map +1 -1
  34. package/dist/components/OnboardingTour/useOnboardingTour.d.ts +4 -0
  35. package/dist/components/OnboardingTour/useOnboardingTour.d.ts.map +1 -1
  36. package/dist/components/OnboardingTour/useOnboardingTour.js +65 -36
  37. package/dist/components/UserAvatar/index.d.ts.map +1 -1
  38. package/dist/components/UserAvatar/index.js +38 -31
  39. package/dist/config/brand.d.ts +2 -0
  40. package/dist/config/brand.d.ts.map +1 -1
  41. package/dist/config/brand.js +28 -22
  42. package/dist/config/envConfig.d.ts +4 -0
  43. package/dist/config/envConfig.d.ts.map +1 -1
  44. package/dist/index.css +1 -1
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +445 -439
  47. package/dist/lang/locales/ui_ru.json.js +1 -1
  48. package/dist/store/featureProgress.d.ts +3 -6
  49. package/dist/store/featureProgress.d.ts.map +1 -1
  50. package/dist/store/featureProgress.js +56 -22
  51. package/dist/store/plansModal.d.ts.map +1 -1
  52. package/dist/store/plansModal.js +10 -10
  53. package/package.json +2 -2
@@ -1,55 +1,77 @@
1
- import { jsx as o, jsxs as p } from "react/jsx-runtime";
2
- import { useMemo as g } from "react";
3
- import { ArrowDown01Icon as f, Tick02Icon as u } from "@hugeicons/core-free-icons";
4
- import { HugeiconsIcon as s } from "@hugeicons/react";
5
- import { Select as d, Image as i, Group as x } from "@mantine/core";
6
- import I from "../../assets/svg/flags/es.svg.js";
7
- import b from "../../assets/svg/flags/ru.svg.js";
8
- import h from "../../assets/svg/flags/us.svg.js";
9
- import l from "./LanguagePicker.module.css.js";
10
- const t = {
11
- ru: b,
12
- en: h,
13
- es: I
14
- }, n = [
1
+ import { jsxs as w, jsx as o } from "react/jsx-runtime";
2
+ import { useCallback as m, useMemo as N } from "react";
3
+ import { Tick02Icon as P, ArrowDown01Icon as j } from "@hugeicons/core-free-icons";
4
+ import { HugeiconsIcon as f } from "@hugeicons/react";
5
+ import { Group as y, Image as u, Select as z } from "@mantine/core";
6
+ import C from "../../assets/svg/flags/es.svg.js";
7
+ import D from "../../assets/svg/flags/ru.svg.js";
8
+ import M from "../../assets/svg/flags/us.svg.js";
9
+ import s from "./LanguagePicker.module.css.js";
10
+ const O = {
11
+ ru: D,
12
+ en: M,
13
+ es: C
14
+ }, A = [
15
15
  { value: "en", label: "English" },
16
16
  { value: "ru", label: "Русский" },
17
17
  { value: "es", label: "Español (España)" }
18
- ], y = ({
19
- option: e,
20
- checked: a
21
- }) => /* @__PURE__ */ p(x, { flex: "1", gap: "xs", children: [
22
- /* @__PURE__ */ o(i, { src: t[e.value], className: l.image }),
23
- e.label,
24
- a && /* @__PURE__ */ o(
25
- s,
26
- {
27
- color: "var(--mantine-primary-color-filled)",
28
- size: 16,
29
- icon: u,
30
- className: l.tickIcon
31
- }
32
- )
33
- ] }), A = ({
34
- value: e,
35
- onChange: a,
36
- label: c
18
+ ], B = ({
19
+ value: a,
20
+ onChange: t,
21
+ label: g,
22
+ data: p,
23
+ flagMap: d,
24
+ size: b,
25
+ radius: v,
26
+ variant: x,
27
+ disabled: h,
28
+ searchable: k,
29
+ withinPortal: F
37
30
  }) => {
38
- const m = g(() => n.find((r) => r.value === e) ? e : "en", [e]);
31
+ const l = p ?? A, r = d ?? O, I = m(
32
+ ({ option: e, checked: S }) => /* @__PURE__ */ w(y, { flex: "1", gap: "xs", children: [
33
+ r[e.value] && /* @__PURE__ */ o(u, { src: r[e.value], className: s.image }),
34
+ e.label,
35
+ S && /* @__PURE__ */ o(
36
+ f,
37
+ {
38
+ color: "var(--mantine-primary-color-filled)",
39
+ size: 16,
40
+ icon: P,
41
+ className: s.tickIcon
42
+ }
43
+ )
44
+ ] }),
45
+ [r]
46
+ ), c = l[0]?.value ?? a, n = N(
47
+ () => l.find((e) => e.value === a) ? a : c,
48
+ [a, l, c]
49
+ ), E = m(
50
+ (e) => {
51
+ e && t(e);
52
+ },
53
+ [t]
54
+ ), i = r[n];
39
55
  return /* @__PURE__ */ o(
40
- d,
56
+ z,
41
57
  {
42
- label: c,
58
+ label: g,
43
59
  flex: 1,
44
- onChange: (r) => r && a(r),
45
- leftSection: /* @__PURE__ */ o(i, { src: t[e], className: l.image }),
46
- value: m,
47
- data: n,
48
- rightSection: /* @__PURE__ */ o(s, { size: 16, icon: f }),
49
- renderOption: y
60
+ onChange: E,
61
+ leftSection: i ? /* @__PURE__ */ o(u, { src: i, className: s.image }) : void 0,
62
+ value: n,
63
+ data: l,
64
+ rightSection: /* @__PURE__ */ o(f, { size: 16, icon: j }),
65
+ renderOption: I,
66
+ size: b,
67
+ radius: v,
68
+ variant: x,
69
+ disabled: h,
70
+ searchable: k,
71
+ comboboxProps: F ? { withinPortal: !0 } : void 0
50
72
  }
51
73
  );
52
74
  };
53
75
  export {
54
- A as LanguagePicker
76
+ B as LanguagePicker
55
77
  };
@@ -1,4 +1,4 @@
1
- import { type OnboardingTourController } from '@gfazioli/mantine-onboarding-tour';
1
+ import { type OnboardingTourController } from '@layers-app/onboarding-tour';
2
2
  export declare const DefaultSingleFooter: ({ controller, label, }: {
3
3
  controller: OnboardingTourController;
4
4
  label: string;
@@ -12,6 +12,11 @@ export declare const DefaultMultiFooter: ({ controller, stepIndex, totalSteps, l
12
12
  back: string;
13
13
  next: string;
14
14
  done: string;
15
+ continue?: string;
15
16
  };
16
17
  }) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const DefaultTourHeader: ({ controller, title, }: {
19
+ controller: OnboardingTourController;
20
+ title: React.ReactNode;
21
+ }) => import("react/jsx-runtime").JSX.Element;
17
22
  //# sourceMappingURL=OnboardingTourFooter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OnboardingTourFooter.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingTour/OnboardingTourFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAGlF,eAAO,MAAM,mBAAmB,GAAI,wBAGjC;IACD,UAAU,EAAE,wBAAwB,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;CACf,4CAMA,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,gDAKhC;IACD,UAAU,EAAE,wBAAwB,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACtE,4CA+BA,CAAC"}
1
+ {"version":3,"file":"OnboardingTourFooter.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingTour/OnboardingTourFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAI5E,eAAO,MAAM,mBAAmB,GAAI,wBAGjC;IACD,UAAU,EAAE,wBAAwB,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;CACf,4CAMA,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,gDAKhC;IACD,UAAU,EAAE,wBAAwB,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,4CAiCA,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,wBAG/B;IACD,UAAU,EAAE,wBAAwB,CAAC;IACrC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB,4CAaA,CAAC"}
@@ -1,40 +1,58 @@
1
- import { jsx as t, jsxs as c } from "react/jsx-runtime";
2
- import { Group as r, Button as s, Text as u } from "@mantine/core";
3
- const a = ({
4
- controller: e,
5
- label: i
6
- }) => /* @__PURE__ */ t(r, { justify: "flex-end", mt: "md", children: /* @__PURE__ */ t(s, { size: "sm", onClick: () => e.endTour(), children: i }) }), h = ({
7
- controller: e,
8
- stepIndex: i,
9
- totalSteps: d,
1
+ import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
+ import { Group as r, Button as s, Text as p, ActionIcon as d } from "@mantine/core";
3
+ import { IconX as f } from "@tabler/icons-react";
4
+ const g = ({
5
+ controller: i,
6
+ label: t
7
+ }) => /* @__PURE__ */ e(r, { justify: "flex-end", children: /* @__PURE__ */ e(s, { size: "sm", onClick: () => i.endTour(), children: t }) }), k = ({
8
+ controller: i,
9
+ stepIndex: t,
10
+ totalSteps: u,
10
11
  labels: n
11
12
  }) => {
12
- const m = i === 0, o = i === d - 1;
13
- return /* @__PURE__ */ c(r, { justify: "space-between", mt: "md", children: [
14
- /* @__PURE__ */ t(u, { size: "sm", c: "gray.5", children: n.stepOf }),
15
- /* @__PURE__ */ c(r, { gap: "xs", children: [
16
- !m && /* @__PURE__ */ t(
13
+ const c = t === 0, a = t === u - 1, l = c && n.continue ? n.continue : n.next;
14
+ return /* @__PURE__ */ o(r, { justify: "space-between", children: [
15
+ /* @__PURE__ */ e(p, { size: "sm", c: "gray.5", children: n.stepOf }),
16
+ /* @__PURE__ */ o(r, { gap: "xs", children: [
17
+ !c && /* @__PURE__ */ e(
17
18
  s,
18
19
  {
19
20
  variant: "subtle",
20
21
  color: "gray.5",
21
22
  size: "sm",
22
- onClick: () => e.prevStep(),
23
+ onClick: () => i.prevStep(),
23
24
  children: n.back
24
25
  }
25
26
  ),
26
- /* @__PURE__ */ t(
27
+ /* @__PURE__ */ e(
27
28
  s,
28
29
  {
29
30
  size: "sm",
30
- onClick: () => o ? e.endTour() : e.nextStep(),
31
- children: o ? n.done : n.next
31
+ onClick: () => a ? i.endTour() : i.nextStep(),
32
+ children: a ? n.done : l
32
33
  }
33
34
  )
34
35
  ] })
35
36
  ] });
36
- };
37
+ }, y = ({
38
+ controller: i,
39
+ title: t
40
+ }) => /* @__PURE__ */ o(r, { justify: "space-between", align: "flex-start", gap: "xs", wrap: "nowrap", children: [
41
+ /* @__PURE__ */ e("div", { style: { flex: 1 }, children: t }),
42
+ /* @__PURE__ */ e(
43
+ d,
44
+ {
45
+ variant: "subtle",
46
+ color: "gray",
47
+ size: "sm",
48
+ onClick: () => i.skipTour(),
49
+ "aria-label": "Skip tour",
50
+ children: /* @__PURE__ */ e(f, { size: 16 })
51
+ }
52
+ )
53
+ ] });
37
54
  export {
38
- h as DefaultMultiFooter,
39
- a as DefaultSingleFooter
55
+ k as DefaultMultiFooter,
56
+ g as DefaultSingleFooter,
57
+ y as DefaultTourHeader
40
58
  };
@@ -1,13 +1,12 @@
1
- import { type ReactNode } from 'react';
2
- import { type OnboardingTourProps, type OnboardingTourStep } from '@gfazioli/mantine-onboarding-tour';
3
- import './OnboardingTourWrapper.css';
1
+ import { type MutableRefObject, type ReactNode } from 'react';
2
+ import { type OnboardingTourController, type OnboardingTourProps, type OnboardingTourStep } from '@layers-app/onboarding-tour';
4
3
  export interface OnboardingTourWrapperProps extends Partial<Omit<OnboardingTourProps, 'tour' | 'started' | 'children'>> {
5
4
  featureKey: string;
6
5
  tour: OnboardingTourStep[];
7
6
  children: ReactNode;
8
7
  onComplete?: () => void;
9
8
  dependsOn?: string;
10
- withPopoverMoveAnimation?: boolean;
9
+ controllerRef?: MutableRefObject<OnboardingTourController | null>;
11
10
  }
12
- export declare const OnboardingTourWrapper: ({ featureKey, tour, children, onComplete, dependsOn, withPopoverMoveAnimation, classNames, focusRevealProps: externalFocusRevealProps, onOnboardingTourEnd: externalOnEnd, onOnboardingTourChange: externalOnChange, onOnboardingTourStart: externalOnStart, ...rest }: OnboardingTourWrapperProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const OnboardingTourWrapper: ({ featureKey, tour, children, onComplete, dependsOn, controllerRef, classNames, focusRevealProps: externalFocusRevealProps, onOnboardingTourEnd: externalOnEnd, onOnboardingTourSkip: externalOnClose, onOnboardingTourChange: externalOnChange, onOnboardingTourStart: externalOnStart, ...rest }: OnboardingTourWrapperProps) => import("react/jsx-runtime").JSX.Element;
13
12
  //# sourceMappingURL=OnboardingTourWrapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OnboardingTourWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingTour/OnboardingTourWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAA2C,MAAM,OAAO,CAAC;AAGhF,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,mCAAmC,CAAC;AAS3C,OAAO,6BAA6B,CAAC;AAErC,MAAM,WAAW,0BACf,SAAQ,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;IAC3E,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,kBAAkB,EAAE,CAAC;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AA+BD,eAAO,MAAM,qBAAqB,GAAI,wQAanC,0BAA0B,4CA2O5B,CAAC"}
1
+ {"version":3,"file":"OnboardingTourWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingTour/OnboardingTourWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAGf,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,6BAA6B,CAAC;AAcrC,MAAM,WAAW,0BACf,SAAQ,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;IAC3E,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,kBAAkB,EAAE,CAAC;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,gBAAgB,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAAC;CACnE;AA4BD,eAAO,MAAM,qBAAqB,GAAI,oSAcnC,0BAA0B,4CA4J5B,CAAC"}
@@ -1,160 +1,128 @@
1
- import { jsx as u, Fragment as z } from "react/jsx-runtime";
2
- import { useRef as C, useCallback as I, useMemo as S, useEffect as L } from "react";
3
- import { useTranslation as q } from "react-i18next";
4
- import { OnboardingTour as W } from "@gfazioli/mantine-onboarding-tour";
5
- import { Text as A } from "@mantine/core";
6
- import { DefaultSingleFooter as M, DefaultMultiFooter as U } from "./OnboardingTourFooter.js";
7
- import { useOnboardingTour as V } from "./useOnboardingTour.js";
8
- /* empty css */
9
- const v = "onboarding-tour-popover-dropdown", h = "data-onboarding-tour-active-dropdown", G = (n) => typeof n == "string" ? /* @__PURE__ */ u(A, { fw: 500, size: "md", c: "white", mb: 4, children: n }) : n, H = (n) => typeof n == "string" ? /* @__PURE__ */ u(A, { size: "sm", c: "gray.3", children: n }) : n, ot = ({
10
- featureKey: n,
1
+ import { jsx as a, Fragment as E } from "react/jsx-runtime";
2
+ import { useMemo as b, useCallback as m } from "react";
3
+ import { useTranslation as F } from "react-i18next";
4
+ import { OnboardingTour as M } from "@layers-app/onboarding-tour";
5
+ import { Text as v } from "@mantine/core";
6
+ import { DefaultSingleFooter as H, DefaultMultiFooter as N, DefaultTourHeader as W } from "./OnboardingTourFooter.js";
7
+ import { useOnboardingTour as q, getSavedStepIndex as A, saveStepIndex as G } from "./useOnboardingTour.js";
8
+ const J = (o) => typeof o == "string" ? /* @__PURE__ */ a(v, { fw: 500, size: "md", c: "white", mb: 4, children: o }) : o, L = (o) => typeof o == "string" ? /* @__PURE__ */ a(v, { size: "sm", c: "gray.3", children: o }) : o, $ = ({
9
+ featureKey: o,
11
10
  tour: d,
12
- children: w,
13
- onComplete: P,
14
- dependsOn: R,
15
- withPopoverMoveAnimation: T = !1,
16
- classNames: D = {},
17
- focusRevealProps: f,
18
- onOnboardingTourEnd: O,
19
- onOnboardingTourChange: k,
20
- onOnboardingTourStart: N,
21
- ...$
11
+ children: l,
12
+ onComplete: p,
13
+ dependsOn: k,
14
+ controllerRef: s,
15
+ classNames: x = {},
16
+ focusRevealProps: c,
17
+ onOnboardingTourEnd: T,
18
+ onOnboardingTourSkip: S,
19
+ onOnboardingTourChange: h,
20
+ onOnboardingTourStart: O,
21
+ ...I
22
22
  }) => {
23
- const { t: l } = q("pages"), { started: b, complete: x } = V(n, { dependsOn: R }), c = C(null), m = C(null), E = I(() => {
24
- x(), P?.(), O?.();
25
- }, [x, P, O]), F = S(() => {
26
- const e = d.length, o = e === 1;
27
- return d.map((r, s) => {
28
- const a = {
23
+ const { t: e } = F("pages"), { started: P, complete: u } = q(o, { dependsOn: k }), y = b(
24
+ () => A(o),
25
+ [o]
26
+ ), B = m(
27
+ (n) => {
28
+ const i = d.findIndex((r) => r.id === n.id);
29
+ i >= 0 && G(o, i), h?.(n);
30
+ },
31
+ [o, d, h]
32
+ ), C = m(() => {
33
+ u(), p?.(), T?.();
34
+ }, [u, p, T]), D = m(() => {
35
+ u(), p?.(), S?.();
36
+ }, [u, p, S]), j = b(() => {
37
+ const n = d.length, i = n === 1;
38
+ return d.map((r, w) => {
39
+ const g = J(r.title), f = {
29
40
  ...r,
30
- title: G(r.title),
31
- content: H(r.content)
41
+ title: void 0,
42
+ header: (t) => /* @__PURE__ */ a(
43
+ W,
44
+ {
45
+ controller: t,
46
+ title: typeof g == "function" ? g(t) : g
47
+ }
48
+ ),
49
+ content: L(r.content)
32
50
  };
33
- return r.footer === void 0 && (o ? a.footer = (p) => /* @__PURE__ */ u(
34
- M,
51
+ return r.footer === void 0 && (i ? f.footer = (t) => (s && (s.current = t), /* @__PURE__ */ a(
52
+ H,
35
53
  {
36
- controller: p,
37
- label: l("onboarding.continue")
54
+ controller: t,
55
+ label: e("onboarding.continue")
38
56
  }
39
- ) : a.footer = (p) => /* @__PURE__ */ u(
40
- U,
57
+ )) : f.footer = (t) => (s && (s.current = t), /* @__PURE__ */ a(
58
+ N,
41
59
  {
42
- controller: p,
43
- stepIndex: s,
44
- totalSteps: e,
60
+ controller: t,
61
+ stepIndex: w,
62
+ totalSteps: n,
45
63
  labels: {
46
- stepOf: l("onboarding.stepOf", {
47
- current: s + 1,
48
- total: e
64
+ stepOf: e("onboarding.stepOf", {
65
+ current: w + 1,
66
+ total: n
49
67
  }),
50
- back: l("onboarding.back"),
51
- next: l("onboarding.next"),
52
- done: l("onboarding.done")
68
+ back: e("onboarding.back"),
69
+ next: e("onboarding.next"),
70
+ done: e("onboarding.done"),
71
+ continue: e("onboarding.continue")
53
72
  }
54
73
  }
55
- )), a;
74
+ ))), f;
56
75
  });
57
- }, [d, l]), B = S(() => {
58
- const e = typeof f == "object" ? f : void 0, o = e?.popoverProps ?? {}, r = o.classNames ?? {}, s = o.styles ?? {}, a = [v, r.dropdown].filter(Boolean).join(" ");
76
+ }, [d, e, s]), z = b(() => {
77
+ const n = typeof c == "object" ? c : void 0, i = n?.popoverProps ?? {}, r = i.styles ?? {};
59
78
  return {
60
- ...e,
61
- disableTargetInteraction: e?.disableTargetInteraction ?? !0,
62
- overlayProps: {
63
- blur: 0,
64
- ...e?.overlayProps
65
- },
79
+ ...n,
80
+ disableTargetInteraction: n?.disableTargetInteraction ?? !0,
66
81
  popoverProps: {
67
82
  position: "bottom",
68
83
  offset: 10,
69
- transitionProps: {
70
- duration: 0,
71
- ...o.transitionProps ?? {}
72
- },
73
- ...o,
74
- classNames: {
75
- ...r,
76
- dropdown: a
77
- },
84
+ ...i,
78
85
  styles: {
79
- ...s,
86
+ ...r,
80
87
  dropdown: {
81
88
  backgroundColor: "var(--mantine-color-dark-7)",
82
89
  padding: 16,
83
90
  color: "white",
84
91
  border: "none",
85
92
  width: 300,
86
- ...s.dropdown
93
+ ...r.dropdown
87
94
  },
88
95
  arrow: {
89
96
  backgroundColor: "var(--mantine-color-dark-7)",
90
97
  border: "none",
91
- ...s.arrow
98
+ ...r.arrow
92
99
  }
93
100
  }
94
101
  }
95
102
  };
96
- }, [f]);
97
- return L(() => {
98
- if (!b || !T) return;
99
- let e = 0;
100
- const o = document.createElement("style");
101
- o.setAttribute("data-onboarding-tour-popover-animation", "true"), o.textContent = `.${v}:not([${h}]) { opacity: 0 !important; pointer-events: none !important; }`, document.head.appendChild(o);
102
- const r = (t) => {
103
- t.removeAttribute(h), t.style.removeProperty("position"), t.style.removeProperty("top"), t.style.removeProperty("left"), t.style.removeProperty("width"), t.style.removeProperty("transform"), t.style.removeProperty("opacity"), t.style.removeProperty("pointer-events"), t.style.removeProperty("will-change"), t.style.removeProperty("transition");
104
- }, s = (t) => {
105
- const i = t.getBoundingClientRect();
106
- if (i.width === 0 || i.height === 0) return;
107
- const g = i.top, y = i.left, _ = m.current?.top ?? g, j = m.current?.left ?? y;
108
- c.current && c.current !== t && r(c.current), c.current = t, t.setAttribute(h, "true"), Object.assign(t.style, {
109
- position: "fixed",
110
- top: `${_}px`,
111
- left: `${j}px`,
112
- width: `${i.width}px`,
113
- transform: "none",
114
- opacity: "1",
115
- pointerEvents: "auto",
116
- willChange: "top, left",
117
- transition: "top 260ms cubic-bezier(0.2, 0, 0, 1), left 260ms cubic-bezier(0.2, 0, 0, 1)"
118
- }), requestAnimationFrame(() => {
119
- t.isConnected && (t.style.top = `${g}px`, t.style.left = `${y}px`);
120
- }), m.current = { top: g, left: y };
121
- }, a = () => {
122
- const t = Array.from(
123
- document.querySelectorAll(`.${v}`)
124
- ), i = t[t.length - 1];
125
- i && s(i);
126
- }, p = new MutationObserver(() => {
127
- cancelAnimationFrame(e), e = requestAnimationFrame(a);
128
- });
129
- return a(), p.observe(document.body, { childList: !0, subtree: !0 }), () => {
130
- p.disconnect(), cancelAnimationFrame(e), o.remove(), c.current && (r(c.current), c.current = null), m.current = null;
131
- };
132
- }, [b, T]), d.length === 0 ? /* @__PURE__ */ u(z, { children: w }) : /* @__PURE__ */ u(
133
- W,
103
+ }, [c]);
104
+ return d.length === 0 ? /* @__PURE__ */ a(E, { children: l }) : /* @__PURE__ */ a(
105
+ M,
134
106
  {
135
- tour: F,
136
- started: b,
137
- onOnboardingTourStart: () => {
138
- N?.();
139
- },
140
- onOnboardingTourChange: (e) => {
141
- k?.(e);
142
- },
143
- onOnboardingTourEnd: E,
107
+ tour: j,
108
+ started: P,
109
+ initialStepIndex: y,
110
+ onOnboardingTourStart: O,
111
+ onOnboardingTourChange: B,
112
+ onOnboardingTourEnd: C,
113
+ onOnboardingTourSkip: D,
144
114
  withPrevButton: !1,
145
115
  withNextButton: !1,
146
116
  withSkipButton: !1,
147
117
  withStepper: !1,
148
118
  maw: 300,
149
- classNames: {
150
- ...D
151
- },
152
- focusRevealProps: B,
153
- ...$,
154
- children: w
119
+ classNames: x,
120
+ focusRevealProps: z,
121
+ ...I,
122
+ children: l
155
123
  }
156
124
  );
157
125
  };
158
126
  export {
159
- ot as OnboardingTourWrapper
127
+ $ as OnboardingTourWrapper
160
128
  };
@@ -1,4 +1,4 @@
1
1
  export { OnboardingTourWrapper } from './OnboardingTourWrapper';
2
2
  export type { OnboardingTourWrapperProps } from './OnboardingTourWrapper';
3
- export { useOnboardingTour, isOnboardingCompleted, resetOnboarding, } from './useOnboardingTour';
3
+ export { useOnboardingTour, isOnboardingCompleted, resetOnboarding, getSavedStepIndex, saveStepIndex, clearSavedStep, setOnboardingUserId, } from './useOnboardingTour';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingTour/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,GAChB,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingTour/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,mBAAmB,GACpB,MAAM,qBAAqB,CAAC"}
@@ -1,5 +1,9 @@
1
+ export declare const setOnboardingUserId: (userId: string | null) => void;
1
2
  export declare const isOnboardingCompleted: (featureKey: string) => boolean;
2
3
  export declare const resetOnboarding: (featureKey: string) => void;
4
+ export declare const getSavedStepIndex: (featureKey: string) => number | undefined;
5
+ export declare const saveStepIndex: (featureKey: string, stepIndex: number) => void;
6
+ export declare const clearSavedStep: (featureKey: string) => void;
3
7
  interface UseOnboardingTourOptions {
4
8
  dependsOn?: string;
5
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useOnboardingTour.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingTour/useOnboardingTour.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,qBAAqB,GAAI,YAAY,MAAM,KAAG,OAE1D,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,YAAY,MAAM,KAAG,IAOpD,CAAC;AAEF,UAAU,wBAAwB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,uBAAuB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,iBAAiB,GAC5B,YAAY,MAAM,EAClB,UAAU,wBAAwB,KACjC,uBAwDF,CAAC"}
1
+ {"version":3,"file":"useOnboardingTour.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingTour/useOnboardingTour.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,GAAG,IAAI,KAAG,IAE3D,CAAC;AA4CF,eAAO,MAAM,qBAAqB,GAAI,YAAY,MAAM,KAAG,OAE1D,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,YAAY,MAAM,KAAG,IAUpD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,YAAY,MAAM,KAAG,MAAM,GAAG,SAI/D,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,YAAY,MAAM,EAAE,WAAW,MAAM,KAAG,IAIrE,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,YAAY,MAAM,KAAG,IAInD,CAAC;AAEF,UAAU,wBAAwB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,uBAAuB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,iBAAiB,GAC5B,YAAY,MAAM,EAClB,UAAU,wBAAwB,KACjC,uBAyDF,CAAC"}
@@ -1,50 +1,79 @@
1
- import { useState as p, useEffect as w, useCallback as O } from "react";
2
- const g = "onboarding-completed", a = "onboarding-completed", l = "onboarding-reset", E = () => {
1
+ import { useState as O, useEffect as M, useCallback as b } from "react";
2
+ const m = "onboarding-completed", u = "onboarding-step", E = "onboarding-completed", S = "onboarding-reset";
3
+ let o = null;
4
+ const R = (t) => {
5
+ o = t;
6
+ }, d = (t) => {
3
7
  try {
4
- return JSON.parse(localStorage.getItem(g) || "{}");
8
+ return JSON.parse(localStorage.getItem(t) || "{}");
5
9
  } catch {
6
10
  return {};
7
11
  }
8
- }, u = (t) => {
9
- try {
10
- localStorage.setItem(g, JSON.stringify(t));
11
- } catch {
12
- }
13
- }, d = (t) => !!E()[t], b = (t) => {
14
- const o = E();
15
- delete o[t], u(o), window.dispatchEvent(
16
- new CustomEvent(l, { detail: t })
12
+ }, g = () => o ? d(m)[o] ?? {} : {}, I = (t) => {
13
+ if (o)
14
+ try {
15
+ const e = d(m);
16
+ e[o] = t, localStorage.setItem(m, JSON.stringify(e));
17
+ } catch {
18
+ }
19
+ }, a = () => o ? d(u)[o] ?? {} : {}, w = (t) => {
20
+ if (o)
21
+ try {
22
+ const e = d(u);
23
+ e[o] = t, localStorage.setItem(u, JSON.stringify(e));
24
+ } catch {
25
+ return;
26
+ }
27
+ }, c = (t) => !!g()[t], L = (t) => {
28
+ const e = g();
29
+ delete e[t], I(e);
30
+ const n = a();
31
+ delete n[t], w(n), window.dispatchEvent(
32
+ new CustomEvent(S, { detail: t })
17
33
  );
18
- }, h = (t, o) => {
19
- const { dependsOn: n } = o ?? {}, [r, m] = p(
20
- () => d(t)
21
- ), [c, s] = p(
22
- () => !d(t) && (n ? d(n) : !0)
34
+ }, f = (t) => {
35
+ const n = a()[t];
36
+ return typeof n == "number" ? n : void 0;
37
+ }, A = (t, e) => {
38
+ const n = a();
39
+ n[t] = e, w(n);
40
+ }, _ = (t) => {
41
+ const e = a();
42
+ delete e[t], w(e);
43
+ }, G = (t, e) => {
44
+ const { dependsOn: n } = e ?? {}, [i, v] = O(
45
+ () => c(t)
46
+ ), [p, r] = O(
47
+ () => !c(t) && (n ? c(n) : !0)
23
48
  );
24
- w(() => {
25
- if (r || !n || c) return;
26
- const e = (i) => {
27
- i.detail === n && !d(t) && s(!0);
49
+ M(() => {
50
+ if (i || !n || p) return;
51
+ const s = (l) => {
52
+ l.detail === n && !c(t) && r(!0);
28
53
  };
29
- return window.addEventListener(a, e), () => window.removeEventListener(a, e);
30
- }, [n, r, c, t]), w(() => {
31
- const e = (i) => {
32
- i.detail === t && (m(!1), s(!0));
54
+ return window.addEventListener(E, s), () => window.removeEventListener(E, s);
55
+ }, [n, i, p, t]), M(() => {
56
+ const s = (l) => {
57
+ l.detail === t && (v(!1), r(!0));
33
58
  };
34
- return window.addEventListener(l, e), () => window.removeEventListener(l, e);
59
+ return window.addEventListener(S, s), () => window.removeEventListener(S, s);
35
60
  }, [t]);
36
- const v = O(() => {
37
- const e = E();
38
- e[t] = !0, u(e), m(!0), s(!1), window.dispatchEvent(
39
- new CustomEvent(a, { detail: t })
61
+ const N = b(() => {
62
+ const s = g();
63
+ s[t] = !0, I(s), _(t), v(!0), r(!1), window.dispatchEvent(
64
+ new CustomEvent(E, { detail: t })
40
65
  );
41
- }, [t]), C = O(() => {
42
- s(!0);
66
+ }, [t]), C = b(() => {
67
+ r(!0);
43
68
  }, []);
44
- return { started: c, completed: r, start: C, complete: v };
69
+ return { started: p, completed: i, start: C, complete: N };
45
70
  };
46
71
  export {
47
- d as isOnboardingCompleted,
48
- b as resetOnboarding,
49
- h as useOnboardingTour
72
+ _ as clearSavedStep,
73
+ f as getSavedStepIndex,
74
+ c as isOnboardingCompleted,
75
+ L as resetOnboarding,
76
+ A as saveStepIndex,
77
+ R as setOnboardingUserId,
78
+ G as useOnboardingTour
50
79
  };