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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/CHANGELOG.json +51 -1912
  2. package/CHANGELOG.md +17 -763
  3. package/README.md +0 -17
  4. package/Spec.md +433 -0
  5. package/dist/react-tabs.d.ts +171 -137
  6. package/lib/Tab.d.ts +1 -0
  7. package/lib/Tab.js +2 -0
  8. package/lib/Tab.js.map +1 -0
  9. package/lib/TabList.d.ts +1 -0
  10. package/lib/TabList.js +2 -0
  11. package/lib/TabList.js.map +1 -0
  12. package/lib/components/Tab/Tab.d.ts +6 -0
  13. package/lib/components/Tab/Tab.js +15 -0
  14. package/lib/components/Tab/Tab.js.map +1 -0
  15. package/lib/components/Tab/Tab.types.d.ts +52 -0
  16. package/lib/components/Tab/Tab.types.js +2 -0
  17. package/lib/components/Tab/Tab.types.js.map +1 -0
  18. package/lib/components/Tab/index.d.ts +5 -0
  19. package/lib/components/Tab/index.js +6 -0
  20. package/lib/components/Tab/index.js.map +1 -0
  21. package/lib/components/Tab/renderTab.d.ts +5 -0
  22. package/lib/components/Tab/renderTab.js +18 -0
  23. package/lib/components/Tab/renderTab.js.map +1 -0
  24. package/lib/components/Tab/useTab.d.ts +12 -0
  25. package/lib/components/Tab/useTab.js +82 -0
  26. package/lib/components/Tab/useTab.js.map +1 -0
  27. package/lib/components/Tab/useTabStyles.d.ts +6 -0
  28. package/lib/components/Tab/useTabStyles.js +205 -0
  29. package/lib/components/Tab/useTabStyles.js.map +1 -0
  30. package/lib/components/TabList/TabList.d.ts +6 -0
  31. package/lib/components/TabList/TabList.js +17 -0
  32. package/lib/components/TabList/TabList.js.map +1 -0
  33. package/lib/components/TabList/TabList.types.d.ts +99 -0
  34. package/lib/components/TabList/TabList.types.js +2 -0
  35. package/lib/components/TabList/TabList.types.js.map +1 -0
  36. package/lib/components/TabList/TabListContext.d.ts +3 -0
  37. package/lib/components/TabList/TabListContext.js +17 -0
  38. package/lib/components/TabList/TabListContext.js.map +1 -0
  39. package/lib/components/TabList/index.d.ts +5 -0
  40. package/lib/components/TabList/index.js +6 -0
  41. package/lib/components/TabList/index.js.map +1 -0
  42. package/lib/components/TabList/renderTabList.d.ts +5 -0
  43. package/lib/components/TabList/renderTabList.js +19 -0
  44. package/lib/components/TabList/renderTabList.js.map +1 -0
  45. package/lib/components/TabList/useTabList.d.ts +12 -0
  46. package/lib/components/TabList/useTabList.js +106 -0
  47. package/lib/components/TabList/useTabList.js.map +1 -0
  48. package/lib/components/TabList/useTabListContextValues.d.ts +2 -0
  49. package/lib/components/TabList/useTabListContextValues.js +24 -0
  50. package/lib/components/TabList/useTabListContextValues.js.map +1 -0
  51. package/lib/components/TabList/useTabListStyles.d.ts +9 -0
  52. package/lib/components/TabList/useTabListStyles.js +118 -0
  53. package/lib/components/TabList/useTabListStyles.js.map +1 -0
  54. package/lib/index.d.ts +2 -1
  55. package/lib/index.js +2 -1
  56. package/lib/index.js.map +1 -1
  57. package/lib/tab.constants.d.ts +15 -0
  58. package/lib/tab.constants.js +17 -0
  59. package/lib/tab.constants.js.map +1 -0
  60. package/lib/tsdoc-metadata.json +1 -1
  61. package/lib-commonjs/Tab.d.ts +1 -0
  62. package/lib-commonjs/Tab.js +10 -0
  63. package/lib-commonjs/Tab.js.map +1 -0
  64. package/lib-commonjs/TabList.d.ts +1 -0
  65. package/lib-commonjs/TabList.js +10 -0
  66. package/lib-commonjs/TabList.js.map +1 -0
  67. package/lib-commonjs/components/Tab/Tab.d.ts +6 -0
  68. package/lib-commonjs/components/Tab/Tab.js +26 -0
  69. package/lib-commonjs/components/Tab/Tab.js.map +1 -0
  70. package/lib-commonjs/components/Tab/Tab.types.d.ts +52 -0
  71. package/lib-commonjs/components/Tab/Tab.types.js +6 -0
  72. package/lib-commonjs/components/Tab/Tab.types.js.map +1 -0
  73. package/lib-commonjs/components/Tab/index.d.ts +5 -0
  74. package/lib-commonjs/components/Tab/index.js +18 -0
  75. package/lib-commonjs/components/Tab/index.js.map +1 -0
  76. package/lib-commonjs/components/Tab/renderTab.d.ts +5 -0
  77. package/lib-commonjs/components/Tab/renderTab.js +29 -0
  78. package/lib-commonjs/components/Tab/renderTab.js.map +1 -0
  79. package/lib-commonjs/components/Tab/useTab.d.ts +12 -0
  80. package/lib-commonjs/components/Tab/useTab.js +95 -0
  81. package/lib-commonjs/components/Tab/useTab.js.map +1 -0
  82. package/lib-commonjs/components/Tab/useTabStyles.d.ts +6 -0
  83. package/lib-commonjs/components/Tab/useTabStyles.js +218 -0
  84. package/lib-commonjs/components/Tab/useTabStyles.js.map +1 -0
  85. package/lib-commonjs/components/TabList/TabList.d.ts +6 -0
  86. package/lib-commonjs/components/TabList/TabList.js +29 -0
  87. package/lib-commonjs/components/TabList/TabList.js.map +1 -0
  88. package/lib-commonjs/components/TabList/TabList.types.d.ts +99 -0
  89. package/lib-commonjs/components/TabList/TabList.types.js +6 -0
  90. package/lib-commonjs/components/TabList/TabList.types.js.map +1 -0
  91. package/lib-commonjs/components/TabList/TabListContext.d.ts +3 -0
  92. package/lib-commonjs/components/TabList/TabListContext.js +25 -0
  93. package/lib-commonjs/components/TabList/TabListContext.js.map +1 -0
  94. package/lib-commonjs/components/TabList/index.d.ts +5 -0
  95. package/lib-commonjs/components/TabList/index.js +18 -0
  96. package/lib-commonjs/components/TabList/index.js.map +1 -0
  97. package/lib-commonjs/components/TabList/renderTabList.d.ts +5 -0
  98. package/lib-commonjs/components/TabList/renderTabList.js +31 -0
  99. package/lib-commonjs/components/TabList/renderTabList.js.map +1 -0
  100. package/lib-commonjs/components/TabList/useTabList.d.ts +12 -0
  101. package/lib-commonjs/components/TabList/useTabList.js +118 -0
  102. package/lib-commonjs/components/TabList/useTabList.js.map +1 -0
  103. package/lib-commonjs/components/TabList/useTabListContextValues.d.ts +2 -0
  104. package/lib-commonjs/components/TabList/useTabListContextValues.js +33 -0
  105. package/lib-commonjs/components/TabList/useTabListContextValues.js.map +1 -0
  106. package/lib-commonjs/components/TabList/useTabListStyles.d.ts +9 -0
  107. package/lib-commonjs/components/TabList/useTabListStyles.js +131 -0
  108. package/lib-commonjs/components/TabList/useTabListStyles.js.map +1 -0
  109. package/lib-commonjs/index.d.ts +2 -1
  110. package/lib-commonjs/index.js +10 -3
  111. package/lib-commonjs/index.js.map +1 -1
  112. package/lib-commonjs/tab.constants.d.ts +15 -0
  113. package/lib-commonjs/tab.constants.js +23 -0
  114. package/lib-commonjs/tab.constants.js.map +1 -0
  115. package/package.json +18 -13
  116. package/config/api-extractor.json +0 -3
  117. package/config/tests.js +0 -14
  118. package/etc/react-tabs.api.md +0 -104
  119. package/just.config.ts +0 -3
  120. package/lib/Tabs.d.ts +0 -1
  121. package/lib/Tabs.js +0 -2
  122. package/lib/Tabs.js.map +0 -1
  123. package/lib/common/isConformant.d.ts +0 -4
  124. package/lib/common/isConformant.js +0 -9
  125. package/lib/common/isConformant.js.map +0 -1
  126. package/lib/components/Tabs/TabItem.d.ts +0 -6
  127. package/lib/components/Tabs/TabItem.js +0 -18
  128. package/lib/components/Tabs/TabItem.js.map +0 -1
  129. package/lib/components/Tabs/TabItem.types.d.ts +0 -61
  130. package/lib/components/Tabs/TabItem.types.js +0 -2
  131. package/lib/components/Tabs/TabItem.types.js.map +0 -1
  132. package/lib/components/Tabs/Tabs.base.d.ts +0 -3
  133. package/lib/components/Tabs/Tabs.base.js +0 -179
  134. package/lib/components/Tabs/Tabs.base.js.map +0 -1
  135. package/lib/components/Tabs/Tabs.d.ts +0 -8
  136. package/lib/components/Tabs/Tabs.js +0 -12
  137. package/lib/components/Tabs/Tabs.js.map +0 -1
  138. package/lib/components/Tabs/Tabs.styles.d.ts +0 -2
  139. package/lib/components/Tabs/Tabs.styles.js +0 -264
  140. package/lib/components/Tabs/Tabs.styles.js.map +0 -1
  141. package/lib/components/Tabs/Tabs.types.d.ts +0 -113
  142. package/lib/components/Tabs/Tabs.types.js +0 -2
  143. package/lib/components/Tabs/Tabs.types.js.map +0 -1
  144. package/lib/components/Tabs/index.d.ts +0 -5
  145. package/lib/components/Tabs/index.js +0 -6
  146. package/lib/components/Tabs/index.js.map +0 -1
  147. package/lib/utilities/observeResize.d.ts +0 -21
  148. package/lib/utilities/observeResize.js +0 -46
  149. package/lib/utilities/observeResize.js.map +0 -1
  150. package/lib/utilities/useOverflow.d.ts +0 -45
  151. package/lib/utilities/useOverflow.js +0 -126
  152. package/lib/utilities/useOverflow.js.map +0 -1
  153. package/lib-amd/Tabs.d.ts +0 -1
  154. package/lib-amd/Tabs.js +0 -6
  155. package/lib-amd/Tabs.js.map +0 -1
  156. package/lib-amd/common/isConformant.d.ts +0 -4
  157. package/lib-amd/common/isConformant.js +0 -14
  158. package/lib-amd/common/isConformant.js.map +0 -1
  159. package/lib-amd/components/Tabs/TabItem.d.ts +0 -6
  160. package/lib-amd/components/Tabs/TabItem.js +0 -20
  161. package/lib-amd/components/Tabs/TabItem.js.map +0 -1
  162. package/lib-amd/components/Tabs/TabItem.types.d.ts +0 -61
  163. package/lib-amd/components/Tabs/TabItem.types.js +0 -5
  164. package/lib-amd/components/Tabs/TabItem.types.js.map +0 -1
  165. package/lib-amd/components/Tabs/Tabs.base.d.ts +0 -3
  166. package/lib-amd/components/Tabs/Tabs.base.js +0 -176
  167. package/lib-amd/components/Tabs/Tabs.base.js.map +0 -1
  168. package/lib-amd/components/Tabs/Tabs.d.ts +0 -8
  169. package/lib-amd/components/Tabs/Tabs.js +0 -14
  170. package/lib-amd/components/Tabs/Tabs.js.map +0 -1
  171. package/lib-amd/components/Tabs/Tabs.styles.d.ts +0 -2
  172. package/lib-amd/components/Tabs/Tabs.styles.js +0 -267
  173. package/lib-amd/components/Tabs/Tabs.styles.js.map +0 -1
  174. package/lib-amd/components/Tabs/Tabs.types.d.ts +0 -113
  175. package/lib-amd/components/Tabs/Tabs.types.js +0 -5
  176. package/lib-amd/components/Tabs/Tabs.types.js.map +0 -1
  177. package/lib-amd/components/Tabs/index.d.ts +0 -5
  178. package/lib-amd/components/Tabs/index.js +0 -11
  179. package/lib-amd/components/Tabs/index.js.map +0 -1
  180. package/lib-amd/index.d.ts +0 -1
  181. package/lib-amd/index.js +0 -6
  182. package/lib-amd/index.js.map +0 -1
  183. package/lib-amd/utilities/observeResize.d.ts +0 -21
  184. package/lib-amd/utilities/observeResize.js +0 -51
  185. package/lib-amd/utilities/observeResize.js.map +0 -1
  186. package/lib-amd/utilities/useOverflow.d.ts +0 -45
  187. package/lib-amd/utilities/useOverflow.js +0 -128
  188. package/lib-amd/utilities/useOverflow.js.map +0 -1
  189. package/lib-commonjs/Tabs.d.ts +0 -1
  190. package/lib-commonjs/Tabs.js +0 -5
  191. package/lib-commonjs/Tabs.js.map +0 -1
  192. package/lib-commonjs/common/isConformant.d.ts +0 -4
  193. package/lib-commonjs/common/isConformant.js +0 -13
  194. package/lib-commonjs/common/isConformant.js.map +0 -1
  195. package/lib-commonjs/components/Tabs/TabItem.d.ts +0 -6
  196. package/lib-commonjs/components/Tabs/TabItem.js +0 -21
  197. package/lib-commonjs/components/Tabs/TabItem.js.map +0 -1
  198. package/lib-commonjs/components/Tabs/TabItem.types.d.ts +0 -61
  199. package/lib-commonjs/components/Tabs/TabItem.types.js +0 -3
  200. package/lib-commonjs/components/Tabs/TabItem.types.js.map +0 -1
  201. package/lib-commonjs/components/Tabs/Tabs.base.d.ts +0 -3
  202. package/lib-commonjs/components/Tabs/Tabs.base.js +0 -182
  203. package/lib-commonjs/components/Tabs/Tabs.base.js.map +0 -1
  204. package/lib-commonjs/components/Tabs/Tabs.d.ts +0 -8
  205. package/lib-commonjs/components/Tabs/Tabs.js +0 -15
  206. package/lib-commonjs/components/Tabs/Tabs.js.map +0 -1
  207. package/lib-commonjs/components/Tabs/Tabs.styles.d.ts +0 -2
  208. package/lib-commonjs/components/Tabs/Tabs.styles.js +0 -268
  209. package/lib-commonjs/components/Tabs/Tabs.styles.js.map +0 -1
  210. package/lib-commonjs/components/Tabs/Tabs.types.d.ts +0 -113
  211. package/lib-commonjs/components/Tabs/Tabs.types.js +0 -3
  212. package/lib-commonjs/components/Tabs/Tabs.types.js.map +0 -1
  213. package/lib-commonjs/components/Tabs/index.d.ts +0 -5
  214. package/lib-commonjs/components/Tabs/index.js +0 -11
  215. package/lib-commonjs/components/Tabs/index.js.map +0 -1
  216. package/lib-commonjs/utilities/observeResize.d.ts +0 -21
  217. package/lib-commonjs/utilities/observeResize.js +0 -50
  218. package/lib-commonjs/utilities/observeResize.js.map +0 -1
  219. package/lib-commonjs/utilities/useOverflow.d.ts +0 -45
  220. package/lib-commonjs/utilities/useOverflow.js +0 -130
  221. package/lib-commonjs/utilities/useOverflow.js.map +0 -1
  222. package/src/components/Tabs/TabItem.types.ts +0 -69
  223. package/src/components/Tabs/Tabs.types.ts +0 -131
@@ -1,176 +0,0 @@
1
- define(["require", "exports", "tslib", "react", "@fluentui/react-hooks", "@fluentui/utilities", "@fluentui/react", "@fluentui/react/lib/Button", "./index", "../../utilities/useOverflow"], function (require, exports, tslib_1, React, react_hooks_1, utilities_1, react_1, Button_1, index_1, useOverflow_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.TabsBase = void 0;
5
- var getClassNames = utilities_1.classNamesFunction();
6
- var COMPONENT_NAME = 'Tabs';
7
- var getTabId = function (props, baseId, itemKey, index) {
8
- if (props.getTabId) {
9
- return props.getTabId(itemKey, index);
10
- }
11
- return baseId + ("-Tab" + index);
12
- };
13
- // Gets the set of Tabs as array of TabItemProps
14
- // The set of Tabs is determined by child components of type TabItem
15
- var getTabItems = function (props, baseId) {
16
- var result = {
17
- tabs: [],
18
- keyToIndexMapping: {},
19
- keyToTabIdMapping: {},
20
- };
21
- React.Children.forEach(React.Children.toArray(props.children), function (child, index) {
22
- if (isTabItem(child)) {
23
- var _a = child.props, _b = _a.itemKey, itemKey = _b === void 0 ? index.toString() : _b, tabItemProps = tslib_1.__rest(_a, ["itemKey"]);
24
- result.tabs.push(tslib_1.__assign(tslib_1.__assign({}, tabItemProps), { itemKey: itemKey }));
25
- result.keyToIndexMapping[itemKey] = index;
26
- result.keyToTabIdMapping[itemKey] = getTabId(props, baseId, itemKey, index);
27
- }
28
- else if (child) {
29
- utilities_1.warn('The children of a Tabs component must be of type TabItem to be rendered.');
30
- }
31
- });
32
- return result;
33
- };
34
- var isTabItem = function (item) {
35
- var _a, _b;
36
- return ((_b = (_a = item) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.name) === index_1.TabItem.name;
37
- };
38
- exports.TabsBase = React.forwardRef(function (props, ref) {
39
- var focusZoneRef = React.useRef(null);
40
- var overflowMenuButtonComponentRef = React.useRef(null);
41
- var baseId = react_hooks_1.useId('Tabs');
42
- var _a = react_hooks_1.useControllableValue(props.selectedKey, props.defaultSelectedKey), selectedKey = _a[0], setSelectedKey = _a[1];
43
- var componentRef = props.componentRef, theme = props.theme, tabSize = props.tabSize, tabFormat = props.tabFormat, overflowBehavior = props.overflowBehavior;
44
- var classNames;
45
- var divProps = utilities_1.getNativeProps(props, utilities_1.divProperties);
46
- var tabCollection = getTabItems(props, baseId);
47
- React.useImperativeHandle(componentRef, function () { return ({
48
- focus: function () {
49
- var _a;
50
- (_a = focusZoneRef.current) === null || _a === void 0 ? void 0 : _a.focus();
51
- },
52
- }); });
53
- var renderTabContent = function (tab) {
54
- if (!tab) {
55
- return null;
56
- }
57
- var itemCount = tab.itemCount, itemIcon = tab.itemIcon, headerText = tab.headerText;
58
- return (React.createElement("span", { className: classNames.tabContent },
59
- itemIcon !== undefined && (React.createElement("span", { className: classNames.icon },
60
- React.createElement(react_1.Icon, { iconName: itemIcon }))),
61
- headerText !== undefined && React.createElement("span", { className: classNames.text },
62
- " ",
63
- tab.headerText),
64
- itemCount !== undefined && React.createElement("span", { className: classNames.count },
65
- " (",
66
- itemCount,
67
- ")")));
68
- };
69
- var renderTab = function (renderTabCollection, tab, renderTabSelectedKey, className) {
70
- var itemKey = tab.itemKey, headerButtonProps = tab.headerButtonProps, onRenderTab = tab.onRenderTab;
71
- var tabId = renderTabCollection.keyToTabIdMapping[itemKey];
72
- var tabContent;
73
- var isSelected = renderTabSelectedKey === itemKey;
74
- if (onRenderTab) {
75
- tabContent = onRenderTab(tab, renderTabContent);
76
- }
77
- else {
78
- tabContent = renderTabContent(tab);
79
- }
80
- var contentString = tab.headerText || '';
81
- contentString += tab.itemCount ? ' (' + tab.itemCount + ')' : '';
82
- // Adding space supplementary for icon
83
- contentString += tab.itemIcon ? ' xx' : '';
84
- return (React.createElement(Button_1.CommandButton, tslib_1.__assign({}, headerButtonProps, { id: tabId, key: itemKey, className: utilities_1.css(className, isSelected && classNames.tabIsSelected),
85
- // eslint-disable-next-line react/jsx-no-bind
86
- onClick: function (ev) { return onTabClick(itemKey, ev); },
87
- // eslint-disable-next-line react/jsx-no-bind
88
- onKeyDown: function (ev) { return onKeyDown(itemKey, ev); }, "aria-label": tab.ariaLabel, role: tab.role || 'tab', "aria-selected": isSelected, name: tab.headerText, keytipProps: tab.keytipProps, "data-content": contentString }), tabContent));
89
- };
90
- var onTabClick = function (itemKey, ev) {
91
- ev.preventDefault();
92
- updateSelectedItem(itemKey, ev);
93
- };
94
- var onKeyDown = function (itemKey, ev) {
95
- // eslint-disable-next-line deprecation/deprecation
96
- if (ev.which === utilities_1.KeyCodes.enter) {
97
- ev.preventDefault();
98
- updateSelectedItem(itemKey);
99
- }
100
- };
101
- var updateSelectedItem = function (itemKey, ev) {
102
- var _a;
103
- setSelectedKey(itemKey);
104
- tabCollection = getTabItems(props, baseId);
105
- if (props.onTabClick && tabCollection.keyToIndexMapping[itemKey] >= 0) {
106
- var selectedIndex = tabCollection.keyToIndexMapping[itemKey];
107
- var item = React.Children.toArray(props.children)[selectedIndex];
108
- if (isTabItem(item)) {
109
- props.onTabClick(item, ev);
110
- }
111
- }
112
- (_a = overflowMenuButtonComponentRef.current) === null || _a === void 0 ? void 0 : _a.dismissMenu();
113
- };
114
- var renderTabItem = function (itemKey, isActive) {
115
- if (props.headersOnly || !itemKey) {
116
- return null;
117
- }
118
- var index = tabCollection.keyToIndexMapping[itemKey];
119
- var selectedTabId = tabCollection.keyToTabIdMapping[itemKey];
120
- return (React.createElement("div", { role: "tabpanel", hidden: !isActive, key: itemKey, "aria-hidden": !isActive, "aria-labelledby": selectedTabId, className: classNames.itemContainer }, React.Children.toArray(props.children)[index]));
121
- };
122
- var isKeyValid = function (itemKey) {
123
- return itemKey !== undefined && itemKey !== null && tabCollection.keyToIndexMapping[itemKey] !== undefined;
124
- };
125
- var getSelectedKey = function () {
126
- if (isKeyValid(selectedKey)) {
127
- return selectedKey;
128
- }
129
- if (tabCollection.tabs.length) {
130
- return tabCollection.tabs[0].itemKey;
131
- }
132
- return undefined;
133
- };
134
- classNames = getClassNames(props.styles, {
135
- theme: theme,
136
- tabSize: tabSize,
137
- tabFormat: tabFormat,
138
- });
139
- var renderedSelectedKey = getSelectedKey();
140
- var renderedSelectedIndex = renderedSelectedKey ? tabCollection.keyToIndexMapping[renderedSelectedKey] : 0;
141
- var items = tabCollection.tabs.map(function (l) { return renderTab(tabCollection, l, renderedSelectedKey, classNames.tab); });
142
- // The overflow menu starts empty and items[] is updated as the overflow items change
143
- var overflowMenuProps = React.useMemo(function () { return ({
144
- items: [],
145
- alignTargetEdge: true,
146
- directionalHint: react_1.DirectionalHint.bottomRightEdge,
147
- }); }, []);
148
- var overflowMenuButtonRef = useOverflow_1.useOverflow({
149
- onOverflowItemsChanged: function (overflowIndex, elements) {
150
- // Set data-is-overflowing on each item
151
- elements.forEach(function (_a) {
152
- var ele = _a.ele, isOverflowing = _a.isOverflowing;
153
- return (ele.dataset.isOverflowing = "" + isOverflowing);
154
- });
155
- // Update the menu items
156
- overflowMenuProps.items = tabCollection.tabs.slice(overflowIndex).map(function (tab, index) { return ({
157
- key: tab.itemKey || "" + (overflowIndex + index),
158
- onRender: function () { return renderTab(tabCollection, tab, renderedSelectedKey, classNames.tabInMenu); },
159
- }); });
160
- },
161
- rtl: utilities_1.getRTL(theme),
162
- pinnedIndex: renderedSelectedIndex,
163
- }).menuButtonRef;
164
- return (React.createElement("div", tslib_1.__assign({ role: "toolbar" }, divProps, { ref: ref }),
165
- React.createElement(react_1.FocusZone, { componentRef: focusZoneRef, direction: react_1.FocusZoneDirection.horizontal, className: classNames.root, role: "tablist" },
166
- items,
167
- overflowBehavior === 'menu' && (React.createElement(Button_1.CommandButton, { className: utilities_1.css(classNames.tab, classNames.overflowMenuButton), elementRef: overflowMenuButtonRef, componentRef: overflowMenuButtonComponentRef, menuProps: overflowMenuProps, menuIconProps: { iconName: 'More', style: { color: 'inherit' } } }))),
168
- renderedSelectedKey &&
169
- tabCollection.tabs.map(function (tab) {
170
- return (tab.alwaysRender === true || renderedSelectedKey === tab.itemKey) &&
171
- renderTabItem(tab.itemKey, renderedSelectedKey === tab.itemKey);
172
- })));
173
- });
174
- exports.TabsBase.displayName = COMPONENT_NAME;
175
- });
176
- //# sourceMappingURL=Tabs.base.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tabs.base.js","sourceRoot":"../src/","sources":["components/Tabs/Tabs.base.tsx"],"names":[],"mappings":";;;;IAeA,IAAM,aAAa,GAAG,8BAAkB,EAA8B,CAAC;IAEvE,IAAM,cAAc,GAAG,MAAM,CAAC;IAQ9B,IAAM,QAAQ,GAAG,UAAC,KAAgB,EAAE,MAAc,EAAE,OAAe,EAAE,KAAa;QAChF,IAAI,KAAK,CAAC,QAAQ,EAAE;YAClB,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SACvC;QACD,OAAO,MAAM,IAAG,SAAO,KAAO,CAAA,CAAC;IACjC,CAAC,CAAC;IAEF,gDAAgD;IAChD,oEAAoE;IACpE,IAAM,WAAW,GAAG,UAAC,KAAgB,EAAE,MAAc;QACnD,IAAM,MAAM,GAAsB;YAChC,IAAI,EAAE,EAAE;YACR,iBAAiB,EAAE,EAAE;YACrB,iBAAiB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IAAE,GAAG,EAAE,GAAG;YACxC,oBAAC,iBAAS,IACR,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,0BAAkB,CAAC,UAAU,EACxC,SAAS,EAAE,UAAU,CAAC,IAAI,EAC1B,IAAI,EAAC,SAAS;gBAEb,KAAK;gBACL,gBAAgB,KAAK,MAAM,IAAI,CAC9B,oBAAC,sBAAa,IACZ,SAAS,EAAE,eAAG,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,kBAAkB,CAAC,EAC7D,UAAU,EAAE,qBAAqB,EACjC,YAAY,EAAE,8BAA8B,EAC5C,SAAS,EAAE,iBAAiB,EAC5B,aAAa,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,GAChE,CACH,CACS;YACX,mBAAmB;gBAClB,aAAa,CAAC,IAAI,CAAC,GAAG,CACpB,UAAA,GAAG;oBACD,OAAA,CAAC,GAAG,CAAC,YAAY,KAAK,IAAI,IAAI,mBAAmB,KAAK,GAAG,CAAC,OAAO,CAAC;wBAClE,aAAa,CAAC,GAAG,CAAC,OAAO,EAAE,mBAAmB,KAAK,GAAG,CAAC,OAAO,CAAC;gBAD/D,CAC+D,CAClE,CACC,CACP,CAAC;IACJ,CAAC,CACF,CAAC;IACF,gBAAQ,CAAC,WAAW,GAAG,cAAc,CAAC","sourcesContent":["import * as React from 'react';\nimport { useControllableValue, useId } from '@fluentui/react-hooks';\nimport { classNamesFunction, css, divProperties, getNativeProps, getRTL, KeyCodes, warn } from '@fluentui/utilities';\nimport {\n DirectionalHint,\n FocusZone,\n FocusZoneDirection,\n Icon,\n IContextualMenuProps,\n IFocusZone,\n} from '@fluentui/react';\nimport { CommandButton, IButton } from '@fluentui/react/lib/Button';\nimport { TabsImperativeHandle, TabItemProps, TabsProps, TabsStyleProps, TabsStyles, TabItem } from './index';\nimport { useOverflow } from '../../utilities/useOverflow';\n\nconst getClassNames = classNamesFunction<TabsStyleProps, TabsStyles>();\n\nconst COMPONENT_NAME = 'Tabs';\n\ntype TabItemCollection = {\n tabs: TabItemProps[];\n keyToIndexMapping: { [key: string]: number };\n keyToTabIdMapping: { [key: string]: string };\n};\n\nconst getTabId = (props: TabsProps, baseId: string, itemKey: string, index: number): string => {\n if (props.getTabId) {\n return props.getTabId(itemKey, index);\n }\n return baseId + `-Tab${index}`;\n};\n\n// Gets the set of Tabs as array of TabItemProps\n// The set of Tabs is determined by child components of type TabItem\nconst getTabItems = (props: TabsProps, baseId: string): TabItemCollection => {\n const result: TabItemCollection = {\n tabs: [],\n keyToIndexMapping: {},\n keyToTabIdMapping: {},\n };\n\n React.Children.forEach(React.Children.toArray(props.children), (child: React.ReactNode, index: number) => {\n if (isTabItem(child)) {\n const { itemKey = index.toString(), ...tabItemProps } = child.props;\n result.tabs.push({\n ...tabItemProps,\n itemKey: itemKey,\n });\n result.keyToIndexMapping[itemKey] = index;\n result.keyToTabIdMapping[itemKey] = getTabId(props, baseId, itemKey, index);\n } else if (child) {\n warn('The children of a Tabs component must be of type TabItem to be rendered.');\n }\n });\n return result;\n};\n\nconst isTabItem = (item: React.ReactNode): item is TabItem => {\n return ((item as React.ReactElement)?.type as React.ComponentType)?.name === TabItem.name;\n};\n\nexport const TabsBase: React.FunctionComponent<TabsProps> = React.forwardRef<HTMLDivElement, TabsProps>(\n (props, ref) => {\n const focusZoneRef = React.useRef<IFocusZone>(null);\n const overflowMenuButtonComponentRef = React.useRef<IButton>(null);\n const baseId: string = useId('Tabs');\n\n const [selectedKey, setSelectedKey] = useControllableValue(props.selectedKey, props.defaultSelectedKey);\n\n const { componentRef, theme, tabSize, tabFormat, overflowBehavior } = props;\n\n let classNames: { [key in keyof TabsStyles]: string };\n const divProps = getNativeProps<React.HTMLAttributes<HTMLDivElement>>(props, divProperties);\n\n let tabCollection = getTabItems(props, baseId);\n\n React.useImperativeHandle(componentRef as React.RefObject<TabsImperativeHandle>, () => ({\n focus: () => {\n focusZoneRef.current?.focus();\n },\n }));\n\n const renderTabContent = (tab?: TabItemProps): JSX.Element | null => {\n if (!tab) {\n return null;\n }\n\n const { itemCount, itemIcon, headerText } = tab;\n return (\n <span className={classNames.tabContent}>\n {itemIcon !== undefined && (\n <span className={classNames.icon}>\n <Icon iconName={itemIcon} />\n </span>\n )}\n {headerText !== undefined && <span className={classNames.text}> {tab.headerText}</span>}\n {itemCount !== undefined && <span className={classNames.count}> ({itemCount})</span>}\n </span>\n );\n };\n\n const renderTab = (\n renderTabCollection: TabItemCollection,\n tab: TabItemProps,\n renderTabSelectedKey: string | null | undefined,\n className: string,\n ): JSX.Element => {\n const { itemKey, headerButtonProps, onRenderTab } = tab;\n const tabId = renderTabCollection.keyToTabIdMapping[itemKey!];\n let tabContent: JSX.Element | null;\n const isSelected: boolean = renderTabSelectedKey === itemKey;\n\n if (onRenderTab) {\n tabContent = onRenderTab(tab, renderTabContent);\n } else {\n tabContent = renderTabContent(tab);\n }\n\n let contentString = tab.headerText || '';\n contentString += tab.itemCount ? ' (' + tab.itemCount + ')' : '';\n // Adding space supplementary for icon\n contentString += tab.itemIcon ? ' xx' : '';\n return (\n <CommandButton\n {...headerButtonProps}\n id={tabId}\n key={itemKey}\n className={css(className, isSelected && classNames.tabIsSelected)}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={(ev: React.MouseEvent<HTMLElement>) => onTabClick(itemKey!, ev)}\n // eslint-disable-next-line react/jsx-no-bind\n onKeyDown={(ev: React.KeyboardEvent<HTMLElement>) => onKeyDown(itemKey!, ev)}\n aria-label={tab.ariaLabel}\n role={tab.role || 'tab'}\n aria-selected={isSelected}\n name={tab.headerText}\n keytipProps={tab.keytipProps}\n data-content={contentString}\n >\n {tabContent}\n </CommandButton>\n );\n };\n\n const onTabClick = (itemKey: string, ev: React.MouseEvent<HTMLElement>): void => {\n ev.preventDefault();\n updateSelectedItem(itemKey, ev);\n };\n\n const onKeyDown = (itemKey: string, ev: React.KeyboardEvent<HTMLElement>): void => {\n // eslint-disable-next-line deprecation/deprecation\n if (ev.which === KeyCodes.enter) {\n ev.preventDefault();\n updateSelectedItem(itemKey);\n }\n };\n\n const updateSelectedItem = (itemKey: string, ev?: React.MouseEvent<HTMLElement>): void => {\n setSelectedKey(itemKey);\n tabCollection = getTabItems(props, baseId);\n if (props.onTabClick && tabCollection.keyToIndexMapping[itemKey] >= 0) {\n const selectedIndex = tabCollection.keyToIndexMapping[itemKey];\n const item = React.Children.toArray(props.children)[selectedIndex];\n if (isTabItem(item)) {\n props.onTabClick(item, ev);\n }\n }\n\n overflowMenuButtonComponentRef.current?.dismissMenu();\n };\n\n const renderTabItem = (itemKey: string | undefined, isActive: boolean): JSX.Element | null => {\n if (props.headersOnly || !itemKey) {\n return null;\n }\n\n const index = tabCollection.keyToIndexMapping[itemKey];\n const selectedTabId = tabCollection.keyToTabIdMapping[itemKey];\n return (\n <div\n role=\"tabpanel\"\n hidden={!isActive}\n key={itemKey}\n aria-hidden={!isActive}\n aria-labelledby={selectedTabId}\n className={classNames.itemContainer}\n >\n {React.Children.toArray(props.children)[index]}\n </div>\n );\n };\n\n const isKeyValid = (itemKey: string | null | undefined): boolean => {\n return itemKey !== undefined && itemKey !== null && tabCollection.keyToIndexMapping[itemKey] !== undefined;\n };\n\n const getSelectedKey = () => {\n if (isKeyValid(selectedKey)) {\n return selectedKey;\n }\n if (tabCollection.tabs.length) {\n return tabCollection.tabs[0].itemKey;\n }\n return undefined;\n };\n\n classNames = getClassNames(props.styles!, {\n theme: theme!,\n tabSize,\n tabFormat,\n });\n\n const renderedSelectedKey = getSelectedKey();\n const renderedSelectedIndex = renderedSelectedKey ? tabCollection.keyToIndexMapping[renderedSelectedKey] : 0;\n\n const items = tabCollection.tabs.map(l => renderTab(tabCollection, l, renderedSelectedKey, classNames.tab));\n\n // The overflow menu starts empty and items[] is updated as the overflow items change\n const overflowMenuProps: IContextualMenuProps = React.useMemo(\n () => ({\n items: [],\n alignTargetEdge: true,\n directionalHint: DirectionalHint.bottomRightEdge,\n }),\n [],\n );\n\n const { menuButtonRef: overflowMenuButtonRef } = useOverflow({\n onOverflowItemsChanged: (overflowIndex, elements) => {\n // Set data-is-overflowing on each item\n elements.forEach(({ ele, isOverflowing }) => (ele.dataset.isOverflowing = `${isOverflowing}`));\n\n // Update the menu items\n overflowMenuProps.items = tabCollection.tabs.slice(overflowIndex).map((tab, index) => ({\n key: tab.itemKey || `${overflowIndex + index}`,\n onRender: () => renderTab(tabCollection, tab, renderedSelectedKey, classNames.tabInMenu),\n }));\n },\n rtl: getRTL(theme),\n pinnedIndex: renderedSelectedIndex,\n });\n\n return (\n <div role=\"toolbar\" {...divProps} ref={ref}>\n <FocusZone\n componentRef={focusZoneRef}\n direction={FocusZoneDirection.horizontal}\n className={classNames.root}\n role=\"tablist\"\n >\n {items}\n {overflowBehavior === 'menu' && (\n <CommandButton\n className={css(classNames.tab, classNames.overflowMenuButton)}\n elementRef={overflowMenuButtonRef}\n componentRef={overflowMenuButtonComponentRef}\n menuProps={overflowMenuProps}\n menuIconProps={{ iconName: 'More', style: { color: 'inherit' } }}\n />\n )}\n </FocusZone>\n {renderedSelectedKey &&\n tabCollection.tabs.map(\n tab =>\n (tab.alwaysRender === true || renderedSelectedKey === tab.itemKey) &&\n renderTabItem(tab.itemKey, renderedSelectedKey === tab.itemKey),\n )}\n </div>\n );\n },\n);\nTabsBase.displayName = COMPONENT_NAME;\n"]}
@@ -1,8 +0,0 @@
1
- import * as React from 'react';
2
- import { TabsProps } from './Tabs.types';
3
- /**
4
- * The Tabs control and related tabs pattern are used for navigating frequently accessed,
5
- * distinct content categories. Tabs allow for navigation between two or more content
6
- * views and relies on text headers to articulate the different sections of content.
7
- */
8
- export declare const Tabs: React.FunctionComponent<TabsProps>;
@@ -1,14 +0,0 @@
1
- define(["require", "exports", "@fluentui/utilities", "./Tabs.base", "./Tabs.styles"], function (require, exports, utilities_1, Tabs_base_1, Tabs_styles_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Tabs = void 0;
5
- /**
6
- * The Tabs control and related tabs pattern are used for navigating frequently accessed,
7
- * distinct content categories. Tabs allow for navigation between two or more content
8
- * views and relies on text headers to articulate the different sections of content.
9
- */
10
- exports.Tabs = utilities_1.styled(Tabs_base_1.TabsBase, Tabs_styles_1.getStyles, undefined, {
11
- scope: 'Tabs',
12
- });
13
- });
14
- //# sourceMappingURL=Tabs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tabs.js","sourceRoot":"../src/","sources":["components/Tabs/Tabs.tsx"],"names":[],"mappings":";;;;IAMA;;;;OAIG;IACU,QAAA,IAAI,GAAuC,kBAAM,CAC5D,oBAAQ,EACR,uBAAS,EACT,SAAS,EACT;QACE,KAAK,EAAE,MAAM;KACd,CACF,CAAC","sourcesContent":["import * as React from 'react';\nimport { styled } from '@fluentui/utilities';\nimport { TabsProps, TabsStyleProps, TabsStyles } from './Tabs.types';\nimport { TabsBase } from './Tabs.base';\nimport { getStyles } from './Tabs.styles';\n\n/**\n * The Tabs control and related tabs pattern are used for navigating frequently accessed,\n * distinct content categories. Tabs allow for navigation between two or more content\n * views and relies on text headers to articulate the different sections of content.\n */\nexport const Tabs: React.FunctionComponent<TabsProps> = styled<TabsProps, TabsStyleProps, TabsStyles>(\n TabsBase,\n getStyles,\n undefined,\n {\n scope: 'Tabs',\n },\n);\n"]}
@@ -1,2 +0,0 @@
1
- import { TabsStyleProps, TabsStyles } from './Tabs.types';
2
- export declare const getStyles: (props: TabsStyleProps) => TabsStyles;
@@ -1,267 +0,0 @@
1
- define(["require", "exports", "tslib", "@fluentui/style-utilities", "@fluentui/utilities"], function (require, exports, tslib_1, style_utilities_1, utilities_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getStyles = void 0;
5
- var globalClassNames = {
6
- count: 'ms-Tabs-count',
7
- icon: 'ms-Tabs-icon',
8
- tabIsSelected: 'is-selected',
9
- tab: 'ms-Tabs-tab',
10
- tabContent: 'ms-Tabs-tabContent',
11
- root: 'ms-Tabs',
12
- rootIsLarge: 'ms-Tabs--large',
13
- rootIsTabs: 'ms-Tabs--tabs',
14
- text: 'ms-Tabs-text',
15
- tabInMenu: 'ms-Tabs-tabInMenu',
16
- overflowMenuButton: 'ms-Tabs-overflowMenuButton',
17
- };
18
- var getLinkStyles = function (props, classNames, isLinkInOverflowMenu) {
19
- var _a, _b, _c;
20
- if (isLinkInOverflowMenu === void 0) { isLinkInOverflowMenu = false; }
21
- var tabSize = props.tabSize, tabFormat = props.tabFormat;
22
- var _d = props.theme, semanticColors = _d.semanticColors, fonts = _d.fonts;
23
- var rootIsLarge = tabSize === 'large';
24
- var rootIsTabs = tabFormat === 'tabs';
25
- return [
26
- fonts.medium,
27
- {
28
- color: semanticColors.actionLink,
29
- padding: '0 8px',
30
- position: 'relative',
31
- backgroundColor: 'transparent',
32
- border: 0,
33
- borderRadius: 0,
34
- selectors: (_a = {
35
- ':hover': {
36
- backgroundColor: semanticColors.buttonBackgroundHovered,
37
- color: semanticColors.buttonTextHovered,
38
- cursor: 'pointer',
39
- },
40
- ':active': {
41
- backgroundColor: semanticColors.buttonBackgroundPressed,
42
- color: semanticColors.buttonTextHovered,
43
- },
44
- ':focus': {
45
- outline: 'none',
46
- }
47
- },
48
- _a["." + utilities_1.IsFocusVisibleClassName + " &:focus"] = {
49
- outline: "1px solid " + semanticColors.focusBorder,
50
- },
51
- _a["." + utilities_1.IsFocusVisibleClassName + " &:focus:after"] = {
52
- content: 'attr(data-content)',
53
- position: 'relative',
54
- border: 0,
55
- },
56
- _a),
57
- },
58
- !isLinkInOverflowMenu && [
59
- {
60
- display: 'inline-block',
61
- lineHeight: 44,
62
- height: 44,
63
- marginRight: 8,
64
- textAlign: 'center',
65
- selectors: {
66
- ':before': {
67
- backgroundColor: 'transparent',
68
- bottom: 0,
69
- content: '""',
70
- height: 2,
71
- left: 8,
72
- position: 'absolute',
73
- right: 8,
74
- transition: "left " + style_utilities_1.AnimationVariables.durationValue2 + " " + style_utilities_1.AnimationVariables.easeFunction2 + ",\n right " + style_utilities_1.AnimationVariables.durationValue2 + " " + style_utilities_1.AnimationVariables.easeFunction2,
75
- },
76
- ':after': {
77
- color: 'transparent',
78
- content: 'attr(data-content)',
79
- display: 'block',
80
- fontWeight: style_utilities_1.FontWeights.bold,
81
- height: 1,
82
- overflow: 'hidden',
83
- visibility: 'hidden',
84
- },
85
- },
86
- },
87
- rootIsLarge && {
88
- fontSize: fonts.large.fontSize,
89
- },
90
- rootIsTabs && [
91
- {
92
- marginRight: 0,
93
- height: 44,
94
- lineHeight: 44,
95
- backgroundColor: semanticColors.buttonBackground,
96
- padding: '0 10px',
97
- verticalAlign: 'top',
98
- selectors: (_b = {
99
- ':focus': {
100
- outlineOffset: '-1px',
101
- }
102
- },
103
- _b["." + utilities_1.IsFocusVisibleClassName + " &:focus::before"] = {
104
- height: 'auto',
105
- background: 'transparent',
106
- transition: 'none',
107
- },
108
- _b['&:hover, &:focus'] = {
109
- color: semanticColors.buttonTextCheckedHovered,
110
- },
111
- _b['&:active, &:hover'] = {
112
- color: semanticColors.primaryButtonText,
113
- backgroundColor: semanticColors.primaryButtonBackground,
114
- },
115
- _b["&." + classNames.tabIsSelected] = {
116
- backgroundColor: semanticColors.primaryButtonBackground,
117
- color: semanticColors.primaryButtonText,
118
- fontWeight: style_utilities_1.FontWeights.regular,
119
- selectors: (_c = {
120
- ':before': {
121
- backgroundColor: 'transparent',
122
- transition: 'none',
123
- position: 'absolute',
124
- top: 0,
125
- left: 0,
126
- right: 0,
127
- bottom: 0,
128
- content: '""',
129
- height: 0,
130
- },
131
- ':hover': {
132
- backgroundColor: semanticColors.primaryButtonBackgroundHovered,
133
- color: semanticColors.primaryButtonText,
134
- },
135
- '&:active': {
136
- backgroundColor: semanticColors.primaryButtonBackgroundPressed,
137
- color: semanticColors.primaryButtonText,
138
- }
139
- },
140
- _c[style_utilities_1.HighContrastSelector] = tslib_1.__assign({ fontWeight: style_utilities_1.FontWeights.semibold, color: 'HighlightText', background: 'Highlight' }, style_utilities_1.getHighContrastNoAdjustStyle()),
141
- _c),
142
- },
143
- _b),
144
- },
145
- ],
146
- ],
147
- ];
148
- };
149
- var getStyles = function (props) {
150
- var _a, _b, _c, _d;
151
- var className = props.className, tabSize = props.tabSize, tabFormat = props.tabFormat, theme = props.theme;
152
- var semanticColors = theme.semanticColors, fonts = theme.fonts;
153
- var classNames = style_utilities_1.getGlobalClassNames(globalClassNames, theme);
154
- var rootIsLarge = tabSize === 'large';
155
- var rootIsTabs = tabFormat === 'tabs';
156
- return {
157
- root: [
158
- classNames.root,
159
- fonts.medium,
160
- style_utilities_1.normalize,
161
- {
162
- position: 'relative',
163
- color: semanticColors.link,
164
- whiteSpace: 'nowrap',
165
- },
166
- rootIsLarge && classNames.rootIsLarge,
167
- rootIsTabs && classNames.rootIsTabs,
168
- className,
169
- ],
170
- itemContainer: {
171
- selectors: {
172
- '&[hidden]': {
173
- display: 'none',
174
- },
175
- },
176
- },
177
- tab: tslib_1.__spreadArrays([
178
- classNames.tab
179
- ], getLinkStyles(props, classNames), [
180
- (_a = {},
181
- _a["&[data-is-overflowing='true']"] = {
182
- display: 'none',
183
- },
184
- _a),
185
- ]),
186
- overflowMenuButton: [
187
- classNames.overflowMenuButton,
188
- (_b = {
189
- visibility: 'hidden',
190
- position: 'absolute',
191
- right: 0
192
- },
193
- _b["." + classNames.tab + "[data-is-overflowing='true'] ~ &"] = {
194
- visibility: 'visible',
195
- position: 'relative',
196
- },
197
- _b),
198
- ],
199
- tabInMenu: tslib_1.__spreadArrays([
200
- classNames.tabInMenu
201
- ], getLinkStyles(props, classNames, true), [
202
- {
203
- textAlign: 'left',
204
- width: '100%',
205
- height: 36,
206
- lineHeight: 36,
207
- },
208
- ]),
209
- tabIsSelected: [
210
- classNames.tab,
211
- classNames.tabIsSelected,
212
- {
213
- fontWeight: style_utilities_1.FontWeights.semibold,
214
- selectors: (_c = {
215
- ':before': {
216
- backgroundColor: semanticColors.inputBackgroundChecked,
217
- selectors: (_d = {},
218
- _d[style_utilities_1.HighContrastSelector] = {
219
- backgroundColor: 'Highlight',
220
- },
221
- _d),
222
- },
223
- ':hover::before': {
224
- left: 0,
225
- right: 0,
226
- }
227
- },
228
- _c[style_utilities_1.HighContrastSelector] = {
229
- color: 'Highlight',
230
- },
231
- _c),
232
- },
233
- ],
234
- tabContent: [
235
- classNames.tabContent,
236
- {
237
- flex: '0 1 100%',
238
- selectors: {
239
- '& > * ': {
240
- marginLeft: 4,
241
- },
242
- '& > *:first-child': {
243
- marginLeft: 0,
244
- },
245
- },
246
- },
247
- ],
248
- text: [
249
- classNames.text,
250
- {
251
- display: 'inline-block',
252
- verticalAlign: 'top',
253
- },
254
- ],
255
- count: [
256
- classNames.count,
257
- {
258
- display: 'inline-block',
259
- verticalAlign: 'top',
260
- },
261
- ],
262
- icon: classNames.icon,
263
- };
264
- };
265
- exports.getStyles = getStyles;
266
- });
267
- //# sourceMappingURL=Tabs.styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tabs.styles.js","sourceRoot":"../src/","sources":["components/Tabs/Tabs.styles.ts"],"names":[],"mappings":";;;;IAYA,IAAM,gBAAgB,GAAG;QACvB,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,cAAc;QACpB,aAAa,EAAE,aAAa;QAC5B,GAAG,EAAE,aAAa;QAClB,UAAU,EAAE,oBAAoB;QAChC,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,gBAAgB;QAC7B,UAAU,EAAE,eAAe;QAC3B,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,mBAAmB;QAC9B,kBAAkB,EAAE,4BAA4B;KACjD,CAAC;IAEF,IAAM,aAAa,GAAG,UACpB,KAAqB,EACrB,UAAqC,EACrC,oBAAqC;;QAArC,qCAAA,EAAA,4BAAqC;QAE7B,IAAA,OAAO,GAAgB,KAAK,QAArB,EAAE,SAAS,GAAK,KAAK,UAAV,CAAW;QAC/B,IAAA,KAA4B,KAAK,CAAC,KAAK,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gBACrB;oBACE,IAAI,EAAE,UAAU;oBAChB,SAAS,EAAE;wBACT,QAAQ,EAAE;4BACR,UAAU,EAAE,CAAC;yBACd;wBACD,mBAAmB,EAAE;4BACnB,UAAU,EAAE,CAAC;yBACd;qBACF;iBACF;aACF;YACD,IAAI,EAAE;gBACJ,UAAU,CAAC,IAAI;gBACf;oBACE,OAAO,EAAE,cAAc;oBACvB,aAAa,EAAE,KAAK;iBACrB;aACF;YACD,KAAK,EAAE;gBACL,UAAU,CAAC,KAAK;gBAChB;oBACE,OAAO,EAAE,cAAc;oBACvB,aAAa,EAAE,KAAK;iBACrB;aACF;YACD,IAAI,EAAE,UAAU,CAAC,IAAI;SACtB,CAAC;IACJ,CAAC,CAAC;IAnHW,QAAA,SAAS,aAmHpB","sourcesContent":["import { TabsStyleProps, TabsStyles } from './Tabs.types';\nimport {\n AnimationVariables,\n getGlobalClassNames,\n HighContrastSelector,\n IStyle,\n normalize,\n FontWeights,\n getHighContrastNoAdjustStyle,\n} from '@fluentui/style-utilities';\nimport { IsFocusVisibleClassName } from '@fluentui/utilities';\n\nconst globalClassNames = {\n count: 'ms-Tabs-count',\n icon: 'ms-Tabs-icon',\n tabIsSelected: 'is-selected',\n tab: 'ms-Tabs-tab',\n tabContent: 'ms-Tabs-tabContent',\n root: 'ms-Tabs',\n rootIsLarge: 'ms-Tabs--large',\n rootIsTabs: 'ms-Tabs--tabs',\n text: 'ms-Tabs-text',\n tabInMenu: 'ms-Tabs-tabInMenu',\n overflowMenuButton: 'ms-Tabs-overflowMenuButton',\n};\n\nconst getLinkStyles = (\n props: TabsStyleProps,\n classNames: { [key: string]: string },\n isLinkInOverflowMenu: boolean = false,\n): IStyle[] => {\n const { tabSize, tabFormat } = props;\n const { semanticColors, fonts } = props.theme;\n const rootIsLarge = tabSize === 'large';\n const rootIsTabs = tabFormat === 'tabs';\n\n return [\n fonts.medium,\n {\n color: semanticColors.actionLink,\n padding: '0 8px',\n position: 'relative',\n backgroundColor: 'transparent',\n border: 0,\n borderRadius: 0,\n selectors: {\n ':hover': {\n backgroundColor: semanticColors.buttonBackgroundHovered,\n color: semanticColors.buttonTextHovered,\n cursor: 'pointer',\n },\n ':active': {\n backgroundColor: semanticColors.buttonBackgroundPressed,\n color: semanticColors.buttonTextHovered,\n },\n ':focus': {\n outline: 'none',\n },\n [`.${IsFocusVisibleClassName} &:focus`]: {\n outline: `1px solid ${semanticColors.focusBorder}`,\n },\n [`.${IsFocusVisibleClassName} &:focus:after`]: {\n content: 'attr(data-content)',\n position: 'relative',\n border: 0,\n },\n },\n },\n !isLinkInOverflowMenu && [\n {\n display: 'inline-block',\n lineHeight: 44,\n height: 44,\n marginRight: 8,\n textAlign: 'center',\n selectors: {\n ':before': {\n backgroundColor: 'transparent',\n bottom: 0,\n content: '\"\"',\n height: 2,\n left: 8,\n position: 'absolute',\n right: 8,\n transition: `left ${AnimationVariables.durationValue2} ${AnimationVariables.easeFunction2},\n right ${AnimationVariables.durationValue2} ${AnimationVariables.easeFunction2}`,\n },\n ':after': {\n color: 'transparent',\n content: 'attr(data-content)',\n display: 'block',\n fontWeight: FontWeights.bold,\n height: 1,\n overflow: 'hidden',\n visibility: 'hidden',\n },\n },\n },\n rootIsLarge && {\n fontSize: fonts.large.fontSize,\n },\n rootIsTabs && [\n {\n marginRight: 0,\n height: 44,\n lineHeight: 44,\n backgroundColor: semanticColors.buttonBackground,\n padding: '0 10px',\n verticalAlign: 'top',\n\n selectors: {\n ':focus': {\n outlineOffset: '-1px',\n },\n [`.${IsFocusVisibleClassName} &:focus::before`]: {\n height: 'auto',\n background: 'transparent',\n transition: 'none',\n },\n '&:hover, &:focus': {\n color: semanticColors.buttonTextCheckedHovered,\n },\n '&:active, &:hover': {\n color: semanticColors.primaryButtonText,\n backgroundColor: semanticColors.primaryButtonBackground,\n },\n [`&.${classNames.tabIsSelected}`]: {\n backgroundColor: semanticColors.primaryButtonBackground,\n color: semanticColors.primaryButtonText,\n fontWeight: FontWeights.regular,\n selectors: {\n ':before': {\n backgroundColor: 'transparent',\n transition: 'none',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n content: '\"\"',\n height: 0,\n },\n ':hover': {\n backgroundColor: semanticColors.primaryButtonBackgroundHovered,\n color: semanticColors.primaryButtonText,\n },\n '&:active': {\n backgroundColor: semanticColors.primaryButtonBackgroundPressed,\n color: semanticColors.primaryButtonText,\n },\n [HighContrastSelector]: {\n fontWeight: FontWeights.semibold,\n color: 'HighlightText',\n background: 'Highlight',\n ...getHighContrastNoAdjustStyle(),\n },\n },\n },\n },\n },\n ],\n ],\n ];\n};\n\nexport const getStyles = (props: TabsStyleProps): TabsStyles => {\n const { className, tabSize, tabFormat, theme } = props;\n const { semanticColors, fonts } = theme;\n\n const classNames = getGlobalClassNames(globalClassNames, theme);\n\n const rootIsLarge = tabSize === 'large';\n const rootIsTabs = tabFormat === 'tabs';\n\n return {\n root: [\n classNames.root,\n fonts.medium,\n normalize,\n {\n position: 'relative',\n color: semanticColors.link,\n whiteSpace: 'nowrap',\n },\n rootIsLarge && classNames.rootIsLarge,\n rootIsTabs && classNames.rootIsTabs,\n className,\n ],\n itemContainer: {\n selectors: {\n '&[hidden]': {\n display: 'none',\n },\n },\n },\n tab: [\n classNames.tab,\n ...getLinkStyles(props, classNames),\n {\n [`&[data-is-overflowing='true']`]: {\n display: 'none',\n },\n },\n ],\n overflowMenuButton: [\n classNames.overflowMenuButton,\n {\n visibility: 'hidden',\n position: 'absolute',\n right: 0,\n [`.${classNames.tab}[data-is-overflowing='true'] ~ &`]: {\n visibility: 'visible',\n position: 'relative',\n },\n },\n ],\n tabInMenu: [\n classNames.tabInMenu,\n ...getLinkStyles(props, classNames, true),\n {\n textAlign: 'left',\n width: '100%',\n height: 36,\n lineHeight: 36,\n },\n ],\n tabIsSelected: [\n classNames.tab,\n classNames.tabIsSelected,\n {\n fontWeight: FontWeights.semibold,\n selectors: {\n ':before': {\n backgroundColor: semanticColors.inputBackgroundChecked,\n selectors: {\n [HighContrastSelector]: {\n backgroundColor: 'Highlight',\n },\n },\n },\n ':hover::before': {\n left: 0,\n right: 0,\n },\n [HighContrastSelector]: {\n color: 'Highlight',\n },\n },\n },\n ],\n tabContent: [\n classNames.tabContent,\n {\n flex: '0 1 100%',\n selectors: {\n '& > * ': {\n marginLeft: 4,\n },\n '& > *:first-child': {\n marginLeft: 0,\n },\n },\n },\n ],\n text: [\n classNames.text,\n {\n display: 'inline-block',\n verticalAlign: 'top',\n },\n ],\n count: [\n classNames.count,\n {\n display: 'inline-block',\n verticalAlign: 'top',\n },\n ],\n icon: classNames.icon,\n };\n};\n"]}