@flamingo-stack/openframe-frontend-core 0.0.454 → 0.0.455
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-AJAF456I.js → chunk-2KUIA2AR.js} +3 -3
- package/dist/{chunk-55ISAJFV.js → chunk-5YPKZM6Y.js} +6 -6
- package/dist/{chunk-72VDY6MM.cjs → chunk-62AXZKYN.cjs} +539 -674
- package/dist/chunk-62AXZKYN.cjs.map +1 -0
- package/dist/{chunk-TMST2WFZ.js → chunk-6W4ZEVIC.js} +3 -3
- package/dist/{chunk-MLFFBQ5B.js → chunk-BD3JBEUC.js} +65 -135
- package/dist/chunk-BD3JBEUC.js.map +1 -0
- package/dist/{chunk-ACUD4XVZ.cjs → chunk-BE77G7GW.cjs} +40 -40
- package/dist/{chunk-ACUD4XVZ.cjs.map → chunk-BE77G7GW.cjs.map} +1 -1
- package/dist/{chunk-OZZ4VQ52.cjs → chunk-D5PBUVGB.cjs} +5 -5
- package/dist/{chunk-OZZ4VQ52.cjs.map → chunk-D5PBUVGB.cjs.map} +1 -1
- package/dist/{chunk-UGFB5EAW.js → chunk-DGPKGESY.js} +4 -4
- package/dist/{chunk-OGKDOG5D.js → chunk-EGTGRG7N.js} +2 -2
- package/dist/{chunk-XH33VG5A.cjs → chunk-FCVF4YAB.cjs} +40 -40
- package/dist/{chunk-XH33VG5A.cjs.map → chunk-FCVF4YAB.cjs.map} +1 -1
- package/dist/{chunk-WLUIXASU.cjs → chunk-GNYV6HYO.cjs} +15 -15
- package/dist/{chunk-WLUIXASU.cjs.map → chunk-GNYV6HYO.cjs.map} +1 -1
- package/dist/{chunk-PB24PKG2.cjs → chunk-IDCPYG7N.cjs} +29 -29
- package/dist/{chunk-PB24PKG2.cjs.map → chunk-IDCPYG7N.cjs.map} +1 -1
- package/dist/{chunk-YED55PQY.js → chunk-JUUPMMKI.js} +3 -3
- package/dist/{chunk-QF3NQW7C.cjs → chunk-KTGGM5WA.cjs} +2 -72
- package/dist/chunk-KTGGM5WA.cjs.map +1 -0
- package/dist/{chunk-GOWE4WSU.js → chunk-LB3OZE4B.js} +6 -6
- package/dist/{chunk-IM5A5F2E.cjs → chunk-M5RT26WQ.cjs} +73 -73
- package/dist/{chunk-IM5A5F2E.cjs.map → chunk-M5RT26WQ.cjs.map} +1 -1
- package/dist/{chunk-UOTHXOCS.js → chunk-N4CHA7T7.js} +5416 -5551
- package/dist/chunk-N4CHA7T7.js.map +1 -0
- package/dist/{chunk-44AD5D3C.cjs → chunk-NNDNJCJ3.cjs} +18 -18
- package/dist/{chunk-44AD5D3C.cjs.map → chunk-NNDNJCJ3.cjs.map} +1 -1
- package/dist/{chunk-PT233TJV.js → chunk-QSIZW6EX.js} +2 -2
- package/dist/{chunk-UPRY4I63.cjs → chunk-RT7DIGTN.cjs} +3 -3
- package/dist/{chunk-UPRY4I63.cjs.map → chunk-RT7DIGTN.cjs.map} +1 -1
- package/dist/{chunk-N2UFIQAD.cjs → chunk-RZL7I6YN.cjs} +7 -7
- package/dist/{chunk-N2UFIQAD.cjs.map → chunk-RZL7I6YN.cjs.map} +1 -1
- package/dist/{chunk-5HQV2F5K.cjs → chunk-UJZ6O2ON.cjs} +32 -32
- package/dist/{chunk-5HQV2F5K.cjs.map → chunk-UJZ6O2ON.cjs.map} +1 -1
- package/dist/{chunk-JUNKHNWE.js → chunk-VNE5R4LQ.js} +5 -5
- package/dist/{chunk-EQWE64RJ.js → chunk-X62ICFPJ.js} +2 -2
- package/dist/{chunk-YJ7SPS7I.js → chunk-XAQLBUCP.js} +2 -2
- package/dist/{chunk-NUT3HRKS.cjs → chunk-XT6S6DYS.cjs} +12 -12
- package/dist/{chunk-NUT3HRKS.cjs.map → chunk-XT6S6DYS.cjs.map} +1 -1
- package/dist/{chunk-YAZIVPUF.cjs → chunk-YSKSBLCG.cjs} +73 -73
- package/dist/{chunk-YAZIVPUF.cjs.map → chunk-YSKSBLCG.cjs.map} +1 -1
- package/dist/{chunk-MX2ITMKK.js → chunk-YXCYQKAX.js} +5 -5
- package/dist/components/case-studies/index.cjs +9 -9
- package/dist/components/case-studies/index.js +3 -3
- package/dist/components/chat/chat-message-list.d.ts.map +1 -1
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/guide-welcome.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +3 -9
- package/dist/components/chat/index.cjs.map +1 -1
- package/dist/components/chat/index.d.ts +0 -2
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +2 -8
- package/dist/components/chat/mingo-welcome.d.ts.map +1 -1
- package/dist/components/chat/quick-action-chip.d.ts +48 -0
- package/dist/components/chat/quick-action-chip.d.ts.map +1 -1
- package/dist/components/chat/quick-action-marquee.d.ts.map +1 -1
- package/dist/components/chat/quick-action-wall.d.ts +1 -2
- package/dist/components/chat/quick-action-wall.d.ts.map +1 -1
- package/dist/components/chat/types/component.types.d.ts +0 -12
- package/dist/components/chat/types/component.types.d.ts.map +1 -1
- package/dist/components/contact/index.cjs +4 -4
- package/dist/components/contact/index.js +3 -3
- package/dist/components/docs/index.cjs +6 -6
- package/dist/components/docs/index.js +5 -5
- package/dist/components/embeds/index.cjs +4 -4
- package/dist/components/embeds/index.js +3 -3
- package/dist/components/faq/index.cjs +5 -5
- package/dist/components/faq/index.js +4 -4
- package/dist/components/features/index.cjs +3 -3
- package/dist/components/features/index.js +2 -2
- package/dist/components/help-center-pages/index.cjs +22 -22
- package/dist/components/help-center-pages/index.js +13 -13
- package/dist/components/index.cjs +135 -141
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +11 -17
- package/dist/components/index.js.map +1 -1
- package/dist/components/navigation/index.cjs +3 -3
- package/dist/components/navigation/index.js +2 -2
- package/dist/components/onboarding-guides/index.cjs +7 -7
- package/dist/components/onboarding-guides/index.js +6 -6
- package/dist/components/related-content/index.cjs +5 -5
- package/dist/components/related-content/index.js +4 -4
- package/dist/components/tickets/index.cjs +6 -6
- package/dist/components/tickets/index.js +5 -5
- package/dist/components/ui/index.cjs +3 -9
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.js +2 -8
- package/dist/hooks/index.cjs +2 -4
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -3
- package/dist/index.cjs +3 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -10
- package/package.json +1 -1
- package/src/components/chat/approval-request-message.tsx +1 -1
- package/src/components/chat/chat-context-picker.tsx +1 -1
- package/src/components/chat/chat-input.tsx +1 -1
- package/src/components/chat/chat-message-list.tsx +5 -1
- package/src/components/chat/chat-message-skeleton.tsx +1 -1
- package/src/components/chat/chat-sidebar-skeleton.tsx +1 -1
- package/src/components/chat/chat-sidebar.tsx +2 -2
- package/src/components/chat/chat-ticket-list.tsx +1 -1
- package/src/components/chat/context-items-list.tsx +1 -1
- package/src/components/chat/embeddable-chat.tsx +15 -3
- package/src/components/chat/guide-welcome.tsx +23 -14
- package/src/components/chat/index.ts +0 -2
- package/src/components/chat/mingo-chat-history.tsx +1 -1
- package/src/components/chat/mingo-welcome.tsx +41 -27
- package/src/components/chat/quick-action-chip.tsx +77 -0
- package/src/components/chat/quick-action-marquee.tsx +1 -2
- package/src/components/chat/quick-action-wall.tsx +6 -4
- package/src/components/chat/slash-command-suggestions.tsx +1 -1
- package/src/components/chat/tool-call-blocks.tsx +1 -1
- package/src/components/chat/types/component.types.ts +0 -15
- package/src/hooks/.index.md +0 -1
- package/src/hooks/index.ts +0 -1
- package/src/stories/ChatContainer.stories.tsx +15 -12
- package/src/stories/QuickActionWall.stories.tsx +1 -2
- package/dist/chunk-72VDY6MM.cjs.map +0 -1
- package/dist/chunk-MLFFBQ5B.js.map +0 -1
- package/dist/chunk-QF3NQW7C.cjs.map +0 -1
- package/dist/chunk-UOTHXOCS.js.map +0 -1
- package/dist/components/chat/chat-quick-action-row.d.ts +0 -84
- package/dist/components/chat/chat-quick-action-row.d.ts.map +0 -1
- package/dist/components/chat/chat-quick-action.d.ts +0 -11
- package/dist/components/chat/chat-quick-action.d.ts.map +0 -1
- package/dist/hooks/use-quick-action-hint.d.ts +0 -25
- package/dist/hooks/use-quick-action-hint.d.ts.map +0 -1
- package/src/components/chat/.chat-quick-action.md +0 -46
- package/src/components/chat/chat-quick-action-row.tsx +0 -282
- package/src/components/chat/chat-quick-action.tsx +0 -59
- package/src/hooks/.use-quick-action-hint.md +0 -43
- package/src/hooks/use-quick-action-hint.ts +0 -126
- /package/dist/{chunk-AJAF456I.js.map → chunk-2KUIA2AR.js.map} +0 -0
- /package/dist/{chunk-55ISAJFV.js.map → chunk-5YPKZM6Y.js.map} +0 -0
- /package/dist/{chunk-TMST2WFZ.js.map → chunk-6W4ZEVIC.js.map} +0 -0
- /package/dist/{chunk-UGFB5EAW.js.map → chunk-DGPKGESY.js.map} +0 -0
- /package/dist/{chunk-OGKDOG5D.js.map → chunk-EGTGRG7N.js.map} +0 -0
- /package/dist/{chunk-YED55PQY.js.map → chunk-JUUPMMKI.js.map} +0 -0
- /package/dist/{chunk-GOWE4WSU.js.map → chunk-LB3OZE4B.js.map} +0 -0
- /package/dist/{chunk-PT233TJV.js.map → chunk-QSIZW6EX.js.map} +0 -0
- /package/dist/{chunk-JUNKHNWE.js.map → chunk-VNE5R4LQ.js.map} +0 -0
- /package/dist/{chunk-EQWE64RJ.js.map → chunk-X62ICFPJ.js.map} +0 -0
- /package/dist/{chunk-YJ7SPS7I.js.map → chunk-XAQLBUCP.js.map} +0 -0
- /package/dist/{chunk-MX2ITMKK.js.map → chunk-YXCYQKAX.js.map} +0 -0
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { type QuickActionChipLozenge, type QuickActionIconSpec, type QuickActionAccent, type QuickActionThemeSpec } from './quick-action-chip';
|
|
3
|
-
/** A single collapsible quick-action chip. */
|
|
4
|
-
export interface QuickActionChip {
|
|
5
|
-
/** Stable React key + menu-item id. */
|
|
6
|
-
id: string;
|
|
7
|
-
label: string;
|
|
8
|
-
/** Pre-rendered node OR a declarative {@link QuickActionIconSpec} (resolved
|
|
9
|
-
* via the unified `<EntityIcon>` path). */
|
|
10
|
-
icon?: React.ReactNode | QuickActionIconSpec;
|
|
11
|
-
/** Caller-supplied {@link QuickActionThemeSpec} (accent + optional
|
|
12
|
-
* lozenge) — per-chip so mixed walls (interleaved IT/SEC streams) work.
|
|
13
|
-
* The lib ships no theme registry; consumers define their own specs. */
|
|
14
|
-
theme?: QuickActionThemeSpec;
|
|
15
|
-
/** Classification affix at the label's leading edge; `true` = the theme's. */
|
|
16
|
-
lozenge?: QuickActionChipLozenge | boolean;
|
|
17
|
-
/** `'primary'` = accent (yellow) chip, `'outline'` = bordered chip (default). */
|
|
18
|
-
variant?: 'primary' | 'outline';
|
|
19
|
-
/** Active single-select state — renders the accented `selected` skin
|
|
20
|
-
* (overrides `variant`). */
|
|
21
|
-
selected?: boolean;
|
|
22
|
-
/** Accent for the `selected` skin (`'cyan'` = cyan twin, else pink). */
|
|
23
|
-
selectedAccent?: QuickActionAccent;
|
|
24
|
-
onSelect?: () => void;
|
|
25
|
-
/** Pointer/keyboard focus enters the chip — e.g. preview the full prompt in
|
|
26
|
-
* the composer. */
|
|
27
|
-
onHoverStart?: () => void;
|
|
28
|
-
/** Pointer/keyboard focus leaves the chip — e.g. restore the composer. */
|
|
29
|
-
onHoverEnd?: () => void;
|
|
30
|
-
}
|
|
31
|
-
export interface ChatQuickActionRowProps {
|
|
32
|
-
/** Always-visible leading chip(s) (e.g. Mingo's "Start Guide Chat"). Never
|
|
33
|
-
* collapses into the overflow menu — rendered before the measured zone. */
|
|
34
|
-
leading?: React.ReactNode;
|
|
35
|
-
/** Collapsible chips — as many as fit on one line render inline; the rest
|
|
36
|
-
* collapse under a trailing "⋯" overflow menu (small icon button). */
|
|
37
|
-
chips: ReadonlyArray<QuickActionChip>;
|
|
38
|
-
/** Render ALL chips in a wrapping multi-line row instead of the single-line +
|
|
39
|
-
* "⋯" overflow collapse. Every chip stays directly visible (and hoverable),
|
|
40
|
-
* for roomy contexts (e.g. the Guide empty state) where overflow-hiding chips
|
|
41
|
-
* would defeat per-chip hover/preview. */
|
|
42
|
-
wrap?: boolean;
|
|
43
|
-
/** Render `skeletonCount` loading chips (the real {@link QuickActionChipSkeleton},
|
|
44
|
-
* so geometry is 1:1 with the loaded chips) instead of `chips`. Wrap-aware. */
|
|
45
|
-
loading?: boolean;
|
|
46
|
-
/** How many skeleton chips to draw when `loading`. Default 8. */
|
|
47
|
-
skeletonCount?: number;
|
|
48
|
-
className?: string;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* THE {@link QuickActionChip}-data → {@link QuickActionChipButton} mapper —
|
|
52
|
-
* one prop-plumbing spelling shared by the chat rows, `QuickActionWall`, and
|
|
53
|
-
* `QuickActionMarquee` (adding a chip field means editing exactly here).
|
|
54
|
-
* `defaultTheme`/`defaultLozenge` fill gaps for wall-level theming;
|
|
55
|
-
* `interactive={false}` renders the decorative Tag form (loop-clone copies).
|
|
56
|
-
*/
|
|
57
|
-
export declare function QuickActionChipFromData({ chip, defaultTheme, defaultLozenge, interactive, className, }: {
|
|
58
|
-
chip: QuickActionChip;
|
|
59
|
-
defaultTheme?: QuickActionThemeSpec;
|
|
60
|
-
defaultLozenge?: boolean;
|
|
61
|
-
interactive?: boolean;
|
|
62
|
-
className?: string;
|
|
63
|
-
}): React.JSX.Element;
|
|
64
|
-
/**
|
|
65
|
-
* A single-line quick-action chip row that collapses overflow into a "⋯" menu.
|
|
66
|
-
*
|
|
67
|
-
* Same dynamic, width-measured overflow used by the multi-select Autocomplete
|
|
68
|
-
* (`useAutoLimitTags`): off-screen copies of every chip are measured, as many
|
|
69
|
-
* as fit render inline, and the remainder move into an `ActionsMenuDropdown`
|
|
70
|
-
* behind a small "⋯" icon button. An optional `leading` slot stays pinned and
|
|
71
|
-
* never collapses, so the row's primary action is always reachable.
|
|
72
|
-
*/
|
|
73
|
-
export declare function ChatQuickActionRow({ leading, chips, wrap, loading, skeletonCount, className, }: ChatQuickActionRowProps): React.JSX.Element | null;
|
|
74
|
-
export interface ChatQuickActionRowSkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
75
|
-
/** Number of placeholder chips to render. Defaults to 3. */
|
|
76
|
-
count?: number;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Loading placeholder for {@link ChatQuickActionRow}. Each chip mirrors a
|
|
80
|
-
* `ChipButton`'s `Tag` footprint (`h-8 rounded-md`) so the row keeps its height
|
|
81
|
-
* and shape while the real quick actions load.
|
|
82
|
-
*/
|
|
83
|
-
export declare function ChatQuickActionRowSkeleton({ className, count, ...props }: ChatQuickActionRowSkeletonProps): React.JSX.Element;
|
|
84
|
-
//# sourceMappingURL=chat-quick-action-row.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chat-quick-action-row.d.ts","sourceRoot":"","sources":["../../../src/components/chat/chat-quick-action-row.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,OAAO,EAIL,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAA;AAM5B,8CAA8C;AAC9C,MAAM,WAAW,eAAe;IAC9B,uCAAuC;IACvC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb;gDAC4C;IAC5C,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,mBAAmB,CAAA;IAC5C;;6EAEyE;IACzE,KAAK,CAAC,EAAE,oBAAoB,CAAA;IAC5B,8EAA8E;IAC9E,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAA;IAC1C,iFAAiF;IACjF,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAC/B;iCAC6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,wEAAwE;IACxE,cAAc,CAAC,EAAE,iBAAiB,CAAA;IAClC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB;wBACoB;IACpB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IACzB,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;CACxB;AAED,MAAM,WAAW,uBAAuB;IACtC;gFAC4E;IAC5E,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB;2EACuE;IACvE,KAAK,EAAE,aAAa,CAAC,eAAe,CAAC,CAAA;IACrC;;;+CAG2C;IAC3C,IAAI,CAAC,EAAE,OAAO,CAAA;IACd;oFACgF;IAChF,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,iEAAiE;IACjE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAUD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,YAAY,EACZ,cAAc,EACd,WAAkB,EAClB,SAAS,GACV,EAAE;IACD,IAAI,EAAE,eAAe,CAAA;IACrB,YAAY,CAAC,EAAE,oBAAoB,CAAA;IACnC,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,qBAiBA;AAYD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,KAAK,EACL,IAAY,EACZ,OAAe,EACf,aAAiB,EACjB,SAAS,GACV,EAAE,uBAAuB,4BAyGzB;AAMD,MAAM,WAAW,+BAAgC,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC3F,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAMD;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,EAAE,SAAS,EAAE,KAAS,EAAE,GAAG,KAAK,EAAE,EAAE,+BAA+B,qBAY7G"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { ChatQuickActionProps } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated Use `QuickActionChipButton` (./quick-action-chip) — the unified
|
|
5
|
-
* quick-action chip used by every chat empty state, marquee, and table
|
|
6
|
-
* surface. This full-width list-row variant remains only for the hub's
|
|
7
|
-
* `hero-chat-demo.tsx`; migrate that consumer, then delete this file.
|
|
8
|
-
*/
|
|
9
|
-
declare const ChatQuickAction: React.ForwardRefExoticComponent<ChatQuickActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
10
|
-
export { ChatQuickAction };
|
|
11
|
-
//# sourceMappingURL=chat-quick-action.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chat-quick-action.d.ts","sourceRoot":"","sources":["../../../src/components/chat/chat-quick-action.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAEnD;;;;;GAKG;AACH,QAAA,MAAM,eAAe,gGAwCpB,CAAA;AAID,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
interface UseQuickActionHintOptions {
|
|
2
|
-
/** Number of quick actions to cycle through */
|
|
3
|
-
actionCount: number;
|
|
4
|
-
/** Duration each action is highlighted in milliseconds */
|
|
5
|
-
cycleDuration?: number;
|
|
6
|
-
/** Whether the hint should be enabled */
|
|
7
|
-
enabled?: boolean;
|
|
8
|
-
}
|
|
9
|
-
interface UseQuickActionHintReturn {
|
|
10
|
-
/** The index of the currently active hint (-1 if none) */
|
|
11
|
-
activeHintIndex: number;
|
|
12
|
-
/** Manually stop the hint animation */
|
|
13
|
-
stopHint: () => void;
|
|
14
|
-
/** Reference to attach to the container element (not used in simplified version) */
|
|
15
|
-
containerRef: React.RefObject<HTMLDivElement | null>;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* SIMPLIFIED hook for managing quick action hint animations
|
|
19
|
-
*
|
|
20
|
-
* Cycles infinitely through quick actions until user interacts.
|
|
21
|
-
* Simple mount-based trigger - no complex visibility detection.
|
|
22
|
-
*/
|
|
23
|
-
export declare function useQuickActionHint({ actionCount, cycleDuration, enabled }: UseQuickActionHintOptions): UseQuickActionHintReturn;
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=use-quick-action-hint.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-quick-action-hint.d.ts","sourceRoot":"","sources":["../../src/hooks/use-quick-action-hint.ts"],"names":[],"mappings":"AAIA,UAAU,yBAAyB;IACjC,+CAA+C;IAC/C,WAAW,EAAE,MAAM,CAAA;IACnB,0DAA0D;IAC1D,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,yCAAyC;IACzC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,UAAU,wBAAwB;IAChC,0DAA0D;IAC1D,eAAe,EAAE,MAAM,CAAA;IACvB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,oFAAoF;IACpF,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;CACrD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,WAAW,EACX,aAAoB,EACpB,OAAc,EACf,EAAE,yBAAyB,GAAG,wBAAwB,CA6FtD"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<!-- source-hash: 7729b24e719a68b72507fe0a745d5b9f -->
|
|
2
|
-
A clickable action button component designed for chat interfaces, featuring hover effects, hint animations, and accessibility support with proper focus management.
|
|
3
|
-
|
|
4
|
-
## Key Components
|
|
5
|
-
|
|
6
|
-
- **ChatQuickAction** - Main React component exported as a forward ref with customizable styling and behavior
|
|
7
|
-
- **handleClick** - Callback handler that manages hint interactions, action execution, and click events in sequence
|
|
8
|
-
- **Styling System** - Uses `cn` utility for conditional classes with ODS (OpenFrame Design System) tokens
|
|
9
|
-
- **Props Interface** - Accepts `text`, `onAction`, `onHintInteraction`, `isHintActive`, and standard button props
|
|
10
|
-
|
|
11
|
-
## Usage Example
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
import { ChatQuickAction } from './chat-quick-action'
|
|
15
|
-
|
|
16
|
-
function ChatInterface() {
|
|
17
|
-
const [showHint, setShowHint] = useState(true)
|
|
18
|
-
|
|
19
|
-
const handleQuickAction = (actionText: string) => {
|
|
20
|
-
console.log('Quick action triggered:', actionText)
|
|
21
|
-
// Process the quick action
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const stopHint = () => {
|
|
25
|
-
setShowHint(false)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<div className="space-y-2">
|
|
30
|
-
<ChatQuickAction
|
|
31
|
-
text="How do I reset my password?"
|
|
32
|
-
onAction={handleQuickAction}
|
|
33
|
-
isHintActive={showHint}
|
|
34
|
-
onHintInteraction={stopHint}
|
|
35
|
-
/>
|
|
36
|
-
<ChatQuickAction
|
|
37
|
-
text="Show me the dashboard"
|
|
38
|
-
onAction={handleQuickAction}
|
|
39
|
-
disabled={false}
|
|
40
|
-
/>
|
|
41
|
-
</div>
|
|
42
|
-
)
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
The component provides visual feedback through hover states, active animations, and a pulsing hint animation when `isHintActive` is true. It integrates seamlessly with chat UIs by triggering actions when clicked and managing hint visibility states.
|
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import * as React from 'react'
|
|
4
|
-
import { cn } from '../../utils/cn'
|
|
5
|
-
import { Tag } from '../ui/tag'
|
|
6
|
-
import { Skeleton } from '../ui/skeleton'
|
|
7
|
-
import { ActionsMenuDropdown } from '../ui/actions-menu'
|
|
8
|
-
import { Ellipsis01Icon } from '../icons-v2-generated'
|
|
9
|
-
import { useAutoLimitTags } from '../../hooks/ui/use-auto-limit-tags'
|
|
10
|
-
import {
|
|
11
|
-
QuickActionChipButton,
|
|
12
|
-
QuickActionChipSkeleton,
|
|
13
|
-
renderQuickActionIcon,
|
|
14
|
-
type QuickActionChipLozenge,
|
|
15
|
-
type QuickActionIconSpec,
|
|
16
|
-
type QuickActionAccent,
|
|
17
|
-
type QuickActionThemeSpec,
|
|
18
|
-
} from './quick-action-chip'
|
|
19
|
-
|
|
20
|
-
// =============================================================================
|
|
21
|
-
// Types
|
|
22
|
-
// =============================================================================
|
|
23
|
-
|
|
24
|
-
/** A single collapsible quick-action chip. */
|
|
25
|
-
export interface QuickActionChip {
|
|
26
|
-
/** Stable React key + menu-item id. */
|
|
27
|
-
id: string
|
|
28
|
-
label: string
|
|
29
|
-
/** Pre-rendered node OR a declarative {@link QuickActionIconSpec} (resolved
|
|
30
|
-
* via the unified `<EntityIcon>` path). */
|
|
31
|
-
icon?: React.ReactNode | QuickActionIconSpec
|
|
32
|
-
/** Caller-supplied {@link QuickActionThemeSpec} (accent + optional
|
|
33
|
-
* lozenge) — per-chip so mixed walls (interleaved IT/SEC streams) work.
|
|
34
|
-
* The lib ships no theme registry; consumers define their own specs. */
|
|
35
|
-
theme?: QuickActionThemeSpec
|
|
36
|
-
/** Classification affix at the label's leading edge; `true` = the theme's. */
|
|
37
|
-
lozenge?: QuickActionChipLozenge | boolean
|
|
38
|
-
/** `'primary'` = accent (yellow) chip, `'outline'` = bordered chip (default). */
|
|
39
|
-
variant?: 'primary' | 'outline'
|
|
40
|
-
/** Active single-select state — renders the accented `selected` skin
|
|
41
|
-
* (overrides `variant`). */
|
|
42
|
-
selected?: boolean
|
|
43
|
-
/** Accent for the `selected` skin (`'cyan'` = cyan twin, else pink). */
|
|
44
|
-
selectedAccent?: QuickActionAccent
|
|
45
|
-
onSelect?: () => void
|
|
46
|
-
/** Pointer/keyboard focus enters the chip — e.g. preview the full prompt in
|
|
47
|
-
* the composer. */
|
|
48
|
-
onHoverStart?: () => void
|
|
49
|
-
/** Pointer/keyboard focus leaves the chip — e.g. restore the composer. */
|
|
50
|
-
onHoverEnd?: () => void
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface ChatQuickActionRowProps {
|
|
54
|
-
/** Always-visible leading chip(s) (e.g. Mingo's "Start Guide Chat"). Never
|
|
55
|
-
* collapses into the overflow menu — rendered before the measured zone. */
|
|
56
|
-
leading?: React.ReactNode
|
|
57
|
-
/** Collapsible chips — as many as fit on one line render inline; the rest
|
|
58
|
-
* collapse under a trailing "⋯" overflow menu (small icon button). */
|
|
59
|
-
chips: ReadonlyArray<QuickActionChip>
|
|
60
|
-
/** Render ALL chips in a wrapping multi-line row instead of the single-line +
|
|
61
|
-
* "⋯" overflow collapse. Every chip stays directly visible (and hoverable),
|
|
62
|
-
* for roomy contexts (e.g. the Guide empty state) where overflow-hiding chips
|
|
63
|
-
* would defeat per-chip hover/preview. */
|
|
64
|
-
wrap?: boolean
|
|
65
|
-
/** Render `skeletonCount` loading chips (the real {@link QuickActionChipSkeleton},
|
|
66
|
-
* so geometry is 1:1 with the loaded chips) instead of `chips`. Wrap-aware. */
|
|
67
|
-
loading?: boolean
|
|
68
|
-
/** How many skeleton chips to draw when `loading`. Default 8. */
|
|
69
|
-
skeletonCount?: number
|
|
70
|
-
className?: string
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Deterministic label widths (in `ch`) so a loading wall reads like a populated
|
|
74
|
-
// one — a varied spread, not a uniform block.
|
|
75
|
-
const SKELETON_LABEL_CHS = [16, 9, 13, 7, 18, 8, 20, 11, 15, 10, 19, 12, 17, 8, 21, 14]
|
|
76
|
-
|
|
77
|
-
// =============================================================================
|
|
78
|
-
// Chip button
|
|
79
|
-
// =============================================================================
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* THE {@link QuickActionChip}-data → {@link QuickActionChipButton} mapper —
|
|
83
|
-
* one prop-plumbing spelling shared by the chat rows, `QuickActionWall`, and
|
|
84
|
-
* `QuickActionMarquee` (adding a chip field means editing exactly here).
|
|
85
|
-
* `defaultTheme`/`defaultLozenge` fill gaps for wall-level theming;
|
|
86
|
-
* `interactive={false}` renders the decorative Tag form (loop-clone copies).
|
|
87
|
-
*/
|
|
88
|
-
export function QuickActionChipFromData({
|
|
89
|
-
chip,
|
|
90
|
-
defaultTheme,
|
|
91
|
-
defaultLozenge,
|
|
92
|
-
interactive = true,
|
|
93
|
-
className,
|
|
94
|
-
}: {
|
|
95
|
-
chip: QuickActionChip
|
|
96
|
-
defaultTheme?: QuickActionThemeSpec
|
|
97
|
-
defaultLozenge?: boolean
|
|
98
|
-
interactive?: boolean
|
|
99
|
-
className?: string
|
|
100
|
-
}) {
|
|
101
|
-
return (
|
|
102
|
-
<QuickActionChipButton
|
|
103
|
-
label={chip.label}
|
|
104
|
-
icon={chip.icon}
|
|
105
|
-
theme={chip.theme ?? defaultTheme}
|
|
106
|
-
lozenge={chip.lozenge ?? (defaultLozenge || undefined)}
|
|
107
|
-
variant={chip.variant ?? 'outline'}
|
|
108
|
-
selected={chip.selected}
|
|
109
|
-
selectedAccent={chip.selectedAccent}
|
|
110
|
-
onSelect={chip.onSelect}
|
|
111
|
-
onHoverStart={chip.onHoverStart}
|
|
112
|
-
onHoverEnd={chip.onHoverEnd}
|
|
113
|
-
interactive={interactive}
|
|
114
|
-
className={className}
|
|
115
|
-
/>
|
|
116
|
-
)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// The chip visual + button wiring lives in the shared `QuickActionChipButton`;
|
|
120
|
-
// the data mapping lives in `QuickActionChipFromData` (one spelling).
|
|
121
|
-
function ChipButton({ chip }: { chip: QuickActionChip }) {
|
|
122
|
-
return <QuickActionChipFromData chip={chip} />
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// =============================================================================
|
|
126
|
-
// Component
|
|
127
|
-
// =============================================================================
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* A single-line quick-action chip row that collapses overflow into a "⋯" menu.
|
|
131
|
-
*
|
|
132
|
-
* Same dynamic, width-measured overflow used by the multi-select Autocomplete
|
|
133
|
-
* (`useAutoLimitTags`): off-screen copies of every chip are measured, as many
|
|
134
|
-
* as fit render inline, and the remainder move into an `ActionsMenuDropdown`
|
|
135
|
-
* behind a small "⋯" icon button. An optional `leading` slot stays pinned and
|
|
136
|
-
* never collapses, so the row's primary action is always reachable.
|
|
137
|
-
*/
|
|
138
|
-
export function ChatQuickActionRow({
|
|
139
|
-
leading,
|
|
140
|
-
chips,
|
|
141
|
-
wrap = false,
|
|
142
|
-
loading = false,
|
|
143
|
-
skeletonCount = 8,
|
|
144
|
-
className,
|
|
145
|
-
}: ChatQuickActionRowProps) {
|
|
146
|
-
const auto = useAutoLimitTags({
|
|
147
|
-
count: chips.length,
|
|
148
|
-
reserveInputWidth: false,
|
|
149
|
-
})
|
|
150
|
-
|
|
151
|
-
const visibleChips = chips.slice(0, auto.visibleCount)
|
|
152
|
-
const hiddenChips = chips.slice(auto.visibleCount)
|
|
153
|
-
|
|
154
|
-
// Loading: draw skeleton chips (real `QuickActionChipSkeleton`, 1:1 geometry)
|
|
155
|
-
// in the same wrap/inline layout — one shared skeleton for every consumer, no
|
|
156
|
-
// hand-rolled bars.
|
|
157
|
-
if (loading) {
|
|
158
|
-
return (
|
|
159
|
-
<div className={cn('flex shrink-0 items-center gap-1', wrap && 'flex-wrap', className)}>
|
|
160
|
-
{Array.from({ length: skeletonCount }, (_, i) => (
|
|
161
|
-
<QuickActionChipSkeleton key={i} labelCh={SKELETON_LABEL_CHS[i % SKELETON_LABEL_CHS.length]} />
|
|
162
|
-
))}
|
|
163
|
-
</div>
|
|
164
|
-
)
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (!leading && chips.length === 0) return null
|
|
168
|
-
|
|
169
|
-
// Wrap mode: no width-measurement / "⋯" overflow — every chip renders inline
|
|
170
|
-
// (reusing the same `ChipButton`, so hover/focus wiring is identical) and the
|
|
171
|
-
// row wraps to as many lines as needed.
|
|
172
|
-
if (wrap) {
|
|
173
|
-
return (
|
|
174
|
-
<div className={cn('flex shrink-0 flex-wrap items-center gap-1', className)}>
|
|
175
|
-
{leading}
|
|
176
|
-
{chips.map((chip) => (
|
|
177
|
-
<ChipButton key={chip.id} chip={chip} />
|
|
178
|
-
))}
|
|
179
|
-
</div>
|
|
180
|
-
)
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return (
|
|
184
|
-
<div
|
|
185
|
-
className={cn('relative flex shrink-0 items-center gap-1', className)}
|
|
186
|
-
>
|
|
187
|
-
{leading}
|
|
188
|
-
|
|
189
|
-
{chips.length > 0 && (
|
|
190
|
-
// Measured zone: `flex-1 min-w-0 overflow-hidden` so it claims the width
|
|
191
|
-
// left by the pinned `leading` slot and clips anything past the fit.
|
|
192
|
-
<div
|
|
193
|
-
ref={auto.middleRef}
|
|
194
|
-
className="flex flex-1 min-w-0 items-center gap-1 overflow-hidden"
|
|
195
|
-
>
|
|
196
|
-
{visibleChips.map((chip) => (
|
|
197
|
-
<ChipButton key={chip.id} chip={chip} />
|
|
198
|
-
))}
|
|
199
|
-
|
|
200
|
-
{hiddenChips.length > 0 && (
|
|
201
|
-
<ActionsMenuDropdown
|
|
202
|
-
triggerAriaLabel="More quick actions"
|
|
203
|
-
// Don't return focus (and its ring) to the "⋯" trigger on close.
|
|
204
|
-
onCloseAutoFocus={(e) => e.preventDefault()}
|
|
205
|
-
groups={[
|
|
206
|
-
{
|
|
207
|
-
items: hiddenChips.map((chip) => ({
|
|
208
|
-
id: chip.id,
|
|
209
|
-
label: chip.label,
|
|
210
|
-
icon: renderQuickActionIcon(chip.icon),
|
|
211
|
-
onClick: chip.onSelect,
|
|
212
|
-
})),
|
|
213
|
-
},
|
|
214
|
-
]}
|
|
215
|
-
customTrigger={
|
|
216
|
-
<button
|
|
217
|
-
ref={auto.badgeRef}
|
|
218
|
-
type="button"
|
|
219
|
-
aria-label="More quick actions"
|
|
220
|
-
className="shrink-0 rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-ods-accent"
|
|
221
|
-
>
|
|
222
|
-
<Tag variant="outline" label={<Ellipsis01Icon size={16} />} />
|
|
223
|
-
</button>
|
|
224
|
-
}
|
|
225
|
-
/>
|
|
226
|
-
)}
|
|
227
|
-
</div>
|
|
228
|
-
)}
|
|
229
|
-
|
|
230
|
-
{/* Off-screen measurement copies of every chip — the hook reads their
|
|
231
|
-
widths to decide how many fit. Mirror the visible chip markup (same
|
|
232
|
-
variant/icon/label and the same `gap-1`) so the measured widths match
|
|
233
|
-
what actually renders. */}
|
|
234
|
-
<div
|
|
235
|
-
ref={auto.measureRef}
|
|
236
|
-
aria-hidden
|
|
237
|
-
className="pointer-events-none invisible absolute left-0 top-0 -z-10 flex gap-1"
|
|
238
|
-
>
|
|
239
|
-
{chips.map((chip) => (
|
|
240
|
-
<Tag
|
|
241
|
-
key={`measure-${chip.id}`}
|
|
242
|
-
variant={chip.variant ?? 'outline'}
|
|
243
|
-
icon={renderQuickActionIcon(chip.icon)}
|
|
244
|
-
label={chip.label}
|
|
245
|
-
/>
|
|
246
|
-
))}
|
|
247
|
-
</div>
|
|
248
|
-
</div>
|
|
249
|
-
)
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
// =============================================================================
|
|
253
|
-
// Skeleton
|
|
254
|
-
// =============================================================================
|
|
255
|
-
|
|
256
|
-
export interface ChatQuickActionRowSkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
257
|
-
/** Number of placeholder chips to render. Defaults to 3. */
|
|
258
|
-
count?: number
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// Varied widths so the placeholder reads like real, differently-sized chips
|
|
262
|
-
// instead of a row of identical bars.
|
|
263
|
-
const SKELETON_CHIP_WIDTHS = ['w-28', 'w-32', 'w-24', 'w-36', 'w-20']
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Loading placeholder for {@link ChatQuickActionRow}. Each chip mirrors a
|
|
267
|
-
* `ChipButton`'s `Tag` footprint (`h-8 rounded-md`) so the row keeps its height
|
|
268
|
-
* and shape while the real quick actions load.
|
|
269
|
-
*/
|
|
270
|
-
export function ChatQuickActionRowSkeleton({ className, count = 3, ...props }: ChatQuickActionRowSkeletonProps) {
|
|
271
|
-
return (
|
|
272
|
-
<div aria-hidden className={cn('flex shrink-0 items-center gap-1', className)} {...props}>
|
|
273
|
-
{Array.from({ length: count }).map((_, i) => (
|
|
274
|
-
<Skeleton
|
|
275
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
276
|
-
key={i}
|
|
277
|
-
className={cn('h-8 shrink-0 rounded-md', SKELETON_CHIP_WIDTHS[i % SKELETON_CHIP_WIDTHS.length])}
|
|
278
|
-
/>
|
|
279
|
-
))}
|
|
280
|
-
</div>
|
|
281
|
-
)
|
|
282
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import * as React from 'react'
|
|
4
|
-
import { cn } from '../../utils/cn'
|
|
5
|
-
import { ChevronRight } from 'lucide-react'
|
|
6
|
-
import { Button } from '../ui'
|
|
7
|
-
import type { ChatQuickActionProps } from './types'
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated Use `QuickActionChipButton` (./quick-action-chip) — the unified
|
|
11
|
-
* quick-action chip used by every chat empty state, marquee, and table
|
|
12
|
-
* surface. This full-width list-row variant remains only for the hub's
|
|
13
|
-
* `hero-chat-demo.tsx`; migrate that consumer, then delete this file.
|
|
14
|
-
*/
|
|
15
|
-
const ChatQuickAction = React.forwardRef<HTMLButtonElement, ChatQuickActionProps>(
|
|
16
|
-
({ className, text, onAction, onClick, isHintActive, onHintInteraction, disabled = false, ...props }, ref) => {
|
|
17
|
-
const handleClick = React.useCallback((e: React.MouseEvent<HTMLButtonElement>) => {
|
|
18
|
-
// Stop hint only on click, not on hover
|
|
19
|
-
if (onHintInteraction) {
|
|
20
|
-
onHintInteraction()
|
|
21
|
-
}
|
|
22
|
-
if (onAction) {
|
|
23
|
-
onAction(text)
|
|
24
|
-
}
|
|
25
|
-
if (onClick) {
|
|
26
|
-
onClick(e)
|
|
27
|
-
}
|
|
28
|
-
}, [text, onAction, onClick, onHintInteraction])
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<button
|
|
32
|
-
ref={ref}
|
|
33
|
-
type="button"
|
|
34
|
-
onClick={handleClick}
|
|
35
|
-
disabled={disabled}
|
|
36
|
-
className={cn(
|
|
37
|
-
"flex items-center justify-between gap-3 w-full",
|
|
38
|
-
"px-4 py-3 rounded-lg",
|
|
39
|
-
"bg-transparent border border-ods-border",
|
|
40
|
-
"text-left text-ods-text-primary",
|
|
41
|
-
"transition-all duration-150",
|
|
42
|
-
"focus:outline-none focus:ring-2 focus:ring-ods-focus focus:ring-offset-2 focus:ring-offset-ods-bg",
|
|
43
|
-
!disabled && "hover:bg-ods-bg-hover hover:border-ods-border active:bg-ods-bg-active active:scale-[0.98]",
|
|
44
|
-
disabled && "opacity-50 cursor-not-allowed",
|
|
45
|
-
isHintActive && !disabled && "animate-hint-pulse",
|
|
46
|
-
className
|
|
47
|
-
)}
|
|
48
|
-
{...props}
|
|
49
|
-
>
|
|
50
|
-
<span className="text-h6">{text}</span>
|
|
51
|
-
<ChevronRight className="h-4 w-4 text-ods-text-secondary flex-shrink-0" />
|
|
52
|
-
</button>
|
|
53
|
-
)
|
|
54
|
-
}
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
ChatQuickAction.displayName = "ChatQuickAction"
|
|
58
|
-
|
|
59
|
-
export { ChatQuickAction }
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<!-- source-hash: 05abd6830db0cbb28a487aec8259d7d1 -->
|
|
2
|
-
A React hook that manages animated hint cycles for quick action interfaces, highlighting different actions in a random sequence to guide user discovery.
|
|
3
|
-
|
|
4
|
-
## Key Components
|
|
5
|
-
|
|
6
|
-
- **`useQuickActionHint`** - Main hook that cycles through action indices with configurable timing
|
|
7
|
-
- **`UseQuickActionHintOptions`** - Configuration interface for action count, cycle duration, and enabled state
|
|
8
|
-
- **`UseQuickActionHintReturn`** - Return type providing active index, stop function, and container ref
|
|
9
|
-
- **`shuffleIndices`** - Fisher-Yates shuffle algorithm for randomized, non-repeating hint sequences
|
|
10
|
-
- **`advanceHint`** - Core logic that progresses through shuffled action indices
|
|
11
|
-
- **`stopHint`** - Manual control to halt hint animations
|
|
12
|
-
|
|
13
|
-
## Usage Example
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
import { useQuickActionHint } from './use-quick-action-hint'
|
|
17
|
-
|
|
18
|
-
function QuickActionPanel() {
|
|
19
|
-
const { activeHintIndex, stopHint, containerRef } = useQuickActionHint({
|
|
20
|
-
actionCount: 4, // Number of quick actions
|
|
21
|
-
cycleDuration: 3000, // 3 seconds per hint
|
|
22
|
-
enabled: true // Enable hint system
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
const actions = ['Copy', 'Edit', 'Delete', 'Share']
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<div ref={containerRef} onMouseEnter={stopHint}>
|
|
29
|
-
{actions.map((action, index) => (
|
|
30
|
-
<button
|
|
31
|
-
key={action}
|
|
32
|
-
className={activeHintIndex === index ? 'highlighted' : ''}
|
|
33
|
-
onClick={stopHint}
|
|
34
|
-
>
|
|
35
|
-
{action}
|
|
36
|
-
</button>
|
|
37
|
-
))}
|
|
38
|
-
</div>
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
The hook automatically starts on mount, respects reduced motion preferences, and provides infinite cycling until user interaction stops the hints.
|