|
| 1 | +import interactionResponse from "await-interaction-response"; |
1 | 2 | import { type ComponentPropsWithoutRef, forwardRef, useCallback } from "react";
|
2 |
| -import { Root, List, Trigger, Content } from "@radix-ui/react-tabs"; |
3 |
| -import { |
4 |
| - getClosestInstance, |
5 |
| - getIndexWithinAncestorFromComponentProps, |
6 |
| - type Hook, |
7 |
| -} from "@webstudio-is/react-sdk/runtime"; |
8 | 3 | import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
9 |
| -import interactionResponse from "await-interaction-response"; |
| 4 | +import { Root, List, Trigger, Content } from "@radix-ui/react-tabs"; |
| 5 | +import { getIndexWithinAncestorFromProps } from "@webstudio-is/sdk/runtime"; |
| 6 | +import { getClosestInstance, type Hook } from "@webstudio-is/react-sdk/runtime"; |
10 | 7 |
|
11 | 8 | export const Tabs = forwardRef<
|
12 | 9 | HTMLDivElement,
|
@@ -45,15 +42,15 @@ export const TabsTrigger = forwardRef<
|
45 | 42 | HTMLButtonElement,
|
46 | 43 | Omit<ComponentPropsWithoutRef<typeof Trigger>, "value"> & { value?: string }
|
47 | 44 | >(({ value, ...props }, ref) => {
|
48 |
| - const index = getIndexWithinAncestorFromComponentProps(props); |
| 45 | + const index = getIndexWithinAncestorFromProps(props); |
49 | 46 | return <Trigger ref={ref} value={value ?? index ?? ""} {...props} />;
|
50 | 47 | });
|
51 | 48 |
|
52 | 49 | export const TabsContent = forwardRef<
|
53 | 50 | HTMLDivElement,
|
54 | 51 | Omit<ComponentPropsWithoutRef<typeof Content>, "value"> & { value?: string }
|
55 | 52 | >(({ value, ...props }, ref) => {
|
56 |
| - const index = getIndexWithinAncestorFromComponentProps(props); |
| 53 | + const index = getIndexWithinAncestorFromProps(props); |
57 | 54 | return <Content ref={ref} value={value ?? index ?? ""} {...props} />;
|
58 | 55 | });
|
59 | 56 |
|
|
0 commit comments