@kennycorrea/ui 0.1.0
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/README.md +153 -0
- package/dist/atoms/Avatar/Avatar.d.ts +7 -0
- package/dist/atoms/Avatar/Avatar.js +19 -0
- package/dist/atoms/Avatar/index.d.ts +1 -0
- package/dist/atoms/Avatar/index.js +1 -0
- package/dist/atoms/Badge/Badge.d.ts +7 -0
- package/dist/atoms/Badge/Badge.js +23 -0
- package/dist/atoms/Badge/index.d.ts +1 -0
- package/dist/atoms/Badge/index.js +1 -0
- package/dist/atoms/Button/Button.d.ts +2 -0
- package/dist/atoms/Button/Button.js +34 -0
- package/dist/atoms/Button/Button.types.d.ts +40 -0
- package/dist/atoms/Button/Button.types.js +1 -0
- package/dist/atoms/Button/index.d.ts +2 -0
- package/dist/atoms/Button/index.js +2 -0
- package/dist/atoms/Card/Card.d.ts +16 -0
- package/dist/atoms/Card/Card.js +22 -0
- package/dist/atoms/Card/index.d.ts +1 -0
- package/dist/atoms/Card/index.js +1 -0
- package/dist/atoms/Checkbox/Checkbox.d.ts +11 -0
- package/dist/atoms/Checkbox/Checkbox.js +14 -0
- package/dist/atoms/Checkbox/index.d.ts +1 -0
- package/dist/atoms/Checkbox/index.js +1 -0
- package/dist/atoms/ContextMenu/ContextMenu.d.ts +31 -0
- package/dist/atoms/ContextMenu/ContextMenu.js +24 -0
- package/dist/atoms/ContextMenu/index.d.ts +1 -0
- package/dist/atoms/ContextMenu/index.js +1 -0
- package/dist/atoms/Dialog/Dialog.d.ts +19 -0
- package/dist/atoms/Dialog/Dialog.js +13 -0
- package/dist/atoms/Dialog/index.d.ts +1 -0
- package/dist/atoms/Dialog/index.js +1 -0
- package/dist/atoms/Icon/Icon.d.ts +48 -0
- package/dist/atoms/Icon/Icon.js +43 -0
- package/dist/atoms/Icon/index.d.ts +1 -0
- package/dist/atoms/Icon/index.js +1 -0
- package/dist/atoms/Input/Input.d.ts +15 -0
- package/dist/atoms/Input/Input.js +11 -0
- package/dist/atoms/Input/index.d.ts +1 -0
- package/dist/atoms/Input/index.js +1 -0
- package/dist/atoms/Label/Label.d.ts +12 -0
- package/dist/atoms/Label/Label.js +14 -0
- package/dist/atoms/Label/index.d.ts +1 -0
- package/dist/atoms/Label/index.js +1 -0
- package/dist/atoms/Popover/Popover.d.ts +16 -0
- package/dist/atoms/Popover/Popover.js +11 -0
- package/dist/atoms/Popover/index.d.ts +1 -0
- package/dist/atoms/Popover/index.js +1 -0
- package/dist/atoms/Progress/Progress.d.ts +9 -0
- package/dist/atoms/Progress/Progress.js +12 -0
- package/dist/atoms/Progress/index.d.ts +1 -0
- package/dist/atoms/Progress/index.js +1 -0
- package/dist/atoms/Select/Select.d.ts +25 -0
- package/dist/atoms/Select/Select.js +16 -0
- package/dist/atoms/Select/index.d.ts +1 -0
- package/dist/atoms/Select/index.js +1 -0
- package/dist/atoms/Separator/Separator.d.ts +5 -0
- package/dist/atoms/Separator/Separator.js +6 -0
- package/dist/atoms/Separator/index.d.ts +1 -0
- package/dist/atoms/Separator/index.js +1 -0
- package/dist/atoms/Spinner/Spinner.d.ts +12 -0
- package/dist/atoms/Spinner/Spinner.js +15 -0
- package/dist/atoms/Spinner/index.d.ts +1 -0
- package/dist/atoms/Spinner/index.js +1 -0
- package/dist/atoms/Switch/Switch.d.ts +4 -0
- package/dist/atoms/Switch/Switch.js +7 -0
- package/dist/atoms/Switch/index.d.ts +1 -0
- package/dist/atoms/Switch/index.js +1 -0
- package/dist/atoms/Textarea/Textarea.d.ts +6 -0
- package/dist/atoms/Textarea/Textarea.js +7 -0
- package/dist/atoms/Textarea/index.d.ts +1 -0
- package/dist/atoms/Textarea/index.js +1 -0
- package/dist/atoms/Tooltip/Tooltip.d.ts +26 -0
- package/dist/atoms/Tooltip/Tooltip.js +25 -0
- package/dist/atoms/Tooltip/index.d.ts +1 -0
- package/dist/atoms/Tooltip/index.js +1 -0
- package/dist/atoms/index.d.ts +18 -0
- package/dist/atoms/index.js +18 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/strings.d.ts +39 -0
- package/dist/strings.js +26 -0
- package/dist/utils/cn.d.ts +3 -0
- package/dist/utils/cn.js +6 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/theme.d.ts +33 -0
- package/dist/utils/theme.js +72 -0
- package/package.json +55 -0
- package/tokens.css +240 -0
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kennycorrea/ui",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Upfront's house component layer: atoms over Radix Themes, the token bridge, and the accent logic.",
|
|
5
|
+
"private": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"license": "UNLICENSED",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"tokens.css",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./tokens.css": "./tokens.css"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc -p tsconfig.json",
|
|
24
|
+
"clean": "rimraf dist",
|
|
25
|
+
"lint": "biome check .",
|
|
26
|
+
"format": "biome check --write .",
|
|
27
|
+
"prepublishOnly": "npm run build",
|
|
28
|
+
"test": "biome check . && tsc -p tsconfig.json --noEmit"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@radix-ui/themes": "^3.3.0",
|
|
32
|
+
"react": "^19.0.0",
|
|
33
|
+
"react-dom": "^19.0.0"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"clsx": "^2.1.1",
|
|
37
|
+
"tailwind-merge": "^3.7.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@biomejs/biome": "^2.5.13",
|
|
41
|
+
"@radix-ui/themes": "^3.3.0",
|
|
42
|
+
"@types/react": "^19.2.18",
|
|
43
|
+
"@types/react-dom": "^19.2.7",
|
|
44
|
+
"react": "^19.2.8",
|
|
45
|
+
"react-dom": "^19.2.8",
|
|
46
|
+
"typescript": "~6.0.2"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "git+ssh://git@github.com/kennyrafael/upfront-ui.git"
|
|
54
|
+
}
|
|
55
|
+
}
|
package/tokens.css
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upfront's token bridge — the shared half of every app's stylesheet.
|
|
3
|
+
*
|
|
4
|
+
* Two apps said `text-ink-muted` and `bg-brand-700/8` and each carried its own copy of what
|
|
5
|
+
* those meant. The values below are the dashboard's, which was the more complete of the two.
|
|
6
|
+
*
|
|
7
|
+
* **How far the two copies had actually drifted, measured rather than assumed**, because the
|
|
8
|
+
* answer is narrower than "two copies always diverge" and the difference matters:
|
|
9
|
+
*
|
|
10
|
+
* - **The live values agreed.** `--color-ink` resolved to `var(--gray-12)` in both,
|
|
11
|
+
* `--color-hairline` to `var(--gray-a6)`, and the backdrop to the same `oklch` literal. The
|
|
12
|
+
* `.radix-themes` blocks had been kept in step by hand, and they were right.
|
|
13
|
+
* - **The static fallbacks in `@theme` had not been.** `--color-ink` was `#1d3b31` here and
|
|
14
|
+
* `#1a211f` there; the hairline 12% against 10%. Those only show if the Radix stylesheet
|
|
15
|
+
* fails to load, so the drift was real and invisible — the worst kind to leave lying around,
|
|
16
|
+
* and the least urgent.
|
|
17
|
+
* - **`--font-sans` was the one live difference**: `'Inter', …` in the dashboard against
|
|
18
|
+
* `ui-sans-serif, …` on the site. ⚠ And neither app loads Inter, so the dashboard has been
|
|
19
|
+
* asking for a font it does not have and both render the system stack. Unified here; if Inter
|
|
20
|
+
* is ever wanted it needs adding to the apps' HTML, and then it will apply to all three at
|
|
21
|
+
* once, which is the point.
|
|
22
|
+
*
|
|
23
|
+
* The drift that was live and visible was in the **components**, not the colours — see the
|
|
24
|
+
* `Button` note in the README.
|
|
25
|
+
*
|
|
26
|
+
* **How to use it**, in an app's own `index.css`:
|
|
27
|
+
*
|
|
28
|
+
* @import 'tailwindcss';
|
|
29
|
+
* @source '../node_modules/@kennycorrea/ui/dist';
|
|
30
|
+
* @import '@kennycorrea/ui/tokens.css';
|
|
31
|
+
*
|
|
32
|
+
* The `@source` line is not optional. Tailwind does not scan `node_modules`, so without it
|
|
33
|
+
* every utility class used *inside* the atoms — `w-full`, `inline-flex` — is absent from the
|
|
34
|
+
* generated CSS, and the components come out subtly unstyled with nothing in the console.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Upfront's token names, registered with Tailwind.
|
|
40
|
+
*
|
|
41
|
+
* The values here are static fallbacks, not the live palette — the real assignments are in
|
|
42
|
+
* the `.radix-themes` rule below. Two blocks rather than one because of how custom
|
|
43
|
+
* properties resolve: `@theme` emits to `:root`, Radix Themes defines `--accent-*` and
|
|
44
|
+
* `--gray-*` on its own element, and `var(--accent-9)` written at `:root` resolves against
|
|
45
|
+
* a variable that does not exist there — to nothing at all. It has to be written where the
|
|
46
|
+
* Radix variables live.
|
|
47
|
+
*
|
|
48
|
+
* Keeping real colours here rather than empty placeholders means the app still renders
|
|
49
|
+
* something sane if the Themes stylesheet ever fails to load.
|
|
50
|
+
*/
|
|
51
|
+
@theme {
|
|
52
|
+
--color-brand-50: #f4fbf7;
|
|
53
|
+
--color-brand-100: #e6f7ed;
|
|
54
|
+
--color-brand-200: #d6f1e3;
|
|
55
|
+
--color-brand-300: #c3e9d7;
|
|
56
|
+
--color-brand-400: #acdec8;
|
|
57
|
+
--color-brand-500: #8bceb6;
|
|
58
|
+
--color-brand-600: #56ba9f;
|
|
59
|
+
--color-brand-700: #29a383;
|
|
60
|
+
--color-brand-ink: #208368;
|
|
61
|
+
--color-brand-800: #26997b;
|
|
62
|
+
--color-brand-900: #1d3b31;
|
|
63
|
+
--color-brand-950: #1d3b31;
|
|
64
|
+
|
|
65
|
+
--color-oncolor: #ffffff;
|
|
66
|
+
--color-canvas: #fbfefd;
|
|
67
|
+
--color-ink: #1d3b31;
|
|
68
|
+
--color-ink-muted: #5f6d68;
|
|
69
|
+
--color-sheet: #ffffff;
|
|
70
|
+
--color-backdrop: #1d3b31;
|
|
71
|
+
--color-onbackdrop: rgba(255, 255, 255, 0.75);
|
|
72
|
+
--color-scrim: rgba(0, 0, 0, 0.6);
|
|
73
|
+
--color-hairline: rgba(29, 59, 49, 0.12);
|
|
74
|
+
|
|
75
|
+
--color-warn: #ffc53d;
|
|
76
|
+
--color-warn-ink: #ab6400;
|
|
77
|
+
--color-warn-solid: #ffc53d;
|
|
78
|
+
--color-danger: #e5484d;
|
|
79
|
+
--color-danger-ink: #ce2c31;
|
|
80
|
+
--color-danger-solid: #e5484d;
|
|
81
|
+
--color-good: #29a383;
|
|
82
|
+
--color-good-ink: #208368;
|
|
83
|
+
|
|
84
|
+
--shadow-panel: 0 1px 2px rgba(29, 59, 49, 0.06), 0 16px 40px -20px rgba(29, 59, 49, 0.22);
|
|
85
|
+
--shadow-raised: 0 1px 2px rgba(29, 59, 49, 0.09), 0 24px 56px -24px rgba(29, 59, 49, 0.32);
|
|
86
|
+
|
|
87
|
+
--font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The live bridge: Upfront's names, pointed at Radix Themes' palette.
|
|
92
|
+
*
|
|
93
|
+
* Every colour in the app now comes from Themes. This is the only place that names a Radix
|
|
94
|
+
* variable — the components keep saying `brand-700`, `ink-muted`, `surface`, and nothing
|
|
95
|
+
* had to be rewritten to adopt them.
|
|
96
|
+
*
|
|
97
|
+
* **Light and dark are no longer ours to maintain.** Themes redefines these under its own
|
|
98
|
+
* `.light` and `.dark` classes, so the hand-written dark palette that used to live here —
|
|
99
|
+
* two near-identical eighty-line blocks — is gone. Setting `appearance` on the `<Theme>` in
|
|
100
|
+
* App.tsx is the whole of it now.
|
|
101
|
+
*
|
|
102
|
+
* The step numbering is Radix's, and it is semantic rather than a lightness ramp: 9 is the
|
|
103
|
+
* solid fill an action is painted with, 11 is low-contrast text, 12 is high-contrast text.
|
|
104
|
+
* Those meanings hold in both appearances, which is why `text-brand-900` reads correctly on
|
|
105
|
+
* a dark ground without a second definition.
|
|
106
|
+
*/
|
|
107
|
+
@layer base {
|
|
108
|
+
.radix-themes {
|
|
109
|
+
--color-brand-50: var(--accent-2);
|
|
110
|
+
--color-brand-100: var(--accent-3);
|
|
111
|
+
--color-brand-200: var(--accent-4);
|
|
112
|
+
--color-brand-300: var(--accent-5);
|
|
113
|
+
--color-brand-400: var(--accent-6);
|
|
114
|
+
--color-brand-500: var(--accent-7);
|
|
115
|
+
--color-brand-600: var(--accent-8);
|
|
116
|
+
/* 700 is the primary action colour, so it maps to the step Radix paints buttons with. */
|
|
117
|
+
--color-brand-700: var(--accent-9);
|
|
118
|
+
--color-brand-800: var(--accent-10);
|
|
119
|
+
--color-brand-900: var(--accent-12);
|
|
120
|
+
--color-brand-950: var(--accent-12);
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Brand **text**, which is not the same colour as a brand fill.
|
|
124
|
+
*
|
|
125
|
+
* Step 9 is the one Radix paints buttons with — a saturated block meant to have
|
|
126
|
+
* something written on top of it, not to be written with. As a link on a pale surface
|
|
127
|
+
* it was always thin for jade, and once the accent became the business's choice it
|
|
128
|
+
* broke outright: yellow-9 on white is a highlighter pen. Step 11 is Radix's
|
|
129
|
+
* "low-contrast text", which is exactly this job and holds in both appearances.
|
|
130
|
+
*
|
|
131
|
+
* Fills and washes keep 700. Only the ink moved.
|
|
132
|
+
*/
|
|
133
|
+
--color-brand-ink: var(--accent-11);
|
|
134
|
+
|
|
135
|
+
/* What Radix itself writes on top of accent-9, so a label on a button is never guesswork. */
|
|
136
|
+
--color-oncolor: var(--accent-contrast);
|
|
137
|
+
|
|
138
|
+
--color-canvas: var(--color-background);
|
|
139
|
+
--color-ink: var(--gray-12);
|
|
140
|
+
--color-ink-muted: var(--gray-11);
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The material every card, dialog and bar is made of.
|
|
144
|
+
*
|
|
145
|
+
* Called `sheet` and not `surface`, which is the obvious name, because Radix Themes
|
|
146
|
+
* already defines `--color-surface` for its own translucent component fills. Theirs is
|
|
147
|
+
* unlayered CSS and ours sits in `@layer base`, so unlayered wins the cascade and every
|
|
148
|
+
* `bg-surface` in the app quietly painted at 85% — which is what made the mobile
|
|
149
|
+
* sidebar see-through.
|
|
150
|
+
*
|
|
151
|
+
* Solid rather than translucent: these are already stacked on a washed ground, and
|
|
152
|
+
* layering two translucencies turns the text grey.
|
|
153
|
+
*/
|
|
154
|
+
--color-sheet: var(--color-panel-solid);
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The deep field behind sign-in and the public booking page, and the wash behind a
|
|
158
|
+
* dialog. Both have to stay dark in *either* appearance.
|
|
159
|
+
*
|
|
160
|
+
* **Neither can be a step from an accent scale.** Themes flips the whole ramp between
|
|
161
|
+
* appearances, so `--jade-12` is a near-black green in light and a pale mint in dark —
|
|
162
|
+
* which turned the sign-in screen into a bright green field with a dark card on it. The
|
|
163
|
+
* scrim was worse: `--gray-a11` inverted to a near-white wash, so a dialog *lightened*
|
|
164
|
+
* the page behind it instead of dimming it.
|
|
165
|
+
*
|
|
166
|
+
* So the backdrop is a literal, and the scrim uses Radix's own `--color-overlay`, which
|
|
167
|
+
* is what they dim their dialogs with and is dark in both.
|
|
168
|
+
*/
|
|
169
|
+
--color-backdrop: oklch(0.24 0.046 162);
|
|
170
|
+
/* Its pair. Anything written on the backdrop needs an ink that does not flip either —
|
|
171
|
+
the sign-in footer used `brand-100`, which is a pale green in light and a near-black
|
|
172
|
+
one in dark, and vanished against the field it sits on. */
|
|
173
|
+
--color-onbackdrop: rgba(255, 255, 255, 0.75);
|
|
174
|
+
--color-scrim: var(--color-overlay);
|
|
175
|
+
|
|
176
|
+
/* An alpha step, so a hairline stays a hairline over whatever surface is beneath it. */
|
|
177
|
+
--color-hairline: var(--gray-a6);
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Warning, danger and success, from Radix's own scales.
|
|
181
|
+
*
|
|
182
|
+
* A fill and an ink, because the two move in opposite directions between appearances:
|
|
183
|
+
* the fill stays a faint wash while the ink goes from nearly black to nearly white.
|
|
184
|
+
* Step 11 is Radix's "text on a tinted background", which is precisely this job — and
|
|
185
|
+
* it is what makes a pending booking legible in the dark theme without a second rule.
|
|
186
|
+
*/
|
|
187
|
+
--color-warn: var(--amber-9);
|
|
188
|
+
--color-warn-ink: var(--amber-11);
|
|
189
|
+
--color-warn-solid: var(--amber-9);
|
|
190
|
+
|
|
191
|
+
--color-danger: var(--red-9);
|
|
192
|
+
--color-danger-ink: var(--red-11);
|
|
193
|
+
--color-danger-solid: var(--red-9);
|
|
194
|
+
|
|
195
|
+
--color-good: var(--jade-9);
|
|
196
|
+
--color-good-ink: var(--jade-11);
|
|
197
|
+
|
|
198
|
+
/* Radix ships six depths; 2 is a resting panel and 4 is something floating over it. */
|
|
199
|
+
--shadow-panel: var(--shadow-2);
|
|
200
|
+
--shadow-raised: var(--shadow-4);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
html {
|
|
204
|
+
-webkit-text-size-adjust: 100%;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
body {
|
|
208
|
+
@apply antialiased;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Pins a subtree to the light appearance whatever the provider chose.
|
|
214
|
+
*
|
|
215
|
+
* Only `color-scheme` — the palette itself comes from the nested `<Theme appearance="light">`
|
|
216
|
+
* in `PublicLayout`. This is what stops the browser painting form controls and scrollbars
|
|
217
|
+
* dark inside an otherwise light page.
|
|
218
|
+
*/
|
|
219
|
+
@utility theme-light {
|
|
220
|
+
color-scheme: light;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
@utility panel {
|
|
224
|
+
/* The shared surface: a panel over the washed ground, hairline ring, soft shadow.
|
|
225
|
+
Everything card-like in the app uses this.
|
|
226
|
+
|
|
227
|
+
**Opaque, and no `backdrop-blur`.** Both were chasing the same artifact: hovering a
|
|
228
|
+
control left a lighter rectangle over the page that faded out on its own a moment later,
|
|
229
|
+
in dark mode only.
|
|
230
|
+
|
|
231
|
+
What a translucent panel costs is a blend on every repainted pixel. Chromium repaints
|
|
232
|
+
the damaged rectangle around whatever changed, and blending 85% over a dark ground does
|
|
233
|
+
not land on exactly the colour the full paint produced — so the repainted rectangle sits
|
|
234
|
+
visibly lighter until the next full paint takes it away. The blur made the same thing
|
|
235
|
+
worse by re-sampling a backdrop as well.
|
|
236
|
+
|
|
237
|
+
Neither bought anything here: this is a flat colour over a flat canvas, so the alpha
|
|
238
|
+
was a blend with nothing to reveal. */
|
|
239
|
+
@apply rounded-2xl bg-sheet shadow-panel ring-1 ring-hairline;
|
|
240
|
+
}
|