@dxos/react-ui-tabs 0.8.4-main.d05539e30a → 0.8.4-main.d9fc60f731
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/lib/browser/index.mjs +22 -14
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +22 -14
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/Tabs.d.ts +35 -7
- package/dist/types/src/Tabs.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/src/Tabs.tsx +30 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-tabs",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.d9fc60f731",
|
|
4
4
|
"description": "Components for facilitating a Tabs pattern.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -33,25 +33,25 @@
|
|
|
33
33
|
"@radix-ui/react-slot": "1.1.2",
|
|
34
34
|
"@radix-ui/react-tabs": "1.1.3",
|
|
35
35
|
"@radix-ui/react-use-controllable-state": "1.1.0",
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
36
|
+
"@dxos/util": "0.8.4-main.d9fc60f731",
|
|
37
|
+
"@dxos/react-ui-attention": "0.8.4-main.d9fc60f731"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/react": "~19.2.7",
|
|
41
41
|
"@types/react-dom": "~19.2.3",
|
|
42
42
|
"react": "~19.2.3",
|
|
43
43
|
"react-dom": "~19.2.3",
|
|
44
|
-
"vite": "^8.0.
|
|
45
|
-
"@dxos/random": "0.8.4-main.
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
48
|
-
"@dxos/ui
|
|
44
|
+
"vite": "^8.0.14",
|
|
45
|
+
"@dxos/random": "0.8.4-main.d9fc60f731",
|
|
46
|
+
"@dxos/ui-theme": "0.8.4-main.d9fc60f731",
|
|
47
|
+
"@dxos/storybook-utils": "0.8.4-main.d9fc60f731",
|
|
48
|
+
"@dxos/react-ui": "0.8.4-main.d9fc60f731"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"react": "~19.2.3",
|
|
52
52
|
"react-dom": "~19.2.3",
|
|
53
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
54
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
53
|
+
"@dxos/react-ui": "0.8.4-main.d9fc60f731",
|
|
54
|
+
"@dxos/ui-theme": "0.8.4-main.d9fc60f731"
|
|
55
55
|
},
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
package/src/Tabs.tsx
CHANGED
|
@@ -127,20 +127,24 @@ const TabsRoot = forwardRef<HTMLDivElement, TabsRootProps>(
|
|
|
127
127
|
},
|
|
128
128
|
);
|
|
129
129
|
|
|
130
|
+
TabsRoot.displayName = 'Tabs.Root';
|
|
131
|
+
|
|
130
132
|
type TabsViewportProps = ThemedClassName<ComponentPropsWithoutRef<'div'>>;
|
|
131
133
|
|
|
132
|
-
|
|
134
|
+
function TabsViewport({ classNames, children, ...props }: TabsViewportProps) {
|
|
133
135
|
const { activePart } = useTabsContext('TabsViewport');
|
|
134
136
|
return (
|
|
135
137
|
<div {...props} data-active={activePart} className={mx(classNames)}>
|
|
136
138
|
{children}
|
|
137
139
|
</div>
|
|
138
140
|
);
|
|
139
|
-
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
TabsViewport.displayName = 'Tabs.Viewport';
|
|
140
144
|
|
|
141
145
|
type TabsTablistProps = ThemedClassName<TabsPrimitive.TabsListProps>;
|
|
142
146
|
|
|
143
|
-
|
|
147
|
+
function TabsTablist({ children, classNames, ...props }: TabsTablistProps) {
|
|
144
148
|
const { orientation } = useTabsContext('TabsTablist');
|
|
145
149
|
return (
|
|
146
150
|
<TabsPrimitive.List
|
|
@@ -156,9 +160,11 @@ const TabsTablist = ({ children, classNames, ...props }: TabsTablistProps) => {
|
|
|
156
160
|
{children}
|
|
157
161
|
</TabsPrimitive.List>
|
|
158
162
|
);
|
|
159
|
-
}
|
|
163
|
+
}
|
|
160
164
|
|
|
161
|
-
|
|
165
|
+
TabsTablist.displayName = 'Tabs.Tablist';
|
|
166
|
+
|
|
167
|
+
function TabsBackButton({ onClick, classNames, ...props }: ButtonProps) {
|
|
162
168
|
const { setActivePart } = useTabsContext('TabsBackButton');
|
|
163
169
|
const handleClick = useCallback(
|
|
164
170
|
(event: MouseEvent<HTMLButtonElement>) => {
|
|
@@ -169,21 +175,25 @@ const TabsBackButton = ({ onClick, classNames, ...props }: ButtonProps) => {
|
|
|
169
175
|
);
|
|
170
176
|
|
|
171
177
|
return <Button {...props} classNames={['@md:hidden text-start', classNames]} onClick={handleClick} />;
|
|
172
|
-
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
TabsBackButton.displayName = 'Tabs.BackButton';
|
|
173
181
|
|
|
174
182
|
type TabsTabGroupHeadingProps = ThemedClassName<ComponentPropsWithoutRef<'h2'>>;
|
|
175
183
|
|
|
176
|
-
|
|
184
|
+
function TabsTabGroupHeading({ children, classNames, ...props }: ThemedClassName<TabsTabGroupHeadingProps>) {
|
|
177
185
|
return (
|
|
178
186
|
<h2 {...props} className={mx('my-1 px-2 text-sm text-un-accent', classNames)}>
|
|
179
187
|
{children}
|
|
180
188
|
</h2>
|
|
181
189
|
);
|
|
182
|
-
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
TabsTabGroupHeading.displayName = 'Tabs.TabGroupHeading';
|
|
183
193
|
|
|
184
194
|
type TabsTabProps = ButtonProps & Pick<TabsPrimitive.TabsTriggerProps, 'value'>;
|
|
185
195
|
|
|
186
|
-
|
|
196
|
+
function TabsTab({ value, classNames, children, onClick, ...props }: TabsTabProps) {
|
|
187
197
|
const { setActivePart, orientation, value: contextValue, attendableId } = useTabsContext('TabsTab');
|
|
188
198
|
const { hasAttention } = useAttention(attendableId);
|
|
189
199
|
|
|
@@ -214,11 +224,13 @@ const TabsTab = ({ value, classNames, children, onClick, ...props }: TabsTabProp
|
|
|
214
224
|
</Button>
|
|
215
225
|
</TabsPrimitive.Trigger>
|
|
216
226
|
);
|
|
217
|
-
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
TabsTab.displayName = 'Tabs.Tab';
|
|
218
230
|
|
|
219
231
|
type TabsIconTabProps = IconButtonProps & Pick<TabsPrimitive.TabsTriggerProps, 'value'>;
|
|
220
232
|
|
|
221
|
-
|
|
233
|
+
function TabsIconTab({ value, classNames, onClick, ...props }: TabsIconTabProps) {
|
|
222
234
|
const { setActivePart, orientation, value: contextValue, attendableId } = useTabsContext('TabsTab');
|
|
223
235
|
const { hasAttention } = useAttention(attendableId);
|
|
224
236
|
|
|
@@ -247,11 +259,13 @@ const TabsIconTab = ({ value, classNames, onClick, ...props }: TabsIconTabProps)
|
|
|
247
259
|
/>
|
|
248
260
|
</TabsPrimitive.Trigger>
|
|
249
261
|
);
|
|
250
|
-
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
TabsIconTab.displayName = 'Tabs.IconTab';
|
|
251
265
|
|
|
252
266
|
type TabsPanelProps = ThemedClassName<TabsPrimitive.TabsContentProps>;
|
|
253
267
|
|
|
254
|
-
|
|
268
|
+
function TabsPanel({ classNames, children, ...props }: TabsPanelProps) {
|
|
255
269
|
const { value: contextValue } = useTabsContext('TabsTab');
|
|
256
270
|
return (
|
|
257
271
|
<Activity mode={contextValue === props.value ? 'visible' : 'hidden'}>
|
|
@@ -260,7 +274,9 @@ const TabsPanel = ({ classNames, children, ...props }: TabsPanelProps) => {
|
|
|
260
274
|
</TabsPrimitive.Content>
|
|
261
275
|
</Activity>
|
|
262
276
|
);
|
|
263
|
-
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
TabsPanel.displayName = 'Tabs.Panel';
|
|
264
280
|
|
|
265
281
|
type TabsTabPrimitiveProps = TabsPrimitive.TabsTriggerProps;
|
|
266
282
|
|