@stratakit/structures 0.3.2 → 0.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/CHANGELOG.md +128 -0
- package/dist/AccordionItem.js +10 -10
- package/dist/Banner.js +8 -8
- package/dist/Chip.js +4 -4
- package/dist/DEV/AccordionItem.js +10 -10
- package/dist/DEV/Banner.js +8 -8
- package/dist/DEV/Chip.js +4 -4
- package/dist/DEV/Dialog.js +179 -0
- package/dist/DEV/DropdownMenu.js +10 -10
- package/dist/DEV/ErrorRegion.js +12 -12
- package/dist/DEV/NavigationRail.js +213 -0
- package/dist/DEV/Table.js +7 -7
- package/dist/DEV/Tabs.js +7 -7
- package/dist/DEV/Toolbar.js +41 -18
- package/dist/DEV/Tree.js +1 -1
- package/dist/DEV/TreeItem.js +14 -14
- package/dist/DEV/index.js +4 -0
- package/dist/DEV/styles.css.js +1 -1
- package/dist/DEV/~utils.ListItem.js +3 -3
- package/dist/DEV/~utils.icons.js +1 -1
- package/dist/Dialog.d.ts +153 -0
- package/dist/Dialog.js +170 -0
- package/dist/DropdownMenu.d.ts +8 -8
- package/dist/DropdownMenu.js +9 -9
- package/dist/ErrorRegion.js +12 -12
- package/dist/NavigationRail.d.ts +203 -0
- package/dist/NavigationRail.js +201 -0
- package/dist/Table.js +7 -7
- package/dist/Tabs.d.ts +9 -9
- package/dist/Tabs.js +6 -6
- package/dist/Toolbar.d.ts +21 -3
- package/dist/Toolbar.js +41 -18
- package/dist/Tree.js +1 -1
- package/dist/TreeItem.js +14 -14
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/styles.css.js +1 -1
- package/dist/~utils.ListItem.js +3 -3
- package/dist/~utils.icons.js +1 -1
- package/package.json +23 -11
package/dist/ErrorRegion.js
CHANGED
|
@@ -40,7 +40,7 @@ const ErrorRegionRoot = forwardRef(
|
|
|
40
40
|
const pulse = () => {
|
|
41
41
|
const el = containerRef.current;
|
|
42
42
|
if (!el) return;
|
|
43
|
-
const id = "--\u{1F95D}
|
|
43
|
+
const id = "--\u{1F95D}ErrorRegion-pulse";
|
|
44
44
|
const animations = el.getAnimations({ subtree: true });
|
|
45
45
|
if (animations.find((animation) => animation.id === id)) return;
|
|
46
46
|
el.animate(
|
|
@@ -87,24 +87,24 @@ const ErrorRegionRoot = forwardRef(
|
|
|
87
87
|
{
|
|
88
88
|
...rest,
|
|
89
89
|
"aria-labelledby": sectionLabelledBy,
|
|
90
|
-
className: cx("\u{1F95D}
|
|
91
|
-
"data-
|
|
92
|
-
"data-
|
|
90
|
+
className: cx("\u{1F95D}ErrorRegion", props.className),
|
|
91
|
+
"data-_sk-visible": !!label,
|
|
92
|
+
"data-_sk-expanded": open,
|
|
93
93
|
ref: forwardedRef,
|
|
94
|
-
children: /* @__PURE__ */ jsxs("div", { className: "\u{1F95D}
|
|
94
|
+
children: /* @__PURE__ */ jsxs("div", { className: "\u{1F95D}ErrorRegionContainer", ref: containerRef, children: [
|
|
95
95
|
/* @__PURE__ */ jsxs(
|
|
96
96
|
DialogDisclosure,
|
|
97
97
|
{
|
|
98
|
-
className: "\u{1F95D}
|
|
98
|
+
className: "\u{1F95D}ErrorRegionHeader",
|
|
99
99
|
render: /* @__PURE__ */ jsx(Button, { variant: "ghost" }),
|
|
100
100
|
children: [
|
|
101
|
-
/* @__PURE__ */ jsx(StatusIcon, { tone: "attention", className: "\u{1F95D}
|
|
101
|
+
/* @__PURE__ */ jsx(StatusIcon, { tone: "attention", className: "\u{1F95D}ErrorRegionIcon" }),
|
|
102
102
|
/* @__PURE__ */ jsx(
|
|
103
103
|
Text,
|
|
104
104
|
{
|
|
105
105
|
render: /* @__PURE__ */ jsx("span", {}),
|
|
106
106
|
id: labelId,
|
|
107
|
-
className: "\u{1F95D}
|
|
107
|
+
className: "\u{1F95D}ErrorRegionLabel",
|
|
108
108
|
variant: "body-sm",
|
|
109
109
|
children: label
|
|
110
110
|
}
|
|
@@ -116,7 +116,7 @@ const ErrorRegionRoot = forwardRef(
|
|
|
116
116
|
/* @__PURE__ */ jsx(
|
|
117
117
|
Dialog,
|
|
118
118
|
{
|
|
119
|
-
className: "\u{1F95D}
|
|
119
|
+
className: "\u{1F95D}ErrorRegionDialog",
|
|
120
120
|
portal: false,
|
|
121
121
|
modal: false,
|
|
122
122
|
autoFocusOnShow: false,
|
|
@@ -125,7 +125,7 @@ const ErrorRegionRoot = forwardRef(
|
|
|
125
125
|
Collection,
|
|
126
126
|
{
|
|
127
127
|
store,
|
|
128
|
-
className: "\u{1F95D}
|
|
128
|
+
className: "\u{1F95D}ErrorRegionItems",
|
|
129
129
|
role: "list",
|
|
130
130
|
children: items
|
|
131
131
|
}
|
|
@@ -152,11 +152,11 @@ const ErrorRegionItem = forwardRef(
|
|
|
152
152
|
{
|
|
153
153
|
...rest,
|
|
154
154
|
role: "listitem",
|
|
155
|
-
className: cx("\u{1F95D}
|
|
155
|
+
className: cx("\u{1F95D}ErrorRegionItem", props.className),
|
|
156
156
|
ref: forwardedRef,
|
|
157
157
|
children: [
|
|
158
158
|
/* @__PURE__ */ jsx(Text, { id: messageId, variant: "body-sm", children: message }),
|
|
159
|
-
/* @__PURE__ */ jsx("div", { className: "\u{1F95D}
|
|
159
|
+
/* @__PURE__ */ jsx("div", { className: "\u{1F95D}ErrorRegionItemActions", children: actions })
|
|
160
160
|
]
|
|
161
161
|
}
|
|
162
162
|
);
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { BaseProps, FocusableProps } from "@stratakit/foundations/secret-internals";
|
|
3
|
+
interface NavigationRailProps extends BaseProps<"nav"> {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The `NavigationRail` presents top-level navigation items in a vertical orientation.
|
|
7
|
+
*
|
|
8
|
+
* Example:
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <NavigationRail.Root>
|
|
11
|
+
* <NavigationRail.Header>
|
|
12
|
+
* <IconButton label="Home" icon={applicationIcon} href="/" />
|
|
13
|
+
* <NavigationRail.ToggleButton />
|
|
14
|
+
* </NavigationRail.Header>
|
|
15
|
+
*
|
|
16
|
+
* <NavigationRail.Content>
|
|
17
|
+
* <NavigationRail.List>
|
|
18
|
+
* <NavigationRail.ListItem>
|
|
19
|
+
* <NavigationRail.Anchor label="Dashboard" icon={dashboardIcon} href="/dashboard" />
|
|
20
|
+
* </NavigationRail.ListItem>
|
|
21
|
+
* <NavigationRail.ListItem>
|
|
22
|
+
* <NavigationRail.Anchor label="Projects" icon={projectsIcon} href="/projects" />
|
|
23
|
+
* </NavigationRail.ListItem>
|
|
24
|
+
* <NavigationRail.ListItem>
|
|
25
|
+
* <NavigationRail.Anchor label="Reports" icon={reportsIcon} href="/reports" />
|
|
26
|
+
* </NavigationRail.ListItem>
|
|
27
|
+
* </NavigationRail.List>
|
|
28
|
+
*
|
|
29
|
+
* <NavigationRail.Footer>
|
|
30
|
+
* <NavigationRail.List>
|
|
31
|
+
* <NavigationRail.ListItem>
|
|
32
|
+
* <NavigationRail.Button label="Help" icon={helpIcon} onClick={…} />
|
|
33
|
+
* </NavigationRail.ListItem>
|
|
34
|
+
* <NavigationRail.ListItem>
|
|
35
|
+
* <NavigationRail.Button label="Settings" icon={settingsIcon} onClick={…} />
|
|
36
|
+
* </NavigationRail.ListItem>
|
|
37
|
+
* <NavigationRail.ListItem>
|
|
38
|
+
* <NavigationRail.Button label="Profile" icon={userIcon} onClick={…} />
|
|
39
|
+
* </NavigationRail.ListItem>
|
|
40
|
+
* </NavigationRail.List>
|
|
41
|
+
* </NavigationRail.Footer>
|
|
42
|
+
* </NavigationRail.Content>
|
|
43
|
+
* </NavigationRail.Root>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
declare const NavigationRailRoot: React.ForwardRefExoticComponent<NavigationRailProps & React.RefAttributes<HTMLElement>>;
|
|
47
|
+
interface NavigationRailHeaderProps extends BaseProps<"header"> {
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* `NavigationRail.Header` represents the header (i.e. top) section of the `NavigationRail` and is
|
|
51
|
+
* visually aligned with the page header next to it.
|
|
52
|
+
*
|
|
53
|
+
* Can contain a logo and a `NavigationRail.ToggleButton` to collapse/expand the `NavigationRail`.
|
|
54
|
+
*
|
|
55
|
+
* **Note**: This component is expected to hug the top edge of the page.
|
|
56
|
+
*/
|
|
57
|
+
declare const NavigationRailHeader: React.ForwardRefExoticComponent<NavigationRailHeaderProps & React.RefAttributes<HTMLElement>>;
|
|
58
|
+
interface NavigationRailToggleButtonProps extends Omit<FocusableProps<"button">, "children"> {
|
|
59
|
+
/**
|
|
60
|
+
* Customize the accessible label of the toggle button.
|
|
61
|
+
*
|
|
62
|
+
* @default "Expand navigation".
|
|
63
|
+
*/
|
|
64
|
+
label?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* `NavigationRail.ToggleButton` toggles the collapsed state of the `NavigationRail`.
|
|
68
|
+
* It is typically placed inside `NavigationRail.Header`, next to the logo.
|
|
69
|
+
*/
|
|
70
|
+
declare const NavigationRailToggleButton: React.ForwardRefExoticComponent<NavigationRailToggleButtonProps & React.RefAttributes<HTMLElement | HTMLButtonElement>>;
|
|
71
|
+
interface NavigationRailContentProps extends BaseProps {
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* `NavigationRail.Content` is a wraps the main content of the `NavigationRail`, including
|
|
75
|
+
* the primary navigation list and an optional footer.
|
|
76
|
+
*
|
|
77
|
+
* Example:
|
|
78
|
+
* ```tsx
|
|
79
|
+
* <NavigationRail.Content>
|
|
80
|
+
* <NavigationRail.List>…</NavigationRail.List>
|
|
81
|
+
*
|
|
82
|
+
* <NavigationRail.Footer>
|
|
83
|
+
* <NavigationRail.List>…</NavigationRail.List>
|
|
84
|
+
* </NavigationRail.Footer>
|
|
85
|
+
* </NavigationRail.Content>
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
declare const NavigationRailContent: React.ForwardRefExoticComponent<NavigationRailContentProps & React.RefAttributes<HTMLDivElement | HTMLElement>>;
|
|
89
|
+
interface NavigationRailListProps extends BaseProps<"div"> {
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The `NavigationRail.List` represents a list of top-level navigation items.
|
|
93
|
+
*
|
|
94
|
+
* It should be used within `NavigationRail.Content` and should contain `NavigationRail.ListItem` elements,
|
|
95
|
+
* which in turn can contain `NavigationRail.Anchor` or `NavigationRail.Button`.
|
|
96
|
+
*
|
|
97
|
+
* Example (with `NavigationRail.Anchor`):
|
|
98
|
+
* ```tsx
|
|
99
|
+
* <NavigationRail.List>
|
|
100
|
+
* <NavigationRail.ListItem>
|
|
101
|
+
* <NavigationRail.Anchor label="Home" icon={homeIcon} href="/" />
|
|
102
|
+
* </NavigationRail.ListItem>
|
|
103
|
+
* <NavigationRail.ListItem>
|
|
104
|
+
* <NavigationRail.Anchor label="Projects" icon={projectsIcon} href="/projects" />
|
|
105
|
+
* </NavigationRail.ListItem>
|
|
106
|
+
* </NavigationRail.List>
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* Example (with `NavigationRail.Button`):
|
|
110
|
+
* ```tsx
|
|
111
|
+
* <NavigationRail.List>
|
|
112
|
+
* <NavigationRail.ListItem>
|
|
113
|
+
* <NavigationRail.Button label="Help" icon={helpIcon} onClick={…} />
|
|
114
|
+
* </NavigationRail.ListItem>
|
|
115
|
+
* <NavigationRail.ListItem>
|
|
116
|
+
* <NavigationRail.Button label="Settings" icon={settingsIcon} onClick={…} />
|
|
117
|
+
* </NavigationRail.ListItem>
|
|
118
|
+
* </NavigationRail.List>
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* Multiple `NavigationRail.List` elements can be used together and be separated by a `Divider`.
|
|
122
|
+
*/
|
|
123
|
+
declare const NavigationRailList: React.ForwardRefExoticComponent<NavigationRailListProps & React.RefAttributes<HTMLDivElement | HTMLElement>>;
|
|
124
|
+
interface NavigationRailListItemProps extends BaseProps<"div"> {
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The `NavigationRail.Item` represents a single navigation list item, which should contain
|
|
128
|
+
* either a `NavigationRail.Anchor` or a `NavigationRail.Button`.
|
|
129
|
+
*
|
|
130
|
+
* Example:
|
|
131
|
+
* ```tsx
|
|
132
|
+
* <NavigationRail.ListItem>
|
|
133
|
+
* <NavigationRail.Anchor label="Home" icon={homeIcon} href="/" />
|
|
134
|
+
* </NavigationRail.ListItem>
|
|
135
|
+
* // or
|
|
136
|
+
* <NavigationRail.ListItem>
|
|
137
|
+
* <NavigationRail.Button label="Settings" icon={settingsIcon} onClick={…} />
|
|
138
|
+
* </NavigationRail.ListItem>
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* **Note:** This is a non-interactive wrapper element and should not directly handle user interactions.
|
|
142
|
+
*/
|
|
143
|
+
declare const NavigationRailListItem: React.ForwardRefExoticComponent<NavigationRailListItemProps & React.RefAttributes<HTMLDivElement | HTMLElement>>;
|
|
144
|
+
interface NavigationRailItemActionOwnProps {
|
|
145
|
+
label: string;
|
|
146
|
+
icon: string | React.JSX.Element;
|
|
147
|
+
}
|
|
148
|
+
interface NavigationRailAnchorProps extends Omit<BaseProps<"a">, "children">, NavigationRailItemActionOwnProps {
|
|
149
|
+
/**
|
|
150
|
+
* Whether the anchor is currently active (i.e. represents the current page).
|
|
151
|
+
*/
|
|
152
|
+
active?: boolean;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* `NavigationRail.Anchor` is used for top-level navigation items that link to major pages.
|
|
156
|
+
*
|
|
157
|
+
* Should be used inside `NavigationRail.ListItem` and must have a short `label` and a recognizable `icon`.
|
|
158
|
+
* The `label` will be shown as a tooltip when the `NavigationRail` is collapsed.
|
|
159
|
+
*
|
|
160
|
+
* Example:
|
|
161
|
+
* ```tsx
|
|
162
|
+
* <NavigationRail.ListItem>
|
|
163
|
+
* <NavigationRail.Anchor label="Home" icon={homeIcon} href="/" />
|
|
164
|
+
* </NavigationRail.ListItem>
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
declare const NavigationRailAnchor: React.ForwardRefExoticComponent<NavigationRailAnchorProps & React.RefAttributes<HTMLElement | HTMLAnchorElement>>;
|
|
168
|
+
interface NavigationRailButtonProps extends Omit<BaseProps<"button">, "children">, NavigationRailItemActionOwnProps {
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* `NavigationRail.Button` is used for actions that do not navigate to a new page, but rather perform
|
|
172
|
+
* an in-page action, such as opening a dialog or menu.
|
|
173
|
+
*
|
|
174
|
+
* Should be used inside `NavigationRail.ListItem` and must have a short `label` and a recognizable `icon`.
|
|
175
|
+
* The `label` will be shown as a tooltip when the `NavigationRail` is collapsed.
|
|
176
|
+
*
|
|
177
|
+
* Example:
|
|
178
|
+
* ```tsx
|
|
179
|
+
* <NavigationRail.ListItem>
|
|
180
|
+
* <NavigationRail.Button label="Notifications" icon={notificationsIcon} onClick={showNotificationsDialog} />
|
|
181
|
+
* </NavigationRail.ListItem>
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
declare const NavigationRailButton: React.ForwardRefExoticComponent<NavigationRailButtonProps & React.RefAttributes<HTMLElement | HTMLButtonElement>>;
|
|
185
|
+
interface NavigationRailFooterProps extends BaseProps<"footer"> {
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* `NavigationRail.Footer` is typically used for grouping secondary actions list near the bottom
|
|
189
|
+
* of the `NavigationRail`, away from the main navigation items.
|
|
190
|
+
*
|
|
191
|
+
* Example:
|
|
192
|
+
* ```tsx
|
|
193
|
+
* <NavigationRail.Content>
|
|
194
|
+
* <NavigationRail.List>…</NavigationRail.List>
|
|
195
|
+
*
|
|
196
|
+
* <NavigationRail.Footer>
|
|
197
|
+
* <NavigationRail.List>…</NavigationRail.List>
|
|
198
|
+
* </NavigationRail.Footer>
|
|
199
|
+
* </NavigationRail.Content>
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
declare const NavigationRailFooter: React.ForwardRefExoticComponent<NavigationRailFooterProps & React.RefAttributes<HTMLElement>>;
|
|
203
|
+
export { NavigationRailRoot as Root, NavigationRailHeader as Header, NavigationRailToggleButton as ToggleButton, NavigationRailContent as Content, NavigationRailList as List, NavigationRailListItem as ListItem, NavigationRailButton as Button, NavigationRailAnchor as Anchor, NavigationRailFooter as Footer, };
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Role } from "@ariakit/react/role";
|
|
4
|
+
import { Tooltip, VisuallyHidden } from "@stratakit/bricks";
|
|
5
|
+
import { Icon } from "@stratakit/foundations";
|
|
6
|
+
import {
|
|
7
|
+
forwardRef,
|
|
8
|
+
useEventHandlers,
|
|
9
|
+
useSafeContext
|
|
10
|
+
} from "@stratakit/foundations/secret-internals";
|
|
11
|
+
import cx from "classnames";
|
|
12
|
+
import { createStore, useStore } from "zustand";
|
|
13
|
+
function createNavigationRailStore() {
|
|
14
|
+
return createStore((set) => ({
|
|
15
|
+
collapsed: true,
|
|
16
|
+
setCollapsed: (collapsed) => set({ collapsed })
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
const NavigationRailContext = React.createContext(void 0);
|
|
20
|
+
function NavigationRailProvider(props) {
|
|
21
|
+
const [store] = React.useState(() => createNavigationRailStore());
|
|
22
|
+
return /* @__PURE__ */ jsx(NavigationRailContext.Provider, { value: store, children: props.children });
|
|
23
|
+
}
|
|
24
|
+
function useNavigationRailState(selectorFn) {
|
|
25
|
+
const store = useSafeContext(NavigationRailContext);
|
|
26
|
+
return useStore(store, selectorFn);
|
|
27
|
+
}
|
|
28
|
+
const NavigationRailRoot = forwardRef(
|
|
29
|
+
(props, forwardedRef) => {
|
|
30
|
+
return /* @__PURE__ */ jsx(NavigationRailProvider, { children: /* @__PURE__ */ jsx(NavigationRailRootInner, { ...props, ref: forwardedRef }) });
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
const NavigationRailRootInner = forwardRef(
|
|
34
|
+
(props, forwardedRef) => {
|
|
35
|
+
const collapsed = useNavigationRailState((state) => state.collapsed);
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
37
|
+
Role.nav,
|
|
38
|
+
{
|
|
39
|
+
...props,
|
|
40
|
+
className: cx("\u{1F95D}NavigationRail", props.className),
|
|
41
|
+
"data-_sk-expanded": collapsed ? "false" : "true",
|
|
42
|
+
ref: forwardedRef
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
const NavigationRailHeader = forwardRef(
|
|
48
|
+
(props, forwardedRef) => {
|
|
49
|
+
const collapsed = useNavigationRailState((state) => state.collapsed);
|
|
50
|
+
return /* @__PURE__ */ jsx(
|
|
51
|
+
Role.header,
|
|
52
|
+
{
|
|
53
|
+
...props,
|
|
54
|
+
className: cx("\u{1F95D}NavigationRailHeader", props.className),
|
|
55
|
+
"data-_sk-collapsed": collapsed ? "true" : void 0,
|
|
56
|
+
ref: forwardedRef
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
const NavigationRailToggleButton = forwardRef((props, forwardedRef) => {
|
|
62
|
+
const { label = "Expand navigation", ...rest } = props;
|
|
63
|
+
const collapsed = useNavigationRailState((state) => state.collapsed);
|
|
64
|
+
const setCollapsed = useNavigationRailState((state) => state.setCollapsed);
|
|
65
|
+
return /* @__PURE__ */ jsxs(
|
|
66
|
+
Role.button,
|
|
67
|
+
{
|
|
68
|
+
"aria-expanded": collapsed ? "false" : "true",
|
|
69
|
+
...rest,
|
|
70
|
+
className: cx("\u{1F95D}NavigationRailToggleButton", props.className),
|
|
71
|
+
ref: forwardedRef,
|
|
72
|
+
onClick: useEventHandlers(props.onClick, () => setCollapsed(!collapsed)),
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsx("svg", { width: "12", height: "12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
75
|
+
"path",
|
|
76
|
+
{
|
|
77
|
+
fill: "currentColor",
|
|
78
|
+
d: "M5.405 2.845a.75.75 0 1 0-1.06 1.06L6.439 6 4.345 8.095a.75.75 0 0 0 1.06 1.06L8.03 6.53a.75.75 0 0 0 0-1.06L5.405 2.845Z"
|
|
79
|
+
}
|
|
80
|
+
) }),
|
|
81
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { children: label })
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
const NavigationRailContent = forwardRef(
|
|
87
|
+
(props, forwardedRef) => {
|
|
88
|
+
return /* @__PURE__ */ jsx(
|
|
89
|
+
Role.div,
|
|
90
|
+
{
|
|
91
|
+
...props,
|
|
92
|
+
className: cx("\u{1F95D}NavigationRailContent", props.className),
|
|
93
|
+
ref: forwardedRef
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
const NavigationRailList = forwardRef(
|
|
99
|
+
(props, forwardedRef) => {
|
|
100
|
+
return /* @__PURE__ */ jsx(
|
|
101
|
+
Role,
|
|
102
|
+
{
|
|
103
|
+
role: "list",
|
|
104
|
+
...props,
|
|
105
|
+
className: cx("\u{1F95D}NavigationRailList", props.className),
|
|
106
|
+
ref: forwardedRef
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
const NavigationRailListItem = forwardRef(
|
|
112
|
+
(props, forwardedRef) => {
|
|
113
|
+
return /* @__PURE__ */ jsx(
|
|
114
|
+
Role.div,
|
|
115
|
+
{
|
|
116
|
+
role: "listitem",
|
|
117
|
+
...props,
|
|
118
|
+
className: cx("\u{1F95D}NavigationRailListItem", props.className),
|
|
119
|
+
ref: forwardedRef
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
const NavigationRailItemAction = forwardRef((props, forwardedRef) => {
|
|
125
|
+
const collapsed = useNavigationRailState((state) => state.collapsed);
|
|
126
|
+
const { label, icon, ...rest } = props;
|
|
127
|
+
const action = /* @__PURE__ */ jsxs(
|
|
128
|
+
Role,
|
|
129
|
+
{
|
|
130
|
+
...rest,
|
|
131
|
+
className: cx("\u{1F95D}NavigationRailItemAction", props.className),
|
|
132
|
+
ref: forwardedRef,
|
|
133
|
+
children: [
|
|
134
|
+
typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { href: icon }) : icon,
|
|
135
|
+
/* @__PURE__ */ jsx(
|
|
136
|
+
Role.span,
|
|
137
|
+
{
|
|
138
|
+
className: "\u{1F95D}NavigationRailItemActionLabel",
|
|
139
|
+
render: collapsed ? /* @__PURE__ */ jsx(VisuallyHidden, {}) : void 0,
|
|
140
|
+
children: label
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
if (collapsed) {
|
|
147
|
+
return /* @__PURE__ */ jsx(Tooltip, { content: label, placement: "right", type: "none", children: action });
|
|
148
|
+
}
|
|
149
|
+
return action;
|
|
150
|
+
});
|
|
151
|
+
const NavigationRailAnchor = forwardRef(
|
|
152
|
+
(props, forwardedRef) => {
|
|
153
|
+
const { label, icon, active, ...rest } = props;
|
|
154
|
+
return /* @__PURE__ */ jsx(
|
|
155
|
+
NavigationRailItemAction,
|
|
156
|
+
{
|
|
157
|
+
label,
|
|
158
|
+
icon,
|
|
159
|
+
"aria-current": active ? "page" : void 0,
|
|
160
|
+
render: /* @__PURE__ */ jsx(Role.a, { ...rest, ref: forwardedRef })
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
const NavigationRailButton = forwardRef(
|
|
166
|
+
(props, forwardedRef) => {
|
|
167
|
+
const { label, icon, ...rest } = props;
|
|
168
|
+
return /* @__PURE__ */ jsx(
|
|
169
|
+
NavigationRailItemAction,
|
|
170
|
+
{
|
|
171
|
+
label,
|
|
172
|
+
icon,
|
|
173
|
+
render: /* @__PURE__ */ jsx(Role.button, { ...rest, ref: forwardedRef })
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
const NavigationRailFooter = forwardRef(
|
|
179
|
+
(props, forwardedRef) => {
|
|
180
|
+
return /* @__PURE__ */ jsx(
|
|
181
|
+
Role,
|
|
182
|
+
{
|
|
183
|
+
render: /* @__PURE__ */ jsx("footer", {}),
|
|
184
|
+
...props,
|
|
185
|
+
className: cx("\u{1F95D}NavigationRailFooter", props.className),
|
|
186
|
+
ref: forwardedRef
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
export {
|
|
192
|
+
NavigationRailAnchor as Anchor,
|
|
193
|
+
NavigationRailButton as Button,
|
|
194
|
+
NavigationRailContent as Content,
|
|
195
|
+
NavigationRailFooter as Footer,
|
|
196
|
+
NavigationRailHeader as Header,
|
|
197
|
+
NavigationRailList as List,
|
|
198
|
+
NavigationRailListItem as ListItem,
|
|
199
|
+
NavigationRailRoot as Root,
|
|
200
|
+
NavigationRailToggleButton as ToggleButton
|
|
201
|
+
};
|
package/dist/Table.js
CHANGED
|
@@ -20,7 +20,7 @@ const HtmlTable = forwardRef((props, forwardedRef) => {
|
|
|
20
20
|
render: /* @__PURE__ */ jsx("table", {}),
|
|
21
21
|
...props,
|
|
22
22
|
ref: forwardedRef,
|
|
23
|
-
className: cx("\u{1F95D}
|
|
23
|
+
className: cx("\u{1F95D}Table", props.className)
|
|
24
24
|
}
|
|
25
25
|
) });
|
|
26
26
|
});
|
|
@@ -38,7 +38,7 @@ const CustomTable = forwardRef(
|
|
|
38
38
|
"aria-labelledby": captionId,
|
|
39
39
|
...props,
|
|
40
40
|
ref: forwardedRef,
|
|
41
|
-
className: cx("\u{1F95D}
|
|
41
|
+
className: cx("\u{1F95D}Table", props.className)
|
|
42
42
|
}
|
|
43
43
|
) });
|
|
44
44
|
}
|
|
@@ -55,7 +55,7 @@ const TableHeader = forwardRef(
|
|
|
55
55
|
role,
|
|
56
56
|
...props,
|
|
57
57
|
ref: forwardedRef,
|
|
58
|
-
className: cx("\u{1F95D}
|
|
58
|
+
className: cx("\u{1F95D}TableHeader", props.className)
|
|
59
59
|
}
|
|
60
60
|
) });
|
|
61
61
|
}
|
|
@@ -70,7 +70,7 @@ const TableBody = forwardRef((props, forwardedRef) => {
|
|
|
70
70
|
role: void 0,
|
|
71
71
|
...props,
|
|
72
72
|
ref: forwardedRef,
|
|
73
|
-
className: cx("\u{1F95D}
|
|
73
|
+
className: cx("\u{1F95D}TableBody", props.className)
|
|
74
74
|
}
|
|
75
75
|
);
|
|
76
76
|
});
|
|
@@ -85,7 +85,7 @@ const TableRow = forwardRef((props, forwardedRef) => {
|
|
|
85
85
|
role,
|
|
86
86
|
...props,
|
|
87
87
|
ref: forwardedRef,
|
|
88
|
-
className: cx("\u{1F95D}
|
|
88
|
+
className: cx("\u{1F95D}TableRow", props.className)
|
|
89
89
|
}
|
|
90
90
|
);
|
|
91
91
|
});
|
|
@@ -108,7 +108,7 @@ const TableCaption = forwardRef(
|
|
|
108
108
|
...rest,
|
|
109
109
|
id,
|
|
110
110
|
ref: useMergedRefs(forwardedRef, captionIdRef),
|
|
111
|
-
className: cx("\u{1F95D}
|
|
111
|
+
className: cx("\u{1F95D}TableCaption", props.className)
|
|
112
112
|
}
|
|
113
113
|
);
|
|
114
114
|
}
|
|
@@ -129,7 +129,7 @@ const TableCell = forwardRef((props, forwardedRef) => {
|
|
|
129
129
|
role,
|
|
130
130
|
...props,
|
|
131
131
|
ref: forwardedRef,
|
|
132
|
-
className: cx("\u{1F95D}
|
|
132
|
+
className: cx("\u{1F95D}TableCell", props.className)
|
|
133
133
|
}
|
|
134
134
|
);
|
|
135
135
|
});
|
package/dist/Tabs.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as AkTab from "@ariakit/react/tab";
|
|
2
2
|
import type { BaseProps, FocusableProps } from "@stratakit/foundations/secret-internals";
|
|
3
|
-
interface
|
|
3
|
+
interface TabsProviderProps extends Pick<AkTab.TabProviderProps, "defaultSelectedId" | "selectedId" | "setSelectedId" | "selectOnMove" | "children"> {
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
6
|
* A set of tabs that can be used to switch between different views.
|
|
@@ -9,7 +9,7 @@ interface TabsProps extends Pick<AkTab.TabProviderProps, "defaultSelectedId" | "
|
|
|
9
9
|
*
|
|
10
10
|
* Example:
|
|
11
11
|
* ```tsx
|
|
12
|
-
* <Tabs.
|
|
12
|
+
* <Tabs.Provider>
|
|
13
13
|
* <Tabs.TabList>
|
|
14
14
|
* <Tabs.Tab id="tab-1">Tab 1</Tabs.Tab>
|
|
15
15
|
* <Tabs.Tab id="tab-2">Tab 2</Tabs.Tab>
|
|
@@ -19,7 +19,7 @@ interface TabsProps extends Pick<AkTab.TabProviderProps, "defaultSelectedId" | "
|
|
|
19
19
|
* <Tabs.TabPanel tabId="tab-1">Tab 1 content</Tabs.TabPanel>
|
|
20
20
|
* <Tabs.TabPanel tabId="tab-2">Tab 2 content</Tabs.TabPanel>
|
|
21
21
|
* <Tabs.TabPanel tabId="tab-3">Tab 3 content</Tabs.TabPanel>
|
|
22
|
-
* </Tabs.
|
|
22
|
+
* </Tabs.Provider>
|
|
23
23
|
* ```
|
|
24
24
|
*
|
|
25
25
|
* The tabs and their panels are connected by matching the `id` prop on the `Tabs.Tab` component with
|
|
@@ -30,8 +30,8 @@ interface TabsProps extends Pick<AkTab.TabProviderProps, "defaultSelectedId" | "
|
|
|
30
30
|
*
|
|
31
31
|
* **Note**: `Tabs` should _not_ be used for navigation; it is only intended for switching smaller views within an existing page.
|
|
32
32
|
*/
|
|
33
|
-
declare function
|
|
34
|
-
declare namespace
|
|
33
|
+
declare function TabsProvider(props: TabsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
declare namespace TabsProvider {
|
|
35
35
|
var displayName: string;
|
|
36
36
|
}
|
|
37
37
|
interface TabListProps extends BaseProps {
|
|
@@ -40,7 +40,7 @@ interface TabListProps extends BaseProps {
|
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* A simple container for the tab buttons.
|
|
43
|
-
* Should be used as a child of `Tabs.
|
|
43
|
+
* Should be used as a child of `Tabs.Provider` and consist of the individual `Tabs.Tab` components.
|
|
44
44
|
*
|
|
45
45
|
* Example:
|
|
46
46
|
* ```tsx
|
|
@@ -57,7 +57,7 @@ interface TabProps extends Omit<FocusableProps<"button">, "id"> {
|
|
|
57
57
|
* The globally unique id of the tab. This will be used to identify the tab
|
|
58
58
|
* and connect it to the corresponding `Tabs.TabPanel` via the `tabId`.
|
|
59
59
|
*
|
|
60
|
-
* The `selectedId` state of `Tabs.
|
|
60
|
+
* The `selectedId` state of `Tabs.Provider` will also be based on this id.
|
|
61
61
|
*/
|
|
62
62
|
id: string;
|
|
63
63
|
}
|
|
@@ -86,7 +86,7 @@ declare const Tab: import("react").ForwardRefExoticComponent<TabProps & import("
|
|
|
86
86
|
interface TabPanelProps extends FocusableProps<"div">, Pick<AkTab.TabPanelProps, "unmountOnHide" | "focusable">, Required<Pick<AkTab.TabPanelProps, "tabId">> {
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
|
-
* The actual content of a tab, shown when the tab is selected. Should be used as a child of `Tabs.
|
|
89
|
+
* The actual content of a tab, shown when the tab is selected. Should be used as a child of `Tabs.Provider`.
|
|
90
90
|
* The `tabId` prop should match the `id` prop of the corresponding `Tabs.Tab` component.
|
|
91
91
|
*
|
|
92
92
|
* Example:
|
|
@@ -95,4 +95,4 @@ interface TabPanelProps extends FocusableProps<"div">, Pick<AkTab.TabPanelProps,
|
|
|
95
95
|
* ```
|
|
96
96
|
*/
|
|
97
97
|
declare const TabPanel: import("react").ForwardRefExoticComponent<TabPanelProps & import("react").RefAttributes<HTMLDivElement | HTMLElement>>;
|
|
98
|
-
export {
|
|
98
|
+
export { TabsProvider as Provider, TabList, Tab, TabPanel };
|
package/dist/Tabs.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import cx from "classnames";
|
|
10
10
|
const supportsAnchorPositioning = isBrowser && CSS?.supports("anchor-name: --foo");
|
|
11
11
|
const prefersReducedMotion = () => isBrowser && window.matchMedia("(prefers-reduced-motion)").matches;
|
|
12
|
-
function
|
|
12
|
+
function TabsProvider(props) {
|
|
13
13
|
const {
|
|
14
14
|
defaultSelectedId,
|
|
15
15
|
selectedId,
|
|
@@ -63,8 +63,8 @@ const TabList = forwardRef((props, forwardedRef) => {
|
|
|
63
63
|
AkTab.TabList,
|
|
64
64
|
{
|
|
65
65
|
...rest,
|
|
66
|
-
"data-
|
|
67
|
-
className: cx("\u{1F95D}
|
|
66
|
+
"data-_sk-tone": tone,
|
|
67
|
+
className: cx("\u{1F95D}TabList", props.className),
|
|
68
68
|
ref: forwardedRef
|
|
69
69
|
}
|
|
70
70
|
);
|
|
@@ -75,7 +75,7 @@ const Tab = forwardRef((props, forwardedRef) => {
|
|
|
75
75
|
{
|
|
76
76
|
accessibleWhenDisabled: true,
|
|
77
77
|
...props,
|
|
78
|
-
className: cx("\u{1F95D}
|
|
78
|
+
className: cx("\u{1F95D}Tab", props.className),
|
|
79
79
|
ref: forwardedRef
|
|
80
80
|
}
|
|
81
81
|
);
|
|
@@ -85,13 +85,13 @@ const TabPanel = forwardRef((props, forwardedRef) => {
|
|
|
85
85
|
AkTab.TabPanel,
|
|
86
86
|
{
|
|
87
87
|
...props,
|
|
88
|
-
className: cx("\u{1F95D}
|
|
88
|
+
className: cx("\u{1F95D}TabPanel", props.className),
|
|
89
89
|
ref: forwardedRef
|
|
90
90
|
}
|
|
91
91
|
);
|
|
92
92
|
});
|
|
93
93
|
export {
|
|
94
|
-
|
|
94
|
+
TabsProvider as Provider,
|
|
95
95
|
Tab,
|
|
96
96
|
TabList,
|
|
97
97
|
TabPanel
|