@bravura/ui 1.4.4 → 1.6.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 (56) hide show
  1. package/CHANGELOG.md +35 -2
  2. package/README.md +1 -1
  3. package/behavior/sizing.directive.d.ts +13 -6
  4. package/bundles/bravura-ui-behavior.umd.js +55 -26
  5. package/bundles/bravura-ui-behavior.umd.js.map +1 -1
  6. package/bundles/bravura-ui-discrete-input.umd.js +738 -0
  7. package/bundles/bravura-ui-discrete-input.umd.js.map +1 -0
  8. package/bundles/bravura-ui-form-field.umd.js +9 -2
  9. package/bundles/bravura-ui-form-field.umd.js.map +1 -1
  10. package/bundles/bravura-ui-phone-number.umd.js +29 -24
  11. package/bundles/bravura-ui-phone-number.umd.js.map +1 -1
  12. package/bundles/bravura-ui-radio-panel.umd.js +12 -4
  13. package/bundles/bravura-ui-radio-panel.umd.js.map +1 -1
  14. package/bundles/bravura-ui-selection-panel.umd.js +658 -0
  15. package/bundles/bravura-ui-selection-panel.umd.js.map +1 -0
  16. package/discrete-input/bravura-ui-discrete-input.d.ts +5 -0
  17. package/discrete-input/discrete-input.component.d.ts +138 -0
  18. package/discrete-input/discrete-input.module.d.ts +11 -0
  19. package/discrete-input/package.json +10 -0
  20. package/discrete-input/public-api.d.ts +2 -0
  21. package/esm2015/behavior/sizing.directive.js +48 -23
  22. package/esm2015/discrete-input/bravura-ui-discrete-input.js +5 -0
  23. package/esm2015/discrete-input/discrete-input.component.js +333 -0
  24. package/esm2015/discrete-input/discrete-input.module.js +20 -0
  25. package/esm2015/discrete-input/public-api.js +3 -0
  26. package/esm2015/form-field/form-field.component.js +11 -4
  27. package/esm2015/phone-number/phone-number.directive.js +27 -21
  28. package/esm2015/radio-panel/radio-panel.directive.js +14 -6
  29. package/esm2015/selection-panel/bravura-ui-selection-panel.js +5 -0
  30. package/esm2015/selection-panel/public-api.js +4 -0
  31. package/esm2015/selection-panel/selection-panel-item.component.js +144 -0
  32. package/esm2015/selection-panel/selection-panel.directive.js +117 -0
  33. package/esm2015/selection-panel/selection-panel.module.js +21 -0
  34. package/fesm2015/bravura-ui-behavior.js +47 -22
  35. package/fesm2015/bravura-ui-behavior.js.map +1 -1
  36. package/fesm2015/bravura-ui-discrete-input.js +355 -0
  37. package/fesm2015/bravura-ui-discrete-input.js.map +1 -0
  38. package/fesm2015/bravura-ui-form-field.js +10 -3
  39. package/fesm2015/bravura-ui-form-field.js.map +1 -1
  40. package/fesm2015/bravura-ui-phone-number.js +26 -20
  41. package/fesm2015/bravura-ui-phone-number.js.map +1 -1
  42. package/fesm2015/bravura-ui-radio-panel.js +12 -4
  43. package/fesm2015/bravura-ui-radio-panel.js.map +1 -1
  44. package/fesm2015/bravura-ui-selection-panel.js +280 -0
  45. package/fesm2015/bravura-ui-selection-panel.js.map +1 -0
  46. package/form-field/form-field.component.d.ts +2 -0
  47. package/package.json +1 -1
  48. package/phone-number/phone-number.directive.d.ts +4 -0
  49. package/radio-panel/radio-panel.directive.d.ts +8 -3
  50. package/selection-panel/bravura-ui-selection-panel.d.ts +5 -0
  51. package/selection-panel/package.json +10 -0
  52. package/selection-panel/public-api.d.ts +3 -0
  53. package/selection-panel/selection-panel-item.component.d.ts +63 -0
  54. package/selection-panel/selection-panel.directive.d.ts +67 -0
  55. package/selection-panel/selection-panel.module.d.ts +12 -0
  56. package/theme/_ui-theme.scss +16 -7
@@ -0,0 +1,658 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/coercion'), require('@angular/core'), require('@angular/material/core'), require('@angular/material/checkbox'), require('@angular/common'), require('@angular/forms')) :
3
+ typeof define === 'function' && define.amd ? define('@bravura/ui/selection-panel', ['exports', '@angular/cdk/coercion', '@angular/core', '@angular/material/core', '@angular/material/checkbox', '@angular/common', '@angular/forms'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.bravura = global.bravura || {}, global.bravura.ui = global.bravura.ui || {}, global.bravura.ui['selection-panel'] = {}), global.ng.cdk.coercion, global.ng.core, global.ng.material.core, global.ng.material.checkbox, global.ng.common, global.ng.forms));
5
+ }(this, (function (exports, coercion, i0, i3, i1, i2, i4) { 'use strict';
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () {
17
+ return e[k];
18
+ }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n['default'] = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
+ var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
29
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
30
+ var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
31
+ var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
32
+
33
+ /*! *****************************************************************************
34
+ Copyright (c) Microsoft Corporation.
35
+
36
+ Permission to use, copy, modify, and/or distribute this software for any
37
+ purpose with or without fee is hereby granted.
38
+
39
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
40
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
41
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
42
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
43
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
44
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
45
+ PERFORMANCE OF THIS SOFTWARE.
46
+ ***************************************************************************** */
47
+ /* global Reflect, Promise */
48
+ var extendStatics = function (d, b) {
49
+ extendStatics = Object.setPrototypeOf ||
50
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
51
+ function (d, b) { for (var p in b)
52
+ if (Object.prototype.hasOwnProperty.call(b, p))
53
+ d[p] = b[p]; };
54
+ return extendStatics(d, b);
55
+ };
56
+ function __extends(d, b) {
57
+ if (typeof b !== "function" && b !== null)
58
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
59
+ extendStatics(d, b);
60
+ function __() { this.constructor = d; }
61
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
62
+ }
63
+ var __assign = function () {
64
+ __assign = Object.assign || function __assign(t) {
65
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
66
+ s = arguments[i];
67
+ for (var p in s)
68
+ if (Object.prototype.hasOwnProperty.call(s, p))
69
+ t[p] = s[p];
70
+ }
71
+ return t;
72
+ };
73
+ return __assign.apply(this, arguments);
74
+ };
75
+ function __rest(s, e) {
76
+ var t = {};
77
+ for (var p in s)
78
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
79
+ t[p] = s[p];
80
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
81
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
82
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
83
+ t[p[i]] = s[p[i]];
84
+ }
85
+ return t;
86
+ }
87
+ function __decorate(decorators, target, key, desc) {
88
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
89
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
90
+ r = Reflect.decorate(decorators, target, key, desc);
91
+ else
92
+ for (var i = decorators.length - 1; i >= 0; i--)
93
+ if (d = decorators[i])
94
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
95
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
96
+ }
97
+ function __param(paramIndex, decorator) {
98
+ return function (target, key) { decorator(target, key, paramIndex); };
99
+ }
100
+ function __metadata(metadataKey, metadataValue) {
101
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
102
+ return Reflect.metadata(metadataKey, metadataValue);
103
+ }
104
+ function __awaiter(thisArg, _arguments, P, generator) {
105
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
106
+ return new (P || (P = Promise))(function (resolve, reject) {
107
+ function fulfilled(value) { try {
108
+ step(generator.next(value));
109
+ }
110
+ catch (e) {
111
+ reject(e);
112
+ } }
113
+ function rejected(value) { try {
114
+ step(generator["throw"](value));
115
+ }
116
+ catch (e) {
117
+ reject(e);
118
+ } }
119
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
120
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
121
+ });
122
+ }
123
+ function __generator(thisArg, body) {
124
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
125
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
126
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
127
+ function verb(n) { return function (v) { return step([n, v]); }; }
128
+ function step(op) {
129
+ if (f)
130
+ throw new TypeError("Generator is already executing.");
131
+ while (_)
132
+ try {
133
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
134
+ return t;
135
+ if (y = 0, t)
136
+ op = [op[0] & 2, t.value];
137
+ switch (op[0]) {
138
+ case 0:
139
+ case 1:
140
+ t = op;
141
+ break;
142
+ case 4:
143
+ _.label++;
144
+ return { value: op[1], done: false };
145
+ case 5:
146
+ _.label++;
147
+ y = op[1];
148
+ op = [0];
149
+ continue;
150
+ case 7:
151
+ op = _.ops.pop();
152
+ _.trys.pop();
153
+ continue;
154
+ default:
155
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
156
+ _ = 0;
157
+ continue;
158
+ }
159
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
160
+ _.label = op[1];
161
+ break;
162
+ }
163
+ if (op[0] === 6 && _.label < t[1]) {
164
+ _.label = t[1];
165
+ t = op;
166
+ break;
167
+ }
168
+ if (t && _.label < t[2]) {
169
+ _.label = t[2];
170
+ _.ops.push(op);
171
+ break;
172
+ }
173
+ if (t[2])
174
+ _.ops.pop();
175
+ _.trys.pop();
176
+ continue;
177
+ }
178
+ op = body.call(thisArg, _);
179
+ }
180
+ catch (e) {
181
+ op = [6, e];
182
+ y = 0;
183
+ }
184
+ finally {
185
+ f = t = 0;
186
+ }
187
+ if (op[0] & 5)
188
+ throw op[1];
189
+ return { value: op[0] ? op[1] : void 0, done: true };
190
+ }
191
+ }
192
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
193
+ if (k2 === undefined)
194
+ k2 = k;
195
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
196
+ }) : (function (o, m, k, k2) {
197
+ if (k2 === undefined)
198
+ k2 = k;
199
+ o[k2] = m[k];
200
+ });
201
+ function __exportStar(m, o) {
202
+ for (var p in m)
203
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
204
+ __createBinding(o, m, p);
205
+ }
206
+ function __values(o) {
207
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
208
+ if (m)
209
+ return m.call(o);
210
+ if (o && typeof o.length === "number")
211
+ return {
212
+ next: function () {
213
+ if (o && i >= o.length)
214
+ o = void 0;
215
+ return { value: o && o[i++], done: !o };
216
+ }
217
+ };
218
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
219
+ }
220
+ function __read(o, n) {
221
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
222
+ if (!m)
223
+ return o;
224
+ var i = m.call(o), r, ar = [], e;
225
+ try {
226
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
227
+ ar.push(r.value);
228
+ }
229
+ catch (error) {
230
+ e = { error: error };
231
+ }
232
+ finally {
233
+ try {
234
+ if (r && !r.done && (m = i["return"]))
235
+ m.call(i);
236
+ }
237
+ finally {
238
+ if (e)
239
+ throw e.error;
240
+ }
241
+ }
242
+ return ar;
243
+ }
244
+ /** @deprecated */
245
+ function __spread() {
246
+ for (var ar = [], i = 0; i < arguments.length; i++)
247
+ ar = ar.concat(__read(arguments[i]));
248
+ return ar;
249
+ }
250
+ /** @deprecated */
251
+ function __spreadArrays() {
252
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
253
+ s += arguments[i].length;
254
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
255
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
256
+ r[k] = a[j];
257
+ return r;
258
+ }
259
+ function __spreadArray(to, from, pack) {
260
+ if (pack || arguments.length === 2)
261
+ for (var i = 0, l = from.length, ar; i < l; i++) {
262
+ if (ar || !(i in from)) {
263
+ if (!ar)
264
+ ar = Array.prototype.slice.call(from, 0, i);
265
+ ar[i] = from[i];
266
+ }
267
+ }
268
+ return to.concat(ar || from);
269
+ }
270
+ function __await(v) {
271
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
272
+ }
273
+ function __asyncGenerator(thisArg, _arguments, generator) {
274
+ if (!Symbol.asyncIterator)
275
+ throw new TypeError("Symbol.asyncIterator is not defined.");
276
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
277
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
278
+ function verb(n) { if (g[n])
279
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
280
+ function resume(n, v) { try {
281
+ step(g[n](v));
282
+ }
283
+ catch (e) {
284
+ settle(q[0][3], e);
285
+ } }
286
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
287
+ function fulfill(value) { resume("next", value); }
288
+ function reject(value) { resume("throw", value); }
289
+ function settle(f, v) { if (f(v), q.shift(), q.length)
290
+ resume(q[0][0], q[0][1]); }
291
+ }
292
+ function __asyncDelegator(o) {
293
+ var i, p;
294
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
295
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
296
+ }
297
+ function __asyncValues(o) {
298
+ if (!Symbol.asyncIterator)
299
+ throw new TypeError("Symbol.asyncIterator is not defined.");
300
+ var m = o[Symbol.asyncIterator], i;
301
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
302
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
303
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
304
+ }
305
+ function __makeTemplateObject(cooked, raw) {
306
+ if (Object.defineProperty) {
307
+ Object.defineProperty(cooked, "raw", { value: raw });
308
+ }
309
+ else {
310
+ cooked.raw = raw;
311
+ }
312
+ return cooked;
313
+ }
314
+ ;
315
+ var __setModuleDefault = Object.create ? (function (o, v) {
316
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
317
+ }) : function (o, v) {
318
+ o["default"] = v;
319
+ };
320
+ function __importStar(mod) {
321
+ if (mod && mod.__esModule)
322
+ return mod;
323
+ var result = {};
324
+ if (mod != null)
325
+ for (var k in mod)
326
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
327
+ __createBinding(result, mod, k);
328
+ __setModuleDefault(result, mod);
329
+ return result;
330
+ }
331
+ function __importDefault(mod) {
332
+ return (mod && mod.__esModule) ? mod : { default: mod };
333
+ }
334
+ function __classPrivateFieldGet(receiver, state, kind, f) {
335
+ if (kind === "a" && !f)
336
+ throw new TypeError("Private accessor was defined without a getter");
337
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
338
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
339
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
340
+ }
341
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
342
+ if (kind === "m")
343
+ throw new TypeError("Private method is not writable");
344
+ if (kind === "a" && !f)
345
+ throw new TypeError("Private accessor was defined without a setter");
346
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
347
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
348
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
349
+ }
350
+
351
+ /**
352
+ * @ignore
353
+ */
354
+ var SELECTION_PANEL_GROUP = new i0.InjectionToken('SelectionPanelItemGroup');
355
+ /**
356
+ * Use `bui-selection-panel-item` within a `bui-selection-panel` to display an option.
357
+ */
358
+ var SelectionPanelItemComponent = /** @class */ (function () {
359
+ function SelectionPanelItemComponent(_group, _cd) {
360
+ this._group = _group;
361
+ this._cd = _cd;
362
+ /**
363
+ * This will be displayed as the panel header
364
+ */
365
+ this.title = '';
366
+ this._disabled = false;
367
+ }
368
+ Object.defineProperty(SelectionPanelItemComponent.prototype, "disabled", {
369
+ /** Whether the option is disabled. */
370
+ get: function () {
371
+ return this._disabled || this._group._isDisabled;
372
+ },
373
+ set: function (value) {
374
+ this._setDisabled(coercion.coerceBooleanProperty(value));
375
+ },
376
+ enumerable: false,
377
+ configurable: true
378
+ });
379
+ Object.defineProperty(SelectionPanelItemComponent.prototype, "value", {
380
+ /** The value of this option. */
381
+ get: function () {
382
+ return this._value;
383
+ },
384
+ set: function (value) {
385
+ if (this._value !== value) {
386
+ this._value = value;
387
+ this._cd.markForCheck();
388
+ }
389
+ },
390
+ enumerable: false,
391
+ configurable: true
392
+ });
393
+ Object.defineProperty(SelectionPanelItemComponent.prototype, "checked", {
394
+ /** Whether this option is checked. */
395
+ get: function () {
396
+ return this._group._selection.includes(this.value);
397
+ },
398
+ set: function (value) {
399
+ var _this = this;
400
+ if (!this._group._onTouched) {
401
+ setTimeout(function () { return _this._setChecked(value); }, 0);
402
+ }
403
+ else {
404
+ this._setChecked(value);
405
+ }
406
+ },
407
+ enumerable: false,
408
+ configurable: true
409
+ });
410
+ Object.defineProperty(SelectionPanelItemComponent.prototype, "color", {
411
+ /** Theme color of the radio button. */
412
+ get: function () {
413
+ return this._color || this._group.color;
414
+ },
415
+ set: function (newValue) {
416
+ this._color = newValue;
417
+ },
418
+ enumerable: false,
419
+ configurable: true
420
+ });
421
+ Object.defineProperty(SelectionPanelItemComponent.prototype, "_selectByHeader", {
422
+ get: function () {
423
+ return this._group.selectByHeader;
424
+ },
425
+ enumerable: false,
426
+ configurable: true
427
+ });
428
+ /** @ignore */
429
+ SelectionPanelItemComponent.prototype._markInteracted = function () {
430
+ this._group._onTouched();
431
+ };
432
+ /** @ignore */
433
+ SelectionPanelItemComponent.prototype._notify = function () {
434
+ this._cd.markForCheck();
435
+ };
436
+ /** Toggle selection programmatically */
437
+ SelectionPanelItemComponent.prototype.toggle = function () {
438
+ this.checked = !this.checked;
439
+ };
440
+ /** @ignore */
441
+ SelectionPanelItemComponent.prototype._contentClicked = function (event) {
442
+ var _a;
443
+ if (!this._selectByHeader) {
444
+ (_a = this._ripple) === null || _a === void 0 ? void 0 : _a.launch(event.clientX, event.clientY);
445
+ this.toggle();
446
+ }
447
+ };
448
+ /** Sets the disabled state and marks for check if a change occurred. */
449
+ SelectionPanelItemComponent.prototype._setDisabled = function (value) {
450
+ if (this._disabled !== value) {
451
+ this._disabled = value;
452
+ this._cd.markForCheck();
453
+ }
454
+ };
455
+ SelectionPanelItemComponent.prototype._setChecked = function (value) {
456
+ var _this = this;
457
+ var newCheckedState = coercion.coerceBooleanProperty(value);
458
+ var old = this._group._selection.includes(this.value);
459
+ if (old !== newCheckedState) {
460
+ var contained = this._group._selection.some(function (v) { return v === _this._value; });
461
+ if (newCheckedState && this._group && !contained) {
462
+ this._group._selection = __spreadArray(__spreadArray([], __read(this._group._selection)), [this._value]);
463
+ }
464
+ else if (!newCheckedState && this._group && contained) {
465
+ // When unchecking the selected item, update the selection
466
+ // property on the group.
467
+ this._group._selection = this._group._selection.filter(function (v) { return v !== _this._value; });
468
+ }
469
+ this._cd.markForCheck();
470
+ }
471
+ };
472
+ return SelectionPanelItemComponent;
473
+ }());
474
+ SelectionPanelItemComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: SelectionPanelItemComponent, deps: [{ token: SELECTION_PANEL_GROUP }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
475
+ SelectionPanelItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.4", type: SelectionPanelItemComponent, selector: "bui-selection-panel-item", inputs: { title: "title", disabled: "disabled", value: "value", checked: "checked", color: "color" }, host: { properties: { "class.bui-selection-checked": "checked", "class.bui-border-accent": "checked && color ==='accent'", "class.bui-border-primary": "checked && color ==='primary'", "class.bui-border-warn": "checked && color ==='warn'", "class.bui-disabled": "disabled" }, classAttribute: "bui-selection-panel-item" }, viewQueries: [{ propertyName: "_ripple", first: true, predicate: i3.MatRipple, descendants: true }], ngImport: i0__namespace, template: "<div class=\"bui-selection-panel-item-wrapper\">\n\t<div\n\t\tmatRipple\n\t\tmatRippleColor=\"rgba(128,128,128,.1)\"\n\t\tclass=\"bui-ripple\"\n\t\t*ngIf=\"!disabled\"\n\t\t[matRippleTrigger]=\"toggleTrigger\"\n\t\t#ripple=\"matRipple\"\n\t></div>\n\t<div class=\"bui-selection-panel-item-header\" #toggleTrigger>\n\t\t<mat-checkbox [(ngModel)]=\"checked\" [color]=\"color\" [disabled]=\"disabled\" (change)=\"_markInteracted()\">\n\t\t\t<div class=\"bui-selection-panel-item-title\" [innerHTML]=\"title\"></div>\n\t\t</mat-checkbox>\n\t</div>\n\n\t<div\n\t\tclass=\"bui-selection-panel-item-content\"\n\t\t[class.bui-selectable]=\"!_selectByHeader\"\n\t\t(click)=\"_contentClicked($event)\"\n\t>\n\t\t<ng-content></ng-content>\n\t</div>\n\t<div class=\"bui-selection-panel-item-bottom\"></div>\n</div>\n", styles: [":host{position:relative;border-radius:5px;border:1px solid rgba(128,128,128,.2);padding:1px}:host .bui-selection-panel-item-wrapper{padding-left:1rem;padding-right:1rem}:host .bui-ripple{position:absolute;top:0;right:0;bottom:0;left:0;z-index:-1}:host .bui-selection-panel-item-header{margin-top:calc(1rem - 4px);margin-bottom:calc(1rem - 4px)}:host .bui-selection-panel-item-title{font-size:larger;font-weight:bold;white-space:normal;margin-top:2px}:host .bui-selection-panel-item-content{margin-top:1rem;margin-bottom:1rem}:host(:not(:first-child)){margin-top:1rem}:host(:not([hidden])){display:block}:host(:not(.bui-disabled)):hover{border-width:2px;padding:0;border-color:#8080804d}:host(:not(.bui-disabled)) .bui-selection-panel-item-content.bui-selectable{cursor:pointer}\n"], components: [{ type: i1__namespace.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace.MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleRadius", "matRippleDisabled", "matRippleTrigger", "matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleAnimation"], exportAs: ["matRipple"] }, { type: i4__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
476
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: SelectionPanelItemComponent, decorators: [{
477
+ type: i0.Component,
478
+ args: [{
479
+ selector: 'bui-selection-panel-item',
480
+ templateUrl: './selection-panel-item.component.html',
481
+ styleUrls: ['./selection-panel-item.component.scss'],
482
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
483
+ host: {
484
+ class: 'bui-selection-panel-item',
485
+ '[class.bui-selection-checked]': 'checked',
486
+ '[class.bui-border-accent]': "checked && color ==='accent'",
487
+ '[class.bui-border-primary]': "checked && color ==='primary'",
488
+ '[class.bui-border-warn]': "checked && color ==='warn'",
489
+ '[class.bui-disabled]': 'disabled'
490
+ }
491
+ }]
492
+ }], ctorParameters: function () {
493
+ return [{ type: undefined, decorators: [{
494
+ type: i0.Inject,
495
+ args: [SELECTION_PANEL_GROUP]
496
+ }] }, { type: i0__namespace.ChangeDetectorRef }];
497
+ }, propDecorators: { title: [{
498
+ type: i0.Input
499
+ }], disabled: [{
500
+ type: i0.Input
501
+ }], value: [{
502
+ type: i0.Input
503
+ }], checked: [{
504
+ type: i0.Input
505
+ }], color: [{
506
+ type: i0.Input
507
+ }], _ripple: [{
508
+ type: i0.ViewChild,
509
+ args: [i3.MatRipple]
510
+ }] } });
511
+
512
+ /**
513
+ * Selection panel is a [control value accessor](https://angular.io/api/forms/ControlValueAccessor)
514
+ * that display a set of multi-selection items as bordered panels, in a similar fashion as Radio Panel `bui-radio-panel`.
515
+ *
516
+ * Accessibility features are not yet fully implemented.
517
+ *
518
+ * Example:
519
+ *
520
+ * ```html
521
+ * <bui-selection-panel>
522
+ * <bui-selection-panel-item *ngFor="let obj of objects" [value]="obj">{{obj.description}}</bui-selection-panel-item>
523
+ * </bui-selection-panel>
524
+ * ```
525
+ *
526
+ */
527
+ var SelectionPanelDirective = /** @class */ (function () {
528
+ function SelectionPanelDirective(_cd) {
529
+ this._cd = _cd;
530
+ /**
531
+ * When set to `false`, the selection is triggered by click everywhere within the panels that is
532
+ * not focus-trapping; otherwise, only clicking on the header will activate the selection.
533
+ *
534
+ * @default true
535
+ */
536
+ this.selectByHeader = true;
537
+ /** @ignore */
538
+ this._isDisabled = false;
539
+ this._selected = [];
540
+ }
541
+ Object.defineProperty(SelectionPanelDirective.prototype, "_selection", {
542
+ /**
543
+ * @ignore
544
+ * The selected values. Used by the child elements to modify the group's value
545
+ */
546
+ get: function () {
547
+ return this._selected;
548
+ },
549
+ set: function (value) {
550
+ if (value !== this._selected) {
551
+ this._selected = value;
552
+ this._onChange(this._selected);
553
+ this._cd.markForCheck();
554
+ }
555
+ },
556
+ enumerable: false,
557
+ configurable: true
558
+ });
559
+ /**
560
+ * @ignore
561
+ */
562
+ SelectionPanelDirective.prototype.writeValue = function (obj) {
563
+ var _b;
564
+ var _a;
565
+ this._selected = [];
566
+ if (Array.isArray(obj)) {
567
+ (_b = this._selected).push.apply(_b, __spreadArray([], __read(obj)));
568
+ }
569
+ else if (obj !== null && obj !== undefined) {
570
+ this._selected.push(obj);
571
+ }
572
+ (_a = this._items) === null || _a === void 0 ? void 0 : _a.forEach(function (it) { return it._notify(); });
573
+ };
574
+ /**
575
+ * @ignore
576
+ */
577
+ SelectionPanelDirective.prototype.registerOnChange = function (fn) {
578
+ this._onChange = fn;
579
+ };
580
+ /**
581
+ * @ignore
582
+ */
583
+ SelectionPanelDirective.prototype.registerOnTouched = function (fn) {
584
+ this._onTouched = fn;
585
+ };
586
+ /**
587
+ * Sets the disabled state and marks for check if a change occurred.
588
+ * @ignore
589
+ */
590
+ SelectionPanelDirective.prototype.setDisabledState = function (isDisabled) {
591
+ if (this._isDisabled !== isDisabled) {
592
+ this._isDisabled = isDisabled;
593
+ this._cd.markForCheck();
594
+ this._items.forEach(function (it) { return it._notify(); });
595
+ }
596
+ };
597
+ /** @ignore */
598
+ SelectionPanelDirective.prototype.ngOnChanges = function (changes) {
599
+ if (this._items) {
600
+ if (changes.color || changes.selectByHeader) {
601
+ this._items.forEach(function (item) { return item._notify(); });
602
+ }
603
+ }
604
+ };
605
+ return SelectionPanelDirective;
606
+ }());
607
+ SelectionPanelDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: SelectionPanelDirective, deps: [{ token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
608
+ SelectionPanelDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.4", type: SelectionPanelDirective, selector: "bui-selection-panel", inputs: { color: "color", selectByHeader: "selectByHeader" }, providers: [
609
+ { provide: i4.NG_VALUE_ACCESSOR, useExisting: i0.forwardRef(function () { return SelectionPanelDirective; }), multi: true },
610
+ { provide: SELECTION_PANEL_GROUP, useExisting: i0.forwardRef(function () { return SelectionPanelDirective; }) }
611
+ ], queries: [{ propertyName: "_items", predicate: SelectionPanelItemComponent, descendants: true }], exportAs: ["buiSelectionPanel"], usesOnChanges: true, ngImport: i0__namespace });
612
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: SelectionPanelDirective, decorators: [{
613
+ type: i0.Directive,
614
+ args: [{
615
+ selector: 'bui-selection-panel',
616
+ providers: [
617
+ { provide: i4.NG_VALUE_ACCESSOR, useExisting: i0.forwardRef(function () { return SelectionPanelDirective; }), multi: true },
618
+ { provide: SELECTION_PANEL_GROUP, useExisting: i0.forwardRef(function () { return SelectionPanelDirective; }) }
619
+ ],
620
+ exportAs: 'buiSelectionPanel'
621
+ }]
622
+ }], ctorParameters: function () { return [{ type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { color: [{
623
+ type: i0.Input
624
+ }], selectByHeader: [{
625
+ type: i0.Input
626
+ }], _items: [{
627
+ type: i0.ContentChildren,
628
+ args: [SelectionPanelItemComponent, { descendants: true }]
629
+ }] } });
630
+
631
+ var SelectionPanelModule = /** @class */ (function () {
632
+ function SelectionPanelModule() {
633
+ }
634
+ return SelectionPanelModule;
635
+ }());
636
+ SelectionPanelModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: SelectionPanelModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
637
+ SelectionPanelModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: SelectionPanelModule, declarations: [SelectionPanelDirective, SelectionPanelItemComponent], imports: [i2.CommonModule, i1.MatCheckboxModule, i4.FormsModule, i3.MatRippleModule] });
638
+ SelectionPanelModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: SelectionPanelModule, imports: [[i2.CommonModule, i1.MatCheckboxModule, i4.FormsModule, i3.MatRippleModule]] });
639
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: SelectionPanelModule, decorators: [{
640
+ type: i0.NgModule,
641
+ args: [{
642
+ declarations: [SelectionPanelDirective, SelectionPanelItemComponent],
643
+ imports: [i2.CommonModule, i1.MatCheckboxModule, i4.FormsModule, i3.MatRippleModule]
644
+ }]
645
+ }] });
646
+
647
+ /**
648
+ * Generated bundle index. Do not edit.
649
+ */
650
+
651
+ exports.SelectionPanelDirective = SelectionPanelDirective;
652
+ exports.SelectionPanelItemComponent = SelectionPanelItemComponent;
653
+ exports.SelectionPanelModule = SelectionPanelModule;
654
+
655
+ Object.defineProperty(exports, '__esModule', { value: true });
656
+
657
+ })));
658
+ //# sourceMappingURL=bravura-ui-selection-panel.umd.js.map