@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,322 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Dialog
|
|
3
|
+
use_when: The user must confirm or finish one short task before going back to the page, including destructive confirmations.
|
|
4
|
+
instead_of: Sheet for long or form-heavy secondary content; Popover for a small non-blocking panel; Toast or Banner to report an outcome; never window.confirm or a custom modal.
|
|
5
|
+
source: packages/core/src/components/dialog.tsx
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Dialog
|
|
9
|
+
|
|
10
|
+
## 1. Overview
|
|
11
|
+
|
|
12
|
+
Dialog is a modal window built on Radix Dialog. `DialogContent` portals a centred panel and a scrim over the page, traps focus inside, and returns focus to the trigger when it closes. Eluan has no AlertDialog: a confirmation, destructive or not, is a Dialog with the right Button in its footer.
|
|
13
|
+
|
|
14
|
+
## 2. When to use
|
|
15
|
+
|
|
16
|
+
- Confirming a destructive or irreversible action: delete a project, remove a teammate, revoke a key.
|
|
17
|
+
- A short, focused task the user must finish or cancel before continuing: rename, invite one person.
|
|
18
|
+
- Warning about unsaved changes before the user leaves.
|
|
19
|
+
- A command palette, through [Command](./command.md)'s `CommandDialog` (which renders `DialogContent layout="command"` for you).
|
|
20
|
+
|
|
21
|
+
### When not to use
|
|
22
|
+
|
|
23
|
+
- Long forms, record details or filters that need room → use [Sheet](./sheet.md).
|
|
24
|
+
- A side panel the user keeps open while working → use [Drawer](./drawer.md).
|
|
25
|
+
- A small panel anchored to a control that doesn't block the page → use [Popover](./popover.md).
|
|
26
|
+
- Telling the user something happened → use [Toast](./toast.md) for a transient confirmation, [Banner](./banner.md) for a persistent message. See `../patterns/feedback.md`.
|
|
27
|
+
- Offering a list of actions → use [DropdownMenu](./dropdown-menu.md) or [ActionPopover](./action-popover.md).
|
|
28
|
+
- Revealing more content in the page flow → use [Collapsible](./collapsible.md) or [Accordion](./accordion.md).
|
|
29
|
+
|
|
30
|
+
### Choosing a confirmation pattern
|
|
31
|
+
|
|
32
|
+
| Situation | Use |
|
|
33
|
+
| --- | --- |
|
|
34
|
+
| Destructive or irreversible: delete, remove, revoke | Dialog. Title asks the question, description states the consequence, footer has Cancel and a `destructive` Button that repeats the verb. |
|
|
35
|
+
| Consequential but reversible: publish, send to 40 people | Dialog with a `default` (primary) confirm Button. |
|
|
36
|
+
| Low risk and easy to undo: archive, remove from a list | No Dialog. Run the action, then show a [Toast](./toast.md) with an Undo action. |
|
|
37
|
+
| Leaving with unsaved changes | Dialog: "Discard changes?" with Keep editing and a `destructive` Discard. |
|
|
38
|
+
|
|
39
|
+
## 3. Anatomy
|
|
40
|
+
|
|
41
|
+
1. **Dialog**: the root. Holds open state; renders nothing itself.
|
|
42
|
+
2. **DialogTrigger**: the control that opens the dialog. Wrap a Button with `asChild`. Focus returns here on close.
|
|
43
|
+
3. **DialogContent**: the panel. Renders the portal, the overlay (scrim in `--overlay-bg` at 80% opacity) and the panel (`--container-bg`, `--container-border`, `--curves-lg` corners, `--spacing-lg` padding, `--spacing-md` gap between children). Adds a close button (X icon, "Close" for screen readers) in the top-right corner, after your content in the DOM.
|
|
44
|
+
4. **DialogHeader**: a column holding the title and description, `--spacing-xs` apart.
|
|
45
|
+
5. **DialogTitle**: required. Renders an `h2` and names the dialog.
|
|
46
|
+
6. **DialogDescription**: a `p` in `--font-size-sm` that describes the dialog to screen readers.
|
|
47
|
+
7. **Body** (optional): your own content between header and footer.
|
|
48
|
+
8. **DialogFooter**: the button row.
|
|
49
|
+
9. **DialogClose**: closes the dialog. Wrap the Cancel Button with `asChild`.
|
|
50
|
+
10. **DialogOverlay**, **DialogPortal**: exported, but DialogContent already renders both. Don't add them yourself.
|
|
51
|
+
|
|
52
|
+
## 4. Variants
|
|
53
|
+
|
|
54
|
+
No `variant` prop. `layout` on DialogContent changes the panel:
|
|
55
|
+
|
|
56
|
+
| Layout | Use for |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| `default` | Every confirmation and task dialog. |
|
|
59
|
+
| `command` | Command palettes only: removes the padding and the close button. Use [Command](./command.md)'s `CommandDialog` rather than setting this yourself. |
|
|
60
|
+
|
|
61
|
+
## 5. Sizes
|
|
62
|
+
|
|
63
|
+
No size prop. The panel is the full viewport width minus `--spacing-2xl`, up to 32rem. If the content needs more room, use [Sheet](./sheet.md).
|
|
64
|
+
|
|
65
|
+
## 6. States
|
|
66
|
+
|
|
67
|
+
| State | Looks like | Notes |
|
|
68
|
+
| --- | --- | --- |
|
|
69
|
+
| Closed | Only the trigger renders | DialogContent is unmounted. |
|
|
70
|
+
| Open | Scrim over the page, panel centred | The page behind is inert: hidden from screen readers, not clickable, not scrollable. |
|
|
71
|
+
| Hover (close button) | Close icon goes from 70% to full opacity | No background change. |
|
|
72
|
+
| Focus (close button) | 1px outline in `--focus-ring`, 1px offset | Never remove or restyle the focus ring. |
|
|
73
|
+
|
|
74
|
+
The title declares no colour of its own and inherits; Sheet and Drawer titles each use a different token. It looks the same in the default theme; don't recolour titles to compensate.
|
|
75
|
+
|
|
76
|
+
## 7. Content guidelines
|
|
77
|
+
|
|
78
|
+
- Title: ask the question, naming the action and the object: "Delete Q3 roadmap?", "Remove Maya Chen from Acme?".
|
|
79
|
+
- Description: say what happens and whether it can be undone, in one or two sentences. Include what else is lost: "This deletes 14 environments and all deploy history."
|
|
80
|
+
- Confirm button: repeat the title's verb and object: "Delete project", not "OK" or "Yes".
|
|
81
|
+
- Dismiss button: "Cancel". For unsaved changes, "Keep editing".
|
|
82
|
+
- Sentence case everywhere. No exclamation marks.
|
|
83
|
+
|
|
84
|
+
| Do | Don't |
|
|
85
|
+
| --- | --- |
|
|
86
|
+
| Delete Q3 roadmap? | Are you sure? |
|
|
87
|
+
| This permanently deletes the roadmap and its 12 milestones. You can't undo this. | This action cannot be undone. |
|
|
88
|
+
| Delete roadmap | OK |
|
|
89
|
+
| Cancel | No |
|
|
90
|
+
|
|
91
|
+
## 8. Rules
|
|
92
|
+
|
|
93
|
+
1. Always render a DialogTitle. Radix logs an error without one.
|
|
94
|
+
2. Render a DialogDescription, or pass `aria-describedby={undefined}` to DialogContent when there's nothing to describe. Radix warns otherwise.
|
|
95
|
+
3. Open the dialog from a `DialogTrigger asChild` wrapping a Button. That's what returns focus on close.
|
|
96
|
+
4. When there's no DialogTrigger (a controlled dialog opened from a menu item or a keyboard shortcut), pass `onCloseAutoFocus` to DialogContent, call `event.preventDefault()`, and focus the control that opened it.
|
|
97
|
+
5. For a destructive confirmation, put Cancel (`DialogClose asChild` around an `outline` Button) first and the `destructive` Button last in DialogFooter. When the body has no fields, Cancel then receives focus as the dialog opens.
|
|
98
|
+
6. Use one `destructive` or `default` Button per dialog: the confirm action.
|
|
99
|
+
7. Always include a visible Cancel or Close Button in the footer. Don't rely on the built-in X alone.
|
|
100
|
+
8. Never build a modal from a `div`, and never use `window.confirm`.
|
|
101
|
+
9. Never pass `className` or `style` to any Dialog part; they're dropped. Lay out the body with your own wrapper element.
|
|
102
|
+
|
|
103
|
+
## 9. Dos and don'ts
|
|
104
|
+
|
|
105
|
+
**Do:** confirm a destructive action with a specific title and a matching button.
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
<Dialog>
|
|
109
|
+
<DialogTrigger asChild>
|
|
110
|
+
<Button type="button" variant="dangerGhost">Delete roadmap</Button>
|
|
111
|
+
</DialogTrigger>
|
|
112
|
+
<DialogContent>
|
|
113
|
+
<DialogHeader>
|
|
114
|
+
<DialogTitle>Delete Q3 roadmap?</DialogTitle>
|
|
115
|
+
<DialogDescription>This permanently deletes the roadmap and its 12 milestones.</DialogDescription>
|
|
116
|
+
</DialogHeader>
|
|
117
|
+
<DialogFooter>
|
|
118
|
+
<DialogClose asChild>
|
|
119
|
+
<Button type="button" variant="outline">Cancel</Button>
|
|
120
|
+
</DialogClose>
|
|
121
|
+
<Button type="button" variant="destructive" onClick={deleteRoadmap}>Delete roadmap</Button>
|
|
122
|
+
</DialogFooter>
|
|
123
|
+
</DialogContent>
|
|
124
|
+
</Dialog>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Don't:** use a browser confirm or a vague, generic dialog.
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
<Button onClick={() => window.confirm("Are you sure?") && deleteRoadmap()}>Delete</Button>
|
|
131
|
+
|
|
132
|
+
<DialogContent>
|
|
133
|
+
<DialogTitle>Are you sure?</DialogTitle>
|
|
134
|
+
<DialogFooter>
|
|
135
|
+
<Button>OK</Button>
|
|
136
|
+
</DialogFooter>
|
|
137
|
+
</DialogContent>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Do:** return focus yourself when a menu item opens the dialog.
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
const menuTriggerRef = React.useRef<HTMLButtonElement>(null);
|
|
144
|
+
|
|
145
|
+
<DialogContent
|
|
146
|
+
onCloseAutoFocus={(event) => {
|
|
147
|
+
event.preventDefault();
|
|
148
|
+
menuTriggerRef.current?.focus();
|
|
149
|
+
}}
|
|
150
|
+
>
|
|
151
|
+
{/* … */}
|
|
152
|
+
</DialogContent>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Don't:** open a dialog from a bare `onClick` with no DialogTrigger and no `onCloseAutoFocus`. Focus is lost when it closes.
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
<Button onClick={() => setOpen(true)}>Delete roadmap</Button>
|
|
159
|
+
<Dialog open={open} onOpenChange={setOpen}>
|
|
160
|
+
<DialogContent>{/* … */}</DialogContent>
|
|
161
|
+
</Dialog>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## 10. Accessibility
|
|
165
|
+
|
|
166
|
+
- Role: `dialog` on DialogContent. DialogTrigger gets `aria-haspopup="dialog"`, `aria-expanded` and `aria-controls`.
|
|
167
|
+
- Label: DialogTitle names the dialog (`aria-labelledby`); DialogDescription describes it (`aria-describedby`). The close button's name is "Close".
|
|
168
|
+
- Keyboard: Escape closes. Tab and Shift+Tab cycle through the dialog's controls and wrap at the ends. Enter and Space activate buttons.
|
|
169
|
+
- Focus: on open, focus moves to the first focusable element in your content (links are skipped). The close button comes last in the DOM, so it's only focused first when your content has no controls. Focus is trapped while open and returns to DialogTrigger on close. Everything outside the dialog is hidden from assistive technology and blocked from pointer input.
|
|
170
|
+
- Contrast: handled by the theme. Don't override colours.
|
|
171
|
+
- The built-in close button is a `--size-xxs` icon with no padding, a small pointer target. Rule 7's footer button is the reliable way to dismiss.
|
|
172
|
+
|
|
173
|
+
## 11. Behaviour
|
|
174
|
+
|
|
175
|
+
- Responsive: below 640px the header centres its text and the footer stacks its buttons full width with the last button (the confirm action) on top; from 640px the header aligns left and the footer is a right-aligned row.
|
|
176
|
+
- Overflow and truncation: the panel has no maximum height and doesn't scroll. Keep dialog content short; move anything long to a [Sheet](./sheet.md).
|
|
177
|
+
- Motion: the dialog appears and disappears without animation. Don't add your own.
|
|
178
|
+
- Dismissal: Escape, a click on the scrim, the close button or a DialogClose all close it and fire `onOpenChange(false)`. To keep it open while a request runs, ignore `onOpenChange` in that window (see the example).
|
|
179
|
+
- Portal: DialogContent mounts in `document.body`. In a scoped theme, pass `portalContainer` to the scoped EluanProvider or wrap the region in `PortalContainerProvider` so the dialog inherits the scope's tokens; `container` overrides it for one dialog. See `../foundations/theming.md`.
|
|
180
|
+
|
|
181
|
+
## 12. API
|
|
182
|
+
|
|
183
|
+
<!-- api:start -->
|
|
184
|
+
### Dialog
|
|
185
|
+
|
|
186
|
+
| Prop | Type | Default | Description |
|
|
187
|
+
| --- | --- | --- | --- |
|
|
188
|
+
| `open` | `boolean` | | Controlled open state. |
|
|
189
|
+
| `defaultOpen` | `boolean` | `false` | Initial state when uncontrolled. |
|
|
190
|
+
| `onOpenChange` | `(open: boolean) => void` | | Called on every open and close. |
|
|
191
|
+
| `modal` | `boolean` | `true` | `false` removes the overlay, focus trap, scroll lock and page hiding. Keep `true`. |
|
|
192
|
+
|
|
193
|
+
### DialogTrigger, DialogClose
|
|
194
|
+
|
|
195
|
+
| Prop | Type | Default | Description |
|
|
196
|
+
| --- | --- | --- | --- |
|
|
197
|
+
| `asChild` | `boolean` | `false` | Renders the child (a Button) instead of a bare `<button type="button">`. |
|
|
198
|
+
| `...props` | Radix `Dialog.Trigger` / `Dialog.Close` props | | Native button attributes. |
|
|
199
|
+
|
|
200
|
+
### DialogContent
|
|
201
|
+
|
|
202
|
+
| Prop | Type | Default | Description |
|
|
203
|
+
| --- | --- | --- | --- |
|
|
204
|
+
| `layout` | `"default" \| "command"` | `"default"` | `"command"` removes padding and the close button, for CommandDialog. |
|
|
205
|
+
| `container` | `HTMLElement \| null` | nearest `PortalContainerProvider`, then `document.body` | Element to portal into. |
|
|
206
|
+
| `onOpenAutoFocus` | `(event: Event) => void` | | Runs as focus moves in. `preventDefault()` and focus another element to change the target. |
|
|
207
|
+
| `onCloseAutoFocus` | `(event: Event) => void` | | Runs as focus returns. `preventDefault()` and focus the opener when there's no DialogTrigger. |
|
|
208
|
+
| `onEscapeKeyDown` | `(event: KeyboardEvent) => void` | | `preventDefault()` keeps the dialog open. |
|
|
209
|
+
| `onPointerDownOutside` | `(event: CustomEvent) => void` | | `preventDefault()` keeps the dialog open on a scrim click. |
|
|
210
|
+
| `aria-describedby` | `string \| undefined` | DialogDescription's id | Pass `undefined` when there's no description. |
|
|
211
|
+
| `forceMount` | `true` | | Keeps the content mounted while closed. |
|
|
212
|
+
| `...props` | Radix `Dialog.Content` props without `className`, `style` | | |
|
|
213
|
+
|
|
214
|
+
### DialogHeader, DialogFooter
|
|
215
|
+
|
|
216
|
+
| Prop | Type | Default | Description |
|
|
217
|
+
| --- | --- | --- | --- |
|
|
218
|
+
| `...props` | `HTMLAttributes<HTMLDivElement>` without `className`, `style` | | Layout wrappers. |
|
|
219
|
+
|
|
220
|
+
### DialogTitle, DialogDescription
|
|
221
|
+
|
|
222
|
+
| Prop | Type | Default | Description |
|
|
223
|
+
| --- | --- | --- | --- |
|
|
224
|
+
| `asChild` | `boolean` | `false` | Renders the child element instead of the `h2` / `p`. |
|
|
225
|
+
| `...props` | Radix `Dialog.Title` / `Dialog.Description` props without `className`, `style` | | |
|
|
226
|
+
|
|
227
|
+
### DialogOverlay, DialogPortal
|
|
228
|
+
|
|
229
|
+
Rendered by DialogContent. Radix `Dialog.Overlay` (without `className`, `style`) and `Dialog.Portal` props.
|
|
230
|
+
<!-- api:end -->
|
|
231
|
+
|
|
232
|
+
## 13. Examples
|
|
233
|
+
|
|
234
|
+
A destructive confirmation that stays open while the delete runs and returns focus to its trigger.
|
|
235
|
+
|
|
236
|
+
```tsx
|
|
237
|
+
import * as React from "react";
|
|
238
|
+
import {
|
|
239
|
+
Button,
|
|
240
|
+
Dialog,
|
|
241
|
+
DialogClose,
|
|
242
|
+
DialogContent,
|
|
243
|
+
DialogDescription,
|
|
244
|
+
DialogFooter,
|
|
245
|
+
DialogHeader,
|
|
246
|
+
DialogTitle,
|
|
247
|
+
DialogTrigger,
|
|
248
|
+
} from "@eluan/core";
|
|
249
|
+
import { Trash2 } from "lucide-react";
|
|
250
|
+
|
|
251
|
+
export function DeleteProjectDialog({
|
|
252
|
+
projectName,
|
|
253
|
+
environmentCount,
|
|
254
|
+
onDelete,
|
|
255
|
+
}: {
|
|
256
|
+
projectName: string;
|
|
257
|
+
environmentCount: number;
|
|
258
|
+
onDelete: () => Promise<void>;
|
|
259
|
+
}) {
|
|
260
|
+
const [open, setOpen] = React.useState(false);
|
|
261
|
+
const [deleting, setDeleting] = React.useState(false);
|
|
262
|
+
|
|
263
|
+
async function handleDelete() {
|
|
264
|
+
if (deleting) return;
|
|
265
|
+
setDeleting(true);
|
|
266
|
+
try {
|
|
267
|
+
await onDelete();
|
|
268
|
+
setOpen(false);
|
|
269
|
+
} finally {
|
|
270
|
+
setDeleting(false);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return (
|
|
275
|
+
<Dialog open={open} onOpenChange={(next) => !deleting && setOpen(next)}>
|
|
276
|
+
<DialogTrigger asChild>
|
|
277
|
+
<Button type="button" variant="dangerGhost">
|
|
278
|
+
<Trash2 aria-hidden="true" style={{ width: "var(--size-xxs)", height: "var(--size-xxs)" }} />
|
|
279
|
+
Delete project
|
|
280
|
+
</Button>
|
|
281
|
+
</DialogTrigger>
|
|
282
|
+
<DialogContent>
|
|
283
|
+
<DialogHeader>
|
|
284
|
+
<DialogTitle>Delete {projectName}?</DialogTitle>
|
|
285
|
+
<DialogDescription>
|
|
286
|
+
This permanently deletes the project, its {environmentCount} environments and all deploy
|
|
287
|
+
history. You can't undo this.
|
|
288
|
+
</DialogDescription>
|
|
289
|
+
</DialogHeader>
|
|
290
|
+
<DialogFooter>
|
|
291
|
+
<DialogClose asChild>
|
|
292
|
+
<Button type="button" variant="outline" disabled={deleting}>
|
|
293
|
+
Cancel
|
|
294
|
+
</Button>
|
|
295
|
+
</DialogClose>
|
|
296
|
+
<Button
|
|
297
|
+
type="button"
|
|
298
|
+
variant="destructive"
|
|
299
|
+
onClick={handleDelete}
|
|
300
|
+
aria-busy={deleting}
|
|
301
|
+
aria-disabled={deleting}
|
|
302
|
+
>
|
|
303
|
+
Delete project
|
|
304
|
+
</Button>
|
|
305
|
+
</DialogFooter>
|
|
306
|
+
</DialogContent>
|
|
307
|
+
</Dialog>
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
## 14. Related components
|
|
313
|
+
|
|
314
|
+
- [Button](./button.md): the trigger and the footer actions; `destructive` for the confirm action.
|
|
315
|
+
- [Sheet](./sheet.md): a modal panel from the screen edge for longer content.
|
|
316
|
+
- [Command](./command.md): `CommandDialog` builds a command palette on Dialog.
|
|
317
|
+
- [ActionPopover](./action-popover.md) and [DropdownMenu](./dropdown-menu.md): row actions that often open a confirmation Dialog.
|
|
318
|
+
- [Toast](./toast.md): confirm that the action finished.
|
|
319
|
+
|
|
320
|
+
## 15. Common agent mistakes
|
|
321
|
+
|
|
322
|
+
_Filled from evals._
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Drawer
|
|
3
|
+
use_when: A side panel opens beside the main content and pushes it aside, so the user can keep working in the page while it's open.
|
|
4
|
+
instead_of: Sheet for a modal panel that covers the page (and on small screens); NavigationDrawer for app navigation; Popover for small anchored content.
|
|
5
|
+
source: packages/core/src/components/drawer.tsx
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Drawer
|
|
9
|
+
|
|
10
|
+
## 1. Overview
|
|
11
|
+
|
|
12
|
+
Drawer is an inline side panel that lives in the page layout. Inside a `DrawerLayout` row, opening it widens the panel from zero to its full width and the main content shrinks to make room; closing it gives the space back. It isn't a Sheet variant: it isn't built on Radix Dialog or any other overlay primitive, and has no scrim, no portal, no focus trap and no built-in close button.
|
|
13
|
+
|
|
14
|
+
## 2. When to use
|
|
15
|
+
|
|
16
|
+
- An inspector or properties panel for the item selected in the main content.
|
|
17
|
+
- Filters the user tweaks while watching the results update.
|
|
18
|
+
- Settings or detail views where the page must stay visible and usable.
|
|
19
|
+
|
|
20
|
+
### When not to use
|
|
21
|
+
|
|
22
|
+
- The panel should block the page until the user is done, or the screen is narrow → use [Sheet](./sheet.md).
|
|
23
|
+
- App-level navigation with a collapsible sidebar → use [NavigationDrawer](./navigation-drawer.md).
|
|
24
|
+
- A short confirmation → use [Dialog](./dialog.md).
|
|
25
|
+
- A small panel anchored to one control → use [Popover](./popover.md).
|
|
26
|
+
- Extra detail revealed in the page flow → use [Collapsible](./collapsible.md) or [Accordion](./accordion.md).
|
|
27
|
+
|
|
28
|
+
### Sheet or Drawer
|
|
29
|
+
|
|
30
|
+
| | Drawer | [Sheet](./sheet.md) |
|
|
31
|
+
| --- | --- | --- |
|
|
32
|
+
| Built on | Its own React context | Radix Dialog |
|
|
33
|
+
| Position | In the layout, next to the main content | Fixed over the page, from an edge |
|
|
34
|
+
| Page while open | Usable; it shrinks to make room | Covered by a scrim and inert |
|
|
35
|
+
| Sides | `left`, `right` | `top`, `right`, `bottom`, `left` |
|
|
36
|
+
| Focus | Stays where it was; no trap | Moves in and is trapped |
|
|
37
|
+
| Close button | None; add a DrawerClose | Built in |
|
|
38
|
+
| Mounted when closed | Yes, collapsed and hidden | No |
|
|
39
|
+
|
|
40
|
+
## 3. Anatomy
|
|
41
|
+
|
|
42
|
+
1. **Drawer**: the root. Holds open state; renders nothing itself.
|
|
43
|
+
2. **DrawerLayout**: a flex row, full width and height of its parent, holding the main content and the panel.
|
|
44
|
+
3. **Main content**: your own element next to the panel. Give it `flex: 1` and `minWidth: 0` so it shrinks.
|
|
45
|
+
4. **DrawerTrigger**: a button that toggles the panel open and closed. Wrap a Button with `asChild`.
|
|
46
|
+
5. **DrawerContent**: the panel. `--container-bg`, a `--container-border` line on its inner edge, 320px wide by default, full height, clipped.
|
|
47
|
+
6. **DrawerHeader**: a column holding the title and description, `--spacing-md` padding, `--spacing-xs` gap.
|
|
48
|
+
7. **DrawerTitle**: an `h2` in `--font-size-lg`, weight 600, `--container-fg`.
|
|
49
|
+
8. **DrawerDescription**: a `p` in `--font-size-sm`, `--container-fg-alt`.
|
|
50
|
+
9. **Body**: your content between header and footer. DrawerContent adds no padding; add your own.
|
|
51
|
+
10. **DrawerFooter**: a column pinned to the bottom of the panel, `--spacing-md` padding, `--spacing-xs` gap.
|
|
52
|
+
11. **DrawerClose**: a button that closes the panel. Wrap a Button with `asChild`.
|
|
53
|
+
|
|
54
|
+
## 4. Variants
|
|
55
|
+
|
|
56
|
+
No `variant` prop. `side` on DrawerContent puts the panel on the `right` (default) or `left` of the main content.
|
|
57
|
+
|
|
58
|
+
## 5. Sizes
|
|
59
|
+
|
|
60
|
+
No size prop. `width` on DrawerContent sets the open width: 320px by default, a number is read as px, a string is used as written. Keep the default unless the content needs a different width.
|
|
61
|
+
|
|
62
|
+
## 6. States
|
|
63
|
+
|
|
64
|
+
| State | Looks like | Notes |
|
|
65
|
+
| --- | --- | --- |
|
|
66
|
+
| Closed | Zero width, no border | Contents stay mounted but hidden and `aria-hidden`, so they're out of the tab order. |
|
|
67
|
+
| Open | Panel at full width beside the main content | DrawerTrigger has `aria-expanded="true"`. |
|
|
68
|
+
| Focus | Drawer draws no focus styles | Its Button trigger and controls bring their own. Never remove or restyle the focus ring. |
|
|
69
|
+
|
|
70
|
+
DrawerTitle and DrawerDescription use the `--container-*` pair, where Sheet uses `--interactive-*` and Dialog's title inherits. They match in the default theme; don't recolour them.
|
|
71
|
+
|
|
72
|
+
## 7. Content guidelines
|
|
73
|
+
|
|
74
|
+
- Title: name the panel's subject: "Order details", "Filters", "Layer properties".
|
|
75
|
+
- Description: one short line, or leave it out.
|
|
76
|
+
- Footer: the main action first and Close or Cancel after it, as the stacked buttons in the stories do.
|
|
77
|
+
- Sentence case.
|
|
78
|
+
|
|
79
|
+
| Do | Don't |
|
|
80
|
+
| --- | --- |
|
|
81
|
+
| Order details | Details Panel |
|
|
82
|
+
| Close | X |
|
|
83
|
+
|
|
84
|
+
## 8. Rules
|
|
85
|
+
|
|
86
|
+
1. Put DrawerLayout inside an element with a set height; DrawerLayout fills its parent.
|
|
87
|
+
2. Give the main content `flex: 1` and `minWidth: 0`.
|
|
88
|
+
3. Use `DrawerTrigger asChild` and `DrawerClose asChild` around Buttons. Without `asChild` they render unstyled native buttons.
|
|
89
|
+
4. Always put a DrawerClose inside the panel. Drawer has no close button of its own.
|
|
90
|
+
5. Match DOM order to what users see: a `left` panel before the main content, a `right` panel after it. The panel moves visually with CSS `order`, but Tab follows the DOM.
|
|
91
|
+
6. Pad the body yourself with a wrapper, using `--spacing-md` to line up with the header and footer.
|
|
92
|
+
7. Don't use Drawer for flows that must block the page. Use Sheet.
|
|
93
|
+
8. Never pass `className` or `style` to any Drawer part; they're dropped.
|
|
94
|
+
|
|
95
|
+
## 9. Dos and don'ts
|
|
96
|
+
|
|
97
|
+
**Do:** compose the layout so the panel pushes the main content.
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
<Drawer>
|
|
101
|
+
<DrawerLayout>
|
|
102
|
+
<main style={{ flex: 1, minWidth: 0, padding: "var(--spacing-xl)" }}>
|
|
103
|
+
<DrawerTrigger asChild>
|
|
104
|
+
<Button type="button" variant="outline">Filters</Button>
|
|
105
|
+
</DrawerTrigger>
|
|
106
|
+
</main>
|
|
107
|
+
<DrawerContent side="right">{/* filters */}</DrawerContent>
|
|
108
|
+
</DrawerLayout>
|
|
109
|
+
</Drawer>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Don't:** render DrawerContent outside DrawerLayout or float it over the page.
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
<Drawer>
|
|
116
|
+
<DrawerTrigger>Filters</DrawerTrigger>
|
|
117
|
+
<div style={{ position: "fixed", right: 0, top: 0 }}>
|
|
118
|
+
<DrawerContent>{/* filters */}</DrawerContent>
|
|
119
|
+
</div>
|
|
120
|
+
</Drawer>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Do:** give the panel a way to close from inside.
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
<DrawerFooter>
|
|
127
|
+
<Button type="button" fullWidth onClick={applyFilters}>Apply filters</Button>
|
|
128
|
+
<DrawerClose asChild>
|
|
129
|
+
<Button type="button" variant="ghost" fullWidth>Close</Button>
|
|
130
|
+
</DrawerClose>
|
|
131
|
+
</DrawerFooter>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Don't:** expect Drawer to add a close button like Sheet does.
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
<DrawerContent>
|
|
138
|
+
<DrawerHeader>
|
|
139
|
+
<DrawerTitle>Filters</DrawerTitle>
|
|
140
|
+
</DrawerHeader>
|
|
141
|
+
{/* filters, and no DrawerClose anywhere */}
|
|
142
|
+
</DrawerContent>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## 10. Accessibility
|
|
146
|
+
|
|
147
|
+
- Role: DrawerContent is a plain `div` with no role. Give it `role="region"` and `aria-labelledby` pointing at the DrawerTitle's `id`, so it's announced as a named landmark.
|
|
148
|
+
- Label: DrawerTrigger gets `aria-expanded` but no `aria-controls`; pass `aria-controls` with the DrawerContent's `id`.
|
|
149
|
+
- Keyboard: Enter and Space on DrawerTrigger toggle the panel. Escape anywhere in the document closes an open drawer.
|
|
150
|
+
- Focus: opening doesn't move focus; the user tabs into the panel. Focus isn't trapped. When the panel closes with focus inside it, focus returns to the element that had focus before it opened. A closed panel's contents can't receive focus.
|
|
151
|
+
- Escape also closes the drawer when it was meant for something else: closing a Select, Popover or Dialog with Escape collapses an open drawer at the same time.
|
|
152
|
+
- Contrast: handled by the theme. Don't override colours.
|
|
153
|
+
|
|
154
|
+
## 11. Behaviour
|
|
155
|
+
|
|
156
|
+
- Responsive: no breakpoint behaviour. The drawer stays inline at every width and never becomes an overlay. On narrow screens, use a [Sheet](./sheet.md) instead.
|
|
157
|
+
- Overflow and truncation: the panel clips its content and the inner column is fixed to the panel width. Long content doesn't scroll; wrap the body in a [ScrollArea](./scroll-area.md).
|
|
158
|
+
- Motion: the panel's width animates over 300ms. The transition isn't reduced for `prefers-reduced-motion`. Don't add your own.
|
|
159
|
+
- Controlled or uncontrolled: pass `open` and `onOpenChange` to control it, or `defaultOpen` to start open.
|
|
160
|
+
|
|
161
|
+
## 12. API
|
|
162
|
+
|
|
163
|
+
<!-- api:start -->
|
|
164
|
+
### Drawer
|
|
165
|
+
|
|
166
|
+
| Prop | Type | Default | Description |
|
|
167
|
+
| --- | --- | --- | --- |
|
|
168
|
+
| `open` | `boolean` | | Controlled open state. |
|
|
169
|
+
| `defaultOpen` | `boolean` | `false` | Initial state when uncontrolled. |
|
|
170
|
+
| `onOpenChange` | `(open: boolean) => void` | | Called when the trigger, a DrawerClose or Escape changes the state. |
|
|
171
|
+
| `children` | `ReactNode` | | DrawerLayout, or the trigger and content. |
|
|
172
|
+
|
|
173
|
+
### DrawerLayout, DrawerHeader, DrawerFooter
|
|
174
|
+
|
|
175
|
+
| Prop | Type | Default | Description |
|
|
176
|
+
| --- | --- | --- | --- |
|
|
177
|
+
| `...props` | `HTMLAttributes<HTMLDivElement>` without `className`, `style` | | Layout wrappers. |
|
|
178
|
+
|
|
179
|
+
### DrawerTrigger, DrawerClose
|
|
180
|
+
|
|
181
|
+
| Prop | Type | Default | Description |
|
|
182
|
+
| --- | --- | --- | --- |
|
|
183
|
+
| `asChild` | `boolean` | `false` | Renders the child (a Button) instead of a bare `<button type="button">`. |
|
|
184
|
+
| `...props` | `ButtonHTMLAttributes` without `className`, `style` | | `onClick` runs after the state change. DrawerTrigger toggles; DrawerClose only closes. |
|
|
185
|
+
|
|
186
|
+
### DrawerContent
|
|
187
|
+
|
|
188
|
+
| Prop | Type | Default | Description |
|
|
189
|
+
| --- | --- | --- | --- |
|
|
190
|
+
| `side` | `"left" \| "right"` | `"right"` | Which side of the main content the panel sits on. |
|
|
191
|
+
| `width` | `number \| string` | `320` (px) | Open width. Numbers are px; strings are used as written. |
|
|
192
|
+
| `...props` | `HTMLAttributes<HTMLDivElement>` without `className`, `style` | | `id`, `role`, `aria-labelledby`. |
|
|
193
|
+
|
|
194
|
+
### DrawerTitle
|
|
195
|
+
|
|
196
|
+
| Prop | Type | Default | Description |
|
|
197
|
+
| --- | --- | --- | --- |
|
|
198
|
+
| `...props` | `HTMLAttributes<HTMLHeadingElement>` without `className`, `style` | | Renders an `h2`. |
|
|
199
|
+
|
|
200
|
+
### DrawerDescription
|
|
201
|
+
|
|
202
|
+
| Prop | Type | Default | Description |
|
|
203
|
+
| --- | --- | --- | --- |
|
|
204
|
+
| `...props` | `HTMLAttributes<HTMLParagraphElement>` without `className`, `style` | | Renders a `p`. |
|
|
205
|
+
<!-- api:end -->
|
|
206
|
+
|
|
207
|
+
## 13. Examples
|
|
208
|
+
|
|
209
|
+
An order details panel beside an orders list. Place it inside a region with a set height, such as your app shell's content area.
|
|
210
|
+
|
|
211
|
+
```tsx
|
|
212
|
+
import {
|
|
213
|
+
Button,
|
|
214
|
+
Drawer,
|
|
215
|
+
DrawerClose,
|
|
216
|
+
DrawerContent,
|
|
217
|
+
DrawerDescription,
|
|
218
|
+
DrawerFooter,
|
|
219
|
+
DrawerHeader,
|
|
220
|
+
DrawerLayout,
|
|
221
|
+
DrawerTitle,
|
|
222
|
+
DrawerTrigger,
|
|
223
|
+
Typography,
|
|
224
|
+
} from "@eluan/core";
|
|
225
|
+
import { PanelRight } from "lucide-react";
|
|
226
|
+
|
|
227
|
+
export function OrdersWithDetails({ orderNumber }: { orderNumber: string }) {
|
|
228
|
+
return (
|
|
229
|
+
<Drawer>
|
|
230
|
+
<DrawerLayout>
|
|
231
|
+
<main
|
|
232
|
+
style={{
|
|
233
|
+
flex: 1,
|
|
234
|
+
minWidth: 0,
|
|
235
|
+
display: "flex",
|
|
236
|
+
flexDirection: "column",
|
|
237
|
+
gap: "var(--spacing-lg)",
|
|
238
|
+
padding: "var(--spacing-xl)",
|
|
239
|
+
}}
|
|
240
|
+
>
|
|
241
|
+
<div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
|
|
242
|
+
<Typography variant="title" size="xl" as="h1">
|
|
243
|
+
Orders
|
|
244
|
+
</Typography>
|
|
245
|
+
<DrawerTrigger asChild aria-controls="order-details">
|
|
246
|
+
<Button type="button" variant="outline">
|
|
247
|
+
<PanelRight aria-hidden="true" style={{ width: "var(--size-xxs)", height: "var(--size-xxs)" }} />
|
|
248
|
+
Details
|
|
249
|
+
</Button>
|
|
250
|
+
</DrawerTrigger>
|
|
251
|
+
</div>
|
|
252
|
+
{/* orders table */}
|
|
253
|
+
</main>
|
|
254
|
+
|
|
255
|
+
<DrawerContent side="right" id="order-details" role="region" aria-labelledby="order-details-title">
|
|
256
|
+
<DrawerHeader>
|
|
257
|
+
<DrawerTitle id="order-details-title">Order {orderNumber}</DrawerTitle>
|
|
258
|
+
<DrawerDescription>Placed 12 March, paid by card.</DrawerDescription>
|
|
259
|
+
</DrawerHeader>
|
|
260
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-sm)", padding: "var(--spacing-md)" }}>
|
|
261
|
+
<Typography variant="label" tone="muted">
|
|
262
|
+
Shipping to
|
|
263
|
+
</Typography>
|
|
264
|
+
<Typography variant="body">Maya Chen, 14 Harbour Street, Leith</Typography>
|
|
265
|
+
</div>
|
|
266
|
+
<DrawerFooter>
|
|
267
|
+
<Button type="button" fullWidth>
|
|
268
|
+
Print packing slip
|
|
269
|
+
</Button>
|
|
270
|
+
<DrawerClose asChild>
|
|
271
|
+
<Button type="button" variant="ghost" fullWidth>
|
|
272
|
+
Close
|
|
273
|
+
</Button>
|
|
274
|
+
</DrawerClose>
|
|
275
|
+
</DrawerFooter>
|
|
276
|
+
</DrawerContent>
|
|
277
|
+
</DrawerLayout>
|
|
278
|
+
</Drawer>
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## 14. Related components
|
|
284
|
+
|
|
285
|
+
- [Sheet](./sheet.md): the modal alternative that covers the page.
|
|
286
|
+
- [NavigationDrawer](./navigation-drawer.md): a navigation sidebar with its own collapse behaviour.
|
|
287
|
+
- [ScrollArea](./scroll-area.md): scroll long panel content.
|
|
288
|
+
- [Button](./button.md): the trigger and footer actions.
|
|
289
|
+
|
|
290
|
+
## 15. Common agent mistakes
|
|
291
|
+
|
|
292
|
+
_Filled from evals._
|