@qw-ui/core 0.3.0-next.8 → 0.3.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 +21 -37
- package/dist/action-sheet/action-sheet.d.ts +110 -0
- package/dist/action-sheet/index.d.ts +2 -0
- package/dist/action-sheet/index.js +2 -0
- package/dist/action-sheet-Cvcr1S_m.js +183 -0
- package/dist/action-sheet-Cvcr1S_m.js.map +1 -0
- package/dist/area-picker/area-picker.d.ts +113 -0
- package/dist/area-picker/index.d.ts +1 -0
- package/dist/area-picker/index.js +348 -0
- package/dist/area-picker/index.js.map +1 -0
- package/dist/aria-description-CimD2M_C.js +13 -0
- package/dist/aria-description-CimD2M_C.js.map +1 -0
- package/dist/aria-description.d.ts +2 -0
- package/dist/avatar/avatar-load.d.ts +76 -0
- package/dist/avatar/avatar.d.ts +22 -5
- package/dist/avatar/index.d.ts +1 -0
- package/dist/avatar/index.js +57 -18
- package/dist/avatar/index.js.map +1 -1
- package/dist/avatar-load-w9dq05oV.js +139 -0
- package/dist/avatar-load-w9dq05oV.js.map +1 -0
- package/dist/back-top/back-top.d.ts +77 -0
- package/dist/back-top/index.d.ts +1 -0
- package/dist/back-top/index.js +189 -0
- package/dist/back-top/index.js.map +1 -0
- package/dist/badge/badge.d.ts +85 -0
- package/dist/badge/index.d.ts +1 -0
- package/dist/badge/index.js +88 -0
- package/dist/badge/index.js.map +1 -0
- package/dist/button/button.d.ts +13 -0
- package/dist/button/index.js +3 -5
- package/dist/button/index.js.map +1 -1
- package/dist/calendar/calendar.d.ts +100 -0
- package/dist/calendar/index.d.ts +1 -0
- package/dist/calendar/index.js +2 -0
- package/dist/calendar-CmpK3stz.js +363 -0
- package/dist/calendar-CmpK3stz.js.map +1 -0
- package/dist/card/card.d.ts +68 -0
- package/dist/card/index.d.ts +2 -0
- package/dist/card/index.js +2 -0
- package/dist/card-DRtWa6Cr.js +107 -0
- package/dist/card-DRtWa6Cr.js.map +1 -0
- package/dist/cascader/cascader.d.ts +115 -0
- package/dist/cascader/index.d.ts +1 -0
- package/dist/cascader/index.js +2 -0
- package/dist/cascader-D-xMjs7P.js +333 -0
- package/dist/cascader-D-xMjs7P.js.map +1 -0
- package/dist/cell/cell.d.ts +41 -0
- package/dist/cell/index.d.ts +1 -0
- package/dist/cell/index.js +43 -0
- package/dist/cell/index.js.map +1 -0
- package/dist/check-list/check-list.d.ts +78 -0
- package/dist/check-list/index.d.ts +2 -0
- package/dist/check-list/index.js +2 -0
- package/dist/check-list-BvZHQt5w.js +60 -0
- package/dist/check-list-BvZHQt5w.js.map +1 -0
- package/dist/checkbox/checkbox.d.ts +59 -0
- package/dist/checkbox/index.d.ts +2 -0
- package/dist/checkbox/index.js +2 -0
- package/dist/checkbox-BlndJrz5.js +127 -0
- package/dist/checkbox-BlndJrz5.js.map +1 -0
- package/dist/checkbox-group/checkbox-group.d.ts +86 -0
- package/dist/checkbox-group/index.d.ts +3 -0
- package/dist/checkbox-group/index.js +2 -0
- package/dist/checkbox-group-gGfsTv-e.js +223 -0
- package/dist/checkbox-group-gGfsTv-e.js.map +1 -0
- package/dist/choice-group-C4c9m0qe.js +373 -0
- package/dist/choice-group-C4c9m0qe.js.map +1 -0
- package/dist/circle/circle.d.ts +97 -0
- package/dist/circle/index.d.ts +1 -0
- package/dist/circle/index.js +119 -0
- package/dist/circle/index.js.map +1 -0
- package/dist/collapse/collapse.d.ts +98 -0
- package/dist/collapse/index.d.ts +2 -0
- package/dist/collapse/index.js +2 -0
- package/dist/collapse-B969h7-H.js +226 -0
- package/dist/collapse-B969h7-H.js.map +1 -0
- package/dist/countdown/countdown.d.ts +114 -0
- package/dist/countdown/index.d.ts +1 -0
- package/dist/countdown/index.js +309 -0
- package/dist/countdown/index.js.map +1 -0
- package/dist/date-picker/date-picker.d.ts +168 -0
- package/dist/date-picker/index.d.ts +1 -0
- package/dist/date-picker/index.js +401 -0
- package/dist/date-picker/index.js.map +1 -0
- package/dist/descriptions/descriptions.d.ts +69 -0
- package/dist/descriptions/index.d.ts +1 -0
- package/dist/descriptions/index.js +86 -0
- package/dist/descriptions/index.js.map +1 -0
- package/dist/dialog/dialog.d.ts +61 -43
- package/dist/dialog/index.js +73 -19
- package/dist/dialog/index.js.map +1 -1
- package/dist/divider/divider.d.ts +18 -2
- package/dist/divider/index.js +20 -2
- package/dist/divider/index.js.map +1 -1
- package/dist/dropdown/dropdown.d.ts +172 -0
- package/dist/dropdown/index.d.ts +2 -0
- package/dist/dropdown/index.js +467 -0
- package/dist/dropdown/index.js.map +1 -0
- package/dist/ellipsis/ellipsis-layout.d.ts +34 -0
- package/dist/ellipsis/ellipsis.d.ts +88 -0
- package/dist/ellipsis/index.d.ts +2 -0
- package/dist/ellipsis/index.js +320 -0
- package/dist/ellipsis/index.js.map +1 -0
- package/dist/empty/empty-illustration.d.ts +3 -0
- package/dist/empty/empty.d.ts +43 -1
- package/dist/empty/index.js +2 -21
- package/dist/empty-CAgyvhUI.js +166 -0
- package/dist/empty-CAgyvhUI.js.map +1 -0
- package/dist/field/field.d.ts +95 -0
- package/dist/field/index.d.ts +2 -0
- package/dist/field/index.js +2 -0
- package/dist/field-DMHGIMZF.js +241 -0
- package/dist/field-DMHGIMZF.js.map +1 -0
- package/dist/floating-bubble/floating-bubble.d.ts +116 -0
- package/dist/floating-bubble/index.d.ts +1 -0
- package/dist/floating-bubble/index.js +333 -0
- package/dist/floating-bubble/index.js.map +1 -0
- package/dist/floating-panel/floating-panel.d.ts +80 -0
- package/dist/floating-panel/index.d.ts +2 -0
- package/dist/floating-panel/index.js +2 -0
- package/dist/floating-panel-Cbm5njBJ.js +363 -0
- package/dist/floating-panel-Cbm5njBJ.js.map +1 -0
- package/dist/footer/footer.d.ts +94 -0
- package/dist/footer/index.d.ts +1 -0
- package/dist/footer/index.js +154 -0
- package/dist/footer/index.js.map +1 -0
- package/dist/form/connect.d.ts +6 -0
- package/dist/form/form.d.ts +100 -0
- package/dist/form/ids.d.ts +14 -0
- package/dist/form/index.d.ts +13 -0
- package/dist/form/index.js +3 -0
- package/dist/form/methods.d.ts +5 -0
- package/dist/form/model.d.ts +24 -0
- package/dist/form/native.d.ts +25 -0
- package/dist/form/rules.d.ts +40 -0
- package/dist/form/ssr.d.ts +7 -0
- package/dist/form/types.d.ts +150 -0
- package/dist/form-BAGkIEMY.js +1354 -0
- package/dist/form-BAGkIEMY.js.map +1 -0
- package/dist/format-BDUY0C_c.js +89 -0
- package/dist/format-BDUY0C_c.js.map +1 -0
- package/dist/gesture-_SRHIvBm.js +30 -0
- package/dist/gesture-_SRHIvBm.js.map +1 -0
- package/dist/grid/grid-item.d.ts +22 -0
- package/dist/grid/grid.d.ts +42 -0
- package/dist/grid/index.d.ts +2 -0
- package/dist/grid/index.js +73 -0
- package/dist/grid/index.js.map +1 -0
- package/dist/icon/icon.d.ts +37 -1
- package/dist/icon/identity.d.ts +3 -0
- package/dist/icon/index.js +2 -20
- package/dist/icon-Cgdbnk1u.js +77 -0
- package/dist/icon-Cgdbnk1u.js.map +1 -0
- package/dist/image/image-load.d.ts +24 -0
- package/dist/image/image.d.ts +45 -8
- package/dist/image/index.d.ts +1 -0
- package/dist/image/index.js +116 -14
- package/dist/image/index.js.map +1 -1
- package/dist/image-preview/image-preview.d.ts +124 -0
- package/dist/image-preview/index.d.ts +1 -0
- package/dist/image-preview/index.js +450 -0
- package/dist/image-preview/index.js.map +1 -0
- package/dist/index-bar/index-bar.d.ts +121 -0
- package/dist/index-bar/index.d.ts +1 -0
- package/dist/index-bar/index.js +386 -0
- package/dist/index-bar/index.js.map +1 -0
- package/dist/index.d.ts +115 -10
- package/dist/index.js +151 -11
- package/dist/index.js.map +1 -0
- package/dist/infinite-scroll/index.d.ts +1 -0
- package/dist/infinite-scroll/index.js +248 -0
- package/dist/infinite-scroll/index.js.map +1 -0
- package/dist/infinite-scroll/infinite-scroll.d.ts +95 -0
- package/dist/input/index.js +181 -22
- package/dist/input/index.js.map +1 -1
- package/dist/input/input.d.ts +44 -1
- package/dist/layer-IpFrl5--.js +414 -0
- package/dist/layer-IpFrl5--.js.map +1 -0
- package/dist/layout-BRSqi4AQ.js +43 -0
- package/dist/layout-BRSqi4AQ.js.map +1 -0
- package/dist/layout.d.ts +13 -0
- package/dist/list/index.d.ts +2 -0
- package/dist/list/index.js +2 -0
- package/dist/list/list.d.ts +30 -0
- package/dist/list-6-iz-Irh.js +28 -0
- package/dist/list-6-iz-Irh.js.map +1 -0
- package/dist/loading/index.js +45 -2
- package/dist/loading/index.js.map +1 -1
- package/dist/loading/loading.d.ts +45 -2
- package/dist/modal-dialog-machine-CF9_z3Dm.js +487 -0
- package/dist/modal-dialog-machine-CF9_z3Dm.js.map +1 -0
- package/dist/modal-dialog-machine.d.ts +21 -0
- package/dist/modal-dismissable-lifetime.d.ts +21 -0
- package/dist/modal-registry.d.ts +24 -0
- package/dist/modal-render-hydration.d.ts +35 -0
- package/dist/modal-render-runtime.d.ts +19 -0
- package/dist/modal-render-scope.d.ts +63 -0
- package/dist/nav-bar/index.d.ts +1 -0
- package/dist/nav-bar/index.js +115 -0
- package/dist/nav-bar/index.js.map +1 -0
- package/dist/nav-bar/nav-bar.d.ts +76 -0
- package/dist/notice-bar/index.d.ts +2 -0
- package/dist/notice-bar/index.js +2 -0
- package/dist/notice-bar/notice-bar.d.ts +103 -0
- package/dist/notice-bar-DMpwLvRb.js +231 -0
- package/dist/notice-bar-DMpwLvRb.js.map +1 -0
- package/dist/notify/index.d.ts +1 -0
- package/dist/notify/index.js +251 -0
- package/dist/notify/index.js.map +1 -0
- package/dist/notify/notify.d.ts +123 -0
- package/dist/number-keyboard/index.d.ts +1 -0
- package/dist/number-keyboard/index.js +333 -0
- package/dist/number-keyboard/index.js.map +1 -0
- package/dist/number-keyboard/number-keyboard.d.ts +141 -0
- package/dist/overlay-panel/index.d.ts +2 -0
- package/dist/overlay-panel/index.js +2 -0
- package/dist/overlay-panel/overlay-panel.d.ts +20 -0
- package/dist/overlay-panel-Z_qdKeBj.js +26 -0
- package/dist/overlay-panel-Z_qdKeBj.js.map +1 -0
- package/dist/page-indicator/index.d.ts +1 -0
- package/dist/page-indicator/index.js +138 -0
- package/dist/page-indicator/index.js.map +1 -0
- package/dist/page-indicator/page-indicator.d.ts +93 -0
- package/dist/pagination/index.d.ts +1 -0
- package/dist/pagination/index.js +198 -0
- package/dist/pagination/index.js.map +1 -0
- package/dist/pagination/pagination.d.ts +125 -0
- package/dist/password-input/index.d.ts +1 -0
- package/dist/password-input/index.js +317 -0
- package/dist/password-input/index.js.map +1 -0
- package/dist/password-input/password-input.d.ts +144 -0
- package/dist/picker/index.d.ts +8 -0
- package/dist/picker/index.js +2 -0
- package/dist/picker/picker-machine.d.ts +80 -0
- package/dist/picker/picker.d.ts +121 -0
- package/dist/picker/platform.d.ts +84 -0
- package/dist/picker/selection-connect.d.ts +90 -0
- package/dist/picker/selection-model.d.ts +211 -0
- package/dist/picker-BykFntQN.js +1675 -0
- package/dist/picker-BykFntQN.js.map +1 -0
- package/dist/popover/index.d.ts +3 -0
- package/dist/popover/index.js +253 -0
- package/dist/popover/index.js.map +1 -0
- package/dist/popover/layer.d.ts +44 -0
- package/dist/popover/popover.d.ts +104 -0
- package/dist/popover/positioning.d.ts +132 -0
- package/dist/popup/index.d.ts +2 -0
- package/dist/popup/index.js +2 -0
- package/dist/popup/popup.d.ts +60 -0
- package/dist/popup-z5d8IYCt.js +576 -0
- package/dist/popup-z5d8IYCt.js.map +1 -0
- package/dist/portal-BHCNTWhg.js +78 -0
- package/dist/portal-BHCNTWhg.js.map +1 -0
- package/dist/portal.d.ts +61 -0
- package/dist/price/format.d.ts +19 -0
- package/dist/price/index.d.ts +1 -0
- package/dist/price/index.js +154 -0
- package/dist/price/index.js.map +1 -0
- package/dist/price/price.d.ts +88 -0
- package/dist/progress/index.d.ts +1 -0
- package/dist/progress/index.js +2 -0
- package/dist/progress/progress.d.ts +32 -0
- package/dist/progress-f3iYEfdA.js +37 -0
- package/dist/progress-f3iYEfdA.js.map +1 -0
- package/dist/pull-refresh/index.d.ts +1 -0
- package/dist/pull-refresh/index.js +414 -0
- package/dist/pull-refresh/index.js.map +1 -0
- package/dist/pull-refresh/pull-refresh.d.ts +118 -0
- package/dist/radio-group/index.d.ts +3 -0
- package/dist/radio-group/index.js +2 -0
- package/dist/radio-group/radio-group.d.ts +78 -0
- package/dist/radio-group-BOIMuqnS.js +230 -0
- package/dist/radio-group-BOIMuqnS.js.map +1 -0
- package/dist/rate/index.d.ts +1 -0
- package/dist/rate/index.js +2 -0
- package/dist/rate/rate-form.d.ts +28 -0
- package/dist/rate/rate.d.ts +144 -0
- package/dist/rate-5XsU2QkY.js +631 -0
- package/dist/rate-5XsU2QkY.js.map +1 -0
- package/dist/reorder/index.d.ts +1 -0
- package/dist/reorder/index.js +720 -0
- package/dist/reorder/index.js.map +1 -0
- package/dist/reorder/reorder.d.ts +190 -0
- package/dist/result/index.d.ts +1 -0
- package/dist/result/index.js +123 -0
- package/dist/result/index.js.map +1 -0
- package/dist/result/result.d.ts +88 -0
- package/dist/safe-area/index.d.ts +1 -0
- package/dist/safe-area/index.js +42 -0
- package/dist/safe-area/index.js.map +1 -0
- package/dist/safe-area/safe-area.d.ts +28 -0
- package/dist/search-bar/index.js +4 -2
- package/dist/search-bar/index.js.map +1 -1
- package/dist/search-bar/search-bar.d.ts +6 -0
- package/dist/segmented/index.d.ts +2 -0
- package/dist/segmented/index.js +2 -0
- package/dist/segmented/segmented.d.ts +127 -0
- package/dist/segmented-BaU38_L4.js +367 -0
- package/dist/segmented-BaU38_L4.js.map +1 -0
- package/dist/selection-form-BOM_odUk.js +88 -0
- package/dist/selection-form-BOM_odUk.js.map +1 -0
- package/dist/selection-form.d.ts +27 -0
- package/dist/selection-ivXqO1eu.js +55 -0
- package/dist/selection-ivXqO1eu.js.map +1 -0
- package/dist/selection.d.ts +29 -0
- package/dist/selector/choice-group.d.ts +114 -0
- package/dist/selector/index.d.ts +2 -0
- package/dist/selector/index.js +2 -0
- package/dist/selector/selector.d.ts +90 -0
- package/dist/selector-BU2MMJ4N.js +93 -0
- package/dist/selector-BU2MMJ4N.js.map +1 -0
- package/dist/share-sheet/index.d.ts +1 -0
- package/dist/share-sheet/index.js +138 -0
- package/dist/share-sheet/index.js.map +1 -0
- package/dist/share-sheet/share-sheet.d.ts +139 -0
- package/dist/side-nav/index.d.ts +1 -0
- package/dist/side-nav/index.js +99 -0
- package/dist/side-nav/index.js.map +1 -0
- package/dist/side-nav/side-nav.d.ts +94 -0
- package/dist/skeleton/index.js +51 -2
- package/dist/skeleton/index.js.map +1 -1
- package/dist/skeleton/skeleton.d.ts +34 -3
- package/dist/slider/index.d.ts +1 -0
- package/dist/slider/index.js +482 -0
- package/dist/slider/index.js.map +1 -0
- package/dist/slider/slider.d.ts +174 -0
- package/dist/space/index.d.ts +1 -0
- package/dist/space/index.js +52 -0
- package/dist/space/index.js.map +1 -0
- package/dist/space/space.d.ts +46 -0
- package/dist/statistic/index.d.ts +1 -0
- package/dist/statistic/index.js +152 -0
- package/dist/statistic/index.js.map +1 -0
- package/dist/statistic/statistic.d.ts +101 -0
- package/dist/stepper/index.d.ts +1 -0
- package/dist/stepper/index.js +172 -0
- package/dist/stepper/index.js.map +1 -0
- package/dist/stepper/stepper.d.ts +161 -0
- package/dist/steps/index.d.ts +1 -0
- package/dist/steps/index.js +72 -0
- package/dist/steps/index.js.map +1 -0
- package/dist/steps/steps.d.ts +67 -0
- package/dist/sticky/index.d.ts +1 -0
- package/dist/sticky/index.js +145 -0
- package/dist/sticky/index.js.map +1 -0
- package/dist/sticky/sticky.d.ts +70 -0
- package/dist/swipe-action/index.d.ts +1 -0
- package/dist/swipe-action/index.js +417 -0
- package/dist/swipe-action/index.js.map +1 -0
- package/dist/swipe-action/swipe-action.d.ts +148 -0
- package/dist/swiper/gesture.d.ts +32 -0
- package/dist/swiper/index.d.ts +1 -0
- package/dist/swiper/index.js +2 -0
- package/dist/swiper/swiper.d.ts +177 -0
- package/dist/swiper-BKivDkHp.js +550 -0
- package/dist/swiper-BKivDkHp.js.map +1 -0
- package/dist/switch/index.d.ts +1 -0
- package/dist/switch/index.js +168 -0
- package/dist/switch/index.js.map +1 -0
- package/dist/switch/switch.d.ts +142 -0
- package/dist/tabbar/index.d.ts +1 -0
- package/dist/tabbar/index.js +95 -0
- package/dist/tabbar/index.js.map +1 -0
- package/dist/tabbar/tabbar.d.ts +119 -0
- package/dist/tabs/index.js +22 -1
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/tabs.d.ts +12 -8
- package/dist/tag/index.js +123 -2
- package/dist/tag/index.js.map +1 -1
- package/dist/tag/tag.d.ts +67 -1
- package/dist/textarea/index.d.ts +2 -0
- package/dist/textarea/index.js +2 -242
- package/dist/textarea/platform.d.ts +22 -0
- package/dist/textarea/textarea.d.ts +169 -46
- package/dist/textarea-qbnruDUG.js +775 -0
- package/dist/textarea-qbnruDUG.js.map +1 -0
- package/dist/time-picker/index.d.ts +1 -0
- package/dist/time-picker/index.js +228 -0
- package/dist/time-picker/index.js.map +1 -0
- package/dist/time-picker/time-picker.d.ts +83 -0
- package/dist/timeline/index.d.ts +1 -0
- package/dist/timeline/index.js +131 -0
- package/dist/timeline/index.js.map +1 -0
- package/dist/timeline/timeline.d.ts +79 -0
- package/dist/toast/index.js +47 -4
- package/dist/toast/index.js.map +1 -1
- package/dist/toast/toast.d.ts +26 -3
- package/dist/top-bar/index.js +16 -2
- package/dist/top-bar/index.js.map +1 -1
- package/dist/top-bar/top-bar.d.ts +13 -2
- package/dist/tree-select/index.d.ts +1 -0
- package/dist/tree-select/index.js +512 -0
- package/dist/tree-select/index.js.map +1 -0
- package/dist/tree-select/tree-select.d.ts +215 -0
- package/dist/typography/index.d.ts +1 -0
- package/dist/typography/index.js +82 -0
- package/dist/typography/index.js.map +1 -0
- package/dist/typography/typography.d.ts +54 -0
- package/dist/upload/index.d.ts +1 -0
- package/dist/upload/index.js +458 -0
- package/dist/upload/index.js.map +1 -0
- package/dist/upload/upload.d.ts +172 -0
- package/dist/virtual-list/index.d.ts +1 -0
- package/dist/virtual-list/index.js +445 -0
- package/dist/virtual-list/index.js.map +1 -0
- package/dist/virtual-list/virtual-list.d.ts +160 -0
- package/dist/visual-manifest.d.ts +27 -0
- package/dist/watermark/index.d.ts +1 -0
- package/dist/watermark/index.js +260 -0
- package/dist/watermark/index.js.map +1 -0
- package/dist/watermark/watermark.d.ts +106 -0
- package/package.json +417 -44
- package/dist/empty/index.js.map +0 -1
- package/dist/icon/index.js.map +0 -1
- package/dist/textarea/index.js.map +0 -1
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { createMachine } from "@zag-js/core";
|
|
2
|
+
import { dataAttr } from "@zag-js/dom-query";
|
|
3
|
+
//#region src/calendar/calendar.ts
|
|
4
|
+
const CALENDAR_PARTS = [
|
|
5
|
+
"root",
|
|
6
|
+
"header",
|
|
7
|
+
"previous-trigger",
|
|
8
|
+
"heading",
|
|
9
|
+
"next-trigger",
|
|
10
|
+
"grid",
|
|
11
|
+
"row",
|
|
12
|
+
"column-header",
|
|
13
|
+
"cell",
|
|
14
|
+
"day"
|
|
15
|
+
];
|
|
16
|
+
const finiteInt = (value) => typeof value === "number" && Number.isInteger(value);
|
|
17
|
+
const utcDate = (year, month, day) => {
|
|
18
|
+
const date = /* @__PURE__ */ new Date(0);
|
|
19
|
+
date.setUTCHours(0, 0, 0, 0);
|
|
20
|
+
date.setUTCFullYear(year, month - 1, day);
|
|
21
|
+
return date;
|
|
22
|
+
};
|
|
23
|
+
function isValidCalendarDate(value) {
|
|
24
|
+
if (!value || typeof value !== "object") return false;
|
|
25
|
+
const date = value;
|
|
26
|
+
if (!finiteInt(date.year) || !finiteInt(date.month) || !finiteInt(date.day) || date.year < 100 || date.year > 9999 || date.month < 1 || date.month > 12 || date.day < 1) return false;
|
|
27
|
+
return date.day <= daysInMonth(date.year, date.month);
|
|
28
|
+
}
|
|
29
|
+
function daysInMonth(year, month) {
|
|
30
|
+
return utcDate(year, month + 1, 0).getUTCDate();
|
|
31
|
+
}
|
|
32
|
+
function toDateKey(date) {
|
|
33
|
+
return `${String(date.year).padStart(4, "0")}-${String(date.month).padStart(2, "0")}-${String(date.day).padStart(2, "0")}`;
|
|
34
|
+
}
|
|
35
|
+
function compareCalendarDates(a, b) {
|
|
36
|
+
return toDateKey(a).localeCompare(toDateKey(b));
|
|
37
|
+
}
|
|
38
|
+
function addCalendarDays(date, amount) {
|
|
39
|
+
const next = utcDate(date.year, date.month, date.day + amount);
|
|
40
|
+
return {
|
|
41
|
+
year: next.getUTCFullYear(),
|
|
42
|
+
month: next.getUTCMonth() + 1,
|
|
43
|
+
day: next.getUTCDate()
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function addCalendarMonths(date, amount) {
|
|
47
|
+
const monthStart = utcDate(date.year, date.month + amount, 1);
|
|
48
|
+
return {
|
|
49
|
+
year: monthStart.getUTCFullYear(),
|
|
50
|
+
month: monthStart.getUTCMonth() + 1,
|
|
51
|
+
day: Math.min(date.day, daysInMonth(monthStart.getUTCFullYear(), monthStart.getUTCMonth() + 1))
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const todayUtc = () => {
|
|
55
|
+
const date = /* @__PURE__ */ new Date();
|
|
56
|
+
return {
|
|
57
|
+
year: date.getUTCFullYear(),
|
|
58
|
+
month: date.getUTCMonth() + 1,
|
|
59
|
+
day: date.getUTCDate()
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
const clone = (date) => ({ ...date });
|
|
63
|
+
function firstDate(value) {
|
|
64
|
+
if (isValidCalendarDate(value)) return value;
|
|
65
|
+
if (Array.isArray(value)) return value.find(isValidCalendarDate) ?? null;
|
|
66
|
+
if (value && typeof value === "object" && "start" in value) return isValidCalendarDate(value.start) ? value.start : null;
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
function normalizeCalendarValue(value, mode) {
|
|
70
|
+
if (mode === "single") return isValidCalendarDate(value) ? clone(value) : null;
|
|
71
|
+
if (mode === "multiple") return Array.isArray(value) ? [...new Map(value.filter(isValidCalendarDate).map((date) => [toDateKey(date), clone(date)])).values()].sort(compareCalendarDates) : [];
|
|
72
|
+
if (!value || Array.isArray(value) || isValidCalendarDate(value) || !("start" in value)) return {
|
|
73
|
+
start: null,
|
|
74
|
+
end: null
|
|
75
|
+
};
|
|
76
|
+
const start = isValidCalendarDate(value.start) ? clone(value.start) : null, end = isValidCalendarDate(value.end) ? clone(value.end) : null;
|
|
77
|
+
return start && end && compareCalendarDates(start, end) > 0 ? {
|
|
78
|
+
start: end,
|
|
79
|
+
end: start
|
|
80
|
+
} : {
|
|
81
|
+
start,
|
|
82
|
+
end
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function isCalendarDateDisabled(date, props) {
|
|
86
|
+
return !!props.min && isValidCalendarDate(props.min) && compareCalendarDates(date, props.min) < 0 || !!props.max && isValidCalendarDate(props.max) && compareCalendarDates(date, props.max) > 0 || !!props.disabledDates?.some((item) => isValidCalendarDate(item) && toDateKey(item) === toDateKey(date));
|
|
87
|
+
}
|
|
88
|
+
function getCalendarMonthDays(view, props, value, focused) {
|
|
89
|
+
const weekStartsOn = finiteInt(props.weekStartsOn) ? (props.weekStartsOn % 7 + 7) % 7 : 0;
|
|
90
|
+
const first = {
|
|
91
|
+
year: view.year,
|
|
92
|
+
month: view.month,
|
|
93
|
+
day: 1
|
|
94
|
+
};
|
|
95
|
+
const start = addCalendarDays(first, -((utcDate(first.year, first.month, 1).getUTCDay() - weekStartsOn + 7) % 7));
|
|
96
|
+
const locale = props.locale || "zh-CN", formatter = new Intl.DateTimeFormat(locale, {
|
|
97
|
+
dateStyle: "full",
|
|
98
|
+
timeZone: "UTC"
|
|
99
|
+
});
|
|
100
|
+
const mode = props.mode ?? "single", normalized = normalizeCalendarValue(value, mode), today = isValidCalendarDate(props.today) ? props.today : todayUtc();
|
|
101
|
+
return Array.from({ length: 42 }, (_, index) => {
|
|
102
|
+
const date = addCalendarDays(start, index), key = toDateKey(date);
|
|
103
|
+
let selected, inRange = false;
|
|
104
|
+
if (mode === "single") selected = isValidCalendarDate(normalized) && toDateKey(normalized) === key;
|
|
105
|
+
else if (mode === "multiple") selected = normalized.some((item) => toDateKey(item) === key);
|
|
106
|
+
else {
|
|
107
|
+
const range = normalized;
|
|
108
|
+
selected = !!range.start && toDateKey(range.start) === key || !!range.end && toDateKey(range.end) === key;
|
|
109
|
+
inRange = !!range.start && !!range.end && compareCalendarDates(date, range.start) >= 0 && compareCalendarDates(date, range.end) <= 0;
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
date,
|
|
113
|
+
key,
|
|
114
|
+
day: date.day,
|
|
115
|
+
label: formatter.format(utcDate(date.year, date.month, date.day)),
|
|
116
|
+
outside: date.month !== view.month,
|
|
117
|
+
disabled: isCalendarDateDisabled(date, props),
|
|
118
|
+
selected,
|
|
119
|
+
inRange,
|
|
120
|
+
today: toDateKey(date) === toDateKey(today),
|
|
121
|
+
focused: toDateKey(date) === toDateKey(focused)
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function selectCalendarDate(value, date, mode) {
|
|
126
|
+
const current = normalizeCalendarValue(value, mode), key = toDateKey(date);
|
|
127
|
+
if (mode === "single") return clone(date);
|
|
128
|
+
if (mode === "multiple") {
|
|
129
|
+
const items = current;
|
|
130
|
+
return items.some((item) => toDateKey(item) === key) ? items.filter((item) => toDateKey(item) !== key) : [...items, clone(date)].sort(compareCalendarDates);
|
|
131
|
+
}
|
|
132
|
+
const range = current;
|
|
133
|
+
if (!range.start || range.end) return {
|
|
134
|
+
start: clone(date),
|
|
135
|
+
end: null
|
|
136
|
+
};
|
|
137
|
+
return compareCalendarDates(date, range.start) < 0 ? {
|
|
138
|
+
start: clone(date),
|
|
139
|
+
end: clone(range.start)
|
|
140
|
+
} : {
|
|
141
|
+
start: clone(range.start),
|
|
142
|
+
end: clone(date)
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function createCalendarProps(props) {
|
|
146
|
+
return {
|
|
147
|
+
...props,
|
|
148
|
+
label: props.label?.trim() || "日历",
|
|
149
|
+
mode: [
|
|
150
|
+
"single",
|
|
151
|
+
"multiple",
|
|
152
|
+
"range"
|
|
153
|
+
].includes(props.mode) ? props.mode : "single"
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
const calendarMachine = createMachine({
|
|
157
|
+
props: ({ props }) => createCalendarProps(props),
|
|
158
|
+
initialState: () => "idle",
|
|
159
|
+
states: { idle: {} },
|
|
160
|
+
context: ({ bindable, prop }) => {
|
|
161
|
+
const mode = prop("mode") ?? "single", seed = firstDate(prop("value") ?? prop("defaultValue") ?? null) ?? (isValidCalendarDate(prop("today")) ? prop("today") : todayUtc());
|
|
162
|
+
return {
|
|
163
|
+
value: bindable(() => ({
|
|
164
|
+
defaultValue: normalizeCalendarValue(prop("defaultValue"), mode),
|
|
165
|
+
value: prop("value") === void 0 ? void 0 : normalizeCalendarValue(prop("value"), mode),
|
|
166
|
+
hash: JSON.stringify,
|
|
167
|
+
onChange: (value) => prop("onValueChange")?.({ value })
|
|
168
|
+
})),
|
|
169
|
+
view: bindable(() => ({
|
|
170
|
+
defaultValue: {
|
|
171
|
+
...seed,
|
|
172
|
+
day: 1
|
|
173
|
+
},
|
|
174
|
+
hash: toDateKey
|
|
175
|
+
})),
|
|
176
|
+
focused: bindable(() => ({
|
|
177
|
+
defaultValue: seed,
|
|
178
|
+
hash: toDateKey
|
|
179
|
+
}))
|
|
180
|
+
};
|
|
181
|
+
},
|
|
182
|
+
on: {
|
|
183
|
+
SELECT: { actions: ["select"] },
|
|
184
|
+
FOCUS: { actions: ["focus"] },
|
|
185
|
+
NAVIGATE: { actions: ["navigate"] },
|
|
186
|
+
TODAY: { actions: ["today"] }
|
|
187
|
+
},
|
|
188
|
+
implementations: { actions: {
|
|
189
|
+
select({ context, event, prop }) {
|
|
190
|
+
if (event.type !== "SELECT" || !isValidCalendarDate(event.date) || isCalendarDateDisabled(event.date, {
|
|
191
|
+
min: prop("min"),
|
|
192
|
+
max: prop("max"),
|
|
193
|
+
disabledDates: prop("disabledDates")
|
|
194
|
+
})) return;
|
|
195
|
+
context.set("value", selectCalendarDate(context.get("value"), event.date, prop("mode") ?? "single"));
|
|
196
|
+
context.set("focused", event.date);
|
|
197
|
+
context.set("view", {
|
|
198
|
+
...event.date,
|
|
199
|
+
day: 1
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
focus({ context, event }) {
|
|
203
|
+
if (event.type === "FOCUS" && isValidCalendarDate(event.date)) {
|
|
204
|
+
context.set("focused", event.date);
|
|
205
|
+
context.set("view", {
|
|
206
|
+
...event.date,
|
|
207
|
+
day: 1
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
navigate({ context, event }) {
|
|
212
|
+
if (event.type === "NAVIGATE") {
|
|
213
|
+
const next = addCalendarMonths(context.get("view"), event.months);
|
|
214
|
+
context.set("view", {
|
|
215
|
+
...next,
|
|
216
|
+
day: 1
|
|
217
|
+
});
|
|
218
|
+
context.set("focused", next);
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
today({ context, prop }) {
|
|
222
|
+
const date = isValidCalendarDate(prop("today")) ? prop("today") : todayUtc();
|
|
223
|
+
context.set("view", {
|
|
224
|
+
...date,
|
|
225
|
+
day: 1
|
|
226
|
+
});
|
|
227
|
+
context.set("focused", date);
|
|
228
|
+
}
|
|
229
|
+
} }
|
|
230
|
+
});
|
|
231
|
+
function connectCalendar(service, normalize) {
|
|
232
|
+
const props = createCalendarProps({
|
|
233
|
+
label: service.prop("label"),
|
|
234
|
+
locale: service.prop("locale"),
|
|
235
|
+
dir: service.prop("dir"),
|
|
236
|
+
mode: service.prop("mode"),
|
|
237
|
+
min: service.prop("min"),
|
|
238
|
+
max: service.prop("max"),
|
|
239
|
+
disabledDates: service.prop("disabledDates"),
|
|
240
|
+
weekStartsOn: service.prop("weekStartsOn"),
|
|
241
|
+
today: service.prop("today")
|
|
242
|
+
}), view = service.context.get("view"), focused = service.context.get("focused"), value = service.context.get("value");
|
|
243
|
+
const locale = props.locale || "zh-CN", heading = new Intl.DateTimeFormat(locale, {
|
|
244
|
+
year: "numeric",
|
|
245
|
+
month: "long",
|
|
246
|
+
timeZone: "UTC"
|
|
247
|
+
}).format(utcDate(view.year, view.month, 1));
|
|
248
|
+
const start = finiteInt(props.weekStartsOn) ? (props.weekStartsOn % 7 + 7) % 7 : 0, weekdayFormatter = new Intl.DateTimeFormat(locale, {
|
|
249
|
+
weekday: "short",
|
|
250
|
+
timeZone: "UTC"
|
|
251
|
+
});
|
|
252
|
+
const weekdays = Array.from({ length: 7 }, (_, index) => weekdayFormatter.format(utcDate(2023, 1, 1 + (start + index) % 7))), days = getCalendarMonthDays(view, props, value, focused), weeks = Array.from({ length: 6 }, (_, index) => days.slice(index * 7, index * 7 + 7));
|
|
253
|
+
const part = (name) => ({
|
|
254
|
+
"data-scope": "calendar",
|
|
255
|
+
"data-part": name
|
|
256
|
+
});
|
|
257
|
+
const move = (day, key) => {
|
|
258
|
+
const rtl = props.dir === "rtl", amount = key === "ArrowRight" ? rtl ? -1 : 1 : key === "ArrowLeft" ? rtl ? 1 : -1 : key === "ArrowDown" ? 7 : key === "ArrowUp" ? -7 : 0;
|
|
259
|
+
if (amount) return addCalendarDays(day.date, amount);
|
|
260
|
+
const weekday = (utcDate(day.date.year, day.date.month, day.date.day).getUTCDay() - start + 7) % 7;
|
|
261
|
+
if (key === "Home") return addCalendarDays(day.date, -weekday);
|
|
262
|
+
if (key === "End") return addCalendarDays(day.date, 6 - weekday);
|
|
263
|
+
if (key === "PageUp") return addCalendarMonths(day.date, -1);
|
|
264
|
+
if (key === "PageDown") return addCalendarMonths(day.date, 1);
|
|
265
|
+
return null;
|
|
266
|
+
};
|
|
267
|
+
return {
|
|
268
|
+
label: props.label,
|
|
269
|
+
heading,
|
|
270
|
+
weekdays,
|
|
271
|
+
weeks,
|
|
272
|
+
value,
|
|
273
|
+
focusDate: (date) => service.send({
|
|
274
|
+
type: "FOCUS",
|
|
275
|
+
date
|
|
276
|
+
}),
|
|
277
|
+
selectDate: (date) => service.send({
|
|
278
|
+
type: "SELECT",
|
|
279
|
+
date
|
|
280
|
+
}),
|
|
281
|
+
getRootProps: () => normalize.element({
|
|
282
|
+
...part("root"),
|
|
283
|
+
dir: props.dir
|
|
284
|
+
}),
|
|
285
|
+
getHeaderProps: () => normalize.element(part("header")),
|
|
286
|
+
getPreviousTriggerProps: () => normalize.button({
|
|
287
|
+
...part("previous-trigger"),
|
|
288
|
+
type: "button",
|
|
289
|
+
"aria-label": "上个月",
|
|
290
|
+
onClick: () => service.send({
|
|
291
|
+
type: "NAVIGATE",
|
|
292
|
+
months: -1
|
|
293
|
+
})
|
|
294
|
+
}),
|
|
295
|
+
getHeadingProps: () => normalize.element({
|
|
296
|
+
...part("heading"),
|
|
297
|
+
"aria-live": "polite"
|
|
298
|
+
}),
|
|
299
|
+
getNextTriggerProps: () => normalize.button({
|
|
300
|
+
...part("next-trigger"),
|
|
301
|
+
type: "button",
|
|
302
|
+
"aria-label": "下个月",
|
|
303
|
+
onClick: () => service.send({
|
|
304
|
+
type: "NAVIGATE",
|
|
305
|
+
months: 1
|
|
306
|
+
})
|
|
307
|
+
}),
|
|
308
|
+
getGridProps: () => normalize.element({
|
|
309
|
+
...part("grid"),
|
|
310
|
+
role: "grid",
|
|
311
|
+
"aria-label": props.label,
|
|
312
|
+
"aria-labelledby": void 0
|
|
313
|
+
}),
|
|
314
|
+
getRowProps: () => normalize.element({
|
|
315
|
+
...part("row"),
|
|
316
|
+
role: "row"
|
|
317
|
+
}),
|
|
318
|
+
getColumnHeaderProps: () => normalize.element({
|
|
319
|
+
...part("column-header"),
|
|
320
|
+
role: "columnheader"
|
|
321
|
+
}),
|
|
322
|
+
getCellProps: (day) => normalize.element({
|
|
323
|
+
...part("cell"),
|
|
324
|
+
role: "gridcell",
|
|
325
|
+
"aria-selected": day.selected || void 0
|
|
326
|
+
}),
|
|
327
|
+
getDayProps: (day) => normalize.button({
|
|
328
|
+
...part("day"),
|
|
329
|
+
type: "button",
|
|
330
|
+
tabIndex: day.focused ? 0 : -1,
|
|
331
|
+
disabled: day.disabled,
|
|
332
|
+
"aria-label": day.label,
|
|
333
|
+
"aria-current": day.today ? "date" : void 0,
|
|
334
|
+
"data-outside": dataAttr(day.outside),
|
|
335
|
+
"data-selected": dataAttr(day.selected),
|
|
336
|
+
"data-in-range": dataAttr(day.inRange),
|
|
337
|
+
"data-today": dataAttr(day.today),
|
|
338
|
+
onClick: () => service.send({
|
|
339
|
+
type: "SELECT",
|
|
340
|
+
date: day.date
|
|
341
|
+
}),
|
|
342
|
+
onFocus: () => service.send({
|
|
343
|
+
type: "FOCUS",
|
|
344
|
+
date: day.date
|
|
345
|
+
}),
|
|
346
|
+
onKeyDown(event) {
|
|
347
|
+
const next = move(day, event.key);
|
|
348
|
+
if (!next) return;
|
|
349
|
+
event.preventDefault();
|
|
350
|
+
service.send({
|
|
351
|
+
type: "FOCUS",
|
|
352
|
+
date: next
|
|
353
|
+
});
|
|
354
|
+
queueMicrotask(() => service.scope.getById(`calendar:${service.scope.id}:${toDateKey(next)}`)?.focus());
|
|
355
|
+
},
|
|
356
|
+
id: `calendar:${service.scope.id}:${day.key}`
|
|
357
|
+
})
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
//#endregion
|
|
361
|
+
export { compareCalendarDates as a, daysInMonth as c, isValidCalendarDate as d, normalizeCalendarValue as f, calendarMachine as i, getCalendarMonthDays as l, toDateKey as m, addCalendarDays as n, connectCalendar as o, selectCalendarDate as p, addCalendarMonths as r, createCalendarProps as s, CALENDAR_PARTS as t, isCalendarDateDisabled as u };
|
|
362
|
+
|
|
363
|
+
//# sourceMappingURL=calendar-CmpK3stz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-CmpK3stz.js","names":[],"sources":["../src/calendar/calendar.ts"],"sourcesContent":["import { createMachine, type Machine, type Service } from \"@zag-js/core\";\nimport { dataAttr } from \"@zag-js/dom-query\";\nimport type { NormalizeProps, PropTypes } from \"@zag-js/types\";\n\nexport const CALENDAR_PARTS = [\"root\", \"header\", \"previous-trigger\", \"heading\", \"next-trigger\", \"grid\", \"row\", \"column-header\", \"cell\", \"day\"] as const;\nexport type CalendarSelectionMode = \"single\" | \"multiple\" | \"range\";\nexport interface CalendarDate { year: number; month: number; day: number }\nexport interface CalendarRange { start: CalendarDate | null; end: CalendarDate | null }\nexport type CalendarValue = CalendarDate | CalendarDate[] | CalendarRange | null;\nexport interface CalendarValueChangeDetails { value: CalendarValue }\nexport interface QwCalendarProps {\n id?: string; label?: string; locale?: string; dir?: \"ltr\" | \"rtl\"; mode?: CalendarSelectionMode;\n value?: CalendarValue; defaultValue?: CalendarValue; min?: CalendarDate; max?: CalendarDate;\n disabledDates?: readonly CalendarDate[]; weekStartsOn?: number; today?: CalendarDate;\n onValueChange?: (details: CalendarValueChangeDetails) => void;\n}\nconst finiteInt = (value: unknown): value is number => typeof value === \"number\" && Number.isInteger(value);\nconst utcDate = (year: number, month: number, day: number): Date => { const date = new Date(0); date.setUTCHours(0, 0, 0, 0); date.setUTCFullYear(year, month - 1, day); return date; };\nexport function isValidCalendarDate(value: unknown): value is CalendarDate {\n if (!value || typeof value !== \"object\") return false;\n const date = value as CalendarDate;\n if (!finiteInt(date.year) || !finiteInt(date.month) || !finiteInt(date.day) || date.year < 100 || date.year > 9999 || date.month < 1 || date.month > 12 || date.day < 1) return false;\n return date.day <= daysInMonth(date.year, date.month);\n}\nexport function daysInMonth(year: number, month: number): number { return utcDate(year, month + 1, 0).getUTCDate(); }\nexport function toDateKey(date: CalendarDate): string { return `${String(date.year).padStart(4, \"0\")}-${String(date.month).padStart(2, \"0\")}-${String(date.day).padStart(2, \"0\")}`; }\nexport function compareCalendarDates(a: CalendarDate, b: CalendarDate): number { return toDateKey(a).localeCompare(toDateKey(b)); }\nexport function addCalendarDays(date: CalendarDate, amount: number): CalendarDate {\n const next = utcDate(date.year, date.month, date.day + amount);\n return { year: next.getUTCFullYear(), month: next.getUTCMonth() + 1, day: next.getUTCDate() };\n}\nexport function addCalendarMonths(date: CalendarDate, amount: number): CalendarDate {\n const monthStart = utcDate(date.year, date.month + amount, 1);\n return { year: monthStart.getUTCFullYear(), month: monthStart.getUTCMonth() + 1, day: Math.min(date.day, daysInMonth(monthStart.getUTCFullYear(), monthStart.getUTCMonth() + 1)) };\n}\nconst todayUtc = (): CalendarDate => { const date = new Date(); return { year: date.getUTCFullYear(), month: date.getUTCMonth() + 1, day: date.getUTCDate() }; };\nconst clone = (date: CalendarDate): CalendarDate => ({ ...date });\nfunction firstDate(value: CalendarValue): CalendarDate | null {\n if (isValidCalendarDate(value)) return value;\n if (Array.isArray(value)) return value.find(isValidCalendarDate) ?? null;\n if (value && typeof value === \"object\" && \"start\" in value) return isValidCalendarDate(value.start) ? value.start : null;\n return null;\n}\nexport function normalizeCalendarValue(value: CalendarValue | undefined, mode: CalendarSelectionMode): CalendarValue {\n if (mode === \"single\") return isValidCalendarDate(value) ? clone(value) : null;\n if (mode === \"multiple\") return Array.isArray(value) ? [...new Map(value.filter(isValidCalendarDate).map((date) => [toDateKey(date), clone(date)])).values()].sort(compareCalendarDates) : [];\n if (!value || Array.isArray(value) || isValidCalendarDate(value) || !(\"start\" in value)) return { start: null, end: null };\n const start = isValidCalendarDate(value.start) ? clone(value.start) : null, end = isValidCalendarDate(value.end) ? clone(value.end) : null;\n return start && end && compareCalendarDates(start, end) > 0 ? { start: end, end: start } : { start, end };\n}\nexport function isCalendarDateDisabled(date: CalendarDate, props: Pick<QwCalendarProps, \"min\" | \"max\" | \"disabledDates\">): boolean {\n return (!!props.min && isValidCalendarDate(props.min) && compareCalendarDates(date, props.min) < 0) || (!!props.max && isValidCalendarDate(props.max) && compareCalendarDates(date, props.max) > 0) || !!props.disabledDates?.some((item) => isValidCalendarDate(item) && toDateKey(item) === toDateKey(date));\n}\nexport interface CalendarDay { date: CalendarDate; key: string; label: string; day: number; outside: boolean; disabled: boolean; selected: boolean; inRange: boolean; today: boolean; focused: boolean }\nexport function getCalendarMonthDays(view: CalendarDate, props: QwCalendarProps, value: CalendarValue, focused: CalendarDate): CalendarDay[] {\n const weekStartsOn = finiteInt(props.weekStartsOn) ? ((props.weekStartsOn % 7) + 7) % 7 : 0;\n const first = { year: view.year, month: view.month, day: 1 }, weekday = utcDate(first.year, first.month, 1).getUTCDay();\n const start = addCalendarDays(first, -((weekday - weekStartsOn + 7) % 7));\n const locale = props.locale || \"zh-CN\", formatter = new Intl.DateTimeFormat(locale, { dateStyle: \"full\", timeZone: \"UTC\" });\n const mode = props.mode ?? \"single\", normalized = normalizeCalendarValue(value, mode), today = isValidCalendarDate(props.today) ? props.today : todayUtc();\n return Array.from({ length: 42 }, (_, index) => {\n const date = addCalendarDays(start, index), key = toDateKey(date);\n let selected: boolean, inRange = false;\n if (mode === \"single\") selected = isValidCalendarDate(normalized) && toDateKey(normalized) === key;\n else if (mode === \"multiple\") selected = (normalized as CalendarDate[]).some((item) => toDateKey(item) === key);\n else { const range = normalized as CalendarRange; selected = (!!range.start && toDateKey(range.start) === key) || (!!range.end && toDateKey(range.end) === key); inRange = !!range.start && !!range.end && compareCalendarDates(date, range.start) >= 0 && compareCalendarDates(date, range.end) <= 0; }\n return { date, key, day: date.day, label: formatter.format(utcDate(date.year, date.month, date.day)), outside: date.month !== view.month, disabled: isCalendarDateDisabled(date, props), selected, inRange, today: toDateKey(date) === toDateKey(today), focused: toDateKey(date) === toDateKey(focused) };\n });\n}\nexport function selectCalendarDate(value: CalendarValue, date: CalendarDate, mode: CalendarSelectionMode): CalendarValue {\n const current = normalizeCalendarValue(value, mode), key = toDateKey(date);\n if (mode === \"single\") return clone(date);\n if (mode === \"multiple\") { const items = current as CalendarDate[], exists = items.some((item) => toDateKey(item) === key); return exists ? items.filter((item) => toDateKey(item) !== key) : [...items, clone(date)].sort(compareCalendarDates); }\n const range = current as CalendarRange;\n if (!range.start || range.end) return { start: clone(date), end: null };\n return compareCalendarDates(date, range.start) < 0 ? { start: clone(date), end: clone(range.start) } : { start: clone(range.start), end: clone(date) };\n}\nexport function createCalendarProps(props: QwCalendarProps): QwCalendarProps { return { ...props, label: props.label?.trim() || \"日历\", mode: [\"single\", \"multiple\", \"range\"].includes(props.mode!) ? props.mode : \"single\" }; }\nexport interface QwCalendarSchema { props: QwCalendarProps; context: { value: CalendarValue; view: CalendarDate; focused: CalendarDate }; state: \"idle\"; action: \"select\" | \"focus\" | \"navigate\" | \"today\"; event: { type: \"SELECT\"; date: CalendarDate } | { type: \"FOCUS\"; date: CalendarDate } | { type: \"NAVIGATE\"; months: number } | { type: \"TODAY\" } }\nexport type QwCalendarMachine = Machine<QwCalendarSchema>; export type QwCalendarService = Service<QwCalendarSchema>;\nexport const calendarMachine: QwCalendarMachine = createMachine<QwCalendarSchema>({\n props: ({ props }) => createCalendarProps(props), initialState: () => \"idle\", states: { idle: {} },\n context: ({ bindable, prop }) => { const mode = prop(\"mode\") ?? \"single\", seed = firstDate(prop(\"value\") ?? prop(\"defaultValue\") ?? null) ?? (isValidCalendarDate(prop(\"today\")) ? prop(\"today\")! : todayUtc()); return {\n value: bindable(() => ({ defaultValue: normalizeCalendarValue(prop(\"defaultValue\"), mode), value: prop(\"value\") === undefined ? undefined : normalizeCalendarValue(prop(\"value\"), mode), hash: JSON.stringify, onChange: (value) => prop(\"onValueChange\")?.({ value }) })),\n view: bindable(() => ({ defaultValue: { ...seed, day: 1 }, hash: toDateKey })), focused: bindable(() => ({ defaultValue: seed, hash: toDateKey })),\n }; },\n on: { SELECT: { actions: [\"select\"] }, FOCUS: { actions: [\"focus\"] }, NAVIGATE: { actions: [\"navigate\"] }, TODAY: { actions: [\"today\"] } },\n implementations: { actions: {\n select({ context, event, prop }) { if (event.type !== \"SELECT\" || !isValidCalendarDate(event.date) || isCalendarDateDisabled(event.date, { min: prop(\"min\"), max: prop(\"max\"), disabledDates: prop(\"disabledDates\") })) return; context.set(\"value\", selectCalendarDate(context.get(\"value\"), event.date, prop(\"mode\") ?? \"single\")); context.set(\"focused\", event.date); context.set(\"view\", { ...event.date, day: 1 }); },\n focus({ context, event }) { if (event.type === \"FOCUS\" && isValidCalendarDate(event.date)) { context.set(\"focused\", event.date); context.set(\"view\", { ...event.date, day: 1 }); } },\n navigate({ context, event }) { if (event.type === \"NAVIGATE\") { const next = addCalendarMonths(context.get(\"view\"), event.months); context.set(\"view\", { ...next, day: 1 }); context.set(\"focused\", next); } },\n today({ context, prop }) { const date = isValidCalendarDate(prop(\"today\")) ? prop(\"today\")! : todayUtc(); context.set(\"view\", { ...date, day: 1 }); context.set(\"focused\", date); },\n } },\n});\nexport interface QwCalendarApi<T extends PropTypes = PropTypes> { label: string; heading: string; weekdays: string[]; weeks: CalendarDay[][]; value: CalendarValue; focusDate(date: CalendarDate): void; selectDate(date: CalendarDate): void; getRootProps(): T[\"element\"]; getHeaderProps(): T[\"element\"]; getPreviousTriggerProps(): T[\"button\"]; getHeadingProps(): T[\"element\"]; getNextTriggerProps(): T[\"button\"]; getGridProps(): T[\"element\"]; getRowProps(): T[\"element\"]; getColumnHeaderProps(index: number): T[\"element\"]; getCellProps(day: CalendarDay): T[\"element\"]; getDayProps(day: CalendarDay): T[\"button\"] }\nexport function connectCalendar<T extends PropTypes>(service: QwCalendarService, normalize: NormalizeProps<T>): QwCalendarApi<T> {\n const props = createCalendarProps({ label: service.prop(\"label\"), locale: service.prop(\"locale\"), dir: service.prop(\"dir\"), mode: service.prop(\"mode\"), min: service.prop(\"min\"), max: service.prop(\"max\"), disabledDates: service.prop(\"disabledDates\"), weekStartsOn: service.prop(\"weekStartsOn\"), today: service.prop(\"today\") }), view = service.context.get(\"view\"), focused = service.context.get(\"focused\"), value = service.context.get(\"value\");\n const locale = props.locale || \"zh-CN\", heading = new Intl.DateTimeFormat(locale, { year: \"numeric\", month: \"long\", timeZone: \"UTC\" }).format(utcDate(view.year, view.month, 1));\n const start = finiteInt(props.weekStartsOn) ? ((props.weekStartsOn % 7) + 7) % 7 : 0, weekdayFormatter = new Intl.DateTimeFormat(locale, { weekday: \"short\", timeZone: \"UTC\" });\n const weekdays = Array.from({ length: 7 }, (_, index) => weekdayFormatter.format(utcDate(2023, 1, 1 + ((start + index) % 7)))), days = getCalendarMonthDays(view, props, value, focused), weeks = Array.from({ length: 6 }, (_, index) => days.slice(index * 7, index * 7 + 7));\n const part = (name: string) => ({ \"data-scope\": \"calendar\", \"data-part\": name });\n const move = (day: CalendarDay, key: string) => { const rtl = props.dir === \"rtl\", amount = key === \"ArrowRight\" ? (rtl ? -1 : 1) : key === \"ArrowLeft\" ? (rtl ? 1 : -1) : key === \"ArrowDown\" ? 7 : key === \"ArrowUp\" ? -7 : 0; if (amount) return addCalendarDays(day.date, amount); const weekday = (utcDate(day.date.year, day.date.month, day.date.day).getUTCDay() - start + 7) % 7; if (key === \"Home\") return addCalendarDays(day.date, -weekday); if (key === \"End\") return addCalendarDays(day.date, 6 - weekday); if (key === \"PageUp\") return addCalendarMonths(day.date, -1); if (key === \"PageDown\") return addCalendarMonths(day.date, 1); return null; };\n return { label: props.label!, heading, weekdays, weeks, value, focusDate: (date) => service.send({ type: \"FOCUS\", date }), selectDate: (date) => service.send({ type: \"SELECT\", date }),\n getRootProps: () => normalize.element({ ...part(\"root\"), dir: props.dir }), getHeaderProps: () => normalize.element(part(\"header\")), getPreviousTriggerProps: () => normalize.button({ ...part(\"previous-trigger\"), type: \"button\", \"aria-label\": \"上个月\", onClick: () => service.send({ type: \"NAVIGATE\", months: -1 }) }), getHeadingProps: () => normalize.element({ ...part(\"heading\"), \"aria-live\": \"polite\" }), getNextTriggerProps: () => normalize.button({ ...part(\"next-trigger\"), type: \"button\", \"aria-label\": \"下个月\", onClick: () => service.send({ type: \"NAVIGATE\", months: 1 }) }),\n getGridProps: () => normalize.element({ ...part(\"grid\"), role: \"grid\", \"aria-label\": props.label, \"aria-labelledby\": undefined }), getRowProps: () => normalize.element({ ...part(\"row\"), role: \"row\" }), getColumnHeaderProps: () => normalize.element({ ...part(\"column-header\"), role: \"columnheader\" }), getCellProps: (day) => normalize.element({ ...part(\"cell\"), role: \"gridcell\", \"aria-selected\": day.selected || undefined }),\n getDayProps: (day) => normalize.button({ ...part(\"day\"), type: \"button\", tabIndex: day.focused ? 0 : -1, disabled: day.disabled, \"aria-label\": day.label, \"aria-current\": day.today ? \"date\" : undefined, \"data-outside\": dataAttr(day.outside), \"data-selected\": dataAttr(day.selected), \"data-in-range\": dataAttr(day.inRange), \"data-today\": dataAttr(day.today), onClick: () => service.send({ type: \"SELECT\", date: day.date }), onFocus: () => service.send({ type: \"FOCUS\", date: day.date }), onKeyDown(event) { const next = move(day, event.key); if (!next) return; event.preventDefault(); service.send({ type: \"FOCUS\", date: next }); queueMicrotask(() => service.scope.getById<HTMLElement>(`calendar:${service.scope.id}:${toDateKey(next)}`)?.focus()); }, id: `calendar:${service.scope.id}:${day.key}` }),\n };\n}\n"],"mappings":";;;AAIA,MAAa,iBAAiB;CAAC;CAAQ;CAAU;CAAoB;CAAW;CAAgB;CAAQ;CAAO;CAAiB;CAAQ;AAAK;AAY7I,MAAM,aAAa,UAAoC,OAAO,UAAU,YAAY,OAAO,UAAU,KAAK;AAC1G,MAAM,WAAW,MAAc,OAAe,QAAsB;CAAE,MAAM,uBAAO,IAAI,KAAK,CAAC;CAAG,KAAK,YAAY,GAAG,GAAG,GAAG,CAAC;CAAG,KAAK,eAAe,MAAM,QAAQ,GAAG,GAAG;CAAG,OAAO;AAAM;AACtL,SAAgB,oBAAoB,OAAuC;CACzE,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO;CAChD,MAAM,OAAO;CACb,IAAI,CAAC,UAAU,KAAK,IAAI,KAAK,CAAC,UAAU,KAAK,KAAK,KAAK,CAAC,UAAU,KAAK,GAAG,KAAK,KAAK,OAAO,OAAO,KAAK,OAAO,QAAQ,KAAK,QAAQ,KAAK,KAAK,QAAQ,MAAM,KAAK,MAAM,GAAG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AI,OAAO;GAAG,cAAc,SAAS,IAAI,KAAK;GAAG,eAAe,QAAQ,KAAK;IAAE,MAAM;IAAU,MAAM,IAAI;GAAK,CAAC;GAAG,eAAe,QAAQ,KAAK;IAAE,MAAM;IAAS,MAAM,IAAI;GAAK,CAAC;GAAG,UAAU,OAAO;IAAE,MAAM,OAAO,KAAK,KAAK,MAAM,GAAG;IAAG,IAAI,CAAC,MAAM;IAAQ,MAAM,eAAe;IAAG,QAAQ,KAAK;KAAE,MAAM;KAAS,MAAM;IAAK,CAAC;IAAG,qBAAqB,QAAQ,MAAM,QAAqB,YAAY,QAAQ,MAAM,GAAG,GAAG,UAAU,IAAI,GAAG,CAAC,EAAE,MAAM,CAAC;GAAG;GAAG,IAAI,YAAY,QAAQ,MAAM,GAAG,GAAG,IAAI;EAAM,CAAC;CAC9xB;AACF"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export declare const CARD_PADDINGS: readonly ["none", "small", "normal"];
|
|
2
|
+
export declare const CARD_HEADING_LEVELS: readonly [2, 3, 4, 5, 6];
|
|
3
|
+
export declare const CARD_MEDIA_POSITIONS: readonly ["before-header", "after-header"];
|
|
4
|
+
export declare const CARD_PARTS: readonly ["header", "heading-group", "title", "description", "custom-header", "actions", "media", "content", "footer"];
|
|
5
|
+
export type CardPadding = (typeof CARD_PADDINGS)[number];
|
|
6
|
+
export type CardHeadingLevel = (typeof CARD_HEADING_LEVELS)[number];
|
|
7
|
+
export type CardMediaPosition = (typeof CARD_MEDIA_POSITIONS)[number];
|
|
8
|
+
export type CardPart = (typeof CARD_PARTS)[number];
|
|
9
|
+
export interface QwCardProps {
|
|
10
|
+
/** Stable identity; frameworks generate one when omitted. Native SSR requires one. */
|
|
11
|
+
id?: string;
|
|
12
|
+
/** Scalar heading; a provided rich header replaces it. */
|
|
13
|
+
title?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
headingLevel?: CardHeadingLevel;
|
|
16
|
+
padding?: CardPadding;
|
|
17
|
+
bordered?: boolean;
|
|
18
|
+
elevated?: boolean;
|
|
19
|
+
mediaPosition?: CardMediaPosition;
|
|
20
|
+
/** Explicit accessible name/description references, overriding generated references. */
|
|
21
|
+
labelledBy?: string;
|
|
22
|
+
describedBy?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface CardPresence {
|
|
25
|
+
header?: boolean;
|
|
26
|
+
actions?: boolean;
|
|
27
|
+
media?: boolean;
|
|
28
|
+
default?: boolean;
|
|
29
|
+
footer?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface ResolvedCardState {
|
|
32
|
+
id: string;
|
|
33
|
+
title: string;
|
|
34
|
+
description: string;
|
|
35
|
+
headingTag: `h${CardHeadingLevel}`;
|
|
36
|
+
padding: CardPadding;
|
|
37
|
+
bordered: boolean;
|
|
38
|
+
elevated: boolean;
|
|
39
|
+
mediaPosition: CardMediaPosition;
|
|
40
|
+
titleId?: string;
|
|
41
|
+
descriptionId?: string;
|
|
42
|
+
labelledBy?: string;
|
|
43
|
+
describedBy?: string;
|
|
44
|
+
ariaLabel?: string;
|
|
45
|
+
order: readonly ("header" | "media" | "content" | "footer")[];
|
|
46
|
+
visible: Readonly<Record<CardPart, boolean>>;
|
|
47
|
+
}
|
|
48
|
+
export declare function resolveCardState(props: QwCardProps, presence?: CardPresence, fallbackId?: string, attributes?: Readonly<Record<string, unknown>>): ResolvedCardState;
|
|
49
|
+
export interface CardRootProps {
|
|
50
|
+
role: "group";
|
|
51
|
+
"data-scope": "card";
|
|
52
|
+
"data-part": "root";
|
|
53
|
+
"data-padding": CardPadding;
|
|
54
|
+
"data-media-position": CardMediaPosition;
|
|
55
|
+
"data-bordered"?: "true";
|
|
56
|
+
"data-elevated"?: "true";
|
|
57
|
+
"aria-labelledby"?: string;
|
|
58
|
+
"aria-describedby"?: string;
|
|
59
|
+
"aria-label"?: string;
|
|
60
|
+
}
|
|
61
|
+
export declare function getCardRootProps(state: ResolvedCardState): CardRootProps;
|
|
62
|
+
export interface CardPartProps {
|
|
63
|
+
"data-scope": "card";
|
|
64
|
+
"data-part": CardPart;
|
|
65
|
+
hidden: boolean;
|
|
66
|
+
id?: string;
|
|
67
|
+
}
|
|
68
|
+
export declare function getCardPartProps(state: ResolvedCardState, part: CardPart): CardPartProps;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { CARD_PADDINGS, CARD_HEADING_LEVELS, CARD_MEDIA_POSITIONS, CARD_PARTS, resolveCardState, getCardRootProps, getCardPartProps } from "./card.js";
|
|
2
|
+
export type { CardPadding, CardHeadingLevel, CardMediaPosition, CardPart, QwCardProps, CardPresence, ResolvedCardState, CardRootProps, CardPartProps } from "./card.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as getCardPartProps, i as CARD_PARTS, n as CARD_MEDIA_POSITIONS, o as getCardRootProps, r as CARD_PADDINGS, s as resolveCardState, t as CARD_HEADING_LEVELS } from "../card-DRtWa6Cr.js";
|
|
2
|
+
export { CARD_HEADING_LEVELS, CARD_MEDIA_POSITIONS, CARD_PADDINGS, CARD_PARTS, getCardPartProps, getCardRootProps, resolveCardState };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
//#region src/card/card.ts
|
|
2
|
+
const CARD_PADDINGS = [
|
|
3
|
+
"none",
|
|
4
|
+
"small",
|
|
5
|
+
"normal"
|
|
6
|
+
];
|
|
7
|
+
const CARD_HEADING_LEVELS = [
|
|
8
|
+
2,
|
|
9
|
+
3,
|
|
10
|
+
4,
|
|
11
|
+
5,
|
|
12
|
+
6
|
|
13
|
+
];
|
|
14
|
+
const CARD_MEDIA_POSITIONS = ["before-header", "after-header"];
|
|
15
|
+
const CARD_PARTS = [
|
|
16
|
+
"header",
|
|
17
|
+
"heading-group",
|
|
18
|
+
"title",
|
|
19
|
+
"description",
|
|
20
|
+
"custom-header",
|
|
21
|
+
"actions",
|
|
22
|
+
"media",
|
|
23
|
+
"content",
|
|
24
|
+
"footer"
|
|
25
|
+
];
|
|
26
|
+
const text = (value) => typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
27
|
+
/** UTF-16 encoding keeps references safe even for whitespace or lone-surrogate caller ids. */
|
|
28
|
+
function identityPrefix(id) {
|
|
29
|
+
return `qw-card-${id.split("").map((char) => char.charCodeAt(0).toString(16).padStart(4, "0")).join("")}`;
|
|
30
|
+
}
|
|
31
|
+
function resolveCardState(props, presence = {}, fallbackId, attributes = {}) {
|
|
32
|
+
const id = text(props.id) ? props.id : fallbackId;
|
|
33
|
+
if (!text(id)) throw new TypeError("Card requires a non-empty stable id");
|
|
34
|
+
const richHeader = !!presence.header;
|
|
35
|
+
const showTitle = !richHeader && !!text(props.title), showDescription = !richHeader && !!text(props.description);
|
|
36
|
+
const prefix = identityPrefix(id);
|
|
37
|
+
const titleId = showTitle ? `${prefix}-title` : void 0, descriptionId = showDescription ? `${prefix}-description` : void 0;
|
|
38
|
+
const ariaLabel = text(attributes["aria-label"]);
|
|
39
|
+
const labelledBy = text(props.labelledBy) ?? text(attributes["aria-labelledby"]) ?? (ariaLabel ? void 0 : titleId);
|
|
40
|
+
const describedBy = text(props.describedBy) ?? text(attributes["aria-describedby"]) ?? descriptionId;
|
|
41
|
+
const headingLevel = CARD_HEADING_LEVELS.includes(props.headingLevel) ? props.headingLevel : 3;
|
|
42
|
+
const padding = CARD_PADDINGS.includes(props.padding) ? props.padding : "normal";
|
|
43
|
+
const mediaPosition = CARD_MEDIA_POSITIONS.includes(props.mediaPosition) ? props.mediaPosition : "before-header";
|
|
44
|
+
return {
|
|
45
|
+
id,
|
|
46
|
+
title: props.title ?? "",
|
|
47
|
+
description: props.description ?? "",
|
|
48
|
+
headingTag: `h${headingLevel}`,
|
|
49
|
+
padding,
|
|
50
|
+
bordered: props.bordered ?? true,
|
|
51
|
+
elevated: props.elevated ?? false,
|
|
52
|
+
mediaPosition,
|
|
53
|
+
titleId,
|
|
54
|
+
descriptionId,
|
|
55
|
+
labelledBy,
|
|
56
|
+
describedBy,
|
|
57
|
+
ariaLabel,
|
|
58
|
+
order: mediaPosition === "before-header" ? [
|
|
59
|
+
"media",
|
|
60
|
+
"header",
|
|
61
|
+
"content",
|
|
62
|
+
"footer"
|
|
63
|
+
] : [
|
|
64
|
+
"header",
|
|
65
|
+
"media",
|
|
66
|
+
"content",
|
|
67
|
+
"footer"
|
|
68
|
+
],
|
|
69
|
+
visible: {
|
|
70
|
+
header: richHeader || showTitle || showDescription || !!presence.actions,
|
|
71
|
+
"heading-group": showTitle || showDescription,
|
|
72
|
+
title: showTitle,
|
|
73
|
+
description: showDescription,
|
|
74
|
+
"custom-header": richHeader,
|
|
75
|
+
actions: !!presence.actions,
|
|
76
|
+
media: !!presence.media,
|
|
77
|
+
content: !!presence.default,
|
|
78
|
+
footer: !!presence.footer
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function getCardRootProps(state) {
|
|
83
|
+
return {
|
|
84
|
+
role: "group",
|
|
85
|
+
"data-scope": "card",
|
|
86
|
+
"data-part": "root",
|
|
87
|
+
"data-padding": state.padding,
|
|
88
|
+
"data-media-position": state.mediaPosition,
|
|
89
|
+
...state.bordered ? { "data-bordered": "true" } : {},
|
|
90
|
+
...state.elevated ? { "data-elevated": "true" } : {},
|
|
91
|
+
"aria-labelledby": state.labelledBy,
|
|
92
|
+
"aria-describedby": state.describedBy,
|
|
93
|
+
"aria-label": state.ariaLabel
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function getCardPartProps(state, part) {
|
|
97
|
+
return {
|
|
98
|
+
"data-scope": "card",
|
|
99
|
+
"data-part": part,
|
|
100
|
+
hidden: !state.visible[part],
|
|
101
|
+
...part === "title" ? { id: state.titleId } : part === "description" ? { id: state.descriptionId } : {}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
export { getCardPartProps as a, CARD_PARTS as i, CARD_MEDIA_POSITIONS as n, getCardRootProps as o, CARD_PADDINGS as r, resolveCardState as s, CARD_HEADING_LEVELS as t };
|
|
106
|
+
|
|
107
|
+
//# sourceMappingURL=card-DRtWa6Cr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-DRtWa6Cr.js","names":[],"sources":["../src/card/card.ts"],"sourcesContent":["export const CARD_PADDINGS = [\"none\", \"small\", \"normal\"] as const;\nexport const CARD_HEADING_LEVELS = [2, 3, 4, 5, 6] as const;\nexport const CARD_MEDIA_POSITIONS = [\"before-header\", \"after-header\"] as const;\nexport const CARD_PARTS = [\"header\", \"heading-group\", \"title\", \"description\", \"custom-header\", \"actions\", \"media\", \"content\", \"footer\"] as const;\nexport type CardPadding = (typeof CARD_PADDINGS)[number];\nexport type CardHeadingLevel = (typeof CARD_HEADING_LEVELS)[number];\nexport type CardMediaPosition = (typeof CARD_MEDIA_POSITIONS)[number];\nexport type CardPart = (typeof CARD_PARTS)[number];\nexport interface QwCardProps {\n /** Stable identity; frameworks generate one when omitted. Native SSR requires one. */\n id?: string;\n /** Scalar heading; a provided rich header replaces it. */\n title?: string;\n description?: string;\n headingLevel?: CardHeadingLevel;\n padding?: CardPadding;\n bordered?: boolean;\n elevated?: boolean;\n mediaPosition?: CardMediaPosition;\n /** Explicit accessible name/description references, overriding generated references. */\n labelledBy?: string;\n describedBy?: string;\n}\nexport interface CardPresence { header?: boolean; actions?: boolean; media?: boolean; default?: boolean; footer?: boolean }\nexport interface ResolvedCardState {\n id: string; title: string; description: string;\n headingTag: `h${CardHeadingLevel}`; padding: CardPadding; bordered: boolean; elevated: boolean; mediaPosition: CardMediaPosition;\n titleId?: string; descriptionId?: string; labelledBy?: string; describedBy?: string; ariaLabel?: string;\n order: readonly (\"header\" | \"media\" | \"content\" | \"footer\")[];\n visible: Readonly<Record<CardPart, boolean>>;\n}\nconst text = (value: unknown): string | undefined => typeof value === \"string\" && value.trim() ? value.trim() : undefined;\n/** UTF-16 encoding keeps references safe even for whitespace or lone-surrogate caller ids. */\nfunction identityPrefix(id: string): string { return `qw-card-${id.split(\"\").map(char => char.charCodeAt(0).toString(16).padStart(4, \"0\")).join(\"\")}`; }\nexport function resolveCardState(props: QwCardProps, presence: CardPresence = {}, fallbackId?: string, attributes: Readonly<Record<string, unknown>> = {}): ResolvedCardState {\n const id = text(props.id) ? props.id! : fallbackId;\n if (!text(id)) throw new TypeError(\"Card requires a non-empty stable id\");\n const richHeader = !!presence.header;\n const showTitle = !richHeader && !!text(props.title), showDescription = !richHeader && !!text(props.description);\n const prefix = identityPrefix(id!);\n const titleId = showTitle ? `${prefix}-title` : undefined, descriptionId = showDescription ? `${prefix}-description` : undefined;\n const ariaLabel = text(attributes[\"aria-label\"]);\n const labelledBy = text(props.labelledBy) ?? text(attributes[\"aria-labelledby\"]) ?? (ariaLabel ? undefined : titleId);\n const describedBy = text(props.describedBy) ?? text(attributes[\"aria-describedby\"]) ?? descriptionId;\n const headingLevel = CARD_HEADING_LEVELS.includes(props.headingLevel!) ? props.headingLevel! : 3;\n const padding = CARD_PADDINGS.includes(props.padding!) ? props.padding! : \"normal\";\n const mediaPosition = CARD_MEDIA_POSITIONS.includes(props.mediaPosition!) ? props.mediaPosition! : \"before-header\";\n return {\n id: id!, title: props.title ?? \"\", description: props.description ?? \"\", headingTag: `h${headingLevel}`,\n padding, bordered: props.bordered ?? true, elevated: props.elevated ?? false, mediaPosition,\n titleId, descriptionId, labelledBy, describedBy, ariaLabel,\n order: mediaPosition === \"before-header\" ? [\"media\", \"header\", \"content\", \"footer\"] : [\"header\", \"media\", \"content\", \"footer\"],\n visible: {\n header: richHeader || showTitle || showDescription || !!presence.actions,\n \"heading-group\": showTitle || showDescription, title: showTitle, description: showDescription,\n \"custom-header\": richHeader, actions: !!presence.actions, media: !!presence.media, content: !!presence.default, footer: !!presence.footer,\n },\n };\n}\nexport interface CardRootProps {\n role: \"group\"; \"data-scope\": \"card\"; \"data-part\": \"root\"; \"data-padding\": CardPadding; \"data-media-position\": CardMediaPosition;\n \"data-bordered\"?: \"true\"; \"data-elevated\"?: \"true\";\n \"aria-labelledby\"?: string; \"aria-describedby\"?: string; \"aria-label\"?: string;\n}\nexport function getCardRootProps(state: ResolvedCardState): CardRootProps {\n return { role: \"group\", \"data-scope\": \"card\", \"data-part\": \"root\", \"data-padding\": state.padding, \"data-media-position\": state.mediaPosition,\n ...(state.bordered ? { \"data-bordered\": \"true\" as const } : {}), ...(state.elevated ? { \"data-elevated\": \"true\" as const } : {}),\n \"aria-labelledby\": state.labelledBy, \"aria-describedby\": state.describedBy, \"aria-label\": state.ariaLabel,\n };\n}\nexport interface CardPartProps { \"data-scope\": \"card\"; \"data-part\": CardPart; hidden: boolean; id?: string }\nexport function getCardPartProps(state: ResolvedCardState, part: CardPart): CardPartProps {\n return { \"data-scope\": \"card\", \"data-part\": part, hidden: !state.visible[part],\n ...(part === \"title\" ? { id: state.titleId } : part === \"description\" ? { id: state.descriptionId } : {}),\n };\n}\n"],"mappings":";AAAA,MAAa,gBAAgB;CAAC;CAAQ;CAAS;AAAQ;AACvD,MAAa,sBAAsB;CAAC;CAAG;CAAG;CAAG;CAAG;AAAC;AACjD,MAAa,uBAAuB,CAAC,iBAAiB,cAAc;AACpE,MAAa,aAAa;CAAC;CAAU;CAAiB;CAAS;CAAe;CAAiB;CAAW;CAAS;CAAW;AAAQ;AA4BtI,MAAM,QAAQ,UAAuC,OAAO,UAAU,YAAY,MAAM,KAAK,IAAI,MAAM,KAAK,IAAI,KAAA;;AAEhH,SAAS,eAAe,IAAoB;CAAE,OAAO,WAAW,GAAG,MAAM,EAAE,CAAC,CAAC,KAAI,SAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE;AAAK;AACvJ,SAAgB,iBAAiB,OAAoB,WAAyB,CAAC,GAAG,YAAqB,aAAgD,CAAC,GAAsB;CAC5K,MAAM,KAAK,KAAK,MAAM,EAAE,IAAI,MAAM,KAAM;CACxC,IAAI,CAAC,KAAK,EAAE,GAAG,MAAM,IAAI,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