@openwarelabs/ui 0.12.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/components/AspectRatio/AspectRatio.d.cts +7 -0
- package/dist/components/AspectRatio/AspectRatio.d.ts +7 -0
- package/dist/components/AspectRatio/AspectRatio.types.d.cts +7 -0
- package/dist/components/AspectRatio/AspectRatio.types.d.ts +7 -0
- package/dist/components/Banner/Banner.d.cts +7 -0
- package/dist/components/Banner/Banner.d.ts +7 -0
- package/dist/components/Banner/Banner.types.d.cts +44 -0
- package/dist/components/Banner/Banner.types.d.ts +44 -0
- package/dist/components/Carousel/Carousel.d.cts +9 -0
- package/dist/components/Carousel/Carousel.d.ts +9 -0
- package/dist/components/Carousel/Carousel.types.d.cts +63 -0
- package/dist/components/Carousel/Carousel.types.d.ts +63 -0
- package/dist/components/ContextMenu/ContextMenu.d.cts +7 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +7 -0
- package/dist/components/ContextMenu/ContextMenu.types.d.cts +32 -0
- package/dist/components/ContextMenu/ContextMenu.types.d.ts +32 -0
- package/dist/components/DescriptionList/DescriptionList.d.cts +9 -0
- package/dist/components/DescriptionList/DescriptionList.d.ts +9 -0
- package/dist/components/DescriptionList/DescriptionList.types.d.cts +32 -0
- package/dist/components/DescriptionList/DescriptionList.types.d.ts +32 -0
- package/dist/components/HoverCard/HoverCard.d.cts +8 -0
- package/dist/components/HoverCard/HoverCard.d.ts +8 -0
- package/dist/components/HoverCard/HoverCard.types.d.cts +28 -0
- package/dist/components/HoverCard/HoverCard.types.d.ts +28 -0
- package/dist/components/Image/Image.d.cts +7 -0
- package/dist/components/Image/Image.d.ts +7 -0
- package/dist/components/Image/Image.types.d.cts +28 -0
- package/dist/components/Image/Image.types.d.ts +28 -0
- package/dist/components/Menu/Menu.context.d.cts +3 -0
- package/dist/components/Menu/Menu.context.d.ts +3 -0
- package/dist/components/Menu/Menu.d.cts +4 -34
- package/dist/components/Menu/Menu.d.ts +4 -34
- package/dist/components/Menu/Menu.types.d.cts +39 -0
- package/dist/components/Menu/Menu.types.d.ts +39 -0
- package/dist/components/PasswordInput/PasswordInput.d.cts +9 -0
- package/dist/components/PasswordInput/PasswordInput.d.ts +9 -0
- package/dist/components/PasswordInput/PasswordInput.types.d.cts +47 -0
- package/dist/components/PasswordInput/PasswordInput.types.d.ts +47 -0
- package/dist/components/PasswordInput/passwordStrength.d.cts +9 -0
- package/dist/components/PasswordInput/passwordStrength.d.ts +9 -0
- package/dist/components/Rating/Rating.d.cts +8 -0
- package/dist/components/Rating/Rating.d.ts +8 -0
- package/dist/components/Rating/Rating.types.d.cts +59 -0
- package/dist/components/Rating/Rating.types.d.ts +59 -0
- package/dist/components/Splitter/Splitter.d.cts +14 -0
- package/dist/components/Splitter/Splitter.d.ts +14 -0
- package/dist/components/Splitter/Splitter.layout.d.cts +12 -0
- package/dist/components/Splitter/Splitter.layout.d.ts +12 -0
- package/dist/components/Splitter/Splitter.types.d.cts +69 -0
- package/dist/components/Splitter/Splitter.types.d.ts +69 -0
- package/dist/components/Table/Table.d.cts +4 -60
- package/dist/components/Table/Table.d.ts +4 -60
- package/dist/components/Table/Table.types.d.cts +64 -0
- package/dist/components/Table/Table.types.d.ts +64 -0
- package/dist/components/TagInput/TagInput.d.cts +7 -0
- package/dist/components/TagInput/TagInput.d.ts +7 -0
- package/dist/components/TagInput/TagInput.types.d.cts +78 -0
- package/dist/components/TagInput/TagInput.types.d.ts +78 -0
- package/dist/components/Timeline/Timeline.d.cts +6 -0
- package/dist/components/Timeline/Timeline.d.ts +6 -0
- package/dist/components/Timeline/Timeline.types.d.cts +42 -0
- package/dist/components/Timeline/Timeline.types.d.ts +42 -0
- package/dist/components/Tour/Tour.d.cts +9 -0
- package/dist/components/Tour/Tour.d.ts +9 -0
- package/dist/components/Tour/Tour.types.d.cts +119 -0
- package/dist/components/Tour/Tour.types.d.ts +119 -0
- package/dist/components.css +1630 -124
- package/dist/icons.d.cts +6 -0
- package/dist/icons.d.ts +6 -0
- package/dist/index.cjs +3501 -1357
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.cts +26 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +3518 -1355
- package/dist/index.js.map +4 -4
- package/dist/openware-ui.iife.js +9 -8
- package/dist/styles.css +1630 -124
- package/package.json +1 -1
|
@@ -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
|
+
}
|