ngwr 9.1.0 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -8
- package/action-sheet/styles/_index.scss +6 -1
- package/badge/styles/_index.scss +17 -7
- package/badge/styles/_tag.scss +12 -3
- package/border-glow/styles/_index.scss +5 -0
- package/button/styles/_index.scss +48 -1
- package/calendar/styles/_index.scss +9 -1
- package/circular-text/styles/_index.scss +6 -1
- package/density/styles/_index.scss +3 -1
- package/dialog/styles/_index.scss +66 -2
- package/drag-drop/styles/_index.scss +20 -7
- package/drawer/styles/_index.scss +61 -1
- package/event-calendar/styles/_index.scss +284 -0
- package/falling-text/styles/_index.scss +5 -0
- package/fesm2022/ngwr-action-sheet.mjs +1 -1
- package/fesm2022/ngwr-action-sheet.mjs.map +1 -1
- package/fesm2022/ngwr-alert.mjs +8 -3
- package/fesm2022/ngwr-alert.mjs.map +1 -1
- package/fesm2022/ngwr-back-top.mjs +6 -4
- package/fesm2022/ngwr-back-top.mjs.map +1 -1
- package/fesm2022/ngwr-border-glow.mjs +12 -9
- package/fesm2022/ngwr-border-glow.mjs.map +1 -1
- package/fesm2022/ngwr-breadcrumbs.mjs +2 -2
- package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ngwr-calendar.mjs +5 -3
- package/fesm2022/ngwr-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-card.mjs +2 -2
- package/fesm2022/ngwr-card.mjs.map +1 -1
- package/fesm2022/ngwr-carousel.mjs +17 -4
- package/fesm2022/ngwr-carousel.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +35 -7
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-checkbox.mjs +12 -3
- package/fesm2022/ngwr-checkbox.mjs.map +1 -1
- package/fesm2022/ngwr-circular-text.mjs +2 -2
- package/fesm2022/ngwr-circular-text.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +6 -5
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-command-palette.mjs +7 -3
- package/fesm2022/ngwr-command-palette.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +7 -7
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-counter.mjs +9 -1
- package/fesm2022/ngwr-counter.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +37 -15
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-density.mjs +10 -2
- package/fesm2022/ngwr-density.mjs.map +1 -1
- package/fesm2022/ngwr-descriptions.mjs +5 -4
- package/fesm2022/ngwr-descriptions.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +10 -1
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-drag-drop.mjs +2 -2
- package/fesm2022/ngwr-drag-drop.mjs.map +1 -1
- package/fesm2022/ngwr-drawer.mjs +37 -16
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +8 -3
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-event-calendar.mjs +723 -0
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -0
- package/fesm2022/ngwr-falling-text.mjs +2 -2
- package/fesm2022/ngwr-falling-text.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +2 -2
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-form.mjs +258 -42
- package/fesm2022/ngwr-form.mjs.map +1 -1
- package/fesm2022/ngwr-fuzzy-text.mjs +15 -1
- package/fesm2022/ngwr-fuzzy-text.mjs.map +1 -1
- package/fesm2022/ngwr-gauge.mjs +8 -3
- package/fesm2022/ngwr-gauge.mjs.map +1 -1
- package/fesm2022/ngwr-glitch-text.mjs +2 -2
- package/fesm2022/ngwr-glitch-text.mjs.map +1 -1
- package/fesm2022/ngwr-gradient-text.mjs +2 -2
- package/fesm2022/ngwr-gradient-text.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +89 -5
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +90 -5
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +94 -3
- package/fesm2022/ngwr-i18n.mjs.map +1 -1
- package/fesm2022/ngwr-icon.mjs +79 -35
- package/fesm2022/ngwr-icon.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +19 -3
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +48 -6
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-knob.mjs +8 -3
- package/fesm2022/ngwr-knob.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +32 -3
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-line-chart.mjs +3 -3
- package/fesm2022/ngwr-line-chart.mjs.map +1 -1
- package/fesm2022/ngwr-list.mjs +2 -2
- package/fesm2022/ngwr-list.mjs.map +1 -1
- package/fesm2022/ngwr-loading-bar.mjs +2 -2
- package/fesm2022/ngwr-loading-bar.mjs.map +1 -1
- package/fesm2022/ngwr-marquee.mjs +2 -2
- package/fesm2022/ngwr-marquee.mjs.map +1 -1
- package/fesm2022/ngwr-media.mjs +3 -0
- package/fesm2022/ngwr-media.mjs.map +1 -1
- package/fesm2022/ngwr-mention.mjs +166 -10
- package/fesm2022/ngwr-mention.mjs.map +1 -1
- package/fesm2022/ngwr-meter-group.mjs +14 -3
- package/fesm2022/ngwr-meter-group.mjs.map +1 -1
- package/fesm2022/ngwr-overlay.mjs +173 -3
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-page-header.mjs +2 -2
- package/fesm2022/ngwr-page-header.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +17 -4
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +4 -3
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +10 -3
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-progress.mjs +8 -2
- package/fesm2022/ngwr-progress.mjs.map +1 -1
- package/fesm2022/ngwr-qr.mjs.map +1 -1
- package/fesm2022/ngwr-rating.mjs +6 -4
- package/fesm2022/ngwr-rating.mjs.map +1 -1
- package/fesm2022/ngwr-result.mjs +19 -12
- package/fesm2022/ngwr-result.mjs.map +1 -1
- package/fesm2022/ngwr-segmented.mjs +2 -2
- package/fesm2022/ngwr-segmented.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +40 -13
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-shiny-text.mjs +4 -6
- package/fesm2022/ngwr-shiny-text.mjs.map +1 -1
- package/fesm2022/ngwr-speed-dial.mjs +11 -3
- package/fesm2022/ngwr-speed-dial.mjs.map +1 -1
- package/fesm2022/ngwr-spotlight-card.mjs +2 -2
- package/fesm2022/ngwr-spotlight-card.mjs.map +1 -1
- package/fesm2022/ngwr-squircle.mjs +1 -1
- package/fesm2022/ngwr-squircle.mjs.map +1 -1
- package/fesm2022/ngwr-star-border.mjs +2 -2
- package/fesm2022/ngwr-star-border.mjs.map +1 -1
- package/fesm2022/ngwr-switch.mjs +10 -3
- package/fesm2022/ngwr-switch.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +233 -19
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs.mjs +21 -4
- package/fesm2022/ngwr-tabs.mjs.map +1 -1
- package/fesm2022/ngwr-textarea.mjs +20 -4
- package/fesm2022/ngwr-textarea.mjs.map +1 -1
- package/fesm2022/ngwr-theme.mjs +13 -3
- package/fesm2022/ngwr-theme.mjs.map +1 -1
- package/fesm2022/ngwr-tilt-card.mjs +2 -2
- package/fesm2022/ngwr-tilt-card.mjs.map +1 -1
- package/fesm2022/ngwr-toolbar.mjs +2 -2
- package/fesm2022/ngwr-toolbar.mjs.map +1 -1
- package/fesm2022/ngwr-tour.mjs +264 -0
- package/fesm2022/ngwr-tour.mjs.map +1 -0
- package/fesm2022/ngwr-transfer.mjs +184 -0
- package/fesm2022/ngwr-transfer.mjs.map +1 -0
- package/fesm2022/ngwr-tree.mjs +27 -9
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-typewriter.mjs +2 -2
- package/fesm2022/ngwr-typewriter.mjs.map +1 -1
- package/fesm2022/ngwr-validators.mjs +118 -2
- package/fesm2022/ngwr-validators.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +2 -2
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-virtual-scroll.mjs +2 -2
- package/fesm2022/ngwr-virtual-scroll.mjs.map +1 -1
- package/fesm2022/ngwr-waves.mjs +25 -3
- package/fesm2022/ngwr-waves.mjs.map +1 -1
- package/form/styles/_index.scss +8 -4
- package/glitch-text/styles/_index.scss +5 -0
- package/gradient-text/styles/_index.scss +5 -0
- package/i18n/en.json +233 -0
- package/i18n/ru.json +233 -0
- package/icon/styles/_index.scss +15 -1
- package/input/styles/_index.scss +16 -0
- package/input-number/styles/_index.scss +8 -1
- package/keyboard/styles/_index.scss +15 -3
- package/llms-full.txt +124 -63
- package/llms.txt +29 -8
- package/loading-bar/styles/_index.scss +5 -0
- package/marquee/styles/_index.scss +7 -2
- package/mention/styles/_index.scss +23 -0
- package/overlay/styles/_index.scss +5 -0
- package/package.json +15 -1
- package/pagination/styles/_index.scss +12 -0
- package/popover/styles/_index.scss +165 -45
- package/pull-to-refresh/styles/_index.scss +5 -0
- package/result/styles/_index.scss +3 -3
- package/schematics/icon-set/index.js +80 -34
- package/schematics/icon-set/schema.json +8 -3
- package/schematics/ng-add/index.js +23 -6
- package/schematics/package.json +3 -0
- package/schematics/page/templates.js +17 -21
- package/schematics/provider/index.js +31 -13
- package/schematics/provider/schema.json +40 -24
- package/schematics/use/index.js +5 -1
- package/schematics/use/schema.json +8 -3
- package/schematics/use/symbol-map.json +7 -176
- package/segmented/styles/_index.scss +1 -1
- package/select/styles/_index.scss +20 -3
- package/shiny-text/styles/_index.scss +5 -0
- package/speed-dial/styles/_index.scss +12 -1
- package/splitter/styles/_index.scss +7 -1
- package/spotlight-card/styles/_index.scss +5 -0
- package/squircle/styles/_index.scss +5 -0
- package/star-border/styles/_index.scss +5 -0
- package/statistic/styles/_index.scss +2 -2
- package/styles/_animations.scss +6 -0
- package/styles.scss +3 -0
- package/table/styles/_index.scss +128 -12
- package/theme/styles/_box-model.scss +29 -0
- package/theme/styles/_colors.scss +116 -15
- package/theme/styles/_dark.scss +65 -7
- package/theme/styles/_focus.scss +2 -8
- package/theme/styles/_index.scss +1 -0
- package/tilt-card/styles/_index.scss +5 -0
- package/toast/styles/_index.scss +6 -3
- package/tour/styles/_index.scss +63 -0
- package/transfer/styles/_index.scss +105 -0
- package/types/ngwr-alert.d.ts +4 -1
- package/types/ngwr-avatar.d.ts +1 -1
- package/types/ngwr-back-top.d.ts +3 -2
- package/types/ngwr-badge.d.ts +1 -1
- package/types/ngwr-border-glow.d.ts +0 -1
- package/types/ngwr-carousel.d.ts +10 -1
- package/types/ngwr-cascader.d.ts +13 -1
- package/types/ngwr-checkbox.d.ts +9 -1
- package/types/ngwr-color-picker.d.ts +1 -0
- package/types/ngwr-command-palette.d.ts +4 -1
- package/types/ngwr-context-menu.d.ts +1 -0
- package/types/ngwr-date-picker.d.ts +14 -4
- package/types/ngwr-density.d.ts +9 -2
- package/types/ngwr-dialog.d.ts +9 -0
- package/types/ngwr-divider.d.ts +1 -1
- package/types/ngwr-drawer.d.ts +20 -4
- package/types/ngwr-dropdown.d.ts +1 -0
- package/types/ngwr-event-calendar.d.ts +358 -0
- package/types/ngwr-form.d.ts +177 -20
- package/types/ngwr-fuzzy-text.d.ts +8 -0
- package/types/ngwr-gauge.d.ts +4 -1
- package/types/ngwr-i18n.d.ts +80 -2
- package/types/ngwr-icon.d.ts +11 -19
- package/types/ngwr-input-number.d.ts +8 -1
- package/types/ngwr-input.d.ts +50 -20
- package/types/ngwr-knob.d.ts +4 -1
- package/types/ngwr-lightbox.d.ts +7 -1
- package/types/ngwr-line-chart.d.ts +1 -1
- package/types/ngwr-media.d.ts +1 -1
- package/types/ngwr-mention.d.ts +45 -1
- package/types/ngwr-meter-group.d.ts +9 -1
- package/types/ngwr-overlay.d.ts +80 -2
- package/types/ngwr-page-header.d.ts +2 -2
- package/types/ngwr-pagination.d.ts +15 -2
- package/types/ngwr-popconfirm.d.ts +1 -0
- package/types/ngwr-popover.d.ts +1 -0
- package/types/ngwr-progress.d.ts +4 -1
- package/types/ngwr-rating.d.ts +3 -2
- package/types/ngwr-result.d.ts +12 -6
- package/types/ngwr-segmented.d.ts +6 -0
- package/types/ngwr-select.d.ts +19 -7
- package/types/ngwr-shiny-text.d.ts +2 -4
- package/types/ngwr-speed-dial.d.ts +7 -1
- package/types/ngwr-squircle.d.ts +1 -1
- package/types/ngwr-switch.d.ts +7 -1
- package/types/ngwr-table.d.ts +126 -6
- package/types/ngwr-tabs.d.ts +1 -4
- package/types/ngwr-textarea.d.ts +8 -1
- package/types/ngwr-theme.d.ts +8 -1
- package/types/ngwr-toolbar.d.ts +2 -2
- package/types/ngwr-tour.d.ts +132 -0
- package/types/ngwr-transfer.d.ts +118 -0
- package/types/ngwr-tree.d.ts +11 -2
- package/types/ngwr-validators.d.ts +62 -2
- package/types/ngwr-version.d.ts +2 -2
- package/types/ngwr-waves.d.ts +10 -0
- package/typewriter/styles/_index.scss +5 -0
- package/typography/styles/_index.scss +3 -3
- package/virtual-scroll/styles/_index.scss +6 -1
- package/waves/styles/_index.scss +26 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-counter.mjs","sources":["../../../projects/lib/counter/easing.ts","../../../projects/lib/counter/counter.ts","../../../projects/lib/counter/counter.html","../../../projects/lib/counter/count-up.ts","../../../projects/lib/counter/ngwr-counter.ts"],"sourcesContent":["/** Cubic ease-out — the shared tween curve for counter / count-up. */\nexport function easeOutCubic(t: number): number {\n return 1 - Math.pow(1 - t, 3);\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 { coerceNumberProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n LOCALE_ID,\n PLATFORM_ID,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n} from '@angular/core';\n\nimport { easeOutCubic } from './easing';\nimport type { WrCounterMode } from './interfaces';\n\n/** Visual cell in odometer mode — either a 0-9 column or a static glyph. */\ntype Cell = { readonly kind: 'digit'; readonly fraction: number } | { readonly kind: 'static'; readonly char: string };\n\n/**\n * Animated number display with two modes:\n *\n * - **`odometer`** (default) — each digit is a vertical strip of 0-9 that\n * rolls into place, continuously interpolated for smooth motion when the\n * value changes.\n * - **`tween`** — a single eased count-up between the previous and new value,\n * rendered through `Intl.NumberFormat`.\n *\n * Reacts to `[value]` changes — animate from any number to any number.\n *\n * @example\n * ```html\n * <wr-counter [value]=\"123456\" mode=\"odometer\" />\n * <wr-counter [value]=\"9.99\" mode=\"tween\" [decimals]=\"2\" prefix=\"$\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/counter\n */\n@Component({\n selector: 'wr-counter',\n templateUrl: './counter.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-counter' },\n})\nexport class WrCounter {\n /** Target value. */\n readonly value = input.required<number>();\n\n /** Animation mode. @default 'odometer' */\n readonly mode = input<WrCounterMode>('odometer');\n\n /** Duration (ms). @default 900 */\n readonly duration = input(900, {\n transform: (v: unknown): number => Math.max(100, coerceNumberProperty(v, 900)),\n });\n\n /** Fixed number of decimals. @default 0 */\n readonly decimals = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /** Optional prefix (e.g. `'$'`). */\n readonly prefix = input<string>('');\n\n /** Optional suffix (e.g. `'%'`). */\n readonly suffix = input<string>('');\n\n /** Group thousands. @default true */\n readonly grouping = input<boolean>(true);\n\n /** Pad integer part to at least this many digits. @default 0 (no padding) */\n readonly minIntegerDigits = input(0, {\n transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)),\n });\n\n private readonly current = signal<number>(0);\n private readonly locale = inject(LOCALE_ID);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private rafId: number | null = null;\n\n /** Tween-mode formatted output. */\n protected readonly tweenText = computed(() => this.format(this.current()));\n\n /**\n * Odometer-mode text for assistive tech and prerendered output. The strip\n * renders every digit 0-9 per column and picks one with a transform, so its\n * markup carries no usable text — screen readers would announce all ten, and\n * static HTML would ship the same noise. This node holds the real value.\n */\n protected readonly odoText = computed(() => `${this.prefix()}${this.format(this.value())}${this.suffix()}`);\n\n /** Odometer cells — one per character in the formatted target string. */\n protected readonly cells = computed<readonly Cell[]>(() => {\n // Build the string with target sign + max length so we can interpolate\n // each digit position smoothly.\n const target = this.value();\n const live = this.current();\n const formattedTarget = this.format(target);\n const formattedLive = this.format(live);\n\n // Right-align so trailing digits line up.\n const maxLen = Math.max(formattedTarget.length, formattedLive.length);\n const padTarget = formattedTarget.padStart(maxLen, ' ');\n const padLive = formattedLive.padStart(maxLen, ' ');\n\n const cells: Cell[] = [];\n for (let i = 0; i < maxLen; i++) {\n const t = padTarget[i];\n const l = padLive[i];\n if (/[0-9]/.test(t) && /[0-9]/.test(l)) {\n // Interpolate the fractional digit so the strip rolls smoothly —\n // multi-digit rollover (9 → 0 carries 1) looks continuous.\n const fraction = this.digitFractionAt(live, target, i, maxLen);\n cells.push({ kind: 'digit', fraction });\n } else {\n cells.push({ kind: 'static', char: t === ' ' ? '' : t });\n }\n }\n return cells;\n });\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.cancel());\n\n effect(() => {\n const target = this.value();\n // Snapshot the current value WITHOUT tracking it — the RAF tick below\n // writes `current` every frame, and tracking it here would re-trigger\n // this effect each frame, cancelling + restarting the tween endlessly\n // (the wheels hang mid-roll and only snap once the restarts converge).\n const start = untracked(() => this.current());\n if (!this.isBrowser) {\n this.current.set(target);\n return;\n }\n this.cancel();\n const startTs = performance.now();\n const dur = this.duration();\n const tick = (now: number): void => {\n const t = Math.min(1, (now - startTs) / dur);\n // Snap exactly to target on the final frame. Without this,\n // `start + (target - start) * 1` carries FP rounding (e.g.\n // 0.1 + (0.3 - 0.1) * 1 = 0.30000000000000004), so\n // `digitFractionAt`'s `live === target` rest-state check\n // fails — wheels visibly stop on a fractional position and\n // never settle to the clean integer glyph.\n const v = t >= 1 ? target : start + (target - start) * easeOutCubic(t);\n this.current.set(v);\n if (t < 1) this.rafId = requestAnimationFrame(tick);\n else this.rafId = null;\n };\n this.rafId = requestAnimationFrame(tick);\n });\n }\n\n private cancel(): void {\n if (this.rafId !== null) cancelAnimationFrame(this.rafId);\n this.rafId = null;\n }\n\n private format(n: number): string {\n return new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: this.decimals(),\n maximumFractionDigits: this.decimals(),\n minimumIntegerDigits: this.minIntegerDigits() || 1,\n useGrouping: this.grouping(),\n }).format(n);\n }\n\n /**\n * Compute the smoothly-interpolated digit (0..10) at column `i` of the\n * formatted live string. Returns the integer digit + a fraction so the\n * strip CSS translate looks like a real rolling odometer.\n */\n private digitFractionAt(live: number, target: number, columnIndex: number, totalLen: number): number {\n // Determine the place value at this column. Account for grouping separators\n // and the decimal point by counting digits to the right of this column in\n // the formatted target.\n const formattedTarget = this.format(target);\n const padded = formattedTarget.padStart(totalLen, ' ');\n const tail = padded.slice(columnIndex + 1);\n const digitsRight = (tail.match(/[0-9]/g) ?? []).length;\n const placePower = digitsRight - this.decimals();\n const place = Math.pow(10, placePower);\n const absLive = Math.abs(live);\n const raw = absLive / place;\n // Modulo 10 gives the digit at this column with fractional rollover —\n // mid-animation this looks like a real wheel rolling between digits.\n const mod = raw - Math.floor(raw / 10) * 10;\n // At rest (live === target) every wheel must rest on an exact integer\n // — otherwise upper digits show as partial (e.g. tens reads \"5.6\"\n // for value 123456, visibly clipping between 5 and 6 in the\n // overflow:hidden window). The continuous-mechanical look is only\n // wanted DURING the tween, not after it settles.\n if (live === target) return Math.floor(mod + 1e-9);\n return mod;\n }\n}\n","@if (mode() === 'tween') {\n <span class=\"wr-counter__tween\">{{ prefix() }}{{ tweenText() }}{{ suffix() }}</span>\n} @else {\n <span class=\"wr-counter__sr-only\">{{ odoText() }}</span>\n <span class=\"wr-counter__odo\" aria-hidden=\"true\">\n @if (prefix()) {\n <span class=\"wr-counter__static\">{{ prefix() }}</span>\n }\n @for (cell of cells(); track $index) {\n @if (cell.kind === 'digit') {\n <span class=\"wr-counter__digit\">\n <span class=\"wr-counter__strip\" [style.transform]=\"`translateY(-${cell.fraction}em)`\">\n <span>0</span><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span\n ><span>7</span><span>8</span><span>9</span>\n </span>\n </span>\n } @else {\n <span class=\"wr-counter__static\">{{ cell.char }}</span>\n }\n }\n @if (suffix()) {\n <span class=\"wr-counter__static\">{{ suffix() }}</span>\n }\n </span>\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 * The spring-physics path is an adaptation of the CountUp effect by\n * David Haz / reactbits.dev (https://www.reactbits.dev/text-animations/count-up).\n * Same critically-damped formula, implemented inline with rAF — no\n * external dependency.\n */\n\nimport { coerceNumberProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n LOCALE_ID,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport { numAttr } from 'ngwr/utils';\n\nimport { easeOutCubic } from './easing';\nimport type { WrCountUpDirection, WrCountUpEasing, WrCountUpTrigger } from './interfaces';\n\n/**\n * Animated number tick. Animates from `from` to the current `to`, formatting\n * via `Intl.NumberFormat`. Re-runs whenever `to` changes.\n *\n * @example Basic\n * ```html\n * <wr-count-up [to]=\"12345\" />\n * <wr-count-up [to]=\"9.99\" [decimals]=\"2\" prefix=\"$\" />\n * ```\n *\n * @example Reactbits-style — spring curve + viewport trigger\n * ```html\n * <wr-count-up [to]=\"100\" easing=\"spring\" trigger=\"visible\" [delay]=\"200\" />\n * ```\n *\n * @example Count down\n * ```html\n * <wr-count-up [from]=\"60\" [to]=\"0\" direction=\"down\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/counter\n */\n@Component({\n selector: 'wr-count-up',\n template: `{{ prefix() }}{{ formatted() }}{{ suffix() }}`,\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-count-up' },\n})\nexport class WrCountUp {\n /** Starting value. @default 0 */\n readonly from = input(0, { transform: numAttr(0) });\n\n /** Target value. */\n readonly to = input.required<number>();\n\n /**\n * Animation duration. Units depend on `easing`:\n *\n * - `ease-out` — milliseconds (default 1200, min 100)\n * - `spring` — seconds (tunes spring stiffness; default 2)\n */\n readonly duration = input(1200, { transform: numAttr(1200) });\n\n /** Optional delay (ms) before the animation starts. @default 0 */\n readonly delay = input(0, { transform: numAttr(0) });\n\n /** Animation curve. @default 'ease-out' */\n readonly easing = input<WrCountUpEasing>('ease-out');\n\n /**\n * When to start the animation.\n *\n * - `'mount'` (default) — start as soon as the component is rendered.\n * - `'visible'` — wait for the host to enter the viewport\n * (IntersectionObserver). Useful for long pages or hero numbers\n * below the fold.\n */\n readonly trigger = input<WrCountUpTrigger>('mount');\n\n /** Counting direction. `'down'` swaps `from` ↔ `to`. @default 'up' */\n readonly direction = input<WrCountUpDirection>('up');\n\n /** Fixed number of decimals. @default 0 */\n readonly decimals = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /** Optional prefix (e.g. `'$'`). */\n readonly prefix = input<string>('');\n\n /** Optional suffix (e.g. `'%'`). */\n readonly suffix = input<string>('');\n\n /** Disable grouping separators (`1,234` → `1234`). @default true (grouping on) */\n readonly grouping = input<boolean>(true);\n\n /** Emits when the animation begins. */\n readonly started = output<void>();\n\n /** Emits when the animation settles. */\n readonly completed = output<void>();\n\n private readonly value = signal<number>(0);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly locale = inject(LOCALE_ID);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly destroyRef = inject(DestroyRef);\n\n private rafId: number | null = null;\n private delayTimer: ReturnType<typeof setTimeout> | undefined;\n private observer: IntersectionObserver | null = null;\n private hasFiredForVisible = false;\n\n protected readonly formatted = computed(() => {\n return new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: this.decimals(),\n maximumFractionDigits: this.decimals(),\n useGrouping: this.grouping(),\n }).format(this.value());\n });\n\n constructor() {\n if (!this.isBrowser) {\n // SSR: settle on the value the animation ENDS on. Seeding the start\n // instead would bake the placeholder (usually 0) into prerendered HTML,\n // so readers and crawlers would get 0 rather than the real figure. The\n // browser rewinds to the start and animates once it boots.\n effect(() => this.value.set(this.direction() === 'down' ? this.from() : this.to()));\n return;\n }\n\n // Seed the resting value so first paint shows the start, not 0.\n effect(() => {\n const initial = this.direction() === 'down' ? this.to() : this.from();\n this.value.set(initial);\n });\n\n // Run the animation whenever the `to` target changes (or on first mount).\n // For `trigger=\"visible\"` the first run waits for the IntersectionObserver\n // to fire; subsequent `to` changes re-run immediately.\n effect(() => {\n // Establish dependencies so the effect re-runs on `to` changes.\n this.to();\n this.from();\n this.direction();\n this.duration();\n this.easing();\n this.delay();\n\n if (this.trigger() === 'visible' && !this.hasFiredForVisible) return;\n this.scheduleRun();\n });\n\n afterNextRender(() => {\n if (this.trigger() === 'visible') this.setupViewportTrigger();\n });\n\n this.destroyRef.onDestroy(() => this.cancel());\n }\n\n // Scheduling\n\n private setupViewportTrigger(): void {\n this.observer = new IntersectionObserver(\n (entries, obs) => {\n for (const e of entries) {\n if (e.isIntersecting && !this.hasFiredForVisible) {\n obs.disconnect();\n this.hasFiredForVisible = true;\n this.scheduleRun();\n break;\n }\n }\n },\n { threshold: 0, rootMargin: '0px' }\n );\n this.observer.observe(this.host.nativeElement);\n }\n\n private scheduleRun(): void {\n this.cancel();\n const d = this.delay();\n if (d > 0) {\n this.delayTimer = setTimeout(() => this.run(), d);\n } else {\n this.run();\n }\n }\n\n private run(): void {\n const start = this.direction() === 'down' ? this.to() : this.from();\n const end = this.direction() === 'down' ? this.from() : this.to();\n this.started.emit();\n if (this.easing() === 'spring') this.tweenSpring(start, end);\n else this.tweenEaseOut(start, end);\n }\n\n // Tweens\n\n private tweenEaseOut(start: number, target: number): void {\n const duration = Math.max(100, this.duration());\n const startTs = performance.now();\n const tick = (now: number): void => {\n const t = Math.min(1, (now - startTs) / duration);\n const v = start + (target - start) * easeOutCubic(t);\n this.value.set(v);\n if (t < 1) {\n this.rafId = requestAnimationFrame(tick);\n } else {\n this.completed.emit();\n }\n };\n this.rafId = requestAnimationFrame(tick);\n }\n\n /**\n * Critically-damped spring tween. Same formula as `motion/react`'s\n * `useSpring` with mass = 1:\n *\n * damping = 20 + 40 / duration\n * stiffness = 100 / duration\n *\n * We integrate `(spring force − damping force)` each frame until both\n * displacement and velocity fall below epsilon.\n */\n private tweenSpring(start: number, target: number): void {\n const duration = Math.max(0.05, this.duration());\n const damping = 20 + 40 / duration;\n const stiffness = 100 / duration;\n let current = start;\n let velocity = 0;\n let lastTs = 0;\n const epsilon = 0.001 * Math.max(1, Math.abs(target - start));\n\n const step = (ts: number): void => {\n const dt = lastTs === 0 ? 1 / 60 : Math.min(0.05, (ts - lastTs) / 1000);\n lastTs = ts;\n\n const displacement = current - target;\n const accel = -stiffness * displacement - damping * velocity;\n velocity += accel * dt;\n current += velocity * dt;\n this.value.set(current);\n\n if (Math.abs(current - target) < epsilon && Math.abs(velocity) < epsilon * 10) {\n this.value.set(target);\n this.completed.emit();\n return;\n }\n this.rafId = requestAnimationFrame(step);\n };\n this.rafId = requestAnimationFrame(step);\n }\n\n // Cleanup\n\n private cancel(): void {\n if (this.rafId !== null) cancelAnimationFrame(this.rafId);\n this.rafId = null;\n if (this.delayTimer !== undefined) {\n clearTimeout(this.delayTimer);\n this.delayTimer = undefined;\n }\n }\n}\n\nexport type { WrCountUpEasing, WrCountUpTrigger, WrCountUpDirection } from './interfaces';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAAA;AACM,SAAU,YAAY,CAAC,CAAS,EAAA;AACpC,IAAA,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAC/B;;ACHA;;;;;AAKG;AAwBH;;;;;;;;;;;;;;;;;;AAkBG;MAOU,SAAS,CAAA;;IAEX,KAAK,GAAG,KAAK,CAAC,QAAQ;8EAAU;;IAGhC,IAAI,GAAG,KAAK,CAAgB,UAAU;6EAAC;;IAGvC,QAAQ,GAAG,KAAK,CAAC,GAAG,EAAA,EAAA,IAAA,SAAA,GAAA,EAAA,SAAA,EAAA,UAAA,EAAA,8BAAA,EAAA,CAAA,EAC3B,SAAS,EAAE,CAAC,CAAU,KAAa,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAA,CAC9E;;IAGO,QAAQ,GAAG,KAAK,CAAC,CAAC,EAAA,EAAA,IAAA,SAAA,GAAA,EAAA,SAAA,EAAA,UAAA,EAAA,8BAAA,EAAA,CAAA,EAAI,SAAS,EAAE,CAAC,CAAU,KAAa,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAA,CAAG;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aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FAI9C,SAAS,EAAA,UAAA,EAAA,CAAA;kBANrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,CAAA,6CAAA,CAA+C;oBACzD,aAAa,EAAE,iBAAiB,CAAC,IAAI;AACrC,oBAAA,IAAI,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE;AAC/B,iBAAA;;;AC9DD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngwr-counter.mjs","sources":["../../../projects/lib/counter/easing.ts","../../../projects/lib/counter/counter.ts","../../../projects/lib/counter/counter.html","../../../projects/lib/counter/count-up.ts","../../../projects/lib/counter/ngwr-counter.ts"],"sourcesContent":["/** Cubic ease-out — the shared tween curve for counter / count-up. */\nexport function easeOutCubic(t: number): number {\n return 1 - Math.pow(1 - t, 3);\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 { coerceNumberProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n LOCALE_ID,\n PLATFORM_ID,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n} from '@angular/core';\n\nimport { easeOutCubic } from './easing';\nimport type { WrCounterMode } from './interfaces';\n\n/** Visual cell in odometer mode — either a 0-9 column or a static glyph. */\ntype Cell = { readonly kind: 'digit'; readonly fraction: number } | { readonly kind: 'static'; readonly char: string };\n\n/**\n * Animated number display with two modes:\n *\n * - **`odometer`** (default) — each digit is a vertical strip of 0-9 that\n * rolls into place, continuously interpolated for smooth motion when the\n * value changes.\n * - **`tween`** — a single eased count-up between the previous and new value,\n * rendered through `Intl.NumberFormat`.\n *\n * Reacts to `[value]` changes — animate from any number to any number.\n *\n * @example\n * ```html\n * <wr-counter [value]=\"123456\" mode=\"odometer\" />\n * <wr-counter [value]=\"9.99\" mode=\"tween\" [decimals]=\"2\" prefix=\"$\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/counter\n */\n@Component({\n selector: 'wr-counter',\n templateUrl: './counter.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-counter' },\n})\nexport class WrCounter {\n /** Target value. */\n readonly value = input.required<number>();\n\n /** Animation mode. @default 'odometer' */\n readonly mode = input<WrCounterMode>('odometer');\n\n /** Duration (ms). @default 900 */\n readonly duration = input(900, {\n transform: (v: unknown): number => Math.max(100, coerceNumberProperty(v, 900)),\n });\n\n /** Fixed number of decimals. @default 0 */\n readonly decimals = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /** Optional prefix (e.g. `'$'`). */\n readonly prefix = input<string>('');\n\n /** Optional suffix (e.g. `'%'`). */\n readonly suffix = input<string>('');\n\n /** Group thousands. @default true */\n readonly grouping = input<boolean>(true);\n\n /** Pad integer part to at least this many digits. @default 0 (no padding) */\n readonly minIntegerDigits = input(0, {\n transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)),\n });\n\n private readonly current = signal<number>(0);\n private readonly locale = inject(LOCALE_ID);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private rafId: number | null = null;\n\n /** Tween-mode formatted output. */\n protected readonly tweenText = computed(() => this.format(this.current()));\n\n /**\n * Odometer-mode text for assistive tech and prerendered output. The strip\n * renders every digit 0-9 per column and picks one with a transform, so its\n * markup carries no usable text — screen readers would announce all ten, and\n * static HTML would ship the same noise. This node holds the real value.\n */\n protected readonly odoText = computed(() => `${this.prefix()}${this.format(this.value())}${this.suffix()}`);\n\n /** Odometer cells — one per character in the formatted target string. */\n protected readonly cells = computed<readonly Cell[]>(() => {\n // Build the string with target sign + max length so we can interpolate\n // each digit position smoothly.\n const target = this.value();\n const live = this.current();\n const formattedTarget = this.format(target);\n const formattedLive = this.format(live);\n\n // Right-align so trailing digits line up.\n const maxLen = Math.max(formattedTarget.length, formattedLive.length);\n const padTarget = formattedTarget.padStart(maxLen, ' ');\n const padLive = formattedLive.padStart(maxLen, ' ');\n\n const cells: Cell[] = [];\n for (let i = 0; i < maxLen; i++) {\n const t = padTarget[i];\n const l = padLive[i];\n if (/[0-9]/.test(t) && /[0-9]/.test(l)) {\n // Interpolate the fractional digit so the strip rolls smoothly —\n // multi-digit rollover (9 → 0 carries 1) looks continuous.\n const fraction = this.digitFractionAt(live, target, i, maxLen);\n cells.push({ kind: 'digit', fraction });\n } else {\n cells.push({ kind: 'static', char: t === ' ' ? '' : t });\n }\n }\n return cells;\n });\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.cancel());\n\n effect(() => {\n const target = this.value();\n // Snapshot the current value WITHOUT tracking it — the RAF tick below\n // writes `current` every frame, and tracking it here would re-trigger\n // this effect each frame, cancelling + restarting the tween endlessly\n // (the wheels hang mid-roll and only snap once the restarts converge).\n const start = untracked(() => this.current());\n if (!this.isBrowser) {\n this.current.set(target);\n return;\n }\n this.cancel();\n const startTs = performance.now();\n const dur = this.duration();\n const tick = (now: number): void => {\n const t = Math.min(1, (now - startTs) / dur);\n // Snap exactly to target on the final frame. Without this,\n // `start + (target - start) * 1` carries FP rounding (e.g.\n // 0.1 + (0.3 - 0.1) * 1 = 0.30000000000000004), so\n // `digitFractionAt`'s `live === target` rest-state check\n // fails — wheels visibly stop on a fractional position and\n // never settle to the clean integer glyph.\n const v = t >= 1 ? target : start + (target - start) * easeOutCubic(t);\n this.current.set(v);\n if (t < 1) this.rafId = requestAnimationFrame(tick);\n else this.rafId = null;\n };\n this.rafId = requestAnimationFrame(tick);\n });\n }\n\n private cancel(): void {\n if (this.rafId !== null) cancelAnimationFrame(this.rafId);\n this.rafId = null;\n }\n\n private format(n: number): string {\n return new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: this.decimals(),\n maximumFractionDigits: this.decimals(),\n minimumIntegerDigits: this.minIntegerDigits() || 1,\n useGrouping: this.grouping(),\n }).format(n);\n }\n\n /**\n * Compute the smoothly-interpolated digit (0..10) at column `i` of the\n * formatted live string. Returns the integer digit + a fraction so the\n * strip CSS translate looks like a real rolling odometer.\n */\n private digitFractionAt(live: number, target: number, columnIndex: number, totalLen: number): number {\n // Determine the place value at this column. Account for grouping separators\n // and the decimal point by counting digits to the right of this column in\n // the formatted target.\n const formattedTarget = this.format(target);\n const padded = formattedTarget.padStart(totalLen, ' ');\n const tail = padded.slice(columnIndex + 1);\n const digitsRight = (tail.match(/[0-9]/g) ?? []).length;\n const placePower = digitsRight - this.decimals();\n const place = Math.pow(10, placePower);\n const absLive = Math.abs(live);\n const raw = absLive / place;\n // Modulo 10 gives the digit at this column with fractional rollover —\n // mid-animation this looks like a real wheel rolling between digits.\n const mod = raw - Math.floor(raw / 10) * 10;\n // At rest (live === target) every wheel must rest on an exact integer\n // — otherwise upper digits show as partial (e.g. tens reads \"5.6\"\n // for value 123456, visibly clipping between 5 and 6 in the\n // overflow:hidden window). The continuous-mechanical look is only\n // wanted DURING the tween, not after it settles.\n if (live === target) return Math.floor(mod + 1e-9);\n return mod;\n }\n}\n","@if (mode() === 'tween') {\n <span class=\"wr-counter__tween\">{{ prefix() }}{{ tweenText() }}{{ suffix() }}</span>\n} @else {\n <span class=\"wr-counter__sr-only\">{{ odoText() }}</span>\n <span class=\"wr-counter__odo\" aria-hidden=\"true\">\n @if (prefix()) {\n <span class=\"wr-counter__static\">{{ prefix() }}</span>\n }\n @for (cell of cells(); track $index) {\n @if (cell.kind === 'digit') {\n <span class=\"wr-counter__digit\">\n <span class=\"wr-counter__strip\" [style.transform]=\"`translateY(-${cell.fraction}em)`\">\n <span>0</span><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span\n ><span>7</span><span>8</span><span>9</span>\n </span>\n </span>\n } @else {\n <span class=\"wr-counter__static\">{{ cell.char }}</span>\n }\n }\n @if (suffix()) {\n <span class=\"wr-counter__static\">{{ suffix() }}</span>\n }\n </span>\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 * The spring-physics path is an adaptation of the CountUp effect by\n * David Haz / reactbits.dev (https://www.reactbits.dev/text-animations/count-up).\n * Same critically-damped formula, implemented inline with rAF — no\n * external dependency.\n */\n\nimport { coerceNumberProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n LOCALE_ID,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport { numAttr } from 'ngwr/utils';\n\nimport { easeOutCubic } from './easing';\nimport type { WrCountUpDirection, WrCountUpEasing, WrCountUpTrigger } from './interfaces';\n\n/**\n * Animated number tick. Animates from `from` to the current `to`, formatting\n * via `Intl.NumberFormat`. Re-runs whenever `to` changes.\n *\n * @example Basic\n * ```html\n * <wr-count-up [to]=\"12345\" />\n * <wr-count-up [to]=\"9.99\" [decimals]=\"2\" prefix=\"$\" />\n * ```\n *\n * @example Reactbits-style — spring curve + viewport trigger\n * ```html\n * <wr-count-up [to]=\"100\" easing=\"spring\" trigger=\"visible\" [delay]=\"200\" />\n * ```\n *\n * @example Count down\n * ```html\n * <wr-count-up [from]=\"60\" [to]=\"0\" direction=\"down\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/counter\n */\n@Component({\n selector: 'wr-count-up',\n template: `{{ prefix() }}{{ formatted() }}{{ suffix() }}`,\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-count-up' },\n})\nexport class WrCountUp {\n /** Starting value. @default 0 */\n readonly from = input(0, { transform: numAttr(0) });\n\n /** Target value. */\n readonly to = input.required<number>();\n\n /**\n * Animation duration. Units depend on `easing`:\n *\n * - `ease-out` — milliseconds (default 1200, min 100)\n * - `spring` — seconds (tunes spring stiffness; default 2)\n */\n readonly duration = input(1200, { transform: numAttr(1200) });\n\n /** Optional delay (ms) before the animation starts. @default 0 */\n readonly delay = input(0, { transform: numAttr(0) });\n\n /** Animation curve. @default 'ease-out' */\n readonly easing = input<WrCountUpEasing>('ease-out');\n\n /**\n * When to start the animation.\n *\n * - `'mount'` (default) — start as soon as the component is rendered.\n * - `'visible'` — wait for the host to enter the viewport\n * (IntersectionObserver). Useful for long pages or hero numbers\n * below the fold.\n */\n readonly trigger = input<WrCountUpTrigger>('mount');\n\n /** Counting direction. `'down'` swaps `from` ↔ `to`. @default 'up' */\n readonly direction = input<WrCountUpDirection>('up');\n\n /** Fixed number of decimals. @default 0 */\n readonly decimals = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /** Optional prefix (e.g. `'$'`). */\n readonly prefix = input<string>('');\n\n /** Optional suffix (e.g. `'%'`). */\n readonly suffix = input<string>('');\n\n /** Disable grouping separators (`1,234` → `1234`). @default true (grouping on) */\n readonly grouping = input<boolean>(true);\n\n /** Emits when the animation begins. */\n readonly started = output<void>();\n\n /** Emits when the animation settles. */\n readonly completed = output<void>();\n\n private readonly value = signal<number>(0);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly locale = inject(LOCALE_ID);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly destroyRef = inject(DestroyRef);\n\n private rafId: number | null = null;\n private delayTimer: ReturnType<typeof setTimeout> | undefined;\n private observer: IntersectionObserver | null = null;\n private hasFiredForVisible = false;\n\n protected readonly formatted = computed(() => {\n return new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: this.decimals(),\n maximumFractionDigits: this.decimals(),\n useGrouping: this.grouping(),\n }).format(this.value());\n });\n\n constructor() {\n if (!this.isBrowser) {\n // SSR: settle on the value the animation ENDS on. Seeding the start\n // instead would bake the placeholder (usually 0) into prerendered HTML,\n // so readers and crawlers would get 0 rather than the real figure. The\n // browser rewinds to the start and animates once it boots.\n effect(() => this.value.set(this.direction() === 'down' ? this.from() : this.to()));\n return;\n }\n\n // Seed the resting value so first paint shows the start, not 0.\n effect(() => {\n const initial = this.direction() === 'down' ? this.to() : this.from();\n this.value.set(initial);\n });\n\n // Run the animation whenever the `to` target changes (or on first mount).\n // For `trigger=\"visible\"` the first run waits for the IntersectionObserver\n // to fire; subsequent `to` changes re-run immediately.\n effect(() => {\n // Establish dependencies so the effect re-runs on `to` changes.\n this.to();\n this.from();\n this.direction();\n this.duration();\n this.easing();\n this.delay();\n\n if (this.trigger() === 'visible' && !this.hasFiredForVisible) return;\n this.scheduleRun();\n });\n\n afterNextRender(() => {\n if (this.trigger() === 'visible') this.setupViewportTrigger();\n });\n\n this.destroyRef.onDestroy(() => {\n this.cancel();\n // `cancel()` only stops timers and the rAF loop. The IntersectionObserver\n // disconnects itself from inside its callback, which never fires if the\n // host is destroyed before it ever scrolls into view — so it would keep\n // observing a detached element for the life of the page.\n this.observer?.disconnect();\n this.observer = null;\n });\n }\n\n // Scheduling\n\n private setupViewportTrigger(): void {\n this.observer = new IntersectionObserver(\n (entries, obs) => {\n for (const e of entries) {\n if (e.isIntersecting && !this.hasFiredForVisible) {\n obs.disconnect();\n this.hasFiredForVisible = true;\n this.scheduleRun();\n break;\n }\n }\n },\n { threshold: 0, rootMargin: '0px' }\n );\n this.observer.observe(this.host.nativeElement);\n }\n\n private scheduleRun(): void {\n this.cancel();\n const d = this.delay();\n if (d > 0) {\n this.delayTimer = setTimeout(() => this.run(), d);\n } else {\n this.run();\n }\n }\n\n private run(): void {\n const start = this.direction() === 'down' ? this.to() : this.from();\n const end = this.direction() === 'down' ? this.from() : this.to();\n this.started.emit();\n if (this.easing() === 'spring') this.tweenSpring(start, end);\n else this.tweenEaseOut(start, end);\n }\n\n // Tweens\n\n private tweenEaseOut(start: number, target: number): void {\n const duration = Math.max(100, this.duration());\n const startTs = performance.now();\n const tick = (now: number): void => {\n const t = Math.min(1, (now - startTs) / duration);\n const v = start + (target - start) * easeOutCubic(t);\n this.value.set(v);\n if (t < 1) {\n this.rafId = requestAnimationFrame(tick);\n } else {\n this.completed.emit();\n }\n };\n this.rafId = requestAnimationFrame(tick);\n }\n\n /**\n * Critically-damped spring tween. Same formula as `motion/react`'s\n * `useSpring` with mass = 1:\n *\n * damping = 20 + 40 / duration\n * stiffness = 100 / duration\n *\n * We integrate `(spring force − damping force)` each frame until both\n * displacement and velocity fall below epsilon.\n */\n private tweenSpring(start: number, target: number): void {\n const duration = Math.max(0.05, this.duration());\n const damping = 20 + 40 / duration;\n const stiffness = 100 / duration;\n let current = start;\n let velocity = 0;\n let lastTs = 0;\n const epsilon = 0.001 * Math.max(1, Math.abs(target - start));\n\n const step = (ts: number): void => {\n const dt = lastTs === 0 ? 1 / 60 : Math.min(0.05, (ts - lastTs) / 1000);\n lastTs = ts;\n\n const displacement = current - target;\n const accel = -stiffness * displacement - damping * velocity;\n velocity += accel * dt;\n current += velocity * dt;\n this.value.set(current);\n\n if (Math.abs(current - target) < epsilon && Math.abs(velocity) < epsilon * 10) {\n this.value.set(target);\n this.completed.emit();\n return;\n }\n this.rafId = requestAnimationFrame(step);\n };\n this.rafId = requestAnimationFrame(step);\n }\n\n // Cleanup\n\n private cancel(): void {\n if (this.rafId !== null) cancelAnimationFrame(this.rafId);\n this.rafId = null;\n if (this.delayTimer !== undefined) {\n clearTimeout(this.delayTimer);\n this.delayTimer = undefined;\n }\n }\n}\n\nexport type { WrCountUpEasing, WrCountUpTrigger, WrCountUpDirection } from './interfaces';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAAA;AACM,SAAU,YAAY,CAAC,CAAS,EAAA;AACpC,IAAA,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAC/B;;ACHA;;;;;AAKG;AAwBH;;;;;;;;;;;;;;;;;;AAkBG;MAOU,SAAS,CAAA;;IAEX,KAAK,GAAG,KAAK,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C1C,QAAA,CAAC;AACD,QAAA,IAAI,CAAC,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC;IAC1C;;IAIQ,MAAM,GAAA;AACZ,QAAA,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI;AAAE,YAAA,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC;AACzD,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI;AACjB,QAAA,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE;AACjC,YAAA,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC;AAC7B,YAAA,IAAI,CAAC,UAAU,GAAG,SAAS;QAC7B;IACF;uGA7NW,SAAS,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAT,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,SAAS,sgDAJV,CAAA,6CAAA,CAA+C,EAAA,QAAA,EAAA,IAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FAI9C,SAAS,EAAA,UAAA,EAAA,CAAA;kBANrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,CAAA,6CAAA,CAA+C;oBACzD,aAAa,EAAE,iBAAiB,CAAC,IAAI;AACrC,oBAAA,IAAI,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE;AAC/B,iBAAA;;;AC9DD;;AAEG;;;;"}
|
|
@@ -6,9 +6,9 @@ import { input, inject, model, output, signal, computed, effect, untracked, View
|
|
|
6
6
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
7
7
|
import { WrCalendar } from 'ngwr/calendar';
|
|
8
8
|
import { WrDateAdapter, WR_DATE_LOCALE } from 'ngwr/date-adapter';
|
|
9
|
-
import { readI18nText } from 'ngwr/i18n';
|
|
9
|
+
import { readI18nText, useI18nText } from 'ngwr/i18n';
|
|
10
10
|
import { WrInput, WrInputGroup, WrInputSuffix } from 'ngwr/input';
|
|
11
|
-
import { WR_OVERLAY } from 'ngwr/overlay';
|
|
11
|
+
import { WR_OVERLAY, WrOutsideClick } from 'ngwr/overlay';
|
|
12
12
|
import * as i1 from '@angular/forms';
|
|
13
13
|
import { FormsModule } from '@angular/forms';
|
|
14
14
|
import { clamp } from 'ngwr/utils';
|
|
@@ -301,7 +301,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
301
301
|
* accepts both named keys (`'shortDate'`, `'mediumDateTime'`, …) and raw
|
|
302
302
|
* token strings (`'dd.MM.yyyy'`, `'HH:mm'`). When `format` is left at the
|
|
303
303
|
* default (`null`), the picker derives the right named key from `mode`:
|
|
304
|
-
* `'date'`
|
|
304
|
+
* `'date'` gives `'shortDate'`, `'time'` gives `'time'`, `'datetime'` gives
|
|
305
305
|
* `'shortDateTime'`.
|
|
306
306
|
*
|
|
307
307
|
* @example
|
|
@@ -327,8 +327,8 @@ class WrDatePicker {
|
|
|
327
327
|
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
328
328
|
/**
|
|
329
329
|
* Format used for both display and parsing. When `null` (default), the
|
|
330
|
-
* format is derived from `mode` (`shortDate` / `
|
|
331
|
-
*
|
|
330
|
+
* format is derived from `mode` (`shortDate` / `time` / `shortDateTime`).
|
|
331
|
+
* Pass a named key or raw token string to override.
|
|
332
332
|
*/
|
|
333
333
|
format = input(null, /* @ts-ignore */
|
|
334
334
|
...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
|
|
@@ -366,6 +366,7 @@ class WrDatePicker {
|
|
|
366
366
|
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
367
367
|
adapter = inject(WrDateAdapter);
|
|
368
368
|
overlay = inject(WR_OVERLAY);
|
|
369
|
+
outsideClick = inject(WrOutsideClick);
|
|
369
370
|
scrollStrategies = inject(ScrollStrategyOptions);
|
|
370
371
|
host = inject(ElementRef);
|
|
371
372
|
destroyRef = inject(DestroyRef);
|
|
@@ -390,8 +391,11 @@ class WrDatePicker {
|
|
|
390
391
|
const m = this.mode();
|
|
391
392
|
if (m === 'datetime')
|
|
392
393
|
return 'shortDateTime';
|
|
394
|
+
// `time`, not `shortTime` — the latter is not a member of WrDateFormat, so
|
|
395
|
+
// adapters fell through to treating it as a raw token pattern. date-fns then
|
|
396
|
+
// threw on the unescaped letters; the native adapter degraded silently.
|
|
393
397
|
if (m === 'time')
|
|
394
|
-
return '
|
|
398
|
+
return 'time';
|
|
395
399
|
return 'shortDate';
|
|
396
400
|
}, /* @ts-ignore */
|
|
397
401
|
...(ngDevMode ? [{ debugName: "resolvedFormat" }] : /* istanbul ignore next */ []));
|
|
@@ -404,6 +408,23 @@ class WrDatePicker {
|
|
|
404
408
|
labelDate = readI18nText('datePicker.open', 'Open calendar');
|
|
405
409
|
labelTime = readI18nText('datePicker.openTime', 'Open time picker');
|
|
406
410
|
labelDateTime = readI18nText('datePicker.openDateTime', 'Open date and time picker');
|
|
411
|
+
/**
|
|
412
|
+
* Accessible name of the text field. Falls back to the placeholder, then to
|
|
413
|
+
* the same catalog string the calendar button uses — the field is a
|
|
414
|
+
* `role="combobox"`, and with an empty placeholder it had no name at all.
|
|
415
|
+
*/
|
|
416
|
+
ariaLabel = input(null, /* @ts-ignore */
|
|
417
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
418
|
+
fieldLabel = useI18nText(this.ariaLabel, 'datePicker.open', 'Open calendar');
|
|
419
|
+
resolvedAriaLabel = computed(() => {
|
|
420
|
+
// Not `??`: an empty placeholder must fall through to the catalog string.
|
|
421
|
+
const explicit = this.ariaLabel();
|
|
422
|
+
if (explicit)
|
|
423
|
+
return explicit;
|
|
424
|
+
const placeholder = this.placeholder();
|
|
425
|
+
return placeholder ? placeholder : this.fieldLabel();
|
|
426
|
+
}, /* @ts-ignore */
|
|
427
|
+
...(ngDevMode ? [{ debugName: "resolvedAriaLabel" }] : /* istanbul ignore next */ []));
|
|
407
428
|
triggerLabel = computed(() => {
|
|
408
429
|
const m = this.mode();
|
|
409
430
|
if (m === 'time')
|
|
@@ -522,8 +543,8 @@ class WrDatePicker {
|
|
|
522
543
|
this.attachDateTime();
|
|
523
544
|
else
|
|
524
545
|
this.attachDate();
|
|
525
|
-
this.
|
|
526
|
-
.outsidePointerEvents()
|
|
546
|
+
this.outsideClick
|
|
547
|
+
.outsidePointerEvents(this.overlayRef)
|
|
527
548
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
528
549
|
.subscribe(event => {
|
|
529
550
|
if (this.host.nativeElement.contains(event.target))
|
|
@@ -628,12 +649,12 @@ class WrDatePicker {
|
|
|
628
649
|
return a.getTime() === b.getTime();
|
|
629
650
|
}
|
|
630
651
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: WrDatePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
631
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: WrDatePicker, isStandalone: true, selector: "wr-date-picker", inputs: { mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", 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 }, timeFormat: { classPropertyName: "timeFormat", publicName: "timeFormat", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", touch: "touch" }, host: { properties: { "class": "classes()" } }, viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["input"], descendants: true, isSignal: true }], ngImport: i0, template: "<wr-input-group>\n <input\n #input\n wrInput\n type=\"text\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n [attr.aria-
|
|
652
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: WrDatePicker, isStandalone: true, selector: "wr-date-picker", inputs: { mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", 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 }, timeFormat: { classPropertyName: "timeFormat", publicName: "timeFormat", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", touch: "touch" }, host: { properties: { "class": "classes()" } }, viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["input"], descendants: true, isSignal: true }], ngImport: i0, template: "<wr-input-group>\n <!--\n A plain textbox, per the APG date-picker-dialog pattern: `aria-haspopup` and\n `aria-expanded` are not permitted on `textbox` and belong to the trigger\n button below, which is the thing that opens the dialog.\n -->\n <input\n #input\n wrInput\n type=\"text\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [value]=\"text()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (click)=\"openOnInput()\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n />\n <button\n type=\"button\"\n wrInputSuffix\n class=\"wr-date-picker__trigger\"\n [attr.aria-label]=\"triggerLabel()\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-expanded]=\"overlayOpen()\"\n [disabled]=\"disabled()\"\n (click)=\"toggleOverlay()\"\n >\n @if (isTime()) {\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" aria-hidden=\"true\">\n <circle cx=\"7\" cy=\"7\" r=\"5.75\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.2\" />\n <line x1=\"7\" y1=\"7\" x2=\"7\" y2=\"3.75\" stroke=\"currentColor\" stroke-width=\"1.4\" stroke-linecap=\"round\" />\n <line x1=\"7\" y1=\"7\" x2=\"9.5\" y2=\"7\" stroke=\"currentColor\" stroke-width=\"1.4\" stroke-linecap=\"round\" />\n </svg>\n } @else {\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" aria-hidden=\"true\">\n <rect x=\"1.5\" y=\"2.5\" width=\"11\" height=\"10\" rx=\"1.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.2\" />\n <line x1=\"1.5\" y1=\"5.5\" x2=\"12.5\" y2=\"5.5\" stroke=\"currentColor\" stroke-width=\"1.2\" />\n <line x1=\"4\" y1=\"1\" x2=\"4\" y2=\"4\" stroke=\"currentColor\" stroke-width=\"1.4\" stroke-linecap=\"round\" />\n <line x1=\"10\" y1=\"1\" x2=\"10\" y2=\"4\" stroke=\"currentColor\" stroke-width=\"1.4\" stroke-linecap=\"round\" />\n @if (isDateTime()) {\n <circle cx=\"7\" cy=\"9\" r=\"1.5\" fill=\"currentColor\" />\n }\n </svg>\n }\n </button>\n</wr-input-group>\n", dependencies: [{ kind: "directive", type: WrInput, selector: "input[wrInput], textarea[wrInput]", inputs: ["wrSize", "rounded"] }, { kind: "component", type: WrInputGroup, selector: "wr-input-group", inputs: ["rounded"] }, { kind: "directive", type: WrInputSuffix, selector: "[wrInputSuffix]" }], encapsulation: i0.ViewEncapsulation.None });
|
|
632
653
|
}
|
|
633
654
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: WrDatePicker, decorators: [{
|
|
634
655
|
type: Component,
|
|
635
|
-
args: [{ selector: 'wr-date-picker', encapsulation: ViewEncapsulation.None, host: { '[class]': 'classes()' }, imports: [WrInput, WrInputGroup, WrInputSuffix], template: "<wr-input-group>\n <input\n #input\n wrInput\n type=\"text\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n [attr.aria-
|
|
636
|
-
}], ctorParameters: () => [], propDecorators: { mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], 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 }] }], timeFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeFormat", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], inputEl: [{ type: i0.ViewChild, args: ['input', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], touch: [{ type: i0.Output, args: ["touch"] }] } });
|
|
656
|
+
args: [{ selector: 'wr-date-picker', encapsulation: ViewEncapsulation.None, host: { '[class]': 'classes()' }, imports: [WrInput, WrInputGroup, WrInputSuffix], template: "<wr-input-group>\n <!--\n A plain textbox, per the APG date-picker-dialog pattern: `aria-haspopup` and\n `aria-expanded` are not permitted on `textbox` and belong to the trigger\n button below, which is the thing that opens the dialog.\n -->\n <input\n #input\n wrInput\n type=\"text\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [value]=\"text()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (click)=\"openOnInput()\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n />\n <button\n type=\"button\"\n wrInputSuffix\n class=\"wr-date-picker__trigger\"\n [attr.aria-label]=\"triggerLabel()\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-expanded]=\"overlayOpen()\"\n [disabled]=\"disabled()\"\n (click)=\"toggleOverlay()\"\n >\n @if (isTime()) {\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" aria-hidden=\"true\">\n <circle cx=\"7\" cy=\"7\" r=\"5.75\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.2\" />\n <line x1=\"7\" y1=\"7\" x2=\"7\" y2=\"3.75\" stroke=\"currentColor\" stroke-width=\"1.4\" stroke-linecap=\"round\" />\n <line x1=\"7\" y1=\"7\" x2=\"9.5\" y2=\"7\" stroke=\"currentColor\" stroke-width=\"1.4\" stroke-linecap=\"round\" />\n </svg>\n } @else {\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" aria-hidden=\"true\">\n <rect x=\"1.5\" y=\"2.5\" width=\"11\" height=\"10\" rx=\"1.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.2\" />\n <line x1=\"1.5\" y1=\"5.5\" x2=\"12.5\" y2=\"5.5\" stroke=\"currentColor\" stroke-width=\"1.2\" />\n <line x1=\"4\" y1=\"1\" x2=\"4\" y2=\"4\" stroke=\"currentColor\" stroke-width=\"1.4\" stroke-linecap=\"round\" />\n <line x1=\"10\" y1=\"1\" x2=\"10\" y2=\"4\" stroke=\"currentColor\" stroke-width=\"1.4\" stroke-linecap=\"round\" />\n @if (isDateTime()) {\n <circle cx=\"7\" cy=\"9\" r=\"1.5\" fill=\"currentColor\" />\n }\n </svg>\n }\n </button>\n</wr-input-group>\n" }]
|
|
657
|
+
}], ctorParameters: () => [], propDecorators: { mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], 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 }] }], timeFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeFormat", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], inputEl: [{ type: i0.ViewChild, args: ['input', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], touch: [{ type: i0.Output, args: ["touch"] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
637
658
|
|
|
638
659
|
/**
|
|
639
660
|
* @license
|
|
@@ -844,6 +865,7 @@ class WrDateRangePicker {
|
|
|
844
865
|
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
845
866
|
adapter = inject(WrDateAdapter);
|
|
846
867
|
overlay = inject(WR_OVERLAY);
|
|
868
|
+
outsideClick = inject(WrOutsideClick);
|
|
847
869
|
scrollStrategies = inject(ScrollStrategyOptions);
|
|
848
870
|
host = inject(ElementRef);
|
|
849
871
|
destroyRef = inject(DestroyRef);
|
|
@@ -1004,8 +1026,8 @@ class WrDateRangePicker {
|
|
|
1004
1026
|
if (!this.isDateTime() && committed[0] && committed[1])
|
|
1005
1027
|
this.closeOverlay();
|
|
1006
1028
|
});
|
|
1007
|
-
this.
|
|
1008
|
-
.outsidePointerEvents()
|
|
1029
|
+
this.outsideClick
|
|
1030
|
+
.outsidePointerEvents(this.overlayRef)
|
|
1009
1031
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
1010
1032
|
.subscribe(event => {
|
|
1011
1033
|
if (this.host.nativeElement.contains(event.target))
|
|
@@ -1136,11 +1158,11 @@ class WrDateRangePicker {
|
|
|
1136
1158
|
return this.sameDate(a[0], b[0]) && this.sameDate(a[1], b[1]);
|
|
1137
1159
|
}
|
|
1138
1160
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: WrDateRangePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1139
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: WrDateRangePicker, isStandalone: true, selector: "wr-date-range-picker", inputs: { mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, startPlaceholder: { classPropertyName: "startPlaceholder", publicName: "startPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, endPlaceholder: { classPropertyName: "endPlaceholder", publicName: "endPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, separator: { classPropertyName: "separator", publicName: "separator", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, timeFormat: { classPropertyName: "timeFormat", publicName: "timeFormat", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", touch: "touch" }, host: { properties: { "class": "classes()" } }, viewQueries: [{ propertyName: "startEl", first: true, predicate: ["startInput"], descendants: true, isSignal: true }], ngImport: i0, template: "<wr-input-group>\n <input\n #startInput\n wrInput\n type=\"text\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n class=\"wr-date-range-picker__input\"\n [attr.aria-label]=\"startLabel\"\n [
|
|
1161
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: WrDateRangePicker, isStandalone: true, selector: "wr-date-range-picker", inputs: { mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, startPlaceholder: { classPropertyName: "startPlaceholder", publicName: "startPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, endPlaceholder: { classPropertyName: "endPlaceholder", publicName: "endPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, separator: { classPropertyName: "separator", publicName: "separator", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, timeFormat: { classPropertyName: "timeFormat", publicName: "timeFormat", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", touch: "touch" }, host: { properties: { "class": "classes()" } }, viewQueries: [{ propertyName: "startEl", first: true, predicate: ["startInput"], descendants: true, isSignal: true }], ngImport: i0, template: "<wr-input-group>\n <input\n #startInput\n wrInput\n type=\"text\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n class=\"wr-date-range-picker__input\"\n [attr.aria-label]=\"startLabel\"\n [value]=\"startText()\"\n [placeholder]=\"startPlaceholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (click)=\"openOnInput()\"\n (input)=\"onStartInput($event)\"\n (blur)=\"onBlur($event)\"\n />\n <span class=\"wr-date-range-picker__separator\" aria-hidden=\"true\">{{ separator() }}</span>\n <input\n wrInput\n type=\"text\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n class=\"wr-date-range-picker__input\"\n [attr.aria-label]=\"endLabel\"\n [value]=\"endText()\"\n [placeholder]=\"endPlaceholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (click)=\"openOnInput()\"\n (input)=\"onEndInput($event)\"\n (blur)=\"onBlur($event)\"\n />\n <button\n type=\"button\"\n wrInputSuffix\n class=\"wr-date-picker__trigger\"\n [attr.aria-label]=\"triggerLabel\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-expanded]=\"overlayOpen()\"\n [disabled]=\"disabled()\"\n (click)=\"toggleOverlay()\"\n >\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" aria-hidden=\"true\">\n <rect x=\"1.5\" y=\"2.5\" width=\"11\" height=\"10\" rx=\"1.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.2\" />\n <line x1=\"1.5\" y1=\"5.5\" x2=\"12.5\" y2=\"5.5\" stroke=\"currentColor\" stroke-width=\"1.2\" />\n <line x1=\"4\" y1=\"1\" x2=\"4\" y2=\"4\" stroke=\"currentColor\" stroke-width=\"1.4\" stroke-linecap=\"round\" />\n <line x1=\"10\" y1=\"1\" x2=\"10\" y2=\"4\" stroke=\"currentColor\" stroke-width=\"1.4\" stroke-linecap=\"round\" />\n @if (isDateTime()) {\n <circle cx=\"7\" cy=\"9\" r=\"1.5\" fill=\"currentColor\" />\n }\n </svg>\n </button>\n</wr-input-group>\n", dependencies: [{ kind: "directive", type: WrInput, selector: "input[wrInput], textarea[wrInput]", inputs: ["wrSize", "rounded"] }, { kind: "component", type: WrInputGroup, selector: "wr-input-group", inputs: ["rounded"] }, { kind: "directive", type: WrInputSuffix, selector: "[wrInputSuffix]" }], encapsulation: i0.ViewEncapsulation.None });
|
|
1140
1162
|
}
|
|
1141
1163
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: WrDateRangePicker, decorators: [{
|
|
1142
1164
|
type: Component,
|
|
1143
|
-
args: [{ selector: 'wr-date-range-picker', encapsulation: ViewEncapsulation.None, host: { '[class]': 'classes()' }, imports: [WrInput, WrInputGroup, WrInputSuffix], template: "<wr-input-group>\n <input\n #startInput\n wrInput\n type=\"text\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n class=\"wr-date-range-picker__input\"\n [attr.aria-label]=\"startLabel\"\n [
|
|
1165
|
+
args: [{ selector: 'wr-date-range-picker', encapsulation: ViewEncapsulation.None, host: { '[class]': 'classes()' }, imports: [WrInput, WrInputGroup, WrInputSuffix], template: "<wr-input-group>\n <input\n #startInput\n wrInput\n type=\"text\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n class=\"wr-date-range-picker__input\"\n [attr.aria-label]=\"startLabel\"\n [value]=\"startText()\"\n [placeholder]=\"startPlaceholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (click)=\"openOnInput()\"\n (input)=\"onStartInput($event)\"\n (blur)=\"onBlur($event)\"\n />\n <span class=\"wr-date-range-picker__separator\" aria-hidden=\"true\">{{ separator() }}</span>\n <input\n wrInput\n type=\"text\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n class=\"wr-date-range-picker__input\"\n [attr.aria-label]=\"endLabel\"\n [value]=\"endText()\"\n [placeholder]=\"endPlaceholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (click)=\"openOnInput()\"\n (input)=\"onEndInput($event)\"\n (blur)=\"onBlur($event)\"\n />\n <button\n type=\"button\"\n wrInputSuffix\n class=\"wr-date-picker__trigger\"\n [attr.aria-label]=\"triggerLabel\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-expanded]=\"overlayOpen()\"\n [disabled]=\"disabled()\"\n (click)=\"toggleOverlay()\"\n >\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" aria-hidden=\"true\">\n <rect x=\"1.5\" y=\"2.5\" width=\"11\" height=\"10\" rx=\"1.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.2\" />\n <line x1=\"1.5\" y1=\"5.5\" x2=\"12.5\" y2=\"5.5\" stroke=\"currentColor\" stroke-width=\"1.2\" />\n <line x1=\"4\" y1=\"1\" x2=\"4\" y2=\"4\" stroke=\"currentColor\" stroke-width=\"1.4\" stroke-linecap=\"round\" />\n <line x1=\"10\" y1=\"1\" x2=\"10\" y2=\"4\" stroke=\"currentColor\" stroke-width=\"1.4\" stroke-linecap=\"round\" />\n @if (isDateTime()) {\n <circle cx=\"7\" cy=\"9\" r=\"1.5\" fill=\"currentColor\" />\n }\n </svg>\n </button>\n</wr-input-group>\n" }]
|
|
1144
1166
|
}], ctorParameters: () => [], propDecorators: { mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], startPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "startPlaceholder", required: false }] }], endPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "endPlaceholder", required: false }] }], separator: [{ type: i0.Input, args: [{ isSignal: true, alias: "separator", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], dateFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFilter", required: false }] }], timeFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeFormat", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], startEl: [{ type: i0.ViewChild, args: ['startInput', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], touch: [{ type: i0.Output, args: ["touch"] }] } });
|
|
1145
1167
|
|
|
1146
1168
|
/**
|