@fluentui/react-tabs 9.11.1 → 9.12.0
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.md +25 -2
- package/dist/index.d.ts +39 -2
- package/lib/TabList.js +1 -1
- package/lib/TabList.js.map +1 -1
- package/lib/components/Tab/renderTab.js.map +1 -1
- package/lib/components/Tab/useTab.js +2 -2
- package/lib/components/Tab/useTab.js.map +1 -1
- package/lib/components/TabList/index.js +1 -1
- package/lib/components/TabList/index.js.map +1 -1
- package/lib/components/TabList/renderTabList.js.map +1 -1
- package/lib/components/TabList/useTabList.js +2 -2
- package/lib/components/TabList/useTabList.js.map +1 -1
- package/lib/index.js +2 -6
- package/lib/index.js.map +1 -1
- package/lib-commonjs/TabList.js +3 -0
- package/lib-commonjs/TabList.js.map +1 -1
- package/lib-commonjs/components/Tab/renderTab.js.map +1 -1
- package/lib-commonjs/components/Tab/useTab.js +2 -2
- package/lib-commonjs/components/Tab/useTab.js.map +1 -1
- package/lib-commonjs/components/TabList/index.js +3 -3
- package/lib-commonjs/components/TabList/index.js.map +1 -1
- package/lib-commonjs/components/TabList/renderTabList.js.map +1 -1
- package/lib-commonjs/components/TabList/useTabList.js +2 -2
- package/lib-commonjs/components/TabList/useTabList.js.map +1 -1
- package/lib-commonjs/index.js +9 -5
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-tabs
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 01 Apr 2026 15:50:22 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.12.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabs_v9.12.0)
|
|
8
|
+
|
|
9
|
+
Wed, 01 Apr 2026 15:50:22 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabs_v9.11.2..@fluentui/react-tabs_v9.12.0)
|
|
11
|
+
|
|
12
|
+
### Minor changes
|
|
13
|
+
|
|
14
|
+
- feat: expose base hooks for Tab and TabList ([PR #35902](https://github.com/microsoft/fluentui/pull/35902) by dmytrokirpa@microsoft.com)
|
|
15
|
+
|
|
16
|
+
## [9.11.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabs_v9.11.2)
|
|
17
|
+
|
|
18
|
+
Wed, 25 Feb 2026 13:32:26 GMT
|
|
19
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabs_v9.11.1..@fluentui/react-tabs_v9.11.2)
|
|
20
|
+
|
|
21
|
+
### Patches
|
|
22
|
+
|
|
23
|
+
- fix: tabster attributes should be overridable on Tabs ([PR #35782](https://github.com/microsoft/fluentui/pull/35782) by olfedias@microsoft.com)
|
|
24
|
+
- Bump @fluentui/react-context-selector to v9.2.15 ([PR #35782](https://github.com/microsoft/fluentui/pull/35782) by beachball)
|
|
25
|
+
- Bump @fluentui/react-jsx-runtime to v9.4.1 ([PR #35782](https://github.com/microsoft/fluentui/pull/35782) by beachball)
|
|
26
|
+
- Bump @fluentui/react-shared-contexts to v9.26.2 ([PR #35782](https://github.com/microsoft/fluentui/pull/35782) by beachball)
|
|
27
|
+
- Bump @fluentui/react-tabster to v9.26.13 ([PR #35782](https://github.com/microsoft/fluentui/pull/35782) by beachball)
|
|
28
|
+
- Bump @fluentui/react-utilities to v9.26.2 ([PR #35782](https://github.com/microsoft/fluentui/pull/35782) by beachball)
|
|
29
|
+
|
|
7
30
|
## [9.11.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabs_v9.11.1)
|
|
8
31
|
|
|
9
|
-
Thu, 12 Feb 2026 10:
|
|
32
|
+
Thu, 12 Feb 2026 10:46:15 GMT
|
|
10
33
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabs_v9.11.0..@fluentui/react-tabs_v9.11.1)
|
|
11
34
|
|
|
12
35
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -9,18 +9,19 @@ import { ProviderProps } from 'react';
|
|
|
9
9
|
import * as React_2 from 'react';
|
|
10
10
|
import type { Slot } from '@fluentui/react-utilities';
|
|
11
11
|
import { SlotClassNames } from '@fluentui/react-utilities';
|
|
12
|
+
import { TabsterDOMAttribute } from '@fluentui/react-tabster';
|
|
12
13
|
|
|
13
14
|
export declare type RegisterTabEventHandler = (data: TabRegisterData) => void;
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Render the final JSX of Tab
|
|
17
18
|
*/
|
|
18
|
-
export declare const renderTab_unstable: (state:
|
|
19
|
+
export declare const renderTab_unstable: (state: TabBaseState) => JSXElement;
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Render the final JSX of TabList
|
|
22
23
|
*/
|
|
23
|
-
export declare const renderTabList_unstable: (state:
|
|
24
|
+
export declare const renderTabList_unstable: (state: TabListBaseState, contextValues: TabListContextValues) => JSXElement;
|
|
24
25
|
|
|
25
26
|
export declare type SelectTabData = {
|
|
26
27
|
/**
|
|
@@ -38,6 +39,10 @@ export declare type SelectTabEventHandler = (event: SelectTabEvent, data: Select
|
|
|
38
39
|
*/
|
|
39
40
|
export declare const Tab: ForwardRefComponent<TabProps>;
|
|
40
41
|
|
|
42
|
+
declare type TabBaseProps = Omit<TabProps, 'contentReservedSpace'>;
|
|
43
|
+
|
|
44
|
+
declare type TabBaseState = Omit<TabState, 'appearance' | 'size' | 'contentReservedSpace'>;
|
|
45
|
+
|
|
41
46
|
export declare const tabClassNames: SlotClassNames<TabSlots>;
|
|
42
47
|
|
|
43
48
|
declare type TabInternalSlots = TabSlots & {
|
|
@@ -49,6 +54,10 @@ declare type TabInternalSlots = TabSlots & {
|
|
|
49
54
|
*/
|
|
50
55
|
export declare const TabList: ForwardRefComponent<TabListProps>;
|
|
51
56
|
|
|
57
|
+
export declare type TabListBaseProps = Omit<TabListProps, 'appearance' | 'size' | 'reserveSelectedTabSpace'>;
|
|
58
|
+
|
|
59
|
+
export declare type TabListBaseState = Omit<TabListState, 'appearance' | 'size' | 'reserveSelectedTabSpace'>;
|
|
60
|
+
|
|
52
61
|
export declare const tabListClassNames: SlotClassNames<TabListSlots>;
|
|
53
62
|
|
|
54
63
|
export declare type TabListContextValue = Pick<TabListProps, 'onTabSelect' | 'selectTabOnFocus' | 'selectedValue' | 'reserveSelectedTabSpace'> & Required<Pick<TabListProps, 'appearance' | 'disabled' | 'size' | 'vertical'>> & {
|
|
@@ -253,6 +262,14 @@ export declare const useTab_unstable: (props: TabProps, ref: React_2.Ref<HTMLEle
|
|
|
253
262
|
*/
|
|
254
263
|
export declare const useTabAnimatedIndicatorStyles_unstable: (state: TabState) => TabState;
|
|
255
264
|
|
|
265
|
+
/**
|
|
266
|
+
* Create the based state required to render Tab without design specifics and focus attributes.
|
|
267
|
+
*
|
|
268
|
+
* @param props - props from this instance of Tab
|
|
269
|
+
* @param ref - reference to root HTMLElement of Tab
|
|
270
|
+
*/
|
|
271
|
+
export declare const useTabBase_unstable: (props: TabBaseProps, ref: React_2.Ref<HTMLElement>) => TabBaseState;
|
|
272
|
+
|
|
256
273
|
/**
|
|
257
274
|
* Applies styles to the Tab button slot based on its current state.
|
|
258
275
|
*
|
|
@@ -298,6 +315,26 @@ export declare const useTabIndicatorStyles_unstable: (state: TabState) => TabSta
|
|
|
298
315
|
*/
|
|
299
316
|
export declare const useTabList_unstable: (props: TabListProps, ref: React_2.Ref<HTMLElement>) => TabListState;
|
|
300
317
|
|
|
318
|
+
/**
|
|
319
|
+
* Hook to get accessibility attributes for TabList component, such as roving tab index.
|
|
320
|
+
* Based on Tabster's useArrowNavigationGroup.
|
|
321
|
+
*
|
|
322
|
+
* @param vertical - whether the TabList is vertical
|
|
323
|
+
* @returns Tabster DOM attributes
|
|
324
|
+
*/
|
|
325
|
+
export declare const useTabListA11yBehavior_unstable: ({ vertical, }: Pick<TabListBaseState, "vertical">) => TabsterDOMAttribute;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Create the state required to render TabList.
|
|
329
|
+
*
|
|
330
|
+
* The returned state can be modified with hooks such as useTabListStyles_unstable,
|
|
331
|
+
* before being passed to renderTabList_unstable.
|
|
332
|
+
*
|
|
333
|
+
* @param props - props from this instance of TabList
|
|
334
|
+
* @param ref - reference to root HTMLElement of TabList
|
|
335
|
+
*/
|
|
336
|
+
export declare const useTabListBase_unstable: (props: TabListBaseProps, ref: React_2.Ref<HTMLElement>) => TabListBaseState;
|
|
337
|
+
|
|
301
338
|
export declare const useTabListContext_unstable: <T>(selector: ContextSelector<TabListContextValue, T>) => T;
|
|
302
339
|
|
|
303
340
|
export declare function useTabListContextValues_unstable(state: TabListState): TabListContextValues;
|
package/lib/TabList.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { TabList, TabListContext, TabListProvider, renderTabList_unstable, tabListClassNames, useTabListContextValues_unstable, useTabListContext_unstable, useTabListStyles_unstable, useTabList_unstable, useTabListBase_unstable } from './components/TabList/index';
|
|
1
|
+
export { TabList, TabListContext, TabListProvider, renderTabList_unstable, tabListClassNames, useTabListContextValues_unstable, useTabListContext_unstable, useTabListStyles_unstable, useTabList_unstable, useTabListBase_unstable, useTabListA11yBehavior_unstable } from './components/TabList/index';
|
package/lib/TabList.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/TabList.ts"],"sourcesContent":["export type {\n RegisterTabEventHandler,\n SelectTabData,\n SelectTabEvent,\n SelectTabEventHandler,\n TabListContextValue,\n TabListContextValues,\n TabListBaseProps,\n TabListProps,\n TabListSlots,\n TabListBaseState,\n TabListState,\n TabRegisterData,\n} from './components/TabList/index';\nexport {\n TabList,\n TabListContext,\n TabListProvider,\n renderTabList_unstable,\n tabListClassNames,\n useTabListContextValues_unstable,\n useTabListContext_unstable,\n useTabListStyles_unstable,\n useTabList_unstable,\n useTabListBase_unstable,\n} from './components/TabList/index';\n"],"names":["TabList","TabListContext","TabListProvider","renderTabList_unstable","tabListClassNames","useTabListContextValues_unstable","useTabListContext_unstable","useTabListStyles_unstable","useTabList_unstable","useTabListBase_unstable"],"mappings":"AAcA,SACEA,OAAO,EACPC,cAAc,EACdC,eAAe,EACfC,sBAAsB,EACtBC,iBAAiB,EACjBC,gCAAgC,EAChCC,0BAA0B,EAC1BC,yBAAyB,EACzBC,mBAAmB,EACnBC,uBAAuB,
|
|
1
|
+
{"version":3,"sources":["../src/TabList.ts"],"sourcesContent":["export type {\n RegisterTabEventHandler,\n SelectTabData,\n SelectTabEvent,\n SelectTabEventHandler,\n TabListContextValue,\n TabListContextValues,\n TabListBaseProps,\n TabListProps,\n TabListSlots,\n TabListBaseState,\n TabListState,\n TabRegisterData,\n} from './components/TabList/index';\nexport {\n TabList,\n TabListContext,\n TabListProvider,\n renderTabList_unstable,\n tabListClassNames,\n useTabListContextValues_unstable,\n useTabListContext_unstable,\n useTabListStyles_unstable,\n useTabList_unstable,\n useTabListBase_unstable,\n useTabListA11yBehavior_unstable,\n} from './components/TabList/index';\n"],"names":["TabList","TabListContext","TabListProvider","renderTabList_unstable","tabListClassNames","useTabListContextValues_unstable","useTabListContext_unstable","useTabListStyles_unstable","useTabList_unstable","useTabListBase_unstable","useTabListA11yBehavior_unstable"],"mappings":"AAcA,SACEA,OAAO,EACPC,cAAc,EACdC,eAAe,EACfC,sBAAsB,EACtBC,iBAAiB,EACjBC,gCAAgC,EAChCC,0BAA0B,EAC1BC,yBAAyB,EACzBC,mBAAmB,EACnBC,uBAAuB,EACvBC,+BAA+B,QAC1B,6BAA6B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Tab/renderTab.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/Tab/renderTab.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { TabBaseState, TabInternalSlots } from './Tab.types';\n\n/**\n * Render the final JSX of Tab\n */\nexport const renderTab_unstable = (state: TabBaseState): JSXElement => {\n assertSlots<TabInternalSlots>(state);\n\n return (\n <state.root>\n {state.icon && <state.icon />}\n {!state.iconOnly && <state.content />}\n {state.contentReservedSpace && <state.contentReservedSpace />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderTab_unstable","state","root","icon","iconOnly","content","contentReservedSpace"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AAIxD;;CAEC,GACD,OAAO,MAAMC,qBAAqB,CAACC;IACjCF,YAA8BE;IAE9B,qBACE,MAACA,MAAMC,IAAI;;YACRD,MAAME,IAAI,kBAAI,KAACF,MAAME,IAAI;YACzB,CAACF,MAAMG,QAAQ,kBAAI,KAACH,MAAMI,OAAO;YACjCJ,MAAMK,oBAAoB,kBAAI,KAACL,MAAMK,oBAAoB;;;AAGhE,EAAE"}
|
|
@@ -32,8 +32,8 @@ import { useTabListContext_unstable } from '../TabList';
|
|
|
32
32
|
contentReservedSpace: 'span'
|
|
33
33
|
},
|
|
34
34
|
root: {
|
|
35
|
-
...
|
|
36
|
-
...
|
|
35
|
+
...focusAttributes,
|
|
36
|
+
...state.root
|
|
37
37
|
},
|
|
38
38
|
contentReservedSpace: slot.optional(contentReservedSpace, {
|
|
39
39
|
renderByDefault: !state.selected && !state.iconOnly && reserveSelectedTabSpace,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Tab/useTab.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { type TabsterDOMAttribute, useTabsterAttributes } from '@fluentui/react-tabster';\nimport { mergeCallbacks, useEventCallback, useMergedRefs, slot, omit } from '@fluentui/react-utilities';\nimport type { TabProps, TabState, TabBaseProps, TabBaseState } from './Tab.types';\nimport { useTabListContext_unstable } from '../TabList';\nimport type { SelectTabEvent } from '../TabList';\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 } = props;\n\n const state = useTabBase_unstable(props, ref);\n const focusAttributes = useTabA11yBehavior_unstable(state);\n\n const appearance = useTabListContext_unstable(ctx => ctx.appearance);\n const reserveSelectedTabSpace = useTabListContext_unstable(ctx => ctx.reserveSelectedTabSpace);\n const size = useTabListContext_unstable(ctx => ctx.size ?? 'medium');\n\n const contentReservedSpace: typeof content =\n content && typeof content === 'object' ? omit(content, ['ref' as keyof typeof content]) : content;\n\n return {\n ...state,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n components: { ...state.components, contentReservedSpace: 'span' },\n root: {\n ...
|
|
1
|
+
{"version":3,"sources":["../src/components/Tab/useTab.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { type TabsterDOMAttribute, useTabsterAttributes } from '@fluentui/react-tabster';\nimport { mergeCallbacks, useEventCallback, useMergedRefs, slot, omit } from '@fluentui/react-utilities';\nimport type { TabProps, TabState, TabBaseProps, TabBaseState } from './Tab.types';\nimport { useTabListContext_unstable } from '../TabList';\nimport type { SelectTabEvent } from '../TabList';\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 } = props;\n\n const state = useTabBase_unstable(props, ref);\n const focusAttributes = useTabA11yBehavior_unstable(state);\n\n const appearance = useTabListContext_unstable(ctx => ctx.appearance);\n const reserveSelectedTabSpace = useTabListContext_unstable(ctx => ctx.reserveSelectedTabSpace);\n const size = useTabListContext_unstable(ctx => ctx.size ?? 'medium');\n\n const contentReservedSpace: typeof content =\n content && typeof content === 'object' ? omit(content, ['ref' as keyof typeof content]) : content;\n\n return {\n ...state,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n components: { ...state.components, contentReservedSpace: 'span' },\n root: {\n ...focusAttributes,\n ...state.root,\n },\n contentReservedSpace: slot.optional(contentReservedSpace, {\n renderByDefault: !state.selected && !state.iconOnly && reserveSelectedTabSpace,\n defaultProps: { children: props.children },\n elementType: 'span',\n }),\n appearance,\n size,\n };\n};\n\n/**\n * Create the based state required to render Tab without design specifics and focus attributes.\n *\n * @param props - props from this instance of Tab\n * @param ref - reference to root HTMLElement of Tab\n */\nexport const useTabBase_unstable = (props: TabBaseProps, ref: React.Ref<HTMLElement>): TabBaseState => {\n const { content, disabled: tabDisabled = false, icon, onClick, onFocus, value, ...rest } = props;\n\n const selectTabOnFocus = useTabListContext_unstable(ctx => ctx.selectTabOnFocus);\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 vertical = useTabListContext_unstable(ctx => !!ctx.vertical);\n const disabled = listDisabled || tabDisabled;\n\n const innerRef = React.useRef<HTMLElement>(null);\n const onSelectCallback = (event: SelectTabEvent) => onSelect(event, { value });\n const onTabClick = useEventCallback(mergeCallbacks(onClick, onSelectCallback));\n const onTabFocus = useEventCallback(mergeCallbacks(onFocus, onSelectCallback));\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 iconSlot = slot.optional(icon, { elementType: 'span' });\n const contentSlot = slot.always(content, {\n defaultProps: { children: props.children },\n elementType: 'span',\n });\n const iconOnly = Boolean(iconSlot?.children && !contentSlot.children);\n return {\n components: { root: 'button', icon: 'span', content: 'span', contentReservedSpace: 'span' },\n root: slot.always(\n {\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}` as 'true' | 'false'),\n value,\n ...rest,\n disabled,\n onClick: onTabClick,\n onFocus: selectTabOnFocus ? onTabFocus : onFocus,\n },\n { elementType: 'button' },\n ) as TabBaseState['root'],\n icon: iconSlot,\n iconOnly,\n content: contentSlot,\n disabled,\n selected,\n value,\n vertical,\n };\n};\n\n/**\n * Hook to return a11y attributes to a Tab based on selected state.\n * Should be applied on the button with role=\"tab\".\n *\n * @param selected - whether the Tab is selected\n * @returns Tabster DOM attributes\n */\nexport const useTabA11yBehavior_unstable = ({ selected }: Pick<TabBaseState, 'selected'>): TabsterDOMAttribute => {\n return useTabsterAttributes({\n focusable: { isDefault: selected },\n });\n};\n"],"names":["React","useTabsterAttributes","mergeCallbacks","useEventCallback","useMergedRefs","slot","omit","useTabListContext_unstable","useTab_unstable","props","ref","content","state","useTabBase_unstable","focusAttributes","useTabA11yBehavior_unstable","appearance","ctx","reserveSelectedTabSpace","size","contentReservedSpace","components","root","optional","renderByDefault","selected","iconOnly","defaultProps","children","elementType","disabled","tabDisabled","icon","onClick","onFocus","value","rest","selectTabOnFocus","listDisabled","selectedValue","onRegister","onUnregister","onSelect","vertical","innerRef","useRef","onSelectCallback","event","onTabClick","onTabFocus","useEffect","iconSlot","contentSlot","always","Boolean","role","type","undefined","focusable","isDefault"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAAmCC,oBAAoB,QAAQ,0BAA0B;AACzF,SA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KkC;YACxBW,MAAM;YACNC,MAAM;YACN,yDAAyD;YACzD,iEAAiE;YACjE,iBAAiB1B,WAAW2B,YAAa,GAAGhC,UAAU;YACtDU;YACA,GAAGC,IAAI;YACPN;YACAG,SAASe;YACTd,SAASG,mBAAmBY,aAAaf;QAC3C,GACA;YAAEL,aAAa;QAAS;QAE1BG,MAAMmB;QACNzB;QACAf,SAASyC;QACTtB;QACAL;QACAU;QACAQ;IACF;AACF,EAAE;AAEF;;;;;;CAMC,GACD,OAAO,MAAM5B,8BAA8B,CAAC,EAAEU,QAAQ,EAAkC;IACtF,OAAOxB,qBAAqB;QAC1ByD,WAAW;YAAEC,WAAWlC;QAAS;IACnC;AACF,EAAE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { TabList } from './TabList';
|
|
2
2
|
export { TabListContext, TabListProvider, useTabListContext_unstable } from './TabListContext';
|
|
3
3
|
export { renderTabList_unstable } from './renderTabList';
|
|
4
|
-
export { useTabList_unstable, useTabListBase_unstable, useTabListA11yBehavior_unstable
|
|
4
|
+
export { useTabList_unstable, useTabListBase_unstable, useTabListA11yBehavior_unstable } from './useTabList';
|
|
5
5
|
export { useTabListContextValues_unstable } from './useTabListContextValues';
|
|
6
6
|
export { tabListClassNames, useTabListStyles_unstable } from './useTabListStyles.styles';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TabList/index.ts"],"sourcesContent":["export { TabList } from './TabList';\nexport type {\n RegisterTabEventHandler,\n SelectTabData,\n SelectTabEvent,\n SelectTabEventHandler,\n TabListContextValue,\n TabListContextValues,\n TabListBaseProps,\n TabListProps,\n TabListSlots,\n TabListBaseState,\n TabListState,\n TabRegisterData,\n} from './TabList.types';\nexport { TabListContext, TabListProvider, useTabListContext_unstable } from './TabListContext';\nexport { renderTabList_unstable } from './renderTabList';\nexport {
|
|
1
|
+
{"version":3,"sources":["../src/components/TabList/index.ts"],"sourcesContent":["export { TabList } from './TabList';\nexport type {\n RegisterTabEventHandler,\n SelectTabData,\n SelectTabEvent,\n SelectTabEventHandler,\n TabListContextValue,\n TabListContextValues,\n TabListBaseProps,\n TabListProps,\n TabListSlots,\n TabListBaseState,\n TabListState,\n TabRegisterData,\n} from './TabList.types';\nexport { TabListContext, TabListProvider, useTabListContext_unstable } from './TabListContext';\nexport { renderTabList_unstable } from './renderTabList';\nexport { useTabList_unstable, useTabListBase_unstable, useTabListA11yBehavior_unstable } from './useTabList';\nexport { useTabListContextValues_unstable } from './useTabListContextValues';\nexport { tabListClassNames, useTabListStyles_unstable } from './useTabListStyles.styles';\n"],"names":["TabList","TabListContext","TabListProvider","useTabListContext_unstable","renderTabList_unstable","useTabList_unstable","useTabListBase_unstable","useTabListA11yBehavior_unstable","useTabListContextValues_unstable","tabListClassNames","useTabListStyles_unstable"],"mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY;AAepC,SAASC,cAAc,EAAEC,eAAe,EAAEC,0BAA0B,QAAQ,mBAAmB;AAC/F,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,mBAAmB,EAAEC,uBAAuB,EAAEC,+BAA+B,QAAQ,eAAe;AAC7G,SAASC,gCAAgC,QAAQ,4BAA4B;AAC7E,SAASC,iBAAiB,EAAEC,yBAAyB,QAAQ,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TabList/renderTabList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/TabList/renderTabList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { TabListBaseState, TabListSlots, TabListContextValues } from './TabList.types';\nimport { TabListProvider } from './TabListContext';\n\n/**\n * Render the final JSX of TabList\n */\nexport const renderTabList_unstable = (state: TabListBaseState, contextValues: TabListContextValues): JSXElement => {\n assertSlots<TabListSlots>(state);\n\n return (\n <state.root>\n <TabListProvider value={contextValues.tabList}>{state.root.children}</TabListProvider>\n </state.root>\n );\n};\n"],"names":["assertSlots","TabListProvider","renderTabList_unstable","state","contextValues","root","value","tabList","children"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD,SAASC,eAAe,QAAQ,mBAAmB;AAEnD;;CAEC,GACD,OAAO,MAAMC,yBAAyB,CAACC,OAAyBC;IAC9DJ,YAA0BG;IAE1B,qBACE,KAACA,MAAME,IAAI;kBACT,cAAA,KAACJ;YAAgBK,OAAOF,cAAcG,OAAO;sBAAGJ,MAAME,IAAI,CAACG,QAAQ;;;AAGzE,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TabList/useTabList.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { type TabsterDOMAttribute, useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { useControllableState, useEventCallback, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport type {\n TabRegisterData,\n SelectTabData,\n SelectTabEvent,\n TabListBaseProps,\n TabListBaseState,\n TabListProps,\n TabListState,\n} from './TabList.types';\nimport type { TabValue } from '../Tab';\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', reserveSelectedTabSpace = true, size = 'medium' } = props;\n const state = useTabListBase_unstable(props, ref);\n const focusAttributes = useTabListA11yBehavior_unstable({ vertical: state.vertical });\n\n return {\n ...state,\n root: {\n ...
|
|
1
|
+
{"version":3,"sources":["../src/components/TabList/useTabList.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { type TabsterDOMAttribute, useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { useControllableState, useEventCallback, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport type {\n TabRegisterData,\n SelectTabData,\n SelectTabEvent,\n TabListBaseProps,\n TabListBaseState,\n TabListProps,\n TabListState,\n} from './TabList.types';\nimport type { TabValue } from '../Tab';\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', reserveSelectedTabSpace = true, size = 'medium' } = props;\n const state = useTabListBase_unstable(props, ref);\n const focusAttributes = useTabListA11yBehavior_unstable({ vertical: state.vertical });\n\n return {\n ...state,\n root: {\n ...focusAttributes,\n ...state.root,\n },\n appearance,\n reserveSelectedTabSpace,\n size,\n };\n};\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 useTabListBase_unstable = (props: TabListBaseProps, ref: React.Ref<HTMLElement>): TabListBaseState => {\n const {\n disabled = false,\n onTabSelect,\n selectTabOnFocus = false,\n vertical = false,\n selectedValue: controlledSelectedValue,\n defaultSelectedValue,\n ...rest\n } = props;\n\n const innerRef = React.useRef<HTMLElement>(null);\n\n const [selectedValue, setSelectedValue] = useControllableState({\n state: controlledSelectedValue,\n defaultState: 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 const key = JSON.stringify(data.value);\n\n if (!key && process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error(\n [\n `[@fluentui/react-tabs] The value \"${data.value}\" cannot be serialized to JSON string.`,\n 'Tab component requires serializable values.',\n 'Please provide a primitive value (string, number, boolean),',\n `or a plain object/array that doesn't contain functions, symbols, or circular references.`,\n ].join(' '),\n );\n }\n\n registeredTabs.current[key] = 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: slot.always(\n {\n ref: useMergedRefs(ref, innerRef) as React.Ref<HTMLDivElement>,\n role: 'tablist',\n 'aria-orientation': vertical ? 'vertical' : 'horizontal',\n ...rest,\n },\n { elementType: 'div' },\n ),\n disabled,\n selectTabOnFocus,\n selectedValue,\n onRegister,\n onUnregister,\n onSelect,\n getRegisteredTabs,\n vertical,\n };\n};\n\n/**\n * Hook to get accessibility attributes for TabList component, such as roving tab index.\n * Based on Tabster's useArrowNavigationGroup.\n *\n * @param vertical - whether the TabList is vertical\n * @returns Tabster DOM attributes\n */\nexport const useTabListA11yBehavior_unstable = ({\n vertical,\n}: Pick<TabListBaseState, 'vertical'>): TabsterDOMAttribute => {\n return useArrowNavigationGroup({\n circular: true,\n axis: vertical ? 'vertical' : 'horizontal',\n memorizeCurrent: false,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_hasDefault: true,\n });\n};\n"],"names":["React","useArrowNavigationGroup","useControllableState","useEventCallback","useMergedRefs","slot","useTabList_unstable","props","ref","appearance","reserveSelectedTabSpace","size","state","useTabListBase_unstable","focusAttributes","useTabListA11yBehavior_unstable","vertical","root","disabled","onTabSelect","selectTabOnFocus","selectedValue","controlledSelectedValue","defaultSelectedValue","rest","innerRef","useRef","setSelectedValue","defaultState","initialState","undefined","currentSelectedValue","previousSelectedValue","useEffect","current","onSelect","event","data","value","registeredTabs","onRegister","key","JSON","stringify","process","env","NODE_ENV","console","error","join","onUnregister","getRegisteredTabs","useCallback","components","always","role","elementType","circular","axis","memorizeCurrent","unstable_hasDefault"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAAmCC,uBAAuB,QAAQ,0BAA0B;AAC5F,SAASC,oBAAoB,EAAEC,gBAAgB,EAAEC,aAAa,EAAEC,IAAI,QAAQ,4BAA4B;AAYxG;;;;;;;;CAQC,GACD,OAAO,MAAMC,sBAAsB,CAACC,OAAqBC;IACvD,MAAM,EAAEC,aAAa,aAAa,EAAEC,0BAA0B,IAAI,EAAEC,OAAO,QAAQ,EAAE,GAAGJ;IACxF,MAAMK,QAAQC,wBAAwBN,OAAOC;IAC7C,MAAMM,kBAAkBC,gCAAgC;QAAEC,UAAUJ,MAAMI,QAAQ;IAAC;IAEnF,OAAO;QACL,GAAGJ,KAAK;QACRK,MAAM;YACJ,GAAGH,eAAe;YAClB,GAAGF,MAAMK,IAAI;QACf;QACAR;QACAC;QACAC;IACF;AACF,EAAE;AAEF;;;;;;;;CAQC,GACD,OAAO,MAAME,0BAA0B,CAACN,OAAyBC;IAC/D,MAAM,EACJU,WAAW,KAAK,EAChBC,WAAW,EACXC,mBAAmB,KAAK,EACxBJ,WAAW,KAAK,EAChBK,eAAeC,uBAAuB,EACtC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BA,sBAAsBE,OAAO;YACpDK,gBAAgBA,eAAeL,OAAO;QACxC;IACF,GAAG,EAAE;IAEL,OAAO;QACLmB,YAAY;YACVpC,MAAM;QACR;QACAA,MAAMZ,KAAKiD,MAAM,CACf;YACE9C,KAAKJ,cAAcI,KAAKiB;YACxB8B,MAAM;YACN,oBAAoBvC,WAAW,aAAa;YAC5C,GAAGQ,IAAI;QACT,GACA;YAAEgC,aAAa;QAAM;QAEvBtC;QACAE;QACAC;QACAmB;QACAU;QACAf;QACAgB;QACAnC;IACF;AACF,EAAE;AAEF;;;;;;CAMC,GACD,OAAO,MAAMD,kCAAkC,CAAC,EAC9CC,QAAQ,EAC2B;IACnC,OAAOf,wBAAwB;QAC7BwD,UAAU;QACVC,MAAM1C,WAAW,aAAa;QAC9B2C,iBAAiB;QACjB,gEAAgE;QAChEC,qBAAqB;IACvB;AACF,EAAE"}
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
export { renderTab_unstable, Tab, tabClassNames, tabReservedSpaceClassNames, useTabAnimatedIndicatorStyles_unstable, useTabButtonStyles_unstable, useTabContentStyles_unstable, useTabIndicatorStyles_unstable, useTabStyles_unstable, useTab_unstable } from './Tab';
|
|
2
|
-
export { renderTabList_unstable, TabList, TabListProvider, tabListClassNames, useTabListContext_unstable, useTabListContextValues_unstable, useTabListStyles_unstable, useTabList_unstable } from './TabList';
|
|
3
|
-
// export type { TabBaseProps, TabBaseState } from './Tab';
|
|
4
|
-
// export { useTabBase_unstable, useTabA11yBehavior_unstable } from './Tab';
|
|
5
|
-
// export type { TabListBaseProps, TabListBaseState } from './TabList';
|
|
6
|
-
// export { useTabListBase_unstable, useTabListA11yBehavior_unstable } from './TabList';
|
|
1
|
+
export { renderTab_unstable, Tab, tabClassNames, tabReservedSpaceClassNames, useTabAnimatedIndicatorStyles_unstable, useTabButtonStyles_unstable, useTabContentStyles_unstable, useTabIndicatorStyles_unstable, useTabStyles_unstable, useTab_unstable, useTabBase_unstable } from './Tab';
|
|
2
|
+
export { renderTabList_unstable, TabList, TabListProvider, tabListClassNames, useTabListContext_unstable, useTabListContextValues_unstable, useTabListStyles_unstable, useTabList_unstable, useTabListA11yBehavior_unstable, useTabListBase_unstable } from './TabList';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type { TabProps, TabSlots, TabState, TabValue } from './Tab';\nexport {\n renderTab_unstable,\n Tab,\n tabClassNames,\n tabReservedSpaceClassNames,\n useTabAnimatedIndicatorStyles_unstable,\n useTabButtonStyles_unstable,\n useTabContentStyles_unstable,\n useTabIndicatorStyles_unstable,\n useTabStyles_unstable,\n useTab_unstable,\n} 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 TabListProvider,\n tabListClassNames,\n useTabListContext_unstable,\n useTabListContextValues_unstable,\n useTabListStyles_unstable,\n useTabList_unstable,\n
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type { TabProps, TabSlots, TabState, TabValue } from './Tab';\nexport {\n renderTab_unstable,\n Tab,\n tabClassNames,\n tabReservedSpaceClassNames,\n useTabAnimatedIndicatorStyles_unstable,\n useTabButtonStyles_unstable,\n useTabContentStyles_unstable,\n useTabIndicatorStyles_unstable,\n useTabStyles_unstable,\n useTab_unstable,\n useTabBase_unstable,\n} 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 TabListBaseProps,\n TabListBaseState,\n} from './TabList';\nexport {\n renderTabList_unstable,\n TabList,\n TabListProvider,\n tabListClassNames,\n useTabListContext_unstable,\n useTabListContextValues_unstable,\n useTabListStyles_unstable,\n useTabList_unstable,\n useTabListA11yBehavior_unstable,\n useTabListBase_unstable,\n} from './TabList';\n"],"names":["renderTab_unstable","Tab","tabClassNames","tabReservedSpaceClassNames","useTabAnimatedIndicatorStyles_unstable","useTabButtonStyles_unstable","useTabContentStyles_unstable","useTabIndicatorStyles_unstable","useTabStyles_unstable","useTab_unstable","useTabBase_unstable","renderTabList_unstable","TabList","TabListProvider","tabListClassNames","useTabListContext_unstable","useTabListContextValues_unstable","useTabListStyles_unstable","useTabList_unstable","useTabListA11yBehavior_unstable","useTabListBase_unstable"],"mappings":"AACA,SACEA,kBAAkB,EAClBC,GAAG,EACHC,aAAa,EACbC,0BAA0B,EAC1BC,sCAAsC,EACtCC,2BAA2B,EAC3BC,4BAA4B,EAC5BC,8BAA8B,EAC9BC,qBAAqB,EACrBC,eAAe,EACfC,mBAAmB,QACd,QAAQ;AAef,SACEC,sBAAsB,EACtBC,OAAO,EACPC,eAAe,EACfC,iBAAiB,EACjBC,0BAA0B,EAC1BC,gCAAgC,EAChCC,yBAAyB,EACzBC,mBAAmB,EACnBC,+BAA+B,EAC/BC,uBAAuB,QAClB,YAAY"}
|
package/lib-commonjs/TabList.js
CHANGED
|
@@ -24,6 +24,9 @@ _export(exports, {
|
|
|
24
24
|
tabListClassNames: function() {
|
|
25
25
|
return _index.tabListClassNames;
|
|
26
26
|
},
|
|
27
|
+
useTabListA11yBehavior_unstable: function() {
|
|
28
|
+
return _index.useTabListA11yBehavior_unstable;
|
|
29
|
+
},
|
|
27
30
|
useTabListBase_unstable: function() {
|
|
28
31
|
return _index.useTabListBase_unstable;
|
|
29
32
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/TabList.ts"],"sourcesContent":["export type {\n RegisterTabEventHandler,\n SelectTabData,\n SelectTabEvent,\n SelectTabEventHandler,\n TabListContextValue,\n TabListContextValues,\n TabListBaseProps,\n TabListProps,\n TabListSlots,\n TabListBaseState,\n TabListState,\n TabRegisterData,\n} from './components/TabList/index';\nexport {\n TabList,\n TabListContext,\n TabListProvider,\n renderTabList_unstable,\n tabListClassNames,\n useTabListContextValues_unstable,\n useTabListContext_unstable,\n useTabListStyles_unstable,\n useTabList_unstable,\n useTabListBase_unstable,\n} from './components/TabList/index';\n"],"names":["TabList","TabListContext","TabListProvider","renderTabList_unstable","tabListClassNames","useTabListContextValues_unstable","useTabListContext_unstable","useTabListStyles_unstable","useTabList_unstable","useTabListBase_unstable"],"mappings":";;;;;;;;;;;IAeEA;6BAAO;;;eACPC,qBAAc;;;eACdC,sBAAe;;;eACfC,6BAAsB;;;eACtBC,wBAAiB;;
|
|
1
|
+
{"version":3,"sources":["../src/TabList.ts"],"sourcesContent":["export type {\n RegisterTabEventHandler,\n SelectTabData,\n SelectTabEvent,\n SelectTabEventHandler,\n TabListContextValue,\n TabListContextValues,\n TabListBaseProps,\n TabListProps,\n TabListSlots,\n TabListBaseState,\n TabListState,\n TabRegisterData,\n} from './components/TabList/index';\nexport {\n TabList,\n TabListContext,\n TabListProvider,\n renderTabList_unstable,\n tabListClassNames,\n useTabListContextValues_unstable,\n useTabListContext_unstable,\n useTabListStyles_unstable,\n useTabList_unstable,\n useTabListBase_unstable,\n useTabListA11yBehavior_unstable,\n} from './components/TabList/index';\n"],"names":["TabList","TabListContext","TabListProvider","renderTabList_unstable","tabListClassNames","useTabListContextValues_unstable","useTabListContext_unstable","useTabListStyles_unstable","useTabList_unstable","useTabListBase_unstable","useTabListA11yBehavior_unstable"],"mappings":";;;;;;;;;;;IAeEA;6BAAO;;;eACPC,qBAAc;;;eACdC,sBAAe;;;eACfC,6BAAsB;;;eACtBC,wBAAiB;;;eAMjBM,sCAA+B;;2BADR;eAAvBD;;;eAJAJ,uCAAgC;;8BACN;eAA1BC;;;eACAC,gCAAyB;;;eACzBC,0BAAmB;;;uBAGd,6BAA6B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Tab/renderTab.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/Tab/renderTab.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { TabBaseState, TabInternalSlots } from './Tab.types';\n\n/**\n * Render the final JSX of Tab\n */\nexport const renderTab_unstable = (state: TabBaseState): JSXElement => {\n assertSlots<TabInternalSlots>(state);\n\n return (\n <state.root>\n {state.icon && <state.icon />}\n {!state.iconOnly && <state.content />}\n {state.contentReservedSpace && <state.contentReservedSpace />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderTab_unstable","state","root","icon","iconOnly","content","contentReservedSpace"],"mappings":";;;;+BASaC;;;;;;4BARb,iCAAiD;gCACrB,4BAA4B;AAOjD,2BAA2B,CAACC;QACjCF,2BAAAA,EAA8BE;IAE9B,OAAA,WAAA,OACE,gBAAA,EAACA,MAAMC,IAAI,EAAA;;YACRD,MAAME,IAAI,IAAA,WAAA,OAAI,eAAA,EAACF,MAAME,IAAI,EAAA,CAAA;YACzB,CAACF,MAAMG,QAAQ,IAAA,WAAA,OAAI,eAAA,EAACH,MAAMI,OAAO,EAAA,CAAA;YACjCJ,MAAMK,oBAAoB,IAAA,WAAA,OAAI,eAAA,EAACL,MAAMK,oBAAoB,EAAA,CAAA;;;AAGhE,EAAE"}
|
|
@@ -46,8 +46,8 @@ const useTab_unstable = (props, ref)=>{
|
|
|
46
46
|
contentReservedSpace: 'span'
|
|
47
47
|
},
|
|
48
48
|
root: {
|
|
49
|
-
...
|
|
50
|
-
...
|
|
49
|
+
...focusAttributes,
|
|
50
|
+
...state.root
|
|
51
51
|
},
|
|
52
52
|
contentReservedSpace: _reactutilities.slot.optional(contentReservedSpace, {
|
|
53
53
|
renderByDefault: !state.selected && !state.iconOnly && reserveSelectedTabSpace,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Tab/useTab.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { type TabsterDOMAttribute, useTabsterAttributes } from '@fluentui/react-tabster';\nimport { mergeCallbacks, useEventCallback, useMergedRefs, slot, omit } from '@fluentui/react-utilities';\nimport type { TabProps, TabState, TabBaseProps, TabBaseState } from './Tab.types';\nimport { useTabListContext_unstable } from '../TabList';\nimport type { SelectTabEvent } from '../TabList';\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 } = props;\n\n const state = useTabBase_unstable(props, ref);\n const focusAttributes = useTabA11yBehavior_unstable(state);\n\n const appearance = useTabListContext_unstable(ctx => ctx.appearance);\n const reserveSelectedTabSpace = useTabListContext_unstable(ctx => ctx.reserveSelectedTabSpace);\n const size = useTabListContext_unstable(ctx => ctx.size ?? 'medium');\n\n const contentReservedSpace: typeof content =\n content && typeof content === 'object' ? omit(content, ['ref' as keyof typeof content]) : content;\n\n return {\n ...state,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n components: { ...state.components, contentReservedSpace: 'span' },\n root: {\n ...
|
|
1
|
+
{"version":3,"sources":["../src/components/Tab/useTab.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { type TabsterDOMAttribute, useTabsterAttributes } from '@fluentui/react-tabster';\nimport { mergeCallbacks, useEventCallback, useMergedRefs, slot, omit } from '@fluentui/react-utilities';\nimport type { TabProps, TabState, TabBaseProps, TabBaseState } from './Tab.types';\nimport { useTabListContext_unstable } from '../TabList';\nimport type { SelectTabEvent } from '../TabList';\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 } = props;\n\n const state = useTabBase_unstable(props, ref);\n const focusAttributes = useTabA11yBehavior_unstable(state);\n\n const appearance = useTabListContext_unstable(ctx => ctx.appearance);\n const reserveSelectedTabSpace = useTabListContext_unstable(ctx => ctx.reserveSelectedTabSpace);\n const size = useTabListContext_unstable(ctx => ctx.size ?? 'medium');\n\n const contentReservedSpace: typeof content =\n content && typeof content === 'object' ? omit(content, ['ref' as keyof typeof content]) : content;\n\n return {\n ...state,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n components: { ...state.components, contentReservedSpace: 'span' },\n root: {\n ...focusAttributes,\n ...state.root,\n },\n contentReservedSpace: slot.optional(contentReservedSpace, {\n renderByDefault: !state.selected && !state.iconOnly && reserveSelectedTabSpace,\n defaultProps: { children: props.children },\n elementType: 'span',\n }),\n appearance,\n size,\n };\n};\n\n/**\n * Create the based state required to render Tab without design specifics and focus attributes.\n *\n * @param props - props from this instance of Tab\n * @param ref - reference to root HTMLElement of Tab\n */\nexport const useTabBase_unstable = (props: TabBaseProps, ref: React.Ref<HTMLElement>): TabBaseState => {\n const { content, disabled: tabDisabled = false, icon, onClick, onFocus, value, ...rest } = props;\n\n const selectTabOnFocus = useTabListContext_unstable(ctx => ctx.selectTabOnFocus);\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 vertical = useTabListContext_unstable(ctx => !!ctx.vertical);\n const disabled = listDisabled || tabDisabled;\n\n const innerRef = React.useRef<HTMLElement>(null);\n const onSelectCallback = (event: SelectTabEvent) => onSelect(event, { value });\n const onTabClick = useEventCallback(mergeCallbacks(onClick, onSelectCallback));\n const onTabFocus = useEventCallback(mergeCallbacks(onFocus, onSelectCallback));\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 iconSlot = slot.optional(icon, { elementType: 'span' });\n const contentSlot = slot.always(content, {\n defaultProps: { children: props.children },\n elementType: 'span',\n });\n const iconOnly = Boolean(iconSlot?.children && !contentSlot.children);\n return {\n components: { root: 'button', icon: 'span', content: 'span', contentReservedSpace: 'span' },\n root: slot.always(\n {\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}` as 'true' | 'false'),\n value,\n ...rest,\n disabled,\n onClick: onTabClick,\n onFocus: selectTabOnFocus ? onTabFocus : onFocus,\n },\n { elementType: 'button' },\n ) as TabBaseState['root'],\n icon: iconSlot,\n iconOnly,\n content: contentSlot,\n disabled,\n selected,\n value,\n vertical,\n };\n};\n\n/**\n * Hook to return a11y attributes to a Tab based on selected state.\n * Should be applied on the button with role=\"tab\".\n *\n * @param selected - whether the Tab is selected\n * @returns Tabster DOM attributes\n */\nexport const useTabA11yBehavior_unstable = ({ selected }: Pick<TabBaseState, 'selected'>): TabsterDOMAttribute => {\n return useTabsterAttributes({\n focusable: { isDefault: selected },\n });\n};\n"],"names":["React","useTabsterAttributes","mergeCallbacks","useEventCallback","useMergedRefs","slot","omit","useTabListContext_unstable","useTab_unstable","props","ref","content","state","useTabBase_unstable","focusAttributes","useTabA11yBehavior_unstable","appearance","ctx","reserveSelectedTabSpace","size","contentReservedSpace","components","root","optional","renderByDefault","selected","iconOnly","defaultProps","children","elementType","disabled","tabDisabled","icon","onClick","onFocus","value","rest","selectTabOnFocus","listDisabled","selectedValue","onRegister","onUnregister","onSelect","vertical","innerRef","useRef","onSelectCallback","event","onTabClick","onTabFocus","useEffect","iconSlot","contentSlot","always","Boolean","role","type","undefined","focusable","isDefault"],"mappings":"AAAA;;;;;;;;;;;;+BA4Hae;;;IArEAF,mBAAAA;;;IArCAL,eAAAA;;;;;iEAhBU,QAAQ;8BACgC,0BAA0B;gCACb,4BAA4B;yBAE7D,aAAa;AAYjD,wBAAwB,CAACC,OAAiBC;IAC/C,MAAM,EAAEC,OAAO,EAAE,GAAGF;IAEpB,MAAMG,QAAQC,oBAAoBJ,OAAOC;IACzC,MAAMI,kBAAkBC,4BAA4BH;IAEpD,MAAMI,iBAAaT,mCAAAA,EAA2BU,CAAAA,MAAOA,IAAID,UAAU;IACnE,MAAME,0BAA0BX,uCAAAA,EAA2BU,CAAAA,MAAOA,IAAIC,uBAAuB;IAC7F,MAAMC,WAAOZ,mCAAAA,EAA2BU,CAAAA;YAAOA;eAAAA,CAAAA,YAAAA,IAAIE,IAAAA,AAAI,MAAA,QAARF,cAAAA,KAAAA,IAAAA,YAAY;;IAE3D,MAAMG,uBACJT,WAAW,OAAOA,YAAY,eAAWL,oBAAAA,EAAKK,SAAS;QAAC;KAA8B,IAAIA;IAE5F,OAAO;QACL,GAAGC,KAAK;QACR,4DAA4D;QAC5DS,YAAY;YAAE,GAAGT,MAAMS,UAAU;YAAED,sBAAsB;QAAO;QAChEE,MAAM;YACJ,GAAGR,eAAe;YAClB,GAAGF,MAAMU,IAAI;QACf;QACAF,sBAAsBf,oBAAAA,CAAKkB,QAAQ,CAACH,sBAAsB;YACxDI,iBAAiB,CAACZ,MAAMa,QAAQ,IAAI,CAACb,MAAMc,QAAQ,IAAIR;YACvDS,cAAc;gBAAEC,UAAUnB,MAAMmB,QAAQ;YAAC;YACzCC,aAAa;QACf;QACAb;QACAG;IACF;AACF,EAAE;AAQK,4BAA4B,CAACV,OAAqBC;IACvD,MAAM,EAAEC,OAA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,QAAQ;QAAC;QACzCC,aAAa;IACf;IACA,MAAMH,WAAW4B,QAAQH,CAAAA,aAAAA,QAAAA,aAAAA,KAAAA,IAAAA,KAAAA,IAAAA,SAAUvB,QAAAA,AAAQ,KAAI,CAACwB,YAAYxB,QAAQ;IACpE,OAAO;QACLP,YAAY;YAAEC,MAAM;YAAUU,MAAM;YAAQrB,SAAS;YAAQS,sBAAsB;QAAO;QAC1FE,MAAMjB,oBAAAA,CAAKgD,MAAM,CACf;YACE3C,SAAKN,6BAAAA,EAAcM,KAAKkC;YACxBW,MAAM;YACNC,MAAM;YACN,yDAAyD;YACzD,iEAAiE;YACjE,iBAAiB1B,WAAW2B,YAAa,GAAGhC,UAAU;YACtDU;YACA,GAAGC,IAAI;YACPN;YACAG,SAASe;YACTd,SAASG,mBAAmBY,aAAaf;QAC3C,GACA;YAAEL,aAAa;QAAS;QAE1BG,MAAMmB;QACNzB;QACAf,SAASyC;QACTtB;QACAL;QACAU;QACAQ;IACF;AACF,EAAE;AASK,MAAM5B,8BAA8B,CAAC,EAAEU,QAAQ,EAAkC;IACtF,WAAOxB,kCAAAA,EAAqB;QAC1ByD,WAAW;YAAEC,WAAWlC;QAAS;IACnC;AACF,EAAE"}
|
|
@@ -24,6 +24,9 @@ _export(exports, {
|
|
|
24
24
|
tabListClassNames: function() {
|
|
25
25
|
return _useTabListStylesstyles.tabListClassNames;
|
|
26
26
|
},
|
|
27
|
+
useTabListA11yBehavior_unstable: function() {
|
|
28
|
+
return _useTabList.useTabListA11yBehavior_unstable;
|
|
29
|
+
},
|
|
27
30
|
useTabListBase_unstable: function() {
|
|
28
31
|
return _useTabList.useTabListBase_unstable;
|
|
29
32
|
},
|
|
@@ -33,9 +36,6 @@ _export(exports, {
|
|
|
33
36
|
useTabListContext_unstable: function() {
|
|
34
37
|
return _TabListContext.useTabListContext_unstable;
|
|
35
38
|
},
|
|
36
|
-
useTabListFocusAttributes: function() {
|
|
37
|
-
return _useTabList.useTabListA11yBehavior_unstable;
|
|
38
|
-
},
|
|
39
39
|
useTabListStyles_unstable: function() {
|
|
40
40
|
return _useTabListStylesstyles.useTabListStyles_unstable;
|
|
41
41
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TabList/index.ts"],"sourcesContent":["export { TabList } from './TabList';\nexport type {\n RegisterTabEventHandler,\n SelectTabData,\n SelectTabEvent,\n SelectTabEventHandler,\n TabListContextValue,\n TabListContextValues,\n TabListBaseProps,\n TabListProps,\n TabListSlots,\n TabListBaseState,\n TabListState,\n TabRegisterData,\n} from './TabList.types';\nexport { TabListContext, TabListProvider, useTabListContext_unstable } from './TabListContext';\nexport { renderTabList_unstable } from './renderTabList';\nexport {
|
|
1
|
+
{"version":3,"sources":["../src/components/TabList/index.ts"],"sourcesContent":["export { TabList } from './TabList';\nexport type {\n RegisterTabEventHandler,\n SelectTabData,\n SelectTabEvent,\n SelectTabEventHandler,\n TabListContextValue,\n TabListContextValues,\n TabListBaseProps,\n TabListProps,\n TabListSlots,\n TabListBaseState,\n TabListState,\n TabRegisterData,\n} from './TabList.types';\nexport { TabListContext, TabListProvider, useTabListContext_unstable } from './TabListContext';\nexport { renderTabList_unstable } from './renderTabList';\nexport { useTabList_unstable, useTabListBase_unstable, useTabListA11yBehavior_unstable } from './useTabList';\nexport { useTabListContextValues_unstable } from './useTabListContextValues';\nexport { tabListClassNames, useTabListStyles_unstable } from './useTabListStyles.styles';\n"],"names":["TabList","TabListContext","TabListProvider","useTabListContext_unstable","renderTabList_unstable","useTabList_unstable","useTabListBase_unstable","useTabListA11yBehavior_unstable","useTabListContextValues_unstable","tabListClassNames","useTabListStyles_unstable"],"mappings":";;;;;;;;;;;IAASA;+BAAO;;;eAePC,8BAAc;;;eAAEC,+BAAe;;;eAC/BE,qCAAsB;;;eAGtBK,yCAAiB;;;eAF6BF,2CAA+B;;;eAAxDD,mCAAuB;;;eAC5CE,yDAAgC;;;eAHCL,0CAA0B;;;eAIxCO,iDAAyB;;IAF5CL;8CAAmB;;;yBAjBJ,YAAY;gCAewC,mBAAmB;+BACxD,kBAAkB;4BACqC,eAAe;yCAC5D,4BAA4B;wCAChB,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TabList/renderTabList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/TabList/renderTabList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { TabListBaseState, TabListSlots, TabListContextValues } from './TabList.types';\nimport { TabListProvider } from './TabListContext';\n\n/**\n * Render the final JSX of TabList\n */\nexport const renderTabList_unstable = (state: TabListBaseState, contextValues: TabListContextValues): JSXElement => {\n assertSlots<TabListSlots>(state);\n\n return (\n <state.root>\n <TabListProvider value={contextValues.tabList}>{state.root.children}</TabListProvider>\n </state.root>\n );\n};\n"],"names":["assertSlots","TabListProvider","renderTabList_unstable","state","contextValues","root","value","tabList","children"],"mappings":";;;;+BAUaE;;;;;;4BATb,gDAAiD;gCACrB,4BAA4B;gCAGxB,mBAAmB;AAK5C,+BAA+B,CAACC,OAAyBC;QAC9DJ,2BAAAA,EAA0BG;IAE1B,OAAA,WAAA,OACE,eAAA,EAACA,MAAME,IAAI,EAAA;kBACT,WAAA,OAAA,eAAA,EAACJ,+BAAAA,EAAAA;YAAgBK,OAAOF,cAAcG,OAAO;sBAAGJ,MAAME,IAAI,CAACG,QAAQ;;;AAGzE,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TabList/useTabList.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { type TabsterDOMAttribute, useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { useControllableState, useEventCallback, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport type {\n TabRegisterData,\n SelectTabData,\n SelectTabEvent,\n TabListBaseProps,\n TabListBaseState,\n TabListProps,\n TabListState,\n} from './TabList.types';\nimport type { TabValue } from '../Tab';\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', reserveSelectedTabSpace = true, size = 'medium' } = props;\n const state = useTabListBase_unstable(props, ref);\n const focusAttributes = useTabListA11yBehavior_unstable({ vertical: state.vertical });\n\n return {\n ...state,\n root: {\n ...
|
|
1
|
+
{"version":3,"sources":["../src/components/TabList/useTabList.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { type TabsterDOMAttribute, useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { useControllableState, useEventCallback, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport type {\n TabRegisterData,\n SelectTabData,\n SelectTabEvent,\n TabListBaseProps,\n TabListBaseState,\n TabListProps,\n TabListState,\n} from './TabList.types';\nimport type { TabValue } from '../Tab';\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', reserveSelectedTabSpace = true, size = 'medium' } = props;\n const state = useTabListBase_unstable(props, ref);\n const focusAttributes = useTabListA11yBehavior_unstable({ vertical: state.vertical });\n\n return {\n ...state,\n root: {\n ...focusAttributes,\n ...state.root,\n },\n appearance,\n reserveSelectedTabSpace,\n size,\n };\n};\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 useTabListBase_unstable = (props: TabListBaseProps, ref: React.Ref<HTMLElement>): TabListBaseState => {\n const {\n disabled = false,\n onTabSelect,\n selectTabOnFocus = false,\n vertical = false,\n selectedValue: controlledSelectedValue,\n defaultSelectedValue,\n ...rest\n } = props;\n\n const innerRef = React.useRef<HTMLElement>(null);\n\n const [selectedValue, setSelectedValue] = useControllableState({\n state: controlledSelectedValue,\n defaultState: 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 const key = JSON.stringify(data.value);\n\n if (!key && process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error(\n [\n `[@fluentui/react-tabs] The value \"${data.value}\" cannot be serialized to JSON string.`,\n 'Tab component requires serializable values.',\n 'Please provide a primitive value (string, number, boolean),',\n `or a plain object/array that doesn't contain functions, symbols, or circular references.`,\n ].join(' '),\n );\n }\n\n registeredTabs.current[key] = 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: slot.always(\n {\n ref: useMergedRefs(ref, innerRef) as React.Ref<HTMLDivElement>,\n role: 'tablist',\n 'aria-orientation': vertical ? 'vertical' : 'horizontal',\n ...rest,\n },\n { elementType: 'div' },\n ),\n disabled,\n selectTabOnFocus,\n selectedValue,\n onRegister,\n onUnregister,\n onSelect,\n getRegisteredTabs,\n vertical,\n };\n};\n\n/**\n * Hook to get accessibility attributes for TabList component, such as roving tab index.\n * Based on Tabster's useArrowNavigationGroup.\n *\n * @param vertical - whether the TabList is vertical\n * @returns Tabster DOM attributes\n */\nexport const useTabListA11yBehavior_unstable = ({\n vertical,\n}: Pick<TabListBaseState, 'vertical'>): TabsterDOMAttribute => {\n return useArrowNavigationGroup({\n circular: true,\n axis: vertical ? 'vertical' : 'horizontal',\n memorizeCurrent: false,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_hasDefault: true,\n });\n};\n"],"names":["React","useArrowNavigationGroup","useControllableState","useEventCallback","useMergedRefs","slot","useTabList_unstable","props","ref","appearance","reserveSelectedTabSpace","size","state","useTabListBase_unstable","focusAttributes","useTabListA11yBehavior_unstable","vertical","root","disabled","onTabSelect","selectTabOnFocus","selectedValue","controlledSelectedValue","defaultSelectedValue","rest","innerRef","useRef","setSelectedValue","defaultState","initialState","undefined","currentSelectedValue","previousSelectedValue","useEffect","current","onSelect","event","data","value","registeredTabs","onRegister","key","JSON","stringify","process","env","NODE_ENV","console","error","join","onUnregister","getRegisteredTabs","useCallback","components","always","role","elementType","circular","axis","memorizeCurrent","unstable_hasDefault"],"mappings":"AAAA;;;;;;;;;;;;mCAsJae;;;2BAnGAF;eAAAA;;uBA1BAP;;;;;iEAvBU,QAAQ;8BACmC,0BAA0B;gCAChB,4BAA4B;AAqBjG,MAAMA,sBAAsB,CAACC,OAAqBC;IACvD,MAAM,EAAEC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AAK;QAErC,IAAI,CAACG,OAAOG,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACjD,sCAAsC;YACtCC,QAAQC,KAAK,CACX;gBACE,CAAC,kCAAkC,EAAEX,KAAKC,KAAK,CAAC,sCAAsC,CAAC;gBACvF;gBACA;gBACA,CAAC,wFAAwF,CAAC;aAC3F,CAACW,IAAI,CAAC;QAEX;QAEAV,eAAeL,OAAO,CAACO,IAAI,GAAGJ;IAChC;IAEA,MAAMa,mBAAe/C,gCAAAA,EAAiB,CAACkC;QACrC,OAAOE,eAAeL,OAAO,CAACQ,KAAKC,SAAS,CAACN,KAAKC,KAAK,EAAE;IAC3D;IAEA,MAAMa,oBAAoBnD,OAAMoD,WAAW,CAAC;QAC1C,OAAO;YACL/B,eAAeU,qBAAqBG,OAAO;YAC3CF,uBAAuBA,sBAAsBE,OAAO;YACpDK,gBAAgBA,eAAeL,OAAO;QACxC;IACF,GAAG,EAAE;IAEL,OAAO;QACLmB,YAAY;YACVpC,MAAM;QACR;QACAA,MAAMZ,oBAAAA,CAAKiD,MAAM,CACf;YACE9C,SAAKJ,6BAAAA,EAAcI,KAAKiB;YACxB8B,MAAM;YACN,oBAAoBvC,WAAW,aAAa;YAC5C,GAAGQ,IAAI;QACT,GACA;YAAEgC,aAAa;QAAM;QAEvBtC;QACAE;QACAC;QACAmB;QACAU;QACAf;QACAgB;QACAnC;IACF;AACF,EAAE;AASK,MAAMD,kCAAkC,CAAC,EAC9CC,QAAQ,EAC2B;IACnC,WAAOf,qCAAAA,EAAwB;QAC7BwD,UAAU;QACVC,MAAM1C,WAAW,aAAa;QAC9B2C,iBAAiB;QACjB,gEAAgE;QAChEC,qBAAqB;IACvB;AACF,EAAE"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -36,6 +36,9 @@ _export(exports, {
|
|
|
36
36
|
useTabAnimatedIndicatorStyles_unstable: function() {
|
|
37
37
|
return _Tab.useTabAnimatedIndicatorStyles_unstable;
|
|
38
38
|
},
|
|
39
|
+
useTabBase_unstable: function() {
|
|
40
|
+
return _Tab.useTabBase_unstable;
|
|
41
|
+
},
|
|
39
42
|
useTabButtonStyles_unstable: function() {
|
|
40
43
|
return _Tab.useTabButtonStyles_unstable;
|
|
41
44
|
},
|
|
@@ -45,6 +48,12 @@ _export(exports, {
|
|
|
45
48
|
useTabIndicatorStyles_unstable: function() {
|
|
46
49
|
return _Tab.useTabIndicatorStyles_unstable;
|
|
47
50
|
},
|
|
51
|
+
useTabListA11yBehavior_unstable: function() {
|
|
52
|
+
return _TabList.useTabListA11yBehavior_unstable;
|
|
53
|
+
},
|
|
54
|
+
useTabListBase_unstable: function() {
|
|
55
|
+
return _TabList.useTabListBase_unstable;
|
|
56
|
+
},
|
|
48
57
|
useTabListContextValues_unstable: function() {
|
|
49
58
|
return _TabList.useTabListContextValues_unstable;
|
|
50
59
|
},
|
|
@@ -66,8 +75,3 @@ _export(exports, {
|
|
|
66
75
|
});
|
|
67
76
|
const _Tab = require("./Tab");
|
|
68
77
|
const _TabList = require("./TabList");
|
|
69
|
-
// Experimental APIs - will be uncommented in experimental release
|
|
70
|
-
// export type { TabBaseProps, TabBaseState } from './Tab';
|
|
71
|
-
// export { useTabBase_unstable, useTabA11yBehavior_unstable } from './Tab';
|
|
72
|
-
// export type { TabListBaseProps, TabListBaseState } from './TabList';
|
|
73
|
-
// export { useTabListBase_unstable, useTabListA11yBehavior_unstable } from './TabList';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type { TabProps, TabSlots, TabState, TabValue } from './Tab';\nexport {\n renderTab_unstable,\n Tab,\n tabClassNames,\n tabReservedSpaceClassNames,\n useTabAnimatedIndicatorStyles_unstable,\n useTabButtonStyles_unstable,\n useTabContentStyles_unstable,\n useTabIndicatorStyles_unstable,\n useTabStyles_unstable,\n useTab_unstable,\n} 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 TabListProvider,\n tabListClassNames,\n useTabListContext_unstable,\n useTabListContextValues_unstable,\n useTabListStyles_unstable,\n useTabList_unstable,\n
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type { TabProps, TabSlots, TabState, TabValue } from './Tab';\nexport {\n renderTab_unstable,\n Tab,\n tabClassNames,\n tabReservedSpaceClassNames,\n useTabAnimatedIndicatorStyles_unstable,\n useTabButtonStyles_unstable,\n useTabContentStyles_unstable,\n useTabIndicatorStyles_unstable,\n useTabStyles_unstable,\n useTab_unstable,\n useTabBase_unstable,\n} 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 TabListBaseProps,\n TabListBaseState,\n} from './TabList';\nexport {\n renderTabList_unstable,\n TabList,\n TabListProvider,\n tabListClassNames,\n useTabListContext_unstable,\n useTabListContextValues_unstable,\n useTabListStyles_unstable,\n useTabList_unstable,\n useTabListA11yBehavior_unstable,\n useTabListBase_unstable,\n} from './TabList';\n"],"names":["renderTab_unstable","Tab","tabClassNames","tabReservedSpaceClassNames","useTabAnimatedIndicatorStyles_unstable","useTabButtonStyles_unstable","useTabContentStyles_unstable","useTabIndicatorStyles_unstable","useTabStyles_unstable","useTab_unstable","useTabBase_unstable","renderTabList_unstable","TabList","TabListProvider","tabListClassNames","useTabListContext_unstable","useTabListContextValues_unstable","useTabListStyles_unstable","useTabList_unstable","useTabListA11yBehavior_unstable","useTabListBase_unstable"],"mappings":";;;;;;;;;;;IAGEC,GAAG;;;WA2BI;eAAPW;;IACAC,eAAe;;;;eAFfF,+BAAsB;;;eA3BtBX,uBAAkB;;;eAElBE,kBAAa;;;eA4BbY,0BAAiB;;;eA3BjBX,+BAA0B;;;eAC1BC,2CAAsC;;IAMtCM;uCAAmB;;;eALnBL,gCAA2B;;;eAC3BC,iCAA4B;;;eAC5BC,mCAA8B;;mCA4BC;eAA/BY;;;eACAC,gCAAuB;;;eAJvBJ,yCAAgC;;;eADhCD,mCAA0B;;;eAE1BE,kCAAyB;;;eACzBC,4BAAmB;;IA1BnBV;yCAAqB;;;eACrBC,oBAAe;;;qBAEV,QAAQ;yBA0BR,YAAY"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-tabs",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.12.0",
|
|
4
4
|
"description": "Fluent UI React tabs components",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@fluentui/react-context-selector": "^9.2.
|
|
16
|
-
"@fluentui/react-jsx-runtime": "^9.4.
|
|
17
|
-
"@fluentui/react-shared-contexts": "^9.26.
|
|
18
|
-
"@fluentui/react-tabster": "^9.26.
|
|
15
|
+
"@fluentui/react-context-selector": "^9.2.15",
|
|
16
|
+
"@fluentui/react-jsx-runtime": "^9.4.1",
|
|
17
|
+
"@fluentui/react-shared-contexts": "^9.26.2",
|
|
18
|
+
"@fluentui/react-tabster": "^9.26.13",
|
|
19
19
|
"@fluentui/react-theme": "^9.2.1",
|
|
20
|
-
"@fluentui/react-utilities": "^9.26.
|
|
20
|
+
"@fluentui/react-utilities": "^9.26.2",
|
|
21
21
|
"@griffel/react": "^1.5.32",
|
|
22
22
|
"@swc/helpers": "^0.5.1"
|
|
23
23
|
},
|