@minimalstuff/ui 2.1.1 → 3.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/dist/index.d.ts +278 -48
- package/dist/minimalstuff-ui.css +1 -1
- package/dist/minimalstuff-ui.js +2023 -642
- package/package.json +28 -26
package/dist/index.d.ts
CHANGED
|
@@ -2,53 +2,78 @@ import { Callable } from 'react-call';
|
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
import { JSX } from 'react';
|
|
4
4
|
import { JSXElementConstructor } from 'react';
|
|
5
|
+
import { MouseEvent as MouseEvent_2 } from 'react';
|
|
5
6
|
import { ReactElement } from 'react';
|
|
6
7
|
import { ReactNode } from 'react';
|
|
7
8
|
import { ReactPortal } from 'react';
|
|
9
|
+
import { Ref } from 'react';
|
|
8
10
|
import { StoreApi } from 'zustand';
|
|
9
11
|
import { UseBoundStore } from 'zustand';
|
|
10
12
|
|
|
13
|
+
export declare const Badge: ({ children, color, variant, size, radius, className, ...props }: Readonly<BadgeProps>) => JSX.Element;
|
|
14
|
+
|
|
15
|
+
export declare interface BadgeProps extends ComponentPropsWithRef<'span'> {
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
color?: ButtonColor;
|
|
18
|
+
variant?: BadgeVariant;
|
|
19
|
+
size?: BadgeSize;
|
|
20
|
+
radius?: Radius;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export declare type BadgeSize = ControlSize;
|
|
24
|
+
|
|
25
|
+
export declare type BadgeVariant = 'solid' | 'outline' | 'subtle';
|
|
26
|
+
|
|
27
|
+
/** Chrome shared by every text-entry control (Input, Textarea, Select, Combobox). */
|
|
11
28
|
export declare const BASE_INPUT_STYLES = "w-full border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed";
|
|
12
29
|
|
|
13
|
-
export declare
|
|
30
|
+
export declare function Button(buttonProps: Readonly<ButtonProps>): JSX.Element;
|
|
14
31
|
|
|
15
|
-
|
|
32
|
+
declare type ButtonColor =
|
|
33
|
+
| 'primary'
|
|
34
|
+
| 'neutral'
|
|
35
|
+
| 'danger'
|
|
36
|
+
| 'success'
|
|
37
|
+
| 'warning';
|
|
38
|
+
export { ButtonColor as BadgeColor }
|
|
39
|
+
export { ButtonColor }
|
|
16
40
|
|
|
17
|
-
declare
|
|
18
|
-
variant?: ButtonVariant;
|
|
19
|
-
color?: ButtonColor;
|
|
20
|
-
size?: ButtonSize;
|
|
21
|
-
radius?: Radius;
|
|
41
|
+
export declare type ButtonProps = Omit<ComponentPropsWithRef<'button'>, 'children'> & {
|
|
22
42
|
children: ReactNode;
|
|
43
|
+
size?: ControlSize;
|
|
23
44
|
className?: string;
|
|
24
45
|
fullWidth?: boolean;
|
|
25
46
|
loading?: boolean;
|
|
26
47
|
startIcon?: string;
|
|
27
48
|
endIcon?: string;
|
|
28
|
-
}
|
|
49
|
+
} & ButtonStyle;
|
|
29
50
|
|
|
30
|
-
declare type
|
|
51
|
+
declare type ButtonStyle = {
|
|
52
|
+
unstyled: true;
|
|
53
|
+
} | {
|
|
54
|
+
unstyled?: false;
|
|
55
|
+
variant?: ButtonVariant;
|
|
56
|
+
color?: ButtonColor;
|
|
57
|
+
radius?: Radius;
|
|
58
|
+
};
|
|
31
59
|
|
|
32
|
-
export declare type ButtonVariant =
|
|
33
|
-
| 'solid'
|
|
34
|
-
| 'outline'
|
|
35
|
-
| 'ghost'
|
|
36
|
-
| 'subtle'
|
|
37
|
-
| 'unstyled';
|
|
60
|
+
export declare type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'subtle';
|
|
38
61
|
|
|
39
|
-
export declare function CharacterCount({ current, min, max, showMin, showMax, }: CharacterCountProps): JSX.Element;
|
|
62
|
+
export declare function CharacterCount({ current, min, max, showMin, showMax, unstyled, className, }: Readonly<CharacterCountProps>): JSX.Element;
|
|
40
63
|
|
|
41
|
-
declare interface CharacterCountProps {
|
|
64
|
+
export declare interface CharacterCountProps {
|
|
42
65
|
current: number;
|
|
43
66
|
min?: number;
|
|
44
67
|
max?: number;
|
|
45
68
|
showMin?: boolean;
|
|
46
69
|
showMax?: boolean;
|
|
70
|
+
unstyled?: boolean;
|
|
71
|
+
className?: string;
|
|
47
72
|
}
|
|
48
73
|
|
|
49
|
-
export declare function Checkbox({ label, description, error, radius, unstyled, className, wrapperClassName, checked, defaultChecked, onChange, id, ...props }: CheckboxProps): JSX.Element;
|
|
74
|
+
export declare function Checkbox({ label, description, error, radius, unstyled, className, wrapperClassName, checked, defaultChecked, onChange, id, ...props }: Readonly<CheckboxProps>): JSX.Element;
|
|
50
75
|
|
|
51
|
-
declare interface CheckboxProps extends Omit<ComponentPropsWithRef<'input'>, 'type' | 'className'> {
|
|
76
|
+
export declare interface CheckboxProps extends Omit<ComponentPropsWithRef<'input'>, 'type' | 'className'> {
|
|
52
77
|
label?: string | React.ReactNode;
|
|
53
78
|
description?: string | React.ReactNode;
|
|
54
79
|
error?: string;
|
|
@@ -58,25 +83,26 @@ declare interface CheckboxProps extends Omit<ComponentPropsWithRef<'input'>, 'ty
|
|
|
58
83
|
wrapperClassName?: string;
|
|
59
84
|
}
|
|
60
85
|
|
|
61
|
-
export declare function ClientOnly({ children, fallback }: ClientOnlyProps): string | number | bigint | boolean | Iterable< ReactNode> | Promise<string | number | bigint | boolean | ReactPortal | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable< ReactNode> | null | undefined> | JSX.Element | null;
|
|
86
|
+
export declare function ClientOnly({ children, fallback }: Readonly<ClientOnlyProps>): string | number | bigint | boolean | Iterable< ReactNode> | Promise<string | number | bigint | boolean | ReactPortal | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable< ReactNode> | null | undefined> | JSX.Element | null;
|
|
62
87
|
|
|
63
|
-
declare interface ClientOnlyProps extends React.PropsWithChildren {
|
|
88
|
+
export declare interface ClientOnlyProps extends React.PropsWithChildren {
|
|
64
89
|
fallback?: React.ReactNode;
|
|
65
90
|
}
|
|
66
91
|
|
|
67
|
-
export declare function Combobox({ options, label, error, placeholder, noResultsText, radius, unstyled, disabled, required, className, wrapperClassName, value, defaultValue, onChange, id, }: ComboboxProps): JSX.Element;
|
|
92
|
+
export declare function Combobox({ options, label, error, placeholder, noResultsText, clearLabel, radius, unstyled, disabled, required, className, wrapperClassName, value, defaultValue, onChange, id, }: Readonly<ComboboxProps>): JSX.Element;
|
|
68
93
|
|
|
69
94
|
export declare interface ComboboxOption {
|
|
70
95
|
value: string;
|
|
71
96
|
label: string;
|
|
72
97
|
}
|
|
73
98
|
|
|
74
|
-
declare interface ComboboxProps {
|
|
99
|
+
export declare interface ComboboxProps {
|
|
75
100
|
options: ComboboxOption[];
|
|
76
101
|
label?: string | ReactNode;
|
|
77
102
|
error?: string;
|
|
78
103
|
placeholder?: string;
|
|
79
104
|
noResultsText?: string;
|
|
105
|
+
clearLabel?: string;
|
|
80
106
|
radius?: Radius;
|
|
81
107
|
unstyled?: boolean;
|
|
82
108
|
disabled?: boolean;
|
|
@@ -91,7 +117,7 @@ declare interface ComboboxProps {
|
|
|
91
117
|
|
|
92
118
|
export declare const ConfirmModal: Callable<ConfirmModalProps, boolean, {}>;
|
|
93
119
|
|
|
94
|
-
export declare type ConfirmModalColor = '
|
|
120
|
+
export declare type ConfirmModalColor = Extract<ButtonColor, 'primary' | 'danger' | 'success'>;
|
|
95
121
|
|
|
96
122
|
export declare interface ConfirmModalProps {
|
|
97
123
|
title: ReactNode;
|
|
@@ -100,31 +126,87 @@ export declare interface ConfirmModalProps {
|
|
|
100
126
|
cancelLabel?: ReactNode;
|
|
101
127
|
confirmColor?: ConfirmModalColor;
|
|
102
128
|
radius?: Radius;
|
|
129
|
+
closeLabel?: string;
|
|
103
130
|
onConfirm?: () => void | Promise<void>;
|
|
131
|
+
onError?: (error: unknown) => void;
|
|
104
132
|
}
|
|
105
133
|
|
|
106
134
|
export declare type ConfirmModalResponse = boolean;
|
|
107
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Wraps `children` (the right-click target area) and opens `items`, a list
|
|
138
|
+
* of `MenuItem` elements as direct children (see `MenuItem`'s own doc
|
|
139
|
+
* comment), at the cursor position. Right-click again elsewhere on the
|
|
140
|
+
* wrapped area to reposition it.
|
|
141
|
+
*
|
|
142
|
+
* For a menu anchored to a specific button (e.g. a kebab icon) instead of a
|
|
143
|
+
* right-click, use `Menu`.
|
|
144
|
+
*/
|
|
145
|
+
export declare function ContextMenu({ children, items, radius, className, ref, }: Readonly<ContextMenuProps>): JSX.Element;
|
|
146
|
+
|
|
147
|
+
export declare interface ContextMenuProps {
|
|
148
|
+
/** The area that opens the menu on right-click. */
|
|
149
|
+
children: ReactNode;
|
|
150
|
+
/** `MenuItem` elements shown in the menu. */
|
|
151
|
+
items: ReactNode;
|
|
152
|
+
radius?: Radius;
|
|
153
|
+
className?: string;
|
|
154
|
+
ref?: Ref<HTMLDivElement>;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** The size scale every inline control shares (Button, IconButton, Badge, Kbd). */
|
|
158
|
+
declare type ControlSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
159
|
+
|
|
160
|
+
export declare function CopyButton({ value, children, onError, }: Readonly<CopyButtonProps>): JSX.Element;
|
|
161
|
+
|
|
162
|
+
export declare interface CopyButtonProps {
|
|
163
|
+
value: string;
|
|
164
|
+
children: (props: {
|
|
165
|
+
copied: boolean;
|
|
166
|
+
copy: () => void | Promise<void>;
|
|
167
|
+
}) => ReactNode;
|
|
168
|
+
onError?: (error: unknown) => void;
|
|
169
|
+
}
|
|
170
|
+
|
|
108
171
|
declare interface GlobalHotkeysStore {
|
|
109
172
|
globalHotkeysEnabled: boolean;
|
|
110
173
|
setGlobalHotkeysEnabled: (value: boolean) => void;
|
|
111
174
|
}
|
|
112
175
|
|
|
113
|
-
|
|
176
|
+
declare function Highlight_2({ text, ranges }: Readonly<HighlightProps>): JSX.Element;
|
|
177
|
+
export { Highlight_2 as Highlight }
|
|
178
|
+
|
|
179
|
+
export declare interface HighlightProps {
|
|
180
|
+
text: string;
|
|
181
|
+
ranges: readonly number[];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export declare interface HighlightSegment {
|
|
185
|
+
text: string;
|
|
186
|
+
isMatch: boolean;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export declare function IconButton(iconButtonProps: Readonly<IconButtonProps>): JSX.Element;
|
|
114
190
|
|
|
115
|
-
declare
|
|
191
|
+
export declare type IconButtonProps = ComponentPropsWithRef<'button'> & {
|
|
116
192
|
icon: string;
|
|
117
193
|
'aria-label': string;
|
|
194
|
+
size?: ControlSize;
|
|
195
|
+
children?: ReactNode;
|
|
196
|
+
} & IconButtonStyle;
|
|
197
|
+
|
|
198
|
+
declare type IconButtonStyle = {
|
|
199
|
+
unstyled: true;
|
|
200
|
+
} | {
|
|
201
|
+
unstyled?: false;
|
|
118
202
|
variant?: ButtonVariant;
|
|
119
203
|
color?: ButtonColor;
|
|
120
|
-
size?: 'sm' | 'md' | 'lg';
|
|
121
204
|
radius?: Radius;
|
|
122
|
-
|
|
123
|
-
}
|
|
205
|
+
};
|
|
124
206
|
|
|
125
|
-
export declare function Input({ label, error, showCharCount, minLength, maxLength, radius, unstyled, className, wrapperClassName, value, defaultValue, onChange, id, ...props }: InputProps): JSX.Element;
|
|
207
|
+
export declare function Input({ label, error, showCharCount, minLength, maxLength, radius, unstyled, className, wrapperClassName, value, defaultValue, onChange, id, ...props }: Readonly<InputProps>): JSX.Element;
|
|
126
208
|
|
|
127
|
-
declare interface InputProps extends ComponentPropsWithRef<'input'> {
|
|
209
|
+
export declare interface InputProps extends ComponentPropsWithRef<'input'> {
|
|
128
210
|
label?: string | ReactNode;
|
|
129
211
|
error?: string;
|
|
130
212
|
showCharCount?: boolean;
|
|
@@ -136,8 +218,95 @@ declare interface InputProps extends ComponentPropsWithRef<'input'> {
|
|
|
136
218
|
wrapperClassName?: string;
|
|
137
219
|
}
|
|
138
220
|
|
|
221
|
+
export declare const Kbd: ({ children, size, radius, unstyled, className, }: Readonly<KbdProps>) => JSX.Element;
|
|
222
|
+
|
|
223
|
+
export declare interface KbdProps {
|
|
224
|
+
children: ReactNode;
|
|
225
|
+
size?: KbdSize;
|
|
226
|
+
radius?: Radius;
|
|
227
|
+
unstyled?: boolean;
|
|
228
|
+
className?: string;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export declare type KbdSize = ControlSize;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* A dropdown anchored to `trigger` (e.g. a kebab `IconButton`): click to
|
|
235
|
+
* open, click again/click outside/Escape to close. `children` must be
|
|
236
|
+
* `MenuItem` elements as direct children (see `MenuItem`'s own doc comment)
|
|
237
|
+
* for keyboard nav and close-on-select to work.
|
|
238
|
+
*
|
|
239
|
+
* For "right-click anywhere on this area" instead of a specific trigger
|
|
240
|
+
* button, use `ContextMenu`.
|
|
241
|
+
*/
|
|
242
|
+
export declare function Menu({ trigger, children, side, align, radius, className, ref, }: Readonly<MenuProps>): JSX.Element;
|
|
243
|
+
|
|
244
|
+
export declare type MenuAlign = 'start' | 'center' | 'end';
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* A row inside a `Menu` or `ContextMenu`. Must be a direct child of one of
|
|
248
|
+
* those (or of a `<>` fragment passed as their `children`/`items`): arrow
|
|
249
|
+
* key navigation and close-on-select both rely on `role="menuitem"` being a
|
|
250
|
+
* direct descendant. Wrapping items in another element (e.g. a `<div>` for
|
|
251
|
+
* a labeled section) will render fine but breaks both.
|
|
252
|
+
*
|
|
253
|
+
* Works standalone outside a `Menu`/`ContextMenu` too (e.g. in isolation in
|
|
254
|
+
* Storybook): `onClick` still fires, it just won't auto-close anything.
|
|
255
|
+
*/
|
|
256
|
+
export declare function MenuItem({ icon, onClick, danger, disabled, children, className, ref, }: Readonly<MenuItemProps>): JSX.Element;
|
|
257
|
+
|
|
258
|
+
export declare interface MenuItemProps {
|
|
259
|
+
icon?: string;
|
|
260
|
+
onClick: (event: MouseEvent_2<HTMLButtonElement>) => void;
|
|
261
|
+
danger?: boolean;
|
|
262
|
+
disabled?: boolean;
|
|
263
|
+
children: ReactNode;
|
|
264
|
+
className?: string;
|
|
265
|
+
ref?: Ref<HTMLButtonElement>;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export declare interface MenuProps {
|
|
269
|
+
trigger: ReactElement;
|
|
270
|
+
children: ReactNode;
|
|
271
|
+
side?: MenuSide;
|
|
272
|
+
align?: MenuAlign;
|
|
273
|
+
radius?: Radius;
|
|
274
|
+
className?: string;
|
|
275
|
+
/** Attaches to the wrapper `<span>` around `trigger`, alongside `Menu`'s own internal ref. */
|
|
276
|
+
ref?: Ref<HTMLSpanElement>;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export declare type MenuSide = 'top' | 'bottom' | 'left' | 'right';
|
|
280
|
+
|
|
139
281
|
export declare const Modal: Callable<ModalProps, void, {}>;
|
|
140
282
|
|
|
283
|
+
/**
|
|
284
|
+
* Scrollable content region for a modal. Pair with `ModalFooter` as direct
|
|
285
|
+
* children of `Modal`'s `children` prop to get a footer pinned outside the
|
|
286
|
+
* scroll area — `ModalShell` detects the pairing and skips its own default
|
|
287
|
+
* padded/scrolling wrapper. Used alone (no `ModalFooter` sibling), it has no
|
|
288
|
+
* effect: `ModalShell` still applies its default wrapper around it.
|
|
289
|
+
*/
|
|
290
|
+
export declare const ModalBody: ({ children, className, }: Readonly<ModalBodyProps>) => JSX.Element;
|
|
291
|
+
|
|
292
|
+
export declare interface ModalBodyProps {
|
|
293
|
+
children: ReactNode;
|
|
294
|
+
className?: string;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Pinned footer region for a modal. Rendered as a direct child of `Modal`'s
|
|
299
|
+
* `children` prop (alongside `ModalBody`) — `ModalShell` detects it and
|
|
300
|
+
* places it outside the scrollable content instead of inside it, so it stays
|
|
301
|
+
* visible regardless of body content height.
|
|
302
|
+
*/
|
|
303
|
+
export declare const ModalFooter: ({ children, className, }: Readonly<ModalFooterProps>) => JSX.Element;
|
|
304
|
+
|
|
305
|
+
export declare interface ModalFooterProps {
|
|
306
|
+
children: ReactNode;
|
|
307
|
+
className?: string;
|
|
308
|
+
}
|
|
309
|
+
|
|
141
310
|
export declare interface ModalProps {
|
|
142
311
|
title?: ReactNode;
|
|
143
312
|
children: ModalRenderProp;
|
|
@@ -146,6 +315,7 @@ export declare interface ModalProps {
|
|
|
146
315
|
radius?: Radius;
|
|
147
316
|
className?: string;
|
|
148
317
|
dismissible?: boolean;
|
|
318
|
+
closeLabel?: string;
|
|
149
319
|
}
|
|
150
320
|
|
|
151
321
|
export declare function ModalProvider(): JSX.Element;
|
|
@@ -162,9 +332,9 @@ export declare interface RadioOption {
|
|
|
162
332
|
disabled?: boolean;
|
|
163
333
|
}
|
|
164
334
|
|
|
165
|
-
export declare function RadioOptions({ options, orientation, value, defaultValue, onChange, name: nameProp, label, error, required, disabled, radius, unstyled, className, wrapperClassName, id, ...props }: RadioOptionsProps): JSX.Element;
|
|
335
|
+
export declare function RadioOptions({ options, orientation, value, defaultValue, onChange, name: nameProp, label, error, required, disabled, radius, unstyled, className, wrapperClassName, id, ...props }: Readonly<RadioOptionsProps>): JSX.Element;
|
|
166
336
|
|
|
167
|
-
declare interface RadioOptionsProps extends Omit<ComponentPropsWithRef<'fieldset'>, 'onChange'> {
|
|
337
|
+
export declare interface RadioOptionsProps extends Omit<ComponentPropsWithRef<'fieldset'>, 'onChange'> {
|
|
168
338
|
options: string[] | RadioOption[];
|
|
169
339
|
orientation?: 'vertical' | 'horizontal';
|
|
170
340
|
value?: string;
|
|
@@ -183,14 +353,14 @@ declare interface RadioOptionsProps extends Omit<ComponentPropsWithRef<'fieldset
|
|
|
183
353
|
|
|
184
354
|
declare type Radius = 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
185
355
|
|
|
186
|
-
export declare function Select({ options, label, error, placeholder, radius, unstyled, className, wrapperClassName, value, defaultValue, onChange, id, ...props }: SelectProps): JSX.Element;
|
|
356
|
+
export declare function Select({ options, label, error, placeholder, radius, unstyled, className, wrapperClassName, value, defaultValue, onChange, id, ...props }: Readonly<SelectProps>): JSX.Element;
|
|
187
357
|
|
|
188
358
|
export declare interface SelectOption {
|
|
189
359
|
value: string;
|
|
190
360
|
label: string;
|
|
191
361
|
}
|
|
192
362
|
|
|
193
|
-
declare interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'children'> {
|
|
363
|
+
export declare interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'children'> {
|
|
194
364
|
options: SelectOption[];
|
|
195
365
|
label?: string | ReactNode;
|
|
196
366
|
error?: string;
|
|
@@ -201,12 +371,53 @@ declare interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'chi
|
|
|
201
371
|
wrapperClassName?: string;
|
|
202
372
|
}
|
|
203
373
|
|
|
204
|
-
|
|
374
|
+
/**
|
|
375
|
+
* Splits `text` into consecutive segments, flagging the ones covered by
|
|
376
|
+
* `ranges` (flat `[start0, end0, start1, end1, ...]` pairs, ascending and
|
|
377
|
+
* non-overlapping — the shape uFuzzy's match info returns). Returns a
|
|
378
|
+
* single unmatched segment when there are no ranges, so callers never
|
|
379
|
+
* special-case an unmatched row.
|
|
380
|
+
*/
|
|
381
|
+
export declare function splitIntoHighlightSegments(
|
|
382
|
+
text: string,
|
|
383
|
+
ranges: readonly number[]
|
|
384
|
+
): HighlightSegment[] {
|
|
385
|
+
if (ranges.length === 0) {
|
|
386
|
+
return [{ text, isMatch: false }];
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const segments: HighlightSegment[] = [];
|
|
390
|
+
let cursor = 0;
|
|
391
|
+
|
|
392
|
+
for (let rangeIndex = 0; rangeIndex < ranges.length; rangeIndex += 2) {
|
|
393
|
+
const start = ranges[rangeIndex];
|
|
394
|
+
const end = ranges[rangeIndex + 1];
|
|
395
|
+
if (start === undefined || end === undefined) {
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
if (start > cursor) {
|
|
400
|
+
segments.push({ text: text.slice(cursor, start), isMatch: false });
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
segments.push({ text: text.slice(start, end), isMatch: true });
|
|
404
|
+
cursor = end;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
if (cursor < text.length) {
|
|
408
|
+
segments.push({ text: text.slice(cursor), isMatch: false });
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
return segments;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export declare function Switch({ label, description, error, unstyled, className, wrapperClassName, checked, defaultChecked, onChange, id, ...props }: Readonly<SwitchProps>): JSX.Element;
|
|
205
415
|
|
|
206
|
-
declare interface SwitchProps extends Omit<ComponentPropsWithRef<'input'>, 'type' | 'className'> {
|
|
416
|
+
export declare interface SwitchProps extends Omit<ComponentPropsWithRef<'input'>, 'type' | 'className'> {
|
|
207
417
|
label?: string | ReactNode;
|
|
208
418
|
description?: string | ReactNode;
|
|
209
419
|
error?: string;
|
|
420
|
+
unstyled?: boolean;
|
|
210
421
|
className?: string;
|
|
211
422
|
wrapperClassName?: string;
|
|
212
423
|
}
|
|
@@ -218,21 +429,23 @@ export declare interface TabItem {
|
|
|
218
429
|
icon?: string;
|
|
219
430
|
}
|
|
220
431
|
|
|
221
|
-
export declare function Tabs({ items, defaultIndex, radius, className, tabListClassName, panelClassName, onChange, }: TabsProps): JSX.Element;
|
|
432
|
+
export declare function Tabs({ items, value, defaultIndex, radius, unstyled, className, tabListClassName, panelClassName, onChange, }: Readonly<TabsProps>): JSX.Element;
|
|
222
433
|
|
|
223
|
-
declare interface TabsProps {
|
|
434
|
+
export declare interface TabsProps {
|
|
224
435
|
items: TabItem[];
|
|
436
|
+
value?: number;
|
|
225
437
|
defaultIndex?: number;
|
|
226
438
|
radius?: Radius;
|
|
439
|
+
unstyled?: boolean;
|
|
227
440
|
className?: string;
|
|
228
441
|
tabListClassName?: string;
|
|
229
442
|
panelClassName?: string;
|
|
230
443
|
onChange?: (index: number) => void;
|
|
231
444
|
}
|
|
232
445
|
|
|
233
|
-
export declare function Textarea({ label, error, showCharCount, minLength, maxLength, radius, unstyled, className, wrapperClassName, value, defaultValue, onChange, id, ...props }: TextareaProps): JSX.Element;
|
|
446
|
+
export declare function Textarea({ label, error, showCharCount, minLength, maxLength, radius, unstyled, className, wrapperClassName, value, defaultValue, onChange, id, ...props }: Readonly<TextareaProps>): JSX.Element;
|
|
234
447
|
|
|
235
|
-
declare interface TextareaProps extends ComponentPropsWithRef<'textarea'> {
|
|
448
|
+
export declare interface TextareaProps extends ComponentPropsWithRef<'textarea'> {
|
|
236
449
|
label?: string | ReactNode;
|
|
237
450
|
error?: string;
|
|
238
451
|
showCharCount?: boolean;
|
|
@@ -253,18 +466,36 @@ declare interface ThemeStore {
|
|
|
253
466
|
setTheme: (theme: Theme_2) => void;
|
|
254
467
|
}
|
|
255
468
|
|
|
256
|
-
export declare function ThemeToggle({ isTransitionEnabled, transitionDuration, transitionEasing, size, radius, }: Readonly<ThemeToggleProps>): JSX.Element;
|
|
469
|
+
export declare function ThemeToggle({ isTransitionEnabled, transitionDuration, transitionEasing, size, radius, variant, getAriaLabel, }: Readonly<ThemeToggleProps>): JSX.Element;
|
|
257
470
|
|
|
258
|
-
declare interface ThemeToggleProps {
|
|
471
|
+
export declare interface ThemeToggleProps {
|
|
259
472
|
isTransitionEnabled?: boolean;
|
|
260
473
|
transitionDuration?: number;
|
|
261
474
|
transitionEasing?: string;
|
|
262
475
|
size?: 'sm' | 'md' | 'lg';
|
|
263
476
|
radius?: Radius;
|
|
477
|
+
variant?: ButtonVariant;
|
|
478
|
+
getAriaLabel?: (theme: Theme_2) => string;
|
|
264
479
|
}
|
|
265
480
|
|
|
266
|
-
|
|
267
|
-
|
|
481
|
+
export declare function Tooltip({ content, children, position, showOnClick, temporaryContent, temporaryDuration, disabled, radius, onTemporaryShow, className, ref, }: Readonly<TooltipProps>): JSX.Element;
|
|
482
|
+
|
|
483
|
+
export declare type TooltipPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
484
|
+
|
|
485
|
+
export declare interface TooltipProps {
|
|
486
|
+
content: ReactNode;
|
|
487
|
+
children: ReactNode;
|
|
488
|
+
position?: TooltipPosition;
|
|
489
|
+
showOnClick?: boolean;
|
|
490
|
+
temporaryContent?: ReactNode;
|
|
491
|
+
temporaryDuration?: number;
|
|
492
|
+
disabled?: boolean;
|
|
493
|
+
radius?: Radius;
|
|
494
|
+
onTemporaryShow?: () => void;
|
|
495
|
+
className?: string;
|
|
496
|
+
/** Attaches to the wrapper `<span>` around `children`, alongside `Tooltip`'s own internal ref. */
|
|
497
|
+
ref?: Ref<HTMLSpanElement>;
|
|
498
|
+
}
|
|
268
499
|
|
|
269
500
|
export declare function useDisableHotkeysWhileMounted(): void;
|
|
270
501
|
|
|
@@ -272,10 +503,9 @@ export declare const useGlobalHotkeysStore: UseBoundStore<StoreApi<GlobalHotkeys
|
|
|
272
503
|
|
|
273
504
|
export declare const useIsClient: () => boolean;
|
|
274
505
|
|
|
275
|
-
export declare function useRunAfterAnimation(durationMs: number): (callback: () => void) => () => void;
|
|
276
|
-
|
|
277
506
|
export declare const useThemeStore: UseBoundStore<StoreApi<ThemeStore>>;
|
|
278
507
|
|
|
279
|
-
|
|
508
|
+
/** Wraps `Component` so it only renders once the client has mounted. */
|
|
509
|
+
export declare const withClientOnly: <TProps extends object>(Component: React.ComponentType<TProps>) => React.ComponentType<TProps>;
|
|
280
510
|
|
|
281
511
|
export { }
|