ngwr 16.2.0 → 16.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/badge/styles/_tag.scss +73 -1
- package/calendar/styles/_index.scss +22 -0
- package/cascader/styles/_rules.scss +7 -0
- package/color-picker/styles/_index.scss +21 -0
- package/date-picker/styles/_index.scss +19 -0
- package/dropdown/styles/_index.scss +13 -19
- package/fesm2022/ngwr-affix.mjs +3 -3
- package/fesm2022/ngwr-alert-testing.mjs +70 -0
- package/fesm2022/ngwr-alert-testing.mjs.map +1 -0
- package/fesm2022/ngwr-alert.mjs +3 -3
- package/fesm2022/ngwr-anchor.mjs +17 -6
- package/fesm2022/ngwr-anchor.mjs.map +1 -1
- package/fesm2022/ngwr-animations-aurora.mjs +3 -3
- package/fesm2022/ngwr-animations-blur-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-click-sparks.mjs +3 -3
- package/fesm2022/ngwr-animations-confetti.mjs +3 -3
- package/fesm2022/ngwr-animations-decode.mjs +3 -3
- package/fesm2022/ngwr-animations-destruct.mjs +3 -3
- package/fesm2022/ngwr-animations-dot-grid.mjs +3 -3
- package/fesm2022/ngwr-animations-falling-letters.mjs +3 -3
- package/fesm2022/ngwr-animations-flow-lines.mjs +3 -3
- package/fesm2022/ngwr-animations-fluid-cursor.mjs +3 -3
- package/fesm2022/ngwr-animations-glitch.mjs +3 -3
- package/fesm2022/ngwr-animations-glow-border.mjs +3 -3
- package/fesm2022/ngwr-animations-gradient-flow.mjs +3 -3
- package/fesm2022/ngwr-animations-marquee.mjs +3 -3
- package/fesm2022/ngwr-animations-orbit.mjs +3 -3
- package/fesm2022/ngwr-animations-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-ripple-grid.mjs +3 -3
- package/fesm2022/ngwr-animations-rotate-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-shimmer.mjs +3 -3
- package/fesm2022/ngwr-animations-spotlight.mjs +3 -3
- package/fesm2022/ngwr-animations-thread-lines.mjs +3 -3
- package/fesm2022/ngwr-animations-tilt.mjs +3 -3
- package/fesm2022/ngwr-animations-typewriter.mjs +3 -3
- package/fesm2022/ngwr-avatar.mjs +3 -3
- package/fesm2022/ngwr-back-top.mjs +3 -3
- package/fesm2022/ngwr-badge.mjs +129 -11
- package/fesm2022/ngwr-badge.mjs.map +1 -1
- package/fesm2022/ngwr-breadcrumbs-testing.mjs +83 -0
- package/fesm2022/ngwr-breadcrumbs-testing.mjs.map +1 -0
- package/fesm2022/ngwr-breadcrumbs.mjs +8 -8
- package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ngwr-burger-testing.mjs +45 -0
- package/fesm2022/ngwr-burger-testing.mjs.map +1 -0
- package/fesm2022/ngwr-burger.mjs +3 -3
- package/fesm2022/ngwr-button.mjs +6 -6
- package/fesm2022/ngwr-calendar-testing.mjs +18 -0
- package/fesm2022/ngwr-calendar-testing.mjs.map +1 -1
- package/fesm2022/ngwr-calendar.mjs +500 -73
- package/fesm2022/ngwr-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-card.mjs +9 -9
- package/fesm2022/ngwr-carousel.mjs +6 -6
- package/fesm2022/ngwr-cascader.mjs +37 -16
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-charts-bar-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-boxplot-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-bullet-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs +3 -3
- package/fesm2022/ngwr-charts-candlestick-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-chart-legend.mjs +26 -11
- package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
- package/fesm2022/ngwr-charts-core.mjs +3 -3
- package/fesm2022/ngwr-charts-donut-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-funnel-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-gauge.mjs +3 -3
- package/fesm2022/ngwr-charts-heatmap-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-line-chart-testing.mjs +3 -2
- package/fesm2022/ngwr-charts-line-chart-testing.mjs.map +1 -1
- package/fesm2022/ngwr-charts-line-chart.mjs +17 -7
- package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-meter-group.mjs +5 -4
- package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
- package/fesm2022/ngwr-charts-radar-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-scatter-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-sparkline.mjs +3 -3
- package/fesm2022/ngwr-charts-treemap-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-waterfall-chart.mjs +3 -3
- package/fesm2022/ngwr-checkbox.mjs +6 -6
- package/fesm2022/ngwr-clipboard.mjs +3 -3
- package/fesm2022/ngwr-collapse.mjs +9 -9
- package/fesm2022/ngwr-color-picker-testing.mjs +11 -1
- package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +153 -37
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-command-palette.mjs +3 -3
- package/fesm2022/ngwr-comment.mjs +10 -6
- package/fesm2022/ngwr-comment.mjs.map +1 -1
- package/fesm2022/ngwr-compare-testing.mjs +84 -0
- package/fesm2022/ngwr-compare-testing.mjs.map +1 -0
- package/fesm2022/ngwr-compare.mjs +3 -3
- package/fesm2022/ngwr-context-menu.mjs +12 -12
- package/fesm2022/ngwr-cookie.mjs +3 -3
- package/fesm2022/ngwr-copy-value.mjs +3 -3
- package/fesm2022/ngwr-counter.mjs +6 -6
- package/fesm2022/ngwr-date-picker-testing.mjs +30 -4
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +342 -69
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-date-stamp.mjs +3 -3
- package/fesm2022/ngwr-date.mjs +59 -8
- package/fesm2022/ngwr-date.mjs.map +1 -1
- package/fesm2022/ngwr-density.mjs +6 -6
- package/fesm2022/ngwr-descriptions.mjs +6 -6
- package/fesm2022/ngwr-dialog.mjs +18 -18
- package/fesm2022/ngwr-directives.mjs +15 -15
- package/fesm2022/ngwr-divider.mjs +3 -3
- package/fesm2022/ngwr-drawer.mjs +51 -29
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown-testing.mjs +11 -3
- package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +52 -95
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-editor.mjs +4 -3
- package/fesm2022/ngwr-editor.mjs.map +1 -1
- package/fesm2022/ngwr-empty.mjs +3 -3
- package/fesm2022/ngwr-event-calendar.mjs +186 -33
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload-testing.mjs +34 -2
- package/fesm2022/ngwr-file-upload-testing.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +274 -15
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-form.mjs +9 -9
- package/fesm2022/ngwr-form.mjs.map +1 -1
- package/fesm2022/ngwr-graph-testing.mjs +3 -0
- package/fesm2022/ngwr-graph-testing.mjs.map +1 -1
- package/fesm2022/ngwr-graph.mjs +102 -42
- package/fesm2022/ngwr-graph.mjs.map +1 -1
- package/fesm2022/ngwr-hotkey.mjs +6 -6
- package/fesm2022/ngwr-i18n-ar.mjs +19 -4
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +19 -4
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +19 -4
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +19 -4
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +19 -4
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +19 -4
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +19 -4
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +19 -4
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +19 -4
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +19 -4
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +19 -4
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +19 -4
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +19 -4
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +19 -4
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +19 -4
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +19 -4
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +19 -4
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +19 -4
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +19 -4
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +19 -4
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +19 -4
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +19 -4
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +9 -9
- package/fesm2022/ngwr-icon.mjs +6 -6
- package/fesm2022/ngwr-image-cropper.mjs +3 -3
- package/fesm2022/ngwr-input-number-testing.mjs +11 -0
- package/fesm2022/ngwr-input-number-testing.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +68 -7
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +23 -3
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input-testing.mjs +24 -1
- package/fesm2022/ngwr-input-testing.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +152 -36
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-keyboard.mjs +3 -3
- package/fesm2022/ngwr-knob.mjs +3 -3
- package/fesm2022/ngwr-layout.mjs +15 -15
- package/fesm2022/ngwr-lightbox.mjs +8 -8
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-list.mjs +8 -8
- package/fesm2022/ngwr-list.mjs.map +1 -1
- package/fesm2022/ngwr-load-state.mjs +15 -15
- package/fesm2022/ngwr-loading-bar.mjs +6 -6
- package/fesm2022/ngwr-mention.mjs +6 -6
- package/fesm2022/ngwr-meta.mjs +6 -6
- package/fesm2022/ngwr-overlay.mjs +175 -13
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-page-header.mjs +3 -3
- package/fesm2022/ngwr-pagination.mjs +5 -3
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +31 -29
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-platform.mjs +9 -9
- package/fesm2022/ngwr-popconfirm-testing.mjs +5 -2
- package/fesm2022/ngwr-popconfirm-testing.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +44 -63
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-popover-testing.mjs +7 -1
- package/fesm2022/ngwr-popover-testing.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +58 -156
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-progress.mjs +50 -9
- package/fesm2022/ngwr-progress.mjs.map +1 -1
- package/fesm2022/ngwr-pull-to-refresh-testing.mjs +57 -0
- package/fesm2022/ngwr-pull-to-refresh-testing.mjs.map +1 -0
- package/fesm2022/ngwr-pull-to-refresh.mjs +3 -3
- package/fesm2022/ngwr-qr.mjs +3 -3
- package/fesm2022/ngwr-radio.mjs +6 -6
- package/fesm2022/ngwr-rating.mjs +3 -3
- package/fesm2022/ngwr-resizable-testing.mjs +113 -0
- package/fesm2022/ngwr-resizable-testing.mjs.map +1 -0
- package/fesm2022/ngwr-resizable.mjs +3 -3
- package/fesm2022/ngwr-result.mjs +12 -12
- package/fesm2022/ngwr-schema-form-testing.mjs +336 -0
- package/fesm2022/ngwr-schema-form-testing.mjs.map +1 -0
- package/fesm2022/ngwr-schema-form.mjs +415 -19
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-scroll.mjs +3 -3
- package/fesm2022/ngwr-segmented.mjs +3 -3
- package/fesm2022/ngwr-select-testing.mjs +19 -0
- package/fesm2022/ngwr-select-testing.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +263 -83
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-sidebar-testing.mjs +176 -0
- package/fesm2022/ngwr-sidebar-testing.mjs.map +1 -0
- package/fesm2022/ngwr-sidebar.mjs +3 -3
- package/fesm2022/ngwr-skeleton.mjs +3 -3
- package/fesm2022/ngwr-slider-testing.mjs +6 -0
- package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +21 -3
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-sortable-list.mjs +29 -12
- package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
- package/fesm2022/ngwr-speed-dial.mjs +3 -3
- package/fesm2022/ngwr-spinner.mjs +3 -3
- package/fesm2022/ngwr-splitter.mjs +3 -3
- package/fesm2022/ngwr-statistic.mjs +9 -9
- package/fesm2022/ngwr-stepper.mjs +42 -11
- package/fesm2022/ngwr-stepper.mjs.map +1 -1
- package/fesm2022/ngwr-storage.mjs +3 -3
- package/fesm2022/ngwr-switch.mjs +3 -3
- package/fesm2022/ngwr-table-testing.mjs +88 -2
- package/fesm2022/ngwr-table-testing.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +891 -74
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs-router.mjs +3 -3
- package/fesm2022/ngwr-tabs-testing.mjs +1 -1
- package/fesm2022/ngwr-tabs-testing.mjs.map +1 -1
- package/fesm2022/ngwr-tabs.mjs +15 -10
- package/fesm2022/ngwr-tabs.mjs.map +1 -1
- package/fesm2022/ngwr-textarea-testing.mjs +11 -0
- package/fesm2022/ngwr-textarea-testing.mjs.map +1 -1
- package/fesm2022/ngwr-textarea.mjs +128 -16
- package/fesm2022/ngwr-textarea.mjs.map +1 -1
- package/fesm2022/ngwr-theme.mjs +3 -3
- package/fesm2022/ngwr-timeline.mjs +6 -6
- package/fesm2022/ngwr-toast.mjs +40 -19
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-toolbar.mjs +3 -3
- package/fesm2022/ngwr-tour.mjs +6 -6
- package/fesm2022/ngwr-transfer-testing.mjs +6 -0
- package/fesm2022/ngwr-transfer-testing.mjs.map +1 -1
- package/fesm2022/ngwr-transfer.mjs +24 -5
- package/fesm2022/ngwr-transfer.mjs.map +1 -1
- package/fesm2022/ngwr-tree-testing.mjs +62 -2
- package/fesm2022/ngwr-tree-testing.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +966 -78
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-typography.mjs +3 -3
- package/fesm2022/ngwr-utils-router.mjs +3 -3
- package/fesm2022/ngwr-utils.mjs +34 -1
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-virtual-scroll.mjs +3 -3
- package/fesm2022/ngwr-window.mjs +33 -22
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/file-upload/styles/_index.scss +156 -0
- package/i18n/ar.json +21 -4
- package/i18n/cs.json +21 -4
- package/i18n/de.json +21 -4
- package/i18n/en.json +21 -4
- package/i18n/es.json +21 -4
- package/i18n/fr.json +21 -4
- package/i18n/he.json +21 -4
- package/i18n/hi.json +21 -4
- package/i18n/id.json +21 -4
- package/i18n/it.json +21 -4
- package/i18n/ja.json +21 -4
- package/i18n/ko.json +21 -4
- package/i18n/nl.json +21 -4
- package/i18n/pl.json +21 -4
- package/i18n/pt.json +21 -4
- package/i18n/ru.json +21 -4
- package/i18n/sv.json +21 -4
- package/i18n/tr.json +21 -4
- package/i18n/uk.json +21 -4
- package/i18n/vi.json +21 -4
- package/i18n/zh-TW.json +21 -4
- package/i18n/zh.json +21 -4
- package/input/styles/_index.scss +68 -1
- package/input-otp/styles/_index.scss +14 -0
- package/llms-full.txt +52 -20
- package/overlay/styles/_arrow.scss +4 -4
- package/package.json +33 -1
- package/popconfirm/styles/_index.scss +3 -11
- package/progress/styles/_index.scss +32 -0
- package/schema-form/styles/_index.scss +78 -0
- package/schematics/use/rule.js +2 -0
- package/schematics/use/symbol-map.json +4 -0
- package/select/styles/_index.scss +114 -22
- package/skills/ngwr/SKILL.md +1 -1
- package/skills/ngwr/references/catalog.md +9 -1
- package/slider/styles/_index.scss +22 -0
- package/table/styles/_index.scss +167 -3
- package/textarea/styles/_index.scss +80 -0
- package/theme/styles/_focus.scss +5 -0
- package/theme/styles/_motion.scss +5 -0
- package/transfer/styles/_index.scss +84 -0
- package/tree/styles/_index.scss +138 -5
- package/types/ngwr-alert-testing.d.ts +88 -0
- package/types/ngwr-badge.d.ts +72 -2
- package/types/ngwr-breadcrumbs-testing.d.ts +92 -0
- package/types/ngwr-burger-testing.d.ts +51 -0
- package/types/ngwr-calendar-testing.d.ts +18 -6
- package/types/ngwr-calendar.d.ts +272 -22
- package/types/ngwr-cascader.d.ts +10 -1
- package/types/ngwr-charts-chart-legend.d.ts +9 -4
- package/types/ngwr-charts-line-chart-testing.d.ts +4 -1
- package/types/ngwr-charts-line-chart.d.ts +7 -4
- package/types/ngwr-color-picker-testing.d.ts +15 -4
- package/types/ngwr-color-picker.d.ts +76 -6
- package/types/ngwr-compare-testing.d.ts +72 -0
- package/types/ngwr-date-picker-testing.d.ts +23 -8
- package/types/ngwr-date-picker.d.ts +100 -9
- package/types/ngwr-date.d.ts +71 -1
- package/types/ngwr-drawer.d.ts +9 -0
- package/types/ngwr-dropdown-testing.d.ts +20 -0
- package/types/ngwr-dropdown.d.ts +24 -6
- package/types/ngwr-event-calendar.d.ts +66 -8
- package/types/ngwr-file-upload-testing.d.ts +31 -2
- package/types/ngwr-file-upload.d.ts +148 -1
- package/types/ngwr-form.d.ts +47 -3
- package/types/ngwr-graph-testing.d.ts +8 -3
- package/types/ngwr-graph.d.ts +147 -7
- package/types/ngwr-input-number-testing.d.ts +10 -0
- package/types/ngwr-input-number.d.ts +30 -1
- package/types/ngwr-input-otp.d.ts +10 -0
- package/types/ngwr-input-testing.d.ts +30 -0
- package/types/ngwr-input.d.ts +54 -3
- package/types/ngwr-overlay.d.ts +84 -5
- package/types/ngwr-pipes.d.ts +2 -1
- package/types/ngwr-popconfirm-testing.d.ts +12 -3
- package/types/ngwr-popconfirm.d.ts +28 -3
- package/types/ngwr-popover-testing.d.ts +19 -2
- package/types/ngwr-popover.d.ts +22 -2
- package/types/ngwr-progress.d.ts +29 -1
- package/types/ngwr-pull-to-refresh-testing.d.ts +83 -0
- package/types/ngwr-resizable-testing.d.ts +116 -0
- package/types/ngwr-schema-form-testing.d.ts +260 -0
- package/types/ngwr-schema-form.d.ts +76 -6
- package/types/ngwr-select-testing.d.ts +20 -0
- package/types/ngwr-select.d.ts +112 -11
- package/types/ngwr-sidebar-testing.d.ts +176 -0
- package/types/ngwr-slider-testing.d.ts +3 -1
- package/types/ngwr-slider.d.ts +21 -1
- package/types/ngwr-sortable-list.d.ts +6 -0
- package/types/ngwr-stepper.d.ts +20 -11
- package/types/ngwr-table-testing.d.ts +70 -6
- package/types/ngwr-table.d.ts +480 -50
- package/types/ngwr-tabs-testing.d.ts +14 -17
- package/types/ngwr-tabs.d.ts +6 -0
- package/types/ngwr-textarea-testing.d.ts +10 -0
- package/types/ngwr-textarea.d.ts +48 -2
- package/types/ngwr-toast.d.ts +8 -1
- package/types/ngwr-transfer-testing.d.ts +3 -0
- package/types/ngwr-transfer.d.ts +24 -1
- package/types/ngwr-tree-testing.d.ts +65 -1
- package/types/ngwr-tree.d.ts +333 -12
- package/types/ngwr-utils.d.ts +28 -0
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr-window.d.ts +7 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-popconfirm-testing.mjs","names":[],"sources":["../../../projects/lib/popconfirm/testing/wr-popconfirm-harness.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 {\n ContentContainerComponentHarness,\n type HarnessLoader,\n HarnessPredicate,\n TestKey,\n type TestElement,\n} from '@angular/cdk/testing';\n\nimport type { WrPopconfirmPosition } from 'ngwr/popconfirm';\nimport { WR_COLORS, type WrColor } from 'ngwr/theme';\n\nimport type { WrPopconfirmHarnessFilters } from './types';\n\n/** The two answers a popconfirm offers, which are also its two action modifiers. */\ntype WrPopconfirmAction = 'confirm' | 'cancel';\n\n/**\n * Test harness for `[wrPopconfirm]` — the \"are you sure?\" dialog anchored to its\n * trigger.\n *\n * The panel is NOT inside the trigger: it is a component portal in the overlay\n * container, a sibling of the whole app. So everything about it is reached\n * through the document root, scoped by the `aria-controls` id the trigger\n * publishes while the dialog is showing — which is what keeps two popconfirms\n * from reading each other's question, and why every panel reader throws while the\n * dialog is shut: there is no element to answer about.\n *\n * **The two actions are told apart by their own modifiers**, never by position.\n * `.wr-popconfirm__action--cancel` and `--confirm` are what `cancel()` and\n * `confirm()` click, so a template that ever reorders the pair cannot silently\n * turn a spec's \"cancel\" into a delete.\n *\n * Being a CONTENT CONTAINER means a consumer's own harnesses resolve INSIDE this\n * instance's panel — `popconfirm.getHarness(WrButtonHarness…)` reaches the\n * buttons without the spec ever naming the overlay.\n *\n * @example\n * ```ts\n * const loader = TestbedHarnessEnvironment.loader(fixture);\n * const remove = await loader.getHarness(WrPopconfirmHarness.with({ triggerText: 'Delete' }));\n *\n * await remove.open();\n * expect(await remove.getMessage()).toBe('Delete this item?');\n * await remove.confirm();\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrPopconfirmHarness extends ContentContainerComponentHarness {\n /**\n * The directive's host — whatever element the consumer put `[wrPopconfirm]` on.\n *\n * Matched by the marker class, not by `[wrPopconfirm]`: the question is normally\n * BOUND (`[wrPopconfirm]=\"question\"`), and a property binding leaves no\n * attribute in the DOM at all. Same shape as `.wr-popover-trigger` and\n * `.wr-dropdown-trigger`.\n */\n static hostSelector = '.wr-popconfirm-trigger';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrPopconfirmHarnessFilters = {}): HarnessPredicate<WrPopconfirmHarness> {\n return new HarnessPredicate(WrPopconfirmHarness, options)\n .addOption('triggerText', options.triggerText, (harness, text) =>\n HarnessPredicate.stringMatches(harness.getTriggerText(), text)\n )\n .addOption('open', options.open, async (harness, open) => (await harness.isOpen()) === open);\n }\n\n /** The trigger's own visible label. The question inside the panel is `getMessage()`. */\n async getTriggerText(): Promise<string> {\n return (await this.host()).text();\n }\n\n /**\n * Whether the dialog is showing.\n *\n * Read from `aria-expanded` rather than from a class, because that is the whole\n * of what the trigger tells a screen reader — the directive puts no state class\n * on its host at all.\n */\n async isOpen(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-expanded')) === 'true';\n }\n\n /** Whether the trigger currently has keyboard focus — the state it is handed back on close. */\n async isTriggerFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n\n /**\n * Press the trigger to open the dialog.\n *\n * Throws when nothing opens, because the reason is always worth failing on: a\n * native `<button disabled>` trigger never receives the click at all. (A\n * DISABLED `<wr-btn>` is a jsdom blind spot in the other direction — it is kept\n * inert by `pointer-events: none`, which jsdom does not apply, so it opens here\n * and would not in a browser.)\n */\n async open(): Promise<void> {\n if (await this.isOpen()) return;\n\n await (await this.host()).click();\n if (await this.isOpen()) return;\n\n throw new Error(\n 'WrPopconfirmHarness.open(): the dialog did not open. A disabled trigger takes no click — assert ' +\n 'the disabled state instead of trying to open it.'\n );\n }\n\n /**\n * Press the trigger again to take the question back.\n *\n * This is the ONE way out that answers nothing: the directive treats a second\n * press as withdrawing the question, so `cancelled` does NOT fire — unlike\n * `cancel()`, `sendEscape()` and `clickOutside()`, which all emit it. Use this\n * when a spec needs the panel gone without recording an answer.\n */\n async close(): Promise<void> {\n if (!(await this.isOpen())) return;\n\n await (await this.host()).click();\n if (!(await this.isOpen())) return;\n\n throw new Error('WrPopconfirmHarness.close(): the dialog is still open after a second press of the trigger.');\n }\n\n /** The question being asked. */\n async getMessage(): Promise<string> {\n return (await this.inPanel('.wr-popconfirm__message')).text();\n }\n\n /**\n * The confirm button's label.\n *\n * Resolved, not given: `confirmText` falls back to the `popconfirm.confirm`\n * catalog entry, so a localized app reads its own word here and a spec that\n * asserted the English default would be asserting the wrong thing.\n */\n async getConfirmText(): Promise<string> {\n return (await this.action('confirm')).text();\n }\n\n /** The cancel button's label — `cancelText`, or the `popconfirm.cancel` catalog entry. */\n async getCancelText(): Promise<string> {\n return (await this.action('cancel')).text();\n }\n\n /**\n * Both action labels in the order they are rendered: cancel first, confirm\n * second.\n *\n * That order is deliberate and worth reading — the destructive choice is the one\n * being confirmed, so the safe one comes first and takes the initial focus.\n */\n async getActionLabels(): Promise<string[]> {\n const actions = await this.allInPanel('.wr-popconfirm__action');\n return Promise.all(actions.map(action => action.text()));\n }\n\n /**\n * The confirm button's intent colour.\n *\n * Checked against `WR_COLORS` rather than pattern-matched out of the class list:\n * `wr-btn--*` also spells the size, the shape and the icon position, so only the\n * intent list can say which of them is a colour. Today `WrButton` happens to\n * emit the colour first, so a first-match regex would agree — but that order is\n * not a contract, and the same regex on a button with no colour answers `sm`.\n * Never `null` in practice — `confirmColor` defaults to `primary` — but typed\n * for it, since the button itself allows no colour at all.\n */\n async getConfirmColor(): Promise<WrColor | null> {\n const classes = (await (await this.action('confirm')).getAttribute('class')) ?? '';\n const present = classes.split(/\\s+/);\n return WR_COLORS.find(color => present.includes(`wr-btn--${color}`)) ?? null;\n }\n\n /** Which action holds keyboard focus, by label, or `null` when focus is elsewhere. */\n async getFocusedActionLabel(): Promise<string | null> {\n for (const action of await this.allInPanel('.wr-popconfirm__action')) {\n if (await action.isFocused()) return action.text();\n }\n return null;\n }\n\n /** Answer the question: click confirm, which emits `confirmed` and closes the dialog. */\n async confirm(): Promise<void> {\n return (await this.action('confirm')).click();\n }\n\n /** Decline: click cancel, which emits `cancelled` and closes the dialog. */\n async cancel(): Promise<void> {\n return (await this.action('cancel')).click();\n }\n\n /**\n * Dismiss with Escape, which emits `cancelled`.\n *\n * Sent at the pane rather than at the focused button, because the target makes\n * no difference: the key is picked up by the overlay's keyboard dispatcher,\n * which keeps one listener on the document and routes to the topmost overlay.\n * The pane is the one element guaranteed to be there.\n */\n async sendEscape(): Promise<void> {\n return (await this.pane()).sendKeys(TestKey.ESCAPE);\n }\n\n /**\n * Dismiss by pressing outside the panel, which emits `cancelled`.\n *\n * The press lands on the overlay CONTAINER — an ancestor of the pane (the CDK\n * puts a host `<div>` between the two), and so outside the panel by the only\n * measure that matters here, since the dismissal is decided by whether the press\n * started inside the pane. With two dialogs showing it dismisses BOTH: neither\n * pane contains the container. jsdom has no layout\n * and no `document.elementFromPoint`, so a harness cannot aim at \"whatever is\n * under the pointer\"; to dismiss by pressing a specific element instead, click\n * that element's own `TestElement`.\n */\n async clickOutside(): Promise<void> {\n const id = await this.panelId();\n const container = await this.documentRootLocatorFactory().locatorFor('.cdk-overlay-container')();\n\n await container.click();\n if (!(await this.isOpen())) return;\n\n throw new Error(\n `WrPopconfirmHarness.clickOutside(): the dialog (#${id}) is still open. An outside press is judged ` +\n 'by where it started, so a press that began inside the panel does not dismiss it.'\n );\n }\n\n /**\n * The role the open panel announces — `'dialog'`.\n *\n * Worth asserting rather than assuming: the directive sets it on the OVERLAY\n * PANE, not on the panel component a consumer can see in the template.\n */\n async getRole(): Promise<string | null> {\n return (await this.pane()).getAttribute('role');\n }\n\n /**\n * The dialog's accessible name — the `ariaLabel` input, or the catalog's\n * `popconfirm.label`.\n *\n * A `role=\"dialog\"` with no name announces as a bare \"dialog\" and trips axe's\n * `aria-dialog-name`, which is why there is always one.\n */\n async getLabel(): Promise<string | null> {\n return (await this.pane()).getAttribute('aria-label');\n }\n\n /**\n * Whether the dialog claims modality.\n *\n * `false`, deliberately, and worth pinning: focus is moved into the panel but\n * NOT trapped, because Escape and an outside click both dismiss — trapping\n * would only make it harder to leave.\n */\n async isModal(): Promise<boolean> {\n return (await (await this.pane()).getAttribute('aria-modal')) === 'true';\n }\n\n /**\n * The text a screen reader reads as the dialog's DESCRIPTION, resolved through\n * `aria-describedby` the way an assistive technology would.\n *\n * This is the question, and it is the entire content of a confirmation: without\n * the link the dialog announces its name and then nothing at all.\n */\n async getDescriptionText(): Promise<string | null> {\n const id = await (await this.pane()).getAttribute('aria-describedby');\n if (!id) return null;\n\n const described = await this.documentRootLocatorFactory().locatorForOptional(`#${id}`)();\n return described ? described.text() : null;\n }\n\n /**\n * Which side of the trigger the panel is anchored to.\n *\n * Read off the pane's public modifier class — `position` is an input, so a\n * bound one never reaches the DOM, and the panel's own offset is a CDK inline\n * style that says nothing in a layout-less jsdom. The class names the side the\n * panel LANDED on, which is the one asked for unless it had no room there and\n * flipped; in jsdom, with no layout to run out of, the two are the same.\n */\n async getPosition(): Promise<WrPopconfirmPosition | null> {\n const classes = (await (await this.pane()).getAttribute('class')) ?? '';\n const modifier = /wr-popconfirm-overlay--([a-z]+)/.exec(classes);\n return modifier ? (modifier[1] as WrPopconfirmPosition) : null;\n }\n\n /**\n * Harnesses for anything inside the panel resolve within THIS instance's dialog.\n *\n * Scoped by the published id rather than by `.wr-popconfirm`: the overlay\n * container is shared, so a class query would answer with whichever popconfirm\n * opened first.\n */\n protected override async getRootHarnessLoader(): Promise<HarnessLoader> {\n return this.documentRootLocatorFactory().harnessLoaderFor(`#${await this.panelId()}`);\n }\n\n /**\n * One of the two action buttons.\n *\n * By its own modifier class, never by index: both are a `<wr-btn size=\"sm\">`, so\n * before the modifiers existed the only thing telling them apart was document\n * order — and a harness that clicked \"the second button\" would go on passing\n * while it started confirming what a spec meant to cancel.\n */\n private async action(role: WrPopconfirmAction): Promise<TestElement> {\n return this.inPanel(`.wr-popconfirm__action--${role}`);\n }\n\n /** One element inside THIS instance's panel. */\n private async inPanel(selector: string): Promise<TestElement> {\n return this.documentRootLocatorFactory().locatorFor(`#${await this.panelId()} ${selector}`)();\n }\n\n /** Every matching element inside THIS instance's panel, in document order. */\n private async allInPanel(selector: string): Promise<TestElement[]> {\n return this.documentRootLocatorFactory().locatorForAll(`#${await this.panelId()} ${selector}`)();\n }\n\n /** This instance's overlay pane — the element carrying the dialog semantics. */\n private async pane(): Promise<TestElement> {\n return this.documentRootLocatorFactory().locatorFor(`#${await this.panelId()}`)();\n }\n\n /** The id the trigger publishes for its dialog, which exists only while the dialog does. */\n private async panelId(): Promise<string> {\n const id = await (await this.host()).getAttribute('aria-controls');\n\n if (!id) {\n throw new Error(\n 'WrPopconfirmHarness: nothing is showing. The trigger publishes its dialog id as aria-controls ' +\n 'only while the dialog is open — call open() first.'\n );\n }\n return id;\n }\n}\n"],"mappings":";;;;;;;;AAuDA,IAAa,sBAAb,MAAa,4BAA4B,iCAAgC;CASvE,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAsC,CAAA,GAAE;EAClD,OAAO,IAAI,iBAAiB,qBAAqB,OAAO,CAAC,CACtD,UAAU,eAAe,QAAQ,cAAc,SAAS,SACvD,iBAAiB,cAAc,QAAQ,eAAc,GAAI,IAAI,CAAC,CAC/D,CACA,UAAU,QAAQ,QAAQ,MAAM,OAAO,SAAS,SAAU,MAAM,QAAQ,OAAM,MAAQ,IAAI;CAC/F;CAGA,MAAM,iBAAc;EAClB,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,KAAI;CACjC;CASA,MAAM,SAAM;EACV,OAAQ,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,eAAe,MAAO;CACvE;CAGA,MAAM,mBAAgB;EACpB,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,UAAS;CACtC;CAWA,MAAM,OAAI;EACR,IAAI,MAAM,KAAK,OAAM,GAAI;EAEzB,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,MAAK;EAC/B,IAAI,MAAM,KAAK,OAAM,GAAI;EAEzB,MAAM,IAAI,MACR,kJACoD;CAExD;CAUA,MAAM,QAAK;EACT,IAAI,CAAE,MAAM,KAAK,OAAM,GAAK;EAE5B,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,MAAK;EAC/B,IAAI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,QAAO,GAAI,CAAC,CAAA;CACjF;CAGQ,MAAM,UAAO;EACnB,MAAM,KAAK,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,eAAe;EAEjE,IAAI,CAAC,IACH,MAAM,IAAI,MACR,kJACsD;EAG1D,OAAO;CACT"}
|
|
1
|
+
{"version":3,"file":"ngwr-popconfirm-testing.mjs","names":[],"sources":["../../../projects/lib/popconfirm/testing/wr-popconfirm-harness.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 {\n ContentContainerComponentHarness,\n type HarnessLoader,\n HarnessPredicate,\n TestKey,\n type TestElement,\n} from '@angular/cdk/testing';\n\nimport type { WrPopconfirmPosition } from 'ngwr/popconfirm';\nimport { WR_COLORS, type WrColor } from 'ngwr/theme';\n\nimport type { WrPopconfirmHarnessFilters } from './types';\n\n/** The two answers a popconfirm offers, which are also its two action modifiers. */\ntype WrPopconfirmAction = 'confirm' | 'cancel';\n\n/**\n * Test harness for `[wrPopconfirm]` — the \"are you sure?\" dialog anchored to its\n * trigger.\n *\n * The panel is NOT inside the trigger: it is a component portal in the overlay\n * container, a sibling of the whole app. So everything about it is reached\n * through the document root, scoped by the `aria-controls` id the trigger\n * publishes while the dialog is showing — which is what keeps two popconfirms\n * from reading each other's question, and why every panel reader throws while the\n * dialog is shut: there is no element to answer about.\n *\n * **The two actions are told apart by their own modifiers**, never by position.\n * `.wr-popconfirm__action--cancel` and `--confirm` are what `cancel()` and\n * `confirm()` click, so a template that ever reorders the pair cannot silently\n * turn a spec's \"cancel\" into a delete.\n *\n * Being a CONTENT CONTAINER means a consumer's own harnesses resolve INSIDE this\n * instance's panel — `popconfirm.getHarness(WrButtonHarness…)` reaches the\n * buttons without the spec ever naming the overlay.\n *\n * @example\n * ```ts\n * const loader = TestbedHarnessEnvironment.loader(fixture);\n * const remove = await loader.getHarness(WrPopconfirmHarness.with({ triggerText: 'Delete' }));\n *\n * await remove.open();\n * expect(await remove.getMessage()).toBe('Delete this item?');\n * await remove.confirm();\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrPopconfirmHarness extends ContentContainerComponentHarness {\n /**\n * The directive's host — whatever element the consumer put `[wrPopconfirm]` on.\n *\n * Matched by the marker class, not by `[wrPopconfirm]`: the question is normally\n * BOUND (`[wrPopconfirm]=\"question\"`), and a property binding leaves no\n * attribute in the DOM at all. Same shape as `.wr-popover-trigger` and\n * `.wr-dropdown-trigger`.\n */\n static hostSelector = '.wr-popconfirm-trigger';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrPopconfirmHarnessFilters = {}): HarnessPredicate<WrPopconfirmHarness> {\n return new HarnessPredicate(WrPopconfirmHarness, options)\n .addOption('triggerText', options.triggerText, (harness, text) =>\n HarnessPredicate.stringMatches(harness.getTriggerText(), text)\n )\n .addOption('open', options.open, async (harness, open) => (await harness.isOpen()) === open)\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled);\n }\n\n /** The trigger's own visible label. The question inside the panel is `getMessage()`. */\n async getTriggerText(): Promise<string> {\n return (await this.host()).text();\n }\n\n /**\n * Whether the dialog is showing.\n *\n * Read from `aria-expanded` rather than from a class, because that is the whole\n * of what the trigger tells a screen reader — the directive puts no open-state\n * class on its host at all.\n */\n async isOpen(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-expanded')) === 'true';\n }\n\n /**\n * Whether `wrPopconfirmDisabled` has turned the question off — read from\n * `wr-popconfirm-trigger--disabled`, the one mark a disabled trigger carries.\n * The HOST's own `disabled` is another question: the directive never sets it,\n * so ask the host's harness (`WrButtonHarness.isDisabled()`).\n */\n async isDisabled(): Promise<boolean> {\n return (await this.host()).hasClass('wr-popconfirm-trigger--disabled');\n }\n\n /** Whether the trigger currently has keyboard focus — the state it is handed back on close. */\n async isTriggerFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n\n /**\n * Press the trigger to open the dialog.\n *\n * Throws when nothing opens, because the reason is always worth failing on: a\n * native `<button disabled>` trigger never receives the click at all. (A\n * DISABLED `<wr-btn>` is a jsdom blind spot in the other direction — it is kept\n * inert by `pointer-events: none`, which jsdom does not apply, so it opens here\n * and would not in a browser.)\n */\n async open(): Promise<void> {\n if (await this.isOpen()) return;\n\n await (await this.host()).click();\n if (await this.isOpen()) return;\n\n throw new Error(\n 'WrPopconfirmHarness.open(): the dialog did not open. A disabled trigger takes no click — assert ' +\n 'the disabled state instead of trying to open it.'\n );\n }\n\n /**\n * Press the trigger again to take the question back.\n *\n * This is the ONE way out that answers nothing: the directive treats a second\n * press as withdrawing the question, so `cancelled` does NOT fire — unlike\n * `cancel()`, `sendEscape()` and `clickOutside()`, which all emit it. Use this\n * when a spec needs the panel gone without recording an answer.\n */\n async close(): Promise<void> {\n if (!(await this.isOpen())) return;\n\n await (await this.host()).click();\n if (!(await this.isOpen())) return;\n\n throw new Error('WrPopconfirmHarness.close(): the dialog is still open after a second press of the trigger.');\n }\n\n /** The question being asked. */\n async getMessage(): Promise<string> {\n return (await this.inPanel('.wr-popconfirm__message')).text();\n }\n\n /**\n * The confirm button's label.\n *\n * Resolved, not given: `confirmText` falls back to the `popconfirm.confirm`\n * catalog entry, so a localized app reads its own word here and a spec that\n * asserted the English default would be asserting the wrong thing.\n */\n async getConfirmText(): Promise<string> {\n return (await this.action('confirm')).text();\n }\n\n /** The cancel button's label — `cancelText`, or the `popconfirm.cancel` catalog entry. */\n async getCancelText(): Promise<string> {\n return (await this.action('cancel')).text();\n }\n\n /**\n * Both action labels in the order they are rendered: cancel first, confirm\n * second.\n *\n * That order is deliberate and worth reading — the destructive choice is the one\n * being confirmed, so the safe one comes first and takes the initial focus.\n */\n async getActionLabels(): Promise<string[]> {\n const actions = await this.allInPanel('.wr-popconfirm__action');\n return Promise.all(actions.map(action => action.text()));\n }\n\n /**\n * The confirm button's intent colour.\n *\n * Checked against `WR_COLORS` rather than pattern-matched out of the class list:\n * `wr-btn--*` also spells the size, the shape and the icon position, so only the\n * intent list can say which of them is a colour. Today `WrButton` happens to\n * emit the colour first, so a first-match regex would agree — but that order is\n * not a contract, and the same regex on a button with no colour answers `sm`.\n * Never `null` in practice — `confirmColor` defaults to `primary` — but typed\n * for it, since the button itself allows no colour at all.\n */\n async getConfirmColor(): Promise<WrColor | null> {\n const classes = (await (await this.action('confirm')).getAttribute('class')) ?? '';\n const present = classes.split(/\\s+/);\n return WR_COLORS.find(color => present.includes(`wr-btn--${color}`)) ?? null;\n }\n\n /** Which action holds keyboard focus, by label, or `null` when focus is elsewhere. */\n async getFocusedActionLabel(): Promise<string | null> {\n for (const action of await this.allInPanel('.wr-popconfirm__action')) {\n if (await action.isFocused()) return action.text();\n }\n return null;\n }\n\n /** Answer the question: click confirm, which emits `confirmed` and closes the dialog. */\n async confirm(): Promise<void> {\n return (await this.action('confirm')).click();\n }\n\n /** Decline: click cancel, which emits `cancelled` and closes the dialog. */\n async cancel(): Promise<void> {\n return (await this.action('cancel')).click();\n }\n\n /**\n * Dismiss with Escape, which emits `cancelled`.\n *\n * Sent at the pane rather than at the focused button, because the target makes\n * no difference: the key is picked up by the overlay's keyboard dispatcher,\n * which keeps one listener on the document and routes to the topmost overlay.\n * The pane is the one element guaranteed to be there.\n */\n async sendEscape(): Promise<void> {\n return (await this.pane()).sendKeys(TestKey.ESCAPE);\n }\n\n /**\n * Dismiss by pressing outside the panel, which emits `cancelled`.\n *\n * The press lands on the overlay CONTAINER — an ancestor of the pane (the CDK\n * puts a host `<div>` between the two), and so outside the panel by the only\n * measure that matters here, since the dismissal is decided by whether the press\n * started inside the pane. With two dialogs showing it dismisses BOTH: neither\n * pane contains the container. jsdom has no layout\n * and no `document.elementFromPoint`, so a harness cannot aim at \"whatever is\n * under the pointer\"; to dismiss by pressing a specific element instead, click\n * that element's own `TestElement`.\n */\n async clickOutside(): Promise<void> {\n const id = await this.panelId();\n const container = await this.documentRootLocatorFactory().locatorFor('.cdk-overlay-container')();\n\n await container.click();\n if (!(await this.isOpen())) return;\n\n throw new Error(\n `WrPopconfirmHarness.clickOutside(): the dialog (#${id}) is still open. An outside press is judged ` +\n 'by where it started, so a press that began inside the panel does not dismiss it.'\n );\n }\n\n /**\n * The role the open panel announces — `'dialog'`.\n *\n * Worth asserting rather than assuming: the directive sets it on the OVERLAY\n * PANE, not on the panel component a consumer can see in the template.\n */\n async getRole(): Promise<string | null> {\n return (await this.pane()).getAttribute('role');\n }\n\n /**\n * The dialog's accessible name — the `ariaLabel` input, or the catalog's\n * `popconfirm.label`.\n *\n * A `role=\"dialog\"` with no name announces as a bare \"dialog\" and trips axe's\n * `aria-dialog-name`, which is why there is always one.\n */\n async getLabel(): Promise<string | null> {\n return (await this.pane()).getAttribute('aria-label');\n }\n\n /**\n * Whether the dialog claims modality.\n *\n * `false`, deliberately, and worth pinning: focus is moved into the panel but\n * NOT trapped, because Escape and an outside click both dismiss — trapping\n * would only make it harder to leave.\n */\n async isModal(): Promise<boolean> {\n return (await (await this.pane()).getAttribute('aria-modal')) === 'true';\n }\n\n /**\n * The text a screen reader reads as the dialog's DESCRIPTION, resolved through\n * `aria-describedby` the way an assistive technology would.\n *\n * This is the question, and it is the entire content of a confirmation: without\n * the link the dialog announces its name and then nothing at all.\n */\n async getDescriptionText(): Promise<string | null> {\n const id = await (await this.pane()).getAttribute('aria-describedby');\n if (!id) return null;\n\n const described = await this.documentRootLocatorFactory().locatorForOptional(`#${id}`)();\n return described ? described.text() : null;\n }\n\n /**\n * Which side of the trigger the panel is anchored to, and how it is aligned.\n *\n * Read off the pane's public modifier class — `position` is an input, so a\n * bound one never reaches the DOM, and the panel's own offset is a CDK inline\n * style that says nothing in a layout-less jsdom. The class names the side the\n * panel LANDED on, which is the one asked for unless it had no room there and\n * flipped; in jsdom, with no layout to run out of, the two are the same.\n */\n async getPosition(): Promise<WrPopconfirmPosition | null> {\n const classes = (await (await this.pane()).getAttribute('class')) ?? '';\n const modifier = /wr-popconfirm-overlay--([a-z-]+)/.exec(classes);\n return modifier ? (modifier[1] as WrPopconfirmPosition) : null;\n }\n\n /**\n * Harnesses for anything inside the panel resolve within THIS instance's dialog.\n *\n * Scoped by the published id rather than by `.wr-popconfirm`: the overlay\n * container is shared, so a class query would answer with whichever popconfirm\n * opened first.\n */\n protected override async getRootHarnessLoader(): Promise<HarnessLoader> {\n return this.documentRootLocatorFactory().harnessLoaderFor(`#${await this.panelId()}`);\n }\n\n /**\n * One of the two action buttons.\n *\n * By its own modifier class, never by index: both are a `<wr-btn size=\"sm\">`, so\n * before the modifiers existed the only thing telling them apart was document\n * order — and a harness that clicked \"the second button\" would go on passing\n * while it started confirming what a spec meant to cancel.\n */\n private async action(role: WrPopconfirmAction): Promise<TestElement> {\n return this.inPanel(`.wr-popconfirm__action--${role}`);\n }\n\n /** One element inside THIS instance's panel. */\n private async inPanel(selector: string): Promise<TestElement> {\n return this.documentRootLocatorFactory().locatorFor(`#${await this.panelId()} ${selector}`)();\n }\n\n /** Every matching element inside THIS instance's panel, in document order. */\n private async allInPanel(selector: string): Promise<TestElement[]> {\n return this.documentRootLocatorFactory().locatorForAll(`#${await this.panelId()} ${selector}`)();\n }\n\n /** This instance's overlay pane — the element carrying the dialog semantics. */\n private async pane(): Promise<TestElement> {\n return this.documentRootLocatorFactory().locatorFor(`#${await this.panelId()}`)();\n }\n\n /** The id the trigger publishes for its dialog, which exists only while the dialog does. */\n private async panelId(): Promise<string> {\n const id = await (await this.host()).getAttribute('aria-controls');\n\n if (!id) {\n throw new Error(\n 'WrPopconfirmHarness: nothing is showing. The trigger publishes its dialog id as aria-controls ' +\n 'only while the dialog is open — call open() first.'\n );\n }\n return id;\n }\n}\n"],"mappings":";;;;;;;;AAuDA,IAAa,sBAAb,MAAa,4BAA4B,iCAAgC;CASvE,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAsC,CAAA,GAAE;EAClD,OAAO,IAAI,iBAAiB,qBAAqB,OAAO,CAAC,C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AAM,KAAK,KAAI,EAAA,CAAI,aAAa,kBAAkB;EACpE,IAAI,CAAC,IAAI,OAAO;EAEhB,MAAM,YAAY,MAAM,KAAK,2BAA0B,CAAE,CAAC,mBAAmB,IAAI,IAAI,CAAC,CAAA;EACtF,OAAO,YAAY,UAAU,KAAI,IAAK;CACxC;CAWA,MAAM,cAAW;EACf,MAAM,UAAW,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,OAAO,KAAM;EACrE,MAAM,WAAW,mCAAmC,KAAK,OAAO;EAChE,OAAO,WAAY,SAAS,KAA8B;CAC5D;CASmB,MAAM,uBAAoB;EAC3C,OAAO,KAAK,2BAA0B,CAAE,CAAC,iBAAiB,IAAI,MAAM,KAAK,QAAO,GAAI;CACtF;CAUQ,MAAM,OAAO,MAAwB;EAC3C,OAAO,KAAK,QAAQ,2BAA2B,MAAM;CACvD;CAGQ,MAAM,QAAQ,UAAgB;EACpC,OAAO,KAAK,2BAA0B,CAAE,CAAC,WAAW,IAAI,MAAM,KAAK,QAAO,EAAE,GAAI,UAAU,CAAC,CAAA;CAC7F;CAGQ,MAAM,WAAW,UAAgB;EACvC,OAAO,KAAK,2BAA0B,CAAE,CAAC,cAAc,IAAI,MAAM,KAAK,QAAO,EAAE,GAAI,UAAU,CAAC,CAAA;CAChG;CAGQ,MAAM,OAAI;EAChB,OAAO,KAAK,2BAA0B,CAAE,CAAC,WAAW,IAAI,MAAM,KAAK,QAAO,GAAI,CAAC,CAAA;CACjF;CAGQ,MAAM,UAAO;EACnB,MAAM,KAAK,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,eAAe;EAEjE,IAAI,CAAC,IACH,MAAM,IAAI,MACR,kJACsD;EAG1D,OAAO;CACT"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { Component, DestroyRef, Directive, ElementRef, Injector, ViewContainerRef, ViewEncapsulation, inject, input, output, signal } from "@angular/core";
|
|
2
|
+
import { Component, DestroyRef, Directive, ElementRef, Injector, ViewContainerRef, ViewEncapsulation, effect, inject, input, output, signal } from "@angular/core";
|
|
3
|
+
import { coerceBooleanProperty } from "@angular/cdk/coercion";
|
|
3
4
|
import { wrCheckStyles, wrRestoreFocus, wrToClassList } from "ngwr/utils";
|
|
4
5
|
import { useI18nText } from "ngwr/i18n";
|
|
5
6
|
import { Directionality } from "@angular/cdk/bidi";
|
|
@@ -7,7 +8,7 @@ import { WrButton } from "ngwr/button";
|
|
|
7
8
|
import { ScrollStrategyOptions } from "@angular/cdk/overlay";
|
|
8
9
|
import { ComponentPortal } from "@angular/cdk/portal";
|
|
9
10
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
10
|
-
import { WR_OVERLAY, WrOutsideClick, wrFollowDirection, wrMirrorOffsets } from "ngwr/overlay";
|
|
11
|
+
import { WR_OVERLAY, WrOutsideClick, wrAnchoredPositions, wrFollowDirection, wrMirrorOffsets } from "ngwr/overlay";
|
|
11
12
|
import { FocusMonitor } from "@angular/cdk/a11y";
|
|
12
13
|
/**
|
|
13
14
|
* @license
|
|
@@ -28,7 +29,7 @@ var WrPopconfirmPanel = class WrPopconfirmPanel {
|
|
|
28
29
|
cancelled = output();
|
|
29
30
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
30
31
|
minVersion: "12.0.0",
|
|
31
|
-
version: "22.2.
|
|
32
|
+
version: "22.2.6",
|
|
32
33
|
ngImport: i0,
|
|
33
34
|
type: WrPopconfirmPanel,
|
|
34
35
|
deps: [],
|
|
@@ -36,7 +37,7 @@ var WrPopconfirmPanel = class WrPopconfirmPanel {
|
|
|
36
37
|
});
|
|
37
38
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
38
39
|
minVersion: "17.1.0",
|
|
39
|
-
version: "22.2.
|
|
40
|
+
version: "22.2.6",
|
|
40
41
|
type: WrPopconfirmPanel,
|
|
41
42
|
isStandalone: true,
|
|
42
43
|
selector: "wr-popconfirm",
|
|
@@ -106,7 +107,7 @@ var WrPopconfirmPanel = class WrPopconfirmPanel {
|
|
|
106
107
|
};
|
|
107
108
|
i0.ɵɵngDeclareClassMetadata({
|
|
108
109
|
minVersion: "12.0.0",
|
|
109
|
-
version: "22.2.
|
|
110
|
+
version: "22.2.6",
|
|
110
111
|
ngImport: i0,
|
|
111
112
|
type: WrPopconfirmPanel,
|
|
112
113
|
decorators: [{
|
|
@@ -177,57 +178,11 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
177
178
|
* Use of this source code is governed by an MIT-style license that can be
|
|
178
179
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
179
180
|
*/
|
|
180
|
-
const WR_POPCONFIRM_POSITIONS = {
|
|
181
|
-
top: {
|
|
182
|
-
originX: "center",
|
|
183
|
-
originY: "top",
|
|
184
|
-
overlayX: "center",
|
|
185
|
-
overlayY: "bottom",
|
|
186
|
-
offsetY: -8
|
|
187
|
-
},
|
|
188
|
-
bottom: {
|
|
189
|
-
originX: "center",
|
|
190
|
-
originY: "bottom",
|
|
191
|
-
overlayX: "center",
|
|
192
|
-
overlayY: "top",
|
|
193
|
-
offsetY: 8
|
|
194
|
-
},
|
|
195
|
-
left: {
|
|
196
|
-
originX: "start",
|
|
197
|
-
originY: "center",
|
|
198
|
-
overlayX: "end",
|
|
199
|
-
overlayY: "center",
|
|
200
|
-
offsetX: -8
|
|
201
|
-
},
|
|
202
|
-
right: {
|
|
203
|
-
originX: "end",
|
|
204
|
-
originY: "center",
|
|
205
|
-
overlayX: "start",
|
|
206
|
-
overlayY: "center",
|
|
207
|
-
offsetX: 8
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
const WR_POPCONFIRM_FALLBACKS = {
|
|
211
|
-
top: ["top", "bottom"],
|
|
212
|
-
bottom: ["bottom", "top"],
|
|
213
|
-
left: [
|
|
214
|
-
"left",
|
|
215
|
-
"right",
|
|
216
|
-
"bottom",
|
|
217
|
-
"top"
|
|
218
|
-
],
|
|
219
|
-
right: [
|
|
220
|
-
"right",
|
|
221
|
-
"left",
|
|
222
|
-
"bottom",
|
|
223
|
-
"top"
|
|
224
|
-
]
|
|
225
|
-
};
|
|
226
181
|
function wrPopconfirmPositions(position) {
|
|
227
|
-
return
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
})
|
|
182
|
+
return wrAnchoredPositions(position, {
|
|
183
|
+
gap: 8,
|
|
184
|
+
paneClass: "wr-popconfirm-overlay"
|
|
185
|
+
});
|
|
231
186
|
}
|
|
232
187
|
/**
|
|
233
188
|
* @license
|
|
@@ -251,6 +206,11 @@ var WrPopconfirm = class WrPopconfirm {
|
|
|
251
206
|
resolvedAriaLabel = useI18nText(this.ariaLabel, "popconfirm.label", "Confirm action");
|
|
252
207
|
confirmColor = input("primary", ...ngDevMode ? [{ debugName: "confirmColor" }] : /* istanbul ignore next */ []);
|
|
253
208
|
panelClass = input(null, ...ngDevMode ? [{ debugName: "panelClass" }] : /* istanbul ignore next */ []);
|
|
209
|
+
disabled = input(false, {
|
|
210
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
211
|
+
alias: "wrPopconfirmDisabled",
|
|
212
|
+
transform: coerceBooleanProperty
|
|
213
|
+
});
|
|
254
214
|
confirmed = output();
|
|
255
215
|
cancelled = output();
|
|
256
216
|
host = inject(ElementRef);
|
|
@@ -271,14 +231,18 @@ var WrPopconfirm = class WrPopconfirm {
|
|
|
271
231
|
constructor() {
|
|
272
232
|
if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("popconfirm");
|
|
273
233
|
this.destroyRef.onDestroy(() => this.dispose());
|
|
234
|
+
effect(() => {
|
|
235
|
+
if (this.disabled()) this.close();
|
|
236
|
+
});
|
|
274
237
|
}
|
|
275
238
|
toggle(event) {
|
|
239
|
+
if (this.disabled()) return;
|
|
276
240
|
event.stopPropagation();
|
|
277
241
|
if (this.overlayRef) this.close();
|
|
278
242
|
else this.open();
|
|
279
243
|
}
|
|
280
244
|
open() {
|
|
281
|
-
if (this.overlayRef) return;
|
|
245
|
+
if (this.disabled() || this.overlayRef) return;
|
|
282
246
|
const positions = wrPopconfirmPositions(this.position());
|
|
283
247
|
const positionStrategy = this.overlay.position().flexibleConnectedTo(this.host).withPositions(wrMirrorOffsets(positions, this.isRtl())).withPush(true).withViewportMargin(VIEWPORT_MARGIN);
|
|
284
248
|
this.overlayRef = this.overlay.create({
|
|
@@ -369,7 +333,7 @@ var WrPopconfirm = class WrPopconfirm {
|
|
|
369
333
|
}
|
|
370
334
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
371
335
|
minVersion: "12.0.0",
|
|
372
|
-
version: "22.2.
|
|
336
|
+
version: "22.2.6",
|
|
373
337
|
ngImport: i0,
|
|
374
338
|
type: WrPopconfirm,
|
|
375
339
|
deps: [],
|
|
@@ -377,7 +341,7 @@ var WrPopconfirm = class WrPopconfirm {
|
|
|
377
341
|
});
|
|
378
342
|
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
379
343
|
minVersion: "17.1.0",
|
|
380
|
-
version: "22.2.
|
|
344
|
+
version: "22.2.6",
|
|
381
345
|
type: WrPopconfirm,
|
|
382
346
|
isStandalone: true,
|
|
383
347
|
selector: "[wrPopconfirm]",
|
|
@@ -430,6 +394,13 @@ var WrPopconfirm = class WrPopconfirm {
|
|
|
430
394
|
isSignal: true,
|
|
431
395
|
isRequired: false,
|
|
432
396
|
transformFunction: null
|
|
397
|
+
},
|
|
398
|
+
disabled: {
|
|
399
|
+
classPropertyName: "disabled",
|
|
400
|
+
publicName: "wrPopconfirmDisabled",
|
|
401
|
+
isSignal: true,
|
|
402
|
+
isRequired: false,
|
|
403
|
+
transformFunction: null
|
|
433
404
|
}
|
|
434
405
|
},
|
|
435
406
|
outputs: {
|
|
@@ -439,8 +410,9 @@ var WrPopconfirm = class WrPopconfirm {
|
|
|
439
410
|
host: {
|
|
440
411
|
listeners: { "click": "toggle($event)" },
|
|
441
412
|
properties: {
|
|
442
|
-
"
|
|
443
|
-
"attr.aria-
|
|
413
|
+
"class.wr-popconfirm-trigger--disabled": "disabled()",
|
|
414
|
+
"attr.aria-haspopup": "disabled() ? null : \"dialog\"",
|
|
415
|
+
"attr.aria-expanded": "disabled() ? null : isOpen()",
|
|
444
416
|
"attr.aria-controls": "isOpen() ? panelId : null"
|
|
445
417
|
},
|
|
446
418
|
classAttribute: "wr-popconfirm-trigger"
|
|
@@ -451,7 +423,7 @@ var WrPopconfirm = class WrPopconfirm {
|
|
|
451
423
|
};
|
|
452
424
|
i0.ɵɵngDeclareClassMetadata({
|
|
453
425
|
minVersion: "12.0.0",
|
|
454
|
-
version: "22.2.
|
|
426
|
+
version: "22.2.6",
|
|
455
427
|
ngImport: i0,
|
|
456
428
|
type: WrPopconfirm,
|
|
457
429
|
decorators: [{
|
|
@@ -461,9 +433,10 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
461
433
|
exportAs: "wrPopconfirm",
|
|
462
434
|
host: {
|
|
463
435
|
class: "wr-popconfirm-trigger",
|
|
436
|
+
"[class.wr-popconfirm-trigger--disabled]": "disabled()",
|
|
464
437
|
"(click)": "toggle($event)",
|
|
465
|
-
"[attr.aria-haspopup]": "\"dialog\"",
|
|
466
|
-
"[attr.aria-expanded]": "isOpen()",
|
|
438
|
+
"[attr.aria-haspopup]": "disabled() ? null : \"dialog\"",
|
|
439
|
+
"[attr.aria-expanded]": "disabled() ? null : isOpen()",
|
|
467
440
|
"[attr.aria-controls]": "isOpen() ? panelId : null"
|
|
468
441
|
}
|
|
469
442
|
}]
|
|
@@ -526,6 +499,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
526
499
|
required: false
|
|
527
500
|
}]
|
|
528
501
|
}],
|
|
502
|
+
disabled: [{
|
|
503
|
+
type: i0.Input,
|
|
504
|
+
args: [{
|
|
505
|
+
isSignal: true,
|
|
506
|
+
alias: "wrPopconfirmDisabled",
|
|
507
|
+
required: false
|
|
508
|
+
}]
|
|
509
|
+
}],
|
|
529
510
|
confirmed: [{
|
|
530
511
|
type: i0.Output,
|
|
531
512
|
args: ["confirmed"]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-popconfirm.mjs","names":[],"sources":["../../../projects/lib/popconfirm/popconfirm-panel.ts","../../../projects/lib/popconfirm/popconfirm-panel.html","../../../projects/lib/popconfirm/types/popconfirm-position.ts","../../../projects/lib/popconfirm/popconfirm.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 { Component, ViewEncapsulation, input, output } from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport type { WrColor } from 'ngwr/theme';\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Confirmation panel rendered inside the popconfirm overlay. Not part\n * of the public template API — use `[wrPopconfirm]` instead.\n *\n * @internal\n */\n@Component({\n selector: 'wr-popconfirm',\n templateUrl: './popconfirm-panel.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-popconfirm' },\n imports: [WrButton],\n})\nexport class WrPopconfirmPanel {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('popconfirm');\n }\n\n readonly message = input.required<string>();\n\n /** Id the anchoring directive points `aria-describedby` at. */\n readonly messageId = input<string | null>(null);\n readonly confirmText = input<string>('Confirm');\n readonly cancelText = input<string>('Cancel');\n readonly confirmColor = input<WrColor>('primary');\n\n readonly confirmed = output<void>();\n readonly cancelled = output<void>();\n}\n","<p class=\"wr-popconfirm__message\" [attr.id]=\"messageId()\">{{ message() }}</p>\n\n<div class=\"wr-popconfirm__actions\">\n <wr-btn class=\"wr-popconfirm__action wr-popconfirm__action--cancel\" size=\"sm\" (click)=\"cancelled.emit()\">\n {{ cancelText() }}\n </wr-btn>\n <wr-btn\n class=\"wr-popconfirm__action wr-popconfirm__action--confirm\"\n size=\"sm\"\n [color]=\"confirmColor()\"\n (click)=\"confirmed.emit()\"\n >\n {{ confirmText() }}\n </wr-btn>\n</div>\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 type { ConnectedPosition } from '@angular/cdk/overlay';\n\nexport type WrPopconfirmPosition = 'top' | 'bottom' | 'left' | 'right';\n\n/**\n * The CDK geometry for each placement — one position each. The 8px offset is\n * the gap between the trigger and the panel, the same one `wr-popover` keeps.\n *\n * @internal\n */\nexport const WR_POPCONFIRM_POSITIONS: Record<WrPopconfirmPosition, ConnectedPosition> = {\n top: { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom', offsetY: -8 },\n bottom: { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top', offsetY: 8 },\n left: { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center', offsetX: -8 },\n right: { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center', offsetX: 8 },\n};\n\n/**\n * What each placement may flip to when it does not fit, best first — the chains\n * `wr-popover` uses for the same four sides, for the same reasons. The requested\n * placement leads, so a panel that fits never moves; a side placement may also\n * fall below or above, because on a phone neither side of a mid-page trigger has\n * the room.\n *\n * Each list used to hold ONE position, with `withPush(true)` and nothing to fall\n * back to. A `top` panel opened 60px under the top of a 1440×900 viewport was\n * pushed back down over its own trigger, by 20px, and a `right` panel on a 390px\n * phone ran off the edge with its Confirm button clipped — the panel covering the\n * control it was asking about, while the docs said it flips.\n *\n * @internal\n */\nexport const WR_POPCONFIRM_FALLBACKS: Record<WrPopconfirmPosition, readonly WrPopconfirmPosition[]> = {\n top: ['top', 'bottom'],\n bottom: ['bottom', 'top'],\n left: ['left', 'right', 'bottom', 'top'],\n right: ['right', 'left', 'bottom', 'top'],\n};\n\n/**\n * The list `withPositions()` wants, every link tagged with the pane class of the\n * side it puts the panel on, so the arrow (`.wr-popconfirm-overlay--<side>`)\n * follows a flip. The CDK applies a position's own `panelClass` when it lands on\n * it and clears it on the next one; the gap is an offset rather than padding, so\n * taking the class off before it measures changes nothing.\n *\n * @internal\n */\nexport function wrPopconfirmPositions(position: WrPopconfirmPosition): ConnectedPosition[] {\n return WR_POPCONFIRM_FALLBACKS[position].map(name => ({\n ...WR_POPCONFIRM_POSITIONS[name],\n panelClass: `wr-popconfirm-overlay--${name}`,\n }));\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 { FocusMonitor } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n Injector,\n ViewContainerRef,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WR_OVERLAY, WrOutsideClick, wrFollowDirection, wrMirrorOffsets } from 'ngwr/overlay';\nimport type { WrColor } from 'ngwr/theme';\nimport { wrToClassList, wrCheckStyles, type WrClassInput, wrRestoreFocus } from 'ngwr/utils';\n\nimport { WrPopconfirmPanel } from './popconfirm-panel';\nimport { type WrPopconfirmPosition, wrPopconfirmPositions } from './types';\n\n/**\n * How close, in px, `withPush` may park the panel to the viewport edge — the\n * `--wr-space-sm` step, and the value `wr-popover` uses.\n */\nconst VIEWPORT_MARGIN = 8;\n\n/**\n * Small \"Are you sure?\" panel anchored to its trigger. Fires `confirmed`\n * or `cancelled` and closes automatically. Built on CDK Overlay.\n *\n * @example\n * ```html\n * <wr-btn\n * color=\"danger\"\n * [wrPopconfirm]=\"'Delete this item?'\"\n * confirmColor=\"danger\"\n * confirmText=\"Delete\"\n * (confirmed)=\"remove()\"\n * >Delete</wr-btn>\n * ```\n *\n * @see https://ngwr.dev/reference/components/popconfirm\n */\nlet popconfirmUid = 0;\n\n@Directive({\n selector: '[wrPopconfirm]',\n exportAs: 'wrPopconfirm',\n host: {\n // Marks the trigger the way `[wrPopover]` and `[wrDropdown]` mark theirs. The\n // question is normally BOUND (`[wrPopconfirm]=\"question\"`), which leaves no\n // attribute in the DOM at all, so without this there is nothing to find a\n // trigger by once the panel is shut.\n class: 'wr-popconfirm-trigger',\n '(click)': 'toggle($event)',\n '[attr.aria-haspopup]': '\"dialog\"',\n '[attr.aria-expanded]': 'isOpen()',\n // Names the dialog this trigger opened, as every other overlay trigger in the\n // catalog does. `aria-haspopup=\"dialog\"` promises a dialog and `aria-expanded`\n // says it is showing; without the id, which one is left to guess.\n '[attr.aria-controls]': 'isOpen() ? panelId : null',\n },\n})\nexport class WrPopconfirm {\n /** Confirmation message. */\n readonly message = input.required<string>({ alias: 'wrPopconfirm' });\n\n /** Anchor side; the panel flips to another side when this one has no room. @default 'top' */\n readonly position = input<WrPopconfirmPosition>('top');\n\n /** Label for the confirm button. @default 'Confirm' */\n /** Confirm button text. Falls back to `popconfirm.confirm`. */\n readonly confirmText = input<string | null>(null);\n\n /** Label for the cancel button. @default 'Cancel' */\n /** Cancel button text. Falls back to `popconfirm.cancel`. */\n readonly cancelText = input<string | null>(null);\n\n /**\n * Accessible name of the confirmation dialog. `role=\"dialog\"` with no name\n * announces as a bare \"dialog\". Falls back to `popconfirm.label`.\n */\n readonly ariaLabel = input<string | null>(null);\n\n // The catalog has carried these translated for as long as the component has\n // existed; the labels were hard-coded English defaults, so a localized app got\n // English buttons with the right strings sitting one file away.\n private readonly resolvedConfirm = useI18nText(this.confirmText, 'popconfirm.confirm', 'Confirm');\n private readonly resolvedCancel = useI18nText(this.cancelText, 'popconfirm.cancel', 'Cancel');\n private readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'popconfirm.label', 'Confirm action');\n\n /** Color of the confirm button. @default 'primary' */\n readonly confirmColor = input<WrColor>('primary');\n\n /**\n * Extra CSS classes for the confirmation bubble's overlay pane.\n *\n * The pane is appended to the overlay container, not to this component, so\n * nothing in the consumer's own template encloses it and no descendant rule\n * written around the trigger can reach it. This input is the only per-instance\n * handle on it. A space-separated string works as well as an array.\n */\n readonly panelClass = input<WrClassInput>(null);\n\n /** Fires when the user clicks confirm. */\n readonly confirmed = output<void>();\n\n /** Fires when the user clicks cancel or dismisses the overlay. */\n readonly cancelled = output<void>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly dir = inject(Directionality, { optional: true });\n private readonly outsideClick = inject(WrOutsideClick);\n private readonly vcr = inject(ViewContainerRef);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly injector = inject(Injector);\n private readonly destroyRef = inject(DestroyRef);\n\n private readonly openState = signal(false);\n\n /** Whether the popconfirm is open. Read-only: `open()` and `close()` change it. */\n readonly isOpen = this.openState.asReadonly();\n\n private overlayRef: OverlayRef | null = null;\n\n private readonly uid = ++popconfirmUid;\n\n /** @internal Public so the host binding can read it. */\n protected readonly panelId = `wr-popconfirm-${this.uid}`;\n\n private readonly messageId = `wr-popconfirm-message-${this.uid}`;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('popconfirm');\n this.destroyRef.onDestroy(() => this.dispose());\n }\n\n /** @internal */\n protected toggle(event: MouseEvent): void {\n event.stopPropagation();\n if (this.overlayRef) {\n this.close();\n } else {\n this.open();\n }\n }\n\n open(): void {\n if (this.overlayRef) return;\n\n // Read ONCE, here, and mirror this list rather than the input: the side is\n // chosen at open and a later `position` write moves nothing, so a follower\n // that re-read the signal would let a direction flip quietly adopt a\n // position the panel never opened with.\n //\n // The list is a fallback CHAIN, each link tagged with its own\n // `wr-popconfirm-overlay--<side>` class, so the panel flips when the side\n // asked for has no room and the arrow names the side it landed on. The\n // viewport margin is `wr-popover`'s, for the same reason: without it a pushed\n // panel parks its border on the glass.\n const positions = wrPopconfirmPositions(this.position());\n\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(this.host)\n .withPositions(wrMirrorOffsets(positions, this.isRtl()))\n .withPush(true)\n .withViewportMargin(VIEWPORT_MARGIN);\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: wrToClassList('wr-popconfirm-overlay', this.panelClass()),\n });\n\n // `isRtl()` above answered once, at `create()`, and so did the CDK's own\n // capture of the direction — neither is revisited if the app flips while the\n // question is still on screen. Both halves have to move: the `dir` on the\n // host, so `start` / `end` resolve to the other edge, and the mirrored list,\n // because `offsetX` is added to the final PHYSICAL x. Leave the list behind\n // and the 8px gap on `left` / `right` becomes an 8px overlap over the very\n // control the panel is asking about.\n wrFollowDirection(this.overlayRef, this.dir, this.injector, direction =>\n positionStrategy.withPositions(wrMirrorOffsets(positions, direction === 'rtl'))\n );\n\n // Non-modal by choice, like `wr-popover`: an outside click or Escape closes it,\n // so trapping focus would only make it harder to leave. It still needs a role, a\n // name and the question read out as its description.\n const pane = this.overlayRef.overlayElement;\n pane.id = this.panelId;\n pane.setAttribute('role', 'dialog');\n pane.setAttribute('aria-modal', 'false');\n pane.setAttribute('aria-label', this.resolvedAriaLabel());\n pane.setAttribute('aria-describedby', this.messageId);\n\n const portal = new ComponentPortal(WrPopconfirmPanel, this.vcr);\n const ref = this.overlayRef.attach(portal);\n ref.setInput('message', this.message());\n ref.setInput('messageId', this.messageId);\n ref.setInput('confirmText', this.resolvedConfirm());\n ref.setInput('cancelText', this.resolvedCancel());\n ref.setInput('confirmColor', this.confirmColor());\n // Render now rather than next frame: the buttons have to exist before focus can\n // move to one, and a deferred focus is the class of bug this repo keeps finding.\n ref.changeDetectorRef.detectChanges();\n // Focus has to enter the panel — the overlay container sits at the end of\n // `<body>`, so Tab from the trigger went to the next thing on the PAGE and the\n // only way to confirm was unreachable. Cancel first: the action being confirmed\n // is usually the destructive one.\n pane.querySelector<HTMLElement>('.wr-popconfirm__actions wr-btn')?.focus();\n // And it has to LEAVE with the panel: Tab past Confirm went on to the end of\n // `<body>` and Shift+Tab before Cancel to the foot of the page, each with the\n // question still on screen and `aria-expanded` still true. See `onPaneKeydown`.\n pane.addEventListener('keydown', this.onPaneKeydown);\n pane.addEventListener('focusout', this.onPaneFocusOut);\n this.openState.set(true);\n\n ref.instance.confirmed.subscribe(() => {\n this.confirmed.emit();\n this.close();\n });\n ref.instance.cancelled.subscribe(() => this.dismiss());\n\n this.outsideClick\n .outsidePointerEvents(this.overlayRef)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (this.host.nativeElement.contains(event.target as Node)) return;\n this.dismiss();\n });\n\n this.overlayRef\n .keydownEvents()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.dismiss();\n }\n });\n }\n\n close(): void {\n this.dispose();\n }\n\n private dismiss(): void {\n if (!this.overlayRef) return;\n this.cancelled.emit();\n this.dispose();\n }\n\n private dispose(): void {\n if (!this.overlayRef) return;\n // Focus lives inside the panel while it is open, and removing the panel would\n // drop it to `<body>` — hand it back to the trigger instead, as `wr-dropdown`\n // does on Escape. Only when focus is still IN there: if the user has already\n // clicked elsewhere, taking it back would be stealing.\n const pane = this.overlayRef.overlayElement;\n const returnFocus = pane.contains(document.activeElement);\n // Before the dispose: Chromium fires `focusout` for a focused node as it is\n // removed, and the pane is about to be.\n pane.removeEventListener('keydown', this.onPaneKeydown);\n pane.removeEventListener('focusout', this.onPaneFocusOut);\n this.overlayRef.dispose();\n this.overlayRef = null;\n this.openState.set(false);\n if (returnFocus) wrRestoreFocus(this.host.nativeElement, this.focusMonitor);\n }\n\n /**\n * Tab off either end of the panel dismisses it and takes focus back to the\n * trigger — `wr-popover`'s disclosure behaviour, for a non-modal panel whose\n * DOM sits nowhere near its trigger. Leaving is a dismissal, so `cancelled`\n * fires, as it does for Escape and an outside click.\n *\n * Forward, the trigger is focused WITHOUT `preventDefault`, so the browser's\n * own Tab runs on from there and lands on whatever follows the trigger, where a\n * panel rendered in place would have let it go. Backward, the trigger itself is\n * the destination, so the default is stopped. The panel holds two stops, Cancel\n * and Confirm, in that order.\n */\n private readonly onPaneKeydown = (event: KeyboardEvent): void => {\n const pane = this.overlayRef?.overlayElement;\n if (!pane || event.key !== 'Tab' || event.defaultPrevented) return;\n const stops = [...pane.querySelectorAll<HTMLElement>('.wr-popconfirm__action')];\n const active = document.activeElement;\n if (event.shiftKey) {\n if (active !== stops[0]) return;\n event.preventDefault();\n } else if (active !== stops.at(-1)) {\n return;\n }\n wrRestoreFocus(this.host.nativeElement, this.focusMonitor);\n this.dismiss();\n };\n\n /**\n * Focus that leaves the panel by any other road (a click on something\n * focusable elsewhere) dismisses it too, and is left where it went. A `null`\n * destination is the window losing focus or a focused node being removed,\n * neither of which is leaving.\n */\n private readonly onPaneFocusOut = (event: FocusEvent): void => {\n const next = event.relatedTarget as Node | null;\n if (!next || this.holdsFocus(next)) return;\n this.dismiss();\n };\n\n /**\n * Whether focus on `node` still belongs to this panel: inside the pane, on the\n * trigger (a press there is about to toggle it), or in an overlay opened AFTER\n * this one — the stacking `wr-popover` and `WrOutsideClick` honour, so a\n * second panel raised by `open()` does not dismiss the first by taking focus.\n */\n private holdsFocus(node: Node): boolean {\n const ref = this.overlayRef;\n if (!ref) return false;\n if (ref.overlayElement.contains(node) || this.host.nativeElement.contains(node)) return true;\n const box = ref.hostElement;\n return (\n (box.parentElement?.contains(node) ?? false) &&\n // eslint-disable-next-line no-bitwise -- compareDocumentPosition answers with a bitmask\n (box.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0\n );\n }\n\n /**\n * Whether the app reads right-to-left.\n *\n * Optional inject: `Directionality` is root-provided, so this is never null in\n * an app — but a bare `TestBed` that provides nothing should still get a\n * component that works, and defaulting to LTR is the honest fallback.\n */\n private isRtl(): boolean {\n return this.dir?.value === 'rtl';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;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AA,YAAA;IAAA,mBAAA;GAAA;GAAA,aAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,YAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,WAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,cAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,YAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA;GAAA,WAAA;GAAA,WAAA;EAAA;EAAA,MAAA;GAAA,WAAA,EAAA,SAAA,iBAAA;GAAA,YAAA;IAAA,sBAAA;IAAA,sBAAA;IAAA,sBAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA,CAAA,cAAA;EAAA,UAAA;CAAA,CAAA;;AAAZ,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAY,YAAA,CAAA;EAlBxB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,MAAM;IAKJ,OAAO;IACP,WAAW;IACX,wBAAwB;IACxB,wBAAwB;IAIxB,wBAAwB;GACzB;EACF,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-popconfirm.mjs","names":[],"sources":["../../../projects/lib/popconfirm/popconfirm-panel.ts","../../../projects/lib/popconfirm/popconfirm-panel.html","../../../projects/lib/popconfirm/types/popconfirm-position.ts","../../../projects/lib/popconfirm/popconfirm.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 { Component, ViewEncapsulation, input, output } from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport type { WrColor } from 'ngwr/theme';\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Confirmation panel rendered inside the popconfirm overlay. Not part\n * of the public template API — use `[wrPopconfirm]` instead.\n *\n * @internal\n */\n@Component({\n selector: 'wr-popconfirm',\n templateUrl: './popconfirm-panel.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-popconfirm' },\n imports: [WrButton],\n})\nexport class WrPopconfirmPanel {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('popconfirm');\n }\n\n readonly message = input.required<string>();\n\n /** Id the anchoring directive points `aria-describedby` at. */\n readonly messageId = input<string | null>(null);\n readonly confirmText = input<string>('Confirm');\n readonly cancelText = input<string>('Cancel');\n readonly confirmColor = input<WrColor>('primary');\n\n readonly confirmed = output<void>();\n readonly cancelled = output<void>();\n}\n","<p class=\"wr-popconfirm__message\" [attr.id]=\"messageId()\">{{ message() }}</p>\n\n<div class=\"wr-popconfirm__actions\">\n <wr-btn class=\"wr-popconfirm__action wr-popconfirm__action--cancel\" size=\"sm\" (click)=\"cancelled.emit()\">\n {{ cancelText() }}\n </wr-btn>\n <wr-btn\n class=\"wr-popconfirm__action wr-popconfirm__action--confirm\"\n size=\"sm\"\n [color]=\"confirmColor()\"\n (click)=\"confirmed.emit()\"\n >\n {{ confirmText() }}\n </wr-btn>\n</div>\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 type { ConnectedPosition } from '@angular/cdk/overlay';\n\nimport { type WrAnchoredPosition, wrAnchoredPositions } from 'ngwr/overlay';\n\n/** Where the popconfirm panel sits relative to its trigger. */\nexport type WrPopconfirmPosition = WrAnchoredPosition;\n\n/**\n * The list `withPositions()` wants: the shared fallback chain `wr-popover`\n * walks, with its 8px gap, every link tagged with the pane class of the\n * placement it puts the panel on, so the arrow\n * (`.wr-popconfirm-overlay--<placement>`) follows a flip. The CDK applies a\n * position's own `panelClass` when it lands on it and clears it on the next one;\n * the gap is an offset rather than padding, so taking the class off before it\n * measures changes nothing.\n *\n * @internal\n */\nexport function wrPopconfirmPositions(position: WrPopconfirmPosition): ConnectedPosition[] {\n return wrAnchoredPositions(position, { gap: 8, paneClass: 'wr-popconfirm-overlay' });\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 { FocusMonitor } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n Injector,\n ViewContainerRef,\n effect,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WR_OVERLAY, WrOutsideClick, wrFollowDirection, wrMirrorOffsets } from 'ngwr/overlay';\nimport type { WrColor } from 'ngwr/theme';\nimport { wrToClassList, wrCheckStyles, type WrClassInput, wrRestoreFocus } from 'ngwr/utils';\n\nimport { WrPopconfirmPanel } from './popconfirm-panel';\nimport { type WrPopconfirmPosition, wrPopconfirmPositions } from './types';\n\n/**\n * How close, in px, `withPush` may park the panel to the viewport edge — the\n * `--wr-space-sm` step, and the value `wr-popover` uses.\n */\nconst VIEWPORT_MARGIN = 8;\n\n/**\n * Small \"Are you sure?\" panel anchored to its trigger. Fires `confirmed`\n * or `cancelled` and closes automatically. Built on CDK Overlay.\n *\n * @example\n * ```html\n * <wr-btn\n * color=\"danger\"\n * [wrPopconfirm]=\"'Delete this item?'\"\n * confirmColor=\"danger\"\n * confirmText=\"Delete\"\n * (confirmed)=\"remove()\"\n * >Delete</wr-btn>\n * ```\n *\n * @see https://ngwr.dev/reference/components/popconfirm\n */\nlet popconfirmUid = 0;\n\n@Directive({\n selector: '[wrPopconfirm]',\n exportAs: 'wrPopconfirm',\n host: {\n // Marks the trigger the way `[wrPopover]` and `[wrDropdown]` mark theirs. The\n // question is normally BOUND (`[wrPopconfirm]=\"question\"`), which leaves no\n // attribute in the DOM at all, so without this there is nothing to find a\n // trigger by once the panel is shut.\n class: 'wr-popconfirm-trigger',\n '[class.wr-popconfirm-trigger--disabled]': 'disabled()',\n '(click)': 'toggle($event)',\n '[attr.aria-haspopup]': 'disabled() ? null : \"dialog\"',\n '[attr.aria-expanded]': 'disabled() ? null : isOpen()',\n // Names the dialog this trigger opened, as every other overlay trigger in the\n // catalog does. `aria-haspopup=\"dialog\"` promises a dialog and `aria-expanded`\n // says it is showing; without the id, which one is left to guess.\n '[attr.aria-controls]': 'isOpen() ? panelId : null',\n },\n})\nexport class WrPopconfirm {\n /** Confirmation message. */\n readonly message = input.required<string>({ alias: 'wrPopconfirm' });\n\n /**\n * Anchor side and alignment, the twelve placements `wr-popover` takes; the\n * panel flips to another side when this one has no room.\n * @default 'top'\n */\n readonly position = input<WrPopconfirmPosition>('top');\n\n /** Label for the confirm button. @default 'Confirm' */\n /** Confirm button text. Falls back to `popconfirm.confirm`. */\n readonly confirmText = input<string | null>(null);\n\n /** Label for the cancel button. @default 'Cancel' */\n /** Cancel button text. Falls back to `popconfirm.cancel`. */\n readonly cancelText = input<string | null>(null);\n\n /**\n * Accessible name of the confirmation dialog. `role=\"dialog\"` with no name\n * announces as a bare \"dialog\". Falls back to `popconfirm.label`.\n */\n readonly ariaLabel = input<string | null>(null);\n\n // The catalog has carried these translated for as long as the component has\n // existed; the labels were hard-coded English defaults, so a localized app got\n // English buttons with the right strings sitting one file away.\n private readonly resolvedConfirm = useI18nText(this.confirmText, 'popconfirm.confirm', 'Confirm');\n private readonly resolvedCancel = useI18nText(this.cancelText, 'popconfirm.cancel', 'Cancel');\n private readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'popconfirm.label', 'Confirm action');\n\n /** Color of the confirm button. @default 'primary' */\n readonly confirmColor = input<WrColor>('primary');\n\n /**\n * Extra CSS classes for the confirmation bubble's overlay pane.\n *\n * The pane is appended to the overlay container, not to this component, so\n * nothing in the consumer's own template encloses it and no descendant rule\n * written around the trigger can reach it. This input is the only per-instance\n * handle on it. A space-separated string works as well as an array.\n */\n readonly panelClass = input<WrClassInput>(null);\n\n /**\n * Turns the question off: a click on the host opens nothing and is left to\n * propagate, `open()` does nothing, and an open panel closes without\n * `cancelled`. The host publishes no popup ARIA meanwhile and carries\n * `wr-popconfirm-trigger--disabled`.\n *\n * The host's own `disabled` stays yours: the directive never sets it, so the\n * button still takes its own `(click)` — the way to skip the question when\n * there is nothing to confirm.\n *\n * @default false\n */\n readonly disabled = input(false, { alias: 'wrPopconfirmDisabled', transform: coerceBooleanProperty });\n\n /** Fires when the user clicks confirm. */\n readonly confirmed = output<void>();\n\n /** Fires when the user clicks cancel or dismisses the overlay. */\n readonly cancelled = output<void>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly dir = inject(Directionality, { optional: true });\n private readonly outsideClick = inject(WrOutsideClick);\n private readonly vcr = inject(ViewContainerRef);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly injector = inject(Injector);\n private readonly destroyRef = inject(DestroyRef);\n\n private readonly openState = signal(false);\n\n /** Whether the popconfirm is open. Read-only: `open()` and `close()` change it. */\n readonly isOpen = this.openState.asReadonly();\n\n private overlayRef: OverlayRef | null = null;\n\n private readonly uid = ++popconfirmUid;\n\n /** @internal Public so the host binding can read it. */\n protected readonly panelId = `wr-popconfirm-${this.uid}`;\n\n private readonly messageId = `wr-popconfirm-message-${this.uid}`;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('popconfirm');\n this.destroyRef.onDestroy(() => this.dispose());\n effect(() => {\n if (this.disabled()) this.close();\n });\n }\n\n /** @internal */\n protected toggle(event: MouseEvent): void {\n if (this.disabled()) return;\n event.stopPropagation();\n if (this.overlayRef) {\n this.close();\n } else {\n this.open();\n }\n }\n\n /** Open the panel. Does nothing while the trigger is disabled. */\n open(): void {\n if (this.disabled() || this.overlayRef) return;\n\n // Read ONCE, here, and mirror this list rather than the input: the side is\n // chosen at open and a later `position` write moves nothing, so a follower\n // that re-read the signal would let a direction flip quietly adopt a\n // position the panel never opened with.\n //\n // The list is a fallback CHAIN, each link tagged with its own\n // `wr-popconfirm-overlay--<side>` class, so the panel flips when the side\n // asked for has no room and the arrow names the side it landed on. The\n // viewport margin is `wr-popover`'s, for the same reason: without it a pushed\n // panel parks its border on the glass.\n const positions = wrPopconfirmPositions(this.position());\n\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(this.host)\n .withPositions(wrMirrorOffsets(positions, this.isRtl()))\n .withPush(true)\n .withViewportMargin(VIEWPORT_MARGIN);\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: wrToClassList('wr-popconfirm-overlay', this.panelClass()),\n });\n\n // `isRtl()` above answered once, at `create()`, and so did the CDK's own\n // capture of the direction — neither is revisited if the app flips while the\n // question is still on screen. Both halves have to move: the `dir` on the\n // host, so `start` / `end` resolve to the other edge, and the mirrored list,\n // because `offsetX` is added to the final PHYSICAL x. Leave the list behind\n // and the 8px gap on `left` / `right` becomes an 8px overlap over the very\n // control the panel is asking about.\n wrFollowDirection(this.overlayRef, this.dir, this.injector, direction =>\n positionStrategy.withPositions(wrMirrorOffsets(positions, direction === 'rtl'))\n );\n\n // Non-modal by choice, like `wr-popover`: an outside click or Escape closes it,\n // so trapping focus would only make it harder to leave. It still needs a role, a\n // name and the question read out as its description.\n const pane = this.overlayRef.overlayElement;\n pane.id = this.panelId;\n pane.setAttribute('role', 'dialog');\n pane.setAttribute('aria-modal', 'false');\n pane.setAttribute('aria-label', this.resolvedAriaLabel());\n pane.setAttribute('aria-describedby', this.messageId);\n\n const portal = new ComponentPortal(WrPopconfirmPanel, this.vcr);\n const ref = this.overlayRef.attach(portal);\n ref.setInput('message', this.message());\n ref.setInput('messageId', this.messageId);\n ref.setInput('confirmText', this.resolvedConfirm());\n ref.setInput('cancelText', this.resolvedCancel());\n ref.setInput('confirmColor', this.confirmColor());\n // Render now rather than next frame: the buttons have to exist before focus can\n // move to one, and a deferred focus is the class of bug this repo keeps finding.\n ref.changeDetectorRef.detectChanges();\n // Focus has to enter the panel — the overlay container sits at the end of\n // `<body>`, so Tab from the trigger went to the next thing on the PAGE and the\n // only way to confirm was unreachable. Cancel first: the action being confirmed\n // is usually the destructive one.\n pane.querySelector<HTMLElement>('.wr-popconfirm__actions wr-btn')?.focus();\n // And it has to LEAVE with the panel: Tab past Confirm went on to the end of\n // `<body>` and Shift+Tab before Cancel to the foot of the page, each with the\n // question still on screen and `aria-expanded` still true. See `onPaneKeydown`.\n pane.addEventListener('keydown', this.onPaneKeydown);\n pane.addEventListener('focusout', this.onPaneFocusOut);\n this.openState.set(true);\n\n ref.instance.confirmed.subscribe(() => {\n this.confirmed.emit();\n this.close();\n });\n ref.instance.cancelled.subscribe(() => this.dismiss());\n\n this.outsideClick\n .outsidePointerEvents(this.overlayRef)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (this.host.nativeElement.contains(event.target as Node)) return;\n this.dismiss();\n });\n\n this.overlayRef\n .keydownEvents()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.dismiss();\n }\n });\n }\n\n close(): void {\n this.dispose();\n }\n\n private dismiss(): void {\n if (!this.overlayRef) return;\n this.cancelled.emit();\n this.dispose();\n }\n\n private dispose(): void {\n if (!this.overlayRef) return;\n // Focus lives inside the panel while it is open, and removing the panel would\n // drop it to `<body>` — hand it back to the trigger instead, as `wr-dropdown`\n // does on Escape. Only when focus is still IN there: if the user has already\n // clicked elsewhere, taking it back would be stealing.\n const pane = this.overlayRef.overlayElement;\n const returnFocus = pane.contains(document.activeElement);\n // Before the dispose: Chromium fires `focusout` for a focused node as it is\n // removed, and the pane is about to be.\n pane.removeEventListener('keydown', this.onPaneKeydown);\n pane.removeEventListener('focusout', this.onPaneFocusOut);\n this.overlayRef.dispose();\n this.overlayRef = null;\n this.openState.set(false);\n if (returnFocus) wrRestoreFocus(this.host.nativeElement, this.focusMonitor);\n }\n\n /**\n * Tab off either end of the panel dismisses it and takes focus back to the\n * trigger — `wr-popover`'s disclosure behaviour, for a non-modal panel whose\n * DOM sits nowhere near its trigger. Leaving is a dismissal, so `cancelled`\n * fires, as it does for Escape and an outside click.\n *\n * Forward, the trigger is focused WITHOUT `preventDefault`, so the browser's\n * own Tab runs on from there and lands on whatever follows the trigger, where a\n * panel rendered in place would have let it go. Backward, the trigger itself is\n * the destination, so the default is stopped. The panel holds two stops, Cancel\n * and Confirm, in that order.\n */\n private readonly onPaneKeydown = (event: KeyboardEvent): void => {\n const pane = this.overlayRef?.overlayElement;\n if (!pane || event.key !== 'Tab' || event.defaultPrevented) return;\n const stops = [...pane.querySelectorAll<HTMLElement>('.wr-popconfirm__action')];\n const active = document.activeElement;\n if (event.shiftKey) {\n if (active !== stops[0]) return;\n event.preventDefault();\n } else if (active !== stops.at(-1)) {\n return;\n }\n wrRestoreFocus(this.host.nativeElement, this.focusMonitor);\n this.dismiss();\n };\n\n /**\n * Focus that leaves the panel by any other road (a click on something\n * focusable elsewhere) dismisses it too, and is left where it went. A `null`\n * destination is the window losing focus or a focused node being removed,\n * neither of which is leaving.\n */\n private readonly onPaneFocusOut = (event: FocusEvent): void => {\n const next = event.relatedTarget as Node | null;\n if (!next || this.holdsFocus(next)) return;\n this.dismiss();\n };\n\n /**\n * Whether focus on `node` still belongs to this panel: inside the pane, on the\n * trigger (a press there is about to toggle it), or in an overlay opened AFTER\n * this one — the stacking `wr-popover` and `WrOutsideClick` honour, so a\n * second panel raised by `open()` does not dismiss the first by taking focus.\n */\n private holdsFocus(node: Node): boolean {\n const ref = this.overlayRef;\n if (!ref) return false;\n if (ref.overlayElement.contains(node) || this.host.nativeElement.contains(node)) return true;\n const box = ref.hostElement;\n return (\n (box.parentElement?.contains(node) ?? false) &&\n // eslint-disable-next-line no-bitwise -- compareDocumentPosition answers with a bitmask\n (box.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0\n );\n }\n\n /**\n * Whether the app reads right-to-left.\n *\n * Optional inject: `Directionality` is root-provided, so this is never null in\n * an app — but a bare `TestBed` that provides nothing should still get a\n * component that works, and defaulting to LTR is the honest fallback.\n */\n private isRtl(): boolean {\n return this.dir?.value === 'rtl';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,IAAa,oBAAb,MAAa,kBAAiB;CAC5B,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,YAAY;CAC/E;CAES,UAAU,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAGlC,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CACtC,cAAc,MAAc,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CACtC,aAAa,MAAc,UAAS,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CACpC,eAAe,MAAe,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CAExC,YAAY,OAAM;CAClB,YAAY,OAAM;CAdhB,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAiB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAjB,OAAA,OAAA,GAAA,qBAAA;EAAA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ContentContainerComponentHarness {
|
|
17
17
|
static hostSelector = ".wr-popover-trigger";
|
|
18
18
|
static with(options = {}) {
|
|
19
|
-
return new HarnessPredicate(WrPopoverHarness, options).addOption("triggerText", options.triggerText, (harness, text) => HarnessPredicate.stringMatches(harness.getTriggerText(), text)).addOption("mode", options.mode, async (harness, mode) => await harness.getMode() === mode).addOption("open", options.open, async (harness, open) => await harness.isOpen() === open);
|
|
19
|
+
return new HarnessPredicate(WrPopoverHarness, options).addOption("triggerText", options.triggerText, (harness, text) => HarnessPredicate.stringMatches(harness.getTriggerText(), text)).addOption("mode", options.mode, async (harness, mode) => !await harness.isDisabled() && await harness.getMode() === mode).addOption("open", options.open, async (harness, open) => await harness.isOpen() === open).addOption("disabled", options.disabled, async (harness, disabled) => await harness.isDisabled() === disabled);
|
|
20
20
|
}
|
|
21
21
|
async getMode() {
|
|
22
|
+
if (await this.isDisabled()) throw new Error("WrPopoverHarness.getMode(): the trigger is disabled (`wrPopoverDisabled`), and a disabled trigger publishes no ARIA to tell a popover from a tooltip by. Assert isDisabled() instead.");
|
|
22
23
|
return await (await this.host()).getAttribute("aria-haspopup") === "dialog" ? "popover" : "tooltip";
|
|
23
24
|
}
|
|
24
25
|
async getTriggerText() {
|
|
25
26
|
return (await this.host()).text();
|
|
26
27
|
}
|
|
28
|
+
async isDisabled() {
|
|
29
|
+
return (await this.host()).hasClass("wr-popover-trigger--disabled");
|
|
30
|
+
}
|
|
27
31
|
async isOpen() {
|
|
32
|
+
if (await this.isDisabled()) return false;
|
|
28
33
|
const host = await this.host();
|
|
29
34
|
return await this.getMode() === "popover" ? await host.getAttribute("aria-expanded") === "true" : await host.getAttribute("aria-describedby") !== null;
|
|
30
35
|
}
|
|
31
36
|
async open(timeout = DEFAULT_TIMEOUT) {
|
|
37
|
+
if (await this.isDisabled()) throw new Error("WrPopoverHarness.open(): the trigger is disabled (`wrPopoverDisabled`), so nothing opens it. Assert isDisabled() instead of trying to open it.");
|
|
32
38
|
if (await this.isOpen()) return;
|
|
33
39
|
const host = await this.host();
|
|
34
40
|
await host.hover();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-popover-testing.mjs","names":[],"sources":["../../../projects/lib/popover/testing/wr-popover-harness.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 {\n ContentContainerComponentHarness,\n type HarnessLoader,\n HarnessPredicate,\n TestKey,\n type TestElement,\n} from '@angular/cdk/testing';\n\nimport type { WrPopoverPosition } from 'ngwr/popover';\n\nimport type { WrPopoverHarnessFilters } from './types';\n\n/** How long the waiters poll before giving up, in ms. Generous next to the 120ms default delays. */\nconst DEFAULT_TIMEOUT = 1000;\n\n/** How often they re-check, in ms. */\nconst POLL_STEP = 10;\n\n/**\n * The real `setTimeout`, captured at module load — before a spec can install\n * fake timers.\n *\n * The waiters have to let REAL time pass: the show / hide delays are plain\n * `setTimeout`s inside the directive, and under zoneless change detection\n * `whenStable()` resolves without waiting for a macrotask. Reading the faked\n * global instead would mean the sleep never fires at all, and the harness would\n * hang where it should fail with the message it prepared.\n */\nconst realSetTimeout = globalThis.setTimeout;\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise(resolve => {\n realSetTimeout(resolve, ms);\n });\n}\n\n/**\n * Test harness for `[wrPopover]` — both shapes the one directive ships:\n *\n * - **popover** — template content, opens on click (or hover), announces\n * `role=\"dialog\"` and is what the trigger's `aria-expanded` describes;\n * - **tooltip** — string content, opens after a delay on hover or on KEYBOARD\n * focus (never on a `.focus()` call — see {@link focus}), announces\n * `role=\"tooltip\"` and DESCRIBES its trigger instead of being owned by it.\n *\n * The panel is never inside the trigger: it is a portal in the overlay\n * container, a sibling of the whole app. It is reached through the document\n * root, scoped by the id the trigger publishes while the panel is showing —\n * `aria-controls` in popover mode, `aria-describedby` in tooltip mode. That id\n * is what lets two popovers be open at once without reading each other's\n * content, and it is why every panel reader throws while the panel is shut:\n * there is no element to answer about.\n *\n * Being a CONTENT CONTAINER is the point in popover mode — the panel holds the\n * consumer's own components, so `popover.getHarness(WrButtonHarness…)` reaches\n * them without the spec ever touching the overlay.\n *\n * **Timing.** A tooltip opens on `showDelay` and hides on `hideDelay`; a hover\n * popover hides 120ms after the pointer leaves. `open()`, `close()` and the two\n * waiters sit out that REAL time, so a spec that installs fake timers should\n * drive the clock itself and read `isOpen()` rather than call them.\n *\n * @example\n * ```ts\n * const loader = TestbedHarnessEnvironment.loader(fixture);\n * const details = await loader.getHarness(WrPopoverHarness.with({ triggerText: 'Details' }));\n *\n * await details.open();\n * expect(await details.getRole()).toBe('dialog');\n * await (await details.getHarness(WrButtonHarness.with({ text: 'Confirm' }))).click();\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrPopoverHarness extends ContentContainerComponentHarness {\n /**\n * The directive's host — whatever element the consumer put `[wrPopover]` on.\n *\n * Matched by the marker class, not by `[wrPopover]`: popover-mode content is a\n * `TemplateRef` and so is always BOUND (`[wrPopover]=\"tpl\"`), which leaves no\n * attribute in the DOM at all, and a CLOSED tooltip publishes no ARIA either.\n * (A tooltip written with the static string form, `wrPopover=\"Save changes\"`,\n * does keep the attribute — but only that one shape would be findable by it.)\n * Same shape as `.wr-dropdown-trigger`.\n */\n static hostSelector = '.wr-popover-trigger';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrPopoverHarnessFilters = {}): HarnessPredicate<WrPopoverHarness> {\n return new HarnessPredicate(WrPopoverHarness, options)\n .addOption('triggerText', options.triggerText, (harness, text) =>\n HarnessPredicate.stringMatches(harness.getTriggerText(), text)\n )\n .addOption('mode', options.mode, async (harness, mode) => (await harness.getMode()) === mode)\n .addOption('open', options.open, async (harness, open) => (await harness.isOpen()) === open);\n }\n\n /**\n * Which shape this trigger carries.\n *\n * Read from the ARIA contract, not from the `mode` input: a bound `[mode]`\n * never reaches the DOM, while `aria-haspopup=\"dialog\"` is on every popover\n * trigger and on no tooltip trigger — a tooltip is a description of the\n * control, not a popup it owns.\n */\n async getMode(): Promise<'popover' | 'tooltip'> {\n return (await (await this.host()).getAttribute('aria-haspopup')) === 'dialog' ? 'popover' : 'tooltip';\n }\n\n /** The trigger's own visible text. The panel's content is `getContentText()`. */\n async getTriggerText(): Promise<string> {\n return (await this.host()).text();\n }\n\n /**\n * Whether the panel is showing.\n *\n * Two different signals because the two modes advertise different things: a\n * popover flips `aria-expanded` on its trigger, a tooltip has none at all and\n * links its description instead. So a tooltip's answer is only as good as the\n * directive's claim on `aria-describedby` — put the tooltip on a control that\n * is ALSO described by something else (a `<wr-form-field>` hint, say) and the\n * two bindings fight over one attribute.\n */\n async isOpen(): Promise<boolean> {\n const host = await this.host();\n return (await this.getMode()) === 'popover'\n ? (await host.getAttribute('aria-expanded')) === 'true'\n : (await host.getAttribute('aria-describedby')) !== null;\n }\n\n /**\n * Open the panel with the gesture this trigger actually answers to, and wait\n * until it is showing.\n *\n * `trigger` is an input, so the DOM does not say which gesture this popover\n * wants — the harness moves the pointer on first and falls back to a click.\n * Hover leads because a click is an outside pointer event for every OTHER open\n * panel, so leading with it would dismiss someone else's popover on the way to\n * opening this one; a click-driven popover ignores the hover outright. A\n * tooltip is never clicked at all, and hover is the only one of its two\n * gestures a harness can perform — the other is a keyboard focus, which is\n * `FocusMonitor`'s to grant (see {@link focus}).\n *\n * Throws when nothing appears: a tooltip with an empty string never opens, and\n * a spec on fake timers has to advance the clock itself.\n */\n async open(timeout = DEFAULT_TIMEOUT): Promise<void> {\n if (await this.isOpen()) return;\n\n const host = await this.host();\n await host.hover();\n if ((await this.getMode()) === 'tooltip') return this.waitUntilOpen(timeout);\n\n if (await this.isOpen()) return;\n await host.click();\n return this.waitUntilOpen(timeout);\n }\n\n /**\n * Dismiss the panel and wait until it is gone.\n *\n * Escape, because it is the one gesture both modes honour immediately: a\n * popover is closed by the overlay's keyboard dispatcher, a tooltip by the\n * directive's own binding — no delay in either. To exercise the delayed\n * pointer path instead, call `mouseAway()` and then `waitUntilClosed()`.\n */\n async close(timeout = DEFAULT_TIMEOUT): Promise<void> {\n if (!(await this.isOpen())) return;\n\n await this.sendEscape();\n return this.waitUntilClosed(timeout);\n }\n\n /** Click the trigger. Opens a click-driven popover, toggles it shut again, and does nothing else. */\n async click(): Promise<void> {\n return (await this.host()).click();\n }\n\n /** Move the pointer onto the trigger — opens a hover popover at once, a tooltip after `showDelay`. */\n async hover(): Promise<void> {\n return (await this.host()).hover();\n }\n\n /** Move the pointer off the trigger. The panel goes after the grace period, not instantly. */\n async mouseAway(): Promise<void> {\n return (await this.host()).mouseAway();\n }\n\n /**\n * Focus the trigger PROGRAMMATICALLY — and note that this does not open a\n * tooltip.\n *\n * `TestElement.focus()` is a `.focus()` call, which is the one kind of focus a\n * tooltip deliberately ignores: it shows for a KEYBOARD focus only, because\n * every overlay in the catalog hands focus back to the trigger it was opened\n * from, and a tooltip that answered those appeared with no pointer to leave and\n * no focus to lose. So this method is the way to assert that NOTHING happens.\n *\n * There is no keyboard-origin twin, and it cannot be written honestly here:\n * origin is `FocusMonitor`'s answer, this class has no injector, and the Tab\n * that would earn it moves focus in a browser and not in jsdom. A spec that\n * needs the opening gesture drives `FocusMonitor.focusVia(el, 'keyboard')`\n * itself, the way `popover.spec.ts` does — or uses `hover()`.\n */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Blur the trigger, which hides a tooltip after `hideDelay`. */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Press Escape on the trigger. Both modes dismiss on it, and neither moves focus. */\n async sendEscape(): Promise<void> {\n return (await this.host()).sendKeys(TestKey.ESCAPE);\n }\n\n /** Wait out a pending show. Resolves at once when the panel is already up. */\n async waitUntilOpen(timeout = DEFAULT_TIMEOUT): Promise<void> {\n if (await this.settled(true, timeout)) return;\n\n throw new Error(\n `WrPopoverHarness.waitUntilOpen(): nothing opened within ${timeout}ms. A tooltip waits out its ` +\n 'showDelay (and never opens at all for an empty string); this wait uses real time, so a spec on ' +\n 'fake timers has to advance the clock itself and read isOpen().'\n );\n }\n\n /** Wait out a pending hide. Resolves at once when the panel is already gone. */\n async waitUntilClosed(timeout = DEFAULT_TIMEOUT): Promise<void> {\n if (await this.settled(false, timeout)) return;\n\n throw new Error(\n `WrPopoverHarness.waitUntilClosed(): still showing after ${timeout}ms. A hover popover closes 120ms ` +\n 'after the pointer leaves — and only if it left at all, since a mouseleave INTO that panel is ' +\n 'deliberately not a leave. A tooltip closes on its hideDelay after mouseleave or blur.'\n );\n }\n\n /**\n * The panel's text.\n *\n * In tooltip mode that is the string itself, rendered into the small text\n * panel; in popover mode it is everything the projected template renders.\n */\n async getContentText(): Promise<string> {\n return (await this.panel()).text();\n }\n\n /**\n * The role the open panel announces: `'dialog'` for a popover, `'tooltip'` for\n * a tooltip.\n *\n * Worth asserting rather than assuming, twice over: the directive sets it on\n * the OVERLAY PANE, not on the content a consumer wrote, and in tooltip mode\n * the pane is deliberately the only element carrying it — the text panel\n * inside has none, or the description would nest a tooltip in a tooltip.\n */\n async getRole(): Promise<string | null> {\n return (await this.panel()).getAttribute('role');\n }\n\n /**\n * The panel's accessible name — `null` in tooltip mode.\n *\n * A popover is a named `role=\"dialog\"`: the `ariaLabel` input, or the i18n\n * catalog's `popover.label` when the consumer says nothing, because an unnamed\n * dialog announces as \"dialog\" and nothing else. A tooltip has no name of its\n * own; it IS the trigger's description, which is `getDescriptionText()`.\n */\n async getLabel(): Promise<string | null> {\n return (await this.panel()).getAttribute('aria-label');\n }\n\n /**\n * Whether the panel claims modality.\n *\n * `false`, deliberately, and worth pinning: the popover sets\n * `aria-modal=\"false\"` because focus is NOT trapped and the panel dismisses on\n * outside click / Escape rather than blocking the page.\n */\n async isModal(): Promise<boolean> {\n return (await (await this.panel()).getAttribute('aria-modal')) === 'true';\n }\n\n /**\n * Where the panel sits relative to the trigger, or `null` when the pane\n * carries no placement class.\n *\n * The APPLIED position, not the requested one: CDK flips a placement that does\n * not fit to the next in its fallback chain and swaps the modifier class with\n * it. Under a unit test that is always the requested placement — jsdom measures\n * every box as 0×0, so the first candidate always \"fits\" — but in a browser the\n * two can differ, and this answers what is on screen. The directive defaults\n * the request per mode (`bottom` for a popover, `top` for a tooltip).\n *\n * The arrow itself is a `::after` pseudo-element, so it exists for no DOM query\n * at all; this class is the placement, and it is what the arrow's own CSS keys\n * off.\n */\n async getPosition(): Promise<WrPopoverPosition | null> {\n const classes = (await (await this.panel()).getAttribute('class')) ?? '';\n const modifier = /wr-(?:popover|tooltip)-overlay--([a-z-]+)/.exec(classes);\n return modifier ? (modifier[1] as WrPopoverPosition) : null;\n }\n\n /**\n * The text a screen reader reads as the TRIGGER'S DESCRIPTION, or `null` when\n * it describes nothing.\n *\n * This resolves `aria-describedby` the way an assistive technology would, so\n * it answers the whole of tooltip mode's naming contract in one call. Always\n * `null` for a popover, open or shut — a popover is a thing the trigger owns\n * (`aria-haspopup` / `aria-expanded`), never a description of it.\n */\n async getDescriptionText(): Promise<string | null> {\n const id = await (await this.host()).getAttribute('aria-describedby');\n if (!id) return null;\n\n const described = await this.documentRootLocatorFactory().locatorForOptional(`#${id}`)();\n return described ? described.text() : null;\n }\n\n /**\n * Harnesses for the consumer's own components are resolved inside THIS\n * instance's panel.\n *\n * Scoped by the published id rather than by `.wr-popover-overlay`: the overlay\n * container is shared, so a class query would answer with whichever popover\n * opened first.\n */\n protected override async getRootHarnessLoader(): Promise<HarnessLoader> {\n return this.documentRootLocatorFactory().harnessLoaderFor(`#${await this.panelId()}`);\n }\n\n /** Poll until `isOpen()` reports `open`, and say whether it did. */\n private async settled(open: boolean, timeout: number): Promise<boolean> {\n for (let waited = 0; waited <= timeout; waited += POLL_STEP) {\n if ((await this.isOpen()) === open) return true;\n\n await sleep(POLL_STEP);\n await this.forceStabilize();\n }\n return false;\n }\n\n /** This instance's overlay pane. */\n private async panel(): Promise<TestElement> {\n return this.documentRootLocatorFactory().locatorFor(`#${await this.panelId()}`)();\n }\n\n /** The id the trigger publishes for its panel, which only exists while the panel does. */\n private async panelId(): Promise<string> {\n const attribute = (await this.getMode()) === 'popover' ? 'aria-controls' : 'aria-describedby';\n const id = await (await this.host()).getAttribute(attribute);\n\n if (!id) {\n throw new Error(\n `WrPopoverHarness: nothing is showing. The trigger publishes its panel id as ${attribute} only ` +\n 'while the panel is open — call open() first (a tooltip also has to wait out its showDelay).'\n );\n }\n return id;\n }\n}\n"],"mappings":";;;;;;;AAoBA,MAAM,kBAAkB;AAGxB,MAAM,YAAY;AAYlB,MAAM,iBAAiB,WAAW;AAElC,SAAS,MAAM,IAAU;CACvB,OAAO,IAAI,SAAQ,YAAU;EAC3B,eAAe,SAAS,EAAE;CAC5B,CAAC;AACH;AAwCA,IAAa,mBAAb,MAAa,yBAAyB,iCAAgC;CAWpE,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAmC,CAAA,GAAE;EAC/C,OAAO,IAAI,iBAAiB,kBAAkB,OAAO,CAAC,CACnD,UAAU,eAAe,QAAQ,cAAc,SAAS,SACvD,iBAAiB,cAAc,QAAQ,eAAc,GAAI,IAAI,CAAC,CAC/D,CACA,UAAU,QAAQ,QAAQ,MAAM,OAAO,SAAS,SAAU,MAAM,QAAQ,QAAO,MAAQ,IAAI,CAAC,CAC5F,UAAU,QAAQ,QAAQ,MAAM,OAAO,SAAS,SAAU,MAAM,QAAQ,OAAM,MAAQ,IAAI;CAC/F;CAUA,MAAM,UAAO;EACX,OAAQ,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,eAAe,MAAO,WAAW,YAAY;CAC9F;CAGA,MAAM,iBAAc;EAClB,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,KAAI;CACjC;CAYA,MAAM,SAAM;EACV,MAAM,OAAO,MAAM,KAAK,KAAI;EAC5B,OAAQ,MAAM,KAAK,QAAO,MAAQ,YAC7B,MAAM,KAAK,aAAa,eAAe,MAAO,SAC9C,MAAM,KAAK,aAAa,kBAAkB,MAAO;CAC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E3D,IAAI,CAAC,IACH,MAAM,IAAI,MACR,+EAA+E,UAAS,kGACO;EAGnG,OAAO;CACT"}
|
|
1
|
+
{"version":3,"file":"ngwr-popover-testing.mjs","names":[],"sources":["../../../projects/lib/popover/testing/wr-popover-harness.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 {\n ContentContainerComponentHarness,\n type HarnessLoader,\n HarnessPredicate,\n TestKey,\n type TestElement,\n} from '@angular/cdk/testing';\n\nimport type { WrPopoverPosition } from 'ngwr/popover';\n\nimport type { WrPopoverHarnessFilters } from './types';\n\n/** How long the waiters poll before giving up, in ms. Generous next to the 120ms default delays. */\nconst DEFAULT_TIMEOUT = 1000;\n\n/** How often they re-check, in ms. */\nconst POLL_STEP = 10;\n\n/**\n * The real `setTimeout`, captured at module load — before a spec can install\n * fake timers.\n *\n * The waiters have to let REAL time pass: the show / hide delays are plain\n * `setTimeout`s inside the directive, and under zoneless change detection\n * `whenStable()` resolves without waiting for a macrotask. Reading the faked\n * global instead would mean the sleep never fires at all, and the harness would\n * hang where it should fail with the message it prepared.\n */\nconst realSetTimeout = globalThis.setTimeout;\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise(resolve => {\n realSetTimeout(resolve, ms);\n });\n}\n\n/**\n * Test harness for `[wrPopover]` — both shapes the one directive ships:\n *\n * - **popover** — template content, opens on click (or hover), announces\n * `role=\"dialog\"` and is what the trigger's `aria-expanded` describes;\n * - **tooltip** — string content, opens after a delay on hover or on KEYBOARD\n * focus (never on a `.focus()` call — see {@link focus}), announces\n * `role=\"tooltip\"` and DESCRIBES its trigger instead of being owned by it.\n *\n * The panel is never inside the trigger: it is a portal in the overlay\n * container, a sibling of the whole app. It is reached through the document\n * root, scoped by the id the trigger publishes while the panel is showing —\n * `aria-controls` in popover mode, `aria-describedby` in tooltip mode. That id\n * is what lets two popovers be open at once without reading each other's\n * content, and it is why every panel reader throws while the panel is shut:\n * there is no element to answer about.\n *\n * Being a CONTENT CONTAINER is the point in popover mode — the panel holds the\n * consumer's own components, so `popover.getHarness(WrButtonHarness…)` reaches\n * them without the spec ever touching the overlay.\n *\n * **Timing.** A tooltip opens on `showDelay` and hides on `hideDelay`; a hover\n * popover hides 120ms after the pointer leaves. `open()`, `close()` and the two\n * waiters sit out that REAL time, so a spec that installs fake timers should\n * drive the clock itself and read `isOpen()` rather than call them.\n *\n * @example\n * ```ts\n * const loader = TestbedHarnessEnvironment.loader(fixture);\n * const details = await loader.getHarness(WrPopoverHarness.with({ triggerText: 'Details' }));\n *\n * await details.open();\n * expect(await details.getRole()).toBe('dialog');\n * await (await details.getHarness(WrButtonHarness.with({ text: 'Confirm' }))).click();\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrPopoverHarness extends ContentContainerComponentHarness {\n /**\n * The directive's host — whatever element the consumer put `[wrPopover]` on.\n *\n * Matched by the marker class, not by `[wrPopover]`: popover-mode content is a\n * `TemplateRef` and so is always BOUND (`[wrPopover]=\"tpl\"`), which leaves no\n * attribute in the DOM at all, and a CLOSED tooltip publishes no ARIA either.\n * (A tooltip written with the static string form, `wrPopover=\"Save changes\"`,\n * does keep the attribute — but only that one shape would be findable by it.)\n * Same shape as `.wr-dropdown-trigger`.\n */\n static hostSelector = '.wr-popover-trigger';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrPopoverHarnessFilters = {}): HarnessPredicate<WrPopoverHarness> {\n return new HarnessPredicate(WrPopoverHarness, options)\n .addOption('triggerText', options.triggerText, (harness, text) =>\n HarnessPredicate.stringMatches(harness.getTriggerText(), text)\n )\n .addOption(\n 'mode',\n options.mode,\n async (harness, mode) => !(await harness.isDisabled()) && (await harness.getMode()) === mode\n )\n .addOption('open', options.open, async (harness, open) => (await harness.isOpen()) === open)\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled);\n }\n\n /**\n * Which shape this trigger carries.\n *\n * Read from the ARIA contract, not from the `mode` input: a bound `[mode]`\n * never reaches the DOM, while `aria-haspopup=\"dialog\"` is on every popover\n * trigger and on no tooltip trigger — a tooltip is a description of the\n * control, not a popup it owns.\n *\n * Throws on a disabled trigger: `wrPopoverDisabled` withdraws that ARIA from\n * both shapes, and answering `'tooltip'` for a disabled popover would be a\n * guess.\n */\n async getMode(): Promise<'popover' | 'tooltip'> {\n if (await this.isDisabled()) {\n throw new Error(\n 'WrPopoverHarness.getMode(): the trigger is disabled (`wrPopoverDisabled`), and a disabled trigger ' +\n 'publishes no ARIA to tell a popover from a tooltip by. Assert isDisabled() instead.'\n );\n }\n return (await (await this.host()).getAttribute('aria-haspopup')) === 'dialog' ? 'popover' : 'tooltip';\n }\n\n /** The trigger's own visible text. The panel's content is `getContentText()`. */\n async getTriggerText(): Promise<string> {\n return (await this.host()).text();\n }\n\n /**\n * Whether `wrPopoverDisabled` has turned the trigger off — read from\n * `wr-popover-trigger--disabled`, the one mark a disabled trigger carries.\n * The HOST's own `disabled` is another question: the directive never sets it,\n * so ask the host's harness (`WrButtonHarness.isDisabled()`).\n */\n async isDisabled(): Promise<boolean> {\n return (await this.host()).hasClass('wr-popover-trigger--disabled');\n }\n\n /**\n * Whether the panel is showing.\n *\n * Two different signals because the two modes advertise different things: a\n * popover flips `aria-expanded` on its trigger, a tooltip has none at all and\n * links its description instead. So a tooltip's answer is only as good as the\n * directive's claim on `aria-describedby` — put the tooltip on a control that\n * is ALSO described by something else (a `<wr-form-field>` hint, say) and the\n * two bindings fight over one attribute.\n */\n async isOpen(): Promise<boolean> {\n if (await this.isDisabled()) return false;\n const host = await this.host();\n return (await this.getMode()) === 'popover'\n ? (await host.getAttribute('aria-expanded')) === 'true'\n : (await host.getAttribute('aria-describedby')) !== null;\n }\n\n /**\n * Open the panel with the gesture this trigger actually answers to, and wait\n * until it is showing.\n *\n * `trigger` is an input, so the DOM does not say which gesture this popover\n * wants — the harness moves the pointer on first and falls back to a click.\n * Hover leads because a click is an outside pointer event for every OTHER open\n * panel, so leading with it would dismiss someone else's popover on the way to\n * opening this one; a click-driven popover ignores the hover outright. A\n * tooltip is never clicked at all, and hover is the only one of its two\n * gestures a harness can perform — the other is a keyboard focus, which is\n * `FocusMonitor`'s to grant (see {@link focus}).\n *\n * Throws when nothing appears: a tooltip with an empty string never opens, and\n * a spec on fake timers has to advance the clock itself. Throws at once on a\n * disabled trigger, which no gesture opens.\n */\n async open(timeout = DEFAULT_TIMEOUT): Promise<void> {\n if (await this.isDisabled()) {\n throw new Error(\n 'WrPopoverHarness.open(): the trigger is disabled (`wrPopoverDisabled`), so nothing opens it. ' +\n 'Assert isDisabled() instead of trying to open it.'\n );\n }\n if (await this.isOpen()) return;\n\n const host = await this.host();\n await host.hover();\n if ((await this.getMode()) === 'tooltip') return this.waitUntilOpen(timeout);\n\n if (await this.isOpen()) return;\n await host.click();\n return this.waitUntilOpen(timeout);\n }\n\n /**\n * Dismiss the panel and wait until it is gone.\n *\n * Escape, because it is the one gesture both modes honour immediately: a\n * popover is closed by the overlay's keyboard dispatcher, a tooltip by the\n * directive's own binding — no delay in either. To exercise the delayed\n * pointer path instead, call `mouseAway()` and then `waitUntilClosed()`.\n */\n async close(timeout = DEFAULT_TIMEOUT): Promise<void> {\n if (!(await this.isOpen())) return;\n\n await this.sendEscape();\n return this.waitUntilClosed(timeout);\n }\n\n /** Click the trigger. Opens a click-driven popover, toggles it shut again, and does nothing else. */\n async click(): Promise<void> {\n return (await this.host()).click();\n }\n\n /** Move the pointer onto the trigger — opens a hover popover at once, a tooltip after `showDelay`. */\n async hover(): Promise<void> {\n return (await this.host()).hover();\n }\n\n /** Move the pointer off the trigger. The panel goes after the grace period, not instantly. */\n async mouseAway(): Promise<void> {\n return (await this.host()).mouseAway();\n }\n\n /**\n * Focus the trigger PROGRAMMATICALLY — and note that this does not open a\n * tooltip.\n *\n * `TestElement.focus()` is a `.focus()` call, which is the one kind of focus a\n * tooltip deliberately ignores: it shows for a KEYBOARD focus only, because\n * every overlay in the catalog hands focus back to the trigger it was opened\n * from, and a tooltip that answered those appeared with no pointer to leave and\n * no focus to lose. So this method is the way to assert that NOTHING happens.\n *\n * There is no keyboard-origin twin, and it cannot be written honestly here:\n * origin is `FocusMonitor`'s answer, this class has no injector, and the Tab\n * that would earn it moves focus in a browser and not in jsdom. A spec that\n * needs the opening gesture drives `FocusMonitor.focusVia(el, 'keyboard')`\n * itself, the way `popover.spec.ts` does — or uses `hover()`.\n */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Blur the trigger, which hides a tooltip after `hideDelay`. */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Press Escape on the trigger. Both modes dismiss on it, and neither moves focus. */\n async sendEscape(): Promise<void> {\n return (await this.host()).sendKeys(TestKey.ESCAPE);\n }\n\n /** Wait out a pending show. Resolves at once when the panel is already up. */\n async waitUntilOpen(timeout = DEFAULT_TIMEOUT): Promise<void> {\n if (await this.settled(true, timeout)) return;\n\n throw new Error(\n `WrPopoverHarness.waitUntilOpen(): nothing opened within ${timeout}ms. A tooltip waits out its ` +\n 'showDelay (and never opens at all for an empty string); this wait uses real time, so a spec on ' +\n 'fake timers has to advance the clock itself and read isOpen().'\n );\n }\n\n /** Wait out a pending hide. Resolves at once when the panel is already gone. */\n async waitUntilClosed(timeout = DEFAULT_TIMEOUT): Promise<void> {\n if (await this.settled(false, timeout)) return;\n\n throw new Error(\n `WrPopoverHarness.waitUntilClosed(): still showing after ${timeout}ms. A hover popover closes 120ms ` +\n 'after the pointer leaves — and only if it left at all, since a mouseleave INTO that panel is ' +\n 'deliberately not a leave. A tooltip closes on its hideDelay after mouseleave or blur.'\n );\n }\n\n /**\n * The panel's text.\n *\n * In tooltip mode that is the string itself, rendered into the small text\n * panel; in popover mode it is everything the projected template renders.\n */\n async getContentText(): Promise<string> {\n return (await this.panel()).text();\n }\n\n /**\n * The role the open panel announces: `'dialog'` for a popover, `'tooltip'` for\n * a tooltip.\n *\n * Worth asserting rather than assuming, twice over: the directive sets it on\n * the OVERLAY PANE, not on the content a consumer wrote, and in tooltip mode\n * the pane is deliberately the only element carrying it — the text panel\n * inside has none, or the description would nest a tooltip in a tooltip.\n */\n async getRole(): Promise<string | null> {\n return (await this.panel()).getAttribute('role');\n }\n\n /**\n * The panel's accessible name — `null` in tooltip mode.\n *\n * A popover is a named `role=\"dialog\"`: the `ariaLabel` input, or the i18n\n * catalog's `popover.label` when the consumer says nothing, because an unnamed\n * dialog announces as \"dialog\" and nothing else. A tooltip has no name of its\n * own; it IS the trigger's description, which is `getDescriptionText()`.\n */\n async getLabel(): Promise<string | null> {\n return (await this.panel()).getAttribute('aria-label');\n }\n\n /**\n * Whether the panel claims modality.\n *\n * `false`, deliberately, and worth pinning: the popover sets\n * `aria-modal=\"false\"` because focus is NOT trapped and the panel dismisses on\n * outside click / Escape rather than blocking the page.\n */\n async isModal(): Promise<boolean> {\n return (await (await this.panel()).getAttribute('aria-modal')) === 'true';\n }\n\n /**\n * Where the panel sits relative to the trigger, or `null` when the pane\n * carries no placement class.\n *\n * The APPLIED position, not the requested one: CDK flips a placement that does\n * not fit to the next in its fallback chain and swaps the modifier class with\n * it. Under a unit test that is always the requested placement — jsdom measures\n * every box as 0×0, so the first candidate always \"fits\" — but in a browser the\n * two can differ, and this answers what is on screen. The directive defaults\n * the request per mode (`bottom` for a popover, `top` for a tooltip).\n *\n * The arrow itself is a `::after` pseudo-element, so it exists for no DOM query\n * at all; this class is the placement, and it is what the arrow's own CSS keys\n * off.\n */\n async getPosition(): Promise<WrPopoverPosition | null> {\n const classes = (await (await this.panel()).getAttribute('class')) ?? '';\n const modifier = /wr-(?:popover|tooltip)-overlay--([a-z-]+)/.exec(classes);\n return modifier ? (modifier[1] as WrPopoverPosition) : null;\n }\n\n /**\n * The text a screen reader reads as the TRIGGER'S DESCRIPTION, or `null` when\n * it describes nothing.\n *\n * This resolves `aria-describedby` the way an assistive technology would, so\n * it answers the whole of tooltip mode's naming contract in one call. Always\n * `null` for a popover, open or shut — a popover is a thing the trigger owns\n * (`aria-haspopup` / `aria-expanded`), never a description of it.\n */\n async getDescriptionText(): Promise<string | null> {\n const id = await (await this.host()).getAttribute('aria-describedby');\n if (!id) return null;\n\n const described = await this.documentRootLocatorFactory().locatorForOptional(`#${id}`)();\n return described ? described.text() : null;\n }\n\n /**\n * Harnesses for the consumer's own components are resolved inside THIS\n * instance's panel.\n *\n * Scoped by the published id rather than by `.wr-popover-overlay`: the overlay\n * container is shared, so a class query would answer with whichever popover\n * opened first.\n */\n protected override async getRootHarnessLoader(): Promise<HarnessLoader> {\n return this.documentRootLocatorFactory().harnessLoaderFor(`#${await this.panelId()}`);\n }\n\n /** Poll until `isOpen()` reports `open`, and say whether it did. */\n private async settled(open: boolean, timeout: number): Promise<boolean> {\n for (let waited = 0; waited <= timeout; waited += POLL_STEP) {\n if ((await this.isOpen()) === open) return true;\n\n await sleep(POLL_STEP);\n await this.forceStabilize();\n }\n return false;\n }\n\n /** This instance's overlay pane. */\n private async panel(): Promise<TestElement> {\n return this.documentRootLocatorFactory().locatorFor(`#${await this.panelId()}`)();\n }\n\n /** The id the trigger publishes for its panel, which only exists while the panel does. */\n private async panelId(): Promise<string> {\n const attribute = (await this.getMode()) === 'popover' ? 'aria-controls' : 'aria-describedby';\n const id = await (await this.host()).getAttribute(attribute);\n\n if (!id) {\n throw new Error(\n `WrPopoverHarness: nothing is showing. The trigger publishes its panel id as ${attribute} only ` +\n 'while the panel is open — call open() first (a tooltip also has to wait out its showDelay).'\n );\n }\n return id;\n }\n}\n"],"mappings":";;;;;;;AAoBA,MAAM,kBAAkB;AAGxB,MAAM,YAAY;AAYlB,MAAM,iBAAiB,WAAW;AAElC,SAAS,MAAM,IAAU;CACvB,OAAO,IAAI,SAAQ,YAAU;EAC3B,eAAe,SAAS,EAAE;CAC5B,CAAC;AACH;AAwCA,IAAa,mBAAb,MAAa,yBAAyB,iCAAgC;CAWpE,OAAO,eAAe;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