@trypattern/sdk 0.1.26 → 0.1.28
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/ButtonBody.js +2 -2
- package/dist/components/IconButton.js +6 -6
- package/dist/components/Select.js +2 -2
- package/dist/components/Text.d.ts +2 -1
- package/dist/components/Text.js +23 -11
- package/dist/components/TextField.js +2 -2
- package/dist/components/controlLook.d.ts +33 -4
- package/dist/components/controlLook.js +20 -11
- package/dist/rules/checkAllFiles.js +1 -0
- package/dist/rules/lintPlugin.js +5 -1
- package/dist/start.d.ts +2 -2
- package/dist/start.js +1 -1
- package/dist/theme/tokens.stylex.d.ts +17 -0
- package/dist/theme/tokens.stylex.js +18 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { Button as BaseButton } from '@base-ui/react/button';
|
|
|
3
3
|
import { Link as RouterLink } from 'react-router';
|
|
4
4
|
import * as stylex from '@stylexjs/stylex';
|
|
5
5
|
import { colors, controls, fontWeights, iconSizes, motion, shadows } from "../theme/tokens.stylex.js";
|
|
6
|
-
import { controlSizes, focusRing } from "./controlLook.js";
|
|
6
|
+
import { buttonCorners, controlSizes, focusRing } from "./controlLook.js";
|
|
7
7
|
import { Icon } from "./Icon.js";
|
|
8
8
|
import { interact, textOf } from "./interaction.js";
|
|
9
9
|
import { Kbd } from "./Kbd.js";
|
|
@@ -14,7 +14,7 @@ export function ButtonBody({ children, variant = 'primary', tone = variant === '
|
|
|
14
14
|
interact({ primitive: 'Button', event: 'click', label: textOf(children) });
|
|
15
15
|
onClick?.();
|
|
16
16
|
};
|
|
17
|
-
const className = stylex.props(styles.button, controlSizes[size], icon !== undefined && !isIconPinned && leadingIconSizes[size], trailingIcon !== undefined && trailingIconSizes[size], looks[`${variant}${toneKeys[tone]}`], !isDisabled && hovers[`${variant}${toneKeys[tone]}`], isDisabled && styles.disabled, isDisabled && variant === 'transparent' && styles.disabledTransparent, isFullWidth && styles.fullWidth, focusRing.visible, style).className;
|
|
17
|
+
const className = stylex.props(styles.button, controlSizes[size], buttonCorners[size], icon !== undefined && !isIconPinned && leadingIconSizes[size], trailingIcon !== undefined && trailingIconSizes[size], looks[`${variant}${toneKeys[tone]}`], !isDisabled && hovers[`${variant}${toneKeys[tone]}`], isDisabled && styles.disabled, isDisabled && variant === 'transparent' && styles.disabledTransparent, isFullWidth && styles.fullWidth, focusRing.visible, style).className;
|
|
18
18
|
const content = (_jsxs("span", { ...stylex.props(styles.stack), children: [_jsxs("span", { ...stylex.props(styles.content, isIconPinned && styles.pinnedContent, isPending && styles.hidden), children: [icon === undefined ? null : _jsx(Icon, { name: icon, size: size }), _jsx("span", { ...stylex.props(styles.label, shortcut !== undefined && styles.labelBeforeShortcut, isIconPinned && styles.labelBetweenPins), children: children }), isIconPinned ? (_jsx("span", { "aria-hidden": "true", ...stylex.props(pinBalances[size]) })) : null, trailingIcon === undefined ? null : (_jsx(Icon, { name: trailingIcon, size: size })), shortcut === undefined ? null : _jsx(Kbd, { keys: shortcut })] }), isPending ? (_jsx("span", { "aria-hidden": "true", ...stylex.props(styles.pending), children: _jsx(Spinner, { size: size }) })) : null] }));
|
|
19
19
|
if (href !== undefined) {
|
|
20
20
|
return (_jsx("a", { href: href, target: "_blank", rel: "noreferrer", onClick: report, className: className, children: content }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Button as BaseButton } from '@base-ui/react/button';
|
|
3
3
|
import * as stylex from '@stylexjs/stylex';
|
|
4
|
-
import { colors, controls,
|
|
4
|
+
import { colors, controls, corners } from "../theme/tokens.stylex.js";
|
|
5
5
|
import { focusRing, transparentLook } from "./controlLook.js";
|
|
6
6
|
import { Icon } from "./Icon.js";
|
|
7
7
|
import { interact } from "./interaction.js";
|
|
@@ -28,26 +28,26 @@ const sizes = stylex.create({
|
|
|
28
28
|
xs: {
|
|
29
29
|
width: controls.heightXs,
|
|
30
30
|
height: controls.heightXs,
|
|
31
|
-
borderRadius:
|
|
31
|
+
borderRadius: corners.buttonXs
|
|
32
32
|
},
|
|
33
33
|
sm: {
|
|
34
34
|
width: controls.heightSm,
|
|
35
35
|
height: controls.heightSm,
|
|
36
|
-
borderRadius:
|
|
36
|
+
borderRadius: corners.buttonSm
|
|
37
37
|
},
|
|
38
38
|
md: {
|
|
39
39
|
width: controls.heightMd,
|
|
40
40
|
height: controls.heightMd,
|
|
41
|
-
borderRadius:
|
|
41
|
+
borderRadius: corners.buttonMd
|
|
42
42
|
},
|
|
43
43
|
lg: {
|
|
44
44
|
width: controls.heightLg,
|
|
45
45
|
height: controls.heightLg,
|
|
46
|
-
borderRadius:
|
|
46
|
+
borderRadius: corners.buttonLg
|
|
47
47
|
},
|
|
48
48
|
xl: {
|
|
49
49
|
width: controls.heightXl,
|
|
50
50
|
height: controls.heightXl,
|
|
51
|
-
borderRadius:
|
|
51
|
+
borderRadius: corners.buttonXl
|
|
52
52
|
}
|
|
53
53
|
});
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Select as BaseSelect } from '@base-ui/react/select';
|
|
3
3
|
import * as stylex from '@stylexjs/stylex';
|
|
4
4
|
import { borders, colors, controls, iconSizes, layers, motion, radii, shadows, space } from "../theme/tokens.stylex.js";
|
|
5
|
-
import { controlSizes } from "./controlLook.js";
|
|
5
|
+
import { fieldCorners, controlSizes } from "./controlLook.js";
|
|
6
6
|
import { Icon } from "./Icon.js";
|
|
7
7
|
import { interact } from "./interaction.js";
|
|
8
8
|
import { Popup } from "./Popup.js";
|
|
@@ -13,7 +13,7 @@ export function Select({ label, value, options, size = 'md', disabled = false, o
|
|
|
13
13
|
return;
|
|
14
14
|
interact({ primitive: 'Select', event: 'change', label });
|
|
15
15
|
onChange(next);
|
|
16
|
-
}, children: [_jsxs(BaseSelect.Trigger, { "aria-label": label, className: (state) => stylex.props(styles.trigger, controlSizes[size], triggerPaddings[size], styles.triggerLook, !disabled && styles.hoverable, state.open && styles.triggerOpen, disabled && styles.disabled, style).className, children: [_jsx("span", { ...stylex.props(styles.values), children: options.map((option) => (_jsx("span", { "aria-hidden": option.value !== value, ...stylex.props(styles.value, option.value !== value && styles.valueHidden), children: option.label }, option.value))) }), _jsx(BaseSelect.Icon, { className: stylex.props(styles.chevron).className, children: _jsx(Icon, { name: "chevronUpDown", size: size }) })] }), _jsx(BaseSelect.Portal, { children: _jsx(BaseSelect.Positioner, { alignItemWithTrigger: false, side: "bottom", align: "start", sideOffset: 4, className: stylex.props(styles.positioner).className, children: _jsx(BaseSelect.Popup, { render: (props, state) => (_jsx(Popup, { ...props, kind: "select", isOpen: state.open, transitionStatus: state.transitionStatus })), children: options.map((option) => (_jsxs(BaseSelect.Item, { value: option.value, render: (props, state) => (_jsx(PopupItem, { ...props, kind: "select", isHighlighted: state.highlighted })), children: [_jsx("span", { ...stylex.props(styles.indicator), children: _jsx(BaseSelect.ItemIndicator, { className: stylex.props(styles.check).className, children: _jsx(Icon, { name: "check" }) }) }), _jsx(BaseSelect.ItemText, { children: option.label })] }, option.value))) }) }) })] }));
|
|
16
|
+
}, children: [_jsxs(BaseSelect.Trigger, { "aria-label": label, className: (state) => stylex.props(styles.trigger, controlSizes[size], fieldCorners[size], triggerPaddings[size], styles.triggerLook, !disabled && styles.hoverable, state.open && styles.triggerOpen, disabled && styles.disabled, style).className, children: [_jsx("span", { ...stylex.props(styles.values), children: options.map((option) => (_jsx("span", { "aria-hidden": option.value !== value, ...stylex.props(styles.value, option.value !== value && styles.valueHidden), children: option.label }, option.value))) }), _jsx(BaseSelect.Icon, { className: stylex.props(styles.chevron).className, children: _jsx(Icon, { name: "chevronUpDown", size: size }) })] }), _jsx(BaseSelect.Portal, { children: _jsx(BaseSelect.Positioner, { alignItemWithTrigger: false, side: "bottom", align: "start", sideOffset: 4, className: stylex.props(styles.positioner).className, children: _jsx(BaseSelect.Popup, { render: (props, state) => (_jsx(Popup, { ...props, kind: "select", isOpen: state.open, transitionStatus: state.transitionStatus })), children: options.map((option) => (_jsxs(BaseSelect.Item, { value: option.value, render: (props, state) => (_jsx(PopupItem, { ...props, kind: "select", isHighlighted: state.highlighted })), children: [_jsx("span", { ...stylex.props(styles.indicator), children: _jsx(BaseSelect.ItemIndicator, { className: stylex.props(styles.check).className, children: _jsx(Icon, { name: "check" }) }) }), _jsx(BaseSelect.ItemText, { children: option.label })] }, option.value))) }) }) })] }));
|
|
17
17
|
}
|
|
18
18
|
const focusRing = `inset 0 0 0 ${borders.hairline} ${colors.brandBorderFocus}, 0 0 0 ${borders.thin} ${colors.brandBorderFocus}, ${shadows.default}`;
|
|
19
19
|
const styles = stylex.create({
|
|
@@ -5,13 +5,14 @@ type TextProps = {
|
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
variant?: 'hero' | 'display' | 'section' | 'heading' | 'subheading' | 'title' | 'lead' | 'intro' | 'label' | 'body' | 'caption' | 'code';
|
|
7
7
|
tone?: Tone;
|
|
8
|
+
weight?: 'normal' | 'medium' | 'semibold' | 'bold' | 'heavy';
|
|
8
9
|
align?: 'start' | 'center' | 'end';
|
|
9
10
|
as?: 'span' | 'p' | 'h1' | 'h2' | 'h3';
|
|
10
11
|
isTruncated?: boolean;
|
|
11
12
|
isSelectable?: boolean;
|
|
12
13
|
style?: Placement;
|
|
13
14
|
};
|
|
14
|
-
export declare function Text({ children, variant, tone, align, as, isTruncated, isSelectable, style }: TextProps): import("react").DetailedReactHTMLElement<Readonly<{
|
|
15
|
+
export declare function Text({ children, variant, tone, weight, align, as, isTruncated, isSelectable, style }: TextProps): import("react").DetailedReactHTMLElement<Readonly<{
|
|
15
16
|
className?: string;
|
|
16
17
|
'data-style-src'?: string;
|
|
17
18
|
style?: Readonly<{
|
package/dist/components/Text.js
CHANGED
|
@@ -2,8 +2,8 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
2
2
|
import { createElement } from 'react';
|
|
3
3
|
import { breakpoints, fontSizes, fontWeights, fonts, lineHeights, trackings } from "../theme/tokens.stylex.js";
|
|
4
4
|
import { tones } from "./tones.js";
|
|
5
|
-
export function Text({ children, variant = 'body', tone = 'inherit', align, as = 'span', isTruncated = false, isSelectable = false, style }) {
|
|
6
|
-
return createElement(as, stylex.props(as !== 'span' && styles.block, variants[variant], tones[tone], align !== undefined && alignments[align], isTruncated && styles.truncated, isSelectable && styles.selectable, style), children);
|
|
5
|
+
export function Text({ children, variant = 'body', tone = 'inherit', weight, align, as = 'span', isTruncated = false, isSelectable = false, style }) {
|
|
6
|
+
return createElement(as, stylex.props(as !== 'span' && styles.block, variants[variant], tones[tone], weight !== undefined && weights[weight], align !== undefined && alignments[align], isTruncated && styles.truncated, isSelectable && styles.selectable, style), children);
|
|
7
7
|
}
|
|
8
8
|
const styles = stylex.create({
|
|
9
9
|
block: {
|
|
@@ -22,11 +22,12 @@ const styles = stylex.create({
|
|
|
22
22
|
});
|
|
23
23
|
const variants = stylex.create({
|
|
24
24
|
hero: {
|
|
25
|
+
fontFamily: fonts.heading,
|
|
25
26
|
fontSize: {
|
|
26
27
|
default: fontSizes.heading1,
|
|
27
28
|
[breakpoints.compact]: fontSizes.heading2
|
|
28
29
|
},
|
|
29
|
-
fontWeight: fontWeights.
|
|
30
|
+
fontWeight: fontWeights.heading,
|
|
30
31
|
lineHeight: {
|
|
31
32
|
default: lineHeights.heading1,
|
|
32
33
|
[breakpoints.compact]: lineHeights.heading2
|
|
@@ -34,11 +35,12 @@ const variants = stylex.create({
|
|
|
34
35
|
letterSpacing: trackings.hero
|
|
35
36
|
},
|
|
36
37
|
display: {
|
|
38
|
+
fontFamily: fonts.heading,
|
|
37
39
|
fontSize: {
|
|
38
40
|
default: fontSizes.heading2,
|
|
39
41
|
[breakpoints.compact]: fontSizes.heading3
|
|
40
42
|
},
|
|
41
|
-
fontWeight: fontWeights.
|
|
43
|
+
fontWeight: fontWeights.heading,
|
|
42
44
|
lineHeight: {
|
|
43
45
|
default: lineHeights.heading2,
|
|
44
46
|
[breakpoints.compact]: lineHeights.heading3
|
|
@@ -46,11 +48,12 @@ const variants = stylex.create({
|
|
|
46
48
|
letterSpacing: trackings.display
|
|
47
49
|
},
|
|
48
50
|
section: {
|
|
51
|
+
fontFamily: fonts.heading,
|
|
49
52
|
fontSize: {
|
|
50
53
|
default: fontSizes.heading3,
|
|
51
54
|
[breakpoints.compact]: fontSizes.heading5
|
|
52
55
|
},
|
|
53
|
-
fontWeight: fontWeights.
|
|
56
|
+
fontWeight: fontWeights.heading,
|
|
54
57
|
lineHeight: {
|
|
55
58
|
default: lineHeights.heading3,
|
|
56
59
|
[breakpoints.compact]: lineHeights.heading5
|
|
@@ -58,14 +61,16 @@ const variants = stylex.create({
|
|
|
58
61
|
letterSpacing: trackings.section
|
|
59
62
|
},
|
|
60
63
|
heading: {
|
|
64
|
+
fontFamily: fonts.heading,
|
|
61
65
|
fontSize: fontSizes.heading5,
|
|
62
|
-
fontWeight: fontWeights.
|
|
66
|
+
fontWeight: fontWeights.heading,
|
|
63
67
|
lineHeight: lineHeights.heading5,
|
|
64
68
|
letterSpacing: trackings.heading
|
|
65
69
|
},
|
|
66
70
|
subheading: {
|
|
71
|
+
fontFamily: fonts.heading,
|
|
67
72
|
fontSize: fontSizes.heading6,
|
|
68
|
-
fontWeight: fontWeights.
|
|
73
|
+
fontWeight: fontWeights.heading,
|
|
69
74
|
lineHeight: lineHeights.heading6
|
|
70
75
|
},
|
|
71
76
|
title: {
|
|
@@ -86,23 +91,23 @@ const variants = stylex.create({
|
|
|
86
91
|
label: {
|
|
87
92
|
fontSize: {
|
|
88
93
|
default: fontSizes.bodySm,
|
|
89
|
-
[breakpoints.compact]: fontSizes.
|
|
94
|
+
[breakpoints.compact]: fontSizes.bodyCompact
|
|
90
95
|
},
|
|
91
96
|
fontWeight: fontWeights.medium,
|
|
92
97
|
lineHeight: {
|
|
93
98
|
default: lineHeights.bodySm,
|
|
94
|
-
[breakpoints.compact]: lineHeights.
|
|
99
|
+
[breakpoints.compact]: lineHeights.bodyCompact
|
|
95
100
|
}
|
|
96
101
|
},
|
|
97
102
|
body: {
|
|
98
103
|
fontSize: {
|
|
99
104
|
default: fontSizes.bodySm,
|
|
100
|
-
[breakpoints.compact]: fontSizes.
|
|
105
|
+
[breakpoints.compact]: fontSizes.bodyCompact
|
|
101
106
|
},
|
|
102
107
|
fontWeight: fontWeights.normal,
|
|
103
108
|
lineHeight: {
|
|
104
109
|
default: lineHeights.bodySm,
|
|
105
|
-
[breakpoints.compact]: lineHeights.
|
|
110
|
+
[breakpoints.compact]: lineHeights.bodyCompact
|
|
106
111
|
}
|
|
107
112
|
},
|
|
108
113
|
caption: {
|
|
@@ -117,6 +122,13 @@ const variants = stylex.create({
|
|
|
117
122
|
lineHeight: lineHeights.bodySm
|
|
118
123
|
}
|
|
119
124
|
});
|
|
125
|
+
const weights = stylex.create({
|
|
126
|
+
normal: { fontWeight: fontWeights.normal },
|
|
127
|
+
medium: { fontWeight: fontWeights.medium },
|
|
128
|
+
semibold: { fontWeight: fontWeights.semibold },
|
|
129
|
+
bold: { fontWeight: fontWeights.bold },
|
|
130
|
+
heavy: { fontWeight: fontWeights.heavy }
|
|
131
|
+
});
|
|
120
132
|
const alignments = stylex.create({
|
|
121
133
|
start: { textAlign: 'start' },
|
|
122
134
|
center: { textAlign: 'center' },
|
|
@@ -4,7 +4,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
4
4
|
import { useRef } from 'react';
|
|
5
5
|
import { borders, colors, controls, fontSizes, fontWeights, lineHeights, motion, shadows, space } from "../theme/tokens.stylex.js";
|
|
6
6
|
import { Icon } from "./Icon.js";
|
|
7
|
-
import { controlSizes } from "./controlLook.js";
|
|
7
|
+
import { fieldCorners, controlSizes } from "./controlLook.js";
|
|
8
8
|
import { interact } from "./interaction.js";
|
|
9
9
|
export function TextField({ label, isLabelHidden = false, description, error, onChange, multiline = false, rows = 3, size = 'md', icon, style, ...input }) {
|
|
10
10
|
const isInvalid = error !== undefined;
|
|
@@ -15,7 +15,7 @@ export function TextField({ label, isLabelHidden = false, description, error, on
|
|
|
15
15
|
if (event.currentTarget.value !== valueOnFocus.current) {
|
|
16
16
|
interact({ primitive: 'TextField', event: 'change', label });
|
|
17
17
|
}
|
|
18
|
-
}, className: stylex.props(styles.input, controlSizes[size], multiline && styles.multiline, multiline && multilinePaddings[size], icon !== undefined && styles.withIcon, isInvalid && styles.invalid, input.disabled === true && styles.disabled).className })] }), description === undefined ? null : (_jsx(Field.Description, { className: stylex.props(styles.note).className, children: description })), error === undefined ? null : (_jsx(Field.Error, { match: true, className: stylex.props(styles.error).className, children: error }))] }));
|
|
18
|
+
}, className: stylex.props(styles.input, controlSizes[size], fieldCorners[size], multiline && styles.multiline, multiline && multilinePaddings[size], icon !== undefined && styles.withIcon, isInvalid && styles.invalid, input.disabled === true && styles.disabled).className })] }), description === undefined ? null : (_jsx(Field.Description, { className: stylex.props(styles.note).className, children: description })), error === undefined ? null : (_jsx(Field.Error, { match: true, className: stylex.props(styles.error).className, children: error }))] }));
|
|
19
19
|
}
|
|
20
20
|
const focusRing = `inset 0 0 0 ${borders.hairline} ${colors.brandBorderFocus}, 0 0 0 ${borders.thin} ${colors.brandBorderFocus}, ${shadows.default}`;
|
|
21
21
|
const invalidRing = `inset 0 0 0 ${borders.hairline} ${colors.dangerBorderDefault}, 0 0 0 ${borders.thin} ${colors.dangerBorderDefault}, ${shadows.default}`;
|
|
@@ -6,7 +6,6 @@ export declare const controlSizes: Readonly<{
|
|
|
6
6
|
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
7
7
|
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
8
8
|
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
9
|
-
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
10
9
|
}>;
|
|
11
10
|
readonly sm: Readonly<{
|
|
12
11
|
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
@@ -14,7 +13,6 @@ export declare const controlSizes: Readonly<{
|
|
|
14
13
|
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
15
14
|
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
16
15
|
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
17
|
-
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
18
16
|
}>;
|
|
19
17
|
readonly md: Readonly<{
|
|
20
18
|
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
@@ -22,7 +20,6 @@ export declare const controlSizes: Readonly<{
|
|
|
22
20
|
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
23
21
|
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
24
22
|
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
25
|
-
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
26
23
|
}>;
|
|
27
24
|
readonly lg: Readonly<{
|
|
28
25
|
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
@@ -30,7 +27,6 @@ export declare const controlSizes: Readonly<{
|
|
|
30
27
|
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
31
28
|
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
32
29
|
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
33
|
-
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
34
30
|
}>;
|
|
35
31
|
readonly xl: Readonly<{
|
|
36
32
|
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
@@ -38,6 +34,39 @@ export declare const controlSizes: Readonly<{
|
|
|
38
34
|
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
39
35
|
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
40
36
|
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
37
|
+
}>;
|
|
38
|
+
}>;
|
|
39
|
+
export declare const buttonCorners: Readonly<{
|
|
40
|
+
readonly xs: Readonly<{
|
|
41
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
42
|
+
}>;
|
|
43
|
+
readonly sm: Readonly<{
|
|
44
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
45
|
+
}>;
|
|
46
|
+
readonly md: Readonly<{
|
|
47
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
48
|
+
}>;
|
|
49
|
+
readonly lg: Readonly<{
|
|
50
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
51
|
+
}>;
|
|
52
|
+
readonly xl: Readonly<{
|
|
53
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
54
|
+
}>;
|
|
55
|
+
}>;
|
|
56
|
+
export declare const fieldCorners: Readonly<{
|
|
57
|
+
readonly xs: Readonly<{
|
|
58
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
59
|
+
}>;
|
|
60
|
+
readonly sm: Readonly<{
|
|
61
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
62
|
+
}>;
|
|
63
|
+
readonly md: Readonly<{
|
|
64
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
65
|
+
}>;
|
|
66
|
+
readonly lg: Readonly<{
|
|
67
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
68
|
+
}>;
|
|
69
|
+
readonly xl: Readonly<{
|
|
41
70
|
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
42
71
|
}>;
|
|
43
72
|
}>;
|
|
@@ -1,47 +1,56 @@
|
|
|
1
1
|
import * as stylex from '@stylexjs/stylex';
|
|
2
|
-
import { borders, colors, controls,
|
|
2
|
+
import { borders, colors, controls, corners, motion } from "../theme/tokens.stylex.js";
|
|
3
3
|
export const controlSizes = stylex.create({
|
|
4
4
|
xs: {
|
|
5
5
|
gap: controls.gapXs,
|
|
6
6
|
height: controls.heightXs,
|
|
7
7
|
paddingInline: controls.paddingXs,
|
|
8
8
|
fontSize: controls.fontSizeXs,
|
|
9
|
-
lineHeight: controls.lineHeightXs
|
|
10
|
-
borderRadius: radii.sm
|
|
9
|
+
lineHeight: controls.lineHeightXs
|
|
11
10
|
},
|
|
12
11
|
sm: {
|
|
13
12
|
gap: controls.gapSm,
|
|
14
13
|
height: controls.heightSm,
|
|
15
14
|
paddingInline: controls.paddingSm,
|
|
16
15
|
fontSize: controls.fontSizeSm,
|
|
17
|
-
lineHeight: controls.lineHeightSm
|
|
18
|
-
borderRadius: radii.md
|
|
16
|
+
lineHeight: controls.lineHeightSm
|
|
19
17
|
},
|
|
20
18
|
md: {
|
|
21
19
|
gap: controls.gapMd,
|
|
22
20
|
height: controls.heightMd,
|
|
23
21
|
paddingInline: controls.paddingMd,
|
|
24
22
|
fontSize: controls.fontSizeMd,
|
|
25
|
-
lineHeight: controls.lineHeightMd
|
|
26
|
-
borderRadius: radii.md
|
|
23
|
+
lineHeight: controls.lineHeightMd
|
|
27
24
|
},
|
|
28
25
|
lg: {
|
|
29
26
|
gap: controls.gapLg,
|
|
30
27
|
height: controls.heightLg,
|
|
31
28
|
paddingInline: controls.paddingLg,
|
|
32
29
|
fontSize: controls.fontSizeLg,
|
|
33
|
-
lineHeight: controls.lineHeightLg
|
|
34
|
-
borderRadius: radii.lg
|
|
30
|
+
lineHeight: controls.lineHeightLg
|
|
35
31
|
},
|
|
36
32
|
xl: {
|
|
37
33
|
gap: controls.gapXl,
|
|
38
34
|
height: controls.heightXl,
|
|
39
35
|
paddingInline: controls.paddingXl,
|
|
40
36
|
fontSize: controls.fontSizeXl,
|
|
41
|
-
lineHeight: controls.lineHeightXl
|
|
42
|
-
borderRadius: radii.lg
|
|
37
|
+
lineHeight: controls.lineHeightXl
|
|
43
38
|
}
|
|
44
39
|
});
|
|
40
|
+
export const buttonCorners = stylex.create({
|
|
41
|
+
xs: { borderRadius: corners.buttonXs },
|
|
42
|
+
sm: { borderRadius: corners.buttonSm },
|
|
43
|
+
md: { borderRadius: corners.buttonMd },
|
|
44
|
+
lg: { borderRadius: corners.buttonLg },
|
|
45
|
+
xl: { borderRadius: corners.buttonXl }
|
|
46
|
+
});
|
|
47
|
+
export const fieldCorners = stylex.create({
|
|
48
|
+
xs: { borderRadius: corners.fieldXs },
|
|
49
|
+
sm: { borderRadius: corners.fieldSm },
|
|
50
|
+
md: { borderRadius: corners.fieldMd },
|
|
51
|
+
lg: { borderRadius: corners.fieldLg },
|
|
52
|
+
xl: { borderRadius: corners.fieldXl }
|
|
53
|
+
});
|
|
45
54
|
export const transparentLook = stylex.create({
|
|
46
55
|
rest: {
|
|
47
56
|
color: colors.secondaryForeground,
|
|
@@ -340,6 +340,7 @@ const SRC_ENTRY_FILES = new Set([
|
|
|
340
340
|
]);
|
|
341
341
|
const SRC_FOLDER_PATTERNS = [
|
|
342
342
|
/^theme\/(theme|icons)\.ts$/,
|
|
343
|
+
/^theme\/colors\.stylex\.ts$/,
|
|
343
344
|
/^lib\/[a-z][A-Za-z]*\.ts$/,
|
|
344
345
|
/^hooks\/use[A-Z][A-Za-z]*\.ts$/,
|
|
345
346
|
/^screens\/[A-Z][A-Za-z]*Screen\.tsx$/,
|
package/dist/rules/lintPlugin.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ACTIONS_WHERE_MESSAGE, COMPONENT_FIRST_MESSAGE, COMPONENT_FILE_NAME_MESSAGE, DARK_MODE_IN_TOKENS_MESSAGE, DEV_ONLY_SIGN_IN_MESSAGE, EXPLICIT_ACCESS_MESSAGE, USE_BREAKPOINTS_MESSAGE, HOVER_USES_HIGHLIGHT_MESSAGE, NO_CLASSNAME_STRINGS_MESSAGE, NO_COMMENTS_MESSAGE, NO_INTERACTIVE_TRANSITION_MESSAGE, NO_POINTER_CURSOR_MESSAGE, NO_ROUTE_DATA_APIS_MESSAGE, ROUTES_UNDER_APP_LAYOUT_MESSAGE, SCROLL_VIEW_ONLY_MESSAGE, SELECTABLE_ONLY_MESSAGE, STATE_VIA_HOOKS_MESSAGE, MODEL_BY_NAME_MESSAGE, MODEL_MEMBERS_MESSAGE, PURE_ACTIONS_MESSAGE, PURE_GETTERS_MESSAGE, USE_MODEL_WHERE_MESSAGE, CLASSES_NOT_FACTORIES_MESSAGE, STORES_IN_APP_MESSAGE, TYPED_STYLE_PROP_MESSAGE, USE_COLOR_TOKEN_MESSAGE, USE_FONT_TOKEN_MESSAGE, USE_LINK_MESSAGE, USE_PRIMITIVES_MESSAGE, USE_IMAGE_MESSAGE, NO_WIDGET_ROLES_MESSAGE, NO_CLICK_ON_STATIC_MESSAGE, PRIMITIVE_NAMES_MESSAGE, USE_SPACE_TOKENS_MESSAGE, USE_SIZE_TOKENS_MESSAGE, TEXT_VIA_TEXT_MESSAGE, TEXT_ELEMENTS_MESSAGE, LOOSE_TEXT_MESSAGE, COMPOSE_IN_SCREENS_MESSAGE, NO_HOVER_IN_APP_MESSAGE } from "./messages.js";
|
|
2
2
|
const TOKENS_FILE = 'src/theme/tokens.stylex.ts';
|
|
3
3
|
const APP_THEME_FILE = 'src/theme/theme.ts';
|
|
4
|
+
const APP_COLORS_FILE = 'src/theme/colors.stylex.ts';
|
|
4
5
|
const SCROLL_AREA_FILE = 'src/components/ScrollArea.tsx';
|
|
5
6
|
const SELECTABLE_FILE = 'src/components/Text.tsx';
|
|
6
7
|
const PRIMITIVE_ELEMENTS = new Set([
|
|
@@ -322,8 +323,11 @@ const noPointerCursor = styleRule((declarations) => declarations
|
|
|
322
323
|
.filter((d) => d.property === 'cursor' && stringValue(d.value) === 'pointer')
|
|
323
324
|
.map((d) => ({ location: d.location, message: NO_POINTER_CURSOR_MESSAGE })));
|
|
324
325
|
const useTokens = styleRule((declarations, context) => {
|
|
325
|
-
if (inFile(context, TOKENS_FILE) ||
|
|
326
|
+
if (inFile(context, TOKENS_FILE) ||
|
|
327
|
+
inFile(context, APP_THEME_FILE) ||
|
|
328
|
+
inFile(context, APP_COLORS_FILE)) {
|
|
326
329
|
return [];
|
|
330
|
+
}
|
|
327
331
|
return declarations.flatMap((d) => {
|
|
328
332
|
const raw = stringValue(d.value);
|
|
329
333
|
const isColorProperty = /color$/i.test(d.property) ||
|
package/dist/start.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import type { IconDrawing } from './components/icons.ts';
|
|
|
5
5
|
import type { Interaction } from './components/interaction.ts';
|
|
6
6
|
import type { ReactApp } from './hooks/appContext.ts';
|
|
7
7
|
import type { Tables } from './table.ts';
|
|
8
|
-
import { borders, colors, controls, fontSizes, fonts, iconSizes, lineHeights, radii, shadows, space, widths } from './theme/tokens.stylex.ts';
|
|
9
|
-
type Themeable = typeof colors | typeof radii | typeof fonts | typeof shadows | typeof space | typeof fontSizes | typeof lineHeights | typeof controls | typeof iconSizes | typeof borders | typeof widths;
|
|
8
|
+
import { borders, colors, controls, corners, fontSizes, fontWeights, fonts, iconSizes, lineHeights, radii, shadows, space, trackings, widths } from './theme/tokens.stylex.ts';
|
|
9
|
+
type Themeable = typeof colors | typeof radii | typeof corners | typeof fonts | typeof shadows | typeof space | typeof fontSizes | typeof fontWeights | typeof lineHeights | typeof trackings | typeof controls | typeof iconSizes | typeof borders | typeof widths;
|
|
10
10
|
export type StartOptions = {
|
|
11
11
|
theme?: readonly Theme<Themeable>[];
|
|
12
12
|
icons?: Readonly<Record<string, IconDrawing>>;
|
package/dist/start.js
CHANGED
|
@@ -12,7 +12,7 @@ import { manualClock, realClock } from "./clock.js";
|
|
|
12
12
|
import { Gate } from "./gate.js";
|
|
13
13
|
import { AppProvider } from "./hooks/appContext.js";
|
|
14
14
|
import { routeObjects } from "./routes.js";
|
|
15
|
-
import { borders, breakpoints, colors, controls, fontFeatures, fontSizes, fontWeights, fonts, iconSizes, lineHeights, radii, shadows, space, widths } from "./theme/tokens.stylex.js";
|
|
15
|
+
import { borders, breakpoints, colors, controls, corners, fontFeatures, fontSizes, fontWeights, fonts, iconSizes, lineHeights, radii, shadows, space, trackings, widths } from "./theme/tokens.stylex.js";
|
|
16
16
|
const TEST_SEED = 'patternSeed';
|
|
17
17
|
const INLINE_DATA_ID = 'pattern-data';
|
|
18
18
|
const TEST_ADMINS = 'patternAdmins';
|
|
@@ -165,6 +165,18 @@ export declare const radii: stylex.VarGroup<Readonly<{
|
|
|
165
165
|
xxxxl: string;
|
|
166
166
|
full: string;
|
|
167
167
|
}>, symbol>;
|
|
168
|
+
export declare const corners: stylex.VarGroup<Readonly<{
|
|
169
|
+
buttonXs: string;
|
|
170
|
+
buttonSm: string;
|
|
171
|
+
buttonMd: string;
|
|
172
|
+
buttonLg: string;
|
|
173
|
+
buttonXl: string;
|
|
174
|
+
fieldXs: string;
|
|
175
|
+
fieldSm: string;
|
|
176
|
+
fieldMd: string;
|
|
177
|
+
fieldLg: string;
|
|
178
|
+
fieldXl: string;
|
|
179
|
+
}>, symbol>;
|
|
168
180
|
export declare const fontSizes: stylex.VarGroup<Readonly<{
|
|
169
181
|
captionXs: string;
|
|
170
182
|
captionSm: string;
|
|
@@ -174,6 +186,7 @@ export declare const fontSizes: stylex.VarGroup<Readonly<{
|
|
|
174
186
|
bodyMd: string;
|
|
175
187
|
bodyBase: string;
|
|
176
188
|
bodyLg: string;
|
|
189
|
+
bodyCompact: string;
|
|
177
190
|
heading6: string;
|
|
178
191
|
heading5: string;
|
|
179
192
|
heading4: string;
|
|
@@ -194,6 +207,7 @@ export declare const lineHeights: stylex.VarGroup<Readonly<{
|
|
|
194
207
|
bodySm: string;
|
|
195
208
|
body: string;
|
|
196
209
|
bodyLg: string;
|
|
210
|
+
bodyCompact: string;
|
|
197
211
|
heading6: string;
|
|
198
212
|
heading5: string;
|
|
199
213
|
heading4: string;
|
|
@@ -203,6 +217,7 @@ export declare const lineHeights: stylex.VarGroup<Readonly<{
|
|
|
203
217
|
}>, symbol>;
|
|
204
218
|
export declare const fonts: stylex.VarGroup<Readonly<{
|
|
205
219
|
sans: string;
|
|
220
|
+
heading: string;
|
|
206
221
|
mono: string;
|
|
207
222
|
}>, symbol>;
|
|
208
223
|
export declare const fontFeatures: stylex.VarGroup<Readonly<{
|
|
@@ -215,6 +230,8 @@ export declare const fontWeights: stylex.VarGroup<Readonly<{
|
|
|
215
230
|
medium: string;
|
|
216
231
|
semibold: string;
|
|
217
232
|
bold: string;
|
|
233
|
+
heavy: string;
|
|
234
|
+
heading: string;
|
|
218
235
|
}>, symbol>;
|
|
219
236
|
export declare const shadows: stylex.VarGroup<Readonly<{
|
|
220
237
|
border: string;
|
|
@@ -165,6 +165,18 @@ export const radii = stylex.defineVars({
|
|
|
165
165
|
xxxxl: '20px',
|
|
166
166
|
full: '9999px'
|
|
167
167
|
});
|
|
168
|
+
export const corners = stylex.defineVars({
|
|
169
|
+
buttonXs: radii.sm,
|
|
170
|
+
buttonSm: radii.md,
|
|
171
|
+
buttonMd: radii.md,
|
|
172
|
+
buttonLg: radii.lg,
|
|
173
|
+
buttonXl: radii.lg,
|
|
174
|
+
fieldXs: radii.sm,
|
|
175
|
+
fieldSm: radii.md,
|
|
176
|
+
fieldMd: radii.md,
|
|
177
|
+
fieldLg: radii.lg,
|
|
178
|
+
fieldXl: radii.lg
|
|
179
|
+
});
|
|
168
180
|
export const fontSizes = stylex.defineVars({
|
|
169
181
|
captionXs: '8px',
|
|
170
182
|
captionSm: '10px',
|
|
@@ -174,6 +186,7 @@ export const fontSizes = stylex.defineVars({
|
|
|
174
186
|
bodyMd: '14px',
|
|
175
187
|
bodyBase: '15px',
|
|
176
188
|
bodyLg: '18px',
|
|
189
|
+
bodyCompact: '15px',
|
|
177
190
|
heading6: '20px',
|
|
178
191
|
heading5: '24px',
|
|
179
192
|
heading4: '28px',
|
|
@@ -194,6 +207,7 @@ export const lineHeights = stylex.defineVars({
|
|
|
194
207
|
bodySm: '20px',
|
|
195
208
|
body: '24px',
|
|
196
209
|
bodyLg: '28px',
|
|
210
|
+
bodyCompact: '24px',
|
|
197
211
|
heading6: '24px',
|
|
198
212
|
heading5: '32px',
|
|
199
213
|
heading4: '36px',
|
|
@@ -203,6 +217,7 @@ export const lineHeights = stylex.defineVars({
|
|
|
203
217
|
});
|
|
204
218
|
export const fonts = stylex.defineVars({
|
|
205
219
|
sans: '"Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',
|
|
220
|
+
heading: '"Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',
|
|
206
221
|
mono: 'ui-monospace, SFMono-Regular, Menlo, monospace'
|
|
207
222
|
});
|
|
208
223
|
export const fontFeatures = stylex.defineVars({
|
|
@@ -214,7 +229,9 @@ export const fontWeights = stylex.defineVars({
|
|
|
214
229
|
semimedium: '450',
|
|
215
230
|
medium: '500',
|
|
216
231
|
semibold: '600',
|
|
217
|
-
bold: '700'
|
|
232
|
+
bold: '700',
|
|
233
|
+
heavy: '800',
|
|
234
|
+
heading: '500'
|
|
218
235
|
});
|
|
219
236
|
export const shadows = stylex.defineVars({
|
|
220
237
|
border: '0 0 0 1px light-dark(#00000012, #ffffff12)',
|