@toteat-eng/ds-react 2026.6.10-2 → 2026.6.10-3
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/components/CloseButton/CloseButton.d.ts +1 -1
- package/dist/components/Icon/__stories__/Icon.stories.d.ts +35 -0
- package/dist/components/Tab/Tab.d.ts +34 -0
- package/dist/components/Tab/__stories__/Tab.stories.d.ts +13 -0
- package/dist/components/Tab/index.d.ts +2 -0
- package/dist/components/TextInput/TextInput.d.ts +48 -2
- package/dist/components/TextInput/__stories__/TextInput.stories.d.ts +11 -0
- package/dist/components/TextInput/index.d.ts +1 -1
- package/dist/components/UserNotification/UserNotification.d.ts +15 -0
- package/dist/components/{Banner/__stories__/Banner.stories.d.ts → UserNotification/__stories__/UserNotification.stories.d.ts} +4 -5
- package/dist/components/UserNotification/index.d.ts +2 -0
- package/dist/hooks/useDropdown.d.ts +59 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.es.js +1533 -1325
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +10 -10
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/components/Banner/Banner.d.ts +0 -14
- package/dist/components/Banner/index.d.ts +0 -2
|
@@ -11,7 +11,7 @@ export interface CloseButtonProps {
|
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Internal dismiss-button primitive. NOT part of the public API — used to
|
|
14
|
-
* de-duplicate the bespoke close buttons across Dialog, Toast,
|
|
14
|
+
* de-duplicate the bespoke close buttons across Dialog, Toast, UserNotification and
|
|
15
15
|
* OverlayMessage. Renders a single native `<button>` containing the canonical
|
|
16
16
|
* `close-outline` icon.
|
|
17
17
|
*/
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { Icon } from "../Icon";
|
|
3
|
+
declare const meta: Meta<typeof Icon>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Icon>;
|
|
6
|
+
export declare const Primary: Story;
|
|
7
|
+
/**
|
|
8
|
+
* Gallery of every icon in the sprite. Use the search box / Ctrl+F to find one,
|
|
9
|
+
* then copy its name into the `name` prop. Names map 1:1 to the `IconNameType` union.
|
|
10
|
+
*/
|
|
11
|
+
export declare const AllIcons: Story;
|
|
12
|
+
/** The `size` prop accepts a number (px) or any CSS length string. */
|
|
13
|
+
export declare const Sizes: Story;
|
|
14
|
+
/**
|
|
15
|
+
* Color is driven by `currentColor` by default — set `color` on a parent and the
|
|
16
|
+
* icon follows. The `color` prop maps a token suffix to `var(--color-<token>)`
|
|
17
|
+
* and only applies to `-outline` / `-filled` icons.
|
|
18
|
+
*/
|
|
19
|
+
export declare const Colors: Story;
|
|
20
|
+
/**
|
|
21
|
+
* `currentColor` inheritance: no `color` prop is set on the icons below — they
|
|
22
|
+
* each inherit the text color of their wrapper, which is the recommended way to
|
|
23
|
+
* keep icons in sync with surrounding text.
|
|
24
|
+
*/
|
|
25
|
+
export declare const CurrentColorInheritance: Story;
|
|
26
|
+
/**
|
|
27
|
+
* Accessibility:
|
|
28
|
+
* - **Decorative (default):** with no `aria-label`, the icon is `aria-hidden="true"`
|
|
29
|
+
* and removed from the accessibility tree. Use this when the icon merely
|
|
30
|
+
* decorates adjacent text (e.g. a labelled button).
|
|
31
|
+
* - **Meaningful:** pass `aria-label` to expose the icon as `role="img"` with an
|
|
32
|
+
* accessible name. Use this when the icon is the only conveyor of meaning
|
|
33
|
+
* (e.g. an icon-only button).
|
|
34
|
+
*/
|
|
35
|
+
export declare const Accessibility: Story;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { GroupedButtonSize } from "../GroupedButtons";
|
|
2
|
+
import type { IconName } from "../Icon";
|
|
3
|
+
export type TabValue = string | number;
|
|
4
|
+
export type TabSelectedColor = "primary" | "secondary" | "tertiary" | "neutral-100";
|
|
5
|
+
export interface TabItem {
|
|
6
|
+
value: TabValue;
|
|
7
|
+
label: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
icon?: IconName;
|
|
10
|
+
}
|
|
11
|
+
export interface TabProps {
|
|
12
|
+
/** Tabs to render as a segmented control. */
|
|
13
|
+
tabs: TabItem[];
|
|
14
|
+
/** Accessible label for the tablist / button group. */
|
|
15
|
+
label: string;
|
|
16
|
+
/** Controlled selected value. When provided the caller owns selection. */
|
|
17
|
+
selectedTab?: TabValue;
|
|
18
|
+
/** Size of the control. Defaults to "medium". */
|
|
19
|
+
size?: GroupedButtonSize;
|
|
20
|
+
/** Stretch the control to fill its container. Defaults to true (Vue3 parity). */
|
|
21
|
+
fullWidth?: boolean;
|
|
22
|
+
/** Color applied to the selected pill. Defaults to "secondary". */
|
|
23
|
+
selectedColor?: TabSelectedColor;
|
|
24
|
+
/** Fired whenever a (non-disabled) tab is selected. */
|
|
25
|
+
onChange?: (value: TabValue) => void;
|
|
26
|
+
/** Fired on tab click with the full tab descriptor. */
|
|
27
|
+
onTabClick?: (tab: {
|
|
28
|
+
value: TabValue;
|
|
29
|
+
label: string;
|
|
30
|
+
}) => void;
|
|
31
|
+
className?: string;
|
|
32
|
+
"data-testid"?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare function Tab({ tabs, label, selectedTab, size, fullWidth, selectedColor, onChange, onTabClick, className, "data-testid": testId, }: TabProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { Tab } from "../Tab";
|
|
3
|
+
declare const meta: Meta<typeof Tab>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Tab>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const ControlledExample: Story;
|
|
8
|
+
export declare const Sizes: Story;
|
|
9
|
+
export declare const FitContent: Story;
|
|
10
|
+
export declare const WithIcons: Story;
|
|
11
|
+
export declare const DisabledTab: Story;
|
|
12
|
+
export declare const SelectedColors: Story;
|
|
13
|
+
export declare const BothThemes: Story;
|
|
@@ -1,9 +1,55 @@
|
|
|
1
|
-
import { type InputHTMLAttributes } from "react";
|
|
1
|
+
import { type InputHTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import type { IconNameType } from "../Icon/icons";
|
|
2
3
|
export type TextInputSize = "small" | "medium" | "large";
|
|
4
|
+
/**
|
|
5
|
+
* Validation state, mirroring the Vue3 DS `TextInput`. `default` is the resting
|
|
6
|
+
* state; `success` / `warning` / `error` drive the field border, optional status
|
|
7
|
+
* icon, and (for `error`) `aria-invalid`. The legacy `error` boolean prop is kept
|
|
8
|
+
* for backward compatibility and is treated as `validationState="error"`.
|
|
9
|
+
*/
|
|
10
|
+
export type TextInputValidationState = "default" | "success" | "warning" | "error";
|
|
3
11
|
export interface TextInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
12
|
+
/** Control height / typography scale. */
|
|
13
|
+
size?: TextInputSize;
|
|
14
|
+
/**
|
|
15
|
+
* Legacy shorthand for an error look. Equivalent to `validationState="error"`.
|
|
16
|
+
* Kept for backward compatibility — existing consumers pass `error`.
|
|
17
|
+
*/
|
|
4
18
|
error?: boolean;
|
|
19
|
+
/** Renders an eye toggle for `type="password"` fields. */
|
|
5
20
|
showPasswordToggle?: boolean;
|
|
6
|
-
|
|
21
|
+
/** Visible `<label>` associated with the input. */
|
|
22
|
+
label?: ReactNode;
|
|
23
|
+
/** Shows a red `*` after the label and sets `aria-required`. */
|
|
24
|
+
required?: boolean;
|
|
25
|
+
/** Validation state. Takes precedence over the legacy `error` boolean. */
|
|
26
|
+
validationState?: TextInputValidationState;
|
|
27
|
+
/** Error message; shown only when the resolved state is `error`. Wires `aria-describedby`. */
|
|
28
|
+
errorMessage?: ReactNode;
|
|
29
|
+
/** Helper / hint text shown below the field. Wires `aria-describedby`. */
|
|
30
|
+
helperText?: ReactNode;
|
|
31
|
+
/** Alignment of the helper text relative to the character counter. */
|
|
32
|
+
helperTextAlign?: "left" | "right";
|
|
33
|
+
/** Icon rendered before the input. */
|
|
34
|
+
prefixIcon?: IconNameType;
|
|
35
|
+
/** Icon rendered after the input (suppressed when clear / password / status icon shows). */
|
|
36
|
+
suffixIcon?: IconNameType;
|
|
37
|
+
/** Shows a clear (×) button when the field has a value. Requires `value` + `onChange`. */
|
|
38
|
+
clearable?: boolean;
|
|
39
|
+
/** Callback fired when the clear button is pressed (after clearing the value). */
|
|
40
|
+
onClear?: () => void;
|
|
41
|
+
/** Accessible label for the clear button. @default "Limpiar" */
|
|
42
|
+
clearLabel?: string;
|
|
43
|
+
/** Accessible label for the password-reveal button while the password is hidden. @default "Mostrar contraseña" */
|
|
44
|
+
showPasswordLabel?: string;
|
|
45
|
+
/** Accessible label for the password-reveal button while the password is shown. @default "Ocultar contraseña" */
|
|
46
|
+
hidePasswordLabel?: string;
|
|
47
|
+
/** Shows a character counter. Implicitly enabled when `maxLength` is set. */
|
|
48
|
+
showCounter?: boolean;
|
|
49
|
+
/** Renders the status icon (success / warning / error) inside the field. Defaults to `true`. */
|
|
50
|
+
showValidationIcon?: boolean;
|
|
51
|
+
/** Makes the field span the full width of its container. */
|
|
52
|
+
fullWidth?: boolean;
|
|
7
53
|
"data-testid"?: string;
|
|
8
54
|
}
|
|
9
55
|
export declare const TextInput: import("react").ForwardRefExoticComponent<TextInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -11,4 +11,15 @@ export declare const EmailInput: Story;
|
|
|
11
11
|
export declare const PasswordInput: Story;
|
|
12
12
|
export declare const PasswordWithToggle: Story;
|
|
13
13
|
export declare const SearchInput: Story;
|
|
14
|
+
export declare const WithLabel: Story;
|
|
15
|
+
export declare const Required: Story;
|
|
16
|
+
export declare const WithHelperText: Story;
|
|
17
|
+
export declare const WithErrorMessage: Story;
|
|
18
|
+
export declare const ValidationStates: Story;
|
|
19
|
+
export declare const WithPrefixIcon: Story;
|
|
20
|
+
export declare const WithSuffixIcon: Story;
|
|
21
|
+
export declare const Clearable: Story;
|
|
22
|
+
export declare const WithCounter: Story;
|
|
23
|
+
export declare const Sizes: Story;
|
|
24
|
+
export declare const FullWidth: Story;
|
|
14
25
|
export declare const States: Story;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { TextInputProps } from "./TextInput";
|
|
1
|
+
export type { TextInputProps, TextInputSize, TextInputValidationState } from "./TextInput";
|
|
2
2
|
export { TextInput } from "./TextInput";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { IconNameType } from "../Icon";
|
|
3
|
+
export type UserNotificationVariant = "info" | "success" | "warning" | "error" | "neutral";
|
|
4
|
+
export interface UserNotificationProps {
|
|
5
|
+
variant?: UserNotificationVariant;
|
|
6
|
+
icon?: IconNameType;
|
|
7
|
+
/** Required — a user notification is always dismissable. */
|
|
8
|
+
onDismiss: () => void;
|
|
9
|
+
dismissLabel?: string;
|
|
10
|
+
action?: React.ReactNode;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
"data-testid"?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function UserNotification({ variant, icon, onDismiss, dismissLabel, action, children, className, "data-testid": testId, }: UserNotificationProps): React.ReactElement;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import {
|
|
3
|
-
declare const meta: Meta<typeof
|
|
2
|
+
import { UserNotification } from "../UserNotification";
|
|
3
|
+
declare const meta: Meta<typeof UserNotification>;
|
|
4
4
|
export default meta;
|
|
5
|
-
type Story = StoryObj<typeof
|
|
5
|
+
type Story = StoryObj<typeof UserNotification>;
|
|
6
6
|
export declare const Info: Story;
|
|
7
7
|
export declare const Success: Story;
|
|
8
8
|
export declare const Warning: Story;
|
|
9
9
|
export declare const Error: Story;
|
|
10
10
|
export declare const Neutral: Story;
|
|
11
11
|
export declare const WithIcon: Story;
|
|
12
|
-
export declare const WithDismiss: Story;
|
|
13
12
|
export declare const WithAction: Story;
|
|
14
|
-
export declare const
|
|
13
|
+
export declare const WithAndAction: Story;
|
|
15
14
|
export declare const AllVariants: Story;
|
|
16
15
|
export declare const BothThemes: Story;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export interface UseDropdownOptions {
|
|
2
|
+
/** Number of navigable items. Used to clamp the active index for roving keyboard nav. */
|
|
3
|
+
itemCount?: number;
|
|
4
|
+
/** Called when an item is chosen via keyboard (Enter/Space) at the active index. */
|
|
5
|
+
onSelectIndex?: (index: number) => void;
|
|
6
|
+
/** Fired after the dropdown opens. */
|
|
7
|
+
onOpen?: () => void;
|
|
8
|
+
/** Fired after the dropdown closes (any cause: toggle, Escape, outside-click, select). */
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
/** When true, toggle/open are no-ops. */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* When false, the document `mousedown` outside-click handler is disabled.
|
|
14
|
+
* Defaults to true. (Some legacy components historically used `click` instead of
|
|
15
|
+
* `mousedown`; this option lets a component skip the shared handler if it must.)
|
|
16
|
+
*/
|
|
17
|
+
closeOnOutsideClick?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface UseDropdownReturn {
|
|
20
|
+
/** Whether the dropdown is currently open. */
|
|
21
|
+
isOpen: boolean;
|
|
22
|
+
/** Attach to the dropdown root: scopes outside-click detection. */
|
|
23
|
+
containerRef: React.RefObject<HTMLDivElement | null>;
|
|
24
|
+
/** Attach to the trigger: focus is returned here on Escape / close. */
|
|
25
|
+
triggerRef: React.RefObject<HTMLButtonElement | null>;
|
|
26
|
+
/** Index of the keyboard-active item (-1 when none). */
|
|
27
|
+
activeIndex: number;
|
|
28
|
+
/** Imperatively set the keyboard-active item index. */
|
|
29
|
+
setActiveIndex: (index: number) => void;
|
|
30
|
+
/** Open the dropdown (no-op when disabled). Resets active index to -1. */
|
|
31
|
+
open: () => void;
|
|
32
|
+
/** Close the dropdown. Resets active index to -1. Does NOT move focus. */
|
|
33
|
+
close: () => void;
|
|
34
|
+
/** Close the dropdown AND return focus to the trigger. */
|
|
35
|
+
closeAndFocusTrigger: () => void;
|
|
36
|
+
/** Toggle open/closed (no-op when disabled). */
|
|
37
|
+
toggle: () => void;
|
|
38
|
+
/**
|
|
39
|
+
* Roving keyboard handler modeled on DropdownButton's interaction:
|
|
40
|
+
* - closed: Enter/Space/ArrowDown open and focus the first item
|
|
41
|
+
* - open: ArrowDown/ArrowUp move the active index (clamped), Home/End jump to ends,
|
|
42
|
+
* Enter/Space select the active item, Escape closes + returns focus, Tab closes.
|
|
43
|
+
* Components that own a different keyboard model can ignore this and use the
|
|
44
|
+
* primitives (open/close/activeIndex) directly.
|
|
45
|
+
*/
|
|
46
|
+
handleTriggerKeyDown: (e: React.KeyboardEvent) => void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Shared, headless dropdown interaction core. Internal — NOT part of the public API.
|
|
50
|
+
*
|
|
51
|
+
* Models the canonical Toteat dropdown UX used by `DropdownButton` (TRM login's
|
|
52
|
+
* `LanguageSelector`): open/close/toggle, document outside-click-to-close, Escape-to-close,
|
|
53
|
+
* roving Arrow/Home/End keyboard navigation with an active index, Enter/Space to select,
|
|
54
|
+
* and focus-return-to-trigger on close.
|
|
55
|
+
*
|
|
56
|
+
* Markup, ARIA, and selection semantics stay in the consuming component; this hook owns
|
|
57
|
+
* only the behaviour that every dropdown shares.
|
|
58
|
+
*/
|
|
59
|
+
export declare function useDropdown(options?: UseDropdownOptions): UseDropdownReturn;
|
package/dist/index.d.ts
CHANGED
|
@@ -9,8 +9,6 @@ export type { BackgroundWrapperProps } from "./components/BackgroundWrapper";
|
|
|
9
9
|
export { BackgroundWrapper } from "./components/BackgroundWrapper";
|
|
10
10
|
export type { BadgeProps, BadgeSize, BadgeVariant } from "./components/Badge";
|
|
11
11
|
export { Badge } from "./components/Badge";
|
|
12
|
-
export type { BannerProps, BannerVariant } from "./components/Banner";
|
|
13
|
-
export { Banner } from "./components/Banner";
|
|
14
12
|
export type { BreadcrumbItem, BreadcrumbProps } from "./components/Breadcrumb";
|
|
15
13
|
export { Breadcrumb } from "./components/Breadcrumb";
|
|
16
14
|
export type { ButtonProps, ButtonSize, ButtonVariant, } from "./components/Button";
|
|
@@ -102,13 +100,15 @@ export type { StatusBadgeProps } from "./components/StatusBadge";
|
|
|
102
100
|
export { StatusBadge } from "./components/StatusBadge";
|
|
103
101
|
export type { StepperProps } from "./components/Stepper";
|
|
104
102
|
export { Stepper } from "./components/Stepper";
|
|
103
|
+
export type { TabItem as SegmentedTabItem, TabProps, TabSelectedColor, TabValue, } from "./components/Tab";
|
|
104
|
+
export { Tab } from "./components/Tab";
|
|
105
105
|
export type { TabBarProps, TabBarVariant } from "./components/TabBar";
|
|
106
106
|
export { TabBar } from "./components/TabBar";
|
|
107
107
|
export type { TabItem, TabsProps } from "./components/Tabs";
|
|
108
108
|
export { Tabs } from "./components/Tabs";
|
|
109
109
|
export type { TextareaProps } from "./components/Textarea";
|
|
110
110
|
export { Textarea } from "./components/Textarea";
|
|
111
|
-
export type { TextInputProps } from "./components/TextInput";
|
|
111
|
+
export type { TextInputProps, TextInputSize, TextInputValidationState, } from "./components/TextInput";
|
|
112
112
|
export { TextInput } from "./components/TextInput";
|
|
113
113
|
export type { ThemeGateProps } from "./components/ThemeGate/ThemeGate";
|
|
114
114
|
export { ThemeGate } from "./components/ThemeGate/ThemeGate";
|
|
@@ -123,6 +123,8 @@ export { TreeItem } from "./components/TreeItem";
|
|
|
123
123
|
export type { TreeItemData } from "./components/TreeItem/treeTypes";
|
|
124
124
|
export type { TreeListProps } from "./components/TreeList";
|
|
125
125
|
export { TreeList } from "./components/TreeList";
|
|
126
|
+
export type { UserNotificationProps, UserNotificationVariant, } from "./components/UserNotification";
|
|
127
|
+
export { UserNotification } from "./components/UserNotification";
|
|
126
128
|
export type { AdminPageHeaderProps } from "./layouts/AdminPageHeader";
|
|
127
129
|
export { AdminPageHeader } from "./layouts/AdminPageHeader";
|
|
128
130
|
export type { AppShellProps } from "./layouts/AppShell";
|