@lumx/react 4.9.0-next.5 → 4.9.0-next.7
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/index.d.ts +75 -8
- package/index.js +159 -61
- package/index.js.map +1 -1
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -3798,16 +3798,25 @@ declare enum TabListLayout {
|
|
|
3798
3798
|
/**
|
|
3799
3799
|
* Defines the props of the component.
|
|
3800
3800
|
*/
|
|
3801
|
-
interface TabListProps extends
|
|
3801
|
+
interface TabListProps$1 extends HasClassName, HasTheme {
|
|
3802
3802
|
/** ARIA label (purpose of the set of tabs). */
|
|
3803
3803
|
['aria-label']: string;
|
|
3804
3804
|
/** Tab list. */
|
|
3805
|
-
children:
|
|
3805
|
+
children: JSXElement;
|
|
3806
3806
|
/** Layout of the tabs in the list. */
|
|
3807
3807
|
layout?: TabListLayout;
|
|
3808
3808
|
/** Position of the tabs in the list (requires 'clustered' layout). */
|
|
3809
|
-
position?: Alignment
|
|
3809
|
+
position?: Alignment;
|
|
3810
|
+
/** ref to the wrapper element */
|
|
3811
|
+
ref?: CommonRef;
|
|
3810
3812
|
}
|
|
3813
|
+
|
|
3814
|
+
/**
|
|
3815
|
+
* Defines the props of the component.
|
|
3816
|
+
*/
|
|
3817
|
+
interface TabListProps extends GenericProps$1, ReactToJSX<TabListProps$1> {
|
|
3818
|
+
}
|
|
3819
|
+
|
|
3811
3820
|
/**
|
|
3812
3821
|
* TabList component.
|
|
3813
3822
|
*
|
|
@@ -3822,7 +3831,50 @@ declare const TabList: Comp<TabListProps, HTMLDivElement>;
|
|
|
3822
3831
|
/**
|
|
3823
3832
|
* Defines the props of the component.
|
|
3824
3833
|
*/
|
|
3825
|
-
interface TabProps extends
|
|
3834
|
+
interface TabProps$1 extends HasClassName {
|
|
3835
|
+
/** Children are not supported. */
|
|
3836
|
+
children?: never;
|
|
3837
|
+
/** Icon (SVG path). */
|
|
3838
|
+
icon?: IconProps$1['icon'];
|
|
3839
|
+
/** Icon component properties. */
|
|
3840
|
+
iconProps?: Omit<IconProps$1, 'icon'>;
|
|
3841
|
+
/** Native id property. */
|
|
3842
|
+
id?: string;
|
|
3843
|
+
/** Whether the tab is active or not. */
|
|
3844
|
+
isActive?: boolean;
|
|
3845
|
+
/** Whether the component is disabled or not. */
|
|
3846
|
+
isDisabled?: boolean;
|
|
3847
|
+
/** Label content. */
|
|
3848
|
+
label: string | JSXElement;
|
|
3849
|
+
/** Whether any tab in the list is disabled (used to block interaction). */
|
|
3850
|
+
isAnyDisabled?: boolean;
|
|
3851
|
+
/** Whether the tab should become active when it receives focus (automatic activation pattern). */
|
|
3852
|
+
shouldActivateOnFocus?: boolean;
|
|
3853
|
+
/** Focus event handler injected by TabList. */
|
|
3854
|
+
handleFocus?: (event: any) => void;
|
|
3855
|
+
/** Keypress event handler injected by TabList. */
|
|
3856
|
+
handleKeyPress?: (event: any) => void;
|
|
3857
|
+
/** Callback to activate this tab, injected by TabList. */
|
|
3858
|
+
changeToTab?: () => void;
|
|
3859
|
+
/** Tab index for roving tabindex management. */
|
|
3860
|
+
tabIndex?: number;
|
|
3861
|
+
/** ID applied to the tab button element (for aria-labelledby on the panel). */
|
|
3862
|
+
tabId?: string;
|
|
3863
|
+
/** ID of the associated tab panel (for aria-controls). */
|
|
3864
|
+
tabPanelId?: string;
|
|
3865
|
+
/** Icon component injected by the framework wrapper. */
|
|
3866
|
+
Icon: any;
|
|
3867
|
+
/** Text component injected by the framework wrapper. */
|
|
3868
|
+
Text: any;
|
|
3869
|
+
/** Forward ref to the underlying button element. */
|
|
3870
|
+
ref?: CommonRef;
|
|
3871
|
+
}
|
|
3872
|
+
type TabPropsToOverride = 'isAnyDisabled' | 'shouldActivateOnFocus' | 'changeToTab' | 'tabIndex' | 'tabId' | 'tabPanelId' | 'Icon' | 'Text';
|
|
3873
|
+
|
|
3874
|
+
/**
|
|
3875
|
+
* Defines the props of the component.
|
|
3876
|
+
*/
|
|
3877
|
+
interface TabProps extends GenericProps$1, ReactToJSX<TabProps$1, TabPropsToOverride> {
|
|
3826
3878
|
/** Children are not supported. */
|
|
3827
3879
|
children?: never;
|
|
3828
3880
|
/** Icon (SVG path). */
|
|
@@ -3852,13 +3904,28 @@ declare const Tab: Comp<TabProps, HTMLButtonElement>;
|
|
|
3852
3904
|
/**
|
|
3853
3905
|
* Defines the props of the component.
|
|
3854
3906
|
*/
|
|
3855
|
-
interface TabPanelProps extends
|
|
3856
|
-
/** Native id property */
|
|
3857
|
-
id?: string;
|
|
3907
|
+
interface TabPanelProps$1 extends HasClassName {
|
|
3858
3908
|
/** Whether the tab is active or not. */
|
|
3859
3909
|
isActive?: boolean;
|
|
3910
|
+
/** Whether the tab is lazy loaded or not */
|
|
3911
|
+
isLazy?: boolean;
|
|
3860
3912
|
/** Children */
|
|
3861
|
-
children?:
|
|
3913
|
+
children?: JSXElement;
|
|
3914
|
+
/** ID applied to the tab button element (for aria-labelledby on the panel). */
|
|
3915
|
+
tabId?: string;
|
|
3916
|
+
/** ID of the associated tab panel (for aria-controls). */
|
|
3917
|
+
id?: string;
|
|
3918
|
+
/** Forward ref to the underlying button element. */
|
|
3919
|
+
ref?: CommonRef;
|
|
3920
|
+
}
|
|
3921
|
+
type TabPanelPropsToOverride = 'tabId';
|
|
3922
|
+
|
|
3923
|
+
/**
|
|
3924
|
+
* Defines the props of the component.
|
|
3925
|
+
*/
|
|
3926
|
+
interface TabPanelProps extends GenericProps$1, ReactToJSX<TabPanelProps$1, TabPanelPropsToOverride> {
|
|
3927
|
+
/** Native id property */
|
|
3928
|
+
id?: string;
|
|
3862
3929
|
}
|
|
3863
3930
|
/**
|
|
3864
3931
|
* TabPanel component.
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Kind as Kind$1, Size as Size$1, ColorPalette as ColorPalette$1, Emphasis as Emphasis$1, ColorVariant, VISUALLY_HIDDEN, Theme as Theme$1, AspectRatio as AspectRatio$1, DOCUMENT, WINDOW, DIALOG_TRANSITION_DURATION, IS_BROWSER as IS_BROWSER$1, Orientation as Orientation$1, Alignment, NOTIFICATION_TRANSITION_DURATION } from '@lumx/core/js/constants';
|
|
1
|
+
import { Kind as Kind$1, Size as Size$1, ColorPalette as ColorPalette$1, Emphasis as Emphasis$1, ColorVariant, VISUALLY_HIDDEN, Theme as Theme$1, AspectRatio as AspectRatio$1, DOCUMENT, WINDOW, DIALOG_TRANSITION_DURATION, IS_BROWSER as IS_BROWSER$1, Orientation as Orientation$1, Alignment as Alignment$1, NOTIFICATION_TRANSITION_DURATION } from '@lumx/core/js/constants';
|
|
2
2
|
export * from '@lumx/core/js/constants';
|
|
3
3
|
export * from '@lumx/core/js/types';
|
|
4
4
|
import * as React from 'react';
|
|
@@ -842,6 +842,8 @@ const TOOLTIP_LONG_PRESS_DELAY = {
|
|
|
842
842
|
/**
|
|
843
843
|
* Alignments.
|
|
844
844
|
*/
|
|
845
|
+
const Alignment = {
|
|
846
|
+
left: 'left'};
|
|
845
847
|
const Theme = {
|
|
846
848
|
light: 'light',
|
|
847
849
|
dark: 'dark'
|
|
@@ -8013,7 +8015,7 @@ const {
|
|
|
8013
8015
|
*/
|
|
8014
8016
|
const DEFAULT_PROPS$O = {
|
|
8015
8017
|
captionPosition: ImageBlockCaptionPosition.below,
|
|
8016
|
-
align: Alignment.left
|
|
8018
|
+
align: Alignment$1.left
|
|
8017
8019
|
};
|
|
8018
8020
|
|
|
8019
8021
|
/**
|
|
@@ -9871,7 +9873,7 @@ const Mosaic = forwardRef((props, ref) => {
|
|
|
9871
9873
|
className: element$q('thumbnail'),
|
|
9872
9874
|
children: [/*#__PURE__*/jsx(Thumbnail, {
|
|
9873
9875
|
...thumbnailProps,
|
|
9874
|
-
align: align || Alignment.left,
|
|
9876
|
+
align: align || Alignment$1.left,
|
|
9875
9877
|
image: image,
|
|
9876
9878
|
theme: theme,
|
|
9877
9879
|
aspectRatio: AspectRatio$1.free,
|
|
@@ -10686,7 +10688,6 @@ const reducer = (state, action) => {
|
|
|
10686
10688
|
if (state.activeTabIndex === action.payload) {
|
|
10687
10689
|
return state;
|
|
10688
10690
|
}
|
|
10689
|
-
// Change active tab index.
|
|
10690
10691
|
return {
|
|
10691
10692
|
...state,
|
|
10692
10693
|
activeTabIndex: action.payload
|
|
@@ -10698,7 +10699,6 @@ const reducer = (state, action) => {
|
|
|
10698
10699
|
type,
|
|
10699
10700
|
id
|
|
10700
10701
|
} = action.payload;
|
|
10701
|
-
// Append tab/tabPanel id in state.
|
|
10702
10702
|
return {
|
|
10703
10703
|
...state,
|
|
10704
10704
|
ids: {
|
|
@@ -10715,7 +10715,6 @@ const reducer = (state, action) => {
|
|
|
10715
10715
|
} = action.payload;
|
|
10716
10716
|
const index = state.ids[type].indexOf(id);
|
|
10717
10717
|
if (index === -1) return state;
|
|
10718
|
-
// Remove tab & tab panel at index.
|
|
10719
10718
|
const tabIds = [...state.ids.tab];
|
|
10720
10719
|
tabIds.splice(index, 1);
|
|
10721
10720
|
const tabPanelIds = [...state.ids.tabPanel];
|
|
@@ -10732,7 +10731,9 @@ const reducer = (state, action) => {
|
|
|
10732
10731
|
return state;
|
|
10733
10732
|
}
|
|
10734
10733
|
};
|
|
10734
|
+
|
|
10735
10735
|
const TabProviderContext = /*#__PURE__*/createContext(null);
|
|
10736
|
+
|
|
10736
10737
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
10737
10738
|
const useTabProviderContext = (type, originalId) => {
|
|
10738
10739
|
const context = useContext(TabProviderContext);
|
|
@@ -13903,7 +13904,7 @@ const Switch$1 = props => {
|
|
|
13903
13904
|
* Component default props.
|
|
13904
13905
|
*/
|
|
13905
13906
|
const DEFAULT_PROPS$h = {
|
|
13906
|
-
position: Alignment.left
|
|
13907
|
+
position: Alignment$1.left
|
|
13907
13908
|
};
|
|
13908
13909
|
|
|
13909
13910
|
/**
|
|
@@ -14462,7 +14463,7 @@ const TABS_CLASSNAME = `lumx-tabs`;
|
|
|
14462
14463
|
const {
|
|
14463
14464
|
block: block$a,
|
|
14464
14465
|
element: element$6
|
|
14465
|
-
} =
|
|
14466
|
+
} = bem(TABS_CLASSNAME);
|
|
14466
14467
|
let TabListLayout = /*#__PURE__*/function (TabListLayout) {
|
|
14467
14468
|
TabListLayout["clustered"] = "clustered";
|
|
14468
14469
|
TabListLayout["fixed"] = "fixed";
|
|
@@ -14495,26 +14496,21 @@ const DEFAULT_PROPS$b = {
|
|
|
14495
14496
|
* @param ref Component ref.
|
|
14496
14497
|
* @return React element.
|
|
14497
14498
|
*/
|
|
14498
|
-
const TabList =
|
|
14499
|
-
const defaultTheme = useTheme() || Theme$1.light;
|
|
14499
|
+
const TabList$1 = props => {
|
|
14500
14500
|
const {
|
|
14501
14501
|
'aria-label': ariaLabel,
|
|
14502
14502
|
children,
|
|
14503
14503
|
className,
|
|
14504
14504
|
layout = DEFAULT_PROPS$b.layout,
|
|
14505
14505
|
position = DEFAULT_PROPS$b.position,
|
|
14506
|
-
theme
|
|
14506
|
+
theme,
|
|
14507
|
+
ref,
|
|
14507
14508
|
...forwardedProps
|
|
14508
14509
|
} = props;
|
|
14509
|
-
const tabListRef = React__default.useRef(null);
|
|
14510
|
-
useRovingTabIndexContainer({
|
|
14511
|
-
containerRef: tabListRef,
|
|
14512
|
-
itemSelector: '[role="tab"]'
|
|
14513
|
-
});
|
|
14514
14510
|
return /*#__PURE__*/jsx("div", {
|
|
14515
|
-
ref:
|
|
14511
|
+
ref: ref,
|
|
14516
14512
|
...forwardedProps,
|
|
14517
|
-
className:
|
|
14513
|
+
className: classnames(className, block$a({
|
|
14518
14514
|
[`layout-${layout}`]: Boolean(layout),
|
|
14519
14515
|
[`position-${position}`]: Boolean(position),
|
|
14520
14516
|
[`theme-${theme}`]: Boolean(theme)
|
|
@@ -14526,6 +14522,33 @@ const TabList = forwardRef((props, ref) => {
|
|
|
14526
14522
|
children: children
|
|
14527
14523
|
})
|
|
14528
14524
|
});
|
|
14525
|
+
};
|
|
14526
|
+
|
|
14527
|
+
/**
|
|
14528
|
+
* TabList component.
|
|
14529
|
+
*
|
|
14530
|
+
* Implements WAI-ARIA `tablist` role {@see https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html#rps_label}
|
|
14531
|
+
*
|
|
14532
|
+
* @param props Component props.
|
|
14533
|
+
* @param ref Component ref.
|
|
14534
|
+
* @return React element.
|
|
14535
|
+
*/
|
|
14536
|
+
const TabList = forwardRef((props, ref) => {
|
|
14537
|
+
const defaultTheme = useTheme() || Theme$1.light;
|
|
14538
|
+
const {
|
|
14539
|
+
theme = defaultTheme,
|
|
14540
|
+
...forwardedProps
|
|
14541
|
+
} = props;
|
|
14542
|
+
const tabListRef = React__default.useRef(null);
|
|
14543
|
+
useRovingTabIndexContainer({
|
|
14544
|
+
containerRef: tabListRef,
|
|
14545
|
+
itemSelector: '[role="tab"]'
|
|
14546
|
+
});
|
|
14547
|
+
return TabList$1({
|
|
14548
|
+
theme,
|
|
14549
|
+
ref: mergeRefs(ref, tabListRef),
|
|
14550
|
+
...forwardedProps
|
|
14551
|
+
});
|
|
14529
14552
|
});
|
|
14530
14553
|
TabList.displayName = COMPONENT_NAME$7;
|
|
14531
14554
|
TabList.className = TABS_CLASSNAME;
|
|
@@ -14536,18 +14559,18 @@ TabList.defaultProps = DEFAULT_PROPS$b;
|
|
|
14536
14559
|
*/
|
|
14537
14560
|
const COMPONENT_NAME$6 = 'Tab';
|
|
14538
14561
|
|
|
14562
|
+
/**
|
|
14563
|
+
* Component default props.
|
|
14564
|
+
*/
|
|
14565
|
+
const DEFAULT_PROPS$a = {};
|
|
14566
|
+
|
|
14539
14567
|
/**
|
|
14540
14568
|
* Component default class name and class prefix.
|
|
14541
14569
|
*/
|
|
14542
14570
|
const CLASSNAME$7 = `${TABS_CLASSNAME}__link`;
|
|
14543
14571
|
const {
|
|
14544
14572
|
block: block$9
|
|
14545
|
-
} =
|
|
14546
|
-
|
|
14547
|
-
/**
|
|
14548
|
-
* Component default props.
|
|
14549
|
-
*/
|
|
14550
|
-
const DEFAULT_PROPS$a = {};
|
|
14573
|
+
} = bem(CLASSNAME$7);
|
|
14551
14574
|
|
|
14552
14575
|
/**
|
|
14553
14576
|
* Tab component.
|
|
@@ -14558,64 +14581,66 @@ const DEFAULT_PROPS$a = {};
|
|
|
14558
14581
|
* @param ref Component ref.
|
|
14559
14582
|
* @return React element.
|
|
14560
14583
|
*/
|
|
14561
|
-
const Tab =
|
|
14562
|
-
const {
|
|
14563
|
-
isAnyDisabled,
|
|
14564
|
-
otherProps
|
|
14565
|
-
} = useDisableStateProps(props);
|
|
14584
|
+
const Tab$1 = props => {
|
|
14566
14585
|
const {
|
|
14567
14586
|
className,
|
|
14568
14587
|
icon,
|
|
14569
14588
|
iconProps = {},
|
|
14589
|
+
isAnyDisabled,
|
|
14570
14590
|
id,
|
|
14571
|
-
isActive
|
|
14591
|
+
isActive,
|
|
14572
14592
|
label,
|
|
14573
|
-
|
|
14574
|
-
|
|
14593
|
+
handleFocus,
|
|
14594
|
+
handleKeyPress,
|
|
14575
14595
|
tabIndex = -1,
|
|
14596
|
+
changeToTab,
|
|
14597
|
+
tabPanelId,
|
|
14598
|
+
shouldActivateOnFocus,
|
|
14599
|
+
tabId,
|
|
14600
|
+
Icon,
|
|
14601
|
+
Text,
|
|
14602
|
+
ref,
|
|
14576
14603
|
...forwardedProps
|
|
14577
|
-
} =
|
|
14578
|
-
const
|
|
14579
|
-
const isActive = propIsActive || state?.isActive;
|
|
14580
|
-
const changeToCurrentTab = useCallback(() => {
|
|
14604
|
+
} = props;
|
|
14605
|
+
const changeToCurrentTab = () => {
|
|
14581
14606
|
if (isAnyDisabled) {
|
|
14582
14607
|
return;
|
|
14583
14608
|
}
|
|
14584
|
-
|
|
14585
|
-
}
|
|
14586
|
-
const
|
|
14587
|
-
|
|
14588
|
-
if (
|
|
14609
|
+
changeToTab?.();
|
|
14610
|
+
};
|
|
14611
|
+
const onFocus = event => {
|
|
14612
|
+
handleFocus?.(event);
|
|
14613
|
+
if (shouldActivateOnFocus) {
|
|
14589
14614
|
changeToCurrentTab();
|
|
14590
14615
|
}
|
|
14591
|
-
}
|
|
14592
|
-
const
|
|
14593
|
-
|
|
14616
|
+
};
|
|
14617
|
+
const onKeyPress = event => {
|
|
14618
|
+
handleKeyPress?.(event);
|
|
14594
14619
|
if (event.key !== 'Enter' || isAnyDisabled) {
|
|
14595
14620
|
return;
|
|
14596
14621
|
}
|
|
14597
14622
|
changeToCurrentTab();
|
|
14598
|
-
}
|
|
14623
|
+
};
|
|
14599
14624
|
return /*#__PURE__*/jsxs("button", {
|
|
14600
14625
|
ref: ref,
|
|
14601
14626
|
...forwardedProps,
|
|
14602
14627
|
type: "button",
|
|
14603
|
-
id:
|
|
14604
|
-
className:
|
|
14628
|
+
id: tabId,
|
|
14629
|
+
className: classnames(className, block$9({
|
|
14605
14630
|
'is-active': isActive,
|
|
14606
14631
|
'is-disabled': isAnyDisabled
|
|
14607
14632
|
})),
|
|
14608
14633
|
onClick: changeToCurrentTab,
|
|
14609
|
-
onKeyPress:
|
|
14610
|
-
onFocus:
|
|
14634
|
+
onKeyPress: onKeyPress,
|
|
14635
|
+
onFocus: onFocus,
|
|
14611
14636
|
role: "tab",
|
|
14612
14637
|
tabIndex: isActive ? 0 : tabIndex,
|
|
14613
14638
|
"aria-disabled": isAnyDisabled,
|
|
14614
14639
|
"aria-selected": isActive,
|
|
14615
|
-
"aria-controls":
|
|
14640
|
+
"aria-controls": tabPanelId,
|
|
14616
14641
|
children: [icon && /*#__PURE__*/jsx(Icon, {
|
|
14617
14642
|
icon: icon,
|
|
14618
|
-
size: Size
|
|
14643
|
+
size: Size.xs,
|
|
14619
14644
|
...iconProps
|
|
14620
14645
|
}), label && /*#__PURE__*/jsx(Text, {
|
|
14621
14646
|
as: "span",
|
|
@@ -14623,6 +14648,47 @@ const Tab = forwardRef((props, ref) => {
|
|
|
14623
14648
|
children: label
|
|
14624
14649
|
})]
|
|
14625
14650
|
});
|
|
14651
|
+
};
|
|
14652
|
+
|
|
14653
|
+
/**
|
|
14654
|
+
* Defines the props of the component.
|
|
14655
|
+
*/
|
|
14656
|
+
|
|
14657
|
+
/**
|
|
14658
|
+
* Tab component.
|
|
14659
|
+
*
|
|
14660
|
+
* Implements WAI-ARIA `tab` role {@see https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html#rps_label}
|
|
14661
|
+
*
|
|
14662
|
+
* @param props Component props.
|
|
14663
|
+
* @param ref Component ref.
|
|
14664
|
+
* @return React element.
|
|
14665
|
+
*/
|
|
14666
|
+
const Tab = forwardRef((props, ref) => {
|
|
14667
|
+
const {
|
|
14668
|
+
isAnyDisabled,
|
|
14669
|
+
otherProps
|
|
14670
|
+
} = useDisableStateProps(props);
|
|
14671
|
+
const {
|
|
14672
|
+
isActive: propIsActive,
|
|
14673
|
+
id,
|
|
14674
|
+
onFocus,
|
|
14675
|
+
onKeyPress,
|
|
14676
|
+
...forwardedProps
|
|
14677
|
+
} = otherProps;
|
|
14678
|
+
const state = useTabProviderContext('tab', id);
|
|
14679
|
+
const isActive = propIsActive || state?.isActive;
|
|
14680
|
+
return Tab$1({
|
|
14681
|
+
id,
|
|
14682
|
+
...state,
|
|
14683
|
+
Icon,
|
|
14684
|
+
Text,
|
|
14685
|
+
ref,
|
|
14686
|
+
isActive,
|
|
14687
|
+
isAnyDisabled,
|
|
14688
|
+
handleFocus: onFocus,
|
|
14689
|
+
handleKeyPress: onKeyPress,
|
|
14690
|
+
...forwardedProps
|
|
14691
|
+
});
|
|
14626
14692
|
});
|
|
14627
14693
|
Tab.displayName = COMPONENT_NAME$6;
|
|
14628
14694
|
Tab.className = CLASSNAME$7;
|
|
@@ -14639,7 +14705,7 @@ const COMPONENT_NAME$5 = 'TabPanel';
|
|
|
14639
14705
|
const CLASSNAME$6 = `lumx-tab-panel`;
|
|
14640
14706
|
const {
|
|
14641
14707
|
block: block$8
|
|
14642
|
-
} =
|
|
14708
|
+
} = bem(CLASSNAME$6);
|
|
14643
14709
|
|
|
14644
14710
|
/**
|
|
14645
14711
|
* Component default props.
|
|
@@ -14655,27 +14721,59 @@ const DEFAULT_PROPS$9 = {};
|
|
|
14655
14721
|
* @param ref Component ref.
|
|
14656
14722
|
* @return React element.
|
|
14657
14723
|
*/
|
|
14658
|
-
const TabPanel =
|
|
14724
|
+
const TabPanel$1 = props => {
|
|
14659
14725
|
const {
|
|
14660
14726
|
children,
|
|
14661
|
-
id,
|
|
14662
14727
|
className,
|
|
14663
|
-
isActive
|
|
14728
|
+
isActive,
|
|
14729
|
+
id,
|
|
14730
|
+
tabId,
|
|
14731
|
+
isLazy,
|
|
14732
|
+
ref,
|
|
14664
14733
|
...forwardedProps
|
|
14665
14734
|
} = props;
|
|
14666
|
-
const state = useTabProviderContext('tabPanel', id);
|
|
14667
|
-
const isActive = propIsActive || state?.isActive;
|
|
14668
14735
|
return /*#__PURE__*/jsx("div", {
|
|
14669
14736
|
ref: ref,
|
|
14670
14737
|
...forwardedProps,
|
|
14671
|
-
id:
|
|
14672
|
-
className:
|
|
14738
|
+
id: id,
|
|
14739
|
+
className: classnames(className, block$8({
|
|
14673
14740
|
'is-active': isActive
|
|
14674
14741
|
})),
|
|
14675
14742
|
role: "tabpanel",
|
|
14676
14743
|
tabIndex: isActive ? 0 : -1,
|
|
14677
|
-
"aria-labelledby":
|
|
14678
|
-
children: (!
|
|
14744
|
+
"aria-labelledby": tabId,
|
|
14745
|
+
children: (!isLazy || isActive) && children
|
|
14746
|
+
});
|
|
14747
|
+
};
|
|
14748
|
+
|
|
14749
|
+
/**
|
|
14750
|
+
* Defines the props of the component.
|
|
14751
|
+
*/
|
|
14752
|
+
|
|
14753
|
+
/**
|
|
14754
|
+
* TabPanel component.
|
|
14755
|
+
*
|
|
14756
|
+
* Implements WAI-ARIA `tabpanel` role {@see https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html#rps_label}
|
|
14757
|
+
*
|
|
14758
|
+
* @param props Component props.
|
|
14759
|
+
* @param ref Component ref.
|
|
14760
|
+
* @return React element.
|
|
14761
|
+
*/
|
|
14762
|
+
const TabPanel = forwardRef((props, ref) => {
|
|
14763
|
+
const {
|
|
14764
|
+
id,
|
|
14765
|
+
isActive: propIsActive,
|
|
14766
|
+
...forwardedProps
|
|
14767
|
+
} = props;
|
|
14768
|
+
const state = useTabProviderContext('tabPanel', id);
|
|
14769
|
+
const isActive = propIsActive || state?.isActive;
|
|
14770
|
+
return TabPanel$1({
|
|
14771
|
+
ref,
|
|
14772
|
+
isActive,
|
|
14773
|
+
id: state?.tabPanelId,
|
|
14774
|
+
isLazy: state?.isLazy,
|
|
14775
|
+
tabId: state?.tabId,
|
|
14776
|
+
...forwardedProps
|
|
14679
14777
|
});
|
|
14680
14778
|
});
|
|
14681
14779
|
TabPanel.displayName = COMPONENT_NAME$5;
|