@fluentui/react-tabs 1.0.0-beta.98 → 9.0.0-beta.7

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 +71 -1840
  2. package/CHANGELOG.md +24 -743
  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 +19 -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 -2
  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 -2
  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 -2
  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
@@ -0,0 +1,118 @@
1
+ import { __styles, mergeClasses, shorthands } from '@griffel/react';
2
+ import { tokens } from '@fluentui/react-theme';
3
+ import { usePrevious } from '@fluentui/react-utilities';
4
+ import { tabPendingDesignTokens } from '../../tab.constants';
5
+ export const tabListClassName = 'fui-TabList';
6
+ export const tabListSelectionIndicatorName = 'fui-TabList_SelectionIndicator';
7
+ export const indicatorOffsetVar = '--selection-indicator-offset';
8
+ export const indicatorLengthVar = '--selection-indicator-length';
9
+ /**
10
+ * Styles for the root slot
11
+ */
12
+
13
+ const useStyles = /*#__PURE__*/__styles({
14
+ "root": {
15
+ "mc9l5x": "f22iagw",
16
+ "Beiy3e4": "f1063pyq",
17
+ "qhf8xq": "f10pi13n"
18
+ },
19
+ "vertical": {
20
+ "Beiy3e4": "f1vx9l62"
21
+ }
22
+ }, {
23
+ "d": [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f1063pyq{-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}", ".f10pi13n{position:relative;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}"]
24
+ });
25
+ /**
26
+ * Styles for the selection indicator slot when horizontal.
27
+ */
28
+
29
+
30
+ const useHorizontalIndicatorStyles = /*#__PURE__*/__styles({
31
+ "base": {
32
+ "Bkbwdz4": "f30248y",
33
+ "frdscb": ["fvxed1z", "f1j2a01o"],
34
+ "B9nohqn": ["f1j2a01o", "fvxed1z"],
35
+ "B1dhsta": ["fsamouo", "f1aazreq"],
36
+ "Bjdmjzx": ["f1aazreq", "fsamouo"],
37
+ "Bj55yzk": "fw2wsqs",
38
+ "oqd9ik": "ffdc0f3",
39
+ "Bs6t6z0": "fqc6z8f",
40
+ "mpb1vu": "f119hevp",
41
+ "jc51t6": ["f1uyszuw", "f1xp83vy"],
42
+ "Hdbjpj": "f11ef69",
43
+ "Biobvvw": "f1tzy5p2",
44
+ "Bunff0j": "fs357bs"
45
+ },
46
+ "small": {
47
+ "jc51t6": ["f1w3ykbk", "f1xm0lqg"],
48
+ "Biobvvw": "f1akpkq3"
49
+ },
50
+ "animated": {
51
+ "wbfbqe": ["fjzde92", "f1xfxhj5"],
52
+ "mafdb0": "f1fuwhvj"
53
+ }
54
+ }, {
55
+ "d": [".f30248y:after{background-color:var(--colorBrandStroke1);}", ".fvxed1z:after{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f1j2a01o:after{border-bottom-left-radius:var(--borderRadiusMedium);}", ".fsamouo:after{border-top-right-radius:var(--borderRadiusMedium);}", ".f1aazreq:after{border-top-left-radius:var(--borderRadiusMedium);}", ".fw2wsqs:after{bottom:0;}", ".ffdc0f3:after{box-sizing:border-box;}", ".fqc6z8f:after{content:\"\";}", ".f119hevp:after{height:2px;}", ".f1uyszuw:after{left:calc(var(--selection-indicator-offset) + 10px);}", ".f1xp83vy:after{right:calc(var(--selection-indicator-offset) + 10px);}", ".f11ef69:after{position:absolute;}", ".f1tzy5p2:after{width:calc(var(--selection-indicator-length) - (2 * 10px));}", ".fs357bs:after{z-index:1;}", ".f1w3ykbk:after{left:calc(var(--selection-indicator-offset) + 6px);}", ".f1xm0lqg:after{right:calc(var(--selection-indicator-offset) + 6px);}", ".f1akpkq3:after{width:calc(var(--selection-indicator-length) - (2 * 6px));}", ".fjzde92:after{transition-property:left,width;}", ".f1xfxhj5:after{transition-property:right,width;}", ".f1fuwhvj:after{transition-duration:350ms,350ms;}"]
56
+ });
57
+ /**
58
+ * Styles for the selection indicator slot when vertical.
59
+ */
60
+
61
+
62
+ const useVerticalIndicatorStyles = /*#__PURE__*/__styles({
63
+ "base": {
64
+ "B1dvbpk": "fa05st",
65
+ "px8gyy": ["f16to4m4", "f1ceoihi"],
66
+ "B5c9fhp": ["f1ceoihi", "f16to4m4"],
67
+ "Bhe99jt": ["fkibbow", "fnlo9u7"],
68
+ "B2r1szc": ["fnlo9u7", "fkibbow"],
69
+ "Bmqnesq": "f170vdtw",
70
+ "rurcny": "fuzzvh5",
71
+ "Bbc2r3f": "f13xaayz",
72
+ "Byque4d": ["f1t0u0az", "fmlx6bj"],
73
+ "xx9plb": "fxf9f1y",
74
+ "Bf8kmfk": "fwt37qm",
75
+ "Bdn98qo": "f15bpuwh",
76
+ "Bab4cu6": "f1ijlm3k"
77
+ },
78
+ "small": {
79
+ "Bf8kmfk": "f8k0k00",
80
+ "Bbc2r3f": "fyephjl"
81
+ },
82
+ "animated": {
83
+ "iukgx1": "fcs48rj",
84
+ "B5szp9g": "f1u309tb"
85
+ }
86
+ }, {
87
+ "d": [".fa05st:before{background-color:var(--colorBrandStroke1);}", ".f16to4m4:before{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f1ceoihi:before{border-bottom-left-radius:var(--borderRadiusMedium);}", ".fkibbow:before{border-top-right-radius:var(--borderRadiusMedium);}", ".fnlo9u7:before{border-top-left-radius:var(--borderRadiusMedium);}", ".f170vdtw:before{box-sizing:border-box;}", ".fuzzvh5:before{content:\"\";}", ".f13xaayz:before{height:calc(var(--selection-indicator-length) - (2 * 10px));}", ".f1t0u0az:before{left:0;}", ".fmlx6bj:before{right:0;}", ".fxf9f1y:before{position:absolute;}", ".fwt37qm:before{top:calc(var(--selection-indicator-offset) + 10px);}", ".f15bpuwh:before{width:2px;}", ".f1ijlm3k:before{z-index:1;}", ".f8k0k00:before{top:calc(var(--selection-indicator-offset) + 6px);}", ".fyephjl:before{height:calc(var(--selection-indicator-length) - (2 * 6px));}", ".fcs48rj:before{transition-property:top,height;}", ".f1u309tb:before{transition-duration:350ms,350ms;}"]
88
+ });
89
+ /**
90
+ * Apply styling to the TabList slots based on the state
91
+ */
92
+ // eslint-disable-next-line @typescript-eslint/naming-convention
93
+
94
+
95
+ export const useTabListStyles_unstable = state => {
96
+ const {
97
+ selectedTabRect: selectionIndicatorRect,
98
+ selectedValue,
99
+ size,
100
+ vertical
101
+ } = state; // only animate when the selected value has changed
102
+
103
+ const previousSelectedValue = usePrevious(selectedValue);
104
+ const shouldAnimate = !!previousSelectedValue && previousSelectedValue !== selectedValue;
105
+ const styles = useStyles();
106
+ const horizontalIndicatorStyles = useHorizontalIndicatorStyles();
107
+ const verticalIndicatorStyles = useVerticalIndicatorStyles();
108
+ state.root.className = mergeClasses(tabListClassName, styles.root, vertical && styles.vertical, !!selectedValue && (vertical ? verticalIndicatorStyles.base : horizontalIndicatorStyles.base), !!selectedValue && size === 'small' && (vertical ? verticalIndicatorStyles.small : horizontalIndicatorStyles.small), !!selectedValue && shouldAnimate && (vertical ? verticalIndicatorStyles.animated : horizontalIndicatorStyles.animated), state.root.className);
109
+ const rootCssVars = selectionIndicatorRect ? {
110
+ [indicatorOffsetVar]: vertical ? `${selectionIndicatorRect.y}px` : `${selectionIndicatorRect.x}px`,
111
+ [indicatorLengthVar]: vertical ? `${selectionIndicatorRect.height}px` : `${selectionIndicatorRect.width}px`
112
+ } : {};
113
+ state.root.style = { ...rootCssVars,
114
+ ...state.root.style
115
+ };
116
+ return state;
117
+ };
118
+ //# sourceMappingURL=useTabListStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/TabList/useTabListStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,EAAmC,UAAnC,QAAqD,gBAArD;AAEA,SAAS,MAAT,QAAuB,uBAAvB;AACA,SAAS,WAAT,QAA4B,2BAA5B;AACA,SAAS,sBAAT,QAAuC,qBAAvC;AAEA,OAAO,MAAM,gBAAgB,GAAG,aAAzB;AACP,OAAO,MAAM,6BAA6B,GAAG,gCAAtC;AAEP,OAAO,MAAM,kBAAkB,GAAG,8BAA3B;AACP,OAAO,MAAM,kBAAkB,GAAG,8BAA3B;AAEP;;AAEG;;AACH,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAWA;;AAEG;;;AACH,MAAM,4BAA4B,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAArC;AA6BA;;AAEG;;;AACH,MAAM,0BAA0B,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAnC;AA6BA;;AAEG;AACH;;;AACA,OAAO,MAAM,yBAAyB,GAAI,KAAD,IAAsC;AAC7E,QAAM;AAAE,IAAA,eAAe,EAAE,sBAAnB;AAA2C,IAAA,aAA3C;AAA0D,IAAA,IAA1D;AAAgE,IAAA;AAAhE,MAA6E,KAAnF,CAD6E,CAG7E;;AACA,QAAM,qBAAqB,GAAG,WAAW,CAAC,aAAD,CAAzC;AACA,QAAM,aAAa,GAAG,CAAC,CAAC,qBAAF,IAA2B,qBAAqB,KAAK,aAA3E;AAEA,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,QAAM,yBAAyB,GAAG,4BAA4B,EAA9D;AACA,QAAM,uBAAuB,GAAG,0BAA0B,EAA1D;AAEA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,gBADiC,EAEjC,MAAM,CAAC,IAF0B,EAGjC,QAAQ,IAAI,MAAM,CAAC,QAHc,EAIjC,CAAC,CAAC,aAAF,KAAoB,QAAQ,GAAG,uBAAuB,CAAC,IAA3B,GAAkC,yBAAyB,CAAC,IAAxF,CAJiC,EAKjC,CAAC,CAAC,aAAF,IAAmB,IAAI,KAAK,OAA5B,KAAwC,QAAQ,GAAG,uBAAuB,CAAC,KAA3B,GAAmC,yBAAyB,CAAC,KAA7G,CALiC,EAMjC,CAAC,CAAC,aAAF,IACE,aADF,KAEG,QAAQ,GAAG,uBAAuB,CAAC,QAA3B,GAAsC,yBAAyB,CAAC,QAF3E,CANiC,EASjC,KAAK,CAAC,IAAN,CAAW,SATsB,CAAnC;AAYA,QAAM,WAAW,GAAG,sBAAsB,GACtC;AACE,KAAC,kBAAD,GAAsB,QAAQ,GAAG,GAAG,sBAAsB,CAAC,CAAC,IAA9B,GAAqC,GAAG,sBAAsB,CAAC,CAAC,IADhG;AAEE,KAAC,kBAAD,GAAsB,QAAQ,GAAG,GAAG,sBAAsB,CAAC,MAAM,IAAnC,GAA0C,GAAG,sBAAsB,CAAC,KAAK;AAFzG,GADsC,GAKtC,EALJ;AAOA,EAAA,KAAK,CAAC,IAAN,CAAW,KAAX,GAAmB,EACjB,GAAG,WADc;AAEjB,OAAG,KAAK,CAAC,IAAN,CAAW;AAFG,GAAnB;AAKA,SAAO,KAAP;AACD,CApCM","sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { TabListState } from './TabList.types';\nimport { tokens } from '@fluentui/react-theme';\nimport { usePrevious } from '@fluentui/react-utilities';\nimport { tabPendingDesignTokens } from '../../tab.constants';\n\nexport const tabListClassName = 'fui-TabList';\nexport const tabListSelectionIndicatorName = 'fui-TabList_SelectionIndicator';\n\nexport const indicatorOffsetVar = '--selection-indicator-offset';\nexport const indicatorLengthVar = '--selection-indicator-length';\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n position: 'relative',\n },\n vertical: {\n flexDirection: 'column',\n },\n});\n\n/**\n * Styles for the selection indicator slot when horizontal.\n */\nconst useHorizontalIndicatorStyles = makeStyles({\n base: {\n ':after': {\n backgroundColor: tokens.colorBrandStroke1,\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n bottom: 0,\n boxSizing: 'border-box',\n content: '\"\"',\n height: tabPendingDesignTokens.indicatorThickness,\n left: `calc(var(${indicatorOffsetVar}) + ${tabPendingDesignTokens.tabPadding.medium})`,\n position: 'absolute',\n width: `calc(var(${indicatorLengthVar}) - (2 * ${tabPendingDesignTokens.tabPadding.medium}))`,\n zIndex: 1,\n },\n },\n small: {\n ':after': {\n left: `calc(var(${indicatorOffsetVar}) + ${tabPendingDesignTokens.tabPadding.small})`,\n width: `calc(var(${indicatorLengthVar}) - (2 * ${tabPendingDesignTokens.tabPadding.small}))`,\n },\n },\n animated: {\n ':after': {\n transitionProperty: 'left, width',\n transitionDuration: `350ms, 350ms`,\n },\n },\n});\n\n/**\n * Styles for the selection indicator slot when vertical.\n */\nconst useVerticalIndicatorStyles = makeStyles({\n base: {\n ':before': {\n backgroundColor: tokens.colorBrandStroke1,\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n boxSizing: 'border-box',\n content: '\"\"',\n height: `calc(var(${indicatorLengthVar}) - (2 * ${tabPendingDesignTokens.tabPadding.medium}))`,\n left: '0',\n position: 'absolute',\n top: `calc(var(${indicatorOffsetVar}) + ${tabPendingDesignTokens.tabPadding.medium})`,\n width: tabPendingDesignTokens.indicatorThickness,\n zIndex: 1,\n },\n },\n small: {\n ':before': {\n top: `calc(var(${indicatorOffsetVar}) + ${tabPendingDesignTokens.tabPadding.small})`,\n height: `calc(var(${indicatorLengthVar}) - (2 * ${tabPendingDesignTokens.tabPadding.small}))`,\n },\n },\n animated: {\n ':before': {\n transitionProperty: 'top, height',\n transitionDuration: `350ms, 350ms`,\n },\n },\n});\n\n/**\n * Apply styling to the TabList slots based on the state\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const useTabListStyles_unstable = (state: TabListState): TabListState => {\n const { selectedTabRect: selectionIndicatorRect, selectedValue, size, vertical } = state;\n\n // only animate when the selected value has changed\n const previousSelectedValue = usePrevious(selectedValue);\n const shouldAnimate = !!previousSelectedValue && previousSelectedValue !== selectedValue;\n\n const styles = useStyles();\n const horizontalIndicatorStyles = useHorizontalIndicatorStyles();\n const verticalIndicatorStyles = useVerticalIndicatorStyles();\n\n state.root.className = mergeClasses(\n tabListClassName,\n styles.root,\n vertical && styles.vertical,\n !!selectedValue && (vertical ? verticalIndicatorStyles.base : horizontalIndicatorStyles.base),\n !!selectedValue && size === 'small' && (vertical ? verticalIndicatorStyles.small : horizontalIndicatorStyles.small),\n !!selectedValue &&\n shouldAnimate &&\n (vertical ? verticalIndicatorStyles.animated : horizontalIndicatorStyles.animated),\n state.root.className,\n );\n\n const rootCssVars = selectionIndicatorRect\n ? {\n [indicatorOffsetVar]: vertical ? `${selectionIndicatorRect.y}px` : `${selectionIndicatorRect.x}px`,\n [indicatorLengthVar]: vertical ? `${selectionIndicatorRect.height}px` : `${selectionIndicatorRect.width}px`,\n }\n : {};\n\n state.root.style = {\n ...rootCssVars,\n ...state.root.style,\n };\n\n return state;\n};\n"],"sourceRoot":"../src/"}
package/lib/index.d.ts CHANGED
@@ -1 +1,2 @@
1
- export * from './Tabs';
1
+ export * from './Tab';
2
+ export * from './TabList';
package/lib/index.js CHANGED
@@ -1,2 +1,3 @@
1
- export * from './Tabs';
1
+ export * from './Tab';
2
+ export * from './TabList';
2
3
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC","sourcesContent":["export * from './Tabs';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC","sourcesContent":["export * from './Tab';\nexport * from './TabList';\n"]}
@@ -0,0 +1,15 @@
1
+ export declare const tabPendingDesignTokens: {
2
+ tabPadding: {
3
+ medium: string;
4
+ small: string;
5
+ };
6
+ indicatorThickness: string;
7
+ gap: {
8
+ medium: string;
9
+ small: string;
10
+ };
11
+ contentPadding: {
12
+ medium: string;
13
+ small: string;
14
+ };
15
+ };
@@ -0,0 +1,17 @@
1
+ // TODO: These constants should be replaced with design tokens
2
+ export const tabPendingDesignTokens = {
3
+ tabPadding: {
4
+ medium: '10px',
5
+ small: '6px'
6
+ },
7
+ indicatorThickness: '2px',
8
+ gap: {
9
+ medium: '6px',
10
+ small: '2px'
11
+ },
12
+ contentPadding: {
13
+ medium: '2px',
14
+ small: '2px'
15
+ }
16
+ };
17
+ //# sourceMappingURL=tab.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["tab.constants.ts"],"names":[],"mappings":"AAAA;AACA,OAAO,MAAM,sBAAsB,GAAG;AACpC,EAAA,UAAU,EAAE;AACV,IAAA,MAAM,EAAE,MADE;AAEV,IAAA,KAAK,EAAE;AAFG,GADwB;AAKpC,EAAA,kBAAkB,EAAE,KALgB;AAMpC,EAAA,GAAG,EAAE;AAAE,IAAA,MAAM,EAAE,KAAV;AAAiB,IAAA,KAAK,EAAE;AAAxB,GAN+B;AAOpC,EAAA,cAAc,EAAE;AACd,IAAA,MAAM,EAAE,KADM;AAEd,IAAA,KAAK,EAAE;AAFO;AAPoB,CAA/B","sourcesContent":["// TODO: These constants should be replaced with design tokens\nexport const tabPendingDesignTokens = {\n tabPadding: {\n medium: '10px',\n small: '6px',\n },\n indicatorThickness: '2px',\n gap: { medium: '6px', small: '2px' },\n contentPadding: {\n medium: '2px',\n small: '2px',\n },\n};\n"],"sourceRoot":"../src/"}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.13.0"
8
+ "packageVersion": "7.18.1"
9
9
  }
10
10
  ]
11
11
  }
@@ -0,0 +1 @@
1
+ export * from './components/Tab/index';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./components/Tab/index"), exports);
10
+ //# sourceMappingURL=Tab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Tab.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Tab/index';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1 @@
1
+ export * from './components/TabList/index';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./components/TabList/index"), exports);
10
+ //# sourceMappingURL=TabList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["TabList.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,4BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/TabList/index';\n"],"sourceRoot":"../src/"}
@@ -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,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Tab = void 0;
7
+
8
+ const React = /*#__PURE__*/require("react");
9
+
10
+ const useTab_1 = /*#__PURE__*/require("./useTab");
11
+
12
+ const renderTab_1 = /*#__PURE__*/require("./renderTab");
13
+
14
+ const useTabStyles_1 = /*#__PURE__*/require("./useTabStyles");
15
+ /**
16
+ * A tab provides a selectable item in a tab list.
17
+ */
18
+
19
+
20
+ exports.Tab = /*#__PURE__*/React.forwardRef((props, ref) => {
21
+ const state = useTab_1.useTab_unstable(props, ref);
22
+ useTabStyles_1.useTabStyles_unstable(state);
23
+ return renderTab_1.renderTab_unstable(state);
24
+ });
25
+ exports.Tab.displayName = 'Tab';
26
+ //# sourceMappingURL=Tab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Tab/Tab.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,QAAA,gBAAA,OAAA,CAAA,UAAA,CAAA;;AACA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,GAAA,gBAAqC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAChF,QAAM,KAAK,GAAG,QAAA,CAAA,eAAA,CAAgB,KAAhB,EAAuB,GAAvB,CAAd;AAEA,EAAA,cAAA,CAAA,qBAAA,CAAsB,KAAtB;AACA,SAAO,WAAA,CAAA,kBAAA,CAAmB,KAAnB,CAAP;AACD,CALiD,CAArC;AAOb,OAAA,CAAA,GAAA,CAAI,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,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=Tab.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
@@ -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,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./Tab"), exports);
10
+
11
+ tslib_1.__exportStar(require("./Tab.types"), exports);
12
+
13
+ tslib_1.__exportStar(require("./renderTab"), exports);
14
+
15
+ tslib_1.__exportStar(require("./useTab"), exports);
16
+
17
+ tslib_1.__exportStar(require("./useTabStyles"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Tab/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,OAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,aAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,aAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,UAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './Tab';\nexport * from './Tab.types';\nexport * from './renderTab';\nexport * from './useTab';\nexport * from './useTabStyles';\n"],"sourceRoot":"../src/"}
@@ -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,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.renderTab_unstable = void 0;
7
+
8
+ const React = /*#__PURE__*/require("react");
9
+
10
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
11
+ /**
12
+ * Render the final JSX of Tab
13
+ */
14
+ // eslint-disable-next-line @typescript-eslint/naming-convention
15
+
16
+
17
+ const renderTab_unstable = state => {
18
+ const {
19
+ slots,
20
+ slotProps
21
+ } = react_utilities_1.getSlots(state);
22
+ return React.createElement(slots.root, { ...slotProps.root
23
+ }, slots.icon && React.createElement(slots.icon, { ...slotProps.icon
24
+ }), React.createElement(slots.content, { ...slotProps.content
25
+ }));
26
+ };
27
+
28
+ exports.renderTab_unstable = renderTab_unstable;
29
+ //# sourceMappingURL=renderTab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Tab/renderTab.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;AACH;;;AACO,MAAM,kBAAkB,GAAI,KAAD,IAAoB;AACpD,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,iBAAA,CAAA,QAAA,CAAmB,KAAnB,CAA7B;AAEA,SACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,KAAK,CAAC,IAAN,IAAc,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;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","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,95 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useTab_unstable = void 0;
7
+
8
+ const React = /*#__PURE__*/require("react");
9
+
10
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
11
+
12
+ const TabListContext_1 = /*#__PURE__*/require("../TabList/TabListContext");
13
+
14
+ const react_context_selector_1 = /*#__PURE__*/require("@fluentui/react-context-selector");
15
+ /**
16
+ * Create the state required to render Tab.
17
+ *
18
+ * The returned state can be modified with hooks such as useTabStyles_unstable,
19
+ * before being passed to renderTab_unstable.
20
+ *
21
+ * @param props - props from this instance of Tab
22
+ * @param ref - reference to root HTMLElement of Tab
23
+ */
24
+ // eslint-disable-next-line @typescript-eslint/naming-convention
25
+
26
+
27
+ const useTab_unstable = (props, ref) => {
28
+ const {
29
+ content,
30
+ icon,
31
+ value
32
+ } = props;
33
+ const {
34
+ appearance,
35
+ selected,
36
+ onRegister,
37
+ onUnregister,
38
+ onSelect,
39
+ size,
40
+ vertical
41
+ } = react_context_selector_1.useContextSelector(TabListContext_1.TabListContext, ctx => ({
42
+ appearance: ctx.appearance,
43
+ selected: ctx.selectedValue === value,
44
+ onRegister: ctx.onRegister,
45
+ onUnregister: ctx.onUnregister,
46
+ onSelect: ctx.onSelect,
47
+ size: ctx.size,
48
+ vertical: !!ctx.vertical
49
+ }));
50
+ const onClick = react_utilities_1.useEventCallback(event => onSelect(event, {
51
+ value
52
+ }));
53
+ const innerRef = React.useRef(null);
54
+ React.useEffect(() => {
55
+ onRegister({
56
+ value,
57
+ ref: innerRef
58
+ });
59
+ return () => {
60
+ onUnregister({
61
+ value,
62
+ ref: innerRef
63
+ });
64
+ };
65
+ }, [onRegister, onUnregister, innerRef, value]);
66
+ return {
67
+ components: {
68
+ root: 'div',
69
+ icon: 'span',
70
+ content: 'span'
71
+ },
72
+ root: react_utilities_1.getNativeElementProps('div', {
73
+ ref: react_utilities_1.useMergedRefs(ref, innerRef),
74
+ role: 'tab',
75
+ tabIndex: 0,
76
+ ...props,
77
+ onClick
78
+ }),
79
+ icon: react_utilities_1.resolveShorthand(icon),
80
+ content: react_utilities_1.resolveShorthand(content, {
81
+ required: true,
82
+ defaultProps: {
83
+ children: props.children
84
+ }
85
+ }),
86
+ appearance,
87
+ selected,
88
+ size,
89
+ value,
90
+ vertical
91
+ };
92
+ };
93
+
94
+ exports.useTab_unstable = useTab_unstable;
95
+ //# sourceMappingURL=useTab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Tab/useTab.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,gBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;AAGA;;;;;;;;AAQG;AACH;;;AACO,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,wBAAA,CAAA,kBAAA,CACnF,gBAAA,CAAA,cADmF,EAEnF,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,CAFgF,CAArF;AAaA,QAAM,OAAO,GAAG,iBAAA,CAAA,gBAAA,CAAkB,KAAD,IAA2B,QAAQ,CAAC,KAAD,EAAQ;AAAE,IAAA;AAAF,GAAR,CAApD,CAAhB;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,iBAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B;AACjC,MAAA,GAAG,EAAE,iBAAA,CAAA,aAAA,CAAc,GAAd,EAAmB,QAAnB,CAD4B;AAEjC,MAAA,IAAI,EAAE,KAF2B;AAGjC,MAAA,QAAQ,EAAE,CAHuB;AAIjC,SAAG,KAJ8B;AAKjC,MAAA;AALiC,KAA7B,CAND;AAaL,IAAA,IAAI,EAAE,iBAAA,CAAA,gBAAA,CAAiB,IAAjB,CAbD;AAcL,IAAA,OAAO,EAAE,iBAAA,CAAA,gBAAA,CAAiB,OAAjB,EAA0B;AAAE,MAAA,QAAQ,EAAE,IAAZ;AAAkB,MAAA,YAAY,EAAE;AAAE,QAAA,QAAQ,EAAE,KAAK,CAAC;AAAlB;AAAhC,KAA1B,CAdJ;AAeL,IAAA,UAfK;AAgBL,IAAA,QAhBK;AAiBL,IAAA,IAjBK;AAkBL,IAAA,KAlBK;AAmBL,IAAA;AAnBK,GAAP;AAqBD,CApDM;;AAAM,OAAA,CAAA,eAAA,GAAe,eAAf","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;