@lunar-js/lunar 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/CHANGELOG.md +12 -0
- package/LICENSE +21 -0
- package/README.md +41 -0
- package/dist/components/composite/Card/Card.d.ts +64 -0
- package/dist/components/composite/Card/Card.d.ts.map +1 -0
- package/dist/components/composite/Card/Card.js +86 -0
- package/dist/components/composite/Card/Card.js.map +1 -0
- package/dist/components/composite/Card/card.css.js +62 -0
- package/dist/components/composite/Card/card.css.js.map +1 -0
- package/dist/components/composite/Dialog/Dialog.d.ts +45 -0
- package/dist/components/composite/Dialog/Dialog.d.ts.map +1 -0
- package/dist/components/composite/Dialog/Dialog.js +117 -0
- package/dist/components/composite/Dialog/Dialog.js.map +1 -0
- package/dist/components/composite/Dialog/DialogProvider.d.ts +11 -0
- package/dist/components/composite/Dialog/DialogProvider.d.ts.map +1 -0
- package/dist/components/composite/Dialog/DialogProvider.js +19 -0
- package/dist/components/composite/Dialog/DialogProvider.js.map +1 -0
- package/dist/components/composite/Dialog/dialog.css.js +104 -0
- package/dist/components/composite/Dialog/dialog.css.js.map +1 -0
- package/dist/components/primitives/Button/Button.d.ts +27 -0
- package/dist/components/primitives/Button/Button.d.ts.map +1 -0
- package/dist/components/primitives/Button/Button.js +25 -0
- package/dist/components/primitives/Button/Button.js.map +1 -0
- package/dist/components/primitives/Button/button.css.d.ts +16 -0
- package/dist/components/primitives/Button/button.css.d.ts.map +1 -0
- package/dist/components/primitives/Button/button.css.js +202 -0
- package/dist/components/primitives/Button/button.css.js.map +1 -0
- package/dist/components/primitives/Button/button.types.d.ts +8 -0
- package/dist/components/primitives/Button/button.types.d.ts.map +1 -0
- package/dist/components/primitives/Input/Input.d.ts +12 -0
- package/dist/components/primitives/Input/Input.d.ts.map +1 -0
- package/dist/components/primitives/Input/Input.js +21 -0
- package/dist/components/primitives/Input/Input.js.map +1 -0
- package/dist/components/primitives/Input/input.css.js +54 -0
- package/dist/components/primitives/Input/input.css.js.map +1 -0
- package/dist/components/primitives/Label/Label.d.ts +13 -0
- package/dist/components/primitives/Label/Label.d.ts.map +1 -0
- package/dist/components/primitives/Label/Label.js +22 -0
- package/dist/components/primitives/Label/Label.js.map +1 -0
- package/dist/components/primitives/Label/label.css.js +35 -0
- package/dist/components/primitives/Label/label.css.js.map +1 -0
- package/dist/components/primitives/Typography/Text.d.ts +40 -0
- package/dist/components/primitives/Typography/Text.d.ts.map +1 -0
- package/dist/components/primitives/Typography/Text.js +28 -0
- package/dist/components/primitives/Typography/Text.js.map +1 -0
- package/dist/components/primitives/Typography/text.css.d.ts +31 -0
- package/dist/components/primitives/Typography/text.css.d.ts.map +1 -0
- package/dist/components/primitives/Typography/text.css.js +1019 -0
- package/dist/components/primitives/Typography/text.css.js.map +1 -0
- package/dist/components/primitives/Typography/text.types.d.ts +10 -0
- package/dist/components/primitives/Typography/text.types.d.ts.map +1 -0
- package/dist/constants/theming.d.ts +10 -0
- package/dist/constants/theming.d.ts.map +1 -0
- package/dist/constants/theming.js +11 -0
- package/dist/constants/theming.js.map +1 -0
- package/dist/hooks/dialog.d.ts +7 -0
- package/dist/hooks/dialog.d.ts.map +1 -0
- package/dist/hooks/dialog.js +14 -0
- package/dist/hooks/dialog.js.map +1 -0
- package/dist/hooks/refs.js +23 -0
- package/dist/hooks/refs.js.map +1 -0
- package/dist/hooks/theme.d.ts +7 -0
- package/dist/hooks/theme.d.ts.map +1 -0
- package/dist/hooks/theme.js +14 -0
- package/dist/hooks/theme.js.map +1 -0
- package/dist/hooks/utils.js +6 -0
- package/dist/hooks/utils.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +20 -0
- package/dist/styles.css.d.ts +4 -0
- package/dist/styles.css.js +5 -0
- package/dist/themes/ThemeProvider/ThemeProvider.d.ts +19 -0
- package/dist/themes/ThemeProvider/ThemeProvider.d.ts.map +1 -0
- package/dist/themes/ThemeProvider/ThemeProvider.js +25 -0
- package/dist/themes/ThemeProvider/ThemeProvider.js.map +1 -0
- package/dist/themes/regal.css.d.ts +5 -0
- package/dist/themes/regal.css.d.ts.map +1 -0
- package/dist/themes/regal.css.js +720 -0
- package/dist/themes/regal.css.js.map +1 -0
- package/dist/themes/styles/color-scheme.css.d.ts +6 -0
- package/dist/themes/styles/color-scheme.css.d.ts.map +1 -0
- package/dist/themes/styles/color-scheme.css.js +9 -0
- package/dist/themes/styles/color-scheme.css.js.map +1 -0
- package/dist/themes/styles/utilities.d.ts +125 -0
- package/dist/themes/styles/utilities.d.ts.map +1 -0
- package/dist/themes/styles/utilities.js +129 -0
- package/dist/themes/styles/utilities.js.map +1 -0
- package/dist/themes/tokens/primitives/borders.d.ts +22 -0
- package/dist/themes/tokens/primitives/borders.d.ts.map +1 -0
- package/dist/themes/tokens/primitives/borders.js +23 -0
- package/dist/themes/tokens/primitives/borders.js.map +1 -0
- package/dist/themes/tokens/primitives/colors.d.ts +100 -0
- package/dist/themes/tokens/primitives/colors.d.ts.map +1 -0
- package/dist/themes/tokens/primitives/colors.js +101 -0
- package/dist/themes/tokens/primitives/colors.js.map +1 -0
- package/dist/themes/tokens/primitives/shadows.d.ts +14 -0
- package/dist/themes/tokens/primitives/shadows.d.ts.map +1 -0
- package/dist/themes/tokens/primitives/shadows.js +15 -0
- package/dist/themes/tokens/primitives/shadows.js.map +1 -0
- package/dist/themes/tokens/primitives/spacing.d.ts +41 -0
- package/dist/themes/tokens/primitives/spacing.d.ts.map +1 -0
- package/dist/themes/tokens/primitives/spacing.js +42 -0
- package/dist/themes/tokens/primitives/spacing.js.map +1 -0
- package/dist/themes/tokens/primitives/typography.d.ts +105 -0
- package/dist/themes/tokens/primitives/typography.d.ts.map +1 -0
- package/dist/themes/tokens/primitives/typography.js +106 -0
- package/dist/themes/tokens/primitives/typography.js.map +1 -0
- package/dist/themes/tokens/semantic/borders.js +23 -0
- package/dist/themes/tokens/semantic/borders.js.map +1 -0
- package/dist/themes/tokens/semantic/colors.js +145 -0
- package/dist/themes/tokens/semantic/colors.js.map +1 -0
- package/dist/themes/tokens/semantic/shadows.js +15 -0
- package/dist/themes/tokens/semantic/shadows.js.map +1 -0
- package/dist/themes/tokens/semantic/spacing.js +70 -0
- package/dist/themes/tokens/semantic/spacing.js.map +1 -0
- package/dist/themes/tokens/semantic/typography.js +34 -0
- package/dist/themes/tokens/semantic/typography.js.map +1 -0
- package/dist/themes/tokens/tokens.css.d.ts +714 -0
- package/dist/themes/tokens/tokens.css.d.ts.map +1 -0
- package/dist/themes/tokens/tokens.css.js +36 -0
- package/dist/themes/tokens/tokens.css.js.map +1 -0
- package/dist/types/theming.d.ts +7 -0
- package/dist/types/theming.d.ts.map +1 -0
- package/package.json +80 -0
- package/src/components/composite/Card/Card.tsx +62 -0
- package/src/components/composite/Card/card.css.ts +79 -0
- package/src/components/composite/Dialog/Dialog.tsx +150 -0
- package/src/components/composite/Dialog/DialogProvider.tsx +21 -0
- package/src/components/composite/Dialog/dialog.css.ts +137 -0
- package/src/components/primitives/Button/Button.tsx +35 -0
- package/src/components/primitives/Button/button.css.ts +236 -0
- package/src/components/primitives/Button/button.types.ts +23 -0
- package/src/components/primitives/Input/Input.tsx +13 -0
- package/src/components/primitives/Input/input.css.ts +64 -0
- package/src/components/primitives/Label/Label.tsx +15 -0
- package/src/components/primitives/Label/label.css.ts +39 -0
- package/src/components/primitives/Typography/Text.tsx +55 -0
- package/src/components/primitives/Typography/text.css.ts +1091 -0
- package/src/components/primitives/Typography/text.types.ts +55 -0
- package/src/constants/theming.ts +16 -0
- package/src/hooks/dialog.ts +15 -0
- package/src/hooks/refs.ts +34 -0
- package/src/hooks/theme.ts +15 -0
- package/src/hooks/utils.ts +3 -0
- package/src/index.css.ts +26 -0
- package/src/index.ts +111 -0
- package/src/themes/ThemeProvider/ThemeProvider.tsx +39 -0
- package/src/themes/regal.css.ts +741 -0
- package/src/themes/styles/color-scheme.css.ts +11 -0
- package/src/themes/styles/utilities.ts +140 -0
- package/src/themes/tokens/primitives/borders.ts +21 -0
- package/src/themes/tokens/primitives/colors.ts +114 -0
- package/src/themes/tokens/primitives/shadows.ts +12 -0
- package/src/themes/tokens/primitives/spacing.ts +39 -0
- package/src/themes/tokens/primitives/typography.ts +125 -0
- package/src/themes/tokens/semantic/borders.ts +21 -0
- package/src/themes/tokens/semantic/colors.ts +166 -0
- package/src/themes/tokens/semantic/shadows.ts +12 -0
- package/src/themes/tokens/semantic/spacing.ts +75 -0
- package/src/themes/tokens/semantic/typography.ts +35 -0
- package/src/themes/tokens/tokens.css.ts +42 -0
- package/src/types/theming.ts +14 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { createVar } from '@vanilla-extract/css';
|
|
2
|
+
import { recipe } from '@vanilla-extract/recipes';
|
|
3
|
+
|
|
4
|
+
import { themeContract } from '../../../themes/tokens/tokens.css.js';
|
|
5
|
+
import { withCustomOutline, withSafeTransition } from '../../../themes/styles/utilities.js';
|
|
6
|
+
import { COLORS__PURE } from '../../../themes/tokens/primitives/colors.js';
|
|
7
|
+
|
|
8
|
+
const BUTTON_VARIANT__PRIMARY = 'primary';
|
|
9
|
+
const BUTTON_VARIANT__SECONDARY = 'secondary';
|
|
10
|
+
const BUTTON_VARIANT__OUTLINE = 'outline';
|
|
11
|
+
const BUTTON_VARIANT__DESTRUCTIVE = 'destructive';
|
|
12
|
+
const BUTTON_VARIANT__GHOST = 'ghost';
|
|
13
|
+
const BUTTON_VARIANT__LINK = 'link';
|
|
14
|
+
|
|
15
|
+
const BUTTON_SIZE__LARGE = 'large';
|
|
16
|
+
const BUTTON_SIZE__MEDIUM = 'medium';
|
|
17
|
+
const BUTTON_SIZE__SMALL = 'small';
|
|
18
|
+
|
|
19
|
+
const internalFontSize = createVar();
|
|
20
|
+
const internalPadding = createVar();
|
|
21
|
+
|
|
22
|
+
const buttonVariants = recipe({
|
|
23
|
+
base: [
|
|
24
|
+
withCustomOutline(themeContract.colors.shadow.interactive),
|
|
25
|
+
withSafeTransition({ transition: 'all 0.2s ease-in-out' }),
|
|
26
|
+
{
|
|
27
|
+
display: 'inline-flex',
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
justifyContent: 'center',
|
|
30
|
+
borderRadius: themeContract.borderRadius.md,
|
|
31
|
+
fontSize: internalFontSize,
|
|
32
|
+
padding: internalPadding,
|
|
33
|
+
fontWeight: themeContract.typography.body.md.medium.fontWeight,
|
|
34
|
+
gap: '0.5rem',
|
|
35
|
+
whiteSpace: 'nowrap',
|
|
36
|
+
flexShrink: 0,
|
|
37
|
+
border: '0',
|
|
38
|
+
cursor: 'pointer',
|
|
39
|
+
userSelect: 'none',
|
|
40
|
+
position: 'relative',
|
|
41
|
+
textDecoration: 'none',
|
|
42
|
+
outlineColor: COLORS__PURE.transparent,
|
|
43
|
+
':disabled': {
|
|
44
|
+
cursor: 'not-allowed',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
variants: {
|
|
49
|
+
variant: {
|
|
50
|
+
[BUTTON_VARIANT__PRIMARY]: {
|
|
51
|
+
backgroundColor: themeContract.colors.action.bg.primary.default,
|
|
52
|
+
color: themeContract.colors.action.color.primary,
|
|
53
|
+
selectors: {
|
|
54
|
+
'&:hover:not(:disabled)': {
|
|
55
|
+
backgroundColor: themeContract.colors.action.bg.primary.hover,
|
|
56
|
+
},
|
|
57
|
+
'&:hover:not(:focus-visible)': {
|
|
58
|
+
boxShadow: `0 1px 3px ${themeContract.colors.shadow.subtle}`,
|
|
59
|
+
},
|
|
60
|
+
'&:active:not(:disabled)': {
|
|
61
|
+
backgroundColor: themeContract.colors.action.bg.primary.active,
|
|
62
|
+
transform: 'translateY(1px)',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
':disabled': {
|
|
66
|
+
backgroundColor: themeContract.colors.action.bg.primary.disabled,
|
|
67
|
+
color: themeContract.colors.text.disabled,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
[BUTTON_VARIANT__SECONDARY]: {
|
|
71
|
+
backgroundColor: themeContract.colors.action.bg.secondary.default,
|
|
72
|
+
borderColor: themeContract.colors.border.action.secondary,
|
|
73
|
+
color: themeContract.colors.text.primary,
|
|
74
|
+
selectors: {
|
|
75
|
+
'&:hover:not(:disabled)': {
|
|
76
|
+
backgroundColor: themeContract.colors.action.bg.secondary.hover,
|
|
77
|
+
boxShadow: `0 1px 3px ${themeContract.colors.shadow.subtle}`,
|
|
78
|
+
},
|
|
79
|
+
'&:active:not(:disabled)': {
|
|
80
|
+
backgroundColor: themeContract.colors.action.bg.secondary.active,
|
|
81
|
+
transform: 'translateY(1px)',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
':disabled': {
|
|
85
|
+
backgroundColor: themeContract.colors.action.bg.secondary.disabled,
|
|
86
|
+
color: themeContract.colors.text.disabled,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
[BUTTON_VARIANT__OUTLINE]: {
|
|
90
|
+
backgroundColor: themeContract.colors.action.bg.outline.default,
|
|
91
|
+
border: themeContract.borderWidth[1],
|
|
92
|
+
borderStyle: 'solid',
|
|
93
|
+
borderColor: themeContract.colors.border.interactive.default,
|
|
94
|
+
color: themeContract.colors.text.interactive.default,
|
|
95
|
+
selectors: {
|
|
96
|
+
'&:hover:not(:disabled)': {
|
|
97
|
+
backgroundColor: themeContract.colors.action.bg.outline.hover,
|
|
98
|
+
borderColor: themeContract.colors.border.interactive.hover,
|
|
99
|
+
color: themeContract.colors.text.interactive.hover,
|
|
100
|
+
boxShadow: `0 1px 3px ${themeContract.colors.shadow.subtle}`,
|
|
101
|
+
},
|
|
102
|
+
'&:active:not(:disabled)': {
|
|
103
|
+
backgroundColor: themeContract.colors.action.bg.outline.active,
|
|
104
|
+
borderColor: themeContract.colors.border.interactive.active,
|
|
105
|
+
color: themeContract.colors.text.interactive.active,
|
|
106
|
+
transform: 'translateY(1px)',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
':disabled': {
|
|
110
|
+
backgroundColor: themeContract.colors.action.bg.outline.disabled,
|
|
111
|
+
borderColor: themeContract.colors.border.action.disabled,
|
|
112
|
+
color: themeContract.colors.action.color.outline.disabled,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
[BUTTON_VARIANT__GHOST]: {
|
|
116
|
+
backgroundColor: themeContract.colors.action.ghost.default,
|
|
117
|
+
borderColor: themeContract.colors.action.ghost.default,
|
|
118
|
+
color: themeContract.colors.text.interactive.default,
|
|
119
|
+
selectors: {
|
|
120
|
+
'&:hover:not(:disabled)': {
|
|
121
|
+
backgroundColor: themeContract.colors.action.ghost.hover,
|
|
122
|
+
color: themeContract.colors.text.interactive.hover,
|
|
123
|
+
},
|
|
124
|
+
'&:active:not(:disabled)': {
|
|
125
|
+
backgroundColor: themeContract.colors.action.ghost.active,
|
|
126
|
+
color: themeContract.colors.text.interactive.active,
|
|
127
|
+
transform: 'translateY(1px)',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
':disabled': {
|
|
131
|
+
backgroundColor: themeContract.colors.action.ghost.disabled,
|
|
132
|
+
color: themeContract.colors.text.disabled,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
[BUTTON_VARIANT__LINK]: [
|
|
136
|
+
withSafeTransition({
|
|
137
|
+
transition: 'background-size 400ms',
|
|
138
|
+
}),
|
|
139
|
+
{
|
|
140
|
+
alignSelf: 'center',
|
|
141
|
+
color: themeContract.colors.text.interactive.default,
|
|
142
|
+
background: `none, linear-gradient(to right, ${themeContract.colors.text.interactive.hover}, ${themeContract.colors.text.interactive.hover})`,
|
|
143
|
+
backgroundRepeat: 'no-repeat',
|
|
144
|
+
backgroundPosition: '100% 100%, 0 100%',
|
|
145
|
+
backgroundSize: `100% calc(${internalFontSize} / 4), 0 calc(${internalFontSize} / 4)`,
|
|
146
|
+
borderRadius: themeContract.borderRadius.none,
|
|
147
|
+
textWrap: 'nowrap',
|
|
148
|
+
padding: '0',
|
|
149
|
+
paddingBottom: '0.2em',
|
|
150
|
+
height: 'min-content',
|
|
151
|
+
selectors: {
|
|
152
|
+
'&:hover:not(:disabled)': {
|
|
153
|
+
backgroundSize: `0 calc(${internalFontSize} / 4), 100% calc(${internalFontSize} / 4)`,
|
|
154
|
+
color: themeContract.colors.text.interactive.hover,
|
|
155
|
+
},
|
|
156
|
+
'&:focus:not(:disabled)': {
|
|
157
|
+
backgroundSize: `0 calc(${internalFontSize} / 4), 100% calc(${internalFontSize} / 4)`,
|
|
158
|
+
color: themeContract.colors.text.interactive.hover,
|
|
159
|
+
},
|
|
160
|
+
'&:active:not(:disabled)': {
|
|
161
|
+
backgroundSize: `0 calc(${internalFontSize} / 4), 100% calc(${internalFontSize} / 4)`,
|
|
162
|
+
color: themeContract.colors.text.interactive.active,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
':disabled': {
|
|
166
|
+
color: themeContract.colors.text.disabled,
|
|
167
|
+
textDecoration: 'none',
|
|
168
|
+
},
|
|
169
|
+
':focus-visible': {
|
|
170
|
+
boxShadow: 'none',
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
[BUTTON_VARIANT__DESTRUCTIVE]: [
|
|
175
|
+
withCustomOutline(themeContract.colors.shadow.destructive),
|
|
176
|
+
{
|
|
177
|
+
backgroundColor: themeContract.colors.action.destructive.default,
|
|
178
|
+
borderColor: themeContract.colors.border.action.destructive,
|
|
179
|
+
color: themeContract.colors.text.inverse,
|
|
180
|
+
selectors: {
|
|
181
|
+
'&:hover:not(:disabled)': {
|
|
182
|
+
backgroundColor: themeContract.colors.action.destructive.hover,
|
|
183
|
+
boxShadow: `0 1px 3px ${themeContract.colors.shadow.subtle}`,
|
|
184
|
+
},
|
|
185
|
+
'&:active:not(:disabled)': {
|
|
186
|
+
backgroundColor: themeContract.colors.action.destructive.active,
|
|
187
|
+
transform: 'translateY(1px)',
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
':disabled': {
|
|
191
|
+
backgroundColor: themeContract.colors.action.destructive.disabled,
|
|
192
|
+
borderColor: themeContract.colors.border.action.disabled,
|
|
193
|
+
color: themeContract.colors.text.disabled,
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
},
|
|
198
|
+
size: {
|
|
199
|
+
[BUTTON_SIZE__SMALL]: {
|
|
200
|
+
vars: {
|
|
201
|
+
[internalFontSize]: themeContract.typography.body.sm.medium.fontSize,
|
|
202
|
+
[internalPadding]: `${themeContract.spacing[1.5]} ${themeContract.spacing[3]}`,
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
[BUTTON_SIZE__MEDIUM]: {
|
|
206
|
+
vars: {
|
|
207
|
+
[internalFontSize]: themeContract.typography.body.md.medium.fontSize,
|
|
208
|
+
[internalPadding]: `${themeContract.spacing[2]} ${themeContract.spacing[4]}`,
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
[BUTTON_SIZE__LARGE]: {
|
|
212
|
+
vars: {
|
|
213
|
+
[internalFontSize]: themeContract.typography.body.lg.medium.fontSize,
|
|
214
|
+
[internalPadding]: `${themeContract.spacing[3]} ${themeContract.spacing[6]}`,
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
defaultVariants: {
|
|
220
|
+
variant: BUTTON_VARIANT__PRIMARY,
|
|
221
|
+
size: BUTTON_SIZE__MEDIUM,
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
export {
|
|
226
|
+
BUTTON_VARIANT__PRIMARY,
|
|
227
|
+
BUTTON_VARIANT__SECONDARY,
|
|
228
|
+
BUTTON_VARIANT__OUTLINE,
|
|
229
|
+
BUTTON_VARIANT__DESTRUCTIVE,
|
|
230
|
+
BUTTON_VARIANT__GHOST,
|
|
231
|
+
BUTTON_VARIANT__LINK,
|
|
232
|
+
BUTTON_SIZE__LARGE,
|
|
233
|
+
BUTTON_SIZE__MEDIUM,
|
|
234
|
+
BUTTON_SIZE__SMALL,
|
|
235
|
+
buttonVariants,
|
|
236
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
BUTTON_SIZE__LARGE,
|
|
3
|
+
BUTTON_SIZE__MEDIUM,
|
|
4
|
+
BUTTON_SIZE__SMALL,
|
|
5
|
+
BUTTON_VARIANT__DESTRUCTIVE,
|
|
6
|
+
BUTTON_VARIANT__GHOST,
|
|
7
|
+
BUTTON_VARIANT__LINK,
|
|
8
|
+
BUTTON_VARIANT__OUTLINE,
|
|
9
|
+
BUTTON_VARIANT__PRIMARY,
|
|
10
|
+
BUTTON_VARIANT__SECONDARY,
|
|
11
|
+
} from './button.css.js';
|
|
12
|
+
|
|
13
|
+
type ButtonVariant =
|
|
14
|
+
| typeof BUTTON_VARIANT__PRIMARY
|
|
15
|
+
| typeof BUTTON_VARIANT__SECONDARY
|
|
16
|
+
| typeof BUTTON_VARIANT__OUTLINE
|
|
17
|
+
| typeof BUTTON_VARIANT__DESTRUCTIVE
|
|
18
|
+
| typeof BUTTON_VARIANT__GHOST
|
|
19
|
+
| typeof BUTTON_VARIANT__LINK;
|
|
20
|
+
|
|
21
|
+
type ButtonSize = typeof BUTTON_SIZE__LARGE | typeof BUTTON_SIZE__MEDIUM | typeof BUTTON_SIZE__SMALL;
|
|
22
|
+
|
|
23
|
+
export type { ButtonVariant, ButtonSize };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ComponentProps, type FC } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { input } from './input.css.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Standard input component with consistent styling and design system integration.
|
|
7
|
+
* Extends native HTML input element with theme-aware styling.
|
|
8
|
+
*/
|
|
9
|
+
const Input: FC<ComponentProps<'input'>> = ({ className, ...props }) => {
|
|
10
|
+
return <input data-slot="input" className={clsx(input, className)} {...props} />;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default Input;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { style } from '@vanilla-extract/css';
|
|
2
|
+
|
|
3
|
+
import { themeContract } from '../../../themes/tokens/tokens.css.js';
|
|
4
|
+
import { withBreakpoint, withCustomOutline, withSafeTransition } from '../../../themes/styles/utilities.js';
|
|
5
|
+
import { BREAKPOINT__MD } from '../../../constants/theming.js';
|
|
6
|
+
import { COLORS__PURE } from '../../../themes/tokens/primitives/colors.js';
|
|
7
|
+
|
|
8
|
+
const input = style([
|
|
9
|
+
withBreakpoint(BREAKPOINT__MD, {
|
|
10
|
+
fontSize: themeContract.typography.body.sm.medium.fontSize,
|
|
11
|
+
}),
|
|
12
|
+
withCustomOutline(themeContract.colors.shadow.focus),
|
|
13
|
+
withSafeTransition({
|
|
14
|
+
transition: 'color 150ms ease-in-out, box-shadow 150ms ease-in-out',
|
|
15
|
+
}),
|
|
16
|
+
{
|
|
17
|
+
width: '100%',
|
|
18
|
+
minWidth: 0,
|
|
19
|
+
boxSizing: 'border-box',
|
|
20
|
+
borderRadius: themeContract.borderRadius.md,
|
|
21
|
+
border: `${themeContract.borderWidth[1]} solid ${themeContract.colors.input.border.default}`,
|
|
22
|
+
backgroundColor: COLORS__PURE.transparent,
|
|
23
|
+
paddingLeft: themeContract.spacing[3],
|
|
24
|
+
paddingRight: themeContract.spacing[3],
|
|
25
|
+
paddingTop: themeContract.spacing[1],
|
|
26
|
+
paddingBottom: themeContract.spacing[1],
|
|
27
|
+
fontSize: themeContract.typography.body.md.medium.fontSize,
|
|
28
|
+
lineHeight: themeContract.typography.body.md.medium.lineHeight,
|
|
29
|
+
boxShadow: themeContract.boxShadow.sm,
|
|
30
|
+
color: themeContract.colors.text.primary,
|
|
31
|
+
selectors: {
|
|
32
|
+
'&[aria-invalid="true"]': {
|
|
33
|
+
borderColor: themeContract.colors.border.error,
|
|
34
|
+
},
|
|
35
|
+
...withCustomOutline(themeContract.colors.shadow.destructive, '&[aria-invalid="true"]'),
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
'::file-selector-button': {
|
|
39
|
+
display: 'inline-flex',
|
|
40
|
+
border: 0,
|
|
41
|
+
backgroundColor: COLORS__PURE.transparent,
|
|
42
|
+
fontSize: themeContract.typography.body.md.medium.fontSize,
|
|
43
|
+
fontWeight: themeContract.typography.body.md.medium.fontWeight,
|
|
44
|
+
color: themeContract.colors.text.primary,
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
'::placeholder': {
|
|
48
|
+
color: themeContract.colors.input.text.placeholder,
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
'::selection': {
|
|
52
|
+
backgroundColor: themeContract.colors.action.bg.primary.default,
|
|
53
|
+
color: themeContract.colors.action.color.primary,
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
':disabled': {
|
|
57
|
+
pointerEvents: 'none',
|
|
58
|
+
cursor: 'not-allowed',
|
|
59
|
+
opacity: '0.5',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
]);
|
|
63
|
+
|
|
64
|
+
export { input };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ComponentProps, type FC } from 'react';
|
|
2
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
|
|
5
|
+
import { label } from './label.css.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Accessible label component built on Radix UI's Label primitive.
|
|
9
|
+
* Provides proper form control labeling with consistent styling.
|
|
10
|
+
*/
|
|
11
|
+
const Label: FC<ComponentProps<typeof LabelPrimitive.Root>> = ({ className, ...props }) => {
|
|
12
|
+
return <LabelPrimitive.Root data-slot="label" className={clsx(label, className)} {...props} />;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default Label;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { style } from '@vanilla-extract/css';
|
|
2
|
+
|
|
3
|
+
import { themeContract } from '../../../themes/tokens/tokens.css.js';
|
|
4
|
+
|
|
5
|
+
const label = style({
|
|
6
|
+
display: 'flex',
|
|
7
|
+
alignItems: 'center',
|
|
8
|
+
gap: themeContract.spacing[2],
|
|
9
|
+
|
|
10
|
+
fontSize: themeContract.typography.label.lg.medium.fontSize,
|
|
11
|
+
lineHeight: themeContract.typography.label.lg.medium.lineHeight,
|
|
12
|
+
fontWeight: themeContract.typography.label.lg.medium.fontWeight,
|
|
13
|
+
|
|
14
|
+
userSelect: 'none',
|
|
15
|
+
|
|
16
|
+
selectors: {
|
|
17
|
+
'[data-disabled="true"] &': {
|
|
18
|
+
pointerEvents: 'none',
|
|
19
|
+
opacity: 0.5,
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
':disabled + &': {
|
|
23
|
+
cursor: 'not-allowed',
|
|
24
|
+
opacity: 0.5,
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
'input:disabled + &': {
|
|
28
|
+
cursor: 'not-allowed',
|
|
29
|
+
opacity: 0.5,
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
':is(input, select, textarea):disabled + &': {
|
|
33
|
+
cursor: 'not-allowed',
|
|
34
|
+
opacity: 0.5,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export { label };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ComponentProps, FC } from 'react';
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
|
|
5
|
+
import { textVariants } from './text.css.js';
|
|
6
|
+
import type { TextColor, TextSize, TextType, TextWeight } from './text.types.js';
|
|
7
|
+
|
|
8
|
+
interface TextProps extends ComponentProps<'h1'> {
|
|
9
|
+
/**
|
|
10
|
+
* When true, the component will render as a child component using Radix UI's Slot primitive.
|
|
11
|
+
* This allows the text styles to be applied to any element while maintaining accessibility.
|
|
12
|
+
*/
|
|
13
|
+
asChild?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* HTML element to render as.
|
|
16
|
+
*/
|
|
17
|
+
as: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'p' | 'small';
|
|
18
|
+
/**
|
|
19
|
+
* Text style variant that determines the overall visual appearance.
|
|
20
|
+
*/
|
|
21
|
+
variant?: TextType;
|
|
22
|
+
/**
|
|
23
|
+
* Visual size variant - independent of semantic HTML element.
|
|
24
|
+
* Allows for flexible styling while maintaining proper semantic structure.
|
|
25
|
+
*/
|
|
26
|
+
size?: TextSize;
|
|
27
|
+
/**
|
|
28
|
+
* Color variant for the text.
|
|
29
|
+
*/
|
|
30
|
+
color?: TextColor;
|
|
31
|
+
/**
|
|
32
|
+
* Font weight variant for the text.
|
|
33
|
+
*/
|
|
34
|
+
weight?: TextWeight;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Flexible text component that supports multiple HTML elements with consistent styling.
|
|
39
|
+
* Allows semantic HTML structure while providing design system typography variants.
|
|
40
|
+
*/
|
|
41
|
+
const Text: FC<TextProps> = ({ ref, className, asChild, as: tag, variant, size, color, weight, ...props }) => {
|
|
42
|
+
const Comp = asChild ? Slot : tag;
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Comp
|
|
46
|
+
ref={ref}
|
|
47
|
+
data-slot={tag}
|
|
48
|
+
className={clsx(textVariants({ variant, size, color, weight }), className)}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type { TextProps };
|
|
55
|
+
export default Text;
|