ngwr 6.1.1 → 7.0.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/LICENSE +1 -3
- package/README.md +179 -32
- package/affix/styles/_index.scss +12 -0
- package/alert/styles/_index.scss +75 -32
- package/anchor/styles/_index.scss +59 -0
- package/aurora/aurora.scss +1 -0
- package/aurora/styles/_index.scss +30 -0
- package/avatar/styles/_index.scss +30 -14
- package/back-top/styles/_index.scss +42 -0
- package/badge/styles/_index.scss +80 -0
- package/badge/styles/_tag.scss +81 -0
- package/bar-chart/styles/_index.scss +56 -0
- package/blur-text/blur-text.scss +1 -0
- package/blur-text/styles/_index.scss +14 -0
- package/border-glow/border-glow.scss +4 -0
- package/border-glow/styles/_index.scss +228 -0
- package/breadcrumbs/breadcrumbs.scss +1 -0
- package/breadcrumbs/styles/_index.scss +76 -0
- package/button/styles/_index.scss +148 -125
- package/calendar/styles/_index.scss +252 -0
- package/calendar-heatmap/styles/_index.scss +69 -0
- package/card/card.scss +1 -0
- package/card/styles/_index.scss +96 -0
- package/carousel/styles/_index.scss +102 -0
- package/cascader/cascader.scss +1 -0
- package/cascader/styles/_index.scss +174 -0
- package/checkbox/styles/_index.scss +76 -60
- package/circular-text/circular-text.scss +1 -0
- package/circular-text/styles/_index.scss +45 -0
- package/click-spark/click-spark.scss +1 -0
- package/click-spark/styles/_index.scss +16 -0
- package/collapse/styles/_index.scss +92 -0
- package/color-picker/styles/_index.scss +247 -0
- package/command-palette/styles/_index.scss +188 -0
- package/compare/styles/_index.scss +100 -0
- package/context-menu/styles/_index.scss +112 -0
- package/counter/styles/_index.scss +44 -0
- package/date-picker/styles/_index.scss +204 -0
- package/decrypt-text/decrypt-text.scss +1 -0
- package/decrypt-text/styles/_index.scss +26 -0
- package/density/styles/_index.scss +37 -0
- package/descriptions/styles/_index.scss +104 -0
- package/dialog/styles/_index.scss +101 -27
- package/divider/styles/_index.scss +43 -24
- package/donut-chart/styles/_index.scss +76 -0
- package/drag-drop/sortable-list.scss +1 -0
- package/drag-drop/styles/_index.scss +99 -0
- package/drawer/styles/_index.scss +164 -0
- package/dropdown/styles/_index.scss +76 -56
- package/empty/styles/_index.scss +49 -0
- package/falling-text/falling-text.scss +1 -0
- package/falling-text/styles/_index.scss +30 -0
- package/fesm2022/ngwr-affix.mjs +102 -0
- package/fesm2022/ngwr-affix.mjs.map +1 -0
- package/fesm2022/ngwr-alert.mjs +70 -52
- package/fesm2022/ngwr-alert.mjs.map +1 -1
- package/fesm2022/ngwr-anchor.mjs +103 -0
- package/fesm2022/ngwr-anchor.mjs.map +1 -0
- package/fesm2022/ngwr-aurora.mjs +309 -0
- package/fesm2022/ngwr-aurora.mjs.map +1 -0
- package/fesm2022/ngwr-avatar.mjs +81 -71
- package/fesm2022/ngwr-avatar.mjs.map +1 -1
- package/fesm2022/ngwr-back-top.mjs +81 -0
- package/fesm2022/ngwr-back-top.mjs.map +1 -0
- package/fesm2022/ngwr-badge.mjs +192 -0
- package/fesm2022/ngwr-badge.mjs.map +1 -0
- package/fesm2022/ngwr-bar-chart.mjs +69 -0
- package/fesm2022/ngwr-bar-chart.mjs.map +1 -0
- package/fesm2022/ngwr-blur-text.mjs +181 -0
- package/fesm2022/ngwr-blur-text.mjs.map +1 -0
- package/fesm2022/ngwr-border-glow.mjs +278 -0
- package/fesm2022/ngwr-border-glow.mjs.map +1 -0
- package/fesm2022/ngwr-breadcrumbs.mjs +101 -0
- package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -0
- package/fesm2022/ngwr-button.mjs +179 -104
- package/fesm2022/ngwr-button.mjs.map +1 -1
- package/fesm2022/ngwr-calendar-heatmap.mjs +145 -0
- package/fesm2022/ngwr-calendar-heatmap.mjs.map +1 -0
- package/fesm2022/ngwr-calendar.mjs +402 -0
- package/fesm2022/ngwr-calendar.mjs.map +1 -0
- package/fesm2022/ngwr-card.mjs +100 -0
- package/fesm2022/ngwr-card.mjs.map +1 -0
- package/fesm2022/ngwr-carousel.mjs +128 -0
- package/fesm2022/ngwr-carousel.mjs.map +1 -0
- package/fesm2022/ngwr-cascader.mjs +280 -0
- package/fesm2022/ngwr-cascader.mjs.map +1 -0
- package/fesm2022/ngwr-checkbox.mjs +214 -54
- package/fesm2022/ngwr-checkbox.mjs.map +1 -1
- package/fesm2022/ngwr-circular-text.mjs +168 -0
- package/fesm2022/ngwr-circular-text.mjs.map +1 -0
- package/fesm2022/ngwr-click-spark.mjs +163 -0
- package/fesm2022/ngwr-click-spark.mjs.map +1 -0
- package/fesm2022/ngwr-clipboard.mjs +130 -0
- package/fesm2022/ngwr-clipboard.mjs.map +1 -0
- package/fesm2022/ngwr-collapse.mjs +232 -0
- package/fesm2022/ngwr-collapse.mjs.map +1 -0
- package/fesm2022/ngwr-color-picker.mjs +646 -0
- package/fesm2022/ngwr-color-picker.mjs.map +1 -0
- package/fesm2022/ngwr-command-palette.mjs +259 -0
- package/fesm2022/ngwr-command-palette.mjs.map +1 -0
- package/fesm2022/ngwr-compare.mjs +137 -0
- package/fesm2022/ngwr-compare.mjs.map +1 -0
- package/fesm2022/ngwr-confetti.mjs +160 -0
- package/fesm2022/ngwr-confetti.mjs.map +1 -0
- package/fesm2022/ngwr-context-menu.mjs +653 -0
- package/fesm2022/ngwr-context-menu.mjs.map +1 -0
- package/fesm2022/ngwr-cookie.mjs +127 -0
- package/fesm2022/ngwr-cookie.mjs.map +1 -0
- package/fesm2022/ngwr-counter.mjs +415 -0
- package/fesm2022/ngwr-counter.mjs.map +1 -0
- package/fesm2022/ngwr-date-adapter-fns.mjs +180 -0
- package/fesm2022/ngwr-date-adapter-fns.mjs.map +1 -0
- package/fesm2022/ngwr-date-adapter-luxon.mjs +201 -0
- package/fesm2022/ngwr-date-adapter-luxon.mjs.map +1 -0
- package/fesm2022/ngwr-date-adapter.mjs +419 -0
- package/fesm2022/ngwr-date-adapter.mjs.map +1 -0
- package/fesm2022/ngwr-date-picker.mjs +624 -0
- package/fesm2022/ngwr-date-picker.mjs.map +1 -0
- package/fesm2022/ngwr-decrypt-text.mjs +396 -0
- package/fesm2022/ngwr-decrypt-text.mjs.map +1 -0
- package/fesm2022/ngwr-density.mjs +157 -0
- package/fesm2022/ngwr-density.mjs.map +1 -0
- package/fesm2022/ngwr-descriptions.mjs +83 -0
- package/fesm2022/ngwr-descriptions.mjs.map +1 -0
- package/fesm2022/ngwr-dialog.mjs +249 -377
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-directives.mjs +315 -0
- package/fesm2022/ngwr-directives.mjs.map +1 -0
- package/fesm2022/ngwr-divider.mjs +74 -59
- package/fesm2022/ngwr-divider.mjs.map +1 -1
- package/fesm2022/ngwr-donut-chart.mjs +131 -0
- package/fesm2022/ngwr-donut-chart.mjs.map +1 -0
- package/fesm2022/ngwr-drag-drop.mjs +117 -0
- package/fesm2022/ngwr-drag-drop.mjs.map +1 -0
- package/fesm2022/ngwr-drawer.mjs +315 -0
- package/fesm2022/ngwr-drawer.mjs.map +1 -0
- package/fesm2022/ngwr-dropdown.mjs +276 -229
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-empty.mjs +57 -0
- package/fesm2022/ngwr-empty.mjs.map +1 -0
- package/fesm2022/ngwr-falling-text.mjs +316 -0
- package/fesm2022/ngwr-falling-text.mjs.map +1 -0
- package/fesm2022/ngwr-file-upload.mjs +260 -0
- package/fesm2022/ngwr-file-upload.mjs.map +1 -0
- package/fesm2022/ngwr-form.mjs +133 -48
- package/fesm2022/ngwr-form.mjs.map +1 -1
- package/fesm2022/ngwr-fuzzy-text.mjs +373 -0
- package/fesm2022/ngwr-fuzzy-text.mjs.map +1 -0
- package/fesm2022/ngwr-gauge.mjs +83 -0
- package/fesm2022/ngwr-gauge.mjs.map +1 -0
- package/fesm2022/ngwr-glitch-text.mjs +67 -0
- package/fesm2022/ngwr-glitch-text.mjs.map +1 -0
- package/fesm2022/ngwr-gradient-text.mjs +109 -0
- package/fesm2022/ngwr-gradient-text.mjs.map +1 -0
- package/fesm2022/ngwr-hotkey.mjs +263 -0
- package/fesm2022/ngwr-hotkey.mjs.map +1 -0
- package/fesm2022/ngwr-i18n-en.mjs +168 -0
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -0
- package/fesm2022/ngwr-i18n-ru.mjs +156 -0
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -0
- package/fesm2022/ngwr-i18n.mjs +478 -0
- package/fesm2022/ngwr-i18n.mjs.map +1 -0
- package/fesm2022/ngwr-icon-adapters-feather.mjs +74 -0
- package/fesm2022/ngwr-icon-adapters-feather.mjs.map +1 -0
- package/fesm2022/ngwr-icon-adapters-lucide.mjs +88 -0
- package/fesm2022/ngwr-icon-adapters-lucide.mjs.map +1 -0
- package/fesm2022/ngwr-icon.mjs +189 -649
- package/fesm2022/ngwr-icon.mjs.map +1 -1
- package/fesm2022/ngwr-image-cropper.mjs +299 -0
- package/fesm2022/ngwr-image-cropper.mjs.map +1 -0
- package/fesm2022/ngwr-input-number.mjs +239 -0
- package/fesm2022/ngwr-input-number.mjs.map +1 -0
- package/fesm2022/ngwr-input-otp.mjs +216 -0
- package/fesm2022/ngwr-input-otp.mjs.map +1 -0
- package/fesm2022/ngwr-input.mjs +183 -104
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-keyboard.mjs +47 -0
- package/fesm2022/ngwr-keyboard.mjs.map +1 -0
- package/fesm2022/ngwr-knob.mjs +227 -0
- package/fesm2022/ngwr-knob.mjs.map +1 -0
- package/fesm2022/ngwr-layout.mjs +197 -0
- package/fesm2022/ngwr-layout.mjs.map +1 -0
- package/fesm2022/ngwr-lightbox.mjs +131 -0
- package/fesm2022/ngwr-lightbox.mjs.map +1 -0
- package/fesm2022/ngwr-line-chart.mjs +176 -0
- package/fesm2022/ngwr-line-chart.mjs.map +1 -0
- package/fesm2022/ngwr-list.mjs +132 -0
- package/fesm2022/ngwr-list.mjs.map +1 -0
- package/fesm2022/ngwr-loading-bar.mjs +160 -0
- package/fesm2022/ngwr-loading-bar.mjs.map +1 -0
- package/fesm2022/ngwr-marquee.mjs +224 -0
- package/fesm2022/ngwr-marquee.mjs.map +1 -0
- package/fesm2022/ngwr-media.mjs +132 -0
- package/fesm2022/ngwr-media.mjs.map +1 -0
- package/fesm2022/ngwr-mention.mjs +374 -0
- package/fesm2022/ngwr-mention.mjs.map +1 -0
- package/fesm2022/ngwr-meta.mjs +266 -0
- package/fesm2022/ngwr-meta.mjs.map +1 -0
- package/fesm2022/ngwr-meter-group.mjs +73 -0
- package/fesm2022/ngwr-meter-group.mjs.map +1 -0
- package/fesm2022/ngwr-overlay.mjs +145 -0
- package/fesm2022/ngwr-overlay.mjs.map +1 -0
- package/fesm2022/ngwr-page-header.mjs +53 -0
- package/fesm2022/ngwr-page-header.mjs.map +1 -0
- package/fesm2022/ngwr-pagination.mjs +152 -96
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +290 -11
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-platform.mjs +63 -0
- package/fesm2022/ngwr-platform.mjs.map +1 -0
- package/fesm2022/ngwr-popconfirm.mjs +188 -0
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -0
- package/fesm2022/ngwr-popover.mjs +361 -0
- package/fesm2022/ngwr-popover.mjs.map +1 -0
- package/fesm2022/ngwr-progress.mjs +47 -39
- package/fesm2022/ngwr-progress.mjs.map +1 -1
- package/fesm2022/ngwr-qr.mjs +160 -179
- package/fesm2022/ngwr-qr.mjs.map +1 -1
- package/fesm2022/ngwr-radio.mjs +204 -0
- package/fesm2022/ngwr-radio.mjs.map +1 -0
- package/fesm2022/ngwr-rating.mjs +180 -0
- package/fesm2022/ngwr-rating.mjs.map +1 -0
- package/fesm2022/ngwr-result.mjs +119 -0
- package/fesm2022/ngwr-result.mjs.map +1 -0
- package/fesm2022/ngwr-rotating-text.mjs +256 -0
- package/fesm2022/ngwr-rotating-text.mjs.map +1 -0
- package/fesm2022/ngwr-scramble-text.mjs +165 -0
- package/fesm2022/ngwr-scramble-text.mjs.map +1 -0
- package/fesm2022/ngwr-scroll.mjs +107 -0
- package/fesm2022/ngwr-scroll.mjs.map +1 -0
- package/fesm2022/ngwr-segmented.mjs +96 -0
- package/fesm2022/ngwr-segmented.mjs.map +1 -0
- package/fesm2022/ngwr-select.mjs +844 -309
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-shiny-text.mjs +127 -0
- package/fesm2022/ngwr-shiny-text.mjs.map +1 -0
- package/fesm2022/ngwr-sidebar.mjs +134 -0
- package/fesm2022/ngwr-sidebar.mjs.map +1 -0
- package/fesm2022/ngwr-skeleton.mjs +59 -34
- package/fesm2022/ngwr-skeleton.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +234 -0
- package/fesm2022/ngwr-slider.mjs.map +1 -0
- package/fesm2022/ngwr-sparkline.mjs +104 -0
- package/fesm2022/ngwr-sparkline.mjs.map +1 -0
- package/fesm2022/ngwr-speed-dial.mjs +79 -0
- package/fesm2022/ngwr-speed-dial.mjs.map +1 -0
- package/fesm2022/ngwr-spinner.mjs +34 -28
- package/fesm2022/ngwr-spinner.mjs.map +1 -1
- package/fesm2022/ngwr-splash-cursor.mjs +970 -0
- package/fesm2022/ngwr-splash-cursor.mjs.map +1 -0
- package/fesm2022/ngwr-split-text.mjs +200 -0
- package/fesm2022/ngwr-split-text.mjs.map +1 -0
- package/fesm2022/ngwr-splitter.mjs +125 -0
- package/fesm2022/ngwr-splitter.mjs.map +1 -0
- package/fesm2022/ngwr-spotlight-card.mjs +138 -0
- package/fesm2022/ngwr-spotlight-card.mjs.map +1 -0
- package/fesm2022/ngwr-squircle.mjs +320 -0
- package/fesm2022/ngwr-squircle.mjs.map +1 -0
- package/fesm2022/ngwr-star-border.mjs +72 -0
- package/fesm2022/ngwr-star-border.mjs.map +1 -0
- package/fesm2022/ngwr-statistic.mjs +220 -0
- package/fesm2022/ngwr-statistic.mjs.map +1 -0
- package/fesm2022/ngwr-stepper.mjs +186 -0
- package/fesm2022/ngwr-stepper.mjs.map +1 -0
- package/fesm2022/ngwr-storage.mjs +317 -0
- package/fesm2022/ngwr-storage.mjs.map +1 -0
- package/fesm2022/ngwr-switch.mjs +99 -0
- package/fesm2022/ngwr-switch.mjs.map +1 -0
- package/fesm2022/ngwr-table.mjs +217 -206
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs.mjs +217 -0
- package/fesm2022/ngwr-tabs.mjs.map +1 -0
- package/fesm2022/ngwr-textarea.mjs +106 -120
- package/fesm2022/ngwr-textarea.mjs.map +1 -1
- package/fesm2022/ngwr-theme.mjs +152 -0
- package/fesm2022/ngwr-theme.mjs.map +1 -0
- package/fesm2022/ngwr-tilt-card.mjs +137 -0
- package/fesm2022/ngwr-tilt-card.mjs.map +1 -0
- package/fesm2022/ngwr-timeline.mjs +73 -0
- package/fesm2022/ngwr-timeline.mjs.map +1 -0
- package/fesm2022/ngwr-toast.mjs +446 -0
- package/fesm2022/ngwr-toast.mjs.map +1 -0
- package/fesm2022/ngwr-toolbar.mjs +46 -0
- package/fesm2022/ngwr-toolbar.mjs.map +1 -0
- package/fesm2022/ngwr-tree.mjs +483 -0
- package/fesm2022/ngwr-tree.mjs.map +1 -0
- package/fesm2022/ngwr-typewriter.mjs +229 -0
- package/fesm2022/ngwr-typewriter.mjs.map +1 -0
- package/fesm2022/ngwr-typography.mjs +79 -0
- package/fesm2022/ngwr-typography.mjs.map +1 -0
- package/fesm2022/ngwr-utils.mjs +535 -0
- package/fesm2022/ngwr-utils.mjs.map +1 -0
- package/fesm2022/ngwr-validators.mjs +214 -0
- package/fesm2022/ngwr-validators.mjs.map +1 -0
- package/fesm2022/ngwr-version.mjs +51 -0
- package/fesm2022/ngwr-version.mjs.map +1 -0
- package/fesm2022/ngwr-virtual-scroll.mjs +99 -0
- package/fesm2022/ngwr-virtual-scroll.mjs.map +1 -0
- package/fesm2022/ngwr-waves.mjs +356 -0
- package/fesm2022/ngwr-waves.mjs.map +1 -0
- package/fesm2022/ngwr-window.mjs +1141 -0
- package/fesm2022/ngwr-window.mjs.map +1 -0
- package/fesm2022/ngwr.mjs +0 -3
- package/fesm2022/ngwr.mjs.map +1 -1
- package/file-upload/styles/_index.scss +152 -0
- package/form/styles/_index.scss +85 -42
- package/gauge/styles/_index.scss +37 -0
- package/glitch-text/glitch-text.scss +1 -0
- package/glitch-text/styles/_index.scss +144 -0
- package/gradient-text/gradient-text.scss +1 -0
- package/gradient-text/styles/_index.scss +113 -0
- package/icon/styles/_index.scss +21 -15
- package/image-cropper/styles/_index.scss +114 -0
- package/input/styles/_index.scss +133 -93
- package/input-number/styles/_index.scss +75 -0
- package/input-otp/styles/_index.scss +53 -0
- package/keyboard/styles/_index.scss +55 -0
- package/knob/styles/_index.scss +54 -0
- package/layout/styles/_index.scss +65 -0
- package/lightbox/lightbox.scss +1 -0
- package/lightbox/styles/_index.scss +144 -0
- package/line-chart/styles/_index.scss +93 -0
- package/list/list.scss +1 -0
- package/list/styles/_index.scss +101 -0
- package/loading-bar/loading-bar.scss +1 -0
- package/loading-bar/styles/_index.scss +29 -0
- package/marquee/marquee.scss +1 -0
- package/marquee/styles/_index.scss +138 -0
- package/mention/styles/_index.scss +47 -0
- package/meter-group/styles/_index.scss +61 -0
- package/package.json +576 -99
- package/page-header/styles/_index.scss +78 -0
- package/pagination/styles/_index.scss +89 -34
- package/popconfirm/styles/_index.scss +32 -0
- package/popover/styles/_index.scss +83 -0
- package/progress/styles/_index.scss +29 -14
- package/qr/styles/_index.scss +6 -3
- package/radio/styles/_index.scss +111 -0
- package/rating/styles/_index.scss +63 -0
- package/result/styles/_index.scss +69 -0
- package/rotating-text/rotating-text.scss +1 -0
- package/rotating-text/styles/_index.scss +39 -0
- package/schematics/collection.json +37 -0
- package/schematics/component-style/index.js +49 -0
- package/{cdk/utils/index.d.ts → schematics/component-style/schema.js} +2 -8
- package/schematics/component-style/schema.json +20 -0
- package/schematics/icon-set/index.js +96 -0
- package/schematics/icon-set/schema.js +8 -0
- package/schematics/icon-set/schema.json +39 -0
- package/schematics/migrations/v7/index.js +187 -0
- package/schematics/migrations.json +10 -0
- package/schematics/ng-add/index.js +180 -0
- package/schematics/ng-add/schema.js +8 -0
- package/schematics/ng-add/schema.json +80 -0
- package/schematics/page/index.js +63 -0
- package/schematics/page/schema.js +8 -0
- package/schematics/page/schema.json +39 -0
- package/schematics/page/templates.js +198 -0
- package/schematics/provider/index.js +126 -0
- package/schematics/provider/schema.js +8 -0
- package/schematics/provider/schema.json +52 -0
- package/schematics/use/index.js +143 -0
- package/schematics/use/schema.js +8 -0
- package/schematics/use/schema.json +25 -0
- package/schematics/use/symbol-map.json +356 -0
- package/scramble-text/scramble-text.scss +1 -0
- package/scramble-text/styles/_index.scss +8 -0
- package/segmented/styles/_index.scss +92 -0
- package/select/styles/_index.scss +245 -159
- package/shiny-text/shiny-text.scss +1 -0
- package/shiny-text/styles/_index.scss +101 -0
- package/sidebar/styles/_index.scss +208 -0
- package/skeleton/styles/_index.scss +33 -33
- package/slider/styles/_index.scss +77 -0
- package/sparkline/styles/_index.scss +9 -0
- package/speed-dial/styles/_index.scss +158 -0
- package/spinner/styles/_index.scss +38 -22
- package/splash-cursor/splash-cursor.scss +1 -0
- package/splash-cursor/styles/_index.scss +27 -0
- package/split-text/split-text.scss +1 -0
- package/split-text/styles/_index.scss +22 -0
- package/splitter/styles/_index.scss +85 -0
- package/spotlight-card/spotlight-card.scss +1 -0
- package/spotlight-card/styles/_index.scss +43 -0
- package/squircle/styles/_index.scss +34 -0
- package/star-border/star-border.scss +1 -0
- package/star-border/styles/_index.scss +118 -0
- package/statistic/styles/_index.scss +54 -0
- package/stepper/styles/_index.scss +162 -0
- package/styles/_animations.scss +198 -0
- package/styles/_breakpoints.scss +75 -0
- package/styles/_grid.scss +71 -0
- package/styles/_reset.scss +123 -0
- package/styles/_typography.scss +122 -0
- package/styles.scss +102 -13
- package/switch/styles/_index.scss +82 -0
- package/table/styles/_index.scss +255 -4
- package/tabs/styles/_index.scss +71 -0
- package/textarea/styles/_index.scss +47 -56
- package/theme/styles/_colors.scss +83 -0
- package/theme/styles/_dark.scss +85 -0
- package/theme/styles/_focus.scss +93 -0
- package/theme/styles/_index.scss +5 -0
- package/theme/styles/_mixins.scss +57 -0
- package/theme/styles/_variables.scss +118 -0
- package/tilt-card/styles/_index.scss +40 -0
- package/tilt-card/tilt-card.scss +1 -0
- package/timeline/styles/_index.scss +127 -0
- package/toast/styles/_index.scss +263 -0
- package/toolbar/styles/_index.scss +65 -0
- package/tree/styles/_index.scss +271 -0
- package/types/ngwr-affix.d.ts +43 -0
- package/types/ngwr-alert.d.ts +68 -0
- package/types/ngwr-anchor.d.ts +53 -0
- package/types/ngwr-aurora.d.ts +52 -0
- package/types/ngwr-avatar.d.ts +90 -0
- package/types/ngwr-back-top.d.ts +37 -0
- package/types/ngwr-badge.d.ts +158 -0
- package/types/ngwr-bar-chart.d.ts +47 -0
- package/types/ngwr-blur-text.d.ts +62 -0
- package/types/ngwr-border-glow.d.ts +66 -0
- package/types/ngwr-breadcrumbs.d.ts +61 -0
- package/types/ngwr-button.d.ts +176 -0
- package/types/ngwr-calendar-heatmap.d.ts +58 -0
- package/types/ngwr-calendar.d.ts +116 -0
- package/types/ngwr-card.d.ts +50 -0
- package/types/ngwr-carousel.d.ts +57 -0
- package/types/ngwr-cascader.d.ts +107 -0
- package/types/ngwr-checkbox.d.ts +139 -0
- package/types/ngwr-circular-text.d.ts +49 -0
- package/types/ngwr-click-spark.d.ts +52 -0
- package/types/ngwr-clipboard.d.ts +53 -0
- package/types/ngwr-collapse.d.ts +139 -0
- package/types/ngwr-color-picker.d.ts +302 -0
- package/types/ngwr-command-palette.d.ts +113 -0
- package/types/ngwr-compare.d.ts +55 -0
- package/types/ngwr-confetti.d.ts +70 -0
- package/types/ngwr-context-menu.d.ts +207 -0
- package/types/ngwr-cookie.d.ts +60 -0
- package/types/ngwr-counter.d.ts +182 -0
- package/types/ngwr-date-adapter-fns.d.ts +73 -0
- package/types/ngwr-date-adapter-luxon.d.ts +73 -0
- package/types/ngwr-date-adapter.d.ts +198 -0
- package/types/ngwr-date-picker.d.ts +117 -0
- package/types/ngwr-decrypt-text.d.ts +85 -0
- package/types/ngwr-density.d.ts +97 -0
- package/types/ngwr-descriptions.d.ts +41 -0
- package/types/ngwr-dialog.d.ts +210 -0
- package/types/ngwr-directives.d.ts +125 -0
- package/types/ngwr-divider.d.ts +73 -0
- package/types/ngwr-donut-chart.d.ts +53 -0
- package/types/ngwr-drag-drop.d.ts +83 -0
- package/types/ngwr-drawer.d.ts +155 -0
- package/types/ngwr-dropdown.d.ts +124 -0
- package/types/ngwr-empty.d.ts +38 -0
- package/types/ngwr-falling-text.d.ts +63 -0
- package/types/ngwr-file-upload.d.ts +94 -0
- package/types/ngwr-form.d.ts +95 -0
- package/types/ngwr-fuzzy-text.d.ts +74 -0
- package/types/ngwr-gauge.d.ts +39 -0
- package/types/ngwr-glitch-text.d.ts +31 -0
- package/types/ngwr-gradient-text.d.ts +46 -0
- package/types/ngwr-hotkey.d.ts +142 -0
- package/types/ngwr-i18n-en.d.ts +18 -0
- package/types/ngwr-i18n-ru.d.ts +6 -0
- package/types/ngwr-i18n.d.ts +336 -0
- package/types/ngwr-icon-adapters-feather.d.ts +44 -0
- package/types/ngwr-icon-adapters-lucide.d.ts +54 -0
- package/types/ngwr-icon.d.ts +180 -0
- package/types/ngwr-image-cropper.d.ts +110 -0
- package/types/ngwr-input-number.d.ts +77 -0
- package/types/ngwr-input-otp.d.ts +78 -0
- package/types/ngwr-input.d.ts +131 -0
- package/types/ngwr-keyboard.d.ts +34 -0
- package/types/ngwr-knob.d.ts +77 -0
- package/types/ngwr-layout.d.ts +89 -0
- package/types/ngwr-lightbox.d.ts +50 -0
- package/types/ngwr-line-chart.d.ts +90 -0
- package/types/ngwr-list.d.ts +71 -0
- package/types/ngwr-loading-bar.d.ts +79 -0
- package/types/ngwr-marquee.d.ts +95 -0
- package/types/ngwr-media.d.ts +74 -0
- package/types/ngwr-mention.d.ts +110 -0
- package/types/ngwr-meta.d.ts +164 -0
- package/types/ngwr-meter-group.d.ts +57 -0
- package/types/ngwr-overlay.d.ts +110 -0
- package/types/ngwr-page-header.d.ts +35 -0
- package/types/ngwr-pagination.d.ts +119 -0
- package/types/ngwr-pipes.d.ts +177 -0
- package/types/ngwr-platform.d.ts +38 -0
- package/types/ngwr-popconfirm.d.ts +79 -0
- package/types/ngwr-popover.d.ts +90 -0
- package/types/ngwr-progress.d.ts +33 -0
- package/types/ngwr-qr.d.ts +56 -0
- package/types/ngwr-radio.d.ts +120 -0
- package/types/ngwr-rating.d.ts +62 -0
- package/types/ngwr-result.d.ts +64 -0
- package/types/ngwr-rotating-text.d.ts +72 -0
- package/types/ngwr-scramble-text.d.ts +49 -0
- package/types/ngwr-scroll.d.ts +65 -0
- package/types/ngwr-segmented.d.ts +65 -0
- package/types/ngwr-select.d.ts +413 -0
- package/types/ngwr-shiny-text.d.ts +70 -0
- package/types/ngwr-sidebar.d.ts +83 -0
- package/types/ngwr-skeleton.d.ts +41 -0
- package/types/ngwr-slider.d.ts +86 -0
- package/types/ngwr-sparkline.d.ts +48 -0
- package/types/ngwr-speed-dial.d.ts +51 -0
- package/types/ngwr-spinner.d.ts +41 -0
- package/types/ngwr-splash-cursor.d.ts +94 -0
- package/types/ngwr-split-text.d.ts +83 -0
- package/types/ngwr-splitter.d.ts +52 -0
- package/types/ngwr-spotlight-card.d.ts +71 -0
- package/types/ngwr-squircle.d.ts +132 -0
- package/types/ngwr-star-border.d.ts +40 -0
- package/types/ngwr-statistic.d.ts +88 -0
- package/types/ngwr-stepper.d.ts +99 -0
- package/types/ngwr-storage.d.ts +178 -0
- package/types/ngwr-switch.d.ts +39 -0
- package/types/ngwr-table.d.ts +237 -0
- package/types/ngwr-tabs.d.ts +125 -0
- package/types/ngwr-textarea.d.ts +60 -0
- package/types/ngwr-theme.d.ts +124 -0
- package/types/ngwr-tilt-card.d.ts +63 -0
- package/types/ngwr-timeline.d.ts +40 -0
- package/types/ngwr-toast.d.ts +230 -0
- package/types/ngwr-toolbar.d.ts +30 -0
- package/types/ngwr-tree.d.ts +150 -0
- package/types/ngwr-typewriter.d.ts +84 -0
- package/types/ngwr-typography.d.ts +56 -0
- package/types/ngwr-utils.d.ts +447 -0
- package/types/ngwr-validators.d.ts +70 -0
- package/types/ngwr-version.d.ts +44 -0
- package/types/ngwr-virtual-scroll.d.ts +64 -0
- package/types/ngwr-waves.d.ts +71 -0
- package/types/ngwr-window.d.ts +437 -0
- package/typewriter/styles/_index.scss +33 -0
- package/typewriter/typewriter.scss +1 -0
- package/typography/styles/_index.scss +211 -0
- package/virtual-scroll/styles/_index.scss +27 -0
- package/virtual-scroll/virtual-scroll.scss +1 -0
- package/waves/styles/_index.scss +24 -0
- package/waves/waves.scss +1 -0
- package/window/styles/_index.scss +430 -0
- package/alert/index.d.ts +0 -32
- package/alert/styles/theming.scss +0 -26
- package/alert/styles/vars.scss +0 -11
- package/avatar/index.d.ts +0 -30
- package/button/index.d.ts +0 -45
- package/button/styles/vars.scss +0 -13
- package/cdk/index.d.ts +0 -24
- package/cdk/rxjs/index.d.ts +0 -40
- package/cdk/types/index.d.ts +0 -27
- package/checkbox/index.d.ts +0 -31
- package/checkbox/styles/vars.scss +0 -16
- package/dialog/index.d.ts +0 -193
- package/dialog/styles/vars.scss +0 -7
- package/divider/index.d.ts +0 -16
- package/dropdown/index.d.ts +0 -68
- package/dropdown/styles/vars.scss +0 -18
- package/fesm2022/ngwr-cdk-rxjs.mjs +0 -53
- package/fesm2022/ngwr-cdk-rxjs.mjs.map +0 -1
- package/fesm2022/ngwr-cdk-types.mjs +0 -44
- package/fesm2022/ngwr-cdk-types.mjs.map +0 -1
- package/fesm2022/ngwr-cdk-utils.mjs +0 -30
- package/fesm2022/ngwr-cdk-utils.mjs.map +0 -1
- package/fesm2022/ngwr-cdk.mjs +0 -46
- package/fesm2022/ngwr-cdk.mjs.map +0 -1
- package/fesm2022/ngwr-tag.mjs +0 -87
- package/fesm2022/ngwr-tag.mjs.map +0 -1
- package/form/index.d.ts +0 -28
- package/icon/index.d.ts +0 -830
- package/icon/styles/vars.scss +0 -3
- package/input/index.d.ts +0 -43
- package/input/styles/vars.scss +0 -17
- package/pagination/index.d.ts +0 -34
- package/pagination/styles/vars.scss +0 -14
- package/pipes/index.d.ts +0 -17
- package/progress/index.d.ts +0 -13
- package/progress/styles/theming.scss +0 -8
- package/progress/styles/vars.scss +0 -6
- package/qr/index.d.ts +0 -127
- package/select/index.d.ts +0 -121
- package/select/styles/vars.scss +0 -32
- package/skeleton/index.d.ts +0 -13
- package/spinner/index.d.ts +0 -23
- package/styles/animations.scss +0 -92
- package/styles/cdk.scss +0 -5
- package/styles/colors.scss +0 -72
- package/styles/grid.scss +0 -99
- package/styles/maps.scss +0 -31
- package/styles/reset.scss +0 -112
- package/styles/variables.scss +0 -72
- package/table/index.d.ts +0 -101
- package/table/styles/table-filter.scss +0 -202
- package/table/styles/table-sort.scss +0 -47
- package/table/styles/table.scss +0 -232
- package/table/styles/vars.scss +0 -21
- package/tag/index.d.ts +0 -24
- package/tag/styles/_index.scss +0 -32
- package/tag/styles/theming.scss +0 -21
- package/tag/styles/vars.scss +0 -12
- package/textarea/index.d.ts +0 -47
- package/textarea/styles/vars.scss +0 -17
- /package/{index.d.ts → types/ngwr.d.ts} +0 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { coerceNumberProperty, coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { input, computed, ViewEncapsulation, Component } from '@angular/core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
*
|
|
8
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
9
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
10
|
+
*/
|
|
11
|
+
function toIso(d) {
|
|
12
|
+
const y = d.getFullYear();
|
|
13
|
+
const m = String(d.getMonth() + 1).padStart(2, '0');
|
|
14
|
+
const day = String(d.getDate()).padStart(2, '0');
|
|
15
|
+
return `${y}-${m}-${day}`;
|
|
16
|
+
}
|
|
17
|
+
function parseInput(value) {
|
|
18
|
+
return value instanceof Date ? new Date(value) : new Date(`${value}T00:00:00`);
|
|
19
|
+
}
|
|
20
|
+
const WEEKDAY_LABELS = ['', 'Mon', '', 'Wed', '', 'Fri', ''];
|
|
21
|
+
const MONTH_LABELS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
22
|
+
/**
|
|
23
|
+
* GitHub-style year-grid heatmap. One column per ISO week, one row per
|
|
24
|
+
* weekday — cells coloured by `value` relative to the data set's max.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```html
|
|
28
|
+
* <wr-calendar-heatmap [data]="contributions" />
|
|
29
|
+
* <wr-calendar-heatmap [data]="data" [endDate]="today" [weeks]="26" color="#10b981" />
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @see https://ngwr.dev/components/calendar-heatmap
|
|
33
|
+
*/
|
|
34
|
+
class WrCalendarHeatmap {
|
|
35
|
+
data = input([], /* @ts-ignore */
|
|
36
|
+
...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
37
|
+
/** Last day to render. @default today */
|
|
38
|
+
endDate = input(null, /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "endDate" }] : /* istanbul ignore next */ []));
|
|
40
|
+
/** Number of weeks (columns) to render. @default 53 */
|
|
41
|
+
weeks = input(53, { ...(ngDevMode ? { debugName: "weeks" } : /* istanbul ignore next */ {}), transform: (v) => Math.max(4, coerceNumberProperty(v, 53)) });
|
|
42
|
+
/** Cell side in CSS pixels. @default 11 */
|
|
43
|
+
cellSize = input(11, { ...(ngDevMode ? { debugName: "cellSize" } : /* istanbul ignore next */ {}), transform: (v) => Math.max(4, coerceNumberProperty(v, 11)) });
|
|
44
|
+
/** Pixel gap between cells. @default 2 */
|
|
45
|
+
cellGap = input(2, { ...(ngDevMode ? { debugName: "cellGap" } : /* istanbul ignore next */ {}), transform: (v) => Math.max(0, coerceNumberProperty(v, 2)) });
|
|
46
|
+
/** Cell fill colour at full intensity. @default primary */
|
|
47
|
+
color = input('var(--wr-color-primary)', /* @ts-ignore */
|
|
48
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
49
|
+
/** Background colour for zero-value days. @default light tint */
|
|
50
|
+
emptyColor = input('rgba(var(--wr-color-light-rgb), 0.5)', /* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "emptyColor" }] : /* istanbul ignore next */ []));
|
|
52
|
+
/** Show the weekday + month labels around the grid. @default true */
|
|
53
|
+
showLabels = input(true, { ...(ngDevMode ? { debugName: "showLabels" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
54
|
+
weekdayLabels = WEEKDAY_LABELS;
|
|
55
|
+
cells = computed(() => {
|
|
56
|
+
const end = this.endDate() ? parseInput(this.endDate()) : new Date();
|
|
57
|
+
end.setHours(0, 0, 0, 0);
|
|
58
|
+
const weeks = this.weeks();
|
|
59
|
+
const totalDays = weeks * 7;
|
|
60
|
+
// Build value lookup.
|
|
61
|
+
const map = new Map();
|
|
62
|
+
for (const d of this.data()) {
|
|
63
|
+
const iso = toIso(parseInput(d.date));
|
|
64
|
+
map.set(iso, (map.get(iso) ?? 0) + d.value);
|
|
65
|
+
}
|
|
66
|
+
const max = [...map.values()].reduce((a, b) => Math.max(a, b), 0);
|
|
67
|
+
// Walk backwards from end day; arrange into columns by week, rows by weekday.
|
|
68
|
+
const out = [];
|
|
69
|
+
const start = new Date(end);
|
|
70
|
+
start.setDate(end.getDate() - totalDays + 1);
|
|
71
|
+
// Align start so column 0 begins on a Sunday (matches GitHub).
|
|
72
|
+
start.setDate(start.getDate() - start.getDay());
|
|
73
|
+
const cursor = new Date(start);
|
|
74
|
+
let column = 0;
|
|
75
|
+
while (cursor <= end) {
|
|
76
|
+
for (let row = 0; row < 7; row++) {
|
|
77
|
+
const iso = toIso(cursor);
|
|
78
|
+
const value = map.get(iso) ?? 0;
|
|
79
|
+
const intensity = max > 0 ? Math.min(1, value / max) : 0;
|
|
80
|
+
out.push({ iso, value, intensity, week: column, day: row });
|
|
81
|
+
cursor.setDate(cursor.getDate() + 1);
|
|
82
|
+
}
|
|
83
|
+
column++;
|
|
84
|
+
}
|
|
85
|
+
return out;
|
|
86
|
+
}, /* @ts-ignore */
|
|
87
|
+
...(ngDevMode ? [{ debugName: "cells" }] : /* istanbul ignore next */ []));
|
|
88
|
+
monthLabels = computed(() => {
|
|
89
|
+
// Pull the first cell of each visible month → render a label centered
|
|
90
|
+
// over its column.
|
|
91
|
+
const cells = this.cells();
|
|
92
|
+
const seen = new Set();
|
|
93
|
+
return cells
|
|
94
|
+
.filter(cell => {
|
|
95
|
+
const date = new Date(`${cell.iso}T00:00:00`);
|
|
96
|
+
if (date.getDate() !== 1)
|
|
97
|
+
return false;
|
|
98
|
+
const key = `${date.getFullYear()}-${date.getMonth()}`;
|
|
99
|
+
if (seen.has(key))
|
|
100
|
+
return false;
|
|
101
|
+
seen.add(key);
|
|
102
|
+
return true;
|
|
103
|
+
})
|
|
104
|
+
.map(cell => ({
|
|
105
|
+
label: MONTH_LABELS[new Date(`${cell.iso}T00:00:00`).getMonth()],
|
|
106
|
+
week: cell.week,
|
|
107
|
+
}));
|
|
108
|
+
}, /* @ts-ignore */
|
|
109
|
+
...(ngDevMode ? [{ debugName: "monthLabels" }] : /* istanbul ignore next */ []));
|
|
110
|
+
columnCount = computed(() => {
|
|
111
|
+
const cells = this.cells();
|
|
112
|
+
return cells.length === 0 ? 0 : cells[cells.length - 1].week + 1;
|
|
113
|
+
}, /* @ts-ignore */
|
|
114
|
+
...(ngDevMode ? [{ debugName: "columnCount" }] : /* istanbul ignore next */ []));
|
|
115
|
+
colorFor(intensity) {
|
|
116
|
+
if (intensity === 0)
|
|
117
|
+
return this.emptyColor();
|
|
118
|
+
return this.color();
|
|
119
|
+
}
|
|
120
|
+
opacityFor(intensity) {
|
|
121
|
+
if (intensity === 0)
|
|
122
|
+
return 1;
|
|
123
|
+
// 4 levels — match the GitHub aesthetic.
|
|
124
|
+
if (intensity < 0.25)
|
|
125
|
+
return 0.25;
|
|
126
|
+
if (intensity < 0.5)
|
|
127
|
+
return 0.5;
|
|
128
|
+
if (intensity < 0.75)
|
|
129
|
+
return 0.75;
|
|
130
|
+
return 1;
|
|
131
|
+
}
|
|
132
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: WrCalendarHeatmap, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
133
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: WrCalendarHeatmap, isStandalone: true, selector: "wr-calendar-heatmap", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, endDate: { classPropertyName: "endDate", publicName: "endDate", isSignal: true, isRequired: false, transformFunction: null }, weeks: { classPropertyName: "weeks", publicName: "weeks", isSignal: true, isRequired: false, transformFunction: null }, cellSize: { classPropertyName: "cellSize", publicName: "cellSize", isSignal: true, isRequired: false, transformFunction: null }, cellGap: { classPropertyName: "cellGap", publicName: "cellGap", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, emptyColor: { classPropertyName: "emptyColor", publicName: "emptyColor", isSignal: true, isRequired: false, transformFunction: null }, showLabels: { classPropertyName: "showLabels", publicName: "showLabels", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "wr-calendar-heatmap" }, ngImport: i0, template: "<div\n class=\"wr-calendar-heatmap__grid\"\n [style.--wr-heatmap-cell-size.px]=\"cellSize()\"\n [style.--wr-heatmap-cell-gap.px]=\"cellGap()\"\n [style.--wr-heatmap-columns]=\"columnCount()\"\n>\n @if (showLabels()) {\n <div class=\"wr-calendar-heatmap__weekdays\">\n @for (label of weekdayLabels; track $index) {\n <span class=\"wr-calendar-heatmap__weekday\">{{ label }}</span>\n }\n </div>\n }\n\n <div class=\"wr-calendar-heatmap__cells\">\n @for (cell of cells(); track cell.iso) {\n <span\n class=\"wr-calendar-heatmap__cell\"\n [style.background]=\"colorFor(cell.intensity)\"\n [style.opacity]=\"opacityFor(cell.intensity)\"\n [style.grid-column]=\"cell.week + 1\"\n [style.grid-row]=\"cell.day + 1\"\n [title]=\"`${cell.iso}: ${cell.value}`\"\n ></span>\n }\n </div>\n\n @if (showLabels()) {\n <div class=\"wr-calendar-heatmap__months\">\n @for (m of monthLabels(); track $index) {\n <span class=\"wr-calendar-heatmap__month\" [style.grid-column]=\"m.week + 1\">{{ m.label }}</span>\n }\n </div>\n }\n</div>\n", encapsulation: i0.ViewEncapsulation.None });
|
|
134
|
+
}
|
|
135
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: WrCalendarHeatmap, decorators: [{
|
|
136
|
+
type: Component,
|
|
137
|
+
args: [{ selector: 'wr-calendar-heatmap', encapsulation: ViewEncapsulation.None, host: { class: 'wr-calendar-heatmap' }, template: "<div\n class=\"wr-calendar-heatmap__grid\"\n [style.--wr-heatmap-cell-size.px]=\"cellSize()\"\n [style.--wr-heatmap-cell-gap.px]=\"cellGap()\"\n [style.--wr-heatmap-columns]=\"columnCount()\"\n>\n @if (showLabels()) {\n <div class=\"wr-calendar-heatmap__weekdays\">\n @for (label of weekdayLabels; track $index) {\n <span class=\"wr-calendar-heatmap__weekday\">{{ label }}</span>\n }\n </div>\n }\n\n <div class=\"wr-calendar-heatmap__cells\">\n @for (cell of cells(); track cell.iso) {\n <span\n class=\"wr-calendar-heatmap__cell\"\n [style.background]=\"colorFor(cell.intensity)\"\n [style.opacity]=\"opacityFor(cell.intensity)\"\n [style.grid-column]=\"cell.week + 1\"\n [style.grid-row]=\"cell.day + 1\"\n [title]=\"`${cell.iso}: ${cell.value}`\"\n ></span>\n }\n </div>\n\n @if (showLabels()) {\n <div class=\"wr-calendar-heatmap__months\">\n @for (m of monthLabels(); track $index) {\n <span class=\"wr-calendar-heatmap__month\" [style.grid-column]=\"m.week + 1\">{{ m.label }}</span>\n }\n </div>\n }\n</div>\n" }]
|
|
138
|
+
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], endDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "endDate", required: false }] }], weeks: [{ type: i0.Input, args: [{ isSignal: true, alias: "weeks", required: false }] }], cellSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "cellSize", required: false }] }], cellGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "cellGap", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], emptyColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyColor", required: false }] }], showLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLabels", required: false }] }] } });
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Generated bundle index. Do not edit.
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
export { WrCalendarHeatmap };
|
|
145
|
+
//# sourceMappingURL=ngwr-calendar-heatmap.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngwr-calendar-heatmap.mjs","sources":["../../../projects/lib/calendar-heatmap/calendar-heatmap.ts","../../../projects/lib/calendar-heatmap/calendar-heatmap.html","../../../projects/lib/calendar-heatmap/ngwr-calendar-heatmap.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport type { WrHeatmapDatum } from './interfaces';\n\ninterface Cell {\n readonly iso: string;\n readonly value: number;\n readonly intensity: number;\n readonly week: number;\n readonly day: number;\n}\n\nfunction toIso(d: Date): string {\n const y = d.getFullYear();\n const m = String(d.getMonth() + 1).padStart(2, '0');\n const day = String(d.getDate()).padStart(2, '0');\n return `${y}-${m}-${day}`;\n}\n\nfunction parseInput(value: string | Date): Date {\n return value instanceof Date ? new Date(value) : new Date(`${value}T00:00:00`);\n}\n\nconst WEEKDAY_LABELS = ['', 'Mon', '', 'Wed', '', 'Fri', ''];\nconst MONTH_LABELS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\n\n/**\n * GitHub-style year-grid heatmap. One column per ISO week, one row per\n * weekday — cells coloured by `value` relative to the data set's max.\n *\n * @example\n * ```html\n * <wr-calendar-heatmap [data]=\"contributions\" />\n * <wr-calendar-heatmap [data]=\"data\" [endDate]=\"today\" [weeks]=\"26\" color=\"#10b981\" />\n * ```\n *\n * @see https://ngwr.dev/components/calendar-heatmap\n */\n@Component({\n selector: 'wr-calendar-heatmap',\n templateUrl: './calendar-heatmap.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-calendar-heatmap' },\n})\nexport class WrCalendarHeatmap {\n readonly data = input<readonly WrHeatmapDatum[]>([]);\n\n /** Last day to render. @default today */\n readonly endDate = input<string | Date | null>(null);\n\n /** Number of weeks (columns) to render. @default 53 */\n readonly weeks = input(53, { transform: (v: unknown): number => Math.max(4, coerceNumberProperty(v, 53)) });\n\n /** Cell side in CSS pixels. @default 11 */\n readonly cellSize = input(11, { transform: (v: unknown): number => Math.max(4, coerceNumberProperty(v, 11)) });\n\n /** Pixel gap between cells. @default 2 */\n readonly cellGap = input(2, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 2)) });\n\n /** Cell fill colour at full intensity. @default primary */\n readonly color = input<string>('var(--wr-color-primary)');\n\n /** Background colour for zero-value days. @default light tint */\n readonly emptyColor = input<string>('rgba(var(--wr-color-light-rgb), 0.5)');\n\n /** Show the weekday + month labels around the grid. @default true */\n readonly showLabels = input(true, { transform: coerceBooleanProperty });\n\n protected readonly weekdayLabels = WEEKDAY_LABELS;\n\n protected readonly cells = computed<readonly Cell[]>(() => {\n const end = this.endDate() ? parseInput(this.endDate()!) : new Date();\n end.setHours(0, 0, 0, 0);\n const weeks = this.weeks();\n const totalDays = weeks * 7;\n\n // Build value lookup.\n const map = new Map<string, number>();\n for (const d of this.data()) {\n const iso = toIso(parseInput(d.date));\n map.set(iso, (map.get(iso) ?? 0) + d.value);\n }\n const max = [...map.values()].reduce((a, b) => Math.max(a, b), 0);\n\n // Walk backwards from end day; arrange into columns by week, rows by weekday.\n const out: Cell[] = [];\n const start = new Date(end);\n start.setDate(end.getDate() - totalDays + 1);\n // Align start so column 0 begins on a Sunday (matches GitHub).\n start.setDate(start.getDate() - start.getDay());\n\n const cursor = new Date(start);\n let column = 0;\n while (cursor <= end) {\n for (let row = 0; row < 7; row++) {\n const iso = toIso(cursor);\n const value = map.get(iso) ?? 0;\n const intensity = max > 0 ? Math.min(1, value / max) : 0;\n out.push({ iso, value, intensity, week: column, day: row });\n cursor.setDate(cursor.getDate() + 1);\n }\n column++;\n }\n return out;\n });\n\n protected readonly monthLabels = computed(() => {\n // Pull the first cell of each visible month → render a label centered\n // over its column.\n const cells = this.cells();\n const seen = new Set<string>();\n return cells\n .filter(cell => {\n const date = new Date(`${cell.iso}T00:00:00`);\n if (date.getDate() !== 1) return false;\n const key = `${date.getFullYear()}-${date.getMonth()}`;\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n })\n .map(cell => ({\n label: MONTH_LABELS[new Date(`${cell.iso}T00:00:00`).getMonth()],\n week: cell.week,\n }));\n });\n\n protected readonly columnCount = computed(() => {\n const cells = this.cells();\n return cells.length === 0 ? 0 : cells[cells.length - 1].week + 1;\n });\n\n protected colorFor(intensity: number): string {\n if (intensity === 0) return this.emptyColor();\n return this.color();\n }\n\n protected opacityFor(intensity: number): number {\n if (intensity === 0) return 1;\n // 4 levels — match the GitHub aesthetic.\n if (intensity < 0.25) return 0.25;\n if (intensity < 0.5) return 0.5;\n if (intensity < 0.75) return 0.75;\n return 1;\n }\n}\n\nexport type { WrHeatmapDatum } from './interfaces';\n","<div\n class=\"wr-calendar-heatmap__grid\"\n [style.--wr-heatmap-cell-size.px]=\"cellSize()\"\n [style.--wr-heatmap-cell-gap.px]=\"cellGap()\"\n [style.--wr-heatmap-columns]=\"columnCount()\"\n>\n @if (showLabels()) {\n <div class=\"wr-calendar-heatmap__weekdays\">\n @for (label of weekdayLabels; track $index) {\n <span class=\"wr-calendar-heatmap__weekday\">{{ label }}</span>\n }\n </div>\n }\n\n <div class=\"wr-calendar-heatmap__cells\">\n @for (cell of cells(); track cell.iso) {\n <span\n class=\"wr-calendar-heatmap__cell\"\n [style.background]=\"colorFor(cell.intensity)\"\n [style.opacity]=\"opacityFor(cell.intensity)\"\n [style.grid-column]=\"cell.week + 1\"\n [style.grid-row]=\"cell.day + 1\"\n [title]=\"`${cell.iso}: ${cell.value}`\"\n ></span>\n }\n </div>\n\n @if (showLabels()) {\n <div class=\"wr-calendar-heatmap__months\">\n @for (m of monthLabels(); track $index) {\n <span class=\"wr-calendar-heatmap__month\" [style.grid-column]=\"m.week + 1\">{{ m.label }}</span>\n }\n </div>\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { input, model, inject, ElementRef, signal, computed, afterNextRender, effect, untracked, ViewEncapsulation, Component } from '@angular/core';
|
|
4
|
+
import { WrDateAdapter } from 'ngwr/date-adapter';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @license
|
|
8
|
+
*
|
|
9
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
11
|
+
*/
|
|
12
|
+
const ROWS = 6;
|
|
13
|
+
const COLS = 7;
|
|
14
|
+
/**
|
|
15
|
+
* Month-view calendar. Supports single-date selection (`mode="single"`) or
|
|
16
|
+
* date-range selection (`mode="range"`). Reusable on its own; consumed by
|
|
17
|
+
* `<wr-date-picker>` inside an overlay.
|
|
18
|
+
*
|
|
19
|
+
* Uses {@link WrDateAdapter} for all date math and formatting — register
|
|
20
|
+
* one via {@link provideWrDateAdapter} at bootstrap.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```html
|
|
24
|
+
* <wr-calendar [(date)]="picked" [min]="minDate" />
|
|
25
|
+
*
|
|
26
|
+
* <wr-calendar mode="range" [(range)]="[start, end]" />
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @see https://ngwr.dev/components/calendar
|
|
30
|
+
*/
|
|
31
|
+
class WrCalendar {
|
|
32
|
+
/** Selection mode. @default 'single' */
|
|
33
|
+
mode = input('single', /* @ts-ignore */
|
|
34
|
+
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
35
|
+
/** Two-way bindable single value (used when `mode === 'single'`). */
|
|
36
|
+
date = model(null, /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "date" }] : /* istanbul ignore next */ []));
|
|
38
|
+
/** Two-way bindable `[start, end]` (used when `mode === 'range'`). */
|
|
39
|
+
range = model([null, null], /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "range" }] : /* istanbul ignore next */ []));
|
|
41
|
+
/** Min selectable date (inclusive). */
|
|
42
|
+
min = input(null, /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
|
|
44
|
+
/** Max selectable date (inclusive). */
|
|
45
|
+
max = input(null, /* @ts-ignore */
|
|
46
|
+
...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
47
|
+
/** Predicate — return `false` to disable specific dates (e.g. weekends only). */
|
|
48
|
+
dateFilter = input(null, /* @ts-ignore */
|
|
49
|
+
...(ngDevMode ? [{ debugName: "dateFilter" }] : /* istanbul ignore next */ []));
|
|
50
|
+
/** Disable interaction entirely. @default false */
|
|
51
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
52
|
+
adapter = inject(WrDateAdapter);
|
|
53
|
+
host = inject(ElementRef);
|
|
54
|
+
/** Currently displayed month (any date inside it). */
|
|
55
|
+
viewDate = signal(this.adapter.today(), /* @ts-ignore */
|
|
56
|
+
...(ngDevMode ? [{ debugName: "viewDate" }] : /* istanbul ignore next */ []));
|
|
57
|
+
/** Date currently focused by keyboard (single roving tabindex). */
|
|
58
|
+
focusedDate = signal(this.adapter.today(), /* @ts-ignore */
|
|
59
|
+
...(ngDevMode ? [{ debugName: "focusedDate" }] : /* istanbul ignore next */ []));
|
|
60
|
+
/** Hovered date during range-mode end-pick — drives the preview highlight. */
|
|
61
|
+
hoverDate = signal(null, /* @ts-ignore */
|
|
62
|
+
...(ngDevMode ? [{ debugName: "hoverDate" }] : /* istanbul ignore next */ []));
|
|
63
|
+
/** Which sub-view is currently shown. Cycles `day → month → year` on header click. */
|
|
64
|
+
viewMode = signal('day', /* @ts-ignore */
|
|
65
|
+
...(ngDevMode ? [{ debugName: "viewMode" }] : /* istanbul ignore next */ []));
|
|
66
|
+
today = computed(() => this.adapter.today(), /* @ts-ignore */
|
|
67
|
+
...(ngDevMode ? [{ debugName: "today" }] : /* istanbul ignore next */ []));
|
|
68
|
+
weekdayNames = computed(() => this.adapter.getDayOfWeekNames('short'), /* @ts-ignore */
|
|
69
|
+
...(ngDevMode ? [{ debugName: "weekdayNames" }] : /* istanbul ignore next */ []));
|
|
70
|
+
monthsView = computed(() => this.adapter.getMonthNames('short'), /* @ts-ignore */
|
|
71
|
+
...(ngDevMode ? [{ debugName: "monthsView" }] : /* istanbul ignore next */ []));
|
|
72
|
+
/** 12-year window centered on the floor-aligned decade containing `viewDate`. */
|
|
73
|
+
yearsView = computed(() => {
|
|
74
|
+
const y = this.adapter.getYear(this.viewDate());
|
|
75
|
+
const start = Math.floor(y / 12) * 12;
|
|
76
|
+
return Array.from({ length: 12 }, (_, i) => start + i);
|
|
77
|
+
}, /* @ts-ignore */
|
|
78
|
+
...(ngDevMode ? [{ debugName: "yearsView" }] : /* istanbul ignore next */ []));
|
|
79
|
+
headerLabel = computed(() => {
|
|
80
|
+
const v = this.viewDate();
|
|
81
|
+
switch (this.viewMode()) {
|
|
82
|
+
case 'day': {
|
|
83
|
+
const monthNames = this.adapter.getMonthNames('long');
|
|
84
|
+
return `${monthNames[this.adapter.getMonth(v)]} ${this.adapter.getYear(v)}`;
|
|
85
|
+
}
|
|
86
|
+
case 'month':
|
|
87
|
+
return `${this.adapter.getYear(v)}`;
|
|
88
|
+
case 'year': {
|
|
89
|
+
const years = this.yearsView();
|
|
90
|
+
return `${years[0]} – ${years[years.length - 1]}`;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}, /* @ts-ignore */
|
|
94
|
+
...(ngDevMode ? [{ debugName: "headerLabel" }] : /* istanbul ignore next */ []));
|
|
95
|
+
/** 6×7 day grid covering the current month plus spillover. */
|
|
96
|
+
weeks = computed(() => {
|
|
97
|
+
const view = this.viewDate();
|
|
98
|
+
const year = this.adapter.getYear(view);
|
|
99
|
+
const month = this.adapter.getMonth(view);
|
|
100
|
+
const firstOfMonth = this.adapter.createDate(year, month, 1);
|
|
101
|
+
const firstWeekday = this.adapter.getDayOfWeek(firstOfMonth);
|
|
102
|
+
const firstDayOfWeek = this.adapter.getFirstDayOfWeek();
|
|
103
|
+
const lead = (firstWeekday - firstDayOfWeek + 7) % 7;
|
|
104
|
+
const gridStart = this.adapter.addDays(firstOfMonth, -lead);
|
|
105
|
+
const out = [];
|
|
106
|
+
for (let w = 0; w < ROWS; w++) {
|
|
107
|
+
const row = [];
|
|
108
|
+
for (let d = 0; d < COLS; d++) {
|
|
109
|
+
row.push(this.adapter.addDays(gridStart, w * COLS + d));
|
|
110
|
+
}
|
|
111
|
+
out.push(row);
|
|
112
|
+
}
|
|
113
|
+
return out;
|
|
114
|
+
}, /* @ts-ignore */
|
|
115
|
+
...(ngDevMode ? [{ debugName: "weeks" }] : /* istanbul ignore next */ []));
|
|
116
|
+
classes = computed(() => {
|
|
117
|
+
const parts = ['wr-calendar', `wr-calendar--${this.mode()}`];
|
|
118
|
+
if (this.disabled())
|
|
119
|
+
parts.push('wr-calendar--disabled');
|
|
120
|
+
return parts.join(' ');
|
|
121
|
+
}, /* @ts-ignore */
|
|
122
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
123
|
+
constructor() {
|
|
124
|
+
// Initial focus: selected date if any, else today. Also snap viewDate to that month.
|
|
125
|
+
afterNextRender(() => {
|
|
126
|
+
const initial = this.date() ?? this.range()[0] ?? this.adapter.today();
|
|
127
|
+
this.focusedDate.set(initial);
|
|
128
|
+
this.viewDate.set(initial);
|
|
129
|
+
});
|
|
130
|
+
// Keep viewDate in sync when date / range changes externally to a
|
|
131
|
+
// different month. The viewDate read must stay untracked — otherwise
|
|
132
|
+
// the effect re-runs on every internal navigation (month stepping,
|
|
133
|
+
// year picking) and snaps the view back to the selected month.
|
|
134
|
+
effect(() => {
|
|
135
|
+
const candidate = this.mode() === 'single' ? this.date() : this.range()[0];
|
|
136
|
+
if (!candidate)
|
|
137
|
+
return;
|
|
138
|
+
untracked(() => {
|
|
139
|
+
if (!this.adapter.isSameMonth(candidate, this.viewDate())) {
|
|
140
|
+
this.viewDate.set(candidate);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
// Navigation
|
|
146
|
+
/** Header `‹` button — steps by month / year / decade based on the active view. */
|
|
147
|
+
prev() {
|
|
148
|
+
this.viewDate.set(this.stepViewDate(-1));
|
|
149
|
+
}
|
|
150
|
+
/** Header `›` button — steps by month / year / decade based on the active view. */
|
|
151
|
+
next() {
|
|
152
|
+
this.viewDate.set(this.stepViewDate(1));
|
|
153
|
+
}
|
|
154
|
+
/** Header label click — zooms out (`day → month → year`). No-op at year view. */
|
|
155
|
+
onLabelClick() {
|
|
156
|
+
if (this.disabled())
|
|
157
|
+
return;
|
|
158
|
+
if (this.viewMode() === 'day') {
|
|
159
|
+
this.viewMode.set('month');
|
|
160
|
+
}
|
|
161
|
+
else if (this.viewMode() === 'month') {
|
|
162
|
+
this.viewMode.set('year');
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
onMonthSelect(monthIdx) {
|
|
166
|
+
if (this.isMonthDisabled(monthIdx))
|
|
167
|
+
return;
|
|
168
|
+
const v = this.viewDate();
|
|
169
|
+
this.viewDate.set(this.adapter.createDate(this.adapter.getYear(v), monthIdx, 1));
|
|
170
|
+
this.viewMode.set('day');
|
|
171
|
+
}
|
|
172
|
+
onYearSelect(year) {
|
|
173
|
+
if (this.isYearDisabled(year))
|
|
174
|
+
return;
|
|
175
|
+
const v = this.viewDate();
|
|
176
|
+
this.viewDate.set(this.adapter.createDate(year, this.adapter.getMonth(v), 1));
|
|
177
|
+
this.viewMode.set('month');
|
|
178
|
+
}
|
|
179
|
+
stepViewDate(direction) {
|
|
180
|
+
const v = this.viewDate();
|
|
181
|
+
switch (this.viewMode()) {
|
|
182
|
+
case 'day':
|
|
183
|
+
return this.adapter.addMonths(v, direction);
|
|
184
|
+
case 'month':
|
|
185
|
+
return this.adapter.addYears(v, direction);
|
|
186
|
+
case 'year':
|
|
187
|
+
return this.adapter.addYears(v, direction * 12);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
// Cell state predicates (used by template)
|
|
191
|
+
isToday(date) {
|
|
192
|
+
return this.adapter.isSameDay(date, this.today());
|
|
193
|
+
}
|
|
194
|
+
isOutOfMonth(date) {
|
|
195
|
+
return !this.adapter.isSameMonth(date, this.viewDate());
|
|
196
|
+
}
|
|
197
|
+
isSelected(date) {
|
|
198
|
+
if (this.mode() === 'single') {
|
|
199
|
+
const v = this.date();
|
|
200
|
+
return v ? this.adapter.isSameDay(date, v) : false;
|
|
201
|
+
}
|
|
202
|
+
const [start, end] = this.range();
|
|
203
|
+
if (start && this.adapter.isSameDay(date, start))
|
|
204
|
+
return true;
|
|
205
|
+
if (end && this.adapter.isSameDay(date, end))
|
|
206
|
+
return true;
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
isInRange(date) {
|
|
210
|
+
if (this.mode() !== 'range')
|
|
211
|
+
return false;
|
|
212
|
+
const [start, end] = this.range();
|
|
213
|
+
if (!start || !end)
|
|
214
|
+
return false;
|
|
215
|
+
return this.adapter.compareDate(date, start) > 0 && this.adapter.compareDate(date, end) < 0;
|
|
216
|
+
}
|
|
217
|
+
isInRangePreview(date) {
|
|
218
|
+
if (this.mode() !== 'range')
|
|
219
|
+
return false;
|
|
220
|
+
const [start, end] = this.range();
|
|
221
|
+
const hover = this.hoverDate();
|
|
222
|
+
if (!start || end || !hover)
|
|
223
|
+
return false;
|
|
224
|
+
const before = this.adapter.compareDate(start, hover) <= 0;
|
|
225
|
+
const lo = before ? start : hover;
|
|
226
|
+
const hi = before ? hover : start;
|
|
227
|
+
return this.adapter.compareDate(date, lo) > 0 && this.adapter.compareDate(date, hi) < 0;
|
|
228
|
+
}
|
|
229
|
+
isFocused(date) {
|
|
230
|
+
return this.adapter.isSameDay(date, this.focusedDate());
|
|
231
|
+
}
|
|
232
|
+
isDisabled(date) {
|
|
233
|
+
if (this.disabled())
|
|
234
|
+
return true;
|
|
235
|
+
const min = this.min();
|
|
236
|
+
if (min && this.adapter.compareDate(date, min) < 0)
|
|
237
|
+
return true;
|
|
238
|
+
const max = this.max();
|
|
239
|
+
if (max && this.adapter.compareDate(date, max) > 0)
|
|
240
|
+
return true;
|
|
241
|
+
const filter = this.dateFilter();
|
|
242
|
+
if (filter && !filter(date))
|
|
243
|
+
return true;
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
// Month / year view predicates
|
|
247
|
+
isMonthCurrent(monthIdx) {
|
|
248
|
+
return this.adapter.getMonth(this.viewDate()) === monthIdx;
|
|
249
|
+
}
|
|
250
|
+
isMonthSelected(monthIdx) {
|
|
251
|
+
const v = this.mode() === 'single' ? this.date() : this.range()[0];
|
|
252
|
+
if (!v)
|
|
253
|
+
return false;
|
|
254
|
+
return this.adapter.getYear(v) === this.adapter.getYear(this.viewDate()) && this.adapter.getMonth(v) === monthIdx;
|
|
255
|
+
}
|
|
256
|
+
isMonthDisabled(monthIdx) {
|
|
257
|
+
if (this.disabled())
|
|
258
|
+
return true;
|
|
259
|
+
const year = this.adapter.getYear(this.viewDate());
|
|
260
|
+
const monthStart = this.adapter.createDate(year, monthIdx, 1);
|
|
261
|
+
const monthEnd = this.adapter.createDate(year, monthIdx, this.adapter.getDaysInMonth(monthStart));
|
|
262
|
+
const min = this.min();
|
|
263
|
+
if (min && this.adapter.compareDate(monthEnd, min) < 0)
|
|
264
|
+
return true;
|
|
265
|
+
const max = this.max();
|
|
266
|
+
if (max && this.adapter.compareDate(monthStart, max) > 0)
|
|
267
|
+
return true;
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
isYearCurrent(year) {
|
|
271
|
+
return this.adapter.getYear(this.viewDate()) === year;
|
|
272
|
+
}
|
|
273
|
+
isYearSelected(year) {
|
|
274
|
+
const v = this.mode() === 'single' ? this.date() : this.range()[0];
|
|
275
|
+
return v ? this.adapter.getYear(v) === year : false;
|
|
276
|
+
}
|
|
277
|
+
isYearDisabled(year) {
|
|
278
|
+
if (this.disabled())
|
|
279
|
+
return true;
|
|
280
|
+
const min = this.min();
|
|
281
|
+
if (min && year < this.adapter.getYear(min))
|
|
282
|
+
return true;
|
|
283
|
+
const max = this.max();
|
|
284
|
+
if (max && year > this.adapter.getYear(max))
|
|
285
|
+
return true;
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
// Interaction
|
|
289
|
+
onCellClick(date) {
|
|
290
|
+
if (this.isDisabled(date))
|
|
291
|
+
return;
|
|
292
|
+
if (this.mode() === 'single') {
|
|
293
|
+
this.date.set(this.adapter.clone(date));
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
this.applyRangeClick(date);
|
|
297
|
+
}
|
|
298
|
+
this.focusedDate.set(date);
|
|
299
|
+
if (!this.adapter.isSameMonth(date, this.viewDate())) {
|
|
300
|
+
this.viewDate.set(date);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
onCellEnter(date) {
|
|
304
|
+
if (this.mode() === 'range')
|
|
305
|
+
this.hoverDate.set(date);
|
|
306
|
+
}
|
|
307
|
+
onCellLeave() {
|
|
308
|
+
if (this.mode() === 'range')
|
|
309
|
+
this.hoverDate.set(null);
|
|
310
|
+
}
|
|
311
|
+
applyRangeClick(date) {
|
|
312
|
+
const [start, end] = this.range();
|
|
313
|
+
if (!start || (start && end)) {
|
|
314
|
+
this.range.set([this.adapter.clone(date), null]);
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
if (this.adapter.compareDate(date, start) < 0) {
|
|
318
|
+
this.range.set([this.adapter.clone(date), start]);
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
this.range.set([start, this.adapter.clone(date)]);
|
|
322
|
+
}
|
|
323
|
+
this.hoverDate.set(null);
|
|
324
|
+
}
|
|
325
|
+
// Keyboard
|
|
326
|
+
onKeyDown(event) {
|
|
327
|
+
if (this.disabled())
|
|
328
|
+
return;
|
|
329
|
+
const current = this.focusedDate();
|
|
330
|
+
let next = null;
|
|
331
|
+
switch (event.key) {
|
|
332
|
+
case 'ArrowLeft':
|
|
333
|
+
next = this.adapter.addDays(current, -1);
|
|
334
|
+
break;
|
|
335
|
+
case 'ArrowRight':
|
|
336
|
+
next = this.adapter.addDays(current, 1);
|
|
337
|
+
break;
|
|
338
|
+
case 'ArrowUp':
|
|
339
|
+
next = this.adapter.addDays(current, -7);
|
|
340
|
+
break;
|
|
341
|
+
case 'ArrowDown':
|
|
342
|
+
next = this.adapter.addDays(current, 7);
|
|
343
|
+
break;
|
|
344
|
+
case 'Home': {
|
|
345
|
+
const dow = this.adapter.getDayOfWeek(current);
|
|
346
|
+
const first = this.adapter.getFirstDayOfWeek();
|
|
347
|
+
next = this.adapter.addDays(current, -((dow - first + 7) % 7));
|
|
348
|
+
break;
|
|
349
|
+
}
|
|
350
|
+
case 'End': {
|
|
351
|
+
const dow = this.adapter.getDayOfWeek(current);
|
|
352
|
+
const first = this.adapter.getFirstDayOfWeek();
|
|
353
|
+
next = this.adapter.addDays(current, 6 - ((dow - first + 7) % 7));
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
case 'PageUp':
|
|
357
|
+
next = event.shiftKey ? this.adapter.addYears(current, -1) : this.adapter.addMonths(current, -1);
|
|
358
|
+
break;
|
|
359
|
+
case 'PageDown':
|
|
360
|
+
next = event.shiftKey ? this.adapter.addYears(current, 1) : this.adapter.addMonths(current, 1);
|
|
361
|
+
break;
|
|
362
|
+
case 'Enter':
|
|
363
|
+
case ' ':
|
|
364
|
+
event.preventDefault();
|
|
365
|
+
this.onCellClick(current);
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
if (!next)
|
|
369
|
+
return;
|
|
370
|
+
event.preventDefault();
|
|
371
|
+
this.focusedDate.set(next);
|
|
372
|
+
if (!this.adapter.isSameMonth(next, this.viewDate())) {
|
|
373
|
+
this.viewDate.set(next);
|
|
374
|
+
}
|
|
375
|
+
queueMicrotask(() => this.focusActiveCell());
|
|
376
|
+
}
|
|
377
|
+
focusActiveCell() {
|
|
378
|
+
const el = this.host.nativeElement.querySelector('.wr-calendar__day--focused');
|
|
379
|
+
el?.focus();
|
|
380
|
+
}
|
|
381
|
+
/** Used by the template's `track` expression. */
|
|
382
|
+
trackByTime(_, date) {
|
|
383
|
+
return date.getTime();
|
|
384
|
+
}
|
|
385
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: WrCalendar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
386
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: WrCalendar, isStandalone: true, selector: "wr-calendar", inputs: { mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null }, range: { classPropertyName: "range", publicName: "range", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { date: "dateChange", range: "rangeChange" }, host: { attributes: { "role": "grid" }, listeners: { "keydown": "onKeyDown($event)" }, properties: { "class": "classes()" } }, ngImport: i0, template: "<div class=\"wr-calendar__header\">\n <button\n type=\"button\"\n class=\"wr-calendar__nav wr-calendar__nav--prev\"\n [attr.aria-label]=\"\n viewMode() === 'year' ? 'Previous 12 years' : viewMode() === 'month' ? 'Previous year' : 'Previous month'\n \"\n [disabled]=\"disabled()\"\n (click)=\"prev()\"\n >\n \u2039\n </button>\n <button\n type=\"button\"\n class=\"wr-calendar__label\"\n aria-live=\"polite\"\n [disabled]=\"disabled() || viewMode() === 'year'\"\n (click)=\"onLabelClick()\"\n >\n {{ headerLabel() }}\n </button>\n <button\n type=\"button\"\n class=\"wr-calendar__nav wr-calendar__nav--next\"\n [attr.aria-label]=\"viewMode() === 'year' ? 'Next 12 years' : viewMode() === 'month' ? 'Next year' : 'Next month'\"\n [disabled]=\"disabled()\"\n (click)=\"next()\"\n >\n \u203A\n </button>\n</div>\n\n@switch (viewMode()) {\n @case ('day') {\n <div class=\"wr-calendar__weekdays\" role=\"row\">\n @for (name of weekdayNames(); track name) {\n <span class=\"wr-calendar__weekday\" role=\"columnheader\">{{ name }}</span>\n }\n </div>\n\n <div class=\"wr-calendar__grid\" (mouseleave)=\"onCellLeave()\">\n @for (week of weeks(); track $index) {\n <div class=\"wr-calendar__week\" role=\"row\">\n @for (day of week; track trackByTime($index, day)) {\n <button\n type=\"button\"\n class=\"wr-calendar__day\"\n role=\"gridcell\"\n [class.wr-calendar__day--today]=\"isToday(day)\"\n [class.wr-calendar__day--out-of-month]=\"isOutOfMonth(day)\"\n [class.wr-calendar__day--selected]=\"isSelected(day)\"\n [class.wr-calendar__day--in-range]=\"isInRange(day)\"\n [class.wr-calendar__day--range-preview]=\"isInRangePreview(day)\"\n [class.wr-calendar__day--focused]=\"isFocused(day)\"\n [disabled]=\"isDisabled(day)\"\n [attr.tabindex]=\"isFocused(day) ? 0 : -1\"\n [attr.aria-selected]=\"isSelected(day)\"\n [attr.aria-disabled]=\"isDisabled(day)\"\n (click)=\"onCellClick(day)\"\n (mouseenter)=\"onCellEnter(day)\"\n >\n {{ day.getDate() }}\n </button>\n }\n </div>\n }\n </div>\n }\n\n @case ('month') {\n <div class=\"wr-calendar__months\" role=\"grid\">\n @for (name of monthsView(); track name) {\n <button\n type=\"button\"\n class=\"wr-calendar__chip\"\n role=\"gridcell\"\n [class.wr-calendar__chip--current]=\"isMonthCurrent($index)\"\n [class.wr-calendar__chip--selected]=\"isMonthSelected($index)\"\n [disabled]=\"isMonthDisabled($index)\"\n [attr.aria-selected]=\"isMonthSelected($index)\"\n [attr.aria-disabled]=\"isMonthDisabled($index)\"\n (click)=\"onMonthSelect($index)\"\n >\n {{ name }}\n </button>\n }\n </div>\n }\n\n @case ('year') {\n <div class=\"wr-calendar__years\" role=\"grid\">\n @for (year of yearsView(); track year) {\n <button\n type=\"button\"\n class=\"wr-calendar__chip\"\n role=\"gridcell\"\n [class.wr-calendar__chip--current]=\"isYearCurrent(year)\"\n [class.wr-calendar__chip--selected]=\"isYearSelected(year)\"\n [disabled]=\"isYearDisabled(year)\"\n [attr.aria-selected]=\"isYearSelected(year)\"\n [attr.aria-disabled]=\"isYearDisabled(year)\"\n (click)=\"onYearSelect(year)\"\n >\n {{ year }}\n </button>\n }\n </div>\n }\n}\n", encapsulation: i0.ViewEncapsulation.None });
|
|
387
|
+
}
|
|
388
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: WrCalendar, decorators: [{
|
|
389
|
+
type: Component,
|
|
390
|
+
args: [{ selector: 'wr-calendar', encapsulation: ViewEncapsulation.None, host: {
|
|
391
|
+
'[class]': 'classes()',
|
|
392
|
+
role: 'grid',
|
|
393
|
+
'(keydown)': 'onKeyDown($event)',
|
|
394
|
+
}, template: "<div class=\"wr-calendar__header\">\n <button\n type=\"button\"\n class=\"wr-calendar__nav wr-calendar__nav--prev\"\n [attr.aria-label]=\"\n viewMode() === 'year' ? 'Previous 12 years' : viewMode() === 'month' ? 'Previous year' : 'Previous month'\n \"\n [disabled]=\"disabled()\"\n (click)=\"prev()\"\n >\n \u2039\n </button>\n <button\n type=\"button\"\n class=\"wr-calendar__label\"\n aria-live=\"polite\"\n [disabled]=\"disabled() || viewMode() === 'year'\"\n (click)=\"onLabelClick()\"\n >\n {{ headerLabel() }}\n </button>\n <button\n type=\"button\"\n class=\"wr-calendar__nav wr-calendar__nav--next\"\n [attr.aria-label]=\"viewMode() === 'year' ? 'Next 12 years' : viewMode() === 'month' ? 'Next year' : 'Next month'\"\n [disabled]=\"disabled()\"\n (click)=\"next()\"\n >\n \u203A\n </button>\n</div>\n\n@switch (viewMode()) {\n @case ('day') {\n <div class=\"wr-calendar__weekdays\" role=\"row\">\n @for (name of weekdayNames(); track name) {\n <span class=\"wr-calendar__weekday\" role=\"columnheader\">{{ name }}</span>\n }\n </div>\n\n <div class=\"wr-calendar__grid\" (mouseleave)=\"onCellLeave()\">\n @for (week of weeks(); track $index) {\n <div class=\"wr-calendar__week\" role=\"row\">\n @for (day of week; track trackByTime($index, day)) {\n <button\n type=\"button\"\n class=\"wr-calendar__day\"\n role=\"gridcell\"\n [class.wr-calendar__day--today]=\"isToday(day)\"\n [class.wr-calendar__day--out-of-month]=\"isOutOfMonth(day)\"\n [class.wr-calendar__day--selected]=\"isSelected(day)\"\n [class.wr-calendar__day--in-range]=\"isInRange(day)\"\n [class.wr-calendar__day--range-preview]=\"isInRangePreview(day)\"\n [class.wr-calendar__day--focused]=\"isFocused(day)\"\n [disabled]=\"isDisabled(day)\"\n [attr.tabindex]=\"isFocused(day) ? 0 : -1\"\n [attr.aria-selected]=\"isSelected(day)\"\n [attr.aria-disabled]=\"isDisabled(day)\"\n (click)=\"onCellClick(day)\"\n (mouseenter)=\"onCellEnter(day)\"\n >\n {{ day.getDate() }}\n </button>\n }\n </div>\n }\n </div>\n }\n\n @case ('month') {\n <div class=\"wr-calendar__months\" role=\"grid\">\n @for (name of monthsView(); track name) {\n <button\n type=\"button\"\n class=\"wr-calendar__chip\"\n role=\"gridcell\"\n [class.wr-calendar__chip--current]=\"isMonthCurrent($index)\"\n [class.wr-calendar__chip--selected]=\"isMonthSelected($index)\"\n [disabled]=\"isMonthDisabled($index)\"\n [attr.aria-selected]=\"isMonthSelected($index)\"\n [attr.aria-disabled]=\"isMonthDisabled($index)\"\n (click)=\"onMonthSelect($index)\"\n >\n {{ name }}\n </button>\n }\n </div>\n }\n\n @case ('year') {\n <div class=\"wr-calendar__years\" role=\"grid\">\n @for (year of yearsView(); track year) {\n <button\n type=\"button\"\n class=\"wr-calendar__chip\"\n role=\"gridcell\"\n [class.wr-calendar__chip--current]=\"isYearCurrent(year)\"\n [class.wr-calendar__chip--selected]=\"isYearSelected(year)\"\n [disabled]=\"isYearDisabled(year)\"\n [attr.aria-selected]=\"isYearSelected(year)\"\n [attr.aria-disabled]=\"isYearDisabled(year)\"\n (click)=\"onYearSelect(year)\"\n >\n {{ year }}\n </button>\n }\n </div>\n }\n}\n" }]
|
|
395
|
+
}], ctorParameters: () => [], propDecorators: { mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], date: [{ type: i0.Input, args: [{ isSignal: true, alias: "date", required: false }] }, { type: i0.Output, args: ["dateChange"] }], range: [{ type: i0.Input, args: [{ isSignal: true, alias: "range", required: false }] }, { type: i0.Output, args: ["rangeChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], dateFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFilter", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Generated bundle index. Do not edit.
|
|
399
|
+
*/
|
|
400
|
+
|
|
401
|
+
export { WrCalendar };
|
|
402
|
+
//# sourceMappingURL=ngwr-calendar.mjs.map
|