@stealthscale/component-actions 0.1.0 → 0.2.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.
- package/README.md +306 -23
- package/dist/cyclonedx/bom.json +1 -1
- package/dist/index.d.ts +440 -53
- package/dist/index.js +983 -18
- package/dist/recipe-BhcK7PNL.js +317 -0
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/theme.d.ts +3 -4
- package/dist/theme.js +11 -6
- package/package.json +39 -24
- package/dist/recipe-19HSwhAG.js +0 -70
package/dist/index.d.ts
CHANGED
|
@@ -1,99 +1,486 @@
|
|
|
1
|
-
import { ComponentProps, JSX } from "react";
|
|
1
|
+
import { ComponentProps, JSX, ReactElement, ReactNode } from "react";
|
|
2
|
+
import * as clipboard from "@zag-js/clipboard";
|
|
3
|
+
import { FileMimeType } from "@zag-js/file-utils";
|
|
4
|
+
import * as toggle from "@zag-js/toggle-group";
|
|
5
|
+
import { Group } from "@stealthscale/component-layout";
|
|
2
6
|
//#region src/button/button.d.ts
|
|
3
7
|
/**
|
|
4
|
-
*
|
|
8
|
+
* Renders an element with the button recipe's classes.
|
|
5
9
|
*/
|
|
6
|
-
|
|
7
|
-
readonly effect?: "glow" | "
|
|
8
|
-
readonly elevation?: import("@stealthscale/theme/authoring").Lift;
|
|
9
|
-
readonly
|
|
10
|
-
readonly
|
|
11
|
-
readonly
|
|
12
|
-
readonly variant?: "ghost" | "glass" | "outline" | "plain" | "solid" | "subtle" | "surface";
|
|
10
|
+
declare const Bound$1: import("@stealthscale/theme").StyledComponent<"button", {
|
|
11
|
+
readonly effect?: "glow" | "pulse" | undefined;
|
|
12
|
+
readonly elevation?: import("@stealthscale/theme/authoring").Lift | undefined;
|
|
13
|
+
readonly palette?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
14
|
+
readonly shape?: "square" | undefined;
|
|
15
|
+
readonly size?: import("@stealthscale/theme/authoring").Scale | undefined;
|
|
16
|
+
readonly variant?: "ghost" | "glass" | "outline" | "plain" | "solid" | "subtle" | "surface" | undefined;
|
|
13
17
|
}>;
|
|
14
18
|
/**
|
|
15
|
-
*
|
|
16
|
-
* element takes.
|
|
19
|
+
* Combines the recipe's variants with the props of a `button` element.
|
|
17
20
|
*/
|
|
18
|
-
type ButtonProps = ComponentProps<typeof
|
|
21
|
+
type ButtonProps = ComponentProps<typeof Bound$1>;
|
|
22
|
+
/**
|
|
23
|
+
* Renders a `button` element with `type` defaulting to `button`, so a button inside a form does not
|
|
24
|
+
* submit it.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* An element that `as` names takes a `type` only from the caller, because an `a` reads `type` as
|
|
28
|
+
* the media type of the page it opens.
|
|
29
|
+
* @param props - The recipe's variants and the props of the element.
|
|
30
|
+
* @returns The element with the button's classes.
|
|
31
|
+
*/
|
|
32
|
+
export declare function Button(props: ButtonProps): ReactElement;
|
|
19
33
|
//#endregion
|
|
20
34
|
//#region src/button/context.d.ts
|
|
21
35
|
/**
|
|
22
|
-
* Binds the button
|
|
36
|
+
* Binds the button recipe to the elements that render it.
|
|
23
37
|
*
|
|
24
38
|
* @remarks
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* every compiler configuration that reads it.
|
|
39
|
+
* The binding is kept out of `recipe.ts` because an application's style compiler imports the
|
|
40
|
+
* recipe at build time, and a binding there would pull the React runtime into that import.
|
|
28
41
|
*/
|
|
29
42
|
/**
|
|
30
|
-
*
|
|
31
|
-
* sets their variants
|
|
43
|
+
* Supplies the element factory `Button` and `IconButton` are built from, and the provider an
|
|
44
|
+
* ancestor sets their variants through.
|
|
32
45
|
*/
|
|
33
46
|
declare const PropsProvider: import("react").Provider<import("@stealthscale/theme").DataAttrs & Partial<{
|
|
34
|
-
readonly effect?: "glow" | "
|
|
35
|
-
readonly elevation?: import("@stealthscale/theme/authoring").Lift;
|
|
36
|
-
readonly
|
|
37
|
-
readonly
|
|
38
|
-
readonly
|
|
39
|
-
readonly variant?: "ghost" | "glass" | "outline" | "plain" | "solid" | "subtle" | "surface";
|
|
47
|
+
readonly effect?: "glow" | "pulse" | undefined;
|
|
48
|
+
readonly elevation?: import("@stealthscale/theme/authoring").Lift | undefined;
|
|
49
|
+
readonly palette?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
50
|
+
readonly shape?: "square" | undefined;
|
|
51
|
+
readonly size?: import("@stealthscale/theme/authoring").Scale | undefined;
|
|
52
|
+
readonly variant?: "ghost" | "glass" | "outline" | "plain" | "solid" | "subtle" | "surface" | undefined;
|
|
40
53
|
}>>, withContext: <Tag extends import("react").ElementType>(Component: Tag, options?: import("@stealthscale/theme").JsxFactoryOptions<import("@stealthscale/theme").ComponentProps<Tag> & Partial<{
|
|
41
|
-
readonly effect?: "glow" | "
|
|
42
|
-
readonly elevation?: import("@stealthscale/theme/authoring").Lift;
|
|
43
|
-
readonly
|
|
44
|
-
readonly
|
|
45
|
-
readonly
|
|
46
|
-
readonly variant?: "ghost" | "glass" | "outline" | "plain" | "solid" | "subtle" | "surface";
|
|
47
|
-
}
|
|
48
|
-
readonly effect?: "glow" | "
|
|
49
|
-
readonly elevation?: import("@stealthscale/theme/authoring").Lift;
|
|
50
|
-
readonly
|
|
51
|
-
readonly
|
|
52
|
-
readonly
|
|
53
|
-
readonly variant?: "ghost" | "glass" | "outline" | "plain" | "solid" | "subtle" | "surface";
|
|
54
|
+
readonly effect?: "glow" | "pulse" | undefined;
|
|
55
|
+
readonly elevation?: import("@stealthscale/theme/authoring").Lift | undefined;
|
|
56
|
+
readonly palette?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
57
|
+
readonly shape?: "square" | undefined;
|
|
58
|
+
readonly size?: import("@stealthscale/theme/authoring").Scale | undefined;
|
|
59
|
+
readonly variant?: "ghost" | "glass" | "outline" | "plain" | "solid" | "subtle" | "surface" | undefined;
|
|
60
|
+
}>, string> | undefined) => import("@stealthscale/theme").StyledComponent<Tag, {
|
|
61
|
+
readonly effect?: "glow" | "pulse" | undefined;
|
|
62
|
+
readonly elevation?: import("@stealthscale/theme/authoring").Lift | undefined;
|
|
63
|
+
readonly palette?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
64
|
+
readonly shape?: "square" | undefined;
|
|
65
|
+
readonly size?: import("@stealthscale/theme/authoring").Scale | undefined;
|
|
66
|
+
readonly variant?: "ghost" | "glass" | "outline" | "plain" | "solid" | "subtle" | "surface" | undefined;
|
|
54
67
|
}>;
|
|
55
68
|
//#endregion
|
|
56
69
|
//#region src/button/icon-button.d.ts
|
|
57
70
|
/**
|
|
58
|
-
*
|
|
71
|
+
* Renders an element with the button recipe's classes and `shape` defaulting to `square`.
|
|
59
72
|
*/
|
|
60
|
-
declare const
|
|
61
|
-
readonly effect?: "glow" | "
|
|
62
|
-
readonly elevation?: import("@stealthscale/theme/authoring").Lift;
|
|
63
|
-
readonly
|
|
64
|
-
readonly
|
|
65
|
-
readonly
|
|
66
|
-
readonly variant?: "ghost" | "glass" | "outline" | "plain" | "solid" | "subtle" | "surface";
|
|
73
|
+
declare const Bound: import("@stealthscale/theme").StyledComponent<"button", {
|
|
74
|
+
readonly effect?: "glow" | "pulse" | undefined;
|
|
75
|
+
readonly elevation?: import("@stealthscale/theme/authoring").Lift | undefined;
|
|
76
|
+
readonly palette?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
77
|
+
readonly shape?: "square" | undefined;
|
|
78
|
+
readonly size?: import("@stealthscale/theme/authoring").Scale | undefined;
|
|
79
|
+
readonly variant?: "ghost" | "glass" | "outline" | "plain" | "solid" | "subtle" | "surface" | undefined;
|
|
67
80
|
}>;
|
|
68
81
|
/**
|
|
69
|
-
*
|
|
82
|
+
* Renders a square `button` element with `type` defaulting to `button`.
|
|
83
|
+
*
|
|
84
|
+
* @remarks
|
|
85
|
+
* An element that `as` names takes a `type` only from the caller, because an `a` reads `type` as
|
|
86
|
+
* the media type of the page it opens.
|
|
87
|
+
* @param props - The recipe's variants and the props of the element.
|
|
88
|
+
* @returns The element with the button's classes.
|
|
89
|
+
*/
|
|
90
|
+
declare function Square(props: ComponentProps<typeof Bound>): ReactElement;
|
|
91
|
+
/**
|
|
92
|
+
* Describes the prop that gives the control its accessible name as text.
|
|
70
93
|
*/
|
|
71
94
|
interface Labelled {
|
|
72
95
|
/**
|
|
73
|
-
* The
|
|
96
|
+
* The accessible name a screen reader announces in place of the icon.
|
|
74
97
|
*/
|
|
75
98
|
"aria-label": string;
|
|
76
99
|
}
|
|
77
100
|
/**
|
|
78
|
-
*
|
|
101
|
+
* Describes the prop that takes the control's accessible name from another element.
|
|
79
102
|
*/
|
|
80
103
|
interface LabelledBy {
|
|
81
104
|
/**
|
|
82
|
-
* The id of the element
|
|
105
|
+
* The id of the element whose text names the control.
|
|
83
106
|
*/
|
|
84
107
|
"aria-labelledby": string;
|
|
85
108
|
}
|
|
86
109
|
/**
|
|
87
|
-
* Requires
|
|
110
|
+
* Requires `aria-label` or `aria-labelledby`.
|
|
88
111
|
*/
|
|
89
112
|
type Named = Labelled | LabelledBy;
|
|
90
113
|
/**
|
|
91
|
-
*
|
|
114
|
+
* Combines the square button's props with the accessible-name requirement.
|
|
92
115
|
*/
|
|
93
116
|
type IconButtonProps = ComponentProps<typeof Square> & Named;
|
|
94
117
|
/**
|
|
95
|
-
*
|
|
118
|
+
* Renders a square button around one icon, named by `aria-label` or `aria-labelledby`.
|
|
96
119
|
*/
|
|
97
120
|
export declare const IconButton: (props: IconButtonProps) => JSX.Element;
|
|
98
121
|
//#endregion
|
|
99
|
-
|
|
122
|
+
//#region src/clipboard/machine.d.ts
|
|
123
|
+
/**
|
|
124
|
+
* API returned by `clipboard.connect`: a prop getter per part, the machine state and its methods.
|
|
125
|
+
*
|
|
126
|
+
* @remarks
|
|
127
|
+
* The type derives from `connect`, so it follows the installed machine version. The derived type
|
|
128
|
+
* references `@zag-js/types`, so the package declares that package as a dependency. A
|
|
129
|
+
* declaration file that references an undeclared package does not resolve for a consumer.
|
|
130
|
+
*/
|
|
131
|
+
type ClipboardApi = ReturnType<typeof clipboard.connect>;
|
|
132
|
+
/**
|
|
133
|
+
* Machine settings a caller passes to the root, `id` included, all optional.
|
|
134
|
+
*
|
|
135
|
+
* @remarks
|
|
136
|
+
* `translations` is omitted. The trigger takes its accessible names as the props `label` and
|
|
137
|
+
* `copiedLabel`, because a component's words are props with English defaults.
|
|
138
|
+
*/
|
|
139
|
+
type ClipboardOptions = Omit<Partial<clipboard.Props>, "translations">;
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/clipboard/consumer.d.ts
|
|
142
|
+
/**
|
|
143
|
+
* Props of `Clipboard.Consumer`: the render function.
|
|
144
|
+
*/
|
|
145
|
+
interface ConsumerProps {
|
|
146
|
+
/**
|
|
147
|
+
* Render function called with the machine's API.
|
|
148
|
+
*/
|
|
149
|
+
readonly children: (api: ClipboardApi) => ReactNode;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Calls the render function with the API of the nearest root.
|
|
153
|
+
*
|
|
154
|
+
* @param props - The render function, as `children`.
|
|
155
|
+
* @returns The tree the render function returns.
|
|
156
|
+
*/
|
|
157
|
+
declare function Consumer({ children }: ConsumerProps): ReactNode;
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/clipboard/control.d.ts
|
|
160
|
+
/**
|
|
161
|
+
* `div` bound to the control slot.
|
|
162
|
+
*/
|
|
163
|
+
declare const Styled$6: import("@stealthscale/theme").StyledComponent<"div", {}>;
|
|
164
|
+
/**
|
|
165
|
+
* Props of `Clipboard.Control`: the props of the styled `div`.
|
|
166
|
+
*/
|
|
167
|
+
type ControlProps = ComponentProps<typeof Styled$6>;
|
|
168
|
+
/**
|
|
169
|
+
* Renders the row with the caller's props merged over the machine's.
|
|
170
|
+
*
|
|
171
|
+
* @param props - Props of the styled `div`.
|
|
172
|
+
* @returns The row, with the `data-copied` attribute the machine sets after a copy.
|
|
173
|
+
*/
|
|
174
|
+
declare function Control(props: ControlProps): ReactElement;
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/clipboard/indicator.d.ts
|
|
177
|
+
/**
|
|
178
|
+
* `span` bound to the indicator slot.
|
|
179
|
+
*/
|
|
180
|
+
declare const Styled$5: import("@stealthscale/theme").StyledComponent<"span", {}>;
|
|
181
|
+
/**
|
|
182
|
+
* Props of `Clipboard.Indicator`: the props of the styled `span` and the copied mark.
|
|
183
|
+
*/
|
|
184
|
+
interface IndicatorProps$1 extends ComponentProps<typeof Styled$5> {
|
|
185
|
+
/**
|
|
186
|
+
* Mark rendered during the copied state.
|
|
187
|
+
*/
|
|
188
|
+
readonly copied?: ReactNode;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Renders `children` in the idle state and `copied` in the copied state.
|
|
192
|
+
*
|
|
193
|
+
* @param props - The two marks and the props of the styled `span`.
|
|
194
|
+
* @returns The span, hidden from assistive technology unless the caller overrides `aria-hidden`.
|
|
195
|
+
*/
|
|
196
|
+
declare function Indicator$1({ children, copied, ...rest }: IndicatorProps$1): ReactElement;
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/clipboard/input.d.ts
|
|
199
|
+
/**
|
|
200
|
+
* `input` bound to the input slot.
|
|
201
|
+
*/
|
|
202
|
+
declare const Styled$4: import("@stealthscale/theme").StyledComponent<"input", {}>;
|
|
203
|
+
/**
|
|
204
|
+
* Props of `Clipboard.Input`: the props of the styled `input`.
|
|
205
|
+
*/
|
|
206
|
+
type InputProps = ComponentProps<typeof Styled$4>;
|
|
207
|
+
/**
|
|
208
|
+
* Renders the field with the caller's props merged over the machine's.
|
|
209
|
+
*
|
|
210
|
+
* @param props - Props of the styled `input`.
|
|
211
|
+
* @returns The read-only field that holds the machine's value.
|
|
212
|
+
*/
|
|
213
|
+
declare function Input(props: InputProps): ReactElement;
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/clipboard/label.d.ts
|
|
216
|
+
/**
|
|
217
|
+
* `label` bound to the label slot.
|
|
218
|
+
*/
|
|
219
|
+
declare const Styled$3: import("@stealthscale/theme").StyledComponent<"label", {}>;
|
|
220
|
+
/**
|
|
221
|
+
* Props of `Clipboard.Label`: the props of the styled `label`.
|
|
222
|
+
*/
|
|
223
|
+
type LabelProps = ComponentProps<typeof Styled$3>;
|
|
224
|
+
/**
|
|
225
|
+
* Renders the label with the caller's props merged over the machine's.
|
|
226
|
+
*
|
|
227
|
+
* @param props - Props of the styled `label`.
|
|
228
|
+
* @returns The label, whose `for` attribute points at the field.
|
|
229
|
+
*/
|
|
230
|
+
declare function Label(props: LabelProps): ReactElement;
|
|
231
|
+
//#endregion
|
|
232
|
+
//#region src/clipboard/root.d.ts
|
|
233
|
+
/**
|
|
234
|
+
* `div` bound to the root slot, which provides the recipe's variants to the parts.
|
|
235
|
+
*/
|
|
236
|
+
declare const Styled$2: import("@stealthscale/theme").StyledComponent<"div", {
|
|
237
|
+
readonly size?: "lg" | "md" | "sm" | undefined;
|
|
238
|
+
}>;
|
|
239
|
+
/**
|
|
240
|
+
* Props of `Clipboard.Root`: the machine settings and the props of the styled `div`.
|
|
241
|
+
*
|
|
242
|
+
* @remarks
|
|
243
|
+
* The element props omit `id` and `dir`, which the machine owns, and `defaultValue`, which is
|
|
244
|
+
* the machine's initial value.
|
|
245
|
+
*/
|
|
246
|
+
interface RootProps$2 extends ClipboardOptions, Omit<ComponentProps<typeof Styled$2>, "defaultValue" | "dir" | "id"> {}
|
|
247
|
+
/**
|
|
248
|
+
* Starts a clipboard machine and renders the container its parts read from.
|
|
249
|
+
*
|
|
250
|
+
* @param props - Machine settings, recipe variants and `div` props.
|
|
251
|
+
* @returns The container, with the connected API in context.
|
|
252
|
+
*/
|
|
253
|
+
declare function Root$2(props: RootProps$2): ReactElement;
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region src/clipboard/trigger.d.ts
|
|
256
|
+
/**
|
|
257
|
+
* `button` bound to the trigger slot.
|
|
258
|
+
*/
|
|
259
|
+
declare const Styled$1: import("@stealthscale/theme").StyledComponent<"button", {}>;
|
|
260
|
+
/**
|
|
261
|
+
* Props of `Clipboard.Trigger`: the two accessible names and the props of the styled `button`.
|
|
262
|
+
*/
|
|
263
|
+
interface TriggerProps extends ComponentProps<typeof Styled$1> {
|
|
264
|
+
/**
|
|
265
|
+
* Accessible name in the copied state. Defaults to "Copied to clipboard".
|
|
266
|
+
*/
|
|
267
|
+
readonly copiedLabel?: string | undefined;
|
|
268
|
+
/**
|
|
269
|
+
* Accessible name in the idle state. Defaults to "Copy to clipboard".
|
|
270
|
+
*/
|
|
271
|
+
readonly label?: string | undefined;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Renders the button with the caller's props merged over the machine's.
|
|
275
|
+
*
|
|
276
|
+
* @remarks
|
|
277
|
+
* An `aria-label` the caller passes takes precedence over both names.
|
|
278
|
+
* @param props - The two accessible names and the props of the styled `button`.
|
|
279
|
+
* @returns The button, wired to the machine's copy handler.
|
|
280
|
+
*/
|
|
281
|
+
declare function Trigger({ copiedLabel, label, ...rest }: TriggerProps): ReactElement;
|
|
282
|
+
//#endregion
|
|
283
|
+
//#region src/clipboard/value-text.d.ts
|
|
284
|
+
/**
|
|
285
|
+
* `span` bound to the valueText slot.
|
|
286
|
+
*/
|
|
287
|
+
declare const Styled: import("@stealthscale/theme").StyledComponent<"span", {}>;
|
|
288
|
+
/**
|
|
289
|
+
* Props of `Clipboard.ValueText`: the props of the styled `span`.
|
|
290
|
+
*/
|
|
291
|
+
type ValueTextProps = ComponentProps<typeof Styled>;
|
|
292
|
+
/**
|
|
293
|
+
* Renders the caller's children, or the machine's value when there are none.
|
|
294
|
+
*
|
|
295
|
+
* @param props - Props of the styled `span`.
|
|
296
|
+
* @returns The span with the children or the value.
|
|
297
|
+
*/
|
|
298
|
+
declare function ValueText({ children, ...rest }: ValueTextProps): ReactElement;
|
|
299
|
+
declare namespace index_d_exports {
|
|
300
|
+
export { Consumer, ConsumerProps, Control, ControlProps, Indicator$1 as Indicator, IndicatorProps$1 as IndicatorProps, Input, InputProps, Label, LabelProps, Root$2 as Root, RootProps$2 as RootProps, Trigger, TriggerProps, ValueText, ValueTextProps };
|
|
301
|
+
}
|
|
302
|
+
//#endregion
|
|
303
|
+
//#region src/color-mode-toggle/color-mode-toggle.d.ts
|
|
304
|
+
/**
|
|
305
|
+
* Describes the props of the toggle: its two glyphs, its name and the props of a `Button`.
|
|
306
|
+
*/
|
|
307
|
+
interface ColorModeToggleProps extends Omit<ButtonProps, "aria-label" | "aria-labelledby" | "aria-pressed" | "children"> {
|
|
308
|
+
/**
|
|
309
|
+
* Glyph shown while the page is dark.
|
|
310
|
+
*/
|
|
311
|
+
readonly dark: ReactNode;
|
|
312
|
+
/**
|
|
313
|
+
* Name of the button in both states, "Dark mode" unless the caller passes another.
|
|
314
|
+
*/
|
|
315
|
+
readonly label?: string | undefined;
|
|
316
|
+
/**
|
|
317
|
+
* Glyph shown while the page is light.
|
|
318
|
+
*/
|
|
319
|
+
readonly light: ReactNode;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Renders the actions `Button` as a ghost, neutral square that sets the other color mode on a press
|
|
323
|
+
* the caller did not cancel.
|
|
324
|
+
*
|
|
325
|
+
* @param props - The two glyphs, the name and the props of a `Button`.
|
|
326
|
+
* @returns The `button` element.
|
|
327
|
+
*/
|
|
328
|
+
export declare function ColorModeToggle({ dark, label, light, onClick, ...props }: ColorModeToggleProps): ReactElement;
|
|
329
|
+
//#endregion
|
|
330
|
+
//#region src/download-trigger/download.d.ts
|
|
331
|
+
/**
|
|
332
|
+
* Contents of a file: text, a `Blob` or a `File`.
|
|
333
|
+
*/
|
|
334
|
+
type DownloadableData = Blob | string;
|
|
335
|
+
/**
|
|
336
|
+
* Options of `download`, which `DownloadTrigger` takes as props.
|
|
337
|
+
*/
|
|
338
|
+
interface DownloadOptions {
|
|
339
|
+
/**
|
|
340
|
+
* Contents of the file, or a function called on every download that returns them or a promise of
|
|
341
|
+
* them.
|
|
342
|
+
*/
|
|
343
|
+
readonly data: (() => DownloadableData | Promise<DownloadableData>) | DownloadableData;
|
|
344
|
+
/**
|
|
345
|
+
* Name the browser saves the file under, extension included.
|
|
346
|
+
*/
|
|
347
|
+
readonly fileName: string;
|
|
348
|
+
/**
|
|
349
|
+
* Type of text data. A `Blob` or a `File` keeps its own type.
|
|
350
|
+
*/
|
|
351
|
+
readonly mimeType?: FileMimeType | undefined;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Resolves the data and hands it to the browser as a file.
|
|
355
|
+
*
|
|
356
|
+
* @returns A promise that settles once the browser has the file, and rejects when the data
|
|
357
|
+
* function throws or its promise rejects.
|
|
358
|
+
*/
|
|
359
|
+
export declare function download({ data, fileName, mimeType }: DownloadOptions): Promise<void>;
|
|
360
|
+
//#endregion
|
|
361
|
+
//#region src/download-trigger/download-trigger.d.ts
|
|
362
|
+
/**
|
|
363
|
+
* Props of `DownloadTrigger`: the download options and the props of `Button`.
|
|
364
|
+
*/
|
|
365
|
+
interface DownloadTriggerProps extends ButtonProps, DownloadOptions {}
|
|
366
|
+
/**
|
|
367
|
+
* Renders a button that downloads `data` as `fileName` when pressed.
|
|
368
|
+
*
|
|
369
|
+
* @remarks
|
|
370
|
+
* `onClick` runs first. A handler that calls `preventDefault` cancels the download.
|
|
371
|
+
*/
|
|
372
|
+
export declare function DownloadTrigger({ data, fileName, mimeType, onClick, ...rest }: DownloadTriggerProps): ReactElement;
|
|
373
|
+
//#endregion
|
|
374
|
+
//#region src/swap/indicator.d.ts
|
|
375
|
+
/**
|
|
376
|
+
* Renders the `span` with the swap's indicator class.
|
|
377
|
+
*/
|
|
378
|
+
declare const Drawn: import("@stealthscale/theme").StyledComponent<"span", {}>;
|
|
379
|
+
/**
|
|
380
|
+
* Describes the props of an indicator: which mark it is and the props of a `span`, without `ref`,
|
|
381
|
+
* which the presence takes.
|
|
382
|
+
*/
|
|
383
|
+
interface IndicatorProps extends Omit<ComponentProps<typeof Drawn>, "ref"> {
|
|
384
|
+
/**
|
|
385
|
+
* Which mark this is: `on` shows while the root's `swap` is true, `off` while it is false.
|
|
386
|
+
*/
|
|
387
|
+
readonly type: "off" | "on";
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Renders the mark with its presence's `data-state` and `inert`, and `data-hidden` in place of
|
|
391
|
+
* `hidden`, under the caller's props.
|
|
392
|
+
*
|
|
393
|
+
* @param props - Which mark this is and the props of a `span`.
|
|
394
|
+
* @returns The `span` element, or nothing while the presence renders nothing.
|
|
395
|
+
*/
|
|
396
|
+
declare function Indicator({ type, ...props }: IndicatorProps): null | ReactElement;
|
|
397
|
+
//#endregion
|
|
398
|
+
//#region src/swap/root.d.ts
|
|
399
|
+
/**
|
|
400
|
+
* Renders the `span` with the swap's root class.
|
|
401
|
+
*/
|
|
402
|
+
declare const Framed: import("@stealthscale/theme").StyledComponent<"span", {
|
|
403
|
+
readonly motion?: "fade" | "none" | "scale" | "slide" | undefined;
|
|
404
|
+
}>;
|
|
405
|
+
/**
|
|
406
|
+
* Describes the props of the root: which mark shows, how the marks render while hidden, the
|
|
407
|
+
* recipe's `motion` and the props of a `span`.
|
|
408
|
+
*/
|
|
409
|
+
interface RootProps$1 extends ComponentProps<typeof Framed> {
|
|
410
|
+
/**
|
|
411
|
+
* Whether a mark renders nothing until it first shows. False unless the caller passes true.
|
|
412
|
+
*/
|
|
413
|
+
readonly lazyMount?: boolean | undefined;
|
|
414
|
+
/**
|
|
415
|
+
* Whether the `on` mark shows. False unless the caller passes true, which shows the `off` mark.
|
|
416
|
+
*/
|
|
417
|
+
readonly swap?: boolean | undefined;
|
|
418
|
+
/**
|
|
419
|
+
* Whether a mark renders nothing once its exit motion ends. False unless the caller passes true.
|
|
420
|
+
*/
|
|
421
|
+
readonly unmountOnExit?: boolean | undefined;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Renders the root and provides which mark shows to the indicators.
|
|
425
|
+
*
|
|
426
|
+
* @param props - Which mark shows, how the marks render while hidden, the motion and the props of a
|
|
427
|
+
* `span`.
|
|
428
|
+
* @returns The `span` element inside the state's provider.
|
|
429
|
+
*/
|
|
430
|
+
declare function Root$1({ lazyMount, swap, unmountOnExit, ...props }: RootProps$1): ReactElement;
|
|
431
|
+
declare namespace index_d_exports$1 {
|
|
432
|
+
export { Indicator, IndicatorProps, Root$1 as Root, RootProps$1 as RootProps };
|
|
433
|
+
}
|
|
434
|
+
//#endregion
|
|
435
|
+
//#region src/toggle-group/machine.d.ts
|
|
436
|
+
/**
|
|
437
|
+
* Describes the machine options the root takes, every one optional.
|
|
438
|
+
*/
|
|
439
|
+
type ToggleGroupOptions = Partial<toggle.Props>;
|
|
440
|
+
/**
|
|
441
|
+
* Describes the options of one item: its value, and whether it is disabled.
|
|
442
|
+
*/
|
|
443
|
+
type ItemOptions = toggle.ItemProps;
|
|
444
|
+
/**
|
|
445
|
+
* Describes what `onValueChange` receives: the values of the items that are on.
|
|
446
|
+
*/
|
|
447
|
+
type ValueChangeDetails = toggle.ValueChangeDetails;
|
|
448
|
+
//#endregion
|
|
449
|
+
//#region src/toggle-group/item.d.ts
|
|
450
|
+
/**
|
|
451
|
+
* Describes the props of an item: its value, whether it is disabled, and the props of the button.
|
|
452
|
+
*
|
|
453
|
+
* @remarks
|
|
454
|
+
* The button's own `value` is left out, so `value` names the item.
|
|
455
|
+
*/
|
|
456
|
+
interface ItemProps extends ItemOptions, Omit<ButtonProps, keyof ItemOptions> {}
|
|
457
|
+
/**
|
|
458
|
+
* Renders the item as a button with the machine's item props.
|
|
459
|
+
*
|
|
460
|
+
* @param props - The item's options and the props of the button.
|
|
461
|
+
* @returns The `button` element.
|
|
462
|
+
*/
|
|
463
|
+
declare function Item(props: ItemProps): ReactElement;
|
|
464
|
+
//#endregion
|
|
465
|
+
//#region src/toggle-group/root.d.ts
|
|
466
|
+
/**
|
|
467
|
+
* Describes the props of the root: the machine's options, the props of the layout's `Group`, and
|
|
468
|
+
* the size, look and palette of the items.
|
|
469
|
+
*
|
|
470
|
+
* @remarks
|
|
471
|
+
* The group's own props of the same names as the machine's options are left out, so no prop has
|
|
472
|
+
* two types.
|
|
473
|
+
*/
|
|
474
|
+
interface RootProps extends Omit<ComponentProps<typeof Group>, keyof ToggleGroupOptions>, Pick<ButtonProps, "palette" | "size" | "variant">, ToggleGroupOptions {}
|
|
475
|
+
/**
|
|
476
|
+
* Renders the group and provides the machine's api and the items' variants.
|
|
477
|
+
*
|
|
478
|
+
* @param props - The machine's options, the group's props and the items' variants.
|
|
479
|
+
* @returns The `div` element that contains the items.
|
|
480
|
+
*/
|
|
481
|
+
declare function Root(props: RootProps): ReactElement;
|
|
482
|
+
declare namespace index_d_exports$2 {
|
|
483
|
+
export { Item, ItemProps, Root, RootProps, ValueChangeDetails };
|
|
484
|
+
}
|
|
485
|
+
//#endregion
|
|
486
|
+
export { type ButtonProps, PropsProvider as ButtonPropsProvider, index_d_exports as Clipboard, type ColorModeToggleProps, type DownloadOptions, type DownloadTriggerProps, type DownloadableData, type IconButtonProps, index_d_exports$1 as Swap, index_d_exports$2 as ToggleGroup };
|