@wow-two-beta/ui 0.0.2 → 0.0.4
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/actions/index.js +4 -2
- package/dist/chunk-AOHZGL6F.js +167 -0
- package/dist/chunk-AOHZGL6F.js.map +1 -0
- package/dist/chunk-BMBIZLO4.js +34 -0
- package/dist/chunk-BMBIZLO4.js.map +1 -0
- package/dist/chunk-D67WGR7Y.js +212 -0
- package/dist/chunk-D67WGR7Y.js.map +1 -0
- package/dist/chunk-DN7WBRIV.js +17 -0
- package/dist/chunk-DN7WBRIV.js.map +1 -0
- package/dist/chunk-KDXJQNB6.js +43 -0
- package/dist/chunk-KDXJQNB6.js.map +1 -0
- package/dist/chunk-KZ4VFY2T.js +11 -0
- package/dist/chunk-KZ4VFY2T.js.map +1 -0
- package/dist/{chunk-7CP7KR5F.js → chunk-OEEYNBEO.js} +3 -3
- package/dist/{chunk-7CP7KR5F.js.map → chunk-OEEYNBEO.js.map} +1 -1
- package/dist/chunk-T3JN5Y3E.js +332 -0
- package/dist/chunk-T3JN5Y3E.js.map +1 -0
- package/dist/chunk-TDX22OWF.js +33 -0
- package/dist/chunk-TDX22OWF.js.map +1 -0
- package/dist/hooks/index.d.ts +2 -5
- package/dist/hooks/index.js +3 -1
- package/dist/icons/index.d.ts +2 -5
- package/dist/icons/index.js +3 -1
- package/dist/index-Bk6CuDNT.d.ts +247 -0
- package/dist/index-C0IDphm_.d.ts +61 -0
- package/dist/index-CEAM9LLM.d.ts +37 -0
- package/dist/index-PAuwodyY.d.ts +103 -0
- package/dist/index-goThcZ1E.d.ts +416 -0
- package/dist/index.d.ts +8 -4
- package/dist/index.js +10 -6
- package/dist/primitives/index.d.ts +5 -0
- package/dist/primitives/index.js +7 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/tailwind/index.js +8 -2
- package/dist/tailwind/index.js.map +1 -1
- package/dist/tokens/index.d.ts +1 -1
- package/dist/tokens/index.js +1 -1
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.js +3 -1
- package/package.json +9 -1
- package/dist/chunk-6YKPUEHU.js +0 -47
- package/dist/chunk-6YKPUEHU.js.map +0 -1
- package/dist/chunk-CTVGU35H.js +0 -6
- package/dist/chunk-CTVGU35H.js.map +0 -1
- package/dist/chunk-ECZ4YFAI.js +0 -16
- package/dist/chunk-ECZ4YFAI.js.map +0 -1
- package/dist/chunk-U4JXXIE2.js +0 -6
- package/dist/chunk-U4JXXIE2.js.map +0 -1
- package/dist/index-CdSRWb8y.d.ts +0 -78
- package/dist/index-D-adCzNR.d.ts +0 -14
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode, ReactElement, KeyboardEvent as KeyboardEvent$1, Context } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import * as _radix_ui_react_focus_scope from '@radix-ui/react-focus-scope';
|
|
5
|
+
import { FocusScope as FocusScope$1 } from '@radix-ui/react-focus-scope';
|
|
6
|
+
import { Placement } from '@floating-ui/react';
|
|
7
|
+
|
|
8
|
+
interface SlotProps extends HTMLAttributes<HTMLElement> {
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Polymorphic slot — renders the single child element with the parent's props
|
|
13
|
+
* merged in (className concatenated, handlers chained, refs composed).
|
|
14
|
+
*
|
|
15
|
+
* Use to enable an `asChild` API on a component:
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Button asChild><a href="/x">Open</a></Button>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
declare const Slot: react.ForwardRefExoticComponent<SlotProps & react.RefAttributes<HTMLElement>>;
|
|
21
|
+
|
|
22
|
+
interface PortalProps {
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
/** Container to render into. Default: `document.body`. */
|
|
25
|
+
container?: HTMLElement | null;
|
|
26
|
+
/** Optional named layer — sets `data-portal-name` on the wrapper. */
|
|
27
|
+
name?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Render children into a different DOM node (default `document.body`).
|
|
31
|
+
* Client-only — package targets pure CSR consumers.
|
|
32
|
+
*/
|
|
33
|
+
declare function Portal({ children, container, name }: PortalProps): ReactNode;
|
|
34
|
+
|
|
35
|
+
type VisuallyHiddenProps = HTMLAttributes<HTMLSpanElement>;
|
|
36
|
+
/**
|
|
37
|
+
* Visually hidden span — content removed from the visual layout but still
|
|
38
|
+
* announced to screen readers. Use for accessible labels on icon-only
|
|
39
|
+
* affordances and live-region announcements.
|
|
40
|
+
*/
|
|
41
|
+
declare const VisuallyHidden: react.ForwardRefExoticComponent<VisuallyHiddenProps & react.RefAttributes<HTMLSpanElement>>;
|
|
42
|
+
|
|
43
|
+
interface PresenceProps {
|
|
44
|
+
/** Whether the content should be present. Toggle false to trigger exit. */
|
|
45
|
+
present: boolean;
|
|
46
|
+
/** Single React element child — receives `ref` and `data-state` ("open" | "closed"). */
|
|
47
|
+
children: ReactElement;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Defer unmount until the child's exit animation/transition finishes.
|
|
51
|
+
* Pass `present={false}` to start the exit; the child stays mounted with
|
|
52
|
+
* `data-state="closed"` until `animationend`/`transitionend` fires.
|
|
53
|
+
*/
|
|
54
|
+
declare function Presence({ present, children }: PresenceProps): ReactElement | null;
|
|
55
|
+
|
|
56
|
+
type Direction = 'ltr' | 'rtl';
|
|
57
|
+
interface DirectionProviderProps {
|
|
58
|
+
dir: Direction;
|
|
59
|
+
children: ReactNode;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Provide reading direction to descendants. Components that mirror in RTL
|
|
63
|
+
* (Tabs arrow keys, Slider, Carousel, etc.) read this via `useDirection()`.
|
|
64
|
+
*/
|
|
65
|
+
declare function DirectionProvider({ dir, children }: DirectionProviderProps): react_jsx_runtime.JSX.Element;
|
|
66
|
+
declare function useDirection(): Direction;
|
|
67
|
+
|
|
68
|
+
interface AccessibleIconProps {
|
|
69
|
+
/** Required accessible label for the icon. */
|
|
70
|
+
label: string;
|
|
71
|
+
/** Single icon element — will receive `aria-hidden` so SR reads only the label. */
|
|
72
|
+
children: ReactElement;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Wrap an icon-only element with an accessible label. The icon is hidden
|
|
76
|
+
* from assistive tech and a `VisuallyHidden` sibling provides the label.
|
|
77
|
+
*/
|
|
78
|
+
declare function AccessibleIcon({ label, children }: AccessibleIconProps): react_jsx_runtime.JSX.Element;
|
|
79
|
+
|
|
80
|
+
type FocusScopeProps = React.ComponentProps<typeof FocusScope$1>;
|
|
81
|
+
/**
|
|
82
|
+
* Trap focus within children. On unmount, returns focus to the previously
|
|
83
|
+
* focused element. Pass `loop` to wrap Tab navigation; `trapped` to enable
|
|
84
|
+
* the trap (default true while mounted).
|
|
85
|
+
*
|
|
86
|
+
* Wraps `@radix-ui/react-focus-scope` — battle-tested implementation.
|
|
87
|
+
*/
|
|
88
|
+
declare const FocusScope: react.ForwardRefExoticComponent<_radix_ui_react_focus_scope.FocusScopeProps & react.RefAttributes<HTMLDivElement>>;
|
|
89
|
+
|
|
90
|
+
interface DismissableLayerProps extends HTMLAttributes<HTMLDivElement> {
|
|
91
|
+
/** Called when Escape is pressed and this is the topmost layer. */
|
|
92
|
+
onEscape?: (event: KeyboardEvent) => void;
|
|
93
|
+
/** Called when a pointerdown lands outside this layer's DOM and this is topmost. */
|
|
94
|
+
onOutsidePointerDown?: (event: PointerEvent) => void;
|
|
95
|
+
/** Disable the Escape listener for this layer. */
|
|
96
|
+
disableEscape?: boolean;
|
|
97
|
+
/** Disable the outside-pointer-down listener for this layer. */
|
|
98
|
+
disableOutsideClick?: boolean;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Stack-aware dismissal layer. Multiple layers may stack (modal > popover);
|
|
102
|
+
* only the topmost reacts to Escape / outside click. Used as the base of
|
|
103
|
+
* Modal, Drawer, Popover, Menu, HoverCard, ContextMenu.
|
|
104
|
+
*/
|
|
105
|
+
declare const DismissableLayer: react.ForwardRefExoticComponent<DismissableLayerProps & react.RefAttributes<HTMLDivElement>>;
|
|
106
|
+
|
|
107
|
+
interface AnchoredPositionerProps extends HTMLAttributes<HTMLDivElement> {
|
|
108
|
+
/** The element the floating layer should be anchored to. */
|
|
109
|
+
anchor: HTMLElement | null;
|
|
110
|
+
/** Floating UI placement. Default `bottom`. */
|
|
111
|
+
placement?: Placement;
|
|
112
|
+
/** Distance between anchor and floating element in px. Default 8. */
|
|
113
|
+
offset?: number;
|
|
114
|
+
/** Render the floating element only when open. */
|
|
115
|
+
open?: boolean;
|
|
116
|
+
children: ReactNode;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Position children relative to an anchor element using Floating UI.
|
|
120
|
+
* Auto-flips and shifts to stay in viewport. Use as the positioning surface
|
|
121
|
+
* for Tooltip, Popover, Menu, HoverCard.
|
|
122
|
+
*/
|
|
123
|
+
declare const AnchoredPositioner: react.ForwardRefExoticComponent<AnchoredPositionerProps & react.RefAttributes<HTMLDivElement>>;
|
|
124
|
+
|
|
125
|
+
type Orientation = 'horizontal' | 'vertical' | 'both';
|
|
126
|
+
interface RovingFocusGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
127
|
+
orientation?: Orientation;
|
|
128
|
+
loop?: boolean;
|
|
129
|
+
children: ReactNode;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Provide arrow-key navigation for a group of focusable children. Children
|
|
133
|
+
* call `useRovingFocusItem()` to register and receive `tabIndex` / event
|
|
134
|
+
* handlers. Used by Tabs, ToggleGroup, RadioGroup, Menu.
|
|
135
|
+
*/
|
|
136
|
+
declare function RovingFocusGroup({ orientation, loop, children, ...props }: RovingFocusGroupProps): react_jsx_runtime.JSX.Element;
|
|
137
|
+
interface UseRovingFocusItemReturn {
|
|
138
|
+
ref: (node: HTMLElement | null) => void;
|
|
139
|
+
tabIndex: 0 | -1;
|
|
140
|
+
onKeyDown: (event: KeyboardEvent$1) => void;
|
|
141
|
+
onFocus: () => void;
|
|
142
|
+
'data-roving-focus-item': boolean;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Inside a `RovingFocusGroup`, returns props to spread onto a focusable item.
|
|
146
|
+
* Outside, returns inert props (tabIndex 0).
|
|
147
|
+
*/
|
|
148
|
+
declare function useRovingFocusItem(): UseRovingFocusItemReturn;
|
|
149
|
+
|
|
150
|
+
interface CollectionContextValue<T> {
|
|
151
|
+
items: T[];
|
|
152
|
+
register: (item: T) => void;
|
|
153
|
+
unregister: (item: T) => void;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Factory for a typed children-registry context. Compound components
|
|
157
|
+
* (Menu, Tabs, Listbox) use this so the parent can iterate ordered children
|
|
158
|
+
* without prop-drilling.
|
|
159
|
+
*/
|
|
160
|
+
declare function createCollection<T>(): {
|
|
161
|
+
Provider: (props: {
|
|
162
|
+
children: ReactNode;
|
|
163
|
+
}) => ReactNode;
|
|
164
|
+
useCollection: () => CollectionContextValue<T>;
|
|
165
|
+
Context: Context<CollectionContextValue<T> | null>;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
interface FormControlContextValue {
|
|
169
|
+
id: string;
|
|
170
|
+
labelId: string;
|
|
171
|
+
helperId: string;
|
|
172
|
+
errorId: string;
|
|
173
|
+
isInvalid: boolean;
|
|
174
|
+
isDisabled: boolean;
|
|
175
|
+
isRequired: boolean;
|
|
176
|
+
isReadOnly: boolean;
|
|
177
|
+
}
|
|
178
|
+
interface FormControlProviderProps {
|
|
179
|
+
/** Override the auto-generated id (also used as control's `id`). */
|
|
180
|
+
id?: string;
|
|
181
|
+
isInvalid?: boolean;
|
|
182
|
+
isDisabled?: boolean;
|
|
183
|
+
isRequired?: boolean;
|
|
184
|
+
isReadOnly?: boolean;
|
|
185
|
+
children: ReactNode;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Wires Label ↔ control ↔ HelperText/ErrorMessage via stable IDs and shared
|
|
189
|
+
* state flags. Used by `FormField` (L4) — atoms (Input, Label, etc.) read
|
|
190
|
+
* via `useFormControl()` to get the right `id`/`htmlFor`/`aria-describedby`.
|
|
191
|
+
*/
|
|
192
|
+
declare function FormControlProvider({ id: providedId, isInvalid, isDisabled, isRequired, isReadOnly, children, }: FormControlProviderProps): react_jsx_runtime.JSX.Element;
|
|
193
|
+
/**
|
|
194
|
+
* Read the surrounding form-control context. Returns `null` when used
|
|
195
|
+
* outside a provider — atoms gracefully degrade to standalone mode.
|
|
196
|
+
*/
|
|
197
|
+
declare function useFormControl(): FormControlContextValue | null;
|
|
198
|
+
|
|
199
|
+
interface ScrollLockProviderProps {
|
|
200
|
+
enabled?: boolean;
|
|
201
|
+
children: ReactNode;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Component wrapper around `useScrollLock` — handy when scroll lock should
|
|
205
|
+
* follow a child's mount lifecycle (e.g. inside a Modal's portal).
|
|
206
|
+
* Multiple wrappers stack; lock releases when the count reaches zero.
|
|
207
|
+
*/
|
|
208
|
+
declare function ScrollLockProvider({ enabled, children }: ScrollLockProviderProps): react_jsx_runtime.JSX.Element;
|
|
209
|
+
|
|
210
|
+
declare const index_AccessibleIcon: typeof AccessibleIcon;
|
|
211
|
+
type index_AccessibleIconProps = AccessibleIconProps;
|
|
212
|
+
declare const index_AnchoredPositioner: typeof AnchoredPositioner;
|
|
213
|
+
type index_AnchoredPositionerProps = AnchoredPositionerProps;
|
|
214
|
+
type index_CollectionContextValue<T> = CollectionContextValue<T>;
|
|
215
|
+
type index_Direction = Direction;
|
|
216
|
+
declare const index_DirectionProvider: typeof DirectionProvider;
|
|
217
|
+
type index_DirectionProviderProps = DirectionProviderProps;
|
|
218
|
+
declare const index_DismissableLayer: typeof DismissableLayer;
|
|
219
|
+
type index_DismissableLayerProps = DismissableLayerProps;
|
|
220
|
+
declare const index_FocusScope: typeof FocusScope;
|
|
221
|
+
type index_FocusScopeProps = FocusScopeProps;
|
|
222
|
+
type index_FormControlContextValue = FormControlContextValue;
|
|
223
|
+
declare const index_FormControlProvider: typeof FormControlProvider;
|
|
224
|
+
type index_FormControlProviderProps = FormControlProviderProps;
|
|
225
|
+
type index_Orientation = Orientation;
|
|
226
|
+
declare const index_Portal: typeof Portal;
|
|
227
|
+
type index_PortalProps = PortalProps;
|
|
228
|
+
declare const index_Presence: typeof Presence;
|
|
229
|
+
type index_PresenceProps = PresenceProps;
|
|
230
|
+
declare const index_RovingFocusGroup: typeof RovingFocusGroup;
|
|
231
|
+
type index_RovingFocusGroupProps = RovingFocusGroupProps;
|
|
232
|
+
declare const index_ScrollLockProvider: typeof ScrollLockProvider;
|
|
233
|
+
type index_ScrollLockProviderProps = ScrollLockProviderProps;
|
|
234
|
+
declare const index_Slot: typeof Slot;
|
|
235
|
+
type index_SlotProps = SlotProps;
|
|
236
|
+
type index_UseRovingFocusItemReturn = UseRovingFocusItemReturn;
|
|
237
|
+
declare const index_VisuallyHidden: typeof VisuallyHidden;
|
|
238
|
+
type index_VisuallyHiddenProps = VisuallyHiddenProps;
|
|
239
|
+
declare const index_createCollection: typeof createCollection;
|
|
240
|
+
declare const index_useDirection: typeof useDirection;
|
|
241
|
+
declare const index_useFormControl: typeof useFormControl;
|
|
242
|
+
declare const index_useRovingFocusItem: typeof useRovingFocusItem;
|
|
243
|
+
declare namespace index {
|
|
244
|
+
export { index_AccessibleIcon as AccessibleIcon, type index_AccessibleIconProps as AccessibleIconProps, index_AnchoredPositioner as AnchoredPositioner, type index_AnchoredPositionerProps as AnchoredPositionerProps, type index_CollectionContextValue as CollectionContextValue, type index_Direction as Direction, index_DirectionProvider as DirectionProvider, type index_DirectionProviderProps as DirectionProviderProps, index_DismissableLayer as DismissableLayer, type index_DismissableLayerProps as DismissableLayerProps, index_FocusScope as FocusScope, type index_FocusScopeProps as FocusScopeProps, type index_FormControlContextValue as FormControlContextValue, index_FormControlProvider as FormControlProvider, type index_FormControlProviderProps as FormControlProviderProps, type index_Orientation as Orientation, index_Portal as Portal, type index_PortalProps as PortalProps, index_Presence as Presence, type index_PresenceProps as PresenceProps, index_RovingFocusGroup as RovingFocusGroup, type index_RovingFocusGroupProps as RovingFocusGroupProps, index_ScrollLockProvider as ScrollLockProvider, type index_ScrollLockProviderProps as ScrollLockProviderProps, index_Slot as Slot, type index_SlotProps as SlotProps, type index_UseRovingFocusItemReturn as UseRovingFocusItemReturn, index_VisuallyHidden as VisuallyHidden, type index_VisuallyHiddenProps as VisuallyHiddenProps, index_createCollection as createCollection, index_useDirection as useDirection, index_useFormControl as useFormControl, index_useRovingFocusItem as useRovingFocusItem };
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export { AccessibleIcon as A, type CollectionContextValue as C, type Direction as D, FocusScope as F, type Orientation as O, Portal as P, RovingFocusGroup as R, ScrollLockProvider as S, type UseRovingFocusItemReturn as U, VisuallyHidden as V, type AccessibleIconProps as a, AnchoredPositioner as b, type AnchoredPositionerProps as c, DirectionProvider as d, type DirectionProviderProps as e, DismissableLayer as f, type DismissableLayerProps as g, type FocusScopeProps as h, index as i, type FormControlContextValue as j, FormControlProvider as k, type FormControlProviderProps as l, type PortalProps as m, Presence as n, type PresenceProps as o, type RovingFocusGroupProps as p, type ScrollLockProviderProps as q, Slot as r, type SlotProps as s, type VisuallyHiddenProps as t, createCollection as u, useDirection as v, useFormControl as w, useRovingFocusItem as x };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ClassValue } from 'clsx';
|
|
2
|
+
import { Ref, SyntheticEvent, ElementType, ComponentPropsWithRef, PropsWithoutRef } from 'react';
|
|
3
|
+
import { VariantProps, tv } from 'tailwind-variants';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Conditional class composer with Tailwind conflict-resolution.
|
|
7
|
+
* Use anywhere you'd otherwise concatenate class strings.
|
|
8
|
+
*/
|
|
9
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
10
|
+
|
|
11
|
+
type PossibleRef<T> = Ref<T> | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Merge multiple React refs (callback or object) into a single callback ref.
|
|
14
|
+
* Use to forward a ref while also keeping a local ref to the same node.
|
|
15
|
+
*/
|
|
16
|
+
declare function composeRefs<T>(...refs: PossibleRef<T>[]): (node: T | null) => void;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Chain two event handlers. The first handler runs, then the second — unless
|
|
20
|
+
* the first called `event.preventDefault()`, in which case the second is skipped.
|
|
21
|
+
* Use when overriding a default handler from a parent while still allowing
|
|
22
|
+
* the consumer to provide their own.
|
|
23
|
+
*/
|
|
24
|
+
declare function composeEventHandlers<E extends SyntheticEvent>(theirHandler: ((event: E) => void) | undefined, ourHandler: (event: E) => void, { checkForDefaultPrevented }?: {
|
|
25
|
+
checkForDefaultPrevented?: boolean;
|
|
26
|
+
}): (event: E) => void;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Returns `""` when the condition is true, `undefined` otherwise.
|
|
30
|
+
* Use for boolean `data-*` attributes — React strips the attr when value is undefined,
|
|
31
|
+
* so the DOM cleanly toggles `data-state` rather than `data-state="false"`.
|
|
32
|
+
*/
|
|
33
|
+
declare function dataAttr(condition: boolean | undefined): '' | undefined;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Props for a polymorphic component (`as` prop). Use only when a component
|
|
37
|
+
* meaningfully changes its DOM element — most components should use `Slot`/`asChild`
|
|
38
|
+
* instead.
|
|
39
|
+
*/
|
|
40
|
+
type PolymorphicProps<C extends ElementType, P = object> = P & Omit<ComponentPropsWithRef<C>, keyof P | 'as'> & {
|
|
41
|
+
as?: C;
|
|
42
|
+
};
|
|
43
|
+
type PolymorphicPropsWithoutRef<C extends ElementType, P = object> = P & Omit<PropsWithoutRef<ComponentPropsWithRef<C>>, keyof P | 'as'> & {
|
|
44
|
+
as?: C;
|
|
45
|
+
};
|
|
46
|
+
type PolymorphicRef<C extends ElementType> = ComponentPropsWithRef<C>['ref'];
|
|
47
|
+
|
|
48
|
+
type index_PolymorphicProps<C extends ElementType, P = object> = PolymorphicProps<C, P>;
|
|
49
|
+
type index_PolymorphicPropsWithoutRef<C extends ElementType, P = object> = PolymorphicPropsWithoutRef<C, P>;
|
|
50
|
+
type index_PolymorphicRef<C extends ElementType> = PolymorphicRef<C>;
|
|
51
|
+
declare const index_VariantProps: typeof VariantProps;
|
|
52
|
+
declare const index_cn: typeof cn;
|
|
53
|
+
declare const index_composeEventHandlers: typeof composeEventHandlers;
|
|
54
|
+
declare const index_composeRefs: typeof composeRefs;
|
|
55
|
+
declare const index_dataAttr: typeof dataAttr;
|
|
56
|
+
declare const index_tv: typeof tv;
|
|
57
|
+
declare namespace index {
|
|
58
|
+
export { type index_PolymorphicProps as PolymorphicProps, type index_PolymorphicPropsWithoutRef as PolymorphicPropsWithoutRef, type index_PolymorphicRef as PolymorphicRef, index_VariantProps as VariantProps, index_cn as cn, index_composeEventHandlers as composeEventHandlers, index_composeRefs as composeRefs, index_dataAttr as dataAttr, index_tv as tv };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { type PolymorphicProps as P, type PolymorphicPropsWithoutRef as a, type PolymorphicRef as b, cn as c, composeEventHandlers as d, composeRefs as e, dataAttr as f, index as i };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { SVGProps, ComponentType } from 'react';
|
|
3
|
+
|
|
4
|
+
interface IconAdapterProps extends SVGProps<SVGSVGElement> {
|
|
5
|
+
size?: number | string;
|
|
6
|
+
}
|
|
7
|
+
type IconAdapter = ComponentType<IconAdapterProps>;
|
|
8
|
+
interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'aria-hidden'> {
|
|
9
|
+
/** Icon component — pass a `lucide-react` icon, custom SVG component, or any matching shape. */
|
|
10
|
+
icon: IconAdapter;
|
|
11
|
+
/** Pixel size of the rendered SVG. Default 20. */
|
|
12
|
+
size?: number | string;
|
|
13
|
+
/**
|
|
14
|
+
* Provide an aria-label when the icon stands alone (decorative siblings
|
|
15
|
+
* should pass it via parent). Sets `role="img"` and unhides from AT.
|
|
16
|
+
* Without it, the icon is `aria-hidden` and decorative.
|
|
17
|
+
*/
|
|
18
|
+
'aria-label'?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Generic icon wrapper. Accepts any icon component matching the lucide-react
|
|
22
|
+
* shape (`{ size, color, className, ...svgProps }`).
|
|
23
|
+
*
|
|
24
|
+
* - Without `aria-label` → decorative, `aria-hidden`.
|
|
25
|
+
* - With `aria-label` → semantic, `role="img"`.
|
|
26
|
+
*/
|
|
27
|
+
declare const Icon: react.ForwardRefExoticComponent<Omit<IconProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
28
|
+
|
|
29
|
+
declare const index_Icon: typeof Icon;
|
|
30
|
+
type index_IconAdapter = IconAdapter;
|
|
31
|
+
type index_IconAdapterProps = IconAdapterProps;
|
|
32
|
+
type index_IconProps = IconProps;
|
|
33
|
+
declare namespace index {
|
|
34
|
+
export { index_Icon as Icon, type index_IconAdapter as IconAdapter, type index_IconAdapterProps as IconAdapterProps, type index_IconProps as IconProps };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { Icon as I, type IconAdapter as a, type IconAdapterProps as b, type IconProps as c, index as i };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Wraps React 19's `useId`. Optionally accepts a stable prefix so generated
|
|
5
|
+
* IDs are easier to spot in DevTools (e.g. `useId('checkbox')` → `:r2:-checkbox`).
|
|
6
|
+
*/
|
|
7
|
+
declare function useId(prefix?: string): string;
|
|
8
|
+
|
|
9
|
+
interface UseControlledOptions<T> {
|
|
10
|
+
controlled: T | undefined;
|
|
11
|
+
default: T;
|
|
12
|
+
onChange?: (value: T) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Standard controlled/uncontrolled pattern.
|
|
16
|
+
*
|
|
17
|
+
* - If `controlled` is defined, the component is controlled — internal state is
|
|
18
|
+
* ignored, `setValue` only fires `onChange`.
|
|
19
|
+
* - Otherwise the component owns its state, `setValue` updates it, and `onChange`
|
|
20
|
+
* still fires for consumers that want to observe changes.
|
|
21
|
+
*/
|
|
22
|
+
declare function useControlled<T>({ controlled, default: defaultValue, onChange, }: UseControlledOptions<T>): [T, (value: T) => void];
|
|
23
|
+
|
|
24
|
+
interface DisclosureControls {
|
|
25
|
+
isOpen: boolean;
|
|
26
|
+
open: () => void;
|
|
27
|
+
close: () => void;
|
|
28
|
+
toggle: () => void;
|
|
29
|
+
setOpen: (next: boolean) => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Minimal open/close state with stable callbacks. The standard backbone for
|
|
33
|
+
* Modal, Drawer, Popover, Menu, Accordion, etc. Use `useControlled` underneath
|
|
34
|
+
* when the consumer may also pass a controlled `open` prop.
|
|
35
|
+
*/
|
|
36
|
+
declare function useDisclosure(initial?: boolean): DisclosureControls;
|
|
37
|
+
|
|
38
|
+
type Target = Window | Document | HTMLElement | null;
|
|
39
|
+
/**
|
|
40
|
+
* Add an event listener and clean it up automatically. Handler is read from
|
|
41
|
+
* a ref so consumers don't need to memoize it.
|
|
42
|
+
*/
|
|
43
|
+
declare function useEventListener<K extends string>(event: K, handler: (event: Event) => void, target?: Target, options?: boolean | AddEventListenerOptions): void;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Fire `handler` when the user clicks outside any of the provided refs.
|
|
47
|
+
* Uses `pointerdown` so it fires before focus shifts (avoids losing focus
|
|
48
|
+
* inside an overlay before a click on a trigger registers).
|
|
49
|
+
*/
|
|
50
|
+
declare function useOutsideClick(refs: RefObject<HTMLElement | null> | RefObject<HTMLElement | null>[], handler: (event: PointerEvent) => void, enabled?: boolean): void;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Fire `handler` when the Escape key is pressed at the document level.
|
|
54
|
+
* For nested overlays, the topmost should call `event.stopPropagation()` in
|
|
55
|
+
* its handler — `DismissableLayer` handles this stack-style.
|
|
56
|
+
*/
|
|
57
|
+
declare function useEscape(handler: (event: KeyboardEvent) => void, enabled?: boolean): void;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Trap Tab / Shift+Tab focus inside the referenced element. On mount, focuses
|
|
61
|
+
* the first focusable child (unless already focused inside). On unmount,
|
|
62
|
+
* returns focus to the element that had it before mounting.
|
|
63
|
+
*
|
|
64
|
+
* For richer behavior (sentinels, nested traps), wrap `FocusScope` instead —
|
|
65
|
+
* this hook is the lower primitive.
|
|
66
|
+
*/
|
|
67
|
+
declare function useFocusTrap(ref: RefObject<HTMLElement | null>, enabled?: boolean): void;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Prevent body scroll while at least one consumer has the lock active.
|
|
71
|
+
* Internally counted — multiple overlays may lock; only the last unlock restores.
|
|
72
|
+
* Compensates for scrollbar width to avoid layout shift.
|
|
73
|
+
*/
|
|
74
|
+
declare function useScrollLock(enabled?: boolean): void;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Run `callback` whenever the referenced element's size changes. Returns
|
|
78
|
+
* synchronously after layout, before paint. Cleans up automatically.
|
|
79
|
+
*/
|
|
80
|
+
declare function useResizeObserver<T extends HTMLElement>(ref: RefObject<T | null>, callback: (entry: ResizeObserverEntry) => void, enabled?: boolean): void;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Reactively follow a CSS media query. Pass a query string like
|
|
84
|
+
* `'(min-width: 768px)'` or `'(prefers-reduced-motion: reduce)'`.
|
|
85
|
+
*/
|
|
86
|
+
declare function useMediaQuery(query: string): boolean;
|
|
87
|
+
|
|
88
|
+
type index_DisclosureControls = DisclosureControls;
|
|
89
|
+
declare const index_useControlled: typeof useControlled;
|
|
90
|
+
declare const index_useDisclosure: typeof useDisclosure;
|
|
91
|
+
declare const index_useEscape: typeof useEscape;
|
|
92
|
+
declare const index_useEventListener: typeof useEventListener;
|
|
93
|
+
declare const index_useFocusTrap: typeof useFocusTrap;
|
|
94
|
+
declare const index_useId: typeof useId;
|
|
95
|
+
declare const index_useMediaQuery: typeof useMediaQuery;
|
|
96
|
+
declare const index_useOutsideClick: typeof useOutsideClick;
|
|
97
|
+
declare const index_useResizeObserver: typeof useResizeObserver;
|
|
98
|
+
declare const index_useScrollLock: typeof useScrollLock;
|
|
99
|
+
declare namespace index {
|
|
100
|
+
export { type index_DisclosureControls as DisclosureControls, index_useControlled as useControlled, index_useDisclosure as useDisclosure, index_useEscape as useEscape, index_useEventListener as useEventListener, index_useFocusTrap as useFocusTrap, index_useId as useId, index_useMediaQuery as useMediaQuery, index_useOutsideClick as useOutsideClick, index_useResizeObserver as useResizeObserver, index_useScrollLock as useScrollLock };
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { type DisclosureControls as D, useDisclosure as a, useEscape as b, useEventListener as c, useFocusTrap as d, useId as e, useMediaQuery as f, useOutsideClick as g, useResizeObserver as h, index as i, useScrollLock as j, useControlled as u };
|