ngwr 16.0.0 → 16.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +6 -2
- package/date-stamp/styles/_index.scss +38 -0
- package/dialog/styles/_index.scss +38 -0
- 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.mjs +86 -30
- 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 +149 -0
- package/fesm2022/ngwr-date-stamp.mjs.map +1 -0
- package/fesm2022/ngwr-date.mjs +279 -50
- 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.mjs +4 -2
- 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 +2 -0
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +2 -0
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +2 -0
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +2 -0
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +2 -0
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +2 -0
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +2 -0
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +2 -0
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +2 -0
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +2 -0
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +2 -0
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +2 -0
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +2 -0
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +2 -0
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +2 -0
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +2 -0
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +2 -0
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +2 -0
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +2 -0
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +2 -0
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +2 -0
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +2 -0
- 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.mjs +9 -5
- 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 +21 -5
- 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-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.mjs +4 -2
- package/fesm2022/ngwr-slider.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 +6 -0
- package/i18n/cs.json +6 -0
- package/i18n/de.json +6 -0
- package/i18n/en.json +6 -0
- package/i18n/es.json +6 -0
- package/i18n/fr.json +6 -0
- package/i18n/he.json +6 -0
- package/i18n/hi.json +6 -0
- package/i18n/id.json +6 -0
- package/i18n/it.json +6 -0
- package/i18n/ja.json +6 -0
- package/i18n/ko.json +6 -0
- package/i18n/nl.json +6 -0
- package/i18n/pl.json +6 -0
- package/i18n/pt.json +6 -0
- package/i18n/ru.json +6 -0
- package/i18n/sv.json +6 -0
- package/i18n/tr.json +6 -0
- package/i18n/uk.json +6 -0
- package/i18n/vi.json +6 -0
- package/i18n/zh-TW.json +6 -0
- package/i18n/zh.json +6 -0
- package/input/styles/_index.scss +10 -5
- package/input-number/styles/_index.scss +6 -3
- package/input-otp/styles/_index.scss +4 -2
- package/llms-full.txt +29 -10
- package/llms.txt +8 -4
- package/package.json +15 -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 +4 -0
- package/select/styles/_index.scss +6 -3
- package/skills/ngwr/SKILL.md +1 -1
- package/skills/ngwr/references/catalog.md +4 -1
- package/skills/ngwr/references/setup.md +3 -0
- 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.d.ts +9 -2
- package/types/ngwr-date-stamp-testing.d.ts +47 -0
- package/types/ngwr-date-stamp.d.ts +81 -0
- package/types/ngwr-date.d.ts +135 -24
- 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-i18n.d.ts +44 -14
- package/types/ngwr-overlay.d.ts +36 -0
- package/types/ngwr-pipes.d.ts +15 -0
- package/types/ngwr-popover.d.ts +39 -1
- package/types/ngwr-resizable.d.ts +228 -0
- 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/fesm2022/ngwr-badge.mjs
CHANGED
|
@@ -22,7 +22,7 @@ var WrBadge = class WrBadge {
|
|
|
22
22
|
transform: coerceBooleanProperty
|
|
23
23
|
});
|
|
24
24
|
classes = computed(() => {
|
|
25
|
-
const parts = [
|
|
25
|
+
const parts = [];
|
|
26
26
|
const color = this.color();
|
|
27
27
|
if (color) parts.push(`wr-badge--${color}`);
|
|
28
28
|
const size = this.size();
|
|
@@ -76,7 +76,10 @@ var WrBadge = class WrBadge {
|
|
|
76
76
|
transformFunction: null
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
|
-
host: {
|
|
79
|
+
host: {
|
|
80
|
+
properties: { "class": "classes()" },
|
|
81
|
+
classAttribute: "wr-badge"
|
|
82
|
+
},
|
|
80
83
|
ngImport: i0,
|
|
81
84
|
template: "<ng-content />",
|
|
82
85
|
isInline: true,
|
|
@@ -94,7 +97,10 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
94
97
|
selector: "wr-badge",
|
|
95
98
|
template: "<ng-content />",
|
|
96
99
|
encapsulation: ViewEncapsulation.None,
|
|
97
|
-
host: {
|
|
100
|
+
host: {
|
|
101
|
+
class: "wr-badge",
|
|
102
|
+
"[class]": "classes()"
|
|
103
|
+
}
|
|
98
104
|
}]
|
|
99
105
|
}],
|
|
100
106
|
ctorParameters: () => [],
|
|
@@ -167,7 +173,7 @@ var WrTag = class WrTag {
|
|
|
167
173
|
transform: coerceBooleanProperty
|
|
168
174
|
});
|
|
169
175
|
classes = computed(() => {
|
|
170
|
-
const parts = [
|
|
176
|
+
const parts = [];
|
|
171
177
|
const color = this.color();
|
|
172
178
|
if (color) parts.push(`wr-tag--${color}`);
|
|
173
179
|
if (this.outlined()) parts.push("wr-tag--outlined");
|
|
@@ -250,7 +256,10 @@ var WrTag = class WrTag {
|
|
|
250
256
|
transformFunction: null
|
|
251
257
|
}
|
|
252
258
|
},
|
|
253
|
-
host: {
|
|
259
|
+
host: {
|
|
260
|
+
properties: { "class": "classes()" },
|
|
261
|
+
classAttribute: "wr-tag"
|
|
262
|
+
},
|
|
254
263
|
ngImport: i0,
|
|
255
264
|
template: "@if (iconPosition() === 'start') {\n @if (loading()) {\n <wr-spinner class=\"wr-tag__adornment\" size=\"sm\" />\n } @else if (icon(); as name) {\n <wr-icon class=\"wr-tag__adornment\" [name]=\"name\" />\n }\n}\n\n<ng-content />\n\n@if (iconPosition() === 'end') {\n @if (loading()) {\n <wr-spinner class=\"wr-tag__adornment\" size=\"sm\" />\n } @else if (icon(); as name) {\n <wr-icon class=\"wr-tag__adornment\" [name]=\"name\" />\n }\n}\n",
|
|
256
265
|
dependencies: [{
|
|
@@ -277,7 +286,10 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
277
286
|
args: [{
|
|
278
287
|
selector: "wr-tag",
|
|
279
288
|
encapsulation: ViewEncapsulation.None,
|
|
280
|
-
host: {
|
|
289
|
+
host: {
|
|
290
|
+
class: "wr-tag",
|
|
291
|
+
"[class]": "classes()"
|
|
292
|
+
},
|
|
281
293
|
imports: [WrIcon, WrSpinner],
|
|
282
294
|
template: "@if (iconPosition() === 'start') {\n @if (loading()) {\n <wr-spinner class=\"wr-tag__adornment\" size=\"sm\" />\n } @else if (icon(); as name) {\n <wr-icon class=\"wr-tag__adornment\" [name]=\"name\" />\n }\n}\n\n<ng-content />\n\n@if (iconPosition() === 'end') {\n @if (loading()) {\n <wr-spinner class=\"wr-tag__adornment\" size=\"sm\" />\n } @else if (icon(); as name) {\n <wr-icon class=\"wr-tag__adornment\" [name]=\"name\" />\n }\n}\n"
|
|
283
295
|
}]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-badge.mjs","names":[],"sources":["../../../projects/lib/badge/badge.ts","../../../projects/lib/badge/tag.ts","../../../projects/lib/badge/tag.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 { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport type { WrColor } from 'ngwr/theme';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrBadgeShape, WrBadgeSize } from './types';\n\n/**\n * Lean chip — color, size, rounded/pill. Use for short labels and counts\n * (e.g. \"ONLINE\", \"3 unread\", \"v2.1\"), where the words say the state and the\n * colour decorates it. Reach for `<wr-tag>` when you need icons, loading\n * state, or outlined / transparent styles.\n *\n * @example\n * ```html\n * <wr-badge color=\"success\">Active</wr-badge>\n * <wr-badge color=\"danger\" size=\"sm\">3</wr-badge>\n * <wr-badge color=\"primary\" shape=\"pill\">New</wr-badge>\n * ```\n *\n * @see https://ngwr.dev/reference/components/badge\n */\n@Component({\n selector: 'wr-badge',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n },\n})\nexport class WrBadge {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('badge');\n }\n\n /**\n * Color variant. Maps to `--wr-color-*` CSS variables from the theme. It is\n * decoration or category, never the state on its own: four of the five intents\n * share one lightness and `success` against `danger` is 1.004:1, so the label\n * has to say the state (`Offline`, not a red `Status`). A badge draws no\n * icon — when a chip must stand for a status without words, use `<wr-tag>`\n * with its `icon` input.\n *\n * @default 'primary'\n */\n readonly color = input<WrColor | null>('primary');\n\n /**\n * Size variant.\n *\n * @default 'md'\n */\n readonly size = input<WrBadgeSize>('md');\n\n /**\n * Corner treatment. Mirrors `<wr-btn>` — `rounded` (default) uses the\n * small form-radius; `pill` rounds the ends fully.\n *\n * @default 'rounded'\n */\n readonly shape = input<WrBadgeShape>('rounded');\n\n /**\n * Outlined style — transparent fill, colored border and text.\n *\n * @default false\n */\n readonly outlined = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => {\n const parts = ['wr-badge'];\n\n const color = this.color();\n if (color) parts.push(`wr-badge--${color}`);\n\n const size = this.size();\n if (size !== 'md') {\n parts.push(`wr-badge--${size}`);\n }\n const shape = this.shape();\n if (shape !== 'rounded') {\n parts.push(`wr-badge--${shape}`);\n }\n if (this.outlined()) {\n parts.push('wr-badge--outlined');\n }\n return parts.join(' ');\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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { WrSpinner } from 'ngwr/spinner';\nimport type { WrColor } from 'ngwr/theme';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrTagIconPosition } from './types';\n\n/**\n * Rich inline label — icons, loading state, three visual styles\n * (solid / outlined / transparent). Reach for `<wr-badge>` when all\n * you need is a colored text chip.\n *\n * @example\n * ```html\n * <wr-tag>Default</wr-tag>\n * <wr-tag color=\"success\" icon=\"checkmark\">Done</wr-tag>\n * <wr-tag color=\"primary\" outlined rounded>Beta</wr-tag>\n * <wr-tag color=\"warning\" loading>Saving</wr-tag>\n * ```\n *\n * @see https://ngwr.dev/reference/components/badge\n */\n@Component({\n selector: 'wr-tag',\n templateUrl: './tag.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()' },\n imports: [WrIcon, WrSpinner],\n})\nexport class WrTag {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('badge');\n }\n\n /**\n * Color variant — decoration or category, never the state on its own. The\n * label carries the state (`Failed`, not a red `Build`): four of the five\n * intents share one lightness and `success` against `danger` is 1.004:1, so a\n * reader who cannot separate red from green cannot tell those two tags\n * apart, and `primary` and `info` are the same blue to everyone. When a tag has to stand\n * for a status by itself, give it an `icon` as well — register one with\n * `provideWrIcons(wrLucideIcons({ 'octagon-alert': OctagonAlert }))`, then write\n * `<wr-tag color=\"danger\" icon=\"octagon-alert\">Failed</wr-tag>`.\n *\n * @default 'primary'\n */\n readonly color = input<WrColor | null>('primary');\n\n /**\n * Icon name shown alongside the content — the one channel besides the label\n * that a tag has, so the one to reach for when colour is carrying a status.\n * Nothing ships built in: register the name through `provideWrIcons` first.\n * The icon is replaced by a spinner when `loading` is true.\n *\n * @default null\n */\n readonly icon = input<WrIconName | null>(null);\n\n /**\n * Where the icon/spinner is rendered.\n *\n * @default 'start'\n */\n readonly iconPosition = input<WrTagIconPosition>('start');\n\n /**\n * Outlined style — colored text and border on a tinted background.\n *\n * @default false\n */\n readonly outlined = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Transparent style — colored text on a low-opacity tint, no border.\n *\n * @default false\n */\n readonly transparent = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Pill-shaped corners.\n *\n * @default false\n */\n readonly rounded = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Adds a hover state — use when the tag is interactive (button/link).\n *\n * @default false\n */\n readonly hoverable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Show a spinner in place of the icon.\n *\n * @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => {\n const parts = ['wr-tag'];\n\n const color = this.color();\n if (color) parts.push(`wr-tag--${color}`);\n\n if (this.outlined()) parts.push('wr-tag--outlined');\n if (this.transparent()) parts.push('wr-tag--transparent');\n if (this.rounded()) parts.push('wr-tag--rounded');\n if (this.hoverable()) parts.push('wr-tag--hoverable');\n if (this.loading()) parts.push('wr-tag--loading');\n\n const hasAdornment = !!this.icon() || this.loading();\n if (hasAdornment) parts.push(`wr-tag--icon-${this.iconPosition()}`);\n\n return parts.join(' ');\n });\n}\n","@if (iconPosition() === 'start') {\n @if (loading()) {\n <wr-spinner class=\"wr-tag__adornment\" size=\"sm\" />\n } @else if (icon(); as name) {\n <wr-icon class=\"wr-tag__adornment\" [name]=\"name\" />\n }\n}\n\n<ng-content />\n\n@if (iconPosition() === 'end') {\n @if (loading()) {\n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/badge/tag.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 { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport type { WrColor } from 'ngwr/theme';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrBadgeShape, WrBadgeSize } from './types';\n\n/**\n * Lean chip — color, size, rounded/pill. Use for short labels and counts\n * (e.g. \"ONLINE\", \"3 unread\", \"v2.1\"), where the words say the state and the\n * colour decorates it. Reach for `<wr-tag>` when you need icons, loading\n * state, or outlined / transparent styles.\n *\n * @example\n * ```html\n * <wr-badge color=\"success\">Active</wr-badge>\n * <wr-badge color=\"danger\" size=\"sm\">3</wr-badge>\n * <wr-badge color=\"primary\" shape=\"pill\">New</wr-badge>\n * ```\n *\n * @see https://ngwr.dev/reference/components/badge\n */\n@Component({\n selector: 'wr-badge',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-badge',\n '[class]': 'classes()',\n },\n})\nexport class WrBadge {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('badge');\n }\n\n /**\n * Color variant. Maps to `--wr-color-*` CSS variables from the theme. It is\n * decoration or category, never the state on its own: four of the five intents\n * share one lightness and `success` against `danger` is 1.004:1, so the label\n * has to say the state (`Offline`, not a red `Status`). A badge draws no\n * icon — when a chip must stand for a status without words, use `<wr-tag>`\n * with its `icon` input.\n *\n * @default 'primary'\n */\n readonly color = input<WrColor | null>('primary');\n\n /**\n * Size variant.\n *\n * @default 'md'\n */\n readonly size = input<WrBadgeSize>('md');\n\n /**\n * Corner treatment. Mirrors `<wr-btn>` — `rounded` (default) uses the\n * small form-radius; `pill` rounds the ends fully.\n *\n * @default 'rounded'\n */\n readonly shape = input<WrBadgeShape>('rounded');\n\n /**\n * Outlined style — transparent fill, colored border and text.\n *\n * @default false\n */\n readonly outlined = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n\n const color = this.color();\n if (color) parts.push(`wr-badge--${color}`);\n\n const size = this.size();\n if (size !== 'md') {\n parts.push(`wr-badge--${size}`);\n }\n const shape = this.shape();\n if (shape !== 'rounded') {\n parts.push(`wr-badge--${shape}`);\n }\n if (this.outlined()) {\n parts.push('wr-badge--outlined');\n }\n return parts.join(' ');\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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { WrSpinner } from 'ngwr/spinner';\nimport type { WrColor } from 'ngwr/theme';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrTagIconPosition } from './types';\n\n/**\n * Rich inline label — icons, loading state, three visual styles\n * (solid / outlined / transparent). Reach for `<wr-badge>` when all\n * you need is a colored text chip.\n *\n * @example\n * ```html\n * <wr-tag>Default</wr-tag>\n * <wr-tag color=\"success\" icon=\"checkmark\">Done</wr-tag>\n * <wr-tag color=\"primary\" outlined rounded>Beta</wr-tag>\n * <wr-tag color=\"warning\" loading>Saving</wr-tag>\n * ```\n *\n * @see https://ngwr.dev/reference/components/badge\n */\n@Component({\n selector: 'wr-tag',\n templateUrl: './tag.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-tag', '[class]': 'classes()' },\n imports: [WrIcon, WrSpinner],\n})\nexport class WrTag {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('badge');\n }\n\n /**\n * Color variant — decoration or category, never the state on its own. The\n * label carries the state (`Failed`, not a red `Build`): four of the five\n * intents share one lightness and `success` against `danger` is 1.004:1, so a\n * reader who cannot separate red from green cannot tell those two tags\n * apart, and `primary` and `info` are the same blue to everyone. When a tag has to stand\n * for a status by itself, give it an `icon` as well — register one with\n * `provideWrIcons(wrLucideIcons({ 'octagon-alert': OctagonAlert }))`, then write\n * `<wr-tag color=\"danger\" icon=\"octagon-alert\">Failed</wr-tag>`.\n *\n * @default 'primary'\n */\n readonly color = input<WrColor | null>('primary');\n\n /**\n * Icon name shown alongside the content — the one channel besides the label\n * that a tag has, so the one to reach for when colour is carrying a status.\n * Nothing ships built in: register the name through `provideWrIcons` first.\n * The icon is replaced by a spinner when `loading` is true.\n *\n * @default null\n */\n readonly icon = input<WrIconName | null>(null);\n\n /**\n * Where the icon/spinner is rendered.\n *\n * @default 'start'\n */\n readonly iconPosition = input<WrTagIconPosition>('start');\n\n /**\n * Outlined style — colored text and border on a tinted background.\n *\n * @default false\n */\n readonly outlined = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Transparent style — colored text on a low-opacity tint, no border.\n *\n * @default false\n */\n readonly transparent = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Pill-shaped corners.\n *\n * @default false\n */\n readonly rounded = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Adds a hover state — use when the tag is interactive (button/link).\n *\n * @default false\n */\n readonly hoverable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Show a spinner in place of the icon.\n *\n * @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n\n const color = this.color();\n if (color) parts.push(`wr-tag--${color}`);\n\n if (this.outlined()) parts.push('wr-tag--outlined');\n if (this.transparent()) parts.push('wr-tag--transparent');\n if (this.rounded()) parts.push('wr-tag--rounded');\n if (this.hoverable()) parts.push('wr-tag--hoverable');\n if (this.loading()) parts.push('wr-tag--loading');\n\n const hasAdornment = !!this.icon() || this.loading();\n if (hasAdornment) parts.push(`wr-tag--icon-${this.iconPosition()}`);\n\n return parts.join(' ');\n });\n}\n","@if (iconPosition() === 'start') {\n @if (loading()) {\n <wr-spinner class=\"wr-tag__adornment\" size=\"sm\" />\n } @else if (icon(); as name) {\n <wr-icon class=\"wr-tag__adornment\" [name]=\"name\" />\n }\n}\n\n<ng-content />\n\n@if (iconPosition() === 'end') {\n @if (loading()) {\n <wr-spinner class=\"wr-tag__adornment\" size=\"sm\" />\n } @else if (icon(); as name) {\n <wr-icon class=\"wr-tag__adornment\" [name]=\"name\" />\n }\n}\n"],"mappings":";;;;;;;;;;;;AAuCA,IAAa,UAAb,MAAa,QAAO;CAClB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,OAAO;CAC1E;CAYS,QAAQ,MAAsB,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAOxC,OAAO,MAAmB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAQ/B,QAAQ,MAAoB,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAOtC,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAEhD,UAAU,eAAc;EACzC,MAAM,QAAkB,CAAA;EAExB,MAAM,QAAQ,KAAK,MAAK;EACxB,IAAI,OAAO,MAAM,KAAK,aAAa,OAAO;EAE1C,MAAM,OAAO,KAAK,KAAI;EACtB,IAAI,SAAS,MACX,MAAM,KAAK,aAAa,MAAM;EAEhC,MAAM,QAAQ,KAAK,MAAK;EACxB,IAAI,UAAU,WACZ,MAAM,KAAK,aAAa,OAAO;EAEjC,IAAI,KAAK,SAAQ,GACf,MAAM,KAAK,oBAAoB;EAEjC,OAAO,MAAM,KAAK,GAAG;CACvB,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAzDS,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;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AU,WAAW;GAAW;GAAE,SACxC,CAAC,QAAQ,SAAS;GAAC,UAAA;EAAA,CAAA"}
|
package/fesm2022/ngwr-burger.mjs
CHANGED
|
@@ -20,10 +20,7 @@ var WrBurger = class WrBurger {
|
|
|
20
20
|
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
21
21
|
transform: coerceBooleanProperty
|
|
22
22
|
});
|
|
23
|
-
classes = computed(() => ({
|
|
24
|
-
"wr-burger": true,
|
|
25
|
-
"wr-burger--opened": this.open()
|
|
26
|
-
}), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
23
|
+
classes = computed(() => ({ "wr-burger--opened": this.open() }), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
27
24
|
toggle() {
|
|
28
25
|
if (this.disabled()) return;
|
|
29
26
|
this.open.set(!this.open());
|
|
@@ -66,7 +63,10 @@ var WrBurger = class WrBurger {
|
|
|
66
63
|
}
|
|
67
64
|
},
|
|
68
65
|
outputs: { open: "openChange" },
|
|
69
|
-
host: {
|
|
66
|
+
host: {
|
|
67
|
+
properties: { "class": "classes()" },
|
|
68
|
+
classAttribute: "wr-burger"
|
|
69
|
+
},
|
|
70
70
|
ngImport: i0,
|
|
71
71
|
template: "<button\n type=\"button\"\n class=\"wr-burger__btn\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-label]=\"resolvedLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"toggle()\"\n>\n <svg class=\"wr-burger__icon\" viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path\n class=\"wr-burger__line wr-burger__line--1\"\n d=\"M 20,29 H 80 C 80,29 94.5,28.8 94.5,66.7 94.5,78 91,81.7 85.3,81.7 79.6,81.7 75,75 75,75 L 25,25\"\n />\n <path class=\"wr-burger__line wr-burger__line--2\" d=\"M 20,50 H 80\" />\n <path\n class=\"wr-burger__line wr-burger__line--3\"\n d=\"M 20,71 H 80 C 80,71 94.5,71.2 94.5,33.3 94.5,22 91,18.3 85.3,18.3 79.6,18.3 75,25 75,25 L 25,75\"\n />\n </svg>\n</button>\n",
|
|
72
72
|
encapsulation: i0.ViewEncapsulation.None
|
|
@@ -82,7 +82,10 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
82
82
|
args: [{
|
|
83
83
|
selector: "wr-burger",
|
|
84
84
|
encapsulation: ViewEncapsulation.None,
|
|
85
|
-
host: {
|
|
85
|
+
host: {
|
|
86
|
+
class: "wr-burger",
|
|
87
|
+
"[class]": "classes()"
|
|
88
|
+
},
|
|
86
89
|
template: "<button\n type=\"button\"\n class=\"wr-burger__btn\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-label]=\"resolvedLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"toggle()\"\n>\n <svg class=\"wr-burger__icon\" viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path\n class=\"wr-burger__line wr-burger__line--1\"\n d=\"M 20,29 H 80 C 80,29 94.5,28.8 94.5,66.7 94.5,78 91,81.7 85.3,81.7 79.6,81.7 75,75 75,75 L 25,25\"\n />\n <path class=\"wr-burger__line wr-burger__line--2\" d=\"M 20,50 H 80\" />\n <path\n class=\"wr-burger__line wr-burger__line--3\"\n d=\"M 20,71 H 80 C 80,71 94.5,71.2 94.5,33.3 94.5,22 91,18.3 85.3,18.3 79.6,18.3 75,25 75,25 L 25,75\"\n />\n </svg>\n</button>\n"
|
|
87
90
|
}]
|
|
88
91
|
}],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-burger.mjs","names":[],"sources":["../../../projects/lib/burger/burger.ts","../../../projects/lib/burger/burger.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 { Component, ViewEncapsulation, computed, input, model } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Animated menu toggle — three SVG strokes morph between a hamburger and a\n * close mark on `open`. Two-way bindable, so it pairs naturally with a\n * `<wr-drawer>` or any disclosure.\n *\n * The morph is pure CSS (`stroke-dasharray` / `stroke-dashoffset` tweens),\n * so it stays smooth without JS and collapses to its end state under\n * `prefers-reduced-motion`.\n *\n * @example Toggle a drawer\n * ```html\n * <wr-burger [(open)]=\"menuOpen\" />\n * <wr-drawer [(open)]=\"menuOpen\" position=\"right\">…</wr-drawer>\n * ```\n *\n * @see https://ngwr.dev/reference/components/burger\n */\n@Component({\n selector: 'wr-burger',\n templateUrl: './burger.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()' },\n})\nexport class WrBurger {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('burger');\n }\n\n /** Two-way bindable open state. Drives the hamburger ↔ close morph. @default false */\n readonly open = model(false);\n\n /**\n * Accessible name for the toggle button. Falls back to `burger.label`, then\n * `'Toggle menu'`.\n */\n readonly label = input<string | null>(null);\n\n protected readonly resolvedLabel = useI18nText(this.label, 'burger.label', 'Toggle menu');\n\n /** Disable the toggle. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => ({\n 'wr-burger
|
|
1
|
+
{"version":3,"file":"ngwr-burger.mjs","names":[],"sources":["../../../projects/lib/burger/burger.ts","../../../projects/lib/burger/burger.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 { Component, ViewEncapsulation, computed, input, model } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Animated menu toggle — three SVG strokes morph between a hamburger and a\n * close mark on `open`. Two-way bindable, so it pairs naturally with a\n * `<wr-drawer>` or any disclosure.\n *\n * The morph is pure CSS (`stroke-dasharray` / `stroke-dashoffset` tweens),\n * so it stays smooth without JS and collapses to its end state under\n * `prefers-reduced-motion`.\n *\n * @example Toggle a drawer\n * ```html\n * <wr-burger [(open)]=\"menuOpen\" />\n * <wr-drawer [(open)]=\"menuOpen\" position=\"right\">…</wr-drawer>\n * ```\n *\n * @see https://ngwr.dev/reference/components/burger\n */\n@Component({\n selector: 'wr-burger',\n templateUrl: './burger.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-burger', '[class]': 'classes()' },\n})\nexport class WrBurger {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('burger');\n }\n\n /** Two-way bindable open state. Drives the hamburger ↔ close morph. @default false */\n readonly open = model(false);\n\n /**\n * Accessible name for the toggle button. Falls back to `burger.label`, then\n * `'Toggle menu'`.\n */\n readonly label = input<string | null>(null);\n\n protected readonly resolvedLabel = useI18nText(this.label, 'burger.label', 'Toggle menu');\n\n /** Disable the toggle. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => ({\n 'wr-burger--opened': this.open(),\n }));\n\n protected toggle(): void {\n if (this.disabled()) return;\n this.open.set(!this.open());\n }\n}\n","<button\n type=\"button\"\n class=\"wr-burger__btn\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-label]=\"resolvedLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"toggle()\"\n>\n <svg class=\"wr-burger__icon\" viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path\n class=\"wr-burger__line wr-burger__line--1\"\n d=\"M 20,29 H 80 C 80,29 94.5,28.8 94.5,66.7 94.5,78 91,81.7 85.3,81.7 79.6,81.7 75,75 75,75 L 25,25\"\n />\n <path class=\"wr-burger__line wr-burger__line--2\" d=\"M 20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A,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA,EAAA,MAAA,aAAA;EAAA,MAAA;GAAA,YAAA,EAAA,SAAA,YAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UCpCrB;EAoBA,eAAA,GAAA,kBAAA;CAAA,CAAA;;ADgBa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAQ,YAAA,CAAA;EANpB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAW,eAEN,kBAAkB;GAAI,MAC/B;IAAE,OAAO;IAAa,WAAW;GAAW;GAAE,UAAA;EAAA,CAAA"}
|
package/fesm2022/ngwr-button.mjs
CHANGED
|
@@ -102,7 +102,7 @@ var WrButton = class WrButton {
|
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
classes = computed(() => {
|
|
105
|
-
const parts = [
|
|
105
|
+
const parts = [];
|
|
106
106
|
const color = this.color();
|
|
107
107
|
if (color) parts.push(`wr-btn--${color}`);
|
|
108
108
|
const size = this.size();
|
|
@@ -214,7 +214,8 @@ var WrButton = class WrButton {
|
|
|
214
214
|
"attr.role": "hostRole()",
|
|
215
215
|
"attr.tabindex": "hostTabIndex()",
|
|
216
216
|
"attr.aria-disabled": "hostAriaDisabled()"
|
|
217
|
-
}
|
|
217
|
+
},
|
|
218
|
+
classAttribute: "wr-btn"
|
|
218
219
|
},
|
|
219
220
|
ngImport: i0,
|
|
220
221
|
template: "<!--\n `aria-hidden`: the spinner is a `role=\"status\"` region named \"Loading\", and inside\n the button it became the button's whole name while the label was hidden. The\n button already says it is busy with `aria-busy`.\n-->\n@if (loading()) {\n <wr-spinner class=\"wr-btn__spin\" size=\"sm\" aria-hidden=\"true\" />\n}\n\n@if (icon(); as name) {\n <wr-icon class=\"wr-btn__icon\" [name]=\"name\" />\n}\n\n<span class=\"wr-btn__label\">\n <ng-content />\n</span>\n",
|
|
@@ -243,6 +244,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
243
244
|
selector: "wr-btn, button[wr-btn], a[wr-btn]",
|
|
244
245
|
encapsulation: ViewEncapsulation.None,
|
|
245
246
|
host: {
|
|
247
|
+
class: "wr-btn",
|
|
246
248
|
"[class]": "classes()",
|
|
247
249
|
"[attr.disabled]": "nativeDisabled()",
|
|
248
250
|
"[attr.aria-busy]": "loading() ? \"true\" : null",
|
|
@@ -353,7 +355,7 @@ var WrButtonGroup = class WrButtonGroup {
|
|
|
353
355
|
}
|
|
354
356
|
shape = input(null, ...ngDevMode ? [{ debugName: "shape" }] : /* istanbul ignore next */ []);
|
|
355
357
|
hostClasses = computed(() => {
|
|
356
|
-
const parts = [
|
|
358
|
+
const parts = [];
|
|
357
359
|
const s = this.shape();
|
|
358
360
|
if (s) parts.push(`wr-btn-group--${s}`);
|
|
359
361
|
return parts.join(" ");
|
|
@@ -381,7 +383,8 @@ var WrButtonGroup = class WrButtonGroup {
|
|
|
381
383
|
} },
|
|
382
384
|
host: {
|
|
383
385
|
attributes: { "role": "group" },
|
|
384
|
-
properties: { "class": "hostClasses()" }
|
|
386
|
+
properties: { "class": "hostClasses()" },
|
|
387
|
+
classAttribute: "wr-btn-group"
|
|
385
388
|
},
|
|
386
389
|
providers: [{
|
|
387
390
|
provide: WR_BUTTON_GROUP,
|
|
@@ -405,6 +408,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
405
408
|
template: "<ng-content />",
|
|
406
409
|
encapsulation: ViewEncapsulation.None,
|
|
407
410
|
host: {
|
|
411
|
+
class: "wr-btn-group",
|
|
408
412
|
"[class]": "hostClasses()",
|
|
409
413
|
role: "group"
|
|
410
414
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-button.mjs","names":[],"sources":["../../../projects/lib/button/tokens/button-group.token.ts","../../../projects/lib/button/button.ts","../../../projects/lib/button/button.html","../../../projects/lib/button/button-group.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { WrButtonGroupContext } from '../types';\n\n/**\n * Token a `<wr-btn>` injects to discover its parent `<wr-btn-group>`. The\n * group provides itself via this token so children can react to the\n * group's `shape` cascade.\n *\n * @internal\n */\nexport const WR_BUTTON_GROUP = new InjectionToken<WrButtonGroupContext>('WR_BUTTON_GROUP');\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n Renderer2,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n} from '@angular/core';\n\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { WrSpinner } from 'ngwr/spinner';\nimport type { WrColor } from 'ngwr/theme';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_BUTTON_GROUP } from './tokens';\nimport type { WrButtonIconPosition, WrButtonShape, WrButtonSize } from './types';\n\n/**\n * Trigger an action. Renders as a `<wr-btn>` element, or attach to a\n * native `<button>` / `<a>` via the `wr-btn` attribute selector.\n *\n * @example\n * ```html\n * <button wr-btn color=\"primary\">Save</button>\n * <a wr-btn color=\"primary\" outlined>Cancel</a>\n * <wr-btn color=\"danger\" icon=\"trash\">Delete</wr-btn>\n * <wr-btn color=\"primary\" shape=\"pill\">Pill</wr-btn>\n * ```\n *\n * Inside a `<wr-btn-group shape=\"…\">`, the group's shape is enforced on\n * every child — child `[shape]` inputs are ignored so the group reads as\n * one coherent control.\n *\n * **Inside a `<form>`, use the native form.** `<wr-btn>` is a custom element\n * carrying `role=\"button\"`, and no custom element submits a form — the platform\n * submits for `<button>`, `<input type=\"submit\">` and `<input type=\"image\">`\n * and nothing else. That is why there is no `type` input: it would look like it\n * worked. Implicit submission (Enter in a text field) does not reach it either.\n *\n * ```html\n * <button wr-btn type=\"submit\" color=\"primary\">Save</button>\n * ```\n *\n * @see https://ngwr.dev/reference/components/button\n */\n@Component({\n selector: 'wr-btn, button[wr-btn], a[wr-btn]',\n templateUrl: './button.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n '[attr.disabled]': 'nativeDisabled()',\n '[attr.aria-busy]': 'loading() ? \"true\" : null',\n // The role applies ONLY to the `<wr-btn>` element form — see `isCustomHost`.\n // The tab stop and `aria-disabled` apply to it and to `<a wr-btn>`, where\n // `disabled` is just as inert. A native `<button>` already has all of it.\n '[attr.role]': 'hostRole()',\n '[attr.tabindex]': 'hostTabIndex()',\n '[attr.aria-disabled]': 'hostAriaDisabled()',\n '(keydown)': 'onHostKeydown($event)',\n '(focus)': 'onHostFocus()',\n '(blur)': 'onHostBlur()',\n },\n imports: [WrIcon, WrSpinner],\n})\nexport class WrButton {\n /**\n * Color variant. Omit for the neutral default style.\n *\n * @default null\n */\n readonly color = input<WrColor | null>(null);\n\n /** Size variant. @default 'md' */\n readonly size = input<WrButtonSize>('md');\n\n /**\n * Corner treatment — `rounded`, `pill` or `squircle`. `null` (default) falls\n * back to `rounded`. Inside a `<wr-btn-group shape=\"…\">`, the group's shape\n * ALWAYS wins over this input — the group enforces a consistent corner\n * treatment across its members.\n *\n * @default null\n */\n readonly shape = input<WrButtonShape | null>(null);\n\n /**\n * Icon name to render alongside the label. The icon is hidden while\n * `loading` is `true` so the spinner can take its place.\n *\n * @default null\n */\n readonly icon = input<WrIconName | null>(null);\n\n /** Position of the icon relative to the label. @default 'start' */\n readonly iconPosition = input<WrButtonIconPosition>('start');\n\n /** Disable the button. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /** Outlined variant — colored text and border on a transparent background. @default false */\n readonly outlined = input(false, { transform: coerceBooleanProperty });\n\n /** Stretch the button to fill its parent's width. @default false */\n readonly block = input(false, { transform: coerceBooleanProperty });\n\n /** Show a spinner overlaying the label. Layout is preserved. @default false */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /**\n * When `loading` is `true` and this is also `true`, pointer events are\n * suppressed and the button reports as disabled to assistive tech.\n *\n * @default true\n */\n readonly disabledWhenLoading = input(true, { transform: coerceBooleanProperty });\n\n private readonly group = inject(WR_BUTTON_GROUP, { optional: true });\n\n /**\n * Resolved shape. Inside a `<wr-btn-group>`, the group ALWAYS wins — child\n * `[shape]` is ignored entirely so the group reads as one coherent control.\n * Outside a group, the button's own `[shape]` is used, falling back to\n * `rounded`.\n */\n protected readonly resolvedShape = computed<WrButtonShape>(() =>\n this.group ? (this.group.shape() ?? 'rounded') : (this.shape() ?? 'rounded')\n );\n\n private readonly hostEl = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Whether this instance is the `<wr-btn>` ELEMENT rather than the attribute\n * form on a native `<button>` / `<a>`.\n *\n * The element form is documented as first-class and is what the pagination,\n * event-calendar and popconfirm chrome use — but a custom element has no\n * button semantics of its own. It was rendering with no `role`, no\n * `tabindex` and no keyboard activation, so it was invisible to assistive\n * tech and unreachable by Tab. Measured in Chromium against the built site:\n * the whole `wr-pagination` subtree, 26 elements, contained ZERO focusable\n * nodes and sixty Tab presses never entered it. axe cannot see this — an\n * unknown element with no role simply is not an interactive control to it,\n * which is the same blind spot that lets `disabled` pass unnoticed on a\n * custom element.\n */\n private readonly isCustomHost = this.hostEl.nativeElement.tagName === 'WR-BTN';\n\n /**\n * Whether this instance is on an `<a>`. The `disabled` attribute means nothing\n * there either: a disabled or loading `<a wr-btn href>` kept its tab stop, was\n * announced as an enabled link and followed its `href` on Enter — only the mouse\n * was stopped, by `pointer-events: none`.\n */\n private readonly isAnchorHost = this.hostEl.nativeElement.tagName === 'A';\n\n private readonly isOff = computed(() => this.disabled() || (this.loading() && this.disabledWhenLoading()));\n\n protected readonly nativeDisabled = computed<'' | null>(() => (this.isOff() ? '' : null));\n\n protected readonly hostRole = computed<'button' | null>(() => (this.isCustomHost ? 'button' : null));\n\n /**\n * Out of the tab order while off — `disabled` is inert on a custom element and on\n * an `<a>`. The element form drops its stop; a link has one of its own, which `-1`\n * takes away.\n */\n protected readonly hostTabIndex = computed<'0' | '-1' | null>(() => {\n if (this.isCustomHost) return this.isOff() ? null : '0';\n return this.isAnchorHost && this.isOff() ? '-1' : null;\n });\n\n protected readonly hostAriaDisabled = computed<'true' | null>(() =>\n (this.isCustomHost || this.isAnchorHost) && this.isOff() ? 'true' : null\n );\n\n /**\n * Enter and Space activate a button. A native one does this for free; a\n * custom element does not, so without this the element form could be focused\n * (once it had a tabindex) and still not be operable.\n *\n * `preventDefault` on Space is not optional — it scrolls the page otherwise.\n * The pointer path needs no guard here: `.wr-btn[disabled]` already sets\n * `pointer-events: none`.\n */\n protected onHostKeydown(event: KeyboardEvent): void {\n // A link activates on Enter, which out of the tab order it can still receive\n // from a script or a screen reader's focus.\n if (this.isAnchorHost && this.isOff() && event.key === 'Enter') {\n event.preventDefault();\n return;\n }\n if (!this.isCustomHost) return;\n if (event.key !== 'Enter' && event.key !== ' ') return;\n\n event.preventDefault();\n if (this.isOff()) return;\n this.hostEl.nativeElement.click();\n }\n\n /**\n * A disabled `<a wr-btn>` activates nothing: no navigation, and no other click\n * listener on it — the `(click)` of the template and a `routerLink` included,\n * the same silence a disabled `<button>` keeps. The pointer never gets here past\n * `pointer-events: none`; a screen reader's activation and `.click()` do.\n *\n * A CAPTURE listener, because a host listener is registered after the\n * template's own `(click)` on the same element and could not stop it; at the\n * target, capture listeners run first.\n */\n private readonly onAnchorClick = (event: MouseEvent): void => {\n if (!this.isOff()) return;\n event.preventDefault();\n event.stopImmediatePropagation();\n };\n\n private readonly injector = inject(Injector);\n\n /**\n * Whether this button is the one the caret was on, so it can be handed back\n * the focus that goes missing while it is off.\n *\n * A control that becomes `disabled` while focused stops being a focusable\n * area, and the browser runs the unfocusing steps: nothing else is nominated,\n * so the caret lands on `<body>`. With `disabledWhenLoading` on by default\n * that happens on EVERY async button — a keyboard user presses Enter on\n * \"Save\" and the next Tab restarts from the top of the document, while a\n * screen-reader user is told neither that the wait began nor that it ended,\n * because the element they were on has left the a11y tree. The `<wr-btn>`\n * element form loses its `tabindex` instead of gaining `disabled` and is\n * unfocused for the same reason.\n *\n * Deliberately NOT keyed on reading `activeElement` when `isOff()` flips: an\n * effect in this component's own view runs AFTER the parent has applied this\n * directive's host bindings, so by then the attribute has landed and the\n * browser has already moved the caret — the read would answer `<body>` on\n * every real browser and the button on jsdom, which is the worst of both.\n *\n * The flag is written by the focus listeners instead, and a `blur` fired\n * WHILE off keeps it set rather than clearing it: that blur is the browser\n * taking the caret away, not the user leaving. A browser that fires no blur\n * on disable at all is covered too — the flag simply stays as `focus` left it,\n * and the `<body>` test below is what decides whether the focus is orphaned.\n */\n private hadFocus = false;\n\n /** @internal Host `focus` — see `hadFocus`. */\n protected onHostFocus(): void {\n this.hadFocus = true;\n }\n\n /** @internal Host `blur` — see `hadFocus`. */\n protected onHostBlur(): void {\n this.hadFocus = this.isOff();\n }\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('button');\n if (this.isAnchorHost) {\n const stop = inject(Renderer2).listen(this.hostEl.nativeElement, 'click', this.onAnchorClick, { capture: true });\n inject(DestroyRef).onDestroy(stop);\n }\n\n effect(() => {\n if (this.isOff()) return;\n if (!this.hadFocus) return;\n const el = this.hostEl.nativeElement;\n\n // Deferred: the host binding that drops `disabled` (or restores the\n // `tabindex`) has not necessarily run yet, and `focus()` on a still\n // disabled element is a silent no-op — the exact failure this is here to\n // fix.\n afterNextRender(\n () => {\n if (!this.hadFocus || this.isOff()) return;\n const doc = el.ownerDocument;\n const active = doc?.activeElement ?? null;\n // Still ours — nothing was ever taken away, so keep the flag for the\n // cycle that does take it.\n if (active === el) return;\n // Someone else owns the caret now: a user who tabbed on while the\n // request was in flight must not be yanked back to a button they have\n // finished with.\n this.hadFocus = false;\n if (active && doc && active !== doc.body) return;\n el.focus();\n },\n { injector: this.injector }\n );\n });\n }\n\n protected readonly classes = computed(() => {\n const parts = ['wr-btn'];\n\n const color = this.color();\n if (color) parts.push(`wr-btn--${color}`);\n\n const size = this.size();\n if (size !== 'md') parts.push(`wr-btn--${size}`);\n\n const shape = this.resolvedShape();\n if (shape !== 'rounded') parts.push(`wr-btn--${shape}`);\n\n if (this.outlined()) parts.push('wr-btn--outlined');\n if (this.block()) parts.push('wr-btn--block');\n if (this.loading()) parts.push('wr-btn--loading');\n\n const hasAdornment = !!this.icon() || this.loading();\n if (hasAdornment) parts.push(`wr-btn--icon-${this.iconPosition()}`);\n\n return parts.join(' ');\n });\n}\n","<!--\n `aria-hidden`: the spinner is a `role=\"status\"` region named \"Loading\", and inside\n the button it became the button's whole name while the label was hidden. The\n button already says it is busy with `aria-busy`.\n-->\n@if (loading()) {\n <wr-spinner class=\"wr-btn__spin\" size=\"sm\" aria-hidden=\"true\" />\n}\n\n@if (icon(); as name) {\n <wr-icon class=\"wr-btn__icon\" [name]=\"name\" />\n}\n\n<span class=\"wr-btn__label\">\n <ng-content />\n</span>\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 { Component, ViewEncapsulation, computed, forwardRef, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_BUTTON_GROUP } from './tokens';\nimport type { WrButtonShape, WrButtonGroupContext } from './types';\n\n/**\n * Visually group buttons by merging their borders. Optionally enforce a\n * single corner treatment across every child via `[shape]` — child\n * `<wr-btn>` `[shape]` inputs are ignored when set on the group.\n *\n * @example\n * ```html\n * <wr-btn-group>\n * <button wr-btn>Left</button>\n * <button wr-btn>Middle</button>\n * <button wr-btn>Right</button>\n * </wr-btn-group>\n *\n * <wr-btn-group shape=\"pill\">\n * <button wr-btn>One</button>\n * <button wr-btn>Two</button>\n * <button wr-btn>Three</button>\n * </wr-btn-group>\n * ```\n *\n * @see https://ngwr.dev/reference/components/button-group\n */\n@Component({\n selector: 'wr-btn-group',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'hostClasses()',\n role: 'group',\n },\n // forwardRef required: WrButtonGroup is self-referenced before its declaration ends.\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n providers: [{ provide: WR_BUTTON_GROUP, useExisting: forwardRef(() => WrButtonGroup) }],\n})\nexport class WrButtonGroup implements WrButtonGroupContext {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('button');\n }\n\n /**\n * Corner treatment enforced on every child `<wr-btn>`. Child `[shape]`\n * inputs are ignored when this is set — the group exists to make a\n * uniform control. `null` (default) leaves children alone.\n *\n * @default null\n */\n readonly shape = input<WrButtonShape | null>(null);\n\n protected readonly hostClasses = computed(() => {\n const parts = ['wr-btn-group'];\n const s = this.shape();\n if (s) parts.push(`wr-btn-group--${s}`);\n return parts.join(' ');\n });\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAa,kBAAkB,IAAI,eAAqC,iBAAiB;;;;;;;AC4DzF,IAAa,WAAb,MAAa,SAAQ;CAMV,QAAQ,MAAsB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAGnC,OAAO,MAAoB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAUhC,QAAQ,MAA4B,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAQzC,OAAO,MAAyB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAGrC,eAAe,MAA4B,SAAQ,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CAGnD,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,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AAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EAZzB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,eAAe,kBAAkB;GACjC,MAAM;IACJ,WAAW;IACX,MAAM;GACP;GAGD,WAAW,CAAC;IAAE,SAAS;IAAiB,aAAa,iBAAgB,aAAc;GAAC,CAAE;EACvF,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-button.mjs","names":[],"sources":["../../../projects/lib/button/tokens/button-group.token.ts","../../../projects/lib/button/button.ts","../../../projects/lib/button/button.html","../../../projects/lib/button/button-group.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { WrButtonGroupContext } from '../types';\n\n/**\n * Token a `<wr-btn>` injects to discover its parent `<wr-btn-group>`. The\n * group provides itself via this token so children can react to the\n * group's `shape` cascade.\n *\n * @internal\n */\nexport const WR_BUTTON_GROUP = new InjectionToken<WrButtonGroupContext>('WR_BUTTON_GROUP');\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n Renderer2,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n} from '@angular/core';\n\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { WrSpinner } from 'ngwr/spinner';\nimport type { WrColor } from 'ngwr/theme';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_BUTTON_GROUP } from './tokens';\nimport type { WrButtonIconPosition, WrButtonShape, WrButtonSize } from './types';\n\n/**\n * Trigger an action. Renders as a `<wr-btn>` element, or attach to a\n * native `<button>` / `<a>` via the `wr-btn` attribute selector.\n *\n * @example\n * ```html\n * <button wr-btn color=\"primary\">Save</button>\n * <a wr-btn color=\"primary\" outlined>Cancel</a>\n * <wr-btn color=\"danger\" icon=\"trash\">Delete</wr-btn>\n * <wr-btn color=\"primary\" shape=\"pill\">Pill</wr-btn>\n * ```\n *\n * Inside a `<wr-btn-group shape=\"…\">`, the group's shape is enforced on\n * every child — child `[shape]` inputs are ignored so the group reads as\n * one coherent control.\n *\n * **Inside a `<form>`, use the native form.** `<wr-btn>` is a custom element\n * carrying `role=\"button\"`, and no custom element submits a form — the platform\n * submits for `<button>`, `<input type=\"submit\">` and `<input type=\"image\">`\n * and nothing else. That is why there is no `type` input: it would look like it\n * worked. Implicit submission (Enter in a text field) does not reach it either.\n *\n * ```html\n * <button wr-btn type=\"submit\" color=\"primary\">Save</button>\n * ```\n *\n * @see https://ngwr.dev/reference/components/button\n */\n@Component({\n selector: 'wr-btn, button[wr-btn], a[wr-btn]',\n templateUrl: './button.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-btn',\n '[class]': 'classes()',\n '[attr.disabled]': 'nativeDisabled()',\n '[attr.aria-busy]': 'loading() ? \"true\" : null',\n // The role applies ONLY to the `<wr-btn>` element form — see `isCustomHost`.\n // The tab stop and `aria-disabled` apply to it and to `<a wr-btn>`, where\n // `disabled` is just as inert. A native `<button>` already has all of it.\n '[attr.role]': 'hostRole()',\n '[attr.tabindex]': 'hostTabIndex()',\n '[attr.aria-disabled]': 'hostAriaDisabled()',\n '(keydown)': 'onHostKeydown($event)',\n '(focus)': 'onHostFocus()',\n '(blur)': 'onHostBlur()',\n },\n imports: [WrIcon, WrSpinner],\n})\nexport class WrButton {\n /**\n * Color variant. Omit for the neutral default style.\n *\n * @default null\n */\n readonly color = input<WrColor | null>(null);\n\n /** Size variant. @default 'md' */\n readonly size = input<WrButtonSize>('md');\n\n /**\n * Corner treatment — `rounded`, `pill` or `squircle`. `null` (default) falls\n * back to `rounded`. Inside a `<wr-btn-group shape=\"…\">`, the group's shape\n * ALWAYS wins over this input — the group enforces a consistent corner\n * treatment across its members.\n *\n * @default null\n */\n readonly shape = input<WrButtonShape | null>(null);\n\n /**\n * Icon name to render alongside the label. The icon is hidden while\n * `loading` is `true` so the spinner can take its place.\n *\n * @default null\n */\n readonly icon = input<WrIconName | null>(null);\n\n /** Position of the icon relative to the label. @default 'start' */\n readonly iconPosition = input<WrButtonIconPosition>('start');\n\n /** Disable the button. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /** Outlined variant — colored text and border on a transparent background. @default false */\n readonly outlined = input(false, { transform: coerceBooleanProperty });\n\n /** Stretch the button to fill its parent's width. @default false */\n readonly block = input(false, { transform: coerceBooleanProperty });\n\n /** Show a spinner overlaying the label. Layout is preserved. @default false */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /**\n * When `loading` is `true` and this is also `true`, pointer events are\n * suppressed and the button reports as disabled to assistive tech.\n *\n * @default true\n */\n readonly disabledWhenLoading = input(true, { transform: coerceBooleanProperty });\n\n private readonly group = inject(WR_BUTTON_GROUP, { optional: true });\n\n /**\n * Resolved shape. Inside a `<wr-btn-group>`, the group ALWAYS wins — child\n * `[shape]` is ignored entirely so the group reads as one coherent control.\n * Outside a group, the button's own `[shape]` is used, falling back to\n * `rounded`.\n */\n protected readonly resolvedShape = computed<WrButtonShape>(() =>\n this.group ? (this.group.shape() ?? 'rounded') : (this.shape() ?? 'rounded')\n );\n\n private readonly hostEl = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Whether this instance is the `<wr-btn>` ELEMENT rather than the attribute\n * form on a native `<button>` / `<a>`.\n *\n * The element form is documented as first-class and is what the pagination,\n * event-calendar and popconfirm chrome use — but a custom element has no\n * button semantics of its own. It was rendering with no `role`, no\n * `tabindex` and no keyboard activation, so it was invisible to assistive\n * tech and unreachable by Tab. Measured in Chromium against the built site:\n * the whole `wr-pagination` subtree, 26 elements, contained ZERO focusable\n * nodes and sixty Tab presses never entered it. axe cannot see this — an\n * unknown element with no role simply is not an interactive control to it,\n * which is the same blind spot that lets `disabled` pass unnoticed on a\n * custom element.\n */\n private readonly isCustomHost = this.hostEl.nativeElement.tagName === 'WR-BTN';\n\n /**\n * Whether this instance is on an `<a>`. The `disabled` attribute means nothing\n * there either: a disabled or loading `<a wr-btn href>` kept its tab stop, was\n * announced as an enabled link and followed its `href` on Enter — only the mouse\n * was stopped, by `pointer-events: none`.\n */\n private readonly isAnchorHost = this.hostEl.nativeElement.tagName === 'A';\n\n private readonly isOff = computed(() => this.disabled() || (this.loading() && this.disabledWhenLoading()));\n\n protected readonly nativeDisabled = computed<'' | null>(() => (this.isOff() ? '' : null));\n\n protected readonly hostRole = computed<'button' | null>(() => (this.isCustomHost ? 'button' : null));\n\n /**\n * Out of the tab order while off — `disabled` is inert on a custom element and on\n * an `<a>`. The element form drops its stop; a link has one of its own, which `-1`\n * takes away.\n */\n protected readonly hostTabIndex = computed<'0' | '-1' | null>(() => {\n if (this.isCustomHost) return this.isOff() ? null : '0';\n return this.isAnchorHost && this.isOff() ? '-1' : null;\n });\n\n protected readonly hostAriaDisabled = computed<'true' | null>(() =>\n (this.isCustomHost || this.isAnchorHost) && this.isOff() ? 'true' : null\n );\n\n /**\n * Enter and Space activate a button. A native one does this for free; a\n * custom element does not, so without this the element form could be focused\n * (once it had a tabindex) and still not be operable.\n *\n * `preventDefault` on Space is not optional — it scrolls the page otherwise.\n * The pointer path needs no guard here: `.wr-btn[disabled]` already sets\n * `pointer-events: none`.\n */\n protected onHostKeydown(event: KeyboardEvent): void {\n // A link activates on Enter, which out of the tab order it can still receive\n // from a script or a screen reader's focus.\n if (this.isAnchorHost && this.isOff() && event.key === 'Enter') {\n event.preventDefault();\n return;\n }\n if (!this.isCustomHost) return;\n if (event.key !== 'Enter' && event.key !== ' ') return;\n\n event.preventDefault();\n if (this.isOff()) return;\n this.hostEl.nativeElement.click();\n }\n\n /**\n * A disabled `<a wr-btn>` activates nothing: no navigation, and no other click\n * listener on it — the `(click)` of the template and a `routerLink` included,\n * the same silence a disabled `<button>` keeps. The pointer never gets here past\n * `pointer-events: none`; a screen reader's activation and `.click()` do.\n *\n * A CAPTURE listener, because a host listener is registered after the\n * template's own `(click)` on the same element and could not stop it; at the\n * target, capture listeners run first.\n */\n private readonly onAnchorClick = (event: MouseEvent): void => {\n if (!this.isOff()) return;\n event.preventDefault();\n event.stopImmediatePropagation();\n };\n\n private readonly injector = inject(Injector);\n\n /**\n * Whether this button is the one the caret was on, so it can be handed back\n * the focus that goes missing while it is off.\n *\n * A control that becomes `disabled` while focused stops being a focusable\n * area, and the browser runs the unfocusing steps: nothing else is nominated,\n * so the caret lands on `<body>`. With `disabledWhenLoading` on by default\n * that happens on EVERY async button — a keyboard user presses Enter on\n * \"Save\" and the next Tab restarts from the top of the document, while a\n * screen-reader user is told neither that the wait began nor that it ended,\n * because the element they were on has left the a11y tree. The `<wr-btn>`\n * element form loses its `tabindex` instead of gaining `disabled` and is\n * unfocused for the same reason.\n *\n * Deliberately NOT keyed on reading `activeElement` when `isOff()` flips: an\n * effect in this component's own view runs AFTER the parent has applied this\n * directive's host bindings, so by then the attribute has landed and the\n * browser has already moved the caret — the read would answer `<body>` on\n * every real browser and the button on jsdom, which is the worst of both.\n *\n * The flag is written by the focus listeners instead, and a `blur` fired\n * WHILE off keeps it set rather than clearing it: that blur is the browser\n * taking the caret away, not the user leaving. A browser that fires no blur\n * on disable at all is covered too — the flag simply stays as `focus` left it,\n * and the `<body>` test below is what decides whether the focus is orphaned.\n */\n private hadFocus = false;\n\n /** @internal Host `focus` — see `hadFocus`. */\n protected onHostFocus(): void {\n this.hadFocus = true;\n }\n\n /** @internal Host `blur` — see `hadFocus`. */\n protected onHostBlur(): void {\n this.hadFocus = this.isOff();\n }\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('button');\n if (this.isAnchorHost) {\n const stop = inject(Renderer2).listen(this.hostEl.nativeElement, 'click', this.onAnchorClick, { capture: true });\n inject(DestroyRef).onDestroy(stop);\n }\n\n effect(() => {\n if (this.isOff()) return;\n if (!this.hadFocus) return;\n const el = this.hostEl.nativeElement;\n\n // Deferred: the host binding that drops `disabled` (or restores the\n // `tabindex`) has not necessarily run yet, and `focus()` on a still\n // disabled element is a silent no-op — the exact failure this is here to\n // fix.\n afterNextRender(\n () => {\n if (!this.hadFocus || this.isOff()) return;\n const doc = el.ownerDocument;\n const active = doc?.activeElement ?? null;\n // Still ours — nothing was ever taken away, so keep the flag for the\n // cycle that does take it.\n if (active === el) return;\n // Someone else owns the caret now: a user who tabbed on while the\n // request was in flight must not be yanked back to a button they have\n // finished with.\n this.hadFocus = false;\n if (active && doc && active !== doc.body) return;\n el.focus();\n },\n { injector: this.injector }\n );\n });\n }\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n\n const color = this.color();\n if (color) parts.push(`wr-btn--${color}`);\n\n const size = this.size();\n if (size !== 'md') parts.push(`wr-btn--${size}`);\n\n const shape = this.resolvedShape();\n if (shape !== 'rounded') parts.push(`wr-btn--${shape}`);\n\n if (this.outlined()) parts.push('wr-btn--outlined');\n if (this.block()) parts.push('wr-btn--block');\n if (this.loading()) parts.push('wr-btn--loading');\n\n const hasAdornment = !!this.icon() || this.loading();\n if (hasAdornment) parts.push(`wr-btn--icon-${this.iconPosition()}`);\n\n return parts.join(' ');\n });\n}\n","<!--\n `aria-hidden`: the spinner is a `role=\"status\"` region named \"Loading\", and inside\n the button it became the button's whole name while the label was hidden. The\n button already says it is busy with `aria-busy`.\n-->\n@if (loading()) {\n <wr-spinner class=\"wr-btn__spin\" size=\"sm\" aria-hidden=\"true\" />\n}\n\n@if (icon(); as name) {\n <wr-icon class=\"wr-btn__icon\" [name]=\"name\" />\n}\n\n<span class=\"wr-btn__label\">\n <ng-content />\n</span>\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 { Component, ViewEncapsulation, computed, forwardRef, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_BUTTON_GROUP } from './tokens';\nimport type { WrButtonShape, WrButtonGroupContext } from './types';\n\n/**\n * Visually group buttons by merging their borders. Optionally enforce a\n * single corner treatment across every child via `[shape]` — child\n * `<wr-btn>` `[shape]` inputs are ignored when set on the group.\n *\n * @example\n * ```html\n * <wr-btn-group>\n * <button wr-btn>Left</button>\n * <button wr-btn>Middle</button>\n * <button wr-btn>Right</button>\n * </wr-btn-group>\n *\n * <wr-btn-group shape=\"pill\">\n * <button wr-btn>One</button>\n * <button wr-btn>Two</button>\n * <button wr-btn>Three</button>\n * </wr-btn-group>\n * ```\n *\n * @see https://ngwr.dev/reference/components/button-group\n */\n@Component({\n selector: 'wr-btn-group',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-btn-group',\n '[class]': 'hostClasses()',\n role: 'group',\n },\n // forwardRef required: WrButtonGroup is self-referenced before its declaration ends.\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n providers: [{ provide: WR_BUTTON_GROUP, useExisting: forwardRef(() => WrButtonGroup) }],\n})\nexport class WrButtonGroup implements WrButtonGroupContext {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('button');\n }\n\n /**\n * Corner treatment enforced on every child `<wr-btn>`. Child `[shape]`\n * inputs are ignored when this is set — the group exists to make a\n * uniform control. `null` (default) leaves children alone.\n *\n * @default null\n */\n readonly shape = input<WrButtonShape | null>(null);\n\n protected readonly hostClasses = computed(() => {\n const parts: string[] = [];\n const s = this.shape();\n if (s) parts.push(`wr-btn-group--${s}`);\n return parts.join(' ');\n });\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAa,kBAAkB,IAAI,eAAqC,iBAAiB;;;;;;;AC6DzF,IAAa,WAAb,MAAa,SAAQ;CAMV,QAAQ,MAAsB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CA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AA;EAAA,MAAA;EAAa,cAAA;EAAA,UAAA;EAAA,QAAA,EAAA,OAAA;GAAA,mBAAA;GAAA,YAAA;GAAA,UAAA;GAAA,YAAA;GAAA,mBAAA;EAAA,EAAA;EAAA,MAAA;GAAA,YAAA,EAAA,QAAA,QAAA;GAAA,YAAA,EAAA,SAAA,gBAAA;GAAA,gBAAA;EAAA;EAAA,WAFb,CAAC;GAAE,SAAS;GAAiB,aAAa,iBAAiB,aAAa;EAAC,CAAE;EAAC,UAAA;EAAA,UAT7E;EAAgB,UAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAWf,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EAbzB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,eAAe,kBAAkB;GACjC,MAAM;IACJ,OAAO;IACP,WAAW;IACX,MAAM;GACP;GAGD,WAAW,CAAC;IAAE,SAAS;IAAiB,aAAa,iBAAgB,aAAc;GAAC,CAAE;EACvF,CAAA"}
|
|
@@ -35,8 +35,14 @@ var WrCalendar = class WrCalendar {
|
|
|
35
35
|
dir = inject(Directionality, { optional: true });
|
|
36
36
|
host = inject(ElementRef);
|
|
37
37
|
injector = inject(Injector);
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
zoneToday() {
|
|
39
|
+
const zoned = this.adapter.zoned();
|
|
40
|
+
const now = zoned.today();
|
|
41
|
+
if (zoned === this.adapter) return now;
|
|
42
|
+
return this.adapter.createDate(zoned.getYear(now), zoned.getMonth(now), zoned.getDate(now));
|
|
43
|
+
}
|
|
44
|
+
viewDate = signal(this.zoneToday(), ...ngDevMode ? [{ debugName: "viewDate" }] : /* istanbul ignore next */ []);
|
|
45
|
+
focusedDate = signal(this.zoneToday(), ...ngDevMode ? [{ debugName: "focusedDate" }] : /* istanbul ignore next */ []);
|
|
40
46
|
hoverDate = signal(null, ...ngDevMode ? [{ debugName: "hoverDate" }] : /* istanbul ignore next */ []);
|
|
41
47
|
viewMode = signal("day", ...ngDevMode ? [{ debugName: "viewMode" }] : /* istanbul ignore next */ []);
|
|
42
48
|
rovedChip = signal(null, ...ngDevMode ? [{ debugName: "rovedChip" }] : /* istanbul ignore next */ []);
|
|
@@ -62,7 +68,7 @@ var WrCalendar = class WrCalendar {
|
|
|
62
68
|
default: return this.nextMonthLabel();
|
|
63
69
|
}
|
|
64
70
|
}, ...ngDevMode ? [{ debugName: "nextLabel" }] : /* istanbul ignore next */ []);
|
|
65
|
-
today = computed(() => this.
|
|
71
|
+
today = computed(() => this.zoneToday(), ...ngDevMode ? [{ debugName: "today" }] : /* istanbul ignore next */ []);
|
|
66
72
|
weekdayNames = computed(() => this.adapter.getDayOfWeekNames("short"), ...ngDevMode ? [{ debugName: "weekdayNames" }] : /* istanbul ignore next */ []);
|
|
67
73
|
monthsView = computed(() => this.adapter.getMonthNames("short"), ...ngDevMode ? [{ debugName: "monthsView" }] : /* istanbul ignore next */ []);
|
|
68
74
|
yearsView = computed(() => {
|
|
@@ -120,14 +126,14 @@ var WrCalendar = class WrCalendar {
|
|
|
120
126
|
return this.nearestEnabledChip(this.rovedChip() ?? this.currentChip());
|
|
121
127
|
}, ...ngDevMode ? [{ debugName: "activeChip" }] : /* istanbul ignore next */ []);
|
|
122
128
|
classes = computed(() => {
|
|
123
|
-
const parts = [
|
|
129
|
+
const parts = [`wr-calendar--${this.mode()}`];
|
|
124
130
|
if (this.disabled()) parts.push("wr-calendar--disabled");
|
|
125
131
|
return parts.join(" ");
|
|
126
132
|
}, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
127
133
|
constructor() {
|
|
128
134
|
if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("calendar");
|
|
129
135
|
afterNextRender(() => {
|
|
130
|
-
const initial = this.nearestEnabled(this.date() ?? this.range()[0] ?? this.
|
|
136
|
+
const initial = this.nearestEnabled(this.date() ?? this.range()[0] ?? this.zoneToday());
|
|
131
137
|
this.focusedDate.set(initial);
|
|
132
138
|
this.viewDate.set(initial);
|
|
133
139
|
if (this.autoFocus()) afterNextRender(() => this.focusActiveCell(), { injector: this.injector });
|
|
@@ -194,6 +200,9 @@ var WrCalendar = class WrCalendar {
|
|
|
194
200
|
case "year": return this.adapter.addYears(v, direction * 12);
|
|
195
201
|
}
|
|
196
202
|
}
|
|
203
|
+
dayOfMonth(date) {
|
|
204
|
+
return this.adapter.getDate(date);
|
|
205
|
+
}
|
|
197
206
|
isToday(date) {
|
|
198
207
|
return this.adapter.isSameDay(date, this.today());
|
|
199
208
|
}
|
|
@@ -532,10 +541,11 @@ var WrCalendar = class WrCalendar {
|
|
|
532
541
|
},
|
|
533
542
|
host: {
|
|
534
543
|
listeners: { "keydown": "onKeyDown($event)" },
|
|
535
|
-
properties: { "class": "classes()" }
|
|
544
|
+
properties: { "class": "classes()" },
|
|
545
|
+
classAttribute: "wr-calendar"
|
|
536
546
|
},
|
|
537
547
|
ngImport: i0,
|
|
538
|
-
template: "<div class=\"wr-calendar__header\">\n <button\n type=\"button\"\n class=\"wr-calendar__nav wr-calendar__nav--prev\"\n [attr.aria-label]=\"prevLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"prev()\"\n >\n <svg\n width=\"18\"\n height=\"18\"\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=\"m15 18-6-6 6-6\" />\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"wr-calendar__label\"\n [disabled]=\"disabled() || viewMode() === 'year'\"\n (click)=\"onLabelClick()\"\n >\n {{ headerLabel() }}\n </button>\n <button\n type=\"button\"\n class=\"wr-calendar__nav wr-calendar__nav--next\"\n [attr.aria-label]=\"nextLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"next()\"\n >\n <svg\n width=\"18\"\n height=\"18\"\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=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n</div>\n\n@switch (viewMode()) {\n @case ('day') {\n <!--\n The weekday strip and the week rows are one grid, so they share a wrapper:\n `role=\"grid\"` may only own rows, and as siblings the header row had no grid\n parent at all. `.wr-calendar__body` repeats the host's column gap, so the\n rendered spacing is unchanged.\n -->\n <div class=\"wr-calendar__body\" role=\"grid\">\n <div class=\"wr-calendar__weekdays\" role=\"row\">\n @for (name of weekdayNames(); track name) {\n <span class=\"wr-calendar__weekday\" role=\"columnheader\">{{ name }}</span>\n }\n </div>\n\n <div class=\"wr-calendar__grid\" role=\"rowgroup\" (mouseleave)=\"onCellLeave()\">\n @for (week of weeks(); track $index) {\n <div class=\"wr-calendar__week\" role=\"row\">\n @for (day of week; track trackByTime($index, day)) {\n <button\n type=\"button\"\n class=\"wr-calendar__day\"\n role=\"gridcell\"\n [class.wr-calendar__day--today]=\"isToday(day)\"\n [class.wr-calendar__day--out-of-month]=\"isOutOfMonth(day)\"\n [class.wr-calendar__day--selected]=\"isSelected(day)\"\n [class.wr-calendar__day--in-range]=\"isInRange(day)\"\n [class.wr-calendar__day--range-preview]=\"isInRangePreview(day)\"\n [class.wr-calendar__day--focused]=\"isFocused(day)\"\n [disabled]=\"isDisabled(day)\"\n [attr.tabindex]=\"isFocused(day) ? 0 : -1\"\n [attr.aria-label]=\"dayLabel(day)\"\n [attr.aria-selected]=\"isSelected(day)\"\n [attr.aria-disabled]=\"isDisabled(day)\"\n (click)=\"onCellClick(day)\"\n (mouseenter)=\"onCellEnter(day)\"\n >\n {{ day
|
|
548
|
+
template: "<div class=\"wr-calendar__header\">\n <button\n type=\"button\"\n class=\"wr-calendar__nav wr-calendar__nav--prev\"\n [attr.aria-label]=\"prevLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"prev()\"\n >\n <svg\n width=\"18\"\n height=\"18\"\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=\"m15 18-6-6 6-6\" />\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"wr-calendar__label\"\n [disabled]=\"disabled() || viewMode() === 'year'\"\n (click)=\"onLabelClick()\"\n >\n {{ headerLabel() }}\n </button>\n <button\n type=\"button\"\n class=\"wr-calendar__nav wr-calendar__nav--next\"\n [attr.aria-label]=\"nextLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"next()\"\n >\n <svg\n width=\"18\"\n height=\"18\"\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=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n</div>\n\n@switch (viewMode()) {\n @case ('day') {\n <!--\n The weekday strip and the week rows are one grid, so they share a wrapper:\n `role=\"grid\"` may only own rows, and as siblings the header row had no grid\n parent at all. `.wr-calendar__body` repeats the host's column gap, so the\n rendered spacing is unchanged.\n -->\n <div class=\"wr-calendar__body\" role=\"grid\">\n <div class=\"wr-calendar__weekdays\" role=\"row\">\n @for (name of weekdayNames(); track name) {\n <span class=\"wr-calendar__weekday\" role=\"columnheader\">{{ name }}</span>\n }\n </div>\n\n <div class=\"wr-calendar__grid\" role=\"rowgroup\" (mouseleave)=\"onCellLeave()\">\n @for (week of weeks(); track $index) {\n <div class=\"wr-calendar__week\" role=\"row\">\n @for (day of week; track trackByTime($index, day)) {\n <button\n type=\"button\"\n class=\"wr-calendar__day\"\n role=\"gridcell\"\n [class.wr-calendar__day--today]=\"isToday(day)\"\n [class.wr-calendar__day--out-of-month]=\"isOutOfMonth(day)\"\n [class.wr-calendar__day--selected]=\"isSelected(day)\"\n [class.wr-calendar__day--in-range]=\"isInRange(day)\"\n [class.wr-calendar__day--range-preview]=\"isInRangePreview(day)\"\n [class.wr-calendar__day--focused]=\"isFocused(day)\"\n [disabled]=\"isDisabled(day)\"\n [attr.tabindex]=\"isFocused(day) ? 0 : -1\"\n [attr.aria-label]=\"dayLabel(day)\"\n [attr.aria-selected]=\"isSelected(day)\"\n [attr.aria-disabled]=\"isDisabled(day)\"\n (click)=\"onCellClick(day)\"\n (mouseenter)=\"onCellEnter(day)\"\n >\n {{ dayOfMonth(day) }}\n </button>\n }\n </div>\n }\n </div>\n </div>\n }\n\n @case ('month') {\n <!--\n A listbox owns its arrows, so its options share ONE tab stop: twelve months\n that were each tabbable announced a keyboard model — arrow to a month, Tab\n out of the list — that the component did not have. `activeChip()` is where\n the ring is, and it is always an enabled chip.\n -->\n <div class=\"wr-calendar__months\" role=\"listbox\" [attr.aria-label]=\"monthListLabel()\">\n @for (name of monthsView(); track name) {\n <button\n type=\"button\"\n class=\"wr-calendar__chip\"\n role=\"option\"\n [class.wr-calendar__chip--current]=\"isMonthCurrent($index)\"\n [class.wr-calendar__chip--selected]=\"isMonthSelected($index)\"\n [disabled]=\"isMonthDisabled($index)\"\n [attr.tabindex]=\"activeChip() === $index ? 0 : -1\"\n [attr.aria-selected]=\"isMonthSelected($index)\"\n [attr.aria-disabled]=\"isMonthDisabled($index)\"\n (click)=\"onMonthSelect($index)\"\n >\n {{ name }}\n </button>\n }\n </div>\n }\n\n @case ('year') {\n <div class=\"wr-calendar__years\" role=\"listbox\" [attr.aria-label]=\"yearListLabel()\">\n @for (year of yearsView(); track year) {\n <button\n type=\"button\"\n class=\"wr-calendar__chip\"\n role=\"option\"\n [class.wr-calendar__chip--current]=\"isYearCurrent(year)\"\n [class.wr-calendar__chip--selected]=\"isYearSelected(year)\"\n [disabled]=\"isYearDisabled(year)\"\n [attr.tabindex]=\"activeChip() === $index ? 0 : -1\"\n [attr.aria-selected]=\"isYearSelected(year)\"\n [attr.aria-disabled]=\"isYearDisabled(year)\"\n (click)=\"onYearSelect(year)\"\n >\n {{ year }}\n </button>\n }\n </div>\n }\n}\n",
|
|
539
549
|
encapsulation: i0.ViewEncapsulation.None
|
|
540
550
|
});
|
|
541
551
|
};
|
|
@@ -550,10 +560,11 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
550
560
|
selector: "wr-calendar",
|
|
551
561
|
encapsulation: ViewEncapsulation.None,
|
|
552
562
|
host: {
|
|
563
|
+
class: "wr-calendar",
|
|
553
564
|
"[class]": "classes()",
|
|
554
565
|
"(keydown)": "onKeyDown($event)"
|
|
555
566
|
},
|
|
556
|
-
template: "<div class=\"wr-calendar__header\">\n <button\n type=\"button\"\n class=\"wr-calendar__nav wr-calendar__nav--prev\"\n [attr.aria-label]=\"prevLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"prev()\"\n >\n <svg\n width=\"18\"\n height=\"18\"\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=\"m15 18-6-6 6-6\" />\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"wr-calendar__label\"\n [disabled]=\"disabled() || viewMode() === 'year'\"\n (click)=\"onLabelClick()\"\n >\n {{ headerLabel() }}\n </button>\n <button\n type=\"button\"\n class=\"wr-calendar__nav wr-calendar__nav--next\"\n [attr.aria-label]=\"nextLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"next()\"\n >\n <svg\n width=\"18\"\n height=\"18\"\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=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n</div>\n\n@switch (viewMode()) {\n @case ('day') {\n <!--\n The weekday strip and the week rows are one grid, so they share a wrapper:\n `role=\"grid\"` may only own rows, and as siblings the header row had no grid\n parent at all. `.wr-calendar__body` repeats the host's column gap, so the\n rendered spacing is unchanged.\n -->\n <div class=\"wr-calendar__body\" role=\"grid\">\n <div class=\"wr-calendar__weekdays\" role=\"row\">\n @for (name of weekdayNames(); track name) {\n <span class=\"wr-calendar__weekday\" role=\"columnheader\">{{ name }}</span>\n }\n </div>\n\n <div class=\"wr-calendar__grid\" role=\"rowgroup\" (mouseleave)=\"onCellLeave()\">\n @for (week of weeks(); track $index) {\n <div class=\"wr-calendar__week\" role=\"row\">\n @for (day of week; track trackByTime($index, day)) {\n <button\n type=\"button\"\n class=\"wr-calendar__day\"\n role=\"gridcell\"\n [class.wr-calendar__day--today]=\"isToday(day)\"\n [class.wr-calendar__day--out-of-month]=\"isOutOfMonth(day)\"\n [class.wr-calendar__day--selected]=\"isSelected(day)\"\n [class.wr-calendar__day--in-range]=\"isInRange(day)\"\n [class.wr-calendar__day--range-preview]=\"isInRangePreview(day)\"\n [class.wr-calendar__day--focused]=\"isFocused(day)\"\n [disabled]=\"isDisabled(day)\"\n [attr.tabindex]=\"isFocused(day) ? 0 : -1\"\n [attr.aria-label]=\"dayLabel(day)\"\n [attr.aria-selected]=\"isSelected(day)\"\n [attr.aria-disabled]=\"isDisabled(day)\"\n (click)=\"onCellClick(day)\"\n (mouseenter)=\"onCellEnter(day)\"\n >\n {{ day
|
|
567
|
+
template: "<div class=\"wr-calendar__header\">\n <button\n type=\"button\"\n class=\"wr-calendar__nav wr-calendar__nav--prev\"\n [attr.aria-label]=\"prevLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"prev()\"\n >\n <svg\n width=\"18\"\n height=\"18\"\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=\"m15 18-6-6 6-6\" />\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"wr-calendar__label\"\n [disabled]=\"disabled() || viewMode() === 'year'\"\n (click)=\"onLabelClick()\"\n >\n {{ headerLabel() }}\n </button>\n <button\n type=\"button\"\n class=\"wr-calendar__nav wr-calendar__nav--next\"\n [attr.aria-label]=\"nextLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"next()\"\n >\n <svg\n width=\"18\"\n height=\"18\"\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=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n</div>\n\n@switch (viewMode()) {\n @case ('day') {\n <!--\n The weekday strip and the week rows are one grid, so they share a wrapper:\n `role=\"grid\"` may only own rows, and as siblings the header row had no grid\n parent at all. `.wr-calendar__body` repeats the host's column gap, so the\n rendered spacing is unchanged.\n -->\n <div class=\"wr-calendar__body\" role=\"grid\">\n <div class=\"wr-calendar__weekdays\" role=\"row\">\n @for (name of weekdayNames(); track name) {\n <span class=\"wr-calendar__weekday\" role=\"columnheader\">{{ name }}</span>\n }\n </div>\n\n <div class=\"wr-calendar__grid\" role=\"rowgroup\" (mouseleave)=\"onCellLeave()\">\n @for (week of weeks(); track $index) {\n <div class=\"wr-calendar__week\" role=\"row\">\n @for (day of week; track trackByTime($index, day)) {\n <button\n type=\"button\"\n class=\"wr-calendar__day\"\n role=\"gridcell\"\n [class.wr-calendar__day--today]=\"isToday(day)\"\n [class.wr-calendar__day--out-of-month]=\"isOutOfMonth(day)\"\n [class.wr-calendar__day--selected]=\"isSelected(day)\"\n [class.wr-calendar__day--in-range]=\"isInRange(day)\"\n [class.wr-calendar__day--range-preview]=\"isInRangePreview(day)\"\n [class.wr-calendar__day--focused]=\"isFocused(day)\"\n [disabled]=\"isDisabled(day)\"\n [attr.tabindex]=\"isFocused(day) ? 0 : -1\"\n [attr.aria-label]=\"dayLabel(day)\"\n [attr.aria-selected]=\"isSelected(day)\"\n [attr.aria-disabled]=\"isDisabled(day)\"\n (click)=\"onCellClick(day)\"\n (mouseenter)=\"onCellEnter(day)\"\n >\n {{ dayOfMonth(day) }}\n </button>\n }\n </div>\n }\n </div>\n </div>\n }\n\n @case ('month') {\n <!--\n A listbox owns its arrows, so its options share ONE tab stop: twelve months\n that were each tabbable announced a keyboard model — arrow to a month, Tab\n out of the list — that the component did not have. `activeChip()` is where\n the ring is, and it is always an enabled chip.\n -->\n <div class=\"wr-calendar__months\" role=\"listbox\" [attr.aria-label]=\"monthListLabel()\">\n @for (name of monthsView(); track name) {\n <button\n type=\"button\"\n class=\"wr-calendar__chip\"\n role=\"option\"\n [class.wr-calendar__chip--current]=\"isMonthCurrent($index)\"\n [class.wr-calendar__chip--selected]=\"isMonthSelected($index)\"\n [disabled]=\"isMonthDisabled($index)\"\n [attr.tabindex]=\"activeChip() === $index ? 0 : -1\"\n [attr.aria-selected]=\"isMonthSelected($index)\"\n [attr.aria-disabled]=\"isMonthDisabled($index)\"\n (click)=\"onMonthSelect($index)\"\n >\n {{ name }}\n </button>\n }\n </div>\n }\n\n @case ('year') {\n <div class=\"wr-calendar__years\" role=\"listbox\" [attr.aria-label]=\"yearListLabel()\">\n @for (year of yearsView(); track year) {\n <button\n type=\"button\"\n class=\"wr-calendar__chip\"\n role=\"option\"\n [class.wr-calendar__chip--current]=\"isYearCurrent(year)\"\n [class.wr-calendar__chip--selected]=\"isYearSelected(year)\"\n [disabled]=\"isYearDisabled(year)\"\n [attr.tabindex]=\"activeChip() === $index ? 0 : -1\"\n [attr.aria-selected]=\"isYearSelected(year)\"\n [attr.aria-disabled]=\"isYearDisabled(year)\"\n (click)=\"onYearSelect(year)\"\n >\n {{ year }}\n </button>\n }\n </div>\n }\n}\n"
|
|
557
568
|
}]
|
|
558
569
|
}],
|
|
559
570
|
ctorParameters: () => [],
|