@fluentui/react-tabs 9.3.3 → 9.3.5
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.
- package/.swcrc +30 -0
- package/CHANGELOG.json +85 -1
- package/CHANGELOG.md +29 -2
- package/lib/Tab.js.map +1 -1
- package/lib/TabList.js.map +1 -1
- package/lib/components/Tab/Tab.js.map +1 -1
- package/lib/components/Tab/Tab.types.js.map +1 -1
- package/lib/components/Tab/index.js.map +1 -1
- package/lib/components/Tab/renderTab.js +1 -7
- package/lib/components/Tab/renderTab.js.map +1 -1
- package/lib/components/Tab/useTab.js.map +1 -1
- package/lib/components/Tab/useTabAnimatedIndicator.js +4 -4
- package/lib/components/Tab/useTabAnimatedIndicator.js.map +1 -1
- package/lib/components/Tab/useTabStyles.js +4 -6
- package/lib/components/Tab/useTabStyles.js.map +1 -1
- package/lib/components/TabList/TabList.js.map +1 -1
- package/lib/components/TabList/TabList.types.js +1 -1
- package/lib/components/TabList/TabList.types.js.map +1 -1
- package/lib/components/TabList/TabListContext.js +3 -6
- package/lib/components/TabList/TabListContext.js.map +1 -1
- package/lib/components/TabList/index.js.map +1 -1
- package/lib/components/TabList/renderTabList.js +1 -3
- package/lib/components/TabList/renderTabList.js.map +1 -1
- package/lib/components/TabList/useTabList.js.map +1 -1
- package/lib/components/TabList/useTabListContextValues.js.map +1 -1
- package/lib/components/TabList/useTabListStyles.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Tab.js +5 -4
- package/lib-commonjs/Tab.js.map +1 -1
- package/lib-commonjs/TabList.js +5 -4
- package/lib-commonjs/TabList.js.map +1 -1
- package/lib-commonjs/components/Tab/Tab.js +19 -20
- package/lib-commonjs/components/Tab/Tab.js.map +1 -1
- package/lib-commonjs/components/Tab/Tab.types.js +3 -2
- package/lib-commonjs/components/Tab/Tab.types.js.map +1 -1
- package/lib-commonjs/components/Tab/index.js +10 -9
- package/lib-commonjs/components/Tab/index.js.map +1 -1
- package/lib-commonjs/components/Tab/renderTab.js +16 -25
- package/lib-commonjs/components/Tab/renderTab.js.map +1 -1
- package/lib-commonjs/components/Tab/useTab.js +76 -82
- package/lib-commonjs/components/Tab/useTab.js.map +1 -1
- package/lib-commonjs/components/Tab/useTabAnimatedIndicator.js +133 -117
- package/lib-commonjs/components/Tab/useTabAnimatedIndicator.js.map +1 -1
- package/lib-commonjs/components/Tab/useTabStyles.js +751 -396
- package/lib-commonjs/components/Tab/useTabStyles.js.map +1 -1
- package/lib-commonjs/components/TabList/TabList.js +21 -22
- package/lib-commonjs/components/TabList/TabList.js.map +1 -1
- package/lib-commonjs/components/TabList/TabList.types.js +5 -2
- package/lib-commonjs/components/TabList/TabList.types.js.map +1 -1
- package/lib-commonjs/components/TabList/TabListContext.js +34 -28
- package/lib-commonjs/components/TabList/TabListContext.js.map +1 -1
- package/lib-commonjs/components/TabList/index.js +11 -10
- package/lib-commonjs/components/TabList/index.js.map +1 -1
- package/lib-commonjs/components/TabList/renderTabList.js +16 -21
- package/lib-commonjs/components/TabList/renderTabList.js.map +1 -1
- package/lib-commonjs/components/TabList/useTabList.js +73 -84
- package/lib-commonjs/components/TabList/useTabList.js.map +1 -1
- package/lib-commonjs/components/TabList/useTabListContextValues.js +23 -32
- package/lib-commonjs/components/TabList/useTabListContextValues.js.map +1 -1
- package/lib-commonjs/components/TabList/useTabListStyles.js +46 -36
- package/lib-commonjs/components/TabList/useTabListStyles.js.map +1 -1
- package/lib-commonjs/index.js +27 -84
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +10 -9
- package/lib-amd/Tab.js +0 -6
- package/lib-amd/Tab.js.map +0 -1
- package/lib-amd/TabList.js +0 -6
- package/lib-amd/TabList.js.map +0 -1
- package/lib-amd/components/Tab/Tab.js +0 -17
- package/lib-amd/components/Tab/Tab.js.map +0 -1
- package/lib-amd/components/Tab/Tab.types.js +0 -5
- package/lib-amd/components/Tab/Tab.types.js.map +0 -1
- package/lib-amd/components/Tab/index.js +0 -11
- package/lib-amd/components/Tab/index.js.map +0 -1
- package/lib-amd/components/Tab/renderTab.js +0 -17
- package/lib-amd/components/Tab/renderTab.js.map +0 -1
- package/lib-amd/components/Tab/useTab.js +0 -63
- package/lib-amd/components/Tab/useTab.js.map +0 -1
- package/lib-amd/components/Tab/useTabAnimatedIndicator.js +0 -112
- package/lib-amd/components/Tab/useTabAnimatedIndicator.js.map +0 -1
- package/lib-amd/components/Tab/useTabStyles.js +0 -380
- package/lib-amd/components/Tab/useTabStyles.js.map +0 -1
- package/lib-amd/components/TabList/TabList.js +0 -18
- package/lib-amd/components/TabList/TabList.js.map +0 -1
- package/lib-amd/components/TabList/TabList.types.js +0 -5
- package/lib-amd/components/TabList/TabList.types.js.map +0 -1
- package/lib-amd/components/TabList/TabListContext.js +0 -37
- package/lib-amd/components/TabList/TabListContext.js.map +0 -1
- package/lib-amd/components/TabList/index.js +0 -12
- package/lib-amd/components/TabList/index.js.map +0 -1
- package/lib-amd/components/TabList/renderTabList.js +0 -15
- package/lib-amd/components/TabList/renderTabList.js.map +0 -1
- package/lib-amd/components/TabList/useTabList.js +0 -74
- package/lib-amd/components/TabList/useTabList.js.map +0 -1
- package/lib-amd/components/TabList/useTabListContextValues.js +0 -23
- package/lib-amd/components/TabList/useTabListContextValues.js.map +0 -1
- package/lib-amd/components/TabList/useTabListStyles.js +0 -39
- package/lib-amd/components/TabList/useTabListStyles.js.map +0 -1
- package/lib-amd/index.js +0 -19
- package/lib-amd/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/TabList/useTabList.js"],"sourcesContent":["import * as React from 'react';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { getNativeElementProps, useControllableState, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\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 */\nexport const useTabList_unstable = (props, ref) => {\n const {\n appearance = 'transparent',\n reserveSelectedTabSpace = true,\n disabled = false,\n onTabSelect,\n size = 'medium',\n vertical = false\n } = props;\n const innerRef = React.useRef(null);\n const focusAttributes = useArrowNavigationGroup({\n circular: true,\n axis: vertical ? 'vertical' : 'horizontal',\n memorizeCurrent: true\n });\n const [selectedValue, setSelectedValue] = useControllableState({\n state: props.selectedValue,\n defaultState: props.defaultSelectedValue,\n initialState: undefined\n });\n // considered usePrevious, but it is sensitive to re-renders\n // this could cause the previous to move to current in the case where the tab list re-renders.\n // these refs avoid getRegisteredTabs changing when selectedValue changes and causing\n // renders for tabs that have not changed.\n const currentSelectedValue = React.useRef(undefined);\n const previousSelectedValue = React.useRef(undefined);\n React.useEffect(() => {\n previousSelectedValue.current = currentSelectedValue.current;\n currentSelectedValue.current = selectedValue;\n }, [selectedValue]);\n const onSelect = useEventCallback((event, data) => {\n setSelectedValue(data.value);\n onTabSelect === null || onTabSelect === void 0 ? void 0 : onTabSelect(event, data);\n });\n const registeredTabs = React.useRef({});\n const onRegister = useEventCallback(data => {\n registeredTabs.current[JSON.stringify(data.value)] = data;\n });\n const onUnregister = useEventCallback(data => {\n delete registeredTabs.current[JSON.stringify(data.value)];\n });\n const getRegisteredTabs = React.useCallback(() => {\n return {\n selectedValue: currentSelectedValue.current,\n previousSelectedValue: previousSelectedValue.current,\n registeredTabs: registeredTabs.current\n };\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 reserveSelectedTabSpace,\n disabled,\n selectedValue,\n size,\n vertical,\n onRegister,\n onUnregister,\n onSelect,\n getRegisteredTabs\n };\n};\n//# sourceMappingURL=useTabList.js.map"],"names":["useTabList_unstable","props","ref","appearance","reserveSelectedTabSpace","disabled","onTabSelect","size","vertical","innerRef","React","useRef","focusAttributes","useArrowNavigationGroup","circular","axis","memorizeCurrent","selectedValue","setSelectedValue","useControllableState","state","defaultState","defaultSelectedValue","initialState","undefined","currentSelectedValue","previousSelectedValue","useEffect","current","onSelect","useEventCallback","event","data","value","registeredTabs","onRegister","JSON","stringify","onUnregister","getRegisteredTabs","useCallback","components","root","getNativeElementProps","useMergedRefs","role"],"mappings":";;;;+BAYaA;;aAAAA;;;6DAZU;8BACiB;gCACqD;AAUtF,MAAMA,sBAAsB,CAACC,OAAOC,MAAQ;IACjD,MAAM,EACJC,YAAa,cAAa,EAC1BC,yBAA0B,IAAI,CAAA,EAC9BC,UAAW,KAAK,CAAA,EAChBC,YAAW,EACXC,MAAO,SAAQ,EACfC,UAAW,KAAK,CAAA,EACjB,GAAGP;IACJ,MAAMQ,WAAWC,OAAMC,MAAM,CAAC,IAAI;IAClC,MAAMC,kBAAkBC,IAAAA,qCAAuB,EAAC;QAC9CC,UAAU,IAAI;QACdC,MAAMP,WAAW,aAAa,YAAY;QAC1CQ,iBAAiB,IAAI;IACvB;IACA,MAAM,CAACC,eAAeC,iBAAiB,GAAGC,IAAAA,oCAAoB,EAAC;QAC7DC,OAAOnB,MAAMgB,aAAa;QAC1BI,cAAcpB,MAAMqB,oBAAoB;QACxCC,cAAcC;IAChB;IACA,4DAA4D;IAC5D,8FAA8F;IAC9F,qFAAqF;IACrF,0CAA0C;IAC1C,MAAMC,uBAAuBf,OAAMC,MAAM,CAACa;IAC1C,MAAME,wBAAwBhB,OAAMC,MAAM,CAACa;IAC3Cd,OAAMiB,SAAS,CAAC,IAAM;QACpBD,sBAAsBE,OAAO,GAAGH,qBAAqBG,OAAO;QAC5DH,qBAAqBG,OAAO,GAAGX;IACjC,GAAG;QAACA;KAAc;IAClB,MAAMY,WAAWC,IAAAA,gCAAgB,EAAC,CAACC,OAAOC,OAAS;QACjDd,iBAAiBc,KAAKC,KAAK;QAC3B3B,gBAAgB,IAAI,IAAIA,gBAAgB,KAAK,IAAI,KAAK,IAAIA,YAAYyB,OAAOC,KAAK;IACpF;IACA,MAAME,iBAAiBxB,OAAMC,MAAM,CAAC,CAAC;IACrC,MAAMwB,aAAaL,IAAAA,gCAAgB,EAACE,CAAAA,OAAQ;QAC1CE,eAAeN,OAAO,CAACQ,KAAKC,SAAS,CAACL,KAAKC,KAAK,EAAE,GAAGD;IACvD;IACA,MAAMM,eAAeR,IAAAA,gCAAgB,EAACE,CAAAA,OAAQ;QAC5C,OAAOE,eAAeN,OAAO,CAACQ,KAAKC,SAAS,CAACL,KAAKC,KAAK,EAAE;IAC3D;IACA,MAAMM,oBAAoB7B,OAAM8B,WAAW,CAAC,IAAM;QAChD,OAAO;YACLvB,eAAeQ,qBAAqBG,OAAO;YAC3CF,uBAAuBA,sBAAsBE,OAAO;YACpDM,gBAAgBA,eAAeN,OAAO;QACxC;IACF,GAAG,EAAE;IACL,OAAO;QACLa,YAAY;YACVC,MAAM;QACR;QACAA,MAAMC,IAAAA,qCAAqB,EAAC,OAAO;YACjCzC,KAAK0C,IAAAA,6BAAa,EAAC1C,KAAKO;YACxBoC,MAAM;YACN,GAAGjC,eAAe;YAClB,GAAGX,KAAK;QACV;QACAE;QACAC;QACAC;QACAY;QACAV;QACAC;QACA2B;QACAG;QACAT;QACAU;IACF;AACF,GACA,sCAAsC"}
|
|
@@ -1,37 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useTabListContextValues_unstable", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>useTabListContextValues_unstable
|
|
5
8
|
});
|
|
6
|
-
exports.useTabListContextValues_unstable = void 0;
|
|
7
9
|
function useTabListContextValues_unstable(state) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
onRegister,
|
|
27
|
-
onUnregister,
|
|
28
|
-
getRegisteredTabs,
|
|
29
|
-
size,
|
|
30
|
-
vertical
|
|
31
|
-
};
|
|
32
|
-
return {
|
|
33
|
-
tabList
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
exports.useTabListContextValues_unstable = useTabListContextValues_unstable;
|
|
10
|
+
const { appearance , reserveSelectedTabSpace , disabled , selectedValue: selectedKey , onRegister , onUnregister , onSelect , getRegisteredTabs , size , vertical } = state;
|
|
11
|
+
const tabList = {
|
|
12
|
+
appearance,
|
|
13
|
+
reserveSelectedTabSpace,
|
|
14
|
+
disabled,
|
|
15
|
+
selectedValue: selectedKey,
|
|
16
|
+
onSelect,
|
|
17
|
+
onRegister,
|
|
18
|
+
onUnregister,
|
|
19
|
+
getRegisteredTabs,
|
|
20
|
+
size,
|
|
21
|
+
vertical
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
tabList
|
|
25
|
+
};
|
|
26
|
+
} //# sourceMappingURL=useTabListContextValues.js.map
|
|
27
|
+
|
|
37
28
|
//# sourceMappingURL=useTabListContextValues.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/TabList/useTabListContextValues.js"],"sourcesContent":["export function useTabListContextValues_unstable(state) {\n const {\n appearance,\n reserveSelectedTabSpace,\n disabled,\n selectedValue: selectedKey,\n onRegister,\n onUnregister,\n onSelect,\n getRegisteredTabs,\n size,\n vertical\n } = state;\n const tabList = {\n appearance,\n reserveSelectedTabSpace,\n disabled,\n selectedValue: selectedKey,\n onSelect,\n onRegister,\n onUnregister,\n getRegisteredTabs,\n size,\n vertical\n };\n return {\n tabList\n };\n}\n//# sourceMappingURL=useTabListContextValues.js.map"],"names":["useTabListContextValues_unstable","state","appearance","reserveSelectedTabSpace","disabled","selectedValue","selectedKey","onRegister","onUnregister","onSelect","getRegisteredTabs","size","vertical","tabList"],"mappings":";;;;+BAAgBA;;aAAAA;;AAAT,SAASA,iCAAiCC,KAAK,EAAE;IACtD,MAAM,EACJC,WAAU,EACVC,wBAAuB,EACvBC,SAAQ,EACRC,eAAeC,YAAW,EAC1BC,WAAU,EACVC,aAAY,EACZC,SAAQ,EACRC,kBAAiB,EACjBC,KAAI,EACJC,SAAQ,EACT,GAAGX;IACJ,MAAMY,UAAU;QACdX;QACAC;QACAC;QACAC,eAAeC;QACfG;QACAF;QACAC;QACAE;QACAC;QACAC;IACF;IACA,OAAO;QACLC;IACF;AACF,EACA,mDAAmD"}
|
|
@@ -1,45 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
tabListClassNames: ()=>tabListClassNames,
|
|
13
|
+
useTabListStyles_unstable: ()=>useTabListStyles_unstable
|
|
5
14
|
});
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
root: 'fui-TabList'
|
|
15
|
+
const _react = require("@griffel/react");
|
|
16
|
+
const tabListClassNames = {
|
|
17
|
+
root: 'fui-TabList'
|
|
10
18
|
};
|
|
11
19
|
/**
|
|
12
20
|
* Styles for the root slot
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
21
|
+
*/ const useStyles = /*#__PURE__*/ (0, _react["__styles"])({
|
|
22
|
+
root: {
|
|
23
|
+
mc9l5x: "f22iagw",
|
|
24
|
+
Beiy3e4: "f1063pyq",
|
|
25
|
+
Bnnss6s: "fi64zpg",
|
|
26
|
+
Eh141a: "flvyvdh",
|
|
27
|
+
qhf8xq: "f10pi13n"
|
|
28
|
+
},
|
|
29
|
+
horizontal: {
|
|
30
|
+
Bt984gj: "f1q9h2pe",
|
|
31
|
+
Beiy3e4: "f1063pyq"
|
|
32
|
+
},
|
|
33
|
+
vertical: {
|
|
34
|
+
Bt984gj: "f1q9h2pe",
|
|
35
|
+
Beiy3e4: "f1vx9l62"
|
|
36
|
+
}
|
|
30
37
|
}, {
|
|
31
|
-
|
|
38
|
+
d: [
|
|
39
|
+
".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}",
|
|
40
|
+
".f1063pyq{-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}",
|
|
41
|
+
".fi64zpg{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}",
|
|
42
|
+
".flvyvdh{-webkit-box-flex-wrap:nowrap;-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;}",
|
|
43
|
+
".f10pi13n{position:relative;}",
|
|
44
|
+
".f1q9h2pe{-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;}",
|
|
45
|
+
".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}"
|
|
46
|
+
]
|
|
32
47
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const styles = useStyles();
|
|
41
|
-
state.root.className = react_1.mergeClasses(exports.tabListClassNames.root, styles.root, vertical ? styles.vertical : styles.horizontal, state.root.className);
|
|
42
|
-
return state;
|
|
43
|
-
};
|
|
44
|
-
exports.useTabListStyles_unstable = useTabListStyles_unstable;
|
|
48
|
+
const useTabListStyles_unstable = (state)=>{
|
|
49
|
+
const { vertical } = state;
|
|
50
|
+
const styles = useStyles();
|
|
51
|
+
state.root.className = (0, _react.mergeClasses)(tabListClassNames.root, styles.root, vertical ? styles.vertical : styles.horizontal, state.root.className);
|
|
52
|
+
return state;
|
|
53
|
+
}; //# sourceMappingURL=useTabListStyles.js.map
|
|
54
|
+
|
|
45
55
|
//# sourceMappingURL=useTabListStyles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/TabList/useTabListStyles.js"],"sourcesContent":["import { __styles, mergeClasses } from '@griffel/react';\nexport const tabListClassNames = {\n root: 'fui-TabList'\n};\n/**\n * Styles for the root slot\n */\nconst useStyles = /*#__PURE__*/__styles({\n root: {\n mc9l5x: \"f22iagw\",\n Beiy3e4: \"f1063pyq\",\n Bnnss6s: \"fi64zpg\",\n Eh141a: \"flvyvdh\",\n qhf8xq: \"f10pi13n\"\n },\n horizontal: {\n Bt984gj: \"f1q9h2pe\",\n Beiy3e4: \"f1063pyq\"\n },\n vertical: {\n Bt984gj: \"f1q9h2pe\",\n Beiy3e4: \"f1vx9l62\"\n }\n}, {\n d: [\".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}\", \".f1063pyq{-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}\", \".fi64zpg{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}\", \".flvyvdh{-webkit-box-flex-wrap:nowrap;-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;}\", \".f10pi13n{position:relative;}\", \".f1q9h2pe{-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;}\", \".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}\"]\n});\n/**\n * Apply styling to the TabList slots based on the state\n */\nexport const useTabListStyles_unstable = state => {\n const {\n vertical\n } = state;\n const styles = useStyles();\n state.root.className = mergeClasses(tabListClassNames.root, styles.root, vertical ? styles.vertical : styles.horizontal, state.root.className);\n return state;\n};\n//# sourceMappingURL=useTabListStyles.js.map"],"names":["tabListClassNames","useTabListStyles_unstable","root","useStyles","__styles","mc9l5x","Beiy3e4","Bnnss6s","Eh141a","qhf8xq","horizontal","Bt984gj","vertical","d","state","styles","className","mergeClasses"],"mappings":";;;;;;;;;;;IACaA,iBAAiB,MAAjBA;IA4BAC,yBAAyB,MAAzBA;;uBA7B0B;AAChC,MAAMD,oBAAoB;IAC/BE,MAAM;AACR;AACA;;CAEC,GACD,MAAMC,YAAY,WAAW,GAAEC,IAAAA,kBAAQ,EAAC;IACtCF,MAAM;QACJG,QAAQ;QACRC,SAAS;QACTC,SAAS;QACTC,QAAQ;QACRC,QAAQ;IACV;IACAC,YAAY;QACVC,SAAS;QACTL,SAAS;IACX;IACAM,UAAU;QACRD,SAAS;QACTL,SAAS;IACX;AACF,GAAG;IACDO,GAAG;QAAC;QAAwF;QAAoF;QAAsE;QAA0G;QAAiC;QAAgH;KAA4F;AAC/kB;AAIO,MAAMZ,4BAA4Ba,CAAAA,QAAS;IAChD,MAAM,EACJF,SAAQ,EACT,GAAGE;IACJ,MAAMC,SAASZ;IACfW,MAAMZ,IAAI,CAACc,SAAS,GAAGC,IAAAA,mBAAY,EAACjB,kBAAkBE,IAAI,EAAEa,OAAOb,IAAI,EAAEU,WAAWG,OAAOH,QAAQ,GAAGG,OAAOL,UAAU,EAAEI,MAAMZ,IAAI,CAACc,SAAS;IAC7I,OAAOF;AACT,GACA,4CAA4C"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -1,87 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(exports, "useTab_unstable", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return Tab_1.useTab_unstable;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
var TabList_1 = /*#__PURE__*/require("./TabList");
|
|
39
|
-
Object.defineProperty(exports, "renderTabList_unstable", {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
get: function () {
|
|
42
|
-
return TabList_1.renderTabList_unstable;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
Object.defineProperty(exports, "TabList", {
|
|
46
|
-
enumerable: true,
|
|
47
|
-
get: function () {
|
|
48
|
-
return TabList_1.TabList;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
Object.defineProperty(exports, "TabListProvider", {
|
|
52
|
-
enumerable: true,
|
|
53
|
-
get: function () {
|
|
54
|
-
return TabList_1.TabListProvider;
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
Object.defineProperty(exports, "tabListClassNames", {
|
|
58
|
-
enumerable: true,
|
|
59
|
-
get: function () {
|
|
60
|
-
return TabList_1.tabListClassNames;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
Object.defineProperty(exports, "useTabListContext_unstable", {
|
|
64
|
-
enumerable: true,
|
|
65
|
-
get: function () {
|
|
66
|
-
return TabList_1.useTabListContext_unstable;
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
Object.defineProperty(exports, "useTabListContextValues_unstable", {
|
|
70
|
-
enumerable: true,
|
|
71
|
-
get: function () {
|
|
72
|
-
return TabList_1.useTabListContextValues_unstable;
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
Object.defineProperty(exports, "useTabListStyles_unstable", {
|
|
76
|
-
enumerable: true,
|
|
77
|
-
get: function () {
|
|
78
|
-
return TabList_1.useTabListStyles_unstable;
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
Object.defineProperty(exports, "useTabList_unstable", {
|
|
82
|
-
enumerable: true,
|
|
83
|
-
get: function () {
|
|
84
|
-
return TabList_1.useTabList_unstable;
|
|
85
|
-
}
|
|
86
|
-
});
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
renderTab_unstable: ()=>_tab.renderTab_unstable,
|
|
13
|
+
Tab: ()=>_tab.Tab,
|
|
14
|
+
tabClassNames: ()=>_tab.tabClassNames,
|
|
15
|
+
useTabStyles_unstable: ()=>_tab.useTabStyles_unstable,
|
|
16
|
+
useTab_unstable: ()=>_tab.useTab_unstable,
|
|
17
|
+
renderTabList_unstable: ()=>_tabList.renderTabList_unstable,
|
|
18
|
+
TabList: ()=>_tabList.TabList,
|
|
19
|
+
TabListProvider: ()=>_tabList.TabListProvider,
|
|
20
|
+
tabListClassNames: ()=>_tabList.tabListClassNames,
|
|
21
|
+
useTabListContext_unstable: ()=>_tabList.useTabListContext_unstable,
|
|
22
|
+
useTabListContextValues_unstable: ()=>_tabList.useTabListContextValues_unstable,
|
|
23
|
+
useTabListStyles_unstable: ()=>_tabList.useTabListStyles_unstable,
|
|
24
|
+
useTabList_unstable: ()=>_tabList.useTabList_unstable
|
|
25
|
+
});
|
|
26
|
+
const _tab = require("./Tab");
|
|
27
|
+
const _tabList = require("./TabList");
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
29
|
+
|
|
87
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { renderTab_unstable, Tab, tabClassNames, useTabStyles_unstable, useTab_unstable } from './Tab';\nexport { renderTabList_unstable, TabList, TabListProvider, tabListClassNames, useTabListContext_unstable, useTabListContextValues_unstable, useTabListStyles_unstable, useTabList_unstable } from './TabList';\n//# sourceMappingURL=index.js.map"],"names":["renderTab_unstable","Tab","tabClassNames","useTabStyles_unstable","useTab_unstable","renderTabList_unstable","TabList","TabListProvider","tabListClassNames","useTabListContext_unstable","useTabListContextValues_unstable","useTabListStyles_unstable","useTabList_unstable"],"mappings":";;;;;;;;;;;IAASA,kBAAkB,MAAlBA,uBAAkB;IAAEC,GAAG,MAAHA,QAAG;IAAEC,aAAa,MAAbA,kBAAa;IAAEC,qBAAqB,MAArBA,0BAAqB;IAAEC,eAAe,MAAfA,oBAAe;IAC9EC,sBAAsB,MAAtBA,+BAAsB;IAAEC,OAAO,MAAPA,gBAAO;IAAEC,eAAe,MAAfA,wBAAe;IAAEC,iBAAiB,MAAjBA,0BAAiB;IAAEC,0BAA0B,MAA1BA,mCAA0B;IAAEC,gCAAgC,MAAhCA,yCAAgC;IAAEC,yBAAyB,MAAzBA,kCAAyB;IAAEC,mBAAmB,MAAnBA,4BAAmB;;qBAD3F;yBACmG;CAClM,iCAAiC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-tabs",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.5",
|
|
4
4
|
"description": "Fluent UI React tabs components",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -21,23 +21,23 @@
|
|
|
21
21
|
"test": "jest --passWithNoTests",
|
|
22
22
|
"storybook": "start-storybook",
|
|
23
23
|
"type-check": "tsc -b tsconfig.json",
|
|
24
|
-
"generate-api": "
|
|
24
|
+
"generate-api": "just-scripts generate-api"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@fluentui/eslint-plugin": "*",
|
|
28
28
|
"@fluentui/react-conformance": "*",
|
|
29
|
-
"@fluentui/react-conformance-griffel": "9.0.0-beta.
|
|
29
|
+
"@fluentui/react-conformance-griffel": "9.0.0-beta.20",
|
|
30
30
|
"@fluentui/scripts-api-extractor": "*",
|
|
31
31
|
"@fluentui/scripts-tasks": "*"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@fluentui/react-context-selector": "^9.1.
|
|
35
|
-
"@fluentui/react-shared-contexts": "^9.3.
|
|
36
|
-
"@fluentui/react-tabster": "^9.
|
|
37
|
-
"@fluentui/react-theme": "^9.1.
|
|
38
|
-
"@fluentui/react-utilities": "^9.7.
|
|
34
|
+
"@fluentui/react-context-selector": "^9.1.15",
|
|
35
|
+
"@fluentui/react-shared-contexts": "^9.3.2",
|
|
36
|
+
"@fluentui/react-tabster": "^9.6.1",
|
|
37
|
+
"@fluentui/react-theme": "^9.1.7",
|
|
38
|
+
"@fluentui/react-utilities": "^9.7.2",
|
|
39
39
|
"@griffel/react": "^1.5.2",
|
|
40
|
-
"
|
|
40
|
+
"@swc/helpers": "^0.4.14"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@types/react": ">=16.8.0 <19.0.0",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"exports": {
|
|
56
56
|
".": {
|
|
57
57
|
"types": "./dist/index.d.ts",
|
|
58
|
+
"node": "./lib-commonjs/index.js",
|
|
58
59
|
"import": "./lib/index.js",
|
|
59
60
|
"require": "./lib-commonjs/index.js"
|
|
60
61
|
},
|
package/lib-amd/Tab.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "./components/Tab/index"], function (require, exports, tslib_1, index_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
tslib_1.__exportStar(index_1, exports);
|
|
5
|
-
});
|
|
6
|
-
//# sourceMappingURL=Tab.js.map
|
package/lib-amd/Tab.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-tabs/src/Tab.ts"],"names":[],"mappings":";;;IAAA,uCAAuC","sourcesContent":["export * from './components/Tab/index';\n"]}
|
package/lib-amd/TabList.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "./components/TabList/index"], function (require, exports, tslib_1, index_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
tslib_1.__exportStar(index_1, exports);
|
|
5
|
-
});
|
|
6
|
-
//# sourceMappingURL=TabList.js.map
|
package/lib-amd/TabList.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TabList.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-tabs/src/TabList.ts"],"names":[],"mappings":";;;IAAA,uCAA2C","sourcesContent":["export * from './components/TabList/index';\n"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "react", "./useTab", "./renderTab", "./useTabStyles", "@fluentui/react-shared-contexts"], function (require, exports, React, useTab_1, renderTab_1, useTabStyles_1, react_shared_contexts_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Tab = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* A tab provides a selectable item in a tab list.
|
|
7
|
-
*/
|
|
8
|
-
exports.Tab = React.forwardRef(function (props, ref) {
|
|
9
|
-
var state = useTab_1.useTab_unstable(props, ref);
|
|
10
|
-
useTabStyles_1.useTabStyles_unstable(state);
|
|
11
|
-
var useCustomStyles = react_shared_contexts_1.useCustomStyleHooks_unstable().useTabStyles_unstable;
|
|
12
|
-
useCustomStyles(state);
|
|
13
|
-
return renderTab_1.renderTab_unstable(state);
|
|
14
|
-
});
|
|
15
|
-
exports.Tab.displayName = 'Tab';
|
|
16
|
-
});
|
|
17
|
-
//# sourceMappingURL=Tab.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-tabs/src/components/Tab/Tab.tsx"],"names":[],"mappings":";;;;IAQA;;OAEG;IACU,QAAA,GAAG,GAAkC,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QAC5E,IAAM,KAAK,GAAG,wBAAe,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAE1C,oCAAqB,CAAC,KAAK,CAAC,CAAC;QAErB,IAAuB,eAAe,GAAK,oDAA4B,EAAE,sBAAnC,CAAoC;QAClF,eAAe,CAAC,KAAK,CAAC,CAAC;QAEvB,OAAO,8BAAkB,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,WAAG,CAAC,WAAW,GAAG,KAAK,CAAC","sourcesContent":["import * as React from 'react';\nimport { useTab_unstable } from './useTab';\nimport { renderTab_unstable } from './renderTab';\nimport { useTabStyles_unstable } from './useTabStyles';\nimport type { TabProps } from './Tab.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * A tab provides a selectable item in a tab list.\n */\nexport const Tab: ForwardRefComponent<TabProps> = React.forwardRef((props, ref) => {\n const state = useTab_unstable(props, ref);\n\n useTabStyles_unstable(state);\n\n const { useTabStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n\n return renderTab_unstable(state);\n});\n\nTab.displayName = 'Tab';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-tabs/src/components/Tab/Tab.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\n/**\n * Any value that identifies a specific tab.\n */\nexport type TabValue = unknown;\n\nexport type TabSlots = {\n /**\n * Root of the component.\n */\n root: Slot<'button'>;\n\n /**\n * Icon that renders before the content.\n */\n icon?: Slot<'span'>;\n\n /**\n * Component children are placed in this slot\n * Avoid using the `children` property in this slot in favour of Component children whenever possible.\n */\n content: NonNullable<Slot<'span'>>;\n};\n\n/**\n * Tab Props\n */\nexport type TabProps = ComponentProps<Partial<TabSlots>> & {\n /**\n * A tab can be set to disable interaction.\n * @default false\n */\n disabled?: boolean;\n /**\n * The value that identifies this tab when selected.\n */\n value: TabValue;\n};\n\n/**\n * State used in rendering Tab\n */\nexport type TabState = ComponentState<TabSlots> &\n Pick<TabProps, 'value'> &\n Required<Pick<TabProps, 'disabled'>> & {\n /**\n * A tab supports 'transparent' and 'subtle' appearance.\n */\n appearance?: 'transparent' | 'subtle';\n /**\n * A tab can have only an icon slot filled and no content.\n */\n iconOnly: boolean;\n /**\n * If this tab is selected\n */\n selected: boolean;\n /**\n * When defined, tab content with selected style is rendered hidden to reserve space.\n * This keeps consistent content size between unselected and selected states.\n */\n contentReservedSpaceClassName?: string;\n /**\n * A tab can be either 'small', 'medium', or 'large' size.\n */\n size: 'small' | 'medium' | 'large';\n /**\n * A tab can arrange its content based on if the tabs in the list are arranged vertically.\n */\n vertical: boolean;\n };\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "./Tab", "./Tab.types", "./renderTab", "./useTab", "./useTabStyles", "./useTabAnimatedIndicator"], function (require, exports, tslib_1, Tab_1, Tab_types_1, renderTab_1, useTab_1, useTabStyles_1, useTabAnimatedIndicator_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
tslib_1.__exportStar(Tab_1, exports);
|
|
5
|
-
tslib_1.__exportStar(Tab_types_1, exports);
|
|
6
|
-
tslib_1.__exportStar(renderTab_1, exports);
|
|
7
|
-
tslib_1.__exportStar(useTab_1, exports);
|
|
8
|
-
tslib_1.__exportStar(useTabStyles_1, exports);
|
|
9
|
-
tslib_1.__exportStar(useTabAnimatedIndicator_1, exports);
|
|
10
|
-
});
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-tabs/src/components/Tab/index.ts"],"names":[],"mappings":";;;IAAA,qCAAsB;IACtB,2CAA4B;IAC5B,2CAA4B;IAC5B,wCAAyB;IACzB,8CAA+B;IAC/B,yDAA0C","sourcesContent":["export * from './Tab';\nexport * from './Tab.types';\nexport * from './renderTab';\nexport * from './useTab';\nexport * from './useTabStyles';\nexport * from './useTabAnimatedIndicator';\n"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "react", "@fluentui/react-utilities"], function (require, exports, tslib_1, React, react_utilities_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.renderTab_unstable = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* Render the final JSX of Tab
|
|
7
|
-
*/
|
|
8
|
-
var renderTab_unstable = function (state) {
|
|
9
|
-
var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
|
|
10
|
-
return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
|
|
11
|
-
slots.icon && React.createElement(slots.icon, tslib_1.__assign({}, slotProps.icon)),
|
|
12
|
-
!state.iconOnly && React.createElement(slots.content, tslib_1.__assign({}, slotProps.content)),
|
|
13
|
-
!state.selected && !state.iconOnly && state.contentReservedSpaceClassName !== undefined && (React.createElement(slots.content, tslib_1.__assign({}, slotProps.content, { className: state.contentReservedSpaceClassName })))));
|
|
14
|
-
};
|
|
15
|
-
exports.renderTab_unstable = renderTab_unstable;
|
|
16
|
-
});
|
|
17
|
-
//# sourceMappingURL=renderTab.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renderTab.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-tabs/src/components/Tab/renderTab.tsx"],"names":[],"mappings":";;;;IAIA;;OAEG;IACI,IAAM,kBAAkB,GAAG,UAAC,KAAe;QAC1C,IAAA,KAAuB,0BAAQ,CAAW,KAAK,CAAC,EAA9C,KAAK,WAAA,EAAE,SAAS,eAA8B,CAAC;QAEvD,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC3B,KAAK,CAAC,IAAI,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI;YAChD,CAAC,KAAK,CAAC,QAAQ,IAAI,oBAAC,KAAK,CAAC,OAAO,uBAAK,SAAS,CAAC,OAAO,EAAI;YAC3D,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,6BAA6B,KAAK,SAAS,IAAI,CAC1F,oBAAC,KAAK,CAAC,OAAO,uBAAK,SAAS,CAAC,OAAO,IAAE,SAAS,EAAE,KAAK,CAAC,6BAA6B,IAAI,CACzF,CACU,CACd,CAAC;IACJ,CAAC,CAAC;IAZW,QAAA,kBAAkB,sBAY7B","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { TabState, TabSlots } from './Tab.types';\n\n/**\n * Render the final JSX of Tab\n */\nexport const renderTab_unstable = (state: TabState) => {\n const { slots, slotProps } = getSlots<TabSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.icon && <slots.icon {...slotProps.icon} />}\n {!state.iconOnly && <slots.content {...slotProps.content} />}\n {!state.selected && !state.iconOnly && state.contentReservedSpaceClassName !== undefined && (\n <slots.content {...slotProps.content} className={state.contentReservedSpaceClassName} />\n )}\n </slots.root>\n );\n};\n"]}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "../TabList/TabListContext"], function (require, exports, tslib_1, React, react_utilities_1, TabListContext_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.useTab_unstable = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* Create the state required to render Tab.
|
|
7
|
-
*
|
|
8
|
-
* The returned state can be modified with hooks such as useTabStyles_unstable,
|
|
9
|
-
* before being passed to renderTab_unstable.
|
|
10
|
-
*
|
|
11
|
-
* @param props - props from this instance of Tab
|
|
12
|
-
* @param ref - reference to root HTMLElement of Tab
|
|
13
|
-
*/
|
|
14
|
-
var useTab_unstable = function (props, ref) {
|
|
15
|
-
var content = props.content, _a = props.disabled, tabDisabled = _a === void 0 ? false : _a, icon = props.icon, value = props.value;
|
|
16
|
-
var appearance = TabListContext_1.useTabListContext_unstable(function (ctx) { return ctx.appearance; });
|
|
17
|
-
var reserveSelectedTabSpace = TabListContext_1.useTabListContext_unstable(function (ctx) { return ctx.reserveSelectedTabSpace; });
|
|
18
|
-
var listDisabled = TabListContext_1.useTabListContext_unstable(function (ctx) { return ctx.disabled; });
|
|
19
|
-
var selected = TabListContext_1.useTabListContext_unstable(function (ctx) { return ctx.selectedValue === value; });
|
|
20
|
-
var onRegister = TabListContext_1.useTabListContext_unstable(function (ctx) { return ctx.onRegister; });
|
|
21
|
-
var onUnregister = TabListContext_1.useTabListContext_unstable(function (ctx) { return ctx.onUnregister; });
|
|
22
|
-
var onSelect = TabListContext_1.useTabListContext_unstable(function (ctx) { return ctx.onSelect; });
|
|
23
|
-
var size = TabListContext_1.useTabListContext_unstable(function (ctx) { return ctx.size; });
|
|
24
|
-
var vertical = TabListContext_1.useTabListContext_unstable(function (ctx) { return !!ctx.vertical; });
|
|
25
|
-
var disabled = listDisabled || tabDisabled;
|
|
26
|
-
var innerRef = React.useRef(null);
|
|
27
|
-
var onClick = react_utilities_1.useEventCallback(function (event) { return onSelect(event, { value: value }); });
|
|
28
|
-
React.useEffect(function () {
|
|
29
|
-
onRegister({
|
|
30
|
-
value: value,
|
|
31
|
-
ref: innerRef,
|
|
32
|
-
});
|
|
33
|
-
return function () {
|
|
34
|
-
onUnregister({ value: value, ref: innerRef });
|
|
35
|
-
};
|
|
36
|
-
}, [onRegister, onUnregister, innerRef, value]);
|
|
37
|
-
var iconShorthand = react_utilities_1.resolveShorthand(icon);
|
|
38
|
-
var contentShorthand = react_utilities_1.resolveShorthand(content, { required: true, defaultProps: { children: props.children } });
|
|
39
|
-
return {
|
|
40
|
-
components: {
|
|
41
|
-
root: 'button',
|
|
42
|
-
icon: 'span',
|
|
43
|
-
content: 'span',
|
|
44
|
-
},
|
|
45
|
-
root: react_utilities_1.getNativeElementProps('button', tslib_1.__assign(tslib_1.__assign({ ref: react_utilities_1.useMergedRefs(ref, innerRef), role: 'tab', type: 'button',
|
|
46
|
-
// aria-selected undefined indicates it is not selectable
|
|
47
|
-
// according to https://www.w3.org/TR/wai-aria-1.1/#aria-selected
|
|
48
|
-
'aria-selected': disabled ? undefined : "" + selected }, props), { disabled: disabled, onClick: onClick })),
|
|
49
|
-
icon: iconShorthand,
|
|
50
|
-
iconOnly: Boolean((iconShorthand === null || iconShorthand === void 0 ? void 0 : iconShorthand.children) && !contentShorthand.children),
|
|
51
|
-
content: contentShorthand,
|
|
52
|
-
appearance: appearance,
|
|
53
|
-
contentReservedSpaceClassName: reserveSelectedTabSpace ? '' : undefined,
|
|
54
|
-
disabled: disabled,
|
|
55
|
-
selected: selected,
|
|
56
|
-
size: size,
|
|
57
|
-
value: value,
|
|
58
|
-
vertical: vertical,
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
exports.useTab_unstable = useTab_unstable;
|
|
62
|
-
});
|
|
63
|
-
//# sourceMappingURL=useTab.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTab.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-tabs/src/components/Tab/useTab.ts"],"names":[],"mappings":"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","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport type { TabProps, TabState } from './Tab.types';\nimport { useTabListContext_unstable } from '../TabList/TabListContext';\nimport { SelectTabEvent } from '../TabList/TabList.types';\n\n/**\n * Create the state required to render Tab.\n *\n * The returned state can be modified with hooks such as useTabStyles_unstable,\n * before being passed to renderTab_unstable.\n *\n * @param props - props from this instance of Tab\n * @param ref - reference to root HTMLElement of Tab\n */\nexport const useTab_unstable = (props: TabProps, ref: React.Ref<HTMLElement>): TabState => {\n const { content, disabled: tabDisabled = false, icon, value } = props;\n\n const appearance = useTabListContext_unstable(ctx => ctx.appearance);\n const reserveSelectedTabSpace = useTabListContext_unstable(ctx => ctx.reserveSelectedTabSpace);\n const listDisabled = useTabListContext_unstable(ctx => ctx.disabled);\n const selected = useTabListContext_unstable(ctx => ctx.selectedValue === value);\n const onRegister = useTabListContext_unstable(ctx => ctx.onRegister);\n const onUnregister = useTabListContext_unstable(ctx => ctx.onUnregister);\n const onSelect = useTabListContext_unstable(ctx => ctx.onSelect);\n const size = useTabListContext_unstable(ctx => ctx.size);\n const vertical = useTabListContext_unstable(ctx => !!ctx.vertical);\n const disabled = listDisabled || tabDisabled;\n\n const innerRef = React.useRef<HTMLElement>(null);\n const onClick = useEventCallback((event: SelectTabEvent) => onSelect(event, { value }));\n\n React.useEffect(() => {\n onRegister({\n value,\n ref: innerRef,\n });\n\n return () => {\n onUnregister({ value, ref: innerRef });\n };\n }, [onRegister, onUnregister, innerRef, value]);\n\n const iconShorthand = resolveShorthand(icon);\n const contentShorthand = resolveShorthand(content, { required: true, defaultProps: { children: props.children } });\n return {\n components: {\n root: 'button',\n icon: 'span',\n content: 'span',\n },\n root: getNativeElementProps('button', {\n ref: useMergedRefs(ref, innerRef),\n role: 'tab',\n type: 'button',\n // aria-selected undefined indicates it is not selectable\n // according to https://www.w3.org/TR/wai-aria-1.1/#aria-selected\n 'aria-selected': disabled ? undefined : `${selected}`,\n ...props,\n disabled,\n onClick,\n }),\n icon: iconShorthand,\n iconOnly: Boolean(iconShorthand?.children && !contentShorthand.children),\n content: contentShorthand,\n appearance,\n contentReservedSpaceClassName: reserveSelectedTabSpace ? '' : undefined,\n disabled,\n selected,\n size,\n value,\n vertical,\n };\n};\n"]}
|