@nextlyhq/ui 0.0.2-alpha.42 → 0.0.2-alpha.44
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/index.cjs +82 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -15
- package/dist/index.d.ts +26 -15
- package/dist/index.mjs +82 -46
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.scoped.css +1 -1
- package/dist/theme.css +137 -33
- package/docs/plugin-ui-authoring.md +55 -5
- package/package.json +4 -4
|
@@ -79,14 +79,62 @@ Colors: `--nx-background` / `--nx-foreground`, `--nx-card` / `--nx-card-foregrou
|
|
|
79
79
|
`--nx-border`, `--nx-border-strong`, `--nx-input`, `--nx-ring`,
|
|
80
80
|
`--nx-sidebar-background` and the `--nx-sidebar-*` family.
|
|
81
81
|
|
|
82
|
-
Sizing: `--radius` (the
|
|
83
|
-
|
|
84
|
-
`--nx-control-height-
|
|
85
|
-
line up with admin inputs and buttons.
|
|
82
|
+
Sizing: `--radius` (see the radius tiers below), and the control-height scale
|
|
83
|
+
`--nx-control-height`, `--nx-control-height-sm`, `--nx-control-height-md`,
|
|
84
|
+
`--nx-control-height-lg` for anything that should line up with admin inputs and buttons.
|
|
86
85
|
|
|
87
86
|
Do not hardcode hex, `rgb()`, `rgba()`, or named colors. The only literals allowed are
|
|
88
87
|
`transparent`, `currentColor`, and `inherit`.
|
|
89
88
|
|
|
89
|
+
### Corner radius: pick a tier, never a value
|
|
90
|
+
|
|
91
|
+
The admin ships square today (`--radius: 0`), but the whole scale derives from that one
|
|
92
|
+
knob, so an operator who sets `--radius: 12px` re-rounds every surface at once. Your plugin
|
|
93
|
+
keeps up with that only if it picks a **tier by element category** rather than writing a
|
|
94
|
+
length. Hardcoding a corner — `rounded-none` just as much as `rounded-[6px]` or
|
|
95
|
+
`border-radius: 4px` — pins your UI at that value and opts it out of the knob.
|
|
96
|
+
|
|
97
|
+
The scale is three steps. These are exactly what `@nextlyhq/ui/tailwind-preset` exports, and
|
|
98
|
+
exactly what the shipped components use, so matching a Nextly component means picking the
|
|
99
|
+
tier it picks.
|
|
100
|
+
|
|
101
|
+
| Tier | Use for |
|
|
102
|
+
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
103
|
+
| `rounded-lg` / `--radius-lg` | Floating and grouping containers: cards, dialogs, alert dialogs, popovers, tooltips, dropdown / select / command panels, empty-state panels |
|
|
104
|
+
| `rounded-md` / `--radius-md` | Controls and the inline surfaces among them: buttons, inputs, textareas, select triggers, icon buttons, alerts, table wrappers, image frames |
|
|
105
|
+
| `rounded-sm` / `--radius-sm` | Small controls and adornments: menu and list items, badges, chips, tags, checkboxes, toolbar affordances |
|
|
106
|
+
| `rounded-full` | Circles and pills, outside the scale — avatars, status dots, spinners, progress tracks, switch tracks and thumbs |
|
|
107
|
+
|
|
108
|
+
Four consequences worth internalising:
|
|
109
|
+
|
|
110
|
+
- **`rounded-full` is deliberately outside the scale.** It is `9999px`, not a `--radius`
|
|
111
|
+
step. Those elements are round because of their shape, not because of the theme, so a
|
|
112
|
+
retheme must never flatten them.
|
|
113
|
+
- **`rounded-xl` and `rounded-2xl` are not tiers of this knob.** The preset exports only
|
|
114
|
+
`lg`, `md` and `sm`, so a plugin built against it gets Tailwind's fixed `0.75rem` /
|
|
115
|
+
`1rem` for those two, detached from `--radius`. Inside the admin's own build they are
|
|
116
|
+
defined, but as `--radius + 4px` and `--radius + 8px`, so at the shipped `--radius: 0`
|
|
117
|
+
they resolve to `4px` and `8px` — visibly round inside a square admin. Pick from
|
|
118
|
+
`sm` / `md` / `lg`.
|
|
119
|
+
- **`--radius: 0` is not "every step is zero".** `--radius-lg` is `0`, but `--radius-sm`
|
|
120
|
+
and `--radius-md` compute to `-4px` and `-2px`. They _render_ square only because
|
|
121
|
+
`border-radius` clamps a negative length to `0`. The token keeps its negative value, so
|
|
122
|
+
reading a step for padding, for an inset, or through `getComputedStyle` gives you `-4px`,
|
|
123
|
+
not `0`. Clamp it yourself if you consume a step as a length rather than as a corner.
|
|
124
|
+
- **A rounded container must handle full-bleed children.** If a child paints a background
|
|
125
|
+
all the way to the container's edge (a tinted footer, a sticky header, a hover row), give
|
|
126
|
+
the container `overflow-hidden` or give the child a matching corner with
|
|
127
|
+
`rounded-b-[inherit]` / `rounded-t-[inherit]`. Otherwise the child's fill paints square
|
|
128
|
+
across the parent's curve at any nonzero `--radius`.
|
|
129
|
+
|
|
130
|
+
If a specific element genuinely must stay square, keep `rounded-none` and leave a comment
|
|
131
|
+
saying why (overlapped-border strips, full-bleed fills inside an already-rounded parent,
|
|
132
|
+
underline tabs). Square with a stated reason is a decision; square without one is an element
|
|
133
|
+
nobody wired to the knob. Tabs are square for exactly that reason — the active state is a
|
|
134
|
+
bottom border that has to run the full width of the trigger — which is why they are not in
|
|
135
|
+
the `rounded-sm` tier above. Sheet is the counter-example: it is anchored to the viewport
|
|
136
|
+
edge and carries no radius class at all.
|
|
137
|
+
|
|
90
138
|
---
|
|
91
139
|
|
|
92
140
|
## 3. Prefer components and utilities over hand-rolled CSS
|
|
@@ -169,7 +217,9 @@ allowlist in the script with a one-line reason — don't silence the whole check
|
|
|
169
217
|
|
|
170
218
|
- [ ] Colors come from `var(--token)` — no `hsl()`/`rgb()` wrappers, no hardcoded values.
|
|
171
219
|
- [ ] Alpha uses `color-mix(in srgb, var(--token) N%, transparent)`.
|
|
172
|
-
- [ ] Corner radius
|
|
220
|
+
- [ ] Corner radius picks a tier (`rounded-lg`/`md`/`sm`), never a hardcoded value; circles
|
|
221
|
+
use `rounded-full`; any `rounded-none` carries a reason; rounded containers clip or
|
|
222
|
+
match their full-bleed children. Control heights use `--nx-control-height*`.
|
|
173
223
|
- [ ] New UI uses `@nextlyhq/ui` components + Tailwind utilities where practical.
|
|
174
224
|
- [ ] No `@media (prefers-color-scheme)`; dark mode inherited from the admin.
|
|
175
225
|
- [ ] Class names are prefixed/scoped; no bare element selectors.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextlyhq/ui",
|
|
3
|
-
"version": "0.0.2-alpha.
|
|
3
|
+
"version": "0.0.2-alpha.44",
|
|
4
4
|
"description": "Nextly UI — Reusable React component library for Nextly plugins and custom admin UIs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
"typescript": "^5.9.3",
|
|
87
87
|
"vite-tsconfig-paths": "^5.1.4",
|
|
88
88
|
"vitest": "^4.1.0",
|
|
89
|
-
"@nextlyhq/
|
|
90
|
-
"@nextlyhq/
|
|
91
|
-
"@nextlyhq/tsconfig": "0.0.2-alpha.
|
|
89
|
+
"@nextlyhq/eslint-config": "0.0.2-alpha.44",
|
|
90
|
+
"@nextlyhq/admin-css": "0.0.2-alpha.44",
|
|
91
|
+
"@nextlyhq/tsconfig": "0.0.2-alpha.44"
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
94
|
"@radix-ui/react-accordion": "^1.2.12",
|