components-test-pb 0.0.1
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/dist/Components/Text/Text.d.ts +3 -0
- package/dist/Components/Text/Text.js +8 -0
- package/dist/Components/Text/Text.types.d.ts +11 -0
- package/dist/Components/Text/Text.types.js +1 -0
- package/dist/Components/Text/index.d.ts +2 -0
- package/dist/Components/Text/index.js +1 -0
- package/dist/Components/Text/renderText.d.ts +3 -0
- package/dist/Components/Text/renderText.js +6 -0
- package/dist/Components/Text/useText.d.ts +2 -0
- package/dist/Components/Text/useText.js +10 -0
- package/dist/Components/Text/useTextStyles.styles.d.ts +4 -0
- package/dist/Components/Text/useTextStyles.styles.js +42 -0
- package/dist/Types/compose/index.d.ts +1 -0
- package/dist/Types/compose/index.js +1 -0
- package/dist/Types/compose/types.d.ts +34 -0
- package/dist/Types/compose/types.js +1 -0
- package/dist/Types/utils/index.d.ts +1 -0
- package/dist/Types/utils/index.js +1 -0
- package/dist/Types/utils/types.d.ts +168 -0
- package/dist/Types/utils/types.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +28 -0
- package/src/Components/Text/Text.tsx +13 -0
- package/src/Components/Text/Text.types.ts +21 -0
- package/src/Components/Text/index.ts +7 -0
- package/src/Components/Text/renderText.tsx +9 -0
- package/src/Components/Text/useText.ts +16 -0
- package/src/Components/Text/useTextStyles.styles.ts +93 -0
- package/src/Types/compose/index.ts +12 -0
- package/src/Types/compose/types.ts +87 -0
- package/src/Types/utils/index.ts +30 -0
- package/src/Types/utils/types.ts +223 -0
- package/src/index.ts +0 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useText } from './useText.js';
|
|
2
|
+
import { renderText } from './renderText.js';
|
|
3
|
+
import { useTextStyles } from './useTextStyles.styles.js';
|
|
4
|
+
export const Text = (props) => {
|
|
5
|
+
const state = useText(props);
|
|
6
|
+
useTextStyles(state);
|
|
7
|
+
return renderText(state);
|
|
8
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ComponentProps, ComponentState, Slot } from '../../Types/compose/types.js';
|
|
2
|
+
export type TextSlots = {
|
|
3
|
+
root: Slot<'span', 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'pre' | 'strong' | 'b' | 'em' | 'i'>;
|
|
4
|
+
};
|
|
5
|
+
export type TextProps = ComponentProps<TextSlots> & {
|
|
6
|
+
font?: 'base' | 'monospace' | 'numeric';
|
|
7
|
+
size?: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 1000;
|
|
8
|
+
weight?: 'regular' | 'medium' | 'semibold' | 'bold';
|
|
9
|
+
};
|
|
10
|
+
export type TextPresetProps = Omit<TextProps, 'font' | 'size' | 'weight'>;
|
|
11
|
+
export type TextState = ComponentState<TextSlots> & Required<Pick<TextProps, 'font' | 'size' | 'weight'>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useText } from './useText.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const useText = (props) => {
|
|
2
|
+
const { font, size, weight, ...rest } = props;
|
|
3
|
+
return {
|
|
4
|
+
font: font ?? 'base',
|
|
5
|
+
size: size ?? 300,
|
|
6
|
+
weight: weight ?? 'regular',
|
|
7
|
+
components: { root: rest.as ?? 'span' },
|
|
8
|
+
root: { as: rest.as ?? 'span', ...rest },
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { makeStyles, mergeClasses } from 'css-engine-test-pb';
|
|
2
|
+
export const textClassNames = {
|
|
3
|
+
root: 'Text'
|
|
4
|
+
};
|
|
5
|
+
const useStyles = makeStyles({
|
|
6
|
+
root: {
|
|
7
|
+
fontFamily: 'Neue Montreal',
|
|
8
|
+
fontSize: '14px',
|
|
9
|
+
lineHeight: '20px',
|
|
10
|
+
fontWeight: 450,
|
|
11
|
+
display: 'inline',
|
|
12
|
+
whiteSpace: 'normal',
|
|
13
|
+
overflow: 'visible',
|
|
14
|
+
textOverflow: 'clip'
|
|
15
|
+
},
|
|
16
|
+
size100: {},
|
|
17
|
+
size200: {},
|
|
18
|
+
size300: {},
|
|
19
|
+
size400: {},
|
|
20
|
+
size500: {},
|
|
21
|
+
size600: {},
|
|
22
|
+
size700: {},
|
|
23
|
+
size800: {},
|
|
24
|
+
size900: {},
|
|
25
|
+
size1000: {},
|
|
26
|
+
monospace: {},
|
|
27
|
+
numeric: {},
|
|
28
|
+
weightMedium: {
|
|
29
|
+
fontWeight: 530
|
|
30
|
+
},
|
|
31
|
+
weightSemibold: {
|
|
32
|
+
fontWeight: 700
|
|
33
|
+
},
|
|
34
|
+
weightBold: {
|
|
35
|
+
fontWeight: 800
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
export const useTextStyles = (state) => {
|
|
39
|
+
const styles = useStyles();
|
|
40
|
+
state.root.className = mergeClasses(textClassNames.root, styles.root, state.size === 100 && styles.size100, state.size === 200 && styles.size200, state.size === 300 && styles.size300, state.size === 400 && styles.size400, state.size === 500 && styles.size500, state.size === 600 && styles.size600, state.size === 700 && styles.size700, state.size === 800 && styles.size800, state.size === 900 && styles.size900, state.size === 1000 && styles.size1000, state.font === 'monospace' && styles.monospace, state.font === 'numeric' && styles.numeric, state.weight === 'medium' && styles.weightMedium, state.weight === 'semibold' && styles.weightSemibold, state.weight === 'bold' && styles.weightBold);
|
|
41
|
+
return state;
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { SlotShorthandValue, SlotPropsRecord, UnknownSlotProps, Slot, IsSingleton, AsIntrinsicElement, ExtractSlotProps, ComponentProps, ComponentState, SlotClassNames, } from './types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ChildNode, ComponentType, IntrinsicElementKeys, IntrinsicElementProps, PropsWithoutChildren, ReplaceNullWithUndefined, HTMLAttributes, Element } from '../utils/types.js';
|
|
2
|
+
export type SlotShorthandValue = Element | string | number;
|
|
3
|
+
export type SlotPropsRecord = Record<string, UnknownSlotProps | SlotShorthandValue | null | undefined>;
|
|
4
|
+
export type UnknownSlotProps = Pick<HTMLAttributes<HTMLElement>, 'className' | 'style'> & {
|
|
5
|
+
as?: IntrinsicElementKeys;
|
|
6
|
+
children?: ChildNode;
|
|
7
|
+
};
|
|
8
|
+
type WithSlotShorthandValue<Props> = Props | ('children' extends keyof Props ? Extract<SlotShorthandValue, Props['children']> : never);
|
|
9
|
+
type EmptyIntrinsicElements = 'area' | 'base' | 'br' | 'col' | 'embed' | 'hr' | 'img' | 'input' | 'link' | 'meta' | 'param' | 'source' | 'track' | 'wbr';
|
|
10
|
+
type SlotIntrinsicElementProps<Type extends IntrinsicElementKeys> = Type extends EmptyIntrinsicElements ? PropsWithoutChildren<IntrinsicElementProps<Type>> : IntrinsicElementProps<Type>;
|
|
11
|
+
export type Slot<Type extends IntrinsicElementKeys | ComponentType<any> | UnknownSlotProps, AlternateAs extends IntrinsicElementKeys = never> = IsSingleton<Extract<Type, string>> extends true ? WithSlotShorthandValue<Type extends IntrinsicElementKeys ? {
|
|
12
|
+
as?: Type;
|
|
13
|
+
} & SlotIntrinsicElementProps<Type> : Type extends ComponentType<infer Props> ? Props extends UnknownSlotProps ? Props : Props : Type> | (AlternateAs extends unknown ? {
|
|
14
|
+
as: AlternateAs;
|
|
15
|
+
} & SlotIntrinsicElementProps<AlternateAs> : never) | null : 'Error: First parameter to Slot must not be not a union of types. See documentation of Slot type.';
|
|
16
|
+
export type IsSingleton<T extends string> = {
|
|
17
|
+
[K in T]: Exclude<T, K> extends never ? true : false;
|
|
18
|
+
}[T];
|
|
19
|
+
export type AsIntrinsicElement<As extends IntrinsicElementKeys> = {
|
|
20
|
+
as?: As;
|
|
21
|
+
};
|
|
22
|
+
export type ExtractSlotProps<S> = Exclude<S, SlotShorthandValue | null | undefined>;
|
|
23
|
+
export type ComponentProps<Slots extends SlotPropsRecord, Primary extends keyof Slots = 'root'> = Omit<Slots, Primary & 'root'> & ExtractSlotProps<Slots[Primary]>;
|
|
24
|
+
export type ComponentState<Slots extends SlotPropsRecord> = {
|
|
25
|
+
components: {
|
|
26
|
+
[Key in keyof Slots]-?: IntrinsicElementKeys | ComponentType;
|
|
27
|
+
};
|
|
28
|
+
} & {
|
|
29
|
+
[Key in keyof Slots]: ReplaceNullWithUndefined<Exclude<Slots[Key], SlotShorthandValue | (Key extends 'root' ? null : never)>>;
|
|
30
|
+
};
|
|
31
|
+
export type SlotClassNames<Slots> = {
|
|
32
|
+
[SlotName in keyof Slots]-?: string;
|
|
33
|
+
};
|
|
34
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ElementProps, Element, ElementChild, FC, HTMLAttributes, CSSProperties, DistributiveOmit, DistributivePick, UnionToIntersection, ReplaceNullWithUndefined, PropsWithoutChildren, FunctionComponent, ComponentType, ChildNode, AnchorNativeProps, ButtonNativeProps, FormNativeProps, InputNativeProps, TextareaNativeProps, SelectNativeProps, ImgNativeProps, LabelNativeProps, IntrinsicElementKeys, IntrinsicElementProps, } from './types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
export interface ElementProps {
|
|
2
|
+
children?: ElementChild | ElementChild[];
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}
|
|
5
|
+
export interface Element {
|
|
6
|
+
$$typeof: symbol;
|
|
7
|
+
type: string | Function | symbol;
|
|
8
|
+
props: ElementProps;
|
|
9
|
+
key: string | null;
|
|
10
|
+
}
|
|
11
|
+
export type ElementChild = Element | string | number | boolean | null | undefined | (() => any);
|
|
12
|
+
export type FC<P = {}> = (props: P) => Element | null;
|
|
13
|
+
export interface CSSProperties {
|
|
14
|
+
[key: string]: string | number;
|
|
15
|
+
}
|
|
16
|
+
export interface HTMLAttributes<T = HTMLElement> {
|
|
17
|
+
className?: string;
|
|
18
|
+
id?: string;
|
|
19
|
+
style?: CSSProperties;
|
|
20
|
+
title?: string;
|
|
21
|
+
lang?: string;
|
|
22
|
+
dir?: 'ltr' | 'rtl' | 'auto';
|
|
23
|
+
hidden?: boolean;
|
|
24
|
+
tabIndex?: number;
|
|
25
|
+
class?: never;
|
|
26
|
+
[key: `data-${string}`]: string | number | boolean | undefined;
|
|
27
|
+
role?: string;
|
|
28
|
+
[key: `aria-${string}`]: string | number | boolean | undefined;
|
|
29
|
+
onClick?: (event: MouseEvent) => void;
|
|
30
|
+
onDoubleClick?: (event: MouseEvent) => void;
|
|
31
|
+
onMouseDown?: (event: MouseEvent) => void;
|
|
32
|
+
onMouseUp?: (event: MouseEvent) => void;
|
|
33
|
+
onMouseEnter?: (event: MouseEvent) => void;
|
|
34
|
+
onMouseLeave?: (event: MouseEvent) => void;
|
|
35
|
+
onMouseMove?: (event: MouseEvent) => void;
|
|
36
|
+
onMouseOver?: (event: MouseEvent) => void;
|
|
37
|
+
onMouseOut?: (event: MouseEvent) => void;
|
|
38
|
+
onChange?: (event: Event) => void;
|
|
39
|
+
onInput?: (event: Event) => void;
|
|
40
|
+
onSubmit?: (event: Event) => void;
|
|
41
|
+
onFocus?: (event: FocusEvent) => void;
|
|
42
|
+
onBlur?: (event: FocusEvent) => void;
|
|
43
|
+
onKeyDown?: (event: KeyboardEvent) => void;
|
|
44
|
+
onKeyUp?: (event: KeyboardEvent) => void;
|
|
45
|
+
onKeyPress?: (event: KeyboardEvent) => void;
|
|
46
|
+
onScroll?: (event: Event) => void;
|
|
47
|
+
onWheel?: (event: WheelEvent) => void;
|
|
48
|
+
onDrag?: (event: DragEvent) => void;
|
|
49
|
+
onDragEnd?: (event: DragEvent) => void;
|
|
50
|
+
onDragEnter?: (event: DragEvent) => void;
|
|
51
|
+
onDragLeave?: (event: DragEvent) => void;
|
|
52
|
+
onDragOver?: (event: DragEvent) => void;
|
|
53
|
+
onDragStart?: (event: DragEvent) => void;
|
|
54
|
+
onDrop?: (event: DragEvent) => void;
|
|
55
|
+
onTouchStart?: (event: TouchEvent) => void;
|
|
56
|
+
onTouchMove?: (event: TouchEvent) => void;
|
|
57
|
+
onTouchEnd?: (event: TouchEvent) => void;
|
|
58
|
+
onTouchCancel?: (event: TouchEvent) => void;
|
|
59
|
+
children?: ElementChild | ElementChild[];
|
|
60
|
+
}
|
|
61
|
+
export type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : T;
|
|
62
|
+
export type DistributivePick<T, K> = T extends unknown ? Pick<T, K & keyof T> : never;
|
|
63
|
+
export type UnionToIntersection<U> = (U extends unknown ? (x: U) => U : never) extends (x: infer I) => U ? I : never;
|
|
64
|
+
export type ReplaceNullWithUndefined<T> = T extends null ? Exclude<T, null> | undefined : T;
|
|
65
|
+
export type PropsWithoutChildren<P> = 'children' extends keyof P ? DistributiveOmit<P, 'children'> : P;
|
|
66
|
+
export interface FunctionComponent<P> {
|
|
67
|
+
(props: P): Element | null;
|
|
68
|
+
displayName?: string;
|
|
69
|
+
}
|
|
70
|
+
export type ComponentType<P = {}> = FunctionComponent<P>;
|
|
71
|
+
export type ChildNode = ElementChild | ElementChild[];
|
|
72
|
+
export interface AnchorNativeProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
73
|
+
href?: string;
|
|
74
|
+
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
75
|
+
rel?: string;
|
|
76
|
+
download?: string | boolean;
|
|
77
|
+
hrefLang?: string;
|
|
78
|
+
type?: string;
|
|
79
|
+
}
|
|
80
|
+
export interface ButtonNativeProps extends HTMLAttributes<HTMLButtonElement> {
|
|
81
|
+
disabled?: boolean;
|
|
82
|
+
type?: 'button' | 'submit' | 'reset';
|
|
83
|
+
value?: string;
|
|
84
|
+
autoFocus?: boolean;
|
|
85
|
+
form?: string;
|
|
86
|
+
formAction?: string;
|
|
87
|
+
formEncType?: string;
|
|
88
|
+
formMethod?: string;
|
|
89
|
+
formNoValidate?: boolean;
|
|
90
|
+
formTarget?: string;
|
|
91
|
+
}
|
|
92
|
+
export interface FormNativeProps extends HTMLAttributes<HTMLFormElement> {
|
|
93
|
+
action?: string;
|
|
94
|
+
method?: 'get' | 'post';
|
|
95
|
+
encType?: string;
|
|
96
|
+
target?: string;
|
|
97
|
+
noValidate?: boolean;
|
|
98
|
+
autoComplete?: 'on' | 'off';
|
|
99
|
+
}
|
|
100
|
+
export interface InputNativeProps extends HTMLAttributes<HTMLInputElement> {
|
|
101
|
+
accept?: string;
|
|
102
|
+
alt?: string;
|
|
103
|
+
autoComplete?: string;
|
|
104
|
+
autoFocus?: boolean;
|
|
105
|
+
capture?: boolean | string;
|
|
106
|
+
checked?: boolean;
|
|
107
|
+
disabled?: boolean;
|
|
108
|
+
form?: string;
|
|
109
|
+
max?: number | string;
|
|
110
|
+
maxLength?: number;
|
|
111
|
+
min?: number | string;
|
|
112
|
+
minLength?: number;
|
|
113
|
+
multiple?: boolean;
|
|
114
|
+
name?: string;
|
|
115
|
+
pattern?: string;
|
|
116
|
+
placeholder?: string;
|
|
117
|
+
readOnly?: boolean;
|
|
118
|
+
required?: boolean;
|
|
119
|
+
size?: number;
|
|
120
|
+
src?: string;
|
|
121
|
+
step?: number | string;
|
|
122
|
+
type?: 'text' | 'password' | 'email' | 'number' | 'tel' | 'url' | 'search' | 'date' | 'time' | 'datetime-local' | 'month' | 'week' | 'checkbox' | 'radio' | 'file' | 'submit' | 'reset' | 'button' | 'hidden' | 'image' | 'color' | 'range';
|
|
123
|
+
value?: string | number;
|
|
124
|
+
}
|
|
125
|
+
export interface TextareaNativeProps extends HTMLAttributes<HTMLTextAreaElement> {
|
|
126
|
+
autoComplete?: string;
|
|
127
|
+
autoFocus?: boolean;
|
|
128
|
+
cols?: number;
|
|
129
|
+
disabled?: boolean;
|
|
130
|
+
form?: string;
|
|
131
|
+
maxLength?: number;
|
|
132
|
+
minLength?: number;
|
|
133
|
+
name?: string;
|
|
134
|
+
placeholder?: string;
|
|
135
|
+
readOnly?: boolean;
|
|
136
|
+
required?: boolean;
|
|
137
|
+
rows?: number;
|
|
138
|
+
value?: string;
|
|
139
|
+
wrap?: 'hard' | 'soft' | 'off';
|
|
140
|
+
}
|
|
141
|
+
export interface SelectNativeProps extends HTMLAttributes<HTMLSelectElement> {
|
|
142
|
+
autoComplete?: string;
|
|
143
|
+
autoFocus?: boolean;
|
|
144
|
+
disabled?: boolean;
|
|
145
|
+
form?: string;
|
|
146
|
+
multiple?: boolean;
|
|
147
|
+
name?: string;
|
|
148
|
+
required?: boolean;
|
|
149
|
+
size?: number;
|
|
150
|
+
value?: string | string[];
|
|
151
|
+
}
|
|
152
|
+
export interface ImgNativeProps extends HTMLAttributes<HTMLImageElement> {
|
|
153
|
+
alt?: string;
|
|
154
|
+
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
155
|
+
decoding?: 'async' | 'auto' | 'sync';
|
|
156
|
+
height?: number | string;
|
|
157
|
+
loading?: 'eager' | 'lazy';
|
|
158
|
+
sizes?: string;
|
|
159
|
+
src?: string;
|
|
160
|
+
srcSet?: string;
|
|
161
|
+
width?: number | string;
|
|
162
|
+
}
|
|
163
|
+
export interface LabelNativeProps extends HTMLAttributes<HTMLLabelElement> {
|
|
164
|
+
htmlFor?: string;
|
|
165
|
+
form?: string;
|
|
166
|
+
}
|
|
167
|
+
export type IntrinsicElementKeys = 'a' | 'abbr' | 'address' | 'area' | 'article' | 'aside' | 'audio' | 'b' | 'base' | 'blockquote' | 'body' | 'br' | 'button' | 'canvas' | 'caption' | 'cite' | 'code' | 'col' | 'colgroup' | 'datalist' | 'del' | 'details' | 'dialog' | 'div' | 'em' | 'fieldset' | 'figcaption' | 'figure' | 'footer' | 'form' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'head' | 'header' | 'hr' | 'html' | 'i' | 'iframe' | 'img' | 'input' | 'ins' | 'kbd' | 'label' | 'legend' | 'li' | 'link' | 'main' | 'mark' | 'menu' | 'meta' | 'meter' | 'nav' | 'ol' | 'optgroup' | 'option' | 'output' | 'p' | 'picture' | 'pre' | 'progress' | 'q' | 's' | 'script' | 'section' | 'select' | 'small' | 'source' | 'span' | 'strong' | 'style' | 'sub' | 'summary' | 'sup' | 'svg' | 'table' | 'tbody' | 'td' | 'template' | 'textarea' | 'tfoot' | 'th' | 'thead' | 'title' | 'tr' | 'track' | 'u' | 'ul' | 'video' | 'wbr' | 'circle' | 'ellipse' | 'line' | 'path' | 'polygon' | 'polyline' | 'rect' | 'g' | 'defs';
|
|
168
|
+
export type IntrinsicElementProps<Tag extends IntrinsicElementKeys> = Tag extends 'a' ? AnchorNativeProps : Tag extends 'button' ? ButtonNativeProps : Tag extends 'form' ? FormNativeProps : Tag extends 'input' ? InputNativeProps : Tag extends 'textarea' ? TextareaNativeProps : Tag extends 'select' ? SelectNativeProps : Tag extends 'img' ? ImgNativeProps : Tag extends 'label' ? LabelNativeProps : HTMLAttributes<HTMLElement>;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "components-test-pb",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"dev": "tsc --watch",
|
|
17
|
+
"prepublishOnly": "npm run build"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"jsx-framework-test-pb": "latest",
|
|
21
|
+
"css-engine-test-pb": "latest",
|
|
22
|
+
"typescript": "^5.9.3"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"jsx-framework-test-pb": "*",
|
|
26
|
+
"css-engine-test-pb": "*"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FC } from '../../Types/utils/types.js';
|
|
2
|
+
import type { TextProps } from './Text.types.js';
|
|
3
|
+
import { useText } from './useText.js';
|
|
4
|
+
import { renderText } from './renderText.js';
|
|
5
|
+
import { useTextStyles } from './useTextStyles.styles.js';
|
|
6
|
+
|
|
7
|
+
export const Text: FC<TextProps> = (props) => {
|
|
8
|
+
const state = useText(props);
|
|
9
|
+
|
|
10
|
+
useTextStyles(state);
|
|
11
|
+
|
|
12
|
+
return renderText(state);
|
|
13
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ComponentProps, ComponentState, Slot } from '../../Types/compose/types.js';
|
|
2
|
+
|
|
3
|
+
export type TextSlots = {
|
|
4
|
+
root: Slot<'span', 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'pre' | 'strong' | 'b' | 'em' | 'i'>;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type TextProps = ComponentProps<TextSlots> & {
|
|
8
|
+
font?: 'base' | 'monospace' | 'numeric';
|
|
9
|
+
size?: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 1000;
|
|
10
|
+
weight?: 'regular' | 'medium' | 'semibold' | 'bold';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type TextPresetProps = Omit<TextProps, 'font' | 'size' | 'weight'>;
|
|
14
|
+
|
|
15
|
+
export type TextState = ComponentState<TextSlots> &
|
|
16
|
+
Required<
|
|
17
|
+
Pick<
|
|
18
|
+
TextProps,
|
|
19
|
+
'font' | 'size' | 'weight'
|
|
20
|
+
>
|
|
21
|
+
>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Element } from '../../Types/utils/types.js';
|
|
2
|
+
import type { TextState } from './Text.types.js';
|
|
3
|
+
|
|
4
|
+
export const renderText = (state: TextState): Element => {
|
|
5
|
+
const Root = state.components.root;
|
|
6
|
+
const { as: _as, ...rootProps } = state.root;
|
|
7
|
+
|
|
8
|
+
return <Root {...rootProps} />;
|
|
9
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TextProps, TextState } from './Text.types.js';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export const useText = (props: TextProps): TextState => {
|
|
5
|
+
const { font, size, weight, ...rest } = props;
|
|
6
|
+
|
|
7
|
+
return {
|
|
8
|
+
font: font ?? 'base',
|
|
9
|
+
size: size ?? 300,
|
|
10
|
+
weight: weight ?? 'regular',
|
|
11
|
+
|
|
12
|
+
components: { root: rest.as ?? 'span' },
|
|
13
|
+
|
|
14
|
+
root: { as: rest.as ?? 'span', ...rest } as TextState['root'],
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { makeStyles, mergeClasses } from 'css-engine-test-pb';
|
|
2
|
+
import { SlotClassNames } from '../../Types/compose/types.js';
|
|
3
|
+
import { TextSlots, TextState } from './Text.types.js';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export const textClassNames: SlotClassNames<TextSlots> = {
|
|
7
|
+
root: 'Text'
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const useStyles = makeStyles({
|
|
11
|
+
root: {
|
|
12
|
+
fontFamily: 'Neue Montreal',
|
|
13
|
+
fontSize: '14px',
|
|
14
|
+
lineHeight: '20px',
|
|
15
|
+
fontWeight: 450,
|
|
16
|
+
display: 'inline',
|
|
17
|
+
whiteSpace: 'normal',
|
|
18
|
+
overflow: 'visible',
|
|
19
|
+
textOverflow: 'clip'
|
|
20
|
+
},
|
|
21
|
+
size100: {
|
|
22
|
+
|
|
23
|
+
},
|
|
24
|
+
size200: {
|
|
25
|
+
|
|
26
|
+
},
|
|
27
|
+
size300: {
|
|
28
|
+
|
|
29
|
+
},
|
|
30
|
+
size400: {
|
|
31
|
+
|
|
32
|
+
},
|
|
33
|
+
size500: {
|
|
34
|
+
|
|
35
|
+
},
|
|
36
|
+
size600: {
|
|
37
|
+
|
|
38
|
+
},
|
|
39
|
+
size700: {
|
|
40
|
+
|
|
41
|
+
},
|
|
42
|
+
size800: {
|
|
43
|
+
|
|
44
|
+
},
|
|
45
|
+
size900: {
|
|
46
|
+
|
|
47
|
+
},
|
|
48
|
+
size1000: {
|
|
49
|
+
|
|
50
|
+
},
|
|
51
|
+
monospace: {
|
|
52
|
+
|
|
53
|
+
},
|
|
54
|
+
numeric: {
|
|
55
|
+
|
|
56
|
+
},
|
|
57
|
+
weightMedium: {
|
|
58
|
+
fontWeight: 530
|
|
59
|
+
},
|
|
60
|
+
weightSemibold: {
|
|
61
|
+
fontWeight: 700
|
|
62
|
+
},
|
|
63
|
+
weightBold: {
|
|
64
|
+
fontWeight: 800
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const useTextStyles = (state: TextState): TextState => {
|
|
69
|
+
|
|
70
|
+
const styles = useStyles();
|
|
71
|
+
|
|
72
|
+
state.root.className = mergeClasses(
|
|
73
|
+
textClassNames.root,
|
|
74
|
+
styles.root,
|
|
75
|
+
state.size === 100 && styles.size100,
|
|
76
|
+
state.size === 200 && styles.size200,
|
|
77
|
+
state.size === 300 && styles.size300,
|
|
78
|
+
state.size === 400 && styles.size400,
|
|
79
|
+
state.size === 500 && styles.size500,
|
|
80
|
+
state.size === 600 && styles.size600,
|
|
81
|
+
state.size === 700 && styles.size700,
|
|
82
|
+
state.size === 800 && styles.size800,
|
|
83
|
+
state.size === 900 && styles.size900,
|
|
84
|
+
state.size === 1000 && styles.size1000,
|
|
85
|
+
state.font === 'monospace' && styles.monospace,
|
|
86
|
+
state.font === 'numeric' && styles.numeric,
|
|
87
|
+
state.weight === 'medium' && styles.weightMedium,
|
|
88
|
+
state.weight === 'semibold' && styles.weightSemibold,
|
|
89
|
+
state.weight === 'bold' && styles.weightBold
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
return state;
|
|
93
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ChildNode,
|
|
3
|
+
ComponentType,
|
|
4
|
+
IntrinsicElementKeys,
|
|
5
|
+
IntrinsicElementProps,
|
|
6
|
+
PropsWithoutChildren,
|
|
7
|
+
ReplaceNullWithUndefined,
|
|
8
|
+
HTMLAttributes,
|
|
9
|
+
Element,
|
|
10
|
+
} from '../utils/types.js';
|
|
11
|
+
|
|
12
|
+
export type SlotShorthandValue = Element | string | number;
|
|
13
|
+
|
|
14
|
+
export type SlotPropsRecord = Record<string, UnknownSlotProps | SlotShorthandValue | null | undefined>;
|
|
15
|
+
|
|
16
|
+
export type UnknownSlotProps = Pick<HTMLAttributes<HTMLElement>, 'className' | 'style'> & {
|
|
17
|
+
as?: IntrinsicElementKeys;
|
|
18
|
+
children?: ChildNode;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type WithSlotShorthandValue<Props> =
|
|
22
|
+
| Props
|
|
23
|
+
| ('children' extends keyof Props ? Extract<SlotShorthandValue, Props['children']> : never);
|
|
24
|
+
|
|
25
|
+
type EmptyIntrinsicElements =
|
|
26
|
+
| 'area'
|
|
27
|
+
| 'base'
|
|
28
|
+
| 'br'
|
|
29
|
+
| 'col'
|
|
30
|
+
| 'embed'
|
|
31
|
+
| 'hr'
|
|
32
|
+
| 'img'
|
|
33
|
+
| 'input'
|
|
34
|
+
| 'link'
|
|
35
|
+
| 'meta'
|
|
36
|
+
| 'param'
|
|
37
|
+
| 'source'
|
|
38
|
+
| 'track'
|
|
39
|
+
| 'wbr';
|
|
40
|
+
|
|
41
|
+
type SlotIntrinsicElementProps<Type extends IntrinsicElementKeys> = Type extends EmptyIntrinsicElements
|
|
42
|
+
? PropsWithoutChildren<IntrinsicElementProps<Type>>
|
|
43
|
+
: IntrinsicElementProps<Type>;
|
|
44
|
+
|
|
45
|
+
export type Slot<
|
|
46
|
+
Type extends IntrinsicElementKeys | ComponentType<any> | UnknownSlotProps,
|
|
47
|
+
AlternateAs extends IntrinsicElementKeys = never,
|
|
48
|
+
> = IsSingleton<Extract<Type, string>> extends true
|
|
49
|
+
?
|
|
50
|
+
| WithSlotShorthandValue<
|
|
51
|
+
Type extends IntrinsicElementKeys
|
|
52
|
+
? { as?: Type } & SlotIntrinsicElementProps<Type>
|
|
53
|
+
: Type extends ComponentType<infer Props>
|
|
54
|
+
? Props extends UnknownSlotProps
|
|
55
|
+
? Props
|
|
56
|
+
: Props
|
|
57
|
+
: Type
|
|
58
|
+
>
|
|
59
|
+
| (AlternateAs extends unknown
|
|
60
|
+
? { as: AlternateAs } & SlotIntrinsicElementProps<AlternateAs>
|
|
61
|
+
: never)
|
|
62
|
+
| null
|
|
63
|
+
: 'Error: First parameter to Slot must not be not a union of types. See documentation of Slot type.';
|
|
64
|
+
|
|
65
|
+
export type IsSingleton<T extends string> = { [K in T]: Exclude<T, K> extends never ? true : false }[T];
|
|
66
|
+
|
|
67
|
+
export type AsIntrinsicElement<As extends IntrinsicElementKeys> = { as?: As };
|
|
68
|
+
|
|
69
|
+
export type ExtractSlotProps<S> = Exclude<S, SlotShorthandValue | null | undefined>;
|
|
70
|
+
|
|
71
|
+
export type ComponentProps<Slots extends SlotPropsRecord, Primary extends keyof Slots = 'root'> =
|
|
72
|
+
Omit<Slots, Primary & 'root'> &
|
|
73
|
+
ExtractSlotProps<Slots[Primary]>;
|
|
74
|
+
|
|
75
|
+
export type ComponentState<Slots extends SlotPropsRecord> = {
|
|
76
|
+
components: {
|
|
77
|
+
[Key in keyof Slots]-?: IntrinsicElementKeys | ComponentType;
|
|
78
|
+
};
|
|
79
|
+
} & {
|
|
80
|
+
[Key in keyof Slots]: ReplaceNullWithUndefined<
|
|
81
|
+
Exclude<Slots[Key], SlotShorthandValue | (Key extends 'root' ? null : never)>
|
|
82
|
+
>;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export type SlotClassNames<Slots> = {
|
|
86
|
+
[SlotName in keyof Slots]-?: string;
|
|
87
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
ElementProps,
|
|
3
|
+
Element,
|
|
4
|
+
ElementChild,
|
|
5
|
+
FC,
|
|
6
|
+
HTMLAttributes,
|
|
7
|
+
CSSProperties,
|
|
8
|
+
|
|
9
|
+
DistributiveOmit,
|
|
10
|
+
DistributivePick,
|
|
11
|
+
UnionToIntersection,
|
|
12
|
+
ReplaceNullWithUndefined,
|
|
13
|
+
PropsWithoutChildren,
|
|
14
|
+
|
|
15
|
+
FunctionComponent,
|
|
16
|
+
ComponentType,
|
|
17
|
+
ChildNode,
|
|
18
|
+
|
|
19
|
+
AnchorNativeProps,
|
|
20
|
+
ButtonNativeProps,
|
|
21
|
+
FormNativeProps,
|
|
22
|
+
InputNativeProps,
|
|
23
|
+
TextareaNativeProps,
|
|
24
|
+
SelectNativeProps,
|
|
25
|
+
ImgNativeProps,
|
|
26
|
+
LabelNativeProps,
|
|
27
|
+
|
|
28
|
+
IntrinsicElementKeys,
|
|
29
|
+
IntrinsicElementProps,
|
|
30
|
+
} from './types.js';
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
// ---- Core framework types (defined here, not imported from framework) ----
|
|
2
|
+
|
|
3
|
+
export interface ElementProps {
|
|
4
|
+
children?: ElementChild | ElementChild[];
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface Element {
|
|
9
|
+
$$typeof: symbol;
|
|
10
|
+
type: string | Function | symbol;
|
|
11
|
+
props: ElementProps;
|
|
12
|
+
key: string | null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type ElementChild = Element | string | number | boolean | null | undefined | (() => any);
|
|
16
|
+
|
|
17
|
+
export type FC<P = {}> = (props: P) => Element | null;
|
|
18
|
+
|
|
19
|
+
export interface CSSProperties {
|
|
20
|
+
[key: string]: string | number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface HTMLAttributes<T = HTMLElement> {
|
|
24
|
+
className?: string;
|
|
25
|
+
id?: string;
|
|
26
|
+
style?: CSSProperties;
|
|
27
|
+
title?: string;
|
|
28
|
+
lang?: string;
|
|
29
|
+
dir?: 'ltr' | 'rtl' | 'auto';
|
|
30
|
+
hidden?: boolean;
|
|
31
|
+
tabIndex?: number;
|
|
32
|
+
class?: never;
|
|
33
|
+
[key: `data-${string}`]: string | number | boolean | undefined;
|
|
34
|
+
role?: string;
|
|
35
|
+
[key: `aria-${string}`]: string | number | boolean | undefined;
|
|
36
|
+
onClick?: (event: MouseEvent) => void;
|
|
37
|
+
onDoubleClick?: (event: MouseEvent) => void;
|
|
38
|
+
onMouseDown?: (event: MouseEvent) => void;
|
|
39
|
+
onMouseUp?: (event: MouseEvent) => void;
|
|
40
|
+
onMouseEnter?: (event: MouseEvent) => void;
|
|
41
|
+
onMouseLeave?: (event: MouseEvent) => void;
|
|
42
|
+
onMouseMove?: (event: MouseEvent) => void;
|
|
43
|
+
onMouseOver?: (event: MouseEvent) => void;
|
|
44
|
+
onMouseOut?: (event: MouseEvent) => void;
|
|
45
|
+
onChange?: (event: Event) => void;
|
|
46
|
+
onInput?: (event: Event) => void;
|
|
47
|
+
onSubmit?: (event: Event) => void;
|
|
48
|
+
onFocus?: (event: FocusEvent) => void;
|
|
49
|
+
onBlur?: (event: FocusEvent) => void;
|
|
50
|
+
onKeyDown?: (event: KeyboardEvent) => void;
|
|
51
|
+
onKeyUp?: (event: KeyboardEvent) => void;
|
|
52
|
+
onKeyPress?: (event: KeyboardEvent) => void;
|
|
53
|
+
onScroll?: (event: Event) => void;
|
|
54
|
+
onWheel?: (event: WheelEvent) => void;
|
|
55
|
+
onDrag?: (event: DragEvent) => void;
|
|
56
|
+
onDragEnd?: (event: DragEvent) => void;
|
|
57
|
+
onDragEnter?: (event: DragEvent) => void;
|
|
58
|
+
onDragLeave?: (event: DragEvent) => void;
|
|
59
|
+
onDragOver?: (event: DragEvent) => void;
|
|
60
|
+
onDragStart?: (event: DragEvent) => void;
|
|
61
|
+
onDrop?: (event: DragEvent) => void;
|
|
62
|
+
onTouchStart?: (event: TouchEvent) => void;
|
|
63
|
+
onTouchMove?: (event: TouchEvent) => void;
|
|
64
|
+
onTouchEnd?: (event: TouchEvent) => void;
|
|
65
|
+
onTouchCancel?: (event: TouchEvent) => void;
|
|
66
|
+
children?: ElementChild | ElementChild[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : T;
|
|
70
|
+
|
|
71
|
+
export type DistributivePick<T, K> = T extends unknown ? Pick<T, K & keyof T> : never;
|
|
72
|
+
|
|
73
|
+
export type UnionToIntersection<U> = (U extends unknown ? (x: U) => U : never) extends (x: infer I) => U ? I : never;
|
|
74
|
+
|
|
75
|
+
export type ReplaceNullWithUndefined<T> = T extends null ? Exclude<T, null> | undefined : T;
|
|
76
|
+
|
|
77
|
+
export type PropsWithoutChildren<P> = 'children' extends keyof P ? DistributiveOmit<P, 'children'> : P;
|
|
78
|
+
|
|
79
|
+
export interface FunctionComponent<P> {
|
|
80
|
+
(props: P): Element | null;
|
|
81
|
+
displayName?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export type ComponentType<P = {}> = FunctionComponent<P>;
|
|
85
|
+
|
|
86
|
+
export type ChildNode = ElementChild | ElementChild[];
|
|
87
|
+
|
|
88
|
+
export interface AnchorNativeProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
89
|
+
href?: string;
|
|
90
|
+
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
91
|
+
rel?: string;
|
|
92
|
+
download?: string | boolean;
|
|
93
|
+
hrefLang?: string;
|
|
94
|
+
type?: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface ButtonNativeProps extends HTMLAttributes<HTMLButtonElement> {
|
|
98
|
+
disabled?: boolean;
|
|
99
|
+
type?: 'button' | 'submit' | 'reset';
|
|
100
|
+
value?: string;
|
|
101
|
+
autoFocus?: boolean;
|
|
102
|
+
form?: string;
|
|
103
|
+
formAction?: string;
|
|
104
|
+
formEncType?: string;
|
|
105
|
+
formMethod?: string;
|
|
106
|
+
formNoValidate?: boolean;
|
|
107
|
+
formTarget?: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface FormNativeProps extends HTMLAttributes<HTMLFormElement> {
|
|
111
|
+
action?: string;
|
|
112
|
+
method?: 'get' | 'post';
|
|
113
|
+
encType?: string;
|
|
114
|
+
target?: string;
|
|
115
|
+
noValidate?: boolean;
|
|
116
|
+
autoComplete?: 'on' | 'off';
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface InputNativeProps extends HTMLAttributes<HTMLInputElement> {
|
|
120
|
+
accept?: string;
|
|
121
|
+
alt?: string;
|
|
122
|
+
autoComplete?: string;
|
|
123
|
+
autoFocus?: boolean;
|
|
124
|
+
capture?: boolean | string;
|
|
125
|
+
checked?: boolean;
|
|
126
|
+
disabled?: boolean;
|
|
127
|
+
form?: string;
|
|
128
|
+
max?: number | string;
|
|
129
|
+
maxLength?: number;
|
|
130
|
+
min?: number | string;
|
|
131
|
+
minLength?: number;
|
|
132
|
+
multiple?: boolean;
|
|
133
|
+
name?: string;
|
|
134
|
+
pattern?: string;
|
|
135
|
+
placeholder?: string;
|
|
136
|
+
readOnly?: boolean;
|
|
137
|
+
required?: boolean;
|
|
138
|
+
size?: number;
|
|
139
|
+
src?: string;
|
|
140
|
+
step?: number | string;
|
|
141
|
+
type?: 'text' | 'password' | 'email' | 'number' | 'tel' | 'url' | 'search' | 'date' | 'time' | 'datetime-local' | 'month' | 'week' | 'checkbox' | 'radio' | 'file' | 'submit' | 'reset' | 'button' | 'hidden' | 'image' | 'color' | 'range';
|
|
142
|
+
value?: string | number;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface TextareaNativeProps extends HTMLAttributes<HTMLTextAreaElement> {
|
|
146
|
+
autoComplete?: string;
|
|
147
|
+
autoFocus?: boolean;
|
|
148
|
+
cols?: number;
|
|
149
|
+
disabled?: boolean;
|
|
150
|
+
form?: string;
|
|
151
|
+
maxLength?: number;
|
|
152
|
+
minLength?: number;
|
|
153
|
+
name?: string;
|
|
154
|
+
placeholder?: string;
|
|
155
|
+
readOnly?: boolean;
|
|
156
|
+
required?: boolean;
|
|
157
|
+
rows?: number;
|
|
158
|
+
value?: string;
|
|
159
|
+
wrap?: 'hard' | 'soft' | 'off';
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface SelectNativeProps extends HTMLAttributes<HTMLSelectElement> {
|
|
163
|
+
autoComplete?: string;
|
|
164
|
+
autoFocus?: boolean;
|
|
165
|
+
disabled?: boolean;
|
|
166
|
+
form?: string;
|
|
167
|
+
multiple?: boolean;
|
|
168
|
+
name?: string;
|
|
169
|
+
required?: boolean;
|
|
170
|
+
size?: number;
|
|
171
|
+
value?: string | string[];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface ImgNativeProps extends HTMLAttributes<HTMLImageElement> {
|
|
175
|
+
alt?: string;
|
|
176
|
+
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
177
|
+
decoding?: 'async' | 'auto' | 'sync';
|
|
178
|
+
height?: number | string;
|
|
179
|
+
loading?: 'eager' | 'lazy';
|
|
180
|
+
sizes?: string;
|
|
181
|
+
src?: string;
|
|
182
|
+
srcSet?: string;
|
|
183
|
+
width?: number | string;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface LabelNativeProps extends HTMLAttributes<HTMLLabelElement> {
|
|
187
|
+
htmlFor?: string;
|
|
188
|
+
form?: string;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export type IntrinsicElementKeys =
|
|
192
|
+
| 'a' | 'abbr' | 'address' | 'area' | 'article' | 'aside' | 'audio'
|
|
193
|
+
| 'b' | 'base' | 'blockquote' | 'body' | 'br' | 'button'
|
|
194
|
+
| 'canvas' | 'caption' | 'cite' | 'code' | 'col' | 'colgroup'
|
|
195
|
+
| 'datalist' | 'del' | 'details' | 'dialog' | 'div'
|
|
196
|
+
| 'em'
|
|
197
|
+
| 'fieldset' | 'figcaption' | 'figure' | 'footer' | 'form'
|
|
198
|
+
| 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'head' | 'header' | 'hr' | 'html'
|
|
199
|
+
| 'i' | 'iframe' | 'img' | 'input' | 'ins'
|
|
200
|
+
| 'kbd'
|
|
201
|
+
| 'label' | 'legend' | 'li' | 'link'
|
|
202
|
+
| 'main' | 'mark' | 'menu' | 'meta' | 'meter'
|
|
203
|
+
| 'nav'
|
|
204
|
+
| 'ol' | 'optgroup' | 'option' | 'output'
|
|
205
|
+
| 'p' | 'picture' | 'pre' | 'progress'
|
|
206
|
+
| 'q'
|
|
207
|
+
| 's' | 'script' | 'section' | 'select' | 'small' | 'source' | 'span' | 'strong' | 'style' | 'sub' | 'summary' | 'sup' | 'svg'
|
|
208
|
+
| 'table' | 'tbody' | 'td' | 'template' | 'textarea' | 'tfoot' | 'th' | 'thead' | 'title' | 'tr' | 'track'
|
|
209
|
+
| 'u' | 'ul'
|
|
210
|
+
| 'video'
|
|
211
|
+
| 'wbr'
|
|
212
|
+
| 'circle' | 'ellipse' | 'line' | 'path' | 'polygon' | 'polyline' | 'rect' | 'g' | 'defs';
|
|
213
|
+
|
|
214
|
+
export type IntrinsicElementProps<Tag extends IntrinsicElementKeys> =
|
|
215
|
+
Tag extends 'a' ? AnchorNativeProps :
|
|
216
|
+
Tag extends 'button' ? ButtonNativeProps :
|
|
217
|
+
Tag extends 'form' ? FormNativeProps :
|
|
218
|
+
Tag extends 'input' ? InputNativeProps :
|
|
219
|
+
Tag extends 'textarea' ? TextareaNativeProps :
|
|
220
|
+
Tag extends 'select' ? SelectNativeProps :
|
|
221
|
+
Tag extends 'img' ? ImgNativeProps :
|
|
222
|
+
Tag extends 'label' ? LabelNativeProps :
|
|
223
|
+
HTMLAttributes<HTMLElement>;
|
package/src/index.ts
ADDED
|
File without changes
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"jsx": "react-jsx",
|
|
6
|
+
"jsxImportSource": "jsx-framework-test-pb",
|
|
7
|
+
"moduleResolution": "NodeNext",
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"outDir": "./dist",
|
|
12
|
+
"rootDir": "./src"
|
|
13
|
+
},
|
|
14
|
+
"include": [
|
|
15
|
+
"src/**/*"
|
|
16
|
+
]
|
|
17
|
+
}
|