@haiilo/catalyst 0.10.0 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalyst/catalyst.css +1 -1
- package/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/catalyst.esm.js.map +1 -1
- package/dist/catalyst/p-c4a1e283.entry.js +12 -0
- package/dist/catalyst/p-c4a1e283.entry.js.map +1 -0
- package/dist/catalyst/scss/_variables.scss +2 -1
- package/dist/cjs/{cat-alert_20.cjs.entry.js → cat-alert_21.cjs.entry.js} +144 -22
- package/dist/cjs/cat-alert_21.cjs.entry.js.map +1 -0
- package/dist/cjs/catalyst.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/cat-button/cat-button.css +12 -11
- package/dist/collection/components/cat-card/cat-card.css +15 -15
- package/dist/collection/components/cat-checkbox/cat-checkbox.css +4 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.js +23 -1
- package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
- package/dist/collection/components/cat-radio/cat-radio.css +7 -0
- package/dist/collection/components/cat-radio/cat-radio.js +25 -2
- package/dist/collection/components/cat-radio/cat-radio.js.map +1 -1
- package/dist/collection/components/cat-radio-group/cat-radio-group.css +12 -0
- package/dist/collection/components/cat-radio-group/cat-radio-group.js +179 -0
- package/dist/collection/components/cat-radio-group/cat-radio-group.js.map +1 -0
- package/dist/collection/components/cat-scrollable/cat-scrollable.css +1 -0
- package/dist/collection/components/cat-select/cat-select.css +35 -20
- package/dist/collection/components/cat-select/cat-select.js +49 -10
- package/dist/collection/components/cat-select/cat-select.js.map +1 -1
- package/dist/collection/components/cat-toggle/cat-toggle.css +4 -0
- package/dist/collection/components/cat-toggle/cat-toggle.js +25 -3
- package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/scss/_variables.scss +2 -1
- package/dist/components/cat-button2.js +1 -1
- package/dist/components/cat-button2.js.map +1 -1
- package/dist/components/cat-card.js +1 -1
- package/dist/components/cat-card.js.map +1 -1
- package/dist/components/cat-checkbox.js +7 -2
- package/dist/components/cat-checkbox.js.map +1 -1
- package/dist/components/cat-radio-group.d.ts +11 -0
- package/dist/components/cat-radio-group.js +111 -0
- package/dist/components/cat-radio-group.js.map +1 -0
- package/dist/components/cat-radio.js +9 -3
- package/dist/components/cat-radio.js.map +1 -1
- package/dist/components/cat-scrollable.js +1 -1
- package/dist/components/cat-scrollable.js.map +1 -1
- package/dist/components/cat-select.js +36 -11
- package/dist/components/cat-select.js.map +1 -1
- package/dist/components/cat-toggle.js +8 -3
- package/dist/components/cat-toggle.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/esm/{cat-alert_20.entry.js → cat-alert_21.entry.js} +144 -23
- package/dist/esm/cat-alert_21.entry.js.map +1 -0
- package/dist/esm/catalyst.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +4 -0
- package/dist/types/components/cat-radio/cat-radio.d.ts +4 -0
- package/dist/types/components/cat-radio-group/cat-radio-group.d.ts +29 -0
- package/dist/types/components/cat-select/cat-select.d.ts +6 -0
- package/dist/types/components/cat-toggle/cat-toggle.d.ts +5 -1
- package/dist/types/components.d.ts +75 -2
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -2
- package/dist/catalyst/p-a21823c9.entry.js +0 -12
- package/dist/catalyst/p-a21823c9.entry.js.map +0 -1
- package/dist/cjs/cat-alert_20.cjs.entry.js.map +0 -1
- package/dist/esm/cat-alert_20.entry.js.map +0 -1
|
@@ -265,9 +265,6 @@ label.hidden {
|
|
|
265
265
|
.choices[data-type*=select-one] {
|
|
266
266
|
cursor: pointer;
|
|
267
267
|
}
|
|
268
|
-
.choices[data-type*=select-one] .choices__inner {
|
|
269
|
-
padding-bottom: 7.5px;
|
|
270
|
-
}
|
|
271
268
|
.choices[data-type*=select-one] .choices__list--dropdown .choices__list {
|
|
272
269
|
padding-top: 0.5rem;
|
|
273
270
|
}
|
|
@@ -315,7 +312,7 @@ label.hidden {
|
|
|
315
312
|
.choices[data-type*=select-one][dir=rtl] .choices__button {
|
|
316
313
|
right: auto;
|
|
317
314
|
left: 0;
|
|
318
|
-
margin-left:
|
|
315
|
+
margin-left: 35px;
|
|
319
316
|
margin-right: 0;
|
|
320
317
|
}
|
|
321
318
|
|
|
@@ -323,9 +320,10 @@ label.hidden {
|
|
|
323
320
|
.choices[data-type*=text] .choices__inner {
|
|
324
321
|
cursor: text;
|
|
325
322
|
display: flex;
|
|
326
|
-
flex-
|
|
323
|
+
flex-flow: row wrap;
|
|
327
324
|
align-items: center;
|
|
328
|
-
padding: 4px 60px
|
|
325
|
+
padding: 4px 60px 4px 4px;
|
|
326
|
+
gap: 4px;
|
|
329
327
|
}
|
|
330
328
|
.choices[data-type*=select-multiple] .choices__item cat-checkbox,
|
|
331
329
|
.choices[data-type*=text] .choices__item cat-checkbox {
|
|
@@ -379,6 +377,18 @@ label.hidden {
|
|
|
379
377
|
box-shadow: unset;
|
|
380
378
|
background-color: transparent;
|
|
381
379
|
}
|
|
380
|
+
.choices[data-type*=select-multiple][dir=rtl] .choices__inner,
|
|
381
|
+
.choices[data-type*=text][dir=rtl] .choices__inner {
|
|
382
|
+
padding-right: 4px;
|
|
383
|
+
padding-left: 60px;
|
|
384
|
+
}
|
|
385
|
+
.choices[data-type*=select-multiple][dir=rtl] cat-button,
|
|
386
|
+
.choices[data-type*=text][dir=rtl] cat-button {
|
|
387
|
+
right: auto;
|
|
388
|
+
left: 0;
|
|
389
|
+
margin-left: 25px;
|
|
390
|
+
margin-right: 0;
|
|
391
|
+
}
|
|
382
392
|
|
|
383
393
|
.choices[data-type*=select-one]::after,
|
|
384
394
|
.choices[data-type*=select-multiple]::after {
|
|
@@ -393,6 +403,11 @@ label.hidden {
|
|
|
393
403
|
pointer-events: none;
|
|
394
404
|
transition: transform 0.25s linear;
|
|
395
405
|
}
|
|
406
|
+
.choices[data-type*=select-one][dir=rtl]::after,
|
|
407
|
+
.choices[data-type*=select-multiple][dir=rtl]::after {
|
|
408
|
+
left: 11.5px;
|
|
409
|
+
right: auto;
|
|
410
|
+
}
|
|
396
411
|
.choices[data-type*=select-one].is-open::after,
|
|
397
412
|
.choices[data-type*=select-multiple].is-open::after {
|
|
398
413
|
transform: rotate(180deg);
|
|
@@ -404,7 +419,6 @@ label.hidden {
|
|
|
404
419
|
vertical-align: top;
|
|
405
420
|
width: 100%;
|
|
406
421
|
background-color: #fff;
|
|
407
|
-
padding: 7.5px 7.5px 3.75px;
|
|
408
422
|
border: 1px solid #d7dbe0;
|
|
409
423
|
border-radius: 4px;
|
|
410
424
|
font-size: 15px;
|
|
@@ -424,21 +438,20 @@ label.hidden {
|
|
|
424
438
|
list-style: none;
|
|
425
439
|
}
|
|
426
440
|
.choices__list--single {
|
|
427
|
-
display:
|
|
428
|
-
padding:
|
|
441
|
+
display: flex;
|
|
442
|
+
padding: 9px 50px 9px 12px;
|
|
429
443
|
width: 100%;
|
|
430
444
|
}
|
|
431
445
|
[dir=rtl] .choices__list--single {
|
|
432
|
-
padding-right:
|
|
433
|
-
padding-left:
|
|
446
|
+
padding-right: 12px;
|
|
447
|
+
padding-left: 50px;
|
|
434
448
|
}
|
|
435
449
|
.choices__list--single .choices__item {
|
|
436
450
|
width: 100%;
|
|
437
451
|
}
|
|
438
452
|
|
|
439
453
|
.choices__list--multiple {
|
|
440
|
-
display:
|
|
441
|
-
flex-wrap: wrap;
|
|
454
|
+
display: contents;
|
|
442
455
|
}
|
|
443
456
|
.choices__list--multiple .choices__item {
|
|
444
457
|
font-size: 0.9375rem;
|
|
@@ -448,9 +461,7 @@ label.hidden {
|
|
|
448
461
|
align-items: center;
|
|
449
462
|
justify-content: space-between;
|
|
450
463
|
border-radius: 2px;
|
|
451
|
-
padding: 5px
|
|
452
|
-
margin-right: 4px;
|
|
453
|
-
margin-bottom: 4px;
|
|
464
|
+
padding: 5px 8px 5px 4px;
|
|
454
465
|
background-color: rgba(105, 118, 135, 0.1);
|
|
455
466
|
color: #000;
|
|
456
467
|
word-break: break-all;
|
|
@@ -483,7 +494,8 @@ label.hidden {
|
|
|
483
494
|
word-break: break-all;
|
|
484
495
|
will-change: visibility;
|
|
485
496
|
box-shadow: 0 2px 4px 0 #101d3033;
|
|
486
|
-
border-radius: 4px;
|
|
497
|
+
border-bottom-left-radius: 4px;
|
|
498
|
+
border-bottom-right-radius: 4px;
|
|
487
499
|
}
|
|
488
500
|
.is-active.choices__list--dropdown, .is-active.choices__list[aria-expanded] {
|
|
489
501
|
visibility: visible;
|
|
@@ -515,9 +527,12 @@ label.hidden {
|
|
|
515
527
|
text-align: right;
|
|
516
528
|
}
|
|
517
529
|
@media (min-width: 640px) {
|
|
518
|
-
.choices__list--dropdown .choices__item--selectable, .choices__list[aria-expanded] .choices__item--selectable {
|
|
530
|
+
.choices__list--dropdown .choices__item--selectable[data-select-text]:not([data-select-text=""]), .choices__list[aria-expanded] .choices__item--selectable[data-select-text]:not([data-select-text=""]) {
|
|
519
531
|
padding-right: 100px;
|
|
520
532
|
}
|
|
533
|
+
[dir=rtl] .choices__list--dropdown .choices__item--selectable[data-select-text]:not([data-select-text=""]), [dir=rtl] .choices__list[aria-expanded] .choices__item--selectable[data-select-text]:not([data-select-text=""]) {
|
|
534
|
+
padding-right: 10px;
|
|
535
|
+
}
|
|
521
536
|
.choices__list--dropdown .choices__item--selectable::after, .choices__list[aria-expanded] .choices__item--selectable::after {
|
|
522
537
|
content: attr(data-select-text);
|
|
523
538
|
font-size: 12px;
|
|
@@ -530,7 +545,6 @@ label.hidden {
|
|
|
530
545
|
[dir=rtl] .choices__list--dropdown .choices__item--selectable, [dir=rtl] .choices__list[aria-expanded] .choices__item--selectable {
|
|
531
546
|
text-align: right;
|
|
532
547
|
padding-left: 100px;
|
|
533
|
-
padding-right: 10px;
|
|
534
548
|
}
|
|
535
549
|
[dir=rtl] .choices__list--dropdown .choices__item--selectable::after, [dir=rtl] .choices__list[aria-expanded] .choices__item--selectable::after {
|
|
536
550
|
right: auto;
|
|
@@ -590,7 +604,7 @@ label.hidden {
|
|
|
590
604
|
vertical-align: baseline;
|
|
591
605
|
background-color: white;
|
|
592
606
|
font-size: 15px;
|
|
593
|
-
|
|
607
|
+
font-family: var(--cat-font-family-body, "Lato"), system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
594
608
|
border: 0;
|
|
595
609
|
border-radius: 0;
|
|
596
610
|
max-width: 100%;
|
|
@@ -645,4 +659,5 @@ label.hidden {
|
|
|
645
659
|
.choices-option-icon {
|
|
646
660
|
width: 20px;
|
|
647
661
|
aspect-ratio: 1;
|
|
662
|
+
border-radius: 0.125rem;
|
|
648
663
|
}
|
|
@@ -86,29 +86,36 @@ export class CatSelect {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
componentDidLoad() {
|
|
89
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
89
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
90
90
|
this.init();
|
|
91
|
-
|
|
92
|
-
(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
const attachedInternals = (_b = (_a = this.hostElement).attachInternals) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
92
|
+
if (attachedInternals) {
|
|
93
|
+
this.choiceInner = ((_c = attachedInternals.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('.choices__inner')) || undefined;
|
|
94
|
+
this.choiceDropdown =
|
|
95
|
+
((_e = (_d = attachedInternals.shadowRoot) === null || _d === void 0 ? void 0 : _d.querySelector('.choices__list--dropdown')) === null || _e === void 0 ? void 0 : _e.firstElementChild) || undefined;
|
|
96
|
+
}
|
|
97
|
+
(_f = this.choiceInner) === null || _f === void 0 ? void 0 : _f.addEventListener('click', this.showDropdownHandler.bind(this));
|
|
98
|
+
(_g = this.selectElement) === null || _g === void 0 ? void 0 : _g.addEventListener('addItem', this.onChange.bind(this));
|
|
99
|
+
(_h = this.selectElement) === null || _h === void 0 ? void 0 : _h.addEventListener('removeItem', this.onChange.bind(this));
|
|
100
|
+
(_j = this.selectElement) === null || _j === void 0 ? void 0 : _j.addEventListener('search', this.onSearch.bind(this));
|
|
101
|
+
(_k = this.choiceDropdown) === null || _k === void 0 ? void 0 : _k.addEventListener('scroll', this.onScrolledBottom.bind(this));
|
|
96
102
|
if (this.multiple) {
|
|
97
|
-
(
|
|
103
|
+
(_l = this.selectElement) === null || _l === void 0 ? void 0 : _l.addEventListener('choice', this.onChoice.bind(this));
|
|
98
104
|
this.createRemoveItemButton();
|
|
99
105
|
}
|
|
100
106
|
}
|
|
101
107
|
disconnectedCallback() {
|
|
102
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
108
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
103
109
|
(_a = this.choice) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
104
110
|
this.choice = undefined;
|
|
105
111
|
(_b = this.choiceInner) === null || _b === void 0 ? void 0 : _b.removeEventListener('click', this.showDropdownHandler.bind(this));
|
|
106
112
|
(_c = this.selectElement) === null || _c === void 0 ? void 0 : _c.removeEventListener('addItem', this.onChange.bind(this));
|
|
107
113
|
(_d = this.selectElement) === null || _d === void 0 ? void 0 : _d.removeEventListener('removeItem', this.onChange.bind(this));
|
|
108
114
|
(_e = this.selectElement) === null || _e === void 0 ? void 0 : _e.removeEventListener('search', this.onSearch.bind(this));
|
|
115
|
+
(_f = this.choiceDropdown) === null || _f === void 0 ? void 0 : _f.removeEventListener('scroll', this.onScrolledBottom.bind(this));
|
|
109
116
|
if (this.multiple) {
|
|
110
|
-
(
|
|
111
|
-
(
|
|
117
|
+
(_g = this.selectElement) === null || _g === void 0 ? void 0 : _g.removeEventListener('choice', this.onChoice.bind(this));
|
|
118
|
+
(_h = this.removeElement) === null || _h === void 0 ? void 0 : _h.removeEventListener('click', this.onRemoveItemButtonClick.bind(this));
|
|
112
119
|
}
|
|
113
120
|
}
|
|
114
121
|
/**
|
|
@@ -161,6 +168,7 @@ export class CatSelect {
|
|
|
161
168
|
}
|
|
162
169
|
init() {
|
|
163
170
|
const value = this.value || [];
|
|
171
|
+
const removeItemText = (value) => this.i18n.t('select.removeItem', { value });
|
|
164
172
|
const config = {
|
|
165
173
|
allowHTML: true,
|
|
166
174
|
items: Array.isArray(value) ? value : [value],
|
|
@@ -196,6 +204,10 @@ export class CatSelect {
|
|
|
196
204
|
return strToEl(`
|
|
197
205
|
<div class="${classNames.item} ${data.highlighted ? classNames.highlightedState : classNames.itemSelectable} ${data.placeholder ? classNames.placeholder : ''}" data-item data-id="${data.id}" data-value="${data.value}" ${data.active ? 'aria-selected="true"' : ''} ${data.disabled ? 'aria-disabled="true"' : ''}>
|
|
198
206
|
<span>${template}</span> ${data.label}
|
|
207
|
+
<button type="button"
|
|
208
|
+
class="${classNames.button}"
|
|
209
|
+
aria-label="${removeItemText(data.label)}"
|
|
210
|
+
data-button>${removeItemText(data.label)}</button>
|
|
199
211
|
</div>
|
|
200
212
|
`);
|
|
201
213
|
}
|
|
@@ -220,6 +232,10 @@ export class CatSelect {
|
|
|
220
232
|
${data.disabled ? 'aria-disabled="true"' : ''}>
|
|
221
233
|
${template}
|
|
222
234
|
${data.label}
|
|
235
|
+
<button type="button"
|
|
236
|
+
class="${classNames.button}"
|
|
237
|
+
aria-label="${removeItemText(data.label)}"
|
|
238
|
+
data-button>${removeItemText(data.label)}</button>
|
|
223
239
|
</div>`);
|
|
224
240
|
},
|
|
225
241
|
choice: function ({ classNames }, data) {
|
|
@@ -259,6 +275,14 @@ export class CatSelect {
|
|
|
259
275
|
const customEvent = event;
|
|
260
276
|
this.catSearch.emit(customEvent.detail.value);
|
|
261
277
|
}
|
|
278
|
+
onScrolledBottom() {
|
|
279
|
+
var _a, _b, _c;
|
|
280
|
+
const scrolledBottom = ((_a = this.choiceDropdown) === null || _a === void 0 ? void 0 : _a.scrollHeight) ===
|
|
281
|
+
(((_b = this.choiceDropdown) === null || _b === void 0 ? void 0 : _b.scrollTop) || 0) + (((_c = this.choiceDropdown) === null || _c === void 0 ? void 0 : _c.clientHeight) || 0);
|
|
282
|
+
if (scrolledBottom) {
|
|
283
|
+
this.catScrolledBottom.emit();
|
|
284
|
+
}
|
|
285
|
+
}
|
|
262
286
|
onChoice(event) {
|
|
263
287
|
var _a, _b;
|
|
264
288
|
const customEvent = event;
|
|
@@ -546,6 +570,21 @@ export class CatSelect {
|
|
|
546
570
|
"resolved": "any",
|
|
547
571
|
"references": {}
|
|
548
572
|
}
|
|
573
|
+
}, {
|
|
574
|
+
"method": "catScrolledBottom",
|
|
575
|
+
"name": "catScrolledBottom",
|
|
576
|
+
"bubbles": true,
|
|
577
|
+
"cancelable": true,
|
|
578
|
+
"composed": true,
|
|
579
|
+
"docs": {
|
|
580
|
+
"tags": [],
|
|
581
|
+
"text": "Emitted when scrolled to the bottom."
|
|
582
|
+
},
|
|
583
|
+
"complexType": {
|
|
584
|
+
"original": "any",
|
|
585
|
+
"resolved": "any",
|
|
586
|
+
"references": {}
|
|
587
|
+
}
|
|
549
588
|
}]; }
|
|
550
589
|
static get methods() { return {
|
|
551
590
|
"setValue": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cat-select.js","sourceRoot":"","sources":["../../../src/components/cat-select/cat-select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC7G,OAAO,OAAqD,MAAM,YAAY,CAAC;AAC/E,OA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G,KAAK,CAAC,IAAI,CAAC,MAAA,IAAI,CAAC,MAAM,0CAAE,QAAQ,EAAY,CAAC,CAAC;IAC5D,IAAI,KAAK,CAAC,MAAM,EAAE;MAChB,MAAA,IAAI,CAAC,aAAa,0CAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;KAC/C;SAAM,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;MACxB,MAAA,IAAI,CAAC,aAAa,0CAAE,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;KACpD;EACH,CAAC;EAEO,uBAAuB,CAAC,KAAY;;IAC1C,KAAK,CAAC,eAAe,EAAE,CAAC;IACxB,MAAA,IAAI,CAAC,MAAM,0CAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;EACrC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, Watch, State } from '@stencil/core';\nimport Choices, { Choice, ClassNames, Group, Item, Options } from 'choices.js';\nimport { CatI18nRegistry } from '../cat-i18n/cat-i18n-registry';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\n\nlet nextUniqueId = 0;\n\nconst getOptionTemplate = (data: Item): string => {\n if (data.customProperties?.imageUrl) {\n return `\n <div class=\"d-flex align-items-center\">\n <img class=\"choices-option-icon\" src=\"${data.customProperties.imageUrl}\" style=\"margin-right: 0.5rem\" />\n ${data.label}\n </div>\n `;\n }\n return `<cat-checkbox label=\"${data.label}\" checked=\"${data.selected}\"></cat-checkbox>`;\n};\n\n/**\n * Select lets user choose one option from an options menu. Consider using\n * select when you have 6 or more options. Select component supports any content\n * type.\n *\n * @slot hint - Optional hint element to be displayed with the select.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part label - The label content.\n */\n@Component({\n tag: 'cat-select',\n styleUrl: 'cat-select.scss',\n shadow: true\n})\nexport class CatSelect {\n private readonly i18n = CatI18nRegistry.getInstance();\n private readonly id = `cat-select-${nextUniqueId++}`;\n\n private choice?: Choices;\n private choiceInner?: Element;\n private selectElement?: HTMLSelectElement;\n private removeElement?: HTMLCatButtonElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * The label for the select.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * The available options for the input.\n */\n @Prop() choices: Choice[] = [];\n\n /**\n * The pre-selected items for the input.\n */\n @Prop({ mutable: true }) value?: string | string[] | Choice | Choice[];\n\n /**\n * Disable the select.\n */\n @Prop() disabled = false;\n\n /**\n * Enable multiple selection.\n */\n @Prop() multiple = false;\n\n /**\n * The placeholder for the select.\n */\n @Prop() placeholder = '';\n\n /**\n * Whether the dropdown should appear above `(top)` or below `(bottom)` the\n * input. By default, if there is not enough space within the window the\n * dropdown will appear above the input, otherwise below it.\n */\n @Prop() position: 'auto' | 'top' | 'bottom' = 'auto';\n\n /**\n * Enable search for the select.\n */\n @Prop() noSearch = false;\n\n /**\n * Optional hint text(s) to be displayed with the select.\n */\n @Prop() hint?: string | string[];\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the search is triggered.\n */\n @Event() catSearch!: EventEmitter;\n\n @Watch('choices')\n setChoicesHandler(choices: Choice[]) {\n if (!choices?.length) return;\n\n this.setChoices(choices, 'value', 'label', true);\n }\n\n @Watch('value')\n setValueHandler(value?: string[] | Choice[]) {\n if (this.multiple) return;\n\n this.setValue(value || []);\n }\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.error('[A11y] Missing ARIA label on select', this);\n }\n }\n\n componentDidLoad(): void {\n this.init();\n this.choiceInner = this.hostElement.attachInternals?.().shadowRoot?.querySelector('.choices__inner') || undefined;\n this.choiceInner?.addEventListener('click', this.showDropdownHandler.bind(this));\n this.selectElement?.addEventListener('addItem', this.onChange.bind(this));\n this.selectElement?.addEventListener('removeItem', this.onChange.bind(this));\n this.selectElement?.addEventListener('search', this.onSearch.bind(this));\n if (this.multiple) {\n this.selectElement?.addEventListener('choice', this.onChoice.bind(this));\n this.createRemoveItemButton();\n }\n }\n\n disconnectedCallback(): void {\n this.choice?.destroy();\n this.choice = undefined;\n this.choiceInner?.removeEventListener('click', this.showDropdownHandler.bind(this));\n this.selectElement?.removeEventListener('addItem', this.onChange.bind(this));\n this.selectElement?.removeEventListener('removeItem', this.onChange.bind(this));\n this.selectElement?.removeEventListener('search', this.onSearch.bind(this));\n if (this.multiple) {\n this.selectElement?.removeEventListener('choice', this.onChoice.bind(this));\n this.removeElement?.removeEventListener('click', this.onRemoveItemButtonClick.bind(this));\n }\n }\n\n /**\n * Set value of input based on an array of objects or strings. This behaves\n * exactly the same as passing items via the items option but can be called\n * after initialisation.\n */\n @Method()\n async setValue(args: Array<string> | Array<Item>) {\n this.choice?.setValue(args);\n\n return this;\n }\n\n /**\n * Set choices of select input via an array of objects (or function that\n * returns array of object or promise of it), a value field name and a label\n * field name.\n */\n @Method()\n async setChoices(choices: Array<Choice> | Array<Group>, value?: string, label?: string, replaceChoices?: boolean) {\n this.choice?.setChoices(choices, value, label, replaceChoices);\n\n return this;\n }\n\n /**\n * Clear all choices from select.\n */\n @Method()\n async clearChoices() {\n this.choice?.clearChoices();\n\n return this;\n }\n\n /**\n * Clear input of any user inputted text.\n */\n @Method()\n async clearInput() {\n this.choice?.clearInput();\n\n return this;\n }\n\n render() {\n return (\n <Host>\n {(this.hasSlottedLabel || this.label) && (\n <label htmlFor={this.id} class={{ hidden: this.labelHidden }}>\n <span part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n {!this.required && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({this.i18n.t('input.optional')})\n </span>\n )}\n </span>\n </label>\n )}\n <select\n id={this.id}\n ref={el => (this.selectElement = el)}\n multiple={this.multiple}\n disabled={this.disabled}\n ></select>\n {this.hintSection}\n </Host>\n );\n }\n\n private init() {\n const value = this.value || [];\n const config = {\n allowHTML: true,\n items: Array.isArray(value) ? value : ([value] as string[] | Choice[]),\n removeItemButton: true,\n duplicateItemsAllowed: false,\n delimiter: '',\n paste: false,\n searchEnabled: !this.noSearch,\n searchChoices: false,\n position: this.position,\n resetScrollPosition: false,\n placeholder: !!this.placeholder,\n placeholderValue: this.placeholder || '',\n searchPlaceholderValue: this.i18n.t('select.searchPlaceholder'),\n renderSelectedChoices: 'always' as 'auto' | 'always',\n loadingText: this.i18n.t('select.loading'),\n noResultsText: this.i18n.t('select.noResults'),\n noChoicesText: this.i18n.t('select.noChoices'),\n itemSelectText: this.i18n.t('select.selectItem'),\n addItemText: (value: string) => this.i18n.t('select.addItem', { value }),\n maxItemText: (maxItemCount: number) => this.i18n.t('select.maxItem', { maxItemCount }),\n uniqueItemText: this.i18n.t('select.uniqueItem'),\n customAddItemText: this.i18n.t('select.customAddItem')\n };\n\n const configSingle = {\n callbackOnCreateTemplates: (strToEl: (str: string) => HTMLElement) => {\n return {\n item: ({ classNames }: { classNames: ClassNames }, data: Item) => {\n const template = data.customProperties?.imageUrl\n ? `<img class=\"choices-option-icon\" src=\"${data.customProperties.imageUrl}\" style=\"margin-right: 0.5rem\" />`\n : '';\n return strToEl(\n `\n <div class=\"${classNames.item} ${\n data.highlighted ? classNames.highlightedState : classNames.itemSelectable\n } ${data.placeholder ? classNames.placeholder : ''}\" data-item data-id=\"${data.id}\" data-value=\"${\n data.value\n }\" ${data.active ? 'aria-selected=\"true\"' : ''} ${data.disabled ? 'aria-disabled=\"true\"' : ''}>\n <span>${template}</span> ${data.label}\n </div>\n `\n );\n }\n };\n }\n };\n\n const configMultiple = {\n callbackOnCreateTemplates: (strToEl: (str: string) => HTMLElement) => {\n const itemSelectText = config.itemSelectText;\n return {\n item: ({ classNames }: { classNames: ClassNames }, data: Item) => {\n const template = data.customProperties?.imageUrl\n ? `<img class=\"choices-option-icon\" src=\"${data.customProperties.imageUrl}\" style=\"margin-right: 0.5rem;\" />`\n : '';\n return strToEl(\n `<div class=\"\n ${classNames.item}\n ${data.highlighted ? classNames.highlightedState : classNames.itemSelectable}\n ${data.placeholder ? classNames.placeholder : ''}\"\n data-item data-id=\"${data.id}\" data-value=\"${data.value}\"\n ${data.active ? 'aria-selected=\"true\"' : ''}\n ${data.disabled ? 'aria-disabled=\"true\"' : ''}>\n ${template}\n ${data.label}\n </div>`\n );\n },\n choice: function ({ classNames }: { classNames: ClassNames }, data: Item) {\n const template = getOptionTemplate(data);\n const className = `${String(classNames.item)} ${String(classNames.itemChoice)}\n ${String(data.disabled ? classNames.itemDisabled : classNames.itemSelectable)}\n ${data.selected ? 'choices__item--selected' : ''}`;\n return strToEl(\n `<div class=\"${className}\"\n data-select-text=\"${itemSelectText}\"\n data-choice data-id=\"${String(data.id)}\" data-value=\"${String(data.value)}\"\n ${data.disabled ? 'data-choice-disabled aria-disabled=\"true\"' : 'data-choice-selectable'}\n ${data.groupId && data.groupId > 0 ? 'role=\"treeitem\"' : 'role=\"option\"'}>\n ${template}\n </div>`\n );\n }\n };\n }\n };\n\n const settings: Partial<Options> = this.multiple\n ? { ...config, ...configMultiple }\n : { ...config, ...configSingle };\n this.choice = new Choices(this.selectElement, settings);\n this.choice.setChoices(this.choices);\n }\n\n private get hintSection() {\n const hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n return (\n (this.hint || hasSlottedHint) && (\n <CatFormHint hint={this.hint} slottedHint={hasSlottedHint && <slot name=\"hint\"></slot>} />\n )\n );\n }\n\n private onChange() {\n this.value = this.choice?.getValue();\n this.catChange.emit(this.choice?.getValue());\n if (this.multiple) {\n this.updateRemoveItemButtonVisibility();\n }\n }\n\n private onSearch(event: Event) {\n const customEvent = event as CustomEvent<{ value: string }>;\n this.catSearch.emit(customEvent.detail.value);\n }\n\n private onChoice(event: Event) {\n const customEvent = event as CustomEvent<{ choice: Choice }>;\n const items = Array.from(this.choice?.getValue() as Item[]);\n const item = items.find(value => value.choiceId === customEvent.detail.choice.id);\n if (item) {\n this.choice?._removeItem(item);\n }\n }\n\n private showDropdownHandler() {\n if (!this.disabled) {\n this.choice?.showDropdown();\n }\n }\n\n private createRemoveItemButton() {\n this.removeElement = document.createElement('cat-button') as HTMLCatButtonElement;\n this.removeElement.icon = 'cross-circle-outlined';\n this.removeElement.iconOnly = true;\n this.removeElement.a11yLabel = this.i18n.t('select.removeItem');\n this.updateRemoveItemButtonVisibility();\n this.removeElement.addEventListener('click', this.onRemoveItemButtonClick.bind(this));\n this.choiceInner?.appendChild(this.removeElement);\n }\n\n private updateRemoveItemButtonVisibility() {\n const items = Array.from(this.choice?.getValue() as Item[]);\n if (items.length) {\n this.removeElement?.removeAttribute('hidden');\n } else if (!items.length) {\n this.removeElement?.setAttribute('hidden', 'true');\n }\n }\n\n private onRemoveItemButtonClick(event: Event) {\n event.stopPropagation();\n this.choice?.removeActiveItems(-1);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cat-select.js","sourceRoot":"","sources":["../../../src/components/cat-select/cat-select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAA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AAC,aAAa,CAAC,CAAC;EACpD,CAAC;EAEO,gCAAgC;;IACtC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAA,IAAI,CAAC,MAAM,0CAAE,QAAQ,EAAY,CAAC,CAAC;IAC5D,IAAI,KAAK,CAAC,MAAM,EAAE;MAChB,MAAA,IAAI,CAAC,aAAa,0CAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;KAC/C;SAAM,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;MACxB,MAAA,IAAI,CAAC,aAAa,0CAAE,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;KACpD;EACH,CAAC;EAEO,uBAAuB,CAAC,KAAY;;IAC1C,KAAK,CAAC,eAAe,EAAE,CAAC;IACxB,MAAA,IAAI,CAAC,MAAM,0CAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;EACrC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, Watch, State } from '@stencil/core';\nimport Choices, { Choice, ClassNames, Group, Item, Options } from 'choices.js';\nimport { CatI18nRegistry } from '../cat-i18n/cat-i18n-registry';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\n\nlet nextUniqueId = 0;\n\nconst getOptionTemplate = (data: Item): string => {\n if (data.customProperties?.imageUrl) {\n return `\n <div class=\"d-flex align-items-center\">\n <img class=\"choices-option-icon\" src=\"${data.customProperties.imageUrl}\" style=\"margin-right: 0.5rem\" />\n ${data.label}\n </div>\n `;\n }\n return `<cat-checkbox label=\"${data.label}\" checked=\"${data.selected}\"></cat-checkbox>`;\n};\n\n/**\n * Select lets user choose one option from an options menu. Consider using\n * select when you have 6 or more options. Select component supports any content\n * type.\n *\n * @slot hint - Optional hint element to be displayed with the select.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part label - The label content.\n */\n@Component({\n tag: 'cat-select',\n styleUrl: 'cat-select.scss',\n shadow: true\n})\nexport class CatSelect {\n private readonly i18n = CatI18nRegistry.getInstance();\n private readonly id = `cat-select-${nextUniqueId++}`;\n\n private choice?: Choices;\n private choiceInner?: Element;\n private choiceDropdown?: Element;\n private selectElement?: HTMLSelectElement;\n private removeElement?: HTMLCatButtonElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * The label for the select.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * The available options for the input.\n */\n @Prop() choices: Choice[] = [];\n\n /**\n * The pre-selected items for the input.\n */\n @Prop({ mutable: true }) value?: string | string[] | Choice | Choice[];\n\n /**\n * Disable the select.\n */\n @Prop() disabled = false;\n\n /**\n * Enable multiple selection.\n */\n @Prop() multiple = false;\n\n /**\n * The placeholder for the select.\n */\n @Prop() placeholder = '';\n\n /**\n * Whether the dropdown should appear above `(top)` or below `(bottom)` the\n * input. By default, if there is not enough space within the window the\n * dropdown will appear above the input, otherwise below it.\n */\n @Prop() position: 'auto' | 'top' | 'bottom' = 'auto';\n\n /**\n * Enable search for the select.\n */\n @Prop() noSearch = false;\n\n /**\n * Optional hint text(s) to be displayed with the select.\n */\n @Prop() hint?: string | string[];\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the search is triggered.\n */\n @Event() catSearch!: EventEmitter;\n\n /**\n * Emitted when scrolled to the bottom.\n */\n @Event() catScrolledBottom!: EventEmitter;\n\n @Watch('choices')\n setChoicesHandler(choices: Choice[]) {\n if (!choices?.length) return;\n\n this.setChoices(choices, 'value', 'label', true);\n }\n\n @Watch('value')\n setValueHandler(value?: string[] | Choice[]) {\n if (this.multiple) return;\n\n this.setValue(value || []);\n }\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.error('[A11y] Missing ARIA label on select', this);\n }\n }\n\n componentDidLoad(): void {\n this.init();\n const attachedInternals: ElementInternals | undefined = this.hostElement.attachInternals?.();\n if (attachedInternals) {\n this.choiceInner = attachedInternals.shadowRoot?.querySelector('.choices__inner') || undefined;\n this.choiceDropdown =\n attachedInternals.shadowRoot?.querySelector('.choices__list--dropdown')?.firstElementChild || undefined;\n }\n this.choiceInner?.addEventListener('click', this.showDropdownHandler.bind(this));\n this.selectElement?.addEventListener('addItem', this.onChange.bind(this));\n this.selectElement?.addEventListener('removeItem', this.onChange.bind(this));\n this.selectElement?.addEventListener('search', this.onSearch.bind(this));\n this.choiceDropdown?.addEventListener('scroll', this.onScrolledBottom.bind(this));\n if (this.multiple) {\n this.selectElement?.addEventListener('choice', this.onChoice.bind(this));\n this.createRemoveItemButton();\n }\n }\n\n disconnectedCallback(): void {\n this.choice?.destroy();\n this.choice = undefined;\n this.choiceInner?.removeEventListener('click', this.showDropdownHandler.bind(this));\n this.selectElement?.removeEventListener('addItem', this.onChange.bind(this));\n this.selectElement?.removeEventListener('removeItem', this.onChange.bind(this));\n this.selectElement?.removeEventListener('search', this.onSearch.bind(this));\n this.choiceDropdown?.removeEventListener('scroll', this.onScrolledBottom.bind(this));\n if (this.multiple) {\n this.selectElement?.removeEventListener('choice', this.onChoice.bind(this));\n this.removeElement?.removeEventListener('click', this.onRemoveItemButtonClick.bind(this));\n }\n }\n\n /**\n * Set value of input based on an array of objects or strings. This behaves\n * exactly the same as passing items via the items option but can be called\n * after initialisation.\n */\n @Method()\n async setValue(args: Array<string> | Array<Item>) {\n this.choice?.setValue(args);\n\n return this;\n }\n\n /**\n * Set choices of select input via an array of objects (or function that\n * returns array of object or promise of it), a value field name and a label\n * field name.\n */\n @Method()\n async setChoices(choices: Array<Choice> | Array<Group>, value?: string, label?: string, replaceChoices?: boolean) {\n this.choice?.setChoices(choices, value, label, replaceChoices);\n\n return this;\n }\n\n /**\n * Clear all choices from select.\n */\n @Method()\n async clearChoices() {\n this.choice?.clearChoices();\n\n return this;\n }\n\n /**\n * Clear input of any user inputted text.\n */\n @Method()\n async clearInput() {\n this.choice?.clearInput();\n\n return this;\n }\n\n render() {\n return (\n <Host>\n {(this.hasSlottedLabel || this.label) && (\n <label htmlFor={this.id} class={{ hidden: this.labelHidden }}>\n <span part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n {!this.required && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({this.i18n.t('input.optional')})\n </span>\n )}\n </span>\n </label>\n )}\n <select\n id={this.id}\n ref={el => (this.selectElement = el)}\n multiple={this.multiple}\n disabled={this.disabled}\n ></select>\n {this.hintSection}\n </Host>\n );\n }\n\n private init() {\n const value = this.value || [];\n const removeItemText = (value: string) => this.i18n.t('select.removeItem', { value });\n const config = {\n allowHTML: true,\n items: Array.isArray(value) ? value : ([value] as string[] | Choice[]),\n removeItemButton: true,\n duplicateItemsAllowed: false,\n delimiter: '',\n paste: false,\n searchEnabled: !this.noSearch,\n searchChoices: false,\n position: this.position,\n resetScrollPosition: false,\n placeholder: !!this.placeholder,\n placeholderValue: this.placeholder || '',\n searchPlaceholderValue: this.i18n.t('select.searchPlaceholder'),\n renderSelectedChoices: 'always' as 'auto' | 'always',\n loadingText: this.i18n.t('select.loading'),\n noResultsText: this.i18n.t('select.noResults'),\n noChoicesText: this.i18n.t('select.noChoices'),\n itemSelectText: this.i18n.t('select.selectItem'),\n addItemText: (value: string) => this.i18n.t('select.addItem', { value }),\n maxItemText: (maxItemCount: number) => this.i18n.t('select.maxItem', { maxItemCount }),\n uniqueItemText: this.i18n.t('select.uniqueItem'),\n customAddItemText: this.i18n.t('select.customAddItem')\n };\n\n const configSingle = {\n callbackOnCreateTemplates: (strToEl: (str: string) => HTMLElement) => {\n return {\n item: ({ classNames }: { classNames: ClassNames }, data: Item) => {\n const template = data.customProperties?.imageUrl\n ? `<img class=\"choices-option-icon\" src=\"${data.customProperties.imageUrl}\" style=\"margin-right: 0.5rem\" />`\n : '';\n return strToEl(\n `\n <div class=\"${classNames.item} ${\n data.highlighted ? classNames.highlightedState : classNames.itemSelectable\n } ${data.placeholder ? classNames.placeholder : ''}\" data-item data-id=\"${data.id}\" data-value=\"${\n data.value\n }\" ${data.active ? 'aria-selected=\"true\"' : ''} ${data.disabled ? 'aria-disabled=\"true\"' : ''}>\n <span>${template}</span> ${data.label}\n <button type=\"button\"\n class=\"${classNames.button}\"\n aria-label=\"${removeItemText(data.label)}\"\n data-button>${removeItemText(data.label)}</button>\n </div>\n `\n );\n }\n };\n }\n };\n\n const configMultiple = {\n callbackOnCreateTemplates: (strToEl: (str: string) => HTMLElement) => {\n const itemSelectText = config.itemSelectText;\n return {\n item: ({ classNames }: { classNames: ClassNames }, data: Item) => {\n const template = data.customProperties?.imageUrl\n ? `<img class=\"choices-option-icon\" src=\"${data.customProperties.imageUrl}\" style=\"margin-right: 0.5rem;\" />`\n : '';\n return strToEl(\n `<div class=\"\n ${classNames.item}\n ${data.highlighted ? classNames.highlightedState : classNames.itemSelectable}\n ${data.placeholder ? classNames.placeholder : ''}\"\n data-item data-id=\"${data.id}\" data-value=\"${data.value}\"\n ${data.active ? 'aria-selected=\"true\"' : ''}\n ${data.disabled ? 'aria-disabled=\"true\"' : ''}>\n ${template}\n ${data.label}\n <button type=\"button\"\n class=\"${classNames.button}\"\n aria-label=\"${removeItemText(data.label)}\"\n data-button>${removeItemText(data.label)}</button>\n </div>`\n );\n },\n choice: function ({ classNames }: { classNames: ClassNames }, data: Item) {\n const template = getOptionTemplate(data);\n const className = `${String(classNames.item)} ${String(classNames.itemChoice)}\n ${String(data.disabled ? classNames.itemDisabled : classNames.itemSelectable)}\n ${data.selected ? 'choices__item--selected' : ''}`;\n return strToEl(\n `<div class=\"${className}\"\n data-select-text=\"${itemSelectText}\"\n data-choice data-id=\"${String(data.id)}\" data-value=\"${String(data.value)}\"\n ${data.disabled ? 'data-choice-disabled aria-disabled=\"true\"' : 'data-choice-selectable'}\n ${data.groupId && data.groupId > 0 ? 'role=\"treeitem\"' : 'role=\"option\"'}>\n ${template}\n </div>`\n );\n }\n };\n }\n };\n\n const settings: Partial<Options> = this.multiple\n ? { ...config, ...configMultiple }\n : { ...config, ...configSingle };\n this.choice = new Choices(this.selectElement, settings);\n this.choice.setChoices(this.choices);\n }\n\n private get hintSection() {\n const hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n return (\n (this.hint || hasSlottedHint) && (\n <CatFormHint hint={this.hint} slottedHint={hasSlottedHint && <slot name=\"hint\"></slot>} />\n )\n );\n }\n\n private onChange() {\n this.value = this.choice?.getValue();\n this.catChange.emit(this.choice?.getValue());\n if (this.multiple) {\n this.updateRemoveItemButtonVisibility();\n }\n }\n\n private onSearch(event: Event) {\n const customEvent = event as CustomEvent<{ value: string }>;\n this.catSearch.emit(customEvent.detail.value);\n }\n\n private onScrolledBottom() {\n const scrolledBottom: boolean =\n this.choiceDropdown?.scrollHeight ===\n (this.choiceDropdown?.scrollTop || 0) + (this.choiceDropdown?.clientHeight || 0);\n\n if (scrolledBottom) {\n this.catScrolledBottom.emit();\n }\n }\n\n private onChoice(event: Event) {\n const customEvent = event as CustomEvent<{ choice: Choice }>;\n const items = Array.from(this.choice?.getValue() as Item[]);\n const item = items.find(value => value.choiceId === customEvent.detail.choice.id);\n if (item) {\n this.choice?._removeItem(item);\n }\n }\n\n private showDropdownHandler() {\n if (!this.disabled) {\n this.choice?.showDropdown();\n }\n }\n\n private createRemoveItemButton() {\n this.removeElement = document.createElement('cat-button') as HTMLCatButtonElement;\n this.removeElement.icon = 'cross-circle-outlined';\n this.removeElement.iconOnly = true;\n this.removeElement.a11yLabel = this.i18n.t('select.removeItem');\n this.updateRemoveItemButtonVisibility();\n this.removeElement.addEventListener('click', this.onRemoveItemButtonClick.bind(this));\n this.choiceInner?.appendChild(this.removeElement);\n }\n\n private updateRemoveItemButtonVisibility() {\n const items = Array.from(this.choice?.getValue() as Item[]);\n if (items.length) {\n this.removeElement?.removeAttribute('hidden');\n } else if (!items.length) {\n this.removeElement?.setAttribute('hidden', 'true');\n }\n }\n\n private onRemoveItemButtonClick(event: Event) {\n event.stopPropagation();\n this.choice?.removeActiveItems(-1);\n }\n}\n"]}
|
|
@@ -32,9 +32,13 @@ export class CatToggle {
|
|
|
32
32
|
*/
|
|
33
33
|
this.labelHidden = false;
|
|
34
34
|
/**
|
|
35
|
-
* Required state of the toggle
|
|
35
|
+
* Required state of the toggle.
|
|
36
36
|
*/
|
|
37
37
|
this.required = false;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the label should appear to the left of the toggle.
|
|
40
|
+
*/
|
|
41
|
+
this.labelLeft = false;
|
|
38
42
|
}
|
|
39
43
|
componentWillRender() {
|
|
40
44
|
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
|
|
@@ -53,7 +57,7 @@ export class CatToggle {
|
|
|
53
57
|
}
|
|
54
58
|
render() {
|
|
55
59
|
return (h(Host, null,
|
|
56
|
-
h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } },
|
|
60
|
+
h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft } },
|
|
57
61
|
h("input", { ref: el => (this.input = el), id: this.id, type: "checkbox", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, class: "form-check-input", role: "switch", onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }),
|
|
58
62
|
h("span", { class: "toggle", part: "toggle" }),
|
|
59
63
|
h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)),
|
|
@@ -183,7 +187,7 @@ export class CatToggle {
|
|
|
183
187
|
"optional": false,
|
|
184
188
|
"docs": {
|
|
185
189
|
"tags": [],
|
|
186
|
-
"text": "Required state of the toggle"
|
|
190
|
+
"text": "Required state of the toggle."
|
|
187
191
|
},
|
|
188
192
|
"attribute": "required",
|
|
189
193
|
"reflect": false,
|
|
@@ -222,6 +226,24 @@ export class CatToggle {
|
|
|
222
226
|
},
|
|
223
227
|
"attribute": "hint",
|
|
224
228
|
"reflect": false
|
|
229
|
+
},
|
|
230
|
+
"labelLeft": {
|
|
231
|
+
"type": "boolean",
|
|
232
|
+
"mutable": false,
|
|
233
|
+
"complexType": {
|
|
234
|
+
"original": "boolean",
|
|
235
|
+
"resolved": "boolean",
|
|
236
|
+
"references": {}
|
|
237
|
+
},
|
|
238
|
+
"required": false,
|
|
239
|
+
"optional": false,
|
|
240
|
+
"docs": {
|
|
241
|
+
"tags": [],
|
|
242
|
+
"text": "Whether the label should appear to the left of the toggle."
|
|
243
|
+
},
|
|
244
|
+
"attribute": "label-left",
|
|
245
|
+
"reflect": false,
|
|
246
|
+
"defaultValue": "false"
|
|
225
247
|
}
|
|
226
248
|
}; }
|
|
227
249
|
static get states() { return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cat-toggle.js","sourceRoot":"","sources":["../../../src/components/cat-toggle/cat-toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\n\nlet nextUniqueId = 0;\n\n/**\n * Toggles are graphical interface switches that give user control over a\n * feature or option that can be turned on or off.\n *\n * @slot hint - Optional hint element to be displayed with the toggle.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part toggle - The toggle element.\n * @part label - The label content.\n */\n@Component({\n tag: 'cat-toggle',\n styleUrls: ['cat-toggle.scss'],\n shadow: true\n})\nexport class CatToggle {\n private readonly id = `cat-toggle-${nextUniqueId++}`;\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * Checked state of the toggle.\n */\n @Prop() checked = false;\n\n /**\n * Disabled state of the toggle.\n */\n @Prop() disabled = false;\n\n /**\n * The label of the toggle that is visible.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * The name of the input\n */\n @Prop() name?: string;\n\n /**\n * Required state of the toggle.\n */\n @Prop() required = false;\n\n /**\n * The value of the toggle\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * Optional hint text(s) to be displayed with the toggle.\n */\n @Prop() hint?: string | string[];\n\n /**\n * Whether the label should appear to the left of the toggle.\n */\n @Prop() labelLeft = false;\n\n /**\n * Emitted when the checked status of the toggle is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the toggle received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the toggle loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.error('[A11y] Missing ARIA label on toggle', this);\n }\n }\n\n /**\n * Sets focus on the toggle. Use this method instead of `toggle.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async setFocus(options?: FocusOptions): Promise<void> {\n this.input.focus(options);\n }\n\n render() {\n return (\n <Host>\n <label\n htmlFor={this.id}\n class={{ 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft }}\n >\n <input\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n type=\"checkbox\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n required={this.required}\n disabled={this.disabled}\n class=\"form-check-input\"\n role=\"switch\"\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n />\n <span class=\"toggle\" part=\"toggle\"></span>\n <span class=\"label\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n </span>\n </label>\n {this.hintSection}\n </Host>\n );\n }\n\n private get hintSection() {\n const hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n return (\n (this.hint || hasSlottedHint) && (\n <CatFormHint hint={this.hint} slottedHint={hasSlottedHint && <slot name=\"hint\"></slot>} />\n )\n );\n }\n\n private onInput(event: Event) {\n this.value = this.input.value;\n this.catChange.emit(event);\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC","sourcesContent":["export { Components, JSX } from './components';\nexport { CatI18nRegistry } from './components/cat-i18n/cat-i18n-registry';\nexport { CatIconRegistry } from './components/cat-icon/cat-icon-registry';\nexport { NotificationsService } from './components/cat-notification/cat-notification';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC","sourcesContent":["export { Components, JSX } from './components';\nexport { CatI18nRegistry } from './components/cat-i18n/cat-i18n-registry';\nexport { CatIconRegistry } from './components/cat-icon/cat-icon-registry';\nexport { NotificationsService } from './components/cat-notification/cat-notification';\nexport { Choice } from 'choices.js';\n"]}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
$cat-head-margin-bottom: cat-token('size.spacing.s');
|
|
11
11
|
$cat-body-margin-bottom: cat-token('size.spacing.m');
|
|
12
|
-
$cat-nav-padding-horizontal:
|
|
12
|
+
$cat-nav-padding-horizontal: 1.25rem;
|
|
13
13
|
|
|
14
14
|
// --------
|
|
15
15
|
// -- z-indexes
|
|
@@ -28,6 +28,7 @@ $font-fallback-sans-serif: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvet
|
|
|
28
28
|
$font-fallback-monospace: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace !default;
|
|
29
29
|
$cat-link-text-decoration: none;
|
|
30
30
|
$cat-link-text-decoration-hover: underline;
|
|
31
|
+
$cat-button-text-decoration-hover: none;
|
|
31
32
|
$cat-mark-color: cat-token('color.theme.primary.bg', 0.2);
|
|
32
33
|
/* stylelint-enable value-keyword-case */
|
|
33
34
|
|
|
@@ -118,7 +118,7 @@ function createEmptyStyleRule(query) {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
const catButtonCss = ":host{display:inline-block;max-width:100%;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([hidden]){display:none}.cat-button{position:relative;font:inherit;display:flex;align-items:center;justify-content:center;border:none;border-radius:0.25rem;text-decoration:none;width:100%;box-sizing:border-box;cursor:pointer;transition:color 0.13s linear, border-color 0.13s linear, background-color 0.13s linear, box-shadow 0.13s linear}.cat-button:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-button-ellipsed .cat-button-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.cat-button-disabled{cursor:not-allowed;opacity:0.65;filter:grayscale(100%)}.cat-button-round{border-radius:10rem}.cat-button-loading{cursor:default}.cat-button-loading cat-spinner{position:absolute}.cat-button-loading>*:not(cat-spinner){visibility:hidden}.cat-button-filled{background-color:rgb(var(--bg));color:rgb(var(--fill));font-weight:600;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:greyscale}.cat-button-outlined{background-color:white;box-shadow:inset 0 0 0 1px rgba(var(--base), 0.2);color:rgb(var(--text))}.cat-button-outlined:hover:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.05)}.cat-button-outlined:active:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.1)}.cat-button-text{background-color:transparent;color:rgb(var(--text));text-decoration:none}.cat-button-text:hover:not(.cat-button-disabled):not(.cat-button-loading){text-decoration:
|
|
121
|
+
const catButtonCss = ":host{display:inline-block;max-width:100%;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([hidden]){display:none}.cat-button{position:relative;font:inherit;display:flex;align-items:center;justify-content:center;border:none;border-radius:0.25rem;text-decoration:none;width:100%;box-sizing:border-box;cursor:pointer;transition:color 0.13s linear, border-color 0.13s linear, background-color 0.13s linear, box-shadow 0.13s linear}.cat-button:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-button-ellipsed .cat-button-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.cat-button-disabled{cursor:not-allowed;opacity:0.65;filter:grayscale(100%)}.cat-button-round{border-radius:10rem}.cat-button-loading{cursor:default}.cat-button-loading cat-spinner{position:absolute}.cat-button-loading>*:not(cat-spinner){visibility:hidden}.cat-button-filled{background-color:rgb(var(--bg));color:rgb(var(--fill));font-weight:600;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:greyscale}.cat-button-outlined{background-color:white;box-shadow:inset 0 0 0 1px rgba(var(--base), 0.2);color:rgb(var(--text))}.cat-button-outlined:hover:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.05)}.cat-button-outlined:active:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.1)}.cat-button-text{background-color:transparent;color:rgb(var(--text));text-decoration:none}.cat-button-text:hover:not(.cat-button-disabled):not(.cat-button-loading){text-decoration:none;background-color:rgba(var(--base), 0.05)}.cat-button-primary{--bg:var(--cat-primary-bg, 32, 127, 138);--fill:var(--cat-primary-fill, 255, 255, 255);--text:var(--cat-primary-text, 32, 127, 138);--base:var(--cat-primary-text, 32, 127, 138)}.cat-button-primary:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-primary-bg-hover, 28, 112, 122);--fill:var(--cat-primary-fill-hover, 255, 255, 255);--text:var(--cat-primary-text-hover, 28, 112, 122)}.cat-button-primary:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-primary-bg-active, 25, 101, 110);--fill:var(--cat-primary-fill-active, 255, 255, 255);--text:var(--cat-primary-text-active, 25, 101, 110)}.cat-button-secondary{--bg:105, 118, 135;--fill:255, 255, 255;--text:0, 0, 0;--base:105, 118, 135}.cat-button-secondary:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:105, 118, 135;--fill:255, 255, 255;--text:0, 0, 0}.cat-button-secondary:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:105, 118, 135;--fill:255, 255, 255;--text:0, 0, 0}.cat-button-success{--bg:0, 132, 88;--fill:255, 255, 255;--text:0, 132, 88;--base:0, 132, 88}.cat-button-success:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:0, 117, 78;--fill:255, 255, 255;--text:0, 117, 78}.cat-button-success:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:0, 105, 70;--fill:255, 255, 255;--text:0, 105, 70}.cat-button-warning{--bg:255, 206, 128;--fill:0, 0, 0;--text:159, 97, 0;--base:159, 97, 0}.cat-button-warning:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:255, 214, 148;--fill:0, 0, 0;--text:159, 97, 0}.cat-button-warning:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:255, 222, 168;--fill:0, 0, 0;--text:159, 97, 0}.cat-button-danger{--bg:217, 52, 13;--fill:255, 255, 255;--text:217, 52, 13;--base:217, 52, 13}.cat-button-danger:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:194, 46, 11;--fill:255, 255, 255;--text:194, 46, 11}.cat-button-danger:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:174, 42, 10;--fill:255, 255, 255;--text:174, 42, 10}.cat-button-xs{min-width:1.5rem;padding:0.25rem 0.25rem;font-size:0.875rem;line-height:1rem}.cat-button-xs .cat-button-prefix{margin-right:0.25rem}.cat-button-xs .cat-button-suffix{margin-left:0.25rem}.cat-button-xs.cat-button-icon{width:1.5rem;padding-left:0;padding-right:0}:host-context(nav) .cat-button-xs{padding-left:1.25rem;padding-right:1.25rem}.cat-button-s{min-width:2rem;padding:0.375rem 0.5rem;font-size:0.9375rem;line-height:1.25rem}.cat-button-s .cat-button-prefix{margin-right:0.25rem}.cat-button-s .cat-button-suffix{margin-left:0.25rem}.cat-button-s cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-s.cat-button-icon{width:2rem;padding-left:0;padding-right:0}:host-context(nav) .cat-button-s{padding-left:1.25rem;padding-right:1.25rem}.cat-button-m{min-width:2.5rem;padding:0.625rem 0.75rem;font-size:0.9375rem;line-height:1.25rem}.cat-button-m .cat-button-prefix{margin-right:0.25rem}.cat-button-m .cat-button-suffix{margin-left:0.25rem}.cat-button-m cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-m.cat-button-icon{width:2.5rem;padding-left:0;padding-right:0}:host-context(nav) .cat-button-m{padding-left:1.25rem;padding-right:1.25rem}.cat-button-l{min-width:3rem;padding:0.875rem 1rem;font-size:0.9375rem;line-height:1.25rem}.cat-button-l .cat-button-prefix{margin-right:0.25rem}.cat-button-l .cat-button-suffix{margin-left:0.25rem}.cat-button-l cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-l.cat-button-icon{width:3rem;padding-left:0;padding-right:0}:host-context(nav) .cat-button-l{padding-left:1.25rem;padding-right:1.25rem}.cat-button-xl{min-width:3.5rem;padding:1rem 1.25rem;font-size:1.125rem;line-height:1.5rem}.cat-button-xl .cat-button-prefix{margin-right:0.25rem}.cat-button-xl .cat-button-suffix{margin-left:0.25rem}.cat-button-xl.cat-button-icon{width:3.5rem;padding-left:0;padding-right:0}:host-context(nav) .cat-button-xl{padding-left:1.25rem;padding-right:1.25rem}.cat-button-active::before{content:\"\";display:block;position:absolute;top:0;left:0;width:0.25rem;height:100%;background:rgb(var(--base))}:host-context(nav){width:100%}:host-context(nav) .cat-button{box-shadow:none;border-radius:0;justify-content:left}:host-context(nav) .cat-button:focus-visible{outline-offset:-2px}:host(.cat-text-left) .cat-button{justify-content:left}:host(.cat-text-right) .cat-button{justify-content:right}";
|
|
122
122
|
|
|
123
123
|
const CatButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
124
124
|
constructor() {
|