anvilui 0.0.0-stage → 0.1.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/README.md +61 -2
- package/dist/colors/colors.d.ts +16 -0
- package/dist/components/AnvilRoot/AnvilContext.d.ts +14 -0
- package/dist/components/AnvilRoot/AnvilRoot.d.ts +18 -0
- package/dist/components/AppBar/AppBar.d.ts +34 -0
- package/dist/components/Avatar/Avatar.d.ts +23 -0
- package/dist/components/Badge/Badge.d.ts +19 -0
- package/dist/components/BottomSheet/BottomSheet.d.ts +19 -0
- package/dist/components/Button/Button.d.ts +18 -0
- package/dist/components/Card/Card.d.ts +21 -0
- package/dist/components/Checkbox/Checkbox.d.ts +4 -0
- package/dist/components/Chip/Chip.d.ts +23 -0
- package/dist/components/Dialog/Dialog.d.ts +24 -0
- package/dist/components/Divider/Divider.d.ts +16 -0
- package/dist/components/FAB/FAB.d.ts +24 -0
- package/dist/components/Field/Field.d.ts +16 -0
- package/dist/components/FloatingToolbar/FloatingToolbar.d.ts +22 -0
- package/dist/components/HoldButton/HoldButton.d.ts +15 -0
- package/dist/components/Icon/Icon.d.ts +7 -0
- package/dist/components/IconButton/IconButton.d.ts +11 -0
- package/dist/components/Input/Input.d.ts +15 -0
- package/dist/components/List/List.d.ts +26 -0
- package/dist/components/Menu/Menu.d.ts +22 -0
- package/dist/components/NavigationBar/NavigationBar.d.ts +20 -0
- package/dist/components/NavigationDrawer/NavigationDrawer.d.ts +30 -0
- package/dist/components/NavigationRail/NavigationRail.d.ts +32 -0
- package/dist/components/Popover/Popover.d.ts +21 -0
- package/dist/components/Progress/Progress.d.ts +22 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +7 -0
- package/dist/components/Select/Select.d.ts +25 -0
- package/dist/components/Slider/Slider.d.ts +26 -0
- package/dist/components/Snackbar/Snackbar.d.ts +30 -0
- package/dist/components/SplitButton/SplitButton.d.ts +3 -0
- package/dist/components/SquigglyWave/SquigglyWave.d.ts +36 -0
- package/dist/components/Switch/Switch.d.ts +4 -0
- package/dist/components/Tabs/Tabs.d.ts +15 -0
- package/dist/components/Textarea/Textarea.d.ts +16 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +38 -0
- package/dist/components/Tooltip/Tooltip.d.ts +14 -0
- package/dist/components/Typography/Typography.d.ts +10 -0
- package/dist/index.cjs +2948 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +2671 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.js +2852 -0
- package/dist/index.js.map +1 -0
- package/dist/morph.d.ts +64 -0
- package/dist/themes/baseTheme.d.ts +3 -0
- package/dist/themes/monochromeTheme.d.ts +3 -0
- package/dist/themes/toCssVariables.d.ts +2 -0
- package/dist/themes/types.d.ts +51 -0
- package/dist/tokens/baseTokens.d.ts +2 -0
- package/dist/tokens/toCssVariables.d.ts +2 -0
- package/dist/tokens/types.d.ts +46 -0
- package/dist/utils.d.ts +4 -0
- package/package.json +45 -5
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Progress as BaseProgress } from '@base-ui/react/progress';
|
|
3
|
+
import './progress.css';
|
|
4
|
+
export type ProgressProps = BaseProgress.Root.Props & {
|
|
5
|
+
/**
|
|
6
|
+
* A bar, a ring, or a small ring the size of the surrounding text, to
|
|
7
|
+
* place inside a line of text. @default 'linear'
|
|
8
|
+
*/
|
|
9
|
+
type?: 'linear' | 'circular' | 'inline';
|
|
10
|
+
/** Draw the filled part of a linear bar as a moving wave. @default false */
|
|
11
|
+
squiggly?: boolean;
|
|
12
|
+
} & ({
|
|
13
|
+
/** Visible label above the indicator. */
|
|
14
|
+
label: ReactNode;
|
|
15
|
+
'aria-label'?: never;
|
|
16
|
+
} | {
|
|
17
|
+
label?: never;
|
|
18
|
+
/** Accessible name, when there's no visible `label`. */
|
|
19
|
+
'aria-label': string;
|
|
20
|
+
});
|
|
21
|
+
/** Pass `value={null}` while the amount of work is unknown. */
|
|
22
|
+
export declare function Progress({ type, squiggly, label, className, style, children, ...props }: ProgressProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Radio as BaseRadio } from '@base-ui/react/radio';
|
|
2
|
+
import { RadioGroup as BaseRadioGroup } from '@base-ui/react/radio-group';
|
|
3
|
+
import './radio-group.css';
|
|
4
|
+
export type RadioGroupProps<Value = any> = BaseRadioGroup.Props<Value>;
|
|
5
|
+
export declare function RadioGroup<Value>({ className, ...props }: RadioGroupProps<Value>): import("react").JSX.Element;
|
|
6
|
+
export type RadioProps<Value = any> = BaseRadio.Root.Props<Value>;
|
|
7
|
+
export declare function Radio<Value>({ className, ...props }: RadioProps<Value>): import("react").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { Select as BaseSelect } from '@base-ui/react/select';
|
|
3
|
+
import '../Input/input.css';
|
|
4
|
+
import '../Menu/menu.css';
|
|
5
|
+
import './select.css';
|
|
6
|
+
export type SelectProps<Value, Multiple extends boolean | undefined = false> = BaseSelect.Root.Props<Value, Multiple> & {
|
|
7
|
+
/** Floating label. Sits inside the field and moves onto the border once it's focused or has a value. */
|
|
8
|
+
label?: ReactNode;
|
|
9
|
+
/** Shown when nothing is selected. With a `label`, only once the label has moved up. */
|
|
10
|
+
placeholder?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* `small` is shorter, and its label works like a placeholder: it hides
|
|
13
|
+
* once a value is selected instead of moving onto the border. @default 'normal'
|
|
14
|
+
*/
|
|
15
|
+
size?: 'small' | 'normal';
|
|
16
|
+
/** Applied to the outer wrapper, so width and margins work as expected. */
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Put `SelectItem`s inside. Pass `items` (value → label) so the field shows
|
|
21
|
+
* the selected item's label rather than its raw value.
|
|
22
|
+
*/
|
|
23
|
+
export declare function Select<Value, Multiple extends boolean | undefined = false>({ label, placeholder, size, className, children, ...props }: SelectProps<Value, Multiple>): import("react").JSX.Element;
|
|
24
|
+
export type SelectItemProps = BaseSelect.Item.Props;
|
|
25
|
+
export declare function SelectItem({ className, children, ...props }: SelectItemProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Slider as BaseSlider } from '@base-ui/react/slider';
|
|
3
|
+
import '../Tooltip/tooltip.css';
|
|
4
|
+
import './slider.css';
|
|
5
|
+
export type SliderProps<Value extends number | readonly number[] = number | readonly number[]> = BaseSlider.Root.Props<Value> & {
|
|
6
|
+
/** Show the value in a bubble above the handle while it's dragged or focused. @default true */
|
|
7
|
+
showValue?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Thin track with the selected part drawn as a moving wave, like a
|
|
10
|
+
* squiggly `Progress`. Horizontal only. @default false
|
|
11
|
+
*/
|
|
12
|
+
squiggly?: boolean;
|
|
13
|
+
} & ({
|
|
14
|
+
/** Visible label above the slider. */
|
|
15
|
+
label: ReactNode;
|
|
16
|
+
'aria-label'?: never;
|
|
17
|
+
} | {
|
|
18
|
+
label?: never;
|
|
19
|
+
/** Accessible name, when there's no visible `label`. */
|
|
20
|
+
'aria-label': string;
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* Pass an array as `value` / `defaultValue` for a range with several handles.
|
|
24
|
+
* `orientation="vertical"` is 160px tall by default; set a height via `className`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function Slider<Value extends number | readonly number[]>({ label, 'aria-label': ariaLabel, showValue, squiggly, className, ...props }: SliderProps<Value>): import("react").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import './snackbar.css';
|
|
3
|
+
export type SnackbarOptions = {
|
|
4
|
+
/** The text shown. Keep it to a line or two. */
|
|
5
|
+
message: ReactNode;
|
|
6
|
+
/** One text button, like "Undo". Clicking it also closes the snackbar. */
|
|
7
|
+
action?: {
|
|
8
|
+
label: ReactNode;
|
|
9
|
+
onClick: () => void;
|
|
10
|
+
};
|
|
11
|
+
/** Show a close (×) button. @default false */
|
|
12
|
+
closeButton?: boolean;
|
|
13
|
+
/** Milliseconds before it closes on its own; `0` keeps it open. @default 5000 */
|
|
14
|
+
timeout?: number;
|
|
15
|
+
/** `high` makes screen readers announce it right away. @default 'low' */
|
|
16
|
+
priority?: 'low' | 'high';
|
|
17
|
+
/** Called once it has closed, however that happened. */
|
|
18
|
+
onClose?: () => void;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Shows snackbars: `const snackbar = useSnackbar()`, then
|
|
22
|
+
* `snackbar.show({ message: 'Saved' })`. Works anywhere inside `AnvilRoot`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useSnackbar(): {
|
|
25
|
+
/** Shows a snackbar at the bottom; open ones move up. Returns its id. */
|
|
26
|
+
show: ({ message, action, closeButton, ...options }: SnackbarOptions) => string;
|
|
27
|
+
/** Closes one snackbar by id, or all of them. */
|
|
28
|
+
close: (toastId?: string) => void;
|
|
29
|
+
};
|
|
30
|
+
export declare function SnackbarViewport(): import("react").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import './squiggly-wave.css';
|
|
2
|
+
/** What to draw this frame, in px from the start of the track. */
|
|
3
|
+
export type WaveSpan = {
|
|
4
|
+
/** Where the wave starts and ends (round caps included). */
|
|
5
|
+
from: number;
|
|
6
|
+
to: number;
|
|
7
|
+
/** Flat track pieces to draw alongside it, as [start, end] pairs. */
|
|
8
|
+
rest?: [number, number][];
|
|
9
|
+
/** Draw the `rest` pieces as waves in step with the main one, not flat. */
|
|
10
|
+
restWave?: boolean;
|
|
11
|
+
/** Draw the stop dot at the far end. */
|
|
12
|
+
dot?: boolean;
|
|
13
|
+
/** Jump straight to `from`/`to` instead of easing toward them. */
|
|
14
|
+
snap?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type SquigglyWaveProps = {
|
|
17
|
+
/**
|
|
18
|
+
* Called every frame with the track width, `--avl-wave-gap` in px, the
|
|
19
|
+
* SVG and the frame time. Reads its inputs fresh each time, so it can
|
|
20
|
+
* follow things that move between renders, like a dragged handle.
|
|
21
|
+
*/
|
|
22
|
+
span: (width: number, gap: number, svg: SVGSVGElement, now: number) => WaveSpan;
|
|
23
|
+
/**
|
|
24
|
+
* Hold the wave still and only redraw when the size changes, for spans
|
|
25
|
+
* that never move. @default false
|
|
26
|
+
*/
|
|
27
|
+
still?: boolean;
|
|
28
|
+
/** Run top to bottom instead of left to right. @default false */
|
|
29
|
+
vertical?: boolean;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* One continuous wave drawn to an exact length, so it has no seams and gets
|
|
33
|
+
* round ends. Redrawn every frame to ripple and to ease toward its new span;
|
|
34
|
+
* with reduced motion it holds still and jumps.
|
|
35
|
+
*/
|
|
36
|
+
export declare function SquigglyWave(props: SquigglyWaveProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Tabs as BaseTabs } from '@base-ui/react/tabs';
|
|
2
|
+
import type { MaterialSymbol } from 'material-symbols';
|
|
3
|
+
import './tabs.css';
|
|
4
|
+
/** Holds the selected tab: `value` / `defaultValue` / `onValueChange`. Horizontal only. */
|
|
5
|
+
export type TabsProps = Omit<BaseTabs.Root.Props, 'orientation'>;
|
|
6
|
+
export declare function Tabs({ className, ...props }: TabsProps): import("react").JSX.Element;
|
|
7
|
+
export type TabsListProps = BaseTabs.List.Props;
|
|
8
|
+
export declare function TabsList({ className, children, ...props }: TabsListProps): import("react").JSX.Element;
|
|
9
|
+
export type TabsTabProps = BaseTabs.Tab.Props & {
|
|
10
|
+
/** Material Symbol shown above the label. */
|
|
11
|
+
icon?: MaterialSymbol;
|
|
12
|
+
};
|
|
13
|
+
export declare function TabsTab({ icon, className, children, ...props }: TabsTabProps): import("react").JSX.Element;
|
|
14
|
+
export type TabsPanelProps = BaseTabs.Panel.Props;
|
|
15
|
+
export declare function TabsPanel({ className, ...props }: TabsPanelProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { Input as BaseInput } from '@base-ui/react/input';
|
|
3
|
+
import '../Input/input.css';
|
|
4
|
+
import './textarea.css';
|
|
5
|
+
export type TextareaProps = Omit<ComponentProps<'textarea'>, 'className'> & Pick<BaseInput.Props, 'onValueChange'> & {
|
|
6
|
+
/** Floating label. Sits on the first line and moves onto the border once it has focus or a value. */
|
|
7
|
+
label?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* `small` has less padding, and its label works like a placeholder: it
|
|
10
|
+
* hides once there's text instead of moving onto the border. @default 'normal'
|
|
11
|
+
*/
|
|
12
|
+
size?: 'small' | 'normal';
|
|
13
|
+
/** Applied to the outer wrapper, so width and margins work as expected. */
|
|
14
|
+
className?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function Textarea({ label, size, className, placeholder, ...props }: TextareaProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Radio as BaseRadio } from '@base-ui/react/radio';
|
|
2
|
+
import { RadioGroup as BaseRadioGroup } from '@base-ui/react/radio-group';
|
|
3
|
+
import { ToggleGroup as BaseToggleGroup } from '@base-ui/react/toggle-group';
|
|
4
|
+
import type { MaterialSymbol } from 'material-symbols';
|
|
5
|
+
import { ColorProps } from '../../colors/colors';
|
|
6
|
+
import './toggle-group.css';
|
|
7
|
+
type ToggleGroupCommonProps = ColorProps & {
|
|
8
|
+
/** @default 'normal' */
|
|
9
|
+
size?: 'small' | 'normal' | 'big';
|
|
10
|
+
};
|
|
11
|
+
export type ToggleGroupProps<Value = any> = ToggleGroupCommonProps & ((BaseRadioGroup.Props<Value> & {
|
|
12
|
+
/**
|
|
13
|
+
* Let several segments be on at once. `value` is then an array
|
|
14
|
+
* of strings. @default false
|
|
15
|
+
*/
|
|
16
|
+
multiple?: false;
|
|
17
|
+
}) | (BaseToggleGroup.Props<string> & {
|
|
18
|
+
multiple: true;
|
|
19
|
+
}));
|
|
20
|
+
/**
|
|
21
|
+
* A segmented control: buttons in a row. By default exactly one is selected,
|
|
22
|
+
* with a pill that stretches over to it. With `multiple`, each one toggles on
|
|
23
|
+
* and off. Use it for 2-5 short options; for longer lists or forms, use
|
|
24
|
+
* `RadioGroup` or checkboxes.
|
|
25
|
+
*/
|
|
26
|
+
export declare function ToggleGroup<Value>({ size, color, fillType, multiple, children, className, ref, ...props }: ToggleGroupProps<Value>): import("react").JSX.Element;
|
|
27
|
+
export type ToggleGroupItemProps<Value = any> = BaseRadio.Root.Props<Value> & {
|
|
28
|
+
/** Material Symbol shown before the label. */
|
|
29
|
+
startIcon?: MaterialSymbol;
|
|
30
|
+
/** Material Symbol shown after the label. */
|
|
31
|
+
endIcon?: MaterialSymbol;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* One option in a `ToggleGroup`. Requires a `value` (a string when the
|
|
35
|
+
* group is `multiple`).
|
|
36
|
+
*/
|
|
37
|
+
export declare function ToggleGroupItem<Value>({ startIcon, endIcon, children, className, value, ...props }: ToggleGroupItemProps<Value>): import("react").JSX.Element;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import { Tooltip as BaseTooltip } from '@base-ui/react/tooltip';
|
|
3
|
+
import './tooltip.css';
|
|
4
|
+
export type TooltipProps = Omit<BaseTooltip.Root.Props, 'children'> & Pick<BaseTooltip.Trigger.Props, 'delay' | 'closeDelay'> & Pick<BaseTooltip.Positioner.Props, 'side' | 'align' | 'sideOffset' | 'alignOffset'> & Pick<BaseTooltip.Popup.Props, 'className'> & {
|
|
5
|
+
/** Text shown in the tooltip. Keep it short; nothing in it can be clicked. */
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* The element the tooltip describes. It must take a ref and pass its
|
|
9
|
+
* props through, as the library's components do.
|
|
10
|
+
*/
|
|
11
|
+
children: ReactElement;
|
|
12
|
+
};
|
|
13
|
+
/** A short hint shown on hover or keyboard focus. `className` goes on the bubble. */
|
|
14
|
+
export declare function Tooltip({ label, children, delay, closeDelay, side, align, sideOffset, alignOffset, className, ...props }: TooltipProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import './typography.css';
|
|
2
|
+
export type TypographyType = 'body' | 'caption' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
3
|
+
export type TypographyTag = 'p' | 'span' | 'div' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
4
|
+
export type TypographyProps = React.ComponentProps<'p'> & {
|
|
5
|
+
/** The look. */
|
|
6
|
+
type?: TypographyType;
|
|
7
|
+
/** The HTML tag, when it should differ from the look (e.g. an h2 styled as h6). */
|
|
8
|
+
as?: TypographyTag;
|
|
9
|
+
};
|
|
10
|
+
export declare function Typography({ type, as, className, ...props }: TypographyProps): import("react").JSX.Element;
|