@fluentui/react-tabs 1.0.0-beta.96 → 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 -1817
  2. package/CHANGELOG.md +17 -729
  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 -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,205 @@
1
+ import { __styles, mergeClasses, shorthands } from '@griffel/react';
2
+ import { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';
3
+ import { tokens } from '@fluentui/react-theme';
4
+ import { tabPendingDesignTokens } from '../../tab.constants';
5
+ export const tabClassName = 'fui-Tab';
6
+ /**
7
+ * Styles for the root slot
8
+ */
9
+
10
+ const useRootStyles = /*#__PURE__*/__styles({
11
+ "base": {
12
+ "De3pzq": "flu3bqm",
13
+ "g2u3we": "fwhevhj",
14
+ "h3c5rm": ["f61n433", "f1q8l70w"],
15
+ "B9xav0g": "fv1dfc8",
16
+ "zhjwy3": ["f1q8l70w", "f61n433"],
17
+ "Bbmb7ep": ["f1aa9q02", "f16jpd5f"],
18
+ "Beyfa6y": ["f16jpd5f", "f1aa9q02"],
19
+ "B7oj6ja": ["f1jar5jt", "fyu767a"],
20
+ "Btl43ni": ["fyu767a", "f1jar5jt"],
21
+ "B4j52fo": "f192inf7",
22
+ "Bekrc4i": ["f5tn483", "f1ojsxk5"],
23
+ "Bn0qgzm": "f1vxd6vx",
24
+ "ibv6hh": ["f1ojsxk5", "f5tn483"],
25
+ "i8kkvl": "fgfbwa2",
26
+ "Bceei9c": "f1k6fduh",
27
+ "mc9l5x": "f22iagw",
28
+ "Beiy3e4": "f1063pyq",
29
+ "Bahqtrf": "fk6fouc",
30
+ "Be2twd7": "fkhj508",
31
+ "Bg96gwp": "f1i3iumi",
32
+ "z8tnut": "f1809wu7",
33
+ "z189sj": ["f81rol6", "frdkuqy"],
34
+ "Byoj8tv": "f1fow5ox",
35
+ "uwmqm3": ["frdkuqy", "f81rol6"],
36
+ "qhf8xq": "f10pi13n",
37
+ "B68tc82": "f1p9o1ba",
38
+ "Bmxbyg5": "f1sil6mw"
39
+ },
40
+ "horizontal": {
41
+ "Bt984gj": "f122n59",
42
+ "Brf1p80": "f4d9j23"
43
+ },
44
+ "vertical": {
45
+ "Bt984gj": "f122n59",
46
+ "Brf1p80": "fbhxue7"
47
+ },
48
+ "small": {
49
+ "z8tnut": "f1xp5gbu",
50
+ "z189sj": ["f1sgzk6v", "f1bg5zqg"],
51
+ "Byoj8tv": "f1d7kygh",
52
+ "uwmqm3": ["f1bg5zqg", "f1sgzk6v"],
53
+ "i8kkvl": "f16mnhsx"
54
+ },
55
+ "subtle": {
56
+ "Jwef8y": "f1knas48"
57
+ }
58
+ }, {
59
+ "d": [".flu3bqm{background-color:none;}", ".fwhevhj{border-top-color:none;}", ".f61n433{border-right-color:none;}", ".f1q8l70w{border-left-color:none;}", ".fv1dfc8{border-bottom-color:none;}", ".f1aa9q02{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f16jpd5f{border-bottom-left-radius:var(--borderRadiusMedium);}", ".f1jar5jt{border-top-right-radius:var(--borderRadiusMedium);}", ".fyu767a{border-top-left-radius:var(--borderRadiusMedium);}", ".f192inf7{border-top-width:var(--strokeWidthThin);}", ".f5tn483{border-right-width:var(--strokeWidthThin);}", ".f1ojsxk5{border-left-width:var(--strokeWidthThin);}", ".f1vxd6vx{border-bottom-width:var(--strokeWidthThin);}", ".fgfbwa2{-webkit-column-gap:6px;column-gap:6px;}", ".f1k6fduh{cursor:pointer;}", ".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f1063pyq{-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".f1809wu7{padding-top:10px;}", ".f81rol6{padding-right:10px;}", ".frdkuqy{padding-left:10px;}", ".f1fow5ox{padding-bottom:10px;}", ".f10pi13n{position:relative;}", ".f1p9o1ba{overflow-x:hidden;}", ".f1sil6mw{overflow-y:hidden;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".f4d9j23{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;}", ".fbhxue7{-webkit-box-pack:start;-ms-flex-pack:start;-webkit-justify-content:flex-start;justify-content:flex-start;}", ".f1xp5gbu{padding-top:6px;}", ".f1sgzk6v{padding-right:6px;}", ".f1bg5zqg{padding-left:6px;}", ".f1d7kygh{padding-bottom:6px;}", ".f16mnhsx{-webkit-column-gap:2px;column-gap:2px;}"],
60
+ "h": [".f1knas48:hover{background-color:var(--colorNeutralBackground1Hover);}"]
61
+ });
62
+ /**
63
+ * Focus styles for the root slot
64
+ */
65
+
66
+
67
+ const useFocusStyles = /*#__PURE__*/__styles({
68
+ "base": {
69
+ "B486eqv": "f2hkw1w",
70
+ "Bnmjwt4": "flfsvnh",
71
+ "Jopkrh": ["f1781m5e", "flvaaa9"],
72
+ "hhrs2v": "f50u1b5",
73
+ "B7jbng7": ["flvaaa9", "f1781m5e"],
74
+ "B32s92o": "fgeg2qa",
75
+ "Bh48x57": "f19j8a82",
76
+ "B5hngm5": "fhcq1yo",
77
+ "D4py6b": "f1gkya50",
78
+ "Bgwpjed": "fpt6wn7"
79
+ }
80
+ }, {
81
+ "i": [".f2hkw1w:focus-visible{outline-style:none;}"],
82
+ "d": ["[data-keyboard-nav] .flfsvnh:focus{border-top-color:transparent;}", "[data-keyboard-nav] .f1781m5e:focus{border-right-color:transparent;}", "[data-keyboard-nav] .flvaaa9:focus{border-left-color:transparent;}", "[data-keyboard-nav] .f50u1b5:focus{border-bottom-color:transparent;}", "[data-keyboard-nav] .fgeg2qa:focus{outline-width:var(--strokeWidthThick);}", "[data-keyboard-nav] .f19j8a82:focus{outline-color:transparent;}", "[data-keyboard-nav] .fhcq1yo:focus{outline-style:solid;}", "[data-keyboard-nav] .f1gkya50:focus{box-shadow:var(--shadow4),0 0 0 var(--strokeWidthThick) var(--colorStrokeFocus2);}", "[data-keyboard-nav] .fpt6wn7:focus{z-index:1;}"]
83
+ });
84
+ /**
85
+ * Indicator styles for the root slot when horizontal.
86
+ */
87
+
88
+
89
+ const useHorizontalIndicatorStyles = /*#__PURE__*/__styles({
90
+ "base": {
91
+ "Bkbwdz4": "f1mif8u4",
92
+ "frdscb": ["fvxed1z", "f1j2a01o"],
93
+ "B9nohqn": ["f1j2a01o", "fvxed1z"],
94
+ "B1dhsta": ["fsamouo", "f1aazreq"],
95
+ "Bjdmjzx": ["f1aazreq", "fsamouo"],
96
+ "oqd9ik": "ffdc0f3",
97
+ "Bs6t6z0": "fqc6z8f",
98
+ "Hdbjpj": "f11ef69",
99
+ "mpb1vu": "f119hevp",
100
+ "Bj55yzk": "fw2wsqs",
101
+ "jc51t6": ["f1l9humg", "f3c5rjh"],
102
+ "cnmfks": ["f3c5rjh", "f1l9humg"],
103
+ "Bt86n75": "fg6xmog"
104
+ },
105
+ "small": {
106
+ "jc51t6": ["f1i8k3s6", "fy447wy"],
107
+ "cnmfks": ["fy447wy", "f1i8k3s6"]
108
+ }
109
+ }, {
110
+ "d": [".f1mif8u4:after{background-color:none;}", ".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);}", ".ffdc0f3:after{box-sizing:border-box;}", ".fqc6z8f:after{content:\"\";}", ".f11ef69:after{position:absolute;}", ".f119hevp:after{height:2px;}", ".fw2wsqs:after{bottom:0;}", ".f1l9humg:after{left:10px;}", ".f3c5rjh:after{right:10px;}", ".f1i8k3s6:after{left:6px;}", ".fy447wy:after{right:6px;}"],
111
+ "h": [".fg6xmog:hover:after{background-color:var(--colorNeutralStroke1);}"]
112
+ });
113
+ /**
114
+ * Indicator styles for the root slot when vertical.
115
+ */
116
+
117
+
118
+ const useVerticalIndicatorStyles = /*#__PURE__*/__styles({
119
+ "base": {
120
+ "B1dvbpk": "ffgj6zs",
121
+ "px8gyy": ["f16to4m4", "f1ceoihi"],
122
+ "B5c9fhp": ["f1ceoihi", "f16to4m4"],
123
+ "Bhe99jt": ["fkibbow", "fnlo9u7"],
124
+ "B2r1szc": ["fnlo9u7", "fkibbow"],
125
+ "Bmqnesq": "f170vdtw",
126
+ "rurcny": "fuzzvh5",
127
+ "xx9plb": "fxf9f1y",
128
+ "Bdn98qo": "f15bpuwh",
129
+ "Byque4d": ["f1t0u0az", "fmlx6bj"],
130
+ "Bf8kmfk": "f1bwym7p",
131
+ "Bj2wrql": "fk3f4e0",
132
+ "Cgij5x": "fl6lm7t"
133
+ },
134
+ "small": {
135
+ "Bf8kmfk": "fp6nmmp",
136
+ "Bj2wrql": "f14i0ki9"
137
+ }
138
+ }, {
139
+ "d": [".ffgj6zs:before{background-color:none;}", ".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:\"\";}", ".fxf9f1y:before{position:absolute;}", ".f15bpuwh:before{width:2px;}", ".f1t0u0az:before{left:0;}", ".fmlx6bj:before{right:0;}", ".f1bwym7p:before{top:10px;}", ".fk3f4e0:before{bottom:10px;}", ".fp6nmmp:before{top:6px;}", ".f14i0ki9:before{bottom:6px;}"],
140
+ "h": [".fl6lm7t:hover:before{background-color:var(--colorNeutralStroke1);}"]
141
+ });
142
+ /**
143
+ * Styles for the icon slot.
144
+ */
145
+
146
+
147
+ const useIconStyles = /*#__PURE__*/__styles({
148
+ "base": {
149
+ "Bt984gj": "f122n59",
150
+ "mc9l5x": "ftuwxu6",
151
+ "Brf1p80": "f4d9j23"
152
+ },
153
+ "small": {
154
+ "Be2twd7": "fe5j1ua",
155
+ "Bqenvij": "fjamq6b",
156
+ "a9b677": "f64fuq3"
157
+ },
158
+ "medium": {
159
+ "Be2twd7": "fe5j1ua",
160
+ "Bqenvij": "fjamq6b",
161
+ "a9b677": "f64fuq3"
162
+ }
163
+ }, {
164
+ "d": [".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".f4d9j23{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;}", ".fe5j1ua{font-size:20px;}", ".fjamq6b{height:20px;}", ".f64fuq3{width:20px;}"]
165
+ });
166
+ /**
167
+ * Styles for the content slot (children)
168
+ */
169
+
170
+
171
+ const useContentStyles = /*#__PURE__*/__styles({
172
+ "base": {
173
+ "uwmqm3": ["f161knb0", "f12huiiw"],
174
+ "z189sj": ["f12huiiw", "f161knb0"]
175
+ },
176
+ "small": {
177
+ "uwmqm3": ["f161knb0", "f12huiiw"],
178
+ "z189sj": ["f12huiiw", "f161knb0"]
179
+ }
180
+ }, {
181
+ "d": [".f161knb0{padding-left:2px;}", ".f12huiiw{padding-right:2px;}"]
182
+ });
183
+ /**
184
+ * Apply styling to the Tab slots based on the state
185
+ */
186
+ // eslint-disable-next-line @typescript-eslint/naming-convention
187
+
188
+
189
+ export const useTabStyles_unstable = state => {
190
+ const rootStyles = useRootStyles();
191
+ const focusStyles = useFocusStyles();
192
+ const horizontalIndicatorStyles = useHorizontalIndicatorStyles();
193
+ const verticalIndicatorStyles = useVerticalIndicatorStyles();
194
+ const iconStyles = useIconStyles();
195
+ const contentStyles = useContentStyles();
196
+ state.root.className = mergeClasses(tabClassName, rootStyles.base, focusStyles.base, state.size === 'small' && rootStyles.small, state.appearance === 'subtle' && rootStyles.subtle, state.vertical ? verticalIndicatorStyles.base : horizontalIndicatorStyles.base, state.size === 'small' && (state.vertical ? verticalIndicatorStyles.small : horizontalIndicatorStyles.small), state.root.className);
197
+
198
+ if (state.icon) {
199
+ state.icon.className = mergeClasses(iconStyles.base, iconStyles[state.size], state.icon.className);
200
+ }
201
+
202
+ state.content.className = mergeClasses(contentStyles.base, state.size === 'small' && contentStyles.small, state.content.className);
203
+ return state;
204
+ };
205
+ //# sourceMappingURL=useTabStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Tab/useTabStyles.ts"],"names":[],"mappings":"AAEA,mBAAqB,YAArB,EAAmC,UAAnC,QAAqD,gBAArD;AACA,SAAS,+BAAT,QAAgD,yBAAhD;AACA,SAAS,MAAT,QAAuB,uBAAvB;AACA,SAAS,sBAAT,QAAuC,qBAAvC;AAEA,OAAO,MAAM,YAAY,GAAG,SAArB;AAEP;;AAEG;;AACH,MAAM,aAAa,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;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,EAAtB;AAoCA;;AAEG;;;AACH,MAAM,cAAc,gBA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J,EAKjC,KAAK,CAAC,UAAN,KAAqB,QAArB,IAAiC,UAAU,CAAC,MALX,EAMjC,KAAK,CAAC,QAAN,GAAiB,uBAAuB,CAAC,IAAzC,GAAgD,yBAAyB,CAAC,IANzC,EAOjC,KAAK,CAAC,IAAN,KAAe,OAAf,KAA2B,KAAK,CAAC,QAAN,GAAiB,uBAAuB,CAAC,KAAzC,GAAiD,yBAAyB,CAAC,KAAtG,CAPiC,EAQjC,KAAK,CAAC,IAAN,CAAW,SARsB,CAAnC;;AAWA,MAAI,KAAK,CAAC,IAAV,EAAgB;AACd,IAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,UAAU,CAAC,IAAZ,EAAkB,UAAU,CAAC,KAAK,CAAC,IAAP,CAA5B,EAA0C,KAAK,CAAC,IAAN,CAAW,SAArD,CAAnC;AACD;;AAED,EAAA,KAAK,CAAC,OAAN,CAAc,SAAd,GAA0B,YAAY,CACpC,aAAa,CAAC,IADsB,EAEpC,KAAK,CAAC,IAAN,KAAe,OAAf,IAA0B,aAAa,CAAC,KAFJ,EAGpC,KAAK,CAAC,OAAN,CAAc,SAHsB,CAAtC;AAMA,SAAO,KAAP;AACD,CA9BM","sourcesContent":["import type { TabState } from './Tab.types';\n\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { tabPendingDesignTokens } from '../../tab.constants';\n\nexport const tabClassName = 'fui-Tab';\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n base: {\n backgroundColor: 'none',\n ...shorthands.borderColor('none'),\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n ...shorthands.borderWidth(tokens.strokeWidthThin),\n columnGap: tabPendingDesignTokens.gap.medium,\n cursor: 'pointer',\n display: 'flex',\n flexDirection: 'row',\n fontFamily: tokens.fontFamilyBase,\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.lineHeightBase300,\n ...shorthands.padding(tabPendingDesignTokens.tabPadding.medium),\n position: 'relative',\n ...shorthands.overflow('hidden'),\n },\n horizontal: {\n alignItems: 'center',\n justifyContent: 'center',\n },\n vertical: {\n alignItems: 'center',\n justifyContent: 'flex-start',\n },\n small: {\n ...shorthands.padding(tabPendingDesignTokens.tabPadding.small),\n columnGap: tabPendingDesignTokens.gap.small,\n },\n subtle: {\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground1Hover,\n },\n },\n});\n\n/**\n * Focus styles for the root slot\n */\nconst useFocusStyles = makeStyles({\n // Tab creates a custom focus indicator because the default focus indicator\n // is applied using an :after pseudo-element on the root. Since the selection\n // indicator uses an :after pseudo-element on the root, there is a conflict.\n base: createCustomFocusIndicatorStyle({\n ...shorthands.borderColor('transparent'),\n outlineWidth: tokens.strokeWidthThick,\n outlineColor: 'transparent',\n outlineStyle: 'solid',\n boxShadow: `\n ${tokens.shadow4},\n 0 0 0 ${tokens.strokeWidthThick} ${tokens.colorStrokeFocus2}\n `,\n zIndex: 1,\n }),\n});\n\n/**\n * Indicator styles for the root slot when horizontal.\n */\nconst useHorizontalIndicatorStyles = makeStyles({\n base: {\n ':after': {\n backgroundColor: 'none',\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n height: tabPendingDesignTokens.indicatorThickness,\n bottom: '0',\n left: tabPendingDesignTokens.tabPadding.medium,\n right: tabPendingDesignTokens.tabPadding.medium,\n },\n ':hover': {\n ':after': {\n backgroundColor: tokens.colorNeutralStroke1,\n },\n },\n },\n small: {\n ':after': {\n left: tabPendingDesignTokens.tabPadding.small,\n right: tabPendingDesignTokens.tabPadding.small,\n },\n },\n});\n\n/**\n * Indicator styles for the root slot when vertical.\n */\nconst useVerticalIndicatorStyles = makeStyles({\n base: {\n ':before': {\n backgroundColor: 'none',\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n width: tabPendingDesignTokens.indicatorThickness,\n left: '0',\n top: tabPendingDesignTokens.tabPadding.medium,\n bottom: tabPendingDesignTokens.tabPadding.medium,\n },\n ':hover': {\n ':before': {\n backgroundColor: tokens.colorNeutralStroke1,\n },\n },\n },\n small: {\n ':before': {\n top: tabPendingDesignTokens.tabPadding.small,\n bottom: tabPendingDesignTokens.tabPadding.small,\n },\n },\n});\n\n/**\n * Styles for the icon slot.\n */\nconst useIconStyles = makeStyles({\n base: {\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'center',\n },\n // per design, the small and medium font sizes are the same.\n // the size prop only affects spacing.\n small: {\n fontSize: '20px',\n height: '20px',\n width: '20px',\n },\n medium: {\n fontSize: '20px',\n height: '20px',\n width: '20px',\n },\n});\n\n/**\n * Styles for the content slot (children)\n */\nconst useContentStyles = makeStyles({\n base: {\n paddingLeft: tabPendingDesignTokens.contentPadding.medium,\n paddingRight: tabPendingDesignTokens.contentPadding.medium,\n },\n small: {\n paddingLeft: tabPendingDesignTokens.contentPadding.small,\n paddingRight: tabPendingDesignTokens.contentPadding.small,\n },\n});\n\n/**\n * Apply styling to the Tab slots based on the state\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const useTabStyles_unstable = (state: TabState): TabState => {\n const rootStyles = useRootStyles();\n const focusStyles = useFocusStyles();\n const horizontalIndicatorStyles = useHorizontalIndicatorStyles();\n const verticalIndicatorStyles = useVerticalIndicatorStyles();\n const iconStyles = useIconStyles();\n const contentStyles = useContentStyles();\n\n state.root.className = mergeClasses(\n tabClassName,\n rootStyles.base,\n focusStyles.base,\n state.size === 'small' && rootStyles.small,\n state.appearance === 'subtle' && rootStyles.subtle,\n state.vertical ? verticalIndicatorStyles.base : horizontalIndicatorStyles.base,\n state.size === 'small' && (state.vertical ? verticalIndicatorStyles.small : horizontalIndicatorStyles.small),\n state.root.className,\n );\n\n if (state.icon) {\n state.icon.className = mergeClasses(iconStyles.base, iconStyles[state.size], state.icon.className);\n }\n\n state.content.className = mergeClasses(\n contentStyles.base,\n state.size === 'small' && contentStyles.small,\n state.content.className,\n );\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,6 @@
1
+ import type { TabListProps } from './TabList.types';
2
+ import type { ForwardRefComponent } from '@fluentui/react-utilities';
3
+ /**
4
+ * A tab list provides single selection from a set of tabs.
5
+ */
6
+ export declare const TabList: ForwardRefComponent<TabListProps>;
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import { useTabList_unstable } from './useTabList';
3
+ import { renderTabList_unstable } from './renderTabList';
4
+ import { useTabListStyles_unstable } from './useTabListStyles';
5
+ import { useTabListContextValues } from './useTabListContextValues';
6
+ /**
7
+ * A tab list provides single selection from a set of tabs.
8
+ */
9
+
10
+ export const TabList = /*#__PURE__*/React.forwardRef((props, ref) => {
11
+ const state = useTabList_unstable(props, ref);
12
+ const contextValues = useTabListContextValues(state);
13
+ useTabListStyles_unstable(state);
14
+ return renderTabList_unstable(state, contextValues);
15
+ });
16
+ TabList.displayName = 'TabList';
17
+ //# sourceMappingURL=TabList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/TabList/TabList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,mBAAT,QAAoC,cAApC;AACA,SAAS,sBAAT,QAAuC,iBAAvC;AACA,SAAS,yBAAT,QAA0C,oBAA1C;AAGA,SAAS,uBAAT,QAAwC,2BAAxC;AAEA;;AAEG;;AACH,OAAO,MAAM,OAAO,gBAAsC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACxF,QAAM,KAAK,GAAG,mBAAmB,CAAC,KAAD,EAAQ,GAAR,CAAjC;AACA,QAAM,aAAa,GAAG,uBAAuB,CAAC,KAAD,CAA7C;AAEA,EAAA,yBAAyB,CAAC,KAAD,CAAzB;AACA,SAAO,sBAAsB,CAAC,KAAD,EAAQ,aAAR,CAA7B;AACD,CANyD,CAAnD;AAQP,OAAO,CAAC,WAAR,GAAsB,SAAtB","sourcesContent":["import * as React from 'react';\nimport { useTabList_unstable } from './useTabList';\nimport { renderTabList_unstable } from './renderTabList';\nimport { useTabListStyles_unstable } from './useTabListStyles';\nimport type { TabListProps } from './TabList.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useTabListContextValues } from './useTabListContextValues';\n\n/**\n * A tab list provides single selection from a set of tabs.\n */\nexport const TabList: ForwardRefComponent<TabListProps> = React.forwardRef((props, ref) => {\n const state = useTabList_unstable(props, ref);\n const contextValues = useTabListContextValues(state);\n\n useTabListStyles_unstable(state);\n return renderTabList_unstable(state, contextValues);\n});\n\nTabList.displayName = 'TabList';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,99 @@
1
+ import * as React from 'react';
2
+ import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
3
+ import { TabValue } from '../Tab/Tab.types';
4
+ export declare type RegisterTabData = {
5
+ /**
6
+ * The value of the selected tab.
7
+ */
8
+ value: TabValue;
9
+ ref: React.RefObject<HTMLElement>;
10
+ };
11
+ export declare type RegisterTabEventHandler = (data: RegisterTabData) => void;
12
+ export declare type SelectTabData = {
13
+ /**
14
+ * The value of the selected tab.
15
+ */
16
+ value: TabValue;
17
+ };
18
+ export declare type SelectTabEvent<E = HTMLElement> = React.MouseEvent<E> | React.KeyboardEvent<E>;
19
+ export declare type SelectTabEventHandler = (event: SelectTabEvent, data: SelectTabData) => void;
20
+ export declare type TabListSlots = {
21
+ /**
22
+ * The slot associated with the root element of this tab list.
23
+ */
24
+ root: Slot<'div'>;
25
+ };
26
+ declare type TabListCommons = {
27
+ /**
28
+ * A tab list can supports 'transparent' and 'subtle' appearance.
29
+ *- 'subtle': Minimizes emphasis to blend into the background until hovered or focused.
30
+ *- 'transparent': No background and border styling
31
+ * The appearance affects each of the contained tabs.
32
+ * @default 'transparent'
33
+ */
34
+ appearance?: 'transparent' | 'subtle';
35
+ /**
36
+ * Raised when a tab is selected.
37
+ */
38
+ onTabSelect?: SelectTabEventHandler;
39
+ /**
40
+ * The value of the currently selected tab.
41
+ */
42
+ selectedValue?: TabValue;
43
+ /**
44
+ * A tab list can be either 'small' or 'medium' size.
45
+ * The size affects each of the contained tabs.
46
+ * @default 'medium'
47
+ */
48
+ size?: 'small' | 'medium';
49
+ /**
50
+ * A tab list can arrange its tabs vertically.
51
+ * @default false
52
+ */
53
+ vertical?: boolean;
54
+ };
55
+ /**
56
+ * TabList Props
57
+ */
58
+ export declare type TabListProps = ComponentProps<TabListSlots> & TabListCommons & {
59
+ /**
60
+ * The value of the tab to be selected by default.
61
+ * Typically useful when the selectedValue is uncontrolled.
62
+ */
63
+ defaultSelectedValue?: TabValue;
64
+ };
65
+ export declare type TabListContextValue = Pick<TabListCommons, 'onTabSelect' | 'selectedValue'> & Required<Pick<TabListCommons, 'appearance' | 'size' | 'vertical'>> & {
66
+ /** A callback to allow a tab to register itself with the tab list. */
67
+ onRegister: RegisterTabEventHandler;
68
+ /** A callback to allow a tab to unregister itself with the tab list. */
69
+ onUnregister: RegisterTabEventHandler;
70
+ /**
71
+ * A callback to allow a tab to select itself when pressed.
72
+ */
73
+ onSelect: SelectTabEventHandler;
74
+ };
75
+ /**
76
+ * Context values used in rendering TabList.
77
+ */
78
+ export declare type TabListContextValues = {
79
+ /**
80
+ * The context of the tab list available to each tab.
81
+ */
82
+ tabList: TabListContextValue;
83
+ };
84
+ /**
85
+ * A bounding rectangle of a tab
86
+ */
87
+ export declare type TabContentRect = {
88
+ x: number;
89
+ y: number;
90
+ width: number;
91
+ height: number;
92
+ };
93
+ /**
94
+ * State used in rendering TabList.
95
+ */
96
+ export declare type TabListState = ComponentState<Required<TabListSlots>> & TabListContextValue & {
97
+ selectedTabRect?: TabContentRect;
98
+ };
99
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TabList.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabList.types.js","sourceRoot":"../src/","sources":["components/TabList/TabList.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { TabValue } from '../Tab/Tab.types';\n\nexport type RegisterTabData = {\n /**\n * The value of the selected tab.\n */\n value: TabValue;\n\n ref: React.RefObject<HTMLElement>;\n};\n\nexport type RegisterTabEventHandler = (data: RegisterTabData) => void;\n\nexport type SelectTabData = {\n /**\n * The value of the selected tab.\n */\n value: TabValue;\n};\n\nexport type SelectTabEvent<E = HTMLElement> = React.MouseEvent<E> | React.KeyboardEvent<E>;\n\nexport type SelectTabEventHandler = (event: SelectTabEvent, data: SelectTabData) => void;\n\nexport type TabListSlots = {\n /**\n * The slot associated with the root element of this tab list.\n */\n root: Slot<'div'>;\n};\n\ntype TabListCommons = {\n /**\n * A tab list can supports 'transparent' and 'subtle' appearance.\n *- 'subtle': Minimizes emphasis to blend into the background until hovered or focused.\n *- 'transparent': No background and border styling\n * The appearance affects each of the contained tabs.\n * @default 'transparent'\n */\n appearance?: 'transparent' | 'subtle';\n\n /**\n * Raised when a tab is selected.\n */\n onTabSelect?: SelectTabEventHandler;\n\n /**\n * The value of the currently selected tab.\n */\n selectedValue?: TabValue;\n\n /**\n * A tab list can be either 'small' or 'medium' size.\n * The size affects each of the contained tabs.\n * @default 'medium'\n */\n size?: 'small' | 'medium';\n\n /**\n * A tab list can arrange its tabs vertically.\n * @default false\n */\n vertical?: boolean;\n};\n\n/**\n * TabList Props\n */\nexport type TabListProps = ComponentProps<TabListSlots> &\n TabListCommons & {\n /**\n * The value of the tab to be selected by default.\n * Typically useful when the selectedValue is uncontrolled.\n */\n defaultSelectedValue?: TabValue;\n };\n\nexport type TabListContextValue = Pick<TabListCommons, 'onTabSelect' | 'selectedValue'> &\n Required<Pick<TabListCommons, 'appearance' | 'size' | 'vertical'>> & {\n /** A callback to allow a tab to register itself with the tab list. */\n onRegister: RegisterTabEventHandler;\n\n /** A callback to allow a tab to unregister itself with the tab list. */\n onUnregister: RegisterTabEventHandler;\n /**\n * A callback to allow a tab to select itself when pressed.\n */\n onSelect: SelectTabEventHandler;\n };\n\n/**\n * Context values used in rendering TabList.\n */\nexport type TabListContextValues = {\n /**\n * The context of the tab list available to each tab.\n */\n tabList: TabListContextValue;\n};\n\n/**\n * A bounding rectangle of a tab\n */\nexport type TabContentRect = {\n x: number;\n y: number;\n width: number;\n height: number;\n};\n\n/**\n * State used in rendering TabList.\n */\nexport type TabListState = ComponentState<Required<TabListSlots>> &\n TabListContextValue & {\n selectedTabRect?: TabContentRect;\n };\n"]}
@@ -0,0 +1,3 @@
1
+ import type { Context } from '@fluentui/react-context-selector';
2
+ import { TabListContextValue } from './TabList.types';
3
+ export declare const TabListContext: Context<TabListContextValue>;
@@ -0,0 +1,17 @@
1
+ import { createContext } from '@fluentui/react-context-selector';
2
+ export const TabListContext = /*#__PURE__*/createContext({
3
+ appearance: 'transparent',
4
+ selectedValue: undefined,
5
+ onRegister: () => {
6
+ /* noop */
7
+ },
8
+ onUnregister: () => {
9
+ /* noop */
10
+ },
11
+ onSelect: () => {
12
+ /* noop */
13
+ },
14
+ size: 'medium',
15
+ vertical: false
16
+ });
17
+ //# sourceMappingURL=TabListContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/TabList/TabListContext.ts"],"names":[],"mappings":"AAAA,SAAS,aAAT,QAA8B,kCAA9B;AAIA,OAAO,MAAM,cAAc,gBAAiC,aAAa,CAAsB;AAC7F,EAAA,UAAU,EAAE,aADiF;AAE7F,EAAA,aAAa,EAAE,SAF8E;AAG7F,EAAA,UAAU,EAAE,MAAK;AACf;AACD,GAL4F;AAM7F,EAAA,YAAY,EAAE,MAAK;AACjB;AACD,GAR4F;AAS7F,EAAA,QAAQ,EAAE,MAAK;AACb;AACD,GAX4F;AAY7F,EAAA,IAAI,EAAE,QAZuF;AAa7F,EAAA,QAAQ,EAAE;AAbmF,CAAtB,CAAlE","sourcesContent":["import { createContext } from '@fluentui/react-context-selector';\nimport type { Context } from '@fluentui/react-context-selector';\nimport { TabListContextValue } from './TabList.types';\n\nexport const TabListContext: Context<TabListContextValue> = createContext<TabListContextValue>({\n appearance: 'transparent',\n selectedValue: undefined,\n onRegister: () => {\n /* noop */\n },\n onUnregister: () => {\n /* noop */\n },\n onSelect: () => {\n /* noop */\n },\n size: 'medium',\n vertical: false,\n});\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,5 @@
1
+ export * from './TabList';
2
+ export * from './TabList.types';
3
+ export * from './renderTabList';
4
+ export * from './useTabList';
5
+ export * from './useTabListStyles';
@@ -0,0 +1,6 @@
1
+ export * from './TabList';
2
+ export * from './TabList.types';
3
+ export * from './renderTabList';
4
+ export * from './useTabList';
5
+ export * from './useTabListStyles';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/TabList/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './TabList';\nexport * from './TabList.types';\nexport * from './renderTabList';\nexport * from './useTabList';\nexport * from './useTabListStyles';\n"]}
@@ -0,0 +1,5 @@
1
+ import type { TabListState, TabListContextValues } from './TabList.types';
2
+ /**
3
+ * Render the final JSX of TabList
4
+ */
5
+ export declare const renderTabList_unstable: (state: TabListState, contextValues: TabListContextValues) => JSX.Element;
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ import { getSlots } from '@fluentui/react-utilities';
3
+ import { TabListContext } from './TabListContext';
4
+ /**
5
+ * Render the final JSX of TabList
6
+ */
7
+ // eslint-disable-next-line @typescript-eslint/naming-convention
8
+
9
+ export const renderTabList_unstable = (state, contextValues) => {
10
+ const {
11
+ slots,
12
+ slotProps
13
+ } = getSlots(state);
14
+ return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
15
+ }, /*#__PURE__*/React.createElement(TabListContext.Provider, {
16
+ value: contextValues.tabList
17
+ }, state.root.children));
18
+ };
19
+ //# sourceMappingURL=renderTabList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/TabList/renderTabList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAEA,SAAS,cAAT,QAA+B,kBAA/B;AAEA;;AAEG;AACH;;AACA,OAAO,MAAM,sBAAsB,GAAG,CAAC,KAAD,EAAsB,aAAtB,KAA6D;AACjG,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAe,KAAf,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,eACE,KAAA,CAAA,aAAA,CAAC,cAAc,CAAC,QAAhB,EAAwB;AAAC,IAAA,KAAK,EAAE,aAAa,CAAC;AAAtB,GAAxB,EAAwD,KAAK,CAAC,IAAN,CAAW,QAAnE,CADF,CADF;AAKD,CARM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { TabListState, TabListSlots, TabListContextValues } from './TabList.types';\nimport { TabListContext } from './TabListContext';\n\n/**\n * Render the final JSX of TabList\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const renderTabList_unstable = (state: TabListState, contextValues: TabListContextValues) => {\n const { slots, slotProps } = getSlots<TabListSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n <TabListContext.Provider value={contextValues.tabList}>{state.root.children}</TabListContext.Provider>\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import type { TabListProps, TabListState } from './TabList.types';
3
+ /**
4
+ * Create the state required to render TabList.
5
+ *
6
+ * The returned state can be modified with hooks such as useTabListStyles_unstable,
7
+ * before being passed to renderTabList_unstable.
8
+ *
9
+ * @param props - props from this instance of TabList
10
+ * @param ref - reference to root HTMLElement of TabList
11
+ */
12
+ export declare const useTabList_unstable: (props: TabListProps, ref: React.Ref<HTMLElement>) => TabListState;
@@ -0,0 +1,106 @@
1
+ import * as React from 'react';
2
+ import { useArrowNavigationGroup } from '@fluentui/react-tabster';
3
+ import { getNativeElementProps, useConst, useControllableState, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';
4
+ /**
5
+ * Create the state required to render TabList.
6
+ *
7
+ * The returned state can be modified with hooks such as useTabListStyles_unstable,
8
+ * before being passed to renderTabList_unstable.
9
+ *
10
+ * @param props - props from this instance of TabList
11
+ * @param ref - reference to root HTMLElement of TabList
12
+ */
13
+ // eslint-disable-next-line @typescript-eslint/naming-convention
14
+
15
+ export const useTabList_unstable = (props, ref) => {
16
+ const {
17
+ appearance = 'transparent',
18
+ onTabSelect,
19
+ size = 'medium',
20
+ vertical = false
21
+ } = props;
22
+ const innerRef = React.useRef(null);
23
+ const focusAttributes = useArrowNavigationGroup({
24
+ circular: true,
25
+ axis: vertical ? 'vertical' : 'horizontal'
26
+ });
27
+ const [selectedValue, setSelectedValue] = useControllableState({
28
+ state: props.selectedValue,
29
+ defaultState: props.defaultSelectedValue,
30
+ initialState: undefined
31
+ });
32
+ const onSelect = useEventCallback((event, data) => {
33
+ onTabSelect === null || onTabSelect === void 0 ? void 0 : onTabSelect(event, data);
34
+ setSelectedValue(data.value);
35
+ }); // provide force recalculation of the selection indicator rectangle
36
+
37
+ const [calcRect, setCalcRect] = React.useState(0);
38
+ const recalcRect = useConst(() => () => setCalcRect(value => ++value)); // when this list or any tab resizes, recalculate the selection indicator rectangle
39
+
40
+ const resizeObserver = React.useMemo(() => new ResizeObserver(entries => {
41
+ recalcRect();
42
+ }), [recalcRect]); // observe this list for resize
43
+
44
+ React.useEffect(() => {
45
+ const currentRef = innerRef.current;
46
+ currentRef && resizeObserver.observe(currentRef);
47
+ return () => {
48
+ currentRef && resizeObserver.unobserve(currentRef);
49
+ };
50
+ }, [resizeObserver]); // when tabs register their refs, observe them for resize
51
+
52
+ const registeredTabs = React.useRef({});
53
+ const onRegister = useEventCallback(data => {
54
+ var _a;
55
+
56
+ registeredTabs.current[JSON.stringify(data.value)] = data;
57
+ ((_a = data.ref) === null || _a === void 0 ? void 0 : _a.current) && resizeObserver.observe(data.ref.current);
58
+ recalcRect();
59
+ });
60
+ const onUnregister = useEventCallback(data => {
61
+ var _a;
62
+
63
+ delete registeredTabs.current[JSON.stringify(data.value)];
64
+ ((_a = data.ref) === null || _a === void 0 ? void 0 : _a.current) && resizeObserver.unobserve(data.ref.current);
65
+ recalcRect();
66
+ }); // calculate the selection indicator rectangle
67
+
68
+ const selectedTabRect = React.useMemo(() => {
69
+ var _a, _b, _c;
70
+
71
+ const listRect = (_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
72
+ const tabRef = (_b = registeredTabs.current[JSON.stringify(selectedValue)]) === null || _b === void 0 ? void 0 : _b.ref;
73
+ const tabRect = (_c = tabRef === null || tabRef === void 0 ? void 0 : tabRef.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
74
+
75
+ if (listRect && tabRect) {
76
+ return {
77
+ x: tabRect.x - listRect.x,
78
+ y: tabRect.y - listRect.y,
79
+ width: tabRect.width,
80
+ height: tabRect.height
81
+ };
82
+ } // calcRect is used to force updates when registered tabs change or resize occurs
83
+ // eslint-disable-next-line react-hooks/exhaustive-deps
84
+
85
+ }, [calcRect, selectedValue]);
86
+ return {
87
+ components: {
88
+ root: 'div'
89
+ },
90
+ root: getNativeElementProps('div', {
91
+ ref: useMergedRefs(ref, innerRef),
92
+ role: 'tablist',
93
+ ...focusAttributes,
94
+ ...props
95
+ }),
96
+ appearance,
97
+ selectedTabRect,
98
+ selectedValue,
99
+ size,
100
+ vertical,
101
+ onRegister,
102
+ onUnregister,
103
+ onSelect
104
+ };
105
+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;AAiBA,SAAO;AACL,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE;AADI,KADP;AAIL,IAAA,IAAI,EAAE,qBAAqB,CAAC,KAAD,EAAQ;AACjC,MAAA,GAAG,EAAE,aAAa,CAAC,GAAD,EAAM,QAAN,CADe;AAEjC,MAAA,IAAI,EAAE,SAF2B;AAGjC,SAAG,eAH8B;AAIjC,SAAG;AAJ8B,KAAR,CAJtB;AAUL,IAAA,UAVK;AAWL,IAAA,eAXK;AAYL,IAAA,aAZK;AAaL,IAAA,IAbK;AAcL,IAAA,QAdK;AAeL,IAAA,UAfK;AAgBL,IAAA,YAhBK;AAiBL,IAAA;AAjBK,GAAP;AAmBD,CA7FM","sourcesContent":["import * as React from 'react';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport {\n getNativeElementProps,\n useConst,\n useControllableState,\n useEventCallback,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport type { RegisterTabData, SelectTabData, SelectTabEvent, TabListProps, TabListState } from './TabList.types';\n\n/**\n * Create the state required to render TabList.\n *\n * The returned state can be modified with hooks such as useTabListStyles_unstable,\n * before being passed to renderTabList_unstable.\n *\n * @param props - props from this instance of TabList\n * @param ref - reference to root HTMLElement of TabList\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const useTabList_unstable = (props: TabListProps, ref: React.Ref<HTMLElement>): TabListState => {\n const { appearance = 'transparent', onTabSelect, size = 'medium', vertical = false } = props;\n\n const innerRef = React.useRef<HTMLElement>(null);\n\n const focusAttributes = useArrowNavigationGroup({ circular: true, axis: vertical ? 'vertical' : 'horizontal' });\n\n const [selectedValue, setSelectedValue] = useControllableState({\n state: props.selectedValue,\n defaultState: props.defaultSelectedValue,\n initialState: undefined,\n });\n\n const onSelect = useEventCallback((event: SelectTabEvent, data: SelectTabData) => {\n onTabSelect?.(event, data);\n setSelectedValue(data.value);\n });\n\n // provide force recalculation of the selection indicator rectangle\n const [calcRect, setCalcRect] = React.useState(0);\n const recalcRect = useConst(() => () => setCalcRect(value => ++value));\n\n // when this list or any tab resizes, recalculate the selection indicator rectangle\n const resizeObserver = React.useMemo(\n () =>\n new ResizeObserver(entries => {\n recalcRect();\n }),\n [recalcRect],\n );\n\n // observe this list for resize\n React.useEffect(() => {\n const currentRef = innerRef.current;\n currentRef && resizeObserver.observe(currentRef);\n\n return () => {\n currentRef && resizeObserver.unobserve(currentRef);\n };\n }, [resizeObserver]);\n\n // when tabs register their refs, observe them for resize\n const registeredTabs = React.useRef<Record<string, RegisterTabData>>({});\n\n const onRegister = useEventCallback((data: RegisterTabData) => {\n registeredTabs.current[JSON.stringify(data.value)] = data;\n data.ref?.current && resizeObserver.observe(data.ref.current);\n recalcRect();\n });\n\n const onUnregister = useEventCallback((data: RegisterTabData) => {\n delete registeredTabs.current[JSON.stringify(data.value)];\n data.ref?.current && resizeObserver.unobserve(data.ref.current);\n recalcRect();\n });\n\n // calculate the selection indicator rectangle\n const selectedTabRect = React.useMemo(() => {\n const listRect = innerRef.current?.getBoundingClientRect();\n const tabRef: React.Ref<HTMLElement> = registeredTabs.current[JSON.stringify(selectedValue)]?.ref;\n const tabRect = tabRef?.current?.getBoundingClientRect();\n\n if (listRect && tabRect) {\n return {\n x: tabRect.x - listRect.x,\n y: tabRect.y - listRect.y,\n width: tabRect.width,\n height: tabRect.height,\n };\n }\n // calcRect is used to force updates when registered tabs change or resize occurs\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [calcRect, selectedValue]);\n\n return {\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n ref: useMergedRefs(ref, innerRef),\n role: 'tablist',\n ...focusAttributes,\n ...props,\n }),\n appearance,\n selectedTabRect,\n selectedValue,\n size,\n vertical,\n onRegister,\n onUnregister,\n onSelect,\n };\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,2 @@
1
+ import { TabListContextValues, TabListState } from './TabList.types';
2
+ export declare function useTabListContextValues(state: TabListState): TabListContextValues;
@@ -0,0 +1,24 @@
1
+ export function useTabListContextValues(state) {
2
+ const {
3
+ appearance,
4
+ selectedValue: selectedKey,
5
+ onRegister,
6
+ onUnregister,
7
+ onSelect,
8
+ size,
9
+ vertical
10
+ } = state;
11
+ const tabList = {
12
+ appearance,
13
+ selectedValue: selectedKey,
14
+ onSelect,
15
+ onRegister,
16
+ onUnregister,
17
+ size,
18
+ vertical
19
+ };
20
+ return {
21
+ tabList
22
+ };
23
+ }
24
+ //# sourceMappingURL=useTabListContextValues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/TabList/useTabListContextValues.tsx"],"names":[],"mappings":"AAEA,OAAM,SAAU,uBAAV,CAAkC,KAAlC,EAAqD;AACzD,QAAM;AAAE,IAAA,UAAF;AAAc,IAAA,aAAa,EAAE,WAA7B;AAA0C,IAAA,UAA1C;AAAsD,IAAA,YAAtD;AAAoE,IAAA,QAApE;AAA8E,IAAA,IAA9E;AAAoF,IAAA;AAApF,MAAiG,KAAvG;AAEA,QAAM,OAAO,GAAwB;AACnC,IAAA,UADmC;AAEnC,IAAA,aAAa,EAAE,WAFoB;AAGnC,IAAA,QAHmC;AAInC,IAAA,UAJmC;AAKnC,IAAA,YALmC;AAMnC,IAAA,IANmC;AAOnC,IAAA;AAPmC,GAArC;AAUA,SAAO;AAAE,IAAA;AAAF,GAAP;AACD","sourcesContent":["import { TabListContextValue, TabListContextValues, TabListState } from './TabList.types';\n\nexport function useTabListContextValues(state: TabListState): TabListContextValues {\n const { appearance, selectedValue: selectedKey, onRegister, onUnregister, onSelect, size, vertical } = state;\n\n const tabList: TabListContextValue = {\n appearance,\n selectedValue: selectedKey,\n onSelect,\n onRegister,\n onUnregister,\n size,\n vertical,\n };\n\n return { tabList };\n}\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,9 @@
1
+ import type { TabListState } from './TabList.types';
2
+ export declare const tabListClassName = "fui-TabList";
3
+ export declare const tabListSelectionIndicatorName = "fui-TabList_SelectionIndicator";
4
+ export declare const indicatorOffsetVar = "--selection-indicator-offset";
5
+ export declare const indicatorLengthVar = "--selection-indicator-length";
6
+ /**
7
+ * Apply styling to the TabList slots based on the state
8
+ */
9
+ export declare const useTabListStyles_unstable: (state: TabListState) => TabListState;