@allxsmith/bestax-bulma 5.62.0 → 5.64.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/dist/bestax.css +1 -1
- package/dist/bestax.css.map +1 -1
- package/dist/esm/components/EmptyState.js +2 -6
- package/dist/esm/components/EmptyState.js.map +1 -1
- package/dist/esm/components/ScrollArea.js +7 -7
- package/dist/esm/components/ScrollArea.js.map +1 -1
- package/dist/esm/components/TableOfContents.js +85 -0
- package/dist/esm/components/TableOfContents.js.map +1 -0
- package/dist/esm/components/Timeline.js +5 -9
- package/dist/esm/components/Timeline.js.map +1 -1
- package/dist/esm/components/TreeView.js +3 -7
- package/dist/esm/components/TreeView.js.map +1 -1
- package/dist/esm/elements/Buttons.js +2 -0
- package/dist/esm/elements/Buttons.js.map +1 -1
- package/dist/esm/elements/CopyButton.js +132 -0
- package/dist/esm/elements/CopyButton.js.map +1 -0
- package/dist/esm/elements/DescriptionList.js +1 -5
- package/dist/esm/elements/DescriptionList.js.map +1 -1
- package/dist/esm/elements/Stat.js +196 -0
- package/dist/esm/elements/Stat.js.map +1 -0
- package/dist/esm/elements/Stats.js +48 -0
- package/dist/esm/elements/Stats.js.map +1 -0
- package/dist/esm/elements/statContext.js +10 -0
- package/dist/esm/elements/statContext.js.map +1 -0
- package/dist/esm/form/Combobox.js +2 -1
- package/dist/esm/form/Combobox.js.map +1 -1
- package/dist/esm/form/PasswordInput.js +105 -0
- package/dist/esm/form/PasswordInput.js.map +1 -0
- package/dist/esm/form/PasswordInputBase.js +177 -0
- package/dist/esm/form/PasswordInputBase.js.map +1 -0
- package/dist/esm/helpers/checkIcon.js +20 -0
- package/dist/esm/helpers/checkIcon.js.map +1 -0
- package/dist/esm/helpers/isGiven.js +13 -0
- package/dist/esm/helpers/isGiven.js.map +1 -0
- package/dist/esm/helpers/statusRegion.js +3 -3
- package/dist/esm/helpers/useClipboard.js +176 -0
- package/dist/esm/helpers/useClipboard.js.map +1 -0
- package/dist/esm/helpers/useScrollSpy.js +286 -0
- package/dist/esm/helpers/useScrollSpy.js.map +1 -0
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +2671 -1544
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +8 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/types/components/TableOfContents.d.ts +87 -0
- package/dist/types/elements/Buttons.d.ts +1 -0
- package/dist/types/elements/CopyButton.d.ts +105 -0
- package/dist/types/elements/Stat.d.ts +242 -0
- package/dist/types/elements/Stats.d.ts +40 -0
- package/dist/types/elements/statContext.d.ts +18 -0
- package/dist/types/form/PasswordInput.d.ts +98 -0
- package/dist/types/form/PasswordInputBase.d.ts +91 -0
- package/dist/types/helpers/checkIcon.d.ts +10 -0
- package/dist/types/helpers/isGiven.d.ts +7 -0
- package/dist/types/helpers/useClipboard.d.ts +65 -0
- package/dist/types/helpers/useScrollSpy.d.ts +61 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types-cjs/components/TableOfContents.d.ts +87 -0
- package/dist/types-cjs/elements/Buttons.d.ts +1 -0
- package/dist/types-cjs/elements/CopyButton.d.ts +105 -0
- package/dist/types-cjs/elements/Stat.d.ts +242 -0
- package/dist/types-cjs/elements/Stats.d.ts +40 -0
- package/dist/types-cjs/elements/statContext.d.ts +18 -0
- package/dist/types-cjs/form/PasswordInput.d.ts +98 -0
- package/dist/types-cjs/form/PasswordInputBase.d.ts +91 -0
- package/dist/types-cjs/helpers/checkIcon.d.ts +10 -0
- package/dist/types-cjs/helpers/isGiven.d.ts +7 -0
- package/dist/types-cjs/helpers/useClipboard.d.ts +65 -0
- package/dist/types-cjs/helpers/useScrollSpy.d.ts +61 -0
- package/dist/types-cjs/index.d.ts +10 -0
- package/dist/versions/bestax-no-dark-mode.css +1 -1
- package/dist/versions/bestax-no-dark-mode.css.map +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
- package/dist/versions/bestax-no-helpers.css +1 -1
- package/dist/versions/bestax-no-helpers.css.map +1 -1
- package/dist/versions/bestax-prefixed.css +1 -1
- package/dist/versions/bestax-prefixed.css.map +1 -1
- package/package.json +1 -1
- package/src/scss/CLAUDE.md +3 -0
- package/src/scss/_input-trigger.scss +76 -0
- package/src/scss/components/_index.scss +1 -0
- package/src/scss/components/_tableofcontents.scss +42 -0
- package/src/scss/elements/_index.scss +1 -0
- package/src/scss/elements/_stat.scss +153 -0
- package/src/scss/form/_index.scss +1 -0
- package/src/scss/form/_passwordinput.scss +112 -0
- package/src/scss/form/_picker-popover.scss +24 -63
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BulmaClassesProps, validColors } from '../helpers/useBulmaClasses.js';
|
|
3
|
+
/** The colors a Stat's change can take, the union `messageColor` takes. */
|
|
4
|
+
export type StatChangeColor = 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';
|
|
5
|
+
/**
|
|
6
|
+
* Props for the Stat component. The helper props, the other attributes and
|
|
7
|
+
* the `ref` land on its root: a `<div>` inside `Stats`, or its own `<dl>` on
|
|
8
|
+
* its own.
|
|
9
|
+
*
|
|
10
|
+
* @extraProp {React.Ref<HTMLElement>} [ref] - Ref forwarded to the root, a `<div>` inside `Stats` or a `<dl>` on its own.
|
|
11
|
+
*/
|
|
12
|
+
export interface StatProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
|
|
13
|
+
/** Additional CSS classes to apply. */
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* What the figure is ("Revenue"), as a `Stat.Label` before the children.
|
|
17
|
+
* A Stat needs one, here or as a `Stat.Label` child: it's the figure's
|
|
18
|
+
* name for assistive tech, and a definition list's values belong to a
|
|
19
|
+
* term. A Stat with neither a `label` nor a `Stat.Label` child warns in
|
|
20
|
+
* development.
|
|
21
|
+
*/
|
|
22
|
+
label?: React.ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* The figure, as a `Stat.Value` after the children. A number is written by
|
|
25
|
+
* `NumberFormatter` with `format` and `locale`; anything else, such as
|
|
26
|
+
* "N/A", renders as given, and `0` renders. `undefined`, `null`, a boolean
|
|
27
|
+
* and `''` leave it empty, and its `<dd>` still renders, one line of the
|
|
28
|
+
* figure tall, while the Stat has a label, so the label keeps its
|
|
29
|
+
* definition while the figure is missing. A `Stat.Value` child takes its
|
|
30
|
+
* place: with one, `value` and its `<dd>` are left out.
|
|
31
|
+
*/
|
|
32
|
+
value?: React.ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* `Intl.NumberFormat` options for a number `value`, as NumberFormatter's
|
|
35
|
+
* `format`. A `value` that isn't a number ignores it.
|
|
36
|
+
*/
|
|
37
|
+
format?: Intl.NumberFormatOptions;
|
|
38
|
+
/**
|
|
39
|
+
* The locale for `value` and `change`, as NumberFormatter's `locale`.
|
|
40
|
+
* Unset, it's the `LocaleProvider`'s around it, and with neither, the
|
|
41
|
+
* runtime's own, so give one, here or through a `LocaleProvider`, on a
|
|
42
|
+
* page rendered on the server.
|
|
43
|
+
*/
|
|
44
|
+
locale?: string;
|
|
45
|
+
/**
|
|
46
|
+
* The change, as a `Stat.Change` after the value. With the default format
|
|
47
|
+
* it's a fraction (`0.12` for 12%); with your own `changeFormat`, it's in
|
|
48
|
+
* that format's terms. It's written with its sign, so the direction is in
|
|
49
|
+
* the text.
|
|
50
|
+
*/
|
|
51
|
+
change?: number;
|
|
52
|
+
/**
|
|
53
|
+
* `Intl.NumberFormat` options for `change`. Yours replace the default, and
|
|
54
|
+
* `signDisplay: 'exceptZero'` is added unless you set a `signDisplay`. With
|
|
55
|
+
* `signDisplay: 'never'`, or `'negative'` on a rise, the text carries no
|
|
56
|
+
* direction: the arrow is hidden from assistive tech and the tone is color
|
|
57
|
+
* alone, so keep a sign, or say the direction in `description`.
|
|
58
|
+
* @defaultValue { style: 'percent', signDisplay: 'exceptZero', maximumFractionDigits: 1 }
|
|
59
|
+
*/
|
|
60
|
+
changeFormat?: Intl.NumberFormatOptions;
|
|
61
|
+
/**
|
|
62
|
+
* The change's color. Unset, it's the sign's: `success` up, `danger` down,
|
|
63
|
+
* and none at zero. Set it where up is bad news, such as a cost or an
|
|
64
|
+
* error rate.
|
|
65
|
+
*/
|
|
66
|
+
changeColor?: StatChangeColor;
|
|
67
|
+
/** A note under the figure ("since last month"), as a `Stat.Description` last. */
|
|
68
|
+
description?: React.ReactNode;
|
|
69
|
+
/**
|
|
70
|
+
* The figure's size, a step of Bulma's size scale. The label, the change
|
|
71
|
+
* and the note stay small.
|
|
72
|
+
*/
|
|
73
|
+
size?: 'small' | 'medium' | 'large';
|
|
74
|
+
/**
|
|
75
|
+
* Shows a `Skeleton` in place of `value`, one line of the figure tall,
|
|
76
|
+
* and sets `aria-busy` on the Stat. The label, the change and the note
|
|
77
|
+
* render as given. With a `Stat.Value` child, it only sets `aria-busy`:
|
|
78
|
+
* the child renders as given, so put a `Skeleton` in it yourself.
|
|
79
|
+
*/
|
|
80
|
+
loading?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* `Stat.Label`, `Stat.Value`, `Stat.Change` and `Stat.Description`, for
|
|
83
|
+
* anything the props don't cover, such as a unit or an info tip. They
|
|
84
|
+
* render between `label` and `value`. They're this Stat's own parts, so
|
|
85
|
+
* not another Stat: that would be a list inside this one's. The Stat finds
|
|
86
|
+
* a `Stat.Label` or `Stat.Value` among them by type, so one rendered from
|
|
87
|
+
* inside a component of your own isn't seen.
|
|
88
|
+
*/
|
|
89
|
+
children?: React.ReactNode;
|
|
90
|
+
/**
|
|
91
|
+
* Text color helper. It colors the figure; the label, the change and the
|
|
92
|
+
* note keep their own colors. Inside `Stats`, a Stat without one takes the
|
|
93
|
+
* row's.
|
|
94
|
+
*/
|
|
95
|
+
textColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
96
|
+
/** Background color helper. */
|
|
97
|
+
bgColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Props for Stat.Label, what the figure is. The helper props, the other
|
|
101
|
+
* attributes and the `ref` land on its `<dt>`.
|
|
102
|
+
*
|
|
103
|
+
* @extraProp {React.Ref<HTMLElement>} [ref] - Ref forwarded to the `<dt>`.
|
|
104
|
+
*/
|
|
105
|
+
export interface StatLabelProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
|
|
106
|
+
/** Additional CSS classes to apply. */
|
|
107
|
+
className?: string;
|
|
108
|
+
/**
|
|
109
|
+
* The label. A button may sit in it, such as one that opens a `Popover`
|
|
110
|
+
* about the figure, but not a heading, which HTML doesn't allow here.
|
|
111
|
+
*/
|
|
112
|
+
children?: React.ReactNode;
|
|
113
|
+
/** Text color helper. */
|
|
114
|
+
textColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
115
|
+
/** Background color helper. */
|
|
116
|
+
bgColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Props for Stat.Value, the figure. The helper props, the other attributes
|
|
120
|
+
* and the `ref` land on its `<dd>`.
|
|
121
|
+
*
|
|
122
|
+
* @extraProp {React.Ref<HTMLElement>} [ref] - Ref forwarded to the `<dd>`.
|
|
123
|
+
*/
|
|
124
|
+
export interface StatValueProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
|
|
125
|
+
/** Additional CSS classes to apply. */
|
|
126
|
+
className?: string;
|
|
127
|
+
/**
|
|
128
|
+
* The figure, written as you give it, so write a number with
|
|
129
|
+
* `NumberFormatter`.
|
|
130
|
+
*/
|
|
131
|
+
children?: React.ReactNode;
|
|
132
|
+
/** Text color helper. */
|
|
133
|
+
textColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
134
|
+
/** Background color helper. */
|
|
135
|
+
bgColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Props for Stat.Description, a note under the figure. The helper props, the
|
|
139
|
+
* other attributes and the `ref` land on its `<dd>`.
|
|
140
|
+
*
|
|
141
|
+
* @extraProp {React.Ref<HTMLElement>} [ref] - Ref forwarded to the `<dd>`.
|
|
142
|
+
*/
|
|
143
|
+
export interface StatDescriptionProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
|
|
144
|
+
/** Additional CSS classes to apply. */
|
|
145
|
+
className?: string;
|
|
146
|
+
/** The note, such as "since last month". */
|
|
147
|
+
children?: React.ReactNode;
|
|
148
|
+
/** Text color helper. */
|
|
149
|
+
textColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
150
|
+
/** Background color helper. */
|
|
151
|
+
bgColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Props for Stat.Change, a change written with its sign. The helper props,
|
|
155
|
+
* the other attributes and the `ref` land on its `<dd>`.
|
|
156
|
+
*
|
|
157
|
+
* @extraProp {React.Ref<HTMLElement>} [ref] - Ref forwarded to the `<dd>`.
|
|
158
|
+
*/
|
|
159
|
+
export interface StatChangeProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color' | 'children'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
|
|
160
|
+
/** Additional CSS classes to apply. */
|
|
161
|
+
className?: string;
|
|
162
|
+
/**
|
|
163
|
+
* The change, as Stat's `change`. One that rounds to zero in its format,
|
|
164
|
+
* such as `0.0004` at one decimal place of a percentage, reads as zero, so
|
|
165
|
+
* it gets no arrow and no color of its own.
|
|
166
|
+
*/
|
|
167
|
+
value: number;
|
|
168
|
+
/**
|
|
169
|
+
* As Stat's `changeFormat`: yours replace the default, and
|
|
170
|
+
* `signDisplay: 'exceptZero'` is added unless you set a `signDisplay`.
|
|
171
|
+
* @defaultValue { style: 'percent', signDisplay: 'exceptZero', maximumFractionDigits: 1 }
|
|
172
|
+
*/
|
|
173
|
+
format?: Intl.NumberFormatOptions;
|
|
174
|
+
/** As Stat's `locale`. Unset, the Stat's. */
|
|
175
|
+
locale?: string;
|
|
176
|
+
/**
|
|
177
|
+
* As Stat's `changeColor`. Unset, it's the sign's: `success` up, `danger`
|
|
178
|
+
* down, and none at zero. Set, it applies at zero too.
|
|
179
|
+
*/
|
|
180
|
+
color?: StatChangeColor;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* What the figure is: a `<dt>`, small and in the weaker text color.
|
|
184
|
+
*
|
|
185
|
+
* @function
|
|
186
|
+
* @param {StatLabelProps} props - Props for Stat.Label.
|
|
187
|
+
* @param {React.Ref<HTMLElement>} ref - Forwarded ref to the `<dt>`.
|
|
188
|
+
* @returns {JSX.Element} The rendered label.
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* <Stat.Label>Revenue</Stat.Label>
|
|
192
|
+
*/
|
|
193
|
+
export declare const StatLabel: React.ForwardRefExoticComponent<StatLabelProps & React.RefAttributes<HTMLElement>>;
|
|
194
|
+
/**
|
|
195
|
+
* The figure: a `<dd>`, large, in the Stat's color, with digits of one width so a figure that updates doesn't shift.
|
|
196
|
+
*
|
|
197
|
+
* @function
|
|
198
|
+
* @param {StatValueProps} props - Props for Stat.Value.
|
|
199
|
+
* @param {React.Ref<HTMLElement>} ref - Forwarded ref to the `<dd>`.
|
|
200
|
+
* @returns {JSX.Element} The rendered figure.
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* <Stat.Value>
|
|
204
|
+
* <NumberFormatter value={182} format={{ style: 'unit', unit: 'millisecond' }} />
|
|
205
|
+
* </Stat.Value>
|
|
206
|
+
*/
|
|
207
|
+
export declare const StatValue: React.ForwardRefExoticComponent<StatValueProps & React.RefAttributes<HTMLElement>>;
|
|
208
|
+
/**
|
|
209
|
+
* A note under the figure: a `<dd>`, small and in the weaker text color.
|
|
210
|
+
*
|
|
211
|
+
* @function
|
|
212
|
+
* @param {StatDescriptionProps} props - Props for Stat.Description.
|
|
213
|
+
* @param {React.Ref<HTMLElement>} ref - Forwarded ref to the `<dd>`.
|
|
214
|
+
* @returns {JSX.Element} The rendered note.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* <Stat.Description>since last month</Stat.Description>
|
|
218
|
+
*/
|
|
219
|
+
export declare const StatDescription: React.ForwardRefExoticComponent<StatDescriptionProps & React.RefAttributes<HTMLElement>>;
|
|
220
|
+
/**
|
|
221
|
+
* A change written with its sign, such as "+12%", after an arrow that repeats the direction: a `<dd>`, green when it's up and red when it's down unless `color` says otherwise.
|
|
222
|
+
*
|
|
223
|
+
* The sign is in the text, written by `Intl` for the locale, so a screen
|
|
224
|
+
* reader hears the direction; the arrow is hidden from assistive tech, and
|
|
225
|
+
* the color repeats the direction for sighted readers rather than carry it.
|
|
226
|
+
*
|
|
227
|
+
* @function
|
|
228
|
+
* @param {StatChangeProps} props - Props for Stat.Change.
|
|
229
|
+
* @param {React.Ref<HTMLElement>} ref - Forwarded ref to the `<dd>`.
|
|
230
|
+
* @returns {JSX.Element} The rendered change.
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* <Stat.Change value={-0.08} color="success" />
|
|
234
|
+
*/
|
|
235
|
+
export declare const StatChange: React.ForwardRefExoticComponent<StatChangeProps & React.RefAttributes<HTMLElement>>;
|
|
236
|
+
export declare const Stat: React.ForwardRefExoticComponent<StatProps & React.RefAttributes<HTMLElement>> & {
|
|
237
|
+
Label: React.ForwardRefExoticComponent<StatLabelProps & React.RefAttributes<HTMLElement>>;
|
|
238
|
+
Value: React.ForwardRefExoticComponent<StatValueProps & React.RefAttributes<HTMLElement>>;
|
|
239
|
+
Change: React.ForwardRefExoticComponent<StatChangeProps & React.RefAttributes<HTMLElement>>;
|
|
240
|
+
Description: React.ForwardRefExoticComponent<StatDescriptionProps & React.RefAttributes<HTMLElement>>;
|
|
241
|
+
};
|
|
242
|
+
export default Stat;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BulmaClassesProps, validColors } from '../helpers/useBulmaClasses.js';
|
|
3
|
+
import type { BulmaMinColValue } from '../grid/Grid.js';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the Stats component, a row of Stats on Bulma's smart grid. The
|
|
6
|
+
* helper props, the other attributes and the `ref` land on its `<dl>`.
|
|
7
|
+
*
|
|
8
|
+
* @extraProp {React.Ref<HTMLDListElement>} [ref] - Ref forwarded to the `<dl>`.
|
|
9
|
+
* @extraProp {BulmaGapStep} [gap] - The space between tiles (`is-gap-*`), the helper prop with the values Grid's `gap` takes.
|
|
10
|
+
* @extraProp {string} [aria-labelledby] - The id of the heading above the row, which names it.
|
|
11
|
+
*/
|
|
12
|
+
export interface StatsProps extends Omit<React.HTMLAttributes<HTMLDListElement>, 'color'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
|
|
13
|
+
/** Additional CSS classes to apply. */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** `Stat`s, one per figure, and nothing else: they're the groups of its `<dl>`. */
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* The narrowest a tile gets before the row wraps (`is-col-min-*`), as
|
|
19
|
+
* Grid's `minCol`: 1.5rem a step. Unset, it's Bulma's 9rem.
|
|
20
|
+
*/
|
|
21
|
+
minCol?: BulmaMinColValue;
|
|
22
|
+
/**
|
|
23
|
+
* Text color helper: `has-text-*` on the `<dl>`, as on Buttons. Each Stat
|
|
24
|
+
* in the row without a `textColor` of its own takes it too, which colors
|
|
25
|
+
* its figure, since a Stat sets its own color. The labels, the changes and
|
|
26
|
+
* the notes keep theirs.
|
|
27
|
+
*/
|
|
28
|
+
textColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
29
|
+
/** Background color helper. */
|
|
30
|
+
bgColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
31
|
+
}
|
|
32
|
+
export declare const Stats: React.ForwardRefExoticComponent<StatsProps & React.RefAttributes<HTMLDListElement>> & {
|
|
33
|
+
Stat: React.ForwardRefExoticComponent<import("./Stat.js").StatProps & React.RefAttributes<HTMLElement>> & {
|
|
34
|
+
Label: React.ForwardRefExoticComponent<import("./Stat.js").StatLabelProps & React.RefAttributes<HTMLElement>>;
|
|
35
|
+
Value: React.ForwardRefExoticComponent<import("./Stat.js").StatValueProps & React.RefAttributes<HTMLElement>>;
|
|
36
|
+
Change: React.ForwardRefExoticComponent<import("./Stat.js").StatChangeProps & React.RefAttributes<HTMLElement>>;
|
|
37
|
+
Description: React.ForwardRefExoticComponent<import("./Stat.js").StatDescriptionProps & React.RefAttributes<HTMLElement>>;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export default Stats;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { validColors } from '../helpers/useBulmaClasses.js';
|
|
2
|
+
export interface StatScope {
|
|
3
|
+
/**
|
|
4
|
+
* Whether this is inside a `Stats` row, where a Stat is a `<div>` in the
|
|
5
|
+
* row's `<dl>` rather than a `<dl>` of its own. A Stat sets it back to
|
|
6
|
+
* `false` for its children. Those are meant to be its parts, so a Stat
|
|
7
|
+
* inside a part sits in a `<dd>`, where a `<dl>` of its own is valid. A
|
|
8
|
+
* Stat written straight among another's children isn't handled: it renders
|
|
9
|
+
* a `<dl>` inside the other's list, which HTML doesn't allow, and Stat's
|
|
10
|
+
* `children` TSDoc says not to.
|
|
11
|
+
*/
|
|
12
|
+
row: boolean;
|
|
13
|
+
/** The row's `textColor`, which each Stat in it takes unless it has its own. */
|
|
14
|
+
textColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
15
|
+
/** The Stat's `locale`, which a `Stat.Change` in it takes unless it has its own. */
|
|
16
|
+
locale?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const StatScopeContext: import("react").Context<StatScope>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FieldProps } from './Field.js';
|
|
3
|
+
import { ControlBaseProps } from './Control.js';
|
|
4
|
+
import { PasswordInputBaseProps } from './PasswordInputBase.js';
|
|
5
|
+
/**
|
|
6
|
+
* Props for the PasswordInput component: PasswordInputBase's, plus Input's
|
|
7
|
+
* Field and Control props, except the right icon, whose place the toggle
|
|
8
|
+
* takes. Inside an existing `Control` it renders no `Control` of its own, so
|
|
9
|
+
* its Control-level props do nothing there and warn in development; set them
|
|
10
|
+
* on that `Control` instead. Inside an outer `Field`, or a `Control` with no
|
|
11
|
+
* `Field` around it, it renders no `Field` of its own either. The exception
|
|
12
|
+
* is `label`, `message`, `horizontal` or `fieldClassName` in that bare
|
|
13
|
+
* `Control`: it keeps a `Field` for them, nested in the `.control`, and warns
|
|
14
|
+
* in development. Wrap the `Control` in a `Field` instead, and set the
|
|
15
|
+
* `label`, `horizontal` and class name on that `Field`.
|
|
16
|
+
*
|
|
17
|
+
* @helperProps Helper props go on the `.password-input-container` `<div>`, with
|
|
18
|
+
* `className` and `style`, so they move and size the field and its toggle
|
|
19
|
+
* together. The other attributes go on the `<input>`.
|
|
20
|
+
* @extraProp {string} [autoComplete="current-password"] - Tells the browser and password managers this is an existing password. Pass `"new-password"` where the user makes one up, on a sign-up or change-password form.
|
|
21
|
+
* @extraProp {boolean} [spellCheck=false] - Off, so a browser's spellcheck never sees the password once it shows.
|
|
22
|
+
* @extraProp {string} [autoCorrect="off"] - Off, so a phone's keyboard doesn't change what's typed.
|
|
23
|
+
* @extraProp {string} [autoCapitalize="none"] - Off, so a phone's keyboard doesn't capitalize the first letter.
|
|
24
|
+
* @extraProp {string} [value] - The password, controlled. React writes a controlled input's value into its `value` attribute, as it does on any input, so the password sits in the page's markup. Uncontrolled, read with `FormData`, the field never puts what's typed there.
|
|
25
|
+
* @extraProp {React.Ref<HTMLInputElement>} [ref] - Ref forwarded to the `<input>`.
|
|
26
|
+
*/
|
|
27
|
+
export interface PasswordInputProps extends PasswordInputBaseProps {
|
|
28
|
+
/** Field label. Automatically associated with the input via `htmlFor`, using your `id` when provided, otherwise a generated one. Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`) and you set no `id` here. */
|
|
29
|
+
label?: React.ReactNode;
|
|
30
|
+
/** Size for the label. */
|
|
31
|
+
labelSize?: FieldProps['labelSize'];
|
|
32
|
+
/** Props for the label element when the component renders its own `Field`; dropped inside an outer `Field` (use that `Field`'s `labelProps` instead). An explicit `htmlFor` key, even `undefined`, overrides the automatic association and no id is generated. */
|
|
33
|
+
labelProps?: FieldProps['labelProps'];
|
|
34
|
+
/** Horizontal field layout. */
|
|
35
|
+
horizontal?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Icon props for the left icon.
|
|
38
|
+
* Bulma gives control icons `pointer-events: none`, so a clickable node here
|
|
39
|
+
* never receives a click.
|
|
40
|
+
*/
|
|
41
|
+
iconLeft?: ControlBaseProps['iconLeft'];
|
|
42
|
+
/** Shortcut for the left icon's name. */
|
|
43
|
+
iconLeftName?: string;
|
|
44
|
+
/** Shortcut for the left icon's size. */
|
|
45
|
+
iconLeftSize?: ControlBaseProps['iconLeftSize'];
|
|
46
|
+
/** Force the left icon container. */
|
|
47
|
+
hasIconsLeft?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Shows a loading spinner on the `Control` it renders, at the edge the
|
|
50
|
+
* toggle uses, so the toggle isn't drawn meanwhile, and a shown password is
|
|
51
|
+
* hidden until it's back. Inside your own
|
|
52
|
+
* `Control` it renders none, so this draws nothing and warns in
|
|
53
|
+
* development; set `isLoading` on that `Control`, which hides the toggle
|
|
54
|
+
* too.
|
|
55
|
+
*/
|
|
56
|
+
isLoading?: boolean;
|
|
57
|
+
/** Expand the control. */
|
|
58
|
+
isExpanded?: boolean;
|
|
59
|
+
/** Control size. */
|
|
60
|
+
controlSize?: ControlBaseProps['size'];
|
|
61
|
+
/** Help/validation message below the input. */
|
|
62
|
+
message?: React.ReactNode;
|
|
63
|
+
/** Bulma color for the message. */
|
|
64
|
+
messageColor?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';
|
|
65
|
+
/** Additional CSS classes for the Field. */
|
|
66
|
+
fieldClassName?: string;
|
|
67
|
+
/** Additional CSS classes for the Control. */
|
|
68
|
+
controlClassName?: string;
|
|
69
|
+
/** Not offered: the toggle takes the right icon's place. Warns in development if passed. @internal */
|
|
70
|
+
iconRight?: never;
|
|
71
|
+
/** Not offered, as `iconRight`. @internal */
|
|
72
|
+
iconRightName?: never;
|
|
73
|
+
/** Not offered, as `iconRight`. @internal */
|
|
74
|
+
iconRightSize?: never;
|
|
75
|
+
/** Not offered, as `iconRight`. @internal */
|
|
76
|
+
hasIconsRight?: never;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The `PasswordInput` component is a password field with a button inside it that shows what was typed.
|
|
80
|
+
*
|
|
81
|
+
* By default the button is an eye named "Show password" that reports
|
|
82
|
+
* whether the password shows with `aria-pressed`; `variant="text"` makes it
|
|
83
|
+
* the words "Show" and "Hide". The field asks for
|
|
84
|
+
* `autocomplete="current-password"` and no spellcheck, and hides the
|
|
85
|
+
* password again when its form submits.
|
|
86
|
+
*
|
|
87
|
+
* @function
|
|
88
|
+
* @param {PasswordInputProps} props - Props for PasswordInput.
|
|
89
|
+
* @returns {JSX.Element} The composed field element.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* <PasswordInput label="Password" />
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* <PasswordInput label="New password" autoComplete="new-password" variant="text" />
|
|
96
|
+
*/
|
|
97
|
+
export declare const PasswordInput: React.ForwardRefExoticComponent<PasswordInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
98
|
+
export default PasswordInput;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { InputBaseProps } from './InputBase.js';
|
|
2
|
+
/** How PasswordInput's visibility toggle draws itself. */
|
|
3
|
+
export type PasswordInputVariant = 'icon' | 'text';
|
|
4
|
+
/** The strings PasswordInput's toggle shows and announces, for translating. */
|
|
5
|
+
export interface PasswordInputLabels {
|
|
6
|
+
/**
|
|
7
|
+
* The toggle's name. With the `icon` variant it's the name in both states,
|
|
8
|
+
* and `aria-pressed` says whether the password shows. With `text`, it's the
|
|
9
|
+
* name while the password is hidden, and it has to contain `show`, the word
|
|
10
|
+
* on the button.
|
|
11
|
+
* @defaultValue 'Show password'
|
|
12
|
+
*/
|
|
13
|
+
showPassword?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The `text` variant's name while the password shows. It has to contain
|
|
16
|
+
* `hide`.
|
|
17
|
+
* @defaultValue 'Hide password'
|
|
18
|
+
*/
|
|
19
|
+
hidePassword?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The `text` variant's word while the password is hidden.
|
|
22
|
+
* @defaultValue 'Show'
|
|
23
|
+
*/
|
|
24
|
+
show?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The `text` variant's word while the password shows.
|
|
27
|
+
* @defaultValue 'Hide'
|
|
28
|
+
*/
|
|
29
|
+
hide?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Props for PasswordInputBase, the input and its toggle without a Field or a
|
|
33
|
+
* Control.
|
|
34
|
+
*
|
|
35
|
+
* @helperProps Helper props go on the `.password-input-container` `<div>`, with
|
|
36
|
+
* `className` and `style`, so they move and size the field and its toggle
|
|
37
|
+
* together. The other attributes go on the `<input>`.
|
|
38
|
+
* @extraProp {string} [autoComplete="current-password"] - Tells the browser and password managers this is an existing password. Pass `"new-password"` where the user makes one up, on a sign-up or change-password form.
|
|
39
|
+
* @extraProp {boolean} [spellCheck=false] - Off, so a browser's spellcheck never sees the password once it shows.
|
|
40
|
+
* @extraProp {string} [autoCorrect="off"] - Off, so a phone's keyboard doesn't change what's typed.
|
|
41
|
+
* @extraProp {string} [autoCapitalize="none"] - Off, so a phone's keyboard doesn't capitalize the first letter.
|
|
42
|
+
* @extraProp {string} [value] - The password, controlled. React writes a controlled input's value into its `value` attribute, as it does on any input, so the password sits in the page's markup. Uncontrolled, read with `FormData`, the field never puts what's typed there.
|
|
43
|
+
* @extraProp {React.Ref<HTMLInputElement>} [ref] - Ref forwarded to the `<input>`.
|
|
44
|
+
*/
|
|
45
|
+
export interface PasswordInputBaseProps extends Omit<InputBaseProps, 'type'> {
|
|
46
|
+
/**
|
|
47
|
+
* Whether the password shows, when you hold the state. Setting it makes
|
|
48
|
+
* the visibility controlled: the toggle only calls `onVisibleChange`, and
|
|
49
|
+
* so does hiding again on its own. Apply that `false` and the field is a
|
|
50
|
+
* password field by the time the form reads it; keep `visible` true and
|
|
51
|
+
* the field stays shown.
|
|
52
|
+
*/
|
|
53
|
+
visible?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the password shows at first, when the input holds its own state.
|
|
56
|
+
* @defaultValue false
|
|
57
|
+
*/
|
|
58
|
+
defaultVisible?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Called with the new visibility on each toggle, and with `false` when the
|
|
61
|
+
* form submits or resets, or the page is left, which it also is on the way
|
|
62
|
+
* into the back-forward cache. React renders those hides at once, a state
|
|
63
|
+
* update you make here included, so the form reads a password field. One
|
|
64
|
+
* that fires while React is rendering or committing, which includes your
|
|
65
|
+
* `useEffect` and `useLayoutEffect` callbacks, such as a `requestSubmit()`
|
|
66
|
+
* from an effect, can't render there, and lands just after the form is
|
|
67
|
+
* read: hide the password first, or submit from an event handler.
|
|
68
|
+
*/
|
|
69
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
70
|
+
/**
|
|
71
|
+
* How the toggle draws itself: an eye icon with a fixed name and
|
|
72
|
+
* `aria-pressed`, or the words "Show" and "Hide" with a name that follows
|
|
73
|
+
* them.
|
|
74
|
+
* @defaultValue 'icon'
|
|
75
|
+
*/
|
|
76
|
+
variant?: PasswordInputVariant;
|
|
77
|
+
/** Translations for the toggle. */
|
|
78
|
+
labels?: PasswordInputLabels;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The raw PasswordInput: a password field with a button inside it that shows what was typed, without Field/Control wrapping.
|
|
82
|
+
*
|
|
83
|
+
* Use `PasswordInput` for the convenience wrapper.
|
|
84
|
+
*
|
|
85
|
+
* @function
|
|
86
|
+
* @param {PasswordInputBaseProps} props - Props for PasswordInputBase.
|
|
87
|
+
* @param {React.Ref<HTMLInputElement>} ref - Forwarded ref to the `<input>`.
|
|
88
|
+
* @returns {JSX.Element} The input and its toggle, in a container.
|
|
89
|
+
*/
|
|
90
|
+
export declare const PasswordInputBase: import("react").ForwardRefExoticComponent<PasswordInputBaseProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
91
|
+
export default PasswordInputBase;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A check mark, 1em square and drawn in `currentColor`, so it takes the text
|
|
3
|
+
* color around it, the system's in forced colors included. Combobox draws it
|
|
4
|
+
* beside a chosen item, and CopyButton after a copy. It's decorative: put it
|
|
5
|
+
* inside something `aria-hidden`.
|
|
6
|
+
*
|
|
7
|
+
* @function CheckIcon
|
|
8
|
+
* @returns The check mark's `<svg>`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function CheckIcon(): import("react").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* INTERNAL, deliberately not exported from `src/index.ts`. Whether a prop
|
|
4
|
+
* was given something to render: `undefined`, `null`, a boolean and `''`
|
|
5
|
+
* weren't, and `0` was, since React renders it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isGiven: (node: ReactNode) => boolean;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/** Options for useClipboard. */
|
|
2
|
+
export interface UseClipboardOptions {
|
|
3
|
+
/**
|
|
4
|
+
* How long `copied` stays `true` after a copy, in milliseconds. Another
|
|
5
|
+
* copy restarts it. `0` turns the timer off, as Toast's `0` does, so
|
|
6
|
+
* `copied` stays `true` until a later copy fails. A missing or `NaN` value
|
|
7
|
+
* uses the default, a negative one ends it at once, and `Infinity`, or
|
|
8
|
+
* anything longer than the longest delay `setTimeout` takes (2147483647 ms,
|
|
9
|
+
* about 24.8 days), is that longest delay.
|
|
10
|
+
* @defaultValue 2000
|
|
11
|
+
*/
|
|
12
|
+
duration?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Called with `true` after each copy that worked, a repeat included, and
|
|
15
|
+
* with `false` when `duration` runs out or a later copy fails.
|
|
16
|
+
*/
|
|
17
|
+
onCopiedChange?: (copied: boolean) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Called when neither the Clipboard API nor the copy command could write,
|
|
20
|
+
* with the Clipboard API's own error when it refused, or an `Error` saying
|
|
21
|
+
* neither could.
|
|
22
|
+
*/
|
|
23
|
+
onCopyError?: (error: Error) => void;
|
|
24
|
+
}
|
|
25
|
+
/** What useClipboard returns. */
|
|
26
|
+
export interface UseClipboardResult {
|
|
27
|
+
/**
|
|
28
|
+
* Writes `text` to the clipboard, and resolves `true` once it's written or
|
|
29
|
+
* `false` when it couldn't be. It never rejects. Call it from a click or a
|
|
30
|
+
* key press, with no `await` before it: browsers only allow a write
|
|
31
|
+
* shortly after one. A call that a later one overtakes leaves `copied`,
|
|
32
|
+
* `error` and the callbacks to the later one, and doesn't fall back to the
|
|
33
|
+
* copy command once the later one has started.
|
|
34
|
+
*/
|
|
35
|
+
copy: (text: string) => Promise<boolean>;
|
|
36
|
+
/**
|
|
37
|
+
* `true` for `duration` after a copy that worked, or, with a `duration` of
|
|
38
|
+
* `0`, until a later copy fails.
|
|
39
|
+
*/
|
|
40
|
+
copied: boolean;
|
|
41
|
+
/** Why the last copy failed, or `null` after one that worked. */
|
|
42
|
+
error: Error | null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Copies text to the clipboard through the Clipboard API, falling back to the copy command where that's missing or refused, and keeps a `copied` flag for `duration` after a copy.
|
|
46
|
+
*
|
|
47
|
+
* It announces nothing. A trigger of your own says "Copied" in a
|
|
48
|
+
* `role="status"` region that's in the page before the click; `CopyButton`
|
|
49
|
+
* is this hook with the button, the label and the announcement built in.
|
|
50
|
+
*
|
|
51
|
+
* A failed copy sets `error`, calls `onCopyError`, and ends `copied` if a
|
|
52
|
+
* copy before it had set it. When copies overlap, only the latest one's
|
|
53
|
+
* outcome sets the state and fires the callbacks, whichever finishes first.
|
|
54
|
+
* Nothing changes and no callback fires once the component using it has
|
|
55
|
+
* unmounted, though a write already under way still finishes.
|
|
56
|
+
*
|
|
57
|
+
* @function useClipboard
|
|
58
|
+
* @param options - How long `copied` lasts, and the callbacks.
|
|
59
|
+
* @returns `copy`, which writes, and the `copied` and `error` state.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* const { copy, copied } = useClipboard();
|
|
63
|
+
* <Button onClick={() => copy(url)}>{copied ? 'Copied' : 'Copy link'}</Button>
|
|
64
|
+
*/
|
|
65
|
+
export declare function useClipboard(options?: UseClipboardOptions): UseClipboardResult;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** Options for useScrollSpy. */
|
|
2
|
+
export interface UseScrollSpyOptions {
|
|
3
|
+
/**
|
|
4
|
+
* **Required.** The ids of the sections to watch, without the `#`, in the
|
|
5
|
+
* order they come on the page. Each one is looked up each time the hook
|
|
6
|
+
* checks, so an id with no element on the page is skipped until one
|
|
7
|
+
* appears, and a section replaced under the same id keeps working.
|
|
8
|
+
*/
|
|
9
|
+
ids: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Pixels from the viewport's top where a section counts as reached. Unset,
|
|
12
|
+
* it's the page's `scroll-padding-top`, read when the hook mounts and on
|
|
13
|
+
* resize, so the highlight agrees with where a jump lands under a sticky
|
|
14
|
+
* header. A `scroll-padding-top` that mixes a percentage with a length in
|
|
15
|
+
* `calc()` isn't read: pass `offset` then.
|
|
16
|
+
*/
|
|
17
|
+
offset?: number;
|
|
18
|
+
/** Called with the new current id when it changes, or `null` above the first section. */
|
|
19
|
+
onCurrentChange?: (id: string | null) => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The `useScrollSpy` hook returns the id of the section being read: the last
|
|
23
|
+
* of `ids` whose top is at or above the offset line, or the last one once the
|
|
24
|
+
* page is scrolled to its end. After a jump to one of them, it's that one
|
|
25
|
+
* until the reader scrolls on. `null` above the first section, on the server
|
|
26
|
+
* and until the page hydrates.
|
|
27
|
+
*
|
|
28
|
+
* It checks once per frame while the page scrolls, and on resize. A jump is
|
|
29
|
+
* a plain click on a link to one of the ids (the main button, no modifier
|
|
30
|
+
* key, opening in this page), noted and never stopped, so the browser jumps
|
|
31
|
+
* as it always does; and the `#id` a page opened afresh opens at. Back,
|
|
32
|
+
* Forward and a reload aren't jumps. That `#id` is read once, when `ids`
|
|
33
|
+
* first has some: a section rendered after that isn't held, even if the
|
|
34
|
+
* page opened at it, and the reading rule marks where the page is. Once the
|
|
35
|
+
* page has been still for a
|
|
36
|
+
* moment, the section stays current only if it's where a jump puts it: its
|
|
37
|
+
* top at the line, give or take a shift of the layout smaller than its own
|
|
38
|
+
* height, or, at the end of the page, on screen below the line. Otherwise,
|
|
39
|
+
* as after a flick right after the click, the reading rule takes over. The
|
|
40
|
+
* next scroll after that lets it go, the browser's own included, so when
|
|
41
|
+
* content loading above it makes the browser scroll to keep the reader's
|
|
42
|
+
* place, the rule takes over too.
|
|
43
|
+
*
|
|
44
|
+
* A section that isn't drawn (`display: none`) is never current. A section
|
|
45
|
+
* that moves while nothing scrolls is seen at the next scroll or resize. It
|
|
46
|
+
* watches the document only: not a panel that scrolls inside it, and not
|
|
47
|
+
* sections inside a shadow root, which an `#id` link can't reach either.
|
|
48
|
+
* Whether a page was opened afresh is read from how the document loaded, so
|
|
49
|
+
* in an app that changes routes on the client, a route change can briefly
|
|
50
|
+
* mark the address bar's section until the page settles, when the reading
|
|
51
|
+
* rule takes over, and after a reload a route change to an `#id` holds
|
|
52
|
+
* nothing.
|
|
53
|
+
*
|
|
54
|
+
* @function
|
|
55
|
+
* @param {UseScrollSpyOptions} options - The ids to watch, the offset, and a change callback.
|
|
56
|
+
* @returns {string | null} The current section's id, or `null`.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* const current = useScrollSpy({ ids: ['profile', 'security', 'billing'] });
|
|
60
|
+
*/
|
|
61
|
+
export declare function useScrollSpy({ ids, offset, onCurrentChange, }: UseScrollSpyOptions): string | null;
|