@lumx/react 4.9.0-next.5 → 4.9.0-next.6
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 +46 -3
- package/index.js +76 -33
- package/index.js.map +1 -1
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -787,7 +787,7 @@ interface ButtonProps extends GenericProps$1, ReactToJSX<ButtonProps$1> {
|
|
|
787
787
|
* @param ref Component ref.
|
|
788
788
|
* @return React element.
|
|
789
789
|
*/
|
|
790
|
-
declare const Button: Comp<ButtonProps,
|
|
790
|
+
declare const Button: Comp<ButtonProps, HTMLAnchorElement | HTMLButtonElement>;
|
|
791
791
|
|
|
792
792
|
interface IconButtonProps$1 extends BaseButtonProps {
|
|
793
793
|
/**
|
|
@@ -2413,7 +2413,7 @@ interface LinkProps extends GenericProps$1, ReactToJSX<LinkProps$1> {
|
|
|
2413
2413
|
* @param ref Component ref.
|
|
2414
2414
|
* @return React element.
|
|
2415
2415
|
*/
|
|
2416
|
-
declare const Link: Comp<LinkProps,
|
|
2416
|
+
declare const Link: Comp<LinkProps, HTMLAnchorElement | HTMLButtonElement>;
|
|
2417
2417
|
|
|
2418
2418
|
/**
|
|
2419
2419
|
* Defines the props of the component.
|
|
@@ -3822,7 +3822,50 @@ declare const TabList: Comp<TabListProps, HTMLDivElement>;
|
|
|
3822
3822
|
/**
|
|
3823
3823
|
* Defines the props of the component.
|
|
3824
3824
|
*/
|
|
3825
|
-
interface TabProps extends
|
|
3825
|
+
interface TabProps$1 extends HasClassName {
|
|
3826
|
+
/** Children are not supported. */
|
|
3827
|
+
children?: never;
|
|
3828
|
+
/** Icon (SVG path). */
|
|
3829
|
+
icon?: IconProps$1['icon'];
|
|
3830
|
+
/** Icon component properties. */
|
|
3831
|
+
iconProps?: Omit<IconProps$1, 'icon'>;
|
|
3832
|
+
/** Native id property. */
|
|
3833
|
+
id?: string;
|
|
3834
|
+
/** Whether the tab is active or not. */
|
|
3835
|
+
isActive?: boolean;
|
|
3836
|
+
/** Whether the component is disabled or not. */
|
|
3837
|
+
isDisabled?: boolean;
|
|
3838
|
+
/** Label content. */
|
|
3839
|
+
label: string | JSXElement;
|
|
3840
|
+
/** Whether any tab in the list is disabled (used to block interaction). */
|
|
3841
|
+
isAnyDisabled?: boolean;
|
|
3842
|
+
/** Whether the tab should become active when it receives focus (automatic activation pattern). */
|
|
3843
|
+
shouldActivateOnFocus?: boolean;
|
|
3844
|
+
/** Focus event handler injected by TabList. */
|
|
3845
|
+
handleFocus?: (event: any) => void;
|
|
3846
|
+
/** Keypress event handler injected by TabList. */
|
|
3847
|
+
handleKeyPress?: (event: any) => void;
|
|
3848
|
+
/** Callback to activate this tab, injected by TabList. */
|
|
3849
|
+
changeToTab?: () => void;
|
|
3850
|
+
/** Tab index for roving tabindex management. */
|
|
3851
|
+
tabIndex?: number;
|
|
3852
|
+
/** ID applied to the tab button element (for aria-labelledby on the panel). */
|
|
3853
|
+
tabId?: string;
|
|
3854
|
+
/** ID of the associated tab panel (for aria-controls). */
|
|
3855
|
+
tabPanelId?: string;
|
|
3856
|
+
/** Icon component injected by the framework wrapper. */
|
|
3857
|
+
Icon: any;
|
|
3858
|
+
/** Text component injected by the framework wrapper. */
|
|
3859
|
+
Text: any;
|
|
3860
|
+
/** Forward ref to the underlying button element. */
|
|
3861
|
+
ref?: CommonRef;
|
|
3862
|
+
}
|
|
3863
|
+
type TabPropsToOverride = 'isAnyDisabled' | 'shouldActivateOnFocus' | 'changeToTab' | 'tabIndex' | 'tabId' | 'tabPanelId' | 'Icon' | 'Text';
|
|
3864
|
+
|
|
3865
|
+
/**
|
|
3866
|
+
* Defines the props of the component.
|
|
3867
|
+
*/
|
|
3868
|
+
interface TabProps extends GenericProps$1, ReactToJSX<TabProps$1, TabPropsToOverride> {
|
|
3826
3869
|
/** Children are not supported. */
|
|
3827
3870
|
children?: never;
|
|
3828
3871
|
/** Icon (SVG path). */
|
package/index.js
CHANGED
|
@@ -14536,18 +14536,18 @@ TabList.defaultProps = DEFAULT_PROPS$b;
|
|
|
14536
14536
|
*/
|
|
14537
14537
|
const COMPONENT_NAME$6 = 'Tab';
|
|
14538
14538
|
|
|
14539
|
+
/**
|
|
14540
|
+
* Component default props.
|
|
14541
|
+
*/
|
|
14542
|
+
const DEFAULT_PROPS$a = {};
|
|
14543
|
+
|
|
14539
14544
|
/**
|
|
14540
14545
|
* Component default class name and class prefix.
|
|
14541
14546
|
*/
|
|
14542
14547
|
const CLASSNAME$7 = `${TABS_CLASSNAME}__link`;
|
|
14543
14548
|
const {
|
|
14544
14549
|
block: block$9
|
|
14545
|
-
} =
|
|
14546
|
-
|
|
14547
|
-
/**
|
|
14548
|
-
* Component default props.
|
|
14549
|
-
*/
|
|
14550
|
-
const DEFAULT_PROPS$a = {};
|
|
14550
|
+
} = bem(CLASSNAME$7);
|
|
14551
14551
|
|
|
14552
14552
|
/**
|
|
14553
14553
|
* Tab component.
|
|
@@ -14558,64 +14558,66 @@ const DEFAULT_PROPS$a = {};
|
|
|
14558
14558
|
* @param ref Component ref.
|
|
14559
14559
|
* @return React element.
|
|
14560
14560
|
*/
|
|
14561
|
-
const Tab =
|
|
14562
|
-
const {
|
|
14563
|
-
isAnyDisabled,
|
|
14564
|
-
otherProps
|
|
14565
|
-
} = useDisableStateProps(props);
|
|
14561
|
+
const Tab$1 = props => {
|
|
14566
14562
|
const {
|
|
14567
14563
|
className,
|
|
14568
14564
|
icon,
|
|
14569
14565
|
iconProps = {},
|
|
14566
|
+
isAnyDisabled,
|
|
14570
14567
|
id,
|
|
14571
|
-
isActive
|
|
14568
|
+
isActive,
|
|
14572
14569
|
label,
|
|
14573
|
-
|
|
14574
|
-
|
|
14570
|
+
handleFocus,
|
|
14571
|
+
handleKeyPress,
|
|
14575
14572
|
tabIndex = -1,
|
|
14573
|
+
changeToTab,
|
|
14574
|
+
tabPanelId,
|
|
14575
|
+
shouldActivateOnFocus,
|
|
14576
|
+
tabId,
|
|
14577
|
+
Icon,
|
|
14578
|
+
Text,
|
|
14579
|
+
ref,
|
|
14576
14580
|
...forwardedProps
|
|
14577
|
-
} =
|
|
14578
|
-
const
|
|
14579
|
-
const isActive = propIsActive || state?.isActive;
|
|
14580
|
-
const changeToCurrentTab = useCallback(() => {
|
|
14581
|
+
} = props;
|
|
14582
|
+
const changeToCurrentTab = () => {
|
|
14581
14583
|
if (isAnyDisabled) {
|
|
14582
14584
|
return;
|
|
14583
14585
|
}
|
|
14584
|
-
|
|
14585
|
-
}
|
|
14586
|
-
const
|
|
14587
|
-
|
|
14588
|
-
if (
|
|
14586
|
+
changeToTab?.();
|
|
14587
|
+
};
|
|
14588
|
+
const onFocus = event => {
|
|
14589
|
+
handleFocus?.(event);
|
|
14590
|
+
if (shouldActivateOnFocus) {
|
|
14589
14591
|
changeToCurrentTab();
|
|
14590
14592
|
}
|
|
14591
|
-
}
|
|
14592
|
-
const
|
|
14593
|
-
|
|
14593
|
+
};
|
|
14594
|
+
const onKeyPress = event => {
|
|
14595
|
+
handleKeyPress?.(event);
|
|
14594
14596
|
if (event.key !== 'Enter' || isAnyDisabled) {
|
|
14595
14597
|
return;
|
|
14596
14598
|
}
|
|
14597
14599
|
changeToCurrentTab();
|
|
14598
|
-
}
|
|
14600
|
+
};
|
|
14599
14601
|
return /*#__PURE__*/jsxs("button", {
|
|
14600
14602
|
ref: ref,
|
|
14601
14603
|
...forwardedProps,
|
|
14602
14604
|
type: "button",
|
|
14603
|
-
id:
|
|
14604
|
-
className:
|
|
14605
|
+
id: tabId,
|
|
14606
|
+
className: classnames(className, block$9({
|
|
14605
14607
|
'is-active': isActive,
|
|
14606
14608
|
'is-disabled': isAnyDisabled
|
|
14607
14609
|
})),
|
|
14608
14610
|
onClick: changeToCurrentTab,
|
|
14609
|
-
onKeyPress:
|
|
14610
|
-
onFocus:
|
|
14611
|
+
onKeyPress: onKeyPress,
|
|
14612
|
+
onFocus: onFocus,
|
|
14611
14613
|
role: "tab",
|
|
14612
14614
|
tabIndex: isActive ? 0 : tabIndex,
|
|
14613
14615
|
"aria-disabled": isAnyDisabled,
|
|
14614
14616
|
"aria-selected": isActive,
|
|
14615
|
-
"aria-controls":
|
|
14617
|
+
"aria-controls": tabPanelId,
|
|
14616
14618
|
children: [icon && /*#__PURE__*/jsx(Icon, {
|
|
14617
14619
|
icon: icon,
|
|
14618
|
-
size: Size
|
|
14620
|
+
size: Size.xs,
|
|
14619
14621
|
...iconProps
|
|
14620
14622
|
}), label && /*#__PURE__*/jsx(Text, {
|
|
14621
14623
|
as: "span",
|
|
@@ -14623,6 +14625,47 @@ const Tab = forwardRef((props, ref) => {
|
|
|
14623
14625
|
children: label
|
|
14624
14626
|
})]
|
|
14625
14627
|
});
|
|
14628
|
+
};
|
|
14629
|
+
|
|
14630
|
+
/**
|
|
14631
|
+
* Defines the props of the component.
|
|
14632
|
+
*/
|
|
14633
|
+
|
|
14634
|
+
/**
|
|
14635
|
+
* Tab component.
|
|
14636
|
+
*
|
|
14637
|
+
* Implements WAI-ARIA `tab` role {@see https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html#rps_label}
|
|
14638
|
+
*
|
|
14639
|
+
* @param props Component props.
|
|
14640
|
+
* @param ref Component ref.
|
|
14641
|
+
* @return React element.
|
|
14642
|
+
*/
|
|
14643
|
+
const Tab = forwardRef((props, ref) => {
|
|
14644
|
+
const {
|
|
14645
|
+
isAnyDisabled,
|
|
14646
|
+
otherProps
|
|
14647
|
+
} = useDisableStateProps(props);
|
|
14648
|
+
const {
|
|
14649
|
+
isActive: propIsActive,
|
|
14650
|
+
id,
|
|
14651
|
+
onFocus,
|
|
14652
|
+
onKeyPress,
|
|
14653
|
+
...forwardedProps
|
|
14654
|
+
} = otherProps;
|
|
14655
|
+
const state = useTabProviderContext('tab', id);
|
|
14656
|
+
const isActive = propIsActive || state?.isActive;
|
|
14657
|
+
return Tab$1({
|
|
14658
|
+
id,
|
|
14659
|
+
...state,
|
|
14660
|
+
Icon,
|
|
14661
|
+
Text,
|
|
14662
|
+
ref,
|
|
14663
|
+
isActive,
|
|
14664
|
+
isAnyDisabled,
|
|
14665
|
+
handleFocus: onFocus,
|
|
14666
|
+
handleKeyPress: onKeyPress,
|
|
14667
|
+
...forwardedProps
|
|
14668
|
+
});
|
|
14626
14669
|
});
|
|
14627
14670
|
Tab.displayName = COMPONENT_NAME$6;
|
|
14628
14671
|
Tab.className = CLASSNAME$7;
|