@toteat-eng/ds-react 2026.6.10-1 → 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.
@@ -0,0 +1,18 @@
1
+ export interface CloseButtonProps {
2
+ onClick?: () => void;
3
+ /** Accessible name for the dismiss button. */
4
+ label?: string;
5
+ /** Icon size in px (also drives the rendered close glyph size). */
6
+ size?: number;
7
+ /** Consumer class applied alongside the zero-specificity baseline, so the
8
+ * host component's exact look is preserved. */
9
+ className?: string;
10
+ "data-testid"?: string;
11
+ }
12
+ /**
13
+ * Internal dismiss-button primitive. NOT part of the public API — used to
14
+ * de-duplicate the bespoke close buttons across Dialog, Toast, UserNotification and
15
+ * OverlayMessage. Renders a single native `<button>` containing the canonical
16
+ * `close-outline` icon.
17
+ */
18
+ export declare function CloseButton({ onClick, label, size, className, "data-testid": testId, }: CloseButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export type { CloseButtonProps } from "./CloseButton";
2
+ export { CloseButton } from "./CloseButton";
@@ -15,6 +15,6 @@ export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBo
15
15
  static getDerivedStateFromError(error: Error): ErrorBoundaryState;
16
16
  componentDidCatch(error: Error, info: ErrorInfo): void;
17
17
  handleRetry: () => void;
18
- render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
18
+ render(): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
19
19
  }
20
20
  export {};
@@ -1,2 +1,2 @@
1
- export type { ExtrasDialogProps } from "./ExtrasDialog";
1
+ export type { ExtrasCategoryType, ExtrasDialogProps, SelectedExtraType } from "./ExtrasDialog";
2
2
  export { ExtrasDialog } from "./ExtrasDialog";
@@ -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;
@@ -1,2 +1,2 @@
1
- export type { ProductTileProps } from "./ProductTile";
1
+ export type { ProductTileProps, ProductTileType, StockStatusType } from "./ProductTile";
2
2
  export { ProductTile } from "./ProductTile";
@@ -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;
@@ -0,0 +1,2 @@
1
+ export type { TabItem, TabProps, TabSelectedColor, TabValue } from "./Tab";
2
+ export { Tab } from "./Tab";
@@ -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
- size?: TextInputSize;
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 { Banner } from "../Banner";
3
- declare const meta: Meta<typeof Banner>;
2
+ import { UserNotification } from "../UserNotification";
3
+ declare const meta: Meta<typeof UserNotification>;
4
4
  export default meta;
5
- type Story = StoryObj<typeof Banner>;
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 WithDismissAndAction: Story;
13
+ export declare const WithAndAction: Story;
15
14
  export declare const AllVariants: Story;
16
15
  export declare const BothThemes: Story;
@@ -0,0 +1,2 @@
1
+ export type { UserNotificationProps, UserNotificationVariant } from "./UserNotification";
2
+ export { UserNotification } from "./UserNotification";
@@ -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;
@@ -0,0 +1,19 @@
1
+ export interface UseScrollLockOptions {
2
+ /**
3
+ * Locking strategy.
4
+ * - `"fixed"` (default): pins `document.body` with `position: fixed` and
5
+ * restores the scroll position on release. This is Dialog's behavior —
6
+ * it prevents the page from jumping when the scrollbar disappears.
7
+ * - `"overflow"`: only sets `document.body.style.overflow = "hidden"`.
8
+ * This is Overlay's lighter behavior.
9
+ */
10
+ strategy?: "fixed" | "overflow";
11
+ }
12
+ /**
13
+ * Locks body scroll while `lock` is true and restores the previous state on
14
+ * cleanup (release / unmount). Internal hook — not part of the public API.
15
+ *
16
+ * Behavior is extracted verbatim from Dialog (`strategy: "fixed"`) and Overlay
17
+ * (`strategy: "overflow"`) so neither consumer changes visually or behaviorally.
18
+ */
19
+ export declare function useScrollLock(lock: boolean, options?: UseScrollLockOptions): void;
@@ -0,0 +1,7 @@
1
+ export type UseToggleReturn = [boolean, () => void, React.Dispatch<React.SetStateAction<boolean>>];
2
+ /**
3
+ * Minimal boolean toggle state. Returns `[state, toggle, setState]`.
4
+ * Internal hook — not part of the public API. Used to de-duplicate the
5
+ * open/close booleans in Accordion and SidebarNavSection.
6
+ */
7
+ export declare function useToggle(initial?: boolean): UseToggleReturn;
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";
@@ -46,6 +44,8 @@ export type { EmptyStateProps } from "./components/EmptyState";
46
44
  export { EmptyState } from "./components/EmptyState";
47
45
  export type { ErrorBoundaryProps } from "./components/ErrorBoundary";
48
46
  export { ErrorBoundary } from "./components/ErrorBoundary";
47
+ export type { ExtrasCategoryType, ExtrasDialogProps, SelectedExtraType, } from "./components/ExtrasDialog";
48
+ export { ExtrasDialog } from "./components/ExtrasDialog";
49
49
  export type { FormFieldProps } from "./components/FormField";
50
50
  export { FormField } from "./components/FormField";
51
51
  export type { GoogleSignInButtonProps } from "./components/GoogleSignInButton";
@@ -76,6 +76,8 @@ export type { PermissionGateProps } from "./components/PermissionGate";
76
76
  export { PermissionGate } from "./components/PermissionGate";
77
77
  export type { PinLockOverlayProps } from "./components/PinLockOverlay";
78
78
  export { PinLockOverlay } from "./components/PinLockOverlay";
79
+ export type { ProductTileProps, ProductTileType, StockStatusType } from "./components/ProductTile";
80
+ export { ProductTile } from "./components/ProductTile";
79
81
  export type { RadioProps } from "./components/Radio";
80
82
  export { Radio } from "./components/Radio";
81
83
  export type { SearchInputProps } from "./components/SearchInput";
@@ -98,13 +100,15 @@ export type { StatusBadgeProps } from "./components/StatusBadge";
98
100
  export { StatusBadge } from "./components/StatusBadge";
99
101
  export type { StepperProps } from "./components/Stepper";
100
102
  export { Stepper } from "./components/Stepper";
103
+ export type { TabItem as SegmentedTabItem, TabProps, TabSelectedColor, TabValue, } from "./components/Tab";
104
+ export { Tab } from "./components/Tab";
101
105
  export type { TabBarProps, TabBarVariant } from "./components/TabBar";
102
106
  export { TabBar } from "./components/TabBar";
103
107
  export type { TabItem, TabsProps } from "./components/Tabs";
104
108
  export { Tabs } from "./components/Tabs";
105
109
  export type { TextareaProps } from "./components/Textarea";
106
110
  export { Textarea } from "./components/Textarea";
107
- export type { TextInputProps } from "./components/TextInput";
111
+ export type { TextInputProps, TextInputSize, TextInputValidationState, } from "./components/TextInput";
108
112
  export { TextInput } from "./components/TextInput";
109
113
  export type { ThemeGateProps } from "./components/ThemeGate/ThemeGate";
110
114
  export { ThemeGate } from "./components/ThemeGate/ThemeGate";
@@ -119,6 +123,8 @@ export { TreeItem } from "./components/TreeItem";
119
123
  export type { TreeItemData } from "./components/TreeItem/treeTypes";
120
124
  export type { TreeListProps } from "./components/TreeList";
121
125
  export { TreeList } from "./components/TreeList";
126
+ export type { UserNotificationProps, UserNotificationVariant, } from "./components/UserNotification";
127
+ export { UserNotification } from "./components/UserNotification";
122
128
  export type { AdminPageHeaderProps } from "./layouts/AdminPageHeader";
123
129
  export { AdminPageHeader } from "./layouts/AdminPageHeader";
124
130
  export type { AppShellProps } from "./layouts/AppShell";