smoothly 0.1.121 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/smoothly-accordion_51.cjs.entry.js +127 -65
- package/dist/cjs/smoothly.cjs.js +1 -1
- package/dist/collection/components/app/style.css +12 -12
- package/dist/collection/components/button/style.css +1 -2
- package/dist/collection/components/calendar/style.css +2 -3
- package/dist/collection/components/input/index.js +68 -8
- package/dist/collection/components/input-date/index.js +1 -1
- package/dist/collection/components/input-date/style.css +2 -3
- package/dist/collection/components/input-date-range/index.js +2 -2
- package/dist/collection/components/input-demo/index.js +2 -1
- package/dist/collection/components/item/style.css +2 -3
- package/dist/collection/components/menu-options/index.js +64 -3
- package/dist/collection/components/option/index.js +35 -1
- package/dist/collection/components/option/style.css +6 -0
- package/dist/collection/components/picker/index.js +149 -11
- package/dist/collection/components/select-demo/index.js +9 -1
- package/dist/collection/components/select-demo/style.css +1 -1
- package/dist/collection/components/selector/style.css +0 -2
- package/dist/collection/components/tab/style.css +3 -4
- package/dist/collection/components/tab-switch/index.js +1 -0
- package/dist/collection/components/tab-switch/style.css +1 -1
- package/dist/collection/components/table/cell/style.css +3 -1
- package/dist/collection/components/table/demo/index.js +38 -32
- package/dist/collection/components/table/expandable/cell/index.js +8 -9
- package/dist/collection/components/table/expandable/cell/style.css +38 -1
- package/dist/collection/components/table/expandable/row/index.js +84 -21
- package/dist/collection/components/table/expandable/row/style.css +35 -4
- package/dist/collection/components/table/header/index.js +22 -2
- package/dist/collection/components/table/header/style.css +5 -3
- package/dist/collection/components/table/index.js +33 -1
- package/dist/collection/components/table/row/index.js +20 -84
- package/dist/collection/components/table/row/style.css +2 -8
- package/dist/collection/components/table/style.css +8 -3
- package/dist/custom-elements/index.js +136 -74
- package/dist/esm/loader.js +1 -1
- package/dist/esm/smoothly-accordion_51.entry.js +127 -65
- package/dist/esm/smoothly.js +1 -1
- package/dist/smoothly/p-a302008c.entry.js +1 -0
- package/dist/smoothly/smoothly.esm.js +1 -1
- package/dist/types/components/input/index.d.ts +10 -3
- package/dist/types/components/menu-options/index.d.ts +5 -0
- package/dist/types/components/option/index.d.ts +5 -0
- package/dist/types/components/picker/index.d.ts +14 -3
- package/dist/types/components/table/expandable/cell/index.d.ts +2 -2
- package/dist/types/components/table/expandable/row/index.d.ts +9 -4
- package/dist/types/components/table/header/index.d.ts +1 -0
- package/dist/types/components/table/index.d.ts +3 -0
- package/dist/types/components/table/row/index.d.ts +3 -9
- package/dist/types/components.d.ts +31 -7
- package/package.json +2 -2
- package/dist/smoothly/p-f4529a2d.entry.js +0 -1
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-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_51.cjs",[[0,"smoothly-app-demo",{"baseUrl":[1,"base-url"]}],[0,"smoothly-input-demo"],[2,"smoothly-select-demo",null,[[0,"selectionChanged","handleSelectionChanged"]]],[0,"smoothly-display-demo"],[2,"smoothly-table-demo"],[4,"smoothly-app",{"color":[1]}],[0,"smoothly-dialog-demo"],[2,"smoothly-icon-demo"],[6,"smoothly-button",{"color":[513],"expand":[513],"fill":[513],"disabled":[516],"type":[513],"link":[1],"download":[4]}],[4,"smoothly-room",{"label":[1],"icon":[1],"path":[1],"to":[1]}],[2,"smoothly-input-date-range",{"value":[1025],"start":[1025],"end":[1025],"max":[1025],"min":[1025],"open":[1028],"showLabel":[516,"show-label"]},[[0,"startChanged","onStartChanged"],[0,"endChanged","onEndChanged"],[0,"dateRangeSet","onDateRangeSet"]]],[6,"smoothly-notifier",{"notices":[32]},[[0,"notice","onNotice"],[0,"remove","onRemove"]]],[1,"smoothly-picker",{"maxMenuHeight":[1,"max-menu-height"],"maxHeight":[1,"max-height"],"emptyMenuLabel":[1025,"empty-menu-label"],"multiple":[516],"optionStyle":[8,"option-style"],"options":[16],"labelSetting":[513,"label-setting"],"label":[513],"selections":[1040],"selectNoneName":[1025,"select-none-name"],"selectionName":[1025,"selection-name"],"isOpen":[32]},[[0,"optionSelect","
|
|
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-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_51.cjs",[[0,"smoothly-app-demo",{"baseUrl":[1,"base-url"]}],[0,"smoothly-input-demo"],[2,"smoothly-select-demo",null,[[0,"selectionChanged","handleSelectionChanged"]]],[0,"smoothly-display-demo"],[2,"smoothly-table-demo"],[4,"smoothly-app",{"color":[1]}],[0,"smoothly-dialog-demo"],[2,"smoothly-icon-demo"],[6,"smoothly-button",{"color":[513],"expand":[513],"fill":[513],"disabled":[516],"type":[513],"link":[1],"download":[4]}],[4,"smoothly-room",{"label":[1],"icon":[1],"path":[1],"to":[1]}],[2,"smoothly-input-date-range",{"value":[1025],"start":[1025],"end":[1025],"max":[1025],"min":[1025],"open":[1028],"showLabel":[516,"show-label"]},[[0,"startChanged","onStartChanged"],[0,"endChanged","onEndChanged"],[0,"dateRangeSet","onDateRangeSet"]]],[6,"smoothly-notifier",{"notices":[32]},[[0,"notice","onNotice"],[0,"remove","onRemove"]]],[1,"smoothly-picker",{"maxMenuHeight":[1,"max-menu-height"],"maxHeight":[1,"max-height"],"emptyMenuLabel":[1025,"empty-menu-label"],"multiple":[516],"mutable":[4],"optionStyle":[8,"option-style"],"options":[16],"labelSetting":[513,"label-setting"],"label":[513],"selections":[1040],"selectNoneName":[1025,"select-none-name"],"selectAllName":[1025,"select-all-name"],"selectionName":[1025,"selection-name"],"newOptionLabel":[1025,"new-option-label"],"valueValidator":[16],"isOpen":[32],"empty":[32]},[[0,"optionSelect","optionSelectHandler"],[0,"optionAdd","optionAddHandler"],[0,"menuEmpty","emptyHandler"]]],[6,"smoothly-dialog",{"color":[513],"open":[1540],"closable":[516],"header":[513]},[[0,"trigger","TriggerListener"]]],[6,"smoothly-table-expandable-row",{"align":[1],"open":[1540]},[[0,"click","onClick"]]],[2,"smoothly-backtotop",{"opacity":[1],"bottom":[1],"right":[1],"visible":[32]}],[2,"smoothly-checkbox",{"selectAll":[4,"select-all"],"size":[1],"intermediate":[1540],"selected":[1540],"disabled":[1540],"t":[32]}],[6,"smoothly-submit",{"processing":[1540],"color":[513],"expand":[513],"fill":[513],"disabled":[516],"prevent":[4],"submit":[64]},[[0,"click","handleSubmit"]]],[6,"smoothly-table-expandable-cell",{"align":[1],"open":[1540]},[[0,"click","onClick"]]],[0,"smoothly-urlencoded",{"data":[1]}],[6,"smoothly-accordion",{"value":[1025]},[[0,"smoothlyOpen","handleOpenClose"],[0,"smoothlyClose","handleOpenClose"],[0,"smoothlyAccordionItemDidLoad","onAccordionItemDidLoad"],[0,"smoothlyAccordionItemDidUnload","onAccordionItemDidUnload"]]],[6,"smoothly-accordion-item",{"name":[1],"brand":[1],"open":[1540]}],[2,"smoothly-display",{"type":[1],"value":[8],"currency":[1],"country":[1]}],[2,"smoothly-display-amount",{"amount":[8],"currency":[1]}],[2,"smoothly-frame",{"url":[1],"name":[1],"origin":[1],"send":[64]}],[6,"smoothly-popup",{"visible":[1540],"direction":[1537],"cssVariables":[32]}],[6,"smoothly-quiet",{"color":[1]}],[6,"smoothly-radio",{"name":[1],"value":[1],"checked":[1540],"tabIndex":[2,"tab-index"]}],[6,"smoothly-select",{"identifier":[1],"background":[513],"value":[1025]}],[2,"smoothly-skeleton",{"widths":[16],"width":[1],"color":[1],"period":[2],"distance":[1],"align":[513]}],[2,"smoothly-svg",{"url":[513],"size":[513],"color":[1]}],[6,"smoothly-table",null,[[0,"expansionLoad","handleEvents"],[0,"expansionOpen","handleEvents"]]],[6,"smoothly-table-header",{"name":[1]}],[6,"smoothly-table-row",null,[[0,"expansionLoad","onExpansionLoad"],[0,"expansionOpen","onExpansionOpen"]]],[6,"smoothly-input-date",{"value":[1025],"open":[1028],"max":[1025],"min":[1025],"disabled":[1028]},[[0,"dateSet","dateSetHandler"]]],[1,"smoothly-menu-options",{"emptyMenuLabel":[1025,"empty-menu-label"],"newOptionLabel":[1,"new-option-label"],"maxMenuHeight":[1,"max-menu-height"],"order":[4],"optionStyle":[8,"option-style"],"options":[1040],"resetHighlightOnOptionsChange":[1028,"reset-highlight-on-options-change"],"mutable":[4],"filteredOptions":[32],"highlightIndex":[32],"keyword":[32],"moveHighlight":[64],"setHighlight":[64],"getHighlighted":[64],"filterOptions":[64]},[[0,"optionHover","optionHoverHandler"]]],[2,"smoothly-notification",{"notice":[16],"tick":[32]},[[0,"trigger","onTrigger"]]],[2,"smoothly-display-date-time",{"datetime":[1]}],[6,"smoothly-tab",{"label":[1],"open":[1540]},[[0,"click","onClick"]]],[6,"smoothly-tab-switch",{"selectedElement":[32]},[[0,"expansionOpen","openChanged"]]],[6,"smoothly-table-cell"],[0,"smoothly-tuple",{"tuple":[16]}],[1,"smoothly-option",{"aliases":[513],"dataHighlight":[1540,"data-highlight"],"name":[1537],"value":[1537],"divider":[1540],"new":[4]}],[2,"smoothly-spinner",{"active":[516],"size":[513]}],[2,"smoothly-calendar",{"month":[1025],"value":[1025],"start":[1025],"end":[1025],"max":[1025],"min":[1025],"doubleInput":[516,"double-input"],"firstSelected":[32]}],[6,"smoothly-input",{"name":[513],"value":[1032],"type":[513],"required":[1540],"minLength":[1026,"min-length"],"showLabel":[516,"show-label"],"maxLength":[1026,"max-length"],"autocomplete":[1028],"pattern":[1040],"placeholder":[1025],"disabled":[1028],"readonly":[1028],"currency":[513],"initialValue":[32],"getFormData":[64],"setKeepFocusOnReRender":[64],"setSelectionRange":[64]}],[2,"smoothly-input-month",{"value":[1025]}],[6,"smoothly-selector",{"opened":[32],"selectedElement":[32],"missing":[32],"filter":[32]},[[0,"click","onClick"],[0,"itemSelected","onItemSelected"],[0,"keydown","onKeyDown"]]],[6,"smoothly-item",{"value":[8],"selected":[1540],"filter":[64]},[[0,"click","onClick"]]],[6,"smoothly-trigger",{"color":[513],"expand":[513],"fill":[513],"disabled":[516],"type":[513],"name":[1],"value":[8]},[[0,"click","onClick"]]],[2,"smoothly-icon",{"color":[513],"fill":[513],"name":[1],"size":[513],"toolTip":[1,"tool-tip"],"document":[32]}]]]], options);
|
|
19
19
|
});
|
|
@@ -37,7 +37,7 @@ smoothly-app[color=danger] {
|
|
|
37
37
|
--smoothly-app-hover-color: var(--smoothly-default-contrast);
|
|
38
38
|
--smoothly-app-shadow: var(--smoothly-color-shadow);
|
|
39
39
|
}
|
|
40
|
-
smoothly-app>smoothly-notifier>header {
|
|
40
|
+
smoothly-app > smoothly-notifier > header {
|
|
41
41
|
position: fixed;
|
|
42
42
|
top: 0;
|
|
43
43
|
left: 0;
|
|
@@ -52,13 +52,13 @@ smoothly-app>smoothly-notifier>header {
|
|
|
52
52
|
justify-content: space-between;
|
|
53
53
|
align-items: center;
|
|
54
54
|
box-shadow: 0 2px 5px 0 rgba(var(--smoothly-app-shadow));
|
|
55
|
-
border-bottom: 1px solid rgba(var(--smoothly-dark-color))
|
|
55
|
+
border-bottom: 1px solid rgba(var(--smoothly-dark-color));
|
|
56
56
|
}
|
|
57
|
-
smoothly-app>smoothly-notifier>header a {
|
|
57
|
+
smoothly-app > smoothly-notifier > header a {
|
|
58
58
|
color: inherit;
|
|
59
59
|
text-decoration: inherit;
|
|
60
60
|
}
|
|
61
|
-
smoothly-app>smoothly-notifier>header>nav {
|
|
61
|
+
smoothly-app > smoothly-notifier > header > nav {
|
|
62
62
|
width: 100%;
|
|
63
63
|
flex-shrink: 2;
|
|
64
64
|
}
|
|
@@ -71,10 +71,10 @@ smoothly-app>smoothly-notifier>header>nav>ul li>*:not(a) {
|
|
|
71
71
|
height: 100%;
|
|
72
72
|
margin: 0;
|
|
73
73
|
}
|
|
74
|
-
smoothly-app>smoothly-notifier>header>h1 {
|
|
74
|
+
smoothly-app > smoothly-notifier > header > h1 {
|
|
75
75
|
margin-left: 3.8rem;
|
|
76
76
|
}
|
|
77
|
-
smoothly-app>smoothly-notifier>header>h1>a {
|
|
77
|
+
smoothly-app > smoothly-notifier > header > h1 > a {
|
|
78
78
|
overflow: hidden;
|
|
79
79
|
user-select: none;
|
|
80
80
|
height: 200%;
|
|
@@ -83,26 +83,26 @@ smoothly-app>smoothly-notifier>header>h1>a {
|
|
|
83
83
|
size: 100%;
|
|
84
84
|
background-position-y: center;
|
|
85
85
|
}
|
|
86
|
-
smoothly-app>smoothly-notifier>header>nav>ul>li a {
|
|
86
|
+
smoothly-app > smoothly-notifier > header > nav > ul > li a {
|
|
87
87
|
line-height: 1.6cm;
|
|
88
88
|
}
|
|
89
|
-
smoothly-app>smoothly-notifier>header>nav>ul {
|
|
89
|
+
smoothly-app > smoothly-notifier > header > nav > ul {
|
|
90
90
|
width: 100%;
|
|
91
91
|
}
|
|
92
|
-
smoothly-app>smoothly-notifier>header>[slot=header] {
|
|
92
|
+
smoothly-app > smoothly-notifier > header > [slot=header] {
|
|
93
93
|
display: flex;
|
|
94
94
|
margin-right: 2.1rem;
|
|
95
95
|
justify-content: flex-end;
|
|
96
96
|
border: 0;
|
|
97
97
|
}
|
|
98
|
-
smoothly-app>smoothly-notifier>header>[slot=header]>a {
|
|
98
|
+
smoothly-app > smoothly-notifier > header > [slot=header] > a {
|
|
99
99
|
display: flex;
|
|
100
100
|
align-self: center;
|
|
101
101
|
border-width: 0;
|
|
102
102
|
align-items: center;
|
|
103
103
|
margin-right: 3.9rem;
|
|
104
104
|
}
|
|
105
|
-
smoothly-app>smoothly-notifier>header>[slot=header]>a>smoothly-icon {
|
|
105
|
+
smoothly-app > smoothly-notifier > header > [slot=header] > a > smoothly-icon {
|
|
106
106
|
fill: rgb(var(--smoothly-primary-shade));
|
|
107
107
|
stroke: rgb(var(--smoothly-primary-shade));
|
|
108
108
|
color: rgb(var(--smoothly-primary-shade));
|
|
@@ -146,7 +146,7 @@ smoothly-app>smoothly-notifier>header>nav>ul li a.active {
|
|
|
146
146
|
stroke: rgb(var(--smoothly-app-color));
|
|
147
147
|
fill: rgb(var(--smoothly-app-color));
|
|
148
148
|
}
|
|
149
|
-
smoothly-app>smoothly-notifier>main {
|
|
149
|
+
smoothly-app > smoothly-notifier > main {
|
|
150
150
|
position: relative;
|
|
151
151
|
top: 5.6rem;
|
|
152
152
|
}
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
}
|
|
19
19
|
a,
|
|
20
20
|
button {
|
|
21
|
+
display: block;
|
|
21
22
|
border-color: transparent;
|
|
22
23
|
background-color: transparent;
|
|
23
24
|
padding: 0.2em 0.3em;
|
|
24
25
|
font-size: 110%;
|
|
25
26
|
font-weight: 400;
|
|
26
27
|
}
|
|
27
|
-
|
|
28
28
|
:host:not([disabled]):hover,
|
|
29
29
|
:host:not([disabled]):focus,
|
|
30
30
|
:host:not([disabled]):active {
|
|
@@ -35,7 +35,6 @@ button {
|
|
|
35
35
|
text-align: center;
|
|
36
36
|
text-decoration: inherit;
|
|
37
37
|
}
|
|
38
|
-
|
|
39
38
|
:host[type=button] > a {
|
|
40
39
|
width: calc(100% - 0.6em);
|
|
41
40
|
}
|
|
@@ -35,7 +35,7 @@ td:nth-child(6):not(.currentMonth),
|
|
|
35
35
|
td:nth-child(7):not(.currentMonth) {
|
|
36
36
|
color: rgba(var(--smoothly-danger-tint), var(--other-month-opacity));
|
|
37
37
|
}
|
|
38
|
-
td:not(.selected
|
|
38
|
+
td:not(.selected, .disable):hover {
|
|
39
39
|
color: rgb(var(--smoothly-primary-contrast));
|
|
40
40
|
background: rgb(var(--smoothly-primary-tint));
|
|
41
41
|
}
|
|
@@ -43,7 +43,7 @@ td.selected {
|
|
|
43
43
|
color: rgb(var(--smoothly-primary-contrast));
|
|
44
44
|
background: rgb(var(--smoothly-primary-color));
|
|
45
45
|
}
|
|
46
|
-
td:not(.selected
|
|
46
|
+
td:not(.selected, .dateRange):not(:hover).today {
|
|
47
47
|
background: rgb(var(--smoothly-dark-tint));
|
|
48
48
|
color: rgb(var(--smoothly-dark-contrast));
|
|
49
49
|
}
|
|
@@ -56,4 +56,3 @@ td.disable {
|
|
|
56
56
|
background-color: rgb(var(--smoothly-default-tint), 0.5);
|
|
57
57
|
color: rgb(var(--smoothly-default-contrast), 0.5);
|
|
58
58
|
}
|
|
59
|
-
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, Event, h, Host, Method, Prop, Watch } from "@stencil/core";
|
|
1
|
+
import { Component, Event, h, Host, Method, Prop, State, Watch } from "@stencil/core";
|
|
2
2
|
import { Language, Locale } from "isoly";
|
|
3
3
|
import { Action, get, StateEditor } from "tidily";
|
|
4
4
|
export class SmoothlyInput {
|
|
@@ -11,6 +11,7 @@ export class SmoothlyInput {
|
|
|
11
11
|
this.maxLength = Number.POSITIVE_INFINITY;
|
|
12
12
|
this.autocomplete = true;
|
|
13
13
|
this.disabled = false;
|
|
14
|
+
this.readonly = false;
|
|
14
15
|
}
|
|
15
16
|
get formatter() {
|
|
16
17
|
let result;
|
|
@@ -36,7 +37,7 @@ export class SmoothlyInput {
|
|
|
36
37
|
if (value != before) {
|
|
37
38
|
if (typeof value == "string")
|
|
38
39
|
value = value.trim();
|
|
39
|
-
this.
|
|
40
|
+
this.smoothlyInput.emit({ name: this.name, value });
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
onCurrency() {
|
|
@@ -86,8 +87,14 @@ export class SmoothlyInput {
|
|
|
86
87
|
const after = this.formatter.format(StateEditor.copy(this.formatter.unformat(StateEditor.copy(Object.assign({}, this.state)))));
|
|
87
88
|
this.updateBackend(after, this.inputElement);
|
|
88
89
|
}
|
|
89
|
-
onBlur(event) {
|
|
90
|
+
onBlur(event) {
|
|
91
|
+
this.smoothlyBlur.emit();
|
|
92
|
+
if (this.initialValue != this.value)
|
|
93
|
+
this.smoothlyChange.emit({ name: this.name, value: this.value });
|
|
94
|
+
this.initialValue = undefined;
|
|
95
|
+
}
|
|
90
96
|
onFocus(event) {
|
|
97
|
+
this.initialValue = this.value;
|
|
91
98
|
const after = this.formatter.format(StateEditor.copy(this.formatter.unformat(StateEditor.copy(Object.assign({}, this.state)))));
|
|
92
99
|
if (event.target)
|
|
93
100
|
this.updateBackend(after, event.target);
|
|
@@ -163,8 +170,10 @@ export class SmoothlyInput {
|
|
|
163
170
|
return value;
|
|
164
171
|
}
|
|
165
172
|
processKey(event, backend) {
|
|
166
|
-
|
|
167
|
-
|
|
173
|
+
if (!this.readonly) {
|
|
174
|
+
const after = Action.apply(this.formatter, this.state, event);
|
|
175
|
+
this.updateBackend(after, backend);
|
|
176
|
+
}
|
|
168
177
|
}
|
|
169
178
|
updateBackend(after, backend) {
|
|
170
179
|
if (after.value != backend.value)
|
|
@@ -181,7 +190,7 @@ export class SmoothlyInput {
|
|
|
181
190
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
182
191
|
return (h(Host, { class: { "has-value": ((_a = this.state) === null || _a === void 0 ? void 0 : _a.value) != undefined && ((_b = this.state) === null || _b === void 0 ? void 0 : _b.value) != "" }, onclick: () => { var _a; return (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.focus(); } },
|
|
183
192
|
h("div", null,
|
|
184
|
-
h("input", { name: this.name, type: (_c = this.state) === null || _c === void 0 ? void 0 : _c.type, placeholder: this.placeholder, required: this.required, autocomplete: this.autocomplete ? (_d = this.state) === null || _d === void 0 ? void 0 : _d.autocomplete : "off", disabled: this.disabled, pattern: ((_e = this.state) === null || _e === void 0 ? void 0 : _e.pattern) && ((_f = this.state) === null || _f === void 0 ? void 0 : _f.pattern.source), value: (_g = this.state) === null || _g === void 0 ? void 0 : _g.value, onInput: (e) => this.onInput(e), onFocus: e => this.onFocus(e), onClick: e => this.onClick(e), onBlur: e => this.onBlur(e), onKeyDown: e => this.onKeyDown(e), ref: (el) => (this.inputElement = el), onPaste: e => this.onPaste(e) }),
|
|
193
|
+
h("input", { name: this.name, type: (_c = this.state) === null || _c === void 0 ? void 0 : _c.type, placeholder: this.placeholder, required: this.required, autocomplete: this.autocomplete ? (_d = this.state) === null || _d === void 0 ? void 0 : _d.autocomplete : "off", disabled: this.disabled, readOnly: this.readonly, pattern: ((_e = this.state) === null || _e === void 0 ? void 0 : _e.pattern) && ((_f = this.state) === null || _f === void 0 ? void 0 : _f.pattern.source), value: (_g = this.state) === null || _g === void 0 ? void 0 : _g.value, onInput: (e) => this.onInput(e), onFocus: e => this.onFocus(e), onClick: e => this.onClick(e), onBlur: e => this.onBlur(e), onKeyDown: e => this.onKeyDown(e), ref: (el) => (this.inputElement = el), onPaste: e => this.onPaste(e) }),
|
|
185
194
|
h("label", { htmlFor: this.name },
|
|
186
195
|
h("slot", null)),
|
|
187
196
|
h("smoothly-icon", { name: "alert-circle", color: "danger", fill: "clear", size: "small" }))));
|
|
@@ -391,6 +400,24 @@ export class SmoothlyInput {
|
|
|
391
400
|
"reflect": false,
|
|
392
401
|
"defaultValue": "false"
|
|
393
402
|
},
|
|
403
|
+
"readonly": {
|
|
404
|
+
"type": "boolean",
|
|
405
|
+
"mutable": true,
|
|
406
|
+
"complexType": {
|
|
407
|
+
"original": "boolean",
|
|
408
|
+
"resolved": "boolean",
|
|
409
|
+
"references": {}
|
|
410
|
+
},
|
|
411
|
+
"required": false,
|
|
412
|
+
"optional": false,
|
|
413
|
+
"docs": {
|
|
414
|
+
"tags": [],
|
|
415
|
+
"text": ""
|
|
416
|
+
},
|
|
417
|
+
"attribute": "readonly",
|
|
418
|
+
"reflect": false,
|
|
419
|
+
"defaultValue": "false"
|
|
420
|
+
},
|
|
394
421
|
"currency": {
|
|
395
422
|
"type": "string",
|
|
396
423
|
"mutable": false,
|
|
@@ -414,9 +441,42 @@ export class SmoothlyInput {
|
|
|
414
441
|
"reflect": true
|
|
415
442
|
}
|
|
416
443
|
}; }
|
|
444
|
+
static get states() { return {
|
|
445
|
+
"initialValue": {}
|
|
446
|
+
}; }
|
|
417
447
|
static get events() { return [{
|
|
418
|
-
"method": "
|
|
419
|
-
"name": "
|
|
448
|
+
"method": "smoothlyBlur",
|
|
449
|
+
"name": "smoothlyBlur",
|
|
450
|
+
"bubbles": true,
|
|
451
|
+
"cancelable": true,
|
|
452
|
+
"composed": true,
|
|
453
|
+
"docs": {
|
|
454
|
+
"tags": [],
|
|
455
|
+
"text": ""
|
|
456
|
+
},
|
|
457
|
+
"complexType": {
|
|
458
|
+
"original": "void",
|
|
459
|
+
"resolved": "void",
|
|
460
|
+
"references": {}
|
|
461
|
+
}
|
|
462
|
+
}, {
|
|
463
|
+
"method": "smoothlyChange",
|
|
464
|
+
"name": "smoothlyChange",
|
|
465
|
+
"bubbles": true,
|
|
466
|
+
"cancelable": true,
|
|
467
|
+
"composed": true,
|
|
468
|
+
"docs": {
|
|
469
|
+
"tags": [],
|
|
470
|
+
"text": ""
|
|
471
|
+
},
|
|
472
|
+
"complexType": {
|
|
473
|
+
"original": "{ name: string; value: any }",
|
|
474
|
+
"resolved": "{ name: string; value: any; }",
|
|
475
|
+
"references": {}
|
|
476
|
+
}
|
|
477
|
+
}, {
|
|
478
|
+
"method": "smoothlyInput",
|
|
479
|
+
"name": "smoothlyInput",
|
|
420
480
|
"bubbles": true,
|
|
421
481
|
"cancelable": true,
|
|
422
482
|
"composed": true,
|
|
@@ -11,7 +11,7 @@ export class InputDate {
|
|
|
11
11
|
render() {
|
|
12
12
|
var _a;
|
|
13
13
|
return [
|
|
14
|
-
h("smoothly-input", { onClick: () => (this.open = !this.open), disabled: this.disabled, type: "date", value: this.value,
|
|
14
|
+
h("smoothly-input", { onClick: () => (this.open = !this.open), disabled: this.disabled, type: "date", value: this.value, onSmoothlyInput: e => (this.value = e.detail.value) },
|
|
15
15
|
h("slot", null)),
|
|
16
16
|
this.open && !this.disabled
|
|
17
17
|
? [
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
position: relative;
|
|
3
3
|
}
|
|
4
|
-
|
|
5
4
|
nav {
|
|
6
5
|
position: absolute;
|
|
7
6
|
z-index: 10;
|
|
8
7
|
top: 3.5em;
|
|
9
8
|
background-color: rgb(var(--smoothly-default-shade));
|
|
10
9
|
max-width: 22em;
|
|
11
|
-
}
|
|
10
|
+
}
|
|
12
11
|
:host > div {
|
|
13
12
|
position: fixed;
|
|
14
13
|
top: 0px;
|
|
@@ -22,7 +21,7 @@ nav {
|
|
|
22
21
|
:host > nav > .arrow {
|
|
23
22
|
position: absolute;
|
|
24
23
|
z-index: 9;
|
|
25
|
-
transform: translate(2em,
|
|
24
|
+
transform: translate(2em, -0.55em) rotate(45deg);
|
|
26
25
|
width: 1em;
|
|
27
26
|
height: 1em;
|
|
28
27
|
background-color: rgb(var(--smoothly-default-shade));
|
|
@@ -23,9 +23,9 @@ export class InputDateRange {
|
|
|
23
23
|
var _a;
|
|
24
24
|
return [
|
|
25
25
|
h("section", { onClick: () => (this.open = !this.open) },
|
|
26
|
-
h("smoothly-input", { type: "date", value: this.start, showLabel: this.showLabel,
|
|
26
|
+
h("smoothly-input", { type: "date", value: this.start, showLabel: this.showLabel, onSmoothlyInput: e => (this.start = e.detail.value) }, "from"),
|
|
27
27
|
h("span", null, "\u2013"),
|
|
28
|
-
h("smoothly-input", { type: "date", showLabel: this.showLabel, value: this.end,
|
|
28
|
+
h("smoothly-input", { type: "date", showLabel: this.showLabel, value: this.end, onSmoothlyInput: e => (this.end = e.detail.value) }, "to")),
|
|
29
29
|
this.open ? h("div", { onClick: () => (this.open = false) }) : [],
|
|
30
30
|
this.open ? (h("nav", null,
|
|
31
31
|
h("div", { class: "arrow" }),
|
|
@@ -6,7 +6,8 @@ export class SmoothlyInputDemo {
|
|
|
6
6
|
h("header", null,
|
|
7
7
|
h("h5", null, "Address")),
|
|
8
8
|
h("main", null,
|
|
9
|
-
h("smoothly-input", { type: "text", name: "name" }, "
|
|
9
|
+
h("smoothly-input", { type: "text", name: "name", readonly: true, value: "Readonly", onSmoothlyBlur: () => console.log("smoothly blur") }, "Readonly"),
|
|
10
|
+
h("smoothly-input", { type: "text", name: "name", onSmoothlyChange: e => console.log("smoothly change event") }, "Name"),
|
|
10
11
|
h("smoothly-input", { type: "date", name: "date" }, "Date"),
|
|
11
12
|
h("smoothly-input", { type: "date-time", name: "date-time" }, "Date-Time"),
|
|
12
13
|
h("smoothly-input", { type: "divisor", name: "divisor" }, "Divisor"),
|
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
color: rgb(var(--smoothly-primary-contrast));
|
|
4
4
|
}
|
|
5
5
|
:host {
|
|
6
|
-
padding: .5em;
|
|
6
|
+
padding: 0.5em;
|
|
7
7
|
cursor: pointer;
|
|
8
8
|
background-color: rgb(var(--smoothly-default-shade));
|
|
9
9
|
color: rgb(var(--smoothly-default-contrast));
|
|
10
|
-
border: rgb(var(--smoothly-default-shade) solid 1px)
|
|
10
|
+
border: rgb(var(--smoothly-default-shade) solid 1px);
|
|
11
11
|
}
|
|
12
12
|
:host:hover {
|
|
13
13
|
background-color: rgb(var(--smoothly-primary-color));
|
|
14
14
|
color: rgb(var(--smoothly-primary-contrast));
|
|
15
15
|
}
|
|
16
|
-
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { Component, Element, h, Host, Listen, Method, Prop, State, Watch } from "@stencil/core";
|
|
1
|
+
import { Component, Element, Event, h, Host, Listen, Method, Prop, State, Watch } from "@stencil/core";
|
|
2
2
|
export class SmoothlyMenuOptions {
|
|
3
3
|
constructor() {
|
|
4
4
|
this.filteredOptions = [];
|
|
5
5
|
this.highlightIndex = 0;
|
|
6
6
|
this.emptyMenuLabel = "No Options";
|
|
7
|
+
this.newOptionLabel = "Add:";
|
|
7
8
|
this.order = false;
|
|
8
9
|
this.options = [];
|
|
9
10
|
this.resetHighlightOnOptionsChange = true;
|
|
11
|
+
this.mutable = false;
|
|
10
12
|
}
|
|
11
13
|
optionsChangeHandler(newOptions) {
|
|
12
14
|
this.highlightIndex = this.resetHighlightOnOptionsChange ? 0 : this.highlightIndex;
|
|
@@ -45,6 +47,7 @@ export class SmoothlyMenuOptions {
|
|
|
45
47
|
return result;
|
|
46
48
|
}
|
|
47
49
|
async filterOptions(keyword, excludeValues = []) {
|
|
50
|
+
this.keyword = keyword;
|
|
48
51
|
const keywordLowercase = keyword.toLowerCase();
|
|
49
52
|
this.filteredOptions = [];
|
|
50
53
|
for (const option of this.options) {
|
|
@@ -52,6 +55,7 @@ export class SmoothlyMenuOptions {
|
|
|
52
55
|
const isVisible = names.toLowerCase().includes(keywordLowercase) && !excludeValues.includes(option.value);
|
|
53
56
|
isVisible && this.filteredOptions.push(option);
|
|
54
57
|
}
|
|
58
|
+
this.menuEmpty.emit(!this.filteredOptions.length);
|
|
55
59
|
this.order && this.sortOptions(keyword);
|
|
56
60
|
}
|
|
57
61
|
sortOptions(keyword) {
|
|
@@ -90,7 +94,11 @@ export class SmoothlyMenuOptions {
|
|
|
90
94
|
render() {
|
|
91
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 },
|
|
92
96
|
option.left ? h("div", { slot: "left" }, option.left) : undefined,
|
|
93
|
-
option.right ? h("div", { slot: "right" }, option.right) : undefined)))) : (h("
|
|
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 },
|
|
98
|
+
h("div", { slot: "left" },
|
|
99
|
+
h("smoothly-icon", { name: "square-outline", size: "small" }),
|
|
100
|
+
" ",
|
|
101
|
+
this.newOptionLabel))) : (h("div", null, this.emptyMenuLabel))));
|
|
94
102
|
}
|
|
95
103
|
static get is() { return "smoothly-menu-options"; }
|
|
96
104
|
static get encapsulation() { return "shadow"; }
|
|
@@ -119,6 +127,24 @@ export class SmoothlyMenuOptions {
|
|
|
119
127
|
"reflect": false,
|
|
120
128
|
"defaultValue": "\"No Options\""
|
|
121
129
|
},
|
|
130
|
+
"newOptionLabel": {
|
|
131
|
+
"type": "string",
|
|
132
|
+
"mutable": false,
|
|
133
|
+
"complexType": {
|
|
134
|
+
"original": "string",
|
|
135
|
+
"resolved": "string",
|
|
136
|
+
"references": {}
|
|
137
|
+
},
|
|
138
|
+
"required": false,
|
|
139
|
+
"optional": false,
|
|
140
|
+
"docs": {
|
|
141
|
+
"tags": [],
|
|
142
|
+
"text": ""
|
|
143
|
+
},
|
|
144
|
+
"attribute": "new-option-label",
|
|
145
|
+
"reflect": false,
|
|
146
|
+
"defaultValue": "\"Add:\""
|
|
147
|
+
},
|
|
122
148
|
"maxMenuHeight": {
|
|
123
149
|
"type": "string",
|
|
124
150
|
"mutable": false,
|
|
@@ -209,12 +235,47 @@ export class SmoothlyMenuOptions {
|
|
|
209
235
|
"attribute": "reset-highlight-on-options-change",
|
|
210
236
|
"reflect": false,
|
|
211
237
|
"defaultValue": "true"
|
|
238
|
+
},
|
|
239
|
+
"mutable": {
|
|
240
|
+
"type": "boolean",
|
|
241
|
+
"mutable": false,
|
|
242
|
+
"complexType": {
|
|
243
|
+
"original": "boolean",
|
|
244
|
+
"resolved": "boolean",
|
|
245
|
+
"references": {}
|
|
246
|
+
},
|
|
247
|
+
"required": false,
|
|
248
|
+
"optional": false,
|
|
249
|
+
"docs": {
|
|
250
|
+
"tags": [],
|
|
251
|
+
"text": ""
|
|
252
|
+
},
|
|
253
|
+
"attribute": "mutable",
|
|
254
|
+
"reflect": false,
|
|
255
|
+
"defaultValue": "false"
|
|
212
256
|
}
|
|
213
257
|
}; }
|
|
214
258
|
static get states() { return {
|
|
215
259
|
"filteredOptions": {},
|
|
216
|
-
"highlightIndex": {}
|
|
260
|
+
"highlightIndex": {},
|
|
261
|
+
"keyword": {}
|
|
217
262
|
}; }
|
|
263
|
+
static get events() { return [{
|
|
264
|
+
"method": "menuEmpty",
|
|
265
|
+
"name": "menuEmpty",
|
|
266
|
+
"bubbles": true,
|
|
267
|
+
"cancelable": true,
|
|
268
|
+
"composed": true,
|
|
269
|
+
"docs": {
|
|
270
|
+
"tags": [],
|
|
271
|
+
"text": ""
|
|
272
|
+
},
|
|
273
|
+
"complexType": {
|
|
274
|
+
"original": "boolean",
|
|
275
|
+
"resolved": "boolean",
|
|
276
|
+
"references": {}
|
|
277
|
+
}
|
|
278
|
+
}]; }
|
|
218
279
|
static get methods() { return {
|
|
219
280
|
"moveHighlight": {
|
|
220
281
|
"complexType": {
|
|
@@ -9,7 +9,9 @@ export class SmoothlyOption {
|
|
|
9
9
|
}
|
|
10
10
|
onSelect(event) {
|
|
11
11
|
if (this.value)
|
|
12
|
-
this.
|
|
12
|
+
this.new
|
|
13
|
+
? this.optionAdd.emit({ name: this.name, value: this.value })
|
|
14
|
+
: this.optionSelect.emit({ name: this.name, value: this.value });
|
|
13
15
|
else
|
|
14
16
|
throw `smoothly-option ${this.element.innerHTML} lacks value-property and can therefore not be selected`;
|
|
15
17
|
}
|
|
@@ -114,6 +116,23 @@ export class SmoothlyOption {
|
|
|
114
116
|
"attribute": "divider",
|
|
115
117
|
"reflect": true,
|
|
116
118
|
"defaultValue": "false"
|
|
119
|
+
},
|
|
120
|
+
"new": {
|
|
121
|
+
"type": "boolean",
|
|
122
|
+
"mutable": false,
|
|
123
|
+
"complexType": {
|
|
124
|
+
"original": "boolean",
|
|
125
|
+
"resolved": "boolean | undefined",
|
|
126
|
+
"references": {}
|
|
127
|
+
},
|
|
128
|
+
"required": false,
|
|
129
|
+
"optional": true,
|
|
130
|
+
"docs": {
|
|
131
|
+
"tags": [],
|
|
132
|
+
"text": ""
|
|
133
|
+
},
|
|
134
|
+
"attribute": "new",
|
|
135
|
+
"reflect": false
|
|
117
136
|
}
|
|
118
137
|
}; }
|
|
119
138
|
static get events() { return [{
|
|
@@ -146,6 +165,21 @@ export class SmoothlyOption {
|
|
|
146
165
|
"resolved": "{ value: any; name: string; }",
|
|
147
166
|
"references": {}
|
|
148
167
|
}
|
|
168
|
+
}, {
|
|
169
|
+
"method": "optionAdd",
|
|
170
|
+
"name": "optionAdd",
|
|
171
|
+
"bubbles": true,
|
|
172
|
+
"cancelable": true,
|
|
173
|
+
"composed": true,
|
|
174
|
+
"docs": {
|
|
175
|
+
"tags": [],
|
|
176
|
+
"text": ""
|
|
177
|
+
},
|
|
178
|
+
"complexType": {
|
|
179
|
+
"original": "{ name: string; value: string }",
|
|
180
|
+
"resolved": "{ name: string; value: string; }",
|
|
181
|
+
"references": {}
|
|
182
|
+
}
|
|
149
183
|
}]; }
|
|
150
184
|
static get elementRef() { return "element"; }
|
|
151
185
|
}
|