@ansh-ui/react 0.2.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/LICENSE +21 -0
- package/dist/chunk-5CFQFMP5.js +178 -0
- package/dist/chunk-5CFQFMP5.js.map +1 -0
- package/dist/chunk-6VRF7X5C.cjs +164 -0
- package/dist/chunk-6VRF7X5C.cjs.map +1 -0
- package/dist/chunk-AVPEA5PB.cjs +718 -0
- package/dist/chunk-AVPEA5PB.cjs.map +1 -0
- package/dist/chunk-C32LKF23.cjs +198 -0
- package/dist/chunk-C32LKF23.cjs.map +1 -0
- package/dist/chunk-C5JG6TMM.cjs +1200 -0
- package/dist/chunk-C5JG6TMM.cjs.map +1 -0
- package/dist/chunk-DATBU46V.cjs +614 -0
- package/dist/chunk-DATBU46V.cjs.map +1 -0
- package/dist/chunk-EGG4CP7C.js +320 -0
- package/dist/chunk-EGG4CP7C.js.map +1 -0
- package/dist/chunk-H34OXXJU.js +55 -0
- package/dist/chunk-H34OXXJU.js.map +1 -0
- package/dist/chunk-HO2YSF5O.js +187 -0
- package/dist/chunk-HO2YSF5O.js.map +1 -0
- package/dist/chunk-HPGCILO4.js +760 -0
- package/dist/chunk-HPGCILO4.js.map +1 -0
- package/dist/chunk-IBXLC5IE.js +154 -0
- package/dist/chunk-IBXLC5IE.js.map +1 -0
- package/dist/chunk-LDCZQP3R.js +1185 -0
- package/dist/chunk-LDCZQP3R.js.map +1 -0
- package/dist/chunk-LXCIXR5T.js +27 -0
- package/dist/chunk-LXCIXR5T.js.map +1 -0
- package/dist/chunk-O2PX54KX.js +94 -0
- package/dist/chunk-O2PX54KX.js.map +1 -0
- package/dist/chunk-OHBWBXLO.cjs +101 -0
- package/dist/chunk-OHBWBXLO.cjs.map +1 -0
- package/dist/chunk-OJN5JBNP.cjs +776 -0
- package/dist/chunk-OJN5JBNP.cjs.map +1 -0
- package/dist/chunk-OLTS6G5M.js +606 -0
- package/dist/chunk-OLTS6G5M.js.map +1 -0
- package/dist/chunk-PO5DU3FU.cjs +29 -0
- package/dist/chunk-PO5DU3FU.cjs.map +1 -0
- package/dist/chunk-QO3E7TJS.js +2940 -0
- package/dist/chunk-QO3E7TJS.js.map +1 -0
- package/dist/chunk-RHTLNSVW.cjs +2976 -0
- package/dist/chunk-RHTLNSVW.cjs.map +1 -0
- package/dist/chunk-SFU5EPSN.cjs +61 -0
- package/dist/chunk-SFU5EPSN.cjs.map +1 -0
- package/dist/chunk-T4AK2KLM.js +699 -0
- package/dist/chunk-T4AK2KLM.js.map +1 -0
- package/dist/chunk-WGYNCSTP.cjs +333 -0
- package/dist/chunk-WGYNCSTP.cjs.map +1 -0
- package/dist/chunk-XEP6P7E6.js +279 -0
- package/dist/chunk-XEP6P7E6.js.map +1 -0
- package/dist/chunk-XMXECSQO.cjs +286 -0
- package/dist/chunk-XMXECSQO.cjs.map +1 -0
- package/dist/chunk-ZWAFLHC2.cjs +181 -0
- package/dist/chunk-ZWAFLHC2.cjs.map +1 -0
- package/dist/data.cjs +71 -0
- package/dist/data.cjs.map +1 -0
- package/dist/data.d.cts +316 -0
- package/dist/data.d.ts +316 -0
- package/dist/data.js +6 -0
- package/dist/data.js.map +1 -0
- package/dist/form.cjs +153 -0
- package/dist/form.cjs.map +1 -0
- package/dist/form.d.cts +660 -0
- package/dist/form.d.ts +660 -0
- package/dist/form.js +8 -0
- package/dist/form.js.map +1 -0
- package/dist/index.cjs +1641 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +552 -0
- package/dist/index.d.ts +552 -0
- package/dist/index.js +956 -0
- package/dist/index.js.map +1 -0
- package/dist/layout.cjs +68 -0
- package/dist/layout.cjs.map +1 -0
- package/dist/layout.d.cts +169 -0
- package/dist/layout.d.ts +169 -0
- package/dist/layout.js +7 -0
- package/dist/layout.js.map +1 -0
- package/dist/motion-CQmCq6_k.d.ts +395 -0
- package/dist/motion-CSX4g2N8.d.cts +395 -0
- package/dist/motion.cjs +79 -0
- package/dist/motion.cjs.map +1 -0
- package/dist/motion.d.cts +4 -0
- package/dist/motion.d.ts +4 -0
- package/dist/motion.js +6 -0
- package/dist/motion.js.map +1 -0
- package/dist/navigation.cjs +48 -0
- package/dist/navigation.cjs.map +1 -0
- package/dist/navigation.d.cts +210 -0
- package/dist/navigation.d.ts +210 -0
- package/dist/navigation.js +7 -0
- package/dist/navigation.js.map +1 -0
- package/dist/overlay.cjs +69 -0
- package/dist/overlay.cjs.map +1 -0
- package/dist/overlay.d.cts +330 -0
- package/dist/overlay.d.ts +330 -0
- package/dist/overlay.js +8 -0
- package/dist/overlay.js.map +1 -0
- package/dist/position-DVScKcaa.d.cts +66 -0
- package/dist/position-DVScKcaa.d.ts +66 -0
- package/dist/primitives.cjs +162 -0
- package/dist/primitives.cjs.map +1 -0
- package/dist/primitives.d.cts +294 -0
- package/dist/primitives.d.ts +294 -0
- package/dist/primitives.js +9 -0
- package/dist/primitives.js.map +1 -0
- package/dist/sidebar-D-PafAXw.d.cts +71 -0
- package/dist/sidebar-D-PafAXw.d.ts +71 -0
- package/dist/styles.css +5575 -0
- package/dist/use-observers-B9qtimrk.d.cts +99 -0
- package/dist/use-observers-B9qtimrk.d.ts +99 -0
- package/package.json +92 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
export { AnchoredPosition, AnchoredPositionOptions, DismissOptions, Portal, PortalProps, Presence, PresenceProps, Slot, SlotProps, composeEventHandlers, cx, getTabbable, mergeProps, mergeRefs, slotted, useAnchoredPosition, useAnimate, useAutoFocus, useControllableState, useDismiss, useFocusRestore, useFocusTrap, useIsMounted, useMotionStyle, useMotionValue, useMotionValueState, usePresence, useRovingFocus, useScrollLock, useSpringValue } from './primitives.cjs';
|
|
2
|
+
export { I as InViewOptions, u as useElementSize, a as useFrameBudget, b as useInView, c as useMergedRef, d as usePointer, e as useReducedMotion, f as useScrollProgress, g as useTicker, h as useWindowScroll } from './use-observers-B9qtimrk.cjs';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import { ForwardRefExoticComponent, ElementType, ReactNode, ComponentPropsWithoutRef, RefAttributes, ButtonHTMLAttributes, HTMLAttributes } from 'react';
|
|
5
|
+
import * as _ansh_ui_core from '@ansh-ui/core';
|
|
6
|
+
import { BaseEffectOptions, EffectDefinition } from '@ansh-ui/core';
|
|
7
|
+
export { AnimationControls, AnimationOptions, BaseEffectOptions, ColorInput, ColorSpace, EasingInput, EffectDefinition, FrameState, Gradient, Timeline as MotionTimeline, MotionValue, PaletteName, PointerState, ReducedMotionStrategy, Rgb, SpringOptions, StaggerFrom, StaggerOptions, animate, checkContrast, createGradient, createNoise, createScale, createTimeline, cubicBezier, easings, ensureContrast, generatePalette, getRegistry, getTicker, mixColors, motionValue, palettes, parseColor, pickReadable, prefersReducedMotion, registerEasing, setReducedMotionMode, signature as signatureEasings, springs, stagger, toHex, toOklchString } from '@ansh-ui/core';
|
|
8
|
+
export { A as AnimatePresence, a as AnimatePresenceProps, b as AnimatedText, c as AnimatedTextProps, B as BehaviourComponent, d as BehaviourComponentBaseProps, e as BehaviourComponentProps, D as Draggable, f as DraggableProps, G as GradientText, g as GradientTextProps, M as MagneticButton, h as Marquee, i as Motion, j as MotionConfig, k as MotionConfigProps, l as MotionConfigValue, m as MotionTransition, n as MotionValues, P as Parallax, R as Ripple, S as ScrollReveal, T as ThemeContextValue, o as ThemeProvider, p as ThemeProviderProps, q as ThemeSetting, r as TiltCard, s as createBehaviourComponent, t as themeScript, u as useBehaviour, v as useMotionConfig, w as useTheme } from './motion-CSX4g2N8.cjs';
|
|
9
|
+
export { A as Align, P as Placement, a as PositionOptions, b as PositionResult, R as Rect, S as Side, c as computePosition } from './position-DVScKcaa.cjs';
|
|
10
|
+
export { AlertDialog, AlertDialogProps, CommandItem, CommandPalette, CommandPaletteProps, ContextMenu, ContextMenuProps, Dialog, DialogFooter, DialogProps, DialogSize, Drawer, DrawerProps, DrawerSide, DropdownMenu, HoverCard, HoverCardProps, MenuAction, MenuCheckbox, MenuEntry, MenuProps, MenuRadioGroup, MenuSubmenu, Popover, PopoverContent, PopoverContentProps, PopoverProps, PopoverTrigger, PopoverTriggerProps, Tooltip, TooltipProps, TooltipProvider, TooltipProviderProps, useCommandShortcut } from './overlay.cjs';
|
|
11
|
+
export { AspectRatio, AspectRatioProps, Center, Container, ContainerProps, Divider, DividerProps, Grid, GridItem, GridItemProps, GridProps, HStack, Resizable, ResizableProps, ScrollArea, ScrollAreaProps, SpaceToken, Spacer, SpacerProps, Stack, StackProps, VStack } from './layout.cjs';
|
|
12
|
+
export { Calendar, CalendarProps, Checkbox, CheckboxProps, ChoiceCard, ChoiceCardProps, ColorPicker, ColorPickerProps, Combobox, ComboboxProps, DatePicker, DatePickerProps, DateRange, DateRangePicker, DateRangePickerProps, Dropzone, DropzoneFile, DropzoneProps, Field, FieldContextValue, FieldProps, Fieldset, FieldsetProps, Input, InputProps, InputSize, NumberInput, NumberInputProps, OptionList, OptionListProps, PinInput, PinInputProps, Radio, RadioGroup, RadioGroupProps, RadioProps, RangeSlider, RangeSliderProps, Rating, RatingProps, Select, SelectOption, SelectProps, Slider, SliderMark, SliderProps, Switch, SwitchProps, TagsInput, TagsInputProps, Textarea, TextareaProps, VisuallyHidden, addDays, addMonths, filterOptions, firstEnabled, isSameDay, scoreOption, startOfDay, stepActive, useFieldContext, useFieldControl, useTypeahead } from './form.cjs';
|
|
13
|
+
export { Avatar, AvatarGroup, AvatarGroupProps, AvatarProps, Badge, BadgeProps, BadgeTone, CircularProgress, CircularProgressProps, CodeBlock, CodeBlockProps, Column, DataTable, DataTableProps, DescriptionList, DescriptionListProps, EmptyState, EmptyStateProps, Kbd, Meter, MeterProps, Pagination, PaginationProps, Progress, ProgressProps, SortDirection, SortState, Stat, StatProps, Table, Timeline, TimelineItem } from './data.cjs';
|
|
14
|
+
export { Accordion, AccordionItem, AccordionProps, Breadcrumbs, BreadcrumbsProps, Collapsible, CollapsibleProps, Crumb, DisclosureList, DisclosureListProps, MegaMenuColumn, MegaMenuLink, NavMenuItem, NavigationMenu, NavigationMenuProps, Step, Stepper, StepperProps, TabItem, Tabs, TabsProps } from './navigation.cjs';
|
|
15
|
+
export { A as AppShell, a as AppShellProps, N as NavItem, b as NavSection, S as Sidebar, c as SidebarProps } from './sidebar-D-PafAXw.cjs';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Turn an {@link EffectDefinition} into a React component.
|
|
19
|
+
*
|
|
20
|
+
* This factory is why the component count can scale without the maintenance cost scaling with it.
|
|
21
|
+
* Every canvas-backed component in the library is one line:
|
|
22
|
+
*
|
|
23
|
+
* ```tsx
|
|
24
|
+
* export const AuroraBackground = createEffectComponent(aurora, 'AuroraBackground')
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* and gets, for free:
|
|
28
|
+
*
|
|
29
|
+
* - **SSR safety.** The server renders only the host element and its children. The canvas is
|
|
30
|
+
* created in an effect, so server and first-client markup are byte-identical and React never
|
|
31
|
+
* reports a hydration mismatch.
|
|
32
|
+
* - **Prop diffing that doesn't remount.** Options are compared shallowly and pushed through
|
|
33
|
+
* `handle.update()`, which live-updates what it can and remounts only what it must.
|
|
34
|
+
* - **A polymorphic `as` prop**, so a background can be a `<section>`, `<div>`, or `<aside>`
|
|
35
|
+
* without a wrapper element.
|
|
36
|
+
* - **Ref forwarding** to the host element.
|
|
37
|
+
* - **Complete teardown**, verified by the leak harness in the test suite.
|
|
38
|
+
*/
|
|
39
|
+
/** Props every effect component accepts on top of its own options. */
|
|
40
|
+
interface EffectComponentBaseProps {
|
|
41
|
+
/** Element to render as the host. Default `'div'`. */
|
|
42
|
+
as?: ElementType;
|
|
43
|
+
className?: string;
|
|
44
|
+
style?: React.CSSProperties;
|
|
45
|
+
/** Content rendered above the canvas. Positioned automatically. */
|
|
46
|
+
children?: ReactNode;
|
|
47
|
+
}
|
|
48
|
+
type EffectComponentProps<Options extends BaseEffectOptions> = Options & EffectComponentBaseProps & Omit<ComponentPropsWithoutRef<'div'>, keyof Options | 'style' | 'className' | 'children'>;
|
|
49
|
+
/** The type of a component produced by {@link createEffectComponent}. */
|
|
50
|
+
type EffectComponent<Options extends BaseEffectOptions> = ForwardRefExoticComponent<EffectComponentProps<Options> & RefAttributes<HTMLElement>>;
|
|
51
|
+
declare function createEffectComponent<Options extends BaseEffectOptions>(definition: EffectDefinition<Options>, displayName?: string): EffectComponent<Options>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Canvas-backed background components.
|
|
55
|
+
*
|
|
56
|
+
* Each is a single call to {@link createEffectComponent}, which supplies SSR safety, prop
|
|
57
|
+
* diffing, ref forwarding, polymorphic `as`, and teardown. The visual behaviour lives entirely in
|
|
58
|
+
* `@ansh-ui/core`, so these definitions are the complete React binding — there is no per-component
|
|
59
|
+
* React logic to get wrong, and the Vue components are the same effects with a different factory.
|
|
60
|
+
*
|
|
61
|
+
* Every component accepts its effect's full option surface plus `as`, `className`, `style`,
|
|
62
|
+
* `children`, and any DOM attribute.
|
|
63
|
+
*
|
|
64
|
+
* ```tsx
|
|
65
|
+
* <AuroraBackground colors={['#0275f4', '#9f0550']} intensity={1.2} className="h-screen">
|
|
66
|
+
* <h1>Motion, refined.</h1>
|
|
67
|
+
* </AuroraBackground>
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
/** Vertical curtains of light with ridged filament structure. */
|
|
71
|
+
declare const AuroraBackground: EffectComponent<_ansh_ui_core.AuroraOptions>;
|
|
72
|
+
/** Soft overlapping colour fields that drift on non-repeating Lissajous paths. */
|
|
73
|
+
declare const MeshGradient: EffectComponent<_ansh_ui_core.MeshGradientOptions>;
|
|
74
|
+
/** A rotating multi-stop linear gradient. One fill per frame — the cheap option. */
|
|
75
|
+
declare const AnimatedGradient: EffectComponent<_ansh_ui_core.AnimatedGradientOptions>;
|
|
76
|
+
/** Points advected by a divergence-free curl-noise flow field. */
|
|
77
|
+
declare const ParticleField: EffectComponent<_ansh_ui_core.ParticleFieldOptions>;
|
|
78
|
+
/** Drifting nodes joined by lines, with the pointer as a live node. */
|
|
79
|
+
declare const Constellation: EffectComponent<_ansh_ui_core.ConstellationOptions>;
|
|
80
|
+
/** Streaks falling across the canvas, spawned as a Poisson process. */
|
|
81
|
+
declare const MeteorShower: EffectComponent<_ansh_ui_core.MeteorsOptions>;
|
|
82
|
+
/** Depth-parallaxed rain, optionally with splash rings. */
|
|
83
|
+
declare const Rain: EffectComponent<_ansh_ui_core.RainOptions>;
|
|
84
|
+
/** Depth-parallaxed snow with independent per-flake sway. */
|
|
85
|
+
declare const Snow: EffectComponent<_ansh_ui_core.SnowOptions>;
|
|
86
|
+
/** Wandering points with asymmetric bioluminescent pulsing. */
|
|
87
|
+
declare const Fireflies: EffectComponent<_ansh_ui_core.FirefliesOptions>;
|
|
88
|
+
/** Layered undulating bands built from three incommensurable sines plus noise. */
|
|
89
|
+
declare const Waves: EffectComponent<_ansh_ui_core.WavesOptions>;
|
|
90
|
+
/** Organic shapes morphing via noise sampled on a closed circle. */
|
|
91
|
+
declare const LiquidBlob: EffectComponent<_ansh_ui_core.BlobOptions>;
|
|
92
|
+
/**
|
|
93
|
+
* Film grain and dither overlay.
|
|
94
|
+
*
|
|
95
|
+
* Place this *above* a gradient to hide 8-bit banding and give flat colour a physical texture.
|
|
96
|
+
* It is the cheapest single change that makes a gradient look deliberate.
|
|
97
|
+
*/
|
|
98
|
+
declare const NoiseLayer: EffectComponent<_ansh_ui_core.NoiseLayerOptions>;
|
|
99
|
+
/** A soft light that follows the pointer, easing in and out of existence. */
|
|
100
|
+
declare const Spotlight: EffectComponent<_ansh_ui_core.SpotlightOptions>;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Buttons.
|
|
104
|
+
*
|
|
105
|
+
* The visual treatments are CSS — a shimmer sweep, a rotating conic border, a fill that rises on
|
|
106
|
+
* hover. None of them need JavaScript, and doing them in JS would mean tracking hover in React
|
|
107
|
+
* state and re-rendering on every pointer event.
|
|
108
|
+
*
|
|
109
|
+
* What *does* need JavaScript is the physics: magnetic attraction and the ripple both read pointer
|
|
110
|
+
* position every frame. Those come from the engine's behaviours, attached via `useBehaviour`, so
|
|
111
|
+
* the button element itself carries them rather than being wrapped in another div.
|
|
112
|
+
*/
|
|
113
|
+
type ButtonVariant = 'solid' | 'ghost' | 'shimmer' | 'glow' | 'liquid';
|
|
114
|
+
type ButtonSize = 'sm' | 'md' | 'lg';
|
|
115
|
+
interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color'> {
|
|
116
|
+
variant?: ButtonVariant;
|
|
117
|
+
size?: ButtonSize;
|
|
118
|
+
/** Render as a different element — `'a'` for links. Default `'button'`. */
|
|
119
|
+
as?: ElementType;
|
|
120
|
+
/**
|
|
121
|
+
* Pull toward the pointer, in pixels of maximum displacement. `0` disables.
|
|
122
|
+
* Spring-driven, so it has weight rather than tracking the cursor rigidly. Default `0`.
|
|
123
|
+
*/
|
|
124
|
+
magneticStrength?: number;
|
|
125
|
+
/** Emit a ripple from the point of contact. Default `false`. */
|
|
126
|
+
ripple?: boolean;
|
|
127
|
+
/** Colours for the `glow` variant's rotating border. */
|
|
128
|
+
glowColors?: readonly [string, string];
|
|
129
|
+
/** Seconds per rotation or sweep, depending on variant. */
|
|
130
|
+
duration?: number;
|
|
131
|
+
children?: ReactNode;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* ```tsx
|
|
135
|
+
* <Button variant="shimmer" magneticStrength={14}>Get started</Button>
|
|
136
|
+
* <Button variant="glow" glowColors={['#0275f4', '#9f0550']}>Upgrade</Button>
|
|
137
|
+
* <Button variant="liquid" ripple>Deploy</Button>
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
141
|
+
interface IconButtonProps extends ButtonProps {
|
|
142
|
+
/** Required: an icon-only control has no visible text, so it needs an accessible name. */
|
|
143
|
+
label: string;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* A square, icon-only button.
|
|
147
|
+
*
|
|
148
|
+
* `label` is required rather than optional. An icon-only control with no accessible name is
|
|
149
|
+
* announced as just "button" by a screen reader, and making the prop optional guarantees some
|
|
150
|
+
* consumers will omit it.
|
|
151
|
+
*/
|
|
152
|
+
declare const IconButton: react.ForwardRefExoticComponent<IconButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Cards.
|
|
156
|
+
*
|
|
157
|
+
* `SpotlightCard` and `GlowCard` both need the pointer position, but neither needs the full
|
|
158
|
+
* `trackPointer` machinery from the engine — they write two CSS custom properties and let the
|
|
159
|
+
* stylesheet do the rest, which is cheaper and doesn't need a spring. Writing to
|
|
160
|
+
* `style.setProperty` bypasses React's render cycle entirely, which is what keeps a 60 Hz pointer
|
|
161
|
+
* handler from costing a re-render.
|
|
162
|
+
*/
|
|
163
|
+
interface SpotlightCardProps extends HTMLAttributes<HTMLDivElement> {
|
|
164
|
+
as?: ElementType;
|
|
165
|
+
/** Highlight colour. Any CSS colour. Default a soft brand blue. */
|
|
166
|
+
color?: string;
|
|
167
|
+
/** Diameter of the highlight in pixels. Default `320`. */
|
|
168
|
+
size?: number;
|
|
169
|
+
children?: ReactNode;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* A card with a radial highlight that follows the pointer.
|
|
173
|
+
*
|
|
174
|
+
* ```tsx
|
|
175
|
+
* <SpotlightCard color="rgb(2 117 244 / 0.25)">
|
|
176
|
+
* <h3>Fast by default</h3>
|
|
177
|
+
* </SpotlightCard>
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
declare const SpotlightCard: react.ForwardRefExoticComponent<SpotlightCardProps & react.RefAttributes<HTMLDivElement>>;
|
|
181
|
+
interface GlowCardProps extends HTMLAttributes<HTMLDivElement> {
|
|
182
|
+
as?: ElementType;
|
|
183
|
+
/** The rotating border's colour stops. Default the Ansh house gradient. */
|
|
184
|
+
colors?: readonly [string, string];
|
|
185
|
+
/** Seconds per full rotation. Default `6`. */
|
|
186
|
+
duration?: number;
|
|
187
|
+
children?: ReactNode;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* A card with a slowly rotating conic-gradient border.
|
|
191
|
+
*
|
|
192
|
+
* The rotation is driven by an `@property`-registered custom angle animated via CSS `@keyframes`
|
|
193
|
+
* — no JavaScript runs per frame. `@property` is what makes a custom property animatable at all;
|
|
194
|
+
* without it browsers cannot interpolate between angle values and the gradient would jump.
|
|
195
|
+
*/
|
|
196
|
+
declare const GlowCard: react.ForwardRefExoticComponent<GlowCardProps & react.RefAttributes<HTMLDivElement>>;
|
|
197
|
+
interface TiltCard3DProps extends HTMLAttributes<HTMLDivElement> {
|
|
198
|
+
as?: ElementType;
|
|
199
|
+
/** Maximum rotation in degrees. Default `12`. */
|
|
200
|
+
max?: number;
|
|
201
|
+
children?: ReactNode;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* A lightweight 3D tilt, independent of the full `TiltCard` behaviour.
|
|
205
|
+
*
|
|
206
|
+
* `@ansh-ui/react` already exports `TiltCard` (spring-driven, glare, the engine's `tilt`
|
|
207
|
+
* behaviour) — reach for that when the interaction should feel weighted. This is the CSS-only
|
|
208
|
+
* sibling for a bento tile or a small preview card where a spring is more machinery than the
|
|
209
|
+
* moment calls for; it follows the pointer directly with a `transition` easing back to rest.
|
|
210
|
+
*/
|
|
211
|
+
declare const TiltCard3D: react.ForwardRefExoticComponent<TiltCard3DProps & react.RefAttributes<HTMLDivElement>>;
|
|
212
|
+
interface BentoGridProps extends HTMLAttributes<HTMLDivElement> {
|
|
213
|
+
/** Number of columns at desktop width. Default `3`. */
|
|
214
|
+
columns?: number;
|
|
215
|
+
children?: ReactNode;
|
|
216
|
+
}
|
|
217
|
+
/** A responsive bento layout. Collapses to a single column below 768px. */
|
|
218
|
+
declare function BentoGrid({ columns, className, style, children, ...rest }: BentoGridProps): react.JSX.Element;
|
|
219
|
+
interface BentoItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
220
|
+
/** Columns this tile spans. Default `1`. */
|
|
221
|
+
span?: number;
|
|
222
|
+
/** Rows this tile spans. Default `1`. */
|
|
223
|
+
rowSpan?: number;
|
|
224
|
+
children?: ReactNode;
|
|
225
|
+
}
|
|
226
|
+
declare function BentoItem({ span, rowSpan, className, style, children, ...rest }: BentoItemProps): react.JSX.Element;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* A macOS-style dock with pointer magnification.
|
|
230
|
+
*
|
|
231
|
+
* Two details separate a dock that feels right from one that doesn't:
|
|
232
|
+
*
|
|
233
|
+
* **Magnification is a distance falloff, not a hover state.** Only scaling the hovered item makes
|
|
234
|
+
* neighbours snap in and out abruptly. Real docks scale every item by its distance from the
|
|
235
|
+
* pointer, so the bulge is continuous and the whole row responds as one surface.
|
|
236
|
+
*
|
|
237
|
+
* **Sizes are eased toward their target, not set directly.** Writing the computed size straight to
|
|
238
|
+
* the node makes the dock track the cursor rigidly, which reads as weightless. A per-frame ease
|
|
239
|
+
* gives it a small amount of lag — the thing that makes it feel physical.
|
|
240
|
+
*
|
|
241
|
+
* Both run in the ticker's write phase and mutate `style.width` directly. Doing this through React
|
|
242
|
+
* state would re-render the whole dock on every pointer move.
|
|
243
|
+
*/
|
|
244
|
+
interface DockItem {
|
|
245
|
+
/** Icon or short label. Rendered inside the tile. */
|
|
246
|
+
icon: ReactNode;
|
|
247
|
+
/** Tooltip text, and the accessible name for the control. */
|
|
248
|
+
label: string;
|
|
249
|
+
onClick?: () => void;
|
|
250
|
+
href?: string;
|
|
251
|
+
}
|
|
252
|
+
interface DockProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
253
|
+
items: readonly DockItem[];
|
|
254
|
+
/** Resting tile size in pixels. Default `48`. */
|
|
255
|
+
size?: number;
|
|
256
|
+
/** Size of a tile directly under the pointer. Default `80`. */
|
|
257
|
+
magnification?: number;
|
|
258
|
+
/**
|
|
259
|
+
* How far the magnification reaches, in pixels. Larger values bulge more neighbours.
|
|
260
|
+
* Default `140`.
|
|
261
|
+
*/
|
|
262
|
+
distance?: number;
|
|
263
|
+
}
|
|
264
|
+
declare function Dock({ items, size, magnification, distance, className, ...rest }: DockProps): react.JSX.Element;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Text effects.
|
|
268
|
+
*
|
|
269
|
+
* All three share one accessibility rule: the *complete* text is always present for assistive
|
|
270
|
+
* technology, even when only part of it is visible. A typewriter that renders one character at a
|
|
271
|
+
* time into the DOM would have a screen reader announce a partial word, then re-announce the
|
|
272
|
+
* string on every keystroke.
|
|
273
|
+
*/
|
|
274
|
+
interface TypewriterProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
275
|
+
/** Strings to type in sequence. A single string types once and stops. */
|
|
276
|
+
words: string | readonly string[];
|
|
277
|
+
/** Characters typed per second. Default `24`. */
|
|
278
|
+
speed?: number;
|
|
279
|
+
/** Characters deleted per second. Default `40` — deleting reads as faster than typing. */
|
|
280
|
+
deleteSpeed?: number;
|
|
281
|
+
/** Seconds to hold a completed word before deleting. Default `1.6`. */
|
|
282
|
+
pause?: number;
|
|
283
|
+
/** Loop through the list. Default `true` when given several words. */
|
|
284
|
+
loop?: boolean;
|
|
285
|
+
/** Show a blinking caret. Default `true`. */
|
|
286
|
+
caret?: boolean;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* A typewriter that cycles through phrases.
|
|
290
|
+
*
|
|
291
|
+
* ```tsx
|
|
292
|
+
* <Typewriter words={['ship faster', 'sleep better', 'stay sane']} />
|
|
293
|
+
* ```
|
|
294
|
+
*
|
|
295
|
+
* Under reduced motion it renders the first phrase statically — a caret blinking indefinitely is a
|
|
296
|
+
* photosensitivity concern, and the content is the point rather than the typing.
|
|
297
|
+
*/
|
|
298
|
+
declare function Typewriter({ words, speed, deleteSpeed, pause, loop, caret, className, ...rest }: TypewriterProps): react.JSX.Element;
|
|
299
|
+
interface ShinyTextProps extends HTMLAttributes<HTMLSpanElement> {
|
|
300
|
+
/** Seconds per sweep. Default `3`. */
|
|
301
|
+
duration?: number;
|
|
302
|
+
children: React.ReactNode;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Text with a highlight sweeping across it.
|
|
306
|
+
*
|
|
307
|
+
* Pure CSS — a moving `background-position` on a gradient clipped to the glyphs. Nothing runs per
|
|
308
|
+
* frame on the main thread, so this is effectively free even repeated across a page.
|
|
309
|
+
*/
|
|
310
|
+
declare function ShinyText({ duration, className, style, children, ...rest }: ShinyTextProps): react.JSX.Element;
|
|
311
|
+
interface NumberTickerProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
312
|
+
value: number;
|
|
313
|
+
/** Seconds to count up. Default `1.4`. */
|
|
314
|
+
duration?: number;
|
|
315
|
+
/** Decimal places. Default `0`. */
|
|
316
|
+
decimals?: number;
|
|
317
|
+
prefix?: string;
|
|
318
|
+
suffix?: string;
|
|
319
|
+
/** Start counting when scrolled into view. Default `true`. */
|
|
320
|
+
whenInView?: boolean;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* A number that counts up to its value.
|
|
324
|
+
*
|
|
325
|
+
* Counts on the shared ticker with an ease-out curve, so it decelerates into the final figure
|
|
326
|
+
* rather than stopping dead. Formatting goes through `Intl.NumberFormat`, which means thousands
|
|
327
|
+
* separators follow the user's locale instead of being hardcoded to commas.
|
|
328
|
+
*/
|
|
329
|
+
declare function NumberTicker({ value, duration, decimals, prefix, suffix, whenInView, className, ...rest }: NumberTickerProps): react.JSX.Element;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Loaders and feedback.
|
|
333
|
+
*
|
|
334
|
+
* The recurring theme: a loading or status indicator must be announced, not just drawn. A spinner
|
|
335
|
+
* with no accessible name is invisible to a screen reader, and a toast that appears silently is a
|
|
336
|
+
* message the user never receives.
|
|
337
|
+
*/
|
|
338
|
+
interface SpinnerProps extends HTMLAttributes<HTMLSpanElement> {
|
|
339
|
+
/** Diameter in pixels. Default `24`. */
|
|
340
|
+
size?: number;
|
|
341
|
+
/** Ring thickness in pixels. Default `3`. */
|
|
342
|
+
thickness?: number;
|
|
343
|
+
/** Accessible label. Default `'Loading'`. Pass `null` if a sibling already announces it. */
|
|
344
|
+
label?: string | null;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* A ring spinner.
|
|
348
|
+
*
|
|
349
|
+
* One element: a conic gradient masked to a ring. No SVG, and it inherits `currentColor`, so it
|
|
350
|
+
* takes the colour of whatever it sits inside without configuration.
|
|
351
|
+
*/
|
|
352
|
+
declare function Spinner({ size, thickness, label, className, style, ...rest }: SpinnerProps): react.JSX.Element;
|
|
353
|
+
interface DotsProps extends HTMLAttributes<HTMLSpanElement> {
|
|
354
|
+
size?: number;
|
|
355
|
+
label?: string | null;
|
|
356
|
+
}
|
|
357
|
+
/** Three bouncing dots. Reads as "thinking" where a spinner reads as "fetching". */
|
|
358
|
+
declare function LoadingDots({ size, label, className, style, ...rest }: DotsProps): react.JSX.Element;
|
|
359
|
+
interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {
|
|
360
|
+
width?: number | string;
|
|
361
|
+
height?: number | string;
|
|
362
|
+
/** Fully rounded, for avatars. Default `false`. */
|
|
363
|
+
circle?: boolean;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* A loading placeholder with a moving sheen.
|
|
367
|
+
*
|
|
368
|
+
* Marked `aria-hidden` deliberately: a skeleton is a visual stand-in with no content to announce.
|
|
369
|
+
* The container should carry `aria-busy="true"` so assistive technology knows something is loading.
|
|
370
|
+
*/
|
|
371
|
+
declare function Skeleton({ width, height, circle, className, style, ...rest }: SkeletonProps): react.JSX.Element;
|
|
372
|
+
type ToastVariant = 'info' | 'success' | 'error';
|
|
373
|
+
interface Toast {
|
|
374
|
+
id: string;
|
|
375
|
+
title?: string;
|
|
376
|
+
message: ReactNode;
|
|
377
|
+
variant?: ToastVariant;
|
|
378
|
+
/** Milliseconds before auto-dismiss. `0` keeps it until dismissed. Default `4500`. */
|
|
379
|
+
duration?: number;
|
|
380
|
+
}
|
|
381
|
+
interface ToastContextValue {
|
|
382
|
+
toast: (toast: Omit<Toast, 'id'>) => string;
|
|
383
|
+
dismiss: (id: string) => void;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Provider for the toast system.
|
|
387
|
+
*
|
|
388
|
+
* ```tsx
|
|
389
|
+
* <ToastProvider><App /></ToastProvider>
|
|
390
|
+
*
|
|
391
|
+
* const { toast } = useToast()
|
|
392
|
+
* toast({ title: 'Deployed', message: 'Live in 1.2s', variant: 'success' })
|
|
393
|
+
* ```
|
|
394
|
+
*/
|
|
395
|
+
declare function ToastProvider({ children }: {
|
|
396
|
+
children?: ReactNode;
|
|
397
|
+
}): react.JSX.Element;
|
|
398
|
+
declare function useToast(): ToastContextValue;
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Marketing components.
|
|
402
|
+
*
|
|
403
|
+
* These are the ones a landing page actually needs, and the two places they usually go wrong are
|
|
404
|
+
* both handled here: an accordion that animates to intrinsic content height without JavaScript
|
|
405
|
+
* measurement, and a pricing table whose "recommended" plan is conveyed by more than colour.
|
|
406
|
+
*/
|
|
407
|
+
interface PricingPlan {
|
|
408
|
+
name: string;
|
|
409
|
+
price: string;
|
|
410
|
+
/** Billing period, e.g. `'/month'`. */
|
|
411
|
+
period?: string;
|
|
412
|
+
description?: string;
|
|
413
|
+
features: readonly string[];
|
|
414
|
+
/** Highlight this plan. Renders elevated with a badge. */
|
|
415
|
+
featured?: boolean;
|
|
416
|
+
badge?: string;
|
|
417
|
+
cta?: {
|
|
418
|
+
label: string;
|
|
419
|
+
href?: string;
|
|
420
|
+
onClick?: () => void;
|
|
421
|
+
variant?: ButtonVariant;
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
interface PricingTableProps {
|
|
425
|
+
plans: readonly PricingPlan[];
|
|
426
|
+
className?: string;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* A responsive pricing table.
|
|
430
|
+
*
|
|
431
|
+
* The featured plan is distinguished three ways — elevation, a text badge, and a filled CTA —
|
|
432
|
+
* rather than by colour alone. Colour-only emphasis fails WCAG 1.4.1 and is invisible to a
|
|
433
|
+
* colour-blind user, which for a pricing page means the recommended plan simply isn't recommended.
|
|
434
|
+
*/
|
|
435
|
+
declare function PricingTable({ plans, className }: PricingTableProps): react.JSX.Element;
|
|
436
|
+
/**
|
|
437
|
+
* A single question/answer pair.
|
|
438
|
+
*
|
|
439
|
+
* Named `FaqItem` rather than `AccordionItem` because the general-purpose `Accordion` owns that
|
|
440
|
+
* name. The two are genuinely different shapes: this one is question/answer, the general one is
|
|
441
|
+
* title/content with icons, subtitles and per-item disabled state.
|
|
442
|
+
*/
|
|
443
|
+
interface FaqItem {
|
|
444
|
+
question: string;
|
|
445
|
+
answer: ReactNode;
|
|
446
|
+
}
|
|
447
|
+
interface FAQAccordionProps {
|
|
448
|
+
items: readonly FaqItem[];
|
|
449
|
+
/** Allow several panels open at once. Default `false`. */
|
|
450
|
+
multiple?: boolean;
|
|
451
|
+
/** Index open on first render. Omit for all closed. */
|
|
452
|
+
defaultOpen?: number;
|
|
453
|
+
className?: string;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* An accordion.
|
|
457
|
+
*
|
|
458
|
+
* The height transition uses `grid-template-rows: 0fr → 1fr`, which is the only way to animate to
|
|
459
|
+
* *intrinsic* content height in pure CSS. The usual alternatives both fail: a fixed `max-height`
|
|
460
|
+
* either clips long answers or eases at the wrong rate, and measuring `scrollHeight` in JavaScript
|
|
461
|
+
* means a layout read per toggle and a stale value whenever the content reflows.
|
|
462
|
+
*
|
|
463
|
+
* Uses native `<button>` triggers with `aria-expanded` and `aria-controls`, so keyboard and screen
|
|
464
|
+
* reader behaviour is correct without a roving tabindex.
|
|
465
|
+
*/
|
|
466
|
+
declare function FAQAccordion({ items, multiple, defaultOpen, className, }: FAQAccordionProps): react.JSX.Element;
|
|
467
|
+
|
|
468
|
+
type AlertTone = 'info' | 'success' | 'warning' | 'danger' | 'neutral';
|
|
469
|
+
interface AlertProps {
|
|
470
|
+
tone?: AlertTone;
|
|
471
|
+
title?: ReactNode;
|
|
472
|
+
children?: ReactNode;
|
|
473
|
+
/** Replace the default icon, or pass `null` to omit it. */
|
|
474
|
+
icon?: ReactNode | null;
|
|
475
|
+
/** Show a dismiss button. */
|
|
476
|
+
dismissible?: boolean;
|
|
477
|
+
onDismiss?: () => void;
|
|
478
|
+
/** Buttons or links under the message. */
|
|
479
|
+
actions?: ReactNode;
|
|
480
|
+
variant?: 'soft' | 'outline' | 'solid';
|
|
481
|
+
className?: string;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* An inline message.
|
|
485
|
+
*
|
|
486
|
+
* The `role` follows the tone, because it decides whether a screen reader interrupts:
|
|
487
|
+
* `role="alert"` (assertive) for errors and warnings, which the user needs to know about *now*;
|
|
488
|
+
* `role="status"` (polite) for information and success, which can wait for a pause.
|
|
489
|
+
*
|
|
490
|
+
* Using `alert` for everything is the common mistake, and it makes a screen reader cut off whatever
|
|
491
|
+
* it was saying to announce that a draft was saved.
|
|
492
|
+
*
|
|
493
|
+
* The tone is always carried by the icon and the text, never by colour alone.
|
|
494
|
+
*/
|
|
495
|
+
declare function Alert({ tone, title, children, icon, dismissible, onDismiss, actions, variant, className, }: AlertProps): react.JSX.Element | null;
|
|
496
|
+
interface BannerProps extends Omit<AlertProps, 'variant'> {
|
|
497
|
+
/** Pin to the top of the viewport. */
|
|
498
|
+
sticky?: boolean;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* A full-width page-level message — maintenance windows, trial expiry, a failed payment.
|
|
502
|
+
*
|
|
503
|
+
* Distinct from `Alert` in placement and weight rather than in mechanics: a banner concerns the
|
|
504
|
+
* whole application, an alert concerns the thing next to it.
|
|
505
|
+
*/
|
|
506
|
+
declare function Banner({ sticky, className, ...rest }: BannerProps): react.JSX.Element;
|
|
507
|
+
interface CalloutProps {
|
|
508
|
+
/** Short label — "Note", "Tip", "Warning". */
|
|
509
|
+
label?: string;
|
|
510
|
+
tone?: AlertTone;
|
|
511
|
+
icon?: ReactNode;
|
|
512
|
+
className?: string;
|
|
513
|
+
children: ReactNode;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* A documentation callout.
|
|
517
|
+
*
|
|
518
|
+
* Deliberately **not** a live region. Prose asides are part of the page's content and are read in
|
|
519
|
+
* document order; announcing them out of sequence would be disruptive rather than helpful, which is
|
|
520
|
+
* the opposite of what `Alert` is for.
|
|
521
|
+
*/
|
|
522
|
+
declare function Callout({ label, tone, icon, className, children }: CalloutProps): react.JSX.Element;
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* @ansh-ui/react — Ansh for React 18/19 and Next.js.
|
|
526
|
+
*
|
|
527
|
+
* Every component here is a thin binding over `@ansh-ui/core`. The engine owns all behaviour; this
|
|
528
|
+
* package owns the React lifecycle, prop diffing, and SSR correctness.
|
|
529
|
+
*
|
|
530
|
+
* ```tsx
|
|
531
|
+
* import '@ansh-ui/tokens/ansh.css'
|
|
532
|
+
* import { AuroraBackground, AnimatedText, MagneticButton } from '@ansh-ui/react'
|
|
533
|
+
*
|
|
534
|
+
* export default function Hero() {
|
|
535
|
+
* return (
|
|
536
|
+
* <AuroraBackground className="min-h-screen grid place-items-center">
|
|
537
|
+
* <AnimatedText by="chars" from="center">Motion, refined.</AnimatedText>
|
|
538
|
+
* <MagneticButton strength={16}>Get started</MagneticButton>
|
|
539
|
+
* </AuroraBackground>
|
|
540
|
+
* )
|
|
541
|
+
* }
|
|
542
|
+
* ```
|
|
543
|
+
*
|
|
544
|
+
* ## Next.js App Router
|
|
545
|
+
*
|
|
546
|
+
* The package ships a `'use client'` banner, so these components work in server components without
|
|
547
|
+
* you wrapping them in your own client boundary.
|
|
548
|
+
*/
|
|
549
|
+
|
|
550
|
+
declare const VERSION = "0.1.0";
|
|
551
|
+
|
|
552
|
+
export { Alert, type AlertProps, type AlertTone, AnimatedGradient, AuroraBackground, Banner, type BannerProps, BentoGrid, type BentoGridProps, BentoItem, type BentoItemProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Callout, type CalloutProps, Constellation, Dock, type DockItem, type DockProps, type DotsProps, type EffectComponent, type EffectComponentBaseProps, type EffectComponentProps, FAQAccordion, type FAQAccordionProps, type FaqItem, Fireflies, GlowCard, type GlowCardProps, IconButton, type IconButtonProps, LiquidBlob, LoadingDots, MeshGradient, MeteorShower, NoiseLayer, NumberTicker, type NumberTickerProps, ParticleField, type PricingPlan, PricingTable, type PricingTableProps, Rain, ShinyText, type ShinyTextProps, Skeleton, type SkeletonProps, Snow, Spinner, type SpinnerProps, Spotlight, SpotlightCard, type SpotlightCardProps, TiltCard3D, type TiltCard3DProps, type Toast, ToastProvider, type ToastVariant, Typewriter, type TypewriterProps, VERSION, Waves, createEffectComponent, useToast };
|