@talogic/react 0.6.4 → 0.8.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 +5 -5
- package/app/app-shell.component.d.ts +31 -2
- package/app/index.d.ts +2 -2
- package/fonts.css +1 -1
- package/index.d.ts +1 -1
- package/index.js +1632 -1064
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/product/product-catalogue.content.d.ts +1 -1
- package/talogic-react.css +1 -1
- package/tokens/apca-contrast.algorithm.d.ts +2 -2
- package/tokens/logo-color.algorithm.d.ts +2 -2
- package/tokens/theme.contract.d.ts +2 -2
- package/tokens.css +29 -3
- package/ui/combobox/combobox-option.contract.d.ts +18 -0
- package/ui/combobox/combobox.component.d.ts +78 -0
- package/ui/combobox/index.d.ts +5 -0
- package/ui/combobox/option-search.hook.d.ts +25 -0
- package/ui/feedback/toaster.component.d.ts +1 -1
- package/ui/field/field-control.hook.d.ts +9 -0
- package/ui/field/index.d.ts +1 -1
- package/ui/file-drop/file-accept.policy.d.ts +25 -0
- package/ui/file-drop/file-drop-overlay.component.d.ts +31 -0
- package/ui/file-drop/index.d.ts +5 -0
- package/ui/file-drop/page-drop.hook.d.ts +29 -0
- package/ui/index.d.ts +4 -0
- package/ui/menu/index.d.ts +1 -0
- package/ui/navigation/index.d.ts +1 -1
- package/ui/navigation/navigation-menu.component.d.ts +2 -1
- package/ui/navigation/tabs.component.d.ts +43 -16
- package/ui/overlay/index.d.ts +1 -0
- package/ui/overlay/portal.component.d.ts +11 -0
- package/ui/presence/index.d.ts +4 -0
- package/ui/presence/presence.component.d.ts +21 -0
- package/ui/presence/presence.recipe.d.ts +8 -0
- package/ui/tags-input/index.d.ts +7 -0
- package/ui/tags-input/tag-entry.algorithm.d.ts +34 -0
- package/ui/tags-input/tag.component.d.ts +18 -0
- package/ui/tags-input/tags-field.recipe.d.ts +7 -0
- package/ui/tags-input/tags-input.component.d.ts +30 -0
- package/web/site-header.component.d.ts +1 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { ComboboxLoader, ComboboxOption } from './combobox-option.contract';
|
|
3
|
+
/** Props every {@link Combobox} takes. */
|
|
4
|
+
interface ComboboxCommonProps {
|
|
5
|
+
/** Eager mode: every choice, filtered in the browser as the person types. */
|
|
6
|
+
'options'?: ComboboxOption[];
|
|
7
|
+
/** Lazy mode: loads the choices for each query from a server. Use it in place of `options`. */
|
|
8
|
+
'loadOptions'?: ComboboxLoader;
|
|
9
|
+
/** Lazy mode: how long to wait after the last key press. Default 250 ms. */
|
|
10
|
+
'debounceMs'?: number;
|
|
11
|
+
/** Lazy mode: the shortest query that starts a search. Default 1. */
|
|
12
|
+
'minQueryLength'?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Turns typed text that matches no choice into a new one, for example an e-mail address that is not in the
|
|
15
|
+
* contacts. Return null to refuse the text. Without it, only listed choices can be picked.
|
|
16
|
+
*/
|
|
17
|
+
'createOption'?: (text: string) => ComboboxOption | null;
|
|
18
|
+
/** The list row that offers the new choice. Default `Use "<text>"`. */
|
|
19
|
+
'createLabel'?: (text: string) => ReactNode;
|
|
20
|
+
/** Shown when nothing matches. Default "No results". */
|
|
21
|
+
'emptyText'?: ReactNode;
|
|
22
|
+
/** Lazy mode: shown while a search runs. Default "Searching…". */
|
|
23
|
+
'loadingText'?: ReactNode;
|
|
24
|
+
/** Lazy mode: shown when a search fails. Default "The search failed. Try again." */
|
|
25
|
+
'errorText'?: ReactNode;
|
|
26
|
+
/** Lazy mode: shown before the query is long enough. Default "Type to search". */
|
|
27
|
+
'idleText'?: ReactNode;
|
|
28
|
+
'placeholder'?: string;
|
|
29
|
+
'disabled'?: boolean;
|
|
30
|
+
'id'?: string;
|
|
31
|
+
'aria-label'?: string;
|
|
32
|
+
'aria-describedby'?: string;
|
|
33
|
+
'aria-invalid'?: boolean | 'true' | 'false';
|
|
34
|
+
/** Classes for the field. */
|
|
35
|
+
'className'?: string;
|
|
36
|
+
/** Classes for the floating list. */
|
|
37
|
+
'contentClassName'?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Props of a {@link Combobox} that holds one choice. */
|
|
40
|
+
export interface SingleComboboxProps extends ComboboxCommonProps {
|
|
41
|
+
multiple?: false;
|
|
42
|
+
/** The choice, when the parent owns it. */
|
|
43
|
+
value?: ComboboxOption | null;
|
|
44
|
+
/** The first choice, when the combobox owns it. */
|
|
45
|
+
defaultValue?: ComboboxOption | null;
|
|
46
|
+
/** Called with the new choice, or null after a clear. */
|
|
47
|
+
onValueChange?: (option: ComboboxOption | null) => void;
|
|
48
|
+
}
|
|
49
|
+
/** Props of a {@link Combobox} that holds several choices as tags. */
|
|
50
|
+
export interface MultipleComboboxProps extends ComboboxCommonProps {
|
|
51
|
+
multiple: true;
|
|
52
|
+
/** The choices, when the parent owns them. */
|
|
53
|
+
value?: ComboboxOption[];
|
|
54
|
+
/** The first choices, when the combobox owns them. */
|
|
55
|
+
defaultValue?: ComboboxOption[];
|
|
56
|
+
/** Called with the new list. */
|
|
57
|
+
onValueChange?: (options: ComboboxOption[]) => void;
|
|
58
|
+
/** The most choices it can hold. */
|
|
59
|
+
max?: number;
|
|
60
|
+
}
|
|
61
|
+
/** Props of {@link Combobox}. */
|
|
62
|
+
export type ComboboxProps = SingleComboboxProps | MultipleComboboxProps;
|
|
63
|
+
/**
|
|
64
|
+
* A select with a search box. It replaces a "Find" button: the list filters while the person types.
|
|
65
|
+
*
|
|
66
|
+
* Two sources: eager (`options`, filtered in the browser) and lazy (`loadOptions`, a server search with a pause,
|
|
67
|
+
* cancelled stale requests and loading, empty and error rows). Two modes: one choice (the input shows its label,
|
|
68
|
+
* with a clear cross) or `multiple` (the choices become tags, and Backspace in the empty input highlights, then
|
|
69
|
+
* removes, the last one). `createOption` accepts typed text that is not in the list, such as a new e-mail address.
|
|
70
|
+
*
|
|
71
|
+
* Arrow keys move in the list, Enter picks, Escape closes. Inside a {@link Field} it takes the field's label, hint
|
|
72
|
+
* and error.
|
|
73
|
+
*
|
|
74
|
+
* @param props - The source, the mode and its value, and the texts of the list states.
|
|
75
|
+
* @returns The combobox.
|
|
76
|
+
*/
|
|
77
|
+
export declare function Combobox(props: ComboboxProps): import("react").JSX.Element;
|
|
78
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Combobox } from './combobox.component';
|
|
2
|
+
export type { ComboboxProps, MultipleComboboxProps, SingleComboboxProps } from './combobox.component';
|
|
3
|
+
export type { ComboboxLoader, ComboboxOption } from './combobox-option.contract';
|
|
4
|
+
export { useOptionSearch } from './option-search.hook';
|
|
5
|
+
export type { OptionSearch, OptionSearchStatus } from './option-search.hook';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ComboboxLoader, ComboboxOption } from './combobox-option.contract';
|
|
2
|
+
/** The state of a lazy search. */
|
|
3
|
+
export type OptionSearchStatus = 'idle' | 'loading' | 'done' | 'error';
|
|
4
|
+
/** What {@link useOptionSearch} returns. */
|
|
5
|
+
export interface OptionSearch {
|
|
6
|
+
/** The choices of the last finished search. */
|
|
7
|
+
options: ComboboxOption[];
|
|
8
|
+
/** `idle` before the query is long enough, then `loading`, `done` or `error`. */
|
|
9
|
+
status: OptionSearchStatus;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Runs a lazy search while the person types: it waits for a pause, cancels the request of an older query, and
|
|
13
|
+
* ignores an answer that comes back after a newer query started.
|
|
14
|
+
*
|
|
15
|
+
* @param load - Loads the choices for a query. It gets an abort signal. With no loader the hook stays idle.
|
|
16
|
+
* @param query - The text in the input.
|
|
17
|
+
* @param options - `debounceMs` (default 250) and `minQueryLength` (default 1).
|
|
18
|
+
* @param options.debounceMs - How long to wait after the last key press.
|
|
19
|
+
* @param options.minQueryLength - The shortest query that starts a search.
|
|
20
|
+
* @returns The choices and the search status.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useOptionSearch(load: ComboboxLoader | undefined, query: string, { debounceMs, minQueryLength }?: {
|
|
23
|
+
debounceMs?: number | undefined;
|
|
24
|
+
minQueryLength?: number | undefined;
|
|
25
|
+
}): OptionSearch;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComponentProps } from 'react';
|
|
2
2
|
import { Toaster as Sonner } from 'sonner';
|
|
3
3
|
/**
|
|
4
|
-
* The shadcn/ui Toaster (Sonner), drawn with the
|
|
4
|
+
* The shadcn/ui Toaster (Sonner), drawn with the talogic tokens: popover colours, large elevation, 10 px radius.
|
|
5
5
|
* Mount one per app, then call `toast()` from `sonner`.
|
|
6
6
|
*
|
|
7
7
|
* @param props - Sonner Toaster props.
|
|
@@ -7,6 +7,8 @@ export interface FieldControlState {
|
|
|
7
7
|
describedBy: string;
|
|
8
8
|
/** True when the field shows an error. */
|
|
9
9
|
invalid: boolean;
|
|
10
|
+
/** The id of the field's label, for a control that cannot take the label's `for` link. */
|
|
11
|
+
labelId?: string;
|
|
10
12
|
}
|
|
11
13
|
/** The context a {@link Field} provides. Null outside a field. */
|
|
12
14
|
export declare const FieldControlContext: import("react").Context<FieldControlState | null>;
|
|
@@ -24,3 +26,10 @@ export interface FieldControlProps {
|
|
|
24
26
|
* @returns The props to spread on the control element.
|
|
25
27
|
*/
|
|
26
28
|
export declare function useFieldControl(own?: FieldControlProps): FieldControlProps;
|
|
29
|
+
/**
|
|
30
|
+
* The id of the label of the {@link Field} around a control. A control whose library writes its own `id`, such as
|
|
31
|
+
* the cmdk input of a combobox, points `aria-labelledby` at it instead of relying on the label's `for` link.
|
|
32
|
+
*
|
|
33
|
+
* @returns The label id, or undefined outside a field.
|
|
34
|
+
*/
|
|
35
|
+
export declare function useFieldLabelId(): string | undefined;
|
package/ui/field/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { controlClassName } from './control.recipe';
|
|
2
2
|
export { Field } from './field.component';
|
|
3
3
|
export type { FieldProps } from './field.component';
|
|
4
|
-
export { useFieldControl } from './field-control.hook';
|
|
4
|
+
export { useFieldControl, useFieldLabelId } from './field-control.hook';
|
|
5
5
|
export type { FieldControlProps } from './field-control.hook';
|
|
6
6
|
export { Input } from './input.component';
|
|
7
7
|
export type { InputProps } from './input.component';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a file matches an `accept` list, in the format of the `accept` attribute of `<input type="file">`:
|
|
3
|
+
* comma-separated extensions (`.pdf`), MIME types (`application/pdf`) and wildcards (`image/*`). An empty or
|
|
4
|
+
* missing list accepts every file. Case is ignored.
|
|
5
|
+
*
|
|
6
|
+
* @param file - The name and MIME type of the file. A name is missing while a drag is still over the page.
|
|
7
|
+
* @param file.name - The file name, with its extension.
|
|
8
|
+
* @param file.type - The MIME type, empty when the browser does not know it.
|
|
9
|
+
* @param accept - The accept list.
|
|
10
|
+
* @returns True when the file matches one entry of the list.
|
|
11
|
+
*/
|
|
12
|
+
export declare function acceptsFile(file: {
|
|
13
|
+
name?: string;
|
|
14
|
+
type: string;
|
|
15
|
+
}, accept?: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Whether a drag that is still over the page can hold an accepted file. During a drag the browser shows only MIME
|
|
18
|
+
* types, never names, so a list of extensions alone, or a file of unknown type, cannot be judged yet: the answer is
|
|
19
|
+
* then true, and the drop filters the files.
|
|
20
|
+
*
|
|
21
|
+
* @param types - The MIME types of the dragged items. Empty strings stand for unknown types.
|
|
22
|
+
* @param accept - The accept list (see {@link acceptsFile}).
|
|
23
|
+
* @returns False only when every dragged item has a known type that the list refuses.
|
|
24
|
+
*/
|
|
25
|
+
export declare function mayAcceptDrag(types: readonly string[], accept?: string): boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/** Props of {@link FileDropOverlay}. */
|
|
3
|
+
export interface FileDropOverlayProps {
|
|
4
|
+
/** True while files are over the window: `isOver` from {@link usePageDrop}. */
|
|
5
|
+
open: boolean;
|
|
6
|
+
/** False when the files fail the accept list: `isAccepted` from {@link usePageDrop}. Default true. */
|
|
7
|
+
accepted?: boolean;
|
|
8
|
+
/** What to do, such as "Drop the quote to upload it". */
|
|
9
|
+
title: ReactNode;
|
|
10
|
+
/** A second line, such as the accepted formats and the size limit. */
|
|
11
|
+
description?: ReactNode;
|
|
12
|
+
/** The title when the files fail the accept list. Default "These files cannot be uploaded here". */
|
|
13
|
+
rejectedTitle?: ReactNode;
|
|
14
|
+
/** An icon in place of the upload arrow. */
|
|
15
|
+
icon?: ReactNode;
|
|
16
|
+
/** Classes for the full-screen layer. */
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The full-screen layer while files are held over the page: the page blurs under a brand tint, a dashed frame
|
|
21
|
+
* shows the drop area, and the message grows in with a pulse around its icon. It turns destructive when the files
|
|
22
|
+
* fail the accept list.
|
|
23
|
+
*
|
|
24
|
+
* It renders in a {@link Portal}, above every other layer, and stays mounted so it can fade in and out. It takes no
|
|
25
|
+
* pointer events, so the drop reaches the window listener of {@link usePageDrop} under it. A polite live region
|
|
26
|
+
* reads the message once when it opens. Reduced motion keeps only the fade.
|
|
27
|
+
*
|
|
28
|
+
* @param props - The open and accepted state, and the message.
|
|
29
|
+
* @returns The overlay.
|
|
30
|
+
*/
|
|
31
|
+
export declare function FileDropOverlay({ open, accepted, title, description, rejectedTitle, icon, className }: FileDropOverlayProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { acceptsFile, mayAcceptDrag } from './file-accept.policy';
|
|
2
|
+
export { FileDropOverlay } from './file-drop-overlay.component';
|
|
3
|
+
export type { FileDropOverlayProps } from './file-drop-overlay.component';
|
|
4
|
+
export { usePageDrop } from './page-drop.hook';
|
|
5
|
+
export type { PageDropOptions, PageDropState } from './page-drop.hook';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Options of {@link usePageDrop}. */
|
|
2
|
+
export interface PageDropOptions {
|
|
3
|
+
/** Given the dropped files: those the `accept` list takes, then those it refuses. */
|
|
4
|
+
onDrop: (accepted: File[], rejected: File[]) => void;
|
|
5
|
+
/** The files to take, in the format of the `accept` attribute of a file input. Default: every file. */
|
|
6
|
+
accept?: string;
|
|
7
|
+
/** Ignores every drag, for example while an upload runs. */
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** What {@link usePageDrop} reports while a drag is over the window. */
|
|
11
|
+
export interface PageDropState {
|
|
12
|
+
/** True while a drag that carries files is over the window. */
|
|
13
|
+
isOver: boolean;
|
|
14
|
+
/** False when the dragged files certainly fail the `accept` list. True while the browser cannot tell yet. */
|
|
15
|
+
isAccepted: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Makes the whole window a drop target for files, so someone who arrives with a file in hand does not have to aim
|
|
19
|
+
* at a box. Pair it with {@link FileDropOverlay}.
|
|
20
|
+
*
|
|
21
|
+
* Only a drag that carries files counts: dragging selected text is not an upload. Entries are counted rather than
|
|
22
|
+
* trusted one by one, because a drag that moves onto a child fires `dragleave` on the parent it left. A drop zone
|
|
23
|
+
* that takes a drop for itself stops it before the window sees it, so a capture listener ends the drag state in
|
|
24
|
+
* every case.
|
|
25
|
+
*
|
|
26
|
+
* @param options - `onDrop`, `accept` and `disabled`.
|
|
27
|
+
* @returns Whether files are over the window, and whether they look acceptable.
|
|
28
|
+
*/
|
|
29
|
+
export declare function usePageDrop(options: PageDropOptions): PageDropState;
|
package/ui/index.d.ts
CHANGED
|
@@ -2,10 +2,14 @@ export * from './avatar';
|
|
|
2
2
|
export * from './badge';
|
|
3
3
|
export * from './button';
|
|
4
4
|
export * from './choice';
|
|
5
|
+
export * from './combobox';
|
|
5
6
|
export * from './feedback';
|
|
6
7
|
export * from './field';
|
|
8
|
+
export * from './file-drop';
|
|
7
9
|
export * from './layout';
|
|
8
10
|
export * from './menu';
|
|
9
11
|
export * from './navigation';
|
|
10
12
|
export * from './overlay';
|
|
13
|
+
export * from './presence';
|
|
11
14
|
export * from './sidebar';
|
|
15
|
+
export * from './tags-input';
|
package/ui/menu/index.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuSeparator,
|
|
|
4
4
|
export type { ContextMenuItemProps } from './context-menu.component';
|
|
5
5
|
export { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, } from './dropdown-menu.component';
|
|
6
6
|
export type { DropdownMenuItemProps } from './dropdown-menu.component';
|
|
7
|
+
export { menuItemClassName, menuSeparatorClassName, menuShortcutClassName } from './menu.recipe';
|
package/ui/navigation/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMe
|
|
|
6
6
|
export { Pagination } from './pagination.component';
|
|
7
7
|
export type { PaginationProps } from './pagination.component';
|
|
8
8
|
export { Tabs, TabsContent, TabsList, TabsTrigger } from './tabs.component';
|
|
9
|
-
export type { TabsListProps } from './tabs.component';
|
|
9
|
+
export type { TabsContentProps, TabsListProps, TabsTriggerProps, TabsVariant } from './tabs.component';
|
|
10
10
|
export { Stepper } from './stepper.component';
|
|
11
11
|
export type { StepperProps, StepperStep } from './stepper.component';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { NavigationMenu as NavigationMenuPrimitive } from 'radix-ui';
|
|
2
2
|
import type { ComponentProps } from 'react';
|
|
3
3
|
/**
|
|
4
|
-
* The shadcn/ui NavigationMenu: the main navigation of a website, with drop-down panels.
|
|
4
|
+
* The shadcn/ui NavigationMenu: the main navigation of a website, with drop-down panels. The box of a panel drops
|
|
5
|
+
* into place while it fades in, and the panel content grows in it.
|
|
5
6
|
*
|
|
6
7
|
* @param props - Radix NavigationMenu root props.
|
|
7
8
|
* @returns The navigation menu.
|
|
@@ -1,39 +1,66 @@
|
|
|
1
1
|
import { Tabs as TabsPrimitive } from 'radix-ui';
|
|
2
|
-
import type
|
|
2
|
+
import { type ComponentProps } from 'react';
|
|
3
3
|
/**
|
|
4
|
-
* The
|
|
4
|
+
* The Tabs root. When the active tab changes, the content of the new panel slides in with the indicator, from the
|
|
5
|
+
* side the indicator came from. It travels further than the indicator, in proportion to the size of the panel, so
|
|
6
|
+
* it moves faster, like a parallax. The panel frame stays still, and the first panel does not move. Reduced motion
|
|
7
|
+
* keeps panels still.
|
|
5
8
|
*
|
|
6
|
-
* @param props - Radix Tabs root props.
|
|
9
|
+
* @param props - Radix Tabs root props. `orientation="vertical"` puts the list beside the panels.
|
|
7
10
|
* @returns The tabs.
|
|
8
11
|
*/
|
|
9
|
-
export declare function Tabs({ className, ...props }: ComponentProps<typeof TabsPrimitive.Root>): import("react").JSX.Element;
|
|
12
|
+
export declare function Tabs({ className, style, value, defaultValue, onValueChange, orientation, ...props }: ComponentProps<typeof TabsPrimitive.Root>): import("react").JSX.Element;
|
|
13
|
+
/** The look of a {@link TabsList}. */
|
|
14
|
+
export type TabsVariant = 'pill' | 'underline' | 'outline';
|
|
10
15
|
/** Props of {@link TabsList}. */
|
|
11
16
|
export interface TabsListProps extends ComponentProps<typeof TabsPrimitive.List> {
|
|
12
17
|
/**
|
|
13
18
|
* `pill` switches views inside a panel. `underline` switches pages in a header, with a brand line under the
|
|
14
|
-
* active tab.
|
|
19
|
+
* active tab. `outline` opens documents or records: the active tab is a raised card with a brand cap that joins
|
|
20
|
+
* the panel below it.
|
|
15
21
|
*/
|
|
16
|
-
variant?:
|
|
22
|
+
variant?: TabsVariant;
|
|
23
|
+
/** Stretches the list to its container and shares the width equally between the tabs. */
|
|
24
|
+
fitted?: boolean;
|
|
17
25
|
}
|
|
18
26
|
/**
|
|
19
|
-
* The row of {@link TabsTrigger}s. One indicator slides to the active tab
|
|
20
|
-
* background of
|
|
27
|
+
* The row of {@link TabsTrigger}s, or the column in a vertical {@link Tabs}. One indicator slides to the active tab
|
|
28
|
+
* and takes its size: the raised background of `pill`, the brand line of `underline`, or the card of `outline`.
|
|
21
29
|
*
|
|
22
|
-
* @param props - `variant` and Radix Tabs list props.
|
|
30
|
+
* @param props - `variant`, `fitted` and Radix Tabs list props.
|
|
23
31
|
* @returns The tab list.
|
|
24
32
|
*/
|
|
25
|
-
export declare function TabsList({ className, variant, children, ...props }: TabsListProps): import("react").JSX.Element;
|
|
33
|
+
export declare function TabsList({ className, variant, fitted, children, ...props }: TabsListProps): import("react").JSX.Element;
|
|
34
|
+
/** Props of {@link TabsTrigger}. */
|
|
35
|
+
export interface TabsTriggerProps extends ComponentProps<typeof TabsPrimitive.Trigger> {
|
|
36
|
+
/** A count beside the label, such as unread items. It turns brand on the active tab. */
|
|
37
|
+
count?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Makes the tab closable: a small cross shows on it, and the Delete key closes the focused tab. Move the
|
|
40
|
+
* selection to another tab before you remove the active one.
|
|
41
|
+
*/
|
|
42
|
+
onClose?: () => void;
|
|
43
|
+
/** The name of the close action for assistive technology. Default `Close tab`. */
|
|
44
|
+
closeLabel?: string;
|
|
45
|
+
}
|
|
26
46
|
/**
|
|
27
|
-
* One tab. It reads the list's variant, so it has
|
|
47
|
+
* One tab. It reads the list's variant and orientation, so it has neither of its own.
|
|
28
48
|
*
|
|
29
|
-
* @param props - Radix Tabs trigger props.
|
|
49
|
+
* @param props - `count`, `onClose`, `closeLabel` and Radix Tabs trigger props.
|
|
30
50
|
* @returns The tab.
|
|
31
51
|
*/
|
|
32
|
-
export declare function TabsTrigger({ className, ...props }:
|
|
52
|
+
export declare function TabsTrigger({ className, count, onClose, closeLabel, onKeyDown, children, value, ...props }: TabsTriggerProps): import("react").JSX.Element;
|
|
53
|
+
/** Props of {@link TabsContent}. */
|
|
54
|
+
export interface TabsContentProps extends ComponentProps<typeof TabsPrimitive.Content> {
|
|
55
|
+
/** Classes for the content inside the panel: its layout, such as `flex flex-col gap-4`. `className` styles the frame. */
|
|
56
|
+
bodyClassName?: string;
|
|
57
|
+
}
|
|
33
58
|
/**
|
|
34
|
-
* The panel of one tab.
|
|
59
|
+
* The panel of one tab. The panel itself (its frame, from `className`) stays still. After a change, its content
|
|
60
|
+
* slides in with the indicator (see {@link Tabs}) and is clipped by the frame. With the `outline` list, the panel
|
|
61
|
+
* joins the list with no gap, so give it the side and bottom borders.
|
|
35
62
|
*
|
|
36
|
-
* @param props - Radix Tabs content props.
|
|
63
|
+
* @param props - `bodyClassName` and Radix Tabs content props.
|
|
37
64
|
* @returns The panel.
|
|
38
65
|
*/
|
|
39
|
-
export declare function TabsContent({ className, ...props }:
|
|
66
|
+
export declare function TabsContent({ className, bodyClassName, children, ...props }: TabsContentProps): import("react").JSX.Element;
|
package/ui/overlay/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent,
|
|
|
2
2
|
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from './dialog.component';
|
|
3
3
|
export type { DialogContentProps } from './dialog.component';
|
|
4
4
|
export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerTitle, DrawerTrigger } from './drawer.component';
|
|
5
|
+
export { Portal } from './portal.component';
|
|
5
6
|
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from './popover.component';
|
|
6
7
|
export { Sheet, SheetClose, SheetContent, SheetDescription, SheetTitle, SheetTrigger } from './sheet.component';
|
|
7
8
|
export type { SheetContentProps } from './sheet.component';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Portal as PortalPrimitive } from 'radix-ui';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Renders its children at the end of `document.body`, or in `container`, outside the parent's DOM. Use it for
|
|
5
|
+
* layers that must sit above every other part of the page, such as {@link FileDropOverlay}, so a parent's
|
|
6
|
+
* `overflow`, `transform` or stacking context cannot clip or cover them. React context still flows through it.
|
|
7
|
+
*
|
|
8
|
+
* @param props - `container` (default `document.body`), `asChild` and the content.
|
|
9
|
+
* @returns The content in the portal, or nothing before the first client render.
|
|
10
|
+
*/
|
|
11
|
+
export declare function Portal(props: ComponentProps<typeof PortalPrimitive.Root>): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ComponentProps } from 'react';
|
|
2
|
+
import { type PresenceAnimation } from './presence.recipe';
|
|
3
|
+
/** Props of {@link Presence}. */
|
|
4
|
+
export interface PresenceProps extends ComponentProps<'div'> {
|
|
5
|
+
/** Shows the content when true. When it turns false, the exit animation plays before the content goes. */
|
|
6
|
+
present: boolean;
|
|
7
|
+
/** The motion: `fade` (default), `scale` or `drop`. */
|
|
8
|
+
animation?: PresenceAnimation;
|
|
9
|
+
/** Removes the content from the DOM after the exit animation. Default true. When false, it is hidden instead. */
|
|
10
|
+
unmountOnExit?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Shows and hides a box with an enter and an exit animation, like Chakra's Presence. When `present` turns true the
|
|
14
|
+
* box mounts and plays its enter animation. When `present` turns false it plays the exit animation, and only then
|
|
15
|
+
* leaves the DOM (or hides, with `unmountOnExit={false}`). Use it for content that appears in place, such as a
|
|
16
|
+
* notice, a details panel or a filter row. Overlays (dialogs, popovers, menus) already animate themselves.
|
|
17
|
+
*
|
|
18
|
+
* @param props - `present`, `animation`, `unmountOnExit` and any `div` props.
|
|
19
|
+
* @returns The animated box, or nothing once it has left.
|
|
20
|
+
*/
|
|
21
|
+
export declare function Presence({ present, animation, unmountOnExit, className, onAnimationEnd, ...props }: PresenceProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The motion of a {@link Presence}. */
|
|
2
|
+
export type PresenceAnimation = 'fade' | 'scale' | 'drop';
|
|
3
|
+
/**
|
|
4
|
+
* The enter and exit classes of each {@link PresenceAnimation}: `fade` fades, `scale` grows from 96 % while it
|
|
5
|
+
* fades (like popovers), `drop` falls 6 px into place while it fades (like the navigation menu). Reduced motion
|
|
6
|
+
* keeps only the fade.
|
|
7
|
+
*/
|
|
8
|
+
export declare const presenceClassName: Record<PresenceAnimation, string>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { addTags, splitTags, TAG_DELIMITERS } from './tag-entry.algorithm';
|
|
2
|
+
export type { TagAddition, TagRules } from './tag-entry.algorithm';
|
|
3
|
+
export { Tag } from './tag.component';
|
|
4
|
+
export type { TagProps } from './tag.component';
|
|
5
|
+
export { tagsFieldClassName, tagsFieldInputClassName } from './tags-field.recipe';
|
|
6
|
+
export { TagsInput } from './tags-input.component';
|
|
7
|
+
export type { TagsInputProps } from './tags-input.component';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** The characters that end one tag and start the next, in typed or pasted text. */
|
|
2
|
+
export declare const TAG_DELIMITERS: RegExp;
|
|
3
|
+
/**
|
|
4
|
+
* Splits typed or pasted text into tags: on commas, semicolons, new lines and tabs, trimmed, without empty parts.
|
|
5
|
+
*
|
|
6
|
+
* @param text - The text.
|
|
7
|
+
* @returns The tags in the text, in order.
|
|
8
|
+
*/
|
|
9
|
+
export declare function splitTags(text: string): string[];
|
|
10
|
+
/** The rules of {@link addTags}. */
|
|
11
|
+
export interface TagRules {
|
|
12
|
+
/** The most tags the list can hold. */
|
|
13
|
+
max?: number;
|
|
14
|
+
/** Accepts or refuses one tag, for example a check of an e-mail address. */
|
|
15
|
+
validate?: (tag: string) => boolean;
|
|
16
|
+
/** Keeps a tag that is already in the list. Default false: the same text, ignoring case, is skipped. */
|
|
17
|
+
allowDuplicates?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** The result of {@link addTags}. */
|
|
20
|
+
export interface TagAddition {
|
|
21
|
+
/** The new list. */
|
|
22
|
+
tags: string[];
|
|
23
|
+
/** The candidates that `validate` refused, or that did not fit under `max`. */
|
|
24
|
+
rejected: string[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Adds candidates to a tag list under the rules. A duplicate is skipped, not rejected: it is already there.
|
|
28
|
+
*
|
|
29
|
+
* @param current - The tags in the list now.
|
|
30
|
+
* @param candidates - The tags to add, in order.
|
|
31
|
+
* @param rules - `max`, `validate` and `allowDuplicates`.
|
|
32
|
+
* @returns The new list and the refused candidates.
|
|
33
|
+
*/
|
|
34
|
+
export declare function addTags(current: readonly string[], candidates: readonly string[], rules?: TagRules): TagAddition;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
/** Props of {@link Tag}. */
|
|
3
|
+
export interface TagProps extends ComponentProps<'span'> {
|
|
4
|
+
/** Shows a cross that calls this. Without it the tag cannot be removed. */
|
|
5
|
+
onRemove?: () => void;
|
|
6
|
+
/** The accessible name of the cross, such as "Remove ana@pargic.com". Default "Remove". */
|
|
7
|
+
removeLabel?: string;
|
|
8
|
+
/** Marks the tag that the next Backspace removes. */
|
|
9
|
+
highlighted?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* One value in a {@link TagsInput} or a multiple {@link Combobox}: a brand-tinted chip that grows in when added,
|
|
13
|
+
* with a cross to remove it.
|
|
14
|
+
*
|
|
15
|
+
* @param props - `onRemove`, `removeLabel`, `highlighted` and any `span` props.
|
|
16
|
+
* @returns The tag.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Tag({ className, children, onRemove, removeLabel, highlighted, ...props }: TagProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The field that holds tags and a text input: the look of a text control, a height that grows as tags wrap, and
|
|
3
|
+
* the focus ring on the whole field while its input has focus.
|
|
4
|
+
*/
|
|
5
|
+
export declare const tagsFieldClassName: string;
|
|
6
|
+
/** The text input inside {@link tagsFieldClassName}: no frame of its own, and it takes the rest of the line. */
|
|
7
|
+
export declare const tagsFieldInputClassName = "h-6 min-w-16 flex-1 bg-transparent px-1 outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ComponentProps } from 'react';
|
|
2
|
+
import { type TagRules } from './tag-entry.algorithm';
|
|
3
|
+
/** Props of {@link TagsInput}. */
|
|
4
|
+
export interface TagsInputProps extends TagRules, Omit<ComponentProps<'input'>, 'value' | 'defaultValue' | 'onChange' | 'type' | 'max'> {
|
|
5
|
+
/** The tags, when the parent owns them. */
|
|
6
|
+
value?: string[];
|
|
7
|
+
/** The first tags, when the input owns them. */
|
|
8
|
+
defaultValue?: string[];
|
|
9
|
+
/** Called with the new list after a tag is added or removed. */
|
|
10
|
+
onValueChange?: (tags: string[]) => void;
|
|
11
|
+
/** Called with the text that `validate` or `max` refused. The text stays in the input, marked invalid. */
|
|
12
|
+
onReject?: (rejected: string[]) => void;
|
|
13
|
+
/** Adds the typed text when the input loses focus. Default true. */
|
|
14
|
+
addOnBlur?: boolean;
|
|
15
|
+
/** The accessible name of a tag's cross. Default `Remove <tag>`. */
|
|
16
|
+
removeLabel?: (tag: string) => string;
|
|
17
|
+
/** Classes for the field around the tags. */
|
|
18
|
+
fieldClassName?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A text input that turns entries into tags, for labels, keywords or e-mail recipients.
|
|
22
|
+
*
|
|
23
|
+
* Enter, a comma or a semicolon adds the typed text. A paste with several entries adds them all. Backspace in an
|
|
24
|
+
* empty input highlights the last tag, and a second Backspace removes it. Each tag also has a cross. Inside a
|
|
25
|
+
* {@link Field} it takes the field's label, hint and error.
|
|
26
|
+
*
|
|
27
|
+
* @param props - The tags, the rules (`max`, `validate`, `allowDuplicates`) and any `input` props.
|
|
28
|
+
* @returns The tags input.
|
|
29
|
+
*/
|
|
30
|
+
export declare function TagsInput({ value, defaultValue, onValueChange, onReject, max, validate, allowDuplicates, addOnBlur, removeLabel, fieldClassName, className, disabled, placeholder, onKeyDown, onPaste, onBlur, ...props }: TagsInputProps): import("react").JSX.Element;
|
|
@@ -18,7 +18,7 @@ export interface SiteHeaderProps {
|
|
|
18
18
|
nav: readonly SiteNavEntry[];
|
|
19
19
|
/** The actions at the end, such as Sign in and Talk to us. */
|
|
20
20
|
actions?: ReactNode;
|
|
21
|
-
/** The brand at the start. Default the
|
|
21
|
+
/** The brand at the start. Default the talogic symbol and name, linking home. */
|
|
22
22
|
brand?: ReactNode;
|
|
23
23
|
className?: string;
|
|
24
24
|
}
|