@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,158 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Stack
|
|
3
|
+
use_when: Children go one above the other with a token gap, such as page sections, form fields, or a heading over its text.
|
|
4
|
+
instead_of: Row for items side by side; Grid for columns; Fieldset for a labelled group of form fields; margins on the children.
|
|
5
|
+
source: packages/core/src/components/stack.tsx
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Stack
|
|
9
|
+
|
|
10
|
+
## 1. Overview
|
|
11
|
+
|
|
12
|
+
Stack is vertical flow: a flex column with a `--spacing-*` gap between its children. It draws nothing (no background, border or radius) and only places what's inside it, so a page can be laid out from tokens without a utility framework or hand-written CSS. It takes `Box`'s props (padding, `grow`, `shrink`, `height`, `minHeight`, `position`, `inset`, `overflow`), `as` and `asChild`, and drops `className` and `style`.
|
|
13
|
+
|
|
14
|
+
## 2. When to use
|
|
15
|
+
|
|
16
|
+
- The outer flow of a page or panel: header, sections, footer.
|
|
17
|
+
- Form fields one under another, with the submit row last.
|
|
18
|
+
- A heading over its supporting text, or a label over a value.
|
|
19
|
+
- Any list of items you compose yourself.
|
|
20
|
+
|
|
21
|
+
### When not to use
|
|
22
|
+
|
|
23
|
+
- Items side by side → [Row](./row.md).
|
|
24
|
+
- Items in columns, or a layout that changes columns with the viewport → [Grid](./grid.md).
|
|
25
|
+
- A group of form fields under a legend → [Fieldset](./fieldset.md), with a Stack inside if needed.
|
|
26
|
+
- A framed block with a surface → [Card](./card.md); a Stack goes inside its content.
|
|
27
|
+
- Padding alone, with no flow → [Box](./box.md).
|
|
28
|
+
|
|
29
|
+
## 3. Anatomy
|
|
30
|
+
|
|
31
|
+
1. **Container**: one element (`div` by default) laid out as a flex column with `min-width: 0`, so it can shrink inside a Row or Grid. Children sit directly inside it.
|
|
32
|
+
|
|
33
|
+
## 4. Variants
|
|
34
|
+
|
|
35
|
+
Stack has no `variant`. `align` and `justify` change how children sit:
|
|
36
|
+
|
|
37
|
+
| Prop | Values | Default |
|
|
38
|
+
| --- | --- | --- |
|
|
39
|
+
| `align` (cross axis) | `start`, `center`, `end`, `stretch`, `baseline` | unset: children stretch to the Stack's width |
|
|
40
|
+
| `justify` (main axis) | `start`, `center`, `end`, `between` | unset: children pack at the top |
|
|
41
|
+
|
|
42
|
+
## 5. Sizes
|
|
43
|
+
|
|
44
|
+
Stack has no size prop. `gap` sets the space between children and `pad`, `padX`, `padY` set padding, each a `--spacing-*` step from `"none"` to `"4xl"`. `gap` defaults to `"md"`.
|
|
45
|
+
|
|
46
|
+
## 6. States
|
|
47
|
+
|
|
48
|
+
| State | Looks like | Notes |
|
|
49
|
+
| --- | --- | --- |
|
|
50
|
+
| Default | Children stacked with the gap | Static. Stack has no interactive states. |
|
|
51
|
+
|
|
52
|
+
## 7. Content guidelines
|
|
53
|
+
|
|
54
|
+
- Pick the gap by relationship, not by pixel: tight (`xs`, `sm`) between a label and its value, `md` to `lg` between fields or list items, `2xl` to `3xl` between page sections.
|
|
55
|
+
- Nest Stacks to group: an outer Stack with a large gap between sections, an inner one with a small gap inside each.
|
|
56
|
+
|
|
57
|
+
## 8. Rules
|
|
58
|
+
|
|
59
|
+
1. Space children with `gap`. Never put margins on the children.
|
|
60
|
+
2. Use `--spacing-*` steps only, through `gap` and `pad*`. Never write px.
|
|
61
|
+
3. Use `as` for the element's meaning (`main`, `section`, `form`, `nav`), not a wrapper `div` around the Stack.
|
|
62
|
+
4. For list semantics, prefer `role="list"` on the Stack and `role="listitem"` on each child over `as="ul"`: a `ul` keeps the browser's list margin, which no prop resets.
|
|
63
|
+
5. Don't pass `className` or `style`; they're dropped. Position, height and overflow are props; fixed widths, hover effects and animation go on an element you own, with the Stack nested in it.
|
|
64
|
+
6. Don't wrap a single child in a Stack to pad it. Use [Box](./box.md).
|
|
65
|
+
|
|
66
|
+
## 9. Dos and don'ts
|
|
67
|
+
|
|
68
|
+
**Do:** stack fields with a gap.
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
<Stack as="form" gap="lg" onSubmit={save}>
|
|
72
|
+
<Input aria-label="Name" />
|
|
73
|
+
<Input type="email" aria-label="Email" />
|
|
74
|
+
<Button type="submit">Save</Button>
|
|
75
|
+
</Stack>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Don't:** space children with margins or a hand-written flex column.
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
<div style={{ display: "flex", flexDirection: "column" }}>
|
|
82
|
+
<Input aria-label="Name" style={{ marginBottom: 16 }} />
|
|
83
|
+
<Button type="submit">Save</Button>
|
|
84
|
+
</div>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 10. Accessibility
|
|
88
|
+
|
|
89
|
+
- Role: none by default (a `div`). Use `as` for landmarks and forms (`main`, `nav`, `section` with a label, `form`), or `role="list"` for a list.
|
|
90
|
+
- Label: give a `section` an `aria-label` or `aria-labelledby` so it becomes a region landmark.
|
|
91
|
+
- Keyboard: none. Stack isn't focusable.
|
|
92
|
+
- Order: visual order is DOM order. `justify` and `align` don't reorder children, so reading order matches what's shown.
|
|
93
|
+
|
|
94
|
+
## 11. Behaviour
|
|
95
|
+
|
|
96
|
+
- Responsive: Stack is one column at every width. For a layout that becomes several columns, use Grid.
|
|
97
|
+
- Density: `gap` and padding follow `data-spacing`, so a Stack re-flows with the components inside it.
|
|
98
|
+
- Shrinking: Stack has `min-width: 0`, so inside a Row or Grid it can shrink below its content's width, and `truncate` text inside it works.
|
|
99
|
+
- Motion: none.
|
|
100
|
+
|
|
101
|
+
## 12. API
|
|
102
|
+
|
|
103
|
+
<!-- api:start -->
|
|
104
|
+
| Prop | Type | Default | Description |
|
|
105
|
+
| --- | --- | --- | --- |
|
|
106
|
+
| `gap` | `"none" \| "xxs" \| "xs" \| "sm" \| "md" \| "lg" \| "xl" \| "2xl" \| "3xl" \| "4xl"` | `"md"` | Space between children, as a `--spacing-*` step. |
|
|
107
|
+
| `align` | `"start" \| "center" \| "end" \| "stretch" \| "baseline"` | | Cross-axis alignment. Unset, children stretch to the Stack's width. |
|
|
108
|
+
| `justify` | `"start" \| "center" \| "end" \| "between"` | | Main-axis distribution. |
|
|
109
|
+
| `pad` | `"none" \| "xxs" \| "xs" \| "sm" \| "md" \| "lg" \| "xl" \| "2xl" \| "3xl" \| "4xl"` | | Padding on every side. `padX` / `padY` override it per axis. |
|
|
110
|
+
| `padX` | `"none" \| "xxs" \| "xs" \| "sm" \| "md" \| "lg" \| "xl" \| "2xl" \| "3xl" \| "4xl"` | | Inline padding (left and right in LTR). |
|
|
111
|
+
| `padY` | `"none" \| "xxs" \| "xs" \| "sm" \| "md" \| "lg" \| "xl" \| "2xl" \| "3xl" \| "4xl"` | | Block padding (top and bottom). |
|
|
112
|
+
| `grow` | `boolean` | | Take the remaining space in a flex parent: `flex: 1 1 0` with `min-width: 0`. |
|
|
113
|
+
| `shrink` | `boolean` | | `false` keeps the element at its content size in a flex parent (`flex-shrink: 0`). |
|
|
114
|
+
| `height` | `"full" \| "screen"` | | `full` fills the parent's height; `screen` fills the viewport (`100dvh`, so mobile browser bars don't cover the bottom). |
|
|
115
|
+
| `minHeight` | `"full" \| "screen"` | | At least the parent's height (`full`) or the viewport's (`screen`). |
|
|
116
|
+
| `position` | `"relative" \| "absolute"` | | `relative` makes this the anchor for `inset` children; `absolute` takes it out of flow. |
|
|
117
|
+
| `inset` | `"fill" \| "top" \| "bottom"` | | Pin to the nearest positioned ancestor: `fill` covers it, `top` and `bottom` run along that edge at full width. Sets `position: absolute`. |
|
|
118
|
+
| `overflow` | `"hidden" \| "auto"` | | `hidden` clips the content; `auto` scrolls it when it doesn't fit. |
|
|
119
|
+
| `as` | `"div" \| "span" \| "section" \| "article" \| "aside" \| "header" \| "footer" \| "main" \| "nav" \| "form" \| "fieldset" \| "label" \| "p" \| "ul" \| "ol" \| "li" \| "dl" \| "dt" \| "dd"` | | Element override. Defaults to `div`. |
|
|
120
|
+
| `asChild` | `boolean` | `false` | Render the child element instead (Radix Slot); the layout styles move onto it. |
|
|
121
|
+
| `...props` | `HTMLAttributes<HTMLElement>` without `className`, `style` | | Native attributes: `id`, `role`, `aria-*`, `data-*`, event handlers. |
|
|
122
|
+
<!-- api:end -->
|
|
123
|
+
|
|
124
|
+
## 13. Examples
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
import { Button, Input, Stack, Typography } from "@eluan/core";
|
|
128
|
+
|
|
129
|
+
export function InviteForm() {
|
|
130
|
+
return (
|
|
131
|
+
<Stack as="section" gap="2xl" pad="xl" aria-labelledby="invite-heading">
|
|
132
|
+
<Stack gap="xs">
|
|
133
|
+
<Typography variant="heading" size="lg" as="h2" id="invite-heading">
|
|
134
|
+
Invite a teammate
|
|
135
|
+
</Typography>
|
|
136
|
+
<Typography tone="muted">They get an email with a sign-up link.</Typography>
|
|
137
|
+
</Stack>
|
|
138
|
+
|
|
139
|
+
<Stack as="form" gap="lg" onSubmit={(event) => event.preventDefault()}>
|
|
140
|
+
<Input type="email" placeholder="name@company.com" aria-label="Email" />
|
|
141
|
+
<Button type="submit">Send invite</Button>
|
|
142
|
+
</Stack>
|
|
143
|
+
</Stack>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## 14. Related components
|
|
149
|
+
|
|
150
|
+
- [Row](./row.md): the horizontal counterpart, centred by default.
|
|
151
|
+
- [Grid](./grid.md): columns, including responsive ones.
|
|
152
|
+
- [Box](./box.md): padding, `grow`, height, position and overflow without flow.
|
|
153
|
+
- [Fieldset](./fieldset.md): a labelled group of form fields.
|
|
154
|
+
- [Card](./card.md): a framed surface; Stacks go inside its content.
|
|
155
|
+
|
|
156
|
+
## 15. Common agent mistakes
|
|
157
|
+
|
|
158
|
+
_Filled from evals._
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Stepper
|
|
3
|
+
use_when: Showing where the user is in a fixed sequence of steps, such as a checkout or an onboarding wizard.
|
|
4
|
+
instead_of: Tabs for switching between independent views; Progress for a percentage; Breadcrumb for where a page sits in the site.
|
|
5
|
+
source: packages/core/src/components/stepper.tsx
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Stepper
|
|
9
|
+
|
|
10
|
+
## 1. Overview
|
|
11
|
+
|
|
12
|
+
Stepper shows a numbered sequence of steps, each completed, current or upcoming, joined by connector lines. You pass the steps as an array and the current step as a zero-based index. `StepperContent` renders the panel for the current step. Steps run horizontally (the default) or vertically, and can be clickable.
|
|
13
|
+
|
|
14
|
+
## 2. When to use
|
|
15
|
+
|
|
16
|
+
- A multi-step form or wizard: checkout, onboarding, a data import.
|
|
17
|
+
- Showing progress through a fixed, ordered sequence where each step depends on the one before.
|
|
18
|
+
- Letting the user go back to a step they've completed, with `onStepClick`.
|
|
19
|
+
|
|
20
|
+
### When not to use
|
|
21
|
+
|
|
22
|
+
- Switching between independent views of the same thing → use [Tabs](./tabs.md) or [SegmentedControl](./segmented-control.md).
|
|
23
|
+
- Showing a percentage → use [Progress](./progress.md).
|
|
24
|
+
- Showing where a page sits in the site → use [Breadcrumb](./breadcrumb.md).
|
|
25
|
+
- Moving through pages of results → use [Pagination](./pagination.md).
|
|
26
|
+
- The status of an item → use [Badge](./badge.md).
|
|
27
|
+
|
|
28
|
+
## 3. Anatomy
|
|
29
|
+
|
|
30
|
+
1. **Root**: the `Stepper` `<div>`; lays the steps out in a row or a column.
|
|
31
|
+
2. **Indicator**: a circular `<button>` per step, `--size-lg` across. Shows the step number, the step's `icon`, or a check once completed.
|
|
32
|
+
3. **Title**: `step.title`, under the indicator (horizontal) or beside it (vertical).
|
|
33
|
+
4. **Description** (optional): `step.description`, in smaller muted text under the title.
|
|
34
|
+
5. **Connector**: the line between two steps. It darkens once the step before it is complete.
|
|
35
|
+
6. **StepperContent**: a separate component that renders its children only while its `step` equals `currentStep`.
|
|
36
|
+
|
|
37
|
+
## 4. Variants
|
|
38
|
+
|
|
39
|
+
Stepper has no `variant` prop. `orientation` sets the layout:
|
|
40
|
+
|
|
41
|
+
| Orientation | Use for |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| `horizontal` | Default. A wizard header above the form, with short titles. |
|
|
44
|
+
| `vertical` | Sidebars and narrow layouts, or steps with longer descriptions. |
|
|
45
|
+
|
|
46
|
+
## 5. Sizes
|
|
47
|
+
|
|
48
|
+
Stepper has no size prop. The indicator is `--size-lg`, titles are `--font-size-sm` and descriptions `--font-size-xs`; all of them follow density.
|
|
49
|
+
|
|
50
|
+
## 6. States
|
|
51
|
+
|
|
52
|
+
Each step is in one of these states, set by its index against `currentStep`:
|
|
53
|
+
|
|
54
|
+
| State | Looks like | Notes |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| Upcoming | Unfilled circle with a pale border, muted number and title | |
|
|
57
|
+
| Current | Unfilled circle with a dark border, full-strength number and title | `aria-current="step"`. |
|
|
58
|
+
| Completed | Filled dark circle with a check, dark title | The connector after it turns dark. |
|
|
59
|
+
| Hover | Clickable steps only: completed switches to `--action-primary-bg-hover`, current fills with `--interactive-bg-hover`, upcoming gets a dark border | |
|
|
60
|
+
| Focus | 1px ring in `--focus-ring` around the circle, edged with `--container-bg`, drawn with `box-shadow` | Never remove or restyle the focus ring. |
|
|
61
|
+
| Disabled | No hover, default cursor | Steps that aren't clickable are disabled buttons: every step when there's no `onStepClick`. |
|
|
62
|
+
|
|
63
|
+
Connectors are `--spacing-xxs` halved, which is 0 in compact density, so in compact the steps show as unconnected circles. Don't draw your own connectors; it's a source bug.
|
|
64
|
+
|
|
65
|
+
## 7. Content guidelines
|
|
66
|
+
|
|
67
|
+
- Title each step with one or two words for its task: "Shipping", "Payment", "Review".
|
|
68
|
+
- Keep titles parallel: all nouns, or all verbs.
|
|
69
|
+
- Use a description only when the title needs help: "Where should we send it?"
|
|
70
|
+
- Make the last step the check before committing: "Review" or "Confirm".
|
|
71
|
+
- Use sentence case.
|
|
72
|
+
|
|
73
|
+
| Do | Don't |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| Shipping | Step 1 |
|
|
76
|
+
| Payment | Enter your payment details below |
|
|
77
|
+
| Review | Done! |
|
|
78
|
+
|
|
79
|
+
## 8. Rules
|
|
80
|
+
|
|
81
|
+
1. `currentStep` is a zero-based index. Set it to `steps.length` to show every step completed.
|
|
82
|
+
2. Give every step a unique, stable `id`; it's the React key.
|
|
83
|
+
3. To let users go back but not skip ahead, pass `onStepClick` with `allowClickOnCompleted={false}`. With the default `true`, every step, upcoming ones included, is clickable as soon as `onStepClick` is set.
|
|
84
|
+
4. Leave `onStepClick` off for a display-only stepper. Every indicator is then a disabled button.
|
|
85
|
+
5. Check the current step is valid before you advance. Stepper doesn't validate; your Continue button and `onStepClick` decide whether `currentStep` changes.
|
|
86
|
+
6. Render one `StepperContent` per step with the same `currentStep`, and put Back and Continue [Buttons](./button.md) in your own footer.
|
|
87
|
+
7. Keep form state above `StepperContent`. It unmounts every step except the current one, so state held inside a step is lost when the user moves on.
|
|
88
|
+
8. Never pass `className` or `style`; they're dropped. Put width on a wrapper.
|
|
89
|
+
|
|
90
|
+
## 9. Dos and don'ts
|
|
91
|
+
|
|
92
|
+
**Do:** allow going back to completed steps only.
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
<Stepper
|
|
96
|
+
steps={checkoutSteps}
|
|
97
|
+
currentStep={current}
|
|
98
|
+
onStepClick={setCurrent}
|
|
99
|
+
allowClickOnCompleted={false}
|
|
100
|
+
/>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Don't:** let users jump ahead past steps they haven't finished.
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
<Stepper steps={checkoutSteps} currentStep={current} onStepClick={setCurrent} />
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Do:** keep the wizard's data above the steps.
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
const [address, setAddress] = useState<Address | null>(null);
|
|
113
|
+
|
|
114
|
+
<StepperContent step={0} currentStep={current}>
|
|
115
|
+
<ShippingForm value={address} onChange={setAddress} />
|
|
116
|
+
</StepperContent>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Don't:** keep step data inside the step; it's lost when the step unmounts.
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
<StepperContent step={0} currentStep={current}>
|
|
123
|
+
<ShippingFormWithOwnState />
|
|
124
|
+
</StepperContent>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## 10. Accessibility
|
|
128
|
+
|
|
129
|
+
- Role: the root is a plain `<div>` with no list or group semantics. Each indicator is a native `<button>`; the current one has `aria-current="step"`.
|
|
130
|
+
- Label: each indicator is named from its title, plus "(completed)" or "(current step)"; upcoming steps get the title alone. Descriptions aren't part of the name. Wrap the Stepper in an element you own that names it, for example `<nav aria-label="Checkout steps">` when steps are clickable.
|
|
131
|
+
- Keyboard: Tab moves between clickable indicators; Enter and Space activate them. Disabled indicators are skipped.
|
|
132
|
+
- Focus: Stepper doesn't move focus when `currentStep` changes. After the user advances, move focus to the new step's heading so keyboard and screen reader users land on the new content.
|
|
133
|
+
- Contrast: handled by the theme. Don't override colours.
|
|
134
|
+
|
|
135
|
+
## 11. Behaviour
|
|
136
|
+
|
|
137
|
+
- Responsive: horizontal steps sit in one row and don't wrap; connectors stretch to fill the space between them, down to `--size-sm`. Switch to `orientation="vertical"` in narrow containers.
|
|
138
|
+
- Overflow and truncation: titles and descriptions wrap; nothing truncates. Keep titles short.
|
|
139
|
+
- Vertical: the connector runs down from the centre of the indicator, at least `--spacing-xl` tall.
|
|
140
|
+
- Motion: indicator and connector colours transition over 150ms. Don't add your own.
|
|
141
|
+
|
|
142
|
+
## 12. API
|
|
143
|
+
|
|
144
|
+
<!-- api:start -->
|
|
145
|
+
### Stepper
|
|
146
|
+
|
|
147
|
+
| Prop | Type | Default | Description |
|
|
148
|
+
| --- | --- | --- | --- |
|
|
149
|
+
| `steps` | `Step[]` | required | The steps, in order. |
|
|
150
|
+
| `currentStep` | `number` | required | Zero-based index of the current step. Earlier steps show as completed. |
|
|
151
|
+
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | Layout direction. |
|
|
152
|
+
| `onStepClick` | `(step: number) => void` | | Makes steps clickable; receives the clicked index. |
|
|
153
|
+
| `allowClickOnCompleted` | `boolean` | `true` | With `onStepClick`: `true` makes every step clickable, `false` only completed steps. |
|
|
154
|
+
| `...props` | `HTMLAttributes<HTMLDivElement>` without `className`, `style` | | `id`, `aria-*`. The ref goes to the root `<div>`. |
|
|
155
|
+
|
|
156
|
+
### Step
|
|
157
|
+
|
|
158
|
+
| Prop | Type | Default | Description |
|
|
159
|
+
| --- | --- | --- | --- |
|
|
160
|
+
| `id` | `string` | required | Unique, stable key. |
|
|
161
|
+
| `title` | `string` | required | Visible title and the indicator's accessible name. |
|
|
162
|
+
| `description` | `string` | | Muted text under the title. |
|
|
163
|
+
| `icon` | `ReactNode` | | Replaces the number in the indicator until the step is completed. |
|
|
164
|
+
|
|
165
|
+
### StepperContent
|
|
166
|
+
|
|
167
|
+
| Prop | Type | Default | Description |
|
|
168
|
+
| --- | --- | --- | --- |
|
|
169
|
+
| `step` | `number` | required | The step index this panel belongs to. |
|
|
170
|
+
| `currentStep` | `number` | required | The Stepper's current step. The panel renders only when they match. |
|
|
171
|
+
| `...props` | `HTMLAttributes<HTMLDivElement>` without `className`, `style` | | `children`, `id`, `aria-*`. The ref goes to the panel `<div>`. |
|
|
172
|
+
<!-- api:end -->
|
|
173
|
+
|
|
174
|
+
## 13. Examples
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
import { useState } from "react";
|
|
178
|
+
import { Button, Stepper, StepperContent, Typography } from "@eluan/core";
|
|
179
|
+
|
|
180
|
+
const checkoutSteps = [
|
|
181
|
+
{ id: "shipping", title: "Shipping", description: "Where should we send it?" },
|
|
182
|
+
{ id: "payment", title: "Payment" },
|
|
183
|
+
{ id: "review", title: "Review" },
|
|
184
|
+
];
|
|
185
|
+
|
|
186
|
+
export function CheckoutWizard({ onPlaceOrder }: { onPlaceOrder: () => void }) {
|
|
187
|
+
const [current, setCurrent] = useState(0);
|
|
188
|
+
const isLast = current === checkoutSteps.length - 1;
|
|
189
|
+
|
|
190
|
+
return (
|
|
191
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-xl)", width: "100%" }}>
|
|
192
|
+
<nav aria-label="Checkout steps">
|
|
193
|
+
<Stepper
|
|
194
|
+
steps={checkoutSteps}
|
|
195
|
+
currentStep={current}
|
|
196
|
+
onStepClick={setCurrent}
|
|
197
|
+
allowClickOnCompleted={false}
|
|
198
|
+
/>
|
|
199
|
+
</nav>
|
|
200
|
+
|
|
201
|
+
<StepperContent step={0} currentStep={current}>
|
|
202
|
+
<Typography variant="heading" size="lg">Shipping address</Typography>
|
|
203
|
+
</StepperContent>
|
|
204
|
+
<StepperContent step={1} currentStep={current}>
|
|
205
|
+
<Typography variant="heading" size="lg">Payment method</Typography>
|
|
206
|
+
</StepperContent>
|
|
207
|
+
<StepperContent step={2} currentStep={current}>
|
|
208
|
+
<Typography variant="heading" size="lg">Review your order</Typography>
|
|
209
|
+
</StepperContent>
|
|
210
|
+
|
|
211
|
+
<div style={{ display: "flex", justifyContent: "flex-end", gap: "var(--spacing-sm)" }}>
|
|
212
|
+
{current > 0 && (
|
|
213
|
+
<Button type="button" variant="outline" onClick={() => setCurrent(current - 1)}>
|
|
214
|
+
Back
|
|
215
|
+
</Button>
|
|
216
|
+
)}
|
|
217
|
+
<Button type="button" onClick={() => (isLast ? onPlaceOrder() : setCurrent(current + 1))}>
|
|
218
|
+
{isLast ? "Place order" : "Continue"}
|
|
219
|
+
</Button>
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## 14. Related components
|
|
227
|
+
|
|
228
|
+
- [Tabs](./tabs.md): independent views with no order.
|
|
229
|
+
- [Progress](./progress.md): a percentage instead of named steps.
|
|
230
|
+
- [Button](./button.md): Back and Continue in the wizard footer.
|
|
231
|
+
- [Fieldset](./fieldset.md): group the fields inside each step.
|
|
232
|
+
- See [patterns/forms.md](../patterns/forms.md) for the fields inside each step.
|
|
233
|
+
|
|
234
|
+
## 15. Common agent mistakes
|
|
235
|
+
|
|
236
|
+
_Filled from evals._
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Switch
|
|
3
|
+
use_when: Turning a setting on or off where the change takes effect immediately, such as notifications or a feature flag.
|
|
4
|
+
instead_of: Checkbox for choices the user submits with a form; Toggle for a pressed toolbar button; RadioGroup or SegmentedControl for more than two options.
|
|
5
|
+
source: packages/core/src/components/switch.tsx
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Switch
|
|
9
|
+
|
|
10
|
+
## 1. Overview
|
|
11
|
+
|
|
12
|
+
Switch is an on/off control built on Radix Switch, meant for boolean settings that apply immediately. It renders a `<button role="switch">` with a sliding thumb. It has no label of its own: pair it with a Label.
|
|
13
|
+
|
|
14
|
+
## 2. When to use
|
|
15
|
+
|
|
16
|
+
- A setting that applies the moment it's flipped: "Marketing emails", "Security emails", "Airplane mode".
|
|
17
|
+
- A list of independent settings, one per row, each with a label and a short description.
|
|
18
|
+
|
|
19
|
+
### When not to use
|
|
20
|
+
|
|
21
|
+
- A choice the user confirms later with a submit button → use [Checkbox](./checkbox.md).
|
|
22
|
+
- A pressed/unpressed button in a toolbar → use [Toggle](./toggle.md).
|
|
23
|
+
- More than two options → use [RadioGroup](./radio-group.md) or [SegmentedControl](./segmented-control.md).
|
|
24
|
+
- A one-off action → use [Button](./button.md).
|
|
25
|
+
|
|
26
|
+
## 3. Anatomy
|
|
27
|
+
|
|
28
|
+
1. **Track**: the `<button role="switch">`. `--size-lg` wide, `--size-xs` tall, fully rounded, with a 2px border in the track colour.
|
|
29
|
+
2. **Thumb**: a `--size-xxs` tall pill in `--interactive-bg` that slides to the end when on.
|
|
30
|
+
3. **Hidden input**: inside a `<form>`, Radix adds a hidden native checkbox so `name` and `value` submit with the form.
|
|
31
|
+
4. **Label** (yours): a Label with `htmlFor` matching the Switch `id`, and an optional description.
|
|
32
|
+
|
|
33
|
+
## 4. Variants
|
|
34
|
+
|
|
35
|
+
Switch has no variants.
|
|
36
|
+
|
|
37
|
+
## 5. Sizes
|
|
38
|
+
|
|
39
|
+
Switch has no `size` prop. The track is `--size-lg` by `--size-xs` and follows density.
|
|
40
|
+
|
|
41
|
+
## 6. States
|
|
42
|
+
|
|
43
|
+
| State | Looks like | Notes |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| Off | Track and border in `--interactive-border-alt`, thumb at the start | |
|
|
46
|
+
| On | Track and border in `--interactive-bg-selected`, thumb at the end | |
|
|
47
|
+
| Focus | 1px outline in `--focus-ring`, 1px offset | Never remove or restyle the focus ring. |
|
|
48
|
+
| Disabled | Track fill switches to `--interactive-bg-disabled`, not-allowed cursor; the thumb stays on its side | Disable its Label too. |
|
|
49
|
+
| Loading | No built-in loading state | While a save is in flight, keep the new position, set `aria-busy` and `aria-disabled`, and ignore further toggles until it settles. Don't set `disabled`: it drops keyboard focus from the switch the user just pressed. Revert if the save fails. |
|
|
50
|
+
|
|
51
|
+
There's no hover style.
|
|
52
|
+
|
|
53
|
+
## 7. Content guidelines
|
|
54
|
+
|
|
55
|
+
- Label the setting, not the action: "Marketing emails", not "Turn on marketing emails".
|
|
56
|
+
- Don't add "On" or "Off" text beside the switch; the thumb position shows the state.
|
|
57
|
+
- Use a description for one sentence on the effect: "Receive emails about new products."
|
|
58
|
+
|
|
59
|
+
| Do | Don't |
|
|
60
|
+
| --- | --- |
|
|
61
|
+
| Marketing emails | Enable marketing emails? |
|
|
62
|
+
| Receive emails about account activity. | When this is on, we will send you emails about account activity. |
|
|
63
|
+
| Two-factor authentication | 2FA ON |
|
|
64
|
+
|
|
65
|
+
## 8. Rules
|
|
66
|
+
|
|
67
|
+
1. Pair every Switch with a Label whose `htmlFor` matches its `id`, or give it `aria-label`.
|
|
68
|
+
2. Apply the change in `onCheckedChange` straight away. Don't wait for a submit button; if the change needs confirming, use a Checkbox in the form instead.
|
|
69
|
+
3. `onCheckedChange` receives a `boolean`. Switch has no `onChange` or `onValueChange`.
|
|
70
|
+
4. Control it with `checked` and `onCheckedChange` together, or leave it uncontrolled with `defaultChecked`.
|
|
71
|
+
5. In a settings list, put the label and description first and the Switch at the end of the row. For a single compact toggle, the Switch can come first with the Label after it.
|
|
72
|
+
6. Never pass `className` or `style`; they're dropped.
|
|
73
|
+
|
|
74
|
+
## 9. Dos and don'ts
|
|
75
|
+
|
|
76
|
+
**Do:** label the setting and save on change.
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
<div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: "var(--spacing-lg)" }}>
|
|
80
|
+
<Label htmlFor="marketing-emails">Marketing emails</Label>
|
|
81
|
+
<Switch id="marketing-emails" checked={marketing} onCheckedChange={saveMarketing} />
|
|
82
|
+
</div>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Don't:** use a Switch that only takes effect after a Save button.
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
<form onSubmit={save}>
|
|
89
|
+
<Switch id="marketing-emails" name="marketing" />
|
|
90
|
+
<Label htmlFor="marketing-emails">Marketing emails</Label>
|
|
91
|
+
<Button type="submit">Save</Button>
|
|
92
|
+
</form>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Do:** let the thumb show the state.
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
<Switch id="two-factor" checked={enabled} onCheckedChange={setEnabled} />
|
|
99
|
+
<Label htmlFor="two-factor">Two-factor authentication</Label>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Don't:** add state text or an unlabelled switch.
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
<Switch checked={enabled} onCheckedChange={setEnabled} />
|
|
106
|
+
<span>{enabled ? "ON" : "OFF"}</span>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## 10. Accessibility
|
|
110
|
+
|
|
111
|
+
- Role: `switch` (Radix renders a `<button>`), with `aria-checked`.
|
|
112
|
+
- Label: a Label with `htmlFor` matching the Switch `id`, or `aria-label`. Link a description with `aria-describedby`.
|
|
113
|
+
- Keyboard: Space and Enter toggle (native button behaviour). Tab moves between switches.
|
|
114
|
+
- Focus: visible outline on `:focus-visible`. Disabled switches use the native `disabled` attribute and are skipped by Tab.
|
|
115
|
+
- Contrast: handled by the theme. Don't override colours.
|
|
116
|
+
|
|
117
|
+
## 11. Behaviour
|
|
118
|
+
|
|
119
|
+
- Responsive: fixed size; it doesn't shrink beside long labels. In settings rows, spread the label and switch with `justifyContent: "space-between"` and a `--spacing-lg` gap, as the settings story does.
|
|
120
|
+
- Motion: the thumb slides and the track changes colour over 150ms. Don't add your own.
|
|
121
|
+
- Forms: inside a `<form>`, a hidden input submits `value` (default `"on"`) under `name` when on.
|
|
122
|
+
|
|
123
|
+
## 12. API
|
|
124
|
+
|
|
125
|
+
<!-- api:start -->
|
|
126
|
+
| Prop | Type | Default | Description |
|
|
127
|
+
| --- | --- | --- | --- |
|
|
128
|
+
| `checked` | `boolean` | | Controlled state. Pair with `onCheckedChange`. |
|
|
129
|
+
| `defaultChecked` | `boolean` | | Uncontrolled starting state. |
|
|
130
|
+
| `onCheckedChange` | `(checked: boolean) => void` | | Called when the user flips it. |
|
|
131
|
+
| `disabled` | `boolean` | `false` | Prevents interaction. |
|
|
132
|
+
| `required` | `boolean` | `false` | Marks it required for form validation. |
|
|
133
|
+
| `name` | `string` | | Field name for form submission. |
|
|
134
|
+
| `value` | `string` | `"on"` | Value submitted when on. |
|
|
135
|
+
| `id` | `string` | | Match it with the Label's `htmlFor`. |
|
|
136
|
+
| `...props` | Radix `Switch.Root` props without `className`, `style` | | Button attributes and `aria-*`. `ref` goes to the `<button>`. |
|
|
137
|
+
<!-- api:end -->
|
|
138
|
+
|
|
139
|
+
## 13. Examples
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
import { Label, Switch, Typography } from "@eluan/core";
|
|
143
|
+
import * as React from "react";
|
|
144
|
+
|
|
145
|
+
type Setting = { id: string; label: string; description: string };
|
|
146
|
+
|
|
147
|
+
const settings: Setting[] = [
|
|
148
|
+
{ id: "marketing-emails", label: "Marketing emails", description: "Receive emails about new products." },
|
|
149
|
+
{ id: "security-emails", label: "Security emails", description: "Receive emails about account activity." },
|
|
150
|
+
];
|
|
151
|
+
|
|
152
|
+
const row = {
|
|
153
|
+
display: "flex",
|
|
154
|
+
alignItems: "center",
|
|
155
|
+
justifyContent: "space-between",
|
|
156
|
+
gap: "var(--spacing-lg)",
|
|
157
|
+
} as const;
|
|
158
|
+
const copy = { display: "flex", flexDirection: "column", gap: "var(--spacing-xxs)" } as const;
|
|
159
|
+
|
|
160
|
+
export function EmailSettings({
|
|
161
|
+
initial,
|
|
162
|
+
onSave,
|
|
163
|
+
}: {
|
|
164
|
+
initial: Record<string, boolean>;
|
|
165
|
+
onSave: (id: string, enabled: boolean) => Promise<void>;
|
|
166
|
+
}) {
|
|
167
|
+
const [values, setValues] = React.useState(initial);
|
|
168
|
+
const [saving, setSaving] = React.useState<string | null>(null);
|
|
169
|
+
|
|
170
|
+
async function handleChange(id: string, enabled: boolean) {
|
|
171
|
+
if (saving === id) return;
|
|
172
|
+
setValues((current) => ({ ...current, [id]: enabled }));
|
|
173
|
+
setSaving(id);
|
|
174
|
+
try {
|
|
175
|
+
await onSave(id, enabled);
|
|
176
|
+
} catch {
|
|
177
|
+
setValues((current) => ({ ...current, [id]: !enabled }));
|
|
178
|
+
} finally {
|
|
179
|
+
setSaving(null);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-lg)" }}>
|
|
185
|
+
{settings.map((setting) => (
|
|
186
|
+
<div key={setting.id} style={row}>
|
|
187
|
+
<div style={copy}>
|
|
188
|
+
<Label htmlFor={setting.id}>{setting.label}</Label>
|
|
189
|
+
<Typography id={`${setting.id}-description`} variant="caption" tone="muted">
|
|
190
|
+
{setting.description}
|
|
191
|
+
</Typography>
|
|
192
|
+
</div>
|
|
193
|
+
<Switch
|
|
194
|
+
id={setting.id}
|
|
195
|
+
checked={values[setting.id] ?? false}
|
|
196
|
+
onCheckedChange={(enabled) => handleChange(setting.id, enabled)}
|
|
197
|
+
aria-busy={saving === setting.id || undefined}
|
|
198
|
+
aria-disabled={saving === setting.id || undefined}
|
|
199
|
+
aria-describedby={`${setting.id}-description`}
|
|
200
|
+
/>
|
|
201
|
+
</div>
|
|
202
|
+
))}
|
|
203
|
+
</div>
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## 14. Related components
|
|
209
|
+
|
|
210
|
+
- [Checkbox](./checkbox.md): an on/off choice submitted with a form.
|
|
211
|
+
- [Toggle](./toggle.md): a button that stays pressed.
|
|
212
|
+
- [Label](./form-label.md): the Label beside each switch.
|
|
213
|
+
- [Toast](./toast.md): tells the user a setting failed to save.
|
|
214
|
+
- See [../patterns/forms.md](../patterns/forms.md) for when to use Switch or Checkbox.
|
|
215
|
+
|
|
216
|
+
## 15. Common agent mistakes
|
|
217
|
+
|
|
218
|
+
- Setting `disabled` on a switch while its change saves. Focus leaves the switch the user just toggled, so a keyboard user loses their place. Set `aria-busy` and `aria-disabled` and ignore toggles until the save settles.
|