ngwr 16.8.0 → 16.9.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.
Files changed (165) hide show
  1. package/descriptions/styles/_index.scss +91 -0
  2. package/fesm2022/ngwr-anchor.mjs +48 -10
  3. package/fesm2022/ngwr-anchor.mjs.map +1 -1
  4. package/fesm2022/ngwr-carousel.mjs +3 -2
  5. package/fesm2022/ngwr-carousel.mjs.map +1 -1
  6. package/fesm2022/ngwr-compare.mjs +4 -0
  7. package/fesm2022/ngwr-compare.mjs.map +1 -1
  8. package/fesm2022/ngwr-cookie.mjs +6 -3
  9. package/fesm2022/ngwr-cookie.mjs.map +1 -1
  10. package/fesm2022/ngwr-date-stamp-testing.mjs +3 -0
  11. package/fesm2022/ngwr-date-stamp-testing.mjs.map +1 -1
  12. package/fesm2022/ngwr-date-stamp.mjs +81 -4
  13. package/fesm2022/ngwr-date-stamp.mjs.map +1 -1
  14. package/fesm2022/ngwr-date.mjs +16 -2
  15. package/fesm2022/ngwr-date.mjs.map +1 -1
  16. package/fesm2022/ngwr-density.mjs +4 -3
  17. package/fesm2022/ngwr-density.mjs.map +1 -1
  18. package/fesm2022/ngwr-descriptions.mjs +77 -20
  19. package/fesm2022/ngwr-descriptions.mjs.map +1 -1
  20. package/fesm2022/ngwr-directives.mjs +12 -0
  21. package/fesm2022/ngwr-directives.mjs.map +1 -1
  22. package/fesm2022/ngwr-editor.mjs +1 -0
  23. package/fesm2022/ngwr-editor.mjs.map +1 -1
  24. package/fesm2022/ngwr-file-upload.mjs +2 -3
  25. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  26. package/fesm2022/ngwr-form.mjs.map +1 -1
  27. package/fesm2022/ngwr-hotkey.mjs +10 -5
  28. package/fesm2022/ngwr-hotkey.mjs.map +1 -1
  29. package/fesm2022/ngwr-i18n-ar.mjs +9 -3
  30. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  31. package/fesm2022/ngwr-i18n-cs.mjs +9 -3
  32. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  33. package/fesm2022/ngwr-i18n-de.mjs +9 -3
  34. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  35. package/fesm2022/ngwr-i18n-en.mjs +9 -3
  36. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  37. package/fesm2022/ngwr-i18n-es.mjs +9 -3
  38. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  39. package/fesm2022/ngwr-i18n-fr.mjs +9 -3
  40. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  41. package/fesm2022/ngwr-i18n-he.mjs +9 -3
  42. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  43. package/fesm2022/ngwr-i18n-hi.mjs +9 -3
  44. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  45. package/fesm2022/ngwr-i18n-id.mjs +9 -3
  46. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  47. package/fesm2022/ngwr-i18n-it.mjs +9 -3
  48. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  49. package/fesm2022/ngwr-i18n-ja.mjs +9 -3
  50. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  51. package/fesm2022/ngwr-i18n-kk.mjs +9 -3
  52. package/fesm2022/ngwr-i18n-kk.mjs.map +1 -1
  53. package/fesm2022/ngwr-i18n-ko.mjs +9 -3
  54. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  55. package/fesm2022/ngwr-i18n-nl.mjs +9 -3
  56. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  57. package/fesm2022/ngwr-i18n-pl.mjs +9 -3
  58. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  59. package/fesm2022/ngwr-i18n-pt.mjs +9 -3
  60. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  61. package/fesm2022/ngwr-i18n-ru.mjs +9 -3
  62. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  63. package/fesm2022/ngwr-i18n-sv.mjs +9 -3
  64. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  65. package/fesm2022/ngwr-i18n-tr.mjs +9 -3
  66. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  67. package/fesm2022/ngwr-i18n-uk.mjs +9 -3
  68. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  69. package/fesm2022/ngwr-i18n-vi.mjs +9 -3
  70. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  71. package/fesm2022/ngwr-i18n-zh-tw.mjs +9 -3
  72. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  73. package/fesm2022/ngwr-i18n-zh.mjs +9 -3
  74. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  75. package/fesm2022/ngwr-i18n.mjs +7 -6
  76. package/fesm2022/ngwr-i18n.mjs.map +1 -1
  77. package/fesm2022/ngwr-image-cropper-testing.mjs +33 -0
  78. package/fesm2022/ngwr-image-cropper-testing.mjs.map +1 -1
  79. package/fesm2022/ngwr-image-cropper.mjs +536 -30
  80. package/fesm2022/ngwr-image-cropper.mjs.map +1 -1
  81. package/fesm2022/ngwr-knob.mjs +5 -0
  82. package/fesm2022/ngwr-knob.mjs.map +1 -1
  83. package/fesm2022/ngwr-mention.mjs +2 -0
  84. package/fesm2022/ngwr-mention.mjs.map +1 -1
  85. package/fesm2022/ngwr-meta.mjs +43 -8
  86. package/fesm2022/ngwr-meta.mjs.map +1 -1
  87. package/fesm2022/ngwr-pagination.mjs +1 -1
  88. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  89. package/fesm2022/ngwr-pipes.mjs +160 -8
  90. package/fesm2022/ngwr-pipes.mjs.map +1 -1
  91. package/fesm2022/ngwr-qr.mjs +65 -7
  92. package/fesm2022/ngwr-qr.mjs.map +1 -1
  93. package/fesm2022/ngwr-schema-form.mjs +2 -2
  94. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  95. package/fesm2022/ngwr-scroll.mjs +1 -2
  96. package/fesm2022/ngwr-scroll.mjs.map +1 -1
  97. package/fesm2022/ngwr-speed-dial.mjs +30 -1
  98. package/fesm2022/ngwr-speed-dial.mjs.map +1 -1
  99. package/fesm2022/ngwr-statistic.mjs +1 -1
  100. package/fesm2022/ngwr-stepper-testing.mjs +7 -1
  101. package/fesm2022/ngwr-stepper-testing.mjs.map +1 -1
  102. package/fesm2022/ngwr-stepper.mjs +55 -4
  103. package/fesm2022/ngwr-stepper.mjs.map +1 -1
  104. package/fesm2022/ngwr-timeline.mjs +4 -0
  105. package/fesm2022/ngwr-timeline.mjs.map +1 -1
  106. package/fesm2022/ngwr-toolbar.mjs +171 -16
  107. package/fesm2022/ngwr-toolbar.mjs.map +1 -1
  108. package/fesm2022/ngwr-transfer.mjs +3 -2
  109. package/fesm2022/ngwr-transfer.mjs.map +1 -1
  110. package/fesm2022/ngwr-tree.mjs +1 -1
  111. package/fesm2022/ngwr-utils.mjs +46 -8
  112. package/fesm2022/ngwr-utils.mjs.map +1 -1
  113. package/fesm2022/ngwr-version.mjs +1 -1
  114. package/fesm2022/ngwr-version.mjs.map +1 -1
  115. package/fesm2022/ngwr-virtual-scroll.mjs +2 -2
  116. package/fesm2022/ngwr-virtual-scroll.mjs.map +1 -1
  117. package/i18n/ar.json +9 -3
  118. package/i18n/cs.json +9 -3
  119. package/i18n/de.json +9 -3
  120. package/i18n/en.json +9 -3
  121. package/i18n/es.json +9 -3
  122. package/i18n/fr.json +9 -3
  123. package/i18n/he.json +9 -3
  124. package/i18n/hi.json +9 -3
  125. package/i18n/id.json +9 -3
  126. package/i18n/it.json +9 -3
  127. package/i18n/ja.json +9 -3
  128. package/i18n/kk.json +9 -3
  129. package/i18n/ko.json +9 -3
  130. package/i18n/nl.json +9 -3
  131. package/i18n/pl.json +9 -3
  132. package/i18n/pt.json +9 -3
  133. package/i18n/ru.json +9 -3
  134. package/i18n/sv.json +9 -3
  135. package/i18n/tr.json +9 -3
  136. package/i18n/uk.json +9 -3
  137. package/i18n/vi.json +9 -3
  138. package/i18n/zh-TW.json +9 -3
  139. package/i18n/zh.json +9 -3
  140. package/image-cropper/styles/_index.scss +30 -1
  141. package/llms-full.txt +5 -5
  142. package/package.json +1 -1
  143. package/schematics/use/symbol-map.json +1 -0
  144. package/skills/ngwr/SKILL.md +2 -2
  145. package/stepper/styles/_index.scss +33 -0
  146. package/types/ngwr-anchor.d.ts +14 -1
  147. package/types/ngwr-date-stamp-testing.d.ts +2 -0
  148. package/types/ngwr-date-stamp.d.ts +41 -2
  149. package/types/ngwr-date.d.ts +3 -1
  150. package/types/ngwr-descriptions.d.ts +33 -5
  151. package/types/ngwr-directives.d.ts +1 -0
  152. package/types/ngwr-form.d.ts +4 -0
  153. package/types/ngwr-hotkey.d.ts +2 -0
  154. package/types/ngwr-image-cropper-testing.d.ts +33 -1
  155. package/types/ngwr-image-cropper.d.ts +214 -6
  156. package/types/ngwr-meta.d.ts +13 -1
  157. package/types/ngwr-pipes.d.ts +125 -1
  158. package/types/ngwr-qr.d.ts +17 -0
  159. package/types/ngwr-speed-dial.d.ts +10 -0
  160. package/types/ngwr-stepper-testing.d.ts +10 -0
  161. package/types/ngwr-stepper.d.ts +47 -1
  162. package/types/ngwr-toolbar.d.ts +27 -0
  163. package/types/ngwr-transfer.d.ts +2 -0
  164. package/types/ngwr-utils.d.ts +61 -2
  165. package/types/ngwr-version.d.ts +1 -1
@@ -1,21 +1,157 @@
1
1
  import * as i0 from "@angular/core";
2
- import { Component, ViewEncapsulation, input } from "@angular/core";
2
+ import { Component, ElementRef, ViewEncapsulation, afterRenderEffect, computed, inject, input } from "@angular/core";
3
3
  import { coerceBooleanProperty } from "@angular/cdk/coercion";
4
- import { wrCheckStyles } from "ngwr/utils";
4
+ import { WR_KEYS, wrCheckStyles, wrHasModifier } from "ngwr/utils";
5
+ import { Directionality } from "@angular/cdk/bidi";
5
6
  /**
6
7
  * @license
7
8
  *
8
9
  * Use of this source code is governed by an MIT-style license that can be
9
10
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
10
11
  */
12
+ const CONTROL_SELECTOR = "a[href], button, input:not([type=\"hidden\"]), select, textarea, [contenteditable], [tabindex]";
13
+ const COMPOSITE_SELECTOR = [
14
+ "radiogroup",
15
+ "tablist",
16
+ "listbox",
17
+ "menu",
18
+ "menubar",
19
+ "slider",
20
+ "spinbutton",
21
+ "combobox",
22
+ "grid",
23
+ "tree",
24
+ "treegrid"
25
+ ].map((role) => `[role="${role}"]`).join(", ");
26
+ function isVisible(el) {
27
+ if (typeof el.checkVisibility !== "function") return true;
28
+ return el.checkVisibility({ visibilityProperty: true });
29
+ }
30
+ const NON_TEXT_INPUTS = /* @__PURE__ */ new Set([
31
+ "button",
32
+ "checkbox",
33
+ "submit",
34
+ "reset",
35
+ "image",
36
+ "color",
37
+ "file"
38
+ ]);
11
39
  var WrToolbar = class WrToolbar {
40
+ host = inject(ElementRef).nativeElement;
41
+ dir = inject(Directionality, { optional: true });
42
+ isRtl = computed(() => this.dir?.valueSignal() === "rtl", ...ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []);
12
43
  constructor() {
13
44
  if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("toolbar");
45
+ afterRenderEffect((onCleanup) => {
46
+ if (this.arrowKeys()) onCleanup(this.attachRoving());
47
+ });
14
48
  }
15
49
  responsive = input(false, {
16
50
  ...ngDevMode ? { debugName: "responsive" } : /* istanbul ignore next */ {},
17
51
  transform: coerceBooleanProperty
18
52
  });
53
+ arrowKeys = input(false, {
54
+ ...ngDevMode ? { debugName: "arrowKeys" } : /* istanbul ignore next */ {},
55
+ transform: coerceBooleanProperty
56
+ });
57
+ attachRoving() {
58
+ const host = this.host;
59
+ const original = /* @__PURE__ */ new Map();
60
+ const written = /* @__PURE__ */ new Map();
61
+ const changedByConsumer = (el) => written.get(el) !== el.getAttribute("tabindex");
62
+ let stop = null;
63
+ const controls = () => Array.from(host.querySelectorAll(CONTROL_SELECTOR)).filter((el) => {
64
+ if (el.matches(":disabled") || el.closest("[hidden], [inert]") || !isVisible(el)) return false;
65
+ if (changedByConsumer(el) && Number(el.getAttribute("tabindex")) < 0) return false;
66
+ return !this.ownsArrows(el);
67
+ });
68
+ const restore = (el, value) => {
69
+ if (!changedByConsumer(el)) {
70
+ if (value === null) el.removeAttribute("tabindex");
71
+ else el.setAttribute("tabindex", value);
72
+ }
73
+ written.delete(el);
74
+ };
75
+ const sync = () => {
76
+ const all = controls();
77
+ for (const [el, value] of original) {
78
+ if (all.includes(el)) continue;
79
+ restore(el, value);
80
+ original.delete(el);
81
+ }
82
+ if (!stop || !all.includes(stop)) stop = all[0] ?? null;
83
+ for (const el of all) {
84
+ if (!original.has(el) || changedByConsumer(el)) original.set(el, el.getAttribute("tabindex"));
85
+ const value = el === stop ? "0" : "-1";
86
+ el.setAttribute("tabindex", value);
87
+ written.set(el, value);
88
+ }
89
+ };
90
+ const onFocusin = (event) => {
91
+ const target = event.target;
92
+ if (target instanceof HTMLElement && controls().includes(target)) {
93
+ stop = target;
94
+ sync();
95
+ }
96
+ };
97
+ const onKeydown = (event) => {
98
+ const target = event.target;
99
+ if (!(target instanceof HTMLElement) || event.defaultPrevented || wrHasModifier(event)) return;
100
+ const all = controls();
101
+ const idx = all.indexOf(target);
102
+ if (idx < 0) return;
103
+ const forward = (idx + 1) % all.length;
104
+ const backward = (idx - 1 + all.length) % all.length;
105
+ const rtl = this.isRtl();
106
+ let next;
107
+ switch (event.key) {
108
+ case WR_KEYS.ARROW_RIGHT:
109
+ next = rtl ? backward : forward;
110
+ break;
111
+ case WR_KEYS.ARROW_LEFT:
112
+ next = rtl ? forward : backward;
113
+ break;
114
+ case WR_KEYS.HOME:
115
+ next = 0;
116
+ break;
117
+ case WR_KEYS.END:
118
+ next = all.length - 1;
119
+ break;
120
+ default: return;
121
+ }
122
+ event.preventDefault();
123
+ all[next].focus({ focusVisible: true });
124
+ };
125
+ sync();
126
+ host.addEventListener("focusin", onFocusin);
127
+ host.addEventListener("keydown", onKeydown);
128
+ const observer = new MutationObserver(sync);
129
+ observer.observe(host, {
130
+ childList: true,
131
+ subtree: true,
132
+ attributes: true,
133
+ attributeFilter: [
134
+ "disabled",
135
+ "hidden",
136
+ "inert",
137
+ "class",
138
+ "style"
139
+ ]
140
+ });
141
+ return () => {
142
+ observer.disconnect();
143
+ host.removeEventListener("focusin", onFocusin);
144
+ host.removeEventListener("keydown", onKeydown);
145
+ for (const [el, value] of original) restore(el, value);
146
+ original.clear();
147
+ };
148
+ }
149
+ ownsArrows(el) {
150
+ if (el instanceof HTMLTextAreaElement || el instanceof HTMLSelectElement || el.isContentEditable) return true;
151
+ if (el instanceof HTMLInputElement && !NON_TEXT_INPUTS.has(el.type)) return true;
152
+ const widget = el.closest(COMPOSITE_SELECTOR);
153
+ return widget !== null && widget !== this.host && this.host.contains(widget);
154
+ }
19
155
  static ɵfac = i0.ɵɵngDeclareFactory({
20
156
  minVersion: "12.0.0",
21
157
  version: "22.3.0",
@@ -30,13 +166,22 @@ var WrToolbar = class WrToolbar {
30
166
  type: WrToolbar,
31
167
  isStandalone: true,
32
168
  selector: "wr-toolbar",
33
- inputs: { responsive: {
34
- classPropertyName: "responsive",
35
- publicName: "responsive",
36
- isSignal: true,
37
- isRequired: false,
38
- transformFunction: null
39
- } },
169
+ inputs: {
170
+ responsive: {
171
+ classPropertyName: "responsive",
172
+ publicName: "responsive",
173
+ isSignal: true,
174
+ isRequired: false,
175
+ transformFunction: null
176
+ },
177
+ arrowKeys: {
178
+ classPropertyName: "arrowKeys",
179
+ publicName: "arrowKeys",
180
+ isSignal: true,
181
+ isRequired: false,
182
+ transformFunction: null
183
+ }
184
+ },
40
185
  host: {
41
186
  attributes: { "role": "toolbar" },
42
187
  properties: { "class.wr-toolbar--responsive": "responsive()" },
@@ -66,14 +211,24 @@ i0.ɵɵngDeclareClassMetadata({
66
211
  }]
67
212
  }],
68
213
  ctorParameters: () => [],
69
- propDecorators: { responsive: [{
70
- type: i0.Input,
71
- args: [{
72
- isSignal: true,
73
- alias: "responsive",
74
- required: false
214
+ propDecorators: {
215
+ responsive: [{
216
+ type: i0.Input,
217
+ args: [{
218
+ isSignal: true,
219
+ alias: "responsive",
220
+ required: false
221
+ }]
222
+ }],
223
+ arrowKeys: [{
224
+ type: i0.Input,
225
+ args: [{
226
+ isSignal: true,
227
+ alias: "arrowKeys",
228
+ required: false
229
+ }]
75
230
  }]
76
- }] }
231
+ }
77
232
  });
78
233
  export { WrToolbar };
79
234
 
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-toolbar.mjs","names":[],"sources":["../../../projects/lib/toolbar/toolbar.ts","../../../projects/lib/toolbar/toolbar.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, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Action bar with three named zones — `[wrToolbarStart]`,\n * `[wrToolbarCenter]`, `[wrToolbarEnd]`. Use any one or all three.\n *\n * A bare `<div>` wrapper in a zone, one with no `class` and no `style`, is laid\n * out as a wrapping row with the zone's own gap, so the controls inside it are\n * spaced exactly like controls projected one by one. The gap follows\n * `--wr-density-gap`. Give the wrapper a class or a style and its layout is\n * yours: the toolbar sets nothing on it. Put running text in a `<span>` or a\n * `<p>`, which stay in inline flow.\n *\n * @example\n * ```html\n * <wr-toolbar>\n * <div wrToolbarStart>\n * <button wr-btn>Back</button>\n * <strong>Items</strong>\n * </div>\n * <div wrToolbarCenter>\n * <wr-segmented [(value)]=\"view\" [options]=\"['grid', 'list']\" />\n * </div>\n * <div wrToolbarEnd>\n * <button wr-btn color=\"primary\">New</button>\n * </div>\n * </wr-toolbar>\n * ```\n *\n * @see https://ngwr.dev/reference/components/toolbar\n */\n@Component({\n selector: 'wr-toolbar',\n templateUrl: './toolbar.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-toolbar', role: 'toolbar', '[class.wr-toolbar--responsive]': 'responsive()' },\n})\nexport class WrToolbar {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('toolbar');\n }\n\n /**\n * Stack the zones vertically when the toolbar's own box is too narrow to fit\n * them in a row (a container query on its own width, not the viewport — so it\n * adapts inside a narrow column or split pane). @default false\n */\n readonly responsive = input(false, { transform: coerceBooleanProperty });\n}\n","<div class=\"wr-toolbar__zone wr-toolbar__zone--start\">\n <ng-content select=\"[wrToolbarStart]\" />\n</div>\n<div class=\"wr-toolbar__zone wr-toolbar__zone--center\">\n <ng-content select=\"[wrToolbarCenter]\" />\n</div>\n<div class=\"wr-toolbar__zone wr-toolbar__zone--end\">\n <ng-content select=\"[wrToolbarEnd]\" />\n</div>\n"],"mappings":";;;;;;;;;;AA+CA,IAAa,YAAb,MAAa,UAAS;CACpB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,SAAS;CAC5E;CAOS,aAAa,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,aAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAV1D,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAS,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAT,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAS,cAAA;EAAA,UAAA;EAAA,QAAA,EAAA,YAAA;GAAA,mBAAA;GAAA,YAAA;GAAA,UAAA;GAAA,YAAA;GAAA,mBAAA;EAAA,EAAA;EAAA,MAAA;GAAA,YAAA,EAAA,QAAA,UAAA;GAAA,YAAA,EAAA,gCAAA,eAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UC/CtB;EASA,eAAA,GAAA,kBAAA;CAAA,CAAA;;ADsCa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EANrB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAY,eAEP,kBAAkB;GAAI,MAC/B;IAAE,OAAO;IAAc,MAAM;IAAW,kCAAkC;GAAc;GAAE,UAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-toolbar.mjs","names":[],"sources":["../../../projects/lib/toolbar/toolbar.ts","../../../projects/lib/toolbar/toolbar.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 { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ElementRef, ViewEncapsulation, afterRenderEffect, computed, inject, input } from '@angular/core';\n\nimport { WR_KEYS, wrCheckStyles, wrHasModifier } from 'ngwr/utils';\n\nconst CONTROL_SELECTOR = 'a[href], button, input:not([type=\"hidden\"]), select, textarea, [contenteditable], [tabindex]';\n\n/** Roles whose widget handles the arrow keys itself. */\nconst COMPOSITE_SELECTOR = [\n 'radiogroup',\n 'tablist',\n 'listbox',\n 'menu',\n 'menubar',\n 'slider',\n 'spinbutton',\n 'combobox',\n 'grid',\n 'tree',\n 'treegrid',\n]\n .map(role => `[role=\"${role}\"]`)\n .join(', ');\n\n/** `visibility: hidden` counts as hidden. An engine without `checkVisibility` is taken as visible. */\nfunction isVisible(el: HTMLElement): boolean {\n if (typeof el.checkVisibility !== 'function') return true;\n return el.checkVisibility({ visibilityProperty: true });\n}\n\nconst NON_TEXT_INPUTS = new Set(['button', 'checkbox', 'submit', 'reset', 'image', 'color', 'file']);\n\n/**\n * Action bar with three named zones — `[wrToolbarStart]`,\n * `[wrToolbarCenter]`, `[wrToolbarEnd]`. Use any one or all three.\n *\n * A bare `<div>` wrapper in a zone, one with no `class` and no `style`, is laid\n * out as a wrapping row with the zone's own gap, so the controls inside it are\n * spaced exactly like controls projected one by one. The gap follows\n * `--wr-density-gap`. Give the wrapper a class or a style and its layout is\n * yours: the toolbar sets nothing on it. Put running text in a `<span>` or a\n * `<p>`, which stay in inline flow.\n *\n * The host is `role=\"toolbar\"`. Name it with a plain `aria-label` attribute on\n * the host when the page has more than one.\n *\n * With `arrowKeys` the toolbar follows the WAI-ARIA toolbar pattern: one tab stop\n * across every enabled control of the three zones, moved with the arrow keys.\n *\n * @example\n * ```html\n * <wr-toolbar>\n * <div wrToolbarStart>\n * <button wr-btn>Back</button>\n * <strong>Items</strong>\n * </div>\n * <div wrToolbarCenter>\n * <wr-segmented [(value)]=\"view\" [options]=\"['grid', 'list']\" />\n * </div>\n * <div wrToolbarEnd>\n * <button wr-btn color=\"primary\">New</button>\n * </div>\n * </wr-toolbar>\n * ```\n *\n * @see https://ngwr.dev/reference/components/toolbar\n */\n@Component({\n selector: 'wr-toolbar',\n templateUrl: './toolbar.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-toolbar', role: 'toolbar', '[class.wr-toolbar--responsive]': 'responsive()' },\n})\nexport class WrToolbar {\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly dir = inject(Directionality, { optional: true });\n private readonly isRtl = computed(() => this.dir?.valueSignal() === 'rtl');\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('toolbar');\n afterRenderEffect(onCleanup => {\n if (this.arrowKeys()) onCleanup(this.attachRoving());\n });\n }\n\n /**\n * Stack the zones vertically when the toolbar's own box is too narrow to fit\n * them in a row (a container query on its own width, not the viewport — so it\n * adapts inside a narrow column or split pane). @default false\n */\n readonly responsive = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Roving focus across the enabled controls of all zones, per the WAI-ARIA toolbar\n * pattern: one tab stop, ArrowRight / ArrowLeft (mirrored under RTL) to step with\n * wrapping, Home / End for the ends. Text fields, native radios and composite\n * widgets (radiogroup, tablist, listbox, ...) are not part of that set: they keep\n * their own tab stop and their own arrow keys, and the arrows skip over them. Tab\n * still reaches every one of them. @default false\n */\n readonly arrowKeys = input(false, { transform: coerceBooleanProperty });\n\n /** Starts listening and returns the cleanup that puts every `tabindex` back. */\n private attachRoving(): () => void {\n const host = this.host;\n const original = new Map<HTMLElement, string | null>();\n // The value last written per control: a different one now is the consumer's.\n const written = new Map<HTMLElement, string>();\n const changedByConsumer = (el: HTMLElement): boolean => written.get(el) !== el.getAttribute('tabindex');\n let stop: HTMLElement | null = null;\n\n const controls = (): HTMLElement[] =>\n Array.from(host.querySelectorAll<HTMLElement>(CONTROL_SELECTOR)).filter(el => {\n if (el.matches(':disabled') || el.closest('[hidden], [inert]') || !isVisible(el)) return false;\n // A negative tabindex that is not ours is the consumer's: out of the roving set.\n if (changedByConsumer(el) && Number(el.getAttribute('tabindex')) < 0) return false;\n // Text fields and composite widgets keep their own tab stop and their own arrows.\n return !this.ownsArrows(el);\n });\n\n const restore = (el: HTMLElement, value: string | null): void => {\n // A value the consumer wrote since is theirs to keep.\n if (!changedByConsumer(el)) {\n if (value === null) el.removeAttribute('tabindex');\n else el.setAttribute('tabindex', value);\n }\n written.delete(el);\n };\n\n const sync = (): void => {\n const all = controls();\n for (const [el, value] of original) {\n // A control that left, or stopped being eligible, gets its own tabindex back.\n if (all.includes(el)) continue;\n restore(el, value);\n original.delete(el);\n }\n if (!stop || !all.includes(stop)) stop = all[0] ?? null;\n for (const el of all) {\n if (!original.has(el) || changedByConsumer(el)) original.set(el, el.getAttribute('tabindex'));\n const value = el === stop ? '0' : '-1';\n el.setAttribute('tabindex', value);\n written.set(el, value);\n }\n };\n\n const onFocusin = (event: FocusEvent): void => {\n const target = event.target;\n if (target instanceof HTMLElement && controls().includes(target)) {\n stop = target;\n sync();\n }\n };\n\n const onKeydown = (event: KeyboardEvent): void => {\n const target = event.target;\n if (!(target instanceof HTMLElement) || event.defaultPrevented || wrHasModifier(event)) return;\n const all = controls();\n const idx = all.indexOf(target);\n if (idx < 0) return;\n const forward = (idx + 1) % all.length;\n const backward = (idx - 1 + all.length) % all.length;\n const rtl = this.isRtl();\n let next: number;\n switch (event.key) {\n case WR_KEYS.ARROW_RIGHT:\n next = rtl ? backward : forward;\n break;\n case WR_KEYS.ARROW_LEFT:\n next = rtl ? forward : backward;\n break;\n case WR_KEYS.HOME:\n next = 0;\n break;\n case WR_KEYS.END:\n next = all.length - 1;\n break;\n default:\n return;\n }\n event.preventDefault();\n // Firefox keeps a mouse-clicked control's ring off for a focus moved by script.\n all[next].focus({ focusVisible: true });\n };\n\n sync();\n host.addEventListener('focusin', onFocusin);\n host.addEventListener('keydown', onKeydown);\n const observer = new MutationObserver(sync);\n observer.observe(host, {\n childList: true,\n subtree: true,\n attributes: true,\n // Never `tabindex`: sync writes it, and watching it would loop.\n attributeFilter: ['disabled', 'hidden', 'inert', 'class', 'style'],\n });\n\n return () => {\n observer.disconnect();\n host.removeEventListener('focusin', onFocusin);\n host.removeEventListener('keydown', onKeydown);\n for (const [el, value] of original) restore(el, value);\n original.clear();\n };\n }\n\n /** Does `el` need the arrow keys for itself: a text field, or inside a composite widget? */\n private ownsArrows(el: HTMLElement): boolean {\n if (el instanceof HTMLTextAreaElement || el instanceof HTMLSelectElement || el.isContentEditable) return true;\n if (el instanceof HTMLInputElement && !NON_TEXT_INPUTS.has(el.type)) return true;\n const widget = el.closest(COMPOSITE_SELECTOR);\n return widget !== null && widget !== this.host && this.host.contains(widget);\n }\n}\n","<div class=\"wr-toolbar__zone wr-toolbar__zone--start\">\n <ng-content select=\"[wrToolbarStart]\" />\n</div>\n<div class=\"wr-toolbar__zone wr-toolbar__zone--center\">\n <ng-content select=\"[wrToolbarCenter]\" />\n</div>\n<div class=\"wr-toolbar__zone wr-toolbar__zone--end\">\n <ng-content select=\"[wrToolbarEnd]\" />\n</div>\n"],"mappings":";;;;;;;;;;;AAaA,MAAM,mBAAmB;AAGzB,MAAM,qBAAqB;CACzB;CACA;C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,CAAA;CAAT,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAS,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,YAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,WAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA;GAAA,YAAA,EAAA,QAAA,UAAA;GAAA,YAAA,EAAA,gCAAA,eAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UCjFtB;EASA,eAAA,GAAA,kBAAA;CAAA,CAAA;;ADwEa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EANrB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAY,eAEP,kBAAkB;GAAI,MAC/B;IAAE,OAAO;IAAc,MAAM;IAAW,kCAAkC;GAAc;GAAE,UAAA;EAAA,CAAA"}
@@ -51,6 +51,7 @@ var WrTransfer = class WrTransfer {
51
51
  resolvedEmpty = useI18nText(this.emptyText, "transfer.empty", "Nothing here");
52
52
  resolvedSelectAll = useI18nText(this.selectAllLabel, "transfer.selectAll", "Select all");
53
53
  selectAllAria = useI18nFormatter("transfer.selectAllAria", "{{pane}} — {{action}}");
54
+ searchAria = useI18nFormatter("transfer.searchAria", "{{title}} - {{search}}");
54
55
  resolvedToTarget = useI18nText(this.toTargetLabel, "transfer.toTarget", "Move to selected");
55
56
  resolvedToSource = useI18nText(this.toSourceLabel, "transfer.toSource", "Move to available");
56
57
  countLabel = useI18nFormatter("transfer.count", "{{checked}} / {{total}}");
@@ -298,7 +299,7 @@ var WrTransfer = class WrTransfer {
298
299
  useValue: null
299
300
  }],
300
301
  ngImport: i0,
301
- template: "<!--\n Two panes and the buttons between them. Each pane is a PLAIN `<ul>` of\n checkboxes, deliberately: dressing it as a `role=\"listbox\"` of `role=\"option\"`\n rows reads better in the abstract but is invalid — an option may not contain an\n interactive control, and the axe gate says so. The checkbox is the thing the\n user operates, so it is the thing the semantics should describe; the pane\n heading names the group.\n-->\n@for (pane of panes; track pane) {\n @let state = pane === 'source' ? source() : target();\n @let title = pane === 'source' ? resolvedSourceTitle() : resolvedTargetTitle();\n\n <div class=\"wr-transfer__pane\" [class.wr-transfer__pane--target]=\"pane === 'target'\">\n <div class=\"wr-transfer__head\">\n <wr-checkbox\n [size]=\"controlSize()\"\n [checked]=\"state.allChecked\"\n [indeterminate]=\"state.someChecked\"\n [disabled]=\"disabled() || state.enabledCount === 0\"\n [readonly]=\"readonly()\"\n [ariaLabel]=\"selectAllAria({ action: resolvedSelectAll(), pane: title })\"\n (checkedChange)=\"toggleAll(pane, $event)\"\n />\n <span class=\"wr-transfer__title\">{{ title }}</span>\n <span class=\"wr-transfer__count\">{{\n countLabel({ checked: state.checkedCount, total: state.rows.length })\n }}</span>\n </div>\n\n @if (searchable()) {\n <div class=\"wr-transfer__search\">\n <input\n wrInput\n [size]=\"controlSize()\"\n type=\"search\"\n [placeholder]=\"resolvedSearch()\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"`${title} — ${resolvedSearch()}`\"\n (input)=\"onSearch(pane, $event)\"\n />\n </div>\n }\n\n <ul class=\"wr-transfer__list\" [attr.aria-label]=\"title\">\n @for (item of state.rows; track item.value) {\n <li class=\"wr-transfer__item\" [class.wr-transfer__item--disabled]=\"item.disabled\">\n <wr-checkbox\n [size]=\"controlSize()\"\n [checked]=\"isChecked(pane, item)\"\n [disabled]=\"disabled() || !!item.disabled\"\n [readonly]=\"readonly()\"\n (checkedChange)=\"toggle(pane, item, $event)\"\n (touch)=\"touch.emit()\"\n >\n {{ item.label }}\n </wr-checkbox>\n </li>\n } @empty {\n <li class=\"wr-transfer__empty\">{{ resolvedEmpty() }}</li>\n }\n </ul>\n </div>\n\n <!-- The buttons live between the panes, so they are emitted after the first. -->\n @if (pane === 'source') {\n <div class=\"wr-transfer__actions\">\n <button\n wr-btn\n type=\"button\"\n [size]=\"controlSize()\"\n color=\"primary\"\n outlined\n class=\"wr-transfer__move wr-transfer__move--to-target\"\n [disabled]=\"!canMoveRight()\"\n [attr.aria-label]=\"resolvedToTarget()\"\n (click)=\"moveRight()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n <button\n wr-btn\n type=\"button\"\n [size]=\"controlSize()\"\n color=\"primary\"\n outlined\n class=\"wr-transfer__move wr-transfer__move--to-source\"\n [disabled]=\"!canMoveLeft()\"\n [attr.aria-label]=\"resolvedToSource()\"\n (click)=\"moveLeft()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n </button>\n </div>\n }\n}\n",
302
+ template: "<!--\n Two panes and the buttons between them. Each pane is a PLAIN `<ul>` of\n checkboxes, deliberately: dressing it as a `role=\"listbox\"` of `role=\"option\"`\n rows reads better in the abstract but is invalid — an option may not contain an\n interactive control, and the axe gate says so. The checkbox is the thing the\n user operates, so it is the thing the semantics should describe; the pane\n heading names the group.\n-->\n@for (pane of panes; track pane) {\n @let state = pane === 'source' ? source() : target();\n @let title = pane === 'source' ? resolvedSourceTitle() : resolvedTargetTitle();\n\n <div class=\"wr-transfer__pane\" [class.wr-transfer__pane--target]=\"pane === 'target'\">\n <div class=\"wr-transfer__head\">\n <wr-checkbox\n [size]=\"controlSize()\"\n [checked]=\"state.allChecked\"\n [indeterminate]=\"state.someChecked\"\n [disabled]=\"disabled() || state.enabledCount === 0\"\n [readonly]=\"readonly()\"\n [ariaLabel]=\"selectAllAria({ action: resolvedSelectAll(), pane: title })\"\n (checkedChange)=\"toggleAll(pane, $event)\"\n />\n <span class=\"wr-transfer__title\">{{ title }}</span>\n <span class=\"wr-transfer__count\">{{\n countLabel({ checked: state.checkedCount, total: state.rows.length })\n }}</span>\n </div>\n\n @if (searchable()) {\n <div class=\"wr-transfer__search\">\n <input\n wrInput\n [size]=\"controlSize()\"\n type=\"search\"\n [placeholder]=\"resolvedSearch()\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"searchAria({ title, search: resolvedSearch() })\"\n (input)=\"onSearch(pane, $event)\"\n />\n </div>\n }\n\n <ul class=\"wr-transfer__list\" [attr.aria-label]=\"title\">\n @for (item of state.rows; track item.value) {\n <li class=\"wr-transfer__item\" [class.wr-transfer__item--disabled]=\"item.disabled\">\n <wr-checkbox\n [size]=\"controlSize()\"\n [checked]=\"isChecked(pane, item)\"\n [disabled]=\"disabled() || !!item.disabled\"\n [readonly]=\"readonly()\"\n (checkedChange)=\"toggle(pane, item, $event)\"\n (touch)=\"touch.emit()\"\n >\n {{ item.label }}\n </wr-checkbox>\n </li>\n } @empty {\n <li class=\"wr-transfer__empty\">{{ resolvedEmpty() }}</li>\n }\n </ul>\n </div>\n\n <!-- The buttons live between the panes, so they are emitted after the first. -->\n @if (pane === 'source') {\n <div class=\"wr-transfer__actions\">\n <button\n wr-btn\n type=\"button\"\n [size]=\"controlSize()\"\n color=\"primary\"\n outlined\n class=\"wr-transfer__move wr-transfer__move--to-target\"\n [disabled]=\"!canMoveRight()\"\n [attr.aria-label]=\"resolvedToTarget()\"\n (click)=\"moveRight()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n <button\n wr-btn\n type=\"button\"\n [size]=\"controlSize()\"\n color=\"primary\"\n outlined\n class=\"wr-transfer__move wr-transfer__move--to-source\"\n [disabled]=\"!canMoveLeft()\"\n [attr.aria-label]=\"resolvedToSource()\"\n (click)=\"moveLeft()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n </button>\n </div>\n }\n}\n",
302
303
  dependencies: [
303
304
  {
304
305
  kind: "component",
@@ -373,7 +374,7 @@ i0.ɵɵngDeclareClassMetadata({
373
374
  WrCheckbox,
374
375
  WrInput
375
376
  ],
376
- template: "<!--\n Two panes and the buttons between them. Each pane is a PLAIN `<ul>` of\n checkboxes, deliberately: dressing it as a `role=\"listbox\"` of `role=\"option\"`\n rows reads better in the abstract but is invalid — an option may not contain an\n interactive control, and the axe gate says so. The checkbox is the thing the\n user operates, so it is the thing the semantics should describe; the pane\n heading names the group.\n-->\n@for (pane of panes; track pane) {\n @let state = pane === 'source' ? source() : target();\n @let title = pane === 'source' ? resolvedSourceTitle() : resolvedTargetTitle();\n\n <div class=\"wr-transfer__pane\" [class.wr-transfer__pane--target]=\"pane === 'target'\">\n <div class=\"wr-transfer__head\">\n <wr-checkbox\n [size]=\"controlSize()\"\n [checked]=\"state.allChecked\"\n [indeterminate]=\"state.someChecked\"\n [disabled]=\"disabled() || state.enabledCount === 0\"\n [readonly]=\"readonly()\"\n [ariaLabel]=\"selectAllAria({ action: resolvedSelectAll(), pane: title })\"\n (checkedChange)=\"toggleAll(pane, $event)\"\n />\n <span class=\"wr-transfer__title\">{{ title }}</span>\n <span class=\"wr-transfer__count\">{{\n countLabel({ checked: state.checkedCount, total: state.rows.length })\n }}</span>\n </div>\n\n @if (searchable()) {\n <div class=\"wr-transfer__search\">\n <input\n wrInput\n [size]=\"controlSize()\"\n type=\"search\"\n [placeholder]=\"resolvedSearch()\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"`${title} — ${resolvedSearch()}`\"\n (input)=\"onSearch(pane, $event)\"\n />\n </div>\n }\n\n <ul class=\"wr-transfer__list\" [attr.aria-label]=\"title\">\n @for (item of state.rows; track item.value) {\n <li class=\"wr-transfer__item\" [class.wr-transfer__item--disabled]=\"item.disabled\">\n <wr-checkbox\n [size]=\"controlSize()\"\n [checked]=\"isChecked(pane, item)\"\n [disabled]=\"disabled() || !!item.disabled\"\n [readonly]=\"readonly()\"\n (checkedChange)=\"toggle(pane, item, $event)\"\n (touch)=\"touch.emit()\"\n >\n {{ item.label }}\n </wr-checkbox>\n </li>\n } @empty {\n <li class=\"wr-transfer__empty\">{{ resolvedEmpty() }}</li>\n }\n </ul>\n </div>\n\n <!-- The buttons live between the panes, so they are emitted after the first. -->\n @if (pane === 'source') {\n <div class=\"wr-transfer__actions\">\n <button\n wr-btn\n type=\"button\"\n [size]=\"controlSize()\"\n color=\"primary\"\n outlined\n class=\"wr-transfer__move wr-transfer__move--to-target\"\n [disabled]=\"!canMoveRight()\"\n [attr.aria-label]=\"resolvedToTarget()\"\n (click)=\"moveRight()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n <button\n wr-btn\n type=\"button\"\n [size]=\"controlSize()\"\n color=\"primary\"\n outlined\n class=\"wr-transfer__move wr-transfer__move--to-source\"\n [disabled]=\"!canMoveLeft()\"\n [attr.aria-label]=\"resolvedToSource()\"\n (click)=\"moveLeft()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n </button>\n </div>\n }\n}\n"
377
+ template: "<!--\n Two panes and the buttons between them. Each pane is a PLAIN `<ul>` of\n checkboxes, deliberately: dressing it as a `role=\"listbox\"` of `role=\"option\"`\n rows reads better in the abstract but is invalid — an option may not contain an\n interactive control, and the axe gate says so. The checkbox is the thing the\n user operates, so it is the thing the semantics should describe; the pane\n heading names the group.\n-->\n@for (pane of panes; track pane) {\n @let state = pane === 'source' ? source() : target();\n @let title = pane === 'source' ? resolvedSourceTitle() : resolvedTargetTitle();\n\n <div class=\"wr-transfer__pane\" [class.wr-transfer__pane--target]=\"pane === 'target'\">\n <div class=\"wr-transfer__head\">\n <wr-checkbox\n [size]=\"controlSize()\"\n [checked]=\"state.allChecked\"\n [indeterminate]=\"state.someChecked\"\n [disabled]=\"disabled() || state.enabledCount === 0\"\n [readonly]=\"readonly()\"\n [ariaLabel]=\"selectAllAria({ action: resolvedSelectAll(), pane: title })\"\n (checkedChange)=\"toggleAll(pane, $event)\"\n />\n <span class=\"wr-transfer__title\">{{ title }}</span>\n <span class=\"wr-transfer__count\">{{\n countLabel({ checked: state.checkedCount, total: state.rows.length })\n }}</span>\n </div>\n\n @if (searchable()) {\n <div class=\"wr-transfer__search\">\n <input\n wrInput\n [size]=\"controlSize()\"\n type=\"search\"\n [placeholder]=\"resolvedSearch()\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"searchAria({ title, search: resolvedSearch() })\"\n (input)=\"onSearch(pane, $event)\"\n />\n </div>\n }\n\n <ul class=\"wr-transfer__list\" [attr.aria-label]=\"title\">\n @for (item of state.rows; track item.value) {\n <li class=\"wr-transfer__item\" [class.wr-transfer__item--disabled]=\"item.disabled\">\n <wr-checkbox\n [size]=\"controlSize()\"\n [checked]=\"isChecked(pane, item)\"\n [disabled]=\"disabled() || !!item.disabled\"\n [readonly]=\"readonly()\"\n (checkedChange)=\"toggle(pane, item, $event)\"\n (touch)=\"touch.emit()\"\n >\n {{ item.label }}\n </wr-checkbox>\n </li>\n } @empty {\n <li class=\"wr-transfer__empty\">{{ resolvedEmpty() }}</li>\n }\n </ul>\n </div>\n\n <!-- The buttons live between the panes, so they are emitted after the first. -->\n @if (pane === 'source') {\n <div class=\"wr-transfer__actions\">\n <button\n wr-btn\n type=\"button\"\n [size]=\"controlSize()\"\n color=\"primary\"\n outlined\n class=\"wr-transfer__move wr-transfer__move--to-target\"\n [disabled]=\"!canMoveRight()\"\n [attr.aria-label]=\"resolvedToTarget()\"\n (click)=\"moveRight()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n <button\n wr-btn\n type=\"button\"\n [size]=\"controlSize()\"\n color=\"primary\"\n outlined\n class=\"wr-transfer__move wr-transfer__move--to-source\"\n [disabled]=\"!canMoveLeft()\"\n [attr.aria-label]=\"resolvedToSource()\"\n (click)=\"moveLeft()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n </button>\n </div>\n }\n}\n"
377
378
  }]
378
379
  }],
379
380
  ctorParameters: () => [],
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-transfer.mjs","names":[],"sources":["../../../projects/lib/transfer/transfer.ts","../../../projects/lib/transfer/transfer.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n HostAttributeToken,\n ElementRef,\n Injector,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { WrButton } from 'ngwr/button';\nimport { WrCheckbox } from 'ngwr/checkbox';\nimport { WR_FORM_FIELD, useFormFieldAria } from 'ngwr/form';\nimport { useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { WrInput } from 'ngwr/input';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrTransferItem, WrTransferSize } from './types';\n\n/** A pane's rows plus the header state derived from them. */\ninterface PaneState {\n readonly rows: readonly WrTransferItem[];\n /**\n * The staged values this pane is actually SHOWING — visible and enabled. The\n * staging signals can hold more than that (a filter change hides rows without\n * unstaging them), and every consumer of the staged set has to agree on which\n * one it means: the count, the header checkbox and the move all read this.\n */\n readonly checked: readonly unknown[];\n readonly checkedCount: number;\n readonly enabledCount: number;\n readonly allChecked: boolean;\n readonly someChecked: boolean;\n}\n\n/**\n * Dual-listbox picker: two panes and the buttons that move rows between them.\n *\n * The full item set is `[items]` and the RIGHT pane is the value — `[(value)]`\n * holds the chosen `WrTransferItem['value']`s, everything else stays left. The\n * checked state inside each pane is transient staging, deliberately not part of\n * the value: what a form cares about is which rows ended up on the right.\n *\n * A signal-forms native control (`FormValueControl<readonly unknown[]>`), so\n * `[formField]` binds straight to `value`; `[(ngModel)]` and reactive forms keep\n * working through Angular's bridge, and `[(value)]` is the standalone shape.\n *\n * @example\n * ```html\n * <!-- Standalone -->\n * <wr-transfer [items]=\"permissions\" [(value)]=\"granted\" />\n *\n * <!-- Searchable, with pane titles -->\n * <wr-transfer\n * searchable\n * sourceTitle=\"Available\"\n * targetTitle=\"Granted\"\n * [items]=\"permissions\"\n * [formField]=\"form.granted\"\n * />\n * ```\n *\n * @see https://ngwr.dev/reference/components/transfer\n */\n@Component({\n selector: 'wr-transfer',\n templateUrl: './transfer.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-transfer',\n '[class]': 'classes()',\n // `role=\"group\"` so the error state below has somewhere legible to live: the\n // control is a composite with no single element carrying its semantics, and\n // `aria-invalid` on a bare `generic` host is announced by nothing.\n role: 'group',\n // See `wr-checkbox-group`: not labelable, so the field's label named\n // nothing and the composite announced only its inner parts.\n '[attr.aria-labelledby]': 'labelledBy()',\n '[attr.aria-invalid]': 'fieldAria.ariaInvalid()',\n '[attr.aria-describedby]': 'fieldAria.describedBy()',\n },\n // The transfer is the control a `<wr-form-field>` wraps; the checkboxes and\n // the search inputs in its own template are parts, not controls. Without this\n // shield each of them found the field's token and announced the one error as\n // its own — which is why `fieldAria` below reads the field with `skipSelf`.\n providers: [{ provide: WR_FORM_FIELD, useValue: null }],\n imports: [WrButton, WrCheckbox, WrInput],\n})\nexport class WrTransfer implements FormValueControl<readonly unknown[]> {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('transfer');\n if (typeof ngDevMode === 'undefined' || ngDevMode) effect(() => this.warnAboutOrphans(this.orphans()));\n }\n\n /** Every row, in either pane. Membership of the right pane is `value`. */\n readonly items = input<readonly WrTransferItem[]>([]);\n\n /**\n * Values currently in the RIGHT pane. Two-way bindable; bound automatically\n * by `[formField]` / `[(ngModel)]`.\n */\n readonly value = model<readonly unknown[]>([]);\n\n /** Emitted on blur / commit so a bound field marks itself touched. */\n readonly touch = output<void>();\n\n /** Disable the whole control. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Refuse changes to the value while both panes stay focusable and readable.\n * Bound automatically from the field's readonly state when used with\n * `[formField]`.\n *\n * The move buttons go inert and the row checkboxes go read-only; SEARCH keeps\n * working, because filtering a pane changes what is shown and not what is\n * chosen. No `aria-readonly` on the host: role `group` does not support the\n * state, so each row's checkbox mirrors its own instead.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /** The surrounding `<wr-form-field>`'s error state. @internal */\n protected readonly fieldAria = useFormFieldAria({ skipSelf: true });\n /**\n * The author's own `aria-labelledby`, read as a static host attribute.\n *\n * A host binding WRITES the attribute, so binding the field's label\n * unconditionally would REMOVE a reference the consumer put there by hand:\n * `<wr-segmented aria-labelledby=\"range-question\">` went nameless the moment\n * the field's label was `null`, which a harness spec caught one commit after\n * it was introduced. `HostAttributeToken` reads it at construction without\n * touching the DOM, so this stays SSR-safe, and the author's own reference\n * wins — the same precedence `[ariaLabel]` has everywhere else.\n */\n private readonly ownLabelledBy = inject(new HostAttributeToken('aria-labelledby'), { optional: true });\n\n /** The surrounding field's label, unless the author named the control. */\n protected readonly labelledBy = computed(() => this.ownLabelledBy ?? this.fieldAria.labelledBy());\n\n /**\n * Control size: the panes, the headings, the rows and the move buttons. The\n * checkboxes, search boxes and buttons inside are `sm` controls at `sm` and\n * `md`, and `md` controls at `lg`.\n *\n * @default 'md'\n */\n readonly size = input<WrTransferSize>('md');\n\n /** Size of the checkboxes, search boxes and buttons the panes render. */\n protected readonly controlSize = computed(() => (this.size() === 'lg' ? 'md' : 'sm'));\n\n /** Show a filter box above each pane. @default false */\n readonly searchable = input(false, { transform: coerceBooleanProperty });\n\n /** Heading above the left pane. Falls back to `transfer.source`. */\n readonly sourceTitle = input<string | null>(null);\n\n /** Heading above the right pane. Falls back to `transfer.target`. */\n readonly targetTitle = input<string | null>(null);\n\n /** Placeholder in both filter boxes. Falls back to `transfer.search`. */\n readonly searchPlaceholder = input<string | null>(null);\n\n /** Shown in a pane with no rows. Falls back to `transfer.empty`. */\n readonly emptyText = input<string | null>(null);\n\n /**\n * Accessible name of each pane's select-all checkbox, composed with the pane\n * heading. Falls back to `transfer.selectAll`.\n */\n readonly selectAllLabel = input<string | null>(null);\n\n /** Accessible name of the move-right button. Falls back to `transfer.toTarget`. */\n readonly toTargetLabel = input<string | null>(null);\n\n /** Accessible name of the move-left button. Falls back to `transfer.toSource`. */\n readonly toSourceLabel = input<string | null>(null);\n\n protected readonly resolvedSourceTitle = useI18nText(this.sourceTitle, 'transfer.source', 'Available');\n protected readonly resolvedTargetTitle = useI18nText(this.targetTitle, 'transfer.target', 'Selected');\n protected readonly resolvedSearch = useI18nText(this.searchPlaceholder, 'transfer.search', 'Search');\n protected readonly resolvedEmpty = useI18nText(this.emptyText, 'transfer.empty', 'Nothing here');\n protected readonly resolvedSelectAll = useI18nText(this.selectAllLabel, 'transfer.selectAll', 'Select all');\n\n /**\n * The select-all checkbox's accessible name, composed IN THE CATALOG.\n *\n * It used to be a template literal — `` `${title} — ${selectAll}` `` — which\n * froze both the separator and the operand order into English. A translator\n * could change each half and not the sentence they make, which is the exact\n * defect the calendar and event-calendar catalogs were rewritten to remove.\n * The key ships as `{{pane}} — {{action}}` in every locale, so nothing reads\n * differently today and every locale can now reorder it without a code change.\n */\n protected readonly selectAllAria = useI18nFormatter('transfer.selectAllAria', '{{pane}} — {{action}}');\n protected readonly resolvedToTarget = useI18nText(this.toTargetLabel, 'transfer.toTarget', 'Move to selected');\n protected readonly resolvedToSource = useI18nText(this.toSourceLabel, 'transfer.toSource', 'Move to available');\n\n /** `{{checked}} / {{total}}` under each heading. @internal */\n protected readonly countLabel = useI18nFormatter('transfer.count', '{{checked}} / {{total}}');\n\n /** Pane order — the template iterates it so both panes share one block. */\n protected readonly panes = ['source', 'target'] as const;\n\n private readonly sourceQuery = signal('');\n private readonly targetQuery = signal('');\n\n /** Staged rows, per pane. Cleared as soon as a move commits them. */\n private readonly sourceChecked = signal<readonly unknown[]>([]);\n private readonly targetChecked = signal<readonly unknown[]>([]);\n\n // The value as a guaranteed array — a classic-forms binding can write null even\n // though the type is `readonly unknown[]`, so normalise every read. Same hazard\n // `wr-checkbox-group` guards; here an unguarded `.map` threw outright.\n private readonly selected = computed<readonly unknown[]>(() => {\n const v = this.value();\n return Array.isArray(v) ? v : [];\n });\n\n private readonly valueSet = computed(() => new Set(this.selected()));\n\n protected readonly source = computed<PaneState>(() =>\n this.pane(\n this.items().filter(item => !this.valueSet().has(item.value)),\n this.sourceQuery(),\n this.sourceChecked()\n )\n );\n\n /** The first item per value, which is the one a scan of `items` would find. */\n private readonly itemByValue = computed(() => {\n const map = new Map<unknown, WrTransferItem>();\n for (const item of this.items()) if (!map.has(item.value)) map.set(item.value, item);\n return map;\n });\n\n // Right-pane order follows `value`, not `items`: the order a user built is\n // the one they expect to read back. Resolved apart from `target`, so a\n // keystroke in the filter or a ticked row does not walk the value again.\n private readonly targetRows = computed<readonly WrTransferItem[]>(() => {\n const byValue = this.itemByValue();\n return this.selected()\n .map(v => byValue.get(v))\n .filter((item): item is WrTransferItem => item !== undefined);\n });\n\n protected readonly target = computed<PaneState>(() =>\n this.pane(this.targetRows(), this.targetQuery(), this.targetChecked())\n );\n\n /** Values no item matches. Equal by content, so its reader runs once per distinct set. */\n private readonly orphans = computed<readonly unknown[]>(\n () => {\n const byValue = this.itemByValue();\n return this.selected().filter(v => !byValue.has(v));\n },\n { equal: (a, b) => a.length === b.length && a.every((v, i) => Object.is(v, b[i])) }\n );\n\n /**\n * Say something when `value` holds a value no `items` entry matches.\n *\n * Such a value is in NEITHER pane — the left one filters out anything already\n * selected and the right one can only render rows it found — and the header\n * counts the rows it shows, so nothing on screen contradicts anything. The\n * result is a value the user can neither see nor remove, and no sign that it\n * is there.\n *\n * A warning rather than an invented row, which matches how the library treats\n * the same question elsewhere: `wr-select` renders a value outside its option\n * list only under an explicit `freeText`, so an unmatched value is a mode a\n * consumer opts into, not a shape a component guesses at. It also stays quiet\n * about the common transient case — `items` arriving after `value` — because\n * the message names the values and a developer can see them settle.\n */\n private warnAboutOrphans(orphans: readonly unknown[]): void {\n if (orphans.length === 0) return;\n\n // eslint-disable-next-line no-console -- dev-mode validation\n console.warn(\n `[NGWR] <wr-transfer>: ${orphans.length} value(s) in \\`value\\` match no \\`items\\` entry ` +\n `and are rendered in neither pane, so a user can neither see nor remove them: ` +\n `${orphans.map(v => JSON.stringify(v)).join(', ')}. ` +\n `If \\`items\\` loads after \\`value\\`, this settles on its own.`\n );\n }\n\n protected readonly canMoveRight = computed(\n () => !this.disabled() && !this.readonly() && this.source().checkedCount > 0\n );\n protected readonly canMoveLeft = computed(\n () => !this.disabled() && !this.readonly() && this.target().checkedCount > 0\n );\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-transfer--${size}`);\n if (this.disabled()) parts.push('wr-transfer--disabled');\n else if (this.readonly()) parts.push('wr-transfer--readonly');\n if (this.searchable()) parts.push('wr-transfer--searchable');\n return parts.join(' ');\n });\n\n protected isChecked(pane: 'source' | 'target', item: WrTransferItem): boolean {\n return (pane === 'source' ? this.sourceChecked() : this.targetChecked()).includes(item.value);\n }\n\n protected toggle(pane: 'source' | 'target', item: WrTransferItem, checked: boolean): void {\n if (item.disabled || this.readonly()) return;\n const box = pane === 'source' ? this.sourceChecked : this.targetChecked;\n const current = box();\n if (checked) {\n box.set([...current, item.value]);\n return;\n }\n // A `Set` compares with SameValueZero, which is what `WrTransferItem['value']`\n // is documented to use and what `isChecked`'s `includes` already does. A `!==`\n // filter cannot remove `NaN` from its own list, so such a row drew itself\n // unchecked while staying staged.\n const next = new Set(current);\n next.delete(item.value);\n box.set([...next]);\n }\n\n /**\n * Header checkbox — stages or clears every enabled row the filter shows, and\n * only those. Staging outlives a filter change, so a row the filter hides keeps\n * whatever state it had: setting the whole box here unstaged hidden rows on a\n * clear and dropped them on a select, which the pane only revealed once the\n * search was emptied.\n */\n protected toggleAll(pane: 'source' | 'target', checked: boolean): void {\n if (this.readonly()) return;\n const state = pane === 'source' ? this.source() : this.target();\n const box = pane === 'source' ? this.sourceChecked : this.targetChecked;\n const next = new Set(box());\n for (const item of state.rows) {\n if (item.disabled) continue;\n if (checked) next.add(item.value);\n else next.delete(item.value);\n }\n box.set([...next]);\n }\n\n protected onSearch(pane: 'source' | 'target', event: Event): void {\n const query = (event.target as HTMLInputElement | null)?.value ?? '';\n (pane === 'source' ? this.sourceQuery : this.targetQuery).set(query);\n }\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly injector = inject(Injector);\n\n /**\n * Focus the transfer — what Signal Forms calls to focus this control. The\n * host is a `group` with no tab stop of its own, so focus goes to the left\n * pane's filter when the panes are searchable, otherwise to the first row that\n * can still be ticked — on the right, once nothing on the left can be.\n *\n * The pane's select-all box comes first in the tab order and is passed over\n * on purpose: it acts on every row at once, and a form pointing at the field\n * is asking for a choice. A disabled transfer has nothing left to focus.\n */\n focus(options?: FocusOptions): void {\n this.host.nativeElement\n .querySelector<HTMLInputElement>(\n '.wr-transfer__search input:not([disabled]), .wr-transfer__item input:not([disabled])'\n )\n ?.focus(options);\n }\n\n /**\n * Keep focus in the widget after a move.\n *\n * A move empties the pane's staging set, which is exactly what disables the\n * button that was just pressed — so the element holding DOM focus went\n * `disabled` as a RESULT of its own activation and the browser dropped focus\n * to `<body>`. From there the next Tab restarts at the top of the document,\n * which for a keyboard user is being thrown out of a control they were in the\n * middle of using.\n *\n * The landing is the FIRST ROW OF THE PANE THE ROWS ARRIVED IN, and the\n * obvious alternative does not work: after a move BOTH buttons are disabled,\n * because each needs something ticked and the move cleared the tick on one\n * side and arrived unticked on the other. The rows that just moved are where\n * the user's attention is and where the next action lives, so that is where\n * focus goes.\n *\n * `afterNextRender`, not `queueMicrotask`: under zoneless CD the microtask\n * runs before the moved rows are in the DOM, so the focus call would land on\n * the pane as it was before the move.\n */\n private restoreFocusAfterMove(landing: 'source' | 'target'): void {\n afterNextRender(\n () => {\n const root = this.host.nativeElement;\n const pane =\n landing === 'target'\n ? root.querySelector<HTMLElement>('.wr-transfer__pane--target')\n : root.querySelector<HTMLElement>('.wr-transfer__pane:not(.wr-transfer__pane--target)');\n const row = pane?.querySelector<HTMLInputElement>('.wr-transfer__item input:not([disabled])');\n row?.focus();\n },\n { injector: this.injector }\n );\n }\n\n protected moveRight(): void {\n if (this.disabled() || this.readonly()) return;\n // `source().checked`, not the raw staging box: rows a filter change hid are\n // neither counted nor ticked any more, so moving them would transfer rows the\n // pane never showed as chosen — and, since staging outlives an external write\n // to `value`, could land the same value on the right twice.\n const moving = this.source().checked;\n if (moving.length === 0) return;\n this.value.set([...this.selected(), ...moving]);\n this.sourceChecked.set([]);\n this.touch.emit();\n this.restoreFocusAfterMove('target');\n }\n\n protected moveLeft(): void {\n if (this.disabled() || this.readonly()) return;\n const moving = new Set(this.target().checked);\n if (moving.size === 0) return;\n this.value.set(this.selected().filter(v => !moving.has(v)));\n this.targetChecked.set([]);\n this.touch.emit();\n this.restoreFocusAfterMove('source');\n }\n\n /** Filter, then derive the header state from what survived. */\n private pane(rows: readonly WrTransferItem[], query: string, checked: readonly unknown[]): PaneState {\n const q = query.trim().toLowerCase();\n const visible = q ? rows.filter(item => item.label.toLowerCase().includes(q)) : rows;\n const enabled = visible.filter(item => !item.disabled);\n const staged = new Set(checked);\n const shown = enabled.filter(item => staged.has(item.value)).map(item => item.value);\n return {\n rows: visible,\n checked: shown,\n checkedCount: shown.length,\n enabledCount: enabled.length,\n allChecked: enabled.length > 0 && shown.length === enabled.length,\n someChecked: shown.length > 0 && shown.length < enabled.length,\n };\n }\n}\n","<!--\n Two panes and the buttons between them. Each pane is a PLAIN `<ul>` of\n checkboxes, deliberately: dressing it as a `role=\"listbox\"` of `role=\"option\"`\n rows reads better in the abstract but is invalid — an option may not contain an\n interactive control, and the axe gate says so. The checkbox is the thing the\n user operates, so it is the thing the semantics should describe; the pane\n heading names the group.\n-->\n@for (pane of panes; track pane) {\n @let state = pane === 'source' ? source() : target();\n @let title = pane === 'source' ? resolvedSourceTitle() : resolvedTargetTitle();\n\n <div class=\"wr-transfer__pane\" [class.wr-transfer__pane--target]=\"pane === 'target'\">\n <div class=\"wr-transfer__head\">\n <wr-checkbox\n [size]=\"controlSize()\"\n [checked]=\"state.allChecked\"\n [indeterminate]=\"state.someChecked\"\n [disabled]=\"disabled() || state.enabledCount === 0\"\n [readonly]=\"readonly()\"\n [ariaLabel]=\"selectAllAria({ action: resolvedSelectAll(), pane: title })\"\n (checkedChange)=\"toggleAll(pane, $event)\"\n />\n <span class=\"wr-transfer__title\">{{ title }}</span>\n <span class=\"wr-transfer__count\">{{\n countLabel({ checked: state.checkedCount, total: state.rows.length })\n }}</span>\n </div>\n\n @if (searchable()) {\n <div class=\"wr-transfer__search\">\n <input\n wrInput\n [size]=\"controlSize()\"\n type=\"search\"\n [placeholder]=\"resolvedSearch()\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"`${title} — ${resolvedSearch()}`\"\n (input)=\"onSearch(pane, $event)\"\n />\n </div>\n }\n\n <ul class=\"wr-transfer__list\" [attr.aria-label]=\"title\">\n @for (item of state.rows; track item.value) {\n <li class=\"wr-transfer__item\" [class.wr-transfer__item--disabled]=\"item.disabled\">\n <wr-checkbox\n [size]=\"controlSize()\"\n [checked]=\"isChecked(pane, item)\"\n [disabled]=\"disabled() || !!item.disabled\"\n [readonly]=\"readonly()\"\n (checkedChange)=\"toggle(pane, item, $event)\"\n (touch)=\"touch.emit()\"\n >\n {{ item.label }}\n </wr-checkbox>\n </li>\n } @empty {\n <li class=\"wr-transfer__empty\">{{ resolvedEmpty() }}</li>\n }\n </ul>\n </div>\n\n <!-- The buttons live between the panes, so they are emitted after the first. -->\n @if (pane === 'source') {\n <div class=\"wr-transfer__actions\">\n <button\n wr-btn\n type=\"button\"\n [size]=\"controlSize()\"\n color=\"primary\"\n outlined\n class=\"wr-transfer__move wr-transfer__move--to-target\"\n [disabled]=\"!canMoveRight()\"\n [attr.aria-label]=\"resolvedToTarget()\"\n (click)=\"moveRight()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n <button\n wr-btn\n type=\"button\"\n [size]=\"controlSize()\"\n color=\"primary\"\n outlined\n class=\"wr-transfer__move wr-transfer__move--to-source\"\n [disabled]=\"!canMoveLeft()\"\n [attr.aria-label]=\"resolvedToSource()\"\n (click)=\"moveLeft()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n </button>\n </div>\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAuGA,IAAa,aAAb,MAAa,WAAU;CACrB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,UAAU;EAC3E,IAAI,OAAO,cAAc,eAAe,WAAW,aAAa,KAAK,iBAAiB,KAAK,QAAO,CAAE,CAAC;CACvG;CAGS,QAAQ,MAAiC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAM5C,QAAQ,MAA0B,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAGrC,QAAQ,OAAM;CAGd,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAc1D,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;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;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAU,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,iBAAA,OAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAO,UAAA;IAAA,QAAA,CAAA,QAAA,SAAA;GAAA;EAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAE5B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAU,YAAA,CAAA;EAxBtB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAa,eAER,kBAAkB;GAAI,MAC/B;IACJ,OAAO;IACP,WAAW;IAIX,MAAM;IAGN,0BAA0B;IAC1B,uBAAuB;IACvB,2BAA2B;GAC5B;GAAA,WAKU,CAAC;IAAE,SAAS;IAAe,UAAU;GAAI,CAAE;GAAC,SAC9C;IAAC;IAAU;IAAY;GAAO;GAAC,UAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-transfer.mjs","names":[],"sources":["../../../projects/lib/transfer/transfer.ts","../../../projects/lib/transfer/transfer.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n HostAttributeToken,\n ElementRef,\n Injector,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { WrButton } from 'ngwr/button';\nimport { WrCheckbox } from 'ngwr/checkbox';\nimport { WR_FORM_FIELD, useFormFieldAria } from 'ngwr/form';\nimport { useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { WrInput } from 'ngwr/input';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrTransferItem, WrTransferSize } from './types';\n\n/** A pane's rows plus the header state derived from them. */\ninterface PaneState {\n readonly rows: readonly WrTransferItem[];\n /**\n * The staged values this pane is actually SHOWING — visible and enabled. The\n * staging signals can hold more than that (a filter change hides rows without\n * unstaging them), and every consumer of the staged set has to agree on which\n * one it means: the count, the header checkbox and the move all read this.\n */\n readonly checked: readonly unknown[];\n readonly checkedCount: number;\n readonly enabledCount: number;\n readonly allChecked: boolean;\n readonly someChecked: boolean;\n}\n\n/**\n * Dual-listbox picker: two panes and the buttons that move rows between them.\n *\n * The full item set is `[items]` and the RIGHT pane is the value — `[(value)]`\n * holds the chosen `WrTransferItem['value']`s, everything else stays left. The\n * checked state inside each pane is transient staging, deliberately not part of\n * the value: what a form cares about is which rows ended up on the right.\n *\n * A signal-forms native control (`FormValueControl<readonly unknown[]>`), so\n * `[formField]` binds straight to `value`; `[(ngModel)]` and reactive forms keep\n * working through Angular's bridge, and `[(value)]` is the standalone shape.\n *\n * @example\n * ```html\n * <!-- Standalone -->\n * <wr-transfer [items]=\"permissions\" [(value)]=\"granted\" />\n *\n * <!-- Searchable, with pane titles -->\n * <wr-transfer\n * searchable\n * sourceTitle=\"Available\"\n * targetTitle=\"Granted\"\n * [items]=\"permissions\"\n * [formField]=\"form.granted\"\n * />\n * ```\n *\n * @see https://ngwr.dev/reference/components/transfer\n */\n@Component({\n selector: 'wr-transfer',\n templateUrl: './transfer.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-transfer',\n '[class]': 'classes()',\n // `role=\"group\"` so the error state below has somewhere legible to live: the\n // control is a composite with no single element carrying its semantics, and\n // `aria-invalid` on a bare `generic` host is announced by nothing.\n role: 'group',\n // See `wr-checkbox-group`: not labelable, so the field's label named\n // nothing and the composite announced only its inner parts.\n '[attr.aria-labelledby]': 'labelledBy()',\n '[attr.aria-invalid]': 'fieldAria.ariaInvalid()',\n '[attr.aria-describedby]': 'fieldAria.describedBy()',\n },\n // The transfer is the control a `<wr-form-field>` wraps; the checkboxes and\n // the search inputs in its own template are parts, not controls. Without this\n // shield each of them found the field's token and announced the one error as\n // its own — which is why `fieldAria` below reads the field with `skipSelf`.\n providers: [{ provide: WR_FORM_FIELD, useValue: null }],\n imports: [WrButton, WrCheckbox, WrInput],\n})\nexport class WrTransfer implements FormValueControl<readonly unknown[]> {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('transfer');\n if (typeof ngDevMode === 'undefined' || ngDevMode) effect(() => this.warnAboutOrphans(this.orphans()));\n }\n\n /** Every row, in either pane. Membership of the right pane is `value`. */\n readonly items = input<readonly WrTransferItem[]>([]);\n\n /**\n * Values currently in the RIGHT pane. Two-way bindable; bound automatically\n * by `[formField]` / `[(ngModel)]`.\n */\n readonly value = model<readonly unknown[]>([]);\n\n /** Emitted on blur / commit so a bound field marks itself touched. */\n readonly touch = output<void>();\n\n /** Disable the whole control. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Refuse changes to the value while both panes stay focusable and readable.\n * Bound automatically from the field's readonly state when used with\n * `[formField]`.\n *\n * The move buttons go inert and the row checkboxes go read-only; SEARCH keeps\n * working, because filtering a pane changes what is shown and not what is\n * chosen. No `aria-readonly` on the host: role `group` does not support the\n * state, so each row's checkbox mirrors its own instead.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /** The surrounding `<wr-form-field>`'s error state. @internal */\n protected readonly fieldAria = useFormFieldAria({ skipSelf: true });\n /**\n * The author's own `aria-labelledby`, read as a static host attribute.\n *\n * A host binding WRITES the attribute, so binding the field's label\n * unconditionally would REMOVE a reference the consumer put there by hand:\n * `<wr-segmented aria-labelledby=\"range-question\">` went nameless the moment\n * the field's label was `null`, which a harness spec caught one commit after\n * it was introduced. `HostAttributeToken` reads it at construction without\n * touching the DOM, so this stays SSR-safe, and the author's own reference\n * wins — the same precedence `[ariaLabel]` has everywhere else.\n */\n private readonly ownLabelledBy = inject(new HostAttributeToken('aria-labelledby'), { optional: true });\n\n /** The surrounding field's label, unless the author named the control. */\n protected readonly labelledBy = computed(() => this.ownLabelledBy ?? this.fieldAria.labelledBy());\n\n /**\n * Control size: the panes, the headings, the rows and the move buttons. The\n * checkboxes, search boxes and buttons inside are `sm` controls at `sm` and\n * `md`, and `md` controls at `lg`.\n *\n * @default 'md'\n */\n readonly size = input<WrTransferSize>('md');\n\n /** Size of the checkboxes, search boxes and buttons the panes render. */\n protected readonly controlSize = computed(() => (this.size() === 'lg' ? 'md' : 'sm'));\n\n /** Show a filter box above each pane. @default false */\n readonly searchable = input(false, { transform: coerceBooleanProperty });\n\n /** Heading above the left pane. Falls back to `transfer.source`. */\n readonly sourceTitle = input<string | null>(null);\n\n /** Heading above the right pane. Falls back to `transfer.target`. */\n readonly targetTitle = input<string | null>(null);\n\n /** Placeholder in both filter boxes. Falls back to `transfer.search`. */\n readonly searchPlaceholder = input<string | null>(null);\n\n /** Shown in a pane with no rows. Falls back to `transfer.empty`. */\n readonly emptyText = input<string | null>(null);\n\n /**\n * Accessible name of each pane's select-all checkbox, composed with the pane\n * heading. Falls back to `transfer.selectAll`.\n */\n readonly selectAllLabel = input<string | null>(null);\n\n /** Accessible name of the move-right button. Falls back to `transfer.toTarget`. */\n readonly toTargetLabel = input<string | null>(null);\n\n /** Accessible name of the move-left button. Falls back to `transfer.toSource`. */\n readonly toSourceLabel = input<string | null>(null);\n\n protected readonly resolvedSourceTitle = useI18nText(this.sourceTitle, 'transfer.source', 'Available');\n protected readonly resolvedTargetTitle = useI18nText(this.targetTitle, 'transfer.target', 'Selected');\n protected readonly resolvedSearch = useI18nText(this.searchPlaceholder, 'transfer.search', 'Search');\n protected readonly resolvedEmpty = useI18nText(this.emptyText, 'transfer.empty', 'Nothing here');\n protected readonly resolvedSelectAll = useI18nText(this.selectAllLabel, 'transfer.selectAll', 'Select all');\n\n /**\n * The select-all checkbox's accessible name, composed IN THE CATALOG.\n *\n * It used to be a template literal — `` `${title} — ${selectAll}` `` — which\n * froze both the separator and the operand order into English. A translator\n * could change each half and not the sentence they make, which is the exact\n * defect the calendar and event-calendar catalogs were rewritten to remove.\n * The key ships as `{{pane}} — {{action}}` in every locale, so nothing reads\n * differently today and every locale can now reorder it without a code change.\n */\n protected readonly selectAllAria = useI18nFormatter('transfer.selectAllAria', '{{pane}} — {{action}}');\n\n /** The search input's accessible name, composed in the catalog for the same reason as `selectAllAria`. */\n protected readonly searchAria = useI18nFormatter('transfer.searchAria', '{{title}} - {{search}}');\n protected readonly resolvedToTarget = useI18nText(this.toTargetLabel, 'transfer.toTarget', 'Move to selected');\n protected readonly resolvedToSource = useI18nText(this.toSourceLabel, 'transfer.toSource', 'Move to available');\n\n /** `{{checked}} / {{total}}` under each heading. @internal */\n protected readonly countLabel = useI18nFormatter('transfer.count', '{{checked}} / {{total}}');\n\n /** Pane order — the template iterates it so both panes share one block. */\n protected readonly panes = ['source', 'target'] as const;\n\n private readonly sourceQuery = signal('');\n private readonly targetQuery = signal('');\n\n /** Staged rows, per pane. Cleared as soon as a move commits them. */\n private readonly sourceChecked = signal<readonly unknown[]>([]);\n private readonly targetChecked = signal<readonly unknown[]>([]);\n\n // The value as a guaranteed array — a classic-forms binding can write null even\n // though the type is `readonly unknown[]`, so normalise every read. Same hazard\n // `wr-checkbox-group` guards; here an unguarded `.map` threw outright.\n private readonly selected = computed<readonly unknown[]>(() => {\n const v = this.value();\n return Array.isArray(v) ? v : [];\n });\n\n private readonly valueSet = computed(() => new Set(this.selected()));\n\n protected readonly source = computed<PaneState>(() =>\n this.pane(\n this.items().filter(item => !this.valueSet().has(item.value)),\n this.sourceQuery(),\n this.sourceChecked()\n )\n );\n\n /** The first item per value, which is the one a scan of `items` would find. */\n private readonly itemByValue = computed(() => {\n const map = new Map<unknown, WrTransferItem>();\n for (const item of this.items()) if (!map.has(item.value)) map.set(item.value, item);\n return map;\n });\n\n // Right-pane order follows `value`, not `items`: the order a user built is\n // the one they expect to read back. Resolved apart from `target`, so a\n // keystroke in the filter or a ticked row does not walk the value again.\n private readonly targetRows = computed<readonly WrTransferItem[]>(() => {\n const byValue = this.itemByValue();\n return this.selected()\n .map(v => byValue.get(v))\n .filter((item): item is WrTransferItem => item !== undefined);\n });\n\n protected readonly target = computed<PaneState>(() =>\n this.pane(this.targetRows(), this.targetQuery(), this.targetChecked())\n );\n\n /** Values no item matches. Equal by content, so its reader runs once per distinct set. */\n private readonly orphans = computed<readonly unknown[]>(\n () => {\n const byValue = this.itemByValue();\n return this.selected().filter(v => !byValue.has(v));\n },\n { equal: (a, b) => a.length === b.length && a.every((v, i) => Object.is(v, b[i])) }\n );\n\n /**\n * Say something when `value` holds a value no `items` entry matches.\n *\n * Such a value is in NEITHER pane — the left one filters out anything already\n * selected and the right one can only render rows it found — and the header\n * counts the rows it shows, so nothing on screen contradicts anything. The\n * result is a value the user can neither see nor remove, and no sign that it\n * is there.\n *\n * A warning rather than an invented row, which matches how the library treats\n * the same question elsewhere: `wr-select` renders a value outside its option\n * list only under an explicit `freeText`, so an unmatched value is a mode a\n * consumer opts into, not a shape a component guesses at. It also stays quiet\n * about the common transient case — `items` arriving after `value` — because\n * the message names the values and a developer can see them settle.\n */\n private warnAboutOrphans(orphans: readonly unknown[]): void {\n if (orphans.length === 0) return;\n\n // eslint-disable-next-line no-console -- dev-mode validation\n console.warn(\n `[NGWR] <wr-transfer>: ${orphans.length} value(s) in \\`value\\` match no \\`items\\` entry ` +\n `and are rendered in neither pane, so a user can neither see nor remove them: ` +\n `${orphans.map(v => JSON.stringify(v)).join(', ')}. ` +\n `If \\`items\\` loads after \\`value\\`, this settles on its own.`\n );\n }\n\n protected readonly canMoveRight = computed(\n () => !this.disabled() && !this.readonly() && this.source().checkedCount > 0\n );\n protected readonly canMoveLeft = computed(\n () => !this.disabled() && !this.readonly() && this.target().checkedCount > 0\n );\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-transfer--${size}`);\n if (this.disabled()) parts.push('wr-transfer--disabled');\n else if (this.readonly()) parts.push('wr-transfer--readonly');\n if (this.searchable()) parts.push('wr-transfer--searchable');\n return parts.join(' ');\n });\n\n protected isChecked(pane: 'source' | 'target', item: WrTransferItem): boolean {\n return (pane === 'source' ? this.sourceChecked() : this.targetChecked()).includes(item.value);\n }\n\n protected toggle(pane: 'source' | 'target', item: WrTransferItem, checked: boolean): void {\n if (item.disabled || this.readonly()) return;\n const box = pane === 'source' ? this.sourceChecked : this.targetChecked;\n const current = box();\n if (checked) {\n box.set([...current, item.value]);\n return;\n }\n // A `Set` compares with SameValueZero, which is what `WrTransferItem['value']`\n // is documented to use and what `isChecked`'s `includes` already does. A `!==`\n // filter cannot remove `NaN` from its own list, so such a row drew itself\n // unchecked while staying staged.\n const next = new Set(current);\n next.delete(item.value);\n box.set([...next]);\n }\n\n /**\n * Header checkbox — stages or clears every enabled row the filter shows, and\n * only those. Staging outlives a filter change, so a row the filter hides keeps\n * whatever state it had: setting the whole box here unstaged hidden rows on a\n * clear and dropped them on a select, which the pane only revealed once the\n * search was emptied.\n */\n protected toggleAll(pane: 'source' | 'target', checked: boolean): void {\n if (this.readonly()) return;\n const state = pane === 'source' ? this.source() : this.target();\n const box = pane === 'source' ? this.sourceChecked : this.targetChecked;\n const next = new Set(box());\n for (const item of state.rows) {\n if (item.disabled) continue;\n if (checked) next.add(item.value);\n else next.delete(item.value);\n }\n box.set([...next]);\n }\n\n protected onSearch(pane: 'source' | 'target', event: Event): void {\n const query = (event.target as HTMLInputElement | null)?.value ?? '';\n (pane === 'source' ? this.sourceQuery : this.targetQuery).set(query);\n }\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly injector = inject(Injector);\n\n /**\n * Focus the transfer — what Signal Forms calls to focus this control. The\n * host is a `group` with no tab stop of its own, so focus goes to the left\n * pane's filter when the panes are searchable, otherwise to the first row that\n * can still be ticked — on the right, once nothing on the left can be.\n *\n * The pane's select-all box comes first in the tab order and is passed over\n * on purpose: it acts on every row at once, and a form pointing at the field\n * is asking for a choice. A disabled transfer has nothing left to focus.\n */\n focus(options?: FocusOptions): void {\n this.host.nativeElement\n .querySelector<HTMLInputElement>(\n '.wr-transfer__search input:not([disabled]), .wr-transfer__item input:not([disabled])'\n )\n ?.focus(options);\n }\n\n /**\n * Keep focus in the widget after a move.\n *\n * A move empties the pane's staging set, which is exactly what disables the\n * button that was just pressed — so the element holding DOM focus went\n * `disabled` as a RESULT of its own activation and the browser dropped focus\n * to `<body>`. From there the next Tab restarts at the top of the document,\n * which for a keyboard user is being thrown out of a control they were in the\n * middle of using.\n *\n * The landing is the FIRST ROW OF THE PANE THE ROWS ARRIVED IN, and the\n * obvious alternative does not work: after a move BOTH buttons are disabled,\n * because each needs something ticked and the move cleared the tick on one\n * side and arrived unticked on the other. The rows that just moved are where\n * the user's attention is and where the next action lives, so that is where\n * focus goes.\n *\n * `afterNextRender`, not `queueMicrotask`: under zoneless CD the microtask\n * runs before the moved rows are in the DOM, so the focus call would land on\n * the pane as it was before the move.\n */\n private restoreFocusAfterMove(landing: 'source' | 'target'): void {\n afterNextRender(\n () => {\n const root = this.host.nativeElement;\n const pane =\n landing === 'target'\n ? root.querySelector<HTMLElement>('.wr-transfer__pane--target')\n : root.querySelector<HTMLElement>('.wr-transfer__pane:not(.wr-transfer__pane--target)');\n const row = pane?.querySelector<HTMLInputElement>('.wr-transfer__item input:not([disabled])');\n row?.focus();\n },\n { injector: this.injector }\n );\n }\n\n protected moveRight(): void {\n if (this.disabled() || this.readonly()) return;\n // `source().checked`, not the raw staging box: rows a filter change hid are\n // neither counted nor ticked any more, so moving them would transfer rows the\n // pane never showed as chosen — and, since staging outlives an external write\n // to `value`, could land the same value on the right twice.\n const moving = this.source().checked;\n if (moving.length === 0) return;\n this.value.set([...this.selected(), ...moving]);\n this.sourceChecked.set([]);\n this.touch.emit();\n this.restoreFocusAfterMove('target');\n }\n\n protected moveLeft(): void {\n if (this.disabled() || this.readonly()) return;\n const moving = new Set(this.target().checked);\n if (moving.size === 0) return;\n this.value.set(this.selected().filter(v => !moving.has(v)));\n this.targetChecked.set([]);\n this.touch.emit();\n this.restoreFocusAfterMove('source');\n }\n\n /** Filter, then derive the header state from what survived. */\n private pane(rows: readonly WrTransferItem[], query: string, checked: readonly unknown[]): PaneState {\n const q = query.trim().toLowerCase();\n const visible = q ? rows.filter(item => item.label.toLowerCase().includes(q)) : rows;\n const enabled = visible.filter(item => !item.disabled);\n const staged = new Set(checked);\n const shown = enabled.filter(item => staged.has(item.value)).map(item => item.value);\n return {\n rows: visible,\n checked: shown,\n checkedCount: shown.length,\n enabledCount: enabled.length,\n allChecked: enabled.length > 0 && shown.length === enabled.length,\n someChecked: shown.length > 0 && shown.length < enabled.length,\n };\n }\n}\n","<!--\n Two panes and the buttons between them. Each pane is a PLAIN `<ul>` of\n checkboxes, deliberately: dressing it as a `role=\"listbox\"` of `role=\"option\"`\n rows reads better in the abstract but is invalid — an option may not contain an\n interactive control, and the axe gate says so. The checkbox is the thing the\n user operates, so it is the thing the semantics should describe; the pane\n heading names the group.\n-->\n@for (pane of panes; track pane) {\n @let state = pane === 'source' ? source() : target();\n @let title = pane === 'source' ? resolvedSourceTitle() : resolvedTargetTitle();\n\n <div class=\"wr-transfer__pane\" [class.wr-transfer__pane--target]=\"pane === 'target'\">\n <div class=\"wr-transfer__head\">\n <wr-checkbox\n [size]=\"controlSize()\"\n [checked]=\"state.allChecked\"\n [indeterminate]=\"state.someChecked\"\n [disabled]=\"disabled() || state.enabledCount === 0\"\n [readonly]=\"readonly()\"\n [ariaLabel]=\"selectAllAria({ action: resolvedSelectAll(), pane: title })\"\n (checkedChange)=\"toggleAll(pane, $event)\"\n />\n <span class=\"wr-transfer__title\">{{ title }}</span>\n <span class=\"wr-transfer__count\">{{\n countLabel({ checked: state.checkedCount, total: state.rows.length })\n }}</span>\n </div>\n\n @if (searchable()) {\n <div class=\"wr-transfer__search\">\n <input\n wrInput\n [size]=\"controlSize()\"\n type=\"search\"\n [placeholder]=\"resolvedSearch()\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"searchAria({ title, search: resolvedSearch() })\"\n (input)=\"onSearch(pane, $event)\"\n />\n </div>\n }\n\n <ul class=\"wr-transfer__list\" [attr.aria-label]=\"title\">\n @for (item of state.rows; track item.value) {\n <li class=\"wr-transfer__item\" [class.wr-transfer__item--disabled]=\"item.disabled\">\n <wr-checkbox\n [size]=\"controlSize()\"\n [checked]=\"isChecked(pane, item)\"\n [disabled]=\"disabled() || !!item.disabled\"\n [readonly]=\"readonly()\"\n (checkedChange)=\"toggle(pane, item, $event)\"\n (touch)=\"touch.emit()\"\n >\n {{ item.label }}\n </wr-checkbox>\n </li>\n } @empty {\n <li class=\"wr-transfer__empty\">{{ resolvedEmpty() }}</li>\n }\n </ul>\n </div>\n\n <!-- The buttons live between the panes, so they are emitted after the first. -->\n @if (pane === 'source') {\n <div class=\"wr-transfer__actions\">\n <button\n wr-btn\n type=\"button\"\n [size]=\"controlSize()\"\n color=\"primary\"\n outlined\n class=\"wr-transfer__move wr-transfer__move--to-target\"\n [disabled]=\"!canMoveRight()\"\n [attr.aria-label]=\"resolvedToTarget()\"\n (click)=\"moveRight()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n <button\n wr-btn\n type=\"button\"\n [size]=\"controlSize()\"\n color=\"primary\"\n outlined\n class=\"wr-transfer__move wr-transfer__move--to-source\"\n [disabled]=\"!canMoveLeft()\"\n [attr.aria-label]=\"resolvedToSource()\"\n (click)=\"moveLeft()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n </button>\n </div>\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAuGA,IAAa,aAAb,MAAa,WAAU;CACrB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,UAAU;EAC3E,IAAI,OAAO,cAAc,eAAe,WAAW,aAAa,KAAK,iBAAiB,KAAK,QAAO,CAAE,CAAC;CACvG;CAGS,QAAQ,MAAiC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAM5C,QAAQ,MAA0B,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAGrC,QAAQ,OAAM;CAGd,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAc1D,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAGhD,YAAY,iBAAiB,EAAE,UAAU,KAAI,CAAE;CAYjD,gBAAgB,OAAO,IAAI,mBAAmB,iBAAiB,GAAG,EAAE,UAAU,KAAI,CAAE;CAGlF,aAAa,eAAe,KAAK,iBAAiB,KAAK,UAAU,WAAU,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CASxF,OAAO,MAAsB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAGxB,cAAc,eAAgB,KAAK,KAAI,MAAO,OAAO,OAAO,MAAM,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,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CAAA,UAAA;CAAA,MAAA;CAAU,YAAA,CAAA;EAxBtB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAa,eAER,kBAAkB;GAAI,MAC/B;IACJ,OAAO;IACP,WAAW;IAIX,MAAM;IAGN,0BAA0B;IAC1B,uBAAuB;IACvB,2BAA2B;GAC5B;GAAA,WAKU,CAAC;IAAE,SAAS;IAAe,UAAU;GAAI,CAAE;GAAC,SAC9C;IAAC;IAAU;IAAY;GAAO;GAAC,UAAA;EAAA,CAAA"}
@@ -12,8 +12,8 @@ import { TemplatePortal } from "@angular/cdk/portal";
12
12
  import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
13
13
  import { WR_OVERLAY, WrOutsideClick, wrFollowDirection } from "ngwr/overlay";
14
14
  import { finalize, from, isObservable, take } from "rxjs";
15
- import { WrEmpty } from "ngwr/empty";
16
15
  import { WrMark } from "ngwr/pipes";
16
+ import { WrEmpty } from "ngwr/empty";
17
17
  /**
18
18
  * @license
19
19
  *
@@ -393,21 +393,25 @@ function findFirstInvalid(root) {
393
393
  }
394
394
  }
395
395
  function wrGetFocusableElements(root) {
396
- return Array.from(root.querySelectorAll(FOCUSABLE_SELECTOR)).filter((el) => isRendered(el) || el === document.activeElement);
396
+ return Array.from(root.querySelectorAll(FOCUSABLE_SELECTOR)).filter((el) => !el.matches(":disabled") && (isRendered(el) || el === document.activeElement));
397
397
  }
398
398
  function wrTrapFocus(root, event) {
399
399
  if (event.key !== "Tab") return false;
400
400
  const focusable = wrGetFocusableElements(root);
401
- if (focusable.length === 0) return false;
401
+ const active = document.activeElement;
402
+ if (focusable.length === 0) {
403
+ if (active !== root) return false;
404
+ event.preventDefault();
405
+ return true;
406
+ }
402
407
  const first = focusable[0];
403
408
  const last = focusable[focusable.length - 1];
404
- const active = document.activeElement;
405
- if (event.shiftKey && active === first) {
409
+ if (event.shiftKey && (active === first || active === root)) {
406
410
  event.preventDefault();
407
411
  last.focus();
408
412
  return true;
409
413
  }
410
- if (!event.shiftKey && active === last) {
414
+ if (!event.shiftKey && (active === last || active === root)) {
411
415
  event.preventDefault();
412
416
  first.focus();
413
417
  return true;
@@ -938,12 +942,18 @@ function wrBadgeWarn(badgeText, color, message) {
938
942
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
939
943
  */
940
944
  let segmenter;
941
- const INITIAL = /[\p{L}\p{N}\p{Extended_Pictographic}]/u;
942
- const SYLLABIC = /^[\p{Script=Han}\p{Script=Hangul}\p{Script=Hiragana}\p{Script=Katakana}]/u;
943
945
  function graphemes(text) {
944
946
  segmenter ??= new Intl.Segmenter(void 0, { granularity: "grapheme" });
945
947
  return [...segmenter.segment(text)].map((s) => s.segment);
946
948
  }
949
+ /**
950
+ * @license
951
+ *
952
+ * Use of this source code is governed by an MIT-style license that can be
953
+ * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
954
+ */
955
+ const INITIAL = /[\p{L}\p{N}\p{Extended_Pictographic}]/u;
956
+ const SYLLABIC = /^[\p{Script=Han}\p{Script=Hangul}\p{Script=Hiragana}\p{Script=Katakana}]/u;
947
957
  function initialOf(word) {
948
958
  return graphemes(word).find((g) => INITIAL.test(g));
949
959
  }
@@ -983,6 +993,34 @@ function wrInitials(name, locale, options) {
983
993
  * Use of this source code is governed by an MIT-style license that can be
984
994
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
985
995
  */
996
+ const SEPARATORS = /[^\p{L}\p{M}\p{N}]+/u;
997
+ const WORD = /[\p{L}\p{N}]/u;
998
+ function cut(word, max) {
999
+ let head = "";
1000
+ for (const grapheme of graphemes(word)) {
1001
+ if (head.length + grapheme.length > max) break;
1002
+ head += grapheme;
1003
+ }
1004
+ return WORD.test(head) ? head : "";
1005
+ }
1006
+ function wrSlug(text, options = {}) {
1007
+ if (text === null || text === void 0) return "";
1008
+ const { separator = "-", maxLength = Infinity } = options;
1009
+ const words = String(text).normalize("NFKC").toLowerCase().split(SEPARATORS).filter((word) => WORD.test(word));
1010
+ let slug = "";
1011
+ for (const word of words) {
1012
+ const next = slug === "" ? word : slug + separator + word;
1013
+ if (next.length > maxLength) return slug === "" ? cut(word, maxLength) : slug;
1014
+ slug = next;
1015
+ }
1016
+ return slug;
1017
+ }
1018
+ /**
1019
+ * @license
1020
+ *
1021
+ * Use of this source code is governed by an MIT-style license that can be
1022
+ * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
1023
+ */
986
1024
  const WR_LIVE_LOCALE = new InjectionToken("WR_LIVE_LOCALE");
987
1025
  /**
988
1026
  * @license
@@ -1108,6 +1146,6 @@ function wrResourceValue(resource, fallback) {
1108
1146
  effect(() => value());
1109
1147
  return value.asReadonly();
1110
1148
  }
1111
- export { WR_KEYS, WR_KEY_LABELS, WR_LIVE_LOCALE, wrAction, wrBadgeError, wrBadgeLog, wrBadgeWarn, wrCheckStyles, wrClamp, wrContentDispositionFileName, wrDebounce, wrDecimal, wrDecimalAdd, wrDecimalCompare, wrDecimalDivide, wrDecimalMultiply, wrDecimalRound, wrDecimalSubtract, wrDownloadBlob, wrFeature, wrFileNameForType, wrFocusFirstInvalid, wrGetFocusableElements, wrGetRootFontSize, wrHasModifier, wrInitials, wrIsComposing, wrIsDefined, wrIsNonEmptyArray, wrIsObservable, wrIsPrintableKey, wrIsSafeCssValue, wrKeyedAction, wrNoop, wrNoteFocusReturn, wrNumAttr, wrRandomId, wrResolveCssColor, wrResolveCssColorChannels, wrResolveCssSize, wrResourceValue, wrRestoreFocus, wrRound, wrThrottle, wrToClassList, wrTrapFocus, wrTypeahead, wrWatchColorScheme, wrWatchDragCancel };
1149
+ export { WR_KEYS, WR_KEY_LABELS, WR_LIVE_LOCALE, wrAction, wrBadgeError, wrBadgeLog, wrBadgeWarn, wrCheckStyles, wrClamp, wrContentDispositionFileName, wrDebounce, wrDecimal, wrDecimalAdd, wrDecimalCompare, wrDecimalDivide, wrDecimalMultiply, wrDecimalRound, wrDecimalSubtract, wrDownloadBlob, wrFeature, wrFileNameForType, wrFocusFirstInvalid, wrGetFocusableElements, wrGetRootFontSize, wrHasModifier, wrInitials, wrIsComposing, wrIsDefined, wrIsNonEmptyArray, wrIsObservable, wrIsPrintableKey, wrIsSafeCssValue, wrKeyedAction, wrNoop, wrNoteFocusReturn, wrNumAttr, wrRandomId, wrResolveCssColor, wrResolveCssColorChannels, wrResolveCssSize, wrResourceValue, wrRestoreFocus, wrRound, wrSlug, wrThrottle, wrToClassList, wrTrapFocus, wrTypeahead, wrWatchColorScheme, wrWatchDragCancel };
1112
1150
 
1113
1151
  //# sourceMappingURL=ngwr-utils.mjs.map