@lumx/core 4.19.1-alpha.3 → 4.19.1-alpha.4
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/js/components/Tabs/Tab.d.ts +14 -9
- package/package.json +2 -2
|
@@ -21,6 +21,11 @@ export interface CommonTabProps extends HasClassName {
|
|
|
21
21
|
isActive?: boolean;
|
|
22
22
|
/** Synonym for `isActive` — `'page'` marks the tab as active (WAI-ARIA nav-link convention). */
|
|
23
23
|
'aria-current'?: 'page' | boolean;
|
|
24
|
+
/**
|
|
25
|
+
* WAI-ARIA `tab` role, resolved by the framework wrapper from `TabProvider` presence:
|
|
26
|
+
* `'tab'` inside a provider (classic tab mode), `undefined` outside (nav-link mode).
|
|
27
|
+
*/
|
|
28
|
+
role?: 'tab';
|
|
24
29
|
/** Whether the component is disabled or not. */
|
|
25
30
|
isDisabled?: boolean;
|
|
26
31
|
/** Label content. */
|
|
@@ -41,8 +46,6 @@ export interface CommonTabProps extends HasClassName {
|
|
|
41
46
|
tabIndexProp?: string;
|
|
42
47
|
/** Name of the prop used to attach the keypress event (framework-dependent). */
|
|
43
48
|
keyPressProp?: string;
|
|
44
|
-
/** ID applied to the tab button element (for aria-labelledby on the panel). */
|
|
45
|
-
tabId?: string;
|
|
46
49
|
/** ID of the associated tab panel (for aria-controls). */
|
|
47
50
|
tabPanelId?: string;
|
|
48
51
|
/** Icon component injected by the framework wrapper. */
|
|
@@ -61,12 +64,13 @@ export type TabAsProps<E extends TabElement = 'button'> = {
|
|
|
61
64
|
as?: E;
|
|
62
65
|
} & (E extends 'a' ? HasRequiredLinkHref<'a'> : unknown);
|
|
63
66
|
/**
|
|
64
|
-
* Props of the `Tab` component. Polymorphic on `as
|
|
65
|
-
*
|
|
66
|
-
* branch is `unknown` (not a record) to avoid
|
|
67
|
+
* Props of the `Tab` component. Polymorphic on `as` (element selection only): `as` picks the
|
|
68
|
+
* rendered element, while **mode is driven by `TabProvider` presence** (via the wrapper-resolved
|
|
69
|
+
* `role`), not by `as`. The `href` conditional's false branch is `unknown` (not a record) to avoid
|
|
70
|
+
* widening `keyof TabProps`.
|
|
67
71
|
*/
|
|
68
72
|
export type TabProps<E extends TabElement = 'button'> = CommonTabProps & TabAsProps<E>;
|
|
69
|
-
export type TabPropsToOverride = 'as' | 'isAnyDisabled' | 'shouldActivateOnFocus' | 'changeToTab' | 'tabIndex' | 'tabIndexProp' | 'keyPressProp' | '
|
|
73
|
+
export type TabPropsToOverride = 'as' | 'role' | 'isAnyDisabled' | 'shouldActivateOnFocus' | 'changeToTab' | 'tabIndex' | 'tabIndexProp' | 'keyPressProp' | 'tabPanelId' | 'Icon' | 'Text';
|
|
70
74
|
/**
|
|
71
75
|
* Component display name.
|
|
72
76
|
*/
|
|
@@ -80,10 +84,11 @@ export declare const DEFAULT_PROPS: Partial<TabProps>;
|
|
|
80
84
|
*/
|
|
81
85
|
export declare const CLASSNAME = "lumx-tabs__link";
|
|
82
86
|
/**
|
|
83
|
-
* Tab component. Two modes keyed on `
|
|
87
|
+
* Tab component. Two modes keyed on `TabProvider` presence (via the wrapper-resolved `role`):
|
|
88
|
+
* tab mode (`role === 'tab'`, inside a provider) implements the WAI-ARIA `tab` role
|
|
84
89
|
* {@see https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html#rps_label};
|
|
85
|
-
* nav-link (
|
|
86
|
-
*
|
|
90
|
+
* nav-link mode (no provider) renders plain link semantics (`aria-current`, no tab role/aria).
|
|
91
|
+
* `as` only selects the rendered element and applies in both modes.
|
|
87
92
|
*
|
|
88
93
|
* @param props Component props.
|
|
89
94
|
* @param ref Component ref.
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@floating-ui/dom": "^1.7.5",
|
|
10
|
-
"@lumx/icons": "^4.19.1-alpha.
|
|
10
|
+
"@lumx/icons": "^4.19.1-alpha.4",
|
|
11
11
|
"classnames": "^2.3.2",
|
|
12
12
|
"focus-visible": "^5.0.2",
|
|
13
13
|
"lodash": "4.18.1",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"update-version-changelog": "yarn version-changelog ../../CHANGELOG.md"
|
|
67
67
|
},
|
|
68
68
|
"sideEffects": false,
|
|
69
|
-
"version": "4.19.1-alpha.
|
|
69
|
+
"version": "4.19.1-alpha.4",
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
72
72
|
"@testing-library/dom": "^10.4.1",
|