ngwr 16.0.0 → 16.2.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 +8 -4
- package/button/styles/_index.scss +13 -7
- package/cascader/styles/_rules.scss +4 -2
- package/checkbox/styles/_index.scss +4 -2
- package/date-picker/styles/_index.scss +95 -3
- package/date-stamp/styles/_index.scss +38 -0
- package/dialog/styles/_index.scss +38 -0
- package/dropdown/styles/_index.scss +37 -1
- package/fesm2022/internal-CVLvP9b_.mjs +33 -0
- package/fesm2022/internal-CVLvP9b_.mjs.map +1 -0
- package/fesm2022/ngwr-alert.mjs +11 -7
- package/fesm2022/ngwr-alert.mjs.map +1 -1
- package/fesm2022/ngwr-avatar.mjs +11 -7
- package/fesm2022/ngwr-avatar.mjs.map +1 -1
- package/fesm2022/ngwr-back-top.mjs +10 -6
- package/fesm2022/ngwr-back-top.mjs.map +1 -1
- package/fesm2022/ngwr-badge.mjs +18 -6
- package/fesm2022/ngwr-badge.mjs.map +1 -1
- package/fesm2022/ngwr-burger.mjs +9 -6
- package/fesm2022/ngwr-burger.mjs.map +1 -1
- package/fesm2022/ngwr-button.mjs +8 -4
- package/fesm2022/ngwr-button.mjs.map +1 -1
- package/fesm2022/ngwr-calendar.mjs +19 -8
- package/fesm2022/ngwr-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-card.mjs +9 -5
- package/fesm2022/ngwr-card.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +11 -5
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs +5 -2
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
- package/fesm2022/ngwr-checkbox.mjs +10 -6
- package/fesm2022/ngwr-checkbox.mjs.map +1 -1
- package/fesm2022/ngwr-clipboard.mjs +2 -1
- package/fesm2022/ngwr-clipboard.mjs.map +1 -1
- package/fesm2022/ngwr-collapse.mjs +9 -5
- package/fesm2022/ngwr-collapse.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +4 -2
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-comment.mjs +13 -7
- package/fesm2022/ngwr-comment.mjs.map +1 -1
- package/fesm2022/ngwr-compare.mjs +9 -3
- package/fesm2022/ngwr-compare.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +4 -2
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-copy-value.mjs +11 -6
- package/fesm2022/ngwr-copy-value.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker-testing.mjs +18 -0
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +238 -38
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-date-stamp-testing.mjs +34 -0
- package/fesm2022/ngwr-date-stamp-testing.mjs.map +1 -0
- package/fesm2022/ngwr-date-stamp.mjs +213 -0
- package/fesm2022/ngwr-date-stamp.mjs.map +1 -0
- package/fesm2022/ngwr-date.mjs +364 -54
- package/fesm2022/ngwr-date.mjs.map +1 -1
- package/fesm2022/ngwr-descriptions.mjs +9 -5
- package/fesm2022/ngwr-descriptions.mjs.map +1 -1
- package/fesm2022/ngwr-dialog-testing.mjs +23 -2
- package/fesm2022/ngwr-dialog-testing.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +45 -16
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-directives.mjs +102 -11
- package/fesm2022/ngwr-directives.mjs.map +1 -1
- package/fesm2022/ngwr-divider.mjs +4 -2
- package/fesm2022/ngwr-divider.mjs.map +1 -1
- package/fesm2022/ngwr-drawer.mjs +29 -3
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown-testing.mjs +38 -3
- package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +362 -26
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-editor.mjs +5 -2
- package/fesm2022/ngwr-editor.mjs.map +1 -1
- package/fesm2022/ngwr-event-calendar.mjs +4 -2
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +9 -3
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-form.mjs +18 -6
- package/fesm2022/ngwr-form.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ar.mjs +9 -2
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +9 -2
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +9 -2
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +9 -2
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +9 -2
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +9 -2
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +9 -2
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +9 -2
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +9 -2
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +9 -2
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +9 -2
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +9 -2
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +9 -2
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +9 -2
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +9 -2
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +9 -2
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +9 -2
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +9 -2
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +9 -2
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +9 -2
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +9 -2
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +9 -2
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +34 -8
- package/fesm2022/ngwr-i18n.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +9 -3
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +4 -2
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +20 -10
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-keyboard.mjs +9 -3
- package/fesm2022/ngwr-keyboard.mjs.map +1 -1
- package/fesm2022/ngwr-knob.mjs +9 -3
- package/fesm2022/ngwr-knob.mjs.map +1 -1
- package/fesm2022/ngwr-layout.mjs +13 -5
- package/fesm2022/ngwr-layout.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox-testing.mjs +26 -0
- package/fesm2022/ngwr-lightbox-testing.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +255 -15
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-list.mjs +13 -5
- package/fesm2022/ngwr-list.mjs.map +1 -1
- package/fesm2022/ngwr-load-state.mjs +9 -5
- package/fesm2022/ngwr-load-state.mjs.map +1 -1
- package/fesm2022/ngwr-overlay.mjs +84 -1
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +3 -2
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +47 -9
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +93 -4
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-progress.mjs +4 -2
- package/fesm2022/ngwr-progress.mjs.map +1 -1
- package/fesm2022/ngwr-radio.mjs +9 -5
- package/fesm2022/ngwr-radio.mjs.map +1 -1
- package/fesm2022/ngwr-rating.mjs +9 -3
- package/fesm2022/ngwr-rating.mjs.map +1 -1
- package/fesm2022/ngwr-resizable.mjs +503 -0
- package/fesm2022/ngwr-resizable.mjs.map +1 -0
- package/fesm2022/ngwr-result.mjs +9 -5
- package/fesm2022/ngwr-result.mjs.map +1 -1
- package/fesm2022/ngwr-schema-form.mjs +3 -0
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-segmented.mjs +4 -2
- package/fesm2022/ngwr-segmented.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +13 -5
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-skeleton.mjs +4 -2
- package/fesm2022/ngwr-skeleton.mjs.map +1 -1
- package/fesm2022/ngwr-slider-testing.mjs +17 -0
- package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +91 -13
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-sortable-list-testing.mjs +103 -0
- package/fesm2022/ngwr-sortable-list-testing.mjs.map +1 -0
- package/fesm2022/ngwr-sortable-list.mjs +257 -53
- package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
- package/fesm2022/ngwr-speed-dial.mjs +4 -2
- package/fesm2022/ngwr-speed-dial.mjs.map +1 -1
- package/fesm2022/ngwr-spinner.mjs +4 -2
- package/fesm2022/ngwr-spinner.mjs.map +1 -1
- package/fesm2022/ngwr-splitter.mjs +17 -21
- package/fesm2022/ngwr-splitter.mjs.map +1 -1
- package/fesm2022/ngwr-stepper.mjs +9 -3
- package/fesm2022/ngwr-stepper.mjs.map +1 -1
- package/fesm2022/ngwr-switch.mjs +9 -5
- package/fesm2022/ngwr-switch.mjs.map +1 -1
- package/fesm2022/ngwr-table-testing.mjs +5 -1
- package/fesm2022/ngwr-table-testing.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +167 -10
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-textarea.mjs +9 -3
- package/fesm2022/ngwr-textarea.mjs.map +1 -1
- package/fesm2022/ngwr-timeline.mjs +18 -8
- package/fesm2022/ngwr-timeline.mjs.map +1 -1
- package/fesm2022/ngwr-toast-testing.mjs +6 -1
- package/fesm2022/ngwr-toast-testing.mjs.map +1 -1
- package/fesm2022/ngwr-toast.mjs +529 -104
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-transfer.mjs +4 -2
- package/fesm2022/ngwr-transfer.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +4 -2
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-typography.mjs +9 -3
- package/fesm2022/ngwr-typography.mjs.map +1 -1
- package/fesm2022/ngwr-utils-router.mjs +18 -2
- package/fesm2022/ngwr-utils-router.mjs.map +1 -1
- package/fesm2022/ngwr-utils.mjs +9 -2
- 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-window.mjs +7 -4
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/fesm2022/ngwr.mjs.map +1 -1
- package/i18n/ar.json +13 -2
- package/i18n/cs.json +13 -2
- package/i18n/de.json +13 -2
- package/i18n/en.json +13 -2
- package/i18n/es.json +13 -2
- package/i18n/fr.json +13 -2
- package/i18n/he.json +13 -2
- package/i18n/hi.json +13 -2
- package/i18n/id.json +13 -2
- package/i18n/it.json +13 -2
- package/i18n/ja.json +13 -2
- package/i18n/ko.json +13 -2
- package/i18n/nl.json +13 -2
- package/i18n/pl.json +13 -2
- package/i18n/pt.json +13 -2
- package/i18n/ru.json +13 -2
- package/i18n/sv.json +13 -2
- package/i18n/tr.json +13 -2
- package/i18n/uk.json +13 -2
- package/i18n/vi.json +13 -2
- package/i18n/zh-TW.json +13 -2
- package/i18n/zh.json +13 -2
- package/input/styles/_index.scss +10 -5
- package/input-number/styles/_index.scss +6 -3
- package/input-otp/styles/_index.scss +4 -2
- package/lightbox/styles/_rules.scss +96 -0
- package/llms-full.txt +40 -17
- package/llms.txt +20 -4
- package/package.json +19 -1
- package/radio/styles/_index.scss +4 -2
- package/resizable/styles/_index.scss +154 -0
- package/schematics/use/rule.js +1 -0
- package/schematics/use/symbol-map.json +5 -0
- package/select/styles/_index.scss +6 -3
- package/skills/ngwr/SKILL.md +1 -1
- package/skills/ngwr/references/catalog.md +6 -2
- package/skills/ngwr/references/setup.md +3 -0
- package/slider/styles/_index.scss +106 -0
- package/sortable-list/styles/_rules.scss +23 -1
- package/switch/styles/_index.scss +4 -2
- package/table/styles/_index.scss +53 -0
- package/textarea/styles/_index.scss +4 -2
- package/theme/styles/_motion.scss +6 -0
- package/toast/styles/_index.scss +19 -0
- package/types/ngwr-burger.d.ts +0 -1
- package/types/ngwr-calendar.d.ts +7 -0
- package/types/ngwr-charts-calendar-heatmap.d.ts +2 -1
- package/types/ngwr-clipboard.d.ts +7 -0
- package/types/ngwr-date-picker-testing.d.ts +17 -0
- package/types/ngwr-date-picker.d.ts +88 -4
- package/types/ngwr-date-stamp-testing.d.ts +47 -0
- package/types/ngwr-date-stamp.d.ts +127 -0
- package/types/ngwr-date.d.ts +251 -37
- package/types/ngwr-dialog-testing.d.ts +10 -0
- package/types/ngwr-dialog.d.ts +72 -4
- package/types/ngwr-directives.d.ts +36 -1
- package/types/ngwr-drawer.d.ts +21 -0
- package/types/ngwr-dropdown-testing.d.ts +53 -5
- package/types/ngwr-dropdown.d.ts +100 -0
- package/types/ngwr-i18n.d.ts +44 -14
- package/types/ngwr-lightbox-testing.d.ts +27 -0
- package/types/ngwr-lightbox.d.ts +71 -6
- package/types/ngwr-overlay.d.ts +36 -0
- package/types/ngwr-pipes.d.ts +48 -13
- package/types/ngwr-popover.d.ts +39 -1
- package/types/ngwr-resizable.d.ts +228 -0
- package/types/ngwr-slider-testing.d.ts +8 -1
- package/types/ngwr-slider.d.ts +89 -3
- package/types/ngwr-sortable-list-testing.d.ts +79 -0
- package/types/ngwr-sortable-list.d.ts +113 -10
- package/types/ngwr-table-testing.d.ts +3 -1
- package/types/ngwr-table.d.ts +120 -4
- package/types/ngwr-toast-testing.d.ts +12 -1
- package/types/ngwr-toast.d.ts +215 -18
- package/types/ngwr-utils-router.d.ts +22 -0
- package/types/ngwr-utils.d.ts +8 -1
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr.d.ts +1 -0
package/badge/styles/_tag.scss
CHANGED
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
transition: var(--wr-transition-base);
|
|
51
51
|
|
|
52
52
|
// Shape
|
|
53
|
-
&--rounded
|
|
53
|
+
&--rounded,
|
|
54
|
+
&:where([rounded]:not([rounded='false'])) {
|
|
54
55
|
--wr-tag-radius: var(--wr-border-radius-pill);
|
|
55
56
|
--wr-tag-padding-x: var(--wr-space-md);
|
|
56
57
|
}
|
|
@@ -77,7 +78,8 @@
|
|
|
77
78
|
|
|
78
79
|
// Colored variants
|
|
79
80
|
@each $name in theme.$colors {
|
|
80
|
-
&--#{$name}
|
|
81
|
+
&--#{$name},
|
|
82
|
+
&:where([color='#{$name}']) {
|
|
81
83
|
--wr-tag-color: var(--wr-color-#{$name}-contrast);
|
|
82
84
|
--wr-tag-bg: var(--wr-color-#{$name});
|
|
83
85
|
--wr-tag-border: var(--wr-color-#{$name});
|
|
@@ -88,13 +90,15 @@
|
|
|
88
90
|
// whole visual change here. The 6% fill stays, and that is the one place
|
|
89
91
|
// the two deliberately differ: a tag is a chip you can click, hover and
|
|
90
92
|
// dismiss, so it keeps a body the badge has none of.
|
|
91
|
-
&.wr-tag--outlined
|
|
93
|
+
&.wr-tag--outlined,
|
|
94
|
+
&:where([outlined]:not([outlined='false'])) {
|
|
92
95
|
--wr-tag-color: var(--wr-color-#{$name}-ink);
|
|
93
96
|
--wr-tag-bg: color-mix(in srgb, var(--wr-color-#{$name}) 6%, transparent);
|
|
94
97
|
--wr-tag-border: var(--wr-color-#{$name}-soft-border);
|
|
95
98
|
}
|
|
96
99
|
|
|
97
|
-
&.wr-tag--transparent
|
|
100
|
+
&.wr-tag--transparent,
|
|
101
|
+
&:where([transparent]:not([transparent='false'])) {
|
|
98
102
|
--wr-tag-color: var(--wr-color-#{$name}-ink);
|
|
99
103
|
--wr-tag-bg: color-mix(in srgb, var(--wr-color-#{$name}) 10%, transparent);
|
|
100
104
|
--wr-tag-border: transparent;
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
//
|
|
142
142
|
// `block` is excluded — it is width:100% by contract, and squaring it would
|
|
143
143
|
// turn a full-width button into a giant tile.
|
|
144
|
-
&:has(> &__label:empty):not(&--block) {
|
|
144
|
+
&:has(> &__label:empty):not(&--block, &:where([block]:not([block='false']))) {
|
|
145
145
|
padding-inline: calc(var(--wr-btn-padding-y) * var(--wr-density-y, 1));
|
|
146
146
|
|
|
147
147
|
.wr-btn__icon {
|
|
@@ -175,7 +175,8 @@
|
|
|
175
175
|
// three `--wr-control-*-sm` tokens are shared so button, input and select line
|
|
176
176
|
// up in a row, and 22px is the number `/guides/tokens/sizing` publishes.
|
|
177
177
|
// Space the targets, or use `md` where they sit together.
|
|
178
|
-
&--sm
|
|
178
|
+
&--sm,
|
|
179
|
+
&:where([size='sm']) {
|
|
179
180
|
--wr-btn-radius: var(--wr-control-radius-sm);
|
|
180
181
|
--wr-btn-gap: var(--wr-space-xs);
|
|
181
182
|
--wr-btn-padding-y: var(--wr-control-padding-y-sm);
|
|
@@ -185,7 +186,8 @@
|
|
|
185
186
|
--wr-btn-icon-size: 0.875rem; // 14px
|
|
186
187
|
}
|
|
187
188
|
|
|
188
|
-
&--lg
|
|
189
|
+
&--lg,
|
|
190
|
+
&:where([size='lg']) {
|
|
189
191
|
--wr-btn-radius: var(--wr-control-radius-lg);
|
|
190
192
|
--wr-btn-gap: var(--wr-space-md);
|
|
191
193
|
--wr-btn-padding-y: var(--wr-control-padding-y-lg);
|
|
@@ -217,7 +219,8 @@
|
|
|
217
219
|
}
|
|
218
220
|
|
|
219
221
|
// Layout
|
|
220
|
-
&--block
|
|
222
|
+
&--block,
|
|
223
|
+
&:where([block]:not([block='false'])) {
|
|
221
224
|
display: flex;
|
|
222
225
|
width: 100%;
|
|
223
226
|
}
|
|
@@ -249,7 +252,8 @@
|
|
|
249
252
|
// wherever a removed intent had been, and the docs page put the two side by
|
|
250
253
|
// side. Transparent rather than a tint: the border is the whole of what
|
|
251
254
|
// outlined means here, and the surface behind it belongs to the host.
|
|
252
|
-
&--outlined
|
|
255
|
+
&--outlined,
|
|
256
|
+
&:where([outlined]:not([outlined='false'])) {
|
|
253
257
|
--wr-btn-bg: transparent;
|
|
254
258
|
|
|
255
259
|
&:hover {
|
|
@@ -263,7 +267,8 @@
|
|
|
263
267
|
|
|
264
268
|
// Color variants
|
|
265
269
|
@each $name in theme.$colors {
|
|
266
|
-
&--#{$name}
|
|
270
|
+
&--#{$name},
|
|
271
|
+
&:where([color='#{$name}']) {
|
|
267
272
|
--wr-btn-color: var(--wr-color-#{$name}-contrast);
|
|
268
273
|
--wr-btn-bg: var(--wr-color-#{$name});
|
|
269
274
|
--wr-btn-border: var(--wr-color-#{$name});
|
|
@@ -278,7 +283,8 @@
|
|
|
278
283
|
--wr-btn-border: var(--wr-color-#{$name}-darker);
|
|
279
284
|
}
|
|
280
285
|
|
|
281
|
-
&.wr-btn--outlined
|
|
286
|
+
&.wr-btn--outlined,
|
|
287
|
+
&:where([outlined]:not([outlined='false'])) {
|
|
282
288
|
// `-ink`, not the bare intent. The label is TEXT on whatever surface the
|
|
283
289
|
// host gives the transparent button, and the bare token does not clear
|
|
284
290
|
// AA there: `#3567ff` on the dark canvas measures 4.06:1, and in light
|
|
@@ -73,7 +73,8 @@
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
// Sizes — trigger on the control contract (sm 22 / md 30 / lg 36).
|
|
76
|
-
&--sm
|
|
76
|
+
&--sm,
|
|
77
|
+
&:where([size='sm']) {
|
|
77
78
|
--wr-cascader-radius: var(--wr-control-radius-sm);
|
|
78
79
|
--wr-cascader-padding-y: var(--wr-control-padding-y-sm);
|
|
79
80
|
--wr-cascader-padding-x: var(--wr-control-padding-x-sm);
|
|
@@ -81,7 +82,8 @@
|
|
|
81
82
|
--wr-cascader-line-height: var(--wr-control-line-height-sm);
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
&--lg
|
|
85
|
+
&--lg,
|
|
86
|
+
&:where([size='lg']) {
|
|
85
87
|
--wr-cascader-radius: var(--wr-control-radius-lg);
|
|
86
88
|
--wr-cascader-padding-y: var(--wr-control-padding-y-lg);
|
|
87
89
|
--wr-cascader-padding-x: var(--wr-control-padding-x-lg);
|
|
@@ -100,14 +100,16 @@
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
// Sizes — box, radius, label font + line-height scale together.
|
|
103
|
-
&--sm
|
|
103
|
+
&--sm,
|
|
104
|
+
&:where([size='sm']) {
|
|
104
105
|
--wr-checkbox-size: 1rem; // 16px
|
|
105
106
|
--wr-checkbox-radius: var(--wr-control-radius-sm);
|
|
106
107
|
--wr-checkbox-font-size: var(--wr-text-xs);
|
|
107
108
|
--wr-checkbox-line-height: var(--wr-control-line-height-sm);
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
&--lg
|
|
111
|
+
&--lg,
|
|
112
|
+
&:where([size='lg']) {
|
|
111
113
|
--wr-checkbox-size: 1.25rem; // 20px
|
|
112
114
|
--wr-checkbox-radius: var(--wr-control-radius-lg);
|
|
113
115
|
--wr-checkbox-font-size: var(--wr-text-base);
|
|
@@ -122,7 +122,9 @@
|
|
|
122
122
|
// `wr-input--<size>` themselves; the group and the trigger are their siblings and
|
|
123
123
|
// read the size from the host. Both pickers draw the same trigger.
|
|
124
124
|
.wr-date-picker--sm,
|
|
125
|
-
.wr-date-
|
|
125
|
+
.wr-date-picker:where([size='sm']),
|
|
126
|
+
.wr-date-range-picker--sm,
|
|
127
|
+
.wr-date-range-picker:where([size='sm']) {
|
|
126
128
|
> .wr-input-group {
|
|
127
129
|
--wr-input-group-radius: var(--wr-control-radius-sm);
|
|
128
130
|
--wr-input-group-padding-x: var(--wr-control-padding-x-sm);
|
|
@@ -138,7 +140,9 @@
|
|
|
138
140
|
}
|
|
139
141
|
|
|
140
142
|
.wr-date-picker--lg,
|
|
141
|
-
.wr-date-
|
|
143
|
+
.wr-date-picker:where([size='lg']),
|
|
144
|
+
.wr-date-range-picker--lg,
|
|
145
|
+
.wr-date-range-picker:where([size='lg']) {
|
|
142
146
|
> .wr-input-group {
|
|
143
147
|
--wr-input-group-radius: var(--wr-control-radius-lg);
|
|
144
148
|
--wr-input-group-padding-x: var(--wr-control-padding-x-lg);
|
|
@@ -440,7 +444,8 @@
|
|
|
440
444
|
flex-direction: column;
|
|
441
445
|
gap: 0;
|
|
442
446
|
|
|
443
|
-
&--timed
|
|
447
|
+
&--timed,
|
|
448
|
+
&--presets {
|
|
444
449
|
--wr-date-range-panel-bg: var(--wr-color-surface);
|
|
445
450
|
--wr-date-range-panel-border: var(--wr-border-base);
|
|
446
451
|
--wr-date-range-panel-radius: var(--wr-border-radius-base);
|
|
@@ -459,6 +464,17 @@
|
|
|
459
464
|
}
|
|
460
465
|
}
|
|
461
466
|
|
|
467
|
+
// The presets take the start column and the calendar and the time row share
|
|
468
|
+
// the other.
|
|
469
|
+
&--presets {
|
|
470
|
+
display: inline-grid;
|
|
471
|
+
grid-template-columns: auto auto;
|
|
472
|
+
|
|
473
|
+
> .wr-date-range-presets {
|
|
474
|
+
grid-row: 1 / span 2;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
462
478
|
&__times {
|
|
463
479
|
--wr-date-range-panel-times-gap-y: var(--wr-space-md);
|
|
464
480
|
--wr-date-range-panel-times-gap-x: var(--wr-space-xl);
|
|
@@ -488,3 +504,79 @@
|
|
|
488
504
|
font-weight: var(--wr-date-range-panel-time-label-font-weight);
|
|
489
505
|
}
|
|
490
506
|
}
|
|
507
|
+
|
|
508
|
+
// One-click ranges on the start side of the range panel.
|
|
509
|
+
.wr-date-range-presets {
|
|
510
|
+
--wr-date-range-presets-width: 9rem;
|
|
511
|
+
--wr-date-range-presets-gap: var(--wr-space-xs);
|
|
512
|
+
--wr-date-range-presets-padding: var(--wr-space-sm);
|
|
513
|
+
--wr-date-range-presets-border: var(--wr-border-base);
|
|
514
|
+
--wr-date-range-presets-color: var(--wr-color-on-surface);
|
|
515
|
+
--wr-date-range-presets-hover-bg: var(--wr-color-hover);
|
|
516
|
+
--wr-date-range-presets-active-bg: var(--wr-color-primary-soft);
|
|
517
|
+
--wr-date-range-presets-active-color: var(--wr-color-primary-ink);
|
|
518
|
+
--wr-date-range-presets-item-padding-y: var(--wr-space-xs);
|
|
519
|
+
--wr-date-range-presets-item-padding-x: var(--wr-space-sm);
|
|
520
|
+
--wr-date-range-presets-item-radius: var(--wr-border-radius-sm);
|
|
521
|
+
--wr-date-range-presets-font-family: var(--wr-font-family-base);
|
|
522
|
+
--wr-date-range-presets-font-size: var(--wr-text-sm);
|
|
523
|
+
--wr-date-range-presets-line-height: var(--wr-text-sm-leading);
|
|
524
|
+
|
|
525
|
+
display: flex;
|
|
526
|
+
flex-direction: column;
|
|
527
|
+
gap: var(--wr-date-range-presets-gap);
|
|
528
|
+
box-sizing: border-box;
|
|
529
|
+
inline-size: var(--wr-date-range-presets-width);
|
|
530
|
+
padding: var(--wr-date-range-presets-padding);
|
|
531
|
+
border-inline-end: 1px solid var(--wr-date-range-presets-border);
|
|
532
|
+
|
|
533
|
+
&__item {
|
|
534
|
+
appearance: none;
|
|
535
|
+
padding: var(--wr-date-range-presets-item-padding-y) var(--wr-date-range-presets-item-padding-x);
|
|
536
|
+
background: transparent;
|
|
537
|
+
border: 0;
|
|
538
|
+
border-radius: var(--wr-date-range-presets-item-radius);
|
|
539
|
+
color: var(--wr-date-range-presets-color);
|
|
540
|
+
font-family: var(--wr-date-range-presets-font-family);
|
|
541
|
+
font-size: var(--wr-date-range-presets-font-size);
|
|
542
|
+
line-height: var(--wr-date-range-presets-line-height);
|
|
543
|
+
text-align: start;
|
|
544
|
+
cursor: pointer;
|
|
545
|
+
transition:
|
|
546
|
+
color var(--wr-transition-base),
|
|
547
|
+
background var(--wr-transition-base);
|
|
548
|
+
|
|
549
|
+
&:hover:not(:disabled) {
|
|
550
|
+
background: var(--wr-date-range-presets-hover-bg);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
&:focus-visible {
|
|
554
|
+
@include theme.focus-ring;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
&:disabled {
|
|
558
|
+
cursor: not-allowed;
|
|
559
|
+
opacity: var(--wr-disabled-opacity);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
&--active,
|
|
563
|
+
&--active:hover:not(:disabled) {
|
|
564
|
+
background: var(--wr-date-range-presets-active-bg);
|
|
565
|
+
color: var(--wr-date-range-presets-active-color);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
// A phone has no room for a side column: the presets wrap above the calendar.
|
|
571
|
+
@media (max-width: 480px) {
|
|
572
|
+
.wr-date-range-panel--presets {
|
|
573
|
+
display: inline-flex;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.wr-date-range-presets {
|
|
577
|
+
flex-flow: row wrap;
|
|
578
|
+
inline-size: auto;
|
|
579
|
+
border-inline-end: 0;
|
|
580
|
+
border-block-end: 1px solid var(--wr-date-range-presets-border);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
@use '../../theme/styles' as theme;
|
|
2
|
+
|
|
3
|
+
@include theme.loaded('date-stamp');
|
|
4
|
+
|
|
5
|
+
.wr-date-stamp {
|
|
6
|
+
--wr-date-stamp-gap: 0;
|
|
7
|
+
--wr-date-stamp-line-height: var(--wr-text-sm-leading);
|
|
8
|
+
--wr-date-stamp-date-color: inherit;
|
|
9
|
+
--wr-date-stamp-time-color: var(--wr-color-on-surface-muted);
|
|
10
|
+
--wr-date-stamp-time-font-size: var(--wr-text-sm);
|
|
11
|
+
--wr-date-stamp-empty-color: var(--wr-color-on-surface-muted);
|
|
12
|
+
|
|
13
|
+
display: inline-block;
|
|
14
|
+
// A column of stamps lines up digit under digit.
|
|
15
|
+
font-variant-numeric: tabular-nums;
|
|
16
|
+
line-height: var(--wr-date-stamp-line-height);
|
|
17
|
+
white-space: nowrap;
|
|
18
|
+
vertical-align: middle;
|
|
19
|
+
|
|
20
|
+
&__value {
|
|
21
|
+
display: inline-flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
gap: var(--wr-date-stamp-gap);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&__date {
|
|
27
|
+
color: var(--wr-date-stamp-date-color);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&__time {
|
|
31
|
+
color: var(--wr-date-stamp-time-color);
|
|
32
|
+
font-size: var(--wr-date-stamp-time-font-size);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&__empty {
|
|
36
|
+
color: var(--wr-date-stamp-empty-color);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -86,6 +86,12 @@
|
|
|
86
86
|
--wr-dialog-close-radius: var(--wr-border-radius-sm);
|
|
87
87
|
--wr-dialog-close-font-size: var(--wr-text-base);
|
|
88
88
|
--wr-dialog-footer-gap: var(--wr-space-sm);
|
|
89
|
+
--wr-dialog-intent-size: 1.25rem;
|
|
90
|
+
--wr-dialog-intent-gap: var(--wr-space-sm);
|
|
91
|
+
--wr-dialog-intent-info: var(--wr-color-info);
|
|
92
|
+
--wr-dialog-intent-success: var(--wr-color-success);
|
|
93
|
+
--wr-dialog-intent-warning: var(--wr-color-warning);
|
|
94
|
+
--wr-dialog-intent-danger: var(--wr-color-danger);
|
|
89
95
|
|
|
90
96
|
display: flex;
|
|
91
97
|
flex-direction: column;
|
|
@@ -248,6 +254,38 @@
|
|
|
248
254
|
}
|
|
249
255
|
}
|
|
250
256
|
|
|
257
|
+
// `confirm()` and `alert()`: the intent icon sits before the title as a flex
|
|
258
|
+
// item, so a title that wraps keeps its lines clear of the icon.
|
|
259
|
+
.wr-dialog-confirm {
|
|
260
|
+
.wr-dialog__title {
|
|
261
|
+
display: flex;
|
|
262
|
+
align-items: flex-start;
|
|
263
|
+
gap: var(--wr-dialog-intent-gap);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
&__icon {
|
|
267
|
+
flex: 0 0 auto;
|
|
268
|
+
width: var(--wr-dialog-intent-size);
|
|
269
|
+
height: var(--wr-dialog-intent-size);
|
|
270
|
+
// Centred on the title's first line.
|
|
271
|
+
margin-block-start: calc((var(--wr-dialog-title-line-height) - var(--wr-dialog-intent-size)) / 2);
|
|
272
|
+
|
|
273
|
+
// Written out, not looped: `gen:css-vars` reads the hooks from the source.
|
|
274
|
+
&--info {
|
|
275
|
+
color: var(--wr-dialog-intent-info);
|
|
276
|
+
}
|
|
277
|
+
&--success {
|
|
278
|
+
color: var(--wr-dialog-intent-success);
|
|
279
|
+
}
|
|
280
|
+
&--warning {
|
|
281
|
+
color: var(--wr-dialog-intent-warning);
|
|
282
|
+
}
|
|
283
|
+
&--danger {
|
|
284
|
+
color: var(--wr-dialog-intent-danger);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
251
289
|
@keyframes wr-dialog-enter {
|
|
252
290
|
from {
|
|
253
291
|
opacity: 0;
|
|
@@ -134,7 +134,16 @@ $arrow-gap: 0.5rem;
|
|
|
134
134
|
$panel: '> .wr-dropdown-menu',
|
|
135
135
|
$background: var(--wr-dropdown-bg),
|
|
136
136
|
$border: var(--wr-dropdown-border),
|
|
137
|
-
$placements-used: (
|
|
137
|
+
$placements-used: (
|
|
138
|
+
top,
|
|
139
|
+
top-start,
|
|
140
|
+
top-end,
|
|
141
|
+
bottom,
|
|
142
|
+
bottom-start,
|
|
143
|
+
bottom-end,
|
|
144
|
+
left,
|
|
145
|
+
right,
|
|
146
|
+
)
|
|
138
147
|
);
|
|
139
148
|
|
|
140
149
|
// `[arrow]="false"` — the directive leaves `--arrow` off the pane and the square
|
|
@@ -152,6 +161,8 @@ $arrow-gap: 0.5rem;
|
|
|
152
161
|
--wr-dropdown-item-radius: var(--wr-border-radius-sm);
|
|
153
162
|
--wr-dropdown-item-font-size: var(--wr-text-sm);
|
|
154
163
|
--wr-dropdown-item-line-height: var(--wr-text-sm-leading);
|
|
164
|
+
--wr-dropdown-item-chevron-size: 0.375rem;
|
|
165
|
+
--wr-dropdown-item-chevron-color: var(--wr-color-on-surface-muted);
|
|
155
166
|
|
|
156
167
|
display: flex;
|
|
157
168
|
align-items: center;
|
|
@@ -203,3 +214,28 @@ $arrow-gap: 0.5rem;
|
|
|
203
214
|
}
|
|
204
215
|
}
|
|
205
216
|
}
|
|
217
|
+
|
|
218
|
+
// An item that opens a submenu. The chevron is two borders of a rotated box:
|
|
219
|
+
// decorative, so it is generated content and never reaches the item's name.
|
|
220
|
+
.wr-dropdown-submenu-trigger {
|
|
221
|
+
&::after {
|
|
222
|
+
content: '';
|
|
223
|
+
flex: 0 0 auto;
|
|
224
|
+
inline-size: var(--wr-dropdown-item-chevron-size);
|
|
225
|
+
block-size: var(--wr-dropdown-item-chevron-size);
|
|
226
|
+
margin-inline-start: auto;
|
|
227
|
+
border-block-start: 1.5px solid var(--wr-dropdown-item-chevron-color);
|
|
228
|
+
border-inline-end: 1.5px solid var(--wr-dropdown-item-chevron-color);
|
|
229
|
+
rotate: 45deg;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// The submenus cascade toward the inline end, so the chevron turns with them.
|
|
233
|
+
[dir='rtl'] &::after {
|
|
234
|
+
rotate: -45deg;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// The path to the open submenu stays marked while the pointer is inside it.
|
|
238
|
+
&[aria-expanded='true'] {
|
|
239
|
+
background: var(--wr-dropdown-item-bg-hover);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
6
|
+
*/
|
|
7
|
+
function wrSeparatorKeyMove(event, axis, rtl) {
|
|
8
|
+
if (event.key === "Home") return "min";
|
|
9
|
+
if (event.key === "End") return "max";
|
|
10
|
+
if (axis === "inline") {
|
|
11
|
+
const forward = rtl ? -1 : 1;
|
|
12
|
+
if (event.key === "ArrowLeft") return -forward;
|
|
13
|
+
if (event.key === "ArrowRight") return forward;
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
if (event.key === "ArrowUp") return -1;
|
|
17
|
+
if (event.key === "ArrowDown") return 1;
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
function wrBeginSeparatorDrag(event) {
|
|
21
|
+
if (event.button !== 0 || !event.isPrimary) return false;
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
const separator = event.currentTarget;
|
|
24
|
+
separator.setPointerCapture(event.pointerId);
|
|
25
|
+
separator.focus();
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
function wrEndSeparatorDrag(event) {
|
|
29
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
30
|
+
}
|
|
31
|
+
export { wrEndSeparatorDrag as n, wrSeparatorKeyMove as r, wrBeginSeparatorDrag as t };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=internal-CVLvP9b_.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-CVLvP9b_.mjs","names":[],"sources":["../../../projects/lib/splitter/internal/separator.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\n/**\n * Where a key sends a focusable `role=\"separator\"`: one step toward the low\n * (`-1`) or the high (`1`) end of its axis, or straight to a bound.\n *\n * @internal\n */\nexport type WrSeparatorKeyMove = -1 | 1 | 'min' | 'max';\n\n/**\n * Reads a `keydown` on a separator. `axis` is the one the separator MOVES\n * along: `inline` for a vertical separator, `block` for a horizontal one.\n *\n * Arrows follow the VISUAL axis (WAI-ARIA APG). Under `dir=\"rtl\"` the inline\n * axis starts on the right, so the visual right is its low end and ArrowRight\n * answers `-1`: otherwise the separator walks away from the key being pressed.\n * The block axis is unaffected by `dir`. Home and End are semantic (first and\n * last, not left and right), so they never mirror. The arrows of the other axis\n * and every other key answer `null`, and the caller leaves the event alone.\n *\n * @internal\n */\nexport function wrSeparatorKeyMove(\n event: KeyboardEvent,\n axis: 'inline' | 'block',\n rtl: boolean\n): WrSeparatorKeyMove | null {\n if (event.key === 'Home') return 'min';\n if (event.key === 'End') return 'max';\n if (axis === 'inline') {\n const forward = rtl ? -1 : 1;\n if (event.key === 'ArrowLeft') return -forward as -1 | 1;\n if (event.key === 'ArrowRight') return forward;\n return null;\n }\n if (event.key === 'ArrowUp') return -1;\n if (event.key === 'ArrowDown') return 1;\n return null;\n}\n\n/**\n * Starts a drag from a `pointerdown` on a separator, and answers whether it did.\n *\n * Only the primary button of the primary pointer drags: holding the right\n * button over the separator and moving used to resize, and the same guard keeps\n * a second finger from taking over a drag in progress. The pointer is captured\n * so the drag survives leaving the separator, an iframe and a canvas included.\n * `preventDefault` also suppresses the press's default focus, so the separator\n * is focused by hand: without it the arrows do nothing after a mouse drag until\n * the user finds the separator again with Tab.\n *\n * @internal\n */\nexport function wrBeginSeparatorDrag(event: PointerEvent): boolean {\n if (event.button !== 0 || !event.isPrimary) return false;\n event.preventDefault();\n const separator = event.currentTarget as HTMLElement;\n separator.setPointerCapture(event.pointerId);\n separator.focus();\n return true;\n}\n\n/**\n * Ends the drag {@link wrBeginSeparatorDrag} started, from the `pointerup` or\n * `pointercancel` that closes it.\n *\n * @internal\n */\nexport function wrEndSeparatorDrag(event: PointerEvent): void {\n (event.currentTarget as HTMLElement).releasePointerCapture(event.pointerId);\n}\n"],"mappings":";;;;;;AA4BA,SAAgB,mBACd,OACA,MACA,KAAY;CAEZ,IAAI,MAAM,QAAQ,QAAQ,OAAO;CACjC,IAAI,MAAM,QAAQ,OAAO,OAAO;CAChC,IAAI,SAAS,UAAU;EACrB,MAAM,UAAU,MAAM,KAAK;EAC3B,IAAI,MAAM,QAAQ,aAAa,OAAO,CAAC;EACvC,IAAI,MAAM,QAAQ,cAAc,OAAO;EACvC,OAAO;CACT;CACA,IAAI,MAAM,QAAQ,WAAW,OAAO;CACpC,IAAI,MAAM,QAAQ,aAAa,OAAO;CACtC,OAAO;AACT;AAeA,SAAgB,qBAAqB,OAAmB;CACtD,IAAI,MAAM,WAAW,KAAK,CAAC,MAAM,WAAW,OAAO;CACnD,MAAM,eAAc;CACpB,MAAM,YAAY,MAAM;CACxB,UAAU,kBAAkB,MAAM,SAAS;CAC3C,UAAU,MAAK;CACf,OAAO;AACT;AAQA,SAAgB,mBAAmB,OAAmB;CACnD,MAAM,cAA8B,sBAAsB,MAAM,SAAS;AAC5E"}
|
package/fesm2022/ngwr-alert.mjs
CHANGED
|
@@ -31,7 +31,7 @@ var WrAlert = class WrAlert {
|
|
|
31
31
|
closed = output();
|
|
32
32
|
dismissed = signal(false, ...ngDevMode ? [{ debugName: "dismissed" }] : /* istanbul ignore next */ []);
|
|
33
33
|
classes = computed(() => {
|
|
34
|
-
const parts = [
|
|
34
|
+
const parts = [`wr-alert--${this.type()}`];
|
|
35
35
|
if (this.dismissed()) parts.push("wr-alert--dismissed");
|
|
36
36
|
return parts.join(" ");
|
|
37
37
|
}, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
@@ -121,12 +121,15 @@ var WrAlert = class WrAlert {
|
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
outputs: { closed: "closed" },
|
|
124
|
-
host: {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
124
|
+
host: {
|
|
125
|
+
properties: {
|
|
126
|
+
"attr.title": "null",
|
|
127
|
+
"class": "classes()",
|
|
128
|
+
"attr.role": "liveRole()",
|
|
129
|
+
"attr.aria-live": "liveLevel()"
|
|
130
|
+
},
|
|
131
|
+
classAttribute: "wr-alert"
|
|
132
|
+
},
|
|
130
133
|
ngImport: i0,
|
|
131
134
|
template: "@if (!dismissed()) {\n @if (iconName(); as n) {\n <wr-icon class=\"wr-alert__icon\" [name]=\"n\" />\n } @else if (icon()) {\n <svg\n class=\"wr-alert__icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n @switch (type()) {\n @case ('success') {\n <path d=\"M21.801 10A10 10 0 1 1 17 3.335\" />\n <path d=\"m9 11 3 3L22 4\" />\n }\n @case ('warning') {\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n }\n <!-- An OCTAGON, and the shape is the point. `danger` used to be a\n circle holding a bar over a dot, which is the vertical mirror of\n the `i` the @default branch draws — at the rendered 18px the two\n differ only by where a 1.5px gap sits. The stop-sign silhouette\n reads at that size and survives greyscale, which a mirrored gap\n does not. -->\n @case ('danger') {\n <path\n d=\"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\"\n />\n <path d=\"M12 8v4\" />\n <path d=\"M12 16h.01\" />\n }\n <!-- A bar, not the exclamation mark `danger` used to carry: `neutral`\n emitted that glyph byte for byte. The icon is the whole difference\n between these two, because what the component actually paints —\n `danger-ink` #a32a33 (L 0.0968) against `on-surface-muted` #5f6c7d\n (L 0.1464) on tints 1.036:1 apart — is a hue difference and little\n else. -->\n @case ('neutral') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M8 12h8\" />\n }\n @case ('offline') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m4.9 4.9 14.2 14.2\" />\n }\n @default {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n }\n }\n </svg>\n }\n\n <div class=\"wr-alert__body\">\n @if (title(); as t) {\n <p class=\"wr-alert__title\">{{ t }}</p>\n @if (message(); as m) {\n <p class=\"wr-alert__message\">{{ m }}</p>\n }\n } @else if (message(); as m) {\n <p class=\"wr-alert__title\">{{ m }}</p>\n }\n <div class=\"wr-alert__content\"><ng-content /></div>\n <div class=\"wr-alert__actions\"><ng-content select=\"[wrAlertActions]\" /></div>\n </div>\n\n @if (closable()) {\n <button type=\"button\" class=\"wr-alert__close\" [attr.aria-label]=\"resolvedCloseLabel()\" (click)=\"onClose()\">\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </button>\n }\n}\n",
|
|
132
135
|
dependencies: [{
|
|
@@ -151,6 +154,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
151
154
|
encapsulation: ViewEncapsulation.None,
|
|
152
155
|
host: {
|
|
153
156
|
"[attr.title]": "null",
|
|
157
|
+
class: "wr-alert",
|
|
154
158
|
"[class]": "classes()",
|
|
155
159
|
"[attr.role]": "liveRole()",
|
|
156
160
|
"[attr.aria-live]": "liveLevel()"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-alert.mjs","names":[],"sources":["../../../projects/lib/alert/alert.ts","../../../projects/lib/alert/alert.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n ElementRef,\n Injector,\n ViewEncapsulation,\n afterNextRender,\n computed,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { wrGetFocusableElements, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrAlertType } from './types';\n\n/**\n * Inline status banner. Use for feedback messages — saved/failed/notice etc.\n * Content placed inside renders below the message, in `.wr-alert__content`.\n *\n * Slots:\n *\n * - **Default** — text under the message.\n * - **`[wrAlertActions]`** — buttons under the message, in a row that wraps.\n *\n * @example\n * ```html\n * <wr-alert title=\"Saved\" message=\"Your changes are live.\" type=\"success\" />\n * <wr-alert title=\"Failed\" type=\"danger\" closable (closed)=\"onClose()\" />\n * <wr-alert title=\"Sync failed\" type=\"danger\">Request <code>8f2c41</code> timed out.</wr-alert>\n * <wr-alert title=\"Update available\" type=\"info\">\n * <wr-btn wrAlertActions size=\"sm\" (click)=\"update()\">Install</wr-btn>\n * </wr-alert>\n * ```\n *\n * @see https://ngwr.dev/reference/components/alert\n */\n@Component({\n selector: 'wr-alert',\n templateUrl: './alert.html',\n imports: [WrIcon],\n encapsulation: ViewEncapsulation.None,\n host: {\n // `title` is an input, and a static attribute that feeds an input is ALSO\n // written onto the host — where the browser shows it as a native tooltip\n // over the whole component, and where it feeds the accessible name of any\n // element that has a role. `<wr-alert title=\"Heads up\">` is the documented\n // spelling, so every page writing it shipped both. A bound `[title]` never\n // did this, which is why the two forms behaved differently for no reason a\n // reader could see.\n '[attr.title]': 'null',\n '[class]': 'classes()',\n '[attr.role]': 'liveRole()',\n '[attr.aria-live]': 'liveLevel()',\n },\n})\nexport class WrAlert {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('alert');\n }\n\n /** Accessible name. Falls back to `alert.close`, then `'Close alert'`. */\n readonly closeLabel = input<string | null>(null);\n\n protected readonly resolvedCloseLabel = useI18nText(this.closeLabel, 'alert.close', 'Close alert');\n\n /**\n * Optional headline shown at the top of the alert.\n *\n * @default null\n */\n readonly title = input<string | null>(null);\n\n /**\n * Visual variant.\n *\n * @default 'info'\n */\n readonly type = input<WrAlertType>('info');\n\n /**\n * Override the default per-type icon with any ngwr icon name.\n *\n * @default null\n */\n readonly iconName = input<WrIconName | null>(null);\n\n /**\n * Optional secondary message rendered below the title.\n *\n * @default null\n */\n readonly message = input<string | null>(null);\n\n /**\n * When `true`, renders a leading status icon matching the `type`.\n * Pass `false` to hide. Ignored when `iconName` is set.\n *\n * @default true\n */\n readonly icon = input(true, { transform: coerceBooleanProperty });\n\n /**\n * When `true`, renders a close button.\n *\n * @default false\n */\n readonly closable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Emitted when the user dismisses the alert via the close button. If the close\n * button had focus, focus moves on to the next focusable element after the alert\n * (or the one before it, when nothing follows) — unless a `(closed)` handler has\n * placed it somewhere itself.\n */\n readonly closed = output<void>();\n\n protected readonly dismissed = signal(false);\n\n protected readonly classes = computed(() => {\n const parts = ['wr-alert', `wr-alert--${this.type()}`];\n if (this.dismissed()) parts.push('wr-alert--dismissed');\n return parts.join(' ');\n });\n\n /** Escalate role/aria-live for danger/warning alerts. */\n protected readonly liveRole = computed(() =>\n this.dismissed() ? null : this.type() === 'danger' ? 'alert' : 'status'\n );\n protected readonly liveLevel = computed(() =>\n this.dismissed() ? null : this.type() === 'danger' || this.type() === 'warning' ? 'assertive' : 'polite'\n );\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly injector = inject(Injector);\n\n protected onClose(): void {\n const host = this.host.nativeElement;\n const hadFocus = host.contains(host.ownerDocument.activeElement);\n this.dismissed.set(true);\n this.closed.emit();\n if (hadFocus) afterNextRender(() => this.handOnFocus(), { injector: this.injector });\n }\n\n /**\n * The close button is removed with the rest of the content, and a focused element\n * that leaves the DOM drops the caret on `<body>`: a keyboard user's next Tab, and\n * a screen reader's reading position, started over from the top of the page. Run\n * after the render that removed it, so a `(closed)` handler that moved focus on\n * purpose is seen and left alone.\n */\n private handOnFocus(): void {\n const host = this.host.nativeElement;\n const doc = host.ownerDocument;\n const active = doc.activeElement;\n if (active && active !== doc.body) return;\n // Tab stops only: a roving composite parks its other items at -1. The host has\n // nothing focusable left inside it, so every stop is either before or after it.\n const stops = wrGetFocusableElements(doc.body).filter(el => el.tabIndex >= 0);\n // eslint-disable-next-line no-bitwise -- compareDocumentPosition answers with a bitmask\n const after = stops.findIndex(el => (host.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0);\n (after >= 0 ? stops[after] : stops.at(-1))?.focus();\n }\n}\n","@if (!dismissed()) {\n @if (iconName(); as n) {\n <wr-icon class=\"wr-alert__icon\" [name]=\"n\" />\n } @else if (icon()) {\n <svg\n class=\"wr-alert__icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n @switch (type()) {\n @case ('success') {\n <path d=\"M21.801 10A10 10 0 1 1 17 3.335\" />\n <path d=\"m9 11 3 3L22 4\" />\n }\n @case ('warning') {\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n }\n <!-- An OCTAGON, and the shape is the point. `danger` used to be a\n circle holding a bar over a dot, which is the vertical mirror of\n the `i` the @default branch draws — at the rendered 18px the two\n differ only by where a 1.5px gap sits. The stop-sign silhouette\n reads at that size and survives greyscale, which a mirrored gap\n does not. -->\n @case ('danger') {\n <path\n d=\"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\"\n />\n <path d=\"M12 8v4\" />\n <path d=\"M12 16h.01\" />\n }\n <!-- A bar, not the exclamation mark `danger` used to carry: `neutral`\n emitted that glyph byte for byte. The icon is the whole difference\n between these two, because what the component actually paints —\n `danger-ink` #a32a33 (L 0.0968) against `on-surface-muted` #5f6c7d\n (L 0.1464) on tints 1.036:1 apart — is a hue difference and little\n else. -->\n @case ('neutral') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M8 12h8\" />\n }\n @case ('offline') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m4.9 4.9 14.2 14.2\" />\n }\n @default {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n }\n }\n </svg>\n }\n\n <div class=\"wr-alert__body\">\n @if (title(); as t) {\n <p class=\"wr-alert__title\">{{ t }}</p>\n @if (message(); as m) {\n <p class=\"wr-alert__message\">{{ m }}</p>\n }\n } @else if (message(); as m) {\n <p class=\"wr-alert__title\">{{ m }}</p>\n }\n <div class=\"wr-alert__content\"><ng-content /></div>\n <div class=\"wr-alert__actions\"><ng-content select=\"[wrAlertActions]\" /></div>\n </div>\n\n @if (closable()) {\n <button type=\"button\" class=\"wr-alert__close\" [attr.aria-label]=\"resolvedCloseLabel()\" (click)=\"onClose()\">\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </button>\n }\n}\n"],"mappings":";;;;;;;;;;;;AAmEA,IAAa,UAAb,MAAa,QAAO;CAClB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,OAAO;CAC1E;CAGS,aAAa,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CAE7B,qBAAqB,YAAY,KAAK,YAAY,eAAe,aAAa;CAOxF,QAAQ,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;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AA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA,EAAA,QAAA,SAAA;EAAA,MAAA,EAAA,YAAA;GAAA,cAAA;GAAA,SAAA;GAAA,aAAA;GAAA,kBAAA;EAAA,EAAA;EAAA,UAAA;EAAA,UCnEpB;EA6FA,cAAA,CAAA;GAAA,MAAA;GAAA,MD1CY;GAAM,UAAA;GAAA,QAAA,CAAA,MAAA;EAAA,CAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAgBL,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAO,YAAA,CAAA;EAnBnB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAU,SAEX,CAAC,MAAM;GAAC,eACF,kBAAkB;GAAI,MAC/B;IAQJ,gBAAgB;IAChB,WAAW;IACX,eAAe;IACf,oBAAoB;GACrB;GAAA,UAAA;EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-alert.mjs","names":[],"sources":["../../../projects/lib/alert/alert.ts","../../../projects/lib/alert/alert.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n ElementRef,\n Injector,\n ViewEncapsulation,\n afterNextRender,\n computed,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { wrGetFocusableElements, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrAlertType } from './types';\n\n/**\n * Inline status banner. Use for feedback messages — saved/failed/notice etc.\n * Content placed inside renders below the message, in `.wr-alert__content`.\n *\n * Slots:\n *\n * - **Default** — text under the message.\n * - **`[wrAlertActions]`** — buttons under the message, in a row that wraps.\n *\n * @example\n * ```html\n * <wr-alert title=\"Saved\" message=\"Your changes are live.\" type=\"success\" />\n * <wr-alert title=\"Failed\" type=\"danger\" closable (closed)=\"onClose()\" />\n * <wr-alert title=\"Sync failed\" type=\"danger\">Request <code>8f2c41</code> timed out.</wr-alert>\n * <wr-alert title=\"Update available\" type=\"info\">\n * <wr-btn wrAlertActions size=\"sm\" (click)=\"update()\">Install</wr-btn>\n * </wr-alert>\n * ```\n *\n * @see https://ngwr.dev/reference/components/alert\n */\n@Component({\n selector: 'wr-alert',\n templateUrl: './alert.html',\n imports: [WrIcon],\n encapsulation: ViewEncapsulation.None,\n host: {\n // `title` is an input, and a static attribute that feeds an input is ALSO\n // written onto the host — where the browser shows it as a native tooltip\n // over the whole component, and where it feeds the accessible name of any\n // element that has a role. `<wr-alert title=\"Heads up\">` is the documented\n // spelling, so every page writing it shipped both. A bound `[title]` never\n // did this, which is why the two forms behaved differently for no reason a\n // reader could see.\n '[attr.title]': 'null',\n class: 'wr-alert',\n '[class]': 'classes()',\n '[attr.role]': 'liveRole()',\n '[attr.aria-live]': 'liveLevel()',\n },\n})\nexport class WrAlert {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('alert');\n }\n\n /** Accessible name. Falls back to `alert.close`, then `'Close alert'`. */\n readonly closeLabel = input<string | null>(null);\n\n protected readonly resolvedCloseLabel = useI18nText(this.closeLabel, 'alert.close', 'Close alert');\n\n /**\n * Optional headline shown at the top of the alert.\n *\n * @default null\n */\n readonly title = input<string | null>(null);\n\n /**\n * Visual variant.\n *\n * @default 'info'\n */\n readonly type = input<WrAlertType>('info');\n\n /**\n * Override the default per-type icon with any ngwr icon name.\n *\n * @default null\n */\n readonly iconName = input<WrIconName | null>(null);\n\n /**\n * Optional secondary message rendered below the title.\n *\n * @default null\n */\n readonly message = input<string | null>(null);\n\n /**\n * When `true`, renders a leading status icon matching the `type`.\n * Pass `false` to hide. Ignored when `iconName` is set.\n *\n * @default true\n */\n readonly icon = input(true, { transform: coerceBooleanProperty });\n\n /**\n * When `true`, renders a close button.\n *\n * @default false\n */\n readonly closable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Emitted when the user dismisses the alert via the close button. If the close\n * button had focus, focus moves on to the next focusable element after the alert\n * (or the one before it, when nothing follows) — unless a `(closed)` handler has\n * placed it somewhere itself.\n */\n readonly closed = output<void>();\n\n protected readonly dismissed = signal(false);\n\n protected readonly classes = computed(() => {\n const parts = [`wr-alert--${this.type()}`];\n if (this.dismissed()) parts.push('wr-alert--dismissed');\n return parts.join(' ');\n });\n\n /** Escalate role/aria-live for danger/warning alerts. */\n protected readonly liveRole = computed(() =>\n this.dismissed() ? null : this.type() === 'danger' ? 'alert' : 'status'\n );\n protected readonly liveLevel = computed(() =>\n this.dismissed() ? null : this.type() === 'danger' || this.type() === 'warning' ? 'assertive' : 'polite'\n );\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly injector = inject(Injector);\n\n protected onClose(): void {\n const host = this.host.nativeElement;\n const hadFocus = host.contains(host.ownerDocument.activeElement);\n this.dismissed.set(true);\n this.closed.emit();\n if (hadFocus) afterNextRender(() => this.handOnFocus(), { injector: this.injector });\n }\n\n /**\n * The close button is removed with the rest of the content, and a focused element\n * that leaves the DOM drops the caret on `<body>`: a keyboard user's next Tab, and\n * a screen reader's reading position, started over from the top of the page. Run\n * after the render that removed it, so a `(closed)` handler that moved focus on\n * purpose is seen and left alone.\n */\n private handOnFocus(): void {\n const host = this.host.nativeElement;\n const doc = host.ownerDocument;\n const active = doc.activeElement;\n if (active && active !== doc.body) return;\n // Tab stops only: a roving composite parks its other items at -1. The host has\n // nothing focusable left inside it, so every stop is either before or after it.\n const stops = wrGetFocusableElements(doc.body).filter(el => el.tabIndex >= 0);\n // eslint-disable-next-line no-bitwise -- compareDocumentPosition answers with a bitmask\n const after = stops.findIndex(el => (host.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0);\n (after >= 0 ? stops[after] : stops.at(-1))?.focus();\n }\n}\n","@if (!dismissed()) {\n @if (iconName(); as n) {\n <wr-icon class=\"wr-alert__icon\" [name]=\"n\" />\n } @else if (icon()) {\n <svg\n class=\"wr-alert__icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n @switch (type()) {\n @case ('success') {\n <path d=\"M21.801 10A10 10 0 1 1 17 3.335\" />\n <path d=\"m9 11 3 3L22 4\" />\n }\n @case ('warning') {\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n }\n <!-- An OCTAGON, and the shape is the point. `danger` used to be a\n circle holding a bar over a dot, which is the vertical mirror of\n the `i` the @default branch draws — at the rendered 18px the two\n differ only by where a 1.5px gap sits. The stop-sign silhouette\n reads at that size and survives greyscale, which a mirrored gap\n does not. -->\n @case ('danger') {\n <path\n d=\"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\"\n />\n <path d=\"M12 8v4\" />\n <path d=\"M12 16h.01\" />\n }\n <!-- A bar, not the exclamation mark `danger` used to carry: `neutral`\n emitted that glyph byte for byte. The icon is the whole difference\n between these two, because what the component actually paints —\n `danger-ink` #a32a33 (L 0.0968) against `on-surface-muted` #5f6c7d\n (L 0.1464) on tints 1.036:1 apart — is a hue difference and little\n else. -->\n @case ('neutral') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M8 12h8\" />\n }\n @case ('offline') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m4.9 4.9 14.2 14.2\" />\n }\n @default {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n }\n }\n </svg>\n }\n\n <div class=\"wr-alert__body\">\n @if (title(); as t) {\n <p class=\"wr-alert__title\">{{ t }}</p>\n @if (message(); as m) {\n <p class=\"wr-alert__message\">{{ m }}</p>\n }\n } @else if (message(); as m) {\n <p class=\"wr-alert__title\">{{ m }}</p>\n }\n <div class=\"wr-alert__content\"><ng-content /></div>\n <div class=\"wr-alert__actions\"><ng-content select=\"[wrAlertActions]\" /></div>\n </div>\n\n @if (closable()) {\n <button type=\"button\" class=\"wr-alert__close\" [attr.aria-label]=\"resolvedCloseLabel()\" (click)=\"onClose()\">\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </button>\n }\n}\n"],"mappings":";;;;;;;;;;;;AAoEA,IAAa,UAAb,MAAa,QAAO;CAClB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,OAAO;CAC1E;CAGS,aAAa,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CAE7B,qBAAqB,YAAY,KAAK,YAAY,eAAe,aAAa;CAOxF,QAAQ,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAOlC,OAAO,MAAmB,QAAO,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CA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mBAAA;GAAA;EAAA;EAAA,SAAA,EAAA,QAAA,SAAA;EAAA,MAAA;GAAA,YAAA;IAAA,cAAA;IAAA,SAAA;IAAA,aAAA;IAAA,kBAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UCpEpB;EA6FA,cAAA,CAAA;GAAA,MAAA;GAAA,MD1CY;GAAM,UAAA;GAAA,QAAA,CAAA,MAAA;EAAA,CAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAiBL,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAO,YAAA,CAAA;EApBnB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAU,SAEX,CAAC,MAAM;GAAC,eACF,kBAAkB;GAAI,MAC/B;IAQJ,gBAAgB;IAChB,OAAO;IACP,WAAW;IACX,eAAe;IACf,oBAAoB;GACrB;GAAA,UAAA;EAAA,CAAA"}
|
package/fesm2022/ngwr-avatar.mjs
CHANGED
|
@@ -83,7 +83,7 @@ var WrAvatar = class WrAvatar {
|
|
|
83
83
|
cssSize = computed(() => this.resolved().cssValue, ...ngDevMode ? [{ debugName: "cssSize" }] : /* istanbul ignore next */ []);
|
|
84
84
|
pxSize = computed(() => this.resolved().pxValue, ...ngDevMode ? [{ debugName: "pxSize" }] : /* istanbul ignore next */ []);
|
|
85
85
|
classes = computed(() => {
|
|
86
|
-
const parts = [
|
|
86
|
+
const parts = [];
|
|
87
87
|
const shape = this.shape();
|
|
88
88
|
if (shape !== "rounded") parts.push(`wr-avatar--${shape}`);
|
|
89
89
|
if (this.loaded()) parts.push("wr-avatar--loaded");
|
|
@@ -155,12 +155,15 @@ var WrAvatar = class WrAvatar {
|
|
|
155
155
|
transformFunction: null
|
|
156
156
|
}
|
|
157
157
|
},
|
|
158
|
-
host: {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
158
|
+
host: {
|
|
159
|
+
properties: {
|
|
160
|
+
"class": "classes()",
|
|
161
|
+
"style.width": "cssSize()",
|
|
162
|
+
"style.height": "cssSize()",
|
|
163
|
+
"style.--wr-avatar-size": "cssSize()"
|
|
164
|
+
},
|
|
165
|
+
classAttribute: "wr-avatar"
|
|
166
|
+
},
|
|
164
167
|
viewQueries: [{
|
|
165
168
|
propertyName: "img",
|
|
166
169
|
first: true,
|
|
@@ -190,6 +193,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
190
193
|
selector: "wr-avatar",
|
|
191
194
|
encapsulation: ViewEncapsulation.None,
|
|
192
195
|
host: {
|
|
196
|
+
class: "wr-avatar",
|
|
193
197
|
"[class]": "classes()",
|
|
194
198
|
"[style.width]": "cssSize()",
|
|
195
199
|
"[style.height]": "cssSize()",
|