@eluan/core 0.5.0 → 0.6.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 +33 -1
- package/dist/{action-popover-D6K9aVFk.cjs → action-popover-DrHKPGqw.cjs} +1 -1
- package/dist/{action-popover-BVJQBuky.js → action-popover-NkXDAHJT.js} +1 -1
- package/dist/action-popover.cjs +1 -1
- package/dist/action-popover.js +1 -1
- package/dist/{avatar-Co-k8KqV.cjs → avatar-B-t3ctR4.cjs} +1 -1
- package/dist/{avatar-CS5f1irF.js → avatar-kDEa0rjF.js} +1 -1
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.js +1 -1
- package/dist/{badge-D9NYZFWH.js → badge-BLZ8V-KC.js} +10 -10
- package/dist/{badge-DXKWztL-.cjs → badge-D1A0Tc79.cjs} +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/{banner-COlEFRuK.cjs → banner-CNdwDPqA.cjs} +1 -1
- package/dist/{banner-CyYFLZXw.js → banner-DzSp5WfQ.js} +9 -9
- package/dist/banner.cjs +1 -1
- package/dist/banner.js +1 -1
- package/dist/box-DG-tkaYi.cjs +1 -0
- package/dist/box-DKbNgGGG.js +17 -0
- package/dist/box.cjs +1 -0
- package/dist/box.d.ts +1 -0
- package/dist/box.js +5 -0
- package/dist/{breadcrumb-NWXeCH5q.cjs → breadcrumb-BuxXkm6O.cjs} +1 -1
- package/dist/{breadcrumb-Cm1nb9Xj.js → breadcrumb-C6qj-tDx.js} +1 -1
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/button--_WI-fM6.cjs +1 -0
- package/dist/{button-ANAPDrvs.js → button-DNSNShUc.js} +28 -26
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/{calendar-BpBsomy5.js → calendar-BA2tSwZD.js} +6 -6
- package/dist/{calendar-7LX5YGGT.cjs → calendar-DS5821-k.cjs} +3 -3
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.js +1 -1
- package/dist/{card-C88--zB4.cjs → card-BNdR5aDa.cjs} +1 -1
- package/dist/{card-BC_4C3ns.js → card-BSgN7WSe.js} +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/{carousel-BfL7oy_q.cjs → carousel-4AERgboz.cjs} +1 -1
- package/dist/{carousel-DuP0hvF-.js → carousel-Bb7jpzep.js} +1 -1
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.js +1 -1
- package/dist/{checkbox-Bi0Kmuut.js → checkbox-CGUTGery.js} +1 -1
- package/dist/{checkbox-M8DmWKiC.cjs → checkbox-Cq9sHU_S.cjs} +1 -1
- package/dist/{checkbox-group-KBwPhjmW.cjs → checkbox-group-DGXZ4o2-.cjs} +1 -1
- package/dist/{checkbox-group-CQMEJnhD.js → checkbox-group-Tkio3IhK.js} +1 -1
- package/dist/checkbox-group.cjs +1 -1
- package/dist/checkbox-group.js +1 -1
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/{command-BCl0seLL.cjs → command-D02vvta9.cjs} +1 -1
- package/dist/{command-Chs5VlBL.js → command-sUMAxm8S.js} +1 -1
- package/dist/command.cjs +1 -1
- package/dist/command.js +1 -1
- package/dist/components/box.d.ts +12 -0
- package/dist/components/grid.d.ts +35 -0
- package/dist/components/hover-card.d.ts +14 -2
- package/dist/components/icon.d.ts +26 -0
- package/dist/components/layout-shared.d.ts +307 -0
- package/dist/components/multi-select.d.ts +1 -1
- package/dist/components/navigation-drawer.d.ts +25 -5
- package/dist/components/row.d.ts +18 -0
- package/dist/components/stack.d.ts +14 -0
- package/dist/components/tone-shared.d.ts +39 -0
- package/dist/components/tooltip.d.ts +14 -2
- package/dist/components/typography.d.ts +22 -2
- package/dist/components/visually-hidden.d.ts +11 -0
- package/dist/{credit-card-input-DN-8vaFj.js → credit-card-input-9VPlzvDm.js} +1 -1
- package/dist/{credit-card-input-CUqA9CX3.cjs → credit-card-input-DppPJBne.cjs} +1 -1
- package/dist/credit-card-input.cjs +1 -1
- package/dist/credit-card-input.js +1 -1
- package/dist/{date-picker-ni8td8Ru.js → date-picker-M5hLx_1s.js} +2 -2
- package/dist/{date-picker-DGBsfZXx.cjs → date-picker-hE7cDg2B.cjs} +1 -1
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.js +1 -1
- package/dist/{datetime-picker-C1d63MaA.cjs → datetime-picker-BeRUPJ7s.cjs} +1 -1
- package/dist/{datetime-picker-DsnHYRK-.js → datetime-picker-CIqBZYMH.js} +3 -3
- package/dist/datetime-picker.cjs +1 -1
- package/dist/datetime-picker.js +1 -1
- package/dist/{decimal-input-yTk35W_5.js → decimal-input-Bg2BPKIr.js} +38 -38
- package/dist/decimal-input-CkTEjo2J.cjs +1 -0
- package/dist/decimal-input.cjs +1 -1
- package/dist/decimal-input.js +1 -1
- package/dist/{dialog-B8eWKqzS.js → dialog-Bsfviqvy.js} +2 -2
- package/dist/dialog-DRAoumvB.cjs +1 -0
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +1 -1
- package/dist/{email-input-DFI4h_KN.cjs → email-input-CehmtNUq.cjs} +1 -1
- package/dist/{email-input-pX0hlYV3.js → email-input-DIiY9Q3S.js} +1 -1
- package/dist/email-input.cjs +1 -1
- package/dist/email-input.js +1 -1
- package/dist/{footer-DB0_-IwN.cjs → footer-fovIsy-0.cjs} +1 -1
- package/dist/{footer-B3KUIwXW.js → footer-jWaFq3qk.js} +9 -9
- package/dist/footer.cjs +1 -1
- package/dist/footer.js +1 -1
- package/dist/grid-BDz4Xs6M.cjs +1 -0
- package/dist/grid-BX5vZjDo.js +612 -0
- package/dist/grid.cjs +1 -0
- package/dist/grid.d.ts +1 -0
- package/dist/grid.js +5 -0
- package/dist/{header-CDOWlOAR.js → header-Dnf8AnIx.js} +2 -2
- package/dist/{header-CiZQY_7S.cjs → header-DzItWqW4.cjs} +1 -1
- package/dist/header.cjs +1 -1
- package/dist/header.js +1 -1
- package/dist/hover-card-C5KsTSZR.cjs +1 -0
- package/dist/hover-card-C_FCzE41.js +21 -0
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.js +1 -1
- package/dist/icon-BmLOodCQ.cjs +1 -0
- package/dist/icon-BwDfkIdR.js +153 -0
- package/dist/icon.cjs +1 -0
- package/dist/icon.d.ts +1 -0
- package/dist/icon.js +5 -0
- package/dist/index.cjs +10 -5
- package/dist/index.d.ts +6 -0
- package/dist/index.js +612 -541
- package/dist/{input-BrGJn-D9.cjs → input-BcjL2oxv.cjs} +1 -1
- package/dist/{input-Cccufiqn.js → input-CPb9yVU5.js} +8 -8
- package/dist/input-otp-BhJ3ERrY.cjs +1 -0
- package/dist/{input-otp-DmEGB1nu.js → input-otp-CTvJztkH.js} +32 -32
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +1 -1
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/layout-shared-B_1iX4Hj.js +319 -0
- package/dist/layout-shared-CsBZcT4V.cjs +1 -0
- package/dist/multi-select-CVxkWW29.js +85 -0
- package/dist/multi-select-DBFINH3F.cjs +1 -0
- package/dist/multi-select.cjs +1 -1
- package/dist/multi-select.js +1 -1
- package/dist/navigation-drawer-BCBFtLEq.cjs +1 -0
- package/dist/navigation-drawer-BMyHXhhX.js +198 -0
- package/dist/navigation-drawer.cjs +1 -1
- package/dist/navigation-drawer.js +1 -1
- package/dist/{number-input-vICbRc2y.js → number-input-Cm9YPBOX.js} +1 -1
- package/dist/{number-input-Bc7jUsu-.cjs → number-input-Dr9MbuRV.cjs} +1 -1
- package/dist/number-input.cjs +1 -1
- package/dist/number-input.js +1 -1
- package/dist/{pagination-DTWRjiOm.js → pagination-D2tjMpVU.js} +2 -2
- package/dist/{pagination-4IuE_APs.cjs → pagination-yKmFlFMR.cjs} +1 -1
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.js +1 -1
- package/dist/{password-input-BwnlHPbX.cjs → password-input-CmHubHuU.cjs} +1 -1
- package/dist/{password-input-B9V45d3Q.js → password-input-ljwdGCO6.js} +2 -2
- package/dist/password-input.cjs +1 -1
- package/dist/password-input.js +1 -1
- package/dist/{phone-input-BQjZj5jI.cjs → phone-input-B8VksCer.cjs} +1 -1
- package/dist/{phone-input-CSBpGHvI.js → phone-input-qTL6K8rT.js} +2 -2
- package/dist/phone-input.cjs +1 -1
- package/dist/phone-input.js +1 -1
- package/dist/progress-BpdmBGaX.cjs +1 -0
- package/dist/{progress-Dz_it5I-.js → progress-ChFf9bIq.js} +1 -1
- package/dist/progress.cjs +1 -1
- package/dist/progress.js +1 -1
- package/dist/providers/create-theme.d.ts +10 -1
- package/dist/providers/eluan-provider.d.ts +2 -1
- package/dist/providers/portal-container.d.ts +1 -1
- package/dist/{radio-group-C--1neiq.cjs → radio-group-9gozRouT.cjs} +1 -1
- package/dist/{radio-group-CNMPZx_2.js → radio-group-Bs9933bk.js} +6 -6
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/{rich-text-BZSyuYSo.js → rich-text-DImwK9hN.js} +1 -1
- package/dist/{rich-text-DerWxzdn.cjs → rich-text-DzHLeG7W.cjs} +1 -1
- package/dist/rich-text.cjs +1 -1
- package/dist/rich-text.js +1 -1
- package/dist/row-BYAk7G5d.js +37 -0
- package/dist/row-Bjn-GQAC.cjs +1 -0
- package/dist/row.cjs +1 -0
- package/dist/row.d.ts +1 -0
- package/dist/row.js +5 -0
- package/dist/{search-input-Dmmo-BEL.cjs → search-input-BKTjebg7.cjs} +1 -1
- package/dist/{search-input-bFNW6oiE.js → search-input-Dgr9kT1a.js} +1 -1
- package/dist/search-input.cjs +1 -1
- package/dist/search-input.js +1 -1
- package/dist/select-Cdh991T-.cjs +1 -0
- package/dist/{select-DDSYjKtj.js → select-Dp5AJ6I-.js} +15 -15
- package/dist/select.cjs +1 -1
- package/dist/select.js +1 -1
- package/dist/sheet-CkXjinUG.cjs +1 -0
- package/dist/{sheet-D5HWF66e.js → sheet-uiyHNKEw.js} +6 -6
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +1 -1
- package/dist/{slider-CZQBAXup.js → slider-BQmbh0Nl.js} +1 -1
- package/dist/{slider-DdEOapYP.cjs → slider-DK2yk-YK.cjs} +1 -1
- package/dist/slider.cjs +1 -1
- package/dist/slider.js +1 -1
- package/dist/stack-Ck1w2iJu.cjs +1 -0
- package/dist/stack-D2btWM1t.js +27 -0
- package/dist/stack.cjs +1 -0
- package/dist/stack.d.ts +1 -0
- package/dist/stack.js +5 -0
- package/dist/{stepper-D5nDwJUz.cjs → stepper-ByYKX7qw.cjs} +1 -1
- package/dist/{stepper-BtlKiHtd.js → stepper-Copsj87A.js} +4 -4
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.js +1 -1
- package/dist/styles.css +935 -59
- package/dist/{switch-KzBijHMJ.cjs → switch-C2OPCq5Z.cjs} +1 -1
- package/dist/{switch-C7EBLT5H.js → switch-CXBWUZcq.js} +3 -3
- package/dist/switch.cjs +1 -1
- package/dist/switch.js +1 -1
- package/dist/{tabs-DztJ2iVc.cjs → tabs-D8p6Tr5i.cjs} +1 -1
- package/dist/{tabs-C9NKBmH0.js → tabs-TV4_2wi1.js} +9 -9
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/{textarea-Dl-daLHR.cjs → textarea-BnpQmE74.cjs} +1 -1
- package/dist/{textarea-DXUk1b_-.js → textarea-CJRmnazN.js} +1 -1
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/{time-input-BPoFvoeM.js → time-input-A603mEFQ.js} +38 -38
- package/dist/time-input-qxljhdEb.cjs +1 -0
- package/dist/time-input.cjs +1 -1
- package/dist/time-input.js +1 -1
- package/dist/{toggle-Dv1VZ5Le.js → toggle-Bx3q15Pu.js} +6 -6
- package/dist/{toggle-Bvh1v32T.cjs → toggle-Z3t4jPdv.cjs} +1 -1
- package/dist/{toggle-group-SyHMwO90.cjs → toggle-group-BZIW4wJp.cjs} +1 -1
- package/dist/{toggle-group-DE8BPZih.js → toggle-group-LaZmOMx_.js} +7 -7
- package/dist/toggle-group.cjs +1 -1
- package/dist/toggle-group.js +1 -1
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +1 -1
- package/dist/tooltip-DZqn4wKl.js +23 -0
- package/dist/tooltip-faf1dIXp.cjs +1 -0
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/{tree-view-CyeJR7cW.js → tree-view-DRmm6oL6.js} +23 -23
- package/dist/tree-view-DVQyRQDg.cjs +1 -0
- package/dist/tree-view.cjs +1 -1
- package/dist/tree-view.js +1 -1
- package/dist/visually-hidden-BQMRYGxP.js +14 -0
- package/dist/visually-hidden-DzxxOswl.cjs +1 -0
- package/dist/visually-hidden.cjs +1 -0
- package/dist/visually-hidden.d.ts +1 -0
- package/dist/visually-hidden.js +5 -0
- package/package.json +8 -8
- package/skills/eluan/DESIGN.md +409 -0
- package/skills/eluan/SKILL.md +166 -0
- package/skills/eluan/components/accordion.md +212 -0
- package/skills/eluan/components/action-popover.md +266 -0
- package/skills/eluan/components/aspect-ratio.md +169 -0
- package/skills/eluan/components/avatar.md +277 -0
- package/skills/eluan/components/badge.md +190 -0
- package/skills/eluan/components/banner.md +247 -0
- package/skills/eluan/components/box.md +166 -0
- package/skills/eluan/components/breadcrumb.md +240 -0
- package/skills/eluan/components/button.md +214 -0
- package/skills/eluan/components/calendar.md +192 -0
- package/skills/eluan/components/card.md +270 -0
- package/skills/eluan/components/carousel.md +274 -0
- package/skills/eluan/components/checkbox-group.md +228 -0
- package/skills/eluan/components/checkbox.md +226 -0
- package/skills/eluan/components/code-block.md +193 -0
- package/skills/eluan/components/collapsible.md +240 -0
- package/skills/eluan/components/command.md +359 -0
- package/skills/eluan/components/context-menu.md +296 -0
- package/skills/eluan/components/credit-card-input.md +217 -0
- package/skills/eluan/components/date-picker.md +255 -0
- package/skills/eluan/components/date-time-picker.md +196 -0
- package/skills/eluan/components/decimal-input.md +232 -0
- package/skills/eluan/components/dialog.md +322 -0
- package/skills/eluan/components/drawer.md +292 -0
- package/skills/eluan/components/dropdown-menu.md +450 -0
- package/skills/eluan/components/email-input.md +200 -0
- package/skills/eluan/components/fieldset.md +219 -0
- package/skills/eluan/components/file-input.md +249 -0
- package/skills/eluan/components/footer.md +290 -0
- package/skills/eluan/components/form-label.md +254 -0
- package/skills/eluan/components/grid.md +192 -0
- package/skills/eluan/components/header.md +242 -0
- package/skills/eluan/components/hover-card.md +215 -0
- package/skills/eluan/components/icon.md +161 -0
- package/skills/eluan/components/input-otp.md +227 -0
- package/skills/eluan/components/input.md +249 -0
- package/skills/eluan/components/kbd.md +216 -0
- package/skills/eluan/components/media.md +244 -0
- package/skills/eluan/components/menubar.md +300 -0
- package/skills/eluan/components/multi-select.md +221 -0
- package/skills/eluan/components/navigation-drawer.md +297 -0
- package/skills/eluan/components/navigation-menu.md +291 -0
- package/skills/eluan/components/number-input.md +190 -0
- package/skills/eluan/components/pagination.md +262 -0
- package/skills/eluan/components/password-input.md +218 -0
- package/skills/eluan/components/phone-input.md +205 -0
- package/skills/eluan/components/popover.md +250 -0
- package/skills/eluan/components/progress.md +185 -0
- package/skills/eluan/components/radio-group.md +232 -0
- package/skills/eluan/components/rich-text.md +195 -0
- package/skills/eluan/components/row.md +174 -0
- package/skills/eluan/components/scroll-area.md +203 -0
- package/skills/eluan/components/search-input.md +281 -0
- package/skills/eluan/components/segmented-control.md +201 -0
- package/skills/eluan/components/select.md +296 -0
- package/skills/eluan/components/separator.md +179 -0
- package/skills/eluan/components/sheet.md +326 -0
- package/skills/eluan/components/skeleton.md +202 -0
- package/skills/eluan/components/slider.md +195 -0
- package/skills/eluan/components/spinner.md +187 -0
- package/skills/eluan/components/stack.md +158 -0
- package/skills/eluan/components/stepper.md +236 -0
- package/skills/eluan/components/switch.md +218 -0
- package/skills/eluan/components/table.md +348 -0
- package/skills/eluan/components/tabs.md +277 -0
- package/skills/eluan/components/textarea.md +202 -0
- package/skills/eluan/components/time-input.md +181 -0
- package/skills/eluan/components/toast.md +251 -0
- package/skills/eluan/components/toggle-group.md +241 -0
- package/skills/eluan/components/toggle.md +198 -0
- package/skills/eluan/components/tooltip.md +222 -0
- package/skills/eluan/components/tree-view.md +213 -0
- package/skills/eluan/components/typography.md +207 -0
- package/skills/eluan/components/visually-hidden.md +132 -0
- package/skills/eluan/foundations/colour.md +252 -0
- package/skills/eluan/foundations/elevation.md +57 -0
- package/skills/eluan/foundations/iconography.md +70 -0
- package/skills/eluan/foundations/motion.md +60 -0
- package/skills/eluan/foundations/radius.md +61 -0
- package/skills/eluan/foundations/spacing.md +98 -0
- package/skills/eluan/foundations/theming.md +197 -0
- package/skills/eluan/foundations/typography.md +163 -0
- package/skills/eluan/patterns/empty-states.md +84 -0
- package/skills/eluan/patterns/feedback.md +95 -0
- package/skills/eluan/patterns/forms.md +138 -0
- package/skills/eluan/patterns/navigation.md +95 -0
- package/skills/eluan/patterns/page-layout.md +101 -0
- package/dist/button-Ny6OF8Un.cjs +0 -1
- package/dist/decimal-input-BLmifKF2.cjs +0 -1
- package/dist/dialog-DWYtFhZl.cjs +0 -1
- package/dist/hover-card-BN7Ew2Y1.js +0 -16
- package/dist/hover-card-Dft-08Ha.cjs +0 -1
- package/dist/input-otp-DcZ7wyjs.cjs +0 -1
- package/dist/multi-select-DPoOHWSC.js +0 -74
- package/dist/multi-select-fX5FXYEY.cjs +0 -1
- package/dist/navigation-drawer-BbeDYPhu.js +0 -171
- package/dist/navigation-drawer-DOOHfbY3.cjs +0 -1
- package/dist/progress-DpQjGEyn.cjs +0 -1
- package/dist/select-1Eb3NSrR.cjs +0 -1
- package/dist/sheet-7NP1LuHy.cjs +0 -1
- package/dist/time-input-DR2snTgB.cjs +0 -1
- package/dist/tooltip-BlCQKhUE.js +0 -18
- package/dist/tooltip-Cyu7fWYZ.cjs +0 -1
- package/dist/tree-view-CNvEc1TT.cjs +0 -1
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: theming
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Theming
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
Eluan's look comes from CSS custom properties in three layers: primitives (raw values), modes (light, dim, dark aliases) and themes (the semantic tokens components read). `EluanProvider` activates them with attributes on `<html>`:
|
|
10
|
+
|
|
11
|
+
| Attribute | Values | Set with | Controls |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `data-theme` | `minimal` or a custom theme name | `defaultTheme`, `setTheme` | every semantic colour and the font families |
|
|
14
|
+
| `data-mode` | `light`, `dim`, `dark` | `defaultMode`, `setMode` | which mode aliases the theme resolves against |
|
|
15
|
+
| `data-spacing` | `compact`, `standard`, `wide` | `defaultSpacing`, `setSpacing` | every `--spacing-*` and `--size-*`, and which type step each `--font-size-*` alias picks |
|
|
16
|
+
| `data-curves` | `sharp`, `slight`, `sweeping` | `defaultCurves`, `setCurves` | every `--curves-*` corner radius |
|
|
17
|
+
| `data-typeset` | `small`, `medium`, `large`, or absent | `defaultTypeset`, `setTypeset` | absent keeps type fluid; a value pins the type scale |
|
|
18
|
+
|
|
19
|
+
`minimal` is the only built-in theme. Brand looks are custom themes made with `createTheme()`, usually from `@eluan/theme-generator` output.
|
|
20
|
+
|
|
21
|
+
The theme generator controls colour only: one to three accent colours, the neutral tint (how much accent bleeds into the greys) and a minimum contrast ratio (default 4.5). Corner style, density and type scale are Provider axes, not generator output.
|
|
22
|
+
|
|
23
|
+
Contrast is checked when the theme is generated. The generator auto-corrects any foreground and background pair that falls below the minimum, moving the foreground the fewest steps along its own ramp that pass, and lists the corrections in its report. That's why you never override colour pairs by hand.
|
|
24
|
+
|
|
25
|
+
## Rules
|
|
26
|
+
|
|
27
|
+
1. Change the look through the theme or a Provider axis. Never restyle a single component.
|
|
28
|
+
2. Get brand colours from the theme generator. Never hand-pick hex values for semantic tokens.
|
|
29
|
+
3. Never override one token of a foreground and background pair. Regenerate the theme instead, so contrast stays checked.
|
|
30
|
+
4. Use `defaultCurves` for corner style and `defaultSpacing` for density. Don't override `--curves-*` or `--spacing-*` values.
|
|
31
|
+
5. Let `EluanProvider` own the `data-*` attributes. Never set them in your own effects.
|
|
32
|
+
6. Use `useEluanTheme()` to read or change theme, mode, spacing, curves and typeset at runtime.
|
|
33
|
+
7. Never add a second built-in theme to the library. Custom themes live in the app.
|
|
34
|
+
8. Give custom themes a unique name that starts with a letter. `minimal` is taken.
|
|
35
|
+
|
|
36
|
+
## Tokens
|
|
37
|
+
|
|
38
|
+
These are the theme-level tokens a custom theme most often changes. The full semantic colour set is in [colour.md](./colour.md).
|
|
39
|
+
|
|
40
|
+
<!-- tokens:start -->
|
|
41
|
+
| Token | Value (default theme) | Use for |
|
|
42
|
+
| --- | --- | --- |
|
|
43
|
+
| `--color-neutral-0` | `--color-mono-0` → oklch(1.0000 0.0000 0.00) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
44
|
+
| `--color-neutral-50` | `--color-mono-50` → oklch(0.9851 0.0000 0.00) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
45
|
+
| `--color-neutral-100` | `--color-mono-100` → oklch(0.9702 0.0000 0.00) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
46
|
+
| `--color-neutral-200` | `--color-mono-200` → oklch(0.9219 0.0000 0.00) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
47
|
+
| `--color-neutral-300` | `--color-mono-300` → oklch(0.8699 0.0000 0.00) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
48
|
+
| `--color-neutral-400` | `--color-mono-400` → oklch(0.7090 0.0000 0.00) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
49
|
+
| `--color-neutral-500` | `--color-mono-500` → oklch(0.5555 0.0000 0.00) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
50
|
+
| `--color-neutral-600` | `--color-mono-600` → oklch(0.4386 0.0000 0.00) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
51
|
+
| `--color-neutral-700` | `--color-mono-700` → oklch(0.3715 0.0000 0.00) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
52
|
+
| `--color-neutral-800` | `--color-mono-800` → oklch(0.2686 0.0000 0.00) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
53
|
+
| `--color-neutral-900` | `--color-mono-900` → oklch(0.2046 0.0000 0.00) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
54
|
+
| `--color-neutral-950` | `--color-mono-950` → oklch(0.1448 0.0000 0.00) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
55
|
+
| `--font-heading` | "Inter Variable" | Headings |
|
|
56
|
+
| `--font-body` | "Inter Variable" | Body text and UI |
|
|
57
|
+
| `--font-mono` | "Paper Mono" | Code and tabular figures |
|
|
58
|
+
<!-- tokens:end -->
|
|
59
|
+
|
|
60
|
+
## Generating a theme
|
|
61
|
+
|
|
62
|
+
From the CLI (writes `custom-theme.css` and `create-theme.json` for applying the theme, plus `primitives.json`, `semantic.json`, `theme.css`, `preview.html` and `report.md`, to the output directory):
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pnpm dlx @eluan/theme-generator generate --accent "#2F6F5E" --name forest --out ./src/theme
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
From code (pure colour maths, runs in Node and the browser):
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { generateTheme } from "@eluan/theme-generator";
|
|
72
|
+
|
|
73
|
+
const result = generateTheme({
|
|
74
|
+
accents: ["#2F6F5E"],
|
|
75
|
+
themeName: "forest",
|
|
76
|
+
minContrast: 4.5,
|
|
77
|
+
neutralTintRatio: 0.04,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
result.customTheme; // ready for EluanProvider's customThemes: light and dark, layered on minimal
|
|
81
|
+
result.createThemeOptions; // { tokens, modes: { dark } } for createTheme()
|
|
82
|
+
result.report; // markdown: warnings and contrast corrections
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Dark-mode colours come out brighter than light-mode ones: the generator lifts the colour ramps dark mode uses (`darkLift`, 0.08 by default) and still checks contrast for every pair. Don't brighten dark colours by hand. Dim mode is generated too: light one step deeper, with toned-down colour and greys warmed to `minimal`'s teak (`dimChroma`, `dimWarmth`). Don't tone dim down by hand either.
|
|
86
|
+
|
|
87
|
+
The accent hex is the one place a raw colour belongs: it's generator input, not a token value. Keep the generator call or its output in the app's source, next to the code that registers the theme.
|
|
88
|
+
|
|
89
|
+
## Applying and switching a theme
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
import "@eluan/core/styles.css";
|
|
93
|
+
import { EluanProvider, useEluanTheme } from "@eluan/core";
|
|
94
|
+
import { generateTheme } from "@eluan/theme-generator";
|
|
95
|
+
|
|
96
|
+
const { customTheme: forest } = generateTheme({ accents: ["#2F6F5E"], themeName: "forest", minContrast: 4.5, neutralTintRatio: 0.04 });
|
|
97
|
+
|
|
98
|
+
export function App({ children }: { children: React.ReactNode }) {
|
|
99
|
+
return (
|
|
100
|
+
<EluanProvider customThemes={[forest]} defaultTheme="forest" defaultCurves="sweeping">
|
|
101
|
+
{children}
|
|
102
|
+
</EluanProvider>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function ThemeSwitch() {
|
|
107
|
+
const { theme, setTheme } = useEluanTheme();
|
|
108
|
+
return (
|
|
109
|
+
<button type="button" onClick={() => setTheme(theme === "forest" ? "minimal" : "forest")}>
|
|
110
|
+
Switch theme
|
|
111
|
+
</button>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The Provider sets `data-theme="minimal"` plus `data-theme-custom="forest"`, injects the theme's CSS once, and applies its dark values whenever `data-mode="dark"`.
|
|
117
|
+
|
|
118
|
+
To mix generated colours with tokens of your own (fonts, say), use `createTheme`, which extends `minimal` and takes per-mode overrides under `modes`:
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
import { createTheme } from "@eluan/core";
|
|
122
|
+
import { generateTheme } from "@eluan/theme-generator";
|
|
123
|
+
|
|
124
|
+
const { createThemeOptions } = generateTheme({ accents: ["#2F6F5E"], themeName: "forest", minContrast: 4.5, neutralTintRatio: 0.04 });
|
|
125
|
+
|
|
126
|
+
export const forest = createTheme({
|
|
127
|
+
name: "forest",
|
|
128
|
+
...createThemeOptions,
|
|
129
|
+
tokens: { ...createThemeOptions.tokens, "--font-heading": '"Fraunces", serif' },
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Don't apply `result.css.theme` or `createThemeTokens` alone: the first drops `minimal`'s fonts, the second has no dark values.
|
|
134
|
+
|
|
135
|
+
Dark mode, density and corner style are separate axes:
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
const { setMode, setSpacing, setCurves } = useEluanTheme();
|
|
139
|
+
setMode("dark"); // light | dim | dark
|
|
140
|
+
setSpacing("compact"); // compact | standard | wide
|
|
141
|
+
setCurves("sharp"); // sharp | slight | sweeping
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The Provider persists these choices to `localStorage` and follows the OS colour scheme until the user picks a mode.
|
|
145
|
+
|
|
146
|
+
## Scoped themes
|
|
147
|
+
|
|
148
|
+
To theme one region, point an `EluanProvider` at that element with `target`, and pass the same element to `portalContainer` so its overlays (Dialog, Popover, Select, menus, Tooltip) render inside the scope. Without `portalContainer`, overlays mount in `document.body` and show the default theme.
|
|
149
|
+
|
|
150
|
+
## Choosing a value
|
|
151
|
+
|
|
152
|
+
| If you need… | Use |
|
|
153
|
+
| --- | --- |
|
|
154
|
+
| a brand colour | the theme generator's `customTheme`, registered with `customThemes` |
|
|
155
|
+
| rounder or sharper corners everywhere | `defaultCurves="sweeping"` or `"sharp"` |
|
|
156
|
+
| a denser or roomier UI | `defaultSpacing="compact"` or `"wide"` |
|
|
157
|
+
| a dark mode toggle | a Switch that calls `setMode` from `useEluanTheme()` |
|
|
158
|
+
| a different font | override `--font-heading` and `--font-body` in `createTheme` |
|
|
159
|
+
| one region in another theme | a scoped `EluanProvider` with `target` and `portalContainer` |
|
|
160
|
+
| one-off change to a single region | wrap it in an element with an inline token override, as a last resort |
|
|
161
|
+
|
|
162
|
+
## Dos and don'ts
|
|
163
|
+
|
|
164
|
+
**Do:** change the look at the theme level.
|
|
165
|
+
|
|
166
|
+
```tsx
|
|
167
|
+
const { customTheme: brand } = generateTheme({ accents: ["#2F6F5E"], themeName: "brand", minContrast: 4.5, neutralTintRatio: 0.04 });
|
|
168
|
+
|
|
169
|
+
<EluanProvider customThemes={[brand]} defaultTheme="brand" defaultCurves="sweeping">
|
|
170
|
+
<App />
|
|
171
|
+
</EluanProvider>;
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Don't:** restyle components one by one or hardcode a brand colour.
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
<div style={{ "--action-primary-bg": "#2F6F5E", borderRadius: 16 } as React.CSSProperties}>
|
|
178
|
+
<Button>Save</Button>
|
|
179
|
+
</div>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**Do:** toggle dark mode through the Provider.
|
|
183
|
+
|
|
184
|
+
```tsx
|
|
185
|
+
const { mode, setMode } = useEluanTheme();
|
|
186
|
+
<Switch checked={mode === "dark"} onCheckedChange={(on) => setMode(on ? "dark" : "light")} aria-label="Dark mode" />;
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Don't:** set the attribute yourself.
|
|
190
|
+
|
|
191
|
+
```tsx
|
|
192
|
+
useEffect(() => document.documentElement.setAttribute("data-mode", "dark"), []);
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Common agent mistakes
|
|
196
|
+
|
|
197
|
+
_Filled from evals._
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: typography
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Typography
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
Eluan's type scale is fluid: ten steps (`step-6` down to `step-neg3`) that interpolate with the viewport between 480px and 1024px, so text resizes with no media queries in app code. Each step has a size, a line height and a letter spacing, and they always travel together. `data-typeset` on any element pins the scale to its small, medium or large column; leave it off to stay fluid.
|
|
10
|
+
|
|
11
|
+
The `Typography` component is the front door to the scale. Its `variant` picks a step, a family, a weight and a default element in one prop:
|
|
12
|
+
|
|
13
|
+
| Variant | Step | Family | Default element |
|
|
14
|
+
| --- | --- | --- | --- |
|
|
15
|
+
| `display` | 5 | heading | `h1` |
|
|
16
|
+
| `title` | 4 | heading | `h2` |
|
|
17
|
+
| `heading` | 3 | heading | `h3` |
|
|
18
|
+
| `subheading` | 2 | heading | `h4` |
|
|
19
|
+
| `lead` | 1 | body | `p` |
|
|
20
|
+
| `body` | 0 | body | `p` |
|
|
21
|
+
| `label` | neg1 | body | `span` |
|
|
22
|
+
| `caption` | neg2 | body | `span` |
|
|
23
|
+
|
|
24
|
+
`tone` is `default`, `muted` (`--container-fg-alt`) or `inverse`; `positive` and `destructive` for status text; `interactive` and `interactive-muted` for text on a control you build; `inherit` for the parent's colour.
|
|
25
|
+
|
|
26
|
+
The `--font-size-xs` to `--font-size-5xl` aliases map onto steps and shift one step with density (compact one down, wide one up). Components use these; app text should use `Typography`.
|
|
27
|
+
|
|
28
|
+
## Rules
|
|
29
|
+
|
|
30
|
+
1. Set text with `Typography`. Pick the `variant` for the role of the text, not its size.
|
|
31
|
+
2. Use `as` to fix the heading level for the document outline; keep the variant for the look.
|
|
32
|
+
3. If you style text yourself, apply all three tokens of one step together, for example `--font-size-step-1`, `--line-height-step-1` and `--letter-spacing-step-1`.
|
|
33
|
+
4. Never write a font size, line height or letter spacing in px, rem or em.
|
|
34
|
+
5. Use `--font-heading`, `--font-body` and `--font-mono` for families. Change fonts only in the theme.
|
|
35
|
+
6. Use one `title` or `display` per page.
|
|
36
|
+
7. Don't pin `data-typeset` unless a region must not resize (for example a fixed-size canvas).
|
|
37
|
+
|
|
38
|
+
## Tokens
|
|
39
|
+
|
|
40
|
+
<!-- tokens:start -->
|
|
41
|
+
| Token | Value (default theme) | Use for |
|
|
42
|
+
| --- | --- | --- |
|
|
43
|
+
| `--font-heading` | "Inter Variable" | Headings |
|
|
44
|
+
| `--font-body` | "Inter Variable" | Body text and UI |
|
|
45
|
+
| `--font-mono` | "Paper Mono" | Code and tabular figures |
|
|
46
|
+
| `--font-size-xs` | `--font-size-step-neg2` (density shifts one step) | Density-aware type size alias |
|
|
47
|
+
| `--font-size-sm` | `--font-size-step-neg1` (density shifts one step) | Density-aware type size alias |
|
|
48
|
+
| `--font-size-base` | `--font-size-step-0` (density shifts one step) | Density-aware type size alias |
|
|
49
|
+
| `--font-size-lg` | `--font-size-step-1` (density shifts one step) | Density-aware type size alias |
|
|
50
|
+
| `--font-size-xl` | `--font-size-step-2` (density shifts one step) | Density-aware type size alias |
|
|
51
|
+
| `--font-size-2xl` | `--font-size-step-3` (density shifts one step) | Density-aware type size alias |
|
|
52
|
+
| `--font-size-3xl` | `--font-size-step-4` (density shifts one step) | Density-aware type size alias |
|
|
53
|
+
| `--font-size-4xl` | `--font-size-step-5` (density shifts one step) | Density-aware type size alias |
|
|
54
|
+
| `--font-size-5xl` | `--font-size-step-6` (density shifts one step) | Density-aware type size alias |
|
|
55
|
+
| `--line-height-xs` | `--line-height-step-neg2` (density shifts one step) | Line height for the same-named --font-size-* alias |
|
|
56
|
+
| `--line-height-sm` | `--line-height-step-neg1` (density shifts one step) | Line height for the same-named --font-size-* alias |
|
|
57
|
+
| `--line-height-base` | `--line-height-step-0` (density shifts one step) | Line height for the same-named --font-size-* alias |
|
|
58
|
+
| `--line-height-lg` | `--line-height-step-1` (density shifts one step) | Line height for the same-named --font-size-* alias |
|
|
59
|
+
| `--line-height-xl` | `--line-height-step-2` (density shifts one step) | Line height for the same-named --font-size-* alias |
|
|
60
|
+
| `--line-height-2xl` | `--line-height-step-3` (density shifts one step) | Line height for the same-named --font-size-* alias |
|
|
61
|
+
| `--line-height-3xl` | `--line-height-step-4` (density shifts one step) | Line height for the same-named --font-size-* alias |
|
|
62
|
+
| `--line-height-4xl` | `--line-height-step-5` (density shifts one step) | Line height for the same-named --font-size-* alias |
|
|
63
|
+
| `--line-height-5xl` | `--line-height-step-6` (density shifts one step) | Line height for the same-named --font-size-* alias |
|
|
64
|
+
| `--letter-spacing-xs` | `--letter-spacing-step-neg2` (density shifts one step) | Tracking for the same-named --font-size-* alias |
|
|
65
|
+
| `--letter-spacing-sm` | `--letter-spacing-step-neg1` (density shifts one step) | Tracking for the same-named --font-size-* alias |
|
|
66
|
+
| `--letter-spacing-base` | `--letter-spacing-step-0` (density shifts one step) | Tracking for the same-named --font-size-* alias |
|
|
67
|
+
| `--letter-spacing-lg` | `--letter-spacing-step-1` (density shifts one step) | Tracking for the same-named --font-size-* alias |
|
|
68
|
+
| `--letter-spacing-xl` | `--letter-spacing-step-2` (density shifts one step) | Tracking for the same-named --font-size-* alias |
|
|
69
|
+
| `--letter-spacing-2xl` | `--letter-spacing-step-3` (density shifts one step) | Tracking for the same-named --font-size-* alias |
|
|
70
|
+
| `--letter-spacing-3xl` | `--letter-spacing-step-4` (density shifts one step) | Tracking for the same-named --font-size-* alias |
|
|
71
|
+
| `--letter-spacing-4xl` | `--letter-spacing-step-5` (density shifts one step) | Tracking for the same-named --font-size-* alias |
|
|
72
|
+
| `--letter-spacing-5xl` | `--letter-spacing-step-6` (density shifts one step) | Tracking for the same-named --font-size-* alias |
|
|
73
|
+
| `--font-size-step-6` | 41.81px → 68.66px, fluid | Type step; apply with its line-height and letter-spacing |
|
|
74
|
+
| `--font-size-step-5` | 34.84px → 54.93px, fluid | Type step; apply with its line-height and letter-spacing |
|
|
75
|
+
| `--font-size-step-4` | 29.03px → 43.95px, fluid | Type step; apply with its line-height and letter-spacing |
|
|
76
|
+
| `--font-size-step-3` | 24.19px → 35.16px, fluid | Type step; apply with its line-height and letter-spacing |
|
|
77
|
+
| `--font-size-step-2` | 20.16px → 28.13px, fluid | Type step; apply with its line-height and letter-spacing |
|
|
78
|
+
| `--font-size-step-1` | 16.8px → 22.5px, fluid | Type step; apply with its line-height and letter-spacing |
|
|
79
|
+
| `--font-size-step-0` | 14px → 18px, fluid | Type step; apply with its line-height and letter-spacing |
|
|
80
|
+
| `--font-size-step-neg1` | 11.67px → 14.4px, fluid | Type step; apply with its line-height and letter-spacing |
|
|
81
|
+
| `--font-size-step-neg2` | 9.72px → 11.52px, fluid | Type step; apply with its line-height and letter-spacing |
|
|
82
|
+
| `--font-size-step-neg3` | 8.1px → 9.22px, fluid | Type step; apply with its line-height and letter-spacing |
|
|
83
|
+
| `--line-height-step-6` | 1.2 | Line height paired with the same step |
|
|
84
|
+
| `--line-height-step-5` | 1.2 | Line height paired with the same step |
|
|
85
|
+
| `--line-height-step-4` | 1.2 | Line height paired with the same step |
|
|
86
|
+
| `--line-height-step-3` | 1.2 | Line height paired with the same step |
|
|
87
|
+
| `--line-height-step-2` | 1.375 | Line height paired with the same step |
|
|
88
|
+
| `--line-height-step-1` | 1.375 | Line height paired with the same step |
|
|
89
|
+
| `--line-height-step-0` | 1.5 | Line height paired with the same step |
|
|
90
|
+
| `--line-height-step-neg1` | 1.5 | Line height paired with the same step |
|
|
91
|
+
| `--line-height-step-neg2` | 1.5 | Line height paired with the same step |
|
|
92
|
+
| `--line-height-step-neg3` | 1.5 | Line height paired with the same step |
|
|
93
|
+
| `--letter-spacing-step-6` | -0.03em | Tracking paired with the same step |
|
|
94
|
+
| `--letter-spacing-step-5` | -0.025em | Tracking paired with the same step |
|
|
95
|
+
| `--letter-spacing-step-4` | -0.02em | Tracking paired with the same step |
|
|
96
|
+
| `--letter-spacing-step-3` | -0.015em | Tracking paired with the same step |
|
|
97
|
+
| `--letter-spacing-step-2` | -0.01em | Tracking paired with the same step |
|
|
98
|
+
| `--letter-spacing-step-1` | 0em | Tracking paired with the same step |
|
|
99
|
+
| `--letter-spacing-step-0` | 0em | Tracking paired with the same step |
|
|
100
|
+
| `--letter-spacing-step-neg1` | 0em | Tracking paired with the same step |
|
|
101
|
+
| `--letter-spacing-step-neg2` | 0em | Tracking paired with the same step |
|
|
102
|
+
| `--letter-spacing-step-neg3` | 0em | Tracking paired with the same step |
|
|
103
|
+
<!-- tokens:end -->
|
|
104
|
+
|
|
105
|
+
## Choosing a value
|
|
106
|
+
|
|
107
|
+
| If you need… | Use |
|
|
108
|
+
| --- | --- |
|
|
109
|
+
| a page title | `<Typography variant="title" as="h1">` |
|
|
110
|
+
| a section heading | `<Typography variant="heading" as="h2">` |
|
|
111
|
+
| a card or group heading | `<Typography variant="subheading" as="h3">`, or CardTitle inside a Card |
|
|
112
|
+
| an intro paragraph | `<Typography variant="lead">` |
|
|
113
|
+
| body copy | `<Typography variant="body">` |
|
|
114
|
+
| helper or meta text | `<Typography variant="caption" tone="muted">` |
|
|
115
|
+
| a form label | Label (from `components/form-label.md`), not Typography |
|
|
116
|
+
| code | CodeBlock or Kbd; `--font-mono` if composing |
|
|
117
|
+
|
|
118
|
+
## Dos and don'ts
|
|
119
|
+
|
|
120
|
+
**Do:** pick variants by role.
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
import { Typography } from "@eluan/core";
|
|
124
|
+
|
|
125
|
+
export function SettingsHeading() {
|
|
126
|
+
return (
|
|
127
|
+
<>
|
|
128
|
+
<Typography variant="title" as="h1">Account settings</Typography>
|
|
129
|
+
<Typography variant="lead">Manage your profile, notifications and billing.</Typography>
|
|
130
|
+
</>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Don't:** size text by hand.
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
<h1 style={{ fontSize: "32px", lineHeight: 1.1 }}>Account settings</h1>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Do:** keep a step's three tokens together when you must compose.
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
<span
|
|
145
|
+
style={{
|
|
146
|
+
fontSize: "var(--font-size-step-neg1)",
|
|
147
|
+
lineHeight: "var(--line-height-step-neg1)",
|
|
148
|
+
letterSpacing: "var(--letter-spacing-step-neg1)",
|
|
149
|
+
}}
|
|
150
|
+
>
|
|
151
|
+
3 items
|
|
152
|
+
</span>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Don't:** mix a step's size with another step's line height.
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
<span style={{ fontSize: "var(--font-size-step-3)", lineHeight: "var(--line-height-step-0)" }}>3 items</span>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Common agent mistakes
|
|
162
|
+
|
|
163
|
+
_Filled from evals._
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: empty-states
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Empty states
|
|
6
|
+
|
|
7
|
+
## When this applies
|
|
8
|
+
|
|
9
|
+
A view has nothing to show: no projects yet, no search results, a cleared inbox, a filter that matches nothing. The router sends "Show that there's nothing yet" here.
|
|
10
|
+
|
|
11
|
+
Eluan has no EmptyState component. Compose one from Typography, an optional Lucide icon and one Button, and mark it `// eluan: composed, no component for empty state`.
|
|
12
|
+
|
|
13
|
+
## Choosing components
|
|
14
|
+
|
|
15
|
+
| Situation | Use | Not |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| First use: nothing created yet | heading, one line of explanation, one primary [Button](../components/button.md) that creates the first item | an empty Table with headers |
|
|
18
|
+
| No results for a search or filter | heading, a line naming the query, an `outline` Button to clear filters | a Toast saying "No results" |
|
|
19
|
+
| Everything done (cleared inbox) | heading and one line; no action needed | a primary Button with nothing to do |
|
|
20
|
+
| Still loading | [Skeleton](../components/skeleton.md), not an empty state | "No items" flashing before data arrives |
|
|
21
|
+
| Failed to load | [Banner](../components/banner.md) `variant="destructive"` with a retry action | an empty state that hides the error |
|
|
22
|
+
|
|
23
|
+
## Structure
|
|
24
|
+
|
|
25
|
+
A centred column inside the area that would hold the content:
|
|
26
|
+
|
|
27
|
+
1. Optional icon, decorative, `aria-hidden="true"`, sized `--size-md`, coloured `--container-fg-alt`.
|
|
28
|
+
2. Heading: `Typography variant="subheading"` with the right heading level for the page.
|
|
29
|
+
3. One line of body text: `Typography variant="body" tone="muted"`.
|
|
30
|
+
4. One action, or none.
|
|
31
|
+
|
|
32
|
+
Gap between parts `--spacing-sm`, and `--spacing-lg` before the action. Pad the region with `--spacing-3xl` so it doesn't hug the edges.
|
|
33
|
+
|
|
34
|
+
## Rules
|
|
35
|
+
|
|
36
|
+
1. Say what's missing and what to do next, in plain words: "No projects yet", "Create a project to get started."
|
|
37
|
+
2. Offer one action at most. Make it primary only on first use; use `outline` for "Clear filters".
|
|
38
|
+
3. Keep the empty state inside the region it replaces, so the page's header and navigation stay.
|
|
39
|
+
4. Don't use an empty state while data is loading; show Skeleton.
|
|
40
|
+
5. Don't add illustrations, colours or fonts that aren't in the theme. A Lucide icon is enough.
|
|
41
|
+
|
|
42
|
+
## Example
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
// eluan: composed, no component for empty state
|
|
46
|
+
import { Button, Typography } from "@eluan/core";
|
|
47
|
+
import { FolderPlus } from "lucide-react";
|
|
48
|
+
|
|
49
|
+
export function ProjectsEmptyState({ onCreate }: { onCreate: () => void }) {
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
style={{
|
|
53
|
+
display: "flex",
|
|
54
|
+
flexDirection: "column",
|
|
55
|
+
alignItems: "center",
|
|
56
|
+
textAlign: "center",
|
|
57
|
+
gap: "var(--spacing-sm)",
|
|
58
|
+
padding: "var(--spacing-3xl)",
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
<FolderPlus aria-hidden="true" style={{ width: "var(--size-md)", height: "var(--size-md)", color: "var(--container-fg-alt)" }} />
|
|
62
|
+
<Typography variant="subheading" as="h2">No projects yet</Typography>
|
|
63
|
+
<Typography variant="body" tone="muted">Create a project to start tracking work.</Typography>
|
|
64
|
+
<div style={{ marginTop: "var(--spacing-lg)" }}>
|
|
65
|
+
<Button type="button" onClick={onCreate}>Create project</Button>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Dos and don'ts
|
|
73
|
+
|
|
74
|
+
**Do:** give a first-use empty state one clear primary action.
|
|
75
|
+
|
|
76
|
+
**Don't:** offer three buttons ("Import", "Create", "Learn more") of equal weight.
|
|
77
|
+
|
|
78
|
+
**Do:** show Skeleton while loading, then the empty state only if the result is empty.
|
|
79
|
+
|
|
80
|
+
**Don't:** render an empty Table with column headers and no rows.
|
|
81
|
+
|
|
82
|
+
## Common agent mistakes
|
|
83
|
+
|
|
84
|
+
_Filled from evals._
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: feedback
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Feedback
|
|
6
|
+
|
|
7
|
+
## When this applies
|
|
8
|
+
|
|
9
|
+
Telling the user that something happened, is happening, or needs their attention: a save succeeded, a request failed, a trial is ending, a page is loading. The router sends "Tell the user something happened" here.
|
|
10
|
+
|
|
11
|
+
## Choosing components
|
|
12
|
+
|
|
13
|
+
| Situation | Use | Not |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| An action succeeded and the result may not be visible (settings saved, invite sent) | [Toast](../components/toast.md) via `toast()` from `sonner` | Banner: stays on screen after it stops being news |
|
|
16
|
+
| A field is invalid | FormMessage from [form-label.md](../components/form-label.md), under the field | Toast or Banner: not tied to the field |
|
|
17
|
+
| The whole form failed (server rejected it) | [Banner](../components/banner.md) `variant="destructive"` `position="inline"` `role="alert"`, at the top of the form | Toast: disappears before the user can act |
|
|
18
|
+
| Something persistent about the account or page (trial ends in 3 days, maintenance tonight) | Banner `position="top"` with `variant="caution"` or `"informative"` and `role="status"` | Toast: transient; Dialog: blocks for no reason |
|
|
19
|
+
| A blocking problem the user must resolve before continuing | Banner `variant="destructive"` with an `action` Button | Toast |
|
|
20
|
+
| The user must decide before an irreversible action | [Dialog](../components/dialog.md) | a Banner or Toast asking for confirmation |
|
|
21
|
+
| Status of an item (Active, Draft, Failed) | [Badge](../components/badge.md) | Banner: it isn't a message |
|
|
22
|
+
| Work in progress, short and in place | [Spinner](../components/spinner.md) | a custom animation |
|
|
23
|
+
| Content loading into a known layout | [Skeleton](../components/skeleton.md) | Spinner in the middle of an empty page |
|
|
24
|
+
| Progress with a known amount | [Progress](../components/progress.md) | Spinner |
|
|
25
|
+
| Progress through a multi-step flow | [Stepper](../components/stepper.md) | Progress |
|
|
26
|
+
|
|
27
|
+
Eluan has no Alert component: inline Banner fills that role.
|
|
28
|
+
|
|
29
|
+
## Structure
|
|
30
|
+
|
|
31
|
+
- Toasts appear wherever the single `<Toast />` toaster is mounted; mount it once near the app root, inside `EluanProvider`.
|
|
32
|
+
- Inline Banners go at the top of the region they describe: the top of a form, or the top of a section.
|
|
33
|
+
- Page Banners (`position="top"`) go above the page header, full width.
|
|
34
|
+
- Field messages go directly under their control, inside the field stack.
|
|
35
|
+
|
|
36
|
+
## Rules
|
|
37
|
+
|
|
38
|
+
1. Use a Toast only for transient, non-blocking confirmation. Never for errors the user must act on.
|
|
39
|
+
2. Keep toast copy to a short past-tense headline ("Settings saved"), with an optional one-line `description`.
|
|
40
|
+
3. Use an inline Banner for a form-level error and a top Banner for an account- or page-level notice.
|
|
41
|
+
4. Set the Banner role yourself: `role="alert"` for errors and blocking messages, `role="status"` for everything else. Banner defaults to `role="banner"`, a page landmark, which is wrong for a message.
|
|
42
|
+
5. Match the Banner `variant` to the meaning: `destructive` errors, `caution` warnings, `positive` success, `informative` and `neutral` information.
|
|
43
|
+
6. If a Banner is `dismissible`, handle `onDismiss` and stop rendering it; the built-in button only calls your handler.
|
|
44
|
+
7. Never show the same message in two places (a Toast and a Banner for one event).
|
|
45
|
+
8. Install `sonner` as a direct dependency to call `toast()`. `@eluan/core` styles the toaster but doesn't re-export `toast()`.
|
|
46
|
+
9. Mount `<Toast />` once, with no `className`, `style` or `toastOptions`; those replace Eluan's toast styling.
|
|
47
|
+
|
|
48
|
+
## Example
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
import { Banner, Button, Toast } from "@eluan/core";
|
|
52
|
+
import { toast } from "sonner";
|
|
53
|
+
|
|
54
|
+
// Once, near the root:
|
|
55
|
+
export function AppShell({ children }: { children: React.ReactNode }) {
|
|
56
|
+
return (
|
|
57
|
+
<>
|
|
58
|
+
<Banner variant="caution" position="top" role="status" action={<Button size="sm" variant="outline">Upgrade</Button>}>
|
|
59
|
+
Your trial ends in 3 days.
|
|
60
|
+
</Banner>
|
|
61
|
+
{children}
|
|
62
|
+
<Toast />
|
|
63
|
+
</>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Anywhere:
|
|
68
|
+
export function SaveSettingsButton({ save }: { save: () => Promise<void> }) {
|
|
69
|
+
return (
|
|
70
|
+
<Button
|
|
71
|
+
type="button"
|
|
72
|
+
onClick={async () => {
|
|
73
|
+
await save();
|
|
74
|
+
toast("Settings saved");
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
Save changes
|
|
78
|
+
</Button>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Dos and don'ts
|
|
84
|
+
|
|
85
|
+
**Do:** confirm a successful save with a short Toast.
|
|
86
|
+
|
|
87
|
+
**Don't:** use a Toast for a failed save the user has to fix; use an inline destructive Banner with `role="alert"`.
|
|
88
|
+
|
|
89
|
+
**Do:** put persistent account notices in a top Banner.
|
|
90
|
+
|
|
91
|
+
**Don't:** open a Dialog to deliver information that needs no decision.
|
|
92
|
+
|
|
93
|
+
## Common agent mistakes
|
|
94
|
+
|
|
95
|
+
_Filled from evals._
|