ngwr 6.0.0 → 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 -383
- 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 -650
- 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 +168 -190
- 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 +842 -307
- 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 +218 -207
- 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/{alert/alert-type.d.ts → schematics/component-style/schema.js} +2 -1
- package/schematics/component-style/schema.json +20 -0
- package/schematics/icon-set/index.js +96 -0
- package/{avatar/public-api.d.ts → schematics/icon-set/schema.js} +2 -1
- 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/{cdk/public-api.d.ts → schematics/ng-add/schema.js} +2 -1
- package/schematics/ng-add/schema.json +80 -0
- package/schematics/page/index.js +63 -0
- package/{alert/public-api.d.ts → schematics/page/schema.js} +2 -2
- 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/types/ngwr.d.ts +2 -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/alert.component.d.ts +0 -21
- package/alert/index.d.ts +0 -5
- package/alert/styles/theming.scss +0 -26
- package/alert/styles/vars.scss +0 -11
- package/avatar/avatar.component.d.ts +0 -27
- package/avatar/index.d.ts +0 -5
- package/button/button-group.component.d.ts +0 -12
- package/button/button.component.d.ts +0 -31
- package/button/index.d.ts +0 -5
- package/button/public-api.d.ts +0 -8
- package/button/styles/vars.scss +0 -13
- package/cdk/base.directive.d.ts +0 -20
- package/cdk/index.d.ts +0 -5
- package/cdk/rxjs/index.d.ts +0 -5
- package/cdk/rxjs/is-array.d.ts +0 -8
- package/cdk/rxjs/is-defined.d.ts +0 -8
- package/cdk/rxjs/is-not-empty-array.d.ts +0 -8
- package/cdk/rxjs/is-observable.d.ts +0 -9
- package/cdk/rxjs/public-api.d.ts +0 -10
- package/cdk/types/index.d.ts +0 -5
- package/cdk/types/maybe.d.ts +0 -7
- package/cdk/types/public-api.d.ts +0 -9
- package/cdk/types/safe-any.d.ts +0 -7
- package/cdk/types/theme-color.d.ts +0 -8
- package/cdk/utils/generate-random-id.d.ts +0 -12
- package/cdk/utils/index.d.ts +0 -5
- package/cdk/utils/public-api.d.ts +0 -7
- package/checkbox/checkbox.component.d.ts +0 -28
- package/checkbox/index.d.ts +0 -5
- package/checkbox/public-api.d.ts +0 -7
- package/checkbox/styles/vars.scss +0 -16
- package/dialog/dialog-animations.d.ts +0 -22
- package/dialog/dialog-base.directive.d.ts +0 -40
- package/dialog/dialog-close.directive.d.ts +0 -9
- package/dialog/dialog-content.directive.d.ts +0 -6
- package/dialog/dialog-data.token.d.ts +0 -8
- package/dialog/dialog-footer.directive.d.ts +0 -8
- package/dialog/dialog-options.d.ts +0 -19
- package/dialog/dialog-ref.d.ts +0 -26
- package/dialog/dialog-title.directive.d.ts +0 -6
- package/dialog/dialog.component.d.ts +0 -28
- package/dialog/dialog.module.d.ts +0 -6
- package/dialog/dialog.service.d.ts +0 -28
- package/dialog/index.d.ts +0 -5
- package/dialog/public-api.d.ts +0 -18
- package/dialog/styles/vars.scss +0 -7
- package/divider/divider.component.d.ts +0 -13
- package/divider/index.d.ts +0 -5
- package/divider/public-api.d.ts +0 -7
- package/dropdown/dropdown-menu-item.component.d.ts +0 -12
- package/dropdown/dropdown-menu.component.d.ts +0 -14
- package/dropdown/dropdown.directive.d.ts +0 -29
- package/dropdown/dropdown.types.d.ts +0 -9
- package/dropdown/index.d.ts +0 -5
- package/dropdown/public-api.d.ts +0 -10
- 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/form-error.component.d.ts +0 -11
- package/form/form-item.component.d.ts +0 -14
- package/form/index.d.ts +0 -5
- package/form/public-api.d.ts +0 -8
- package/icon/icon.component.d.ts +0 -24
- package/icon/icon.service.d.ts +0 -23
- package/icon/icons.d.ts +0 -770
- package/icon/index.d.ts +0 -5
- package/icon/provide-wr-icons.d.ts +0 -9
- package/icon/public-api.d.ts +0 -10
- package/icon/styles/vars.scss +0 -3
- package/index.d.ts +0 -5
- package/input/index.d.ts +0 -5
- package/input/input-types.d.ts +0 -1
- package/input/input.component.d.ts +0 -38
- package/input/public-api.d.ts +0 -8
- package/input/styles/vars.scss +0 -17
- package/pagination/index.d.ts +0 -5
- package/pagination/pagination.component.d.ts +0 -23
- package/pagination/pagination.types.d.ts +0 -7
- package/pagination/public-api.d.ts +0 -8
- package/pagination/styles/vars.scss +0 -14
- package/pipes/index.d.ts +0 -5
- package/pipes/new-array.pipe.d.ts +0 -13
- package/pipes/public-api.d.ts +0 -7
- package/progress/index.d.ts +0 -5
- package/progress/progress.component.d.ts +0 -10
- package/progress/public-api.d.ts +0 -7
- package/progress/styles/theming.scss +0 -8
- package/progress/styles/vars.scss +0 -6
- package/public-api.d.ts +0 -2
- package/qr/generator.d.ts +0 -7
- package/qr/index.d.ts +0 -5
- package/qr/public-api.d.ts +0 -7
- package/qr/qr.component.d.ts +0 -31
- package/qr/qrcodegen.d.ts +0 -94
- package/select/index.d.ts +0 -5
- package/select/public-api.d.ts +0 -10
- package/select/select-option-group.component.d.ts +0 -19
- package/select/select-option.component.d.ts +0 -22
- package/select/select.component.d.ts +0 -63
- package/select/select.types.d.ts +0 -17
- package/select/styles/vars.scss +0 -32
- package/skeleton/index.d.ts +0 -1
- package/skeleton/skeleton.component.d.ts +0 -10
- package/spinner/index.d.ts +0 -1
- package/spinner/spinner.component.d.ts +0 -13
- package/spinner/spinner.types.d.ts +0 -7
- 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 -5
- package/table/public-api.d.ts +0 -11
- 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/table/table-cell/index.d.ts +0 -7
- package/table/table-cell/table-cell.directive.d.ts +0 -8
- package/table/table-filter/index.d.ts +0 -7
- package/table/table-filter/table-filter.component.d.ts +0 -18
- package/table/table-sort/index.d.ts +0 -7
- package/table/table-sort/table-sort.component.d.ts +0 -8
- package/table/table.component.d.ts +0 -33
- package/table/types/index.d.ts +0 -6
- package/table/types/table-cell-context.d.ts +0 -6
- package/table/types/table-columns.d.ts +0 -7
- package/table/types/table-filter-emit.d.ts +0 -5
- package/table/types/table-filter-item.d.ts +0 -6
- package/table/types/table-order-item.d.ts +0 -5
- package/table/types/table-order.enum.d.ts +0 -5
- package/tag/index.d.ts +0 -5
- package/tag/public-api.d.ts +0 -7
- package/tag/styles/_index.scss +0 -32
- package/tag/styles/theming.scss +0 -21
- package/tag/styles/vars.scss +0 -12
- package/tag/tag.component.d.ts +0 -21
- package/textarea/index.d.ts +0 -7
- package/textarea/public-api.d.ts +0 -7
- package/textarea/styles/vars.scss +0 -17
- package/textarea/textarea.component.d.ts +0 -44
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { coerceNumberProperty } from '@angular/cdk/coercion';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { input, computed, ViewEncapsulation, Component, output, inject, DestroyRef, PLATFORM_ID, signal, effect, afterNextRender } from '@angular/core';
|
|
4
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
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
|
+
/**
|
|
13
|
+
* KPI card — label + big number + optional prefix/suffix + delta. Pair
|
|
14
|
+
* with a layout grid for dashboards.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```html
|
|
18
|
+
* <wr-statistic label="Active users" [value]="12345" suffix="users" />
|
|
19
|
+
* <wr-statistic label="Revenue" [value]="9512" prefix="$" [delta]="12.4" />
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @see https://ngwr.dev/components/statistic
|
|
23
|
+
*/
|
|
24
|
+
class WrStatistic {
|
|
25
|
+
label = input('', /* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
27
|
+
/** The number (or string) to display in the main slot. */
|
|
28
|
+
value = input(null, /* @ts-ignore */
|
|
29
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
30
|
+
/** Prefix glyph / symbol (e.g. `'$'`). */
|
|
31
|
+
prefix = input('', /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "prefix" }] : /* istanbul ignore next */ []));
|
|
33
|
+
/** Suffix glyph / unit (e.g. `'%'`, `'kg'`). */
|
|
34
|
+
suffix = input('', /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "suffix" }] : /* istanbul ignore next */ []));
|
|
36
|
+
/**
|
|
37
|
+
* Optional delta vs previous period — shown as `+x.x%` (or `-x.x%`).
|
|
38
|
+
* Use `deltaSuffix` to change the trailing unit.
|
|
39
|
+
*/
|
|
40
|
+
delta = input(null, { ...(ngDevMode ? { debugName: "delta" } : /* istanbul ignore next */ {}), transform: (v) => {
|
|
41
|
+
if (v === null || v === undefined || v === '')
|
|
42
|
+
return null;
|
|
43
|
+
const n = coerceNumberProperty(v, Number.NaN);
|
|
44
|
+
return Number.isFinite(n) ? n : null;
|
|
45
|
+
} });
|
|
46
|
+
/** Unit appended to the delta value. @default '%' */
|
|
47
|
+
deltaSuffix = input('%', /* @ts-ignore */
|
|
48
|
+
...(ngDevMode ? [{ debugName: "deltaSuffix" }] : /* istanbul ignore next */ []));
|
|
49
|
+
hasDelta = computed(() => this.delta() !== null, /* @ts-ignore */
|
|
50
|
+
...(ngDevMode ? [{ debugName: "hasDelta" }] : /* istanbul ignore next */ []));
|
|
51
|
+
deltaDirection = computed(() => {
|
|
52
|
+
const d = this.delta();
|
|
53
|
+
if (d === null || d === 0)
|
|
54
|
+
return 'flat';
|
|
55
|
+
return d > 0 ? 'up' : 'down';
|
|
56
|
+
}, /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "deltaDirection" }] : /* istanbul ignore next */ []));
|
|
58
|
+
deltaText = computed(() => {
|
|
59
|
+
const d = this.delta();
|
|
60
|
+
if (d === null)
|
|
61
|
+
return '';
|
|
62
|
+
const sign = d > 0 ? '+' : '';
|
|
63
|
+
return `${sign}${d}${this.deltaSuffix()}`;
|
|
64
|
+
}, /* @ts-ignore */
|
|
65
|
+
...(ngDevMode ? [{ debugName: "deltaText" }] : /* istanbul ignore next */ []));
|
|
66
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: WrStatistic, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
67
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: WrStatistic, isStandalone: true, selector: "wr-statistic", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, prefix: { classPropertyName: "prefix", publicName: "prefix", isSignal: true, isRequired: false, transformFunction: null }, suffix: { classPropertyName: "suffix", publicName: "suffix", isSignal: true, isRequired: false, transformFunction: null }, delta: { classPropertyName: "delta", publicName: "delta", isSignal: true, isRequired: false, transformFunction: null }, deltaSuffix: { classPropertyName: "deltaSuffix", publicName: "deltaSuffix", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "wr-statistic" }, ngImport: i0, template: "@if (label()) {\n <div class=\"wr-statistic__label\">{{ label() }}</div>\n}\n<div class=\"wr-statistic__value\">\n @if (prefix()) {\n <span class=\"wr-statistic__prefix\">{{ prefix() }}</span>\n }\n <span class=\"wr-statistic__number\">{{ value() ?? '\u2014' }}</span>\n @if (suffix()) {\n <span class=\"wr-statistic__suffix\">{{ suffix() }}</span>\n }\n</div>\n@if (hasDelta()) {\n <div [class]=\"`wr-statistic__delta wr-statistic__delta--${deltaDirection()}`\">\n @if (deltaDirection() === 'up') {\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M5 1 L9 8 L1 8 Z\" fill=\"currentColor\" />\n </svg>\n } @else if (deltaDirection() === 'down') {\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M5 9 L9 2 L1 2 Z\" fill=\"currentColor\" />\n </svg>\n }\n <span>{{ deltaText() }}</span>\n </div>\n}\n", encapsulation: i0.ViewEncapsulation.None });
|
|
68
|
+
}
|
|
69
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: WrStatistic, decorators: [{
|
|
70
|
+
type: Component,
|
|
71
|
+
args: [{ selector: 'wr-statistic', encapsulation: ViewEncapsulation.None, host: { class: 'wr-statistic' }, template: "@if (label()) {\n <div class=\"wr-statistic__label\">{{ label() }}</div>\n}\n<div class=\"wr-statistic__value\">\n @if (prefix()) {\n <span class=\"wr-statistic__prefix\">{{ prefix() }}</span>\n }\n <span class=\"wr-statistic__number\">{{ value() ?? '\u2014' }}</span>\n @if (suffix()) {\n <span class=\"wr-statistic__suffix\">{{ suffix() }}</span>\n }\n</div>\n@if (hasDelta()) {\n <div [class]=\"`wr-statistic__delta wr-statistic__delta--${deltaDirection()}`\">\n @if (deltaDirection() === 'up') {\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M5 1 L9 8 L1 8 Z\" fill=\"currentColor\" />\n </svg>\n } @else if (deltaDirection() === 'down') {\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M5 9 L9 2 L1 2 Z\" fill=\"currentColor\" />\n </svg>\n }\n <span>{{ deltaText() }}</span>\n </div>\n}\n" }]
|
|
72
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], prefix: [{ type: i0.Input, args: [{ isSignal: true, alias: "prefix", required: false }] }], suffix: [{ type: i0.Input, args: [{ isSignal: true, alias: "suffix", required: false }] }], delta: [{ type: i0.Input, args: [{ isSignal: true, alias: "delta", required: false }] }], deltaSuffix: [{ type: i0.Input, args: [{ isSignal: true, alias: "deltaSuffix", required: false }] }] } });
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @license
|
|
76
|
+
*
|
|
77
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
78
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
79
|
+
*/
|
|
80
|
+
// Helpers
|
|
81
|
+
function toMs(value) {
|
|
82
|
+
if (value instanceof Date)
|
|
83
|
+
return value.getTime();
|
|
84
|
+
if (typeof value === 'number')
|
|
85
|
+
return value;
|
|
86
|
+
return new Date(value).getTime();
|
|
87
|
+
}
|
|
88
|
+
function pad(n, width) {
|
|
89
|
+
return String(n).padStart(width, '0');
|
|
90
|
+
}
|
|
91
|
+
function formatRemaining(ms, fmt) {
|
|
92
|
+
const days = Math.floor(ms / 86_400_000);
|
|
93
|
+
const hours = Math.floor((ms % 86_400_000) / 3_600_000);
|
|
94
|
+
const minutes = Math.floor((ms % 3_600_000) / 60_000);
|
|
95
|
+
const seconds = Math.floor((ms % 60_000) / 1000);
|
|
96
|
+
const millis = ms % 1000;
|
|
97
|
+
// Single-pass tokenizer so we never re-scan output for tokens. The
|
|
98
|
+
// previous sequential `.replace()` chain leaked: e.g. `D days HH:mm:ss`
|
|
99
|
+
// → `1 day42 11:59:42` because the `/s/g` step at the end re-matched
|
|
100
|
+
// the literal `s` inside `days`. Longest-token-first ordering inside
|
|
101
|
+
// the alternation handles `DD`>`D`, `HH`>`H`, `mm`>`m`, `SSS`>`ss`>`s`.
|
|
102
|
+
return fmt.replace(/(?<![A-Za-z])(?:SSS|DD|HH|mm|ss|D|H|m|s)(?![A-Za-z])/g, token => {
|
|
103
|
+
switch (token) {
|
|
104
|
+
case 'DD':
|
|
105
|
+
return pad(days, 2);
|
|
106
|
+
case 'D':
|
|
107
|
+
return String(days);
|
|
108
|
+
case 'HH':
|
|
109
|
+
return pad(hours, 2);
|
|
110
|
+
case 'H':
|
|
111
|
+
return String(hours);
|
|
112
|
+
case 'mm':
|
|
113
|
+
return pad(minutes, 2);
|
|
114
|
+
case 'm':
|
|
115
|
+
return String(minutes);
|
|
116
|
+
case 'ss':
|
|
117
|
+
return pad(seconds, 2);
|
|
118
|
+
case 's':
|
|
119
|
+
return String(seconds);
|
|
120
|
+
case 'SSS':
|
|
121
|
+
return pad(millis, 3);
|
|
122
|
+
default:
|
|
123
|
+
return token;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Live-counting variant of `<wr-statistic>` that targets a future date
|
|
129
|
+
* and ticks down to zero. The format string uses Day/Hour/Minute/Second
|
|
130
|
+
* tokens (`D`, `H`, `m`, `s`, double for zero-padded, plus `SSS` for
|
|
131
|
+
* milliseconds).
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```html
|
|
135
|
+
* <wr-statistic-countdown
|
|
136
|
+
* label="Launch in"
|
|
137
|
+
* [target]="launchDate"
|
|
138
|
+
* format="D days HH:mm:ss"
|
|
139
|
+
* (countdownEnd)="onLive()"
|
|
140
|
+
* />
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* @see https://ngwr.dev/components/statistic
|
|
144
|
+
*/
|
|
145
|
+
class WrStatisticCountdown {
|
|
146
|
+
/** Target date / timestamp the countdown is running down to. */
|
|
147
|
+
target = input.required(/* @ts-ignore */
|
|
148
|
+
...(ngDevMode ? [{ debugName: "target" }] : /* istanbul ignore next */ []));
|
|
149
|
+
/** Label rendered above the value. */
|
|
150
|
+
label = input('', /* @ts-ignore */
|
|
151
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
152
|
+
/**
|
|
153
|
+
* Format string. Tokens: `D`/`DD` (days), `H`/`HH` (hours),
|
|
154
|
+
* `m`/`mm` (minutes), `s`/`ss` (seconds), `SSS` (milliseconds).
|
|
155
|
+
* Double-letter forms zero-pad to width 2. @default 'HH:mm:ss'
|
|
156
|
+
*/
|
|
157
|
+
format = input('HH:mm:ss', /* @ts-ignore */
|
|
158
|
+
...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
|
|
159
|
+
/** Optional text shown once the countdown reaches zero. */
|
|
160
|
+
endText = input(null, /* @ts-ignore */
|
|
161
|
+
...(ngDevMode ? [{ debugName: "endText" }] : /* istanbul ignore next */ []));
|
|
162
|
+
/**
|
|
163
|
+
* Tick interval in ms. Drop to ~16 for `SSS` (millisecond display).
|
|
164
|
+
* @default 1000
|
|
165
|
+
*/
|
|
166
|
+
tickMs = input(1000, /* @ts-ignore */
|
|
167
|
+
...(ngDevMode ? [{ debugName: "tickMs" }] : /* istanbul ignore next */ []));
|
|
168
|
+
/** Fires once when the countdown crosses zero. */
|
|
169
|
+
countdownEnd = output();
|
|
170
|
+
destroyRef = inject(DestroyRef);
|
|
171
|
+
isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
172
|
+
targetMs = computed(() => toMs(this.target()), /* @ts-ignore */
|
|
173
|
+
...(ngDevMode ? [{ debugName: "targetMs" }] : /* istanbul ignore next */ []));
|
|
174
|
+
/** Remaining milliseconds (live signal). */
|
|
175
|
+
remaining = signal(0, /* @ts-ignore */
|
|
176
|
+
...(ngDevMode ? [{ debugName: "remaining" }] : /* istanbul ignore next */ []));
|
|
177
|
+
finished = signal(false, /* @ts-ignore */
|
|
178
|
+
...(ngDevMode ? [{ debugName: "finished" }] : /* istanbul ignore next */ []));
|
|
179
|
+
display = computed(() => {
|
|
180
|
+
if (this.finished() && this.endText() != null)
|
|
181
|
+
return this.endText();
|
|
182
|
+
return formatRemaining(this.remaining(), this.format());
|
|
183
|
+
}, /* @ts-ignore */
|
|
184
|
+
...(ngDevMode ? [{ debugName: "display" }] : /* istanbul ignore next */ []));
|
|
185
|
+
constructor() {
|
|
186
|
+
// Seed once synchronously so SSR / first paint shows a sane value.
|
|
187
|
+
effect(() => {
|
|
188
|
+
const ms = Math.max(0, this.targetMs() - Date.now());
|
|
189
|
+
this.remaining.set(ms);
|
|
190
|
+
this.finished.set(ms === 0);
|
|
191
|
+
});
|
|
192
|
+
if (!this.isBrowser)
|
|
193
|
+
return;
|
|
194
|
+
afterNextRender(() => {
|
|
195
|
+
const handle = setInterval(() => this.tick(), this.tickMs());
|
|
196
|
+
this.destroyRef.onDestroy(() => clearInterval(handle));
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
tick() {
|
|
200
|
+
const ms = Math.max(0, this.targetMs() - Date.now());
|
|
201
|
+
this.remaining.set(ms);
|
|
202
|
+
if (ms === 0 && !this.finished()) {
|
|
203
|
+
this.finished.set(true);
|
|
204
|
+
this.countdownEnd.emit();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: WrStatisticCountdown, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
208
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: WrStatisticCountdown, isStandalone: true, selector: "wr-statistic-countdown", inputs: { target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, endText: { classPropertyName: "endText", publicName: "endText", isSignal: true, isRequired: false, transformFunction: null }, tickMs: { classPropertyName: "tickMs", publicName: "tickMs", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { countdownEnd: "countdownEnd" }, host: { classAttribute: "wr-statistic" }, ngImport: i0, template: "@if (label()) {\n <div class=\"wr-statistic__label\">{{ label() }}</div>\n}\n<div class=\"wr-statistic__value\">\n <span class=\"wr-statistic__number\">{{ display() }}</span>\n</div>\n", encapsulation: i0.ViewEncapsulation.None });
|
|
209
|
+
}
|
|
210
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: WrStatisticCountdown, decorators: [{
|
|
211
|
+
type: Component,
|
|
212
|
+
args: [{ selector: 'wr-statistic-countdown', encapsulation: ViewEncapsulation.None, host: { class: 'wr-statistic' }, template: "@if (label()) {\n <div class=\"wr-statistic__label\">{{ label() }}</div>\n}\n<div class=\"wr-statistic__value\">\n <span class=\"wr-statistic__number\">{{ display() }}</span>\n</div>\n" }]
|
|
213
|
+
}], ctorParameters: () => [], propDecorators: { target: [{ type: i0.Input, args: [{ isSignal: true, alias: "target", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], endText: [{ type: i0.Input, args: [{ isSignal: true, alias: "endText", required: false }] }], tickMs: [{ type: i0.Input, args: [{ isSignal: true, alias: "tickMs", required: false }] }], countdownEnd: [{ type: i0.Output, args: ["countdownEnd"] }] } });
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Generated bundle index. Do not edit.
|
|
217
|
+
*/
|
|
218
|
+
|
|
219
|
+
export { WrStatistic, WrStatisticCountdown };
|
|
220
|
+
//# sourceMappingURL=ngwr-statistic.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngwr-statistic.mjs","sources":["../../../projects/lib/statistic/statistic.ts","../../../projects/lib/statistic/statistic.html","../../../projects/lib/statistic/statistic-countdown.ts","../../../projects/lib/statistic/statistic-countdown.html","../../../projects/lib/statistic/ngwr-statistic.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 { coerceNumberProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\n/**\n * KPI card — label + big number + optional prefix/suffix + delta. Pair\n * with a layout grid for dashboards.\n *\n * @example\n * ```html\n * <wr-statistic label=\"Active users\" [value]=\"12345\" suffix=\"users\" />\n * <wr-statistic label=\"Revenue\" [value]=\"9512\" prefix=\"$\" [delta]=\"12.4\" />\n * ```\n *\n * @see https://ngwr.dev/components/statistic\n */\n@Component({\n selector: 'wr-statistic',\n templateUrl: './statistic.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-statistic' },\n})\nexport class WrStatistic {\n readonly label = input<string>('');\n\n /** The number (or string) to display in the main slot. */\n readonly value = input<number | string | null>(null);\n\n /** Prefix glyph / symbol (e.g. `'$'`). */\n readonly prefix = input<string>('');\n\n /** Suffix glyph / unit (e.g. `'%'`, `'kg'`). */\n readonly suffix = input<string>('');\n\n /**\n * Optional delta vs previous period — shown as `+x.x%` (or `-x.x%`).\n * Use `deltaSuffix` to change the trailing unit.\n */\n readonly delta = input<number | null>(null, {\n transform: (v: unknown): number | null => {\n if (v === null || v === undefined || v === '') return null;\n const n = coerceNumberProperty(v, Number.NaN);\n return Number.isFinite(n) ? n : null;\n },\n });\n\n /** Unit appended to the delta value. @default '%' */\n readonly deltaSuffix = input<string>('%');\n\n protected readonly hasDelta = computed(() => this.delta() !== null);\n\n protected readonly deltaDirection = computed<'up' | 'down' | 'flat'>(() => {\n const d = this.delta();\n if (d === null || d === 0) return 'flat';\n return d > 0 ? 'up' : 'down';\n });\n\n protected readonly deltaText = computed(() => {\n const d = this.delta();\n if (d === null) return '';\n const sign = d > 0 ? '+' : '';\n return `${sign}${d}${this.deltaSuffix()}`;\n });\n}\n","@if (label()) {\n <div class=\"wr-statistic__label\">{{ label() }}</div>\n}\n<div class=\"wr-statistic__value\">\n @if (prefix()) {\n <span class=\"wr-statistic__prefix\">{{ prefix() }}</span>\n }\n <span class=\"wr-statistic__number\">{{ value() ?? '—' }}</span>\n @if (suffix()) {\n <span class=\"wr-statistic__suffix\">{{ suffix() }}</span>\n }\n</div>\n@if (hasDelta()) {\n <div [class]=\"`wr-statistic__delta wr-statistic__delta--${deltaDirection()}`\">\n @if (deltaDirection() === 'up') {\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M5 1 L9 8 L1 8 Z\" fill=\"currentColor\" />\n </svg>\n } @else if (deltaDirection() === 'down') {\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M5 9 L9 2 L1 2 Z\" fill=\"currentColor\" />\n </svg>\n }\n <span>{{ deltaText() }}</span>\n </div>\n}\n","/**\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 { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\n// Helpers\n\nfunction toMs(value: Date | string | number): number {\n if (value instanceof Date) return value.getTime();\n if (typeof value === 'number') return value;\n return new Date(value).getTime();\n}\n\nfunction pad(n: number, width: number): string {\n return String(n).padStart(width, '0');\n}\n\nfunction formatRemaining(ms: number, fmt: string): string {\n const days = Math.floor(ms / 86_400_000);\n const hours = Math.floor((ms % 86_400_000) / 3_600_000);\n const minutes = Math.floor((ms % 3_600_000) / 60_000);\n const seconds = Math.floor((ms % 60_000) / 1000);\n const millis = ms % 1000;\n // Single-pass tokenizer so we never re-scan output for tokens. The\n // previous sequential `.replace()` chain leaked: e.g. `D days HH:mm:ss`\n // → `1 day42 11:59:42` because the `/s/g` step at the end re-matched\n // the literal `s` inside `days`. Longest-token-first ordering inside\n // the alternation handles `DD`>`D`, `HH`>`H`, `mm`>`m`, `SSS`>`ss`>`s`.\n return fmt.replace(/(?<![A-Za-z])(?:SSS|DD|HH|mm|ss|D|H|m|s)(?![A-Za-z])/g, token => {\n switch (token) {\n case 'DD':\n return pad(days, 2);\n case 'D':\n return String(days);\n case 'HH':\n return pad(hours, 2);\n case 'H':\n return String(hours);\n case 'mm':\n return pad(minutes, 2);\n case 'm':\n return String(minutes);\n case 'ss':\n return pad(seconds, 2);\n case 's':\n return String(seconds);\n case 'SSS':\n return pad(millis, 3);\n default:\n return token;\n }\n });\n}\n\n/**\n * Live-counting variant of `<wr-statistic>` that targets a future date\n * and ticks down to zero. The format string uses Day/Hour/Minute/Second\n * tokens (`D`, `H`, `m`, `s`, double for zero-padded, plus `SSS` for\n * milliseconds).\n *\n * @example\n * ```html\n * <wr-statistic-countdown\n * label=\"Launch in\"\n * [target]=\"launchDate\"\n * format=\"D days HH:mm:ss\"\n * (countdownEnd)=\"onLive()\"\n * />\n * ```\n *\n * @see https://ngwr.dev/components/statistic\n */\n@Component({\n selector: 'wr-statistic-countdown',\n templateUrl: './statistic-countdown.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-statistic' },\n})\nexport class WrStatisticCountdown {\n /** Target date / timestamp the countdown is running down to. */\n readonly target = input.required<Date | string | number>();\n\n /** Label rendered above the value. */\n readonly label = input<string>('');\n\n /**\n * Format string. Tokens: `D`/`DD` (days), `H`/`HH` (hours),\n * `m`/`mm` (minutes), `s`/`ss` (seconds), `SSS` (milliseconds).\n * Double-letter forms zero-pad to width 2. @default 'HH:mm:ss'\n */\n readonly format = input<string>('HH:mm:ss');\n\n /** Optional text shown once the countdown reaches zero. */\n readonly endText = input<string | null>(null);\n\n /**\n * Tick interval in ms. Drop to ~16 for `SSS` (millisecond display).\n * @default 1000\n */\n readonly tickMs = input(1000);\n\n /** Fires once when the countdown crosses zero. */\n readonly countdownEnd = output<void>();\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private readonly targetMs = computed(() => toMs(this.target()));\n\n /** Remaining milliseconds (live signal). */\n protected readonly remaining = signal(0);\n protected readonly finished = signal(false);\n\n protected readonly display = computed(() => {\n if (this.finished() && this.endText() != null) return this.endText()!;\n return formatRemaining(this.remaining(), this.format());\n });\n\n constructor() {\n // Seed once synchronously so SSR / first paint shows a sane value.\n effect(() => {\n const ms = Math.max(0, this.targetMs() - Date.now());\n this.remaining.set(ms);\n this.finished.set(ms === 0);\n });\n\n if (!this.isBrowser) return;\n\n afterNextRender(() => {\n const handle = setInterval(() => this.tick(), this.tickMs());\n this.destroyRef.onDestroy(() => clearInterval(handle));\n });\n }\n\n private tick(): void {\n const ms = Math.max(0, this.targetMs() - Date.now());\n this.remaining.set(ms);\n if (ms === 0 && !this.finished()) {\n this.finished.set(true);\n this.countdownEnd.emit();\n }\n }\n}\n","@if (label()) {\n <div class=\"wr-statistic__label\">{{ label() }}</div>\n}\n<div class=\"wr-statistic__value\">\n <span class=\"wr-statistic__number\">{{ display() }}</span>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAAA;;;;;AAKG;AAKH;;;;;;;;;;;AAWG;MAOU,WAAW,CAAA;IACb,KAAK,GAAG,KAAK,CAA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AU,CAAC,SAAS,CAAC,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC;AACxD,QAAA,CAAC,CAAC;IACJ;IAEQ,IAAI,GAAA;AACV,QAAA,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AACpD,QAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE;AAChC,YAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;AACvB,YAAA,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE;QAC1B;IACF;uGA/DW,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAApB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,oBAAoB,yxBC/FjC,4LAMA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FDyFa,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBANhC,SAAS;+BACE,wBAAwB,EAAA,aAAA,EAEnB,iBAAiB,CAAC,IAAI,QAC/B,EAAE,KAAK,EAAE,cAAc,EAAE,EAAA,QAAA,EAAA,4LAAA,EAAA;;;AE7FjC;;AAEG;;;;"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { InjectionToken, input, signal, inject, computed, ViewEncapsulation, Component, model, contentChildren, effect, forwardRef } 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
|
+
const WR_STEPPER = new InjectionToken('WR_STEPPER');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @license
|
|
15
|
+
*
|
|
16
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
17
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* One step in a {@link WrStepper}. Project as a child:
|
|
21
|
+
*
|
|
22
|
+
* ```html
|
|
23
|
+
* <wr-stepper>
|
|
24
|
+
* <wr-step label="Account"> … </wr-step>
|
|
25
|
+
* <wr-step label="Profile" description="Optional"> … </wr-step>
|
|
26
|
+
* </wr-stepper>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* The stepper hides every step except the active one via a host class —
|
|
30
|
+
* each step still mounts once, so component state survives navigation.
|
|
31
|
+
*
|
|
32
|
+
* @see https://ngwr.dev/components/stepper
|
|
33
|
+
*/
|
|
34
|
+
class WrStep {
|
|
35
|
+
/** Header label. */
|
|
36
|
+
label = input('', /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
38
|
+
/** Secondary text shown under the label. */
|
|
39
|
+
description = input('', /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "description" }] : /* istanbul ignore next */ []));
|
|
41
|
+
/** Marks the step as optional in the header. */
|
|
42
|
+
optional = input(false, { ...(ngDevMode ? { debugName: "optional" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
43
|
+
/**
|
|
44
|
+
* Override completion state. When unset, the stepper auto-derives it
|
|
45
|
+
* from the active index (any step before `active` is completed).
|
|
46
|
+
*/
|
|
47
|
+
completed = input(null, /* @ts-ignore */
|
|
48
|
+
...(ngDevMode ? [{ debugName: "completed" }] : /* istanbul ignore next */ []));
|
|
49
|
+
/** Disables the header — also blocks header clicks. */
|
|
50
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
51
|
+
/** Stepper-assigned index. Set by the parent when contentChildren updates. */
|
|
52
|
+
_index = signal(-1, /* @ts-ignore */
|
|
53
|
+
...(ngDevMode ? [{ debugName: "_index" }] : /* istanbul ignore next */ []));
|
|
54
|
+
stepper = inject(WR_STEPPER);
|
|
55
|
+
isActive = computed(() => this._index() === this.stepper.active(), /* @ts-ignore */
|
|
56
|
+
...(ngDevMode ? [{ debugName: "isActive" }] : /* istanbul ignore next */ []));
|
|
57
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: WrStep, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
58
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.1", type: WrStep, isStandalone: true, selector: "wr-step", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, optional: { classPropertyName: "optional", publicName: "optional", isSignal: true, isRequired: false, transformFunction: null }, completed: { classPropertyName: "completed", publicName: "completed", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.wr-step--active": "isActive()" }, classAttribute: "wr-step" }, ngImport: i0, template: '<ng-content />', isInline: true, encapsulation: i0.ViewEncapsulation.None });
|
|
59
|
+
}
|
|
60
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: WrStep, decorators: [{
|
|
61
|
+
type: Component,
|
|
62
|
+
args: [{
|
|
63
|
+
selector: 'wr-step',
|
|
64
|
+
template: '<ng-content />',
|
|
65
|
+
encapsulation: ViewEncapsulation.None,
|
|
66
|
+
host: {
|
|
67
|
+
class: 'wr-step',
|
|
68
|
+
'[class.wr-step--active]': 'isActive()',
|
|
69
|
+
},
|
|
70
|
+
}]
|
|
71
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }], optional: [{ type: i0.Input, args: [{ isSignal: true, alias: "optional", required: false }] }], completed: [{ type: i0.Input, args: [{ isSignal: true, alias: "completed", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @license
|
|
75
|
+
*
|
|
76
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
77
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
78
|
+
*/
|
|
79
|
+
/**
|
|
80
|
+
* Multi-step wizard container. Children are `<wr-step>` components — the
|
|
81
|
+
* stepper renders one numbered header per step (with connectors) and the
|
|
82
|
+
* body of the currently active one.
|
|
83
|
+
*
|
|
84
|
+
* Two-way bind `[(active)]` to the active step index. Set `linear="true"`
|
|
85
|
+
* to forbid jumping past incomplete steps.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```html
|
|
89
|
+
* <wr-stepper [(active)]="step" linear>
|
|
90
|
+
* <wr-step label="Account">…</wr-step>
|
|
91
|
+
* <wr-step label="Profile">…</wr-step>
|
|
92
|
+
* <wr-step label="Confirm">…</wr-step>
|
|
93
|
+
* </wr-stepper>
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @see https://ngwr.dev/components/stepper
|
|
97
|
+
*/
|
|
98
|
+
class WrStepper {
|
|
99
|
+
/** Index of the currently visible step. */
|
|
100
|
+
active = model(0, /* @ts-ignore */
|
|
101
|
+
...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
102
|
+
/** Layout direction. @default 'horizontal' */
|
|
103
|
+
orientation = input('horizontal', /* @ts-ignore */
|
|
104
|
+
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
105
|
+
/** Lock steps after the latest completed one. @default false */
|
|
106
|
+
linear = input(false, { ...(ngDevMode ? { debugName: "linear" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
107
|
+
steps = contentChildren(WrStep, /* @ts-ignore */
|
|
108
|
+
...(ngDevMode ? [{ debugName: "steps" }] : /* istanbul ignore next */ []));
|
|
109
|
+
classes = computed(() => {
|
|
110
|
+
const parts = ['wr-stepper', `wr-stepper--${this.orientation()}`];
|
|
111
|
+
if (this.linear())
|
|
112
|
+
parts.push('wr-stepper--linear');
|
|
113
|
+
return parts.join(' ');
|
|
114
|
+
}, /* @ts-ignore */
|
|
115
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
116
|
+
constructor() {
|
|
117
|
+
// Push each step's index down so it can compute its own active state.
|
|
118
|
+
effect(() => {
|
|
119
|
+
this.steps().forEach((step, i) => step._index.set(i));
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/** Is the step at `index` considered completed? */
|
|
123
|
+
isCompleted(index) {
|
|
124
|
+
const override = this.steps()[index]?.completed();
|
|
125
|
+
if (override !== null && override !== undefined)
|
|
126
|
+
return override;
|
|
127
|
+
return index < this.active();
|
|
128
|
+
}
|
|
129
|
+
/** Is the step at `index` reachable for direct header clicks? */
|
|
130
|
+
isReachable(index) {
|
|
131
|
+
if (this.steps()[index]?.disabled())
|
|
132
|
+
return false;
|
|
133
|
+
if (!this.linear())
|
|
134
|
+
return true;
|
|
135
|
+
if (index <= this.active())
|
|
136
|
+
return true;
|
|
137
|
+
for (let i = 0; i < index; i++) {
|
|
138
|
+
if (!this.isCompleted(i))
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
onHeaderClick(index) {
|
|
144
|
+
if (this.isReachable(index))
|
|
145
|
+
this.goTo(index);
|
|
146
|
+
}
|
|
147
|
+
// Imperative API
|
|
148
|
+
goTo(index) {
|
|
149
|
+
const last = this.steps().length - 1;
|
|
150
|
+
if (last < 0)
|
|
151
|
+
return;
|
|
152
|
+
const clamped = Math.min(Math.max(0, index), last);
|
|
153
|
+
this.active.set(clamped);
|
|
154
|
+
}
|
|
155
|
+
next() {
|
|
156
|
+
this.goTo(this.active() + 1);
|
|
157
|
+
}
|
|
158
|
+
prev() {
|
|
159
|
+
this.goTo(this.active() - 1);
|
|
160
|
+
}
|
|
161
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: WrStepper, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
162
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: WrStepper, isStandalone: true, selector: "wr-stepper", inputs: { active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, linear: { classPropertyName: "linear", publicName: "linear", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { active: "activeChange" }, host: { properties: { "class": "classes()" } }, providers: [
|
|
163
|
+
{
|
|
164
|
+
provide: WR_STEPPER,
|
|
165
|
+
// eslint-disable-next-line @angular-eslint/no-forward-ref
|
|
166
|
+
useExisting: forwardRef(() => WrStepper),
|
|
167
|
+
},
|
|
168
|
+
], queries: [{ propertyName: "steps", predicate: WrStep, isSignal: true }], ngImport: i0, template: "<ol class=\"wr-stepper__headers\" role=\"list\">\n @for (step of steps(); track $index) {\n <li\n class=\"wr-stepper__header\"\n [class.wr-stepper__header--active]=\"$index === active()\"\n [class.wr-stepper__header--completed]=\"isCompleted($index)\"\n [class.wr-stepper__header--reachable]=\"isReachable($index)\"\n [class.wr-stepper__header--disabled]=\"step.disabled()\"\n >\n <button\n type=\"button\"\n class=\"wr-stepper__header-button\"\n [disabled]=\"!isReachable($index) || step.disabled()\"\n [attr.aria-current]=\"$index === active() ? 'step' : null\"\n (click)=\"onHeaderClick($index)\"\n >\n <span class=\"wr-stepper__indicator\" aria-hidden=\"true\">\n @if (isCompleted($index)) {\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\">\n <path\n d=\"M3 7.5 L6 10.5 L11 4.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.75\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n } @else {\n {{ $index + 1 }}\n }\n </span>\n <span class=\"wr-stepper__label\">\n {{ step.label() }}\n @if (step.optional()) {\n <small class=\"wr-stepper__optional\">optional</small>\n }\n @if (step.description()) {\n <small class=\"wr-stepper__description\">{{ step.description() }}</small>\n }\n </span>\n </button>\n @if (!$last) {\n <span class=\"wr-stepper__connector\" aria-hidden=\"true\"></span>\n }\n </li>\n }\n</ol>\n\n<div class=\"wr-stepper__body\">\n <ng-content />\n</div>\n", encapsulation: i0.ViewEncapsulation.None });
|
|
169
|
+
}
|
|
170
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: WrStepper, decorators: [{
|
|
171
|
+
type: Component,
|
|
172
|
+
args: [{ selector: 'wr-stepper', encapsulation: ViewEncapsulation.None, host: { '[class]': 'classes()' }, providers: [
|
|
173
|
+
{
|
|
174
|
+
provide: WR_STEPPER,
|
|
175
|
+
// eslint-disable-next-line @angular-eslint/no-forward-ref
|
|
176
|
+
useExisting: forwardRef(() => WrStepper),
|
|
177
|
+
},
|
|
178
|
+
], template: "<ol class=\"wr-stepper__headers\" role=\"list\">\n @for (step of steps(); track $index) {\n <li\n class=\"wr-stepper__header\"\n [class.wr-stepper__header--active]=\"$index === active()\"\n [class.wr-stepper__header--completed]=\"isCompleted($index)\"\n [class.wr-stepper__header--reachable]=\"isReachable($index)\"\n [class.wr-stepper__header--disabled]=\"step.disabled()\"\n >\n <button\n type=\"button\"\n class=\"wr-stepper__header-button\"\n [disabled]=\"!isReachable($index) || step.disabled()\"\n [attr.aria-current]=\"$index === active() ? 'step' : null\"\n (click)=\"onHeaderClick($index)\"\n >\n <span class=\"wr-stepper__indicator\" aria-hidden=\"true\">\n @if (isCompleted($index)) {\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\">\n <path\n d=\"M3 7.5 L6 10.5 L11 4.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.75\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n } @else {\n {{ $index + 1 }}\n }\n </span>\n <span class=\"wr-stepper__label\">\n {{ step.label() }}\n @if (step.optional()) {\n <small class=\"wr-stepper__optional\">optional</small>\n }\n @if (step.description()) {\n <small class=\"wr-stepper__description\">{{ step.description() }}</small>\n }\n </span>\n </button>\n @if (!$last) {\n <span class=\"wr-stepper__connector\" aria-hidden=\"true\"></span>\n }\n </li>\n }\n</ol>\n\n<div class=\"wr-stepper__body\">\n <ng-content />\n</div>\n" }]
|
|
179
|
+
}], ctorParameters: () => [], propDecorators: { active: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: false }] }, { type: i0.Output, args: ["activeChange"] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], linear: [{ type: i0.Input, args: [{ isSignal: true, alias: "linear", required: false }] }], steps: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => WrStep), { isSignal: true }] }] } });
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Generated bundle index. Do not edit.
|
|
183
|
+
*/
|
|
184
|
+
|
|
185
|
+
export { WR_STEPPER, WrStep, WrStepper };
|
|
186
|
+
//# sourceMappingURL=ngwr-stepper.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngwr-stepper.mjs","sources":["../../../projects/lib/stepper/tokens.ts","../../../projects/lib/stepper/step.ts","../../../projects/lib/stepper/stepper.ts","../../../projects/lib/stepper/stepper.html","../../../projects/lib/stepper/ngwr-stepper.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 { InjectionToken, type Signal } from '@angular/core';\n\n/** Surface a {@link WrStepper} provides for its child `<wr-step>`s. */\nexport interface WrStepperContext {\n /** Index of the currently visible step. */\n readonly active: Signal<number>;\n /** Linear mode — steps after the latest completed one are locked. */\n readonly linear: Signal<boolean>;\n}\n\nexport const WR_STEPPER = new InjectionToken<WrStepperContext>('WR_STEPPER');\n","/**\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 } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, inject, input, signal } from '@angular/core';\n\nimport { WR_STEPPER } from './tokens';\n\n/**\n * One step in a {@link WrStepper}. Project as a child:\n *\n * ```html\n * <wr-stepper>\n * <wr-step label=\"Account\"> … </wr-step>\n * <wr-step label=\"Profile\" description=\"Optional\"> … </wr-step>\n * </wr-stepper>\n * ```\n *\n * The stepper hides every step except the active one via a host class —\n * each step still mounts once, so component state survives navigation.\n *\n * @see https://ngwr.dev/components/stepper\n */\n@Component({\n selector: 'wr-step',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-step',\n '[class.wr-step--active]': 'isActive()',\n },\n})\nexport class WrStep {\n /** Header label. */\n readonly label = input<string>('');\n\n /** Secondary text shown under the label. */\n readonly description = input<string>('');\n\n /** Marks the step as optional in the header. */\n readonly optional = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Override completion state. When unset, the stepper auto-derives it\n * from the active index (any step before `active` is completed).\n */\n readonly completed = input<boolean | null>(null);\n\n /** Disables the header — also blocks header clicks. */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /** Stepper-assigned index. Set by the parent when contentChildren updates. */\n readonly _index = signal(-1);\n\n private readonly stepper = inject(WR_STEPPER);\n\n protected readonly isActive = computed(() => this._index() === this.stepper.active());\n}\n","/**\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 } from '@angular/cdk/coercion';\nimport {\n Component,\n ViewEncapsulation,\n computed,\n contentChildren,\n effect,\n forwardRef,\n input,\n model,\n} from '@angular/core';\n\nimport { WrStep } from './step';\nimport { WR_STEPPER, type WrStepperContext } from './tokens';\n\n/**\n * Multi-step wizard container. Children are `<wr-step>` components — the\n * stepper renders one numbered header per step (with connectors) and the\n * body of the currently active one.\n *\n * Two-way bind `[(active)]` to the active step index. Set `linear=\"true\"`\n * to forbid jumping past incomplete steps.\n *\n * @example\n * ```html\n * <wr-stepper [(active)]=\"step\" linear>\n * <wr-step label=\"Account\">…</wr-step>\n * <wr-step label=\"Profile\">…</wr-step>\n * <wr-step label=\"Confirm\">…</wr-step>\n * </wr-stepper>\n * ```\n *\n * @see https://ngwr.dev/components/stepper\n */\n@Component({\n selector: 'wr-stepper',\n templateUrl: './stepper.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()' },\n providers: [\n {\n provide: WR_STEPPER,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrStepper),\n },\n ],\n})\nexport class WrStepper implements WrStepperContext {\n /** Index of the currently visible step. */\n readonly active = model(0);\n\n /** Layout direction. @default 'horizontal' */\n readonly orientation = input<'horizontal' | 'vertical'>('horizontal');\n\n /** Lock steps after the latest completed one. @default false */\n readonly linear = input(false, { transform: coerceBooleanProperty });\n\n protected readonly steps = contentChildren(WrStep);\n\n protected readonly classes = computed(() => {\n const parts = ['wr-stepper', `wr-stepper--${this.orientation()}`];\n if (this.linear()) parts.push('wr-stepper--linear');\n return parts.join(' ');\n });\n\n constructor() {\n // Push each step's index down so it can compute its own active state.\n effect(() => {\n this.steps().forEach((step, i) => step._index.set(i));\n });\n }\n\n /** Is the step at `index` considered completed? */\n protected isCompleted(index: number): boolean {\n const override = this.steps()[index]?.completed();\n if (override !== null && override !== undefined) return override;\n return index < this.active();\n }\n\n /** Is the step at `index` reachable for direct header clicks? */\n protected isReachable(index: number): boolean {\n if (this.steps()[index]?.disabled()) return false;\n if (!this.linear()) return true;\n if (index <= this.active()) return true;\n for (let i = 0; i < index; i++) {\n if (!this.isCompleted(i)) return false;\n }\n return true;\n }\n\n protected onHeaderClick(index: number): void {\n if (this.isReachable(index)) this.goTo(index);\n }\n\n // Imperative API\n\n goTo(index: number): void {\n const last = this.steps().length - 1;\n if (last < 0) return;\n const clamped = Math.min(Math.max(0, index), last);\n this.active.set(clamped);\n }\n\n next(): void {\n this.goTo(this.active() + 1);\n }\n\n prev(): void {\n this.goTo(this.active() - 1);\n }\n}\n","<ol class=\"wr-stepper__headers\" role=\"list\">\n @for (step of steps(); track $index) {\n <li\n class=\"wr-stepper__header\"\n [class.wr-stepper__header--active]=\"$index === active()\"\n [class.wr-stepper__header--completed]=\"isCompleted($index)\"\n [class.wr-stepper__header--reachable]=\"isReachable($index)\"\n [class.wr-stepper__header--disabled]=\"step.disabled()\"\n >\n <button\n type=\"button\"\n class=\"wr-stepper__header-button\"\n [disabled]=\"!isReachable($index) || step.disabled()\"\n [attr.aria-current]=\"$index === active() ? 'step' : null\"\n (click)=\"onHeaderClick($index)\"\n >\n <span class=\"wr-stepper__indicator\" aria-hidden=\"true\">\n @if (isCompleted($index)) {\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\">\n <path\n d=\"M3 7.5 L6 10.5 L11 4.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.75\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n } @else {\n {{ $index + 1 }}\n }\n </span>\n <span class=\"wr-stepper__label\">\n {{ step.label() }}\n @if (step.optional()) {\n <small class=\"wr-stepper__optional\">optional</small>\n }\n @if (step.description()) {\n <small class=\"wr-stepper__description\">{{ step.description() }}</small>\n }\n </span>\n </button>\n @if (!$last) {\n <span class=\"wr-stepper__connector\" aria-hidden=\"true\"></span>\n }\n </li>\n }\n</ol>\n\n<div class=\"wr-stepper__body\">\n <ng-content />\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAAA;;;;;AAKG;MAYU,UAAU,GAAG,IAAI,cAAc,CAAmB,YAAY;;ACjB3E;;;;;AAKG;AAOH;;;;;;;;;;;;;;AAcG;MAUU,MAAM,CAAA;;IAER,KAAK,GAAG,KAAK,CAAS,EAAE;8EAAC;;IAGzB,WAAW,GAAG,KAAK,CAAS,EAAE;oFAAC;;IAG/B,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,qBAAqB,EAAA,CAAG;AAEtE;;;AAGG;IACM,SAAS,GAAG,KAAK,CAAiB,IAAI;kFAAC;;IAGvC,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,qBAAqB,EAAA,CAAG;;AAG7D,IAAA,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;+EAAC;AAEX,IAAA,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC;AAE1B,IAAA,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;iFAAC;uGAxB1E,MAAM,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAN,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAM,m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