@fluentui/react-tabs 1.0.0-beta.97 → 9.0.0-beta.10
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 +181 -1762
- package/CHANGELOG.md +54 -718
- package/README.md +0 -17
- package/Spec.md +433 -0
- package/dist/react-tabs.d.ts +173 -127
- package/lib/Tab.d.ts +1 -0
- package/lib/Tab.js +2 -0
- package/lib/Tab.js.map +1 -0
- package/lib/TabList.d.ts +1 -0
- package/lib/TabList.js +2 -0
- package/lib/TabList.js.map +1 -0
- package/lib/components/Tab/Tab.d.ts +6 -0
- package/lib/components/Tab/Tab.js +15 -0
- package/lib/components/Tab/Tab.js.map +1 -0
- package/lib/components/Tab/Tab.types.d.ts +61 -0
- package/lib/components/Tab/Tab.types.js +2 -0
- package/lib/components/Tab/Tab.types.js.map +1 -0
- package/lib/components/Tab/index.d.ts +6 -0
- package/lib/components/Tab/index.js +7 -0
- package/lib/components/Tab/index.js.map +1 -0
- package/lib/components/Tab/renderTab.d.ts +5 -0
- package/lib/components/Tab/renderTab.js +17 -0
- package/lib/components/Tab/renderTab.js.map +1 -0
- package/lib/components/Tab/useTab.d.ts +12 -0
- package/lib/components/Tab/useTab.js +78 -0
- package/lib/components/Tab/useTab.js.map +1 -0
- 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 +8 -0
- package/lib/components/Tab/useTabStyles.js +402 -0
- package/lib/components/Tab/useTabStyles.js.map +1 -0
- package/lib/components/TabList/TabList.d.ts +6 -0
- package/lib/components/TabList/TabList.js +17 -0
- package/lib/components/TabList/TabList.js.map +1 -0
- package/lib/components/TabList/TabList.types.d.ts +104 -0
- package/lib/components/TabList/TabList.types.js +2 -0
- package/lib/components/TabList/TabList.types.js.map +1 -0
- package/lib/components/TabList/TabListContext.d.ts +3 -0
- package/lib/components/TabList/TabListContext.js +23 -0
- package/lib/components/TabList/TabListContext.js.map +1 -0
- package/lib/components/TabList/index.d.ts +5 -0
- package/lib/components/TabList/index.js +6 -0
- package/lib/components/TabList/index.js.map +1 -0
- package/lib/components/TabList/renderTabList.d.ts +5 -0
- package/lib/components/TabList/renderTabList.js +18 -0
- package/lib/components/TabList/renderTabList.js.map +1 -0
- package/lib/components/TabList/useTabList.d.ts +12 -0
- package/lib/components/TabList/useTabList.js +81 -0
- package/lib/components/TabList/useTabList.js.map +1 -0
- package/lib/components/TabList/useTabListContextValues.d.ts +2 -0
- package/lib/components/TabList/useTabListContextValues.js +28 -0
- package/lib/components/TabList/useTabListContextValues.js.map +1 -0
- package/lib/components/TabList/useTabListStyles.d.ts +8 -0
- package/lib/components/TabList/useTabListStyles.js +45 -0
- package/lib/components/TabList/useTabListStyles.js.map +1 -0
- package/lib/index.d.ts +4 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/tab.constants.d.ts +62 -0
- package/lib/tab.constants.js +68 -0
- package/lib/tab.constants.js.map +1 -0
- package/lib/tsdoc-metadata.json +1 -1
- package/lib-commonjs/Tab.d.ts +1 -0
- package/lib-commonjs/Tab.js +10 -0
- package/lib-commonjs/Tab.js.map +1 -0
- package/lib-commonjs/TabList.d.ts +1 -0
- package/lib-commonjs/TabList.js +10 -0
- package/lib-commonjs/TabList.js.map +1 -0
- package/lib-commonjs/components/Tab/Tab.d.ts +6 -0
- package/lib-commonjs/components/Tab/Tab.js +26 -0
- package/lib-commonjs/components/Tab/Tab.js.map +1 -0
- package/lib-commonjs/components/Tab/Tab.types.d.ts +61 -0
- package/lib-commonjs/components/Tab/Tab.types.js +6 -0
- package/lib-commonjs/components/Tab/Tab.types.js.map +1 -0
- package/lib-commonjs/components/Tab/index.d.ts +6 -0
- package/lib-commonjs/components/Tab/index.js +20 -0
- package/lib-commonjs/components/Tab/index.js.map +1 -0
- package/lib-commonjs/components/Tab/renderTab.d.ts +5 -0
- package/lib-commonjs/components/Tab/renderTab.js +28 -0
- package/lib-commonjs/components/Tab/renderTab.js.map +1 -0
- package/lib-commonjs/components/Tab/useTab.d.ts +12 -0
- package/lib-commonjs/components/Tab/useTab.js +91 -0
- package/lib-commonjs/components/Tab/useTab.js.map +1 -0
- 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 +8 -0
- package/lib-commonjs/components/Tab/useTabStyles.js +416 -0
- package/lib-commonjs/components/Tab/useTabStyles.js.map +1 -0
- package/lib-commonjs/components/TabList/TabList.d.ts +6 -0
- package/lib-commonjs/components/TabList/TabList.js +29 -0
- package/lib-commonjs/components/TabList/TabList.js.map +1 -0
- package/lib-commonjs/components/TabList/TabList.types.d.ts +104 -0
- package/lib-commonjs/components/TabList/TabList.types.js +6 -0
- package/lib-commonjs/components/TabList/TabList.types.js.map +1 -0
- package/lib-commonjs/components/TabList/TabListContext.d.ts +3 -0
- package/lib-commonjs/components/TabList/TabListContext.js +31 -0
- package/lib-commonjs/components/TabList/TabListContext.js.map +1 -0
- package/lib-commonjs/components/TabList/index.d.ts +5 -0
- package/lib-commonjs/components/TabList/index.js +18 -0
- package/lib-commonjs/components/TabList/index.js.map +1 -0
- package/lib-commonjs/components/TabList/renderTabList.d.ts +5 -0
- package/lib-commonjs/components/TabList/renderTabList.js +30 -0
- package/lib-commonjs/components/TabList/renderTabList.js.map +1 -0
- package/lib-commonjs/components/TabList/useTabList.d.ts +12 -0
- package/lib-commonjs/components/TabList/useTabList.js +93 -0
- package/lib-commonjs/components/TabList/useTabList.js.map +1 -0
- package/lib-commonjs/components/TabList/useTabListContextValues.d.ts +2 -0
- package/lib-commonjs/components/TabList/useTabListContextValues.js +37 -0
- package/lib-commonjs/components/TabList/useTabListContextValues.js.map +1 -0
- package/lib-commonjs/components/TabList/useTabListStyles.d.ts +8 -0
- package/lib-commonjs/components/TabList/useTabListStyles.js +55 -0
- package/lib-commonjs/components/TabList/useTabListStyles.js.map +1 -0
- package/lib-commonjs/index.d.ts +4 -1
- package/lib-commonjs/index.js +83 -3
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/tab.constants.d.ts +62 -0
- package/lib-commonjs/tab.constants.js +75 -0
- package/lib-commonjs/tab.constants.js.map +1 -0
- package/package.json +25 -21
- package/config/api-extractor.json +0 -3
- package/config/tests.js +0 -14
- package/etc/react-tabs.api.md +0 -104
- package/just.config.ts +0 -3
- package/lib/Tabs.d.ts +0 -1
- package/lib/Tabs.js +0 -2
- package/lib/Tabs.js.map +0 -1
- package/lib/common/isConformant.d.ts +0 -2
- package/lib/common/isConformant.js +0 -9
- package/lib/common/isConformant.js.map +0 -1
- package/lib/components/Tabs/TabItem.d.ts +0 -6
- package/lib/components/Tabs/TabItem.js +0 -18
- package/lib/components/Tabs/TabItem.js.map +0 -1
- package/lib/components/Tabs/TabItem.types.d.ts +0 -61
- package/lib/components/Tabs/TabItem.types.js +0 -2
- package/lib/components/Tabs/TabItem.types.js.map +0 -1
- package/lib/components/Tabs/Tabs.base.d.ts +0 -3
- package/lib/components/Tabs/Tabs.base.js +0 -179
- package/lib/components/Tabs/Tabs.base.js.map +0 -1
- package/lib/components/Tabs/Tabs.d.ts +0 -8
- package/lib/components/Tabs/Tabs.js +0 -12
- package/lib/components/Tabs/Tabs.js.map +0 -1
- package/lib/components/Tabs/Tabs.styles.d.ts +0 -2
- package/lib/components/Tabs/Tabs.styles.js +0 -264
- package/lib/components/Tabs/Tabs.styles.js.map +0 -1
- package/lib/components/Tabs/Tabs.types.d.ts +0 -113
- package/lib/components/Tabs/Tabs.types.js +0 -2
- package/lib/components/Tabs/Tabs.types.js.map +0 -1
- package/lib/components/Tabs/index.d.ts +0 -5
- package/lib/components/Tabs/index.js +0 -6
- package/lib/components/Tabs/index.js.map +0 -1
- package/lib/utilities/observeResize.d.ts +0 -21
- package/lib/utilities/observeResize.js +0 -46
- package/lib/utilities/observeResize.js.map +0 -1
- package/lib/utilities/useOverflow.d.ts +0 -45
- package/lib/utilities/useOverflow.js +0 -126
- package/lib/utilities/useOverflow.js.map +0 -1
- package/lib-amd/Tabs.d.ts +0 -1
- package/lib-amd/Tabs.js +0 -6
- package/lib-amd/Tabs.js.map +0 -1
- package/lib-amd/common/isConformant.d.ts +0 -2
- package/lib-amd/common/isConformant.js +0 -14
- package/lib-amd/common/isConformant.js.map +0 -1
- package/lib-amd/components/Tabs/TabItem.d.ts +0 -6
- package/lib-amd/components/Tabs/TabItem.js +0 -20
- package/lib-amd/components/Tabs/TabItem.js.map +0 -1
- package/lib-amd/components/Tabs/TabItem.types.d.ts +0 -61
- package/lib-amd/components/Tabs/TabItem.types.js +0 -5
- package/lib-amd/components/Tabs/TabItem.types.js.map +0 -1
- package/lib-amd/components/Tabs/Tabs.base.d.ts +0 -3
- package/lib-amd/components/Tabs/Tabs.base.js +0 -176
- package/lib-amd/components/Tabs/Tabs.base.js.map +0 -1
- package/lib-amd/components/Tabs/Tabs.d.ts +0 -8
- package/lib-amd/components/Tabs/Tabs.js +0 -14
- package/lib-amd/components/Tabs/Tabs.js.map +0 -1
- package/lib-amd/components/Tabs/Tabs.styles.d.ts +0 -2
- package/lib-amd/components/Tabs/Tabs.styles.js +0 -267
- package/lib-amd/components/Tabs/Tabs.styles.js.map +0 -1
- package/lib-amd/components/Tabs/Tabs.types.d.ts +0 -113
- package/lib-amd/components/Tabs/Tabs.types.js +0 -5
- package/lib-amd/components/Tabs/Tabs.types.js.map +0 -1
- package/lib-amd/components/Tabs/index.d.ts +0 -5
- package/lib-amd/components/Tabs/index.js +0 -11
- package/lib-amd/components/Tabs/index.js.map +0 -1
- package/lib-amd/index.d.ts +0 -1
- package/lib-amd/index.js +0 -6
- package/lib-amd/index.js.map +0 -1
- package/lib-amd/utilities/observeResize.d.ts +0 -21
- package/lib-amd/utilities/observeResize.js +0 -51
- package/lib-amd/utilities/observeResize.js.map +0 -1
- package/lib-amd/utilities/useOverflow.d.ts +0 -45
- package/lib-amd/utilities/useOverflow.js +0 -128
- package/lib-amd/utilities/useOverflow.js.map +0 -1
- package/lib-commonjs/Tabs.d.ts +0 -1
- package/lib-commonjs/Tabs.js +0 -5
- package/lib-commonjs/Tabs.js.map +0 -1
- package/lib-commonjs/common/isConformant.d.ts +0 -2
- package/lib-commonjs/common/isConformant.js +0 -13
- package/lib-commonjs/common/isConformant.js.map +0 -1
- package/lib-commonjs/components/Tabs/TabItem.d.ts +0 -6
- package/lib-commonjs/components/Tabs/TabItem.js +0 -21
- package/lib-commonjs/components/Tabs/TabItem.js.map +0 -1
- package/lib-commonjs/components/Tabs/TabItem.types.d.ts +0 -61
- package/lib-commonjs/components/Tabs/TabItem.types.js +0 -3
- package/lib-commonjs/components/Tabs/TabItem.types.js.map +0 -1
- package/lib-commonjs/components/Tabs/Tabs.base.d.ts +0 -3
- package/lib-commonjs/components/Tabs/Tabs.base.js +0 -182
- package/lib-commonjs/components/Tabs/Tabs.base.js.map +0 -1
- package/lib-commonjs/components/Tabs/Tabs.d.ts +0 -8
- package/lib-commonjs/components/Tabs/Tabs.js +0 -15
- package/lib-commonjs/components/Tabs/Tabs.js.map +0 -1
- package/lib-commonjs/components/Tabs/Tabs.styles.d.ts +0 -2
- package/lib-commonjs/components/Tabs/Tabs.styles.js +0 -268
- package/lib-commonjs/components/Tabs/Tabs.styles.js.map +0 -1
- package/lib-commonjs/components/Tabs/Tabs.types.d.ts +0 -113
- package/lib-commonjs/components/Tabs/Tabs.types.js +0 -3
- package/lib-commonjs/components/Tabs/Tabs.types.js.map +0 -1
- package/lib-commonjs/components/Tabs/index.d.ts +0 -5
- package/lib-commonjs/components/Tabs/index.js +0 -11
- package/lib-commonjs/components/Tabs/index.js.map +0 -1
- package/lib-commonjs/utilities/observeResize.d.ts +0 -21
- package/lib-commonjs/utilities/observeResize.js +0 -50
- package/lib-commonjs/utilities/observeResize.js.map +0 -1
- package/lib-commonjs/utilities/useOverflow.d.ts +0 -45
- package/lib-commonjs/utilities/useOverflow.js +0 -130
- package/lib-commonjs/utilities/useOverflow.js.map +0 -1
- package/src/components/Tabs/TabItem.types.ts +0 -69
- package/src/components/Tabs/Tabs.types.ts +0 -131
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useTabList_unstable } from './useTabList';
|
|
3
|
+
import { renderTabList_unstable } from './renderTabList';
|
|
4
|
+
import { useTabListStyles_unstable } from './useTabListStyles';
|
|
5
|
+
import { useTabListContextValues } from './useTabListContextValues';
|
|
6
|
+
/**
|
|
7
|
+
* A tab list provides single selection from a set of tabs.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export const TabList = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
11
|
+
const state = useTabList_unstable(props, ref);
|
|
12
|
+
const contextValues = useTabListContextValues(state);
|
|
13
|
+
useTabListStyles_unstable(state);
|
|
14
|
+
return renderTabList_unstable(state, contextValues);
|
|
15
|
+
});
|
|
16
|
+
TabList.displayName = 'TabList';
|
|
17
|
+
//# sourceMappingURL=TabList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/TabList/TabList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,mBAAT,QAAoC,cAApC;AACA,SAAS,sBAAT,QAAuC,iBAAvC;AACA,SAAS,yBAAT,QAA0C,oBAA1C;AAGA,SAAS,uBAAT,QAAwC,2BAAxC;AAEA;;AAEG;;AACH,OAAO,MAAM,OAAO,gBAAsC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACxF,QAAM,KAAK,GAAG,mBAAmB,CAAC,KAAD,EAAQ,GAAR,CAAjC;AACA,QAAM,aAAa,GAAG,uBAAuB,CAAC,KAAD,CAA7C;AAEA,EAAA,yBAAyB,CAAC,KAAD,CAAzB;AACA,SAAO,sBAAsB,CAAC,KAAD,EAAQ,aAAR,CAA7B;AACD,CANyD,CAAnD;AAQP,OAAO,CAAC,WAAR,GAAsB,SAAtB","sourcesContent":["import * as React from 'react';\nimport { useTabList_unstable } from './useTabList';\nimport { renderTabList_unstable } from './renderTabList';\nimport { useTabListStyles_unstable } from './useTabListStyles';\nimport type { TabListProps } from './TabList.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useTabListContextValues } from './useTabListContextValues';\n\n/**\n * A tab list provides single selection from a set of tabs.\n */\nexport const TabList: ForwardRefComponent<TabListProps> = React.forwardRef((props, ref) => {\n const state = useTabList_unstable(props, ref);\n const contextValues = useTabListContextValues(state);\n\n useTabListStyles_unstable(state);\n return renderTabList_unstable(state, contextValues);\n});\n\nTabList.displayName = 'TabList';\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
|
|
3
|
+
import { TabValue } from '../Tab/Tab.types';
|
|
4
|
+
export declare type TabRegisterData = {
|
|
5
|
+
/**
|
|
6
|
+
* The value of the tab.
|
|
7
|
+
*/
|
|
8
|
+
value: TabValue;
|
|
9
|
+
/**
|
|
10
|
+
* The reference to the tab HTML element.
|
|
11
|
+
*/
|
|
12
|
+
ref: React.RefObject<HTMLElement>;
|
|
13
|
+
};
|
|
14
|
+
export declare type RegisterTabEventHandler = (data: TabRegisterData) => void;
|
|
15
|
+
export declare type SelectTabData = {
|
|
16
|
+
/**
|
|
17
|
+
* The value of the selected tab.
|
|
18
|
+
*/
|
|
19
|
+
value: TabValue;
|
|
20
|
+
};
|
|
21
|
+
export declare type SelectTabEvent<E = HTMLElement> = React.MouseEvent<E> | React.KeyboardEvent<E>;
|
|
22
|
+
export declare type SelectTabEventHandler = (event: SelectTabEvent, data: SelectTabData) => void;
|
|
23
|
+
export declare type TabListSlots = {
|
|
24
|
+
/**
|
|
25
|
+
* The slot associated with the root element of this tab list.
|
|
26
|
+
*/
|
|
27
|
+
root: Slot<'div'>;
|
|
28
|
+
};
|
|
29
|
+
declare type TabListCommons = {
|
|
30
|
+
/**
|
|
31
|
+
* A tab list can supports 'transparent' and 'subtle' appearance.
|
|
32
|
+
*- 'subtle': Minimizes emphasis to blend into the background until hovered or focused.
|
|
33
|
+
*- 'transparent': No background and border styling
|
|
34
|
+
* The appearance affects each of the contained tabs.
|
|
35
|
+
* @default 'transparent'
|
|
36
|
+
*/
|
|
37
|
+
appearance?: 'transparent' | 'subtle';
|
|
38
|
+
/**
|
|
39
|
+
* A tab list can be set to disable interaction.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Raised when a tab is selected.
|
|
45
|
+
*/
|
|
46
|
+
onTabSelect?: SelectTabEventHandler;
|
|
47
|
+
/**
|
|
48
|
+
* The value of the currently selected tab.
|
|
49
|
+
*/
|
|
50
|
+
selectedValue?: TabValue;
|
|
51
|
+
/**
|
|
52
|
+
* A tab list can be either 'small' or 'medium' size.
|
|
53
|
+
* The size affects each of the contained tabs.
|
|
54
|
+
* @default 'medium'
|
|
55
|
+
*/
|
|
56
|
+
size?: 'small' | 'medium';
|
|
57
|
+
/**
|
|
58
|
+
* A tab list can arrange its tabs vertically.
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
vertical?: boolean;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* TabList Props
|
|
65
|
+
*/
|
|
66
|
+
export declare type TabListProps = ComponentProps<TabListSlots> & TabListCommons & {
|
|
67
|
+
/**
|
|
68
|
+
* The value of the tab to be selected by default.
|
|
69
|
+
* Typically useful when the selectedValue is uncontrolled.
|
|
70
|
+
*/
|
|
71
|
+
defaultSelectedValue?: TabValue;
|
|
72
|
+
};
|
|
73
|
+
export declare type TabListContextValue = Pick<TabListCommons, 'onTabSelect' | 'selectedValue'> & Required<Pick<TabListCommons, 'appearance' | 'disabled' | 'size' | 'vertical'>> & {
|
|
74
|
+
/** A callback to allow a tab to register itself with the tab list. */
|
|
75
|
+
onRegister: RegisterTabEventHandler;
|
|
76
|
+
/** A callback to allow a tab to unregister itself with the tab list. */
|
|
77
|
+
onUnregister: RegisterTabEventHandler;
|
|
78
|
+
/**
|
|
79
|
+
* A callback to allow a tab to select itself when pressed.
|
|
80
|
+
*/
|
|
81
|
+
onSelect: SelectTabEventHandler;
|
|
82
|
+
/**
|
|
83
|
+
* Gets the registered tab data along with current and previous selected values.
|
|
84
|
+
*/
|
|
85
|
+
getRegisteredTabs: () => {
|
|
86
|
+
selectedValue?: TabValue;
|
|
87
|
+
previousSelectedValue?: TabValue;
|
|
88
|
+
registeredTabs: Record<string, TabRegisterData>;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Context values used in rendering TabList.
|
|
93
|
+
*/
|
|
94
|
+
export declare type TabListContextValues = {
|
|
95
|
+
/**
|
|
96
|
+
* The context of the tab list available to each tab.
|
|
97
|
+
*/
|
|
98
|
+
tabList: TabListContextValue;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* State used in rendering TabList.
|
|
102
|
+
*/
|
|
103
|
+
export declare type TabListState = ComponentState<Required<TabListSlots>> & TabListContextValue;
|
|
104
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabList.types.js","sourceRoot":"../src/","sources":["components/TabList/TabList.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { TabValue } from '../Tab/Tab.types';\n\nexport type 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"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createContext } from '@fluentui/react-context-selector';
|
|
2
|
+
export const TabListContext = /*#__PURE__*/createContext({
|
|
3
|
+
appearance: 'transparent',
|
|
4
|
+
disabled: false,
|
|
5
|
+
selectedValue: undefined,
|
|
6
|
+
onRegister: () => {
|
|
7
|
+
/* noop */
|
|
8
|
+
},
|
|
9
|
+
onUnregister: () => {
|
|
10
|
+
/* noop */
|
|
11
|
+
},
|
|
12
|
+
onSelect: () => {
|
|
13
|
+
/* noop */
|
|
14
|
+
},
|
|
15
|
+
getRegisteredTabs: () => {
|
|
16
|
+
return {
|
|
17
|
+
registeredTabs: {}
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
size: 'medium',
|
|
21
|
+
vertical: false
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=TabListContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/TabList/TabListContext.ts"],"names":[],"mappings":"AAAA,SAAS,aAAT,QAA8B,kCAA9B;AAIA,OAAO,MAAM,cAAc,gBAAiC,aAAa,CAAsB;AAC7F,EAAA,UAAU,EAAE,aADiF;AAE7F,EAAA,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/"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/TabList/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './TabList';\nexport * from './TabList.types';\nexport * from './renderTabList';\nexport * from './useTabList';\nexport * from './useTabListStyles';\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getSlots } from '@fluentui/react-utilities';
|
|
3
|
+
import { TabListContext } from './TabListContext';
|
|
4
|
+
/**
|
|
5
|
+
* Render the final JSX of TabList
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export const renderTabList_unstable = (state, contextValues) => {
|
|
9
|
+
const {
|
|
10
|
+
slots,
|
|
11
|
+
slotProps
|
|
12
|
+
} = getSlots(state);
|
|
13
|
+
return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
|
|
14
|
+
}, /*#__PURE__*/React.createElement(TabListContext.Provider, {
|
|
15
|
+
value: contextValues.tabList
|
|
16
|
+
}, state.root.children));
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=renderTabList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/TabList/renderTabList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAEA,SAAS,cAAT,QAA+B,kBAA/B;AAEA;;AAEG;;AACH,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/"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { TabListProps, TabListState } from './TabList.types';
|
|
3
|
+
/**
|
|
4
|
+
* Create the state required to render TabList.
|
|
5
|
+
*
|
|
6
|
+
* The returned state can be modified with hooks such as useTabListStyles_unstable,
|
|
7
|
+
* before being passed to renderTabList_unstable.
|
|
8
|
+
*
|
|
9
|
+
* @param props - props from this instance of TabList
|
|
10
|
+
* @param ref - reference to root HTMLElement of TabList
|
|
11
|
+
*/
|
|
12
|
+
export declare const useTabList_unstable: (props: TabListProps, ref: React.Ref<HTMLElement>) => TabListState;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
3
|
+
import { getNativeElementProps, useControllableState, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';
|
|
4
|
+
/**
|
|
5
|
+
* Create the state required to render TabList.
|
|
6
|
+
*
|
|
7
|
+
* The returned state can be modified with hooks such as useTabListStyles_unstable,
|
|
8
|
+
* before being passed to renderTabList_unstable.
|
|
9
|
+
*
|
|
10
|
+
* @param props - props from this instance of TabList
|
|
11
|
+
* @param ref - reference to root HTMLElement of TabList
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export const useTabList_unstable = (props, ref) => {
|
|
15
|
+
const {
|
|
16
|
+
appearance = 'transparent',
|
|
17
|
+
disabled = false,
|
|
18
|
+
onTabSelect,
|
|
19
|
+
size = 'medium',
|
|
20
|
+
vertical = false
|
|
21
|
+
} = props;
|
|
22
|
+
const innerRef = React.useRef(null);
|
|
23
|
+
const focusAttributes = useArrowNavigationGroup({
|
|
24
|
+
circular: true,
|
|
25
|
+
axis: vertical ? 'vertical' : 'horizontal'
|
|
26
|
+
});
|
|
27
|
+
const [selectedValue, setSelectedValue] = useControllableState({
|
|
28
|
+
state: props.selectedValue,
|
|
29
|
+
defaultState: props.defaultSelectedValue,
|
|
30
|
+
initialState: undefined
|
|
31
|
+
}); // 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.
|
|
35
|
+
|
|
36
|
+
const currentSelectedValue = React.useRef(undefined);
|
|
37
|
+
const previousSelectedValue = React.useRef(undefined);
|
|
38
|
+
React.useEffect(() => {
|
|
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
|
+
});
|
|
46
|
+
const registeredTabs = React.useRef({});
|
|
47
|
+
const onRegister = useEventCallback(data => {
|
|
48
|
+
registeredTabs.current[JSON.stringify(data.value)] = data;
|
|
49
|
+
});
|
|
50
|
+
const onUnregister = useEventCallback(data => {
|
|
51
|
+
delete registeredTabs.current[JSON.stringify(data.value)];
|
|
52
|
+
});
|
|
53
|
+
const getRegisteredTabs = React.useCallback(() => {
|
|
54
|
+
return {
|
|
55
|
+
selectedValue: currentSelectedValue.current,
|
|
56
|
+
previousSelectedValue: previousSelectedValue.current,
|
|
57
|
+
registeredTabs: registeredTabs.current
|
|
58
|
+
};
|
|
59
|
+
}, []);
|
|
60
|
+
return {
|
|
61
|
+
components: {
|
|
62
|
+
root: 'div'
|
|
63
|
+
},
|
|
64
|
+
root: getNativeElementProps('div', {
|
|
65
|
+
ref: useMergedRefs(ref, innerRef),
|
|
66
|
+
role: 'tablist',
|
|
67
|
+
...focusAttributes,
|
|
68
|
+
...props
|
|
69
|
+
}),
|
|
70
|
+
appearance,
|
|
71
|
+
disabled,
|
|
72
|
+
selectedValue,
|
|
73
|
+
size,
|
|
74
|
+
vertical,
|
|
75
|
+
onRegister,
|
|
76
|
+
onUnregister,
|
|
77
|
+
onSelect,
|
|
78
|
+
getRegisteredTabs
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=useTabList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/TabList/useTabList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SA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M","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/"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function useTabListContextValues(state) {
|
|
2
|
+
const {
|
|
3
|
+
appearance,
|
|
4
|
+
disabled,
|
|
5
|
+
selectedValue: selectedKey,
|
|
6
|
+
onRegister,
|
|
7
|
+
onUnregister,
|
|
8
|
+
onSelect,
|
|
9
|
+
getRegisteredTabs,
|
|
10
|
+
size,
|
|
11
|
+
vertical
|
|
12
|
+
} = state;
|
|
13
|
+
const tabList = {
|
|
14
|
+
appearance,
|
|
15
|
+
disabled,
|
|
16
|
+
selectedValue: selectedKey,
|
|
17
|
+
onSelect,
|
|
18
|
+
onRegister,
|
|
19
|
+
onUnregister,
|
|
20
|
+
getRegisteredTabs,
|
|
21
|
+
size,
|
|
22
|
+
vertical
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
tabList
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=useTabListContextValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/TabList/useTabListContextValues.tsx"],"names":[],"mappings":"AAEA,OAAM,SAAU,uBAAV,CAAkC,KAAlC,EAAqD;AACzD,QAAM;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/"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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;
|
|
5
|
+
/**
|
|
6
|
+
* Apply styling to the TabList slots based on the state
|
|
7
|
+
*/
|
|
8
|
+
export declare const useTabListStyles_unstable: (state: TabListState) => TabListState;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { __styles, mergeClasses, shorthands } 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;
|
|
7
|
+
/**
|
|
8
|
+
* Styles for the root slot
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const useStyles = /*#__PURE__*/__styles({
|
|
12
|
+
"root": {
|
|
13
|
+
"mc9l5x": "f22iagw",
|
|
14
|
+
"Beiy3e4": "f1063pyq",
|
|
15
|
+
"Bnnss6s": "fi64zpg",
|
|
16
|
+
"Eh141a": "flvyvdh",
|
|
17
|
+
"B68tc82": "f1p9o1ba",
|
|
18
|
+
"Bmxbyg5": "f1sil6mw",
|
|
19
|
+
"qhf8xq": "f10pi13n"
|
|
20
|
+
},
|
|
21
|
+
"horizontal": {
|
|
22
|
+
"Bt984gj": "f1q9h2pe",
|
|
23
|
+
"Beiy3e4": "f1063pyq"
|
|
24
|
+
},
|
|
25
|
+
"vertical": {
|
|
26
|
+
"Bt984gj": "f1q9h2pe",
|
|
27
|
+
"Beiy3e4": "f1vx9l62"
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
"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;}", ".f1p9o1ba{overflow-x:hidden;}", ".f1sil6mw{overflow-y:hidden;}", ".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;}"]
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* Apply styling to the TabList slots based on the state
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
export const useTabListStyles_unstable = state => {
|
|
38
|
+
const {
|
|
39
|
+
vertical
|
|
40
|
+
} = state;
|
|
41
|
+
const styles = useStyles();
|
|
42
|
+
state.root.className = mergeClasses(tabListClassName, styles.root, vertical ? styles.vertical : styles.horizontal, state.root.className);
|
|
43
|
+
return state;
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=useTabListStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/TabList/useTabListStyles.ts"],"names":[],"mappings":"AACA,mBAAqB,YAArB,EAAmC,UAAnC,QAAqD,gBAArD;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAmBA;;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,CACjC,gBADiC,EAEjC,MAAM,CAAC,IAF0B,EAGjC,QAAQ,GAAG,MAAM,CAAC,QAAV,GAAqB,MAAM,CAAC,UAHH,EAIjC,KAAK,CAAC,IAAN,CAAW,SAJsB,CAAnC;AAOA,SAAO,KAAP;AACD,CAbM","sourcesContent":["import { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses, shorthands } 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 flexShrink: 0,\n flexWrap: 'nowrap',\n ...shorthands.overflow('hidden'),\n position: 'relative',\n },\n horizontal: {\n alignItems: 'stretch',\n flexDirection: 'row',\n },\n vertical: {\n alignItems: 'stretch',\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(\n tabListClassName,\n styles.root,\n vertical ? styles.vertical : styles.horizontal,\n state.root.className,\n );\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
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,2 +1,3 @@
|
|
|
1
|
-
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';
|
|
2
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/"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export declare const pendingContentSizeTokens: {
|
|
2
|
+
body1: {
|
|
3
|
+
fontSize: string;
|
|
4
|
+
fontWeight: string;
|
|
5
|
+
lineHeight: string;
|
|
6
|
+
};
|
|
7
|
+
body1Strong: {
|
|
8
|
+
fontSize: string;
|
|
9
|
+
fontWeight: string;
|
|
10
|
+
lineHeight: string;
|
|
11
|
+
};
|
|
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
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
|
10
|
+
},
|
|
11
|
+
body1Strong: {
|
|
12
|
+
fontSize: tokens.fontSizeBase300,
|
|
13
|
+
fontWeight: tokens.fontWeightSemibold,
|
|
14
|
+
lineHeight: tokens.lineHeightBase300
|
|
15
|
+
}
|
|
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.strokeW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C;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/"}
|
package/lib/tsdoc-metadata.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/Tab/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Tab.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Tab/index';\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/TabList/index';
|