@fluentui/react-tabs 1.0.0-beta.99 → 9.0.0-beta.6

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.
Files changed (223) hide show
  1. package/CHANGELOG.json +51 -1912
  2. package/CHANGELOG.md +17 -763
  3. package/README.md +0 -17
  4. package/Spec.md +433 -0
  5. package/dist/react-tabs.d.ts +171 -137
  6. package/lib/Tab.d.ts +1 -0
  7. package/lib/Tab.js +2 -0
  8. package/lib/Tab.js.map +1 -0
  9. package/lib/TabList.d.ts +1 -0
  10. package/lib/TabList.js +2 -0
  11. package/lib/TabList.js.map +1 -0
  12. package/lib/components/Tab/Tab.d.ts +6 -0
  13. package/lib/components/Tab/Tab.js +15 -0
  14. package/lib/components/Tab/Tab.js.map +1 -0
  15. package/lib/components/Tab/Tab.types.d.ts +52 -0
  16. package/lib/components/Tab/Tab.types.js +2 -0
  17. package/lib/components/Tab/Tab.types.js.map +1 -0
  18. package/lib/components/Tab/index.d.ts +5 -0
  19. package/lib/components/Tab/index.js +6 -0
  20. package/lib/components/Tab/index.js.map +1 -0
  21. package/lib/components/Tab/renderTab.d.ts +5 -0
  22. package/lib/components/Tab/renderTab.js +18 -0
  23. package/lib/components/Tab/renderTab.js.map +1 -0
  24. package/lib/components/Tab/useTab.d.ts +12 -0
  25. package/lib/components/Tab/useTab.js +82 -0
  26. package/lib/components/Tab/useTab.js.map +1 -0
  27. package/lib/components/Tab/useTabStyles.d.ts +6 -0
  28. package/lib/components/Tab/useTabStyles.js +205 -0
  29. package/lib/components/Tab/useTabStyles.js.map +1 -0
  30. package/lib/components/TabList/TabList.d.ts +6 -0
  31. package/lib/components/TabList/TabList.js +17 -0
  32. package/lib/components/TabList/TabList.js.map +1 -0
  33. package/lib/components/TabList/TabList.types.d.ts +99 -0
  34. package/lib/components/TabList/TabList.types.js +2 -0
  35. package/lib/components/TabList/TabList.types.js.map +1 -0
  36. package/lib/components/TabList/TabListContext.d.ts +3 -0
  37. package/lib/components/TabList/TabListContext.js +17 -0
  38. package/lib/components/TabList/TabListContext.js.map +1 -0
  39. package/lib/components/TabList/index.d.ts +5 -0
  40. package/lib/components/TabList/index.js +6 -0
  41. package/lib/components/TabList/index.js.map +1 -0
  42. package/lib/components/TabList/renderTabList.d.ts +5 -0
  43. package/lib/components/TabList/renderTabList.js +19 -0
  44. package/lib/components/TabList/renderTabList.js.map +1 -0
  45. package/lib/components/TabList/useTabList.d.ts +12 -0
  46. package/lib/components/TabList/useTabList.js +106 -0
  47. package/lib/components/TabList/useTabList.js.map +1 -0
  48. package/lib/components/TabList/useTabListContextValues.d.ts +2 -0
  49. package/lib/components/TabList/useTabListContextValues.js +24 -0
  50. package/lib/components/TabList/useTabListContextValues.js.map +1 -0
  51. package/lib/components/TabList/useTabListStyles.d.ts +9 -0
  52. package/lib/components/TabList/useTabListStyles.js +118 -0
  53. package/lib/components/TabList/useTabListStyles.js.map +1 -0
  54. package/lib/index.d.ts +2 -1
  55. package/lib/index.js +2 -1
  56. package/lib/index.js.map +1 -1
  57. package/lib/tab.constants.d.ts +15 -0
  58. package/lib/tab.constants.js +17 -0
  59. package/lib/tab.constants.js.map +1 -0
  60. package/lib/tsdoc-metadata.json +1 -1
  61. package/lib-commonjs/Tab.d.ts +1 -0
  62. package/lib-commonjs/Tab.js +10 -0
  63. package/lib-commonjs/Tab.js.map +1 -0
  64. package/lib-commonjs/TabList.d.ts +1 -0
  65. package/lib-commonjs/TabList.js +10 -0
  66. package/lib-commonjs/TabList.js.map +1 -0
  67. package/lib-commonjs/components/Tab/Tab.d.ts +6 -0
  68. package/lib-commonjs/components/Tab/Tab.js +26 -0
  69. package/lib-commonjs/components/Tab/Tab.js.map +1 -0
  70. package/lib-commonjs/components/Tab/Tab.types.d.ts +52 -0
  71. package/lib-commonjs/components/Tab/Tab.types.js +6 -0
  72. package/lib-commonjs/components/Tab/Tab.types.js.map +1 -0
  73. package/lib-commonjs/components/Tab/index.d.ts +5 -0
  74. package/lib-commonjs/components/Tab/index.js +18 -0
  75. package/lib-commonjs/components/Tab/index.js.map +1 -0
  76. package/lib-commonjs/components/Tab/renderTab.d.ts +5 -0
  77. package/lib-commonjs/components/Tab/renderTab.js +29 -0
  78. package/lib-commonjs/components/Tab/renderTab.js.map +1 -0
  79. package/lib-commonjs/components/Tab/useTab.d.ts +12 -0
  80. package/lib-commonjs/components/Tab/useTab.js +95 -0
  81. package/lib-commonjs/components/Tab/useTab.js.map +1 -0
  82. package/lib-commonjs/components/Tab/useTabStyles.d.ts +6 -0
  83. package/lib-commonjs/components/Tab/useTabStyles.js +218 -0
  84. package/lib-commonjs/components/Tab/useTabStyles.js.map +1 -0
  85. package/lib-commonjs/components/TabList/TabList.d.ts +6 -0
  86. package/lib-commonjs/components/TabList/TabList.js +29 -0
  87. package/lib-commonjs/components/TabList/TabList.js.map +1 -0
  88. package/lib-commonjs/components/TabList/TabList.types.d.ts +99 -0
  89. package/lib-commonjs/components/TabList/TabList.types.js +6 -0
  90. package/lib-commonjs/components/TabList/TabList.types.js.map +1 -0
  91. package/lib-commonjs/components/TabList/TabListContext.d.ts +3 -0
  92. package/lib-commonjs/components/TabList/TabListContext.js +25 -0
  93. package/lib-commonjs/components/TabList/TabListContext.js.map +1 -0
  94. package/lib-commonjs/components/TabList/index.d.ts +5 -0
  95. package/lib-commonjs/components/TabList/index.js +18 -0
  96. package/lib-commonjs/components/TabList/index.js.map +1 -0
  97. package/lib-commonjs/components/TabList/renderTabList.d.ts +5 -0
  98. package/lib-commonjs/components/TabList/renderTabList.js +31 -0
  99. package/lib-commonjs/components/TabList/renderTabList.js.map +1 -0
  100. package/lib-commonjs/components/TabList/useTabList.d.ts +12 -0
  101. package/lib-commonjs/components/TabList/useTabList.js +118 -0
  102. package/lib-commonjs/components/TabList/useTabList.js.map +1 -0
  103. package/lib-commonjs/components/TabList/useTabListContextValues.d.ts +2 -0
  104. package/lib-commonjs/components/TabList/useTabListContextValues.js +33 -0
  105. package/lib-commonjs/components/TabList/useTabListContextValues.js.map +1 -0
  106. package/lib-commonjs/components/TabList/useTabListStyles.d.ts +9 -0
  107. package/lib-commonjs/components/TabList/useTabListStyles.js +131 -0
  108. package/lib-commonjs/components/TabList/useTabListStyles.js.map +1 -0
  109. package/lib-commonjs/index.d.ts +2 -1
  110. package/lib-commonjs/index.js +10 -3
  111. package/lib-commonjs/index.js.map +1 -1
  112. package/lib-commonjs/tab.constants.d.ts +15 -0
  113. package/lib-commonjs/tab.constants.js +23 -0
  114. package/lib-commonjs/tab.constants.js.map +1 -0
  115. package/package.json +18 -13
  116. package/config/api-extractor.json +0 -3
  117. package/config/tests.js +0 -14
  118. package/etc/react-tabs.api.md +0 -104
  119. package/just.config.ts +0 -3
  120. package/lib/Tabs.d.ts +0 -1
  121. package/lib/Tabs.js +0 -2
  122. package/lib/Tabs.js.map +0 -1
  123. package/lib/common/isConformant.d.ts +0 -4
  124. package/lib/common/isConformant.js +0 -9
  125. package/lib/common/isConformant.js.map +0 -1
  126. package/lib/components/Tabs/TabItem.d.ts +0 -6
  127. package/lib/components/Tabs/TabItem.js +0 -18
  128. package/lib/components/Tabs/TabItem.js.map +0 -1
  129. package/lib/components/Tabs/TabItem.types.d.ts +0 -61
  130. package/lib/components/Tabs/TabItem.types.js +0 -2
  131. package/lib/components/Tabs/TabItem.types.js.map +0 -1
  132. package/lib/components/Tabs/Tabs.base.d.ts +0 -3
  133. package/lib/components/Tabs/Tabs.base.js +0 -179
  134. package/lib/components/Tabs/Tabs.base.js.map +0 -1
  135. package/lib/components/Tabs/Tabs.d.ts +0 -8
  136. package/lib/components/Tabs/Tabs.js +0 -12
  137. package/lib/components/Tabs/Tabs.js.map +0 -1
  138. package/lib/components/Tabs/Tabs.styles.d.ts +0 -2
  139. package/lib/components/Tabs/Tabs.styles.js +0 -264
  140. package/lib/components/Tabs/Tabs.styles.js.map +0 -1
  141. package/lib/components/Tabs/Tabs.types.d.ts +0 -113
  142. package/lib/components/Tabs/Tabs.types.js +0 -2
  143. package/lib/components/Tabs/Tabs.types.js.map +0 -1
  144. package/lib/components/Tabs/index.d.ts +0 -5
  145. package/lib/components/Tabs/index.js +0 -6
  146. package/lib/components/Tabs/index.js.map +0 -1
  147. package/lib/utilities/observeResize.d.ts +0 -21
  148. package/lib/utilities/observeResize.js +0 -46
  149. package/lib/utilities/observeResize.js.map +0 -1
  150. package/lib/utilities/useOverflow.d.ts +0 -45
  151. package/lib/utilities/useOverflow.js +0 -126
  152. package/lib/utilities/useOverflow.js.map +0 -1
  153. package/lib-amd/Tabs.d.ts +0 -1
  154. package/lib-amd/Tabs.js +0 -6
  155. package/lib-amd/Tabs.js.map +0 -1
  156. package/lib-amd/common/isConformant.d.ts +0 -4
  157. package/lib-amd/common/isConformant.js +0 -14
  158. package/lib-amd/common/isConformant.js.map +0 -1
  159. package/lib-amd/components/Tabs/TabItem.d.ts +0 -6
  160. package/lib-amd/components/Tabs/TabItem.js +0 -20
  161. package/lib-amd/components/Tabs/TabItem.js.map +0 -1
  162. package/lib-amd/components/Tabs/TabItem.types.d.ts +0 -61
  163. package/lib-amd/components/Tabs/TabItem.types.js +0 -5
  164. package/lib-amd/components/Tabs/TabItem.types.js.map +0 -1
  165. package/lib-amd/components/Tabs/Tabs.base.d.ts +0 -3
  166. package/lib-amd/components/Tabs/Tabs.base.js +0 -176
  167. package/lib-amd/components/Tabs/Tabs.base.js.map +0 -1
  168. package/lib-amd/components/Tabs/Tabs.d.ts +0 -8
  169. package/lib-amd/components/Tabs/Tabs.js +0 -14
  170. package/lib-amd/components/Tabs/Tabs.js.map +0 -1
  171. package/lib-amd/components/Tabs/Tabs.styles.d.ts +0 -2
  172. package/lib-amd/components/Tabs/Tabs.styles.js +0 -267
  173. package/lib-amd/components/Tabs/Tabs.styles.js.map +0 -1
  174. package/lib-amd/components/Tabs/Tabs.types.d.ts +0 -113
  175. package/lib-amd/components/Tabs/Tabs.types.js +0 -5
  176. package/lib-amd/components/Tabs/Tabs.types.js.map +0 -1
  177. package/lib-amd/components/Tabs/index.d.ts +0 -5
  178. package/lib-amd/components/Tabs/index.js +0 -11
  179. package/lib-amd/components/Tabs/index.js.map +0 -1
  180. package/lib-amd/index.d.ts +0 -1
  181. package/lib-amd/index.js +0 -6
  182. package/lib-amd/index.js.map +0 -1
  183. package/lib-amd/utilities/observeResize.d.ts +0 -21
  184. package/lib-amd/utilities/observeResize.js +0 -51
  185. package/lib-amd/utilities/observeResize.js.map +0 -1
  186. package/lib-amd/utilities/useOverflow.d.ts +0 -45
  187. package/lib-amd/utilities/useOverflow.js +0 -128
  188. package/lib-amd/utilities/useOverflow.js.map +0 -1
  189. package/lib-commonjs/Tabs.d.ts +0 -1
  190. package/lib-commonjs/Tabs.js +0 -5
  191. package/lib-commonjs/Tabs.js.map +0 -1
  192. package/lib-commonjs/common/isConformant.d.ts +0 -4
  193. package/lib-commonjs/common/isConformant.js +0 -13
  194. package/lib-commonjs/common/isConformant.js.map +0 -1
  195. package/lib-commonjs/components/Tabs/TabItem.d.ts +0 -6
  196. package/lib-commonjs/components/Tabs/TabItem.js +0 -21
  197. package/lib-commonjs/components/Tabs/TabItem.js.map +0 -1
  198. package/lib-commonjs/components/Tabs/TabItem.types.d.ts +0 -61
  199. package/lib-commonjs/components/Tabs/TabItem.types.js +0 -3
  200. package/lib-commonjs/components/Tabs/TabItem.types.js.map +0 -1
  201. package/lib-commonjs/components/Tabs/Tabs.base.d.ts +0 -3
  202. package/lib-commonjs/components/Tabs/Tabs.base.js +0 -182
  203. package/lib-commonjs/components/Tabs/Tabs.base.js.map +0 -1
  204. package/lib-commonjs/components/Tabs/Tabs.d.ts +0 -8
  205. package/lib-commonjs/components/Tabs/Tabs.js +0 -15
  206. package/lib-commonjs/components/Tabs/Tabs.js.map +0 -1
  207. package/lib-commonjs/components/Tabs/Tabs.styles.d.ts +0 -2
  208. package/lib-commonjs/components/Tabs/Tabs.styles.js +0 -268
  209. package/lib-commonjs/components/Tabs/Tabs.styles.js.map +0 -1
  210. package/lib-commonjs/components/Tabs/Tabs.types.d.ts +0 -113
  211. package/lib-commonjs/components/Tabs/Tabs.types.js +0 -3
  212. package/lib-commonjs/components/Tabs/Tabs.types.js.map +0 -1
  213. package/lib-commonjs/components/Tabs/index.d.ts +0 -5
  214. package/lib-commonjs/components/Tabs/index.js +0 -11
  215. package/lib-commonjs/components/Tabs/index.js.map +0 -1
  216. package/lib-commonjs/utilities/observeResize.d.ts +0 -21
  217. package/lib-commonjs/utilities/observeResize.js +0 -50
  218. package/lib-commonjs/utilities/observeResize.js.map +0 -1
  219. package/lib-commonjs/utilities/useOverflow.d.ts +0 -45
  220. package/lib-commonjs/utilities/useOverflow.js +0 -130
  221. package/lib-commonjs/utilities/useOverflow.js.map +0 -1
  222. package/src/components/Tabs/TabItem.types.ts +0 -69
  223. package/src/components/Tabs/Tabs.types.ts +0 -131
@@ -1,197 +1,231 @@
1
- import { IButtonProps } from '@fluentui/react/lib/Button';
2
- import { IKeytipProps } from '@fluentui/react';
3
- import { IRefObject } from '@fluentui/utilities';
4
- import { IRenderFunction } from '@fluentui/utilities';
5
- import { IStyle } from '@fluentui/style-utilities';
6
- import { IStyleFunctionOrObject } from '@fluentui/utilities';
7
- import { ITheme } from '@fluentui/style-utilities';
1
+ import type { ComponentProps } from '@fluentui/react-utilities';
2
+ import type { ComponentState } from '@fluentui/react-utilities';
3
+ import type { ForwardRefComponent } from '@fluentui/react-utilities';
8
4
  import * as React_2 from 'react';
5
+ import type { Slot } from '@fluentui/react-utilities';
6
+
7
+ export declare const indicatorLengthVar = "--selection-indicator-length";
8
+
9
+ export declare const indicatorOffsetVar = "--selection-indicator-offset";
10
+
11
+ export declare type RegisterTabData = {
12
+ /**
13
+ * The value of the selected tab.
14
+ */
15
+ value: TabValue;
16
+ ref: React_2.RefObject<HTMLElement>;
17
+ };
18
+
19
+ export declare type RegisterTabEventHandler = (data: RegisterTabData) => void;
9
20
 
10
21
  /**
11
- * {@docCategory Tabs}
12
- * Display mode for the tabs
22
+ * Render the final JSX of Tab
13
23
  */
14
- export declare type TabFormatType = 'links' | 'tabs';
15
-
16
- export declare class TabItem extends React_2.Component<TabItemProps, {}> {
17
- constructor(props: TabItemProps);
18
- render(): JSX.Element;
19
- }
24
+ export declare const renderTab_unstable: (state: TabState) => JSX.Element;
20
25
 
21
26
  /**
22
- * {@docCategory Tabs}
27
+ * Render the final JSX of TabList
23
28
  */
24
- export declare interface TabItemProps extends React_2.HTMLAttributes<HTMLDivElement> {
25
- /**
26
- * Gets the component ref.
27
- */
28
- componentRef?: IRefObject<{}>;
29
+ export declare const renderTabList_unstable: (state: TabListState, contextValues: TabListContextValues) => JSX.Element;
30
+
31
+ export declare type SelectTabData = {
29
32
  /**
30
- * The text displayed of each tab.
33
+ * The value of the selected tab.
31
34
  */
32
- headerText?: string;
35
+ value: TabValue;
36
+ };
37
+
38
+ export declare type SelectTabEvent<E = HTMLElement> = React_2.MouseEvent<E> | React_2.KeyboardEvent<E>;
39
+
40
+ export declare type SelectTabEventHandler = (event: SelectTabEvent, data: SelectTabData) => void;
41
+
42
+ /**
43
+ * A tab provides a selectable item in a tab list.
44
+ */
45
+ export declare const Tab: ForwardRefComponent<TabProps>;
46
+
47
+ export declare const tabClassName = "fui-Tab";
48
+
49
+ declare type TabCommons = {
33
50
  /**
34
- * Props for the header command button. This provides a way to pass in native props, such as data-* and aria-*,
35
- * for each tab element.
51
+ * The value that identifies this tab when selected.
36
52
  */
37
- headerButtonProps?: IButtonProps | {
38
- [key: string]: string | number | boolean;
39
- };
53
+ value: TabValue;
54
+ };
55
+
56
+ /**
57
+ * A bounding rectangle of a tab
58
+ */
59
+ export declare type TabContentRect = {
60
+ x: number;
61
+ y: number;
62
+ width: number;
63
+ height: number;
64
+ };
65
+
66
+ /**
67
+ * A tab list provides single selection from a set of tabs.
68
+ */
69
+ export declare const TabList: ForwardRefComponent<TabListProps>;
70
+
71
+ export declare const tabListClassName = "fui-TabList";
72
+
73
+ declare type TabListCommons = {
40
74
  /**
41
- * An required key to uniquely identify a tab item.
42
- *
43
- * Note: The 'key' from react props cannot be used inside component.
75
+ * A tab list can supports 'transparent' and 'subtle' appearance.
76
+ *- 'subtle': Minimizes emphasis to blend into the background until hovered or focused.
77
+ *- 'transparent': No background and border styling
78
+ * The appearance affects each of the contained tabs.
79
+ * @default 'transparent'
44
80
  */
45
- itemKey?: string;
81
+ appearance?: 'transparent' | 'subtle';
46
82
  /**
47
- * The aria label of each tab which will read by screen reader instead of headerText.
48
- *
49
- * Note that unless you have compelling requirements you should not override aria-label.
83
+ * Raised when a tab is selected.
50
84
  */
51
- ariaLabel?: string;
85
+ onTabSelect?: SelectTabEventHandler;
52
86
  /**
53
- * Defines an optional item count displayed in parentheses just after the `headerText`.
54
- *
55
- * Examples: completed (4), Unread (99+)
87
+ * The value of the currently selected tab.
56
88
  */
57
- itemCount?: number | string;
89
+ selectedValue?: TabValue;
58
90
  /**
59
- * An optional icon to show next to the tab.
91
+ * A tab list can be either 'small' or 'medium' size.
92
+ * The size affects each of the contained tabs.
93
+ * @default 'medium'
60
94
  */
61
- itemIcon?: string;
95
+ size?: 'small' | 'medium';
62
96
  /**
63
- * Optional custom renderer for the tab
97
+ * A tab list can arrange its tabs vertically.
98
+ * @default false
64
99
  */
65
- onRenderTab?: IRenderFunction<TabItemProps>;
100
+ vertical?: boolean;
101
+ };
102
+
103
+ export declare type TabListContextValue = Pick<TabListCommons, 'onTabSelect' | 'selectedValue'> & Required<Pick<TabListCommons, 'appearance' | 'size' | 'vertical'>> & {
104
+ /** A callback to allow a tab to register itself with the tab list. */
105
+ onRegister: RegisterTabEventHandler;
106
+ /** A callback to allow a tab to unregister itself with the tab list. */
107
+ onUnregister: RegisterTabEventHandler;
66
108
  /**
67
- * Optional keytip for this TabItem
109
+ * A callback to allow a tab to select itself when pressed.
68
110
  */
69
- keytipProps?: IKeytipProps;
111
+ onSelect: SelectTabEventHandler;
112
+ };
113
+
114
+ /**
115
+ * Context values used in rendering TabList.
116
+ */
117
+ export declare type TabListContextValues = {
70
118
  /**
71
- * Defines whether to always render the tab item (regardless of whether it is selected or not).
72
- * Useful if you're rendering content that is expensive to mount.
73
- *
74
- * @defaultvalue false
119
+ * The context of the tab list available to each tab.
75
120
  */
76
- alwaysRender?: boolean;
77
- }
121
+ tabList: TabListContextValue;
122
+ };
78
123
 
79
124
  /**
80
- * The Tabs control and related tabs pattern are used for navigating frequently accessed,
81
- * distinct content categories. Tabs allow for navigation between two or more content
82
- * views and relies on text headers to articulate the different sections of content.
125
+ * TabList Props
83
126
  */
84
- export declare const Tabs: React_2.FunctionComponent<TabsProps>;
127
+ export declare type TabListProps = ComponentProps<TabListSlots> & TabListCommons & {
128
+ /**
129
+ * The value of the tab to be selected by default.
130
+ * Typically useful when the selectedValue is uncontrolled.
131
+ */
132
+ defaultSelectedValue?: TabValue;
133
+ };
85
134
 
86
- export declare const TabsBase: React_2.FunctionComponent<TabsProps>;
135
+ export declare const tabListSelectionIndicatorName = "fui-TabList_SelectionIndicator";
87
136
 
88
- /**
89
- * {@docCategory Tabs}
90
- */
91
- export declare interface TabsImperativeHandle {
137
+ export declare type TabListSlots = {
92
138
  /**
93
- * Sets focus to the first tab.
139
+ * The slot associated with the root element of this tab list.
94
140
  */
95
- focus(): void;
96
- }
141
+ root: Slot<'div'>;
142
+ };
97
143
 
98
144
  /**
99
- * {@docCategory Tabs}
100
- * Size of the tabs
145
+ * State used in rendering TabList.
101
146
  */
102
- export declare type TabSizeType = 'normal' | 'large';
147
+ export declare type TabListState = ComponentState<Required<TabListSlots>> & TabListContextValue & {
148
+ selectedTabRect?: TabContentRect;
149
+ };
103
150
 
104
151
  /**
105
- * {@docCategory Tabs}
152
+ * Tab Props
106
153
  */
107
- export declare interface TabsProps extends React_2.HTMLAttributes<HTMLDivElement>, React_2.RefAttributes<HTMLDivElement> {
108
- /**
109
- * Optional callback to access the TabsImperativeHandle interface. Use this instead of ref for accessing
110
- * the public methods and properties of the component.
111
- */
112
- componentRef?: React_2.RefObject<TabsImperativeHandle>;
113
- /**
114
- * Call to provide customized styling that will layer on top of the variant rules.
115
- */
116
- styles?: IStyleFunctionOrObject<TabsStyleProps, TabsStyles>;
117
- /**
118
- * Theme provided by High-Order Component.
119
- */
120
- theme?: ITheme;
121
- /**
122
- * Additional css class to apply to the Tabs
123
- * @defaultvalue undefined
124
- */
125
- className?: string;
126
- /**
127
- * Default selected TabItem key. Only provide this if the Tabs is an uncontrolled component;
128
- * otherwise, use the `selectedKey` property.
129
- */
130
- defaultSelectedKey?: string;
154
+ export declare type TabProps = ComponentProps<Partial<TabSlots>> & TabCommons;
155
+
156
+ export declare type TabSlots = {
131
157
  /**
132
- * Key of the selected tab item. Updating this will override the selected tab state.
133
- * Only provide this if the Tabs is a controlled component where you are maintaining the
134
- * current state; otherwise, use `defaultSelectedKey`.
158
+ * Root of the component.
135
159
  */
136
- selectedKey?: string | null;
160
+ root: Slot<'div'>;
137
161
  /**
138
- * Callback for when the selected tab item is changed.
162
+ * Icon that renders before the content.
139
163
  */
140
- onTabClick?: (item?: TabItem, ev?: React_2.MouseEvent<HTMLElement>) => void;
164
+ icon?: Slot<'span'>;
141
165
  /**
142
- * Tab size (normal, large)
166
+ * Component children are placed in this slot
167
+ * Avoid using the `children` property in this slot in favour of Component children whenever possible.
143
168
  */
144
- tabSize?: TabSizeType;
169
+ content: NonNullable<Slot<'span'>>;
170
+ };
171
+
172
+ /**
173
+ * State used in rendering Tab
174
+ */
175
+ export declare type TabState = ComponentState<TabSlots> & TabCommons & {
145
176
  /**
146
- * Tab format (links, tabs)
177
+ * A tab supports 'transparent' and 'subtle' appearance.
147
178
  */
148
- tabFormat?: TabFormatType;
179
+ appearance?: string;
149
180
  /**
150
- * Overflow behavior when there is not enough room to display all of the tabs
151
- * * none: Tabs will overflow the container and may not be visible
152
- * * menu: Display an overflow menu that contains the tabs that don't fit
153
- *
154
- * @default none
181
+ * If this tab is selected.
155
182
  */
156
- overflowBehavior?: 'none' | 'menu';
183
+ selected?: boolean;
157
184
  /**
158
- * Whether to skip rendering the tabpanel with the content of the selected tab.
159
- * Use this prop if you plan to separately render the tab content
160
- * and don't want to leave an empty tabpanel in the page that may confuse Screen Readers.
185
+ * A tab can be either 'small' or 'medium' size.
161
186
  */
162
- headersOnly?: boolean;
187
+ size: 'small' | 'medium';
163
188
  /**
164
- * Callback to customize how IDs are generated for each tab header.
165
- * Useful if you're rendering content outside and need to connect aria-labelledby.
189
+ * A tab can arrange its content based on if the tabs in the list are arranged vertically.
166
190
  */
167
- getTabId?: (itemKey: string, index: number) => string;
168
- }
191
+ vertical: boolean;
192
+ };
169
193
 
170
194
  /**
171
- * {@docCategory Tabs}
195
+ * Any value that identifies a specific tab.
172
196
  */
173
- export declare type TabsStyleProps = Required<Pick<TabsProps, 'theme'>> & Pick<TabsProps, 'className'> & {
174
- tabSize?: TabSizeType;
175
- tabFormat?: TabFormatType;
176
- };
197
+ export declare type TabValue = unknown;
198
+
199
+ /**
200
+ * Create the state required to render Tab.
201
+ *
202
+ * The returned state can be modified with hooks such as useTabStyles_unstable,
203
+ * before being passed to renderTab_unstable.
204
+ *
205
+ * @param props - props from this instance of Tab
206
+ * @param ref - reference to root HTMLElement of Tab
207
+ */
208
+ export declare const useTab_unstable: (props: TabProps, ref: React_2.Ref<HTMLElement>) => TabState;
209
+
210
+ /**
211
+ * Create the state required to render TabList.
212
+ *
213
+ * The returned state can be modified with hooks such as useTabListStyles_unstable,
214
+ * before being passed to renderTabList_unstable.
215
+ *
216
+ * @param props - props from this instance of TabList
217
+ * @param ref - reference to root HTMLElement of TabList
218
+ */
219
+ export declare const useTabList_unstable: (props: TabListProps, ref: React_2.Ref<HTMLElement>) => TabListState;
220
+
221
+ /**
222
+ * Apply styling to the TabList slots based on the state
223
+ */
224
+ export declare const useTabListStyles_unstable: (state: TabListState) => TabListState;
177
225
 
178
226
  /**
179
- * {@docCategory Tabs}
227
+ * Apply styling to the Tab slots based on the state
180
228
  */
181
- export declare interface TabsStyles {
182
- /**
183
- * Style for the root element.
184
- */
185
- root: IStyle;
186
- tab: IStyle;
187
- tabIsSelected: IStyle;
188
- tabContent: IStyle;
189
- text: IStyle;
190
- count: IStyle;
191
- icon: IStyle;
192
- tabInMenu: IStyle;
193
- overflowMenuButton: IStyle;
194
- itemContainer?: IStyle;
195
- }
229
+ export declare const useTabStyles_unstable: (state: TabState) => TabState;
196
230
 
197
231
  export { }
package/lib/Tab.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './components/Tab/index';
package/lib/Tab.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './components/Tab/index';
2
+ //# sourceMappingURL=Tab.js.map
package/lib/Tab.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tab.js","sourceRoot":"../src/","sources":["Tab.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC","sourcesContent":["export * from './components/Tab/index';\n"]}
@@ -0,0 +1 @@
1
+ export * from './components/TabList/index';
package/lib/TabList.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './components/TabList/index';
2
+ //# sourceMappingURL=TabList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabList.js","sourceRoot":"../src/","sources":["TabList.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC","sourcesContent":["export * from './components/TabList/index';\n"]}
@@ -0,0 +1,6 @@
1
+ import type { TabProps } from './Tab.types';
2
+ import type { ForwardRefComponent } from '@fluentui/react-utilities';
3
+ /**
4
+ * A tab provides a selectable item in a tab list.
5
+ */
6
+ export declare const Tab: ForwardRefComponent<TabProps>;
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import { useTab_unstable } from './useTab';
3
+ import { renderTab_unstable } from './renderTab';
4
+ import { useTabStyles_unstable } from './useTabStyles';
5
+ /**
6
+ * A tab provides a selectable item in a tab list.
7
+ */
8
+
9
+ export const Tab = /*#__PURE__*/React.forwardRef((props, ref) => {
10
+ const state = useTab_unstable(props, ref);
11
+ useTabStyles_unstable(state);
12
+ return renderTab_unstable(state);
13
+ });
14
+ Tab.displayName = 'Tab';
15
+ //# sourceMappingURL=Tab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Tab/Tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,eAAT,QAAgC,UAAhC;AACA,SAAS,kBAAT,QAAmC,aAAnC;AACA,SAAS,qBAAT,QAAsC,gBAAtC;AAIA;;AAEG;;AACH,OAAO,MAAM,GAAG,gBAAkC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAChF,QAAM,KAAK,GAAG,eAAe,CAAC,KAAD,EAAQ,GAAR,CAA7B;AAEA,EAAA,qBAAqB,CAAC,KAAD,CAArB;AACA,SAAO,kBAAkB,CAAC,KAAD,CAAzB;AACD,CALiD,CAA3C;AAOP,GAAG,CAAC,WAAJ,GAAkB,KAAlB","sourcesContent":["import * as React from 'react';\nimport { useTab_unstable } from './useTab';\nimport { renderTab_unstable } from './renderTab';\nimport { useTabStyles_unstable } from './useTabStyles';\nimport type { TabProps } from './Tab.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * A tab provides a selectable item in a tab list.\n */\nexport const Tab: ForwardRefComponent<TabProps> = React.forwardRef((props, ref) => {\n const state = useTab_unstable(props, ref);\n\n useTabStyles_unstable(state);\n return renderTab_unstable(state);\n});\n\nTab.displayName = 'Tab';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,52 @@
1
+ import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
2
+ /**
3
+ * Any value that identifies a specific tab.
4
+ */
5
+ export declare type TabValue = unknown;
6
+ export declare type TabSlots = {
7
+ /**
8
+ * Root of the component.
9
+ */
10
+ root: Slot<'div'>;
11
+ /**
12
+ * Icon that renders before the content.
13
+ */
14
+ icon?: Slot<'span'>;
15
+ /**
16
+ * Component children are placed in this slot
17
+ * Avoid using the `children` property in this slot in favour of Component children whenever possible.
18
+ */
19
+ content: NonNullable<Slot<'span'>>;
20
+ };
21
+ declare type TabCommons = {
22
+ /**
23
+ * The value that identifies this tab when selected.
24
+ */
25
+ value: TabValue;
26
+ };
27
+ /**
28
+ * Tab Props
29
+ */
30
+ export declare type TabProps = ComponentProps<Partial<TabSlots>> & TabCommons;
31
+ /**
32
+ * State used in rendering Tab
33
+ */
34
+ export declare type TabState = ComponentState<TabSlots> & TabCommons & {
35
+ /**
36
+ * A tab supports 'transparent' and 'subtle' appearance.
37
+ */
38
+ appearance?: string;
39
+ /**
40
+ * If this tab is selected.
41
+ */
42
+ selected?: boolean;
43
+ /**
44
+ * A tab can be either 'small' or 'medium' size.
45
+ */
46
+ size: 'small' | 'medium';
47
+ /**
48
+ * A tab can arrange its content based on if the tabs in the list are arranged vertically.
49
+ */
50
+ vertical: boolean;
51
+ };
52
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Tab.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tab.types.js","sourceRoot":"../src/","sources":["components/Tab/Tab.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\n/**\n * Any value that identifies a specific tab.\n */\nexport type TabValue = unknown;\n\nexport type TabSlots = {\n /**\n * Root of the component.\n */\n root: Slot<'div'>;\n\n /**\n * Icon that renders before the content.\n */\n icon?: Slot<'span'>;\n\n /**\n * Component children are placed in this slot\n * Avoid using the `children` property in this slot in favour of Component children whenever possible.\n */\n content: NonNullable<Slot<'span'>>;\n};\n\ntype TabCommons = {\n /**\n * The value that identifies this tab when selected.\n */\n value: TabValue;\n};\n\n/**\n * Tab Props\n */\nexport type TabProps = ComponentProps<Partial<TabSlots>> & TabCommons;\n\n/**\n * State used in rendering Tab\n */\nexport type TabState = ComponentState<TabSlots> &\n TabCommons & {\n /**\n * A tab supports 'transparent' and 'subtle' appearance.\n */\n appearance?: string;\n /**\n * If this tab is selected.\n */\n selected?: boolean;\n /**\n * A tab can be either 'small' or 'medium' size.\n */\n size: 'small' | 'medium';\n /**\n * A tab can arrange its content based on if the tabs in the list are arranged vertically.\n */\n vertical: boolean;\n };\n"]}
@@ -0,0 +1,5 @@
1
+ export * from './Tab';
2
+ export * from './Tab.types';
3
+ export * from './renderTab';
4
+ export * from './useTab';
5
+ export * from './useTabStyles';
@@ -0,0 +1,6 @@
1
+ export * from './Tab';
2
+ export * from './Tab.types';
3
+ export * from './renderTab';
4
+ export * from './useTab';
5
+ export * from './useTabStyles';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Tab/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC","sourcesContent":["export * from './Tab';\nexport * from './Tab.types';\nexport * from './renderTab';\nexport * from './useTab';\nexport * from './useTabStyles';\n"]}
@@ -0,0 +1,5 @@
1
+ import type { TabState } from './Tab.types';
2
+ /**
3
+ * Render the final JSX of Tab
4
+ */
5
+ export declare const renderTab_unstable: (state: TabState) => JSX.Element;
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ import { getSlots } from '@fluentui/react-utilities';
3
+ /**
4
+ * Render the final JSX of Tab
5
+ */
6
+ // eslint-disable-next-line @typescript-eslint/naming-convention
7
+
8
+ export const renderTab_unstable = state => {
9
+ const {
10
+ slots,
11
+ slotProps
12
+ } = getSlots(state);
13
+ return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
14
+ }, slots.icon && /*#__PURE__*/React.createElement(slots.icon, { ...slotProps.icon
15
+ }), /*#__PURE__*/React.createElement(slots.content, { ...slotProps.content
16
+ }));
17
+ };
18
+ //# sourceMappingURL=renderTab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Tab/renderTab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;AACH;;AACA,OAAO,MAAM,kBAAkB,GAAI,KAAD,IAAoB;AACpD,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAW,KAAX,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,KAAK,CAAC,IAAN,iBAAc,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CADjB,eAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,OAAP,EAAc,EAAA,GAAK,SAAS,CAAC;AAAf,GAAd,CAFF,CADF;AAMD,CATM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { TabState, TabSlots } from './Tab.types';\n\n/**\n * Render the final JSX of Tab\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const renderTab_unstable = (state: TabState) => {\n const { slots, slotProps } = getSlots<TabSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.icon && <slots.icon {...slotProps.icon} />}\n <slots.content {...slotProps.content} />\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import type { TabProps, TabState } from './Tab.types';
3
+ /**
4
+ * Create the state required to render Tab.
5
+ *
6
+ * The returned state can be modified with hooks such as useTabStyles_unstable,
7
+ * before being passed to renderTab_unstable.
8
+ *
9
+ * @param props - props from this instance of Tab
10
+ * @param ref - reference to root HTMLElement of Tab
11
+ */
12
+ export declare const useTab_unstable: (props: TabProps, ref: React.Ref<HTMLElement>) => TabState;
@@ -0,0 +1,82 @@
1
+ import * as React from 'react';
2
+ import { getNativeElementProps, resolveShorthand, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';
3
+ import { TabListContext } from '../TabList/TabListContext';
4
+ import { useContextSelector } from '@fluentui/react-context-selector';
5
+ /**
6
+ * Create the state required to render Tab.
7
+ *
8
+ * The returned state can be modified with hooks such as useTabStyles_unstable,
9
+ * before being passed to renderTab_unstable.
10
+ *
11
+ * @param props - props from this instance of Tab
12
+ * @param ref - reference to root HTMLElement of Tab
13
+ */
14
+ // eslint-disable-next-line @typescript-eslint/naming-convention
15
+
16
+ export const useTab_unstable = (props, ref) => {
17
+ const {
18
+ content,
19
+ icon,
20
+ value
21
+ } = props;
22
+ const {
23
+ appearance,
24
+ selected,
25
+ onRegister,
26
+ onUnregister,
27
+ onSelect,
28
+ size,
29
+ vertical
30
+ } = useContextSelector(TabListContext, ctx => ({
31
+ appearance: ctx.appearance,
32
+ selected: ctx.selectedValue === value,
33
+ onRegister: ctx.onRegister,
34
+ onUnregister: ctx.onUnregister,
35
+ onSelect: ctx.onSelect,
36
+ size: ctx.size,
37
+ vertical: !!ctx.vertical
38
+ }));
39
+ const onClick = useEventCallback(event => onSelect(event, {
40
+ value
41
+ }));
42
+ const innerRef = React.useRef(null);
43
+ React.useEffect(() => {
44
+ onRegister({
45
+ value,
46
+ ref: innerRef
47
+ });
48
+ return () => {
49
+ onUnregister({
50
+ value,
51
+ ref: innerRef
52
+ });
53
+ };
54
+ }, [onRegister, onUnregister, innerRef, value]);
55
+ return {
56
+ components: {
57
+ root: 'div',
58
+ icon: 'span',
59
+ content: 'span'
60
+ },
61
+ root: getNativeElementProps('div', {
62
+ ref: useMergedRefs(ref, innerRef),
63
+ role: 'tab',
64
+ tabIndex: 0,
65
+ ...props,
66
+ onClick
67
+ }),
68
+ icon: resolveShorthand(icon),
69
+ content: resolveShorthand(content, {
70
+ required: true,
71
+ defaultProps: {
72
+ children: props.children
73
+ }
74
+ }),
75
+ appearance,
76
+ selected,
77
+ size,
78
+ value,
79
+ vertical
80
+ };
81
+ };
82
+ //# sourceMappingURL=useTab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Tab/useTab.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,qBAAT,EAAgC,gBAAhC,EAAkD,gBAAlD,EAAoE,aAApE,QAAyF,2BAAzF;AAEA,SAAS,cAAT,QAA+B,2BAA/B;AACA,SAAS,kBAAT,QAAmC,kCAAnC;AAGA;;;;;;;;AAQG;AACH;;AACA,OAAO,MAAM,eAAe,GAAG,CAAC,KAAD,EAAkB,GAAlB,KAA2D;AACxF,QAAM;AAAE,IAAA,OAAF;AAAW,IAAA,IAAX;AAAiB,IAAA;AAAjB,MAA2B,KAAjC;AAEA,QAAM;AAAE,IAAA,UAAF;AAAc,IAAA,QAAd;AAAwB,IAAA,UAAxB;AAAoC,IAAA,YAApC;AAAkD,IAAA,QAAlD;AAA4D,IAAA,IAA5D;AAAkE,IAAA;AAAlE,MAA+E,kBAAkB,CACrG,cADqG,EAErG,GAAG,KAAK;AACN,IAAA,UAAU,EAAE,GAAG,CAAC,UADV;AAEN,IAAA,QAAQ,EAAE,GAAG,CAAC,aAAJ,KAAsB,KAF1B;AAGN,IAAA,UAAU,EAAE,GAAG,CAAC,UAHV;AAIN,IAAA,YAAY,EAAE,GAAG,CAAC,YAJZ;AAKN,IAAA,QAAQ,EAAE,GAAG,CAAC,QALR;AAMN,IAAA,IAAI,EAAE,GAAG,CAAC,IANJ;AAON,IAAA,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC;AAPV,GAAL,CAFkG,CAAvG;AAaA,QAAM,OAAO,GAAG,gBAAgB,CAAE,KAAD,IAA2B,QAAQ,CAAC,KAAD,EAAQ;AAAE,IAAA;AAAF,GAAR,CAApC,CAAhC;AAEA,QAAM,QAAQ,GAAG,KAAK,CAAC,MAAN,CAA0B,IAA1B,CAAjB;AAEA,EAAA,KAAK,CAAC,SAAN,CAAgB,MAAK;AACnB,IAAA,UAAU,CAAC;AACT,MAAA,KADS;AAET,MAAA,GAAG,EAAE;AAFI,KAAD,CAAV;AAKA,WAAO,MAAK;AACV,MAAA,YAAY,CAAC;AAAE,QAAA,KAAF;AAAS,QAAA,GAAG,EAAE;AAAd,OAAD,CAAZ;AACD,KAFD;AAGD,GATD,EASG,CAAC,UAAD,EAAa,YAAb,EAA2B,QAA3B,EAAqC,KAArC,CATH;AAWA,SAAO;AACL,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE,KADI;AAEV,MAAA,IAAI,EAAE,MAFI;AAGV,MAAA,OAAO,EAAE;AAHC,KADP;AAML,IAAA,IAAI,EAAE,qBAAqB,CAAC,KAAD,EAAQ;AACjC,MAAA,GAAG,EAAE,aAAa,CAAC,GAAD,EAAM,QAAN,CADe;AAEjC,MAAA,IAAI,EAAE,KAF2B;AAGjC,MAAA,QAAQ,EAAE,CAHuB;AAIjC,SAAG,KAJ8B;AAKjC,MAAA;AALiC,KAAR,CANtB;AAaL,IAAA,IAAI,EAAE,gBAAgB,CAAC,IAAD,CAbjB;AAcL,IAAA,OAAO,EAAE,gBAAgB,CAAC,OAAD,EAAU;AAAE,MAAA,QAAQ,EAAE,IAAZ;AAAkB,MAAA,YAAY,EAAE;AAAE,QAAA,QAAQ,EAAE,KAAK,CAAC;AAAlB;AAAhC,KAAV,CAdpB;AAeL,IAAA,UAfK;AAgBL,IAAA,QAhBK;AAiBL,IAAA,IAjBK;AAkBL,IAAA,KAlBK;AAmBL,IAAA;AAnBK,GAAP;AAqBD,CApDM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport type { TabProps, TabState } from './Tab.types';\nimport { TabListContext } from '../TabList/TabListContext';\nimport { useContextSelector } from '@fluentui/react-context-selector';\nimport { SelectTabEvent } from '../TabList/TabList.types';\n\n/**\n * Create the state required to render Tab.\n *\n * The returned state can be modified with hooks such as useTabStyles_unstable,\n * before being passed to renderTab_unstable.\n *\n * @param props - props from this instance of Tab\n * @param ref - reference to root HTMLElement of Tab\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const useTab_unstable = (props: TabProps, ref: React.Ref<HTMLElement>): TabState => {\n const { content, icon, value } = props;\n\n const { appearance, selected, onRegister, onUnregister, onSelect, size, vertical } = useContextSelector(\n TabListContext,\n ctx => ({\n appearance: ctx.appearance,\n selected: ctx.selectedValue === value,\n onRegister: ctx.onRegister,\n onUnregister: ctx.onUnregister,\n onSelect: ctx.onSelect,\n size: ctx.size,\n vertical: !!ctx.vertical,\n }),\n );\n\n const onClick = useEventCallback((event: SelectTabEvent) => onSelect(event, { value }));\n\n const innerRef = React.useRef<HTMLElement>(null);\n\n React.useEffect(() => {\n onRegister({\n value,\n ref: innerRef,\n });\n\n return () => {\n onUnregister({ value, ref: innerRef });\n };\n }, [onRegister, onUnregister, innerRef, value]);\n\n return {\n components: {\n root: 'div',\n icon: 'span',\n content: 'span',\n },\n root: getNativeElementProps('div', {\n ref: useMergedRefs(ref, innerRef),\n role: 'tab',\n tabIndex: 0,\n ...props,\n onClick,\n }),\n icon: resolveShorthand(icon),\n content: resolveShorthand(content, { required: true, defaultProps: { children: props.children } }),\n appearance,\n selected,\n size,\n value,\n vertical,\n };\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,6 @@
1
+ import type { TabState } from './Tab.types';
2
+ export declare const tabClassName = "fui-Tab";
3
+ /**
4
+ * Apply styling to the Tab slots based on the state
5
+ */
6
+ export declare const useTabStyles_unstable: (state: TabState) => TabState;