smoothly 0.1.86 → 0.1.87

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.
Files changed (46) hide show
  1. package/dist/cjs/{generate-a6821b82.js → generate-f9a36f25.js} +1 -1
  2. package/dist/cjs/index-328edd81.js +1599 -0
  3. package/dist/cjs/{index-fc82954f.js → index-ac32385c.js} +230 -184
  4. package/dist/cjs/smoothly-accordion_47.cjs.entry.js +1025 -19098
  5. package/dist/cjs/smoothly-calendar.cjs.entry.js +2 -2
  6. package/dist/cjs/smoothly-display-amount.cjs.entry.js +1 -1
  7. package/dist/cjs/smoothly-display.cjs.entry.js +2 -1
  8. package/dist/cjs/smoothly-input-date-range.cjs.entry.js +1 -1
  9. package/dist/cjs/smoothly-input-date.cjs.entry.js +1 -1
  10. package/dist/cjs/smoothly-input-month.cjs.entry.js +2 -2
  11. package/dist/cjs/smoothly-input.cjs.entry.js +17 -10
  12. package/dist/cjs/smoothly-select-demo.cjs.entry.js +2 -2
  13. package/dist/collection/components/display/index.js +1 -1
  14. package/dist/collection/components/input/index.js +17 -10
  15. package/dist/collection/components/select-demo/index.js +2 -2
  16. package/dist/custom-elements/index.js +1174 -19455
  17. package/dist/{smoothly/generate-776b3b0f.js → esm/generate-50b98474.js} +1 -1
  18. package/dist/esm/index-1be6d668.js +1597 -0
  19. package/dist/{smoothly/index-a28d88cf.js → esm/index-a5a08f46.js} +230 -184
  20. package/dist/esm/smoothly-accordion_47.entry.js +1025 -19098
  21. package/dist/esm/smoothly-calendar.entry.js +2 -2
  22. package/dist/esm/smoothly-display-amount.entry.js +1 -1
  23. package/dist/esm/smoothly-display.entry.js +2 -1
  24. package/dist/esm/smoothly-input-date-range.entry.js +1 -1
  25. package/dist/esm/smoothly-input-date.entry.js +1 -1
  26. package/dist/esm/smoothly-input-month.entry.js +2 -2
  27. package/dist/esm/smoothly-input.entry.js +17 -10
  28. package/dist/esm/smoothly-select-demo.entry.js +2 -2
  29. package/dist/{esm/generate-776b3b0f.js → smoothly/generate-50b98474.js} +1 -1
  30. package/dist/smoothly/index-1be6d668.js +1597 -0
  31. package/dist/{esm/index-a28d88cf.js → smoothly/index-a5a08f46.js} +230 -184
  32. package/dist/smoothly/p-7b43df84.entry.js +1 -0
  33. package/dist/smoothly/smoothly-calendar.entry.js +2 -2
  34. package/dist/smoothly/smoothly-display-amount.entry.js +1 -1
  35. package/dist/smoothly/smoothly-display.entry.js +2 -1
  36. package/dist/smoothly/smoothly-input-date-range.entry.js +1 -1
  37. package/dist/smoothly/smoothly-input-date.entry.js +1 -1
  38. package/dist/smoothly/smoothly-input-month.entry.js +2 -2
  39. package/dist/smoothly/smoothly-input.entry.js +17 -10
  40. package/dist/smoothly/smoothly-select-demo.entry.js +2 -2
  41. package/dist/types/components/input/index.d.ts +1 -0
  42. package/package.json +3 -3
  43. package/dist/cjs/index-42db74b3.js +0 -19931
  44. package/dist/esm/index-36a04e8c.js +0 -19929
  45. package/dist/smoothly/index-36a04e8c.js +0 -19929
  46. package/dist/smoothly/p-375a8d94.entry.js +0 -1
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, i as createEvent, h, j as getElement } from './index-02a70ac1.js';
2
- import { d as dist } from './index-a28d88cf.js';
3
- import { w as weekdays, m as month } from './generate-776b3b0f.js';
2
+ import { d as dist } from './index-a5a08f46.js';
3
+ import { w as weekdays, m as month } from './generate-50b98474.js';
4
4
  import './_commonjsHelpers-8fe71198.js';
5
5
 
6
6
  const styleCss = ".sc-smoothly-calendar-h{display:block;--other-month-opacity:0.5}.sc-smoothly-calendar-h>smoothly-input-month.sc-smoothly-calendar{width:calc(100% - 1em);padding:0.5em 0.5em 0 0.5em}th.sc-smoothly-calendar,td.sc-smoothly-calendar{text-align:center;padding:0.5em;min-width:2em;background-color:rgb(var(--smoothly-default-shade));cursor:pointer;user-select:none}td.currentMonth.sc-smoothly-calendar{color:rgb(var(--smoothly-default-contrast))}td.sc-smoothly-calendar:not(.currentMonth){color:rgba(var(--smoothly-default-contrast), var(--other-month-opacity))}td.sc-smoothly-calendar:nth-child(6):not(.currentMonth).selected,td.sc-smoothly-calendar:nth-child(6):not(.currentMonth).dateRange,td.sc-smoothly-calendar:nth-child(7):not(.currentMonth).selected,td.sc-smoothly-calendar:nth-child(7):not(.currentMonth).dateRange{color:rgba(var(--smoothly-default-contrast))}td.sc-smoothly-calendar:nth-child(6),td.sc-smoothly-calendar:nth-child(7){color:rgb(var(--smoothly-danger-tint))}td.sc-smoothly-calendar:nth-child(6):not(.currentMonth),td.sc-smoothly-calendar:nth-child(7):not(.currentMonth){color:rgba(var(--smoothly-danger-tint), var(--other-month-opacity))}td.sc-smoothly-calendar:not(.selected,.disable).sc-smoothly-calendar:hover{color:rgb(var(--smoothly-primary-contrast));background:rgb(var(--smoothly-primary-tint))}td.selected.sc-smoothly-calendar{color:rgb(var(--smoothly-primary-contrast));background:rgb(var(--smoothly-primary-color))}td.sc-smoothly-calendar:not(.selected,.dateRange).sc-smoothly-calendar:not(:hover).today{background:rgb(var(--smoothly-dark-tint));color:rgb(var(--smoothly-dark-contrast))}td.dateRange.sc-smoothly-calendar{color:rgb(var(--smoothly-primary-contrast));background:rgb(var(--smoothly-primary-tint))}td.disable.sc-smoothly-calendar{cursor:not-allowed;background-color:rgb(var(--smoothly-default-tint), 0.5);color:rgb(var(--smoothly-default-contrast), 0.5)}";
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance } from './index-02a70ac1.js';
2
- import { d as dist } from './index-a28d88cf.js';
2
+ import { d as dist } from './index-a5a08f46.js';
3
3
  import './_commonjsHelpers-8fe71198.js';
4
4
 
5
5
  const styleCss = ".sc-smoothly-display-amount-h{display:block}[hidden].sc-smoothly-display-amount-h{display:none}";
@@ -1,6 +1,7 @@
1
1
  import { r as registerInstance, h } from './index-02a70ac1.js';
2
- import { d as dist } from './index-36a04e8c.js';
2
+ import { d as dist } from './index-1be6d668.js';
3
3
  import './_commonjsHelpers-8fe71198.js';
4
+ import './index-a5a08f46.js';
4
5
 
5
6
  const styleCss = ".sc-smoothly-display-h{display:block}[hidden].sc-smoothly-display-h{display:none}";
6
7
 
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, i as createEvent, h } from './index-02a70ac1.js';
2
- import { d as dist } from './index-a28d88cf.js';
2
+ import { d as dist } from './index-a5a08f46.js';
3
3
  import './_commonjsHelpers-8fe71198.js';
4
4
 
5
5
  const styleCss = ".sc-smoothly-input-date-range-h{position:relative;display:block}.sc-smoothly-input-date-range-h>nav.sc-smoothly-input-date-range{position:absolute;z-index:10;top:3.5em;background-color:rgb(var(--smoothly-default-shade));max-width:22em}.sc-smoothly-input-date-range-h>div.sc-smoothly-input-date-range{position:fixed;top:0px;left:0px;right:0px;bottom:0px;width:100vw;height:100vh;z-index:2}.sc-smoothly-input-date-range-h>nav.sc-smoothly-input-date-range>.arrow.sc-smoothly-input-date-range{position:absolute;z-index:9;transform:translate(10em, -.55em) rotate(45deg);width:1em;height:1em;background-color:rgb(var(--smoothly-default-shade))}.sc-smoothly-input-date-range-h>section.sc-smoothly-input-date-range{display:flex;flex-direction:row;align-items:center}.sc-smoothly-input-date-range-h>smoothly-input.sc-smoothly-input-date-range{padding:0}";
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, i as createEvent, h } from './index-02a70ac1.js';
2
- import { d as dist } from './index-a28d88cf.js';
2
+ import { d as dist } from './index-a5a08f46.js';
3
3
  import './_commonjsHelpers-8fe71198.js';
4
4
 
5
5
  const styleCss = ".sc-smoothly-input-date-h{position:relative}nav.sc-smoothly-input-date{position:absolute;z-index:10;top:3.5em;background-color:rgb(var(--smoothly-default-shade));max-width:22em}.sc-smoothly-input-date-h>div.sc-smoothly-input-date{position:fixed;top:0px;left:0px;right:0px;bottom:0px;width:100vw;height:100vh;z-index:2}.sc-smoothly-input-date-h>nav.sc-smoothly-input-date>.arrow.sc-smoothly-input-date{position:absolute;z-index:9;transform:translate(2em, -.55em) rotate(45deg);width:1em;height:1em;background-color:rgb(var(--smoothly-default-shade))}";
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, i as createEvent, h } from './index-02a70ac1.js';
2
- import { d as dist } from './index-a28d88cf.js';
3
- import { y as years, a as months } from './generate-776b3b0f.js';
2
+ import { d as dist } from './index-a5a08f46.js';
3
+ import { y as years, a as months } from './generate-50b98474.js';
4
4
  import './_commonjsHelpers-8fe71198.js';
5
5
 
6
6
  const styleCss = ".sc-smoothly-input-month-h{display:flex;justify-content:space-between;font-size:large}smoothly-icon.sc-smoothly-input-month{font-size:smaller}";
@@ -1,5 +1,6 @@
1
1
  import { r as registerInstance, i as createEvent, h, k as Host } from './index-02a70ac1.js';
2
- import { d as dist } from './index-36a04e8c.js';
2
+ import { d as dist$1 } from './index-a5a08f46.js';
3
+ import { d as dist } from './index-1be6d668.js';
3
4
  import './_commonjsHelpers-8fe71198.js';
4
5
 
5
6
  const styleCss = ".sc-smoothly-input-h{display:block;position:relative}[hidden].sc-smoothly-input-h{display:none}label.sc-smoothly-input{position:absolute;left:0.4em;top:0.6em;color:rgb(var(--smoothly-text-tint));opacity:0.8;user-select:none;cursor:inherit;transition:font-size 0.1s;transition-timing-function:ease}input.sc-smoothly-input{padding:1em 0.2em 0.2em 0.2em;width:calc(100% - 0.4em);background:none;border:0;z-index:1;position:relative;font-size:1rem;font-family:var(--smoothly-font-family)}smoothly-icon.sc-smoothly-input{display:none;position:absolute;right:0.2em;top:0.6em}input.sc-smoothly-input:invalid+smoothly-icon.sc-smoothly-input{display:block}.has-value.sc-smoothly-input-h>label.sc-smoothly-input{top:0.3em;top:0.4em;font-size:60%;z-index:0}.sc-smoothly-input-h:focus-within>label.sc-smoothly-input{top:0.3em;top:0.4em;font-size:60%;z-index:0}input.sc-smoothly-input:focus{outline:none}input.sc-smoothly-input:-webkit-autofill,input.sc-smoothly-input:-webkit-autofill:hover,input.sc-smoothly-input:-webkit-autofill:focus,input.sc-smoothly-input:-webkit-autofill:active{box-shadow:0 0 0 30px unset inset !important;-webkit-box-shadow:0 0 0 30px unset inset !important}input.sc-smoothly-input:-webkit-autofill{-webkit-text-fill-color:unset !important}input.sc-smoothly-input:-internal-autofill-previewed,input.sc-smoothly-input:-internal-autofill-selected,textarea.sc-smoothly-input:-internal-autofill-previewed,textarea.sc-smoothly-input:-internal-autofill-selected,select.sc-smoothly-input:-internal-autofill-previewed,select.sc-smoothly-input:-internal-autofill-selected{background-color:none !important;background-image:none !important;color:unset !important}";
@@ -23,27 +24,30 @@ let SmoothlyInput = class {
23
24
  result = dist.get("price", this.currency);
24
25
  break;
25
26
  default:
26
- result = dist.get(this.type);
27
+ result = dist.get(this.type, getLocale());
27
28
  break;
28
29
  }
29
30
  return result || dist.get("text");
30
31
  }
32
+ newState(state) {
33
+ const formatter = this.formatter;
34
+ return formatter.format(dist.StateEditor.copy(formatter.unformat(dist.StateEditor.copy(state))));
35
+ }
31
36
  valueWatcher(value, before) {
32
37
  if (this.lastValue != value) {
33
38
  this.lastValue = value;
34
- this.state = Object.assign(Object.assign({}, this.state), { value: this.formatter.format(dist.StateEditor.copy(this.formatter.unformat(dist.StateEditor.copy({ value, selection: this.state.selection })))).value });
39
+ this.state = Object.assign(Object.assign({}, this.state), { value: this.newState({ value: this.formatter.toString(value), selection: this.state.selection }).value });
35
40
  }
36
41
  if (value != before)
37
42
  this.smoothlyChanged.emit({ name: this.name, value });
38
43
  }
39
44
  componentWillLoad() {
40
- const formatter = this.formatter;
41
- const value = formatter.toString(this.value) || "";
45
+ const value = this.formatter.toString(this.value) || "";
42
46
  const start = value.length;
43
- this.state = formatter.format(dist.StateEditor.copy(formatter.unformat(dist.StateEditor.copy({
47
+ this.state = this.newState({
44
48
  value,
45
49
  selection: { start, end: start, direction: "none" },
46
- }))));
50
+ });
47
51
  }
48
52
  componentDidRender() {
49
53
  if (this.keepFocusOnReRender) {
@@ -55,8 +59,7 @@ let SmoothlyInput = class {
55
59
  this.keepFocusOnReRender = keepFocus;
56
60
  }
57
61
  async setSelectionRange(start, end, direction) {
58
- const formatter = this.formatter;
59
- this.state = formatter.format(dist.StateEditor.copy(formatter.unformat(dist.StateEditor.copy(Object.assign(Object.assign({}, this.state), { selection: { start, end, direction: direction != undefined ? direction : this.state.selection.direction } })))));
62
+ this.state = this.newState(Object.assign(Object.assign({}, this.state), { selection: { start, end, direction: direction != undefined ? direction : this.state.selection.direction } }));
60
63
  const after = this.formatter.format(dist.StateEditor.copy(this.formatter.unformat(dist.StateEditor.copy(Object.assign({}, this.state)))));
61
64
  this.updateBackend(after, this.inputElement);
62
65
  }
@@ -73,7 +76,7 @@ let SmoothlyInput = class {
73
76
  end: backend.selectionEnd != undefined ? backend.selectionEnd : backend.value.length,
74
77
  direction: backend.selectionDirection ? backend.selectionDirection : "none",
75
78
  } });
76
- const after = this.formatter.format(dist.StateEditor.copy(this.formatter.unformat(dist.StateEditor.copy(Object.assign({}, this.state)))));
79
+ const after = this.newState(Object.assign({}, this.state));
77
80
  this.updateBackend(after, backend);
78
81
  }
79
82
  onKeyDown(event) {
@@ -159,6 +162,10 @@ let SmoothlyInput = class {
159
162
  "value": ["valueWatcher"]
160
163
  }; }
161
164
  };
165
+ function getLocale() {
166
+ const result = navigator.language;
167
+ return dist$1.Locale.is(result) ? result : dist$1.Language.is(result) ? dist$1.Locale.toLocale(result) : undefined;
168
+ }
162
169
  SmoothlyInput.style = styleCss;
163
170
 
164
171
  export { SmoothlyInput as smoothly_input };
@@ -21,8 +21,8 @@ let SmoothlySelectDemo = class {
21
21
  h("smoothly-select", { identifier: "currency" }, this.currencies.map(option => this.currency == option ? (h("option", { value: option, selected: true }, option)) : (h("option", { value: option }, option)))),
22
22
  h("smoothly-select", { identifier: "language" }, h("optgroup", { label: "Nordic" }, h("option", { value: "sv" }, "Swedish"), h("option", { value: "da", selected: true }, "Danish"), h("option", { value: "no" }, "Norwegian")), h("optgroup", { label: "Other" }, h("option", { value: "en" }, "English"))),
23
23
  h("smoothly-select", { identifier: "quantity", ref: e => (this.quantityElement = e) }, h("option", { value: "1" }, "1"), h("option", { value: "2" }, "2"), h("option", { value: "3" }, "3")),
24
- h("smoothly-input-date", { max: "2021-12-30", min: "2021-10-10" }, "Date"),
25
- h("smoothly-input-date-range", { max: "2021-12-30", min: "2021-10-10" }),
24
+ h("smoothly-input-date", { value: "2021-10-28", max: "2021-12-30", min: "2021-10-10" }, "Date"),
25
+ h("smoothly-input-date-range", { start: "2021-10-28", end: "2021-11-27", min: "2021-10-10", max: "2021-12-30" }),
26
26
  h("smoothly-selector", null, h("smoothly-item", { value: "1" }, "January"), h("smoothly-item", { value: "2" }, "February"), h("smoothly-item", { value: "3" }, "March"), h("smoothly-item", { value: "4" }, "April"), h("smoothly-item", { value: "5" }, "May"), h("smoothly-item", { value: "6" }, "June"), h("smoothly-item", { value: "7" }, "July"), h("smoothly-item", { value: "8" }, "August"), h("smoothly-item", { value: "9" }, "September"), h("smoothly-item", { value: "10" }, "October"), h("smoothly-item", { value: "11" }, "November"), h("smoothly-item", { value: "12" }, "December")),
27
27
  h("button", { onClick: () => this.alertf() }, "press here"),
28
28
  h("smoothly-picker", { label: "Filter", "empty-menu-label": "Sorry, we're out of options.", "max-height": "58px", multiple: true, options: [
@@ -18,6 +18,7 @@ export declare class SmoothlyInput {
18
18
  disabled: boolean;
19
19
  currency?: Currency;
20
20
  get formatter(): Formatter & Converter<any>;
21
+ private newState;
21
22
  smoothlyChanged: EventEmitter<{
22
23
  name: string;
23
24
  value: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smoothly",
3
- "version": "0.1.86",
3
+ "version": "0.1.87",
4
4
  "description": "Web component library written in Stencil.",
5
5
  "author": "PayFunc",
6
6
  "license": "MIT",
@@ -62,11 +62,11 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "authly": "0.2.8",
65
- "isoly": "0.0.36",
65
+ "isoly": "0.0.39",
66
66
  "langly": "0.0.14",
67
67
  "normalize.css": "^8.0.1",
68
68
  "stencil-router-v2": "^0.6.0",
69
- "tidily": "0.0.46"
69
+ "tidily": "0.0.47"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@stencil/core": "^2.10.0",