@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,255 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: DatePicker
|
|
3
|
+
use_when: The user picks one date (DatePicker) or a start and end date (DateRangePicker) in a form or filter bar.
|
|
4
|
+
instead_of: Input type=date or a hand-built Popover and Calendar; DateTimePicker when a time is needed; TimeInput for a time alone; Calendar for an always-visible grid.
|
|
5
|
+
source: packages/core/src/components/date-picker.tsx
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# DatePicker
|
|
9
|
+
|
|
10
|
+
## 1. Overview
|
|
11
|
+
|
|
12
|
+
DatePicker is a field-style trigger that opens a Calendar in a Popover. The module exports two components: `DatePicker` for one date and `DateRangePicker` for a start and end date. The trigger shows the formatted value, or a placeholder when empty.
|
|
13
|
+
|
|
14
|
+
This file is also where to choose between Eluan's date and time components.
|
|
15
|
+
|
|
16
|
+
## 2. When to use
|
|
17
|
+
|
|
18
|
+
Pick the component by what the user is choosing:
|
|
19
|
+
|
|
20
|
+
| The user picks… | Use |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| One date in a form or filter: due date, start date | `DatePicker` |
|
|
23
|
+
| A start and end date: report period, booking, a date filter in a toolbar | `DateRangePicker` |
|
|
24
|
+
| One moment with a time of day: scheduled send, meeting start | [DateTimePicker](./date-time-picker.md) |
|
|
25
|
+
| A time of day with no date: opening hours, daily reminder | [TimeInput](./time-input.md) |
|
|
26
|
+
| A date on an always-visible month grid, or several separate dates | [Calendar](./calendar.md) |
|
|
27
|
+
|
|
28
|
+
- A filter bar with a date range uses `DateRangePicker`, next to Select filters and an `outline` reset Button.
|
|
29
|
+
|
|
30
|
+
### When not to use
|
|
31
|
+
|
|
32
|
+
- The time of day matters → use [DateTimePicker](./date-time-picker.md).
|
|
33
|
+
- Only a time → use [TimeInput](./time-input.md).
|
|
34
|
+
- The grid should stay visible, or the user picks several separate dates → use [Calendar](./calendar.md) inline.
|
|
35
|
+
- A birth date or any date many years away → use an [Input](./input.md) with a format hint. The year Select inside the calendar only lists ten years around the current one.
|
|
36
|
+
|
|
37
|
+
## 3. Anatomy
|
|
38
|
+
|
|
39
|
+
1. **Trigger**: a full-width Button in the `input` variant (`inputMuted` while empty), with a leading calendar icon and the value or placeholder text.
|
|
40
|
+
2. **Popover**: opens below the trigger, aligned to its start edge.
|
|
41
|
+
3. **Calendar**: one month for `DatePicker`, two months side by side for `DateRangePicker`. See [Calendar](./calendar.md).
|
|
42
|
+
|
|
43
|
+
## 4. Variants
|
|
44
|
+
|
|
45
|
+
There's no `variant` prop. Choose the component:
|
|
46
|
+
|
|
47
|
+
| Component | Use for |
|
|
48
|
+
| --- | --- |
|
|
49
|
+
| `DatePicker` | One date. Closes as soon as a date is picked. |
|
|
50
|
+
| `DateRangePicker` | A start and end date. Shows two months and stays open until the user presses Escape or clicks outside. |
|
|
51
|
+
|
|
52
|
+
## 5. Sizes
|
|
53
|
+
|
|
54
|
+
No size prop. The trigger is a default-size Button (`--size-lg` tall) and always fills its container's width. Set the width on a wrapper.
|
|
55
|
+
|
|
56
|
+
## 6. States
|
|
57
|
+
|
|
58
|
+
| State | Looks like | Notes |
|
|
59
|
+
| --- | --- | --- |
|
|
60
|
+
| Empty | Placeholder in `--interactive-fg-alt` next to the calendar icon | |
|
|
61
|
+
| Filled | Formatted value in `--interactive-fg` | Range shows "from - to"; after the first click both ends are the same day. |
|
|
62
|
+
| Hover | Trigger background fills | |
|
|
63
|
+
| Focus | 1px outline in `--focus-ring`, 1px offset | Never remove or restyle the focus ring. |
|
|
64
|
+
| Open | Popover below the trigger; focus moves into the calendar | |
|
|
65
|
+
| Disabled | `--interactive-bg-disabled` fill, `--interactive-fg-disabled` text; skipped by Tab | |
|
|
66
|
+
| Error | No built-in error state | Put a FormMessage under the picker and reference it with `aria-describedby` on the group wrapper (see Rules). |
|
|
67
|
+
| Range across months | A selected day from the adjacent month is close to invisible | DateRangePicker always shows outside days and has no prop to hide them; don't patch it. |
|
|
68
|
+
|
|
69
|
+
## 7. Content guidelines
|
|
70
|
+
|
|
71
|
+
- Write the placeholder as what to pick: "Pick a due date", "Any date". It is not a label; add one anyway.
|
|
72
|
+
- Keep the year in `dateFormat`. The defaults are `"PPP"` ("October 27th, 2026") for DatePicker and `"LLL dd, y"` ("Oct 27, 2026") for each end of a range.
|
|
73
|
+
- Prefer formats with a month name over all-number formats such as `"MM/dd/yyyy"`, which read differently by region.
|
|
74
|
+
- Trigger text is English: `dateFormat` uses date-fns without a locale.
|
|
75
|
+
|
|
76
|
+
| Do | Don't |
|
|
77
|
+
| --- | --- |
|
|
78
|
+
| Pick a due date | Click to select |
|
|
79
|
+
| Any date | dd/mm/yyyy |
|
|
80
|
+
|
|
81
|
+
## 8. Rules
|
|
82
|
+
|
|
83
|
+
1. Control the value: pass `value` and `onValueChange`. The pickers keep no value of their own, so without `value` the trigger keeps showing the placeholder.
|
|
84
|
+
2. Label every picker. The trigger accepts no `id` or `aria-label`, so `Label htmlFor` can't reach it: give the Label an `id` and wrap the picker in `<div role="group" aria-labelledby="…">`. Add `aria-describedby` there for a hint or error.
|
|
85
|
+
3. Handle `undefined` from `DateRangePicker`. Its `onValueChange` is typed as always passing a range, but clicking the single selected day again clears it and passes `undefined`. Fall back to an empty range.
|
|
86
|
+
4. Set width on a wrapper; the trigger always stretches to fill it.
|
|
87
|
+
5. Use `DateRangePicker` for a period, not two DatePickers.
|
|
88
|
+
6. For native form submission, add your own `<input type="hidden">` with the date as an ISO string; the pickers have no `name`.
|
|
89
|
+
7. Never pass `className` or `style`; the props don't accept them.
|
|
90
|
+
|
|
91
|
+
## 9. Dos and don'ts
|
|
92
|
+
|
|
93
|
+
**Do:** control the value and name the field.
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-sm)" }}>
|
|
97
|
+
<Label id="due-date-label" required>Due date</Label>
|
|
98
|
+
<div role="group" aria-labelledby="due-date-label">
|
|
99
|
+
<DatePicker value={dueDate} onValueChange={setDueDate} placeholder="Pick a due date" />
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Don't:** leave it uncontrolled or rely on the placeholder as the label.
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
<DatePicker placeholder="Due date" />
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Do:** guard against a cleared range.
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
<DateRangePicker value={range} onValueChange={(next) => setRange(next ?? { from: undefined, to: undefined })} />
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Don't:** build your own Popover and Calendar for a plain date field.
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
<Popover>
|
|
120
|
+
<PopoverTrigger asChild><Button variant="input">{label}</Button></PopoverTrigger>
|
|
121
|
+
<PopoverContent><Calendar mode="single" selected={day} onSelect={setDay} /></PopoverContent>
|
|
122
|
+
</Popover>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## 10. Accessibility
|
|
126
|
+
|
|
127
|
+
- Role: the trigger is a `button` with `aria-haspopup="dialog"` and `aria-expanded` (Radix Popover); the open panel is a `dialog`. The calendar inside is a `grid` (see [Calendar](./calendar.md)).
|
|
128
|
+
- Label: the trigger's name is its text, the formatted date or the placeholder. Name the field with a visible label and a `role="group"` wrapper (Rules 2).
|
|
129
|
+
- Keyboard: Enter or Space opens the popover. Inside, the calendar's arrow, Page Up/Down and Home/End keys apply, and Enter or Space picks. Escape closes.
|
|
130
|
+
- Focus: on open, focus moves to the selected day, or today. The popover doesn't trap focus. On close, focus returns to the trigger.
|
|
131
|
+
- Contrast: handled by the theme. Don't override colours.
|
|
132
|
+
|
|
133
|
+
## 11. Behaviour
|
|
134
|
+
|
|
135
|
+
- Responsive: the trigger fills its container. DatePicker's popover matches the trigger's width (never narrower than the calendar), so a wider trigger stretches the grid. DateRangePicker's popover sizes to its two months, which stack below a 640px viewport.
|
|
136
|
+
- Picking a range: the first click selects a one-day range; the next click before or after it extends the range.
|
|
137
|
+
- Opening month: DateRangePicker opens on the month of `value.from`. DatePicker always opens on the current month, even when its value is in another month.
|
|
138
|
+
- Clearing: clicking the selected date again clears it. DatePicker then calls `onValueChange(undefined)` and closes.
|
|
139
|
+
- Overflow and truncation: the trigger text doesn't wrap. Give a range picker room for both dates.
|
|
140
|
+
- Motion: none of its own. Don't add any.
|
|
141
|
+
|
|
142
|
+
## 12. API
|
|
143
|
+
|
|
144
|
+
<!-- api:start -->
|
|
145
|
+
### DatePicker
|
|
146
|
+
|
|
147
|
+
| Prop | Type | Default | Description |
|
|
148
|
+
| --- | --- | --- | --- |
|
|
149
|
+
| `value` | `Date` | | The selected date. |
|
|
150
|
+
| `onValueChange` | `(date: Date \| undefined) => void` | | Called when a date is picked, with `undefined` when it's cleared. |
|
|
151
|
+
| `placeholder` | `string` | `"Pick a date"` | Trigger text while empty. |
|
|
152
|
+
| `dateFormat` | `string` | `"PPP"` | date-fns format for the trigger text. |
|
|
153
|
+
| `disabled` | `boolean` | `false` | Disables the trigger. |
|
|
154
|
+
| `ref` | `Ref<HTMLButtonElement>` | | Forwarded to the trigger button. |
|
|
155
|
+
|
|
156
|
+
### DateRangePicker
|
|
157
|
+
|
|
158
|
+
| Prop | Type | Default | Description |
|
|
159
|
+
| --- | --- | --- | --- |
|
|
160
|
+
| `value` | `{ from: Date \| undefined; to: Date \| undefined }` | | The selected range. |
|
|
161
|
+
| `onValueChange` | `(range: { from: Date \| undefined; to: Date \| undefined }) => void` | | Called on every pick. Receives `undefined` when the range is cleared, despite the type. |
|
|
162
|
+
| `placeholder` | `string` | `"Pick a date range"` | Trigger text while empty. |
|
|
163
|
+
| `dateFormat` | `string` | `"LLL dd, y"` | date-fns format for each end of the range. |
|
|
164
|
+
| `disabled` | `boolean` | `false` | Disables the trigger. |
|
|
165
|
+
| `ref` | `Ref<HTMLButtonElement>` | | Forwarded to the trigger button. |
|
|
166
|
+
|
|
167
|
+
Neither component accepts other props: no `id`, `name`, `aria-*`, `className` or `style`.
|
|
168
|
+
<!-- api:end -->
|
|
169
|
+
|
|
170
|
+
## 13. Examples
|
|
171
|
+
|
|
172
|
+
A filter bar with a date range, a status filter and a reset action.
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
import * as React from "react";
|
|
176
|
+
import {
|
|
177
|
+
Button,
|
|
178
|
+
DateRangePicker,
|
|
179
|
+
Label,
|
|
180
|
+
Select,
|
|
181
|
+
SelectContent,
|
|
182
|
+
SelectItem,
|
|
183
|
+
SelectTrigger,
|
|
184
|
+
SelectValue,
|
|
185
|
+
} from "@eluan/core";
|
|
186
|
+
|
|
187
|
+
type Range = { from: Date | undefined; to: Date | undefined };
|
|
188
|
+
const anyDate: Range = { from: undefined, to: undefined };
|
|
189
|
+
|
|
190
|
+
export function OrderFilters() {
|
|
191
|
+
const [range, setRange] = React.useState<Range>(anyDate);
|
|
192
|
+
const [status, setStatus] = React.useState("all");
|
|
193
|
+
|
|
194
|
+
const field = { display: "flex", flexDirection: "column", gap: "var(--spacing-sm)" } as const;
|
|
195
|
+
|
|
196
|
+
return (
|
|
197
|
+
<div
|
|
198
|
+
style={{
|
|
199
|
+
display: "grid",
|
|
200
|
+
gridTemplateColumns: "2fr 1fr auto",
|
|
201
|
+
alignItems: "end",
|
|
202
|
+
gap: "var(--spacing-md)",
|
|
203
|
+
}}
|
|
204
|
+
>
|
|
205
|
+
<div style={field}>
|
|
206
|
+
<Label id="order-date-label">Order date</Label>
|
|
207
|
+
<div role="group" aria-labelledby="order-date-label">
|
|
208
|
+
<DateRangePicker
|
|
209
|
+
value={range}
|
|
210
|
+
onValueChange={(next) => setRange(next ?? anyDate)}
|
|
211
|
+
placeholder="Any date"
|
|
212
|
+
/>
|
|
213
|
+
</div>
|
|
214
|
+
</div>
|
|
215
|
+
<div style={field}>
|
|
216
|
+
<Label htmlFor="order-status">Status</Label>
|
|
217
|
+
<Select value={status} onValueChange={setStatus}>
|
|
218
|
+
<SelectTrigger id="order-status">
|
|
219
|
+
<SelectValue />
|
|
220
|
+
</SelectTrigger>
|
|
221
|
+
<SelectContent>
|
|
222
|
+
<SelectItem value="all">All statuses</SelectItem>
|
|
223
|
+
<SelectItem value="pending">Pending</SelectItem>
|
|
224
|
+
<SelectItem value="shipped">Shipped</SelectItem>
|
|
225
|
+
<SelectItem value="delivered">Delivered</SelectItem>
|
|
226
|
+
</SelectContent>
|
|
227
|
+
</Select>
|
|
228
|
+
</div>
|
|
229
|
+
<Button
|
|
230
|
+
type="button"
|
|
231
|
+
variant="outline"
|
|
232
|
+
onClick={() => {
|
|
233
|
+
setRange(anyDate);
|
|
234
|
+
setStatus("all");
|
|
235
|
+
}}
|
|
236
|
+
>
|
|
237
|
+
Reset filters
|
|
238
|
+
</Button>
|
|
239
|
+
</div>
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## 14. Related components
|
|
245
|
+
|
|
246
|
+
- [Calendar](./calendar.md): the grid inside both pickers; use it inline when the grid should stay visible.
|
|
247
|
+
- [DateTimePicker](./date-time-picker.md): the same trigger and popover with a time row.
|
|
248
|
+
- [TimeInput](./time-input.md): a time of day without a date.
|
|
249
|
+
- [Popover](./popover.md): the surface the pickers open in.
|
|
250
|
+
- [Label](./form-label.md): the visible label for each picker; see also [forms](../patterns/forms.md).
|
|
251
|
+
- [Select](./select.md): the other common control in a filter bar.
|
|
252
|
+
|
|
253
|
+
## 15. Common agent mistakes
|
|
254
|
+
|
|
255
|
+
_Filled from evals._
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: DateTimePicker
|
|
3
|
+
use_when: The user picks one moment, a date plus a time of day, such as a scheduled send or a meeting start.
|
|
4
|
+
instead_of: A DatePicker next to a separate TimeInput; DatePicker when the time doesn't matter; TimeInput for a time with no date.
|
|
5
|
+
source: packages/core/src/components/datetime-picker.tsx
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# DateTimePicker
|
|
9
|
+
|
|
10
|
+
## 1. Overview
|
|
11
|
+
|
|
12
|
+
DateTimePicker is a field-style trigger that opens a Popover holding a Calendar and, below a divider, a TimeInput. It emits one `Date` that carries both the day and the time. The module and docs slug are `datetime-picker`; the export is `DateTimePicker`.
|
|
13
|
+
|
|
14
|
+
## 2. When to use
|
|
15
|
+
|
|
16
|
+
- Scheduling something for an exact moment: publish at, send at, starts at, reminder at.
|
|
17
|
+
- Editing an existing timestamp where both parts can change.
|
|
18
|
+
|
|
19
|
+
### When not to use
|
|
20
|
+
|
|
21
|
+
- Only the day matters → use [DatePicker](./date-picker.md).
|
|
22
|
+
- A start and end date → use DateRangePicker, documented in [DatePicker](./date-picker.md).
|
|
23
|
+
- A time of day with no date (opening hours, a daily digest) → use [TimeInput](./time-input.md).
|
|
24
|
+
- The date should stay visible on the page → use [Calendar](./calendar.md) with a [TimeInput](./time-input.md) beside it.
|
|
25
|
+
|
|
26
|
+
## 3. Anatomy
|
|
27
|
+
|
|
28
|
+
1. **Trigger**: a full-width Button in the `input` variant (`inputMuted` while empty), with a leading calendar icon and the formatted date and time.
|
|
29
|
+
2. **Popover**: opens below the trigger, aligned to its start edge, as wide as the trigger.
|
|
30
|
+
3. **Calendar**: one month in single mode. See [Calendar](./calendar.md).
|
|
31
|
+
4. **Time row**: a [TimeInput](./time-input.md) under a `--container-border` divider, with hours, minutes, optional seconds and AM/PM toggles in 12-hour mode.
|
|
32
|
+
|
|
33
|
+
## 4. Variants
|
|
34
|
+
|
|
35
|
+
No `variant` prop. Two booleans set the time format:
|
|
36
|
+
|
|
37
|
+
| Props | Trigger shows | Time row |
|
|
38
|
+
| --- | --- | --- |
|
|
39
|
+
| default | October 27th, 2026 02:30 PM | Hours, minutes, AM/PM |
|
|
40
|
+
| `use24Hour` | October 27th, 2026 14:30 | Hours, minutes |
|
|
41
|
+
| `showSeconds` | October 27th, 2026 02:30:45 PM | Adds a seconds segment |
|
|
42
|
+
|
|
43
|
+
## 5. Sizes
|
|
44
|
+
|
|
45
|
+
No size prop. The trigger is a default-size Button (`--size-lg` tall) and always fills its container's width. Set the width on a wrapper.
|
|
46
|
+
|
|
47
|
+
## 6. States
|
|
48
|
+
|
|
49
|
+
| State | Looks like | Notes |
|
|
50
|
+
| --- | --- | --- |
|
|
51
|
+
| Empty | Placeholder in `--interactive-fg-alt` next to the calendar icon | |
|
|
52
|
+
| Filled | Formatted date and time in `--interactive-fg` | |
|
|
53
|
+
| Hover | Trigger background fills | |
|
|
54
|
+
| Focus | 1px outline in `--focus-ring`, 1px offset | Never remove or restyle the focus ring. |
|
|
55
|
+
| Open | Popover with the calendar and time row; focus moves into the calendar | |
|
|
56
|
+
| Disabled | `--interactive-bg-disabled` fill, `--interactive-fg-disabled` text; skipped by Tab | |
|
|
57
|
+
| Error | No built-in error state | Put a FormMessage under the picker and reference it with `aria-describedby` on the group wrapper. |
|
|
58
|
+
|
|
59
|
+
## 7. Content guidelines
|
|
60
|
+
|
|
61
|
+
- Name what the moment is for in the label: "Publish at", "Reminder".
|
|
62
|
+
- Say which time zone applies when it isn't obviously the user's own; the value is built in the browser's local time.
|
|
63
|
+
- Use `use24Hour` where your audience expects a 24-hour clock.
|
|
64
|
+
- The trigger format is fixed (`PPP` plus the time) and English; there is no `dateFormat` prop.
|
|
65
|
+
|
|
66
|
+
| Do | Don't |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| Publish at (UTC) | Date/time |
|
|
69
|
+
| Pick a send time | Select… |
|
|
70
|
+
|
|
71
|
+
## 8. Rules
|
|
72
|
+
|
|
73
|
+
1. Control the value: pass `value` and `onValueChange`, and keep the `Date` you receive.
|
|
74
|
+
2. Label every picker. The trigger accepts no `id` or `aria-label`: give the Label an `id` and wrap the picker in `<div role="group" aria-labelledby="…">`.
|
|
75
|
+
3. Expect frequent updates. `onValueChange` fires on every date pick and on every change in the time segments, so validate on blur or submit, not on each call.
|
|
76
|
+
4. Clear the value from outside. Clicking the selected date again does nothing, so offer your own Clear button that sets `value` to `undefined` when the field is optional.
|
|
77
|
+
5. Convert to the time zone your backend expects before sending; the `Date` is local.
|
|
78
|
+
6. Set width on a wrapper; the trigger always stretches to fill it.
|
|
79
|
+
7. Never pass `className` or `style`; the props don't accept them.
|
|
80
|
+
|
|
81
|
+
## 9. Dos and don'ts
|
|
82
|
+
|
|
83
|
+
**Do:** use one DateTimePicker for one moment.
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
<div role="group" aria-labelledby="publish-at-label">
|
|
87
|
+
<DateTimePicker value={publishAt} onValueChange={setPublishAt} placeholder="Pick a publish time" />
|
|
88
|
+
</div>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Don't:** split one moment into a DatePicker and a separate TimeInput.
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
<DatePicker value={day} onValueChange={setDay} />
|
|
95
|
+
<TimeInput value={time} onValueChange={setTime} />
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Do:** offer a clear action when the field is optional.
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
<Button type="button" variant="ghost" size="sm" onClick={() => setRemindAt(undefined)}>
|
|
102
|
+
Remove reminder
|
|
103
|
+
</Button>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Don't:** expect clicking the selected day to clear it.
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
<DateTimePicker value={remindAt} onValueChange={(next) => setRemindAt(next)} />
|
|
110
|
+
// next is never undefined from the popover
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## 10. Accessibility
|
|
114
|
+
|
|
115
|
+
- Role: the trigger is a `button` with `aria-haspopup="dialog"` and `aria-expanded` (Radix Popover); the panel is a `dialog` holding a calendar `grid` and the time inputs.
|
|
116
|
+
- Label: the trigger's name is its text, the formatted value or the placeholder. Name the field with a visible label and a `role="group"` wrapper (Rules 2). The time segments are named "Hours", "Minutes" and "Seconds"; the period toggles "AM" and "PM".
|
|
117
|
+
- Keyboard: Enter or Space opens. In the calendar, arrow keys, Page Up/Down and Home/End move and Enter picks. Tab moves on to the time segments, where digits type, Up and Down step, and `:` jumps to the next segment. Escape closes.
|
|
118
|
+
- Focus: on open, focus moves to the selected day, or today. Picking a date keeps the popover open so the user can go on to the time. The popover doesn't trap focus. On close, focus returns to the trigger.
|
|
119
|
+
- Contrast: handled by the theme. Don't override colours.
|
|
120
|
+
|
|
121
|
+
## 11. Behaviour
|
|
122
|
+
|
|
123
|
+
- Picking a date keeps the time already chosen. With no earlier value, the time starts at midnight.
|
|
124
|
+
- Changing the time before picking a date applies it to today.
|
|
125
|
+
- The popover stays open after a date pick; it closes on Escape or a click outside.
|
|
126
|
+
- The calendar always opens on the current month, even when the value is in another month.
|
|
127
|
+
- Responsive: the trigger fills its container; the popover matches the trigger's width (never narrower than the calendar), so a wider trigger stretches the grid.
|
|
128
|
+
- Overflow and truncation: the trigger text doesn't wrap. Leave room for the full date and time.
|
|
129
|
+
- Motion: none of its own. Don't add any.
|
|
130
|
+
|
|
131
|
+
## 12. API
|
|
132
|
+
|
|
133
|
+
<!-- api:start -->
|
|
134
|
+
| Prop | Type | Default | Description |
|
|
135
|
+
| --- | --- | --- | --- |
|
|
136
|
+
| `value` | `Date` | | The selected date and time. |
|
|
137
|
+
| `onValueChange` | `(date: Date \| undefined) => void` | | Called with a new `Date` on every date or time change. |
|
|
138
|
+
| `placeholder` | `string` | `"Pick date and time"` | Trigger text while empty. |
|
|
139
|
+
| `use24Hour` | `boolean` | `false` | 24-hour clock; otherwise 12-hour with AM/PM toggles. |
|
|
140
|
+
| `showSeconds` | `boolean` | `false` | Adds a seconds segment and shows seconds in the trigger. |
|
|
141
|
+
| `disabled` | `boolean` | `false` | Disables the trigger. |
|
|
142
|
+
| `ref` | `Ref<HTMLButtonElement>` | | Forwarded to the trigger button. |
|
|
143
|
+
|
|
144
|
+
No other props are accepted: no `id`, `name`, `aria-*`, `dateFormat`, `className` or `style`.
|
|
145
|
+
<!-- api:end -->
|
|
146
|
+
|
|
147
|
+
## 13. Examples
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
import * as React from "react";
|
|
151
|
+
import { Button, DateTimePicker, FormDescription, Label } from "@eluan/core";
|
|
152
|
+
|
|
153
|
+
export function SchedulePost({ onSchedule }: { onSchedule: (when: Date) => void }) {
|
|
154
|
+
const [publishAt, setPublishAt] = React.useState<Date | undefined>();
|
|
155
|
+
|
|
156
|
+
return (
|
|
157
|
+
<form
|
|
158
|
+
onSubmit={(event) => {
|
|
159
|
+
event.preventDefault();
|
|
160
|
+
if (publishAt) onSchedule(publishAt);
|
|
161
|
+
}}
|
|
162
|
+
style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-lg)" }}
|
|
163
|
+
>
|
|
164
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-sm)" }}>
|
|
165
|
+
<Label id="publish-at-label" required>
|
|
166
|
+
Publish at
|
|
167
|
+
</Label>
|
|
168
|
+
<div role="group" aria-labelledby="publish-at-label" aria-describedby="publish-at-hint">
|
|
169
|
+
<DateTimePicker value={publishAt} onValueChange={setPublishAt} placeholder="Pick a publish time" />
|
|
170
|
+
</div>
|
|
171
|
+
<FormDescription id="publish-at-hint">Uses your computer's time zone.</FormDescription>
|
|
172
|
+
</div>
|
|
173
|
+
<div style={{ display: "flex", justifyContent: "flex-end", gap: "var(--spacing-sm)" }}>
|
|
174
|
+
<Button type="button" variant="outline" onClick={() => setPublishAt(undefined)}>
|
|
175
|
+
Clear
|
|
176
|
+
</Button>
|
|
177
|
+
<Button type="submit" disabled={!publishAt}>
|
|
178
|
+
Schedule post
|
|
179
|
+
</Button>
|
|
180
|
+
</div>
|
|
181
|
+
</form>
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## 14. Related components
|
|
187
|
+
|
|
188
|
+
- [DatePicker](./date-picker.md): the same trigger without a time; also the chooser for all date and time components.
|
|
189
|
+
- [TimeInput](./time-input.md): the time row inside the popover; use it alone for a time with no date.
|
|
190
|
+
- [Calendar](./calendar.md): the grid inside the popover.
|
|
191
|
+
- [Popover](./popover.md): the surface the picker opens in.
|
|
192
|
+
- [Label](./form-label.md): the visible label; see also [forms](../patterns/forms.md).
|
|
193
|
+
|
|
194
|
+
## 15. Common agent mistakes
|
|
195
|
+
|
|
196
|
+
_Filled from evals._
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: DecimalInput
|
|
3
|
+
use_when: The user enters money, a percentage, a measurement or another decimal that should display with fixed decimals and thousands separators.
|
|
4
|
+
instead_of: NumberInput for counts with steppers; Slider for approximate values on a range; Input for text that isn't a number.
|
|
5
|
+
source: packages/core/src/components/decimal-input.tsx
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# DecimalInput
|
|
9
|
+
|
|
10
|
+
## 1. Overview
|
|
11
|
+
|
|
12
|
+
DecimalInput is a right-aligned, monospaced field for decimal amounts. While the user types it keeps only digits, one decimal separator and, if allowed, a leading minus, and caps the number of decimal places. On blur it shows the controlled value with thousands separators and fixed decimals. Prefix and suffix text (a currency symbol, `%`, a unit) sit inside the field. Three presets ship with it: CurrencyInput, PercentageInput and UnitInput.
|
|
13
|
+
|
|
14
|
+
## 2. When to use
|
|
15
|
+
|
|
16
|
+
- Money: prices, budgets, invoice lines (CurrencyInput).
|
|
17
|
+
- Rates and shares: discount, tax rate, allocation (PercentageInput).
|
|
18
|
+
- Measurements: weight, length, duration (UnitInput).
|
|
19
|
+
- Any decimal with a fixed precision (DecimalInput).
|
|
20
|
+
|
|
21
|
+
### When not to use
|
|
22
|
+
|
|
23
|
+
- Plain text → use [Input](./input.md).
|
|
24
|
+
- A whole-number count with minus and plus buttons → use [NumberInput](./number-input.md).
|
|
25
|
+
- A value on a continuous range where close enough is fine → use [Slider](./slider.md).
|
|
26
|
+
|
|
27
|
+
DecimalInput earns its place through formatting: separators and fixed decimals on blur, the decimal-place cap while typing, and the currency, percent and unit affixes. It only formats when controlled.
|
|
28
|
+
|
|
29
|
+
## 3. Anatomy
|
|
30
|
+
|
|
31
|
+
1. **Field**: a native `<input type="text" inputMode="decimal">`, right-aligned in `--font-mono`.
|
|
32
|
+
2. **Prefix** (optional): the currency symbol, `prefix`, or a prefix `unit`, in `--interactive-fg-alt` at the leading edge.
|
|
33
|
+
3. **Suffix** (optional): `suffix`, `%`, or a suffix `unit`, at the trailing edge.
|
|
34
|
+
|
|
35
|
+
The field's padding grows to fit the affixes. Affixes are visual text; they aren't part of the field's accessible name.
|
|
36
|
+
|
|
37
|
+
## 4. Variants
|
|
38
|
+
|
|
39
|
+
| Export | Use for |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| `DecimalInput` | Any decimal; you set decimals, affixes, separators and bounds. |
|
|
42
|
+
| `CurrencyInput` | Money. `currency` is required and sets the symbol prefix and the decimal places. |
|
|
43
|
+
| `PercentageInput` | Percentages. Fixed `%` suffix; defaults to `min={0}`, `max={100}`, `decimals={1}`. |
|
|
44
|
+
| `UnitInput` | Measurements. `unit` is required and shows as a suffix by default. |
|
|
45
|
+
|
|
46
|
+
## 5. Sizes
|
|
47
|
+
|
|
48
|
+
No size prop. The field is `--size-lg` tall and follows density.
|
|
49
|
+
|
|
50
|
+
## 6. States
|
|
51
|
+
|
|
52
|
+
| State | Looks like | Notes |
|
|
53
|
+
| --- | --- | --- |
|
|
54
|
+
| Default | `--container-bg` surface, `--interactive-border-alt` border, affixes and placeholder in `--interactive-fg-alt` | DecimalInput draws its own field rather than using Input; the surface token differs from Input's `--interactive-bg` but looks the same in the default theme. |
|
|
55
|
+
| Focus | Border and 1px outline in `--focus-ring`, 1px offset; value shown unformatted | Never remove or restyle the focus ring. |
|
|
56
|
+
| Disabled | `--interactive-bg-disabled` surface, `--interactive-fg-disabled` text, not-allowed cursor | |
|
|
57
|
+
| Error | No visual change | `aria-invalid` has no style here, unlike Input. Show a FormMessage and still set `aria-invalid` for assistive tech. |
|
|
58
|
+
|
|
59
|
+
## 7. Content guidelines
|
|
60
|
+
|
|
61
|
+
- Put the currency or unit in the label when the affix carries meaning: "Price (USD)", "Weight (kg)". Screen readers don't hear the affix.
|
|
62
|
+
- Use a placeholder that shows the expected precision, such as "0.00", or none.
|
|
63
|
+
- State bounds in a description: "Up to 100%".
|
|
64
|
+
|
|
65
|
+
| Do | Don't |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| Monthly budget (USD) | Amount |
|
|
68
|
+
| Discount, up to 100% | Enter a percentage value |
|
|
69
|
+
|
|
70
|
+
## 8. Rules
|
|
71
|
+
|
|
72
|
+
1. Always control it: pass `value` and update it from `onValueChange`. Uncontrolled, it never formats; with a `value` that doesn't update, the field snaps back to that value on blur.
|
|
73
|
+
2. Give the field a visible [Label](./form-label.md) tied with `htmlFor` and `id`, including the currency or unit.
|
|
74
|
+
3. Use CurrencyInput for money rather than a hand-written `prefix="$"` with `decimals={2}`. It takes the symbol and decimal places from `currencies`.
|
|
75
|
+
4. Set separators yourself; nothing is locale-aware. CurrencyInput doesn't change separators: pass `thousandsSeparator="."` and `decimalSeparator=","` where that's the convention.
|
|
76
|
+
5. Expect `currency` to win over `decimals`. To show a currency with other precision, use DecimalInput with `prefix`.
|
|
77
|
+
6. Validate bounds on submit. `min` and `max` clamp the number sent to `onValueChange` as the user types, but the field shows what they typed until blur.
|
|
78
|
+
7. Set `allowNegative` for refunds and adjustments; it's off by default.
|
|
79
|
+
8. Never pass `className` or `style`; they're dropped. Put width on a wrapper.
|
|
80
|
+
|
|
81
|
+
## 9. Dos and don'ts
|
|
82
|
+
|
|
83
|
+
**Do:** control the value and name the currency in the label.
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
<Label htmlFor="budget">Monthly budget (USD)</Label>
|
|
87
|
+
<CurrencyInput id="budget" currency="USD" value={budget} onValueChange={setBudget} />
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Don't:** leave it uncontrolled, or pin a value without updating it.
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
<CurrencyInput currency="USD" />
|
|
94
|
+
<CurrencyInput currency="USD" value={99.99} />
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Do:** set separators for the format your users expect.
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
<CurrencyInput currency="EUR" thousandsSeparator="." decimalSeparator="," value={amount} onValueChange={setAmount} />
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Don't:** fake a unit with an icon or text outside the field.
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
<div style={{ display: "flex" }}>
|
|
107
|
+
<DecimalInput value={weight} onValueChange={setWeight} />
|
|
108
|
+
<span>kg</span>
|
|
109
|
+
</div>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## 10. Accessibility
|
|
113
|
+
|
|
114
|
+
- Role: `textbox` (`type="text"` with `inputMode="decimal"`, so mobile shows a decimal keypad).
|
|
115
|
+
- Label: a Label tied by `htmlFor`/`id`. Include the currency or unit in it; the prefix and suffix text isn't part of the name.
|
|
116
|
+
- Keyboard: standard text input. There's no arrow-key stepping.
|
|
117
|
+
- Focus: native focus. On focus the value switches to its raw form (for example `1234.5`) for editing.
|
|
118
|
+
- Contrast: handled by the theme. Don't override colours.
|
|
119
|
+
|
|
120
|
+
## 11. Behaviour
|
|
121
|
+
|
|
122
|
+
- Typing: anything other than digits, the decimal separator and (with `allowNegative`) one leading minus is removed. Extra decimal separators are dropped, and digits past the allowed decimal places are cut off. Thousands separators can't be typed; they're added on blur.
|
|
123
|
+
- Focus and blur: with a controlled `value`, focus shows the raw number and blur shows it formatted, for example `1,234.50`.
|
|
124
|
+
- `onValueChange` sends a JS `number` on every change, clamped to `min` and `max`, or `undefined` when the field can't be parsed.
|
|
125
|
+
- Setting `value` back to `undefined` doesn't clear the field. Set a number, or remount with a new `key` to reset.
|
|
126
|
+
- Responsive: fills its container's width. Constrain it with a wrapper.
|
|
127
|
+
- Motion: colour transitions over 150ms. Don't add your own.
|
|
128
|
+
|
|
129
|
+
## 12. API
|
|
130
|
+
|
|
131
|
+
<!-- api:start -->
|
|
132
|
+
### DecimalInput
|
|
133
|
+
|
|
134
|
+
| Prop | Type | Default | Description |
|
|
135
|
+
| --- | --- | --- | --- |
|
|
136
|
+
| `value` | `number` | | Controlled value. Required for formatting. |
|
|
137
|
+
| `onValueChange` | `(value: number \| undefined) => void` | | Fires on every change with the clamped number, or `undefined`. |
|
|
138
|
+
| `decimals` | `number` | `2` | Decimal places allowed while typing and shown on blur. Ignored when `currency` is set. |
|
|
139
|
+
| `min` | `number` | | Lower bound for the emitted value. |
|
|
140
|
+
| `max` | `number` | | Upper bound for the emitted value. |
|
|
141
|
+
| `prefix` | `string` | | Text at the leading edge. Overrides the currency symbol. |
|
|
142
|
+
| `suffix` | `string` | | Text at the trailing edge. |
|
|
143
|
+
| `currency` | `CurrencyCode` | | One of `currencies`' keys; sets the symbol prefix and decimal places. |
|
|
144
|
+
| `unit` | `string` | | Unit text, placed by `unitPosition`. |
|
|
145
|
+
| `unitPosition` | `"prefix" \| "suffix"` | `"prefix"` | Where `unit` shows. |
|
|
146
|
+
| `thousandsSeparator` | `string` | `","` | Inserted between groups of three digits on blur. |
|
|
147
|
+
| `decimalSeparator` | `string` | `"."` | Separates whole and fractional parts, typed and displayed. |
|
|
148
|
+
| `allowNegative` | `boolean` | `false` | Allows one leading minus sign. |
|
|
149
|
+
| `disabled` | `boolean` | | Disables the field. |
|
|
150
|
+
| `...props` | `InputHTMLAttributes` without `className`, `style`, `size`, `type`, `value`, `onChange` | | Native input attributes: `id`, `name`, `placeholder`, `required`, `aria-*`. `ref` reaches the `<input>`. |
|
|
151
|
+
|
|
152
|
+
### CurrencyInput
|
|
153
|
+
|
|
154
|
+
| Prop | Type | Default | Description |
|
|
155
|
+
| --- | --- | --- | --- |
|
|
156
|
+
| `currency` | `CurrencyCode` | required | Sets the symbol prefix and decimal places. |
|
|
157
|
+
| `...props` | DecimalInput props | | Everything else as DecimalInput. |
|
|
158
|
+
|
|
159
|
+
### PercentageInput
|
|
160
|
+
|
|
161
|
+
| Prop | Type | Default | Description |
|
|
162
|
+
| --- | --- | --- | --- |
|
|
163
|
+
| `min` | `number` | `0` | Lower bound. |
|
|
164
|
+
| `max` | `number` | `100` | Upper bound. |
|
|
165
|
+
| `decimals` | `number` | `1` | Decimal places. |
|
|
166
|
+
| `...props` | DecimalInput props without `suffix` | | The `%` suffix is fixed. |
|
|
167
|
+
|
|
168
|
+
### UnitInput
|
|
169
|
+
|
|
170
|
+
| Prop | Type | Default | Description |
|
|
171
|
+
| --- | --- | --- | --- |
|
|
172
|
+
| `unit` | `string` | required | Unit text, for example `"kg"`. |
|
|
173
|
+
| `unitPosition` | `"prefix" \| "suffix"` | `"suffix"` | Where the unit shows. |
|
|
174
|
+
| `...props` | DecimalInput props | | Everything else as DecimalInput. |
|
|
175
|
+
|
|
176
|
+
### currencies
|
|
177
|
+
|
|
178
|
+
`Record<CurrencyCode, { code, symbol, name, decimals }>` for the eleven supported currencies: USD, EUR, GBP, JPY, CNY, KRW, INR, BRL, CAD, AUD, CHF. JPY and KRW have 0 decimals; the rest have 2. The `CurrencyCode` and `CurrencyInfo` types are exported too.
|
|
179
|
+
<!-- api:end -->
|
|
180
|
+
|
|
181
|
+
## 13. Examples
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
import { useState } from "react";
|
|
185
|
+
import { CurrencyInput, FormDescription, Label, PercentageInput } from "@eluan/core";
|
|
186
|
+
|
|
187
|
+
export function PricingFields() {
|
|
188
|
+
const [price, setPrice] = useState<number | undefined>(49);
|
|
189
|
+
const [discount, setDiscount] = useState<number | undefined>(10);
|
|
190
|
+
|
|
191
|
+
const field = { display: "flex", flexDirection: "column", gap: "var(--spacing-sm)" } as const;
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: "var(--spacing-lg)" }}>
|
|
195
|
+
<div style={field}>
|
|
196
|
+
<Label htmlFor="plan-price" required>Price per month (USD)</Label>
|
|
197
|
+
<CurrencyInput
|
|
198
|
+
id="plan-price"
|
|
199
|
+
name="price"
|
|
200
|
+
currency="USD"
|
|
201
|
+
min={0}
|
|
202
|
+
placeholder="0.00"
|
|
203
|
+
value={price}
|
|
204
|
+
onValueChange={setPrice}
|
|
205
|
+
/>
|
|
206
|
+
</div>
|
|
207
|
+
<div style={field}>
|
|
208
|
+
<Label htmlFor="plan-discount">Annual discount</Label>
|
|
209
|
+
<PercentageInput
|
|
210
|
+
id="plan-discount"
|
|
211
|
+
name="discount"
|
|
212
|
+
value={discount}
|
|
213
|
+
onValueChange={setDiscount}
|
|
214
|
+
aria-describedby="plan-discount-hint"
|
|
215
|
+
/>
|
|
216
|
+
<FormDescription id="plan-discount-hint">Up to 100%. Applied when billed yearly.</FormDescription>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## 14. Related components
|
|
224
|
+
|
|
225
|
+
- [NumberInput](./number-input.md): whole-number counts with steppers.
|
|
226
|
+
- [Slider](./slider.md): approximate values on a range.
|
|
227
|
+
- [Input](./input.md): the field family DecimalInput is styled to match.
|
|
228
|
+
- [Forms pattern](../patterns/forms.md): field structure and validation.
|
|
229
|
+
|
|
230
|
+
## 15. Common agent mistakes
|
|
231
|
+
|
|
232
|
+
_Filled from evals._
|