@dxos/react-ui-tabs 0.8.4-main.ef1bc66f44 → 0.8.4-main.f466a3d56e

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/LICENSE CHANGED
@@ -1,8 +1,105 @@
1
- MIT License
2
- Copyright (c) 2024 DXOS
1
+ # Functional Source License, Version 1.1, ALv2 Future License
3
2
 
4
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ ## Abbreviation
5
4
 
6
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ FSL-1.1-Apache-2.0
7
6
 
8
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7
+ ## Notice
8
+
9
+ Copyright 2026 DXOS
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the Apache License, Version 2.0 that is effective on the second anniversary of
91
+ the date we make the Software available. On or after that date, you may use the
92
+ Software under the Apache License, Version 2.0, in which case the following
93
+ will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
+ this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software distributed
103
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
+ specific language governing permissions and limitations under the License.
@@ -6,15 +6,15 @@ import { useControllableState } from "@radix-ui/react-use-controllable-state";
6
6
  import React, { Activity, forwardRef, useCallback, useLayoutEffect } from "react";
7
7
  import { Button, IconButton, useForwardedRef } from "@dxos/react-ui";
8
8
  import { useAttention } from "@dxos/react-ui-attention";
9
- import { ghostSelectedContainerMd, mx } from "@dxos/ui-theme";
9
+ import { mx } from "@dxos/ui-theme";
10
10
  var TABS_NAME = "Tabs";
11
11
  var [TabsContextProvider, useTabsContext] = createContext(TABS_NAME, {
12
+ orientation: "vertical",
12
13
  activePart: "list",
13
14
  setActivePart: () => {
14
- },
15
- orientation: "vertical"
15
+ }
16
16
  });
17
- var TabsRoot = /* @__PURE__ */ forwardRef(({ children, classNames, activePart: propsActivePart, onActivePartChange, defaultActivePart, value: propsValue, onValueChange, defaultValue, orientation = "vertical", activationMode = "manual", verticalVariant = "stateful", attendableId, ...props }, forwardedRef) => {
17
+ var TabsRoot = /* @__PURE__ */ forwardRef(({ children, classNames, activePart: propsActivePart, onActivePartChange, defaultActivePart, value: propsValue, onValueChange, defaultValue, orientation = "vertical", activationMode = "manual", attendableId, ...props }, forwardedRef) => {
18
18
  const tabsRoot = useForwardedRef(forwardedRef);
19
19
  const _1 = useArrowNavigationGroup();
20
20
  const _2 = useFocusableGroup();
@@ -47,41 +47,35 @@ var TabsRoot = /* @__PURE__ */ forwardRef(({ children, classNames, activePart: p
47
47
  activePart,
48
48
  setActivePart,
49
49
  value,
50
- attendableId,
51
- verticalVariant
50
+ attendableId
52
51
  }, /* @__PURE__ */ React.createElement(TabsPrimitive.Root, {
52
+ ...props,
53
+ className: mx("overflow-hidden", classNames),
54
+ orientation,
53
55
  activationMode,
54
56
  "data-active": activePart,
55
- orientation,
56
- ...props,
57
57
  value,
58
58
  onValueChange: handleValueChange,
59
- className: mx("overflow-hidden", orientation === "vertical" && verticalVariant === "stateful" && "[&[data-active=list]_[role=tabpanel]]:invisible @md:[&[data-active=list]_[role=tabpanel]]:visible", classNames),
60
59
  ref: tabsRoot
61
60
  }, children));
62
61
  });
63
62
  var TabsViewport = ({ classNames, children, ...props }) => {
64
- const { orientation, activePart, verticalVariant } = useTabsContext("TabsViewport");
63
+ const { activePart } = useTabsContext("TabsViewport");
65
64
  return /* @__PURE__ */ React.createElement("div", {
66
- role: "none",
67
65
  ...props,
68
66
  "data-active": activePart,
69
- className: mx(orientation === "vertical" && verticalVariant === "stateful" && [
70
- "grid is-[200%] grid-cols-2 data-[active=panel]:mis-[-100%]",
71
- "@md:is-auto @md:data-[active=panel]:mis-0 @md:grid-cols-[minmax(min-content,1fr)_3fr] @md:gap-1"
72
- ], classNames)
67
+ className: mx(classNames)
73
68
  }, children);
74
69
  };
75
70
  var TabsTablist = ({ children, classNames, ...props }) => {
76
- const { orientation, verticalVariant } = useTabsContext("TabsTablist");
71
+ const { orientation } = useTabsContext("TabsTablist");
77
72
  return /* @__PURE__ */ React.createElement(TabsPrimitive.List, {
78
73
  ...props,
79
74
  "data-arrow-keys": orientation === "vertical" ? "up down" : "left right",
80
75
  className: mx(
81
- "max-bs-full is-full",
82
- // NOTE: Padding should be common to Toolbar.
83
- orientation === "vertical" ? "overflow-y-auto" : "flex items-stretch justify-start overflow-x-auto p-1 gap-1",
84
- orientation === "vertical" && verticalVariant === "stateful" && "place-self-start p-1",
76
+ "max-h-full w-full",
77
+ // TODO(burdon): Should be embeddable inside Toolbar (if horizontal).
78
+ orientation === "vertical" ? "overflow-y-auto" : "flex p-1 gap-1 items-stretch justify-start overflow-x-auto",
85
79
  classNames
86
80
  )
87
81
  }, children);
@@ -92,13 +86,13 @@ var TabsBackButton = ({ onClick, classNames, ...props }) => {
92
86
  setActivePart("list");
93
87
  return onClick?.(event);
94
88
  }, [
95
- onClick,
96
- setActivePart
89
+ setActivePart,
90
+ onClick
97
91
  ]);
98
92
  return /* @__PURE__ */ React.createElement(Button, {
99
93
  ...props,
100
94
  classNames: [
101
- "is-full text-start @md:hidden mbe-2",
95
+ "@md:hidden text-start",
102
96
  classNames
103
97
  ],
104
98
  onClick: handleClick
@@ -107,7 +101,7 @@ var TabsBackButton = ({ onClick, classNames, ...props }) => {
107
101
  var TabsTabGroupHeading = ({ children, classNames, ...props }) => {
108
102
  return /* @__PURE__ */ React.createElement("h2", {
109
103
  ...props,
110
- className: mx("mlb-1 pli-2 text-sm text-unAccent", classNames)
104
+ className: mx("my-1 px-2 text-sm text-un-accent", classNames)
111
105
  }, children);
112
106
  };
113
107
  var TabsTab = ({ value, classNames, children, onClick, ...props }) => {
@@ -128,15 +122,14 @@ var TabsTab = ({ value, classNames, children, onClick, ...props }) => {
128
122
  value,
129
123
  asChild: true
130
124
  }, /* @__PURE__ */ React.createElement(Button, {
131
- density: "fine",
132
- variant: orientation === "horizontal" && contextValue === value ? hasAttention ? "primary" : "default" : "ghost",
133
125
  ...props,
134
- onClick: handleClick,
126
+ variant: orientation === "horizontal" && contextValue === value ? hasAttention ? "primary" : "default" : "ghost",
135
127
  classNames: [
136
- orientation === "vertical" && "block justify-start text-start is-full",
137
- orientation === "vertical" && ghostSelectedContainerMd,
128
+ orientation === "vertical" && "block justify-start text-start w-full",
129
+ orientation === "vertical" && "dx-selected",
138
130
  classNames
139
- ]
131
+ ],
132
+ onClick: handleClick
140
133
  }, children));
141
134
  };
142
135
  var TabsIconTab = ({ value, classNames, onClick, ...props }) => {
@@ -153,24 +146,23 @@ var TabsIconTab = ({ value, classNames, onClick, ...props }) => {
153
146
  value,
154
147
  asChild: true
155
148
  }, /* @__PURE__ */ React.createElement(IconButton, {
156
- density: "fine",
157
- variant: orientation === "horizontal" && contextValue === value ? hasAttention ? "primary" : "default" : "ghost",
158
149
  ...props,
159
- onClick: handleClick,
150
+ variant: orientation === "horizontal" && contextValue === value ? hasAttention ? "primary" : "default" : "ghost",
160
151
  classNames: [
161
- orientation === "vertical" && "justify-start text-start is-full",
162
- orientation === "vertical" && ghostSelectedContainerMd,
152
+ orientation === "vertical" && "justify-start text-start w-full",
153
+ orientation === "vertical" && "dx-selected",
163
154
  classNames
164
- ]
155
+ ],
156
+ onClick: handleClick
165
157
  }));
166
158
  };
167
- var TabsTabpanel = ({ classNames, children, ...props }) => {
159
+ var TabsPanel = ({ classNames, children, ...props }) => {
168
160
  const { value: contextValue } = useTabsContext("TabsTab");
169
161
  return /* @__PURE__ */ React.createElement(Activity, {
170
162
  mode: contextValue === props.value ? "visible" : "hidden"
171
163
  }, /* @__PURE__ */ React.createElement(TabsPrimitive.Content, {
172
164
  ...props,
173
- className: mx("dx-focus-ring-inset-over-all", classNames)
165
+ className: mx("p-0! dx-focus-ring-inset-over-all", classNames)
174
166
  }, children));
175
167
  };
176
168
  var Tabs = {
@@ -180,7 +172,7 @@ var Tabs = {
180
172
  IconTab: TabsIconTab,
181
173
  TabPrimitive: TabsPrimitive.Trigger,
182
174
  TabGroupHeading: TabsTabGroupHeading,
183
- Tabpanel: TabsTabpanel,
175
+ Panel: TabsPanel,
184
176
  BackButton: TabsBackButton,
185
177
  Viewport: TabsViewport
186
178
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/Tabs.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { useArrowNavigationGroup, useFocusFinders, useFocusableGroup } from '@fluentui/react-tabster';\nimport { createContext } from '@radix-ui/react-context';\nimport * as TabsPrimitive from '@radix-ui/react-tabs';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, {\n Activity,\n type ComponentPropsWithoutRef,\n type MouseEvent,\n forwardRef,\n useCallback,\n useLayoutEffect,\n} from 'react';\n\nimport {\n Button,\n type ButtonProps,\n IconButton,\n type IconButtonProps,\n type ThemedClassName,\n useForwardedRef,\n} from '@dxos/react-ui';\nimport { useAttention } from '@dxos/react-ui-attention';\nimport { ghostSelectedContainerMd, mx } from '@dxos/ui-theme';\n\ntype TabsActivePart = 'list' | 'panel';\n\nconst TABS_NAME = 'Tabs';\n\ntype TabsContextValue = {\n activePart: TabsActivePart;\n setActivePart: (nextActivePart: TabsActivePart) => void;\n attendableId?: string;\n verticalVariant?: 'stateful' | 'stateless';\n} & Pick<TabsPrimitive.TabsProps, 'orientation' | 'value'>;\n\nconst [TabsContextProvider, useTabsContext] = createContext<TabsContextValue>(TABS_NAME, {\n activePart: 'list',\n setActivePart: () => {},\n orientation: 'vertical',\n});\n\ntype TabsRootProps = ThemedClassName<TabsPrimitive.TabsProps> &\n Partial<Pick<TabsContextValue, 'activePart' | 'verticalVariant' | 'attendableId'>> &\n Partial<{\n onActivePartChange: (nextActivePart: TabsActivePart) => void;\n defaultActivePart: TabsActivePart;\n }>;\n\nconst TabsRoot = forwardRef<HTMLDivElement, TabsRootProps>(\n (\n {\n children,\n classNames,\n activePart: propsActivePart,\n onActivePartChange,\n defaultActivePart,\n value: propsValue,\n onValueChange,\n defaultValue,\n orientation = 'vertical',\n activationMode = 'manual',\n verticalVariant = 'stateful',\n attendableId,\n ...props\n },\n forwardedRef,\n ) => {\n // const tabsRoot = useRef<HTMLDivElement | null>(null);\n const tabsRoot = useForwardedRef(forwardedRef);\n\n // TODO(thure): Without these, we get Groupper/Mover `API used before initialization`, but why?\n const _1 = useArrowNavigationGroup();\n const _2 = useFocusableGroup();\n const [activePart = 'list', setActivePart] = useControllableState({\n prop: propsActivePart,\n onChange: onActivePartChange,\n defaultProp: defaultActivePart,\n });\n\n const [value, setValue] = useControllableState({\n prop: propsValue,\n onChange: onValueChange,\n defaultProp: defaultValue,\n });\n\n const handleValueChange = useCallback(\n (nextValue: string) => {\n setActivePart('panel');\n setValue(nextValue);\n },\n [value],\n );\n\n const { findFirstFocusable } = useFocusFinders();\n\n useLayoutEffect(() => {\n if (tabsRoot.current) {\n findFirstFocusable(tabsRoot.current)?.focus();\n }\n }, [activePart]);\n\n return (\n <TabsContextProvider\n orientation={orientation}\n activePart={activePart}\n setActivePart={setActivePart}\n value={value}\n attendableId={attendableId}\n verticalVariant={verticalVariant}\n >\n <TabsPrimitive.Root\n activationMode={activationMode}\n data-active={activePart}\n orientation={orientation}\n {...props}\n value={value}\n onValueChange={handleValueChange}\n className={mx(\n 'overflow-hidden',\n orientation === 'vertical' &&\n verticalVariant === 'stateful' &&\n '[&[data-active=list]_[role=tabpanel]]:invisible @md:[&[data-active=list]_[role=tabpanel]]:visible',\n classNames,\n )}\n ref={tabsRoot}\n >\n {children}\n </TabsPrimitive.Root>\n </TabsContextProvider>\n );\n },\n);\n\ntype TabsViewportProps = ThemedClassName<ComponentPropsWithoutRef<'div'>>;\n\nconst TabsViewport = ({ classNames, children, ...props }: TabsViewportProps) => {\n const { orientation, activePart, verticalVariant } = useTabsContext('TabsViewport');\n return (\n <div\n role='none'\n {...props}\n data-active={activePart}\n className={mx(\n orientation === 'vertical' &&\n verticalVariant === 'stateful' && [\n 'grid is-[200%] grid-cols-2 data-[active=panel]:mis-[-100%]',\n '@md:is-auto @md:data-[active=panel]:mis-0 @md:grid-cols-[minmax(min-content,1fr)_3fr] @md:gap-1',\n ],\n classNames,\n )}\n >\n {children}\n </div>\n );\n};\n\ntype TabsTablistProps = ThemedClassName<TabsPrimitive.TabsListProps>;\n\nconst TabsTablist = ({ children, classNames, ...props }: TabsTablistProps) => {\n const { orientation, verticalVariant } = useTabsContext('TabsTablist');\n return (\n <TabsPrimitive.List\n {...props}\n data-arrow-keys={orientation === 'vertical' ? 'up down' : 'left right'}\n className={mx(\n 'max-bs-full is-full',\n // NOTE: Padding should be common to Toolbar.\n orientation === 'vertical' ? 'overflow-y-auto' : 'flex items-stretch justify-start overflow-x-auto p-1 gap-1',\n orientation === 'vertical' && verticalVariant === 'stateful' && 'place-self-start p-1',\n classNames,\n )}\n >\n {children}\n </TabsPrimitive.List>\n );\n};\n\nconst TabsBackButton = ({ onClick, classNames, ...props }: ButtonProps) => {\n const { setActivePart } = useTabsContext('TabsBackButton');\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n setActivePart('list');\n return onClick?.(event);\n },\n [onClick, setActivePart],\n );\n\n return <Button {...props} classNames={['is-full text-start @md:hidden mbe-2', classNames]} onClick={handleClick} />;\n};\n\ntype TabsTabGroupHeadingProps = ThemedClassName<ComponentPropsWithoutRef<'h2'>>;\n\nconst TabsTabGroupHeading = ({ children, classNames, ...props }: ThemedClassName<TabsTabGroupHeadingProps>) => {\n return (\n <h2 {...props} className={mx('mlb-1 pli-2 text-sm text-unAccent', classNames)}>\n {children}\n </h2>\n );\n};\n\ntype TabsTabProps = ButtonProps & Pick<TabsPrimitive.TabsTriggerProps, 'value'>;\n\nconst TabsTab = ({ value, classNames, children, onClick, ...props }: TabsTabProps) => {\n const { setActivePart, orientation, value: contextValue, attendableId } = useTabsContext('TabsTab');\n const { hasAttention } = useAttention(attendableId);\n\n const handleClick = useCallback(\n // NOTE: This handler is only called if the tab is *already active*.\n (event: MouseEvent<HTMLButtonElement>) => {\n setActivePart('panel');\n onClick?.(event);\n },\n [setActivePart, onClick],\n );\n\n return (\n <TabsPrimitive.Trigger value={value} asChild>\n <Button\n density='fine'\n variant={\n orientation === 'horizontal' && contextValue === value ? (hasAttention ? 'primary' : 'default') : 'ghost'\n }\n {...props}\n onClick={handleClick}\n classNames={[\n orientation === 'vertical' && 'block justify-start text-start is-full',\n orientation === 'vertical' && ghostSelectedContainerMd,\n classNames,\n ]}\n >\n {children}\n </Button>\n </TabsPrimitive.Trigger>\n );\n};\n\ntype TabsIconTabProps = IconButtonProps & Pick<TabsPrimitive.TabsTriggerProps, 'value'>;\n\nconst TabsIconTab = ({ value, classNames, onClick, ...props }: TabsIconTabProps) => {\n const { setActivePart, orientation, value: contextValue, attendableId } = useTabsContext('TabsTab');\n const { hasAttention } = useAttention(attendableId);\n\n // NOTE: This handler is only called if the tab is *already active*.\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n setActivePart('panel');\n onClick?.(event);\n },\n [setActivePart, onClick],\n );\n\n return (\n <TabsPrimitive.Trigger value={value} asChild>\n <IconButton\n density='fine'\n variant={\n orientation === 'horizontal' && contextValue === value ? (hasAttention ? 'primary' : 'default') : 'ghost'\n }\n {...props}\n onClick={handleClick}\n classNames={[\n orientation === 'vertical' && 'justify-start text-start is-full',\n orientation === 'vertical' && ghostSelectedContainerMd,\n classNames,\n ]}\n />\n </TabsPrimitive.Trigger>\n );\n};\n\ntype TabsTabpanelProps = ThemedClassName<TabsPrimitive.TabsContentProps>;\n\nconst TabsTabpanel = ({ classNames, children, ...props }: TabsTabpanelProps) => {\n const { value: contextValue } = useTabsContext('TabsTab');\n return (\n <Activity mode={contextValue === props.value ? 'visible' : 'hidden'}>\n <TabsPrimitive.Content {...props} className={mx('dx-focus-ring-inset-over-all', classNames)}>\n {children}\n </TabsPrimitive.Content>\n </Activity>\n );\n};\n\ntype TabsTabPrimitiveProps = TabsPrimitive.TabsTriggerProps;\n\nexport const Tabs = {\n Root: TabsRoot,\n Tablist: TabsTablist,\n Tab: TabsTab,\n IconTab: TabsIconTab,\n TabPrimitive: TabsPrimitive.Trigger,\n TabGroupHeading: TabsTabGroupHeading,\n Tabpanel: TabsTabpanel,\n BackButton: TabsBackButton,\n Viewport: TabsViewport,\n};\n\nexport type {\n TabsActivePart,\n TabsRootProps,\n TabsTablistProps,\n TabsTabProps,\n TabsTabPrimitiveProps,\n TabsTabGroupHeadingProps,\n TabsTabpanelProps,\n TabsViewportProps,\n};\n"],
5
- "mappings": ";AAIA,SAASA,yBAAyBC,iBAAiBC,yBAAyB;AAC5E,SAASC,qBAAqB;AAC9B,YAAYC,mBAAmB;AAC/B,SAASC,4BAA4B;AACrC,OAAOC,SACLC,UAGAC,YACAC,aACAC,uBACK;AAEP,SACEC,QAEAC,YAGAC,uBACK;AACP,SAASC,oBAAoB;AAC7B,SAASC,0BAA0BC,UAAU;AAI7C,IAAMC,YAAY;AASlB,IAAM,CAACC,qBAAqBC,cAAAA,IAAkBC,cAAgCH,WAAW;EACvFI,YAAY;EACZC,eAAe,MAAA;EAAO;EACtBC,aAAa;AACf,CAAA;AASA,IAAMC,WAAWC,2BACf,CACE,EACEC,UACAC,YACAN,YAAYO,iBACZC,oBACAC,mBACAC,OAAOC,YACPC,eACAC,cACAX,cAAc,YACdY,iBAAiB,UACjBC,kBAAkB,YAClBC,cACA,GAAGC,MAAAA,GAELC,iBAAAA;AAGA,QAAMC,WAAWC,gBAAgBF,YAAAA;AAGjC,QAAMG,KAAKC,wBAAAA;AACX,QAAMC,KAAKC,kBAAAA;AACX,QAAM,CAACxB,aAAa,QAAQC,aAAAA,IAAiBwB,qBAAqB;IAChEC,MAAMnB;IACNoB,UAAUnB;IACVoB,aAAanB;EACf,CAAA;AAEA,QAAM,CAACC,OAAOmB,QAAAA,IAAYJ,qBAAqB;IAC7CC,MAAMf;IACNgB,UAAUf;IACVgB,aAAaf;EACf,CAAA;AAEA,QAAMiB,oBAAoBC,YACxB,CAACC,cAAAA;AACC/B,kBAAc,OAAA;AACd4B,aAASG,SAAAA;EACX,GACA;IAACtB;GAAM;AAGT,QAAM,EAAEuB,mBAAkB,IAAKC,gBAAAA;AAE/BC,kBAAgB,MAAA;AACd,QAAIhB,SAASiB,SAAS;AACpBH,yBAAmBd,SAASiB,OAAO,GAAGC,MAAAA;IACxC;EACF,GAAG;IAACrC;GAAW;AAEf,SACE,sBA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IACCJ,SAAQ;IACRC,SACE7D,gBAAgB,gBAAgBuD,iBAAiB/C,QAASgD,eAAe,YAAY,YAAa;IAEnG,GAAGzC;IACJiC,SAASC;IACT7C,YAAY;MACVJ,gBAAgB,cAAc;MAC9BA,gBAAgB,cAAc8D;MAC9B1D;;;AAKV;AAIA,IAAM6D,eAAe,CAAC,EAAE7D,YAAYD,UAAU,GAAGY,MAAAA,MAA0B;AACzE,QAAM,EAAEP,OAAO+C,aAAY,IAAK3D,eAAe,SAAA;AAC/C,SACE,sBAAA,cAACsE,UAAAA;IAASC,MAAMZ,iBAAiBxC,MAAMP,QAAQ,YAAY;KACzD,sBAAA,cAAe4D,uBAAO;IAAE,GAAGrD;IAAOuB,WAAWC,GAAG,gCAAgCnC,UAAAA;KAC7ED,QAAAA,CAAAA;AAIT;AAIO,IAAMkE,OAAO;EAClBjC,MAAMnC;EACNqE,SAAS1B;EACT2B,KAAKjB;EACLkB,SAAST;EACTU,cAA4Bf;EAC5BgB,iBAAiBtB;EACjBuB,UAAUV;EACVW,YAAY7B;EACZ8B,UAAUpC;AACZ;",
6
- "names": ["useArrowNavigationGroup", "useFocusFinders", "useFocusableGroup", "createContext", "TabsPrimitive", "useControllableState", "React", "Activity", "forwardRef", "useCallback", "useLayoutEffect", "Button", "IconButton", "useForwardedRef", "useAttention", "ghostSelectedContainerMd", "mx", "TABS_NAME", "TabsContextProvider", "useTabsContext", "createContext", "activePart", "setActivePart", "orientation", "TabsRoot", "forwardRef", "children", "classNames", "propsActivePart", "onActivePartChange", "defaultActivePart", "value", "propsValue", "onValueChange", "defaultValue", "activationMode", "verticalVariant", "attendableId", "props", "forwardedRef", "tabsRoot", "useForwardedRef", "_1", "useArrowNavigationGroup", "_2", "useFocusableGroup", "useControllableState", "prop", "onChange", "defaultProp", "setValue", "handleValueChange", "useCallback", "nextValue", "findFirstFocusable", "useFocusFinders", "useLayoutEffect", "current", "focus", "Root", "data-active", "className", "mx", "ref", "TabsViewport", "div", "role", "TabsTablist", "List", "data-arrow-keys", "TabsBackButton", "onClick", "handleClick", "event", "Button", "TabsTabGroupHeading", "h2", "TabsTab", "contextValue", "hasAttention", "useAttention", "Trigger", "asChild", "density", "variant", "ghostSelectedContainerMd", "TabsIconTab", "IconButton", "TabsTabpanel", "Activity", "mode", "Content", "Tabs", "Tablist", "Tab", "IconTab", "TabPrimitive", "TabGroupHeading", "Tabpanel", "BackButton", "Viewport"]
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { useArrowNavigationGroup, useFocusFinders, useFocusableGroup } from '@fluentui/react-tabster';\nimport { createContext } from '@radix-ui/react-context';\nimport * as TabsPrimitive from '@radix-ui/react-tabs';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, {\n Activity,\n type ComponentPropsWithoutRef,\n type MouseEvent,\n forwardRef,\n useCallback,\n useLayoutEffect,\n} from 'react';\n\nimport {\n Button,\n type ButtonProps,\n IconButton,\n type IconButtonProps,\n type ThemedClassName,\n useForwardedRef,\n} from '@dxos/react-ui';\nimport { useAttention } from '@dxos/react-ui-attention';\nimport { mx } from '@dxos/ui-theme';\n\ntype TabsActivePart = 'list' | 'panel';\n\nconst TABS_NAME = 'Tabs';\n\ntype TabsContextValue = {\n activePart: TabsActivePart;\n setActivePart: (nextActivePart: TabsActivePart) => void;\n attendableId?: string;\n} & Pick<TabsPrimitive.TabsProps, 'orientation' | 'value'>;\n\nconst [TabsContextProvider, useTabsContext] = createContext<TabsContextValue>(TABS_NAME, {\n orientation: 'vertical',\n activePart: 'list',\n setActivePart: () => {},\n});\n\ntype TabsRootProps = ThemedClassName<TabsPrimitive.TabsProps> &\n Partial<\n Pick<TabsContextValue, 'activePart' | 'attendableId'> & {\n onActivePartChange: (nextActivePart: TabsActivePart) => void;\n defaultActivePart: TabsActivePart;\n }\n >;\n\nconst TabsRoot = forwardRef<HTMLDivElement, TabsRootProps>(\n (\n {\n children,\n classNames,\n activePart: propsActivePart,\n onActivePartChange,\n defaultActivePart,\n value: propsValue,\n onValueChange,\n defaultValue,\n orientation = 'vertical',\n activationMode = 'manual',\n attendableId,\n ...props\n },\n forwardedRef,\n ) => {\n // const tabsRoot = useRef<HTMLDivElement | null>(null);\n const tabsRoot = useForwardedRef(forwardedRef);\n\n // TODO(thure): Without these, we get Groupper/Mover `API used before initialization`, but why?\n const _1 = useArrowNavigationGroup();\n const _2 = useFocusableGroup();\n const [activePart = 'list', setActivePart] = useControllableState({\n prop: propsActivePart,\n onChange: onActivePartChange,\n defaultProp: defaultActivePart,\n });\n\n const [value, setValue] = useControllableState({\n prop: propsValue,\n onChange: onValueChange,\n defaultProp: defaultValue,\n });\n\n const handleValueChange = useCallback(\n (nextValue: string) => {\n setActivePart('panel');\n setValue(nextValue);\n },\n [value],\n );\n\n const { findFirstFocusable } = useFocusFinders();\n\n useLayoutEffect(() => {\n if (tabsRoot.current) {\n findFirstFocusable(tabsRoot.current)?.focus();\n }\n }, [activePart]);\n\n return (\n <TabsContextProvider\n orientation={orientation}\n activePart={activePart}\n setActivePart={setActivePart}\n value={value}\n attendableId={attendableId}\n >\n <TabsPrimitive.Root\n {...props}\n className={mx('overflow-hidden', classNames)}\n orientation={orientation}\n activationMode={activationMode}\n data-active={activePart}\n value={value}\n onValueChange={handleValueChange}\n ref={tabsRoot}\n >\n {children}\n </TabsPrimitive.Root>\n </TabsContextProvider>\n );\n },\n);\n\ntype TabsViewportProps = ThemedClassName<ComponentPropsWithoutRef<'div'>>;\n\nconst TabsViewport = ({ classNames, children, ...props }: TabsViewportProps) => {\n const { activePart } = useTabsContext('TabsViewport');\n return (\n <div {...props} data-active={activePart} className={mx(classNames)}>\n {children}\n </div>\n );\n};\n\ntype TabsTablistProps = ThemedClassName<TabsPrimitive.TabsListProps>;\n\nconst TabsTablist = ({ children, classNames, ...props }: TabsTablistProps) => {\n const { orientation } = useTabsContext('TabsTablist');\n return (\n <TabsPrimitive.List\n {...props}\n data-arrow-keys={orientation === 'vertical' ? 'up down' : 'left right'}\n className={mx(\n 'max-h-full w-full',\n // TODO(burdon): Should be embeddable inside Toolbar (if horizontal).\n orientation === 'vertical' ? 'overflow-y-auto' : 'flex p-1 gap-1 items-stretch justify-start overflow-x-auto',\n classNames,\n )}\n >\n {children}\n </TabsPrimitive.List>\n );\n};\n\nconst TabsBackButton = ({ onClick, classNames, ...props }: ButtonProps) => {\n const { setActivePart } = useTabsContext('TabsBackButton');\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n setActivePart('list');\n return onClick?.(event);\n },\n [setActivePart, onClick],\n );\n\n return <Button {...props} classNames={['@md:hidden text-start', classNames]} onClick={handleClick} />;\n};\n\ntype TabsTabGroupHeadingProps = ThemedClassName<ComponentPropsWithoutRef<'h2'>>;\n\nconst TabsTabGroupHeading = ({ children, classNames, ...props }: ThemedClassName<TabsTabGroupHeadingProps>) => {\n return (\n <h2 {...props} className={mx('my-1 px-2 text-sm text-un-accent', classNames)}>\n {children}\n </h2>\n );\n};\n\ntype TabsTabProps = ButtonProps & Pick<TabsPrimitive.TabsTriggerProps, 'value'>;\n\nconst TabsTab = ({ value, classNames, children, onClick, ...props }: TabsTabProps) => {\n const { setActivePart, orientation, value: contextValue, attendableId } = useTabsContext('TabsTab');\n const { hasAttention } = useAttention(attendableId);\n\n const handleClick = useCallback(\n // NOTE: This handler is only called if the tab is *already active*.\n (event: MouseEvent<HTMLButtonElement>) => {\n setActivePart('panel');\n onClick?.(event);\n },\n [setActivePart, onClick],\n );\n\n return (\n <TabsPrimitive.Trigger value={value} asChild>\n <Button\n {...props}\n variant={\n orientation === 'horizontal' && contextValue === value ? (hasAttention ? 'primary' : 'default') : 'ghost'\n }\n classNames={[\n orientation === 'vertical' && 'block justify-start text-start w-full',\n orientation === 'vertical' && 'dx-selected',\n classNames,\n ]}\n onClick={handleClick}\n >\n {children}\n </Button>\n </TabsPrimitive.Trigger>\n );\n};\n\ntype TabsIconTabProps = IconButtonProps & Pick<TabsPrimitive.TabsTriggerProps, 'value'>;\n\nconst TabsIconTab = ({ value, classNames, onClick, ...props }: TabsIconTabProps) => {\n const { setActivePart, orientation, value: contextValue, attendableId } = useTabsContext('TabsTab');\n const { hasAttention } = useAttention(attendableId);\n\n // NOTE: This handler is only called if the tab is *already active*.\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n setActivePart('panel');\n onClick?.(event);\n },\n [setActivePart, onClick],\n );\n\n return (\n <TabsPrimitive.Trigger value={value} asChild>\n <IconButton\n {...props}\n variant={\n orientation === 'horizontal' && contextValue === value ? (hasAttention ? 'primary' : 'default') : 'ghost'\n }\n classNames={[\n orientation === 'vertical' && 'justify-start text-start w-full',\n orientation === 'vertical' && 'dx-selected',\n classNames,\n ]}\n onClick={handleClick}\n />\n </TabsPrimitive.Trigger>\n );\n};\n\ntype TabsPanelProps = ThemedClassName<TabsPrimitive.TabsContentProps>;\n\nconst TabsPanel = ({ classNames, children, ...props }: TabsPanelProps) => {\n const { value: contextValue } = useTabsContext('TabsTab');\n return (\n <Activity mode={contextValue === props.value ? 'visible' : 'hidden'}>\n <TabsPrimitive.Content {...props} className={mx('p-0! dx-focus-ring-inset-over-all', classNames)}>\n {children}\n </TabsPrimitive.Content>\n </Activity>\n );\n};\n\ntype TabsTabPrimitiveProps = TabsPrimitive.TabsTriggerProps;\n\nexport const Tabs = {\n Root: TabsRoot,\n Tablist: TabsTablist,\n Tab: TabsTab,\n IconTab: TabsIconTab,\n TabPrimitive: TabsPrimitive.Trigger,\n TabGroupHeading: TabsTabGroupHeading,\n Panel: TabsPanel,\n BackButton: TabsBackButton,\n Viewport: TabsViewport,\n};\n\nexport type {\n TabsActivePart,\n TabsRootProps,\n TabsTablistProps,\n TabsTabProps,\n TabsTabPrimitiveProps,\n TabsTabGroupHeadingProps,\n TabsPanelProps,\n TabsViewportProps,\n};\n"],
5
+ "mappings": ";AAIA,SAASA,yBAAyBC,iBAAiBC,yBAAyB;AAC5E,SAASC,qBAAqB;AAC9B,YAAYC,mBAAmB;AAC/B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,YAAY;KACzD,sBAAA,cAAe4C,uBAAO;IAAE,GAAGtC;IAAOe,WAAWlC,GAAG,qCAAqCS,UAAAA;KAClFD,QAAAA,CAAAA;AAIT;AAIO,IAAMkD,OAAO;EAClBzB,MAAM1B;EACNoD,SAASpB;EACTqB,KAAKZ;EACLa,SAASP;EACTQ,cAA4BX;EAC5BY,iBAAiBjB;EACjBkB,OAAOT;EACPU,YAAYvB;EACZwB,UAAU7B;AACZ;",
6
+ "names": ["useArrowNavigationGroup", "useFocusFinders", "useFocusableGroup", "createContext", "TabsPrimitive", "useControllableState", "React", "Activity", "forwardRef", "useCallback", "useLayoutEffect", "Button", "IconButton", "useForwardedRef", "useAttention", "mx", "TABS_NAME", "TabsContextProvider", "useTabsContext", "orientation", "activePart", "setActivePart", "TabsRoot", "children", "classNames", "propsActivePart", "onActivePartChange", "defaultActivePart", "value", "propsValue", "onValueChange", "defaultValue", "activationMode", "attendableId", "props", "forwardedRef", "tabsRoot", "_1", "_2", "prop", "onChange", "defaultProp", "setValue", "handleValueChange", "nextValue", "findFirstFocusable", "current", "focus", "Root", "className", "data-active", "ref", "TabsViewport", "div", "TabsTablist", "List", "data-arrow-keys", "TabsBackButton", "onClick", "handleClick", "event", "TabsTabGroupHeading", "h2", "TabsTab", "contextValue", "hasAttention", "Trigger", "asChild", "variant", "TabsIconTab", "TabsPanel", "mode", "Content", "Tabs", "Tablist", "Tab", "IconTab", "TabPrimitive", "TabGroupHeading", "Panel", "BackButton", "Viewport"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/Tabs.tsx":{"bytes":27563,"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-tabs","kind":"import-statement","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":444,"imports":[{"path":"src/Tabs.tsx","kind":"import-statement","original":"./Tabs"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14979},"dist/lib/browser/index.mjs":{"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-tabs","kind":"import-statement","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"exports":["Tabs"],"entryPoint":"src/index.ts","inputs":{"src/Tabs.tsx":{"bytesInOutput":6861},"src/index.ts":{"bytesInOutput":0}},"bytes":6931}}}
1
+ {"inputs":{"src/Tabs.tsx":{"bytes":25015,"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-tabs","kind":"import-statement","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":368,"imports":[{"path":"src/Tabs.tsx","kind":"import-statement","original":"./Tabs"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":13455},"dist/lib/browser/index.mjs":{"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-tabs","kind":"import-statement","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"exports":["Tabs"],"entryPoint":"src/index.ts","inputs":{"src/Tabs.tsx":{"bytesInOutput":6152},"src/index.ts":{"bytesInOutput":0}},"bytes":6222}}}
@@ -8,15 +8,15 @@ import { useControllableState } from "@radix-ui/react-use-controllable-state";
8
8
  import React, { Activity, forwardRef, useCallback, useLayoutEffect } from "react";
9
9
  import { Button, IconButton, useForwardedRef } from "@dxos/react-ui";
10
10
  import { useAttention } from "@dxos/react-ui-attention";
11
- import { ghostSelectedContainerMd, mx } from "@dxos/ui-theme";
11
+ import { mx } from "@dxos/ui-theme";
12
12
  var TABS_NAME = "Tabs";
13
13
  var [TabsContextProvider, useTabsContext] = createContext(TABS_NAME, {
14
+ orientation: "vertical",
14
15
  activePart: "list",
15
16
  setActivePart: () => {
16
- },
17
- orientation: "vertical"
17
+ }
18
18
  });
19
- var TabsRoot = /* @__PURE__ */ forwardRef(({ children, classNames, activePart: propsActivePart, onActivePartChange, defaultActivePart, value: propsValue, onValueChange, defaultValue, orientation = "vertical", activationMode = "manual", verticalVariant = "stateful", attendableId, ...props }, forwardedRef) => {
19
+ var TabsRoot = /* @__PURE__ */ forwardRef(({ children, classNames, activePart: propsActivePart, onActivePartChange, defaultActivePart, value: propsValue, onValueChange, defaultValue, orientation = "vertical", activationMode = "manual", attendableId, ...props }, forwardedRef) => {
20
20
  const tabsRoot = useForwardedRef(forwardedRef);
21
21
  const _1 = useArrowNavigationGroup();
22
22
  const _2 = useFocusableGroup();
@@ -49,41 +49,35 @@ var TabsRoot = /* @__PURE__ */ forwardRef(({ children, classNames, activePart: p
49
49
  activePart,
50
50
  setActivePart,
51
51
  value,
52
- attendableId,
53
- verticalVariant
52
+ attendableId
54
53
  }, /* @__PURE__ */ React.createElement(TabsPrimitive.Root, {
54
+ ...props,
55
+ className: mx("overflow-hidden", classNames),
56
+ orientation,
55
57
  activationMode,
56
58
  "data-active": activePart,
57
- orientation,
58
- ...props,
59
59
  value,
60
60
  onValueChange: handleValueChange,
61
- className: mx("overflow-hidden", orientation === "vertical" && verticalVariant === "stateful" && "[&[data-active=list]_[role=tabpanel]]:invisible @md:[&[data-active=list]_[role=tabpanel]]:visible", classNames),
62
61
  ref: tabsRoot
63
62
  }, children));
64
63
  });
65
64
  var TabsViewport = ({ classNames, children, ...props }) => {
66
- const { orientation, activePart, verticalVariant } = useTabsContext("TabsViewport");
65
+ const { activePart } = useTabsContext("TabsViewport");
67
66
  return /* @__PURE__ */ React.createElement("div", {
68
- role: "none",
69
67
  ...props,
70
68
  "data-active": activePart,
71
- className: mx(orientation === "vertical" && verticalVariant === "stateful" && [
72
- "grid is-[200%] grid-cols-2 data-[active=panel]:mis-[-100%]",
73
- "@md:is-auto @md:data-[active=panel]:mis-0 @md:grid-cols-[minmax(min-content,1fr)_3fr] @md:gap-1"
74
- ], classNames)
69
+ className: mx(classNames)
75
70
  }, children);
76
71
  };
77
72
  var TabsTablist = ({ children, classNames, ...props }) => {
78
- const { orientation, verticalVariant } = useTabsContext("TabsTablist");
73
+ const { orientation } = useTabsContext("TabsTablist");
79
74
  return /* @__PURE__ */ React.createElement(TabsPrimitive.List, {
80
75
  ...props,
81
76
  "data-arrow-keys": orientation === "vertical" ? "up down" : "left right",
82
77
  className: mx(
83
- "max-bs-full is-full",
84
- // NOTE: Padding should be common to Toolbar.
85
- orientation === "vertical" ? "overflow-y-auto" : "flex items-stretch justify-start overflow-x-auto p-1 gap-1",
86
- orientation === "vertical" && verticalVariant === "stateful" && "place-self-start p-1",
78
+ "max-h-full w-full",
79
+ // TODO(burdon): Should be embeddable inside Toolbar (if horizontal).
80
+ orientation === "vertical" ? "overflow-y-auto" : "flex p-1 gap-1 items-stretch justify-start overflow-x-auto",
87
81
  classNames
88
82
  )
89
83
  }, children);
@@ -94,13 +88,13 @@ var TabsBackButton = ({ onClick, classNames, ...props }) => {
94
88
  setActivePart("list");
95
89
  return onClick?.(event);
96
90
  }, [
97
- onClick,
98
- setActivePart
91
+ setActivePart,
92
+ onClick
99
93
  ]);
100
94
  return /* @__PURE__ */ React.createElement(Button, {
101
95
  ...props,
102
96
  classNames: [
103
- "is-full text-start @md:hidden mbe-2",
97
+ "@md:hidden text-start",
104
98
  classNames
105
99
  ],
106
100
  onClick: handleClick
@@ -109,7 +103,7 @@ var TabsBackButton = ({ onClick, classNames, ...props }) => {
109
103
  var TabsTabGroupHeading = ({ children, classNames, ...props }) => {
110
104
  return /* @__PURE__ */ React.createElement("h2", {
111
105
  ...props,
112
- className: mx("mlb-1 pli-2 text-sm text-unAccent", classNames)
106
+ className: mx("my-1 px-2 text-sm text-un-accent", classNames)
113
107
  }, children);
114
108
  };
115
109
  var TabsTab = ({ value, classNames, children, onClick, ...props }) => {
@@ -130,15 +124,14 @@ var TabsTab = ({ value, classNames, children, onClick, ...props }) => {
130
124
  value,
131
125
  asChild: true
132
126
  }, /* @__PURE__ */ React.createElement(Button, {
133
- density: "fine",
134
- variant: orientation === "horizontal" && contextValue === value ? hasAttention ? "primary" : "default" : "ghost",
135
127
  ...props,
136
- onClick: handleClick,
128
+ variant: orientation === "horizontal" && contextValue === value ? hasAttention ? "primary" : "default" : "ghost",
137
129
  classNames: [
138
- orientation === "vertical" && "block justify-start text-start is-full",
139
- orientation === "vertical" && ghostSelectedContainerMd,
130
+ orientation === "vertical" && "block justify-start text-start w-full",
131
+ orientation === "vertical" && "dx-selected",
140
132
  classNames
141
- ]
133
+ ],
134
+ onClick: handleClick
142
135
  }, children));
143
136
  };
144
137
  var TabsIconTab = ({ value, classNames, onClick, ...props }) => {
@@ -155,24 +148,23 @@ var TabsIconTab = ({ value, classNames, onClick, ...props }) => {
155
148
  value,
156
149
  asChild: true
157
150
  }, /* @__PURE__ */ React.createElement(IconButton, {
158
- density: "fine",
159
- variant: orientation === "horizontal" && contextValue === value ? hasAttention ? "primary" : "default" : "ghost",
160
151
  ...props,
161
- onClick: handleClick,
152
+ variant: orientation === "horizontal" && contextValue === value ? hasAttention ? "primary" : "default" : "ghost",
162
153
  classNames: [
163
- orientation === "vertical" && "justify-start text-start is-full",
164
- orientation === "vertical" && ghostSelectedContainerMd,
154
+ orientation === "vertical" && "justify-start text-start w-full",
155
+ orientation === "vertical" && "dx-selected",
165
156
  classNames
166
- ]
157
+ ],
158
+ onClick: handleClick
167
159
  }));
168
160
  };
169
- var TabsTabpanel = ({ classNames, children, ...props }) => {
161
+ var TabsPanel = ({ classNames, children, ...props }) => {
170
162
  const { value: contextValue } = useTabsContext("TabsTab");
171
163
  return /* @__PURE__ */ React.createElement(Activity, {
172
164
  mode: contextValue === props.value ? "visible" : "hidden"
173
165
  }, /* @__PURE__ */ React.createElement(TabsPrimitive.Content, {
174
166
  ...props,
175
- className: mx("dx-focus-ring-inset-over-all", classNames)
167
+ className: mx("p-0! dx-focus-ring-inset-over-all", classNames)
176
168
  }, children));
177
169
  };
178
170
  var Tabs = {
@@ -182,7 +174,7 @@ var Tabs = {
182
174
  IconTab: TabsIconTab,
183
175
  TabPrimitive: TabsPrimitive.Trigger,
184
176
  TabGroupHeading: TabsTabGroupHeading,
185
- Tabpanel: TabsTabpanel,
177
+ Panel: TabsPanel,
186
178
  BackButton: TabsBackButton,
187
179
  Viewport: TabsViewport
188
180
  };