@openwarelabs/ui 0.13.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +7 -7
  2. package/dist/components/AspectRatio/AspectRatio.d.cts +7 -0
  3. package/dist/components/AspectRatio/AspectRatio.d.ts +7 -0
  4. package/dist/components/AspectRatio/AspectRatio.types.d.cts +7 -0
  5. package/dist/components/AspectRatio/AspectRatio.types.d.ts +7 -0
  6. package/dist/components/Banner/Banner.d.cts +7 -0
  7. package/dist/components/Banner/Banner.d.ts +7 -0
  8. package/dist/components/Banner/Banner.types.d.cts +44 -0
  9. package/dist/components/Banner/Banner.types.d.ts +44 -0
  10. package/dist/components/Carousel/Carousel.d.cts +9 -0
  11. package/dist/components/Carousel/Carousel.d.ts +9 -0
  12. package/dist/components/Carousel/Carousel.types.d.cts +63 -0
  13. package/dist/components/Carousel/Carousel.types.d.ts +63 -0
  14. package/dist/components/ContextMenu/ContextMenu.d.cts +7 -0
  15. package/dist/components/ContextMenu/ContextMenu.d.ts +7 -0
  16. package/dist/components/ContextMenu/ContextMenu.types.d.cts +32 -0
  17. package/dist/components/ContextMenu/ContextMenu.types.d.ts +32 -0
  18. package/dist/components/DescriptionList/DescriptionList.d.cts +9 -0
  19. package/dist/components/DescriptionList/DescriptionList.d.ts +9 -0
  20. package/dist/components/DescriptionList/DescriptionList.types.d.cts +32 -0
  21. package/dist/components/DescriptionList/DescriptionList.types.d.ts +32 -0
  22. package/dist/components/HoverCard/HoverCard.d.cts +8 -0
  23. package/dist/components/HoverCard/HoverCard.d.ts +8 -0
  24. package/dist/components/HoverCard/HoverCard.types.d.cts +28 -0
  25. package/dist/components/HoverCard/HoverCard.types.d.ts +28 -0
  26. package/dist/components/Image/Image.d.cts +7 -0
  27. package/dist/components/Image/Image.d.ts +7 -0
  28. package/dist/components/Image/Image.types.d.cts +28 -0
  29. package/dist/components/Image/Image.types.d.ts +28 -0
  30. package/dist/components/Menu/Menu.context.d.cts +3 -0
  31. package/dist/components/Menu/Menu.context.d.ts +3 -0
  32. package/dist/components/Menu/Menu.d.cts +4 -34
  33. package/dist/components/Menu/Menu.d.ts +4 -34
  34. package/dist/components/Menu/Menu.types.d.cts +39 -0
  35. package/dist/components/Menu/Menu.types.d.ts +39 -0
  36. package/dist/components/PasswordInput/PasswordInput.d.cts +9 -0
  37. package/dist/components/PasswordInput/PasswordInput.d.ts +9 -0
  38. package/dist/components/PasswordInput/PasswordInput.types.d.cts +47 -0
  39. package/dist/components/PasswordInput/PasswordInput.types.d.ts +47 -0
  40. package/dist/components/PasswordInput/passwordStrength.d.cts +9 -0
  41. package/dist/components/PasswordInput/passwordStrength.d.ts +9 -0
  42. package/dist/components/Rating/Rating.d.cts +8 -0
  43. package/dist/components/Rating/Rating.d.ts +8 -0
  44. package/dist/components/Rating/Rating.types.d.cts +59 -0
  45. package/dist/components/Rating/Rating.types.d.ts +59 -0
  46. package/dist/components/Splitter/Splitter.d.cts +14 -0
  47. package/dist/components/Splitter/Splitter.d.ts +14 -0
  48. package/dist/components/Splitter/Splitter.layout.d.cts +12 -0
  49. package/dist/components/Splitter/Splitter.layout.d.ts +12 -0
  50. package/dist/components/Splitter/Splitter.types.d.cts +69 -0
  51. package/dist/components/Splitter/Splitter.types.d.ts +69 -0
  52. package/dist/components/TagInput/TagInput.d.cts +7 -0
  53. package/dist/components/TagInput/TagInput.d.ts +7 -0
  54. package/dist/components/TagInput/TagInput.types.d.cts +78 -0
  55. package/dist/components/TagInput/TagInput.types.d.ts +78 -0
  56. package/dist/components/Timeline/Timeline.d.cts +6 -0
  57. package/dist/components/Timeline/Timeline.d.ts +6 -0
  58. package/dist/components/Timeline/Timeline.types.d.cts +42 -0
  59. package/dist/components/Timeline/Timeline.types.d.ts +42 -0
  60. package/dist/components/Tour/Tour.d.cts +9 -0
  61. package/dist/components/Tour/Tour.d.ts +9 -0
  62. package/dist/components/Tour/Tour.types.d.cts +119 -0
  63. package/dist/components/Tour/Tour.types.d.ts +119 -0
  64. package/dist/components.css +1479 -33
  65. package/dist/icons.d.cts +6 -0
  66. package/dist/icons.d.ts +6 -0
  67. package/dist/index.cjs +3500 -1357
  68. package/dist/index.cjs.map +4 -4
  69. package/dist/index.d.cts +26 -0
  70. package/dist/index.d.ts +26 -0
  71. package/dist/index.js +3516 -1354
  72. package/dist/index.js.map +4 -4
  73. package/dist/openware-ui.iife.js +8 -7
  74. package/dist/styles.css +1479 -33
  75. package/package.json +1 -1
@@ -0,0 +1,69 @@
1
+ import type { HTMLAttributes, ReactNode } from "react";
2
+ export type SplitterDirection = "horizontal" | "vertical";
3
+ export interface SplitterProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
4
+ /** SplitterPanels with a SplitterHandle between each pair, straight inside (fragments are fine). */
5
+ children: ReactNode;
6
+ /** `horizontal` puts the panels side by side, `vertical` stacks them.
7
+ * @default "horizontal" */
8
+ direction?: SplitterDirection;
9
+ /** Each panel's size in percent, in order, adding up to 100, when you control it. */
10
+ sizes?: number[];
11
+ /** The sizes at first, when it controls itself. Without it, each panel's `defaultSize` is used, and panels without
12
+ * one share what's left. */
13
+ defaultSizes?: number[];
14
+ /** Called with every panel's size, in percent, as they change: while dragging, on each key press, on collapsing. */
15
+ onSizesChange?(sizes: number[]): void;
16
+ /** Remembers the sizes in localStorage under this name and puts them back next time. Give each splitter its own. */
17
+ autoSaveId?: string;
18
+ }
19
+ export interface SplitterPanelProps extends Omit<HTMLAttributes<HTMLDivElement>, "onResize"> {
20
+ children?: ReactNode;
21
+ /** Its size at first, in percent of the splitter. Panels without one share what the others leave. */
22
+ defaultSize?: number;
23
+ /** The smallest it can be dragged, in percent. @default 0 */
24
+ minSize?: number;
25
+ /** The largest it can be dragged, in percent. @default 100 */
26
+ maxSize?: number;
27
+ /** Lets it fold away: dragging well past `minSize`, double-clicking its handle, or Enter on the handle collapses it
28
+ * to `collapsedSize`, and the same expands it again. @default false */
29
+ collapsible?: boolean;
30
+ /** Its size when collapsed, in percent: 0 hides it, more leaves a strip such as a rail of icons. @default 0 */
31
+ collapsedSize?: number;
32
+ /** Called with its new size, in percent, when it changes. */
33
+ onResize?(size: number): void;
34
+ /** Called when it collapses or expands. */
35
+ onCollapsedChange?(collapsed: boolean): void;
36
+ }
37
+ export interface SplitterHandleProps extends Omit<HTMLAttributes<HTMLDivElement>, "children" | "role"> {
38
+ /** Names the handle for screen readers: say which panel it resizes, such as "Resize sidebar".
39
+ * @default "Resize panels" */
40
+ "aria-label"?: string;
41
+ /** Shows a small grip on the line, so it's easier to see and to catch on a touch screen. @default false */
42
+ grip?: boolean;
43
+ /** Keeps the panels at their sizes: the handle can't be dragged or focused. @default false */
44
+ disabled?: boolean;
45
+ }
46
+ /** A panel's limits, in percent, as the layout maths reads them. Internal. */
47
+ export interface SplitterPanelLimits {
48
+ minSize: number;
49
+ maxSize: number;
50
+ collapsible: boolean;
51
+ collapsedSize: number;
52
+ }
53
+ /** What a Splitter shares with its panels and handles. Internal. */
54
+ export interface SplitterState {
55
+ direction: SplitterDirection;
56
+ sizes: number[];
57
+ limits: SplitterPanelLimits[];
58
+ /** Each panel's element id, for the handles' aria-controls. */
59
+ panelIds: string[];
60
+ /** Moves handle `handle` by `delta` percent; `snap` lets a collapsible panel fold or unfold on the way. */
61
+ move(handle: number, delta: number, snap: boolean, from?: number[]): void;
62
+ /** Collapses or expands the collapsible panel beside the handle. */
63
+ toggle(handle: number): void;
64
+ /** The panels' length along the direction, in pixels, and whether a horizontal splitter runs right to left. */
65
+ measure(): {
66
+ length: number;
67
+ reversed: boolean;
68
+ };
69
+ }
@@ -0,0 +1,7 @@
1
+ import type { TagInputProps } from "./TagInput.types.cjs";
2
+ export type { TagInputOption, TagInputProps, TagInputRejectReason } from "./TagInput.types.cjs";
3
+ /**
4
+ * Several values in one field: each shows as a removable tag before the text box. People type a value and press
5
+ * Enter or a comma, or paste a list. With `options`, it suggests values as they type, like Combobox.
6
+ */
7
+ export declare const TagInput: import("react").ForwardRefExoticComponent<TagInputProps & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,7 @@
1
+ import type { TagInputProps } from "./TagInput.types.js";
2
+ export type { TagInputOption, TagInputProps, TagInputRejectReason } from "./TagInput.types.js";
3
+ /**
4
+ * Several values in one field: each shows as a removable tag before the text box. People type a value and press
5
+ * Enter or a comma, or paste a list. With `options`, it suggests values as they type, like Combobox.
6
+ */
7
+ export declare const TagInput: import("react").ForwardRefExoticComponent<TagInputProps & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,78 @@
1
+ import type { ReactNode } from "react";
2
+ export interface TagInputOption {
3
+ /** What goes in the value when it's picked. */
4
+ value: string;
5
+ /** The text shown in the list and on the tag, and matched as people type. */
6
+ label: string;
7
+ /** A muted line under the label in the list; also matched. */
8
+ description?: ReactNode;
9
+ disabled?: boolean;
10
+ }
11
+ /** Why a value wasn't added: `validate` refused it, it's already there, it isn't one of the options, or the field is full. */
12
+ /** An item in the suggestions: an option, or the one that adds what's typed. Internal. */
13
+ export type TagInputItem = {
14
+ option: TagInputOption;
15
+ } | {
16
+ create: string;
17
+ };
18
+ export type TagInputRejectReason = "invalid" | "duplicate" | "unknown" | "max";
19
+ export interface TagInputProps {
20
+ /** The values, when you control them. */
21
+ value?: string[];
22
+ /** The values at first, when it controls them itself.
23
+ * @default [] */
24
+ defaultValue?: string[];
25
+ /** Called with the new list when a value is added or removed. */
26
+ onChange?(value: string[]): void;
27
+ /** Suggestions shown in a list under the field, filtered by what's typed. Without them, it takes whatever is typed. */
28
+ options?: TagInputOption[];
29
+ /** With `options`, also takes values that aren't among them. Without options, it always does.
30
+ * @default false */
31
+ allowCustom?: boolean;
32
+ /** Checks a typed value before it's added; return false to refuse it. The text stays in the field to fix. */
33
+ validate?(text: string): boolean;
34
+ /** Called when a value isn't added, with the text and why, to show a message. */
35
+ onReject?(text: string, reason: TagInputRejectReason): void;
36
+ /** Keeps a value that's already there (compared ignoring case) instead of refusing it.
37
+ * @default false */
38
+ allowDuplicates?: boolean;
39
+ /** The most values it takes. */
40
+ max?: number;
41
+ /** Keys that add what's typed, besides Enter. A pasted list is split on these and on new lines.
42
+ * @default [","] */
43
+ separators?: string[];
44
+ /** Called as the person types, to load options from a server. */
45
+ onInputChange?(text: string): void;
46
+ /** Shown while there are no values. */
47
+ placeholder?: string;
48
+ /** Shown in the list when nothing matches.
49
+ * @default "No matches" */
50
+ emptyMessage?: ReactNode;
51
+ /** sm 32px for toolbars and settings rows, md 40px in forms; the field grows as tags wrap.
52
+ * @default "md" */
53
+ size?: "sm" | "md";
54
+ /** Shows the field as wrong, like Input. Field sets it when there's an error.
55
+ * @default false */
56
+ isInvalid?: boolean;
57
+ /** @default false */
58
+ disabled?: boolean;
59
+ /** Submits each value under this name, in a hidden input, so a Form or a plain form sends them as a list. */
60
+ name?: string;
61
+ /** The text box's id, which a Field's label points at. */
62
+ id?: string;
63
+ "aria-label"?: string;
64
+ "aria-labelledby"?: string;
65
+ "aria-describedby"?: string;
66
+ /** The words it uses, for other languages. */
67
+ labels?: {
68
+ /** The remove button on a tag, given its text. @default (tag) => `Remove ${tag}` */
69
+ remove?(tag: string): string;
70
+ /** Read out when a value is added. @default (tag) => `Added ${tag}` */
71
+ added?(tag: string): string;
72
+ /** Read out when a value is removed. @default (tag) => `Removed ${tag}` */
73
+ removed?(tag: string): string;
74
+ /** The option that adds what's typed, with `allowCustom` and options. @default (text) => `Add "${text}"` */
75
+ create?(text: string): string;
76
+ };
77
+ className?: string;
78
+ }
@@ -0,0 +1,78 @@
1
+ import type { ReactNode } from "react";
2
+ export interface TagInputOption {
3
+ /** What goes in the value when it's picked. */
4
+ value: string;
5
+ /** The text shown in the list and on the tag, and matched as people type. */
6
+ label: string;
7
+ /** A muted line under the label in the list; also matched. */
8
+ description?: ReactNode;
9
+ disabled?: boolean;
10
+ }
11
+ /** Why a value wasn't added: `validate` refused it, it's already there, it isn't one of the options, or the field is full. */
12
+ /** An item in the suggestions: an option, or the one that adds what's typed. Internal. */
13
+ export type TagInputItem = {
14
+ option: TagInputOption;
15
+ } | {
16
+ create: string;
17
+ };
18
+ export type TagInputRejectReason = "invalid" | "duplicate" | "unknown" | "max";
19
+ export interface TagInputProps {
20
+ /** The values, when you control them. */
21
+ value?: string[];
22
+ /** The values at first, when it controls them itself.
23
+ * @default [] */
24
+ defaultValue?: string[];
25
+ /** Called with the new list when a value is added or removed. */
26
+ onChange?(value: string[]): void;
27
+ /** Suggestions shown in a list under the field, filtered by what's typed. Without them, it takes whatever is typed. */
28
+ options?: TagInputOption[];
29
+ /** With `options`, also takes values that aren't among them. Without options, it always does.
30
+ * @default false */
31
+ allowCustom?: boolean;
32
+ /** Checks a typed value before it's added; return false to refuse it. The text stays in the field to fix. */
33
+ validate?(text: string): boolean;
34
+ /** Called when a value isn't added, with the text and why, to show a message. */
35
+ onReject?(text: string, reason: TagInputRejectReason): void;
36
+ /** Keeps a value that's already there (compared ignoring case) instead of refusing it.
37
+ * @default false */
38
+ allowDuplicates?: boolean;
39
+ /** The most values it takes. */
40
+ max?: number;
41
+ /** Keys that add what's typed, besides Enter. A pasted list is split on these and on new lines.
42
+ * @default [","] */
43
+ separators?: string[];
44
+ /** Called as the person types, to load options from a server. */
45
+ onInputChange?(text: string): void;
46
+ /** Shown while there are no values. */
47
+ placeholder?: string;
48
+ /** Shown in the list when nothing matches.
49
+ * @default "No matches" */
50
+ emptyMessage?: ReactNode;
51
+ /** sm 32px for toolbars and settings rows, md 40px in forms; the field grows as tags wrap.
52
+ * @default "md" */
53
+ size?: "sm" | "md";
54
+ /** Shows the field as wrong, like Input. Field sets it when there's an error.
55
+ * @default false */
56
+ isInvalid?: boolean;
57
+ /** @default false */
58
+ disabled?: boolean;
59
+ /** Submits each value under this name, in a hidden input, so a Form or a plain form sends them as a list. */
60
+ name?: string;
61
+ /** The text box's id, which a Field's label points at. */
62
+ id?: string;
63
+ "aria-label"?: string;
64
+ "aria-labelledby"?: string;
65
+ "aria-describedby"?: string;
66
+ /** The words it uses, for other languages. */
67
+ labels?: {
68
+ /** The remove button on a tag, given its text. @default (tag) => `Remove ${tag}` */
69
+ remove?(tag: string): string;
70
+ /** Read out when a value is added. @default (tag) => `Added ${tag}` */
71
+ added?(tag: string): string;
72
+ /** Read out when a value is removed. @default (tag) => `Removed ${tag}` */
73
+ removed?(tag: string): string;
74
+ /** The option that adds what's typed, with `allowCustom` and options. @default (text) => `Add "${text}"` */
75
+ create?(text: string): string;
76
+ };
77
+ className?: string;
78
+ }
@@ -0,0 +1,6 @@
1
+ import type { TimelineItemProps, TimelineProps } from "./Timeline.types.cjs";
2
+ export type { TimelineItemProps, TimelineProps, TimelineTone } from "./Timeline.types.cjs";
3
+ /** Events down a line, as an ordered list: an activity feed, a changelog or the history of a record. */
4
+ export declare function Timeline({ density, className, children, ...props }: TimelineProps): import("react").JSX.Element;
5
+ /** One event on a Timeline: a marker on the line (a dot, an icon or an avatar), a title, a time and anything under it. */
6
+ export declare function TimelineItem({ title, time, dateTime, tone, icon, avatar, pending, className, children, ...props }: TimelineItemProps): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { TimelineItemProps, TimelineProps } from "./Timeline.types.js";
2
+ export type { TimelineItemProps, TimelineProps, TimelineTone } from "./Timeline.types.js";
3
+ /** Events down a line, as an ordered list: an activity feed, a changelog or the history of a record. */
4
+ export declare function Timeline({ density, className, children, ...props }: TimelineProps): import("react").JSX.Element;
5
+ /** One event on a Timeline: a marker on the line (a dot, an icon or an avatar), a title, a time and anything under it. */
6
+ export declare function TimelineItem({ title, time, dateTime, tone, icon, avatar, pending, className, children, ...props }: TimelineItemProps): import("react").JSX.Element;
@@ -0,0 +1,42 @@
1
+ import type { LiHTMLAttributes, OlHTMLAttributes, ReactNode } from "react";
2
+ /** The colour of an item's dot or icon circle, the same set as Badge and Alert. */
3
+ export type TimelineTone = "neutral" | "brand" | "success" | "warning" | "danger";
4
+ export interface TimelineProps extends OlHTMLAttributes<HTMLOListElement> {
5
+ /**
6
+ * `comfortable` is a changelog or a history: a bold title with the time at the end of its line, and room for a
7
+ * description or a card under it. `compact` is an activity feed: one sentence with the time after it, close
8
+ * together, for 24px avatars.
9
+ * @default "comfortable"
10
+ */
11
+ density?: "compact" | "comfortable";
12
+ /** The events, as `TimelineItem`s, in the order they read: newest first for a feed, oldest first for a plan. */
13
+ children?: ReactNode;
14
+ }
15
+ export interface TimelineItemProps extends Omit<LiHTMLAttributes<HTMLLIElement>, "title"> {
16
+ /** What happened: a heading in a changelog, or the whole sentence in a feed ("Ana merged #42"). */
17
+ title?: ReactNode;
18
+ /** When it happened, as people read it: "2h ago", "14 Oct", "v0.13.0 · 14 Oct". */
19
+ time?: ReactNode;
20
+ /**
21
+ * The machine-readable moment for `time`, such as "2026-10-13T14:32" or "2026-10-13". With it, the time is a
22
+ * `<time>` element that screen readers, search engines and scripts can read.
23
+ */
24
+ dateTime?: string;
25
+ /**
26
+ * The colour of the dot, or of the icon's circle. Brand for something in progress or by an agent, success for
27
+ * something that shipped, warning for something that needs you, danger for something that failed.
28
+ * @default "neutral"
29
+ */
30
+ tone?: TimelineTone;
31
+ /** A 14px icon in a circle in place of the dot, such as a rocket for a deploy. */
32
+ icon?: ReactNode;
33
+ /**
34
+ * An `Avatar` in place of the dot, for who did it. Size it to the timeline: `sm` (24px) when compact, `md` (28px)
35
+ * when comfortable.
36
+ */
37
+ avatar?: ReactNode;
38
+ /** Something that hasn't happened yet: a hollow marker, a muted title and a dashed line into and out of it. */
39
+ pending?: boolean;
40
+ /** More about it under the title: a line of description, a quoted comment, badges, a link. */
41
+ children?: ReactNode;
42
+ }
@@ -0,0 +1,42 @@
1
+ import type { LiHTMLAttributes, OlHTMLAttributes, ReactNode } from "react";
2
+ /** The colour of an item's dot or icon circle, the same set as Badge and Alert. */
3
+ export type TimelineTone = "neutral" | "brand" | "success" | "warning" | "danger";
4
+ export interface TimelineProps extends OlHTMLAttributes<HTMLOListElement> {
5
+ /**
6
+ * `comfortable` is a changelog or a history: a bold title with the time at the end of its line, and room for a
7
+ * description or a card under it. `compact` is an activity feed: one sentence with the time after it, close
8
+ * together, for 24px avatars.
9
+ * @default "comfortable"
10
+ */
11
+ density?: "compact" | "comfortable";
12
+ /** The events, as `TimelineItem`s, in the order they read: newest first for a feed, oldest first for a plan. */
13
+ children?: ReactNode;
14
+ }
15
+ export interface TimelineItemProps extends Omit<LiHTMLAttributes<HTMLLIElement>, "title"> {
16
+ /** What happened: a heading in a changelog, or the whole sentence in a feed ("Ana merged #42"). */
17
+ title?: ReactNode;
18
+ /** When it happened, as people read it: "2h ago", "14 Oct", "v0.13.0 · 14 Oct". */
19
+ time?: ReactNode;
20
+ /**
21
+ * The machine-readable moment for `time`, such as "2026-10-13T14:32" or "2026-10-13". With it, the time is a
22
+ * `<time>` element that screen readers, search engines and scripts can read.
23
+ */
24
+ dateTime?: string;
25
+ /**
26
+ * The colour of the dot, or of the icon's circle. Brand for something in progress or by an agent, success for
27
+ * something that shipped, warning for something that needs you, danger for something that failed.
28
+ * @default "neutral"
29
+ */
30
+ tone?: TimelineTone;
31
+ /** A 14px icon in a circle in place of the dot, such as a rocket for a deploy. */
32
+ icon?: ReactNode;
33
+ /**
34
+ * An `Avatar` in place of the dot, for who did it. Size it to the timeline: `sm` (24px) when compact, `md` (28px)
35
+ * when comfortable.
36
+ */
37
+ avatar?: ReactNode;
38
+ /** Something that hasn't happened yet: a hollow marker, a muted title and a dashed line into and out of it. */
39
+ pending?: boolean;
40
+ /** More about it under the title: a line of description, a quoted comment, badges, a link. */
41
+ children?: ReactNode;
42
+ }
@@ -0,0 +1,9 @@
1
+ import type { CoachmarkProps, TourProps } from "./Tour.types.cjs";
2
+ export type { CoachmarkProps, TourLabels, TourProps, TourStep, TourTarget } from "./Tour.types.cjs";
3
+ /**
4
+ * A guided tour: a card beside each part of the page in turn, with what it's for, Back and Next. Steps without a
5
+ * target show in the middle, for a welcome. It's non-modal, so the page stays usable; `spotlight` dims the rest of it.
6
+ */
7
+ export declare function Tour({ steps, open, defaultOpen, onOpenChange, step, defaultStep, onStepChange, onComplete, onSkip, spotlight, spotlightPadding, width, labels, className, }: TourProps): import("react").JSX.Element | null;
8
+ /** A single hint beside one control, with a button that dismisses it: for pointing out something new. */
9
+ export declare function Coachmark({ target, title, content, open, defaultOpen, onOpenChange, placement, dismissLabel, autoFocus, width, className, }: CoachmarkProps): import("react").JSX.Element | null;
@@ -0,0 +1,9 @@
1
+ import type { CoachmarkProps, TourProps } from "./Tour.types.js";
2
+ export type { CoachmarkProps, TourLabels, TourProps, TourStep, TourTarget } from "./Tour.types.js";
3
+ /**
4
+ * A guided tour: a card beside each part of the page in turn, with what it's for, Back and Next. Steps without a
5
+ * target show in the middle, for a welcome. It's non-modal, so the page stays usable; `spotlight` dims the rest of it.
6
+ */
7
+ export declare function Tour({ steps, open, defaultOpen, onOpenChange, step, defaultStep, onStepChange, onComplete, onSkip, spotlight, spotlightPadding, width, labels, className, }: TourProps): import("react").JSX.Element | null;
8
+ /** A single hint beside one control, with a button that dismisses it: for pointing out something new. */
9
+ export declare function Coachmark({ target, title, content, open, defaultOpen, onOpenChange, placement, dismissLabel, autoFocus, width, className, }: CoachmarkProps): import("react").JSX.Element | null;
@@ -0,0 +1,119 @@
1
+ import type { CSSProperties, KeyboardEvent, ReactNode, RefObject } from "react";
2
+ import type { Placement } from "../../hooks/useFloating.cjs";
3
+ /** What a step points at: a CSS selector, a ref, or a function that returns the element. */
4
+ export type TourTarget = string | RefObject<HTMLElement | null> | (() => HTMLElement | null | undefined);
5
+ export interface TourStep {
6
+ /** The part of the page this step is about. Leave it out (or point at something that isn't there) and the step
7
+ * shows in the middle of the window, like a dialog: for a welcome or a last word. */
8
+ target?: TourTarget;
9
+ /** A few words that name the step. It names the card for screen readers too. */
10
+ title: ReactNode;
11
+ /** A sentence or two about the target. */
12
+ content?: ReactNode;
13
+ /** Where the card opens beside the target; it flips when there's no room.
14
+ * @default "bottom" */
15
+ placement?: Placement;
16
+ }
17
+ export interface TourLabels {
18
+ /** @default "Back" */
19
+ back?: string;
20
+ /** @default "Next" */
21
+ next?: string;
22
+ /** The last step's button. @default "Done" */
23
+ done?: string;
24
+ /** The ✕ in the corner, for screen readers. @default "Skip tour" */
25
+ skip?: string;
26
+ /** The count in the corner of the card.
27
+ * @default (step, total) => `Step ${step} of ${total}` */
28
+ progress?(step: number, total: number): string;
29
+ }
30
+ export interface TourProps {
31
+ /** The steps, in order. */
32
+ steps: TourStep[];
33
+ /** Shown, when you control it. */
34
+ open?: boolean;
35
+ /** Shown at first, when it controls itself.
36
+ * @default false */
37
+ defaultOpen?: boolean;
38
+ /** Called when it opens or closes (Done, the ✕ or Escape). */
39
+ onOpenChange?(open: boolean): void;
40
+ /** The step showing, from 0, when you control it. */
41
+ step?: number;
42
+ /** The step it starts on, and goes back to after it closes, when it controls itself.
43
+ * @default 0 */
44
+ defaultStep?: number;
45
+ /** Called with the new step's index on Back and Next. */
46
+ onStepChange?(step: number): void;
47
+ /** Called when the person presses Done on the last step. */
48
+ onComplete?(): void;
49
+ /** Called with the step's index when the person leaves early, with the ✕ or Escape. */
50
+ onSkip?(step: number): void;
51
+ /** Dims the page around the target, leaving a hole over it. The page still takes clicks and Tab: it's a cue, not a wall.
52
+ * @default false */
53
+ spotlight?: boolean;
54
+ /** Room around the target inside the spotlight's hole, in pixels.
55
+ * @default 6 */
56
+ spotlightPadding?: number;
57
+ /** The card's width: pixels, or any CSS width.
58
+ * @default 320 */
59
+ width?: number | string;
60
+ /** The words it uses, for other languages. */
61
+ labels?: TourLabels;
62
+ className?: string;
63
+ }
64
+ export interface CoachmarkProps {
65
+ /** What it points at: a CSS selector, a ref, or a function that returns the element. */
66
+ target: TourTarget;
67
+ /** A few words. It names the card for screen readers too. */
68
+ title: ReactNode;
69
+ /** A sentence about the target. */
70
+ content?: ReactNode;
71
+ /** Shown, when you control it. */
72
+ open?: boolean;
73
+ /** Shown at first, when it controls itself.
74
+ * @default true */
75
+ defaultOpen?: boolean;
76
+ /** Called when it opens or is dismissed. */
77
+ onOpenChange?(open: boolean): void;
78
+ /** Where it opens beside the target; it flips when there's no room.
79
+ * @default "bottom" */
80
+ placement?: Placement;
81
+ /** The button that dismisses it.
82
+ * @default "Got it" */
83
+ dismissLabel?: string;
84
+ /** Moves focus into it when it opens. Leave it off for a hint that shows on load, so it doesn't pull focus away;
85
+ * turn it on when it opens because of something the person did.
86
+ * @default false */
87
+ autoFocus?: boolean;
88
+ /** The card's width: pixels, or any CSS width.
89
+ * @default 280 */
90
+ width?: number | string;
91
+ className?: string;
92
+ }
93
+ /** Internal: what Tour and Coachmark pass to the card they share. */
94
+ export interface TourCardOptions {
95
+ open: boolean;
96
+ target: TourTarget | undefined;
97
+ placement: Placement;
98
+ /** Changes on every step, so focus moves into the card again. */
99
+ stepKey: number;
100
+ spotlight: boolean;
101
+ spotlightPadding: number;
102
+ autoFocus: boolean;
103
+ width: number | string;
104
+ }
105
+ /** Internal: the card's parts. */
106
+ export interface TourCardProps {
107
+ cardRef: RefObject<HTMLDivElement>;
108
+ id: string;
109
+ state: "open" | "closed";
110
+ centred: boolean;
111
+ style: CSSProperties;
112
+ className?: string;
113
+ title: ReactNode;
114
+ content?: ReactNode;
115
+ close?: ReactNode;
116
+ progress?: string;
117
+ actions: ReactNode;
118
+ onKeyDown(event: KeyboardEvent<HTMLDivElement>): void;
119
+ }
@@ -0,0 +1,119 @@
1
+ import type { CSSProperties, KeyboardEvent, ReactNode, RefObject } from "react";
2
+ import type { Placement } from "../../hooks/useFloating.js";
3
+ /** What a step points at: a CSS selector, a ref, or a function that returns the element. */
4
+ export type TourTarget = string | RefObject<HTMLElement | null> | (() => HTMLElement | null | undefined);
5
+ export interface TourStep {
6
+ /** The part of the page this step is about. Leave it out (or point at something that isn't there) and the step
7
+ * shows in the middle of the window, like a dialog: for a welcome or a last word. */
8
+ target?: TourTarget;
9
+ /** A few words that name the step. It names the card for screen readers too. */
10
+ title: ReactNode;
11
+ /** A sentence or two about the target. */
12
+ content?: ReactNode;
13
+ /** Where the card opens beside the target; it flips when there's no room.
14
+ * @default "bottom" */
15
+ placement?: Placement;
16
+ }
17
+ export interface TourLabels {
18
+ /** @default "Back" */
19
+ back?: string;
20
+ /** @default "Next" */
21
+ next?: string;
22
+ /** The last step's button. @default "Done" */
23
+ done?: string;
24
+ /** The ✕ in the corner, for screen readers. @default "Skip tour" */
25
+ skip?: string;
26
+ /** The count in the corner of the card.
27
+ * @default (step, total) => `Step ${step} of ${total}` */
28
+ progress?(step: number, total: number): string;
29
+ }
30
+ export interface TourProps {
31
+ /** The steps, in order. */
32
+ steps: TourStep[];
33
+ /** Shown, when you control it. */
34
+ open?: boolean;
35
+ /** Shown at first, when it controls itself.
36
+ * @default false */
37
+ defaultOpen?: boolean;
38
+ /** Called when it opens or closes (Done, the ✕ or Escape). */
39
+ onOpenChange?(open: boolean): void;
40
+ /** The step showing, from 0, when you control it. */
41
+ step?: number;
42
+ /** The step it starts on, and goes back to after it closes, when it controls itself.
43
+ * @default 0 */
44
+ defaultStep?: number;
45
+ /** Called with the new step's index on Back and Next. */
46
+ onStepChange?(step: number): void;
47
+ /** Called when the person presses Done on the last step. */
48
+ onComplete?(): void;
49
+ /** Called with the step's index when the person leaves early, with the ✕ or Escape. */
50
+ onSkip?(step: number): void;
51
+ /** Dims the page around the target, leaving a hole over it. The page still takes clicks and Tab: it's a cue, not a wall.
52
+ * @default false */
53
+ spotlight?: boolean;
54
+ /** Room around the target inside the spotlight's hole, in pixels.
55
+ * @default 6 */
56
+ spotlightPadding?: number;
57
+ /** The card's width: pixels, or any CSS width.
58
+ * @default 320 */
59
+ width?: number | string;
60
+ /** The words it uses, for other languages. */
61
+ labels?: TourLabels;
62
+ className?: string;
63
+ }
64
+ export interface CoachmarkProps {
65
+ /** What it points at: a CSS selector, a ref, or a function that returns the element. */
66
+ target: TourTarget;
67
+ /** A few words. It names the card for screen readers too. */
68
+ title: ReactNode;
69
+ /** A sentence about the target. */
70
+ content?: ReactNode;
71
+ /** Shown, when you control it. */
72
+ open?: boolean;
73
+ /** Shown at first, when it controls itself.
74
+ * @default true */
75
+ defaultOpen?: boolean;
76
+ /** Called when it opens or is dismissed. */
77
+ onOpenChange?(open: boolean): void;
78
+ /** Where it opens beside the target; it flips when there's no room.
79
+ * @default "bottom" */
80
+ placement?: Placement;
81
+ /** The button that dismisses it.
82
+ * @default "Got it" */
83
+ dismissLabel?: string;
84
+ /** Moves focus into it when it opens. Leave it off for a hint that shows on load, so it doesn't pull focus away;
85
+ * turn it on when it opens because of something the person did.
86
+ * @default false */
87
+ autoFocus?: boolean;
88
+ /** The card's width: pixels, or any CSS width.
89
+ * @default 280 */
90
+ width?: number | string;
91
+ className?: string;
92
+ }
93
+ /** Internal: what Tour and Coachmark pass to the card they share. */
94
+ export interface TourCardOptions {
95
+ open: boolean;
96
+ target: TourTarget | undefined;
97
+ placement: Placement;
98
+ /** Changes on every step, so focus moves into the card again. */
99
+ stepKey: number;
100
+ spotlight: boolean;
101
+ spotlightPadding: number;
102
+ autoFocus: boolean;
103
+ width: number | string;
104
+ }
105
+ /** Internal: the card's parts. */
106
+ export interface TourCardProps {
107
+ cardRef: RefObject<HTMLDivElement>;
108
+ id: string;
109
+ state: "open" | "closed";
110
+ centred: boolean;
111
+ style: CSSProperties;
112
+ className?: string;
113
+ title: ReactNode;
114
+ content?: ReactNode;
115
+ close?: ReactNode;
116
+ progress?: string;
117
+ actions: ReactNode;
118
+ onKeyDown(event: KeyboardEvent<HTMLDivElement>): void;
119
+ }