@fluentui/react-tabs 1.0.0-beta.97 → 9.0.0-beta.10

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 (229) hide show
  1. package/CHANGELOG.json +181 -1762
  2. package/CHANGELOG.md +54 -718
  3. package/README.md +0 -17
  4. package/Spec.md +433 -0
  5. package/dist/react-tabs.d.ts +173 -127
  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 +61 -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 +6 -0
  19. package/lib/components/Tab/index.js +7 -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 +17 -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 +78 -0
  26. package/lib/components/Tab/useTab.js.map +1 -0
  27. package/lib/components/Tab/useTabAnimatedIndicator.d.ts +5 -0
  28. package/lib/components/Tab/useTabAnimatedIndicator.js +134 -0
  29. package/lib/components/Tab/useTabAnimatedIndicator.js.map +1 -0
  30. package/lib/components/Tab/useTabStyles.d.ts +8 -0
  31. package/lib/components/Tab/useTabStyles.js +402 -0
  32. package/lib/components/Tab/useTabStyles.js.map +1 -0
  33. package/lib/components/TabList/TabList.d.ts +6 -0
  34. package/lib/components/TabList/TabList.js +17 -0
  35. package/lib/components/TabList/TabList.js.map +1 -0
  36. package/lib/components/TabList/TabList.types.d.ts +104 -0
  37. package/lib/components/TabList/TabList.types.js +2 -0
  38. package/lib/components/TabList/TabList.types.js.map +1 -0
  39. package/lib/components/TabList/TabListContext.d.ts +3 -0
  40. package/lib/components/TabList/TabListContext.js +23 -0
  41. package/lib/components/TabList/TabListContext.js.map +1 -0
  42. package/lib/components/TabList/index.d.ts +5 -0
  43. package/lib/components/TabList/index.js +6 -0
  44. package/lib/components/TabList/index.js.map +1 -0
  45. package/lib/components/TabList/renderTabList.d.ts +5 -0
  46. package/lib/components/TabList/renderTabList.js +18 -0
  47. package/lib/components/TabList/renderTabList.js.map +1 -0
  48. package/lib/components/TabList/useTabList.d.ts +12 -0
  49. package/lib/components/TabList/useTabList.js +81 -0
  50. package/lib/components/TabList/useTabList.js.map +1 -0
  51. package/lib/components/TabList/useTabListContextValues.d.ts +2 -0
  52. package/lib/components/TabList/useTabListContextValues.js +28 -0
  53. package/lib/components/TabList/useTabListContextValues.js.map +1 -0
  54. package/lib/components/TabList/useTabListStyles.d.ts +8 -0
  55. package/lib/components/TabList/useTabListStyles.js +45 -0
  56. package/lib/components/TabList/useTabListStyles.js.map +1 -0
  57. package/lib/index.d.ts +4 -1
  58. package/lib/index.js +2 -1
  59. package/lib/index.js.map +1 -1
  60. package/lib/tab.constants.d.ts +62 -0
  61. package/lib/tab.constants.js +68 -0
  62. package/lib/tab.constants.js.map +1 -0
  63. package/lib/tsdoc-metadata.json +1 -1
  64. package/lib-commonjs/Tab.d.ts +1 -0
  65. package/lib-commonjs/Tab.js +10 -0
  66. package/lib-commonjs/Tab.js.map +1 -0
  67. package/lib-commonjs/TabList.d.ts +1 -0
  68. package/lib-commonjs/TabList.js +10 -0
  69. package/lib-commonjs/TabList.js.map +1 -0
  70. package/lib-commonjs/components/Tab/Tab.d.ts +6 -0
  71. package/lib-commonjs/components/Tab/Tab.js +26 -0
  72. package/lib-commonjs/components/Tab/Tab.js.map +1 -0
  73. package/lib-commonjs/components/Tab/Tab.types.d.ts +61 -0
  74. package/lib-commonjs/components/Tab/Tab.types.js +6 -0
  75. package/lib-commonjs/components/Tab/Tab.types.js.map +1 -0
  76. package/lib-commonjs/components/Tab/index.d.ts +6 -0
  77. package/lib-commonjs/components/Tab/index.js +20 -0
  78. package/lib-commonjs/components/Tab/index.js.map +1 -0
  79. package/lib-commonjs/components/Tab/renderTab.d.ts +5 -0
  80. package/lib-commonjs/components/Tab/renderTab.js +28 -0
  81. package/lib-commonjs/components/Tab/renderTab.js.map +1 -0
  82. package/lib-commonjs/components/Tab/useTab.d.ts +12 -0
  83. package/lib-commonjs/components/Tab/useTab.js +91 -0
  84. package/lib-commonjs/components/Tab/useTab.js.map +1 -0
  85. package/lib-commonjs/components/Tab/useTabAnimatedIndicator.d.ts +5 -0
  86. package/lib-commonjs/components/Tab/useTabAnimatedIndicator.js +148 -0
  87. package/lib-commonjs/components/Tab/useTabAnimatedIndicator.js.map +1 -0
  88. package/lib-commonjs/components/Tab/useTabStyles.d.ts +8 -0
  89. package/lib-commonjs/components/Tab/useTabStyles.js +416 -0
  90. package/lib-commonjs/components/Tab/useTabStyles.js.map +1 -0
  91. package/lib-commonjs/components/TabList/TabList.d.ts +6 -0
  92. package/lib-commonjs/components/TabList/TabList.js +29 -0
  93. package/lib-commonjs/components/TabList/TabList.js.map +1 -0
  94. package/lib-commonjs/components/TabList/TabList.types.d.ts +104 -0
  95. package/lib-commonjs/components/TabList/TabList.types.js +6 -0
  96. package/lib-commonjs/components/TabList/TabList.types.js.map +1 -0
  97. package/lib-commonjs/components/TabList/TabListContext.d.ts +3 -0
  98. package/lib-commonjs/components/TabList/TabListContext.js +31 -0
  99. package/lib-commonjs/components/TabList/TabListContext.js.map +1 -0
  100. package/lib-commonjs/components/TabList/index.d.ts +5 -0
  101. package/lib-commonjs/components/TabList/index.js +18 -0
  102. package/lib-commonjs/components/TabList/index.js.map +1 -0
  103. package/lib-commonjs/components/TabList/renderTabList.d.ts +5 -0
  104. package/lib-commonjs/components/TabList/renderTabList.js +30 -0
  105. package/lib-commonjs/components/TabList/renderTabList.js.map +1 -0
  106. package/lib-commonjs/components/TabList/useTabList.d.ts +12 -0
  107. package/lib-commonjs/components/TabList/useTabList.js +93 -0
  108. package/lib-commonjs/components/TabList/useTabList.js.map +1 -0
  109. package/lib-commonjs/components/TabList/useTabListContextValues.d.ts +2 -0
  110. package/lib-commonjs/components/TabList/useTabListContextValues.js +37 -0
  111. package/lib-commonjs/components/TabList/useTabListContextValues.js.map +1 -0
  112. package/lib-commonjs/components/TabList/useTabListStyles.d.ts +8 -0
  113. package/lib-commonjs/components/TabList/useTabListStyles.js +55 -0
  114. package/lib-commonjs/components/TabList/useTabListStyles.js.map +1 -0
  115. package/lib-commonjs/index.d.ts +4 -1
  116. package/lib-commonjs/index.js +83 -3
  117. package/lib-commonjs/index.js.map +1 -1
  118. package/lib-commonjs/tab.constants.d.ts +62 -0
  119. package/lib-commonjs/tab.constants.js +75 -0
  120. package/lib-commonjs/tab.constants.js.map +1 -0
  121. package/package.json +25 -21
  122. package/config/api-extractor.json +0 -3
  123. package/config/tests.js +0 -14
  124. package/etc/react-tabs.api.md +0 -104
  125. package/just.config.ts +0 -3
  126. package/lib/Tabs.d.ts +0 -1
  127. package/lib/Tabs.js +0 -2
  128. package/lib/Tabs.js.map +0 -1
  129. package/lib/common/isConformant.d.ts +0 -2
  130. package/lib/common/isConformant.js +0 -9
  131. package/lib/common/isConformant.js.map +0 -1
  132. package/lib/components/Tabs/TabItem.d.ts +0 -6
  133. package/lib/components/Tabs/TabItem.js +0 -18
  134. package/lib/components/Tabs/TabItem.js.map +0 -1
  135. package/lib/components/Tabs/TabItem.types.d.ts +0 -61
  136. package/lib/components/Tabs/TabItem.types.js +0 -2
  137. package/lib/components/Tabs/TabItem.types.js.map +0 -1
  138. package/lib/components/Tabs/Tabs.base.d.ts +0 -3
  139. package/lib/components/Tabs/Tabs.base.js +0 -179
  140. package/lib/components/Tabs/Tabs.base.js.map +0 -1
  141. package/lib/components/Tabs/Tabs.d.ts +0 -8
  142. package/lib/components/Tabs/Tabs.js +0 -12
  143. package/lib/components/Tabs/Tabs.js.map +0 -1
  144. package/lib/components/Tabs/Tabs.styles.d.ts +0 -2
  145. package/lib/components/Tabs/Tabs.styles.js +0 -264
  146. package/lib/components/Tabs/Tabs.styles.js.map +0 -1
  147. package/lib/components/Tabs/Tabs.types.d.ts +0 -113
  148. package/lib/components/Tabs/Tabs.types.js +0 -2
  149. package/lib/components/Tabs/Tabs.types.js.map +0 -1
  150. package/lib/components/Tabs/index.d.ts +0 -5
  151. package/lib/components/Tabs/index.js +0 -6
  152. package/lib/components/Tabs/index.js.map +0 -1
  153. package/lib/utilities/observeResize.d.ts +0 -21
  154. package/lib/utilities/observeResize.js +0 -46
  155. package/lib/utilities/observeResize.js.map +0 -1
  156. package/lib/utilities/useOverflow.d.ts +0 -45
  157. package/lib/utilities/useOverflow.js +0 -126
  158. package/lib/utilities/useOverflow.js.map +0 -1
  159. package/lib-amd/Tabs.d.ts +0 -1
  160. package/lib-amd/Tabs.js +0 -6
  161. package/lib-amd/Tabs.js.map +0 -1
  162. package/lib-amd/common/isConformant.d.ts +0 -2
  163. package/lib-amd/common/isConformant.js +0 -14
  164. package/lib-amd/common/isConformant.js.map +0 -1
  165. package/lib-amd/components/Tabs/TabItem.d.ts +0 -6
  166. package/lib-amd/components/Tabs/TabItem.js +0 -20
  167. package/lib-amd/components/Tabs/TabItem.js.map +0 -1
  168. package/lib-amd/components/Tabs/TabItem.types.d.ts +0 -61
  169. package/lib-amd/components/Tabs/TabItem.types.js +0 -5
  170. package/lib-amd/components/Tabs/TabItem.types.js.map +0 -1
  171. package/lib-amd/components/Tabs/Tabs.base.d.ts +0 -3
  172. package/lib-amd/components/Tabs/Tabs.base.js +0 -176
  173. package/lib-amd/components/Tabs/Tabs.base.js.map +0 -1
  174. package/lib-amd/components/Tabs/Tabs.d.ts +0 -8
  175. package/lib-amd/components/Tabs/Tabs.js +0 -14
  176. package/lib-amd/components/Tabs/Tabs.js.map +0 -1
  177. package/lib-amd/components/Tabs/Tabs.styles.d.ts +0 -2
  178. package/lib-amd/components/Tabs/Tabs.styles.js +0 -267
  179. package/lib-amd/components/Tabs/Tabs.styles.js.map +0 -1
  180. package/lib-amd/components/Tabs/Tabs.types.d.ts +0 -113
  181. package/lib-amd/components/Tabs/Tabs.types.js +0 -5
  182. package/lib-amd/components/Tabs/Tabs.types.js.map +0 -1
  183. package/lib-amd/components/Tabs/index.d.ts +0 -5
  184. package/lib-amd/components/Tabs/index.js +0 -11
  185. package/lib-amd/components/Tabs/index.js.map +0 -1
  186. package/lib-amd/index.d.ts +0 -1
  187. package/lib-amd/index.js +0 -6
  188. package/lib-amd/index.js.map +0 -1
  189. package/lib-amd/utilities/observeResize.d.ts +0 -21
  190. package/lib-amd/utilities/observeResize.js +0 -51
  191. package/lib-amd/utilities/observeResize.js.map +0 -1
  192. package/lib-amd/utilities/useOverflow.d.ts +0 -45
  193. package/lib-amd/utilities/useOverflow.js +0 -128
  194. package/lib-amd/utilities/useOverflow.js.map +0 -1
  195. package/lib-commonjs/Tabs.d.ts +0 -1
  196. package/lib-commonjs/Tabs.js +0 -5
  197. package/lib-commonjs/Tabs.js.map +0 -1
  198. package/lib-commonjs/common/isConformant.d.ts +0 -2
  199. package/lib-commonjs/common/isConformant.js +0 -13
  200. package/lib-commonjs/common/isConformant.js.map +0 -1
  201. package/lib-commonjs/components/Tabs/TabItem.d.ts +0 -6
  202. package/lib-commonjs/components/Tabs/TabItem.js +0 -21
  203. package/lib-commonjs/components/Tabs/TabItem.js.map +0 -1
  204. package/lib-commonjs/components/Tabs/TabItem.types.d.ts +0 -61
  205. package/lib-commonjs/components/Tabs/TabItem.types.js +0 -3
  206. package/lib-commonjs/components/Tabs/TabItem.types.js.map +0 -1
  207. package/lib-commonjs/components/Tabs/Tabs.base.d.ts +0 -3
  208. package/lib-commonjs/components/Tabs/Tabs.base.js +0 -182
  209. package/lib-commonjs/components/Tabs/Tabs.base.js.map +0 -1
  210. package/lib-commonjs/components/Tabs/Tabs.d.ts +0 -8
  211. package/lib-commonjs/components/Tabs/Tabs.js +0 -15
  212. package/lib-commonjs/components/Tabs/Tabs.js.map +0 -1
  213. package/lib-commonjs/components/Tabs/Tabs.styles.d.ts +0 -2
  214. package/lib-commonjs/components/Tabs/Tabs.styles.js +0 -268
  215. package/lib-commonjs/components/Tabs/Tabs.styles.js.map +0 -1
  216. package/lib-commonjs/components/Tabs/Tabs.types.d.ts +0 -113
  217. package/lib-commonjs/components/Tabs/Tabs.types.js +0 -3
  218. package/lib-commonjs/components/Tabs/Tabs.types.js.map +0 -1
  219. package/lib-commonjs/components/Tabs/index.d.ts +0 -5
  220. package/lib-commonjs/components/Tabs/index.js +0 -11
  221. package/lib-commonjs/components/Tabs/index.js.map +0 -1
  222. package/lib-commonjs/utilities/observeResize.d.ts +0 -21
  223. package/lib-commonjs/utilities/observeResize.js +0 -50
  224. package/lib-commonjs/utilities/observeResize.js.map +0 -1
  225. package/lib-commonjs/utilities/useOverflow.d.ts +0 -45
  226. package/lib-commonjs/utilities/useOverflow.js +0 -130
  227. package/lib-commonjs/utilities/useOverflow.js.map +0 -1
  228. package/src/components/Tabs/TabItem.types.ts +0 -69
  229. package/src/components/Tabs/Tabs.types.ts +0 -131
@@ -1,197 +1,243 @@
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
+ import { SlotClassNames } from '@fluentui/react-utilities';
7
+
8
+ export declare type RegisterTabEventHandler = (data: TabRegisterData) => void;
9
+
10
+ /**
11
+ * Render the final JSX of Tab
12
+ */
13
+ export declare const renderTab_unstable: (state: TabState) => JSX.Element;
9
14
 
10
15
  /**
11
- * {@docCategory Tabs}
12
- * Display mode for the tabs
16
+ * Render the final JSX of TabList
13
17
  */
14
- export declare type TabFormatType = 'links' | 'tabs';
18
+ export declare const renderTabList_unstable: (state: TabListState, contextValues: TabListContextValues) => JSX.Element;
19
+
20
+ export declare type SelectTabData = {
21
+ /**
22
+ * The value of the selected tab.
23
+ */
24
+ value: TabValue;
25
+ };
26
+
27
+ export declare type SelectTabEvent<E = HTMLElement> = React_2.MouseEvent<E> | React_2.KeyboardEvent<E>;
15
28
 
16
- export declare class TabItem extends React_2.Component<TabItemProps, {}> {
17
- constructor(props: TabItemProps);
18
- render(): JSX.Element;
19
- }
29
+ export declare type SelectTabEventHandler = (event: SelectTabEvent, data: SelectTabData) => void;
20
30
 
21
31
  /**
22
- * {@docCategory Tabs}
32
+ * A tab provides a selectable item in a tab list.
23
33
  */
24
- export declare interface TabItemProps extends React_2.HTMLAttributes<HTMLDivElement> {
34
+ export declare const Tab: ForwardRefComponent<TabProps>;
35
+
36
+ export declare const tabClassName: string;
37
+
38
+ export declare const tabClassNames: SlotClassNames<TabSlots>;
39
+
40
+ declare type TabCommons = {
25
41
  /**
26
- * Gets the component ref.
42
+ * A tab can be set to disable interaction.
43
+ * @default false
27
44
  */
28
- componentRef?: IRefObject<{}>;
45
+ disabled?: boolean;
29
46
  /**
30
- * The text displayed of each tab.
47
+ * The value that identifies this tab when selected.
31
48
  */
32
- headerText?: string;
49
+ value: TabValue;
50
+ };
51
+
52
+ /**
53
+ * A tab list provides single selection from a set of tabs.
54
+ */
55
+ export declare const TabList: ForwardRefComponent<TabListProps>;
56
+
57
+ export declare const tabListClassName: string;
58
+
59
+ export declare const tabListClassNames: SlotClassNames<TabListSlots>;
60
+
61
+ declare type TabListCommons = {
33
62
  /**
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.
63
+ * A tab list can supports 'transparent' and 'subtle' appearance.
64
+ *- 'subtle': Minimizes emphasis to blend into the background until hovered or focused.
65
+ *- 'transparent': No background and border styling
66
+ * The appearance affects each of the contained tabs.
67
+ * @default 'transparent'
36
68
  */
37
- headerButtonProps?: IButtonProps | {
38
- [key: string]: string | number | boolean;
39
- };
69
+ appearance?: 'transparent' | 'subtle';
40
70
  /**
41
- * An required key to uniquely identify a tab item.
42
- *
43
- * Note: The 'key' from react props cannot be used inside component.
71
+ * A tab list can be set to disable interaction.
72
+ * @default false
44
73
  */
45
- itemKey?: string;
74
+ disabled?: boolean;
46
75
  /**
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.
76
+ * Raised when a tab is selected.
50
77
  */
51
- ariaLabel?: string;
78
+ onTabSelect?: SelectTabEventHandler;
52
79
  /**
53
- * Defines an optional item count displayed in parentheses just after the `headerText`.
54
- *
55
- * Examples: completed (4), Unread (99+)
80
+ * The value of the currently selected tab.
56
81
  */
57
- itemCount?: number | string;
82
+ selectedValue?: TabValue;
58
83
  /**
59
- * An optional icon to show next to the tab.
84
+ * A tab list can be either 'small' or 'medium' size.
85
+ * The size affects each of the contained tabs.
86
+ * @default 'medium'
60
87
  */
61
- itemIcon?: string;
88
+ size?: 'small' | 'medium';
62
89
  /**
63
- * Optional custom renderer for the tab
90
+ * A tab list can arrange its tabs vertically.
91
+ * @default false
64
92
  */
65
- onRenderTab?: IRenderFunction<TabItemProps>;
93
+ vertical?: boolean;
94
+ };
95
+
96
+ export declare type TabListContextValue = Pick<TabListCommons, 'onTabSelect' | 'selectedValue'> & Required<Pick<TabListCommons, 'appearance' | 'disabled' | 'size' | 'vertical'>> & {
97
+ /** A callback to allow a tab to register itself with the tab list. */
98
+ onRegister: RegisterTabEventHandler;
99
+ /** A callback to allow a tab to unregister itself with the tab list. */
100
+ onUnregister: RegisterTabEventHandler;
66
101
  /**
67
- * Optional keytip for this TabItem
102
+ * A callback to allow a tab to select itself when pressed.
68
103
  */
69
- keytipProps?: IKeytipProps;
104
+ onSelect: SelectTabEventHandler;
70
105
  /**
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
106
+ * Gets the registered tab data along with current and previous selected values.
75
107
  */
76
- alwaysRender?: boolean;
77
- }
108
+ getRegisteredTabs: () => {
109
+ selectedValue?: TabValue;
110
+ previousSelectedValue?: TabValue;
111
+ registeredTabs: Record<string, TabRegisterData>;
112
+ };
113
+ };
78
114
 
79
115
  /**
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.
116
+ * Context values used in rendering TabList.
83
117
  */
84
- export declare const Tabs: React_2.FunctionComponent<TabsProps>;
85
-
86
- export declare const TabsBase: React_2.FunctionComponent<TabsProps>;
118
+ export declare type TabListContextValues = {
119
+ /**
120
+ * The context of the tab list available to each tab.
121
+ */
122
+ tabList: TabListContextValue;
123
+ };
87
124
 
88
125
  /**
89
- * {@docCategory Tabs}
126
+ * TabList Props
90
127
  */
91
- export declare interface TabsImperativeHandle {
128
+ export declare type TabListProps = ComponentProps<TabListSlots> & TabListCommons & {
92
129
  /**
93
- * Sets focus to the first tab.
130
+ * The value of the tab to be selected by default.
131
+ * Typically useful when the selectedValue is uncontrolled.
94
132
  */
95
- focus(): void;
96
- }
133
+ defaultSelectedValue?: TabValue;
134
+ };
135
+
136
+ export declare type TabListSlots = {
137
+ /**
138
+ * The slot associated with the root element of this tab list.
139
+ */
140
+ root: Slot<'div'>;
141
+ };
97
142
 
98
143
  /**
99
- * {@docCategory Tabs}
100
- * Size of the tabs
144
+ * State used in rendering TabList.
101
145
  */
102
- export declare type TabSizeType = 'normal' | 'large';
146
+ export declare type TabListState = ComponentState<Required<TabListSlots>> & TabListContextValue;
103
147
 
104
148
  /**
105
- * {@docCategory Tabs}
149
+ * Tab Props
106
150
  */
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>;
151
+ export declare type TabProps = ComponentProps<Partial<TabSlots>> & TabCommons;
152
+
153
+ export declare type TabRegisterData = {
117
154
  /**
118
- * Theme provided by High-Order Component.
155
+ * The value of the tab.
119
156
  */
120
- theme?: ITheme;
157
+ value: TabValue;
121
158
  /**
122
- * Additional css class to apply to the Tabs
123
- * @defaultvalue undefined
159
+ * The reference to the tab HTML element.
124
160
  */
125
- className?: string;
161
+ ref: React_2.RefObject<HTMLElement>;
162
+ };
163
+
164
+ export declare type TabSlots = {
126
165
  /**
127
- * Default selected TabItem key. Only provide this if the Tabs is an uncontrolled component;
128
- * otherwise, use the `selectedKey` property.
166
+ * Root of the component.
129
167
  */
130
- defaultSelectedKey?: string;
168
+ root: Slot<'button'>;
131
169
  /**
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`.
170
+ * Icon that renders before the content.
135
171
  */
136
- selectedKey?: string | null;
172
+ icon?: Slot<'span'>;
137
173
  /**
138
- * Callback for when the selected tab item is changed.
174
+ * Component children are placed in this slot
175
+ * Avoid using the `children` property in this slot in favour of Component children whenever possible.
139
176
  */
140
- onTabClick?: (item?: TabItem, ev?: React_2.MouseEvent<HTMLElement>) => void;
177
+ content: NonNullable<Slot<'span'>>;
178
+ };
179
+
180
+ /**
181
+ * State used in rendering Tab
182
+ */
183
+ export declare type TabState = ComponentState<TabSlots> & Omit<TabCommons, 'disabled'> & Required<Pick<TabCommons, 'disabled'>> & {
141
184
  /**
142
- * Tab size (normal, large)
185
+ * A tab supports 'transparent' and 'subtle' appearance.
143
186
  */
144
- tabSize?: TabSizeType;
187
+ appearance?: 'transparent' | 'subtle';
145
188
  /**
146
- * Tab format (links, tabs)
189
+ * A tab can have only an icon slot filled and no content.
147
190
  */
148
- tabFormat?: TabFormatType;
191
+ iconOnly: boolean;
149
192
  /**
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
193
+ * If this tab is selected
155
194
  */
156
- overflowBehavior?: 'none' | 'menu';
195
+ selected: boolean;
157
196
  /**
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.
197
+ * A tab can be either 'small' or 'medium' size.
161
198
  */
162
- headersOnly?: boolean;
199
+ size: 'small' | 'medium';
163
200
  /**
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.
201
+ * A tab can arrange its content based on if the tabs in the list are arranged vertically.
166
202
  */
167
- getTabId?: (itemKey: string, index: number) => string;
168
- }
203
+ vertical: boolean;
204
+ };
169
205
 
170
206
  /**
171
- * {@docCategory Tabs}
207
+ * Any value that identifies a specific tab.
172
208
  */
173
- export declare type TabsStyleProps = Required<Pick<TabsProps, 'theme'>> & Pick<TabsProps, 'className'> & {
174
- tabSize?: TabSizeType;
175
- tabFormat?: TabFormatType;
176
- };
209
+ export declare type TabValue = unknown;
210
+
211
+ /**
212
+ * Create the state required to render Tab.
213
+ *
214
+ * The returned state can be modified with hooks such as useTabStyles_unstable,
215
+ * before being passed to renderTab_unstable.
216
+ *
217
+ * @param props - props from this instance of Tab
218
+ * @param ref - reference to root HTMLElement of Tab
219
+ */
220
+ export declare const useTab_unstable: (props: TabProps, ref: React_2.Ref<HTMLElement>) => TabState;
221
+
222
+ /**
223
+ * Create the state required to render TabList.
224
+ *
225
+ * The returned state can be modified with hooks such as useTabListStyles_unstable,
226
+ * before being passed to renderTabList_unstable.
227
+ *
228
+ * @param props - props from this instance of TabList
229
+ * @param ref - reference to root HTMLElement of TabList
230
+ */
231
+ export declare const useTabList_unstable: (props: TabListProps, ref: React_2.Ref<HTMLElement>) => TabListState;
232
+
233
+ /**
234
+ * Apply styling to the TabList slots based on the state
235
+ */
236
+ export declare const useTabListStyles_unstable: (state: TabListState) => TabListState;
177
237
 
178
238
  /**
179
- * {@docCategory Tabs}
239
+ * Apply styling to the Tab slots based on the state
180
240
  */
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
- }
241
+ export declare const useTabStyles_unstable: (state: TabState) => TabState;
196
242
 
197
243
  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,61 @@
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<'button'>;
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
+ * A tab can be set to disable interaction.
24
+ * @default false
25
+ */
26
+ disabled?: boolean;
27
+ /**
28
+ * The value that identifies this tab when selected.
29
+ */
30
+ value: TabValue;
31
+ };
32
+ /**
33
+ * Tab Props
34
+ */
35
+ export declare type TabProps = ComponentProps<Partial<TabSlots>> & TabCommons;
36
+ /**
37
+ * State used in rendering Tab
38
+ */
39
+ export declare type TabState = ComponentState<TabSlots> & Omit<TabCommons, 'disabled'> & Required<Pick<TabCommons, 'disabled'>> & {
40
+ /**
41
+ * A tab supports 'transparent' and 'subtle' appearance.
42
+ */
43
+ appearance?: 'transparent' | 'subtle';
44
+ /**
45
+ * A tab can have only an icon slot filled and no content.
46
+ */
47
+ iconOnly: boolean;
48
+ /**
49
+ * If this tab is selected
50
+ */
51
+ selected: boolean;
52
+ /**
53
+ * A tab can be either 'small' or 'medium' size.
54
+ */
55
+ size: 'small' | 'medium';
56
+ /**
57
+ * A tab can arrange its content based on if the tabs in the list are arranged vertically.
58
+ */
59
+ vertical: boolean;
60
+ };
61
+ 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<'button'>;\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 * A tab can be set to disable interaction.\n * @default false\n */\n disabled?: boolean;\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 Omit<TabCommons, 'disabled'> &\n Required<Pick<TabCommons, 'disabled'>> & {\n /**\n * A tab supports 'transparent' and 'subtle' appearance.\n */\n appearance?: 'transparent' | 'subtle';\n /**\n * A tab can have only an icon slot filled and no content.\n */\n iconOnly: boolean;\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,6 @@
1
+ export * from './Tab';
2
+ export * from './Tab.types';
3
+ export * from './renderTab';
4
+ export * from './useTab';
5
+ export * from './useTabStyles';
6
+ export * from './useTabAnimatedIndicator';
@@ -0,0 +1,7 @@
1
+ export * from './Tab';
2
+ export * from './Tab.types';
3
+ export * from './renderTab';
4
+ export * from './useTab';
5
+ export * from './useTabStyles';
6
+ export * from './useTabAnimatedIndicator';
7
+ //# 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;AAC/B,cAAc,2BAA2B,CAAC","sourcesContent":["export * from './Tab';\nexport * from './Tab.types';\nexport * from './renderTab';\nexport * from './useTab';\nexport * from './useTabStyles';\nexport * from './useTabAnimatedIndicator';\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,17 @@
1
+ import * as React from 'react';
2
+ import { getSlots } from '@fluentui/react-utilities';
3
+ /**
4
+ * Render the final JSX of Tab
5
+ */
6
+
7
+ export const renderTab_unstable = state => {
8
+ const {
9
+ slots,
10
+ slotProps
11
+ } = getSlots(state);
12
+ return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
13
+ }, slots.icon && /*#__PURE__*/React.createElement(slots.icon, { ...slotProps.icon
14
+ }), !state.iconOnly && /*#__PURE__*/React.createElement(slots.content, { ...slotProps.content
15
+ }));
16
+ };
17
+ //# 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,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,EAEG,CAAC,KAAK,CAAC,QAAP,iBAAmB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,OAAP,EAAc,EAAA,GAAK,SAAS,CAAC;AAAf,GAAd,CAFtB,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 */\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 {!state.iconOnly && <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,78 @@
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
+
15
+ export const useTab_unstable = (props, ref) => {
16
+ const {
17
+ content,
18
+ disabled: tabDisabled = false,
19
+ icon,
20
+ value
21
+ } = props;
22
+ const appearance = useContextSelector(TabListContext, ctx => ctx.appearance);
23
+ const listDisabled = useContextSelector(TabListContext, ctx => ctx.disabled);
24
+ const selected = useContextSelector(TabListContext, ctx => ctx.selectedValue === value);
25
+ const onRegister = useContextSelector(TabListContext, ctx => ctx.onRegister);
26
+ const onUnregister = useContextSelector(TabListContext, ctx => ctx.onUnregister);
27
+ const onSelect = useContextSelector(TabListContext, ctx => ctx.onSelect);
28
+ const size = useContextSelector(TabListContext, ctx => ctx.size);
29
+ const vertical = useContextSelector(TabListContext, ctx => !!ctx.vertical);
30
+ const disabled = listDisabled || tabDisabled;
31
+ const innerRef = React.useRef(null);
32
+ const onClick = useEventCallback(event => onSelect(event, {
33
+ value
34
+ }));
35
+ React.useEffect(() => {
36
+ onRegister({
37
+ value,
38
+ ref: innerRef
39
+ });
40
+ return () => {
41
+ onUnregister({
42
+ value,
43
+ ref: innerRef
44
+ });
45
+ };
46
+ }, [onRegister, onUnregister, innerRef, value]);
47
+ const iconShorthand = resolveShorthand(icon);
48
+ const contentShorthand = resolveShorthand(content, {
49
+ required: true,
50
+ defaultProps: {
51
+ children: props.children
52
+ }
53
+ });
54
+ return {
55
+ components: {
56
+ root: 'button',
57
+ icon: 'span',
58
+ content: 'span'
59
+ },
60
+ root: getNativeElementProps('button', {
61
+ ref: useMergedRefs(ref, innerRef),
62
+ role: 'tab',
63
+ ...props,
64
+ disabled,
65
+ onClick
66
+ }),
67
+ icon: iconShorthand,
68
+ iconOnly: Boolean((iconShorthand === null || iconShorthand === void 0 ? void 0 : iconShorthand.children) && !contentShorthand.children),
69
+ content: contentShorthand,
70
+ appearance,
71
+ disabled,
72
+ selected,
73
+ size,
74
+ value,
75
+ vertical
76
+ };
77
+ };
78
+ //# 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,OAAO,MAAM,eAAe,GAAG,CAAC,KAAD,EAAkB,GAAlB,KAA2D;AACxF,QAAM;AAAE,IAAA,OAAF;AAAW,IAAA,QAAQ,EAAE,WAAW,GAAG,KAAnC;AAA0C,IAAA,IAA1C;AAAgD,IAAA;AAAhD,MAA0D,KAAhE;AAEA,QAAM,UAAU,GAAG,kBAAkB,CAAC,cAAD,EAAiB,GAAG,IAAI,GAAG,CAAC,UAA5B,CAArC;AACA,QAAM,YAAY,GAAG,kBAAkB,CAAC,cAAD,EAAiB,GAAG,IAAI,GAAG,CAAC,QAA5B,CAAvC;AACA,QAAM,QAAQ,GAAG,kBAAkB,CAAC,cAAD,EAAiB,GAAG,IAAI,GAAG,CAAC,aAAJ,KAAsB,KAA9C,CAAnC;AACA,QAAM,UAAU,GAAG,kBAAkB,CAAC,cAAD,EAAiB,GAAG,IAAI,GAAG,CAAC,UAA5B,CAArC;AACA,QAAM,YAAY,GAAG,kBAAkB,CAAC,cAAD,EAAiB,GAAG,IAAI,GAAG,CAAC,YAA5B,CAAvC;AACA,QAAM,QAAQ,GAAG,kBAAkB,CAAC,cAAD,EAAiB,GAAG,IAAI,GAAG,CAAC,QAA5B,CAAnC;AACA,QAAM,IAAI,GAAG,kBAAkB,CAAC,cAAD,EAAiB,GAAG,IAAI,GAAG,CAAC,IAA5B,CAA/B;AACA,QAAM,QAAQ,GAAG,kBAAkB,CAAC,cAAD,EAAiB,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,QAA9B,CAAnC;AACA,QAAM,QAAQ,GAAG,YAAY,IAAI,WAAjC;AAEA,QAAM,QAAQ,GAAG,KAAK,CAAC,MAAN,CAA0B,IAA1B,CAAjB;AACA,QAAM,OAAO,GAAG,gBAAgB,CAAE,KAAD,IAA2B,QAAQ,CAAC,KAAD,EAAQ;AAAE,IAAA;AAAF,GAAR,CAApC,CAAhC;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,QAAM,aAAa,GAAG,gBAAgB,CAAC,IAAD,CAAtC;AACA,QAAM,gBAAgB,GAAG,gBAAgB,CAAC,OAAD,EAAU;AAAE,IAAA,QAAQ,EAAE,IAAZ;AAAkB,IAAA,YAAY,EAAE;AAAE,MAAA,QAAQ,EAAE,KAAK,CAAC;AAAlB;AAAhC,GAAV,CAAzC;AACA,SAAO;AACL,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE,QADI;AAEV,MAAA,IAAI,EAAE,MAFI;AAGV,MAAA,OAAO,EAAE;AAHC,KADP;AAML,IAAA,IAAI,EAAE,qBAAqB,CAAC,QAAD,EAAW;AACpC,MAAA,GAAG,EAAE,aAAa,CAAC,GAAD,EAAM,QAAN,CADkB;AAEpC,MAAA,IAAI,EAAE,KAF8B;AAGpC,SAAG,KAHiC;AAIpC,MAAA,QAJoC;AAKpC,MAAA;AALoC,KAAX,CANtB;AAaL,IAAA,IAAI,EAAE,aAbD;AAcL,IAAA,QAAQ,EAAE,OAAO,CAAC,CAAA,aAAa,KAAA,IAAb,IAAA,aAAa,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAA,aAAa,CAAE,QAAf,KAA2B,CAAC,gBAAgB,CAAC,QAA9C,CAdZ;AAeL,IAAA,OAAO,EAAE,gBAfJ;AAgBL,IAAA,UAhBK;AAiBL,IAAA,QAjBK;AAkBL,IAAA,QAlBK;AAmBL,IAAA,IAnBK;AAoBL,IAAA,KApBK;AAqBL,IAAA;AArBK,GAAP;AAuBD,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 */\nexport const useTab_unstable = (props: TabProps, ref: React.Ref<HTMLElement>): TabState => {\n const { content, disabled: tabDisabled = false, icon, value } = props;\n\n const appearance = useContextSelector(TabListContext, ctx => ctx.appearance);\n const listDisabled = useContextSelector(TabListContext, ctx => ctx.disabled);\n const selected = useContextSelector(TabListContext, ctx => ctx.selectedValue === value);\n const onRegister = useContextSelector(TabListContext, ctx => ctx.onRegister);\n const onUnregister = useContextSelector(TabListContext, ctx => ctx.onUnregister);\n const onSelect = useContextSelector(TabListContext, ctx => ctx.onSelect);\n const size = useContextSelector(TabListContext, ctx => ctx.size);\n const vertical = useContextSelector(TabListContext, ctx => !!ctx.vertical);\n const disabled = listDisabled || tabDisabled;\n\n const innerRef = React.useRef<HTMLElement>(null);\n const onClick = useEventCallback((event: SelectTabEvent) => onSelect(event, { value }));\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 const iconShorthand = resolveShorthand(icon);\n const contentShorthand = resolveShorthand(content, { required: true, defaultProps: { children: props.children } });\n return {\n components: {\n root: 'button',\n icon: 'span',\n content: 'span',\n },\n root: getNativeElementProps('button', {\n ref: useMergedRefs(ref, innerRef),\n role: 'tab',\n ...props,\n disabled,\n onClick,\n }),\n icon: iconShorthand,\n iconOnly: Boolean(iconShorthand?.children && !contentShorthand.children),\n content: contentShorthand,\n appearance,\n disabled,\n selected,\n size,\n value,\n vertical,\n };\n};\n"],"sourceRoot":"../src/"}