Skip to content

Commit f2d0af7

Browse files
committed
Add tab components to pos web component library
1 parent 30f4b40 commit f2d0af7

File tree

4 files changed

+206
-0
lines changed

4 files changed

+206
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/** VERSION: undefined **/
2+
/* eslint-disable import-x/extensions */
3+
/* eslint-disable @typescript-eslint/no-namespace */
4+
/* eslint-disable @typescript-eslint/member-ordering */
5+
/* eslint-disable line-comment-position */
6+
/* eslint-disable @typescript-eslint/unified-signatures */
7+
/* eslint-disable no-var */
8+
/* eslint-disable import-x/namespace */
9+
// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment
10+
/// <reference lib="DOM" />
11+
import type {TabProps,StringChildren,Key, Ref} from './components-shared.d.ts';
12+
13+
export type ComponentChildren = any;
14+
/**
15+
* Used when an element does not have children.
16+
*/
17+
export interface BaseElementProps<TClass = HTMLElement> {
18+
key?: Key;
19+
ref?: Ref<TClass>;
20+
slot?: Lowercase<string>;
21+
}
22+
/**
23+
* Used when an element has children.
24+
*/
25+
export interface BaseElementPropsWithChildren<TClass = HTMLElement> extends BaseElementProps<TClass> {
26+
children?: ComponentChildren;
27+
}
28+
export type IntrinsicElementProps<T> = T & BaseElementPropsWithChildren<T & HTMLElement>;
29+
export type HtmlElementTagNameProps<T> = T & HTMLElement;
30+
31+
declare const tagName = "s-tabs";
32+
export interface TabJSXProps extends Pick<TabProps, 'controls' | 'disabled'> {
33+
children?: StringChildren;
34+
}
35+
declare global {
36+
interface HTMLElementTagNameMap {
37+
[tagName]: HtmlElementTagNameProps<TabJSXProps>;
38+
}
39+
}
40+
declare module 'preact' {
41+
namespace createElement.JSX {
42+
interface IntrinsicElements {
43+
[tagName]: IntrinsicElementProps<TabJSXProps>;
44+
}
45+
}
46+
}
47+
48+
export { tagName };
49+
export type { TabJSXProps };
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/** VERSION: undefined **/
2+
/* eslint-disable import-x/extensions */
3+
/* eslint-disable @typescript-eslint/no-namespace */
4+
/* eslint-disable @typescript-eslint/member-ordering */
5+
/* eslint-disable line-comment-position */
6+
/* eslint-disable @typescript-eslint/unified-signatures */
7+
/* eslint-disable no-var */
8+
/* eslint-disable import-x/namespace */
9+
// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment
10+
/// <reference lib="DOM" />
11+
import type {TabListProps,Key, Ref} from './components-shared.d.ts';
12+
13+
export type ComponentChildren = any;
14+
/**
15+
* Used when an element does not have children.
16+
*/
17+
export interface BaseElementProps<TClass = HTMLElement> {
18+
key?: Key;
19+
ref?: Ref<TClass>;
20+
slot?: Lowercase<string>;
21+
}
22+
/**
23+
* Used when an element has children.
24+
*/
25+
export interface BaseElementPropsWithChildren<TClass = HTMLElement> extends BaseElementProps<TClass> {
26+
children?: ComponentChildren;
27+
}
28+
export type IntrinsicElementProps<T> = T & BaseElementPropsWithChildren<T & HTMLElement>;
29+
export type HtmlElementTagNameProps<T> = T & HTMLElement;
30+
31+
declare const tagName = "s-tab-list";
32+
export interface TabListJSXProps extends Pick<TabListProps, 'children'> {
33+
children?: ComponentChildren;
34+
}
35+
declare global {
36+
interface HTMLElementTagNameMap {
37+
[tagName]: HtmlElementTagNameProps<TabListJSXProps>;
38+
}
39+
}
40+
declare module 'preact' {
41+
namespace createElement.JSX {
42+
interface IntrinsicElements {
43+
[tagName]: IntrinsicElementProps<TabListJSXProps>;
44+
}
45+
}
46+
}
47+
48+
export { tagName };
49+
export type { TabListJSXProps };
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/** VERSION: undefined **/
2+
/* eslint-disable import-x/extensions */
3+
/* eslint-disable @typescript-eslint/no-namespace */
4+
/* eslint-disable @typescript-eslint/member-ordering */
5+
/* eslint-disable line-comment-position */
6+
/* eslint-disable @typescript-eslint/unified-signatures */
7+
/* eslint-disable no-var */
8+
/* eslint-disable import-x/namespace */
9+
// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment
10+
/// <reference lib="DOM" />
11+
import type {TabPanelProps,Key, Ref} from './components-shared.d.ts';
12+
13+
export type ComponentChildren = any;
14+
/**
15+
* Used when an element does not have children.
16+
*/
17+
export interface BaseElementProps<TClass = HTMLElement> {
18+
key?: Key;
19+
ref?: Ref<TClass>;
20+
slot?: Lowercase<string>;
21+
}
22+
/**
23+
* Used when an element has children.
24+
*/
25+
export interface BaseElementPropsWithChildren<TClass = HTMLElement> extends BaseElementProps<TClass> {
26+
children?: ComponentChildren;
27+
}
28+
export type IntrinsicElementProps<T> = T & BaseElementPropsWithChildren<T & HTMLElement>;
29+
export type HtmlElementTagNameProps<T> = T & HTMLElement;
30+
31+
declare const tagName = "s-tab-panel";
32+
export interface TabPanelJSXProps extends Pick<TabPanelProps, 'id'> {
33+
children?: ComponentChildren;
34+
}
35+
declare global {
36+
interface HTMLElementTagNameMap {
37+
[tagName]: HtmlElementTagNameProps<TabPanelJSXProps>;
38+
}
39+
}
40+
declare module 'preact' {
41+
namespace createElement.JSX {
42+
interface IntrinsicElements {
43+
[tagName]: IntrinsicElementProps<TabPanelJSXProps>;
44+
}
45+
}
46+
}
47+
48+
export { tagName };
49+
export type { TabPanelJSXProps };
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/** VERSION: undefined **/
2+
/* eslint-disable import-x/extensions */
3+
/* eslint-disable @typescript-eslint/no-namespace */
4+
/* eslint-disable @typescript-eslint/member-ordering */
5+
/* eslint-disable line-comment-position */
6+
/* eslint-disable @typescript-eslint/unified-signatures */
7+
/* eslint-disable no-var */
8+
/* eslint-disable import-x/namespace */
9+
// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment
10+
/// <reference lib="DOM" />
11+
import type {TabsProps,Key, Ref} from './components-shared.d.ts';
12+
13+
export type ComponentChildren = any;
14+
/**
15+
* Used when an element does not have children.
16+
*/
17+
export interface BaseElementProps<TClass = HTMLElement> {
18+
key?: Key;
19+
ref?: Ref<TClass>;
20+
slot?: Lowercase<string>;
21+
}
22+
/**
23+
* Used when an element has children.
24+
*/
25+
export interface BaseElementPropsWithChildren<TClass = HTMLElement> extends BaseElementProps<TClass> {
26+
children?: ComponentChildren;
27+
}
28+
export type IntrinsicElementProps<T> = T & BaseElementPropsWithChildren<T & HTMLElement>;
29+
export type HtmlElementTagNameProps<T> = T & HTMLElement;
30+
export interface CallbackEvent<T extends keyof HTMLElementTagNameMap> {
31+
currentTarget: HTMLElementTagNameMap[T];
32+
bubbles?: boolean;
33+
cancelable?: boolean;
34+
composed?: boolean;
35+
detail?: any;
36+
eventPhase: number;
37+
target: HTMLElementTagNameMap[T] | null;
38+
}
39+
40+
declare const tagName = "s-tab";
41+
export interface TabsJSXProps extends Pick<TabsProps, 'value' | 'defaultValue' | 'disabled'> {
42+
children?: ComponentChildren;
43+
onChange?: ((event: CallbackEvent<typeof tagName>) => void) | null;
44+
}
45+
declare global {
46+
interface HTMLElementTagNameMap {
47+
[tagName]: HtmlElementTagNameProps<TabsJSXProps>;
48+
}
49+
}
50+
declare module 'preact' {
51+
namespace createElement.JSX {
52+
interface IntrinsicElements {
53+
[tagName]: IntrinsicElementProps<TabsJSXProps>;
54+
}
55+
}
56+
}
57+
58+
export { tagName };
59+
export type { TabsJSXProps };

0 commit comments

Comments
 (0)