@lumx/core 4.19.1-alpha.0 → 4.19.1-alpha.2

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.
@@ -11121,6 +11121,9 @@ table {
11121
11121
  position: relative;
11122
11122
  display: flex;
11123
11123
  }
11124
+ .lumx-tabs__link {
11125
+ text-decoration: none;
11126
+ }
11124
11127
  .lumx-tabs__link:not(.lumx-tabs__link--is-active):not(.lumx-tabs__link--is-disabled) {
11125
11128
  position: relative;
11126
11129
  display: flex;
@@ -1,9 +1,14 @@
1
- import { CommonRef, HasClassName, JSXElement } from '../../types';
1
+ import { CommonRef, ElementType, HasClassName, HasRequiredLinkHref, JSXElement } from '../../types';
2
2
  import { IconProps } from '../Icon';
3
3
  /**
4
- * Defines the props of the component.
4
+ * Element a `Tab` can render as: `'button'` (default, classic tab), `'a'` (nav-link, `href`
5
+ * required via {@link HasRequiredLinkHref}), or any `ElementType` (nav-link, e.g. a router `Link`).
5
6
  */
6
- export interface TabProps extends HasClassName {
7
+ export type TabElement = 'a' | 'button' | ElementType;
8
+ /**
9
+ * Defines the props of the component (independent of the `as` element).
10
+ */
11
+ export interface CommonTabProps extends HasClassName {
7
12
  /** Children are not supported. */
8
13
  children?: never;
9
14
  /** Icon (SVG path). */
@@ -14,6 +19,8 @@ export interface TabProps extends HasClassName {
14
19
  id?: string;
15
20
  /** Whether the tab is active or not. */
16
21
  isActive?: boolean;
22
+ /** Synonym for `isActive` — `'page'` marks the tab as active (WAI-ARIA nav-link convention). */
23
+ 'aria-current'?: 'page' | boolean;
17
24
  /** Whether the component is disabled or not. */
18
25
  isDisabled?: boolean;
19
26
  /** Label content. */
@@ -42,10 +49,24 @@ export interface TabProps extends HasClassName {
42
49
  Icon: any;
43
50
  /** Text component injected by the framework wrapper. */
44
51
  Text: any;
45
- /** Forward ref to the underlying button element. */
52
+ /** Forward ref to the underlying element. */
46
53
  ref?: CommonRef;
47
54
  }
48
- export type TabPropsToOverride = 'isAnyDisabled' | 'shouldActivateOnFocus' | 'changeToTab' | 'tabIndex' | 'tabIndexProp' | 'keyPressProp' | 'tabId' | 'tabPanelId' | 'Icon' | 'Text';
55
+ /**
56
+ * Polymorphic `as` surface for `Tab`. Not `HasPolymorphicAs<E>`: core JSX is type-checked under
57
+ * both the React and Vue namespaces, so spreading React DOM prop types would break the Vue
58
+ * cross-check. `href` is required at compile time when `as === 'a'` (via {@link HasRequiredLinkHref}).
59
+ */
60
+ export type TabAsProps<E extends TabElement = 'button'> = {
61
+ as?: E;
62
+ } & (E extends 'a' ? HasRequiredLinkHref<'a'> : unknown);
63
+ /**
64
+ * Props of the `Tab` component. Polymorphic on `as`: setting it enters **nav-link mode**,
65
+ * rendering that element instead of a `<button role="tab">`. The `href` conditional's false
66
+ * branch is `unknown` (not a record) to avoid widening `keyof TabProps`.
67
+ */
68
+ export type TabProps<E extends TabElement = 'button'> = CommonTabProps & TabAsProps<E>;
69
+ export type TabPropsToOverride = 'as' | 'isAnyDisabled' | 'shouldActivateOnFocus' | 'changeToTab' | 'tabIndex' | 'tabIndexProp' | 'keyPressProp' | 'tabId' | 'tabPanelId' | 'Icon' | 'Text';
49
70
  /**
50
71
  * Component display name.
51
72
  */
@@ -59,12 +80,13 @@ export declare const DEFAULT_PROPS: Partial<TabProps>;
59
80
  */
60
81
  export declare const CLASSNAME = "lumx-tabs__link";
61
82
  /**
62
- * Tab component.
63
- *
64
- * Implements WAI-ARIA `tab` role {@see https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html#rps_label}
83
+ * Tab component. Two modes keyed on `as`: classic (no `as`) implements the WAI-ARIA `tab` role
84
+ * {@see https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html#rps_label};
85
+ * nav-link (`as` set) renders plain link semantics (`aria-current`, no tab role/aria), decoupled
86
+ * from the TabProvider.
65
87
  *
66
88
  * @param props Component props.
67
89
  * @param ref Component ref.
68
90
  * @return React element.
69
91
  */
70
- export declare const Tab: (props: TabProps) => import("react").JSX.Element;
92
+ export declare const Tab: <E extends TabElement = "button">(props: TabProps<E>) => import("react").JSX.Element;
@@ -16,9 +16,12 @@ export interface TabListProps extends HasClassName, HasTheme {
16
16
  layout?: TabListLayout;
17
17
  /** Position of the tabs in the list (requires 'clustered' layout). */
18
18
  position?: Alignment;
19
+ /** `role` applied to the inner `__links` container */
20
+ role?: 'navigation' | 'tablist';
19
21
  /** ref to the wrapper element */
20
22
  ref?: CommonRef;
21
23
  }
24
+ export type TabListPropsToOverride = 'role';
22
25
  /**
23
26
  * Component display name.
24
27
  */
@@ -2,4 +2,7 @@
2
2
  * Wrap `fn` so that, no matter how many times the returned function is called within the same
3
3
  * microtask cycle, `fn` only runs once at the end of that cycle.
4
4
  */
5
- export declare function debounceMicrotask(fn: () => void): () => void;
5
+ export declare function debounceMicrotask(fn: () => void): {
6
+ (): void;
7
+ cancel(): void;
8
+ };
package/lumx.css CHANGED
@@ -11802,6 +11802,9 @@ table {
11802
11802
  position: relative;
11803
11803
  display: flex;
11804
11804
  }
11805
+ .lumx-tabs__link {
11806
+ text-decoration: none;
11807
+ }
11805
11808
  .lumx-tabs__link:not(.lumx-tabs__link--is-active):not(.lumx-tabs__link--is-disabled) {
11806
11809
  position: relative;
11807
11810
  display: flex;
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.0",
10
+ "@lumx/icons": "^4.19.1-alpha.2",
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.0",
69
+ "version": "4.19.1-alpha.2",
70
70
  "devDependencies": {
71
71
  "@rollup/plugin-typescript": "^12.3.0",
72
72
  "@testing-library/dom": "^10.4.1",
@@ -16,6 +16,8 @@
16
16
  }
17
17
 
18
18
  &__link {
19
+ text-decoration: none;
20
+
19
21
  &:not(&--is-active):not(&--is-disabled) {
20
22
  @include lumx-tabs-link(lumx-base-const("emphasis", "LOW"));
21
23