smoothly 0.2.11 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["smoothly-google-font.cjs",[[2,"smoothly-google-font",{"value":[1]}]]],["smoothly-radio-group.cjs",[[4,"smoothly-radio-group",{"orientation":[513]}]]],["smoothly-reorder.cjs",[[0,"smoothly-reorder"]]],["smoothly-svg.cjs",[[2,"smoothly-svg",{"url":[513],"size":[513],"color":[1]}]]],["smoothly-trigger-sink.cjs",[[6,"smoothly-trigger-sink",{"context":[16],"destination":[1],"filter":[1]},[[0,"trigger","TriggerListener"]]]]],["smoothly-trigger-source.cjs",[[6,"smoothly-trigger-source",{"listen":[1]}]]],["smoothly-accordion_50.cjs",[[0,"smoothly-app-demo",{"baseUrl":[1,"base-url"]}],[0,"smoothly-input-demo"],[2,"smoothly-select-demo",null,[[0,"selectionChanged","handleSelectionChanged"]]],[2,"smoothly-table-demo"],[0,"smoothly-display-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",{"disabled":[516],"readonly":[516],"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"]]],[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"]]],[6,"smoothly-table-expandable-row",{"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],"format":[16]}],[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]}],[6,"smoothly-table",null,[[0,"expansionLoad","handleEvents"],[0,"expansionOpen","handleEvents"]]],[6,"smoothly-table-cell"],[6,"smoothly-table-header",{"name":[1]}],[6,"smoothly-table-row",null,[[0,"expansionLoad","onExpansionLoad"],[0,"expansionOpen","onExpansionOpen"]]],[6,"smoothly-input-date",{"name":[513],"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]}],[2,"smoothly-spinner",{"active":[516],"size":[513]}],[6,"smoothly-tab",{"label":[1],"open":[1540]},[[0,"click","onClick"]]],[6,"smoothly-tab-switch",{"selectedElement":[32]},[[0,"expansionOpen","openChanged"]]],[0,"smoothly-tuple",{"tuple":[16]}],[1,"smoothly-option",{"aliases":[513],"dataHighlight":[1540,"data-highlight"],"name":[1537],"value":[1537],"divider":[1540],"new":[4]}],[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);
17
+ return index.bootstrapLazy([["smoothly-google-font.cjs",[[2,"smoothly-google-font",{"value":[1]}]]],["smoothly-radio-group.cjs",[[4,"smoothly-radio-group",{"orientation":[513]}]]],["smoothly-reorder.cjs",[[0,"smoothly-reorder"]]],["smoothly-svg.cjs",[[2,"smoothly-svg",{"url":[513],"size":[513],"color":[1]}]]],["smoothly-trigger-sink.cjs",[[6,"smoothly-trigger-sink",{"context":[16],"destination":[1],"filter":[1]},[[0,"trigger","TriggerListener"]]]]],["smoothly-trigger-source.cjs",[[6,"smoothly-trigger-source",{"listen":[1]}]]],["smoothly-accordion_50.cjs",[[0,"smoothly-app-demo",{"baseUrl":[1,"base-url"]}],[0,"smoothly-input-demo"],[2,"smoothly-select-demo",null,[[0,"selectionChanged","handleSelectionChanged"]]],[2,"smoothly-table-demo"],[0,"smoothly-display-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"]]],[1,"smoothly-picker",{"disabled":[516],"readonly":[516],"maxMenuHeight":[1,"max-menu-height"],"maxHeight":[1,"max-height"],"emptyMenuLabel":[1025,"empty-menu-label"],"multiple":[516],"mutable":[4],"optionStyle":[8,"option-style"],"options":[1040],"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,"optionUnselect","optionSelectHandler"],[0,"optionAdd","optionAddHandler"],[0,"menuEmpty","emptyHandler"]]],[6,"smoothly-notifier",{"notices":[32]},[[0,"notice","onNotice"],[0,"remove","onRemove"]]],[6,"smoothly-dialog",{"color":[513],"open":[1540],"closable":[516],"header":[513]},[[0,"trigger","TriggerListener"]]],[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"]]],[6,"smoothly-table-expandable-row",{"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],"format":[16]}],[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-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":[1025],"color":[1],"period":[2],"distance":[1],"align":[513]}],[6,"smoothly-table",null,[[0,"expansionLoad","handleEvents"],[0,"expansionOpen","handleEvents"]]],[6,"smoothly-table-cell"],[6,"smoothly-table-header",{"name":[1]}],[6,"smoothly-table-row",null,[[0,"expansionLoad","onExpansionLoad"],[0,"expansionOpen","onExpansionOpen"]]],[6,"smoothly-input-date",{"name":[513],"value":[1025],"open":[1028],"max":[1025],"min":[1025],"disabled":[1028]},[[0,"dateSet","dateSetHandler"]]],[1,"smoothly-menu-options",{"toggle":[4],"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]}],[2,"smoothly-spinner",{"active":[516],"size":[513]}],[6,"smoothly-tab",{"label":[1],"open":[1540]},[[0,"click","onClick"]]],[6,"smoothly-tab-switch",{"selectedElement":[32]},[[0,"expansionOpen","openChanged"]]],[0,"smoothly-tuple",{"tuple":[16]}],[1,"smoothly-option",{"aliases":[513],"dataHighlight":[1540,"data-highlight"],"name":[1537],"value":[1537],"divider":[1540],"checkbox":[4],"new":[4],"toggle":[4],"checked":[1028]}],[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-quiet",{"color":[1]}],[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);
18
18
  });
19
19
  };
20
20
 
@@ -125,16 +125,16 @@ const SmoothlyAppDemo = class {
125
125
  index$1.redirect("https://google.com");
126
126
  } }, "External")), index.h("smoothly-room", { path: /^\/routing\/\w+\/?/, label: "No effect" }, index.h("h2", null, "Regex routing")), index.h("smoothly-room", { path: "old", label: "Old", to: "select" }), index.h("span", { slot: "header", style: { width: "100%", maxWidth: "500px" } }, index.h("smoothly-picker", { label: "All Animals Selected", style: { minWidth: "100px" }, labelSetting: "hide", "empty-menu-label": "Sorry, we're out of options.", "max-height": "58px", multiple: true, "select-none-name": "Select All", options: [
127
127
  { name: "Big Dog", value: "dog", aliases: ["WOFF"] },
128
- { name: "Cat Stevens", value: "cat", aliases: ["moew"], right: "🐈" },
129
- { name: "Noble Pig", value: "pig", right: "🐷" },
130
- { name: "Turtle Wax", value: "turtle", right: "" },
131
- { name: "Spider Man", value: "spider", right: "" },
132
- { name: "Phoenix Order Long Wooord", value: "phoenix", right: "" },
133
- { name: "Horse Back", value: "horse", right: "" },
134
- { name: "Unicorn Horn", value: "unicorn", right: "" },
135
- { name: "Talking Parrot Parrot", value: "parrot", right: "" },
136
- { name: "Hidden Dragon", value: "dragon", right: "" },
137
- { name: "Scary Kraken", value: "kraken", right: "" },
128
+ { name: "Cat Stevens", value: "cat", aliases: ["moew"], hint: "moew 🐈" },
129
+ { name: "Noble Pig", value: "pig", hint: "🐷" },
130
+ { name: "Turtle Wax", value: "turtle" },
131
+ { name: "Spider Man", value: "spider" },
132
+ { name: "Phoenix Order Long Wooord", value: "phoenix" },
133
+ { name: "Horse Back", value: "horse" },
134
+ { name: "Unicorn Horn", value: "unicorn" },
135
+ { name: "Talking Parrot Parrot", value: "parrot" },
136
+ { name: "Hidden Dragon", value: "dragon" },
137
+ { name: "Scary Kraken", value: "kraken" },
138
138
  ] })), index.h("smoothly-trigger", { slot: "header", type: "link", name: "logout" }, index.h("smoothly-icon", { toolTip: "Log out", name: "log-out", size: "medium" }))));
139
139
  }
140
140
  };
@@ -33673,8 +33673,10 @@ const SmoothlyMenuOptions = class {
33673
33673
  constructor(hostRef) {
33674
33674
  index.registerInstance(this, hostRef);
33675
33675
  this.menuEmpty = index.createEvent(this, "menuEmpty", 7);
33676
+ this.optionElements = [];
33676
33677
  this.filteredOptions = [];
33677
33678
  this.highlightIndex = 0;
33679
+ this.toggle = false;
33678
33680
  this.emptyMenuLabel = "No Options";
33679
33681
  this.newOptionLabel = "Add:";
33680
33682
  this.order = false;
@@ -33682,7 +33684,7 @@ const SmoothlyMenuOptions = class {
33682
33684
  this.resetHighlightOnOptionsChange = true;
33683
33685
  this.mutable = false;
33684
33686
  }
33685
- optionsChangeHandler(newOptions) {
33687
+ optionsChangeHandler() {
33686
33688
  this.highlightIndex = this.resetHighlightOnOptionsChange ? 0 : this.highlightIndex;
33687
33689
  }
33688
33690
  optionHoverHandler(event) {
@@ -33764,7 +33766,10 @@ const SmoothlyMenuOptions = class {
33764
33766
  }
33765
33767
  }
33766
33768
  render() {
33767
- return (index.h(index.Host, { style: { "--max-menu-height": this.maxMenuHeight } }, this.filteredOptions.length > 0 ? (this.filteredOptions.map((option, index$1) => (index.h("smoothly-option", { style: this.optionStyle, ref: el => index$1 == 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$1 }, option.left ? index.h("div", { slot: "left" }, option.left) : undefined, option.right ? index.h("div", { slot: "right" }, option.right) : undefined)))) : this.mutable ? (index.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 }, index.h("div", { slot: "left" }, index.h("smoothly-icon", { name: "square-outline", size: "small" }), " ", this.newOptionLabel))) : (index.h("div", null, this.emptyMenuLabel))));
33769
+ return (index.h(index.Host, { style: { "--max-menu-height": this.maxMenuHeight } }, this.filteredOptions.length > 0 ? (this.filteredOptions.map((option, index$1) => (index.h("smoothly-option", { style: this.optionStyle, toggle: this.toggle, ref: el => {
33770
+ index$1 == 0 && (this.firstOptionsElement = el !== null && el !== void 0 ? el : this.firstOptionsElement);
33771
+ el && (this.optionElements[index$1] = el);
33772
+ }, checked: option.checked, value: option.value, name: option.name, divider: option.divider, "data-highlight": this.highlightIndex == index$1 }, option.hint ? index.h("div", { slot: "hint" }, option.hint) : undefined)))) : this.mutable ? (index.h("smoothly-option", { style: this.optionStyle, value: this.keyword, name: this.keyword, "data-highlight": 0, new: true }, index.h("div", { slot: "left" }, index.h("smoothly-icon", { name: "square-outline", size: "small" }), " ", this.newOptionLabel))) : (index.h("div", null, this.emptyMenuLabel))));
33768
33773
  }
33769
33774
  get element() { return index.getElement(this); }
33770
33775
  static get watchers() { return {
@@ -33855,30 +33860,37 @@ const Notifier = class {
33855
33860
  };
33856
33861
  Notifier.style = styleCss$l;
33857
33862
 
33858
- const styleCss$k = ":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}";
33863
+ const styleCss$k = ":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.name{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=hint]){display:flex;align-items:center;gap:1ch;font-style:italic;white-space:nowrap}";
33859
33864
 
33860
33865
  const SmoothlyOption = class {
33861
33866
  constructor(hostRef) {
33862
33867
  index.registerInstance(this, hostRef);
33863
33868
  this.optionHover = index.createEvent(this, "optionHover", 7);
33864
33869
  this.optionSelect = index.createEvent(this, "optionSelect", 7);
33870
+ this.optionUnselect = index.createEvent(this, "optionUnselect", 7);
33865
33871
  this.optionAdd = index.createEvent(this, "optionAdd", 7);
33866
33872
  this.dataHighlight = false;
33867
33873
  this.divider = false;
33874
+ this.toggle = false;
33875
+ this.checked = false;
33868
33876
  }
33869
33877
  onHover(event) {
33870
33878
  this.optionHover.emit({ name: this.name, value: this.value });
33871
33879
  }
33872
33880
  onSelect(event) {
33873
- if (this.value)
33881
+ if (this.value) {
33874
33882
  this.new
33875
33883
  ? this.optionAdd.emit({ name: this.name, value: this.value })
33876
- : this.optionSelect.emit({ name: this.name, value: this.value });
33884
+ : !this.toggle || (this.toggle && !this.checked)
33885
+ ? this.optionSelect.emit({ name: this.name, value: this.value })
33886
+ : this.optionUnselect.emit({ name: this.name, value: this.value });
33887
+ this.toggle && (this.checked = !this.checked);
33888
+ }
33877
33889
  else
33878
33890
  throw `smoothly-option ${this.element.innerHTML} lacks value-property and can therefore not be selected`;
33879
33891
  }
33880
33892
  render() {
33881
- return (index.h(index.Host, { onMouseDown: (e) => this.onSelect(e), onMouseOver: (e) => this.onHover(e) }, index.h("slot", { name: "left" }), index.h("div", { class: "middle" }, this.name), index.h("slot", { name: "right" })));
33893
+ return (index.h(index.Host, { onMouseDown: (e) => this.onSelect(e), onMouseOver: (e) => this.onHover(e) }, this.toggle && index.h("smoothly-icon", { name: this.checked ? "checkbox" : "square-outline" }), index.h("div", { class: "name" }, this.name), index.h("smoothly-quiet", null, index.h("slot", { name: "hint" }))));
33882
33894
  }
33883
33895
  get element() { return index.getElement(this); }
33884
33896
  };
@@ -33894,6 +33906,7 @@ const SmoothlyPicker = class {
33894
33906
  this.keepFocusOnReRender = false;
33895
33907
  this.disabled = false;
33896
33908
  this.readonly = false;
33909
+ this.maxMenuHeight = "inherit";
33897
33910
  this.emptyMenuLabel = "No Options";
33898
33911
  this.multiple = false;
33899
33912
  this.mutable = false;
@@ -34030,17 +34043,14 @@ const SmoothlyPicker = class {
34030
34043
  this.isOpen = false;
34031
34044
  this.filterOptions();
34032
34045
  }
34033
- getCheckHtml(checked) {
34034
- return checked ? (index.h("smoothly-icon", { name: "checkbox", size: "small" })) : (index.h("smoothly-icon", { name: "square-outline", size: "small" }));
34035
- }
34036
34046
  render() {
34037
- var _a, _b, _c, _d;
34047
+ var _a, _b, _c;
34038
34048
  const cssVariables = {
34039
34049
  "--max-height": (_a = this.maxHeight) !== null && _a !== void 0 ? _a : "inherit",
34040
34050
  "--label-display": this.labelSetting == "hide" ? "none" : "absolute",
34041
34051
  };
34042
34052
  (_b = this.options) === null || _b === void 0 ? void 0 : _b.forEach(o => {
34043
- o.left = this.getCheckHtml(this.selections.map(s => s.value).includes(o.value));
34053
+ o.checked = this.selections.map(s => s.value).includes(o.value);
34044
34054
  });
34045
34055
  const options = [
34046
34056
  ...(this.multiple
@@ -34048,16 +34058,16 @@ const SmoothlyPicker = class {
34048
34058
  {
34049
34059
  value: "select-none",
34050
34060
  name: this.selections.length == this.options.length ? this.selectNoneName : this.selectAllName,
34051
- left: this.getCheckHtml(this.selections.length == ((_c = this.options) === null || _c === void 0 ? void 0 : _c.length)),
34061
+ checked: this.selections.length == this.options.length,
34052
34062
  divider: true,
34053
34063
  },
34054
34064
  ]
34055
34065
  : []),
34056
- ...((_d = this.options) !== null && _d !== void 0 ? _d : []),
34066
+ ...((_c = this.options) !== null && _c !== void 0 ? _c : []),
34057
34067
  ];
34058
34068
  return (index.h(index.Host, { style: cssVariables, "has-selection": this.selections.length > 0, "is-open": this.isOpen ? "" : undefined, onMouseDown: (e) => e.preventDefault(), onClick: () => this.onClick() }, index.h("div", null, index.h("smoothly-icon", { part: "search", class: "search", name: "search-outline", size: "tiny" }), index.h("label", { part: "label-element" }, this.label), index.h("input", { part: "input", disabled: this.disabled, readonly: this.readonly, type: "text", ref: (el) => (this.inputElement = el ? el : this.inputElement), onFocus: () => this.highlightDefault(), onBlur: () => this.onBlur(), placeholder: this.selections.length > 3
34059
34069
  ? this.selections.length.toString() + " " + this.selectionName
34060
- : this.selections.map(selection => selection.name).join(", "), onKeyDown: e => this.onKeyDown(e), onInput: (e) => this.onInput(e) }), index.h("smoothly-icon", { part: "chevron", class: "down", name: "chevron-down", size: "tiny" }), index.h("smoothly-icon", { part: "chevron", class: "up", name: "chevron-up", size: "tiny" })), index.h("smoothly-menu-options", { part: "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 })));
34070
+ : this.selections.map(selection => selection.name).join(", "), onKeyDown: e => this.onKeyDown(e), onInput: (e) => this.onInput(e) }), index.h("smoothly-icon", { part: "chevron", class: "down", name: "chevron-down", size: "tiny" }), index.h("smoothly-icon", { part: "chevron", class: "up", name: "chevron-up", size: "tiny" })), index.h("smoothly-menu-options", { part: "menu-options", style: { width: "100%" }, toggle: true, 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 })));
34061
34071
  }
34062
34072
  get element() { return index.getElement(this); }
34063
34073
  static get watchers() { return {
@@ -34195,11 +34205,11 @@ const SmoothlySelectDemo = class {
34195
34205
  } }),
34196
34206
  index.h("smoothly-selector", null, index.h("smoothly-item", { value: "1" }, "January"), index.h("smoothly-item", { value: "2" }, "February"), index.h("smoothly-item", { value: "3" }, "March"), index.h("smoothly-item", { value: "4" }, "April"), index.h("smoothly-item", { value: "5" }, "May"), index.h("smoothly-item", { value: "6" }, "June"), index.h("smoothly-item", { value: "7" }, "July"), index.h("smoothly-item", { value: "8" }, "August"), index.h("smoothly-item", { value: "9" }, "September"), index.h("smoothly-item", { value: "10" }, "October"), index.h("smoothly-item", { value: "11" }, "November"), index.h("smoothly-item", { value: "12" }, "December")),
34197
34207
  index.h("button", { onClick: () => this.alertf() }, "press here"),
34198
- index.h("smoothly-picker", { label: "Filter", "empty-menu-label": "Sorry, we're out of options.", "max-height": "58px", multiple: true, options: [
34208
+ index.h("smoothly-picker", { label: "Filter", "empty-menu-label": "Sorry, we're out of options.", "max-height": "58px", maxMenuHeight: "20rem", multiple: true, options: [
34199
34209
  { name: "Big Dog", value: "dog", aliases: ["WOFF"] },
34200
- { name: "Cat Stevens", value: "cat", aliases: ["moew"] },
34210
+ { name: "Cat Stevens", value: "cat", aliases: ["moew"], hint: "moew" },
34201
34211
  { name: "Noble Pig", value: "pig" },
34202
- { name: "Turtle Wax", value: "turtle" },
34212
+ { name: "Turtle Wax", value: "turtle", hint: "slow" },
34203
34213
  { name: "Spider Man", value: "spider" },
34204
34214
  { name: "Phoenix Order Long Wooord", value: "phoenix" },
34205
34215
  { name: "Horse Back", value: "horse" },
@@ -34231,7 +34241,7 @@ const SmoothlySelectDemo = class {
34231
34241
  ], valueValidator: (email) => email.match(/^\w+@\w+/) ? [true, undefined] : [false, index$1.Notice.failed("Incorrectly formatted email")] }),
34232
34242
  index.h("br", null),
34233
34243
  index.h("smoothly-picker", { label: "Single select", multiple: false, "max-menu-height": "200px", options: [
34234
- { name: "Dog", value: "dog", aliases: ["WOFF"], right: "Woof 🐶" },
34244
+ { name: "Dog", value: "dog", aliases: ["WOFF"], hint: "Woof 🐶" },
34235
34245
  { name: "Cat", value: "cat", aliases: ["moew"] },
34236
34246
  { name: "Pig", value: "pig" },
34237
34247
  { name: "Turtle", value: "turtle" },
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["smoothly-google-font.cjs",[[2,"smoothly-google-font",{"value":[1]}]]],["smoothly-radio-group.cjs",[[4,"smoothly-radio-group",{"orientation":[513]}]]],["smoothly-reorder.cjs",[[0,"smoothly-reorder"]]],["smoothly-svg.cjs",[[2,"smoothly-svg",{"url":[513],"size":[513],"color":[1]}]]],["smoothly-trigger-sink.cjs",[[6,"smoothly-trigger-sink",{"context":[16],"destination":[1],"filter":[1]},[[0,"trigger","TriggerListener"]]]]],["smoothly-trigger-source.cjs",[[6,"smoothly-trigger-source",{"listen":[1]}]]],["smoothly-accordion_50.cjs",[[0,"smoothly-app-demo",{"baseUrl":[1,"base-url"]}],[0,"smoothly-input-demo"],[2,"smoothly-select-demo",null,[[0,"selectionChanged","handleSelectionChanged"]]],[2,"smoothly-table-demo"],[0,"smoothly-display-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",{"disabled":[516],"readonly":[516],"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"]]],[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"]]],[6,"smoothly-table-expandable-row",{"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],"format":[16]}],[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]}],[6,"smoothly-table",null,[[0,"expansionLoad","handleEvents"],[0,"expansionOpen","handleEvents"]]],[6,"smoothly-table-cell"],[6,"smoothly-table-header",{"name":[1]}],[6,"smoothly-table-row",null,[[0,"expansionLoad","onExpansionLoad"],[0,"expansionOpen","onExpansionOpen"]]],[6,"smoothly-input-date",{"name":[513],"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]}],[2,"smoothly-spinner",{"active":[516],"size":[513]}],[6,"smoothly-tab",{"label":[1],"open":[1540]},[[0,"click","onClick"]]],[6,"smoothly-tab-switch",{"selectedElement":[32]},[[0,"expansionOpen","openChanged"]]],[0,"smoothly-tuple",{"tuple":[16]}],[1,"smoothly-option",{"aliases":[513],"dataHighlight":[1540,"data-highlight"],"name":[1537],"value":[1537],"divider":[1540],"new":[4]}],[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);
18
+ return index.bootstrapLazy([["smoothly-google-font.cjs",[[2,"smoothly-google-font",{"value":[1]}]]],["smoothly-radio-group.cjs",[[4,"smoothly-radio-group",{"orientation":[513]}]]],["smoothly-reorder.cjs",[[0,"smoothly-reorder"]]],["smoothly-svg.cjs",[[2,"smoothly-svg",{"url":[513],"size":[513],"color":[1]}]]],["smoothly-trigger-sink.cjs",[[6,"smoothly-trigger-sink",{"context":[16],"destination":[1],"filter":[1]},[[0,"trigger","TriggerListener"]]]]],["smoothly-trigger-source.cjs",[[6,"smoothly-trigger-source",{"listen":[1]}]]],["smoothly-accordion_50.cjs",[[0,"smoothly-app-demo",{"baseUrl":[1,"base-url"]}],[0,"smoothly-input-demo"],[2,"smoothly-select-demo",null,[[0,"selectionChanged","handleSelectionChanged"]]],[2,"smoothly-table-demo"],[0,"smoothly-display-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"]]],[1,"smoothly-picker",{"disabled":[516],"readonly":[516],"maxMenuHeight":[1,"max-menu-height"],"maxHeight":[1,"max-height"],"emptyMenuLabel":[1025,"empty-menu-label"],"multiple":[516],"mutable":[4],"optionStyle":[8,"option-style"],"options":[1040],"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,"optionUnselect","optionSelectHandler"],[0,"optionAdd","optionAddHandler"],[0,"menuEmpty","emptyHandler"]]],[6,"smoothly-notifier",{"notices":[32]},[[0,"notice","onNotice"],[0,"remove","onRemove"]]],[6,"smoothly-dialog",{"color":[513],"open":[1540],"closable":[516],"header":[513]},[[0,"trigger","TriggerListener"]]],[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"]]],[6,"smoothly-table-expandable-row",{"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],"format":[16]}],[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-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":[1025],"color":[1],"period":[2],"distance":[1],"align":[513]}],[6,"smoothly-table",null,[[0,"expansionLoad","handleEvents"],[0,"expansionOpen","handleEvents"]]],[6,"smoothly-table-cell"],[6,"smoothly-table-header",{"name":[1]}],[6,"smoothly-table-row",null,[[0,"expansionLoad","onExpansionLoad"],[0,"expansionOpen","onExpansionOpen"]]],[6,"smoothly-input-date",{"name":[513],"value":[1025],"open":[1028],"max":[1025],"min":[1025],"disabled":[1028]},[[0,"dateSet","dateSetHandler"]]],[1,"smoothly-menu-options",{"toggle":[4],"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]}],[2,"smoothly-spinner",{"active":[516],"size":[513]}],[6,"smoothly-tab",{"label":[1],"open":[1540]},[[0,"click","onClick"]]],[6,"smoothly-tab-switch",{"selectedElement":[32]},[[0,"expansionOpen","openChanged"]]],[0,"smoothly-tuple",{"tuple":[16]}],[1,"smoothly-option",{"aliases":[513],"dataHighlight":[1540,"data-highlight"],"name":[1537],"value":[1537],"divider":[1540],"checkbox":[4],"new":[4],"toggle":[4],"checked":[1028]}],[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-quiet",{"color":[1]}],[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);
19
19
  });
@@ -38,16 +38,16 @@ export class SmoothlyAppDemo {
38
38
  h("span", { slot: "header", style: { width: "100%", maxWidth: "500px" } },
39
39
  h("smoothly-picker", { label: "All Animals Selected", style: { minWidth: "100px" }, labelSetting: "hide", "empty-menu-label": "Sorry, we're out of options.", "max-height": "58px", multiple: true, "select-none-name": "Select All", options: [
40
40
  { name: "Big Dog", value: "dog", aliases: ["WOFF"] },
41
- { name: "Cat Stevens", value: "cat", aliases: ["moew"], right: "🐈" },
42
- { name: "Noble Pig", value: "pig", right: "🐷" },
43
- { name: "Turtle Wax", value: "turtle", right: "" },
44
- { name: "Spider Man", value: "spider", right: "" },
45
- { name: "Phoenix Order Long Wooord", value: "phoenix", right: "" },
46
- { name: "Horse Back", value: "horse", right: "" },
47
- { name: "Unicorn Horn", value: "unicorn", right: "" },
48
- { name: "Talking Parrot Parrot", value: "parrot", right: "" },
49
- { name: "Hidden Dragon", value: "dragon", right: "" },
50
- { name: "Scary Kraken", value: "kraken", right: "" },
41
+ { name: "Cat Stevens", value: "cat", aliases: ["moew"], hint: "moew 🐈" },
42
+ { name: "Noble Pig", value: "pig", hint: "🐷" },
43
+ { name: "Turtle Wax", value: "turtle" },
44
+ { name: "Spider Man", value: "spider" },
45
+ { name: "Phoenix Order Long Wooord", value: "phoenix" },
46
+ { name: "Horse Back", value: "horse" },
47
+ { name: "Unicorn Horn", value: "unicorn" },
48
+ { name: "Talking Parrot Parrot", value: "parrot" },
49
+ { name: "Hidden Dragon", value: "dragon" },
50
+ { name: "Scary Kraken", value: "kraken" },
51
51
  ] })),
52
52
  h("smoothly-trigger", { slot: "header", type: "link", name: "logout" },
53
53
  h("smoothly-icon", { toolTip: "Log out", name: "log-out", size: "medium" }))));
@@ -1,8 +1,10 @@
1
1
  import { Component, Element, Event, h, Host, Listen, Method, Prop, State, Watch } from "@stencil/core";
2
2
  export class SmoothlyMenuOptions {
3
3
  constructor() {
4
+ this.optionElements = [];
4
5
  this.filteredOptions = [];
5
6
  this.highlightIndex = 0;
7
+ this.toggle = false;
6
8
  this.emptyMenuLabel = "No Options";
7
9
  this.newOptionLabel = "Add:";
8
10
  this.order = false;
@@ -10,7 +12,7 @@ export class SmoothlyMenuOptions {
10
12
  this.resetHighlightOnOptionsChange = true;
11
13
  this.mutable = false;
12
14
  }
13
- optionsChangeHandler(newOptions) {
15
+ optionsChangeHandler() {
14
16
  this.highlightIndex = this.resetHighlightOnOptionsChange ? 0 : this.highlightIndex;
15
17
  }
16
18
  optionHoverHandler(event) {
@@ -92,9 +94,10 @@ export class SmoothlyMenuOptions {
92
94
  }
93
95
  }
94
96
  render() {
95
- 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 },
96
- option.left ? h("div", { slot: "left" }, option.left) : undefined,
97
- 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 },
97
+ return (h(Host, { style: { "--max-menu-height": this.maxMenuHeight } }, this.filteredOptions.length > 0 ? (this.filteredOptions.map((option, index) => (h("smoothly-option", { style: this.optionStyle, toggle: this.toggle, ref: el => {
98
+ index == 0 && (this.firstOptionsElement = el !== null && el !== void 0 ? el : this.firstOptionsElement);
99
+ el && (this.optionElements[index] = el);
100
+ }, checked: option.checked, value: option.value, name: option.name, divider: option.divider, "data-highlight": this.highlightIndex == index }, option.hint ? h("div", { slot: "hint" }, option.hint) : undefined)))) : this.mutable ? (h("smoothly-option", { style: this.optionStyle, value: this.keyword, name: this.keyword, "data-highlight": 0, new: true },
98
101
  h("div", { slot: "left" },
99
102
  h("smoothly-icon", { name: "square-outline", size: "small" }),
100
103
  " ",
@@ -109,6 +112,24 @@ export class SmoothlyMenuOptions {
109
112
  "$": ["style.css"]
110
113
  }; }
111
114
  static get properties() { return {
115
+ "toggle": {
116
+ "type": "boolean",
117
+ "mutable": false,
118
+ "complexType": {
119
+ "original": "boolean",
120
+ "resolved": "boolean",
121
+ "references": {}
122
+ },
123
+ "required": false,
124
+ "optional": false,
125
+ "docs": {
126
+ "tags": [],
127
+ "text": ""
128
+ },
129
+ "attribute": "toggle",
130
+ "reflect": false,
131
+ "defaultValue": "false"
132
+ },
112
133
  "emptyMenuLabel": {
113
134
  "type": "string",
114
135
  "mutable": true,
@@ -201,10 +222,10 @@ export class SmoothlyMenuOptions {
201
222
  "type": "unknown",
202
223
  "mutable": true,
203
224
  "complexType": {
204
- "original": "OptionType[]",
205
- "resolved": "OptionType[]",
225
+ "original": "Option[]",
226
+ "resolved": "Option[]",
206
227
  "references": {
207
- "OptionType": {
228
+ "Option": {
208
229
  "location": "import",
209
230
  "path": "../../model"
210
231
  }
@@ -320,18 +341,18 @@ export class SmoothlyMenuOptions {
320
341
  },
321
342
  "getHighlighted": {
322
343
  "complexType": {
323
- "signature": "() => Promise<OptionType | undefined>",
344
+ "signature": "() => Promise<Option | undefined>",
324
345
  "parameters": [],
325
346
  "references": {
326
347
  "Promise": {
327
348
  "location": "global"
328
349
  },
329
- "OptionType": {
350
+ "Option": {
330
351
  "location": "import",
331
352
  "path": "../../model"
332
353
  }
333
354
  },
334
- "return": "Promise<OptionType | undefined>"
355
+ "return": "Promise<Option | undefined>"
335
356
  },
336
357
  "docs": {
337
358
  "text": "",
@@ -3,28 +3,35 @@ export class SmoothlyOption {
3
3
  constructor() {
4
4
  this.dataHighlight = false;
5
5
  this.divider = false;
6
+ this.toggle = false;
7
+ this.checked = false;
6
8
  }
7
9
  onHover(event) {
8
10
  this.optionHover.emit({ name: this.name, value: this.value });
9
11
  }
10
12
  onSelect(event) {
11
- if (this.value)
13
+ if (this.value) {
12
14
  this.new
13
15
  ? this.optionAdd.emit({ name: this.name, value: this.value })
14
- : this.optionSelect.emit({ name: this.name, value: this.value });
16
+ : !this.toggle || (this.toggle && !this.checked)
17
+ ? this.optionSelect.emit({ name: this.name, value: this.value })
18
+ : this.optionUnselect.emit({ name: this.name, value: this.value });
19
+ this.toggle && (this.checked = !this.checked);
20
+ }
15
21
  else
16
22
  throw `smoothly-option ${this.element.innerHTML} lacks value-property and can therefore not be selected`;
17
23
  }
18
24
  render() {
19
25
  return (h(Host, { onMouseDown: (e) => this.onSelect(e), onMouseOver: (e) => this.onHover(e) },
20
- h("slot", { name: "left" }),
21
- h("div", { class: "middle" }, this.name),
22
- h("slot", { name: "right" })));
26
+ this.toggle && h("smoothly-icon", { name: this.checked ? "checkbox" : "square-outline" }),
27
+ h("div", { class: "name" }, this.name),
28
+ h("smoothly-quiet", null,
29
+ h("slot", { name: "hint" }))));
23
30
  }
24
31
  static get is() { return "smoothly-option"; }
25
32
  static get encapsulation() { return "shadow"; }
26
33
  static get originalStyleUrls() { return {
27
- "$": ["style.scss"]
34
+ "$": ["style.css"]
28
35
  }; }
29
36
  static get styleUrls() { return {
30
37
  "$": ["style.css"]
@@ -117,6 +124,23 @@ export class SmoothlyOption {
117
124
  "reflect": true,
118
125
  "defaultValue": "false"
119
126
  },
127
+ "checkbox": {
128
+ "type": "boolean",
129
+ "mutable": false,
130
+ "complexType": {
131
+ "original": "boolean",
132
+ "resolved": "boolean",
133
+ "references": {}
134
+ },
135
+ "required": false,
136
+ "optional": false,
137
+ "docs": {
138
+ "tags": [],
139
+ "text": ""
140
+ },
141
+ "attribute": "checkbox",
142
+ "reflect": false
143
+ },
120
144
  "new": {
121
145
  "type": "boolean",
122
146
  "mutable": false,
@@ -133,6 +157,42 @@ export class SmoothlyOption {
133
157
  },
134
158
  "attribute": "new",
135
159
  "reflect": false
160
+ },
161
+ "toggle": {
162
+ "type": "boolean",
163
+ "mutable": false,
164
+ "complexType": {
165
+ "original": "boolean",
166
+ "resolved": "boolean",
167
+ "references": {}
168
+ },
169
+ "required": false,
170
+ "optional": false,
171
+ "docs": {
172
+ "tags": [],
173
+ "text": ""
174
+ },
175
+ "attribute": "toggle",
176
+ "reflect": false,
177
+ "defaultValue": "false"
178
+ },
179
+ "checked": {
180
+ "type": "boolean",
181
+ "mutable": true,
182
+ "complexType": {
183
+ "original": "boolean",
184
+ "resolved": "boolean",
185
+ "references": {}
186
+ },
187
+ "required": false,
188
+ "optional": false,
189
+ "docs": {
190
+ "tags": [],
191
+ "text": ""
192
+ },
193
+ "attribute": "checked",
194
+ "reflect": false,
195
+ "defaultValue": "false"
136
196
  }
137
197
  }; }
138
198
  static get events() { return [{
@@ -165,6 +225,21 @@ export class SmoothlyOption {
165
225
  "resolved": "{ value: any; name: string; }",
166
226
  "references": {}
167
227
  }
228
+ }, {
229
+ "method": "optionUnselect",
230
+ "name": "optionUnselect",
231
+ "bubbles": true,
232
+ "cancelable": true,
233
+ "composed": true,
234
+ "docs": {
235
+ "tags": [],
236
+ "text": ""
237
+ },
238
+ "complexType": {
239
+ "original": "{ value: any; name: string }",
240
+ "resolved": "{ value: any; name: string; }",
241
+ "references": {}
242
+ }
168
243
  }, {
169
244
  "method": "optionAdd",
170
245
  "name": "optionAdd",
@@ -1,46 +1,42 @@
1
1
  :host {
2
- display: flex;
3
- flex-direction: row;
4
- align-items: center;
5
- justify-content: flex-start;
6
- padding: 0.7em 1em;
7
- margin-left: 1px;
8
- margin-right: 1px;
9
- background-color: transparent;
10
- position: relative;
2
+ display: flex;
3
+ flex-direction: row;
4
+ align-items: center;
5
+ justify-content: flex-start;
6
+ padding: 0.7em 1em;
7
+ margin-left: 1px;
8
+ margin-right: 1px;
9
+ background-color: transparent;
10
+ position: relative;
11
11
  }
12
-
13
12
  :host([data-highlight]) {
14
- background-color: rgb(var(--smoothly-default-shade));
13
+ background-color: rgb(var(--smoothly-default-shade));
15
14
  }
16
-
17
- :host > div.middle {
18
- padding-left: 0.5em;
19
- flex-shrink: 1;
20
- width: 100%;
15
+ :host > div.name {
16
+ padding-left: 0.5em;
17
+ flex-shrink: 1;
18
+ width: 100%;
21
19
  }
22
-
23
20
  :host([divider]) {
24
- margin-bottom: 0.5em;
21
+ margin-bottom: 0.5em;
25
22
  }
26
-
27
23
  ::slotted([slot=right]) {
28
- font-style: italic;
29
- white-space: nowrap;
24
+ font-style: italic;
25
+ white-space: nowrap;
30
26
  }
31
-
32
27
  :host([divider])::after {
33
- position: absolute;
34
- height: 1px;
35
- width: 100%;
36
- left: 0;
37
- bottom: -0.25em;
38
- content: "";
39
- background-color: rgba(var(--smoothly-dark-color));
28
+ position: absolute;
29
+ height: 1px;
30
+ width: 100%;
31
+ left: 0;
32
+ bottom: -0.25em;
33
+ content: "";
34
+ background-color: rgba(var(--smoothly-dark-color));
35
+ }
36
+ ::slotted([slot=hint]) {
37
+ display: flex;
38
+ align-items: center;
39
+ gap: 1ch;
40
+ font-style: italic;
41
+ white-space: nowrap;
40
42
  }
41
-
42
- ::slotted([slot=left]) {
43
- display: flex;
44
- align-items: center;
45
- gap: 1ch;
46
- }