@toteat-eng/ds-react 2026.6.10 → 2026.6.18
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/Banner/Banner.d.ts +14 -0
- package/dist/components/Banner/__stories__/Banner.stories.d.ts +16 -0
- package/dist/components/Banner/index.d.ts +2 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +3 -5
- package/dist/components/Breadcrumb/__stories__/Breadcrumb.stories.d.ts +4 -7
- package/dist/components/CloseButton/CloseButton.d.ts +18 -0
- package/dist/components/CloseButton/index.d.ts +2 -0
- package/dist/components/ErrorBoundary/ErrorBoundary.d.ts +1 -1
- package/dist/components/ExtrasDialog/index.d.ts +1 -1
- package/dist/components/GroupedButtons/GroupedButtons.d.ts +2 -0
- package/dist/components/Icon/__stories__/Icon.stories.d.ts +35 -0
- package/dist/components/Icon/icons.d.ts +5 -5
- package/dist/components/PermissionGate/PermissionGate.d.ts +30 -0
- package/dist/components/PermissionGate/__stories__/PermissionGate.stories.d.ts +10 -0
- package/dist/components/PermissionGate/index.d.ts +2 -0
- package/dist/components/ProductTile/index.d.ts +1 -1
- package/dist/components/SearchInput/SearchInput.d.ts +27 -8
- package/dist/components/SearchInput/__stories__/SearchInput.stories.d.ts +4 -3
- package/dist/components/SearchInput/index.d.ts +1 -1
- package/dist/components/StatusBanner/StatusBanner.d.ts +18 -0
- package/dist/components/StatusBanner/__stories__/StatusBanner.stories.d.ts +23 -0
- package/dist/components/StatusBanner/index.d.ts +2 -0
- package/dist/components/Stepper/Stepper.d.ts +4 -5
- package/dist/components/Stepper/__stories__/Stepper.stories.d.ts +3 -3
- package/dist/components/Tab/Tab.d.ts +36 -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/NotificationBase.d.ts +41 -0
- package/dist/components/UserNotification/UserNotification.d.ts +15 -0
- package/dist/components/UserNotification/__stories__/UserNotification.stories.d.ts +15 -0
- package/dist/components/UserNotification/index.d.ts +2 -0
- package/dist/hooks/useDropdown.d.ts +59 -0
- package/dist/hooks/useScrollLock.d.ts +19 -0
- package/dist/hooks/useToggle.d.ts +7 -0
- package/dist/index.d.ts +18 -3
- package/dist/index.es.js +1911 -1413
- 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/dist/utils/csv.d.ts +18 -11
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { UserNotification } from "../UserNotification";
|
|
3
|
+
declare const meta: Meta<typeof UserNotification>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof UserNotification>;
|
|
6
|
+
export declare const Info: Story;
|
|
7
|
+
export declare const Success: Story;
|
|
8
|
+
export declare const Warning: Story;
|
|
9
|
+
export declare const Error: Story;
|
|
10
|
+
export declare const Neutral: Story;
|
|
11
|
+
export declare const WithIcon: Story;
|
|
12
|
+
export declare const WithAction: Story;
|
|
13
|
+
export declare const WithAndAction: Story;
|
|
14
|
+
export declare const AllVariants: Story;
|
|
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;
|
|
@@ -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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./tokens/base.css";
|
|
2
2
|
import "./tokens/animations.css";
|
|
3
3
|
import "./tokens/theme-angular.css";
|
|
4
|
-
import "./tokens/
|
|
4
|
+
import "./tokens/toteat-react-ds.css";
|
|
5
5
|
export { Accordion } from "./components/Accordion";
|
|
6
6
|
export type { AppleSignInButtonProps } from "./components/AppleSignInButton";
|
|
7
7
|
export { AppleSignInButton } from "./components/AppleSignInButton";
|
|
@@ -9,6 +9,8 @@ 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";
|
|
12
14
|
export type { BreadcrumbItem, BreadcrumbProps } from "./components/Breadcrumb";
|
|
13
15
|
export { Breadcrumb } from "./components/Breadcrumb";
|
|
14
16
|
export type { ButtonProps, ButtonSize, ButtonVariant, } from "./components/Button";
|
|
@@ -44,6 +46,8 @@ export type { EmptyStateProps } from "./components/EmptyState";
|
|
|
44
46
|
export { EmptyState } from "./components/EmptyState";
|
|
45
47
|
export type { ErrorBoundaryProps } from "./components/ErrorBoundary";
|
|
46
48
|
export { ErrorBoundary } from "./components/ErrorBoundary";
|
|
49
|
+
export type { ExtrasCategoryType, ExtrasDialogProps, SelectedExtraType, } from "./components/ExtrasDialog";
|
|
50
|
+
export { ExtrasDialog } from "./components/ExtrasDialog";
|
|
47
51
|
export type { FormFieldProps } from "./components/FormField";
|
|
48
52
|
export { FormField } from "./components/FormField";
|
|
49
53
|
export type { GoogleSignInButtonProps } from "./components/GoogleSignInButton";
|
|
@@ -70,11 +74,15 @@ export type { OverlayMessageProps, OverlayMessageStatus } from "./components/Ove
|
|
|
70
74
|
export { OverlayMessage } from "./components/OverlayMessage";
|
|
71
75
|
export type { PageLoadingOverlayProps } from "./components/PageLoadingOverlay";
|
|
72
76
|
export { PageLoadingOverlay } from "./components/PageLoadingOverlay";
|
|
77
|
+
export type { PermissionGateProps } from "./components/PermissionGate";
|
|
78
|
+
export { PermissionGate } from "./components/PermissionGate";
|
|
73
79
|
export type { PinLockOverlayProps } from "./components/PinLockOverlay";
|
|
74
80
|
export { PinLockOverlay } from "./components/PinLockOverlay";
|
|
81
|
+
export type { ProductTileProps, ProductTileType, StockStatusType } from "./components/ProductTile";
|
|
82
|
+
export { ProductTile } from "./components/ProductTile";
|
|
75
83
|
export type { RadioProps } from "./components/Radio";
|
|
76
84
|
export { Radio } from "./components/Radio";
|
|
77
|
-
export type { SearchInputProps } from "./components/SearchInput";
|
|
85
|
+
export type { SearchInputProps, SearchInputSize } from "./components/SearchInput";
|
|
78
86
|
export { SearchInput } from "./components/SearchInput";
|
|
79
87
|
export type { SectionHeaderProps } from "./components/SectionHeader";
|
|
80
88
|
export { SectionHeader } from "./components/SectionHeader";
|
|
@@ -92,15 +100,19 @@ export type { SpinnerProps, SpinnerSize } from "./components/Spinner";
|
|
|
92
100
|
export { Spinner } from "./components/Spinner";
|
|
93
101
|
export type { StatusBadgeProps } from "./components/StatusBadge";
|
|
94
102
|
export { StatusBadge } from "./components/StatusBadge";
|
|
103
|
+
export type { StatusBannerProps, StatusBannerVariant } from "./components/StatusBanner";
|
|
104
|
+
export { StatusBanner } from "./components/StatusBanner";
|
|
95
105
|
export type { StepperProps } from "./components/Stepper";
|
|
96
106
|
export { Stepper } from "./components/Stepper";
|
|
107
|
+
export type { TabItem as SegmentedTabItem, TabProps, TabSelectedColor, TabValue, } from "./components/Tab";
|
|
108
|
+
export { Tab } from "./components/Tab";
|
|
97
109
|
export type { TabBarProps, TabBarVariant } from "./components/TabBar";
|
|
98
110
|
export { TabBar } from "./components/TabBar";
|
|
99
111
|
export type { TabItem, TabsProps } from "./components/Tabs";
|
|
100
112
|
export { Tabs } from "./components/Tabs";
|
|
101
113
|
export type { TextareaProps } from "./components/Textarea";
|
|
102
114
|
export { Textarea } from "./components/Textarea";
|
|
103
|
-
export type { TextInputProps } from "./components/TextInput";
|
|
115
|
+
export type { TextInputProps, TextInputSize, TextInputValidationState, } from "./components/TextInput";
|
|
104
116
|
export { TextInput } from "./components/TextInput";
|
|
105
117
|
export type { ThemeGateProps } from "./components/ThemeGate/ThemeGate";
|
|
106
118
|
export { ThemeGate } from "./components/ThemeGate/ThemeGate";
|
|
@@ -115,6 +127,8 @@ export { TreeItem } from "./components/TreeItem";
|
|
|
115
127
|
export type { TreeItemData } from "./components/TreeItem/treeTypes";
|
|
116
128
|
export type { TreeListProps } from "./components/TreeList";
|
|
117
129
|
export { TreeList } from "./components/TreeList";
|
|
130
|
+
export type { UserNotificationProps, UserNotificationVariant, } from "./components/UserNotification";
|
|
131
|
+
export { UserNotification } from "./components/UserNotification";
|
|
118
132
|
export type { AdminPageHeaderProps } from "./layouts/AdminPageHeader";
|
|
119
133
|
export { AdminPageHeader } from "./layouts/AdminPageHeader";
|
|
120
134
|
export type { AppShellProps } from "./layouts/AppShell";
|
|
@@ -132,6 +146,7 @@ export { PageLayout } from "./layouts/PageLayout";
|
|
|
132
146
|
export type { StackAlign, StackDirection, StackGap, StackJustify, StackProps, } from "./layouts/Stack";
|
|
133
147
|
export { Stack } from "./layouts/Stack";
|
|
134
148
|
export { cn } from "./utils/cn";
|
|
149
|
+
export type { CsvCell } from "./utils/csv";
|
|
135
150
|
export { escapeCell, rowsToCsv } from "./utils/csv";
|
|
136
151
|
export { useFocusTrap } from "./utils/focusTrap";
|
|
137
152
|
export { portal } from "./utils/portal";
|