smoothly 0.2.3 → 0.2.4
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/cjs/loader.cjs.js +1 -1
- package/dist/cjs/smoothly-accordion_51.cjs.entry.js +57 -12
- package/dist/cjs/smoothly.cjs.js +1 -1
- package/dist/collection/components/menu-options/index.js +64 -3
- package/dist/collection/components/option/index.js +35 -1
- package/dist/collection/components/option/style.css +6 -0
- package/dist/collection/components/picker/index.js +129 -10
- package/dist/collection/components/select-demo/index.js +9 -1
- package/dist/custom-elements/index.js +60 -15
- package/dist/esm/loader.js +1 -1
- package/dist/esm/smoothly-accordion_51.entry.js +57 -12
- package/dist/esm/smoothly.js +1 -1
- package/dist/smoothly/{p-6e8e1fb1.entry.js → p-a302008c.entry.js} +1 -1
- package/dist/smoothly/smoothly.esm.js +1 -1
- package/dist/types/components/menu-options/index.d.ts +5 -0
- package/dist/types/components/option/index.d.ts +5 -0
- package/dist/types/components/picker/index.d.ts +13 -3
- package/dist/types/components.d.ts +15 -0
- package/package.json +1 -1
|
@@ -4,13 +4,16 @@ export class SmoothlyPicker {
|
|
|
4
4
|
this.keepFocusOnReRender = false;
|
|
5
5
|
this.emptyMenuLabel = "No Options";
|
|
6
6
|
this.multiple = false;
|
|
7
|
+
this.mutable = false;
|
|
7
8
|
this.options = [];
|
|
8
9
|
this.selections = [];
|
|
9
10
|
this.selectNoneName = "Select None";
|
|
10
11
|
this.selectAllName = "Select All";
|
|
11
12
|
this.selectionName = "items selected";
|
|
13
|
+
this.newOptionLabel = "Add:";
|
|
14
|
+
this.valueValidator = _ => [true, undefined];
|
|
12
15
|
}
|
|
13
|
-
|
|
16
|
+
isOpenChangeHandler() {
|
|
14
17
|
if (this.isOpen == false) {
|
|
15
18
|
this.menuClose.emit(this.selections);
|
|
16
19
|
}
|
|
@@ -22,10 +25,26 @@ export class SmoothlyPicker {
|
|
|
22
25
|
this.keepFocusOnReRender = false;
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
|
-
|
|
28
|
+
optionSelectHandler(event) {
|
|
26
29
|
this.toggle(event.detail);
|
|
27
30
|
event.stopPropagation();
|
|
28
31
|
}
|
|
32
|
+
optionAddHandler(event) {
|
|
33
|
+
if (this.mutable) {
|
|
34
|
+
const [status, notice] = this.valueValidator(event.detail.value);
|
|
35
|
+
if (status) {
|
|
36
|
+
const option = Object.assign({}, event.detail);
|
|
37
|
+
this.options = [...this.options, option];
|
|
38
|
+
this.select(option);
|
|
39
|
+
}
|
|
40
|
+
notice && this.notice.emit(notice);
|
|
41
|
+
}
|
|
42
|
+
event.stopPropagation();
|
|
43
|
+
}
|
|
44
|
+
emptyHandler(event) {
|
|
45
|
+
this.empty = event.detail;
|
|
46
|
+
event.stopPropagation();
|
|
47
|
+
}
|
|
29
48
|
toggle(option) {
|
|
30
49
|
option.value == "select-none"
|
|
31
50
|
? this.toggleAll()
|
|
@@ -60,9 +79,19 @@ export class SmoothlyPicker {
|
|
|
60
79
|
}
|
|
61
80
|
toggleHighlighted() {
|
|
62
81
|
var _a;
|
|
63
|
-
(
|
|
64
|
-
|
|
65
|
-
|
|
82
|
+
if (this.mutable && this.empty) {
|
|
83
|
+
const [status, notice] = this.valueValidator(this.inputElement.value);
|
|
84
|
+
if (status) {
|
|
85
|
+
const option = { name: this.inputElement.value, value: this.inputElement.value };
|
|
86
|
+
this.options = [...this.options, option];
|
|
87
|
+
this.select(option);
|
|
88
|
+
}
|
|
89
|
+
notice && this.notice.emit(notice);
|
|
90
|
+
}
|
|
91
|
+
else
|
|
92
|
+
(_a = this.menuElement) === null || _a === void 0 ? void 0 : _a.getHighlighted().then((result) => {
|
|
93
|
+
result && this.toggle(result);
|
|
94
|
+
});
|
|
66
95
|
}
|
|
67
96
|
highlightDefault() {
|
|
68
97
|
var _a;
|
|
@@ -141,7 +170,7 @@ export class SmoothlyPicker {
|
|
|
141
170
|
: this.selections.map(selection => selection.name).join(", "), onKeyDown: e => this.onKeyDown(e), onInput: (e) => this.onInput(e) }),
|
|
142
171
|
h("smoothly-icon", { class: "down", name: "chevron-down", size: "tiny" }),
|
|
143
172
|
h("smoothly-icon", { class: "up", name: "chevron-up", size: "tiny" })),
|
|
144
|
-
h("smoothly-menu-options", { style: { width: "100%" }, optionStyle: Object.assign({}, this.optionStyle), order: false, emptyMenuLabel: this.emptyMenuLabel, "max-menu-height": this.maxMenuHeight, ref: (el) => (this.menuElement = el !== null && el !== void 0 ? el : this.menuElement), onClick: e => e.stopPropagation(), resetHighlightOnOptionsChange: false, options: options })));
|
|
173
|
+
h("smoothly-menu-options", { style: { width: "100%" }, optionStyle: Object.assign({}, this.optionStyle), order: false, emptyMenuLabel: this.emptyMenuLabel, newOptionLabel: this.newOptionLabel, "max-menu-height": this.maxMenuHeight, mutable: this.mutable, ref: (el) => (this.menuElement = el !== null && el !== void 0 ? el : this.menuElement), onClick: e => e.stopPropagation(), resetHighlightOnOptionsChange: false, options: options })));
|
|
145
174
|
}
|
|
146
175
|
static get is() { return "smoothly-picker"; }
|
|
147
176
|
static get encapsulation() { return "shadow"; }
|
|
@@ -222,6 +251,24 @@ export class SmoothlyPicker {
|
|
|
222
251
|
"reflect": true,
|
|
223
252
|
"defaultValue": "false"
|
|
224
253
|
},
|
|
254
|
+
"mutable": {
|
|
255
|
+
"type": "boolean",
|
|
256
|
+
"mutable": false,
|
|
257
|
+
"complexType": {
|
|
258
|
+
"original": "boolean",
|
|
259
|
+
"resolved": "boolean",
|
|
260
|
+
"references": {}
|
|
261
|
+
},
|
|
262
|
+
"required": false,
|
|
263
|
+
"optional": false,
|
|
264
|
+
"docs": {
|
|
265
|
+
"tags": [],
|
|
266
|
+
"text": ""
|
|
267
|
+
},
|
|
268
|
+
"attribute": "mutable",
|
|
269
|
+
"reflect": false,
|
|
270
|
+
"defaultValue": "false"
|
|
271
|
+
},
|
|
225
272
|
"optionStyle": {
|
|
226
273
|
"type": "any",
|
|
227
274
|
"mutable": false,
|
|
@@ -368,10 +415,50 @@ export class SmoothlyPicker {
|
|
|
368
415
|
"attribute": "selection-name",
|
|
369
416
|
"reflect": false,
|
|
370
417
|
"defaultValue": "\"items selected\""
|
|
418
|
+
},
|
|
419
|
+
"newOptionLabel": {
|
|
420
|
+
"type": "string",
|
|
421
|
+
"mutable": true,
|
|
422
|
+
"complexType": {
|
|
423
|
+
"original": "string",
|
|
424
|
+
"resolved": "string",
|
|
425
|
+
"references": {}
|
|
426
|
+
},
|
|
427
|
+
"required": false,
|
|
428
|
+
"optional": false,
|
|
429
|
+
"docs": {
|
|
430
|
+
"tags": [],
|
|
431
|
+
"text": ""
|
|
432
|
+
},
|
|
433
|
+
"attribute": "new-option-label",
|
|
434
|
+
"reflect": false,
|
|
435
|
+
"defaultValue": "\"Add:\""
|
|
436
|
+
},
|
|
437
|
+
"valueValidator": {
|
|
438
|
+
"type": "unknown",
|
|
439
|
+
"mutable": false,
|
|
440
|
+
"complexType": {
|
|
441
|
+
"original": "(value: any) => [boolean, Notice | undefined]",
|
|
442
|
+
"resolved": "(value: any) => [boolean, Notice | undefined]",
|
|
443
|
+
"references": {
|
|
444
|
+
"Notice": {
|
|
445
|
+
"location": "import",
|
|
446
|
+
"path": "../../model"
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
"required": false,
|
|
451
|
+
"optional": false,
|
|
452
|
+
"docs": {
|
|
453
|
+
"tags": [],
|
|
454
|
+
"text": ""
|
|
455
|
+
},
|
|
456
|
+
"defaultValue": "_ => [true, undefined]"
|
|
371
457
|
}
|
|
372
458
|
}; }
|
|
373
459
|
static get states() { return {
|
|
374
|
-
"isOpen": {}
|
|
460
|
+
"isOpen": {},
|
|
461
|
+
"empty": {}
|
|
375
462
|
}; }
|
|
376
463
|
static get events() { return [{
|
|
377
464
|
"method": "menuClose",
|
|
@@ -393,18 +480,50 @@ export class SmoothlyPicker {
|
|
|
393
480
|
}
|
|
394
481
|
}
|
|
395
482
|
}
|
|
483
|
+
}, {
|
|
484
|
+
"method": "notice",
|
|
485
|
+
"name": "notice",
|
|
486
|
+
"bubbles": true,
|
|
487
|
+
"cancelable": true,
|
|
488
|
+
"composed": true,
|
|
489
|
+
"docs": {
|
|
490
|
+
"tags": [],
|
|
491
|
+
"text": ""
|
|
492
|
+
},
|
|
493
|
+
"complexType": {
|
|
494
|
+
"original": "Notice",
|
|
495
|
+
"resolved": "Notice",
|
|
496
|
+
"references": {
|
|
497
|
+
"Notice": {
|
|
498
|
+
"location": "import",
|
|
499
|
+
"path": "../../model"
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
396
503
|
}]; }
|
|
397
504
|
static get elementRef() { return "element"; }
|
|
398
505
|
static get watchers() { return [{
|
|
399
506
|
"propName": "selections",
|
|
400
|
-
"methodName": "
|
|
507
|
+
"methodName": "isOpenChangeHandler"
|
|
401
508
|
}, {
|
|
402
509
|
"propName": "isOpen",
|
|
403
|
-
"methodName": "
|
|
510
|
+
"methodName": "isOpenChangeHandler"
|
|
404
511
|
}]; }
|
|
405
512
|
static get listeners() { return [{
|
|
406
513
|
"name": "optionSelect",
|
|
407
|
-
"method": "
|
|
514
|
+
"method": "optionSelectHandler",
|
|
515
|
+
"target": undefined,
|
|
516
|
+
"capture": false,
|
|
517
|
+
"passive": false
|
|
518
|
+
}, {
|
|
519
|
+
"name": "optionAdd",
|
|
520
|
+
"method": "optionAddHandler",
|
|
521
|
+
"target": undefined,
|
|
522
|
+
"capture": false,
|
|
523
|
+
"passive": false
|
|
524
|
+
}, {
|
|
525
|
+
"name": "menuEmpty",
|
|
526
|
+
"method": "emptyHandler",
|
|
408
527
|
"target": undefined,
|
|
409
528
|
"capture": false,
|
|
410
529
|
"passive": false
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Component, h, Listen } from "@stencil/core";
|
|
2
|
+
import { Notice } from "../../model";
|
|
2
3
|
export class SmoothlySelectDemo {
|
|
3
4
|
constructor() {
|
|
4
5
|
this.currencies = ["SEK", "EUR"];
|
|
@@ -63,7 +64,7 @@ export class SmoothlySelectDemo {
|
|
|
63
64
|
{ name: "Scary Kraken", value: "kraken" },
|
|
64
65
|
] }),
|
|
65
66
|
h("br", null),
|
|
66
|
-
h("smoothly-picker", { label: "", "empty-menu-label": "Sorry, we're out of options.", "max-height": "58px", multiple: true, options: [
|
|
67
|
+
h("smoothly-picker", { label: "Multiple", "empty-menu-label": "Sorry, we're out of options.", "max-height": "58px", multiple: true, options: [
|
|
67
68
|
{ name: "Big Dog", value: "dog", aliases: ["WOFF"] },
|
|
68
69
|
{ name: "Cat Stevens", value: "cat", aliases: ["moew"] },
|
|
69
70
|
{ name: "Noble Pig", value: "pig" },
|
|
@@ -77,6 +78,13 @@ export class SmoothlySelectDemo {
|
|
|
77
78
|
{ name: "Scary Kraken", value: "kraken" },
|
|
78
79
|
] }),
|
|
79
80
|
h("br", null),
|
|
81
|
+
h("smoothly-picker", { label: "Multiple mutable", "max-height": "58px", multiple: true, mutable: true, newOptionLabel: "Invite:", options: [
|
|
82
|
+
{ name: "john@example.com", value: "john@example.com" },
|
|
83
|
+
{ name: "jane@example.com", value: "jane@example.com" },
|
|
84
|
+
{ name: "james@example.com", value: "james@example.com" },
|
|
85
|
+
{ name: "jessie@example.com", value: "jessie@example.com" },
|
|
86
|
+
], valueValidator: (email) => email.match(/^\w+@\w+/) ? [true, undefined] : [false, Notice.failed("Incorrectly formatted email")] }),
|
|
87
|
+
h("br", null),
|
|
80
88
|
h("smoothly-picker", { label: "Single select", multiple: false, "max-menu-height": "200px", options: [
|
|
81
89
|
{ name: "Dog", value: "dog", aliases: ["WOFF"], right: "Woof 🐶" },
|
|
82
90
|
{ name: "Cat", value: "cat", aliases: ["moew"] },
|
|
@@ -47831,12 +47831,15 @@ const SmoothlyMenuOptions$1 = class extends HTMLElement {
|
|
|
47831
47831
|
super();
|
|
47832
47832
|
this.__registerHost();
|
|
47833
47833
|
this.__attachShadow();
|
|
47834
|
+
this.menuEmpty = createEvent(this, "menuEmpty", 7);
|
|
47834
47835
|
this.filteredOptions = [];
|
|
47835
47836
|
this.highlightIndex = 0;
|
|
47836
47837
|
this.emptyMenuLabel = "No Options";
|
|
47838
|
+
this.newOptionLabel = "Add:";
|
|
47837
47839
|
this.order = false;
|
|
47838
47840
|
this.options = [];
|
|
47839
47841
|
this.resetHighlightOnOptionsChange = true;
|
|
47842
|
+
this.mutable = false;
|
|
47840
47843
|
}
|
|
47841
47844
|
optionsChangeHandler(newOptions) {
|
|
47842
47845
|
this.highlightIndex = this.resetHighlightOnOptionsChange ? 0 : this.highlightIndex;
|
|
@@ -47875,6 +47878,7 @@ const SmoothlyMenuOptions$1 = class extends HTMLElement {
|
|
|
47875
47878
|
return result;
|
|
47876
47879
|
}
|
|
47877
47880
|
async filterOptions(keyword, excludeValues = []) {
|
|
47881
|
+
this.keyword = keyword;
|
|
47878
47882
|
const keywordLowercase = keyword.toLowerCase();
|
|
47879
47883
|
this.filteredOptions = [];
|
|
47880
47884
|
for (const option of this.options) {
|
|
@@ -47882,6 +47886,7 @@ const SmoothlyMenuOptions$1 = class extends HTMLElement {
|
|
|
47882
47886
|
const isVisible = names.toLowerCase().includes(keywordLowercase) && !excludeValues.includes(option.value);
|
|
47883
47887
|
isVisible && this.filteredOptions.push(option);
|
|
47884
47888
|
}
|
|
47889
|
+
this.menuEmpty.emit(!this.filteredOptions.length);
|
|
47885
47890
|
this.order && this.sortOptions(keyword);
|
|
47886
47891
|
}
|
|
47887
47892
|
sortOptions(keyword) {
|
|
@@ -47918,7 +47923,7 @@ const SmoothlyMenuOptions$1 = class extends HTMLElement {
|
|
|
47918
47923
|
}
|
|
47919
47924
|
}
|
|
47920
47925
|
render() {
|
|
47921
|
-
return (h(Host, { style: { "--max-menu-height": this.maxMenuHeight } }, this.filteredOptions.length > 0 ? (this.filteredOptions.map((option, index) => (h("smoothly-option", { style: this.optionStyle, ref: el => index == 0 && (this.firstOptionsElement = el !== null && el !== void 0 ? el : this.firstOptionsElement), value: option.value, name: option.name, divider: option.divider, "data-highlight": this.highlightIndex == index }, option.left ? h("div", { slot: "left" }, option.left) : undefined, option.right ? h("div", { slot: "right" }, option.right) : undefined)))) : (h("div", null, this.emptyMenuLabel))));
|
|
47926
|
+
return (h(Host, { style: { "--max-menu-height": this.maxMenuHeight } }, this.filteredOptions.length > 0 ? (this.filteredOptions.map((option, index) => (h("smoothly-option", { style: this.optionStyle, ref: el => index == 0 && (this.firstOptionsElement = el !== null && el !== void 0 ? el : this.firstOptionsElement), value: option.value, name: option.name, divider: option.divider, "data-highlight": this.highlightIndex == index }, option.left ? h("div", { slot: "left" }, option.left) : undefined, option.right ? h("div", { slot: "right" }, option.right) : undefined)))) : this.mutable ? (h("smoothly-option", { style: this.optionStyle, ref: el => (this.firstOptionsElement = el !== null && el !== void 0 ? el : this.firstOptionsElement), value: this.keyword, name: this.keyword, "data-highlight": 0, new: true }, h("div", { slot: "left" }, h("smoothly-icon", { name: "square-outline", size: "small" }), " ", this.newOptionLabel))) : (h("div", null, this.emptyMenuLabel))));
|
|
47922
47927
|
}
|
|
47923
47928
|
get element() { return this; }
|
|
47924
47929
|
static get watchers() { return {
|
|
@@ -48011,7 +48016,7 @@ const Notifier = class extends HTMLElement {
|
|
|
48011
48016
|
static get style() { return styleCss$q; }
|
|
48012
48017
|
};
|
|
48013
48018
|
|
|
48014
|
-
const styleCss$p = ":host{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;padding:0.7em 1em;margin-left:1px;margin-right:1px;background-color:transparent;position:relative}:host([data-highlight]){background-color:rgb(var(--smoothly-default-shade))}:host>div.middle{padding-left:0.5em;flex-shrink:1;width:100%}:host([divider]){margin-bottom:0.5em}::slotted([slot=right]){font-style:italic;white-space:nowrap}:host([divider])::after{position:absolute;height:1px;width:100%;left:0;bottom:-0.25em;content:\"\";background-color:rgba(var(--smoothly-dark-color))}";
|
|
48019
|
+
const styleCss$p = ":host{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;padding:0.7em 1em;margin-left:1px;margin-right:1px;background-color:transparent;position:relative}:host([data-highlight]){background-color:rgb(var(--smoothly-default-shade))}:host>div.middle{padding-left:0.5em;flex-shrink:1;width:100%}:host([divider]){margin-bottom:0.5em}::slotted([slot=right]){font-style:italic;white-space:nowrap}:host([divider])::after{position:absolute;height:1px;width:100%;left:0;bottom:-0.25em;content:\"\";background-color:rgba(var(--smoothly-dark-color))}::slotted([slot=left]){display:flex;align-items:center;gap:1ch}";
|
|
48015
48020
|
|
|
48016
48021
|
const SmoothlyOption$1 = class extends HTMLElement {
|
|
48017
48022
|
constructor() {
|
|
@@ -48020,6 +48025,7 @@ const SmoothlyOption$1 = class extends HTMLElement {
|
|
|
48020
48025
|
this.__attachShadow();
|
|
48021
48026
|
this.optionHover = createEvent(this, "optionHover", 7);
|
|
48022
48027
|
this.optionSelect = createEvent(this, "optionSelect", 7);
|
|
48028
|
+
this.optionAdd = createEvent(this, "optionAdd", 7);
|
|
48023
48029
|
this.dataHighlight = false;
|
|
48024
48030
|
this.divider = false;
|
|
48025
48031
|
}
|
|
@@ -48028,7 +48034,9 @@ const SmoothlyOption$1 = class extends HTMLElement {
|
|
|
48028
48034
|
}
|
|
48029
48035
|
onSelect(event) {
|
|
48030
48036
|
if (this.value)
|
|
48031
|
-
this.
|
|
48037
|
+
this.new
|
|
48038
|
+
? this.optionAdd.emit({ name: this.name, value: this.value })
|
|
48039
|
+
: this.optionSelect.emit({ name: this.name, value: this.value });
|
|
48032
48040
|
else
|
|
48033
48041
|
throw `smoothly-option ${this.element.innerHTML} lacks value-property and can therefore not be selected`;
|
|
48034
48042
|
}
|
|
@@ -48047,16 +48055,20 @@ const SmoothlyPicker$1 = class extends HTMLElement {
|
|
|
48047
48055
|
this.__registerHost();
|
|
48048
48056
|
this.__attachShadow();
|
|
48049
48057
|
this.menuClose = createEvent(this, "menuClose", 7);
|
|
48058
|
+
this.notice = createEvent(this, "notice", 7);
|
|
48050
48059
|
this.keepFocusOnReRender = false;
|
|
48051
48060
|
this.emptyMenuLabel = "No Options";
|
|
48052
48061
|
this.multiple = false;
|
|
48062
|
+
this.mutable = false;
|
|
48053
48063
|
this.options = [];
|
|
48054
48064
|
this.selections = [];
|
|
48055
48065
|
this.selectNoneName = "Select None";
|
|
48056
48066
|
this.selectAllName = "Select All";
|
|
48057
48067
|
this.selectionName = "items selected";
|
|
48068
|
+
this.newOptionLabel = "Add:";
|
|
48069
|
+
this.valueValidator = _ => [true, undefined];
|
|
48058
48070
|
}
|
|
48059
|
-
|
|
48071
|
+
isOpenChangeHandler() {
|
|
48060
48072
|
if (this.isOpen == false) {
|
|
48061
48073
|
this.menuClose.emit(this.selections);
|
|
48062
48074
|
}
|
|
@@ -48068,10 +48080,26 @@ const SmoothlyPicker$1 = class extends HTMLElement {
|
|
|
48068
48080
|
this.keepFocusOnReRender = false;
|
|
48069
48081
|
}
|
|
48070
48082
|
}
|
|
48071
|
-
|
|
48083
|
+
optionSelectHandler(event) {
|
|
48072
48084
|
this.toggle(event.detail);
|
|
48073
48085
|
event.stopPropagation();
|
|
48074
48086
|
}
|
|
48087
|
+
optionAddHandler(event) {
|
|
48088
|
+
if (this.mutable) {
|
|
48089
|
+
const [status, notice] = this.valueValidator(event.detail.value);
|
|
48090
|
+
if (status) {
|
|
48091
|
+
const option = Object.assign({}, event.detail);
|
|
48092
|
+
this.options = [...this.options, option];
|
|
48093
|
+
this.select(option);
|
|
48094
|
+
}
|
|
48095
|
+
notice && this.notice.emit(notice);
|
|
48096
|
+
}
|
|
48097
|
+
event.stopPropagation();
|
|
48098
|
+
}
|
|
48099
|
+
emptyHandler(event) {
|
|
48100
|
+
this.empty = event.detail;
|
|
48101
|
+
event.stopPropagation();
|
|
48102
|
+
}
|
|
48075
48103
|
toggle(option) {
|
|
48076
48104
|
option.value == "select-none"
|
|
48077
48105
|
? this.toggleAll()
|
|
@@ -48106,9 +48134,19 @@ const SmoothlyPicker$1 = class extends HTMLElement {
|
|
|
48106
48134
|
}
|
|
48107
48135
|
toggleHighlighted() {
|
|
48108
48136
|
var _a;
|
|
48109
|
-
(
|
|
48110
|
-
|
|
48111
|
-
|
|
48137
|
+
if (this.mutable && this.empty) {
|
|
48138
|
+
const [status, notice] = this.valueValidator(this.inputElement.value);
|
|
48139
|
+
if (status) {
|
|
48140
|
+
const option = { name: this.inputElement.value, value: this.inputElement.value };
|
|
48141
|
+
this.options = [...this.options, option];
|
|
48142
|
+
this.select(option);
|
|
48143
|
+
}
|
|
48144
|
+
notice && this.notice.emit(notice);
|
|
48145
|
+
}
|
|
48146
|
+
else
|
|
48147
|
+
(_a = this.menuElement) === null || _a === void 0 ? void 0 : _a.getHighlighted().then((result) => {
|
|
48148
|
+
result && this.toggle(result);
|
|
48149
|
+
});
|
|
48112
48150
|
}
|
|
48113
48151
|
highlightDefault() {
|
|
48114
48152
|
var _a;
|
|
@@ -48180,12 +48218,12 @@ const SmoothlyPicker$1 = class extends HTMLElement {
|
|
|
48180
48218
|
];
|
|
48181
48219
|
return (h(Host, { style: cssVariables, "has-selection": this.selections.length > 0, "is-open": this.isOpen ? "" : undefined, onMouseDown: (e) => e.preventDefault(), onClick: () => this.onClick() }, h("div", null, h("smoothly-icon", { class: "search", name: "search-outline", size: "tiny" }), h("label", null, this.label), h("input", { type: "text", ref: (el) => (this.inputElement = el ? el : this.inputElement), onFocus: () => this.highlightDefault(), onBlur: () => this.onBlur(), placeholder: this.selections.length > 3
|
|
48182
48220
|
? this.selections.length.toString() + " " + this.selectionName
|
|
48183
|
-
: this.selections.map(selection => selection.name).join(", "), onKeyDown: e => this.onKeyDown(e), onInput: (e) => this.onInput(e) }), h("smoothly-icon", { class: "down", name: "chevron-down", size: "tiny" }), h("smoothly-icon", { class: "up", name: "chevron-up", size: "tiny" })), h("smoothly-menu-options", { style: { width: "100%" }, optionStyle: Object.assign({}, this.optionStyle), order: false, emptyMenuLabel: this.emptyMenuLabel, "max-menu-height": this.maxMenuHeight, ref: (el) => (this.menuElement = el !== null && el !== void 0 ? el : this.menuElement), onClick: e => e.stopPropagation(), resetHighlightOnOptionsChange: false, options: options })));
|
|
48221
|
+
: this.selections.map(selection => selection.name).join(", "), onKeyDown: e => this.onKeyDown(e), onInput: (e) => this.onInput(e) }), h("smoothly-icon", { class: "down", name: "chevron-down", size: "tiny" }), h("smoothly-icon", { class: "up", name: "chevron-up", size: "tiny" })), h("smoothly-menu-options", { style: { width: "100%" }, optionStyle: Object.assign({}, this.optionStyle), order: false, emptyMenuLabel: this.emptyMenuLabel, newOptionLabel: this.newOptionLabel, "max-menu-height": this.maxMenuHeight, mutable: this.mutable, ref: (el) => (this.menuElement = el !== null && el !== void 0 ? el : this.menuElement), onClick: e => e.stopPropagation(), resetHighlightOnOptionsChange: false, options: options })));
|
|
48184
48222
|
}
|
|
48185
48223
|
get element() { return this; }
|
|
48186
48224
|
static get watchers() { return {
|
|
48187
|
-
"selections": ["
|
|
48188
|
-
"isOpen": ["
|
|
48225
|
+
"selections": ["isOpenChangeHandler"],
|
|
48226
|
+
"isOpen": ["isOpenChangeHandler"]
|
|
48189
48227
|
}; }
|
|
48190
48228
|
static get style() { return styleCss$o; }
|
|
48191
48229
|
};
|
|
@@ -48450,7 +48488,7 @@ const SmoothlySelectDemo$1 = class extends HTMLElement {
|
|
|
48450
48488
|
{ name: "Scary Kraken", value: "kraken" },
|
|
48451
48489
|
] }),
|
|
48452
48490
|
h("br", null),
|
|
48453
|
-
h("smoothly-picker", { label: "", "empty-menu-label": "Sorry, we're out of options.", "max-height": "58px", multiple: true, options: [
|
|
48491
|
+
h("smoothly-picker", { label: "Multiple", "empty-menu-label": "Sorry, we're out of options.", "max-height": "58px", multiple: true, options: [
|
|
48454
48492
|
{ name: "Big Dog", value: "dog", aliases: ["WOFF"] },
|
|
48455
48493
|
{ name: "Cat Stevens", value: "cat", aliases: ["moew"] },
|
|
48456
48494
|
{ name: "Noble Pig", value: "pig" },
|
|
@@ -48464,6 +48502,13 @@ const SmoothlySelectDemo$1 = class extends HTMLElement {
|
|
|
48464
48502
|
{ name: "Scary Kraken", value: "kraken" },
|
|
48465
48503
|
] }),
|
|
48466
48504
|
h("br", null),
|
|
48505
|
+
h("smoothly-picker", { label: "Multiple mutable", "max-height": "58px", multiple: true, mutable: true, newOptionLabel: "Invite:", options: [
|
|
48506
|
+
{ name: "john@example.com", value: "john@example.com" },
|
|
48507
|
+
{ name: "jane@example.com", value: "jane@example.com" },
|
|
48508
|
+
{ name: "james@example.com", value: "james@example.com" },
|
|
48509
|
+
{ name: "jessie@example.com", value: "jessie@example.com" },
|
|
48510
|
+
], valueValidator: (email) => email.match(/^\w+@\w+/) ? [true, undefined] : [false, Notice.failed("Incorrectly formatted email")] }),
|
|
48511
|
+
h("br", null),
|
|
48467
48512
|
h("smoothly-picker", { label: "Single select", multiple: false, "max-menu-height": "200px", options: [
|
|
48468
48513
|
{ name: "Dog", value: "dog", aliases: ["WOFF"], right: "Woof 🐶" },
|
|
48469
48514
|
{ name: "Cat", value: "cat", aliases: ["moew"] },
|
|
@@ -49065,11 +49110,11 @@ const SmoothlyInputDateRange = /*@__PURE__*/proxyCustomElement(InputDateRange, [
|
|
|
49065
49110
|
const SmoothlyInputDemo = /*@__PURE__*/proxyCustomElement(SmoothlyInputDemo$1, [0,"smoothly-input-demo"]);
|
|
49066
49111
|
const SmoothlyInputMonth = /*@__PURE__*/proxyCustomElement(MonthSelector, [2,"smoothly-input-month",{"value":[1025]}]);
|
|
49067
49112
|
const SmoothlyItem = /*@__PURE__*/proxyCustomElement(Item, [6,"smoothly-item",{"value":[8],"selected":[1540]},[[0,"click","onClick"]]]);
|
|
49068
|
-
const SmoothlyMenuOptions = /*@__PURE__*/proxyCustomElement(SmoothlyMenuOptions$1, [1,"smoothly-menu-options",{"emptyMenuLabel":[1025,"empty-menu-label"],"maxMenuHeight":[1,"max-menu-height"],"order":[4],"optionStyle":[8,"option-style"],"options":[1040],"resetHighlightOnOptionsChange":[1028,"reset-highlight-on-options-change"],"filteredOptions":[32],"highlightIndex":[32]},[[0,"optionHover","optionHoverHandler"]]]);
|
|
49113
|
+
const SmoothlyMenuOptions = /*@__PURE__*/proxyCustomElement(SmoothlyMenuOptions$1, [1,"smoothly-menu-options",{"emptyMenuLabel":[1025,"empty-menu-label"],"newOptionLabel":[1,"new-option-label"],"maxMenuHeight":[1,"max-menu-height"],"order":[4],"optionStyle":[8,"option-style"],"options":[1040],"resetHighlightOnOptionsChange":[1028,"reset-highlight-on-options-change"],"mutable":[4],"filteredOptions":[32],"highlightIndex":[32],"keyword":[32]},[[0,"optionHover","optionHoverHandler"]]]);
|
|
49069
49114
|
const SmoothlyNotification = /*@__PURE__*/proxyCustomElement(Notification, [2,"smoothly-notification",{"notice":[16],"tick":[32]},[[0,"trigger","onTrigger"]]]);
|
|
49070
49115
|
const SmoothlyNotifier = /*@__PURE__*/proxyCustomElement(Notifier, [6,"smoothly-notifier",{"notices":[32]},[[0,"notice","onNotice"],[0,"remove","onRemove"]]]);
|
|
49071
|
-
const SmoothlyOption = /*@__PURE__*/proxyCustomElement(SmoothlyOption$1, [1,"smoothly-option",{"aliases":[513],"dataHighlight":[1540,"data-highlight"],"name":[1537],"value":[1537],"divider":[1540]}]);
|
|
49072
|
-
const SmoothlyPicker = /*@__PURE__*/proxyCustomElement(SmoothlyPicker$1, [1,"smoothly-picker",{"maxMenuHeight":[1,"max-menu-height"],"maxHeight":[1,"max-height"],"emptyMenuLabel":[1025,"empty-menu-label"],"multiple":[516],"optionStyle":[8,"option-style"],"options":[16],"labelSetting":[513,"label-setting"],"label":[513],"selections":[1040],"selectNoneName":[1025,"select-none-name"],"selectAllName":[1025,"select-all-name"],"selectionName":[1025,"selection-name"],"isOpen":[32]},[[0,"optionSelect","
|
|
49116
|
+
const SmoothlyOption = /*@__PURE__*/proxyCustomElement(SmoothlyOption$1, [1,"smoothly-option",{"aliases":[513],"dataHighlight":[1540,"data-highlight"],"name":[1537],"value":[1537],"divider":[1540],"new":[4]}]);
|
|
49117
|
+
const SmoothlyPicker = /*@__PURE__*/proxyCustomElement(SmoothlyPicker$1, [1,"smoothly-picker",{"maxMenuHeight":[1,"max-menu-height"],"maxHeight":[1,"max-height"],"emptyMenuLabel":[1025,"empty-menu-label"],"multiple":[516],"mutable":[4],"optionStyle":[8,"option-style"],"options":[16],"labelSetting":[513,"label-setting"],"label":[513],"selections":[1040],"selectNoneName":[1025,"select-none-name"],"selectAllName":[1025,"select-all-name"],"selectionName":[1025,"selection-name"],"newOptionLabel":[1025,"new-option-label"],"valueValidator":[16],"isOpen":[32],"empty":[32]},[[0,"optionSelect","optionSelectHandler"],[0,"optionAdd","optionAddHandler"],[0,"menuEmpty","emptyHandler"]]]);
|
|
49073
49118
|
const SmoothlyPopup = /*@__PURE__*/proxyCustomElement(SmoothlyPopup$1, [6,"smoothly-popup",{"visible":[1540],"direction":[1537],"cssVariables":[32]}]);
|
|
49074
49119
|
const SmoothlyQuiet = /*@__PURE__*/proxyCustomElement(SmoothlyQuiet$1, [6,"smoothly-quiet",{"color":[1]}]);
|
|
49075
49120
|
const SmoothlyRadio = /*@__PURE__*/proxyCustomElement(SmoothlyRadio$1, [6,"smoothly-radio",{"name":[1],"value":[1],"checked":[1540],"tabIndex":[2,"tab-index"]}]);
|
package/dist/esm/loader.js
CHANGED
|
@@ -10,7 +10,7 @@ const patchEsm = () => {
|
|
|
10
10
|
const defineCustomElements = (win, options) => {
|
|
11
11
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
12
12
|
return patchEsm().then(() => {
|
|
13
|
-
return bootstrapLazy([["smoothly-google-font",[[2,"smoothly-google-font",{"value":[1]}]]],["smoothly-radio-group",[[4,"smoothly-radio-group",{"orientation":[513]}]]],["smoothly-reorder",[[0,"smoothly-reorder"]]],["smoothly-trigger-sink",[[6,"smoothly-trigger-sink",{"context":[16],"destination":[1],"filter":[1]},[[0,"trigger","TriggerListener"]]]]],["smoothly-trigger-source",[[6,"smoothly-trigger-source",{"listen":[1]}]]],["smoothly-accordion_51",[[0,"smoothly-app-demo",{"baseUrl":[1,"base-url"]}],[0,"smoothly-input-demo"],[2,"smoothly-select-demo",null,[[0,"selectionChanged","handleSelectionChanged"]]],[0,"smoothly-display-demo"],[2,"smoothly-table-demo"],[4,"smoothly-app",{"color":[1]}],[0,"smoothly-dialog-demo"],[2,"smoothly-icon-demo"],[6,"smoothly-button",{"color":[513],"expand":[513],"fill":[513],"disabled":[516],"type":[513],"link":[1],"download":[4]}],[4,"smoothly-room",{"label":[1],"icon":[1],"path":[1],"to":[1]}],[2,"smoothly-input-date-range",{"value":[1025],"start":[1025],"end":[1025],"max":[1025],"min":[1025],"open":[1028],"showLabel":[516,"show-label"]},[[0,"startChanged","onStartChanged"],[0,"endChanged","onEndChanged"],[0,"dateRangeSet","onDateRangeSet"]]],[6,"smoothly-notifier",{"notices":[32]},[[0,"notice","onNotice"],[0,"remove","onRemove"]]],[1,"smoothly-picker",{"maxMenuHeight":[1,"max-menu-height"],"maxHeight":[1,"max-height"],"emptyMenuLabel":[1025,"empty-menu-label"],"multiple":[516],"optionStyle":[8,"option-style"],"options":[16],"labelSetting":[513,"label-setting"],"label":[513],"selections":[1040],"selectNoneName":[1025,"select-none-name"],"selectAllName":[1025,"select-all-name"],"selectionName":[1025,"selection-name"],"isOpen":[32]},[[0,"optionSelect","
|
|
13
|
+
return bootstrapLazy([["smoothly-google-font",[[2,"smoothly-google-font",{"value":[1]}]]],["smoothly-radio-group",[[4,"smoothly-radio-group",{"orientation":[513]}]]],["smoothly-reorder",[[0,"smoothly-reorder"]]],["smoothly-trigger-sink",[[6,"smoothly-trigger-sink",{"context":[16],"destination":[1],"filter":[1]},[[0,"trigger","TriggerListener"]]]]],["smoothly-trigger-source",[[6,"smoothly-trigger-source",{"listen":[1]}]]],["smoothly-accordion_51",[[0,"smoothly-app-demo",{"baseUrl":[1,"base-url"]}],[0,"smoothly-input-demo"],[2,"smoothly-select-demo",null,[[0,"selectionChanged","handleSelectionChanged"]]],[0,"smoothly-display-demo"],[2,"smoothly-table-demo"],[4,"smoothly-app",{"color":[1]}],[0,"smoothly-dialog-demo"],[2,"smoothly-icon-demo"],[6,"smoothly-button",{"color":[513],"expand":[513],"fill":[513],"disabled":[516],"type":[513],"link":[1],"download":[4]}],[4,"smoothly-room",{"label":[1],"icon":[1],"path":[1],"to":[1]}],[2,"smoothly-input-date-range",{"value":[1025],"start":[1025],"end":[1025],"max":[1025],"min":[1025],"open":[1028],"showLabel":[516,"show-label"]},[[0,"startChanged","onStartChanged"],[0,"endChanged","onEndChanged"],[0,"dateRangeSet","onDateRangeSet"]]],[6,"smoothly-notifier",{"notices":[32]},[[0,"notice","onNotice"],[0,"remove","onRemove"]]],[1,"smoothly-picker",{"maxMenuHeight":[1,"max-menu-height"],"maxHeight":[1,"max-height"],"emptyMenuLabel":[1025,"empty-menu-label"],"multiple":[516],"mutable":[4],"optionStyle":[8,"option-style"],"options":[16],"labelSetting":[513,"label-setting"],"label":[513],"selections":[1040],"selectNoneName":[1025,"select-none-name"],"selectAllName":[1025,"select-all-name"],"selectionName":[1025,"selection-name"],"newOptionLabel":[1025,"new-option-label"],"valueValidator":[16],"isOpen":[32],"empty":[32]},[[0,"optionSelect","optionSelectHandler"],[0,"optionAdd","optionAddHandler"],[0,"menuEmpty","emptyHandler"]]],[6,"smoothly-dialog",{"color":[513],"open":[1540],"closable":[516],"header":[513]},[[0,"trigger","TriggerListener"]]],[6,"smoothly-table-expandable-row",{"align":[1],"open":[1540]},[[0,"click","onClick"]]],[2,"smoothly-backtotop",{"opacity":[1],"bottom":[1],"right":[1],"visible":[32]}],[2,"smoothly-checkbox",{"selectAll":[4,"select-all"],"size":[1],"intermediate":[1540],"selected":[1540],"disabled":[1540],"t":[32]}],[6,"smoothly-submit",{"processing":[1540],"color":[513],"expand":[513],"fill":[513],"disabled":[516],"prevent":[4],"submit":[64]},[[0,"click","handleSubmit"]]],[6,"smoothly-table-expandable-cell",{"align":[1],"open":[1540]},[[0,"click","onClick"]]],[0,"smoothly-urlencoded",{"data":[1]}],[6,"smoothly-accordion",{"value":[1025]},[[0,"smoothlyOpen","handleOpenClose"],[0,"smoothlyClose","handleOpenClose"],[0,"smoothlyAccordionItemDidLoad","onAccordionItemDidLoad"],[0,"smoothlyAccordionItemDidUnload","onAccordionItemDidUnload"]]],[6,"smoothly-accordion-item",{"name":[1],"brand":[1],"open":[1540]}],[2,"smoothly-display",{"type":[1],"value":[8],"currency":[1],"country":[1]}],[2,"smoothly-display-amount",{"amount":[8],"currency":[1]}],[2,"smoothly-frame",{"url":[1],"name":[1],"origin":[1],"send":[64]}],[6,"smoothly-popup",{"visible":[1540],"direction":[1537],"cssVariables":[32]}],[6,"smoothly-quiet",{"color":[1]}],[6,"smoothly-radio",{"name":[1],"value":[1],"checked":[1540],"tabIndex":[2,"tab-index"]}],[6,"smoothly-select",{"identifier":[1],"background":[513],"value":[1025]}],[2,"smoothly-skeleton",{"widths":[16],"width":[1],"color":[1],"period":[2],"distance":[1],"align":[513]}],[2,"smoothly-svg",{"url":[513],"size":[513],"color":[1]}],[6,"smoothly-table",null,[[0,"expansionLoad","handleEvents"],[0,"expansionOpen","handleEvents"]]],[6,"smoothly-table-header",{"name":[1]}],[6,"smoothly-table-row",null,[[0,"expansionLoad","onExpansionLoad"],[0,"expansionOpen","onExpansionOpen"]]],[6,"smoothly-input-date",{"value":[1025],"open":[1028],"max":[1025],"min":[1025],"disabled":[1028]},[[0,"dateSet","dateSetHandler"]]],[1,"smoothly-menu-options",{"emptyMenuLabel":[1025,"empty-menu-label"],"newOptionLabel":[1,"new-option-label"],"maxMenuHeight":[1,"max-menu-height"],"order":[4],"optionStyle":[8,"option-style"],"options":[1040],"resetHighlightOnOptionsChange":[1028,"reset-highlight-on-options-change"],"mutable":[4],"filteredOptions":[32],"highlightIndex":[32],"keyword":[32],"moveHighlight":[64],"setHighlight":[64],"getHighlighted":[64],"filterOptions":[64]},[[0,"optionHover","optionHoverHandler"]]],[2,"smoothly-notification",{"notice":[16],"tick":[32]},[[0,"trigger","onTrigger"]]],[2,"smoothly-display-date-time",{"datetime":[1]}],[6,"smoothly-tab",{"label":[1],"open":[1540]},[[0,"click","onClick"]]],[6,"smoothly-tab-switch",{"selectedElement":[32]},[[0,"expansionOpen","openChanged"]]],[6,"smoothly-table-cell"],[0,"smoothly-tuple",{"tuple":[16]}],[1,"smoothly-option",{"aliases":[513],"dataHighlight":[1540,"data-highlight"],"name":[1537],"value":[1537],"divider":[1540],"new":[4]}],[2,"smoothly-spinner",{"active":[516],"size":[513]}],[2,"smoothly-calendar",{"month":[1025],"value":[1025],"start":[1025],"end":[1025],"max":[1025],"min":[1025],"doubleInput":[516,"double-input"],"firstSelected":[32]}],[6,"smoothly-input",{"name":[513],"value":[1032],"type":[513],"required":[1540],"minLength":[1026,"min-length"],"showLabel":[516,"show-label"],"maxLength":[1026,"max-length"],"autocomplete":[1028],"pattern":[1040],"placeholder":[1025],"disabled":[1028],"readonly":[1028],"currency":[513],"initialValue":[32],"getFormData":[64],"setKeepFocusOnReRender":[64],"setSelectionRange":[64]}],[2,"smoothly-input-month",{"value":[1025]}],[6,"smoothly-selector",{"opened":[32],"selectedElement":[32],"missing":[32],"filter":[32]},[[0,"click","onClick"],[0,"itemSelected","onItemSelected"],[0,"keydown","onKeyDown"]]],[6,"smoothly-item",{"value":[8],"selected":[1540],"filter":[64]},[[0,"click","onClick"]]],[6,"smoothly-trigger",{"color":[513],"expand":[513],"fill":[513],"disabled":[516],"type":[513],"name":[1],"value":[8]},[[0,"click","onClick"]]],[2,"smoothly-icon",{"color":[513],"fill":[513],"name":[1],"size":[513],"toolTip":[1,"tool-tip"],"document":[32]}]]]], options);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|