@lumx/react 4.9.0-next.6 → 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 +33 -9
- package/index.js +83 -28
- 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, HTMLButtonElement | HTMLAnchorElement>;
|
|
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, HTMLButtonElement | HTMLAnchorElement>;
|
|
2417
2417
|
|
|
2418
2418
|
/**
|
|
2419
2419
|
* Defines the props of the component.
|
|
@@ -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;
|
|
3812
|
+
}
|
|
3813
|
+
|
|
3814
|
+
/**
|
|
3815
|
+
* Defines the props of the component.
|
|
3816
|
+
*/
|
|
3817
|
+
interface TabListProps extends GenericProps$1, ReactToJSX<TabListProps$1> {
|
|
3810
3818
|
}
|
|
3819
|
+
|
|
3811
3820
|
/**
|
|
3812
3821
|
* TabList component.
|
|
3813
3822
|
*
|
|
@@ -3895,13 +3904,28 @@ declare const Tab: Comp<TabProps, HTMLButtonElement>;
|
|
|
3895
3904
|
/**
|
|
3896
3905
|
* Defines the props of the component.
|
|
3897
3906
|
*/
|
|
3898
|
-
interface TabPanelProps extends
|
|
3899
|
-
/** Native id property */
|
|
3900
|
-
id?: string;
|
|
3907
|
+
interface TabPanelProps$1 extends HasClassName {
|
|
3901
3908
|
/** Whether the tab is active or not. */
|
|
3902
3909
|
isActive?: boolean;
|
|
3910
|
+
/** Whether the tab is lazy loaded or not */
|
|
3911
|
+
isLazy?: boolean;
|
|
3903
3912
|
/** Children */
|
|
3904
|
-
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;
|
|
3905
3929
|
}
|
|
3906
3930
|
/**
|
|
3907
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;
|
|
@@ -14682,7 +14705,7 @@ const COMPONENT_NAME$5 = 'TabPanel';
|
|
|
14682
14705
|
const CLASSNAME$6 = `lumx-tab-panel`;
|
|
14683
14706
|
const {
|
|
14684
14707
|
block: block$8
|
|
14685
|
-
} =
|
|
14708
|
+
} = bem(CLASSNAME$6);
|
|
14686
14709
|
|
|
14687
14710
|
/**
|
|
14688
14711
|
* Component default props.
|
|
@@ -14698,27 +14721,59 @@ const DEFAULT_PROPS$9 = {};
|
|
|
14698
14721
|
* @param ref Component ref.
|
|
14699
14722
|
* @return React element.
|
|
14700
14723
|
*/
|
|
14701
|
-
const TabPanel =
|
|
14724
|
+
const TabPanel$1 = props => {
|
|
14702
14725
|
const {
|
|
14703
14726
|
children,
|
|
14704
|
-
id,
|
|
14705
14727
|
className,
|
|
14706
|
-
isActive
|
|
14728
|
+
isActive,
|
|
14729
|
+
id,
|
|
14730
|
+
tabId,
|
|
14731
|
+
isLazy,
|
|
14732
|
+
ref,
|
|
14707
14733
|
...forwardedProps
|
|
14708
14734
|
} = props;
|
|
14709
|
-
const state = useTabProviderContext('tabPanel', id);
|
|
14710
|
-
const isActive = propIsActive || state?.isActive;
|
|
14711
14735
|
return /*#__PURE__*/jsx("div", {
|
|
14712
14736
|
ref: ref,
|
|
14713
14737
|
...forwardedProps,
|
|
14714
|
-
id:
|
|
14715
|
-
className:
|
|
14738
|
+
id: id,
|
|
14739
|
+
className: classnames(className, block$8({
|
|
14716
14740
|
'is-active': isActive
|
|
14717
14741
|
})),
|
|
14718
14742
|
role: "tabpanel",
|
|
14719
14743
|
tabIndex: isActive ? 0 : -1,
|
|
14720
|
-
"aria-labelledby":
|
|
14721
|
-
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
|
|
14722
14777
|
});
|
|
14723
14778
|
});
|
|
14724
14779
|
TabPanel.displayName = COMPONENT_NAME$5;
|