@epam/ai-dial-onboarding-tour 0.0.0-stage → 1.3.4
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/components/AnchorOutline/AnchorOutline.d.ts +15 -0
- package/components/AnchorOutline/AnchorOutline.d.ts.map +1 -0
- package/components/HintCard/HintCard.d.ts +30 -0
- package/components/HintCard/HintCard.d.ts.map +1 -0
- package/components/OnboardingAnchorMap/OnboardingAnchorMap.d.ts +5 -0
- package/components/OnboardingAnchorMap/OnboardingAnchorMap.d.ts.map +1 -0
- package/components/OnboardingHints/OnboardingHints.d.ts +5 -0
- package/components/OnboardingHints/OnboardingHints.d.ts.map +1 -0
- package/components/OnboardingTour/OnboardingTour.d.ts +5 -0
- package/components/OnboardingTour/OnboardingTour.d.ts.map +1 -0
- package/constants/layout.d.ts +17 -0
- package/constants/layout.d.ts.map +1 -0
- package/constants/public-class-names.d.ts +18 -0
- package/constants/public-class-names.d.ts.map +1 -0
- package/constants/timing.d.ts +7 -0
- package/constants/timing.d.ts.map +1 -0
- package/hooks/useOnboardingHints/useOnboardingHints.d.ts +4 -0
- package/hooks/useOnboardingHints/useOnboardingHints.d.ts.map +1 -0
- package/hooks/useResolvedTarget/useResolvedTarget.d.ts +3 -0
- package/hooks/useResolvedTarget/useResolvedTarget.d.ts.map +1 -0
- package/index.css +3 -0
- package/index.d.ts +9 -0
- package/index.d.ts.map +1 -0
- package/index.js +481 -0
- package/models/onboarding-tour.d.ts +182 -0
- package/models/onboarding-tour.d.ts.map +1 -0
- package/models/target-rect.d.ts +12 -0
- package/models/target-rect.d.ts.map +1 -0
- package/package.json +31 -4
- package/test-setup.d.ts +6 -0
- package/test-setup.d.ts.map +1 -0
- package/types/onboarding-tour-end-reason.d.ts +8 -0
- package/types/onboarding-tour-end-reason.d.ts.map +1 -0
- package/utils/card-colors.d.ts +4 -0
- package/utils/card-colors.d.ts.map +1 -0
- package/utils/floating.d.ts +12 -0
- package/utils/floating.d.ts.map +1 -0
- package/utils/focus.d.ts +3 -0
- package/utils/focus.d.ts.map +1 -0
- package/utils/spotlight.d.ts +3 -0
- package/utils/spotlight.d.ts.map +1 -0
- package/README.md +0 -3
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { OnboardingAnchor } from '../../models/onboarding-tour';
|
|
3
|
+
/** Props for the internal `AnchorOutline` component. */
|
|
4
|
+
interface AnchorOutlineProps {
|
|
5
|
+
/** The anchor to outline. */
|
|
6
|
+
anchor: OnboardingAnchor;
|
|
7
|
+
/** Called with whether the anchor's element is on screen, whenever that changes. */
|
|
8
|
+
onAvailabilityChange: (id: string, isOnScreen: boolean) => void;
|
|
9
|
+
/** Typography class of the name tag. */
|
|
10
|
+
tagClassName: string;
|
|
11
|
+
}
|
|
12
|
+
/** A dashed outline around one anchor's element with the anchor's name above it. */
|
|
13
|
+
export declare const AnchorOutline: FC<AnchorOutlineProps>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=AnchorOutline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnchorOutline.d.ts","sourceRoot":"","sources":["../../../src/components/AnchorOutline/AnchorOutline.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAGpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAWrE,wDAAwD;AACxD,UAAU,kBAAkB;IAC1B,6BAA6B;IAC7B,MAAM,EAAE,gBAAgB,CAAC;IACzB,oFAAoF;IACpF,oBAAoB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IAChE,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,oFAAoF;AACpF,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CA2EhD,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { FC, HTMLAttributes, ReactNode, Ref } from 'react';
|
|
2
|
+
/** Props for the internal `HintCard` component. */
|
|
3
|
+
interface HintCardProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** Ref of the card element. */
|
|
5
|
+
ref?: Ref<HTMLDivElement>;
|
|
6
|
+
/** Card heading; also the dialog's accessible name. */
|
|
7
|
+
heading: string;
|
|
8
|
+
/** Optional body text; also the dialog's accessible description. */
|
|
9
|
+
description?: string;
|
|
10
|
+
/** Optional line above the heading, such as a step counter. */
|
|
11
|
+
counter?: string;
|
|
12
|
+
/** Accessible label of the close button; the button renders only together with `onClose`. */
|
|
13
|
+
closeLabel?: string;
|
|
14
|
+
/** Called when the close button is pressed. */
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
/** Buttons at the bottom of the card. */
|
|
17
|
+
footer: ReactNode;
|
|
18
|
+
/** Optional arrow pointing from the card at its target. */
|
|
19
|
+
arrow?: ReactNode;
|
|
20
|
+
/** Typography class of the counter. */
|
|
21
|
+
counterClassName?: string;
|
|
22
|
+
/** Typography class of the heading. */
|
|
23
|
+
titleClassName: string;
|
|
24
|
+
/** Typography class of the description. */
|
|
25
|
+
descriptionClassName: string;
|
|
26
|
+
}
|
|
27
|
+
/** The hint card of the tour: heading, description and footer buttons in a `role="dialog"`. */
|
|
28
|
+
export declare const HintCard: FC<HintCardProps>;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=HintCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HintCard.d.ts","sourceRoot":"","sources":["../../../src/components/HintCard/HintCard.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,EAAE,EACP,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,GAAG,EACT,MAAM,OAAO,CAAC;AAIf,mDAAmD;AACnD,UAAU,aAAc,SAAQ,cAAc,CAAC,cAAc,CAAC;IAC5D,+BAA+B;IAC/B,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6FAA6F;IAC7F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,yCAAyC;IACzC,MAAM,EAAE,SAAS,CAAC;IAClB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,uCAAuC;IACvC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uCAAuC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,+FAA+F;AAC/F,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAmEtC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { OnboardingAnchorMapProps } from '../../models/onboarding-tour';
|
|
3
|
+
/** Outlines every anchor on screen with its name and lists the anchors the page does not render. */
|
|
4
|
+
export declare const OnboardingAnchorMap: FC<OnboardingAnchorMapProps>;
|
|
5
|
+
//# sourceMappingURL=OnboardingAnchorMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OnboardingAnchorMap.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingAnchorMap/OnboardingAnchorMap.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAgC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAO7E,oGAAoG;AACpG,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAmJ5D,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { OnboardingHintsProps } from '../../models/onboarding-tour';
|
|
3
|
+
/** Shows the unseen hints whose element is on the page as a tour, or outlines every anchor instead while `isAnchorView` is set. */
|
|
4
|
+
export declare const OnboardingHints: FC<OnboardingHintsProps>;
|
|
5
|
+
//# sourceMappingURL=OnboardingHints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OnboardingHints.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingHints/OnboardingHints.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,KAAK,EAEV,oBAAoB,EACrB,MAAM,8BAA8B,CAAC;AAItC,mIAAmI;AACnI,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CA6CpD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { OnboardingTourProps } from '../../models/onboarding-tour';
|
|
3
|
+
/** Dims the page around each step's element and walks through the steps one hint card at a time, the card pointing at the element; the page stays usable while a card is open. */
|
|
4
|
+
export declare const OnboardingTour: FC<OnboardingTourProps>;
|
|
5
|
+
//# sourceMappingURL=OnboardingTour.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OnboardingTour.d.ts","sourceRoot":"","sources":["../../../src/components/OnboardingTour/OnboardingTour.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAOL,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAQf,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAgBxE,kLAAkL;AAClL,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA0PlD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Minimum distance, in px, between a hint card and the viewport edge. */
|
|
2
|
+
export declare const VIEWPORT_MARGIN = 16;
|
|
3
|
+
/** Distance, in px, between a hint card and its target. */
|
|
4
|
+
export declare const TARGET_GAP = 12;
|
|
5
|
+
/** Padding, in px, between the element and the edge of the cut-out around it. */
|
|
6
|
+
export declare const SPOTLIGHT_PADDING = 6;
|
|
7
|
+
/** Width, in px, of the arrow that points from a hint card at its target. */
|
|
8
|
+
export declare const ARROW_WIDTH = 16;
|
|
9
|
+
/** Height, in px, of that arrow. */
|
|
10
|
+
export declare const ARROW_HEIGHT = 8;
|
|
11
|
+
/** Smallest corner radius, in px, of an outline drawn around an element. */
|
|
12
|
+
export declare const SPOTLIGHT_MIN_RADIUS = 8;
|
|
13
|
+
/** Minimum interval, in ms, between two lookups of a hint's target while the page changes. */
|
|
14
|
+
export declare const TARGET_RESOLVE_THROTTLE_MS = 250;
|
|
15
|
+
/** Selector of the lib's own overlays, whose mutations never move a target. */
|
|
16
|
+
export declare const OWN_OVERLAY_SELECTOR = ".dial-onboarding-tour-root, .dial-onboarding-anchor-map-root";
|
|
17
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/constants/layout.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,2DAA2D;AAC3D,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,iFAAiF;AACjF,eAAO,MAAM,iBAAiB,IAAI,CAAC;AACnC,6EAA6E;AAC7E,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,oCAAoC;AACpC,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,4EAA4E;AAC5E,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,8FAA8F;AAC9F,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAC9C,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,iEAC+B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const ONBOARDING_TOUR_CLASS: {
|
|
2
|
+
/** The fixed, click-through layer that holds the card while the tour runs. */
|
|
3
|
+
readonly root: "dial-onboarding-tour-root";
|
|
4
|
+
/** The `role="dialog"` hint card. */
|
|
5
|
+
readonly card: "dial-onboarding-tour-card";
|
|
6
|
+
};
|
|
7
|
+
/** Public, host-addressable class names of `OnboardingAnchorMap`. */
|
|
8
|
+
export declare const ONBOARDING_ANCHOR_MAP_CLASS: {
|
|
9
|
+
/** The fixed layer holding every outline, tag and the panel. */
|
|
10
|
+
readonly root: "dial-onboarding-anchor-map-root";
|
|
11
|
+
/** The dashed outline around each anchor on screen. */
|
|
12
|
+
readonly outline: "dial-onboarding-anchor-map-outline";
|
|
13
|
+
/** The name tag above each outline. */
|
|
14
|
+
readonly tag: "dial-onboarding-anchor-map-tag";
|
|
15
|
+
/** The panel listing the anchors that are not on screen. */
|
|
16
|
+
readonly panel: "dial-onboarding-anchor-map-panel";
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=public-class-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-class-names.d.ts","sourceRoot":"","sources":["../../src/constants/public-class-names.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,qBAAqB;IAChC,8EAA8E;;IAE9E,qCAAqC;;CAE7B,CAAC;AAEX,qEAAqE;AACrE,eAAO,MAAM,2BAA2B;IACtC,gEAAgE;;IAEhE,uDAAuD;;IAEvD,uCAAuC;;IAEvC,4DAA4D;;CAEpD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Delay, in ms, that lets a page render before hint targets are looked up. */
|
|
2
|
+
export declare const ONBOARDING_START_DELAY_MS = 800;
|
|
3
|
+
/** Interval, in ms, between lookups while the page is still loading its data. */
|
|
4
|
+
export declare const ONBOARDING_RETRY_INTERVAL_MS = 500;
|
|
5
|
+
/** Lookups made before a page with no hint target on screen is given up on. */
|
|
6
|
+
export declare const ONBOARDING_RETRY_ATTEMPTS = 20;
|
|
7
|
+
//# sourceMappingURL=timing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timing.d.ts","sourceRoot":"","sources":["../../src/constants/timing.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAC7C,iFAAiF;AACjF,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAChD,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB,KAAK,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { UseOnboardingHintsOptions, UseOnboardingHintsResult } from '../../models/onboarding-tour';
|
|
2
|
+
/** Picks the unseen hints whose element is on the current page and returns the steps and finish handler for `OnboardingTour`. */
|
|
3
|
+
export declare const useOnboardingHints: ({ hints, seenIds, onSeenIdsChange, resolveTarget, isEnabled, pageKey, }: UseOnboardingHintsOptions) => UseOnboardingHintsResult;
|
|
4
|
+
//# sourceMappingURL=useOnboardingHints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOnboardingHints.d.ts","sourceRoot":"","sources":["../../../src/hooks/useOnboardingHints/useOnboardingHints.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAEV,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,8BAA8B,CAAC;AAMtC,iIAAiI;AACjI,eAAO,MAAM,kBAAkB,GAAI,yEAOhC,yBAAyB,KAAG,wBAyE9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResolvedTarget.d.ts","sourceRoot":"","sources":["../../../src/hooks/useResolvedTarget/useResolvedTarget.ts"],"names":[],"mappings":"AAcA,4GAA4G;AAC5G,eAAO,MAAM,iBAAiB,GAC5B,WAAW,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,SAAS,KAChD,WAAW,GAAG,IA4ChB,CAAC"}
|
package/index.css
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
._card_1bnm0_1{background:var(--ot-card-bg,var(--bg-layer-raised,#fcfcfc));box-shadow:0 2px 6px 0 var(--ot-card-shadow,var(--shadow-lg,#161b2d1f)), 0 12px 32px 0 var(--ot-card-shadow,var(--shadow-lg,#161b2d1f))}._counter_1bnm0_7{color:var(--ot-counter-text,var(--text-tertiary,#848e9c))}._title_1bnm0_11{color:var(--ot-title-text,var(--text-primary,#161b2d))}._description_1bnm0_15{color:var(--ot-description-text,var(--text-secondary,#57647a))}._backdrop_by4yl_1{background:var(--ot-backdrop,var(--bg-backdrop,#161b2d4d))}._cutout_by4yl_6{box-shadow:0 0 0 9999px var(--ot-backdrop,var(--bg-backdrop,#161b2d4d))}._arrow_by4yl_11{fill:var(--ot-card-bg,var(--bg-layer-raised,#fcfcfc))}._outline_ny19w_1{border-color:var(--oam-outline,var(--stroke-accent,#1d4ed8))}._tag_ny19w_5{background:var(--oam-tag-bg,var(--bg-layer-raised,#fcfcfc));color:var(--oam-tag-text,var(--text-accent,#1d4ed8));border:1px solid var(--oam-outline,var(--stroke-accent,#1d4ed8))}._panel_puhv9_1{background:var(--oam-panel-bg,var(--bg-layer-raised,#fcfcfc));border-color:var(--oam-panel-border,var(--stroke-tertiary,#e0e6f0));box-shadow:1px 10px 25px 12px var(--oam-panel-shadow,var(--shadow-lg,#2764d914))}._summary_puhv9_7{color:var(--oam-panel-text,var(--text-primary,#161b2d))}._item_puhv9_11{color:var(--oam-panel-muted-text,var(--text-secondary,#57647a))}
|
|
2
|
+
/*$vite$:1*//*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
3
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid}}}.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.inset-0{inset:0}.inset-x-4{inset-inline:1rem}.inset-e-4{inset-inline-end:1rem}.top-4{top:1rem}.bottom-4{bottom:1rem}.z-60{z-index:60}.z-70{z-index:70}.block{display:block}.flex{display:flex}.hidden{display:none}.inline{display:inline}.max-h-\[50vh\]{max-height:50vh}.w-72{width:18rem}.w-90{width:22.5rem}.max-w-\[calc\(100vw-32px\)\]{max-width:calc(100vw - 32px)}.min-w-0{min-width:0}.flex-1{flex:1}.rotate-180{rotate:180deg}.resize{resize:both}.flex-col{flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.overflow-auto{overflow:auto}.rounded{border-radius:4px}.rounded-lg{border-radius:.5rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.p-3{padding:.75rem}.p-4{padding:1rem}.px-1{padding-inline:.25rem}.whitespace-nowrap{white-space:nowrap}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,cubic-bezier(.4, 0, .2, 1));transition-duration:var(--tw-duration,.15s)}.outline-none{--tw-outline-style:none;outline-style:none}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { OnboardingTour } from './components/OnboardingTour/OnboardingTour';
|
|
2
|
+
export { OnboardingAnchorMap } from './components/OnboardingAnchorMap/OnboardingAnchorMap';
|
|
3
|
+
export { OnboardingHints } from './components/OnboardingHints/OnboardingHints';
|
|
4
|
+
export { useOnboardingHints } from './hooks/useOnboardingHints/useOnboardingHints';
|
|
5
|
+
export { OnboardingTourEndReason } from './types/onboarding-tour-end-reason';
|
|
6
|
+
export { ONBOARDING_RETRY_ATTEMPTS, ONBOARDING_RETRY_INTERVAL_MS, ONBOARDING_START_DELAY_MS, } from './constants/timing';
|
|
7
|
+
export type { OnboardingAnchor, OnboardingAnchorMapColors, OnboardingAnchorMapLabels, OnboardingAnchorMapProps, OnboardingCardColors, OnboardingHint, OnboardingHintsLabels, OnboardingHintsProps, OnboardingTourColors, OnboardingTourLabels, OnboardingTourProps, OnboardingTourStep, UseOnboardingHintsOptions, UseOnboardingHintsResult, } from './models/onboarding-tour';
|
|
8
|
+
export { ONBOARDING_ANCHOR_MAP_CLASS, ONBOARDING_TOUR_CLASS, } from './constants/public-class-names';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EACL,yBAAyB,EACzB,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,gBAAgB,EAChB,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,EACpB,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,gCAAgC,CAAC"}
|
package/index.js
ADDED
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
import { buildCssVars as e } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { CloseButton as t, DIAL_ICON_SIZE as n, DIAL_KIT_ICON_STROKE as r, ElementSize as i, GhostButton as a, NeutralButton as o, PrimaryButton as s, mergeClasses as c } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { FloatingArrow as l, FloatingFocusManager as u, FloatingPortal as d, arrow as f, autoUpdate as p, flip as m, hide as h, offset as g, shift as _, useDismiss as ee, useFloating as v, useInteractions as te, useMergeRefs as y } from "@floating-ui/react";
|
|
4
|
+
import { createElement as b, forwardRef as ne, useCallback as x, useEffect as S, useId as C, useLayoutEffect as w, useMemo as T, useRef as E, useState as D } from "react";
|
|
5
|
+
import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
|
|
6
|
+
//#region src/constants/layout.ts
|
|
7
|
+
var j = ".dial-onboarding-tour-root, .dial-onboarding-anchor-map-root", M = {
|
|
8
|
+
root: "dial-onboarding-tour-root",
|
|
9
|
+
card: "dial-onboarding-tour-card"
|
|
10
|
+
}, N = {
|
|
11
|
+
root: "dial-onboarding-anchor-map-root",
|
|
12
|
+
outline: "dial-onboarding-anchor-map-outline",
|
|
13
|
+
tag: "dial-onboarding-anchor-map-tag",
|
|
14
|
+
panel: "dial-onboarding-anchor-map-panel"
|
|
15
|
+
}, P = (e) => (e.target instanceof Element ? e.target : e.target.parentElement)?.closest(j) != null, re = (e) => {
|
|
16
|
+
let [t, n] = D(null);
|
|
17
|
+
return w(() => {
|
|
18
|
+
if (!e) {
|
|
19
|
+
n(null);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
let t = () => n(e());
|
|
23
|
+
t();
|
|
24
|
+
let r = 0, i = () => {
|
|
25
|
+
r === 0 && (r = window.setTimeout(() => {
|
|
26
|
+
r = 0, t();
|
|
27
|
+
}, 250));
|
|
28
|
+
}, a = typeof MutationObserver > "u" ? null : new MutationObserver((e) => {
|
|
29
|
+
e.some((e) => !P(e)) && i();
|
|
30
|
+
});
|
|
31
|
+
return a?.observe(document.body, {
|
|
32
|
+
childList: !0,
|
|
33
|
+
subtree: !0,
|
|
34
|
+
attributes: !0,
|
|
35
|
+
attributeFilter: [
|
|
36
|
+
"inert",
|
|
37
|
+
"hidden",
|
|
38
|
+
"aria-hidden",
|
|
39
|
+
"class",
|
|
40
|
+
"style"
|
|
41
|
+
]
|
|
42
|
+
}), window.addEventListener("resize", i), () => {
|
|
43
|
+
a?.disconnect(), window.clearTimeout(r), window.removeEventListener("resize", i);
|
|
44
|
+
};
|
|
45
|
+
}, [e]), t;
|
|
46
|
+
}, F = /* @__PURE__ */ function(e) {
|
|
47
|
+
return e.Done = "done", e.Dismissed = "dismissed", e;
|
|
48
|
+
}({}), ie = (e) => ({
|
|
49
|
+
"--ot-card-bg": e?.cardBackground,
|
|
50
|
+
"--ot-card-shadow": e?.cardShadow,
|
|
51
|
+
"--ot-title-text": e?.titleText,
|
|
52
|
+
"--ot-description-text": e?.descriptionText
|
|
53
|
+
}), I = "targetRect", ae = () => ({
|
|
54
|
+
name: I,
|
|
55
|
+
fn: ({ rects: e }) => ({ data: {
|
|
56
|
+
top: e.reference.y,
|
|
57
|
+
left: e.reference.x,
|
|
58
|
+
width: e.reference.width,
|
|
59
|
+
height: e.reference.height
|
|
60
|
+
} })
|
|
61
|
+
}), L = "occlusion", R = () => ({
|
|
62
|
+
name: L,
|
|
63
|
+
fn: ({ elements: e, rects: t }) => {
|
|
64
|
+
let n = e.reference;
|
|
65
|
+
if (!(n instanceof Element) || typeof document.elementFromPoint != "function") return { data: { isCovered: !1 } };
|
|
66
|
+
let r = document.elementFromPoint(t.reference.x + t.reference.width / 2, t.reference.y + t.reference.height / 2);
|
|
67
|
+
return { data: { isCovered: r != null && !n.contains(r) && !r.contains(n) } };
|
|
68
|
+
}
|
|
69
|
+
}), oe = (e = 0) => [
|
|
70
|
+
g(18 + e),
|
|
71
|
+
m({
|
|
72
|
+
padding: 16,
|
|
73
|
+
fallbackPlacements: [
|
|
74
|
+
"top-start",
|
|
75
|
+
"right-start",
|
|
76
|
+
"left-start"
|
|
77
|
+
]
|
|
78
|
+
}),
|
|
79
|
+
_({ padding: 16 })
|
|
80
|
+
], z = [
|
|
81
|
+
"borderTopLeftRadius",
|
|
82
|
+
"borderTopRightRadius",
|
|
83
|
+
"borderBottomRightRadius",
|
|
84
|
+
"borderBottomLeftRadius"
|
|
85
|
+
], B = (e, t) => {
|
|
86
|
+
if (e.endsWith("%")) return e;
|
|
87
|
+
let n = parseFloat(e), r = Number.isFinite(n) && n > 0 ? n + t : 0;
|
|
88
|
+
return `${Math.max(r, 8)}px`;
|
|
89
|
+
}, se = (e, t) => {
|
|
90
|
+
let n = getComputedStyle(e);
|
|
91
|
+
return z.map((e) => B(n[e], t)).join(" ");
|
|
92
|
+
}, V = {
|
|
93
|
+
card: "_card_1bnm0_1",
|
|
94
|
+
counter: "_counter_1bnm0_7",
|
|
95
|
+
title: "_title_1bnm0_11",
|
|
96
|
+
description: "_description_1bnm0_15"
|
|
97
|
+
}, ce = ({ ref: e, heading: n, description: r, counter: a, closeLabel: o, onClose: s, footer: l, arrow: u, counterClassName: d, titleClassName: f, descriptionClassName: p, className: m, ...h }) => {
|
|
98
|
+
let g = C(), _ = C();
|
|
99
|
+
return /* @__PURE__ */ A("div", {
|
|
100
|
+
...h,
|
|
101
|
+
ref: e,
|
|
102
|
+
role: "dialog",
|
|
103
|
+
"aria-labelledby": g,
|
|
104
|
+
"aria-describedby": r ? _ : void 0,
|
|
105
|
+
tabIndex: -1,
|
|
106
|
+
className: c(M.card, V.card, "flex flex-col gap-3 rounded-lg p-4 outline-none", m),
|
|
107
|
+
children: [
|
|
108
|
+
u,
|
|
109
|
+
/* @__PURE__ */ A("div", {
|
|
110
|
+
className: "flex items-start gap-2",
|
|
111
|
+
children: [/* @__PURE__ */ A("div", {
|
|
112
|
+
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
113
|
+
children: [a && /* @__PURE__ */ k("span", {
|
|
114
|
+
className: c(V.counter, d),
|
|
115
|
+
children: a
|
|
116
|
+
}), /* @__PURE__ */ k("h2", {
|
|
117
|
+
id: g,
|
|
118
|
+
className: c(V.title, f),
|
|
119
|
+
children: n
|
|
120
|
+
})]
|
|
121
|
+
}), s && o && /* @__PURE__ */ k(t, {
|
|
122
|
+
ariaLabel: o,
|
|
123
|
+
size: i.Small,
|
|
124
|
+
onClose: s
|
|
125
|
+
})]
|
|
126
|
+
}),
|
|
127
|
+
r && /* @__PURE__ */ k("p", {
|
|
128
|
+
id: _,
|
|
129
|
+
className: c(V.description, p),
|
|
130
|
+
children: r
|
|
131
|
+
}),
|
|
132
|
+
l
|
|
133
|
+
]
|
|
134
|
+
});
|
|
135
|
+
}, H = {
|
|
136
|
+
backdrop: "_backdrop_by4yl_1",
|
|
137
|
+
cutout: "_cutout_by4yl_6",
|
|
138
|
+
arrow: "_arrow_by4yl_11"
|
|
139
|
+
}, le = (e, t) => `Step ${e} of ${t}`, U = ({ steps: t, onFinish: n, isMobile: r = !1, dir: i, labels: m, colors: h, counterClassName: g = "dial-tiny-text", titleClassName: _ = "dial-body-semi-text", descriptionClassName: b = "dial-small-paragraph-text", className: ne }) => {
|
|
140
|
+
let [C, O] = D(0), [j, N] = D(t), P = E(null), L = E(null);
|
|
141
|
+
j !== t && (N(t), O(0));
|
|
142
|
+
let R = t[C] ?? null, z = R != null, B = re(R?.getTarget), V = E(null), U = T(() => B ? se(B, 6) : void 0, [B]);
|
|
143
|
+
w(() => {
|
|
144
|
+
z && (L.current = document.activeElement);
|
|
145
|
+
}, [z]);
|
|
146
|
+
let W = E(/* @__PURE__ */ new Set());
|
|
147
|
+
w(() => {
|
|
148
|
+
W.current = /* @__PURE__ */ new Set();
|
|
149
|
+
}, [t]), w(() => {
|
|
150
|
+
R && B && R.getTarget() && W.current.add(R.id);
|
|
151
|
+
}, [R, B]);
|
|
152
|
+
let G = x((e) => {
|
|
153
|
+
n([...W.current], e);
|
|
154
|
+
}, [n]), K = x(() => G(F.Done), [G]), q = x(() => G(F.Dismissed), [G]), { refs: J, floatingStyles: ue, context: Y, middlewareData: de, isPositioned: fe } = v({
|
|
155
|
+
open: z,
|
|
156
|
+
onOpenChange: (e) => {
|
|
157
|
+
e || q();
|
|
158
|
+
},
|
|
159
|
+
elements: { reference: B },
|
|
160
|
+
strategy: "fixed",
|
|
161
|
+
placement: "bottom-start",
|
|
162
|
+
middleware: [
|
|
163
|
+
...oe(8),
|
|
164
|
+
f({
|
|
165
|
+
element: V,
|
|
166
|
+
padding: 12
|
|
167
|
+
}),
|
|
168
|
+
ae()
|
|
169
|
+
],
|
|
170
|
+
whileElementsMounted: p
|
|
171
|
+
}), pe = ee(Y, { outsidePress: !1 }), { getFloatingProps: me } = te([pe]), he = y([J.setFloating, P]);
|
|
172
|
+
w(() => {
|
|
173
|
+
R && !R.getTarget() && (C < t.length - 1 ? O(C + 1) : K());
|
|
174
|
+
}, [
|
|
175
|
+
R,
|
|
176
|
+
C,
|
|
177
|
+
t.length,
|
|
178
|
+
K
|
|
179
|
+
]), w(() => {
|
|
180
|
+
B?.scrollIntoView?.({
|
|
181
|
+
block: "nearest",
|
|
182
|
+
inline: "nearest"
|
|
183
|
+
});
|
|
184
|
+
}, [B]), S(() => {
|
|
185
|
+
R && P.current?.focus();
|
|
186
|
+
}, [R]);
|
|
187
|
+
let X = x(() => O((e) => e - 1), []), Z = x(() => O((e) => e + 1), []);
|
|
188
|
+
if (!R) return null;
|
|
189
|
+
let ge = t.length, _e = C === ge - 1, ve = m?.stepCounter ?? le, Q = r || !B, $ = B ? de[I] : void 0, ye = $ != null && $.top + $.height / 2 > window.innerHeight / 2, be = e({
|
|
190
|
+
...ie(h),
|
|
191
|
+
"--ot-backdrop": h?.backdrop,
|
|
192
|
+
"--ot-counter-text": h?.counterText
|
|
193
|
+
});
|
|
194
|
+
return /* @__PURE__ */ k(d, { children: /* @__PURE__ */ A("div", {
|
|
195
|
+
dir: i,
|
|
196
|
+
style: be,
|
|
197
|
+
className: c(M.root, "pointer-events-none fixed inset-0 z-60", ne),
|
|
198
|
+
children: [$ ? /* @__PURE__ */ k("div", {
|
|
199
|
+
"aria-hidden": !0,
|
|
200
|
+
className: c(H.cutout, "absolute"),
|
|
201
|
+
style: {
|
|
202
|
+
top: $.top - 6,
|
|
203
|
+
left: $.left - 6,
|
|
204
|
+
width: $.width + 12,
|
|
205
|
+
height: $.height + 12,
|
|
206
|
+
borderRadius: U
|
|
207
|
+
}
|
|
208
|
+
}) : /* @__PURE__ */ k("div", {
|
|
209
|
+
"aria-hidden": !0,
|
|
210
|
+
className: c(H.backdrop, "absolute inset-0")
|
|
211
|
+
}), /* @__PURE__ */ k(u, {
|
|
212
|
+
context: Y,
|
|
213
|
+
modal: !1,
|
|
214
|
+
closeOnFocusOut: !1,
|
|
215
|
+
initialFocus: P,
|
|
216
|
+
returnFocus: L,
|
|
217
|
+
children: /* @__PURE__ */ k(ce, {
|
|
218
|
+
...me(),
|
|
219
|
+
ref: he,
|
|
220
|
+
heading: R.title,
|
|
221
|
+
description: R.description,
|
|
222
|
+
counter: ve(C + 1, ge),
|
|
223
|
+
closeLabel: m?.close ?? "Close tour",
|
|
224
|
+
onClose: q,
|
|
225
|
+
counterClassName: g,
|
|
226
|
+
titleClassName: _,
|
|
227
|
+
descriptionClassName: b,
|
|
228
|
+
className: c("pointer-events-auto", Q && ye && "fixed inset-x-4 top-4", Q && !ye && "fixed inset-x-4 bottom-4", !Q && "w-90 max-w-[calc(100vw-32px)]", !Q && !fe && "invisible"),
|
|
229
|
+
style: Q ? void 0 : ue,
|
|
230
|
+
arrow: Q ? void 0 : /* @__PURE__ */ k(l, {
|
|
231
|
+
ref: V,
|
|
232
|
+
context: Y,
|
|
233
|
+
width: 16,
|
|
234
|
+
height: 8,
|
|
235
|
+
className: H.arrow
|
|
236
|
+
}),
|
|
237
|
+
footer: /* @__PURE__ */ A("div", {
|
|
238
|
+
className: "flex items-center justify-between gap-2",
|
|
239
|
+
children: [_e ? /* @__PURE__ */ k("span", {}) : /* @__PURE__ */ k(a, {
|
|
240
|
+
label: m?.skip ?? "Skip tour",
|
|
241
|
+
onClick: q
|
|
242
|
+
}), /* @__PURE__ */ A("div", {
|
|
243
|
+
className: "flex items-center gap-2",
|
|
244
|
+
children: [C > 0 && /* @__PURE__ */ k(o, {
|
|
245
|
+
label: m?.back ?? "Back",
|
|
246
|
+
onClick: X
|
|
247
|
+
}), /* @__PURE__ */ k(s, {
|
|
248
|
+
label: _e ? m?.done ?? "Done" : m?.next ?? "Next",
|
|
249
|
+
onClick: _e ? K : Z
|
|
250
|
+
})]
|
|
251
|
+
})]
|
|
252
|
+
})
|
|
253
|
+
})
|
|
254
|
+
})]
|
|
255
|
+
}) });
|
|
256
|
+
}, W = {
|
|
257
|
+
outline: {
|
|
258
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
259
|
+
width: 24,
|
|
260
|
+
height: 24,
|
|
261
|
+
viewBox: "0 0 24 24",
|
|
262
|
+
fill: "none",
|
|
263
|
+
stroke: "currentColor",
|
|
264
|
+
strokeWidth: 2,
|
|
265
|
+
strokeLinecap: "round",
|
|
266
|
+
strokeLinejoin: "round"
|
|
267
|
+
},
|
|
268
|
+
filled: {
|
|
269
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
270
|
+
width: 24,
|
|
271
|
+
height: 24,
|
|
272
|
+
viewBox: "0 0 24 24",
|
|
273
|
+
fill: "currentColor",
|
|
274
|
+
stroke: "none"
|
|
275
|
+
}
|
|
276
|
+
}, G = ((e, t, n, r) => {
|
|
277
|
+
let i = ne(({ color: n = "currentColor", size: i = 24, stroke: a = 2, title: o, className: s, children: c, ...l }, u) => b("svg", {
|
|
278
|
+
ref: u,
|
|
279
|
+
...W[e],
|
|
280
|
+
width: i,
|
|
281
|
+
height: i,
|
|
282
|
+
className: [
|
|
283
|
+
"tabler-icon",
|
|
284
|
+
`tabler-icon-${t}`,
|
|
285
|
+
s
|
|
286
|
+
].filter(Boolean).join(" "),
|
|
287
|
+
strokeWidth: a,
|
|
288
|
+
stroke: n,
|
|
289
|
+
...l
|
|
290
|
+
}, [
|
|
291
|
+
o && b("title", { key: "svg-title" }, o),
|
|
292
|
+
...r.map(([e, t]) => b(e, t)),
|
|
293
|
+
...Array.isArray(c) ? c : [c]
|
|
294
|
+
]));
|
|
295
|
+
return i.displayName = `${n}`, i;
|
|
296
|
+
})("outline", "chevron-down", "ChevronDown", [["path", {
|
|
297
|
+
d: "M6 9l6 6l6 -6",
|
|
298
|
+
key: "svg-0"
|
|
299
|
+
}]]), K = {
|
|
300
|
+
outline: "_outline_ny19w_1",
|
|
301
|
+
tag: "_tag_ny19w_5"
|
|
302
|
+
}, q = ({ anchor: e, onAvailabilityChange: t, tagClassName: n }) => {
|
|
303
|
+
let r = re(e.getTarget), i = r != null;
|
|
304
|
+
S(() => {
|
|
305
|
+
t(e.id, i);
|
|
306
|
+
}, [
|
|
307
|
+
e.id,
|
|
308
|
+
i,
|
|
309
|
+
t
|
|
310
|
+
]);
|
|
311
|
+
let { refs: a, floatingStyles: o, middlewareData: s, isPositioned: l } = v({
|
|
312
|
+
elements: { reference: r },
|
|
313
|
+
strategy: "fixed",
|
|
314
|
+
placement: "top-start",
|
|
315
|
+
middleware: [
|
|
316
|
+
ae(),
|
|
317
|
+
h(),
|
|
318
|
+
R()
|
|
319
|
+
],
|
|
320
|
+
whileElementsMounted: (e, t, n) => p(e, t, n, { animationFrame: !0 })
|
|
321
|
+
}), u = T(() => r ? se(r, 0) : void 0, [r]);
|
|
322
|
+
if (!r) return null;
|
|
323
|
+
let d = s[I], f = !l || s.hide?.referenceHidden || s.occlusion?.isCovered;
|
|
324
|
+
return /* @__PURE__ */ A(O, { children: [d && /* @__PURE__ */ k("div", {
|
|
325
|
+
"aria-hidden": !0,
|
|
326
|
+
className: c(N.outline, K.outline, "fixed border-2 border-dashed", f && "invisible"),
|
|
327
|
+
style: {
|
|
328
|
+
top: d.top,
|
|
329
|
+
left: d.left,
|
|
330
|
+
width: d.width,
|
|
331
|
+
height: d.height,
|
|
332
|
+
borderRadius: u
|
|
333
|
+
}
|
|
334
|
+
}), /* @__PURE__ */ k("span", {
|
|
335
|
+
ref: a.setFloating,
|
|
336
|
+
style: o,
|
|
337
|
+
className: c(N.tag, K.tag, "rounded px-1 whitespace-nowrap", n, f && "invisible"),
|
|
338
|
+
children: e.id
|
|
339
|
+
})] });
|
|
340
|
+
}, J = {
|
|
341
|
+
panel: "_panel_puhv9_1",
|
|
342
|
+
summary: "_summary_puhv9_7",
|
|
343
|
+
item: "_item_puhv9_11"
|
|
344
|
+
}, ue = (e, t) => `${e} of ${t} anchors on this page`, Y = ({ anchors: o, onClose: s, dir: l, labels: u, colors: f, tagClassName: p = "dial-tiny-semi-text", summaryClassName: m = "dial-small-semi-text", itemClassName: h = "dial-tiny-text", className: g }) => {
|
|
345
|
+
let [_, ee] = D(() => /* @__PURE__ */ new Set()), v = C(), te = C(), [y, b] = D(!1), ne = x(() => b((e) => !e), []), S = x((e, t) => ee((n) => {
|
|
346
|
+
if (n.has(e) === t) return n;
|
|
347
|
+
let r = new Set(n);
|
|
348
|
+
return t ? r.add(e) : r.delete(e), r;
|
|
349
|
+
}), []), w = o.filter(({ id: e }) => !_.has(e)), T = o.length - w.length, E = (u?.summary ?? ue)(T, o.length), j = e({
|
|
350
|
+
"--oam-outline": f?.outline,
|
|
351
|
+
"--oam-tag-bg": f?.tagBackground,
|
|
352
|
+
"--oam-tag-text": f?.tagText,
|
|
353
|
+
"--oam-panel-bg": f?.panelBackground,
|
|
354
|
+
"--oam-panel-border": f?.panelBorder,
|
|
355
|
+
"--oam-panel-shadow": f?.panelShadow,
|
|
356
|
+
"--oam-panel-text": f?.panelText,
|
|
357
|
+
"--oam-panel-muted-text": f?.panelMutedText
|
|
358
|
+
});
|
|
359
|
+
return /* @__PURE__ */ k(d, { children: /* @__PURE__ */ A("div", {
|
|
360
|
+
dir: l,
|
|
361
|
+
style: j,
|
|
362
|
+
className: c(N.root, "pointer-events-none fixed inset-0 z-70", g),
|
|
363
|
+
children: [o.map((e) => /* @__PURE__ */ k(q, {
|
|
364
|
+
anchor: e,
|
|
365
|
+
onAvailabilityChange: S,
|
|
366
|
+
tagClassName: p
|
|
367
|
+
}, e.id)), /* @__PURE__ */ A("section", {
|
|
368
|
+
"aria-labelledby": v,
|
|
369
|
+
className: c(N.panel, J.panel, "pointer-events-auto fixed inset-e-4 bottom-4 flex max-h-[50vh] w-72 max-w-[calc(100vw-32px)] flex-col gap-2 overflow-auto rounded-lg border p-3"),
|
|
370
|
+
children: [/* @__PURE__ */ A("div", {
|
|
371
|
+
className: "flex items-start justify-between gap-2",
|
|
372
|
+
children: [/* @__PURE__ */ k("h2", {
|
|
373
|
+
id: v,
|
|
374
|
+
className: c(J.summary, m),
|
|
375
|
+
children: E
|
|
376
|
+
}), /* @__PURE__ */ k(t, {
|
|
377
|
+
ariaLabel: u?.close ?? "Close anchor view",
|
|
378
|
+
size: i.Standard,
|
|
379
|
+
onClose: s
|
|
380
|
+
})]
|
|
381
|
+
}), w.length > 0 ? /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k("h3", { children: /* @__PURE__ */ k(a, {
|
|
382
|
+
label: `${u?.missingHeading ?? "Not on this page"} (${w.length})`,
|
|
383
|
+
"aria-expanded": y,
|
|
384
|
+
"aria-controls": te,
|
|
385
|
+
onClick: ne,
|
|
386
|
+
iconAfter: /* @__PURE__ */ k(G, {
|
|
387
|
+
size: n.SM,
|
|
388
|
+
stroke: r,
|
|
389
|
+
className: c("transition-transform", y && "rotate-180"),
|
|
390
|
+
"aria-hidden": !0
|
|
391
|
+
}),
|
|
392
|
+
textClassName: c(J.item, h)
|
|
393
|
+
}) }), /* @__PURE__ */ k("ul", {
|
|
394
|
+
id: te,
|
|
395
|
+
hidden: !y,
|
|
396
|
+
className: c(y ? "flex" : "hidden", "flex-col gap-1"),
|
|
397
|
+
children: w.map(({ id: e }) => /* @__PURE__ */ k("li", {
|
|
398
|
+
className: c(J.item, h),
|
|
399
|
+
children: /* @__PURE__ */ k("code", { children: e })
|
|
400
|
+
}, e))
|
|
401
|
+
})] }) : /* @__PURE__ */ k("p", {
|
|
402
|
+
className: c(J.item, h),
|
|
403
|
+
children: u?.noneMissing ?? "Every anchor is on this page"
|
|
404
|
+
})]
|
|
405
|
+
})]
|
|
406
|
+
}) });
|
|
407
|
+
}, de = 800, fe = 500, pe = 20, me = /* @__PURE__ */ new Set([
|
|
408
|
+
"button",
|
|
409
|
+
"checkbox",
|
|
410
|
+
"color",
|
|
411
|
+
"file",
|
|
412
|
+
"image",
|
|
413
|
+
"radio",
|
|
414
|
+
"range",
|
|
415
|
+
"reset",
|
|
416
|
+
"submit"
|
|
417
|
+
]), he = (e) => e instanceof HTMLElement ? e instanceof HTMLInputElement ? !me.has(e.type) : e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement || e.isContentEditable : !1, X = [], Z = ({ hints: e, seenIds: t, onSeenIdsChange: n, resolveTarget: r, isEnabled: i, pageKey: a }) => {
|
|
418
|
+
let [o, s] = D(X), c = T(() => e.filter((e) => !t.includes(e.id)).map((e) => ({
|
|
419
|
+
id: e.id,
|
|
420
|
+
title: e.title,
|
|
421
|
+
description: e.description ?? void 0,
|
|
422
|
+
getTarget: () => r(e.target)
|
|
423
|
+
})), [
|
|
424
|
+
e,
|
|
425
|
+
t,
|
|
426
|
+
r
|
|
427
|
+
]);
|
|
428
|
+
S(() => {
|
|
429
|
+
s(X);
|
|
430
|
+
}, [a]);
|
|
431
|
+
let l = o.length > 0;
|
|
432
|
+
return S(() => {
|
|
433
|
+
if (!i || l || c.length === 0) return;
|
|
434
|
+
let e = 0, t = 0, n = () => {
|
|
435
|
+
if (he(document.activeElement)) {
|
|
436
|
+
t = window.setTimeout(n, 500);
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
let r = c.filter((e) => e.getTarget() != null);
|
|
440
|
+
r.length > 0 ? s(r) : (e += 1, e < 20 && (t = window.setTimeout(n, 500)));
|
|
441
|
+
};
|
|
442
|
+
return t = window.setTimeout(n, 800), () => window.clearTimeout(t);
|
|
443
|
+
}, [
|
|
444
|
+
i,
|
|
445
|
+
l,
|
|
446
|
+
c,
|
|
447
|
+
a
|
|
448
|
+
]), {
|
|
449
|
+
steps: o,
|
|
450
|
+
onFinish: x((r, i) => {
|
|
451
|
+
let a = i === F.Dismissed ? [.../* @__PURE__ */ new Set([...r, ...e.map(({ id: e }) => e)])] : r;
|
|
452
|
+
n([...t.filter((e) => !a.includes(e)), ...a]), s(X);
|
|
453
|
+
}, [
|
|
454
|
+
e,
|
|
455
|
+
t,
|
|
456
|
+
n
|
|
457
|
+
])
|
|
458
|
+
};
|
|
459
|
+
}, ge = ({ anchorTargets: e, isAnchorView: t = !1, onCloseAnchorView: n, isMobile: r = !1, dir: i, labels: a, isEnabled: o, ...s }) => {
|
|
460
|
+
let { resolveTarget: c } = s, { steps: l, onFinish: u } = Z({
|
|
461
|
+
...s,
|
|
462
|
+
isEnabled: o && !t
|
|
463
|
+
}), d = T(() => e.map((e) => ({
|
|
464
|
+
id: e,
|
|
465
|
+
getTarget: () => c(e)
|
|
466
|
+
})), [e, c]);
|
|
467
|
+
return t ? /* @__PURE__ */ k(Y, {
|
|
468
|
+
anchors: d,
|
|
469
|
+
onClose: n ?? (() => void 0),
|
|
470
|
+
dir: i,
|
|
471
|
+
labels: a?.anchorMap
|
|
472
|
+
}) : /* @__PURE__ */ k(U, {
|
|
473
|
+
steps: l,
|
|
474
|
+
onFinish: u,
|
|
475
|
+
isMobile: r,
|
|
476
|
+
dir: i,
|
|
477
|
+
labels: a?.tour
|
|
478
|
+
});
|
|
479
|
+
};
|
|
480
|
+
//#endregion
|
|
481
|
+
export { N as ONBOARDING_ANCHOR_MAP_CLASS, pe as ONBOARDING_RETRY_ATTEMPTS, fe as ONBOARDING_RETRY_INTERVAL_MS, de as ONBOARDING_START_DELAY_MS, M as ONBOARDING_TOUR_CLASS, Y as OnboardingAnchorMap, ge as OnboardingHints, U as OnboardingTour, F as OnboardingTourEndReason, Z as useOnboardingHints };
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { OnboardingTourEndReason } from '../types/onboarding-tour-end-reason';
|
|
2
|
+
/** One hint: the copy shown in its card and the element it points at. */
|
|
3
|
+
export interface OnboardingTourStep {
|
|
4
|
+
/** Stable id of the hint, reported back through `onFinish`. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Card heading; also the card's accessible name. */
|
|
7
|
+
title: string;
|
|
8
|
+
/** Optional body text below the heading; also the card's accessible description. */
|
|
9
|
+
description?: string;
|
|
10
|
+
/** Returns the element the hint points at, or `null` when it is not on screen; called again whenever the page changes. */
|
|
11
|
+
getTarget: () => HTMLElement | null;
|
|
12
|
+
}
|
|
13
|
+
/** Colors of the hint card of `OnboardingTour`. */
|
|
14
|
+
export interface OnboardingCardColors {
|
|
15
|
+
/** Hint card background. Defaults to `--bg-layer-raised`. */
|
|
16
|
+
cardBackground?: string;
|
|
17
|
+
/** Hint card drop shadow color. Defaults to `--shadow-lg`. */
|
|
18
|
+
cardShadow?: string;
|
|
19
|
+
/** Card title text. Defaults to `--text-primary`. */
|
|
20
|
+
titleText?: string;
|
|
21
|
+
/** Card description text. Defaults to `--text-secondary`. */
|
|
22
|
+
descriptionText?: string;
|
|
23
|
+
}
|
|
24
|
+
/** User-visible strings of the `OnboardingTour` component. */
|
|
25
|
+
export interface OnboardingTourLabels {
|
|
26
|
+
/** Step counter above the title. Defaults to `` (current, total) => `Step ${current} of ${total}` ``. */
|
|
27
|
+
stepCounter?: (current: number, total: number) => string;
|
|
28
|
+
/** Label of the button that opens the next hint. Defaults to `'Next'`. */
|
|
29
|
+
next?: string;
|
|
30
|
+
/** Label of the button that returns to the previous hint. Defaults to `'Back'`. */
|
|
31
|
+
back?: string;
|
|
32
|
+
/** Label of the button on the last hint that ends the tour. Defaults to `'Done'`. */
|
|
33
|
+
done?: string;
|
|
34
|
+
/** Label of the button that ends the tour early. Defaults to `'Skip tour'`. */
|
|
35
|
+
skip?: string;
|
|
36
|
+
/** Accessible label of the card's close button. Defaults to `'Close tour'`. */
|
|
37
|
+
close?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Color overrides of the `OnboardingTour` component. */
|
|
40
|
+
export interface OnboardingTourColors extends OnboardingCardColors {
|
|
41
|
+
/** Dimming layer over the page behind the card. Defaults to `--bg-backdrop`. */
|
|
42
|
+
backdrop?: string;
|
|
43
|
+
/** Step counter text. Defaults to `--text-tertiary`. */
|
|
44
|
+
counterText?: string;
|
|
45
|
+
}
|
|
46
|
+
/** Props for the `OnboardingTour` component. */
|
|
47
|
+
export interface OnboardingTourProps {
|
|
48
|
+
/** Hints to walk through, in order; the tour renders nothing while the list is empty and restarts from the first hint when the list changes. */
|
|
49
|
+
steps: OnboardingTourStep[];
|
|
50
|
+
/** Called with the ids of the steps that were on screen when the tour ends, and why it ended; the host clears `steps` in response. */
|
|
51
|
+
onFinish: (shownStepIds: string[], reason: OnboardingTourEndReason) => void;
|
|
52
|
+
/** When `true`, the card is a bottom sheet instead of a popover next to the target. Defaults to `false`. */
|
|
53
|
+
isMobile?: boolean;
|
|
54
|
+
/** Text direction of the overlay, used to align the card with its target. Defaults to the direction inherited from the document. */
|
|
55
|
+
dir?: 'ltr' | 'rtl';
|
|
56
|
+
/** User-visible strings; each missing field falls back to its English default. */
|
|
57
|
+
labels?: OnboardingTourLabels;
|
|
58
|
+
/** Color overrides, applied as CSS custom properties on the overlay. */
|
|
59
|
+
colors?: OnboardingTourColors;
|
|
60
|
+
/** Typography class of the step counter. Defaults to `'dial-tiny-text'`. */
|
|
61
|
+
counterClassName?: string;
|
|
62
|
+
/** Typography class of the card title. Defaults to `'dial-body-semi-text'`. */
|
|
63
|
+
titleClassName?: string;
|
|
64
|
+
/** Typography class of the card description. Defaults to `'dial-small-paragraph-text'`. */
|
|
65
|
+
descriptionClassName?: string;
|
|
66
|
+
/** Extra class name(s) merged onto the overlay root. */
|
|
67
|
+
className?: string;
|
|
68
|
+
}
|
|
69
|
+
/** One anchor shown by `OnboardingAnchorMap`. */
|
|
70
|
+
export interface OnboardingAnchor {
|
|
71
|
+
/** Name of the anchor, shown in its tag and in the list of anchors not on the page. */
|
|
72
|
+
id: string;
|
|
73
|
+
/** Returns the anchor's element, or `null` when it is not on screen; called again whenever the page changes. */
|
|
74
|
+
getTarget: () => HTMLElement | null;
|
|
75
|
+
}
|
|
76
|
+
/** User-visible strings of the `OnboardingAnchorMap` component. */
|
|
77
|
+
export interface OnboardingAnchorMapLabels {
|
|
78
|
+
/** Panel heading, given how many anchors are on screen out of all of them. Defaults to `` (found, total) => `${found} of ${total} anchors on this page` ``. */
|
|
79
|
+
summary?: (found: number, total: number) => string;
|
|
80
|
+
/** Heading above the anchors that are not on screen. Defaults to `'Not on this page'`. */
|
|
81
|
+
missingHeading?: string;
|
|
82
|
+
/** Text shown when every anchor is on screen. Defaults to `'Every anchor is on this page'`. */
|
|
83
|
+
noneMissing?: string;
|
|
84
|
+
/** Accessible label of the panel's close button. Defaults to `'Close anchor view'`. */
|
|
85
|
+
close?: string;
|
|
86
|
+
}
|
|
87
|
+
/** Color overrides of the `OnboardingAnchorMap` component. */
|
|
88
|
+
export interface OnboardingAnchorMapColors {
|
|
89
|
+
/** Dashed outline around each anchor. Defaults to `--stroke-accent`. */
|
|
90
|
+
outline?: string;
|
|
91
|
+
/** Background of each anchor's name tag. Defaults to `--bg-layer-raised`. */
|
|
92
|
+
tagBackground?: string;
|
|
93
|
+
/** Text of each anchor's name tag. Defaults to `--text-accent`. */
|
|
94
|
+
tagText?: string;
|
|
95
|
+
/** Panel background. Defaults to `--bg-layer-raised`. */
|
|
96
|
+
panelBackground?: string;
|
|
97
|
+
/** Panel border. Defaults to `--stroke-tertiary`. */
|
|
98
|
+
panelBorder?: string;
|
|
99
|
+
/** Panel drop shadow color. Defaults to `--shadow-lg`. */
|
|
100
|
+
panelShadow?: string;
|
|
101
|
+
/** Panel heading text. Defaults to `--text-primary`. */
|
|
102
|
+
panelText?: string;
|
|
103
|
+
/** Panel list text. Defaults to `--text-secondary`. */
|
|
104
|
+
panelMutedText?: string;
|
|
105
|
+
}
|
|
106
|
+
/** Props for the `OnboardingAnchorMap` component. */
|
|
107
|
+
export interface OnboardingAnchorMapProps {
|
|
108
|
+
/** Anchors to outline; one that is not on screen is listed in the panel instead. */
|
|
109
|
+
anchors: OnboardingAnchor[];
|
|
110
|
+
/** Called when the panel's close button is pressed. */
|
|
111
|
+
onClose: () => void;
|
|
112
|
+
/** Text direction of the tags and the panel. Defaults to the direction inherited from the document. */
|
|
113
|
+
dir?: 'ltr' | 'rtl';
|
|
114
|
+
/** User-visible strings; each missing field falls back to its English default. */
|
|
115
|
+
labels?: OnboardingAnchorMapLabels;
|
|
116
|
+
/** Color overrides, applied as CSS custom properties on the map root. */
|
|
117
|
+
colors?: OnboardingAnchorMapColors;
|
|
118
|
+
/** Typography class of each anchor's name tag. Defaults to `'dial-tiny-semi-text'`. */
|
|
119
|
+
tagClassName?: string;
|
|
120
|
+
/** Typography class of the panel heading. Defaults to `'dial-small-semi-text'`. */
|
|
121
|
+
summaryClassName?: string;
|
|
122
|
+
/** Typography class of the panel's list and its heading. Defaults to `'dial-tiny-text'`. */
|
|
123
|
+
itemClassName?: string;
|
|
124
|
+
/** Extra class name(s) merged onto the map root. */
|
|
125
|
+
className?: string;
|
|
126
|
+
}
|
|
127
|
+
/** One operator-configured hint: its copy and the target name the host resolves. */
|
|
128
|
+
export interface OnboardingHint {
|
|
129
|
+
/** Stable id of the hint; seen ids are tracked by it. */
|
|
130
|
+
id: string;
|
|
131
|
+
/** Name of the element the hint points at, resolved by the host's `resolveTarget`. */
|
|
132
|
+
target: string;
|
|
133
|
+
/** Card heading. */
|
|
134
|
+
title: string;
|
|
135
|
+
/** Optional body text; `null` and `undefined` both mean none. */
|
|
136
|
+
description?: string | null;
|
|
137
|
+
}
|
|
138
|
+
/** Options of `useOnboardingHints`. */
|
|
139
|
+
export interface UseOnboardingHintsOptions {
|
|
140
|
+
/** Hints to show, in order. */
|
|
141
|
+
hints: OnboardingHint[];
|
|
142
|
+
/** Ids of the hints this user has already seen. */
|
|
143
|
+
seenIds: string[];
|
|
144
|
+
/** Called with the new list of seen ids once a tour ends; the host persists it. */
|
|
145
|
+
onSeenIdsChange: (seenIds: string[]) => void;
|
|
146
|
+
/** Returns the on-screen element of a target, or `null` when the page does not render it. */
|
|
147
|
+
resolveTarget: (target: string) => HTMLElement | null;
|
|
148
|
+
/** `false` while the hints are loading or the host shows something else instead. */
|
|
149
|
+
isEnabled: boolean;
|
|
150
|
+
/** A value that changes on navigation, such as the pathname; each change looks for hints again. */
|
|
151
|
+
pageKey?: unknown;
|
|
152
|
+
}
|
|
153
|
+
/** Return value of `useOnboardingHints`. */
|
|
154
|
+
export interface UseOnboardingHintsResult {
|
|
155
|
+
/** Steps to pass to `OnboardingTour`; empty while no tour runs. */
|
|
156
|
+
steps: OnboardingTourStep[];
|
|
157
|
+
/** Pass to `OnboardingTour` as `onFinish`: marks the shown ids seen (every hint's id when dismissed) and ends the tour. */
|
|
158
|
+
onFinish: (shownIds: string[], reason: OnboardingTourEndReason) => void;
|
|
159
|
+
}
|
|
160
|
+
/** User-visible strings of the `OnboardingHints` component. */
|
|
161
|
+
export interface OnboardingHintsLabels {
|
|
162
|
+
/** Strings of the tour; each missing field falls back to its English default. */
|
|
163
|
+
tour?: OnboardingTourLabels;
|
|
164
|
+
/** Strings of the anchor map; each missing field falls back to its English default. */
|
|
165
|
+
anchorMap?: OnboardingAnchorMapLabels;
|
|
166
|
+
}
|
|
167
|
+
/** Props for the `OnboardingHints` component. */
|
|
168
|
+
export interface OnboardingHintsProps extends UseOnboardingHintsOptions {
|
|
169
|
+
/** Every target name the host can resolve, outlined while `isAnchorView` is set. */
|
|
170
|
+
anchorTargets: string[];
|
|
171
|
+
/** When `true`, outlines every anchor on the page instead of showing hints. Defaults to `false`. */
|
|
172
|
+
isAnchorView?: boolean;
|
|
173
|
+
/** Called when the anchor map's close button is pressed; without it the button does nothing. */
|
|
174
|
+
onCloseAnchorView?: () => void;
|
|
175
|
+
/** When `true`, the hint card is a bottom sheet. Defaults to `false`. */
|
|
176
|
+
isMobile?: boolean;
|
|
177
|
+
/** Text direction of the tour and the anchor map. Defaults to the direction inherited from the document. */
|
|
178
|
+
dir?: 'ltr' | 'rtl';
|
|
179
|
+
/** User-visible strings of the tour and the anchor map. */
|
|
180
|
+
labels?: OnboardingHintsLabels;
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=onboarding-tour.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboarding-tour.d.ts","sourceRoot":"","sources":["../../src/models/onboarding-tour.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** A target's viewport rectangle, in CSS pixels. */
|
|
2
|
+
export interface TargetRect {
|
|
3
|
+
/** Distance from the viewport's top edge. */
|
|
4
|
+
top: number;
|
|
5
|
+
/** Distance from the viewport's left edge. */
|
|
6
|
+
left: number;
|
|
7
|
+
/** Width of the rectangle. */
|
|
8
|
+
width: number;
|
|
9
|
+
/** Height of the rectangle. */
|
|
10
|
+
height: number;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=target-rect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target-rect.d.ts","sourceRoot":"","sources":["../../src/models/target-rect.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,WAAW,UAAU;IACzB,6CAA6C;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-onboarding-tour",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"description": "Onboarding hints over any page, shown as hint cards one after another next to the elements they explain",
|
|
4
|
+
"version": "1.3.4",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./index.js",
|
|
8
|
+
"module": "./index.js",
|
|
9
|
+
"types": "./index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
"./package.json": "./package.json",
|
|
12
|
+
"./styles.css": "./index.css",
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./index.d.ts",
|
|
15
|
+
"import": "./index.js",
|
|
16
|
+
"default": "./index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@floating-ui/react": "^0.27.19",
|
|
21
|
+
"@tabler/icons-react": "^3.50.0"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@epam/ai-dial-chat-shared": "1.3.4",
|
|
25
|
+
"@epam/ai-dial-ui-kit": "^0.16.0",
|
|
26
|
+
"react": "^19.2.8"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+https://github.com/epam/ai-dial-chat.git",
|
|
31
|
+
"directory": "libs/onboarding-tour"
|
|
32
|
+
}
|
|
33
|
+
}
|
package/test-setup.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../src/test-setup.ts"],"names":[],"mappings":"AAEA,cAAM,kBAAkB;IACtB,OAAO;IACP,SAAS;IACT,UAAU;CACX"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Why a tour ended, as reported to `OnboardingTourProps.onFinish`. */
|
|
2
|
+
export declare enum OnboardingTourEndReason {
|
|
3
|
+
/** The user pressed Done on the last step, or no remaining step had a target. */
|
|
4
|
+
Done = "done",
|
|
5
|
+
/** The user pressed Skip tour or the close button, or pressed Escape. */
|
|
6
|
+
Dismissed = "dismissed"
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=onboarding-tour-end-reason.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboarding-tour-end-reason.d.ts","sourceRoot":"","sources":["../../src/types/onboarding-tour-end-reason.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,oBAAY,uBAAuB;IACjC,iFAAiF;IACjF,IAAI,SAAS;IACb,yEAAyE;IACzE,SAAS,cAAc;CACxB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { OnboardingCardColors } from '../models/onboarding-tour';
|
|
2
|
+
/** Returns the CSS custom properties `HintCard` reads, keyed by name, for `buildCssVars`. */
|
|
3
|
+
export declare const cardColorVars: (colors: OnboardingCardColors | undefined) => Record<string, string | undefined>;
|
|
4
|
+
//# sourceMappingURL=card-colors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-colors.d.ts","sourceRoot":"","sources":["../../src/utils/card-colors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,6FAA6F;AAC7F,eAAO,MAAM,aAAa,GACxB,QAAQ,oBAAoB,GAAG,SAAS,KACvC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAKlC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Middleware } from '@floating-ui/react';
|
|
2
|
+
/** Name under which `targetRect` stores the target's rectangle in `middlewareData`. */
|
|
3
|
+
export declare const TARGET_RECT_MIDDLEWARE = "targetRect";
|
|
4
|
+
/** Returns a middleware that exposes the reference element's viewport rectangle as `middlewareData.targetRect`. */
|
|
5
|
+
export declare const targetRect: () => Middleware;
|
|
6
|
+
/** Name under which `occlusion` stores whether the target is covered in `middlewareData`. */
|
|
7
|
+
export declare const OCCLUSION_MIDDLEWARE = "occlusion";
|
|
8
|
+
/** Returns a middleware that reports, as `middlewareData.occlusion.isCovered`, whether another element (a drawer, a dialog) sits over the centre of the reference element. */
|
|
9
|
+
export declare const occlusion: () => Middleware;
|
|
10
|
+
/** Returns the middleware that keeps a hint card next to its target, `extraGap` px further out for an arrow: below, else above, else beside it, inside the viewport. */
|
|
11
|
+
export declare const hintCardMiddleware: (extraGap?: number) => Middleware[];
|
|
12
|
+
//# sourceMappingURL=floating.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floating.d.ts","sourceRoot":"","sources":["../../src/utils/floating.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAQ1E,uFAAuF;AACvF,eAAO,MAAM,sBAAsB,eAAe,CAAC;AAEnD,mHAAmH;AACnH,eAAO,MAAM,UAAU,QAAO,UAU5B,CAAC;AAEH,6FAA6F;AAC7F,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAEhD,8KAA8K;AAC9K,eAAO,MAAM,SAAS,QAAO,UAmB3B,CAAC;AAEH,wKAAwK;AACxK,eAAO,MAAM,kBAAkB,GAAI,iBAAY,KAAG,UAAU,EAQ3D,CAAC"}
|
package/utils/focus.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus.d.ts","sourceRoot":"","sources":["../../src/utils/focus.ts"],"names":[],"mappings":"AAYA,iHAAiH;AACjH,eAAO,MAAM,iBAAiB,GAAI,SAAS,OAAO,GAAG,IAAI,KAAG,OAY3D,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Returns a `border-radius` value for an outline drawn `padding` px outside `element` that follows the element's own corners, never below `SPOTLIGHT_MIN_RADIUS`. */
|
|
2
|
+
export declare const spotlightRadius: (element: HTMLElement, padding: number) => string;
|
|
3
|
+
//# sourceMappingURL=spotlight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spotlight.d.ts","sourceRoot":"","sources":["../../src/utils/spotlight.ts"],"names":[],"mappings":"AAsBA,sKAAsK;AACtK,eAAO,MAAM,eAAe,GAC1B,SAAS,WAAW,EACpB,SAAS,MAAM,KACd,MAKF,CAAC"}
|
package/README.md
DELETED