@sesamehr/react-design-system 3.3.1 → 3.4.1
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/Button/ButtonGroup/ButtonGroup.d.ts +11 -0
- package/dist/Button/ButtonGroup/index.d.ts +1 -0
- package/dist/Button/Fab/Fab.d.ts +24 -0
- package/dist/Button/Fab/index.d.ts +9 -0
- package/dist/Button/IconButton/IconButton.d.ts +2 -1
- package/dist/Button/IconButton/index.d.ts +5 -4
- package/dist/Button/SplitButton/SplitButton.d.ts +48 -0
- package/dist/Button/SplitButton/index.d.ts +1 -0
- package/dist/Button/index.d.ts +1 -1
- package/dist/Data/Table/hooks/useTableVirtual/useTableVirtual.types.d.ts +1 -1
- package/dist/Display/Badge/Badge.d.ts +3 -1
- package/dist/Display/Badge/index.d.ts +7 -5
- package/dist/Display/Mention/Mention.d.ts +28 -0
- package/dist/Display/Mention/index.d.ts +6 -0
- package/dist/Display/PlayerPill/PlayerPill.d.ts +11 -0
- package/dist/Display/PlayerPill/PlayerPillAction.d.ts +10 -0
- package/dist/Display/PlayerPill/PlayerPillStatus.d.ts +11 -0
- package/dist/Display/PlayerPill/PlayerPillTime.d.ts +18 -0
- package/dist/Display/PlayerPill/index.d.ts +15 -0
- package/dist/Display/PlayerPill/playerPillContext.d.ts +16 -0
- package/dist/Display/PlayerPill/useElapsedSeconds.d.ts +18 -0
- package/dist/Display/Tag/Tag.d.ts +17 -0
- package/dist/Display/Tag/index.d.ts +14 -0
- package/dist/Feedback/Alert/AlertDescription.d.ts +1 -1
- package/dist/Feedback/Alert/alert-context.d.ts +1 -1
- package/dist/Feedback/Bullet/index.d.ts +1 -1
- package/dist/Feedback/Dialog/DialogFullScreenContent.d.ts +33 -0
- package/dist/Feedback/Dialog/index.d.ts +1 -0
- package/dist/Feedback/EmptyState/EmptyState.d.ts +26 -0
- package/dist/Feedback/EmptyState/EmptyStateOption/EmptyStateOption.d.ts +16 -0
- package/dist/Feedback/EmptyState/EmptyStateOption/index.d.ts +1 -0
- package/dist/Feedback/EmptyState/index.d.ts +10 -0
- package/dist/Feedback/Toast/Toast.d.ts +15 -0
- package/dist/Feedback/Toast/ToastAction.d.ts +12 -0
- package/dist/Feedback/Toast/ToastClose.d.ts +12 -0
- package/dist/Feedback/Toast/ToastDescription.d.ts +4 -0
- package/dist/Feedback/Toast/ToastIcon.d.ts +5 -0
- package/dist/Feedback/Toast/ToastTitle.d.ts +4 -0
- package/dist/Feedback/Toast/Toaster.d.ts +24 -0
- package/dist/Feedback/Toast/index.d.ts +26 -0
- package/dist/Feedback/Toast/toast-context.d.ts +6 -0
- package/dist/Feedback/Toast/useToast.d.ts +51 -0
- package/dist/Forms/Field/useFieldGroup.d.ts +1 -1
- package/dist/Forms/Inputs/ColorPicker/ColorPicker.d.ts +15 -0
- package/dist/Forms/Inputs/ColorPicker/ColorPickerContent.d.ts +14 -0
- package/dist/Forms/Inputs/ColorPicker/ColorPickerSwatch.d.ts +11 -0
- package/dist/Forms/Inputs/ColorPicker/ColorPickerTrigger.d.ts +17 -0
- package/dist/Forms/Inputs/ColorPicker/index.d.ts +5 -0
- package/dist/Forms/Inputs/ColorPicker/useColorPicker.d.ts +21 -0
- package/dist/Forms/Inputs/DatePicker/DatePickerTrigger.d.ts +1 -1
- package/dist/Forms/Inputs/IconPicker/IconPicker.d.ts +42 -0
- package/dist/Forms/Inputs/IconPicker/IconPickerContent.d.ts +26 -0
- package/dist/Forms/Inputs/IconPicker/IconPickerItem.d.ts +31 -0
- package/dist/Forms/Inputs/IconPicker/IconPickerTrigger.d.ts +19 -0
- package/dist/Forms/Inputs/IconPicker/index.d.ts +5 -0
- package/dist/Forms/Inputs/IconPicker/useIconPicker.d.ts +44 -0
- package/dist/Forms/Inputs/InputOtp/InputOtpGroup/InputOtpGroup.d.ts +5 -1
- package/dist/Forms/Inputs/InputOtp/types.d.ts +1 -1
- package/dist/Forms/Inputs/Select/SelectTrigger.d.ts +1 -1
- package/dist/Forms/Inputs/Textarea/Textarea.d.ts +48 -3
- package/dist/Forms/Inputs/Textarea/index.d.ts +3 -2
- package/dist/Forms/Inputs/Toggle/Switch/Switch.d.ts +11 -0
- package/dist/Forms/Inputs/index.d.ts +2 -0
- package/dist/Forms/Inputs/inputSize.d.ts +1 -1
- package/dist/Layout/Scrollbar/Scrollbar.d.ts +2 -2
- package/dist/Navigation/Stepper/Stepper.d.ts +23 -0
- package/dist/Navigation/Stepper/StepperItem.d.ts +13 -0
- package/dist/Navigation/Stepper/StepperSubsteps.d.ts +12 -0
- package/dist/Navigation/Stepper/index.d.ts +4 -0
- package/dist/Navigation/Stepper/useStepper.d.ts +25 -0
- package/dist/Navigation/Stepper/useStepperPill.d.ts +28 -0
- package/dist/Navigation/ToggleTabs/useToggleTabsPill.d.ts +1 -1
- package/dist/Transitions/TransitionBase.d.ts +5 -1
- package/dist/hooks/useAutoGrow/useAutoGrow.d.ts +7 -0
- package/dist/main.d.ts +12 -2
- package/dist/react-design-system.css +1 -1
- package/dist/react-design-system.js +21787 -18689
- package/dist/react-design-system.umd.cjs +118 -87
- package/package.json +4 -2
- package/src/assets/styles/theme-v2.css +14 -22
- package/src/assets/styles/theme-v3.css +161 -23
- package/src/assets/styles/theme-v3.test.ts +242 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
export { Toast, type ToastProps } from './Toast.tsx';
|
|
3
|
+
export { ToastAction, type ToastActionProps } from './ToastAction.tsx';
|
|
4
|
+
export { ToastClose, type ToastCloseProps } from './ToastClose.tsx';
|
|
5
|
+
export { ToastDescription, type ToastDescriptionProps, } from './ToastDescription.tsx';
|
|
6
|
+
export { ToastIcon, type ToastIconProps } from './ToastIcon.tsx';
|
|
7
|
+
export { ToastTitle, type ToastTitleProps } from './ToastTitle.tsx';
|
|
8
|
+
export { Toaster, type ToasterProps } from './Toaster.tsx';
|
|
9
|
+
export { type ToastActionDescriptor, type ToastEntry, type ToastOptions, type ToastType, type UseToastReturn, dismissAllToasts, dismissToast, toast, useToast, } from './useToast.ts';
|
|
10
|
+
/** The six corners the stack can be anchored to. */
|
|
11
|
+
export declare const TOAST_POSITIONS: readonly ["top-left", "top-center", "top-right", "bottom-left", "bottom-center", "bottom-right"];
|
|
12
|
+
export type ToastPosition = (typeof TOAST_POSITIONS)[number];
|
|
13
|
+
/**
|
|
14
|
+
* Class names, not utilities: the declarations live in `Toaster.module.css`
|
|
15
|
+
* behind `@apply`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const toastViewportVariants: (props?: ({
|
|
18
|
+
position?: "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right" | null | undefined;
|
|
19
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
20
|
+
export type ToastViewportVariants = VariantProps<typeof toastViewportVariants>;
|
|
21
|
+
export declare const toastVariants: (props?: ({
|
|
22
|
+
type?: "success" | "error" | "info" | "warning" | "neutral" | null | undefined;
|
|
23
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
24
|
+
export type ToastVariants = VariantProps<typeof toastVariants>;
|
|
25
|
+
/** Which way a swipe must travel to dismiss, derived from the corner. */
|
|
26
|
+
export declare function toastSwipeDirection(position: ToastPosition): 'up' | 'down' | 'left' | 'right';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export type ToastType = 'info' | 'success' | 'warning' | 'error' | 'neutral';
|
|
2
|
+
export interface ToastActionDescriptor {
|
|
3
|
+
label: string;
|
|
4
|
+
onClick: () => void;
|
|
5
|
+
/**
|
|
6
|
+
* What a screen reader is told instead of the button, which is gone before
|
|
7
|
+
* anyone can reach it — so it must describe a route that outlives the toast.
|
|
8
|
+
* Defaults to the label.
|
|
9
|
+
*/
|
|
10
|
+
altText?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ToastOptions {
|
|
13
|
+
title: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
type?: ToastType;
|
|
16
|
+
action?: ToastActionDescriptor;
|
|
17
|
+
/** Overrides the `duration` `OxToaster` was mounted with. */
|
|
18
|
+
duration?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface ToastEntry extends ToastOptions {
|
|
21
|
+
id: string;
|
|
22
|
+
type: ToastType;
|
|
23
|
+
open: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface UseToastReturn {
|
|
26
|
+
toasts: readonly ToastEntry[];
|
|
27
|
+
toast: (options: ToastOptions) => string;
|
|
28
|
+
dismiss: (id: string) => void;
|
|
29
|
+
dismissAll: () => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The queue read without subscribing, for tests that assert on it without
|
|
33
|
+
* rendering a viewport. Exported for them, not from the package: it is absent
|
|
34
|
+
* from `index.ts` on purpose and no consumer can reach it.
|
|
35
|
+
*/
|
|
36
|
+
export declare const getToasts: () => readonly ToastEntry[];
|
|
37
|
+
/**
|
|
38
|
+
* The queue owns the cap rather than the viewport clipping to it, because a
|
|
39
|
+
* fourth toast has to *close* the oldest: it leaves the way any other does.
|
|
40
|
+
*/
|
|
41
|
+
export declare function setToastLimit(next: number): void;
|
|
42
|
+
export declare function toast(options: ToastOptions): string;
|
|
43
|
+
/**
|
|
44
|
+
* Closes the toast; dropping it is `removeToast`'s job, a beat later. Also the
|
|
45
|
+
* single path out of the queue, so a timer, the close button and a swipe all
|
|
46
|
+
* leave by the same route and a second call is a no-op.
|
|
47
|
+
*/
|
|
48
|
+
export declare function dismissToast(id: string): void;
|
|
49
|
+
export declare function dismissAllToasts(): void;
|
|
50
|
+
export declare function removeToast(id: string): void;
|
|
51
|
+
export declare function useToast(): UseToastReturn;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* inside it.
|
|
4
4
|
*
|
|
5
5
|
* `FieldGroup` already paints its children through custom properties
|
|
6
|
-
* (`--message-text-color`, `--controller-border-color`), and that stays: it is
|
|
6
|
+
* (`--ox-message-text-color`, `--ox-controller-border-color`), and that stays: it is
|
|
7
7
|
* what lets a consumer's own control inherit the error colour with no prop
|
|
8
8
|
* drilling. A custom property cannot carry an `id` or an `aria-invalid`,
|
|
9
9
|
* though, so the accessible half needs a real context beside it.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ColorPickerProps {
|
|
2
|
+
className?: string;
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
/** The field does not open, and an open panel closes. */
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
value?: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
onValueChange?: (value: string) => void;
|
|
9
|
+
open?: boolean;
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
onOpenChange?: (open: boolean) => void;
|
|
12
|
+
dataTestid: string;
|
|
13
|
+
}
|
|
14
|
+
/** A field that opens a panel of the colours an application may assign. */
|
|
15
|
+
export declare const ColorPicker: import('react').ForwardRefExoticComponent<ColorPickerProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
2
|
+
export interface ColorPickerContentProps extends Omit<React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>, 'side' | 'align' | 'sideOffset'> {
|
|
3
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
4
|
+
sideOffset?: number;
|
|
5
|
+
align?: 'start' | 'center' | 'end';
|
|
6
|
+
dataTestid: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The panel the swatches sit in.
|
|
10
|
+
*
|
|
11
|
+
* A radio group and not a plain box: that is what gives the set one tab stop,
|
|
12
|
+
* arrow keys between swatches, `role="radiogroup"` and an `aria-checked` each.
|
|
13
|
+
*/
|
|
14
|
+
export declare const ColorPickerContent: import('react').ForwardRefExoticComponent<ColorPickerContentProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
2
|
+
export interface ColorPickerSwatchProps extends Omit<React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>, 'children'> {
|
|
3
|
+
/** What gets stored when this swatch is chosen. */
|
|
4
|
+
value: string;
|
|
5
|
+
/** Any CSS colour: a token (`var(--category-7)`) or a literal. */
|
|
6
|
+
color: string;
|
|
7
|
+
/** The colour's name, drawn for screen readers only. */
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/** One colour in the panel. */
|
|
11
|
+
export declare const ColorPickerSwatch: import('react').ForwardRefExoticComponent<ColorPickerSwatchProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ColorPickerTriggerProps extends Omit<React.ComponentPropsWithoutRef<'button'>, 'children'> {
|
|
2
|
+
/** Any CSS colour: a token (`var(--category-7)`) or a literal. */
|
|
3
|
+
color?: string;
|
|
4
|
+
/** Shown while nothing is chosen. */
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
/** The chosen colour's name. */
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The field: the chosen colour, its name, and a chevron.
|
|
11
|
+
*
|
|
12
|
+
* Both fall back to the chosen swatch's own, so the bare field works. The prop
|
|
13
|
+
* and `children` stay because Radix keeps the panel unmounted until it opens:
|
|
14
|
+
* for a value loaded from a server whose swatch has never rendered, the caller
|
|
15
|
+
* is the only one who knows.
|
|
16
|
+
*/
|
|
17
|
+
export declare const ColorPickerTrigger: import('react').ForwardRefExoticComponent<ColorPickerTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ColorPicker, type ColorPickerProps } from './ColorPicker.tsx';
|
|
2
|
+
export { ColorPickerTrigger, type ColorPickerTriggerProps, } from './ColorPickerTrigger.tsx';
|
|
3
|
+
export { ColorPickerContent, type ColorPickerContentProps, } from './ColorPickerContent.tsx';
|
|
4
|
+
export { ColorPickerSwatch, type ColorPickerSwatchProps, } from './ColorPickerSwatch.tsx';
|
|
5
|
+
export { useColorPicker, type ColorPickerContext } from './useColorPicker.ts';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** What a swatch tells the root about itself, so the field can redraw it. */
|
|
2
|
+
export interface ColorPickerSwatchEntry {
|
|
3
|
+
color: string;
|
|
4
|
+
name: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export interface ColorPickerContext {
|
|
7
|
+
/** The chosen colour's value, or `undefined` while nothing is chosen. */
|
|
8
|
+
value: string | undefined;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
/** Choose a colour. Closes the panel, which is what the design asks for. */
|
|
11
|
+
select: (value: string) => void;
|
|
12
|
+
/** The swatch behind the chosen value, once one has rendered. */
|
|
13
|
+
chosen: ColorPickerSwatchEntry | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Record a swatch. Never taken back on unmount: the panel unmounts every
|
|
16
|
+
* time it closes, and the field has to keep the dot and the name after it.
|
|
17
|
+
*/
|
|
18
|
+
remember: (value: string, entry: ColorPickerSwatchEntry) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare const ColorPickerContextObject: import('react').Context<ColorPickerContext | null>;
|
|
21
|
+
export declare function useColorPicker(): ColorPickerContext;
|
|
@@ -18,7 +18,7 @@ export interface DatePickerTriggerProps extends React.ButtonHTMLAttributes<HTMLB
|
|
|
18
18
|
* `OxCombobox` came to disagree about a radius, a border and a background, and
|
|
19
19
|
* the fix cost more than the component.
|
|
20
20
|
*
|
|
21
|
-
* It takes no size prop: height and radius come from the `--controller-*`
|
|
21
|
+
* It takes no size prop: height and radius come from the `--ox-controller-*`
|
|
22
22
|
* variables every input in the package reads, so `inputSizeClass[size]` on any
|
|
23
23
|
* ancestor sizes it. Its declarations are `OxSelectTrigger`'s, so the two sit
|
|
24
24
|
* level in one form.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface IconPickerProps {
|
|
2
|
+
className?: string;
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
/** The field does not open, and an open panel closes. */
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
value?: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
onValueChange?: (value: string) => void;
|
|
9
|
+
open?: boolean;
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
onOpenChange?: (open: boolean) => void;
|
|
12
|
+
dataTestid: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A field that opens a searchable panel of icons — the one on a folder, a
|
|
16
|
+
* shortcut or a category.
|
|
17
|
+
*
|
|
18
|
+
* **The set is composed, not configured.** An item carries its own icon and
|
|
19
|
+
* its own name, exactly as `OxColorPickerSwatch` carries its own colour, so
|
|
20
|
+
* the caller writes the icons they want and this component binds none of its
|
|
21
|
+
* own. That is the whole bundle argument in one sentence and it is worth
|
|
22
|
+
* spelling out, because the obvious alternative looks friendlier and is not:
|
|
23
|
+
*
|
|
24
|
+
* `@sesame/orxata-icons` ships 511 icons, about 85 KB gzipped once the markup,
|
|
25
|
+
* the barrel and its re-export chain are counted. A picker that knew them all
|
|
26
|
+
* would have to reach the barrel from inside this package, which
|
|
27
|
+
* `orxata/icon-import-per-icon` forbids for a documented reason — an icon
|
|
28
|
+
* pulled through the barrel survives in the design system's own bundle and only
|
|
29
|
+
* drops out if the *consumer's* bundler walks it, so the package's size becomes
|
|
30
|
+
* a claim about someone else's toolchain. Everyone installing the design system
|
|
31
|
+
* for one button would pay for that being wrong. Composed, a caller pays for
|
|
32
|
+
* the icons they actually listed and nothing else.
|
|
33
|
+
*
|
|
34
|
+
* Radix's `Popover.Root` renders no element of its own, so the wrapper below is
|
|
35
|
+
* what carries `data-slot`, `data-testid` and the class. Both the value and the
|
|
36
|
+
* open state keep an uncontrolled path, gated on the **handler** the way the
|
|
37
|
+
* Vue `defineModel` behaves: given a value and nobody listening, the picker
|
|
38
|
+
* still moves rather than being pinned to what it started on. The open state
|
|
39
|
+
* has to be held here either way — choosing an icon closes the panel, and only
|
|
40
|
+
* the side that owns the state can do that.
|
|
41
|
+
*/
|
|
42
|
+
export declare const IconPicker: import('react').ForwardRefExoticComponent<IconPickerProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
2
|
+
export interface IconPickerContentProps extends Omit<React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>, 'side' | 'align' | 'sideOffset'> {
|
|
3
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
4
|
+
sideOffset?: number;
|
|
5
|
+
align?: 'start' | 'center' | 'end';
|
|
6
|
+
dataTestid: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The panel: a search field over a grid of icons.
|
|
10
|
+
*
|
|
11
|
+
* A radio group rather than a plain box, so the whole set is one tab stop and
|
|
12
|
+
* the arrows move between icons — Radix's roving focus answers all four, which
|
|
13
|
+
* is what a wrapped grid needs. It is also what gives the set
|
|
14
|
+
* `role="radiogroup"` and each item its `aria-checked`, so the choice is
|
|
15
|
+
* announced as a choice instead of as several hundred buttons.
|
|
16
|
+
*
|
|
17
|
+
* **The search field is written here rather than composed from `OxSearchBar`,
|
|
18
|
+
* and that is not a slight on it.** `OxSearchBar` calls `useFieldControl()`,
|
|
19
|
+
* and so does the trigger. Inside an `OxFieldGroup` the trigger claims the
|
|
20
|
+
* control id first and a second claim warns — so composing it would print
|
|
21
|
+
* "more than one labelable control in a single field group" to the console
|
|
22
|
+
* every time a user opened the panel, for a field that should never have been
|
|
23
|
+
* the one the label names anyway. It names itself instead, with the same
|
|
24
|
+
* string it shows as a placeholder.
|
|
25
|
+
*/
|
|
26
|
+
export declare const IconPickerContent: import('react').ForwardRefExoticComponent<IconPickerContentProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
2
|
+
export interface IconPickerItemProps extends Omit<React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>, 'children'> {
|
|
3
|
+
/** What gets stored when this icon is chosen. */
|
|
4
|
+
value: string;
|
|
5
|
+
/** Markup for the icon, as `@sesame/orxata-icons` exports it. */
|
|
6
|
+
icon: string;
|
|
7
|
+
/** Extra words the search should match besides `value`. */
|
|
8
|
+
keywords?: string[];
|
|
9
|
+
/** The icon's name, drawn for screen readers only. */
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* One icon in the panel.
|
|
14
|
+
*
|
|
15
|
+
* The name goes in `children` and is drawn for screen readers only: there is no
|
|
16
|
+
* room for it under a 20px glyph, and the design asks for it twice over — the
|
|
17
|
+
* item needs an accessible name, and nobody should have to tell the icons apart
|
|
18
|
+
* by shape. The field shows the same name in full.
|
|
19
|
+
*
|
|
20
|
+
* **The item decides its own visibility**, which is why the search lives in the
|
|
21
|
+
* root's context rather than in the panel: the panel would otherwise have to
|
|
22
|
+
* filter children it did not write. An item that does not survive the term
|
|
23
|
+
* renders nothing at all, so its SVG is not in the document either.
|
|
24
|
+
*
|
|
25
|
+
* `keywords` is where synonyms go — "notification", "alarm" for a bell — and it
|
|
26
|
+
* is a caller's to supply for the same reason the icons are. This package holds
|
|
27
|
+
* no synonyms for its icons in any language, and a design system that shipped
|
|
28
|
+
* Spanish ones would be shipping a search that works in one of the ten locales
|
|
29
|
+
* it translates.
|
|
30
|
+
*/
|
|
31
|
+
export declare const IconPickerItem: import('react').ForwardRefExoticComponent<IconPickerItemProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface IconPickerTriggerProps extends Omit<React.ComponentPropsWithoutRef<'button'>, 'children'> {
|
|
2
|
+
/** Markup for the chosen icon, as `@sesame/orxata-icons` exports it. */
|
|
3
|
+
icon?: string;
|
|
4
|
+
/** Shown while nothing is chosen. */
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
/** The chosen icon's name. */
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The field: the chosen icon, its name, and a chevron.
|
|
11
|
+
*
|
|
12
|
+
* The name is `children` and the icon is a prop, both describing the *current*
|
|
13
|
+
* selection — which is the one thing a registry fed by the items could not do.
|
|
14
|
+
* Radix keeps a popover's content unmounted until it opens, so no item has run
|
|
15
|
+
* by the time a form renders an icon it loaded from a server: the common case,
|
|
16
|
+
* not the edge case. A caller who wrote the set already holds the mapping, so
|
|
17
|
+
* it is asked for here rather than guessed at.
|
|
18
|
+
*/
|
|
19
|
+
export declare const IconPickerTrigger: import('react').ForwardRefExoticComponent<IconPickerTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { IconPicker, type IconPickerProps } from './IconPicker.tsx';
|
|
2
|
+
export { IconPickerTrigger, type IconPickerTriggerProps, } from './IconPickerTrigger.tsx';
|
|
3
|
+
export { IconPickerContent, type IconPickerContentProps, } from './IconPickerContent.tsx';
|
|
4
|
+
export { IconPickerItem, type IconPickerItemProps } from './IconPickerItem.tsx';
|
|
5
|
+
export { useIconPicker, type IconPickerContext } from './useIconPicker.ts';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface IconPickerContext {
|
|
2
|
+
/** The chosen icon's value, or `undefined` while nothing is chosen. */
|
|
3
|
+
value: string | undefined;
|
|
4
|
+
disabled: boolean;
|
|
5
|
+
/** Choose an icon. Closes the panel, which is what the design asks for. */
|
|
6
|
+
select: (value: string) => void;
|
|
7
|
+
/** What the panel's search field shows. Cleared when the panel closes. */
|
|
8
|
+
term: string;
|
|
9
|
+
setTerm: (term: string) => void;
|
|
10
|
+
/** Whether an item survives the current term. An item asks about itself. */
|
|
11
|
+
matches: (value: string, keywords?: string[]) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* An item announces itself while it is mounted, and gets back the call that
|
|
14
|
+
* takes it away again.
|
|
15
|
+
*
|
|
16
|
+
* Only ever read to answer "did the term match nothing at all", which is the
|
|
17
|
+
* one question an item cannot answer about itself. Deliberately not what the
|
|
18
|
+
* trigger reads: the panel is unmounted until it opens, so at the moment a
|
|
19
|
+
* form first paints a value loaded from a server this registry is empty —
|
|
20
|
+
* which is why the trigger is handed its icon directly instead.
|
|
21
|
+
*/
|
|
22
|
+
register: (value: string, keywords?: string[]) => () => void;
|
|
23
|
+
/** False only when a term is in the field and nothing survived it. */
|
|
24
|
+
hasMatches: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare const IconPickerContextObject: import('react').Context<IconPickerContext | null>;
|
|
27
|
+
/**
|
|
28
|
+
* Throwing, unlike `useFieldGroup` — a trigger with no root has nothing to
|
|
29
|
+
* open and an item with no root has nothing to tell, so neither one has a
|
|
30
|
+
* sensible way to render.
|
|
31
|
+
*/
|
|
32
|
+
export declare function useIconPicker(): IconPickerContext;
|
|
33
|
+
/**
|
|
34
|
+
* Case- and accent-insensitive substring matching, over an item's value and
|
|
35
|
+
* whatever else the caller says it is called.
|
|
36
|
+
*
|
|
37
|
+
* The accents are not a flourish: this package ships ten locales, so the names
|
|
38
|
+
* a Spanish or French caller writes into `keywords` carry them while nobody
|
|
39
|
+
* types them into a search box. `NFD` splits a letter from its mark and the
|
|
40
|
+
* range drops the marks, so `nomina` finds `nómina`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function normalize(text: string): string;
|
|
43
|
+
/** True when every word of `term` appears somewhere in `haystack`. */
|
|
44
|
+
export declare function matchesTerm(term: string, haystack: string[]): boolean;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export type InputOtpGroupProps = React.HTMLAttributes<HTMLDivElement>;
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* InputOtpGroup — welds the slots it holds into one bar, which is the design's
|
|
4
|
+
* `Style=Default`; slots left directly in the root keep the root's gap instead,
|
|
5
|
+
* which is `Style=Separated`. Its test id follows mount order.
|
|
6
|
+
*/
|
|
3
7
|
export declare const InputOtpGroup: import('react').ForwardRefExoticComponent<InputOtpGroupProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface InputOtpProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange' | 'children'> {
|
|
2
2
|
dataTestid: string;
|
|
3
|
-
size?: 'sm' | 'md' | 'lg';
|
|
3
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
4
4
|
type?: 'text' | 'number';
|
|
5
5
|
otp?: boolean;
|
|
6
6
|
/** Render every slot as a password field. */
|
|
@@ -18,7 +18,7 @@ export interface SelectTriggerProps extends Omit<React.ComponentPropsWithoutRef<
|
|
|
18
18
|
/**
|
|
19
19
|
* The button that opens the list and shows the current value.
|
|
20
20
|
*
|
|
21
|
-
* It takes no size prop: height and radius come from the `--controller-*`
|
|
21
|
+
* It takes no size prop: height and radius come from the `--ox-controller-*`
|
|
22
22
|
* variables shared with every other input, so `inputSizeClass[size]` on any
|
|
23
23
|
* ancestor drives it.
|
|
24
24
|
*/
|
|
@@ -11,14 +11,38 @@ export interface TextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTex
|
|
|
11
11
|
* padding.
|
|
12
12
|
*/
|
|
13
13
|
maxRows?: number;
|
|
14
|
+
/**
|
|
15
|
+
* The character limit the built-in counter counts to. Set it and the counter
|
|
16
|
+
* appears; leave it out and there is none.
|
|
17
|
+
*
|
|
18
|
+
* A soft limit: nothing here stops the field going past it. That is the
|
|
19
|
+
* point — `OxCounter` turns red once the value is over, which is the moment
|
|
20
|
+
* the counter is worth having, and a hard `maxLength` would make that moment
|
|
21
|
+
* unreachable.
|
|
22
|
+
*/
|
|
23
|
+
counterMax?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Draws the native grip in the bottom-right corner and lets the user drag
|
|
26
|
+
* the field taller or shorter. Vertical only — a width dragged by hand would
|
|
27
|
+
* take the field out of the column its field group puts it in.
|
|
28
|
+
*
|
|
29
|
+
* Off by default, because Figma draws no grip in any of the six states it
|
|
30
|
+
* documents and the growth already covers the ordinary case. Turn it on for
|
|
31
|
+
* a field someone writes paragraphs into, where four rows and a scroll is
|
|
32
|
+
* not enough room to see what you wrote.
|
|
33
|
+
*
|
|
34
|
+
* The drag wins over `maxRows`: the growth stops writing the height the
|
|
35
|
+
* moment the user has chosen one, or the next keystroke would undo the drag.
|
|
36
|
+
*/
|
|
37
|
+
resizable?: boolean;
|
|
14
38
|
/** Controlled value. Pair with `onFieldChange`; omit for uncontrolled. */
|
|
15
39
|
field?: string;
|
|
16
40
|
/** Called on every input with the next value. */
|
|
17
41
|
onFieldChange?: (value: string) => void;
|
|
18
42
|
/**
|
|
19
|
-
*
|
|
20
|
-
* `{ value, length }
|
|
21
|
-
*
|
|
43
|
+
* Overrides what `counterMax` would draw bottom-right inside the box. A node,
|
|
44
|
+
* or a render prop called with `{ value, length }`, for a word count or a
|
|
45
|
+
* hint rather than the character counter.
|
|
22
46
|
*/
|
|
23
47
|
counter?: ReactNode | ((state: TextareaCounterState) => ReactNode);
|
|
24
48
|
dataTestid: string;
|
|
@@ -53,6 +77,27 @@ export interface TextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTex
|
|
|
53
77
|
* </OxFieldGroup>
|
|
54
78
|
* ```
|
|
55
79
|
*
|
|
80
|
+
* **`counterMax` is the switch the design calls ‘Show counter’.** It is a
|
|
81
|
+
* limit rather than a boolean because a counter needs a number to count to,
|
|
82
|
+
* and the component already knows the other one — so an `<OxCounter>` appears
|
|
83
|
+
* bottom-right inside the box with nothing else to wire:
|
|
84
|
+
*
|
|
85
|
+
* ```tsx
|
|
86
|
+
* <OxTextarea counterMax={100} dataTestid="notes" />
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* The limit is deliberately **not** read from `maxLength`, even though a caller
|
|
90
|
+
* may well write one too. `maxLength` is a hard stop — the browser refuses the
|
|
91
|
+
* keystroke — so a counter that counted to it could never reach the over-limit
|
|
92
|
+
* state `OxCounter` draws in red, and the one case the counter exists to warn
|
|
93
|
+
* about would be the one it never showed. The soft limit and the hard one are
|
|
94
|
+
* different numbers, and often only one of them is wanted.
|
|
95
|
+
*
|
|
96
|
+
* The `counter` prop still overrides what is drawn there. It takes a render
|
|
97
|
+
* prop handed `{ value, length }`, both read off the field, so it works for the
|
|
98
|
+
* uncontrolled case too — a field posting itself in a plain `<form>`, where the
|
|
99
|
+
* caller has no value to count.
|
|
100
|
+
*
|
|
56
101
|
* **`field` alone does not mean "controlled" — `field` *with* `onFieldChange`
|
|
57
102
|
* does.** The Vue original is a `defineModel`, and a `defineModel` only hands
|
|
58
103
|
* control to the parent when the parent actually listens; given a value and no
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { Textarea, type TextareaProps } from './Textarea.tsx';
|
|
2
2
|
/**
|
|
3
|
-
* What the `counter`
|
|
3
|
+
* What the `counter` render prop is handed when a caller overrides the counter
|
|
4
|
+
* `counterMax` would otherwise draw.
|
|
4
5
|
*
|
|
5
6
|
* Both numbers come from the field rather than from the caller, so a counter
|
|
6
7
|
* works the same whether the value is controlled or left to the textarea — an
|
|
@@ -9,7 +10,7 @@ export { Textarea, type TextareaProps } from './Textarea.tsx';
|
|
|
9
10
|
*
|
|
10
11
|
* There is no `cva` here on purpose. `Textarea` has no variants: the design
|
|
11
12
|
* draws one box, and its states come from `OxFieldGroup` through the
|
|
12
|
-
* `--controller-*` properties rather than from a class this component picks.
|
|
13
|
+
* `--ox-controller-*` properties rather than from a class this component picks.
|
|
13
14
|
* An empty variant map would be one more thing to keep in step across two
|
|
14
15
|
* packages in exchange for nothing.
|
|
15
16
|
*/
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
export interface SwitchProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'onChange' | 'children'> {
|
|
2
2
|
checked?: boolean;
|
|
3
|
+
/** `regular` is the board's default variant; `small` is for dense panels. */
|
|
3
4
|
size?: 'small' | 'regular';
|
|
4
5
|
disabled?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* A boolean rather than a node, because the board's `Icon` axis is a boolean
|
|
8
|
+
* and the glyphs are fixed: `icon-check` when on, `icon-x` when off. That is
|
|
9
|
+
* the control's own vocabulary — a checkbox's tick, not caller content.
|
|
10
|
+
*
|
|
11
|
+
* `children` survives as the escape hatch and wins when it is passed; it now
|
|
12
|
+
* lands inside the thumb, where the board's glyph is, rather than on the
|
|
13
|
+
* track, where it used to.
|
|
14
|
+
*/
|
|
15
|
+
icon?: boolean;
|
|
5
16
|
onCheckedChange?: (checked: boolean) => void;
|
|
6
17
|
children?: React.ReactNode;
|
|
7
18
|
}
|
|
@@ -6,6 +6,8 @@ export * from './InputOtp/index.ts';
|
|
|
6
6
|
export * from './Calendar/index.ts';
|
|
7
7
|
export * from './Combobox/index.ts';
|
|
8
8
|
export * from './ChatInput/index.ts';
|
|
9
|
+
export * from './ColorPicker/index.ts';
|
|
10
|
+
export * from './IconPicker/index.ts';
|
|
9
11
|
export * from './DatePicker/index.ts';
|
|
10
12
|
export * from './SearchBar/index.ts';
|
|
11
13
|
export * from './SearchPanel/index.ts';
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* the public vocabulary — a consumer can apply `input-{size}` to an ancestor
|
|
4
4
|
* and every descendant control that reads the custom properties follows.
|
|
5
5
|
*/
|
|
6
|
-
export type InputSize = 'sm' | 'md' | 'lg';
|
|
6
|
+
export type InputSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
7
7
|
export declare const inputSizeClass: Record<InputSize, string>;
|
|
@@ -26,8 +26,8 @@ export interface ScrollbarProps extends Omit<React.HTMLAttributes<HTMLDivElement
|
|
|
26
26
|
* **Placement is the parent's.** This positions itself absolutely inside the
|
|
27
27
|
* nearest positioned ancestor and reads four custom properties for where that
|
|
28
28
|
* is, all with fallbacks that spell "fill the containing block down its right
|
|
29
|
-
* edge": `--scrollbar-top` (`0px`), `--scrollbar-right` (`0px`),
|
|
30
|
-
* `--scrollbar-left` (`auto`) and `--scrollbar-height` (`100%`).
|
|
29
|
+
* edge": `--ox-scrollbar-top` (`0px`), `--ox-scrollbar-right` (`0px`),
|
|
30
|
+
* `--ox-scrollbar-left` (`auto`) and `--ox-scrollbar-height` (`100%`).
|
|
31
31
|
*
|
|
32
32
|
* A parent whose scrollport *is* the containing block sets none of them. One
|
|
33
33
|
* that has to compensate for something — a header inside the scrollport, an
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StepperOrientation } from './useStepper.ts';
|
|
2
|
+
export interface StepperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Which way the steps run. Horizontal is a row of pills for a wizard header;
|
|
5
|
+
* vertical is a rail with a connector for a side panel.
|
|
6
|
+
*/
|
|
7
|
+
orientation?: StepperOrientation;
|
|
8
|
+
/** Which step is active, one-based — the number printed in the step's own circle. */
|
|
9
|
+
current?: number;
|
|
10
|
+
defaultCurrent?: number;
|
|
11
|
+
onCurrentChange?: (current: number) => void;
|
|
12
|
+
/** Title above a vertical stepper. */
|
|
13
|
+
header?: React.ReactNode;
|
|
14
|
+
/** The line under the title — "Step 2 of 3", in your words. */
|
|
15
|
+
headerDescription?: React.ReactNode;
|
|
16
|
+
dataTestid: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Where you are in a linear flow of three to five steps. Port of
|
|
20
|
+
* `core/src/Navigation/Stepper/Stepper.vue`; Radix has no Stepper, so the
|
|
21
|
+
* behaviour is implemented here rather than matched to a primitive's DOM.
|
|
22
|
+
*/
|
|
23
|
+
export declare const Stepper: import('react').ForwardRefExoticComponent<StepperProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface StepperItemProps extends React.LiHTMLAttributes<HTMLLIElement> {
|
|
2
|
+
/** Its position in the flow, one-based, and the number printed in the circle. */
|
|
3
|
+
step: number;
|
|
4
|
+
/** Marks a step the user has to come back to, whatever the current step is. */
|
|
5
|
+
error?: boolean;
|
|
6
|
+
/** The line under the label, in a vertical stepper. */
|
|
7
|
+
description?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* One step, with its state read off its own number and the root's current one.
|
|
11
|
+
* Port of `core/src/Navigation/Stepper/StepperItem.vue`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const StepperItem: import('react').ForwardRefExoticComponent<StepperItemProps & import('react').RefAttributes<HTMLLIElement>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface StepperSubstepsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
2
|
+
/** How many sub-steps this step has */
|
|
3
|
+
count: number;
|
|
4
|
+
/** Which one is showing, one-based */
|
|
5
|
+
current?: number;
|
|
6
|
+
dataTestid: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The dots under a step that is itself several screens long — 3.1, 3.2, 3.3.
|
|
10
|
+
* Port of `core/src/Navigation/Stepper/StepperSubsteps.vue`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const StepperSubsteps: import('react').ForwardRefExoticComponent<StepperSubstepsProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Stepper, type StepperProps } from './Stepper.tsx';
|
|
2
|
+
export { StepperItem, type StepperItemProps } from './StepperItem.tsx';
|
|
3
|
+
export { StepperSubsteps, type StepperSubstepsProps, } from './StepperSubsteps.tsx';
|
|
4
|
+
export { isStepNavigable, stepperState, useStepper, type StepperContextValue, type StepperOrientation, type StepperState, } from './useStepper.ts';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type StepperOrientation = 'horizontal' | 'vertical';
|
|
2
|
+
export type StepperState = 'completed' | 'current' | 'upcoming' | 'error';
|
|
3
|
+
export interface StepperContextValue {
|
|
4
|
+
current: number;
|
|
5
|
+
/** The furthest step this flow has reached, which only ever rises. */
|
|
6
|
+
furthest: number;
|
|
7
|
+
orientation: StepperOrientation;
|
|
8
|
+
dataTestid: string;
|
|
9
|
+
goTo: (step: number) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const StepperContext: import('react').Context<StepperContextValue | null>;
|
|
12
|
+
export declare const useStepper: () => StepperContextValue;
|
|
13
|
+
/** Where a step stands relative to the current one; `error` is not a position. */
|
|
14
|
+
export declare const stepperState: (step: number, current: number, error?: boolean) => StepperState;
|
|
15
|
+
/**
|
|
16
|
+
* Where you have been you may go back to — and where you have been is not where
|
|
17
|
+
* you are. Walk to step 3 and back to step 1 and steps 2 and 3 read `upcoming`
|
|
18
|
+
* again while still being filled in, so this asks `furthest` rather than the
|
|
19
|
+
* state: a position remembers nothing.
|
|
20
|
+
*
|
|
21
|
+
* An errored step is reachable whatever the high-water mark says — it is the one
|
|
22
|
+
* you are being sent back to. The step you are standing on never is, errored or
|
|
23
|
+
* not, since there is nowhere to go.
|
|
24
|
+
*/
|
|
25
|
+
export declare const isStepNavigable: (step: number, current: number, furthest: number, error?: boolean) => boolean;
|