@eluan/core 0.5.1 → 0.7.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 +41 -3
- package/bin/eluan.mjs +75 -0
- package/bin/lib/check.mjs +271 -0
- package/bin/lib/skill.mjs +123 -0
- package/dist/{action-popover-D6K9aVFk.cjs → action-popover-Bt7U0g8y.cjs} +1 -1
- package/dist/{action-popover-BVJQBuky.js → action-popover-jEeycwXM.js} +2 -2
- package/dist/action-popover.cjs +1 -1
- package/dist/action-popover.js +1 -1
- package/dist/{avatar-CS5f1irF.js → avatar-C1LUOzjw.js} +1 -1
- package/dist/{avatar-Co-k8KqV.cjs → avatar-SwIO4oyt.cjs} +1 -1
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.js +1 -1
- package/dist/badge-BLInSFM-.cjs +1 -0
- package/dist/{badge-D9NYZFWH.js → badge-Bj7i1Xf5.js} +20 -18
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/{banner-CyYFLZXw.js → banner-BqEziMp4.js} +11 -12
- package/dist/banner-C8OECYHz.cjs +1 -0
- 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-BGH_YhOZ.cjs} +1 -1
- package/dist/{breadcrumb-Cm1nb9Xj.js → breadcrumb-BVXSOA4Z.js} +2 -2
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/button-BUHQOcAo.cjs +1 -0
- package/dist/{button-ANAPDrvs.js → button-fCYiYUPE.js} +69 -60
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/calendar-2s_jGUBa.cjs +76 -0
- package/dist/{calendar-BpBsomy5.js → calendar-BN9BkjO_.js} +22 -22
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card-CfSvhkGH.js +81 -0
- package/dist/card-DlP39QSZ.cjs +1 -0
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/{carousel-DuP0hvF-.js → carousel-BO6KUdP8.js} +1 -1
- package/dist/{carousel-BfL7oy_q.cjs → carousel-dypuabh8.cjs} +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/{code-block-C9u140Ob.js → code-block-CAXUOKNI.js} +10 -10
- package/dist/{code-block-_dFw7Su1.cjs → code-block-Co8uGXiG.cjs} +2 -2
- package/dist/code-block.cjs +1 -1
- package/dist/code-block.js +1 -1
- package/dist/command-C50Jkuv7.js +132 -0
- package/dist/command-DqNgPVsf.cjs +9 -0
- package/dist/command.cjs +1 -1
- package/dist/command.js +1 -1
- package/dist/components/box.d.ts +12 -0
- package/dist/components/card.d.ts +7 -2
- package/dist/components/grid.d.ts +35 -0
- package/dist/components/icon.d.ts +26 -0
- package/dist/components/input.d.ts +1 -1
- package/dist/components/layout-shared.d.ts +307 -0
- 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/table.d.ts +8 -4
- package/dist/components/tone-shared.d.ts +39 -0
- package/dist/components/typography.d.ts +22 -2
- package/dist/components/visually-hidden.d.ts +11 -0
- package/dist/{context-menu-Bd6m1RYU.js → context-menu-CTyczUjx.js} +34 -34
- package/dist/context-menu-oQ6xMN6t.cjs +1 -0
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.js +1 -1
- package/dist/{credit-card-input-CUqA9CX3.cjs → credit-card-input-C6oNQBAl.cjs} +1 -1
- package/dist/{credit-card-input-DN-8vaFj.js → credit-card-input-aYftFdRo.js} +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-DK-G61Nn.js} +3 -3
- package/dist/{date-picker-DGBsfZXx.cjs → date-picker-D_aU_P3A.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-897BvwxW.cjs} +1 -1
- package/dist/{datetime-picker-DsnHYRK-.js → datetime-picker-CECtSobs.js} +4 -4
- package/dist/datetime-picker.cjs +1 -1
- package/dist/datetime-picker.js +1 -1
- package/dist/decimal-input-B7IHYVXP.cjs +1 -0
- package/dist/decimal-input-ohejnbQg.js +177 -0
- package/dist/decimal-input.cjs +1 -1
- package/dist/decimal-input.js +1 -1
- package/dist/dialog-DIGW7qln.cjs +1 -0
- package/dist/dialog-DVhnZFqE.js +64 -0
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu-BV2rX_ow.cjs +1 -0
- package/dist/dropdown-menu-C6NPtU9J.js +115 -0
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/{email-input-pX0hlYV3.js → email-input-CRd87a_c.js} +1 -1
- package/dist/{email-input-DFI4h_KN.cjs → email-input-Dvj1xSzJ.cjs} +1 -1
- package/dist/email-input.cjs +1 -1
- package/dist/email-input.js +1 -1
- package/dist/{fieldset-5V8wx-KE.js → fieldset-BxINrO_H.js} +6 -6
- package/dist/fieldset-C6cahGeV.cjs +1 -0
- package/dist/fieldset.cjs +1 -1
- package/dist/fieldset.js +1 -1
- package/dist/file-input-BzYcnore.cjs +1 -0
- package/dist/{file-input-B_aBgxmT.js → file-input-Ch16hNA1.js} +55 -55
- package/dist/file-input.cjs +1 -1
- package/dist/file-input.js +1 -1
- package/dist/{footer-DB0_-IwN.cjs → footer-B-fRLhqP.cjs} +1 -1
- package/dist/{footer-B3KUIwXW.js → footer-BiiV6-ZD.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-CvhqGcuo.cjs +1 -0
- package/dist/{header-CDOWlOAR.js → header-DwvyTpRi.js} +22 -22
- package/dist/header.cjs +1 -1
- package/dist/header.js +1 -1
- package/dist/hover-card-BQpzaazK.js +21 -0
- package/dist/{hover-card-C5KsTSZR.cjs → hover-card-V5A1HzEu.cjs} +1 -1
- 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 +593 -516
- package/dist/input-Dtr0tlf7.cjs +1 -0
- package/dist/input-Zs45H33i.js +131 -0
- package/dist/input-otp-D-T32R3O.cjs +1 -0
- package/dist/{input-otp-DmEGB1nu.js → input-otp-DwdX6VlR.js} +33 -33
- 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/{menubar-F1_bhmku.js → menubar-CodcV4b7.js} +28 -28
- package/dist/menubar-bOYi1jKo.cjs +1 -0
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.js +1 -1
- package/dist/multi-select-ChfbxrG3.js +85 -0
- package/dist/multi-select-D573XqUT.cjs +1 -0
- package/dist/multi-select.cjs +1 -1
- package/dist/multi-select.js +1 -1
- package/dist/navigation-drawer-C7YYtBXz.js +198 -0
- package/dist/navigation-drawer-Cu2q1NMn.cjs +1 -0
- package/dist/navigation-drawer.cjs +1 -1
- package/dist/navigation-drawer.js +1 -1
- package/dist/{navigation-menu-BjA-PdMY.js → navigation-menu-BEp603xA.js} +16 -16
- package/dist/{navigation-menu-BtpLfxHN.cjs → navigation-menu-tw5cD7mL.cjs} +2 -2
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.js +1 -1
- package/dist/number-input-C1RS-p2C.js +66 -0
- package/dist/number-input-N3-IvxZT.cjs +1 -0
- package/dist/number-input.cjs +1 -1
- package/dist/number-input.js +1 -1
- package/dist/{pagination-4IuE_APs.cjs → pagination-C6e9oVes.cjs} +1 -1
- package/dist/{pagination-DTWRjiOm.js → pagination-XlaE-Plb.js} +32 -32
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.js +1 -1
- package/dist/{password-input-B9V45d3Q.js → password-input-CR6FT6Rh.js} +2 -2
- package/dist/{password-input-BwnlHPbX.cjs → password-input-CZ19HPZd.cjs} +1 -1
- package/dist/password-input.cjs +1 -1
- package/dist/password-input.js +1 -1
- package/dist/{phone-input-BQjZj5jI.cjs → phone-input-BZhkLmI6.cjs} +1 -1
- package/dist/{phone-input-CSBpGHvI.js → phone-input-CT9W87M7.js} +2 -2
- package/dist/phone-input.cjs +1 -1
- package/dist/phone-input.js +1 -1
- package/dist/popover-CE0n5BQv.cjs +1 -0
- package/dist/popover-CguR4kP7.js +70 -0
- package/dist/popover.cjs +1 -1
- package/dist/popover.js +1 -1
- package/dist/{progress-Dz_it5I-.js → progress-BpUNvswZ.js} +8 -7
- package/dist/progress-DSy_jRee.cjs +1 -0
- package/dist/progress.cjs +1 -1
- package/dist/progress.js +1 -1
- package/dist/providers/create-theme.d.ts +11 -2
- package/dist/providers/eluan-provider.d.ts +8 -6
- 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-CuAa5WkV.js} +21 -21
- package/dist/{rich-text-DerWxzdn.cjs → rich-text-p7H-0qE7.cjs} +2 -2
- 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-bFNW6oiE.js → search-input-CxKLBmii.js} +53 -53
- package/dist/{search-input-Dmmo-BEL.cjs → search-input-XmoL2YjY.cjs} +1 -1
- package/dist/search-input.cjs +1 -1
- package/dist/search-input.js +1 -1
- package/dist/select-BCDam7PR.cjs +1 -0
- package/dist/select-QgjG43ye.js +119 -0
- package/dist/select.cjs +1 -1
- package/dist/select.js +1 -1
- package/dist/sheet-BxNmBMti.cjs +1 -0
- package/dist/{sheet-D5HWF66e.js → sheet-D0hVuH9a.js} +7 -7
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +1 -1
- package/dist/slider-Cv7uIp4z.js +16 -0
- package/dist/slider-Dci7KGjg.cjs +1 -0
- 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 +1205 -189
- package/dist/switch-DQ4R-gjR.cjs +1 -0
- package/dist/switch-WaESqUuN.js +9 -0
- package/dist/switch.cjs +1 -1
- package/dist/switch.js +1 -1
- package/dist/table-YKEWGYnI.js +149 -0
- package/dist/table-zbkgP43L.cjs +1 -0
- package/dist/table.cjs +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs-BwNIi7Dl.js +22 -0
- package/dist/tabs-DItFd2o9.cjs +1 -0
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/textarea-BWAPWDRt.js +8 -0
- package/dist/textarea-CniUTipL.cjs +1 -0
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/{time-input-BPoFvoeM.js → time-input-CeJVQKWO.js} +68 -68
- package/dist/time-input-eVFFYo10.cjs +1 -0
- package/dist/time-input.cjs +1 -1
- package/dist/time-input.js +1 -1
- package/dist/{toast-BK0ulAzi.cjs → toast-84RpQJtn.cjs} +1 -1
- package/dist/{toast-hI3pdZ2X.js → toast-BGKaAZwf.js} +1 -1
- package/dist/toast.cjs +1 -1
- package/dist/toast.js +1 -1
- package/dist/{toggle-Dv1VZ5Le.js → toggle-CxHqX2-V.js} +11 -11
- package/dist/toggle-DrJJAflI.cjs +1 -0
- package/dist/toggle-group-DvoxSJMq.cjs +1 -0
- package/dist/{toggle-group-DE8BPZih.js → toggle-group-k-kiBnEe.js} +21 -21
- 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 → tooltip-1Biy6A0m.js} +3 -3
- package/dist/{tooltip-faf1dIXp.cjs → tooltip-DIerl2vz.cjs} +1 -1
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/{tree-view-CyeJR7cW.js → tree-view-Bswh2RGr.js} +37 -37
- package/dist/tree-view-DDX9QjzF.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 +12 -8
- package/skills/eluan/DESIGN.md +411 -0
- package/skills/eluan/SKILL.md +202 -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 +271 -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 +210 -0
- package/skills/eluan/components/visually-hidden.md +132 -0
- package/skills/eluan/foundations/colour.md +257 -0
- package/skills/eluan/foundations/elevation.md +86 -0
- package/skills/eluan/foundations/iconography.md +70 -0
- package/skills/eluan/foundations/look.md +135 -0
- package/skills/eluan/foundations/motion.md +60 -0
- package/skills/eluan/foundations/radius.md +73 -0
- package/skills/eluan/foundations/spacing.md +98 -0
- package/skills/eluan/foundations/theming.md +212 -0
- package/skills/eluan/foundations/typography.md +169 -0
- package/skills/eluan/patterns/app-shell.md +222 -0
- package/skills/eluan/patterns/dashboard.md +249 -0
- package/skills/eluan/patterns/empty-states.md +78 -0
- package/skills/eluan/patterns/feedback.md +95 -0
- package/skills/eluan/patterns/forms.md +138 -0
- package/skills/eluan/patterns/navigation.md +96 -0
- package/skills/eluan/patterns/page-layout.md +185 -0
- package/dist/badge-DXKWztL-.cjs +0 -1
- package/dist/banner-COlEFRuK.cjs +0 -1
- package/dist/button-Ny6OF8Un.cjs +0 -1
- package/dist/calendar-7LX5YGGT.cjs +0 -76
- package/dist/card-BC_4C3ns.js +0 -70
- package/dist/card-C88--zB4.cjs +0 -1
- package/dist/command-BCl0seLL.cjs +0 -9
- package/dist/command-Chs5VlBL.js +0 -132
- package/dist/context-menu-1WehRCpR.cjs +0 -1
- package/dist/decimal-input-BLmifKF2.cjs +0 -1
- package/dist/decimal-input-yTk35W_5.js +0 -177
- package/dist/dialog-B8eWKqzS.js +0 -64
- package/dist/dialog-DWYtFhZl.cjs +0 -1
- package/dist/dropdown-menu-_h_fqgvS.cjs +0 -1
- package/dist/dropdown-menu-p0NkOoTP.js +0 -115
- package/dist/fieldset-C3aAINhi.cjs +0 -1
- package/dist/file-input-D62FEnKg.cjs +0 -1
- package/dist/header-CiZQY_7S.cjs +0 -1
- package/dist/hover-card-C_FCzE41.js +0 -21
- package/dist/input-BrGJn-D9.cjs +0 -1
- package/dist/input-Cccufiqn.js +0 -128
- package/dist/input-otp-DcZ7wyjs.cjs +0 -1
- package/dist/menubar-CKWQEl7c.cjs +0 -1
- package/dist/multi-select-B6NBbDCW.js +0 -85
- package/dist/multi-select-kcoUbSwE.cjs +0 -1
- package/dist/navigation-drawer-BbeDYPhu.js +0 -171
- package/dist/navigation-drawer-DOOHfbY3.cjs +0 -1
- package/dist/number-input-Bc7jUsu-.cjs +0 -1
- package/dist/number-input-vICbRc2y.js +0 -66
- package/dist/popover-DPc4rRsR.js +0 -70
- package/dist/popover-Db6VOysz.cjs +0 -1
- package/dist/progress-DpQjGEyn.cjs +0 -1
- package/dist/select-1Eb3NSrR.cjs +0 -1
- package/dist/select-DDSYjKtj.js +0 -119
- package/dist/sheet-7NP1LuHy.cjs +0 -1
- package/dist/slider-CZQBAXup.js +0 -16
- package/dist/slider-DdEOapYP.cjs +0 -1
- package/dist/switch-C7EBLT5H.js +0 -9
- package/dist/switch-KzBijHMJ.cjs +0 -1
- package/dist/table-DopzfXYj.js +0 -101
- package/dist/table-xNu_KUaU.cjs +0 -1
- package/dist/tabs-C9NKBmH0.js +0 -22
- package/dist/tabs-DztJ2iVc.cjs +0 -1
- package/dist/textarea-DXUk1b_-.js +0 -8
- package/dist/textarea-Dl-daLHR.cjs +0 -1
- package/dist/time-input-DR2snTgB.cjs +0 -1
- package/dist/toggle-Bvh1v32T.cjs +0 -1
- package/dist/toggle-group-SyHMwO90.cjs +0 -1
- package/dist/tree-view-CNvEc1TT.cjs +0 -1
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Avatar
|
|
3
|
+
use_when: Showing a person or account as a small circular image with initials as the fallback, optionally with a presence dot or notification count.
|
|
4
|
+
instead_of: Media or Image for content pictures; Badge for status without a person; a plain img for profile pictures.
|
|
5
|
+
source: packages/core/src/components/avatar.tsx
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Avatar
|
|
9
|
+
|
|
10
|
+
## 1. Overview
|
|
11
|
+
|
|
12
|
+
Avatar shows a person or account as a circle. It wraps Radix Avatar: the image shows once it loads, and the fallback (usually initials) shows until then or if it fails. Optional overlays add a notification badge (AvatarBadge) or a presence dot (AvatarStatus), positioned by the AvatarWithStatus wrapper.
|
|
13
|
+
|
|
14
|
+
## 2. When to use
|
|
15
|
+
|
|
16
|
+
- Next to a person's name in lists, tables, comments and headers.
|
|
17
|
+
- As the visible part of an account menu trigger.
|
|
18
|
+
- With AvatarStatus to show presence (online, busy, away, offline).
|
|
19
|
+
- With AvatarBadge to show unread notifications for that person or account.
|
|
20
|
+
|
|
21
|
+
### When not to use
|
|
22
|
+
|
|
23
|
+
- Content images, thumbnails or illustrations → use Image from [Media](./media.md) or [AspectRatio](./aspect-ratio.md).
|
|
24
|
+
- A status label with no person attached → use [Badge](./badge.md).
|
|
25
|
+
- A logo or icon for a thing, not a person or account → use a Lucide icon; see [iconography.md](../foundations/iconography.md).
|
|
26
|
+
|
|
27
|
+
## 3. Anatomy
|
|
28
|
+
|
|
29
|
+
1. **Avatar**: the circular root (`--size-lg` square, `--radius-radius-full`, clips its content).
|
|
30
|
+
2. **AvatarImage**: the `<img>`. Shown only once it has loaded.
|
|
31
|
+
3. **AvatarFallback**: shown while the image loads or when it fails. Initials on `--container-bg-alt` in `--font-size-xs`, weight 500.
|
|
32
|
+
4. **AvatarWithStatus** (optional): an inline wrapper that positions overlays. Put Avatar, AvatarBadge and AvatarStatus inside it as siblings.
|
|
33
|
+
5. **AvatarBadge** (optional): a destructive [Badge](./badge.md) on a corner, centred on the rim. A dot with no `count`; the number (capped at `max`, shown as "99+") with one.
|
|
34
|
+
6. **AvatarStatus** (optional): a presence dot on a corner, ringed in the surface colour.
|
|
35
|
+
|
|
36
|
+
## 4. Variants
|
|
37
|
+
|
|
38
|
+
Avatar has no `variant` prop. AvatarStatus's `status` picks the dot colour:
|
|
39
|
+
|
|
40
|
+
| Status | Use for |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| `online` | The person is active now (`--positive-fg`). |
|
|
43
|
+
| `busy` | Active but not available (`--destructive-fg`). |
|
|
44
|
+
| `away` | Idle for a while (`--cautionary-bg-alt`). |
|
|
45
|
+
| `offline` | Not connected (`--container-bg-alt`). |
|
|
46
|
+
|
|
47
|
+
## 5. Sizes
|
|
48
|
+
|
|
49
|
+
Avatar has no size prop; it is always `--size-lg`, which scales with density. To change it, set `--size-lg` to another size token on a wrapper around that one Avatar only, for example `style={{ "--size-lg": "var(--size-2xl)" }}`. Nothing else should sit inside that wrapper.
|
|
50
|
+
|
|
51
|
+
## 6. States
|
|
52
|
+
|
|
53
|
+
| State | Looks like | Notes |
|
|
54
|
+
| --- | --- | --- |
|
|
55
|
+
| Loading | AvatarFallback | Set `delayMs` on AvatarFallback to avoid a flash of initials on fast connections. |
|
|
56
|
+
| Loaded | The image, cropped to the circle | |
|
|
57
|
+
| Error | AvatarFallback | Always provide one; with no fallback the circle is empty. |
|
|
58
|
+
| Status: online, busy | Saturated green or red dot | |
|
|
59
|
+
| Status: away, offline | Pale yellow dot; offline is the same colour as the fallback surface | Offline is invisible on an initials avatar and away barely reads. Show presence in text as well (for example "Away" next to the name). |
|
|
60
|
+
| Badge with count 0 | A dot | AvatarBadge only shows a number for `count` above 0; `count={0}` falls back to the dot. Don't render AvatarBadge when there's nothing unread. |
|
|
61
|
+
|
|
62
|
+
## 7. Content guidelines
|
|
63
|
+
|
|
64
|
+
- Use one or two initials in the fallback: "AM" for Alex Morgan. Use the person's own name order.
|
|
65
|
+
- Set `alt` on AvatarImage to the person's name, or `alt=""` when the name is already shown next to the avatar.
|
|
66
|
+
- Keep badge counts as numbers; let `max` cap them ("99+").
|
|
67
|
+
|
|
68
|
+
| Do | Don't |
|
|
69
|
+
| --- | --- |
|
|
70
|
+
| AM | ALEX |
|
|
71
|
+
| `alt="Alex Morgan"` | `alt="avatar"` |
|
|
72
|
+
| `alt=""` when the name is shown beside it | Repeating the name in `alt` next to a visible name |
|
|
73
|
+
|
|
74
|
+
## 8. Rules
|
|
75
|
+
|
|
76
|
+
1. Always include an AvatarFallback with initials, after AvatarImage.
|
|
77
|
+
2. Put AvatarBadge and AvatarStatus inside AvatarWithStatus, next to the Avatar, never inside it; Avatar clips its children.
|
|
78
|
+
3. Don't render AvatarBadge for a zero count.
|
|
79
|
+
4. Don't rely on the status dot alone to convey presence; say it in text nearby.
|
|
80
|
+
5. Don't build a ring, border or shadow around an avatar yourself.
|
|
81
|
+
6. Make an avatar interactive only by wrapping it in a Button (`asChild` triggers included) with an `aria-label`; Avatar itself isn't focusable. AvatarWithStatus renders a `<div>`, so put it around the Button, not inside it.
|
|
82
|
+
7. Never pass `className` or `style` to any Avatar part; they're dropped.
|
|
83
|
+
|
|
84
|
+
## 9. Dos and don'ts
|
|
85
|
+
|
|
86
|
+
**Do:** pair the image with initials.
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
<Avatar>
|
|
90
|
+
<AvatarImage src="/people/alex-morgan.jpg" alt="Alex Morgan" />
|
|
91
|
+
<AvatarFallback>AM</AvatarFallback>
|
|
92
|
+
</Avatar>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Don't:** leave the fallback out or use a bare img.
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
<img src="/people/alex-morgan.jpg" style={{ width: 36, borderRadius: "50%" }} />
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Do:** put overlays beside the Avatar, inside AvatarWithStatus.
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
<AvatarWithStatus>
|
|
105
|
+
<Avatar>
|
|
106
|
+
<AvatarFallback>SC</AvatarFallback>
|
|
107
|
+
</Avatar>
|
|
108
|
+
<AvatarStatus status="online" />
|
|
109
|
+
</AvatarWithStatus>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Don't:** put overlays inside Avatar, where they're clipped.
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
<Avatar>
|
|
116
|
+
<AvatarFallback>SC</AvatarFallback>
|
|
117
|
+
<AvatarStatus status="online" />
|
|
118
|
+
</Avatar>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## 10. Accessibility
|
|
122
|
+
|
|
123
|
+
- Role: Avatar is a plain `<span>`; AvatarImage is an `<img>`.
|
|
124
|
+
- Label: the image's `alt`, or the fallback text when the image isn't shown. AvatarStatus sets `aria-label` to the raw status ("online") on a span with no role, which most screen readers ignore; AvatarBadge has no label at all. Put presence and counts in the accessible name of the surrounding control or in visible text, for example `aria-label="Alex Morgan, 3 unread notifications"` on the trigger Button.
|
|
125
|
+
- Keyboard: none. Avatar isn't focusable; a wrapping Button provides focus and activation.
|
|
126
|
+
- Focus: the wrapping Button's outline.
|
|
127
|
+
- Contrast: handled by the theme. Don't override colours. See the status note in States.
|
|
128
|
+
|
|
129
|
+
## 11. Behaviour
|
|
130
|
+
|
|
131
|
+
- Responsive: fixed size; doesn't stretch or shrink in flex rows (`flex-shrink: 0`).
|
|
132
|
+
- Overflow and truncation: the image is cropped to a circle. Fallback text doesn't scale, so keep it to two characters.
|
|
133
|
+
- Image loading: the image swaps in once loaded. Use `onLoadingStatusChange` on AvatarImage if you need to react to failures.
|
|
134
|
+
- Groups: Eluan has no AvatarGroup. Show several avatars in a row with a `--spacing-xs` gap rather than overlapping them, since an overlap needs a ring the system has no token for.
|
|
135
|
+
- Motion: none.
|
|
136
|
+
|
|
137
|
+
## 12. API
|
|
138
|
+
|
|
139
|
+
<!-- api:start -->
|
|
140
|
+
### Avatar
|
|
141
|
+
|
|
142
|
+
| Prop | Type | Default | Description |
|
|
143
|
+
| --- | --- | --- | --- |
|
|
144
|
+
| `...props` | Radix `Avatar.Root` props (`HTMLAttributes<HTMLSpanElement>`) without `className`, `style` | | Renders the circular `<span>`. |
|
|
145
|
+
|
|
146
|
+
### AvatarImage
|
|
147
|
+
|
|
148
|
+
| Prop | Type | Default | Description |
|
|
149
|
+
| --- | --- | --- | --- |
|
|
150
|
+
| `src` | `string` | | Image URL. |
|
|
151
|
+
| `alt` | `string` | | The person's name, or `""` when it's shown beside the avatar. |
|
|
152
|
+
| `onLoadingStatusChange` | `(status: "idle" \| "loading" \| "loaded" \| "error") => void` | | Called as the image loads or fails. |
|
|
153
|
+
| `...props` | Radix `Avatar.Image` props without `className`, `style` | | Native img attributes. |
|
|
154
|
+
|
|
155
|
+
### AvatarFallback
|
|
156
|
+
|
|
157
|
+
| Prop | Type | Default | Description |
|
|
158
|
+
| --- | --- | --- | --- |
|
|
159
|
+
| `children` | `ReactNode` | | Initials. |
|
|
160
|
+
| `delayMs` | `number` | | Waits this long before showing, to avoid a flash while the image loads. |
|
|
161
|
+
| `...props` | Radix `Avatar.Fallback` props without `className`, `style` | | |
|
|
162
|
+
|
|
163
|
+
### AvatarWithStatus
|
|
164
|
+
|
|
165
|
+
| Prop | Type | Default | Description |
|
|
166
|
+
| --- | --- | --- | --- |
|
|
167
|
+
| `...props` | `HTMLAttributes<HTMLDivElement>` without `className`, `style` | | The positioning wrapper for Avatar plus overlays. |
|
|
168
|
+
|
|
169
|
+
### AvatarBadge
|
|
170
|
+
|
|
171
|
+
| Prop | Type | Default | Description |
|
|
172
|
+
| --- | --- | --- | --- |
|
|
173
|
+
| `count` | `number` | | Shows the number. Omitted or 0 shows a dot. |
|
|
174
|
+
| `max` | `number` | `99` | Counts above this show as `"{max}+"`. |
|
|
175
|
+
| `position` | `"top-right" \| "bottom-right" \| "top-left" \| "bottom-left"` | `"top-right"` | Corner the badge sits on. |
|
|
176
|
+
| `...props` | `HTMLAttributes<HTMLSpanElement>` without `className`, `style` | | Applied to the positioning span. |
|
|
177
|
+
|
|
178
|
+
### AvatarStatus
|
|
179
|
+
|
|
180
|
+
| Prop | Type | Default | Description |
|
|
181
|
+
| --- | --- | --- | --- |
|
|
182
|
+
| `status` | `"online" \| "offline" \| "busy" \| "away"` | | Required. Dot colour; also set as its `aria-label`. |
|
|
183
|
+
| `position` | `"top-right" \| "bottom-right" \| "top-left" \| "bottom-left"` | `"bottom-right"` | Corner the dot sits on. Accepts no other props and no ref. |
|
|
184
|
+
<!-- api:end -->
|
|
185
|
+
|
|
186
|
+
## 13. Examples
|
|
187
|
+
|
|
188
|
+
A team list with presence, and an account menu trigger with an unread count.
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
import {
|
|
192
|
+
Avatar,
|
|
193
|
+
AvatarBadge,
|
|
194
|
+
AvatarFallback,
|
|
195
|
+
AvatarImage,
|
|
196
|
+
AvatarStatus,
|
|
197
|
+
AvatarWithStatus,
|
|
198
|
+
Button,
|
|
199
|
+
DropdownMenu,
|
|
200
|
+
DropdownMenuContent,
|
|
201
|
+
DropdownMenuItem,
|
|
202
|
+
DropdownMenuTrigger,
|
|
203
|
+
Typography,
|
|
204
|
+
} from "@eluan/core";
|
|
205
|
+
|
|
206
|
+
const team = [
|
|
207
|
+
{ id: "1", name: "Alex Morgan", initials: "AM", role: "Design lead", photo: "/people/alex-morgan.jpg", status: "online" as const, statusLabel: "Online" },
|
|
208
|
+
{ id: "2", name: "Sarah Chen", initials: "SC", role: "Engineer", photo: "/people/sarah-chen.jpg", status: "away" as const, statusLabel: "Away" },
|
|
209
|
+
{ id: "3", name: "Marcus Lee", initials: "ML", role: "Product manager", photo: undefined, status: "offline" as const, statusLabel: "Offline" },
|
|
210
|
+
];
|
|
211
|
+
|
|
212
|
+
export function TeamList() {
|
|
213
|
+
return (
|
|
214
|
+
<ul style={{ listStyle: "none", margin: 0, padding: 0, display: "flex", flexDirection: "column", gap: "var(--spacing-md)" }}>
|
|
215
|
+
{team.map((person) => (
|
|
216
|
+
<li key={person.id} style={{ display: "flex", alignItems: "center", gap: "var(--spacing-sm)" }}>
|
|
217
|
+
<AvatarWithStatus>
|
|
218
|
+
<Avatar>
|
|
219
|
+
{person.photo && <AvatarImage src={person.photo} alt="" />}
|
|
220
|
+
<AvatarFallback delayMs={300}>{person.initials}</AvatarFallback>
|
|
221
|
+
</Avatar>
|
|
222
|
+
<AvatarStatus status={person.status} />
|
|
223
|
+
</AvatarWithStatus>
|
|
224
|
+
<div style={{ display: "flex", flexDirection: "column" }}>
|
|
225
|
+
<Typography variant="label">{person.name}</Typography>
|
|
226
|
+
<Typography variant="caption" tone="muted">
|
|
227
|
+
{person.role} · {person.statusLabel}
|
|
228
|
+
</Typography>
|
|
229
|
+
</div>
|
|
230
|
+
</li>
|
|
231
|
+
))}
|
|
232
|
+
</ul>
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export function AccountMenu({ unread }: { unread: number }) {
|
|
237
|
+
return (
|
|
238
|
+
<DropdownMenu>
|
|
239
|
+
{/* AvatarWithStatus renders a div, so it wraps the Button rather than sitting inside it. */}
|
|
240
|
+
<AvatarWithStatus>
|
|
241
|
+
<DropdownMenuTrigger asChild>
|
|
242
|
+
<Button
|
|
243
|
+
type="button"
|
|
244
|
+
variant="ghost"
|
|
245
|
+
size="iconInline"
|
|
246
|
+
shape="round"
|
|
247
|
+
aria-label={unread > 0 ? `Account menu, ${unread} unread notifications` : "Account menu"}
|
|
248
|
+
>
|
|
249
|
+
<Avatar>
|
|
250
|
+
<AvatarImage src="/people/alex-morgan.jpg" alt="" />
|
|
251
|
+
<AvatarFallback>AM</AvatarFallback>
|
|
252
|
+
</Avatar>
|
|
253
|
+
</Button>
|
|
254
|
+
</DropdownMenuTrigger>
|
|
255
|
+
{unread > 0 && <AvatarBadge count={unread} aria-hidden="true" />}
|
|
256
|
+
</AvatarWithStatus>
|
|
257
|
+
<DropdownMenuContent align="end">
|
|
258
|
+
<DropdownMenuItem>Profile</DropdownMenuItem>
|
|
259
|
+
<DropdownMenuItem>Notifications</DropdownMenuItem>
|
|
260
|
+
<DropdownMenuItem>Sign out</DropdownMenuItem>
|
|
261
|
+
</DropdownMenuContent>
|
|
262
|
+
</DropdownMenu>
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## 14. Related components
|
|
268
|
+
|
|
269
|
+
- [Badge](./badge.md): AvatarBadge renders a destructive Badge; use Badge alone for status without a person.
|
|
270
|
+
- [DropdownMenu](./dropdown-menu.md): an account menu behind an avatar trigger.
|
|
271
|
+
- [Button](./button.md): makes an avatar focusable and clickable.
|
|
272
|
+
- [Media](./media.md): content images rather than people.
|
|
273
|
+
- [Table](./table.md): avatars beside names in a user list.
|
|
274
|
+
|
|
275
|
+
## 15. Common agent mistakes
|
|
276
|
+
|
|
277
|
+
_Filled from evals._
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Badge
|
|
3
|
+
use_when: Labelling the status or category of an item, such as Active, Draft, Failed or Beta.
|
|
4
|
+
instead_of: Toast or Banner for messages; Avatar's AvatarStatus for presence; Button or Toggle for anything clickable; Progress, Spinner or Skeleton for loading.
|
|
5
|
+
source: packages/core/src/components/badge.tsx
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Badge
|
|
9
|
+
|
|
10
|
+
## 1. Overview
|
|
11
|
+
|
|
12
|
+
Badge is a small inline label for the status or category of an item. It renders a `<span>` in eight variants and two sizes: a text label (`default`) and a bare status dot (`microdot`). It can carry a remove button. Badge labels something; it isn't a message and it isn't a button.
|
|
13
|
+
|
|
14
|
+
## 2. When to use
|
|
15
|
+
|
|
16
|
+
- The status of a row, card or record: Active, Draft, Paid, Failed.
|
|
17
|
+
- A category or attribute tag: Beta, Admin, Pro.
|
|
18
|
+
- A count or "New" marker next to a label.
|
|
19
|
+
- A removable filter tag, with `onRemove`.
|
|
20
|
+
- A small status dot next to a text label, with `size="microdot"`.
|
|
21
|
+
|
|
22
|
+
### When not to use
|
|
23
|
+
|
|
24
|
+
- Telling the user something happened → use [Toast](./toast.md) or [Banner](./banner.md).
|
|
25
|
+
- Online or away status on an avatar → use [Avatar](./avatar.md) `AvatarStatus` or `AvatarWithStatus`.
|
|
26
|
+
- Picking several values in a field → use [MultiSelect](./multi-select.md).
|
|
27
|
+
- Anything clickable → use [Button](./button.md) or [Toggle](./toggle.md).
|
|
28
|
+
- Progress with a known amount → use [Progress](./progress.md).
|
|
29
|
+
- Work in progress → use [Spinner](./spinner.md); content loading into a layout → use [Skeleton](./skeleton.md).
|
|
30
|
+
- A keyboard shortcut → use [Kbd](./kbd.md).
|
|
31
|
+
|
|
32
|
+
## 3. Anatomy
|
|
33
|
+
|
|
34
|
+
1. **Container**: the `<span>`; inline-flex, `--curves-md` corners, 1px border (transparent except for `outline`).
|
|
35
|
+
2. **Label**: the text child, at `--font-size-xs`.
|
|
36
|
+
3. **Remove button** (optional): an X icon button named "Remove", shown when `removable` or `onRemove` is set.
|
|
37
|
+
|
|
38
|
+
At `size="microdot"` the container is the whole badge: a filled circle. Children and the remove button aren't rendered.
|
|
39
|
+
|
|
40
|
+
## 4. Variants
|
|
41
|
+
|
|
42
|
+
| Variant | Use for |
|
|
43
|
+
| --- | --- |
|
|
44
|
+
| `default` | High-emphasis labels in primary colours: New, a count. |
|
|
45
|
+
| `secondary` | Neutral, low-emphasis tags and categories. |
|
|
46
|
+
| `outline` | The quietest label, bordered with no fill: metadata. |
|
|
47
|
+
| `positive` | Healthy or done: Active, Paid, Passing. |
|
|
48
|
+
| `caution` | Needs attention soon: Expiring, Pending review. |
|
|
49
|
+
| `destructive` | Failed or blocked: Failed, Overdue. |
|
|
50
|
+
| `informative` | Neutral status: Scheduled, In progress. |
|
|
51
|
+
| `important` | Emphasis that isn't a warning: Beta, Pro, Featured. |
|
|
52
|
+
|
|
53
|
+
## 5. Sizes
|
|
54
|
+
|
|
55
|
+
| Size | Use in |
|
|
56
|
+
| --- | --- |
|
|
57
|
+
| `default` | Every text badge. |
|
|
58
|
+
| `microdot` | A status dot beside a text label. A circle `--spacing-sm` plus `--spacing-xxs` across, ringed in `--container-bg`. Renders no text. |
|
|
59
|
+
|
|
60
|
+
## 6. States
|
|
61
|
+
|
|
62
|
+
| State | Looks like | Notes |
|
|
63
|
+
| --- | --- | --- |
|
|
64
|
+
| Default | Variant colours | |
|
|
65
|
+
| Hover | Only the remove button changes: 60% to full opacity | |
|
|
66
|
+
| Focus | Remove button: 1px outline in `--focus-ring`, 1px offset, at full opacity | Never remove or restyle the focus ring. Don't add `tabIndex` to badges. |
|
|
67
|
+
| Microdot | Filled circle with a ring | `variant="outline"` at this size has no fill and no border, so nothing shows. Use a filled variant. |
|
|
68
|
+
|
|
69
|
+
## 7. Content guidelines
|
|
70
|
+
|
|
71
|
+
- Use one or two words that name the state or category: "Active", "Past due", "Beta".
|
|
72
|
+
- Use sentence case. Don't write in capitals.
|
|
73
|
+
- Use the same word for the same status everywhere in the product, with the same variant.
|
|
74
|
+
- Name the status in words. Colour alone doesn't tell everyone what it means.
|
|
75
|
+
|
|
76
|
+
| Do | Don't |
|
|
77
|
+
| --- | --- |
|
|
78
|
+
| Active | ● (a dot with no text) |
|
|
79
|
+
| Past due | PAST DUE!! |
|
|
80
|
+
| Draft | Not yet published to the workspace |
|
|
81
|
+
| 3 new | Click to view |
|
|
82
|
+
|
|
83
|
+
## 8. Rules
|
|
84
|
+
|
|
85
|
+
1. Use Badge to label an item. Never use it as a message or give it an `onClick`; it isn't focusable or keyboard-operable.
|
|
86
|
+
2. Say the status in words. A `microdot` must sit next to visible text that names the status.
|
|
87
|
+
3. Map each status to one variant and keep it consistent: if Failed is `destructive` in one table, it's `destructive` everywhere.
|
|
88
|
+
4. Use a filled variant with `size="microdot"`; `outline` renders nothing at that size.
|
|
89
|
+
5. Pass `onRemove` whenever a badge is removable. `removable` alone renders a remove button that does nothing.
|
|
90
|
+
6. Never pass `className` or `style`; they're dropped. Put spacing on the parent with `gap`.
|
|
91
|
+
|
|
92
|
+
## 9. Dos and don'ts
|
|
93
|
+
|
|
94
|
+
**Do:** label a record's status in words, with the matching tone.
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
<Badge variant="positive">Paid</Badge>
|
|
98
|
+
<Badge variant="destructive">Overdue</Badge>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Don't:** make a badge clickable or let colour carry the meaning.
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
<Badge onClick={() => openInvoice(id)}>View</Badge>
|
|
105
|
+
<Badge variant="positive" size="microdot" />
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Do:** pair a microdot with a visible label and hide the dot.
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
<span style={{ display: "inline-flex", alignItems: "center", gap: "var(--spacing-xs)" }}>
|
|
112
|
+
<Badge variant="positive" size="microdot" aria-hidden="true" />
|
|
113
|
+
Operational
|
|
114
|
+
</span>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Don't:** use an outline microdot; it renders nothing.
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
<Badge variant="outline" size="microdot" />
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## 10. Accessibility
|
|
124
|
+
|
|
125
|
+
- Role: none. The `<span>` text is read inline with its surroundings.
|
|
126
|
+
- Label: the children. A `microdot` has no text, so put the status in visible text next to it and mark the dot `aria-hidden="true"`.
|
|
127
|
+
- Remove button: a native `<button>` named "Remove". The name doesn't include the badge's text and can't be changed, so several removable badges all read as "Remove". Keep removable badges next to a heading or label that names the set, or use [MultiSelect](./multi-select.md) for a multi-value field.
|
|
128
|
+
- Keyboard: Tab reaches the remove button; Enter and Space activate it. Its click doesn't bubble to a parent row.
|
|
129
|
+
- Focus: the remove button currently shows no focus indicator (see States).
|
|
130
|
+
- Contrast: handled by the theme. Don't override colours.
|
|
131
|
+
|
|
132
|
+
## 11. Behaviour
|
|
133
|
+
|
|
134
|
+
- Responsive: Badge sizes to its content and sits inline with text.
|
|
135
|
+
- Overflow and truncation: Badge doesn't set `white-space`, so a long label wraps inside a narrow container. Keep labels short.
|
|
136
|
+
- Motion: colours transition over 150ms. Don't add your own.
|
|
137
|
+
- The remove button stops click propagation, so removing a badge inside a clickable row doesn't also open the row.
|
|
138
|
+
|
|
139
|
+
## 12. API
|
|
140
|
+
|
|
141
|
+
<!-- api:start -->
|
|
142
|
+
| Prop | Type | Default | Description |
|
|
143
|
+
| --- | --- | --- | --- |
|
|
144
|
+
| `variant` | `"default" \| "secondary" \| "outline" \| "positive" \| "caution" \| "destructive" \| "informative" \| "important"` | `"default"` | Visual style. |
|
|
145
|
+
| `size` | `"default" \| "microdot"` | `"default"` | `"microdot"` renders a status dot with no text. |
|
|
146
|
+
| `removable` | `boolean` | | Shows the remove button. Pair it with `onRemove`. |
|
|
147
|
+
| `onRemove` | `() => void` | | Called when the remove button is clicked. Also shows the button. |
|
|
148
|
+
| `...props` | `HTMLAttributes<HTMLSpanElement>` without `className`, `style` | | `id`, `aria-*`, `title`. Badge isn't wrapped in `forwardRef`. |
|
|
149
|
+
<!-- api:end -->
|
|
150
|
+
|
|
151
|
+
## 13. Examples
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
import { Badge } from "@eluan/core";
|
|
155
|
+
|
|
156
|
+
type InvoiceStatus = "paid" | "pending" | "overdue" | "draft";
|
|
157
|
+
|
|
158
|
+
const statusBadge: Record<InvoiceStatus, { label: string; variant: "positive" | "caution" | "destructive" | "secondary" }> = {
|
|
159
|
+
paid: { label: "Paid", variant: "positive" },
|
|
160
|
+
pending: { label: "Pending", variant: "caution" },
|
|
161
|
+
overdue: { label: "Overdue", variant: "destructive" },
|
|
162
|
+
draft: { label: "Draft", variant: "secondary" },
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export function InvoiceStatusCell({ status }: { status: InvoiceStatus }) {
|
|
166
|
+
const { label, variant } = statusBadge[status];
|
|
167
|
+
return <Badge variant={variant}>{label}</Badge>;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export function ServiceStatus({ healthy }: { healthy: boolean }) {
|
|
171
|
+
return (
|
|
172
|
+
<span style={{ display: "inline-flex", alignItems: "center", gap: "var(--spacing-xs)", color: "var(--container-fg-alt)" }}>
|
|
173
|
+
<Badge variant={healthy ? "positive" : "destructive"} size="microdot" aria-hidden="true" />
|
|
174
|
+
{healthy ? "Operational" : "Outage"}
|
|
175
|
+
</span>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## 14. Related components
|
|
181
|
+
|
|
182
|
+
- [Banner](./banner.md) and [Toast](./toast.md): messages, not labels.
|
|
183
|
+
- [Avatar](./avatar.md): `AvatarStatus` for presence on a person.
|
|
184
|
+
- [MultiSelect](./multi-select.md): removable chips inside a field.
|
|
185
|
+
- [Table](./table.md): status columns usually hold a Badge.
|
|
186
|
+
- [Progress](./progress.md), [Spinner](./spinner.md), [Skeleton](./skeleton.md): progress and loading.
|
|
187
|
+
|
|
188
|
+
## 15. Common agent mistakes
|
|
189
|
+
|
|
190
|
+
_Filled from evals._
|