smoothly 0.2.11 → 0.3.1
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_50.cjs.entry.js +41 -30
- package/dist/cjs/smoothly.cjs.js +1 -1
- package/dist/collection/components/app-demo/index.js +10 -10
- package/dist/collection/components/display-amount/index.js +22 -1
- package/dist/collection/components/display-demo/index.js +9 -0
- package/dist/collection/components/menu-options/index.js +31 -10
- package/dist/collection/components/option/index.js +81 -6
- package/dist/collection/components/option/style.css +31 -35
- package/dist/collection/components/picker/index.js +26 -21
- package/dist/collection/components/select-demo/index.js +4 -4
- package/dist/collection/components/skeleton/index.js +1 -1
- package/dist/collection/model/{OptionType.js → Option.js} +0 -0
- package/dist/custom-elements/index.js +46 -35
- package/dist/esm/loader.js +1 -1
- package/dist/esm/smoothly-accordion_50.entry.js +41 -30
- package/dist/esm/smoothly.js +1 -1
- package/dist/smoothly/p-b92b1eb7.entry.js +1 -0
- package/dist/smoothly/smoothly.esm.js +1 -1
- package/dist/types/components/display-amount/index.d.ts +1 -0
- package/dist/types/components/menu-options/index.d.ts +10 -6
- package/dist/types/components/option/index.d.ts +7 -0
- package/dist/types/components/picker/index.d.ts +11 -10
- package/dist/types/components.d.ts +22 -11
- package/dist/types/index.d.ts +1 -1
- package/dist/types/model/Option.d.ts +7 -0
- package/dist/types/model/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/smoothly/p-956089d5.entry.js +0 -1
- package/dist/types/model/OptionType.d.ts +0 -8
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -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"]]],[
|
|
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-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-amount",{"amount":[8],"currency":[1],"toInteger":[4,"to-integer"]}],[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"],
|
|
129
|
-
{ name: "Noble Pig", value: "pig",
|
|
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"
|
|
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
|
};
|
|
@@ -32659,6 +32659,7 @@ const styleCss$x = ".sc-smoothly-display-amount-h{display:block}[hidden].sc-smoo
|
|
|
32659
32659
|
const SmoothlyDisplayAmount = class {
|
|
32660
32660
|
constructor(hostRef) {
|
|
32661
32661
|
index.registerInstance(this, hostRef);
|
|
32662
|
+
this.toInteger = false;
|
|
32662
32663
|
}
|
|
32663
32664
|
format(amount) {
|
|
32664
32665
|
const digitsPerGroup = 3;
|
|
@@ -32679,7 +32680,7 @@ const SmoothlyDisplayAmount = class {
|
|
|
32679
32680
|
result = result.padEnd(separator + maxDecimals + 1, "0");
|
|
32680
32681
|
result = result.substring(0, separator + maxDecimals + 1);
|
|
32681
32682
|
}
|
|
32682
|
-
else {
|
|
32683
|
+
else if (!this.toInteger) {
|
|
32683
32684
|
result = result + ".";
|
|
32684
32685
|
separator = result.length - 1;
|
|
32685
32686
|
result = result.padEnd(separator + maxDecimals + 1, "0");
|
|
@@ -32731,7 +32732,7 @@ const SmoothlyDisplayDemo = class {
|
|
|
32731
32732
|
}
|
|
32732
32733
|
render() {
|
|
32733
32734
|
return [
|
|
32734
|
-
index.h("main", null, index.h("smoothly-popup", null, index.h("div", null, "Popup, click me"), index.h("div", { color: "dark", slot: "popup" }, "1 line popup")), index.h("smoothly-display-date-time", { datetime: "2019-08-15T08:08:17.65Z" }), index.h("dl", null, index.h("dt", null, "text"), index.h("dd", null, index.h("smoothly-display", { type: "text", value: "text" })), index.h("dt", null, "postal code"), index.h("dd", null, index.h("smoothly-display", { type: "postal-code", value: "752 31" })), index.h("dt", null, "password"), index.h("dd", null, index.h("smoothly-display", { type: "password", value: "password" })), index.h("dt", null, "email"), index.h("dd", null, index.h("smoothly-display", { type: "email", value: "test@example.com" })), index.h("dt", null, "price"), index.h("dd", null, index.h("smoothly-display", { type: "price", value: "13.37", currency: "SEK" })), index.h("dt", null, "percent"), index.h("dd", null, index.h("smoothly-display", { type: "percent", value: "42" })), index.h("dt", null, "phone"), index.h("dd", null, index.h("smoothly-display", { type: "phone", value: "0101881108" })), index.h("dt", null, "card number"), index.h("dd", null, index.h("smoothly-display", { type: "card-number", value: "4111111111111111" })), index.h("dt", null, "card expires"), index.h("dd", null, index.h("smoothly-display", { type: "card-expires", value: "7/22" })), index.h("dt", null, "card csc"), index.h("dd", null, index.h("smoothly-display", { type: "card-csc", value: "987" })), index.h("dt", null, "date"), index.h("dd", null, index.h("smoothly-display", { type: "date", value: "2022-07-07" })), index.h("dt", null, "date time"), index.h("dd", null, index.h("smoothly-display", { type: "date-time", format: { year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }, value: "2022-07-07T02:02:02Z" })), index.h("dd", null, index.h("smoothly-display", { type: "date-time", format: { year: "2-digit", month: "long", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit" }, value: "2022-07-07T02:02:02Z" })), index.h("dd", null, index.h("smoothly-display", { type: "date-time", format: { year: "numeric", month: "2-digit", day: "2-digit", hour: "numeric", minute: "numeric", second: "numeric" }, value: "2022-07-07T12:22:24Z" })), index.h("dd", null, index.h("smoothly-display", { type: "date-time", format: { year: "numeric", month: "numeric", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }, value: "2022-07-07T12:22:24Z" })), index.h("dd", null, index.h("smoothly-display", { type: "date-time", format: { year: "numeric", month: "short", day: "numeric" }, value: "2022-07-07T00:00+02:00" })), index.h("dd", null, index.h("smoothly-display", { type: "date-time", format: { year: "2-digit", month: "numeric", day: "numeric" }, value: "2022-07-07T00:00+02:00" })), index.h("dd", null, index.h("smoothly-display", { type: "date-time", format: { year: "2-digit", month: "numeric", day: "numeric", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZone: "+01:00" }, value: "2022-07-07T12:15Z" })), index.h("dt", null, "Quiet"), index.h("dd", null, index.h("smoothly-quiet", { color: "dark" }, "-"))), index.h("smoothly-skeleton", { period: 3, distance: "20rem", width: "20rem" }), index.h("smoothly-skeleton", { period: 3, distance: "20rem", color: "200,200,255" }), index.h("smoothly-skeleton", { period: 3, distance: "20rem", color: "var(--smoothly-warning-color)" }), index.h("smoothly-skeleton", { period: 3, distance: "20rem" }), index.h("smoothly-skeleton", { align: "center", period: 3, distance: "20rem", width: "20rem" }), index.h("smoothly-skeleton", { align: "center", period: 3, distance: "20rem" }), index.h("smoothly-skeleton", { align: "center", period: 3, distance: "20rem" }), index.h("smoothly-skeleton", { align: "center", period: 3, distance: "20rem" }), index.h("smoothly-skeleton", { align: "right", period: 3, distance: "20rem", width: "20rem" }), index.h("smoothly-skeleton", { align: "right", period: 3, distance: "20rem" }), index.h("smoothly-skeleton", { align: "right", period: 3, distance: "20rem" }), index.h("smoothly-skeleton", { align: "right", period: 3, distance: "20rem" }), index.h("smoothly-urlencoded", { data: "hej=hopp&tjena=moss" }), index.h("div", { style: { display: "flex", justifyContent: "space-between" } }, index.h("smoothly-popup", { direction: "down" }, "Click for popup", index.h("span", { slot: "popup", color: "dark", style: { whiteSpace: "nowrap" } }, "Some popup stuff that has a lot of text")), index.h("smoothly-popup", { direction: "down" }, "Click for popup", index.h("span", { slot: "popup", color: "dark", style: { whiteSpace: "nowrap" } }, "Some popup with a bunch of text."))), index.h("p", null, "Test of diffrent kinds of notifier:"), index.h("button", { onClick: () => this.noticeWarning(index$1.Notice.warn("This is a test warning notice.")) }, "warning"), index.h("button", { onClick: () => this.noticeWarning(index$1.Notice.succeded("This is a test success notice.")) }, "success"), index.h("button", { onClick: () => this.noticeWarning(index$1.Notice.failed("This is a test danger notice.")) }, "danger"), index.h("button", { onClick: () => this.noticeWarning(index$1.Notice.execute("This is a test execute notice.", () => new Promise(resolve => window.setTimeout(() => resolve([true, "This went great"]), 3000)))) }, "execute"), index.h("button", { onClick: () => this.noticeWarning(index$1.Notice.delay("This is a test delay notice.", () => new Promise(resolve => window.setTimeout(() => resolve([true, "This went great"]), 3000)))) }, "delay")),
|
|
32735
|
+
index.h("main", null, index.h("smoothly-popup", null, index.h("div", null, "Popup, click me"), index.h("div", { color: "dark", slot: "popup" }, "1 line popup")), index.h("smoothly-display-date-time", { datetime: "2019-08-15T08:08:17.65Z" }), index.h("dl", null, index.h("dt", null, "text"), index.h("dd", null, index.h("smoothly-display", { type: "text", value: "text" })), index.h("dt", null, "postal code"), index.h("dd", null, index.h("smoothly-display", { type: "postal-code", value: "752 31" })), index.h("dt", null, "password"), index.h("dd", null, index.h("smoothly-display", { type: "password", value: "password" })), index.h("dt", null, "email"), index.h("dd", null, index.h("smoothly-display", { type: "email", value: "test@example.com" })), index.h("dt", null, "price"), index.h("dd", null, index.h("smoothly-display", { type: "price", value: "13.37", currency: "SEK" })), index.h("dt", null, "display amount without decimals"), index.h("dd", null, index.h("smoothly-display-amount", { amount: 200, currency: "SEK", toInteger: true })), index.h("dt", null, "display amount with decimals if they are set, otherwise no decimal"), index.h("dd", null, index.h("smoothly-display-amount", { amount: 200.20, currency: "SEK", toInteger: true })), index.h("dt", null, "display amount with decimals"), index.h("dd", null, index.h("smoothly-display-amount", { amount: 200.20, currency: "SEK" })), index.h("dt", null, "percent"), index.h("dd", null, index.h("smoothly-display", { type: "percent", value: "42" })), index.h("dt", null, "phone"), index.h("dd", null, index.h("smoothly-display", { type: "phone", value: "0101881108" })), index.h("dt", null, "card number"), index.h("dd", null, index.h("smoothly-display", { type: "card-number", value: "4111111111111111" })), index.h("dt", null, "card expires"), index.h("dd", null, index.h("smoothly-display", { type: "card-expires", value: "7/22" })), index.h("dt", null, "card csc"), index.h("dd", null, index.h("smoothly-display", { type: "card-csc", value: "987" })), index.h("dt", null, "date"), index.h("dd", null, index.h("smoothly-display", { type: "date", value: "2022-07-07" })), index.h("dt", null, "date time"), index.h("dd", null, index.h("smoothly-display", { type: "date-time", format: { year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }, value: "2022-07-07T02:02:02Z" })), index.h("dd", null, index.h("smoothly-display", { type: "date-time", format: { year: "2-digit", month: "long", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit" }, value: "2022-07-07T02:02:02Z" })), index.h("dd", null, index.h("smoothly-display", { type: "date-time", format: { year: "numeric", month: "2-digit", day: "2-digit", hour: "numeric", minute: "numeric", second: "numeric" }, value: "2022-07-07T12:22:24Z" })), index.h("dd", null, index.h("smoothly-display", { type: "date-time", format: { year: "numeric", month: "numeric", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }, value: "2022-07-07T12:22:24Z" })), index.h("dd", null, index.h("smoothly-display", { type: "date-time", format: { year: "numeric", month: "short", day: "numeric" }, value: "2022-07-07T00:00+02:00" })), index.h("dd", null, index.h("smoothly-display", { type: "date-time", format: { year: "2-digit", month: "numeric", day: "numeric" }, value: "2022-07-07T00:00+02:00" })), index.h("dd", null, index.h("smoothly-display", { type: "date-time", format: { year: "2-digit", month: "numeric", day: "numeric", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZone: "+01:00" }, value: "2022-07-07T12:15Z" })), index.h("dt", null, "Quiet"), index.h("dd", null, index.h("smoothly-quiet", { color: "dark" }, "-"))), index.h("smoothly-skeleton", { period: 3, distance: "20rem", width: "20rem" }), index.h("smoothly-skeleton", { period: 3, distance: "20rem", color: "200,200,255" }), index.h("smoothly-skeleton", { period: 3, distance: "20rem", color: "var(--smoothly-warning-color)" }), index.h("smoothly-skeleton", { period: 3, distance: "20rem" }), index.h("smoothly-skeleton", { align: "center", period: 3, distance: "20rem", width: "20rem" }), index.h("smoothly-skeleton", { align: "center", period: 3, distance: "20rem" }), index.h("smoothly-skeleton", { align: "center", period: 3, distance: "20rem" }), index.h("smoothly-skeleton", { align: "center", period: 3, distance: "20rem" }), index.h("smoothly-skeleton", { align: "right", period: 3, distance: "20rem", width: "20rem" }), index.h("smoothly-skeleton", { align: "right", period: 3, distance: "20rem" }), index.h("smoothly-skeleton", { align: "right", period: 3, distance: "20rem" }), index.h("smoothly-skeleton", { align: "right", period: 3, distance: "20rem" }), index.h("smoothly-urlencoded", { data: "hej=hopp&tjena=moss" }), index.h("div", { style: { display: "flex", justifyContent: "space-between" } }, index.h("smoothly-popup", { direction: "down" }, "Click for popup", index.h("span", { slot: "popup", color: "dark", style: { whiteSpace: "nowrap" } }, "Some popup stuff that has a lot of text")), index.h("smoothly-popup", { direction: "down" }, "Click for popup", index.h("span", { slot: "popup", color: "dark", style: { whiteSpace: "nowrap" } }, "Some popup with a bunch of text."))), index.h("p", null, "Test of diffrent kinds of notifier:"), index.h("button", { onClick: () => this.noticeWarning(index$1.Notice.warn("This is a test warning notice.")) }, "warning"), index.h("button", { onClick: () => this.noticeWarning(index$1.Notice.succeded("This is a test success notice.")) }, "success"), index.h("button", { onClick: () => this.noticeWarning(index$1.Notice.failed("This is a test danger notice.")) }, "danger"), index.h("button", { onClick: () => this.noticeWarning(index$1.Notice.execute("This is a test execute notice.", () => new Promise(resolve => window.setTimeout(() => resolve([true, "This went great"]), 3000)))) }, "execute"), index.h("button", { onClick: () => this.noticeWarning(index$1.Notice.delay("This is a test delay notice.", () => new Promise(resolve => window.setTimeout(() => resolve([true, "This went great"]), 3000)))) }, "delay")),
|
|
32735
32736
|
];
|
|
32736
32737
|
}
|
|
32737
32738
|
};
|
|
@@ -33673,8 +33674,10 @@ const SmoothlyMenuOptions = class {
|
|
|
33673
33674
|
constructor(hostRef) {
|
|
33674
33675
|
index.registerInstance(this, hostRef);
|
|
33675
33676
|
this.menuEmpty = index.createEvent(this, "menuEmpty", 7);
|
|
33677
|
+
this.optionElements = [];
|
|
33676
33678
|
this.filteredOptions = [];
|
|
33677
33679
|
this.highlightIndex = 0;
|
|
33680
|
+
this.toggle = false;
|
|
33678
33681
|
this.emptyMenuLabel = "No Options";
|
|
33679
33682
|
this.newOptionLabel = "Add:";
|
|
33680
33683
|
this.order = false;
|
|
@@ -33682,7 +33685,7 @@ const SmoothlyMenuOptions = class {
|
|
|
33682
33685
|
this.resetHighlightOnOptionsChange = true;
|
|
33683
33686
|
this.mutable = false;
|
|
33684
33687
|
}
|
|
33685
|
-
optionsChangeHandler(
|
|
33688
|
+
optionsChangeHandler() {
|
|
33686
33689
|
this.highlightIndex = this.resetHighlightOnOptionsChange ? 0 : this.highlightIndex;
|
|
33687
33690
|
}
|
|
33688
33691
|
optionHoverHandler(event) {
|
|
@@ -33764,7 +33767,10 @@ const SmoothlyMenuOptions = class {
|
|
|
33764
33767
|
}
|
|
33765
33768
|
}
|
|
33766
33769
|
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,
|
|
33770
|
+
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 => {
|
|
33771
|
+
index$1 == 0 && (this.firstOptionsElement = el !== null && el !== void 0 ? el : this.firstOptionsElement);
|
|
33772
|
+
el && (this.optionElements[index$1] = el);
|
|
33773
|
+
}, 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
33774
|
}
|
|
33769
33775
|
get element() { return index.getElement(this); }
|
|
33770
33776
|
static get watchers() { return {
|
|
@@ -33855,30 +33861,37 @@ const Notifier = class {
|
|
|
33855
33861
|
};
|
|
33856
33862
|
Notifier.style = styleCss$l;
|
|
33857
33863
|
|
|
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.
|
|
33864
|
+
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
33865
|
|
|
33860
33866
|
const SmoothlyOption = class {
|
|
33861
33867
|
constructor(hostRef) {
|
|
33862
33868
|
index.registerInstance(this, hostRef);
|
|
33863
33869
|
this.optionHover = index.createEvent(this, "optionHover", 7);
|
|
33864
33870
|
this.optionSelect = index.createEvent(this, "optionSelect", 7);
|
|
33871
|
+
this.optionUnselect = index.createEvent(this, "optionUnselect", 7);
|
|
33865
33872
|
this.optionAdd = index.createEvent(this, "optionAdd", 7);
|
|
33866
33873
|
this.dataHighlight = false;
|
|
33867
33874
|
this.divider = false;
|
|
33875
|
+
this.toggle = false;
|
|
33876
|
+
this.checked = false;
|
|
33868
33877
|
}
|
|
33869
33878
|
onHover(event) {
|
|
33870
33879
|
this.optionHover.emit({ name: this.name, value: this.value });
|
|
33871
33880
|
}
|
|
33872
33881
|
onSelect(event) {
|
|
33873
|
-
if (this.value)
|
|
33882
|
+
if (this.value) {
|
|
33874
33883
|
this.new
|
|
33875
33884
|
? this.optionAdd.emit({ name: this.name, value: this.value })
|
|
33876
|
-
: this.
|
|
33885
|
+
: !this.toggle || (this.toggle && !this.checked)
|
|
33886
|
+
? this.optionSelect.emit({ name: this.name, value: this.value })
|
|
33887
|
+
: this.optionUnselect.emit({ name: this.name, value: this.value });
|
|
33888
|
+
this.toggle && (this.checked = !this.checked);
|
|
33889
|
+
}
|
|
33877
33890
|
else
|
|
33878
33891
|
throw `smoothly-option ${this.element.innerHTML} lacks value-property and can therefore not be selected`;
|
|
33879
33892
|
}
|
|
33880
33893
|
render() {
|
|
33881
|
-
return (index.h(index.Host, { onMouseDown: (e) => this.onSelect(e), onMouseOver: (e) => this.onHover(e) }, index.h("
|
|
33894
|
+
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
33895
|
}
|
|
33883
33896
|
get element() { return index.getElement(this); }
|
|
33884
33897
|
};
|
|
@@ -33894,6 +33907,7 @@ const SmoothlyPicker = class {
|
|
|
33894
33907
|
this.keepFocusOnReRender = false;
|
|
33895
33908
|
this.disabled = false;
|
|
33896
33909
|
this.readonly = false;
|
|
33910
|
+
this.maxMenuHeight = "inherit";
|
|
33897
33911
|
this.emptyMenuLabel = "No Options";
|
|
33898
33912
|
this.multiple = false;
|
|
33899
33913
|
this.mutable = false;
|
|
@@ -34030,17 +34044,14 @@ const SmoothlyPicker = class {
|
|
|
34030
34044
|
this.isOpen = false;
|
|
34031
34045
|
this.filterOptions();
|
|
34032
34046
|
}
|
|
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
34047
|
render() {
|
|
34037
|
-
var _a, _b, _c
|
|
34048
|
+
var _a, _b, _c;
|
|
34038
34049
|
const cssVariables = {
|
|
34039
34050
|
"--max-height": (_a = this.maxHeight) !== null && _a !== void 0 ? _a : "inherit",
|
|
34040
34051
|
"--label-display": this.labelSetting == "hide" ? "none" : "absolute",
|
|
34041
34052
|
};
|
|
34042
34053
|
(_b = this.options) === null || _b === void 0 ? void 0 : _b.forEach(o => {
|
|
34043
|
-
o.
|
|
34054
|
+
o.checked = this.selections.map(s => s.value).includes(o.value);
|
|
34044
34055
|
});
|
|
34045
34056
|
const options = [
|
|
34046
34057
|
...(this.multiple
|
|
@@ -34048,16 +34059,16 @@ const SmoothlyPicker = class {
|
|
|
34048
34059
|
{
|
|
34049
34060
|
value: "select-none",
|
|
34050
34061
|
name: this.selections.length == this.options.length ? this.selectNoneName : this.selectAllName,
|
|
34051
|
-
|
|
34062
|
+
checked: this.selections.length == this.options.length,
|
|
34052
34063
|
divider: true,
|
|
34053
34064
|
},
|
|
34054
34065
|
]
|
|
34055
34066
|
: []),
|
|
34056
|
-
...((
|
|
34067
|
+
...((_c = this.options) !== null && _c !== void 0 ? _c : []),
|
|
34057
34068
|
];
|
|
34058
34069
|
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
34070
|
? 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 })));
|
|
34071
|
+
: 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
34072
|
}
|
|
34062
34073
|
get element() { return index.getElement(this); }
|
|
34063
34074
|
static get watchers() { return {
|
|
@@ -34195,11 +34206,11 @@ const SmoothlySelectDemo = class {
|
|
|
34195
34206
|
} }),
|
|
34196
34207
|
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
34208
|
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: [
|
|
34209
|
+
index.h("smoothly-picker", { label: "Filter", "empty-menu-label": "Sorry, we're out of options.", "max-height": "58px", maxMenuHeight: "20rem", multiple: true, options: [
|
|
34199
34210
|
{ name: "Big Dog", value: "dog", aliases: ["WOFF"] },
|
|
34200
|
-
{ name: "Cat Stevens", value: "cat", aliases: ["moew"] },
|
|
34211
|
+
{ name: "Cat Stevens", value: "cat", aliases: ["moew"], hint: "moew" },
|
|
34201
34212
|
{ name: "Noble Pig", value: "pig" },
|
|
34202
|
-
{ name: "Turtle Wax", value: "turtle" },
|
|
34213
|
+
{ name: "Turtle Wax", value: "turtle", hint: "slow" },
|
|
34203
34214
|
{ name: "Spider Man", value: "spider" },
|
|
34204
34215
|
{ name: "Phoenix Order Long Wooord", value: "phoenix" },
|
|
34205
34216
|
{ name: "Horse Back", value: "horse" },
|
|
@@ -34231,7 +34242,7 @@ const SmoothlySelectDemo = class {
|
|
|
34231
34242
|
], valueValidator: (email) => email.match(/^\w+@\w+/) ? [true, undefined] : [false, index$1.Notice.failed("Incorrectly formatted email")] }),
|
|
34232
34243
|
index.h("br", null),
|
|
34233
34244
|
index.h("smoothly-picker", { label: "Single select", multiple: false, "max-menu-height": "200px", options: [
|
|
34234
|
-
{ name: "Dog", value: "dog", aliases: ["WOFF"],
|
|
34245
|
+
{ name: "Dog", value: "dog", aliases: ["WOFF"], hint: "Woof 🐶" },
|
|
34235
34246
|
{ name: "Cat", value: "cat", aliases: ["moew"] },
|
|
34236
34247
|
{ name: "Pig", value: "pig" },
|
|
34237
34248
|
{ name: "Turtle", value: "turtle" },
|
package/dist/cjs/smoothly.cjs.js
CHANGED
|
@@ -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"]]],[
|
|
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-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-amount",{"amount":[8],"currency":[1],"toInteger":[4,"to-integer"]}],[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"],
|
|
42
|
-
{ name: "Noble Pig", value: "pig",
|
|
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"
|
|
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,6 +1,9 @@
|
|
|
1
1
|
import { Component, Prop } from "@stencil/core";
|
|
2
2
|
import { Currency } from "isoly";
|
|
3
3
|
export class SmoothlyDisplayAmount {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.toInteger = false;
|
|
6
|
+
}
|
|
4
7
|
format(amount) {
|
|
5
8
|
const digitsPerGroup = 3;
|
|
6
9
|
const defaultDecimals = 2;
|
|
@@ -20,7 +23,7 @@ export class SmoothlyDisplayAmount {
|
|
|
20
23
|
result = result.padEnd(separator + maxDecimals + 1, "0");
|
|
21
24
|
result = result.substring(0, separator + maxDecimals + 1);
|
|
22
25
|
}
|
|
23
|
-
else {
|
|
26
|
+
else if (!this.toInteger) {
|
|
24
27
|
result = result + ".";
|
|
25
28
|
separator = result.length - 1;
|
|
26
29
|
result = result.padEnd(separator + maxDecimals + 1, "0");
|
|
@@ -89,6 +92,24 @@ export class SmoothlyDisplayAmount {
|
|
|
89
92
|
},
|
|
90
93
|
"attribute": "currency",
|
|
91
94
|
"reflect": false
|
|
95
|
+
},
|
|
96
|
+
"toInteger": {
|
|
97
|
+
"type": "boolean",
|
|
98
|
+
"mutable": false,
|
|
99
|
+
"complexType": {
|
|
100
|
+
"original": "boolean",
|
|
101
|
+
"resolved": "boolean",
|
|
102
|
+
"references": {}
|
|
103
|
+
},
|
|
104
|
+
"required": false,
|
|
105
|
+
"optional": false,
|
|
106
|
+
"docs": {
|
|
107
|
+
"tags": [],
|
|
108
|
+
"text": ""
|
|
109
|
+
},
|
|
110
|
+
"attribute": "to-integer",
|
|
111
|
+
"reflect": false,
|
|
112
|
+
"defaultValue": "false"
|
|
92
113
|
}
|
|
93
114
|
}; }
|
|
94
115
|
}
|
|
@@ -28,6 +28,15 @@ export class SmoothlyDisplayDemo {
|
|
|
28
28
|
h("dt", null, "price"),
|
|
29
29
|
h("dd", null,
|
|
30
30
|
h("smoothly-display", { type: "price", value: "13.37", currency: "SEK" })),
|
|
31
|
+
h("dt", null, "display amount without decimals"),
|
|
32
|
+
h("dd", null,
|
|
33
|
+
h("smoothly-display-amount", { amount: 200, currency: "SEK", toInteger: true })),
|
|
34
|
+
h("dt", null, "display amount with decimals if they are set, otherwise no decimal"),
|
|
35
|
+
h("dd", null,
|
|
36
|
+
h("smoothly-display-amount", { amount: 200.20, currency: "SEK", toInteger: true })),
|
|
37
|
+
h("dt", null, "display amount with decimals"),
|
|
38
|
+
h("dd", null,
|
|
39
|
+
h("smoothly-display-amount", { amount: 200.20, currency: "SEK" })),
|
|
31
40
|
h("dt", null, "percent"),
|
|
32
41
|
h("dd", null,
|
|
33
42
|
h("smoothly-display", { type: "percent", value: "42" })),
|
|
@@ -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(
|
|
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,
|
|
96
|
-
|
|
97
|
-
|
|
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": "
|
|
205
|
-
"resolved": "
|
|
225
|
+
"original": "Option[]",
|
|
226
|
+
"resolved": "Option[]",
|
|
206
227
|
"references": {
|
|
207
|
-
"
|
|
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<
|
|
344
|
+
"signature": "() => Promise<Option | undefined>",
|
|
324
345
|
"parameters": [],
|
|
325
346
|
"references": {
|
|
326
347
|
"Promise": {
|
|
327
348
|
"location": "global"
|
|
328
349
|
},
|
|
329
|
-
"
|
|
350
|
+
"Option": {
|
|
330
351
|
"location": "import",
|
|
331
352
|
"path": "../../model"
|
|
332
353
|
}
|
|
333
354
|
},
|
|
334
|
-
"return": "Promise<
|
|
355
|
+
"return": "Promise<Option | undefined>"
|
|
335
356
|
},
|
|
336
357
|
"docs": {
|
|
337
358
|
"text": "",
|