bubble-toolbar 0.0.0-stage → 1.0.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/CHANGELOG.md +3 -0
- package/LICENSE +21 -0
- package/README.md +314 -2
- package/dist/index.d.mts +203 -0
- package/dist/index.d.ts +203 -0
- package/dist/index.js +615 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +586 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +195 -0
- package/package.json +89 -5
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode, CSSProperties, ButtonHTMLAttributes, ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
interface BubbleActivityValue {
|
|
5
|
+
isBusy: boolean;
|
|
6
|
+
run: <T>(task: () => Promise<T>) => Promise<T>;
|
|
7
|
+
}
|
|
8
|
+
declare const useBubbleActivity: () => BubbleActivityValue;
|
|
9
|
+
|
|
10
|
+
type BubbleToolbarTheme = 'light' | 'dark' | 'auto' | 'glass';
|
|
11
|
+
type BubbleToolbarPosition = 'bottom' | 'top' | 'static' | 'custom';
|
|
12
|
+
type BubbleToolbarSize = 'sm' | 'md' | 'lg' | number;
|
|
13
|
+
type BubbleShape = 'circle' | 'pill';
|
|
14
|
+
/** Activity appearance inherited by each bubble group. */
|
|
15
|
+
interface BubbleActivityProps {
|
|
16
|
+
/** Adds external activity; false does not hide pending local tasks. */
|
|
17
|
+
busy?: boolean;
|
|
18
|
+
/** Three CSS colors used by the rotating activity border. */
|
|
19
|
+
activityColors?: readonly [string, string, string];
|
|
20
|
+
/** Seconds per rotation. Defaults to 2.4. */
|
|
21
|
+
activityDuration?: number;
|
|
22
|
+
}
|
|
23
|
+
interface BubbleToolbarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'>, BubbleActivityProps {
|
|
24
|
+
/**
|
|
25
|
+
* Definition of items by groups.
|
|
26
|
+
* Example:
|
|
27
|
+
* [
|
|
28
|
+
* [<Logo />],
|
|
29
|
+
* [<IconButton name="search" />, <ToolbarArea />],
|
|
30
|
+
* [<IconButton name="theme" />],
|
|
31
|
+
* [<IconButton name="chat" />],
|
|
32
|
+
* [<IconButton name="notifications" />]
|
|
33
|
+
* ]
|
|
34
|
+
*/
|
|
35
|
+
groups?: ReactNode[][];
|
|
36
|
+
/**
|
|
37
|
+
* Alternatively, declarative composition using BubbleToolbar.Group children.
|
|
38
|
+
*/
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Placement on the screen.
|
|
42
|
+
* @default 'bottom'
|
|
43
|
+
*/
|
|
44
|
+
position?: BubbleToolbarPosition;
|
|
45
|
+
/**
|
|
46
|
+
* Visual theme styling.
|
|
47
|
+
* @default 'glass'
|
|
48
|
+
*/
|
|
49
|
+
theme?: BubbleToolbarTheme;
|
|
50
|
+
/**
|
|
51
|
+
* Toolbar height / bubble diameter.
|
|
52
|
+
* Preset 'sm' (40px), 'md' (48px), 'lg' (56px) or numeric pixels.
|
|
53
|
+
* @default 'md'
|
|
54
|
+
*/
|
|
55
|
+
size?: BubbleToolbarSize;
|
|
56
|
+
/**
|
|
57
|
+
* Whether to apply the blurred frosted glass effect (backdrop-filter: blur).
|
|
58
|
+
* @default true
|
|
59
|
+
*/
|
|
60
|
+
blurred?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Amount of backdrop blur in pixels or CSS string.
|
|
63
|
+
* @default 16
|
|
64
|
+
*/
|
|
65
|
+
blurAmount?: number | string;
|
|
66
|
+
/**
|
|
67
|
+
* Spacing between bubble groups.
|
|
68
|
+
* @default 8
|
|
69
|
+
*/
|
|
70
|
+
groupGap?: number | string;
|
|
71
|
+
/**
|
|
72
|
+
* Spacing between elements inside a multi-node pill group.
|
|
73
|
+
* @default 8
|
|
74
|
+
*/
|
|
75
|
+
itemGap?: number | string;
|
|
76
|
+
/**
|
|
77
|
+
* Whether to display subtle borders around bubbles.
|
|
78
|
+
* @default true
|
|
79
|
+
*/
|
|
80
|
+
bordered?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Whether to render floating shadow, or custom shadow CSS string.
|
|
83
|
+
* @default true
|
|
84
|
+
*/
|
|
85
|
+
shadow?: boolean | string;
|
|
86
|
+
/**
|
|
87
|
+
* Custom CSS class name for toolbar container.
|
|
88
|
+
*/
|
|
89
|
+
className?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Inline CSS styles for toolbar container.
|
|
92
|
+
*/
|
|
93
|
+
style?: CSSProperties;
|
|
94
|
+
/**
|
|
95
|
+
* Accessible ARIA label for toolbar.
|
|
96
|
+
* @default 'Toolbar'
|
|
97
|
+
*/
|
|
98
|
+
ariaLabel?: string;
|
|
99
|
+
}
|
|
100
|
+
interface BubbleGroupProps extends HTMLAttributes<HTMLDivElement>, BubbleActivityProps {
|
|
101
|
+
/**
|
|
102
|
+
* Elements inside this group.
|
|
103
|
+
* 1 node renders as a circle.
|
|
104
|
+
* More than 1 node renders as a pill / rounded rectangle.
|
|
105
|
+
*/
|
|
106
|
+
children?: ReactNode;
|
|
107
|
+
/**
|
|
108
|
+
* Force shape instead of auto-calculating from children count.
|
|
109
|
+
*/
|
|
110
|
+
shape?: BubbleShape;
|
|
111
|
+
/**
|
|
112
|
+
* Override bubble size / height for this specific group.
|
|
113
|
+
*/
|
|
114
|
+
size?: BubbleToolbarSize;
|
|
115
|
+
/**
|
|
116
|
+
* Gap between items in this group.
|
|
117
|
+
*/
|
|
118
|
+
itemGap?: number | string;
|
|
119
|
+
/**
|
|
120
|
+
* Custom CSS class name.
|
|
121
|
+
*/
|
|
122
|
+
className?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Inline CSS styles.
|
|
125
|
+
*/
|
|
126
|
+
style?: CSSProperties;
|
|
127
|
+
}
|
|
128
|
+
interface BubbleIconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
129
|
+
/**
|
|
130
|
+
* Icon identifier or label for standard icons.
|
|
131
|
+
*/
|
|
132
|
+
name?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Custom icon element or SVG.
|
|
135
|
+
*/
|
|
136
|
+
icon?: ReactNode;
|
|
137
|
+
/**
|
|
138
|
+
* Active or toggled state.
|
|
139
|
+
* @default false
|
|
140
|
+
*/
|
|
141
|
+
active?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Optional badge count or indicator.
|
|
144
|
+
*/
|
|
145
|
+
badge?: ReactNode | number | string;
|
|
146
|
+
/**
|
|
147
|
+
* Tooltip text.
|
|
148
|
+
*/
|
|
149
|
+
tooltip?: string;
|
|
150
|
+
/**
|
|
151
|
+
* Explicit accessible label.
|
|
152
|
+
*/
|
|
153
|
+
ariaLabel?: string;
|
|
154
|
+
}
|
|
155
|
+
interface BubbleAreaProps extends HTMLAttributes<HTMLDivElement> {
|
|
156
|
+
/**
|
|
157
|
+
* Content inside the toolbar area (e.g. search input, label, sliders).
|
|
158
|
+
*/
|
|
159
|
+
children?: ReactNode;
|
|
160
|
+
/**
|
|
161
|
+
* Minimum width for the area.
|
|
162
|
+
*/
|
|
163
|
+
minWidth?: number | string;
|
|
164
|
+
/**
|
|
165
|
+
* Maximum width for the area.
|
|
166
|
+
*/
|
|
167
|
+
maxWidth?: number | string;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
declare const BubbleGroup: react.ForwardRefExoticComponent<BubbleGroupProps & react.RefAttributes<HTMLDivElement>>;
|
|
171
|
+
|
|
172
|
+
interface BubbleToolbarComponent extends ForwardRefExoticComponent<BubbleToolbarProps & RefAttributes<HTMLDivElement>> {
|
|
173
|
+
Group: typeof BubbleGroup;
|
|
174
|
+
}
|
|
175
|
+
declare const BubbleToolbar: BubbleToolbarComponent;
|
|
176
|
+
|
|
177
|
+
declare const BubbleArea: react.ForwardRefExoticComponent<BubbleAreaProps & react.RefAttributes<HTMLDivElement>>;
|
|
178
|
+
|
|
179
|
+
declare const BubbleIconButton: react.ForwardRefExoticComponent<BubbleIconButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
180
|
+
|
|
181
|
+
interface BubbleToolbarContextValue extends BubbleActivityProps {
|
|
182
|
+
size: BubbleToolbarSize;
|
|
183
|
+
theme: BubbleToolbarTheme;
|
|
184
|
+
blurred: boolean;
|
|
185
|
+
blurAmount: number | string;
|
|
186
|
+
itemGap: number | string;
|
|
187
|
+
bordered: boolean;
|
|
188
|
+
shadow: boolean | string;
|
|
189
|
+
}
|
|
190
|
+
declare const BubbleToolbarContext: react.Context<BubbleToolbarContextValue>;
|
|
191
|
+
declare const useBubbleToolbar: () => BubbleToolbarContextValue;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Returns an array of non-null, non-undefined, non-boolean child elements.
|
|
195
|
+
* Unpacks Fragment if encountered at the top level.
|
|
196
|
+
*/
|
|
197
|
+
declare function getValidChildren(children: ReactNode): ReactNode[];
|
|
198
|
+
|
|
199
|
+
declare function resolveSize(size: BubbleToolbarSize): number;
|
|
200
|
+
declare function formatPx(val: number | string): string;
|
|
201
|
+
declare function getGlassStyles(theme: BubbleToolbarTheme, blurred: boolean, blurAmount: number | string, bordered: boolean, shadow: boolean | string): CSSProperties;
|
|
202
|
+
|
|
203
|
+
export { type BubbleActivityProps, type BubbleActivityValue, BubbleArea, type BubbleAreaProps, BubbleGroup, type BubbleGroupProps, BubbleIconButton, type BubbleIconButtonProps, type BubbleShape, BubbleToolbar, type BubbleToolbarComponent, BubbleToolbarContext, type BubbleToolbarPosition, type BubbleToolbarProps, type BubbleToolbarSize, type BubbleToolbarTheme, formatPx, getGlassStyles, getValidChildren, resolveSize, useBubbleActivity, useBubbleToolbar };
|