@fluentui/react-tabs 9.0.0-beta.6 → 9.0.0-beta.9
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/CHANGELOG.json +180 -1
- package/CHANGELOG.md +49 -2
- package/dist/react-tabs.d.ts +48 -36
- package/lib/components/Tab/Tab.types.d.ts +14 -5
- package/lib/components/Tab/Tab.types.js.map +1 -1
- package/lib/components/Tab/index.d.ts +1 -0
- package/lib/components/Tab/index.js +1 -0
- package/lib/components/Tab/index.js.map +1 -1
- package/lib/components/Tab/renderTab.js +1 -2
- package/lib/components/Tab/renderTab.js.map +1 -1
- package/lib/components/Tab/useTab.js +25 -29
- package/lib/components/Tab/useTab.js.map +1 -1
- package/lib/components/Tab/useTabAnimatedIndicator.d.ts +5 -0
- package/lib/components/Tab/useTabAnimatedIndicator.js +134 -0
- package/lib/components/Tab/useTabAnimatedIndicator.js.map +1 -0
- package/lib/components/Tab/useTabStyles.d.ts +4 -2
- package/lib/components/Tab/useTabStyles.js +280 -84
- package/lib/components/Tab/useTabStyles.js.map +1 -1
- package/lib/components/TabList/TabList.types.d.ts +21 -16
- package/lib/components/TabList/TabList.types.js.map +1 -1
- package/lib/components/TabList/TabListContext.js +6 -0
- package/lib/components/TabList/TabListContext.js.map +1 -1
- package/lib/components/TabList/renderTabList.js +0 -1
- package/lib/components/TabList/renderTabList.js.map +1 -1
- package/lib/components/TabList/useTabList.js +26 -51
- package/lib/components/TabList/useTabList.js.map +1 -1
- package/lib/components/TabList/useTabListContextValues.js +4 -0
- package/lib/components/TabList/useTabListContextValues.js.map +1 -1
- package/lib/components/TabList/useTabListStyles.d.ts +4 -5
- package/lib/components/TabList/useTabListStyles.js +8 -90
- package/lib/components/TabList/useTabListStyles.js.map +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/tab.constants.d.ts +59 -12
- package/lib/tab.constants.js +64 -13
- package/lib/tab.constants.js.map +1 -1
- package/lib-commonjs/components/Tab/Tab.types.d.ts +14 -5
- package/lib-commonjs/components/Tab/index.d.ts +1 -0
- package/lib-commonjs/components/Tab/index.js +2 -0
- package/lib-commonjs/components/Tab/index.js.map +1 -1
- package/lib-commonjs/components/Tab/renderTab.js +1 -2
- package/lib-commonjs/components/Tab/renderTab.js.map +1 -1
- package/lib-commonjs/components/Tab/useTab.js +25 -29
- package/lib-commonjs/components/Tab/useTab.js.map +1 -1
- package/lib-commonjs/components/Tab/useTabAnimatedIndicator.d.ts +5 -0
- package/lib-commonjs/components/Tab/useTabAnimatedIndicator.js +148 -0
- package/lib-commonjs/components/Tab/useTabAnimatedIndicator.js.map +1 -0
- package/lib-commonjs/components/Tab/useTabStyles.d.ts +4 -2
- package/lib-commonjs/components/Tab/useTabStyles.js +281 -84
- package/lib-commonjs/components/Tab/useTabStyles.js.map +1 -1
- package/lib-commonjs/components/TabList/TabList.types.d.ts +21 -16
- package/lib-commonjs/components/TabList/TabListContext.js +6 -0
- package/lib-commonjs/components/TabList/TabListContext.js.map +1 -1
- package/lib-commonjs/components/TabList/renderTabList.js +0 -1
- package/lib-commonjs/components/TabList/renderTabList.js.map +1 -1
- package/lib-commonjs/components/TabList/useTabList.js +25 -50
- package/lib-commonjs/components/TabList/useTabList.js.map +1 -1
- package/lib-commonjs/components/TabList/useTabListContextValues.js +4 -0
- package/lib-commonjs/components/TabList/useTabListContextValues.js.map +1 -1
- package/lib-commonjs/components/TabList/useTabListStyles.d.ts +4 -5
- package/lib-commonjs/components/TabList/useTabListStyles.js +7 -92
- package/lib-commonjs/components/TabList/useTabListStyles.js.map +1 -1
- package/lib-commonjs/index.d.ts +4 -2
- package/lib-commonjs/index.js +76 -3
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/tab.constants.d.ts +59 -12
- package/lib-commonjs/tab.constants.js +66 -14
- package/lib-commonjs/tab.constants.js.map +1 -1
- package/package.json +16 -17
|
@@ -1 +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
|
|
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 TabRegisterData = {\n /**\n * The value of the tab.\n */\n value: TabValue;\n\n /**\n * The reference to the tab HTML element.\n */\n ref: React.RefObject<HTMLElement>;\n};\n\nexport type RegisterTabEventHandler = (data: TabRegisterData) => 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 * A tab list can be set to disable interaction.\n * @default false\n */\n disabled?: boolean;\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' | 'disabled' | '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 * Gets the registered tab data along with current and previous selected values.\n */\n getRegisteredTabs: () => {\n selectedValue?: TabValue;\n previousSelectedValue?: TabValue;\n registeredTabs: Record<string, TabRegisterData>;\n };\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 * State used in rendering TabList.\n */\nexport type TabListState = ComponentState<Required<TabListSlots>> & TabListContextValue;\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createContext } from '@fluentui/react-context-selector';
|
|
2
2
|
export const TabListContext = /*#__PURE__*/createContext({
|
|
3
3
|
appearance: 'transparent',
|
|
4
|
+
disabled: false,
|
|
4
5
|
selectedValue: undefined,
|
|
5
6
|
onRegister: () => {
|
|
6
7
|
/* noop */
|
|
@@ -11,6 +12,11 @@ export const TabListContext = /*#__PURE__*/createContext({
|
|
|
11
12
|
onSelect: () => {
|
|
12
13
|
/* noop */
|
|
13
14
|
},
|
|
15
|
+
getRegisteredTabs: () => {
|
|
16
|
+
return {
|
|
17
|
+
registeredTabs: {}
|
|
18
|
+
};
|
|
19
|
+
},
|
|
14
20
|
size: 'medium',
|
|
15
21
|
vertical: false
|
|
16
22
|
});
|
|
@@ -1 +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,
|
|
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,QAAQ,EAAE,KAFmF;AAG7F,EAAA,aAAa,EAAE,SAH8E;AAI7F,EAAA,UAAU,EAAE,MAAK;AACf;AACD,GAN4F;AAO7F,EAAA,YAAY,EAAE,MAAK;AACjB;AACD,GAT4F;AAU7F,EAAA,QAAQ,EAAE,MAAK;AACb;AACD,GAZ4F;AAa7F,EAAA,iBAAiB,EAAE,MAAK;AACtB,WAAO;AACL,MAAA,cAAc,EAAE;AADX,KAAP;AAGD,GAjB4F;AAkB7F,EAAA,IAAI,EAAE,QAlBuF;AAmB7F,EAAA,QAAQ,EAAE;AAnBmF,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 disabled: false,\n selectedValue: undefined,\n onRegister: () => {\n /* noop */\n },\n onUnregister: () => {\n /* noop */\n },\n onSelect: () => {\n /* noop */\n },\n getRegisteredTabs: () => {\n return {\n registeredTabs: {},\n };\n },\n size: 'medium',\n vertical: false,\n});\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +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
|
|
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,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 */\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/"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
3
|
-
import { getNativeElementProps,
|
|
3
|
+
import { getNativeElementProps, useControllableState, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';
|
|
4
4
|
/**
|
|
5
5
|
* Create the state required to render TabList.
|
|
6
6
|
*
|
|
@@ -10,11 +10,11 @@ import { getNativeElementProps, useConst, useControllableState, useEventCallback
|
|
|
10
10
|
* @param props - props from this instance of TabList
|
|
11
11
|
* @param ref - reference to root HTMLElement of TabList
|
|
12
12
|
*/
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
14
13
|
|
|
15
14
|
export const useTabList_unstable = (props, ref) => {
|
|
16
15
|
const {
|
|
17
16
|
appearance = 'transparent',
|
|
17
|
+
disabled = false,
|
|
18
18
|
onTabSelect,
|
|
19
19
|
size = 'medium',
|
|
20
20
|
vertical = false
|
|
@@ -28,61 +28,35 @@ export const useTabList_unstable = (props, ref) => {
|
|
|
28
28
|
state: props.selectedValue,
|
|
29
29
|
defaultState: props.defaultSelectedValue,
|
|
30
30
|
initialState: undefined
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
|
31
|
+
}); // considered usePrevious, but it is sensitive to re-renders
|
|
32
|
+
// this could cause the previous to move to current in the case where the tab list re-renders.
|
|
33
|
+
// these refs avoid getRegisteredTabs changing when selectedValue changes and causing
|
|
34
|
+
// renders for tabs that have not changed.
|
|
43
35
|
|
|
36
|
+
const currentSelectedValue = React.useRef(undefined);
|
|
37
|
+
const previousSelectedValue = React.useRef(undefined);
|
|
44
38
|
React.useEffect(() => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
39
|
+
previousSelectedValue.current = currentSelectedValue.current;
|
|
40
|
+
currentSelectedValue.current = selectedValue;
|
|
41
|
+
}, [selectedValue]);
|
|
42
|
+
const onSelect = useEventCallback((event, data) => {
|
|
43
|
+
setSelectedValue(data.value);
|
|
44
|
+
onTabSelect === null || onTabSelect === void 0 ? void 0 : onTabSelect(event, data);
|
|
45
|
+
});
|
|
52
46
|
const registeredTabs = React.useRef({});
|
|
53
47
|
const onRegister = useEventCallback(data => {
|
|
54
|
-
var _a;
|
|
55
|
-
|
|
56
48
|
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
49
|
});
|
|
60
50
|
const onUnregister = useEventCallback(data => {
|
|
61
|
-
var _a;
|
|
62
|
-
|
|
63
51
|
delete registeredTabs.current[JSON.stringify(data.value)];
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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]);
|
|
52
|
+
});
|
|
53
|
+
const getRegisteredTabs = React.useCallback(() => {
|
|
54
|
+
return {
|
|
55
|
+
selectedValue: currentSelectedValue.current,
|
|
56
|
+
previousSelectedValue: previousSelectedValue.current,
|
|
57
|
+
registeredTabs: registeredTabs.current
|
|
58
|
+
};
|
|
59
|
+
}, []);
|
|
86
60
|
return {
|
|
87
61
|
components: {
|
|
88
62
|
root: 'div'
|
|
@@ -94,13 +68,14 @@ export const useTabList_unstable = (props, ref) => {
|
|
|
94
68
|
...props
|
|
95
69
|
}),
|
|
96
70
|
appearance,
|
|
97
|
-
|
|
71
|
+
disabled,
|
|
98
72
|
selectedValue,
|
|
99
73
|
size,
|
|
100
74
|
vertical,
|
|
101
75
|
onRegister,
|
|
102
76
|
onUnregister,
|
|
103
|
-
onSelect
|
|
77
|
+
onSelect,
|
|
78
|
+
getRegisteredTabs
|
|
104
79
|
};
|
|
105
80
|
};
|
|
106
81
|
//# sourceMappingURL=useTabList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/TabList/useTabList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,uBAAT,QAAwC,yBAAxC;AACA,SACE,qBADF,EAEE,
|
|
1
|
+
{"version":3,"sources":["components/TabList/useTabList.ts"],"names":[],"mappings":"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","sourcesContent":["import * as React from 'react';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport {\n getNativeElementProps,\n useControllableState,\n useEventCallback,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport type { TabRegisterData, SelectTabData, SelectTabEvent, TabListProps, TabListState } from './TabList.types';\nimport { TabValue } from '../Tab/Tab.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 */\nexport const useTabList_unstable = (props: TabListProps, ref: React.Ref<HTMLElement>): TabListState => {\n const { appearance = 'transparent', disabled = false, 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 // 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<TabValue | undefined>(undefined);\n const previousSelectedValue = React.useRef<TabValue | undefined>(undefined);\n\n React.useEffect(() => {\n previousSelectedValue.current = currentSelectedValue.current;\n currentSelectedValue.current = selectedValue;\n }, [selectedValue]);\n\n const onSelect = useEventCallback((event: SelectTabEvent, data: SelectTabData) => {\n setSelectedValue(data.value);\n onTabSelect?.(event, data);\n });\n\n const registeredTabs = React.useRef<Record<string, TabRegisterData>>({});\n\n const onRegister = useEventCallback((data: TabRegisterData) => {\n registeredTabs.current[JSON.stringify(data.value)] = data;\n });\n\n const onUnregister = useEventCallback((data: TabRegisterData) => {\n delete registeredTabs.current[JSON.stringify(data.value)];\n });\n\n const getRegisteredTabs = React.useCallback(() => {\n return {\n selectedValue: currentSelectedValue.current,\n previousSelectedValue: previousSelectedValue.current,\n registeredTabs: registeredTabs.current,\n };\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 disabled,\n selectedValue,\n size,\n vertical,\n onRegister,\n onUnregister,\n onSelect,\n getRegisteredTabs,\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
export function useTabListContextValues(state) {
|
|
2
2
|
const {
|
|
3
3
|
appearance,
|
|
4
|
+
disabled,
|
|
4
5
|
selectedValue: selectedKey,
|
|
5
6
|
onRegister,
|
|
6
7
|
onUnregister,
|
|
7
8
|
onSelect,
|
|
9
|
+
getRegisteredTabs,
|
|
8
10
|
size,
|
|
9
11
|
vertical
|
|
10
12
|
} = state;
|
|
11
13
|
const tabList = {
|
|
12
14
|
appearance,
|
|
15
|
+
disabled,
|
|
13
16
|
selectedValue: selectedKey,
|
|
14
17
|
onSelect,
|
|
15
18
|
onRegister,
|
|
16
19
|
onUnregister,
|
|
20
|
+
getRegisteredTabs,
|
|
17
21
|
size,
|
|
18
22
|
vertical
|
|
19
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/TabList/useTabListContextValues.tsx"],"names":[],"mappings":"AAEA,OAAM,SAAU,uBAAV,CAAkC,KAAlC,EAAqD;AACzD,QAAM;
|
|
1
|
+
{"version":3,"sources":["components/TabList/useTabListContextValues.tsx"],"names":[],"mappings":"AAEA,OAAM,SAAU,uBAAV,CAAkC,KAAlC,EAAqD;AACzD,QAAM;AACJ,IAAA,UADI;AAEJ,IAAA,QAFI;AAGJ,IAAA,aAAa,EAAE,WAHX;AAIJ,IAAA,UAJI;AAKJ,IAAA,YALI;AAMJ,IAAA,QANI;AAOJ,IAAA,iBAPI;AAQJ,IAAA,IARI;AASJ,IAAA;AATI,MAUF,KAVJ;AAYA,QAAM,OAAO,GAAwB;AACnC,IAAA,UADmC;AAEnC,IAAA,QAFmC;AAGnC,IAAA,aAAa,EAAE,WAHoB;AAInC,IAAA,QAJmC;AAKnC,IAAA,UALmC;AAMnC,IAAA,YANmC;AAOnC,IAAA,iBAPmC;AAQnC,IAAA,IARmC;AASnC,IAAA;AATmC,GAArC;AAYA,SAAO;AAAE,IAAA;AAAF,GAAP;AACD","sourcesContent":["import { TabListContextValue, TabListContextValues, TabListState } from './TabList.types';\n\nexport function useTabListContextValues(state: TabListState): TabListContextValues {\n const {\n appearance,\n disabled,\n selectedValue: selectedKey,\n onRegister,\n onUnregister,\n onSelect,\n getRegisteredTabs,\n size,\n vertical,\n } = state;\n\n const tabList: TabListContextValue = {\n appearance,\n disabled,\n selectedValue: selectedKey,\n onSelect,\n onRegister,\n onUnregister,\n getRegisteredTabs,\n size,\n vertical,\n };\n\n return { tabList };\n}\n"],"sourceRoot":"../src/"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const indicatorLengthVar = "--selection-indicator-length";
|
|
1
|
+
import { SlotClassNames } from '@fluentui/react-utilities';
|
|
2
|
+
import type { TabListSlots, TabListState } from './TabList.types';
|
|
3
|
+
export declare const tabListClassNames: SlotClassNames<TabListSlots>;
|
|
4
|
+
export declare const tabListClassName: string;
|
|
6
5
|
/**
|
|
7
6
|
* Apply styling to the TabList slots based on the state
|
|
8
7
|
*/
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { __styles, mergeClasses
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export const
|
|
7
|
-
export const indicatorOffsetVar = '--selection-indicator-offset';
|
|
8
|
-
export const indicatorLengthVar = '--selection-indicator-length';
|
|
1
|
+
import { __styles, mergeClasses } from '@griffel/react';
|
|
2
|
+
export const tabListClassNames = {
|
|
3
|
+
root: 'fui-TabList'
|
|
4
|
+
}; // TODO temporary export to pass conformance test.
|
|
5
|
+
|
|
6
|
+
export const tabListClassName = tabListClassNames.root;
|
|
9
7
|
/**
|
|
10
8
|
* Styles for the root slot
|
|
11
9
|
*/
|
|
@@ -22,97 +20,17 @@ const useStyles = /*#__PURE__*/__styles({
|
|
|
22
20
|
}, {
|
|
23
21
|
"d": [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f1063pyq{-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}", ".f10pi13n{position:relative;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}"]
|
|
24
22
|
});
|
|
25
|
-
/**
|
|
26
|
-
* Styles for the selection indicator slot when horizontal.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const useHorizontalIndicatorStyles = /*#__PURE__*/__styles({
|
|
31
|
-
"base": {
|
|
32
|
-
"Bkbwdz4": "f30248y",
|
|
33
|
-
"frdscb": ["fvxed1z", "f1j2a01o"],
|
|
34
|
-
"B9nohqn": ["f1j2a01o", "fvxed1z"],
|
|
35
|
-
"B1dhsta": ["fsamouo", "f1aazreq"],
|
|
36
|
-
"Bjdmjzx": ["f1aazreq", "fsamouo"],
|
|
37
|
-
"Bj55yzk": "fw2wsqs",
|
|
38
|
-
"oqd9ik": "ffdc0f3",
|
|
39
|
-
"Bs6t6z0": "fqc6z8f",
|
|
40
|
-
"mpb1vu": "f119hevp",
|
|
41
|
-
"jc51t6": ["f1uyszuw", "f1xp83vy"],
|
|
42
|
-
"Hdbjpj": "f11ef69",
|
|
43
|
-
"Biobvvw": "f1tzy5p2",
|
|
44
|
-
"Bunff0j": "fs357bs"
|
|
45
|
-
},
|
|
46
|
-
"small": {
|
|
47
|
-
"jc51t6": ["f1w3ykbk", "f1xm0lqg"],
|
|
48
|
-
"Biobvvw": "f1akpkq3"
|
|
49
|
-
},
|
|
50
|
-
"animated": {
|
|
51
|
-
"wbfbqe": ["fjzde92", "f1xfxhj5"],
|
|
52
|
-
"mafdb0": "f1fuwhvj"
|
|
53
|
-
}
|
|
54
|
-
}, {
|
|
55
|
-
"d": [".f30248y:after{background-color:var(--colorBrandStroke1);}", ".fvxed1z:after{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f1j2a01o:after{border-bottom-left-radius:var(--borderRadiusMedium);}", ".fsamouo:after{border-top-right-radius:var(--borderRadiusMedium);}", ".f1aazreq:after{border-top-left-radius:var(--borderRadiusMedium);}", ".fw2wsqs:after{bottom:0;}", ".ffdc0f3:after{box-sizing:border-box;}", ".fqc6z8f:after{content:\"\";}", ".f119hevp:after{height:2px;}", ".f1uyszuw:after{left:calc(var(--selection-indicator-offset) + 10px);}", ".f1xp83vy:after{right:calc(var(--selection-indicator-offset) + 10px);}", ".f11ef69:after{position:absolute;}", ".f1tzy5p2:after{width:calc(var(--selection-indicator-length) - (2 * 10px));}", ".fs357bs:after{z-index:1;}", ".f1w3ykbk:after{left:calc(var(--selection-indicator-offset) + 6px);}", ".f1xm0lqg:after{right:calc(var(--selection-indicator-offset) + 6px);}", ".f1akpkq3:after{width:calc(var(--selection-indicator-length) - (2 * 6px));}", ".fjzde92:after{transition-property:left,width;}", ".f1xfxhj5:after{transition-property:right,width;}", ".f1fuwhvj:after{transition-duration:350ms,350ms;}"]
|
|
56
|
-
});
|
|
57
|
-
/**
|
|
58
|
-
* Styles for the selection indicator slot when vertical.
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const useVerticalIndicatorStyles = /*#__PURE__*/__styles({
|
|
63
|
-
"base": {
|
|
64
|
-
"B1dvbpk": "fa05st",
|
|
65
|
-
"px8gyy": ["f16to4m4", "f1ceoihi"],
|
|
66
|
-
"B5c9fhp": ["f1ceoihi", "f16to4m4"],
|
|
67
|
-
"Bhe99jt": ["fkibbow", "fnlo9u7"],
|
|
68
|
-
"B2r1szc": ["fnlo9u7", "fkibbow"],
|
|
69
|
-
"Bmqnesq": "f170vdtw",
|
|
70
|
-
"rurcny": "fuzzvh5",
|
|
71
|
-
"Bbc2r3f": "f13xaayz",
|
|
72
|
-
"Byque4d": ["f1t0u0az", "fmlx6bj"],
|
|
73
|
-
"xx9plb": "fxf9f1y",
|
|
74
|
-
"Bf8kmfk": "fwt37qm",
|
|
75
|
-
"Bdn98qo": "f15bpuwh",
|
|
76
|
-
"Bab4cu6": "f1ijlm3k"
|
|
77
|
-
},
|
|
78
|
-
"small": {
|
|
79
|
-
"Bf8kmfk": "f8k0k00",
|
|
80
|
-
"Bbc2r3f": "fyephjl"
|
|
81
|
-
},
|
|
82
|
-
"animated": {
|
|
83
|
-
"iukgx1": "fcs48rj",
|
|
84
|
-
"B5szp9g": "f1u309tb"
|
|
85
|
-
}
|
|
86
|
-
}, {
|
|
87
|
-
"d": [".fa05st:before{background-color:var(--colorBrandStroke1);}", ".f16to4m4:before{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f1ceoihi:before{border-bottom-left-radius:var(--borderRadiusMedium);}", ".fkibbow:before{border-top-right-radius:var(--borderRadiusMedium);}", ".fnlo9u7:before{border-top-left-radius:var(--borderRadiusMedium);}", ".f170vdtw:before{box-sizing:border-box;}", ".fuzzvh5:before{content:\"\";}", ".f13xaayz:before{height:calc(var(--selection-indicator-length) - (2 * 10px));}", ".f1t0u0az:before{left:0;}", ".fmlx6bj:before{right:0;}", ".fxf9f1y:before{position:absolute;}", ".fwt37qm:before{top:calc(var(--selection-indicator-offset) + 10px);}", ".f15bpuwh:before{width:2px;}", ".f1ijlm3k:before{z-index:1;}", ".f8k0k00:before{top:calc(var(--selection-indicator-offset) + 6px);}", ".fyephjl:before{height:calc(var(--selection-indicator-length) - (2 * 6px));}", ".fcs48rj:before{transition-property:top,height;}", ".f1u309tb:before{transition-duration:350ms,350ms;}"]
|
|
88
|
-
});
|
|
89
23
|
/**
|
|
90
24
|
* Apply styling to the TabList slots based on the state
|
|
91
25
|
*/
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
93
26
|
|
|
94
27
|
|
|
95
28
|
export const useTabListStyles_unstable = state => {
|
|
96
29
|
const {
|
|
97
|
-
selectedTabRect: selectionIndicatorRect,
|
|
98
|
-
selectedValue,
|
|
99
|
-
size,
|
|
100
30
|
vertical
|
|
101
|
-
} = state;
|
|
102
|
-
|
|
103
|
-
const previousSelectedValue = usePrevious(selectedValue);
|
|
104
|
-
const shouldAnimate = !!previousSelectedValue && previousSelectedValue !== selectedValue;
|
|
31
|
+
} = state;
|
|
105
32
|
const styles = useStyles();
|
|
106
|
-
|
|
107
|
-
const verticalIndicatorStyles = useVerticalIndicatorStyles();
|
|
108
|
-
state.root.className = mergeClasses(tabListClassName, styles.root, vertical && styles.vertical, !!selectedValue && (vertical ? verticalIndicatorStyles.base : horizontalIndicatorStyles.base), !!selectedValue && size === 'small' && (vertical ? verticalIndicatorStyles.small : horizontalIndicatorStyles.small), !!selectedValue && shouldAnimate && (vertical ? verticalIndicatorStyles.animated : horizontalIndicatorStyles.animated), state.root.className);
|
|
109
|
-
const rootCssVars = selectionIndicatorRect ? {
|
|
110
|
-
[indicatorOffsetVar]: vertical ? `${selectionIndicatorRect.y}px` : `${selectionIndicatorRect.x}px`,
|
|
111
|
-
[indicatorLengthVar]: vertical ? `${selectionIndicatorRect.height}px` : `${selectionIndicatorRect.width}px`
|
|
112
|
-
} : {};
|
|
113
|
-
state.root.style = { ...rootCssVars,
|
|
114
|
-
...state.root.style
|
|
115
|
-
};
|
|
33
|
+
state.root.className = mergeClasses(tabListClassName, styles.root, vertical && styles.vertical, state.root.className);
|
|
116
34
|
return state;
|
|
117
35
|
};
|
|
118
36
|
//# sourceMappingURL=useTabListStyles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/TabList/useTabListStyles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["components/TabList/useTabListStyles.ts"],"names":[],"mappings":"AACA,mBAAqB,YAArB,QAAyC,gBAAzC;AAGA,OAAO,MAAM,iBAAiB,GAAiC;AAC7D,EAAA,IAAI,EAAE;AADuD,CAAxD,C,CAIP;;AACA,OAAO,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,IAA3C;AAEP;;AAEG;;AACH,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAWA;;AAEG;;;AACH,OAAO,MAAM,yBAAyB,GAAI,KAAD,IAAsC;AAC7E,QAAM;AAAE,IAAA;AAAF,MAAe,KAArB;AAEA,QAAM,MAAM,GAAG,SAAS,EAAxB;AAEA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,gBAAD,EAAmB,MAAM,CAAC,IAA1B,EAAgC,QAAQ,IAAI,MAAM,CAAC,QAAnD,EAA6D,KAAK,CAAC,IAAN,CAAW,SAAxE,CAAnC;AAEA,SAAO,KAAP;AACD,CARM","sourcesContent":["import { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport type { TabListSlots, TabListState } from './TabList.types';\n\nexport const tabListClassNames: SlotClassNames<TabListSlots> = {\n root: 'fui-TabList',\n};\n\n// TODO temporary export to pass conformance test.\nexport const tabListClassName = tabListClassNames.root;\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n position: 'relative',\n },\n vertical: {\n flexDirection: 'column',\n },\n});\n\n/**\n * Apply styling to the TabList slots based on the state\n */\nexport const useTabListStyles_unstable = (state: TabListState): TabListState => {\n const { vertical } = state;\n\n const styles = useStyles();\n\n state.root.className = mergeClasses(tabListClassName, styles.root, vertical && styles.vertical, state.root.className);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type { TabProps, TabSlots, TabState, TabValue } from './Tab';
|
|
2
|
+
export { renderTab_unstable, Tab, tabClassName, tabClassNames, useTabStyles_unstable, useTab_unstable } from './Tab';
|
|
3
|
+
export type { TabRegisterData, RegisterTabEventHandler, SelectTabData, SelectTabEvent, SelectTabEventHandler, TabListContextValue, TabListContextValues, TabListProps, TabListSlots, TabListState, } from './TabList';
|
|
4
|
+
export { renderTabList_unstable, TabList, tabListClassName, tabListClassNames, useTabListStyles_unstable, useTabList_unstable, } from './TabList';
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export { renderTab_unstable, Tab, tabClassName, tabClassNames, useTabStyles_unstable, useTab_unstable } from './Tab';
|
|
2
|
+
export { renderTabList_unstable, TabList, tabListClassName, tabListClassNames, useTabListStyles_unstable, useTabList_unstable } from './TabList';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AACA,SAAS,kBAAT,EAA6B,GAA7B,EAAkC,YAAlC,EAAgD,aAAhD,EAA+D,qBAA/D,EAAsF,eAAtF,QAA6G,OAA7G;AAaA,SACE,sBADF,EAEE,OAFF,EAGE,gBAHF,EAIE,iBAJF,EAKE,yBALF,EAME,mBANF,QAOO,WAPP","sourcesContent":["export type { TabProps, TabSlots, TabState, TabValue } from './Tab';\nexport { renderTab_unstable, Tab, tabClassName, tabClassNames, useTabStyles_unstable, useTab_unstable } from './Tab';\nexport type {\n TabRegisterData,\n RegisterTabEventHandler,\n SelectTabData,\n SelectTabEvent,\n SelectTabEventHandler,\n TabListContextValue,\n TabListContextValues,\n TabListProps,\n TabListSlots,\n TabListState,\n} from './TabList';\nexport {\n renderTabList_unstable,\n TabList,\n tabListClassName,\n tabListClassNames,\n useTabListStyles_unstable,\n useTabList_unstable,\n} from './TabList';\n"],"sourceRoot":"../src/"}
|
package/lib/tab.constants.d.ts
CHANGED
|
@@ -1,15 +1,62 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export declare const pendingContentSizeTokens: {
|
|
2
|
+
body1: {
|
|
3
|
+
fontSize: string;
|
|
4
|
+
fontWeight: string;
|
|
5
|
+
lineHeight: string;
|
|
5
6
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
contentPadding: {
|
|
12
|
-
medium: string;
|
|
13
|
-
small: string;
|
|
7
|
+
body1Strong: {
|
|
8
|
+
fontSize: string;
|
|
9
|
+
fontWeight: string;
|
|
10
|
+
lineHeight: string;
|
|
14
11
|
};
|
|
15
12
|
};
|
|
13
|
+
export declare const pendingSpacingTokens: {
|
|
14
|
+
none: string;
|
|
15
|
+
xxs: string;
|
|
16
|
+
xs: string;
|
|
17
|
+
sNudge: string;
|
|
18
|
+
s: string;
|
|
19
|
+
mNudge: string;
|
|
20
|
+
m: string;
|
|
21
|
+
l: string;
|
|
22
|
+
xl: string;
|
|
23
|
+
xxl: string;
|
|
24
|
+
xxxl: string;
|
|
25
|
+
};
|
|
26
|
+
export declare const pendingAnimationDurationTokens: {
|
|
27
|
+
ultraFast: string;
|
|
28
|
+
faster: string;
|
|
29
|
+
fast: string;
|
|
30
|
+
normal: string;
|
|
31
|
+
slow: string;
|
|
32
|
+
slower: string;
|
|
33
|
+
ultraSlow: string;
|
|
34
|
+
};
|
|
35
|
+
export declare const pendingAnimationEasingTokens: {
|
|
36
|
+
accelerateMax: string;
|
|
37
|
+
accelerateMid: string;
|
|
38
|
+
accelerateMin: string;
|
|
39
|
+
declerateMax: string;
|
|
40
|
+
decelerateMid: string;
|
|
41
|
+
decelarateMin: string;
|
|
42
|
+
maxEasyEase: string;
|
|
43
|
+
easyEase: string;
|
|
44
|
+
linear: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Provides shared values between tab style hooks
|
|
48
|
+
* useTabStyles
|
|
49
|
+
* useTabAnimatedIndicator
|
|
50
|
+
*/
|
|
51
|
+
export declare const tabIndicatorPadding: {
|
|
52
|
+
mediumHorizontal: string;
|
|
53
|
+
mediumVertical: string;
|
|
54
|
+
smallHorizontal: string;
|
|
55
|
+
smallVertical: string;
|
|
56
|
+
};
|
|
57
|
+
export declare const tabIndicatorStrokeWidths: {
|
|
58
|
+
mediumHorizontal: string;
|
|
59
|
+
mediumVertical: string;
|
|
60
|
+
smallHorizontal: string;
|
|
61
|
+
smallVertical: string;
|
|
62
|
+
};
|
package/lib/tab.constants.js
CHANGED
|
@@ -1,17 +1,68 @@
|
|
|
1
|
-
// TODO:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
// TODO: Constants prefixed with pending should be replaced with design tokens
|
|
2
|
+
// These values were taken from the design token superset figma
|
|
3
|
+
import { tokens } from '@fluentui/react-theme';
|
|
4
|
+
export const pendingContentSizeTokens = {
|
|
5
|
+
// Only body sizes are defined here currently
|
|
6
|
+
body1: {
|
|
7
|
+
fontSize: tokens.fontSizeBase300,
|
|
8
|
+
fontWeight: tokens.fontWeightRegular,
|
|
9
|
+
lineHeight: tokens.lineHeightBase300
|
|
6
10
|
},
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
contentPadding: {
|
|
13
|
-
medium: '2px',
|
|
14
|
-
small: '2px'
|
|
11
|
+
body1Strong: {
|
|
12
|
+
fontSize: tokens.fontSizeBase300,
|
|
13
|
+
fontWeight: tokens.fontWeightSemibold,
|
|
14
|
+
lineHeight: tokens.lineHeightBase300
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
+
export const pendingSpacingTokens = {
|
|
18
|
+
none: '0',
|
|
19
|
+
xxs: '2px',
|
|
20
|
+
xs: '4px',
|
|
21
|
+
sNudge: '6px',
|
|
22
|
+
s: '8px',
|
|
23
|
+
mNudge: '10px',
|
|
24
|
+
m: '12px',
|
|
25
|
+
l: '16px',
|
|
26
|
+
xl: '20px',
|
|
27
|
+
xxl: '24px',
|
|
28
|
+
xxxl: '32px'
|
|
29
|
+
};
|
|
30
|
+
export const pendingAnimationDurationTokens = {
|
|
31
|
+
ultraFast: '50ms',
|
|
32
|
+
faster: '100ms',
|
|
33
|
+
fast: '150ms',
|
|
34
|
+
normal: '200ms',
|
|
35
|
+
slow: '300ms',
|
|
36
|
+
slower: '400ms',
|
|
37
|
+
ultraSlow: '500ms'
|
|
38
|
+
};
|
|
39
|
+
export const pendingAnimationEasingTokens = {
|
|
40
|
+
accelerateMax: 'cubic-bezier(1,0,1,1)',
|
|
41
|
+
accelerateMid: 'cubic-bezier(0.7,0,1,0.5)',
|
|
42
|
+
accelerateMin: 'cubic-bezier(0.8,0,1,1)',
|
|
43
|
+
declerateMax: 'cubic-bezier(0,0,0,1)',
|
|
44
|
+
decelerateMid: 'cubic-bezier(0.1,0.9,0.2,1)',
|
|
45
|
+
decelarateMin: 'cubic-bezier(0.33,0,0.1,1)',
|
|
46
|
+
maxEasyEase: 'cubic-bezier(0.8,0,0.1,1)',
|
|
47
|
+
easyEase: 'cubic-bezier(0.33,0,0.67,1)',
|
|
48
|
+
linear: 'cubic-bezier(0,0,1,1)'
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Provides shared values between tab style hooks
|
|
52
|
+
* useTabStyles
|
|
53
|
+
* useTabAnimatedIndicator
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
export const tabIndicatorPadding = {
|
|
57
|
+
mediumHorizontal: pendingSpacingTokens.m,
|
|
58
|
+
mediumVertical: pendingSpacingTokens.s,
|
|
59
|
+
smallHorizontal: pendingSpacingTokens.sNudge,
|
|
60
|
+
smallVertical: pendingSpacingTokens.xs
|
|
61
|
+
};
|
|
62
|
+
export const tabIndicatorStrokeWidths = {
|
|
63
|
+
mediumHorizontal: tokens.strokeWidthThicker,
|
|
64
|
+
mediumVertical: tokens.strokeWidthThicker,
|
|
65
|
+
smallHorizontal: tokens.strokeWidthThick,
|
|
66
|
+
smallVertical: tokens.strokeWidthThicker
|
|
67
|
+
};
|
|
17
68
|
//# sourceMappingURL=tab.constants.js.map
|
package/lib/tab.constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["tab.constants.ts"],"names":[],"mappings":"AAAA;AACA,OAAO,MAAM,
|
|
1
|
+
{"version":3,"sources":["tab.constants.ts"],"names":[],"mappings":"AAAA;AACA;AAEA,SAAS,MAAT,QAAuB,uBAAvB;AAEA,OAAO,MAAM,wBAAwB,GAAG;AACtC;AACA,EAAA,KAAK,EAAE;AACL,IAAA,QAAQ,EAAE,MAAM,CAAC,eADZ;AAEL,IAAA,UAAU,EAAE,MAAM,CAAC,iBAFd;AAGL,IAAA,UAAU,EAAE,MAAM,CAAC;AAHd,GAF+B;AAOtC,EAAA,WAAW,EAAE;AACX,IAAA,QAAQ,EAAE,MAAM,CAAC,eADN;AAEX,IAAA,UAAU,EAAE,MAAM,CAAC,kBAFR;AAGX,IAAA,UAAU,EAAE,MAAM,CAAC;AAHR;AAPyB,CAAjC;AAcP,OAAO,MAAM,oBAAoB,GAAG;AAClC,EAAA,IAAI,EAAE,GAD4B;AAElC,EAAA,GAAG,EAAE,KAF6B;AAGlC,EAAA,EAAE,EAAE,KAH8B;AAIlC,EAAA,MAAM,EAAE,KAJ0B;AAKlC,EAAA,CAAC,EAAE,KAL+B;AAMlC,EAAA,MAAM,EAAE,MAN0B;AAOlC,EAAA,CAAC,EAAE,MAP+B;AAQlC,EAAA,CAAC,EAAE,MAR+B;AASlC,EAAA,EAAE,EAAE,MAT8B;AAUlC,EAAA,GAAG,EAAE,MAV6B;AAWlC,EAAA,IAAI,EAAE;AAX4B,CAA7B;AAcP,OAAO,MAAM,8BAA8B,GAAG;AAC5C,EAAA,SAAS,EAAE,MADiC;AAE5C,EAAA,MAAM,EAAE,OAFoC;AAG5C,EAAA,IAAI,EAAE,OAHsC;AAI5C,EAAA,MAAM,EAAE,OAJoC;AAK5C,EAAA,IAAI,EAAE,OALsC;AAM5C,EAAA,MAAM,EAAE,OANoC;AAO5C,EAAA,SAAS,EAAE;AAPiC,CAAvC;AAUP,OAAO,MAAM,4BAA4B,GAAG;AAC1C,EAAA,aAAa,EAAE,uBAD2B;AAE1C,EAAA,aAAa,EAAE,2BAF2B;AAG1C,EAAA,aAAa,EAAE,yBAH2B;AAI1C,EAAA,YAAY,EAAE,uBAJ4B;AAK1C,EAAA,aAAa,EAAE,6BAL2B;AAM1C,EAAA,aAAa,EAAE,4BAN2B;AAO1C,EAAA,WAAW,EAAE,2BAP6B;AAQ1C,EAAA,QAAQ,EAAE,6BARgC;AAS1C,EAAA,MAAM,EAAE;AATkC,CAArC;AAYP;;;;AAIG;;AACH,OAAO,MAAM,mBAAmB,GAAG;AACjC,EAAA,gBAAgB,EAAE,oBAAoB,CAAC,CADN;AAEjC,EAAA,cAAc,EAAE,oBAAoB,CAAC,CAFJ;AAGjC,EAAA,eAAe,EAAE,oBAAoB,CAAC,MAHL;AAIjC,EAAA,aAAa,EAAE,oBAAoB,CAAC;AAJH,CAA5B;AAOP,OAAO,MAAM,wBAAwB,GAAG;AACtC,EAAA,gBAAgB,EAAE,MAAM,CAAC,kBADa;AAEtC,EAAA,cAAc,EAAE,MAAM,CAAC,kBAFe;AAGtC,EAAA,eAAe,EAAE,MAAM,CAAC,gBAHc;AAItC,EAAA,aAAa,EAAE,MAAM,CAAC;AAJgB,CAAjC","sourcesContent":["// TODO: Constants prefixed with pending should be replaced with design tokens\n// These values were taken from the design token superset figma\n\nimport { tokens } from '@fluentui/react-theme';\n\nexport const pendingContentSizeTokens = {\n // Only body sizes are defined here currently\n body1: {\n fontSize: tokens.fontSizeBase300,\n fontWeight: tokens.fontWeightRegular,\n lineHeight: tokens.lineHeightBase300,\n },\n body1Strong: {\n fontSize: tokens.fontSizeBase300,\n fontWeight: tokens.fontWeightSemibold,\n lineHeight: tokens.lineHeightBase300,\n },\n};\n\nexport const pendingSpacingTokens = {\n none: '0',\n xxs: '2px',\n xs: '4px',\n sNudge: '6px',\n s: '8px',\n mNudge: '10px',\n m: '12px',\n l: '16px',\n xl: '20px',\n xxl: '24px',\n xxxl: '32px',\n};\n\nexport const pendingAnimationDurationTokens = {\n ultraFast: '50ms',\n faster: '100ms',\n fast: '150ms',\n normal: '200ms',\n slow: '300ms',\n slower: '400ms',\n ultraSlow: '500ms',\n};\n\nexport const pendingAnimationEasingTokens = {\n accelerateMax: 'cubic-bezier(1,0,1,1)',\n accelerateMid: 'cubic-bezier(0.7,0,1,0.5)',\n accelerateMin: 'cubic-bezier(0.8,0,1,1)',\n declerateMax: 'cubic-bezier(0,0,0,1)',\n decelerateMid: 'cubic-bezier(0.1,0.9,0.2,1)',\n decelarateMin: 'cubic-bezier(0.33,0,0.1,1)',\n maxEasyEase: 'cubic-bezier(0.8,0,0.1,1)',\n easyEase: 'cubic-bezier(0.33,0,0.67,1)',\n linear: 'cubic-bezier(0,0,1,1)',\n};\n\n/**\n * Provides shared values between tab style hooks\n * useTabStyles\n * useTabAnimatedIndicator\n */\nexport const tabIndicatorPadding = {\n mediumHorizontal: pendingSpacingTokens.m,\n mediumVertical: pendingSpacingTokens.s,\n smallHorizontal: pendingSpacingTokens.sNudge,\n smallVertical: pendingSpacingTokens.xs,\n};\n\nexport const tabIndicatorStrokeWidths = {\n mediumHorizontal: tokens.strokeWidthThicker,\n mediumVertical: tokens.strokeWidthThicker,\n smallHorizontal: tokens.strokeWidthThick,\n smallVertical: tokens.strokeWidthThicker,\n};\n"],"sourceRoot":"../src/"}
|