@lumx/core 4.9.0-next.6 → 4.9.0-next.8

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.
@@ -0,0 +1,39 @@
1
+ import { Alignment } from '../../constants';
2
+ import { CommonRef, HasClassName, HasTheme, JSXElement } from '../../types';
3
+ export declare enum TabListLayout {
4
+ clustered = "clustered",
5
+ fixed = "fixed"
6
+ }
7
+ /**
8
+ * Defines the props of the component.
9
+ */
10
+ export interface TabListProps extends HasClassName, HasTheme {
11
+ /** ARIA label (purpose of the set of tabs). */
12
+ ['aria-label']: string;
13
+ /** Tab list. */
14
+ children: JSXElement;
15
+ /** Layout of the tabs in the list. */
16
+ layout?: TabListLayout;
17
+ /** Position of the tabs in the list (requires 'clustered' layout). */
18
+ position?: Alignment;
19
+ /** ref to the wrapper element */
20
+ ref?: CommonRef;
21
+ }
22
+ /**
23
+ * Component display name.
24
+ */
25
+ export declare const COMPONENT_NAME = "TabList";
26
+ /**
27
+ * Component default props.
28
+ */
29
+ export declare const DEFAULT_PROPS: Partial<TabListProps>;
30
+ /**
31
+ * TabList component.
32
+ *
33
+ * Implements WAI-ARIA `tablist` role {@see https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html#rps_label}
34
+ *
35
+ * @param props Component props.
36
+ * @param ref Component ref.
37
+ * @return React element.
38
+ */
39
+ export declare const TabList: (props: TabListProps) => import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { SetupOptions } from '../../../testing';
2
+ /**
3
+ * Mounts the component and returns common DOM elements / data needed in multiple tests further down.
4
+ */
5
+ export declare const setup: (propsOverride: any | undefined, { render, ...options }: SetupOptions<any>) => {
6
+ props: any;
7
+ tabList: HTMLElement;
8
+ links: HTMLElement | null;
9
+ wrapper: Partial<import("../../../testing").SetupResult>;
10
+ };
11
+ declare const _default: (renderOptions: SetupOptions<any>) => void;
12
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { SetupOptions } from '../../../testing';
2
+ /**
3
+ * Mounts the component and returns common DOM elements / data needed in multiple tests further down.
4
+ */
5
+ export declare const setup: (propsOverride: any | undefined, { render, ...options }: SetupOptions<any>) => {
6
+ props: any;
7
+ tabPanel: HTMLElement;
8
+ wrapper: Partial<import("../../../testing").SetupResult>;
9
+ };
10
+ declare const _default: (renderOptions: SetupOptions<any>) => void;
11
+ export default _default;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Test util module. Do not import in production code!
3
+ */
4
+ export declare const createTabTestUtils: ({ screen, within }: {
5
+ screen: any;
6
+ within: any;
7
+ }) => {
8
+ query: {
9
+ tabList: (name: string) => any;
10
+ tabs: (tabList?: any) => any;
11
+ tab: (name: string, tabList?: any) => any;
12
+ tabPanel: (name: string) => any;
13
+ };
14
+ checkTabActive: (activeTabName: string, { isLazy }?: {
15
+ isLazy?: boolean | undefined;
16
+ }) => void;
17
+ };
@@ -0,0 +1,34 @@
1
+ export type TabType = 'tab' | 'tabPanel';
2
+ export interface State {
3
+ isLazy: boolean;
4
+ shouldActivateOnFocus: boolean;
5
+ activeTabIndex: number;
6
+ ids: Record<TabType, string[]>;
7
+ }
8
+ export declare const INIT_STATE: State;
9
+ export type Action = {
10
+ type: 'update';
11
+ payload: Partial<State>;
12
+ } | {
13
+ type: 'setActiveTabIndex';
14
+ payload: number;
15
+ } | {
16
+ type: 'register';
17
+ payload: {
18
+ type: TabType;
19
+ id: string;
20
+ };
21
+ } | {
22
+ type: 'unregister';
23
+ payload: {
24
+ type: TabType;
25
+ id: string;
26
+ };
27
+ };
28
+ export declare const reducer: (state: State, action: Action) => State;
29
+ export type TabState = Pick<Required<State>, 'isLazy' | 'shouldActivateOnFocus'> & {
30
+ isActive: boolean;
31
+ tabId: string;
32
+ tabPanelId: string;
33
+ changeToTab(): void;
34
+ };
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.9.0-next.6",
10
+ "@lumx/icons": "^4.9.0-next.8",
11
11
  "classnames": "^2.3.2",
12
12
  "focus-visible": "^5.0.2",
13
13
  "lodash": "4.17.23",
@@ -69,7 +69,7 @@
69
69
  "update-version-changelog": "yarn version-changelog ../../CHANGELOG.md"
70
70
  },
71
71
  "sideEffects": false,
72
- "version": "4.9.0-next.6",
72
+ "version": "4.9.0-next.8",
73
73
  "devDependencies": {
74
74
  "@rollup/plugin-typescript": "^12.3.0",
75
75
  "@testing-library/dom": "^10.4.1",