smoothly 1.0.1-alpha.8 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/smoothly-app_81.cjs.entry.js +94 -23
  3. package/dist/cjs/smoothly-app_81.cjs.entry.js.map +1 -1
  4. package/dist/cjs/smoothly.cjs.js +1 -1
  5. package/dist/collection/components/form/index.js +27 -2
  6. package/dist/collection/components/form/index.js.map +1 -1
  7. package/dist/collection/components/input/Editable.js +4 -0
  8. package/dist/collection/components/input/Editable.js.map +1 -1
  9. package/dist/collection/components/input/Input.js +2 -0
  10. package/dist/collection/components/input/Input.js.map +1 -1
  11. package/dist/collection/components/input/date/index.js +21 -1
  12. package/dist/collection/components/input/date/index.js.map +1 -1
  13. package/dist/collection/components/input/date/range/index.js +21 -1
  14. package/dist/collection/components/input/date/range/index.js.map +1 -1
  15. package/dist/collection/components/input/demo/index.js +1 -1
  16. package/dist/collection/components/input/demo/index.js.map +1 -1
  17. package/dist/collection/components/input/file/index.js +223 -33
  18. package/dist/collection/components/input/file/index.js.map +1 -1
  19. package/dist/collection/components/input/file/style.css +10 -15
  20. package/dist/collection/model/index.js.map +1 -1
  21. package/dist/collection/smoothly.js.map +1 -1
  22. package/dist/custom-elements/index.js +95 -24
  23. package/dist/custom-elements/index.js.map +1 -1
  24. package/dist/esm/loader.js +1 -1
  25. package/dist/esm/smoothly-app_81.entry.js +94 -23
  26. package/dist/esm/smoothly-app_81.entry.js.map +1 -1
  27. package/dist/esm/smoothly.js +1 -1
  28. package/dist/smoothly/p-7f49e208.entry.js +2 -0
  29. package/dist/smoothly/p-7f49e208.entry.js.map +1 -0
  30. package/dist/smoothly/smoothly.esm.js +1 -1
  31. package/dist/smoothly/smoothly.esm.js.map +1 -1
  32. package/dist/types/components/form/index.d.ts +5 -2
  33. package/dist/types/components/input/Editable.d.ts +4 -0
  34. package/dist/types/components/input/Input.d.ts +3 -0
  35. package/dist/types/components/input/date/index.d.ts +3 -2
  36. package/dist/types/components/input/date/range/index.d.ts +3 -2
  37. package/dist/types/components/input/file/index.d.ts +27 -8
  38. package/dist/types/components.d.ts +15 -2
  39. package/dist/types/model/index.d.ts +1 -1
  40. package/dist/types/smoothly.d.ts +1 -1
  41. package/package.json +1 -1
  42. package/dist/smoothly/p-22644183.entry.js +0 -2
  43. package/dist/smoothly/p-22644183.entry.js.map +0 -1
@@ -33377,11 +33377,15 @@ var Editable;
33377
33377
  reset: islyFunction(),
33378
33378
  setInitialValue: islyFunction(),
33379
33379
  });
33380
+ Element.is = Element.type.is;
33380
33381
  })(Element = Editable.Element || (Editable.Element = {}));
33382
+ const EventEmitter = object({ emit: islyFunction() });
33381
33383
  Editable.type = Element.type.extend({
33382
33384
  changed: boolean(),
33383
33385
  value: any().optional(),
33386
+ smoothlyFormDisable: EventEmitter,
33384
33387
  });
33388
+ Editable.is = Editable.type.is;
33385
33389
  })(Editable || (Editable = {}));
33386
33390
 
33387
33391
  var Looks;
@@ -33400,11 +33404,13 @@ var Input;
33400
33404
  color: Color$1.type.optional(),
33401
33405
  name: string(),
33402
33406
  looks: Looks.type,
33407
+ binary: islyFunction().optional(),
33403
33408
  });
33404
33409
  Element.is = Element.type.is;
33405
33410
  })(Element = Input.Element || (Input.Element = {}));
33406
33411
  const EventEmitter = object({ emit: islyFunction() });
33407
33412
  Input.type = Element.type.extend({
33413
+ smoothlyInputLoad: EventEmitter,
33408
33414
  smoothlyInput: EventEmitter,
33409
33415
  smoothlyInputForm: EventEmitter.optional(),
33410
33416
  });
@@ -33417,12 +33423,14 @@ const SmoothlyForm$1 = class extends HTMLElement {
33417
33423
  constructor() {
33418
33424
  super();
33419
33425
  this.__registerHost();
33426
+ this.smoothlyFormDisable = createEvent(this, "smoothlyFormDisable", 7);
33420
33427
  this.smoothlyFormInput = createEvent(this, "smoothlyFormInput", 7);
33421
33428
  this.smoothlyFormSubmit = createEvent(this, "smoothlyFormSubmit", 7);
33422
33429
  this.smoothlyFormReset = createEvent(this, "smoothlyFormReset", 7);
33423
33430
  this.smoothlyFormEdit = createEvent(this, "smoothlyFormEdit", 7);
33424
33431
  this.smoothlyFormClear = createEvent(this, "smoothlyFormClear", 7);
33425
33432
  this.notice = createEvent(this, "notice", 7);
33433
+ this.contentType = "json";
33426
33434
  this.inputs = new Map();
33427
33435
  this.readonlyAtLoad = this.readonly;
33428
33436
  this.listeners = {};
@@ -33437,6 +33445,9 @@ const SmoothlyForm$1 = class extends HTMLElement {
33437
33445
  this.changed = false;
33438
33446
  this.processing = undefined;
33439
33447
  }
33448
+ componentWillLoad() {
33449
+ !this.readonly && this.smoothlyFormDisable.emit(readonly => (this.readonly = readonly));
33450
+ }
33440
33451
  async listen(property, listener) {
33441
33452
  var _a;
33442
33453
  var _b;
@@ -33466,9 +33477,12 @@ const SmoothlyForm$1 = class extends HTMLElement {
33466
33477
  this.action && event.stopPropagation();
33467
33478
  }
33468
33479
  async smoothlyInputLoadHandler(event) {
33480
+ var _a, _b;
33469
33481
  event.stopPropagation();
33470
33482
  event.detail(this);
33471
33483
  if (Input.Element.is(event.target)) {
33484
+ if (await ((_b = (_a = event.target).binary) === null || _b === void 0 ? void 0 : _b.call(_a)))
33485
+ this.contentType = "form-data";
33472
33486
  this.value = Data.merge(this.value, { [event.target.name]: event.target.value });
33473
33487
  this.inputs.set(event.target.name, event.target);
33474
33488
  }
@@ -33494,7 +33508,10 @@ const SmoothlyForm$1 = class extends HTMLElement {
33494
33508
  : "GET";
33495
33509
  const response = await fetch(Request.create(method == "GET"
33496
33510
  ? { method, url: `${action}?${stringify(this.value)}` }
33497
- : Object.assign({ method, url: action }, (this.value && { header: { contentType: "application/json" }, body: this.value }))))
33511
+ : Object.assign({ method, url: action }, (this.value && {
33512
+ header: { contentType: this.contentType ? "multipart/form-data" : "application/json" },
33513
+ body: this.value,
33514
+ }))))
33498
33515
  .catch(() => undefined);
33499
33516
  const result = !response || (response === null || response === void 0 ? void 0 : response.status) < 200 || response.status >= 300
33500
33517
  ? [false, "Failed to submit form."]
@@ -34599,6 +34616,7 @@ const InputDate = class extends HTMLElement {
34599
34616
  constructor() {
34600
34617
  super();
34601
34618
  this.__registerHost();
34619
+ this.smoothlyInputLoad = createEvent(this, "smoothlyInputLoad", 7);
34602
34620
  this.smoothlyValueChange = createEvent(this, "smoothlyValueChange", 7);
34603
34621
  this.smoothlyInput = createEvent(this, "smoothlyInput", 7);
34604
34622
  this.smoothlyInputLooks = createEvent(this, "smoothlyInputLooks", 7);
@@ -34613,6 +34631,7 @@ const InputDate = class extends HTMLElement {
34613
34631
  this.disabled = undefined;
34614
34632
  }
34615
34633
  componentWillLoad() {
34634
+ this.smoothlyInputLoad.emit(() => { });
34616
34635
  this.smoothlyInputLooks.emit((looks, color) => ((this.looks = looks), !this.color && (this.color = color)));
34617
34636
  }
34618
34637
  async clear() {
@@ -34662,6 +34681,7 @@ const InputDateRange = class extends HTMLElement {
34662
34681
  constructor() {
34663
34682
  super();
34664
34683
  this.__registerHost();
34684
+ this.smoothlyInputLoad = createEvent(this, "smoothlyInputLoad", 7);
34665
34685
  this.smoothlyValueChange = createEvent(this, "smoothlyValueChange", 7);
34666
34686
  this.smoothlyInput = createEvent(this, "smoothlyInput", 7);
34667
34687
  this.smoothlyInputLooks = createEvent(this, "smoothlyInputLooks", 7);
@@ -34683,6 +34703,7 @@ const InputDateRange = class extends HTMLElement {
34683
34703
  this.end = undefined;
34684
34704
  }
34685
34705
  componentWillLoad() {
34706
+ this.smoothlyInputLoad.emit(() => { });
34686
34707
  this.smoothlyInputLooks.emit((looks, color) => ((this.looks = looks), !this.color && (this.color = color)));
34687
34708
  if (this.start && this.end)
34688
34709
  this.smoothlyInput.emit({ [this.name]: { start: this.start, end: this.end } });
@@ -34732,7 +34753,7 @@ const SmoothlyInputDemo$1 = class extends HTMLElement {
34732
34753
  this.duration = { hours: 8 };
34733
34754
  }
34734
34755
  render() {
34735
- return (h(Host, null, h("h2", null, "Controlled form"), h("smoothly-input-demo-controlled-form", null), h("h2", null, "Create form defaulting type"), h("smoothly-form", { looks: "line", action: "https://api.toiletapi.com/6b12fd2f-e896-46f9-b38f-25cf42cee4b4" }, h("smoothly-input", { type: "text", name: "name" }, "Name"), h("smoothly-input-reset", { slot: "reset", type: "form", size: "icon", color: "warning", fill: "default" }), h("smoothly-input-submit", { slot: "submit", size: "icon", color: "success" })), h("h2", null, "Select"), h("div", { class: "select-div" }, h("smoothly-input-select", { name: "select-dessert", looks: "border", onSmoothlyInput: e => console.log(e.detail) }, h("label", { slot: "label" }, "Select with clear button"), h("smoothly-item", { value: "1" }, "Ice cream"), h("smoothly-item", { value: "2" }, "Sponge cake"), h("smoothly-item", { value: "3" }, "Cookie"), h("smoothly-item", { value: "4" }, "Croissant"), h("smoothly-item", { value: "5" }, "Chocolate fondue"), h("smoothly-input-clear", { size: "icon", slot: "end" }, h("smoothly-icon", { name: "close" }))), h("smoothly-input-select", { multiple: true, name: "select-dessert-multiple", looks: "border", onSmoothlyInput: e => console.log(e.detail) }, h("label", { slot: "label" }, "Select multiple with reset button"), h("smoothly-item", { value: "ice cream" }, "Ice cream"), h("smoothly-item", { value: "sponge cake" }, "Sponge cake"), h("smoothly-item", { selected: true, value: "cookie" }, "Cookie"), h("smoothly-item", { value: "croissant" }, "Croissant"), h("smoothly-item", { selected: true, value: "chocolate fondue" }, "Chocolate fondue"), h("smoothly-input-reset", { size: "icon", slot: "end" }, h("smoothly-icon", { name: "refresh-outline" }))), h("smoothly-input-select", { name: "select-icon", clearable: false, showSelected: false, onSmoothlyInput: e => console.log("Form Readonly", e.detail) }, h("smoothly-item", { value: "folder", selected: true }, h("smoothly-icon", { size: "small", name: "folder-outline" })), h("smoothly-item", { value: "camera" }, h("smoothly-icon", { size: "small", name: "camera-outline" })))), h("h2", null, "Delayed"), h("smoothly-input", { name: "Delayed", delay: 2 }, "Delayed"), h("h2", null, "Editable form and Input with Clear and Reset - Readonly"), h("smoothly-form", { looks: "grid", readonly: true, action: "https://api.toiletapi.com/6b12fd2f-e896-46f9-b38f-25cf42cee4b4" }, h("smoothly-input", { readonly: true, name: "First Name", value: "John" }, "First name"), h("smoothly-input", { name: "Last name", value: "Doe" }, "Last name", h("smoothly-input-clear", { size: "icon", slot: "end" }, h("smoothly-icon", { name: "close" }))), h("smoothly-input", { type: "phone", name: "Phone", value: "777888999" }, "Phone", h("smoothly-input-reset", { size: "icon", slot: "end" }, h("smoothly-icon", { name: "refresh-outline" }))), h("smoothly-input-radio", { clearable: true, name: "radioFirstInput" }, h("p", { slot: "label" }, "Clearable"), h("smoothly-input-radio-item", { slot: "options", value: "first" }, "Label 1"), h("smoothly-input-radio-item", { selected: true, slot: "options", value: "second" }, "Label 2"), h("smoothly-input-radio-item", { slot: "options", value: "third" }, "Label 3")), h("smoothly-input-select", { menuHeight: "7.5items", placeholder: "Select...", multiple: true, name: "select-month" }, h("label", { slot: "label" }, "Month"), 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"), h("smoothly-input-clear", { size: "icon", slot: "end" }, h("smoothly-icon", { name: "close" }))), h("smoothly-input-select", { name: "select-icon", clearable: false, showSelected: false }, h("smoothly-item", { value: "folder", selected: true }, h("smoothly-icon", { size: "small", name: "folder-outline" })), h("smoothly-item", { value: "camera" }, h("smoothly-icon", { size: "small", name: "camera-outline" }))), h("smoothly-input-checkbox", { name: "checkbox" }, "Check the box"), h("smoothly-input-checkbox", { name: "checkbox2", checked: true }, "Check the box 2"), h("smoothly-input-range", { step: 1, name: "range3", value: 20000 }, "Select"), h("smoothly-picker", { multiple: true, name: "animals" }, h("span", { slot: "label" }, "Animals"), h("span", { slot: "search" }, "Search"), h("smoothly-picker-option", { selected: true, value: "cat" }, "Cat"), h("smoothly-picker-option", { value: "dog" }, "Dog"), h("smoothly-picker-option", { value: "fish" }, "Fish")), h("smoothly-input-edit", { fill: "default", type: "button", color: "tertiary", slot: "edit", size: "icon", shape: "rounded" }), h("smoothly-input-reset", { fill: "default", type: "form", color: "warning", slot: "reset", size: "icon", shape: "rounded" }), h("smoothly-input-submit", { delete: true, slot: "clear", color: "danger", size: "icon", shape: "rounded" }), h("smoothly-input-submit", { fill: "default", type: "button", color: "success", slot: "submit", size: "icon", shape: "rounded" }, h("smoothly-icon", { name: "checkmark-outline", fill: "solid", size: "tiny" }))), h("h2", null, "Editable form and Input with Clear and Reset - Editable"), h("smoothly-form", { looks: "grid", type: "create", action: "https://api.toiletapi.com/upload/6b12fd2f-e896-46f9-b38f-25cf42cee4b4" }, h("smoothly-input", { readonly: true, name: "First Name", value: "John" }, "First name"), h("smoothly-input", { name: "Last name", value: "Doe" }, "Last name", h("smoothly-input-clear", { size: "icon", slot: "end" }, h("smoothly-icon", { name: "close" }))), h("smoothly-input", { type: "phone", name: "Phone", value: "777888999" }, "Phone", h("smoothly-input-reset", { size: "icon", slot: "end" }, h("smoothly-icon", { name: "refresh-outline" }))), h("smoothly-input-radio", { clearable: true, name: "radioFirstInput" }, h("p", { slot: "label" }, "Clearable"), h("smoothly-input-radio-item", { slot: "options", value: "first" }, "Label 1"), h("smoothly-input-radio-item", { selected: true, slot: "options", value: "second" }, "Label 2"), h("smoothly-input-radio-item", { slot: "options", value: "third" }, "Label 3")), h("smoothly-input-select", { multiple: true, menuHeight: "7.5items", placeholder: "Select...", name: "select-month" }, h("label", { slot: "label" }, "Month multiple select"), 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")), h("smoothly-input-select", { name: "select-icon", clearable: false, showSelected: false }, h("smoothly-item", { value: "folder", selected: true }, h("smoothly-icon", { size: "small", name: "folder-outline" })), h("smoothly-item", { value: "camera" }, h("smoothly-icon", { size: "small", name: "camera-outline" }))), h("smoothly-input-checkbox", { name: "checkbox" }, "Check the box"), h("smoothly-input-checkbox", { name: "checkbox2", checked: true }, "Check the box 2"), h("smoothly-input-range", { step: 1, name: "range3", value: 20000 }, "Select"), h("smoothly-picker", { multiple: true, name: "animals" }, h("span", { slot: "label" }, "Animals"), h("span", { slot: "search" }, "Search"), h("smoothly-picker-option", { selected: true, value: "cat" }, "Cat"), h("smoothly-picker-option", { value: "dog" }, "Dog"), h("smoothly-picker-option", { value: "fish" }, "Fish")), h("smoothly-input-edit", { fill: "default", type: "button", color: "tertiary", slot: "edit", size: "icon", shape: "rounded" }), h("smoothly-input-reset", { fill: "default", type: "form", color: "warning", slot: "reset", size: "icon", shape: "rounded" }), h("smoothly-input-submit", { delete: true, slot: "clear", color: "danger", size: "icon", shape: "rounded" }), h("smoothly-input-submit", { fill: "default", type: "button", color: "success", slot: "submit", size: "icon", shape: "rounded" }, h("smoothly-icon", { name: "checkmark-outline", fill: "solid", size: "tiny" }))), h("h2", null, "Color"), h("smoothly-form", { looks: "border" }, h("smoothly-input-color", { name: "color" })), h("h2", null, "Range"), h("smoothly-form", { looks: "border" }, h("smoothly-input-range", { step: 1, name: "range", outputSide: "right" }, "Select and so"), h("smoothly-input-range", { step: 1, name: "range2" }, "Select with really really long label", h("smoothly-icon", { name: "checkmark-circle", slot: "start" }), h("smoothly-input-clear", { size: "icon", slot: "end" }, h("smoothly-icon", { name: "close" }))), h("smoothly-input-range", { step: 1, name: "range3" }, "Select")), h("h2", null, "Duration"), h("smoothly-form", { looks: "border" }, h("smoothly-input", { name: "duration", type: "duration", placeholder: "hh:mm", value: this.duration, onSmoothlyInput: e => {
34756
+ return (h(Host, null, h("h2", null, "Controlled form"), h("smoothly-input-demo-controlled-form", null), h("h2", null, "Create form defaulting type"), h("smoothly-form", { looks: "line", action: "https://api.toiletapi.com/6b12fd2f-e896-46f9-b38f-25cf42cee4b4" }, h("smoothly-input", { type: "text", name: "name" }, "Name"), h("smoothly-input-reset", { slot: "reset", type: "form", size: "icon", color: "warning", fill: "default" }), h("smoothly-input-submit", { slot: "submit", size: "icon", color: "success" })), h("h2", null, "Select"), h("div", { class: "select-div" }, h("smoothly-input-select", { name: "select-dessert", looks: "border", onSmoothlyInput: e => console.log(e.detail) }, h("label", { slot: "label" }, "Select with clear button"), h("smoothly-item", { value: "1" }, "Ice cream"), h("smoothly-item", { value: "2" }, "Sponge cake"), h("smoothly-item", { value: "3" }, "Cookie"), h("smoothly-item", { value: "4" }, "Croissant"), h("smoothly-item", { value: "5" }, "Chocolate fondue"), h("smoothly-input-clear", { size: "icon", slot: "end" }, h("smoothly-icon", { name: "close" }))), h("smoothly-input-select", { multiple: true, name: "select-dessert-multiple", looks: "border", onSmoothlyInput: e => console.log(e.detail) }, h("label", { slot: "label" }, "Select multiple with reset button"), h("smoothly-item", { value: "ice cream" }, "Ice cream"), h("smoothly-item", { value: "sponge cake" }, "Sponge cake"), h("smoothly-item", { selected: true, value: "cookie" }, "Cookie"), h("smoothly-item", { value: "croissant" }, "Croissant"), h("smoothly-item", { selected: true, value: "chocolate fondue" }, "Chocolate fondue"), h("smoothly-input-reset", { size: "icon", slot: "end" }, h("smoothly-icon", { name: "refresh-outline" }))), h("smoothly-input-select", { name: "select-icon", clearable: false, showSelected: false, onSmoothlyInput: e => console.log("Form Readonly", e.detail) }, h("smoothly-item", { value: "folder", selected: true }, h("smoothly-icon", { size: "small", name: "folder-outline" })), h("smoothly-item", { value: "camera" }, h("smoothly-icon", { size: "small", name: "camera-outline" })))), h("h2", null, "Delayed"), h("smoothly-input", { name: "Delayed", delay: 2 }, "Delayed"), h("h2", null, "Editable form and Input with Clear and Reset - Readonly"), h("smoothly-form", { looks: "grid", readonly: true, action: "https://api.toiletapi.com/6b12fd2f-e896-46f9-b38f-25cf42cee4b4" }, h("smoothly-input", { readonly: true, name: "First Name", value: "John" }, "First name"), h("smoothly-input", { name: "Last name", value: "Doe" }, "Last name", h("smoothly-input-clear", { size: "icon", slot: "end" }, h("smoothly-icon", { name: "close" }))), h("smoothly-input", { type: "phone", name: "Phone", value: "777888999" }, "Phone", h("smoothly-input-reset", { size: "icon", slot: "end" }, h("smoothly-icon", { name: "refresh-outline" }))), h("smoothly-input-radio", { clearable: true, name: "radioFirstInput" }, h("p", { slot: "label" }, "Clearable"), h("smoothly-input-radio-item", { slot: "options", value: "first" }, "Label 1"), h("smoothly-input-radio-item", { selected: true, slot: "options", value: "second" }, "Label 2"), h("smoothly-input-radio-item", { slot: "options", value: "third" }, "Label 3")), h("smoothly-input-select", { menuHeight: "7.5items", placeholder: "Select...", multiple: true, name: "select-month" }, h("label", { slot: "label" }, "Month"), 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"), h("smoothly-input-clear", { size: "icon", slot: "end" }, h("smoothly-icon", { name: "close" }))), h("smoothly-input-select", { name: "select-icon", clearable: false, showSelected: false }, h("smoothly-item", { value: "folder", selected: true }, h("smoothly-icon", { size: "small", name: "folder-outline" })), h("smoothly-item", { value: "camera" }, h("smoothly-icon", { size: "small", name: "camera-outline" }))), h("smoothly-input-checkbox", { name: "checkbox" }, "Check the box"), h("smoothly-input-checkbox", { name: "checkbox2", checked: true }, "Check the box 2"), h("smoothly-input-range", { step: 1, name: "range3", value: 20000 }, "Select"), h("smoothly-picker", { multiple: true, name: "animals" }, h("span", { slot: "label" }, "Animals"), h("span", { slot: "search" }, "Search"), h("smoothly-picker-option", { selected: true, value: "cat" }, "Cat"), h("smoothly-picker-option", { value: "dog" }, "Dog"), h("smoothly-picker-option", { value: "fish" }, "Fish")), h("smoothly-input-file", { name: "profile", placeholder: "Click or drag your profile picture here..." }, h("span", { slot: "label" }, "Profile"), h("smoothly-icon", { slot: "button", name: "person-circle-outline", size: "tiny", fill: "default" })), h("smoothly-input-edit", { fill: "default", type: "button", color: "tertiary", slot: "edit", size: "icon", shape: "rounded" }), h("smoothly-input-reset", { fill: "default", type: "form", color: "warning", slot: "reset", size: "icon", shape: "rounded" }), h("smoothly-input-submit", { delete: true, slot: "clear", color: "danger", size: "icon", shape: "rounded" }), h("smoothly-input-submit", { fill: "default", type: "button", color: "success", slot: "submit", size: "icon", shape: "rounded" }, h("smoothly-icon", { name: "checkmark-outline", fill: "solid", size: "tiny" }))), h("h2", null, "Editable form and Input with Clear and Reset - Editable"), h("smoothly-form", { looks: "grid", type: "create", action: "https://api.toiletapi.com/upload/6b12fd2f-e896-46f9-b38f-25cf42cee4b4" }, h("smoothly-input", { readonly: true, name: "First Name", value: "John" }, "First name"), h("smoothly-input", { name: "Last name", value: "Doe" }, "Last name", h("smoothly-input-clear", { size: "icon", slot: "end" }, h("smoothly-icon", { name: "close" }))), h("smoothly-input", { type: "phone", name: "Phone", value: "777888999" }, "Phone", h("smoothly-input-reset", { size: "icon", slot: "end" }, h("smoothly-icon", { name: "refresh-outline" }))), h("smoothly-input-radio", { clearable: true, name: "radioFirstInput" }, h("p", { slot: "label" }, "Clearable"), h("smoothly-input-radio-item", { slot: "options", value: "first" }, "Label 1"), h("smoothly-input-radio-item", { selected: true, slot: "options", value: "second" }, "Label 2"), h("smoothly-input-radio-item", { slot: "options", value: "third" }, "Label 3")), h("smoothly-input-select", { multiple: true, menuHeight: "7.5items", placeholder: "Select...", name: "select-month" }, h("label", { slot: "label" }, "Month multiple select"), 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")), h("smoothly-input-select", { name: "select-icon", clearable: false, showSelected: false }, h("smoothly-item", { value: "folder", selected: true }, h("smoothly-icon", { size: "small", name: "folder-outline" })), h("smoothly-item", { value: "camera" }, h("smoothly-icon", { size: "small", name: "camera-outline" }))), h("smoothly-input-checkbox", { name: "checkbox" }, "Check the box"), h("smoothly-input-checkbox", { name: "checkbox2", checked: true }, "Check the box 2"), h("smoothly-input-range", { step: 1, name: "range3", value: 20000 }, "Select"), h("smoothly-picker", { multiple: true, name: "animals" }, h("span", { slot: "label" }, "Animals"), h("span", { slot: "search" }, "Search"), h("smoothly-picker-option", { selected: true, value: "cat" }, "Cat"), h("smoothly-picker-option", { value: "dog" }, "Dog"), h("smoothly-picker-option", { value: "fish" }, "Fish")), h("smoothly-input-edit", { fill: "default", type: "button", color: "tertiary", slot: "edit", size: "icon", shape: "rounded" }), h("smoothly-input-reset", { fill: "default", type: "form", color: "warning", slot: "reset", size: "icon", shape: "rounded" }), h("smoothly-input-submit", { delete: true, slot: "clear", color: "danger", size: "icon", shape: "rounded" }), h("smoothly-input-submit", { fill: "default", type: "button", color: "success", slot: "submit", size: "icon", shape: "rounded" }, h("smoothly-icon", { name: "checkmark-outline", fill: "solid", size: "tiny" }))), h("h2", null, "Color"), h("smoothly-form", { looks: "border" }, h("smoothly-input-color", { name: "color" })), h("h2", null, "Range"), h("smoothly-form", { looks: "border" }, h("smoothly-input-range", { step: 1, name: "range", outputSide: "right" }, "Select and so"), h("smoothly-input-range", { step: 1, name: "range2" }, "Select with really really long label", h("smoothly-icon", { name: "checkmark-circle", slot: "start" }), h("smoothly-input-clear", { size: "icon", slot: "end" }, h("smoothly-icon", { name: "close" }))), h("smoothly-input-range", { step: 1, name: "range3" }, "Select")), h("h2", null, "Duration"), h("smoothly-form", { looks: "border" }, h("smoothly-input", { name: "duration", type: "duration", placeholder: "hh:mm", value: this.duration, onSmoothlyInput: e => {
34736
34757
  const duration = e.detail.duration;
34737
34758
  console.log("event duration", duration);
34738
34759
  this.duration = duration;
@@ -34828,7 +34849,7 @@ const SmoothlyInputEdit$1 = class extends HTMLElement {
34828
34849
  static get style() { return styleCss$O; }
34829
34850
  };
34830
34851
 
34831
- const styleCss$N = ".sc-smoothly-input-file-h{box-sizing:border-box}.sc-smoothly-input-file-h[looks=\"border\"].sc-smoothly-input-file-s>smoothly-picker-menu smoothly-input,[looks=\"border\"].sc-smoothly-input-file-h{border:rgb(var(--text-color, var(--smoothly-color-contrast))) solid 1px}[looks=\"border\"][readonly].sc-smoothly-input-file-h{border:rgba(var(--text-color, var(--smoothly-color-contrast)), .1) solid 1px}.sc-smoothly-input-file-h[looks=\"line\"].sc-smoothly-input-file-s>smoothly-picker-menu smoothly-input,[looks=\"line\"].sc-smoothly-input-file-h{border-bottom:rgb(var(--text-color, var(--smoothly-color-contrast))) solid 1px}[looks=\"line\"][readonly].sc-smoothly-input-file-h{border-bottom:rgba(var(--text-color, var(--smoothly-color-contrast)), .1) solid 1px}.sc-smoothly-input-file-h[looks=\"grid\"].sc-smoothly-input-file-s>smoothly-picker-menu smoothly-input,[looks=\"grid\"].sc-smoothly-input-file-h{border:rgba(var(--text-color, var(--smoothly-color-contrast)), .5) solid .5px}[looks=\"grid\"][readonly].sc-smoothly-input-file-h{border:rgba(var(--text-color, var(--smoothly-color-contrast)), .2) solid .5px}[looks=\"transparent\"].sc-smoothly-input-file-h{border:none}[looks=\"transparent\"].sc-smoothly-input-file-h:not(:focus-within){background-color:transparent}[looks=\"transparent\"].sc-smoothly-input-file-h:not(:focus-within) input.sc-smoothly-input-file{background:transparent}[looks=\"transparent\"].sc-smoothly-input-file-h:focus-within{outline:1px solid rgb(var(--smoothly-color-contrast))}.sc-smoothly-input-file-h{display:flex;align-items:center;flex-wrap:wrap;overflow:hidden;position:relative;width:100%;padding-left:0.4rem;background-color:rgb(var(--background-color,var(--smoothly-color-shade)))}.mask.sc-smoothly-input-file{position:absolute;top:0;bottom:0;left:0;right:0;background-color:rgb(var(--text-color ,var(--smoothly-color-contrast)), 0.3)}.sc-smoothly-input-file-h:not(.dragging) .mask.sc-smoothly-input-file{display:none}input.sc-smoothly-input-file{overflow:hidden;height:0;width:0;padding:0}.input.sc-smoothly-input-file{display:flex;align-items:center;padding-left:0.4rem;padding-bottom:0.2rem}smoothly-button.sc-smoothly-input-file{margin:0;border:none}label.sc-smoothly-input-file{padding-left:0.4rem;padding-top:0.4rem;display:flex;width:100%;align-items:baseline;justify-content:flex-start;color:rgb(var(--text-color, var(--smoothly-color-contrast)));cursor:inherit}label.sc-smoothly-input-file-s>*{display:block;width:100%;font-size:0.65em;opacity:0.8}.sc-smoothly-input-file-h:not([show-label]) label.sc-smoothly-input-file{display:none}smoothly-icon.sc-smoothly-input-file{display:none;position:absolute;right:0.2em;top:0.6em}span.sc-smoothly-input-file{cursor:pointer;padding-left:0.5rem}";
34852
+ const styleCss$N = ".sc-smoothly-input-file-h{box-sizing:border-box}.sc-smoothly-input-file-h[looks=\"border\"].sc-smoothly-input-file-s>smoothly-picker-menu smoothly-input,[looks=\"border\"].sc-smoothly-input-file-h{border:rgb(var(--text-color, var(--smoothly-color-contrast))) solid 1px}[looks=\"border\"][readonly].sc-smoothly-input-file-h{border:rgba(var(--text-color, var(--smoothly-color-contrast)), .1) solid 1px}.sc-smoothly-input-file-h[looks=\"line\"].sc-smoothly-input-file-s>smoothly-picker-menu smoothly-input,[looks=\"line\"].sc-smoothly-input-file-h{border-bottom:rgb(var(--text-color, var(--smoothly-color-contrast))) solid 1px}[looks=\"line\"][readonly].sc-smoothly-input-file-h{border-bottom:rgba(var(--text-color, var(--smoothly-color-contrast)), .1) solid 1px}.sc-smoothly-input-file-h[looks=\"grid\"].sc-smoothly-input-file-s>smoothly-picker-menu smoothly-input,[looks=\"grid\"].sc-smoothly-input-file-h{border:rgba(var(--text-color, var(--smoothly-color-contrast)), .5) solid .5px}[looks=\"grid\"][readonly].sc-smoothly-input-file-h{border:rgba(var(--text-color, var(--smoothly-color-contrast)), .2) solid .5px}[looks=\"transparent\"].sc-smoothly-input-file-h{border:none}[looks=\"transparent\"].sc-smoothly-input-file-h:not(:focus-within){background-color:transparent}[looks=\"transparent\"].sc-smoothly-input-file-h:not(:focus-within) input.sc-smoothly-input-file{background:transparent}[looks=\"transparent\"].sc-smoothly-input-file-h:focus-within{outline:1px solid rgb(var(--smoothly-color-contrast))}.sc-smoothly-input-file-h{display:flex;align-items:center;flex-wrap:wrap;overflow:hidden;position:relative;width:100%;padding-left:0.4rem;background-color:rgb(var(--background-color,var(--smoothly-color-shade)))}.mask.sc-smoothly-input-file{position:absolute;inset:0;background-color:rgb(var(--text-color ,var(--smoothly-color-contrast)), 0.3)}.sc-smoothly-input-file-h:not(.dragging) .mask.sc-smoothly-input-file{display:none}input.sc-smoothly-input-file{overflow:hidden;height:0;width:0;padding:0}div.input.sc-smoothly-input-file{display:flex;align-items:center;padding-bottom:0.2rem;column-gap:1ch}smoothly-button.sc-smoothly-input-file{margin:0;border:none}label.sc-smoothly-input-file{padding-top:0.4rem;display:flex;width:100%;align-items:baseline;justify-content:flex-start;color:rgb(var(--text-color, var(--smoothly-color-contrast)));cursor:inherit}label.sc-smoothly-input-file-s>*{display:block;width:100%;font-size:0.65em;opacity:0.8}.sc-smoothly-input-file-h:not([show-label]) label.sc-smoothly-input-file{display:none}smoothly-icon.sc-smoothly-input-file{display:none;position:absolute;right:0.2em;top:0.6em}span.sc-smoothly-input-file{cursor:pointer}";
34832
34853
 
34833
34854
  const SmoothlyInputFile$1 = class extends HTMLElement {
34834
34855
  constructor() {
@@ -34836,9 +34857,11 @@ const SmoothlyInputFile$1 = class extends HTMLElement {
34836
34857
  this.__registerHost();
34837
34858
  this.smoothlyInputLooks = createEvent(this, "smoothlyInputLooks", 7);
34838
34859
  this.smoothlyInput = createEvent(this, "smoothlyInput", 7);
34839
- this.smoothlyChange = createEvent(this, "smoothlyChange", 7);
34860
+ this.smoothlyInputLoad = createEvent(this, "smoothlyInputLoad", 7);
34861
+ this.smoothlyFormDisable = createEvent(this, "smoothlyFormDisable", 7);
34840
34862
  this.transfer = new DataTransfer();
34841
- this.dragging = false;
34863
+ this.changed = false;
34864
+ this.readonly = false;
34842
34865
  this.accept = undefined;
34843
34866
  this.color = undefined;
34844
34867
  this.looks = "plain";
@@ -34847,34 +34870,82 @@ const SmoothlyInputFile$1 = class extends HTMLElement {
34847
34870
  this.showLabel = true;
34848
34871
  this.value = undefined;
34849
34872
  this.placeholder = undefined;
34873
+ this.dragging = false;
34874
+ }
34875
+ get files() {
34876
+ this.transfer.items.clear();
34877
+ this.value && this.transfer.items.add(this.value);
34878
+ return this.transfer.files;
34850
34879
  }
34851
34880
  componentWillLoad() {
34852
34881
  this.smoothlyInputLooks.emit((looks, color) => ((this.looks = looks), !this.color && (this.color = color)));
34882
+ this.smoothlyInput.emit({ [this.name]: this.value });
34883
+ this.smoothlyInputLoad.emit(() => { });
34884
+ !this.readonly && this.smoothlyFormDisable.emit(readonly => (this.readonly = readonly));
34853
34885
  }
34854
34886
  async clear() {
34855
34887
  this.value = undefined;
34856
34888
  }
34889
+ async listen(property, listener) {
34890
+ this.listener[property] = listener;
34891
+ listener(this);
34892
+ }
34893
+ async edit(editable) {
34894
+ this.readonly = !editable;
34895
+ }
34896
+ async reset() {
34897
+ this.value = this.initialValue;
34898
+ }
34899
+ async setInitialValue() {
34900
+ this.initialValue = this.value;
34901
+ this.valueChanged();
34902
+ }
34903
+ async binary() {
34904
+ return true;
34905
+ }
34906
+ valueChanged() {
34907
+ this.changed = this.initialValue !== this.value;
34908
+ this.smoothlyInput.emit({ [this.name]: this.value });
34909
+ }
34910
+ inputHandler(event) {
34911
+ var _a, _b, _c;
34912
+ event.stopPropagation();
34913
+ if ((_b = (_a = this.input) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b.length)
34914
+ this.value = (_c = this.input) === null || _c === void 0 ? void 0 : _c.files[0];
34915
+ }
34916
+ dropHandler(event) {
34917
+ var _a;
34918
+ event.preventDefault();
34919
+ event.stopPropagation();
34920
+ this.dragging = false;
34921
+ if ((_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.files.length)
34922
+ this.value = event.dataTransfer.files[0];
34923
+ }
34924
+ clickHandler(event) {
34925
+ var _a;
34926
+ if (!this.readonly && !event.composedPath().find(target => target == this.input)) {
34927
+ (_a = this.input) === null || _a === void 0 ? void 0 : _a.click();
34928
+ }
34929
+ }
34930
+ dragOverHandler(event) {
34931
+ event.preventDefault();
34932
+ event.stopPropagation();
34933
+ }
34934
+ dragEnterHandler(event) {
34935
+ event.preventDefault();
34936
+ !this.readonly && (this.dragging = true);
34937
+ }
34938
+ dragLeaveHandler(event) {
34939
+ event.stopPropagation();
34940
+ this.dragging = false;
34941
+ }
34857
34942
  render() {
34858
34943
  var _a, _b, _c;
34859
- return (h(Host, { class: { dragging: this.dragging }, tabindex: 0, onClick: () => { var _a; return (_a = this.input) === null || _a === void 0 ? void 0 : _a.click(); }, onDragOver: (event) => (event.preventDefault(), event.stopPropagation()), onDragEnter: () => (this.dragging = true) }, h("label", null, h("slot", { name: "label" })), h("div", { class: "input" }, h("smoothly-button", { color: this.color, fill: "clear", size: "flexible", onClick: event => { var _a; return (event.stopPropagation(), (_a = this.input) === null || _a === void 0 ? void 0 : _a.click()); } }, h("slot", { name: "button" })), h("span", { onClick: event => { var _a; return (event.stopPropagation(), (_a = this.input) === null || _a === void 0 ? void 0 : _a.click()); } }, (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : this.placeholder), h("div", { class: "mask", onDrop: event => {
34860
- var _a;
34861
- return (event.preventDefault(),
34862
- event.stopPropagation(),
34863
- (this.dragging = false),
34864
- ((_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.files.length) &&
34865
- (this.smoothlyInput.emit({ [this.name]: (this.value = event.dataTransfer.files[0]) }),
34866
- this.smoothlyChange.emit({ [this.name]: (this.value = event.dataTransfer.files[0]) })));
34867
- }, onDragLeave: event => (event.stopPropagation(), (this.dragging = false)) }), h("input", { ref: element => (this.input = element), type: "file", capture: this.camera == "back" ? "environment" : "user", accept: (_c = this.accept) !== null && _c !== void 0 ? _c : (!this.camera ? undefined : "image/jpeg"), files: (this.transfer.items.clear(), this.value && this.transfer.items.add(this.value), this.transfer.files), onInput: event => {
34868
- var _a, _b, _c;
34869
- return (event.stopPropagation(),
34870
- ((_b = (_a = this.input) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b.length) && this.smoothlyInput.emit({ [this.name]: (this.value = (_c = this.input) === null || _c === void 0 ? void 0 : _c.files[0]) }));
34871
- }, onChange: event => {
34872
- var _a, _b, _c;
34873
- return (event.stopPropagation(),
34874
- ((_b = (_a = this.input) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b.length) &&
34875
- this.smoothlyChange.emit({ [this.name]: (this.value = (_c = this.input) === null || _c === void 0 ? void 0 : _c.files[0]) }));
34876
- } })), h("slot", null)));
34944
+ return (h(Host, { class: { dragging: this.dragging }, tabindex: 0, onClick: (e) => this.clickHandler(e), onDragOver: (e) => this.dragOverHandler(e), onDragEnter: (e) => this.dragEnterHandler(e) }, h("label", null, h("slot", { name: "label" })), h("div", { class: "input" }, h("smoothly-button", { color: this.color, fill: "clear", size: "flexible" }, h("slot", { name: "button" })), h("span", null, (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : this.placeholder), h("div", { class: "mask", onDrop: e => this.dropHandler(e), onDragLeave: e => this.dragLeaveHandler(e) }), h("input", { ref: element => (this.input = element), type: "file", capture: this.camera == "back" ? "environment" : "user", accept: (_c = this.accept) !== null && _c !== void 0 ? _c : (!this.camera ? undefined : "image/jpeg"), files: this.files, onInput: e => this.inputHandler(e) })), h("slot", null)));
34877
34945
  }
34946
+ static get watchers() { return {
34947
+ "value": ["valueChanged"]
34948
+ }; }
34878
34949
  static get style() { return styleCss$N; }
34879
34950
  };
34880
34951
 
@@ -37188,7 +37259,7 @@ const SmoothlyInputDateRange = /*@__PURE__*/proxyCustomElement(InputDateRange, [
37188
37259
  const SmoothlyInputDemo = /*@__PURE__*/proxyCustomElement(SmoothlyInputDemo$1, [0,"smoothly-input-demo",{"duration":[32]}]);
37189
37260
  const SmoothlyInputDemoControlledForm = /*@__PURE__*/proxyCustomElement(SmoothlyInputDemoControlledForm$1, [2,"smoothly-input-demo-controlled-form",{"name":[32]}]);
37190
37261
  const SmoothlyInputEdit = /*@__PURE__*/proxyCustomElement(SmoothlyInputEdit$1, [6,"smoothly-input-edit",{"color":[513],"expand":[513],"fill":[513],"disabled":[1540],"display":[1540],"shape":[513],"type":[513],"size":[513],"toolTip":[1,"tool-tip"]},[[0,"click","clickHandler"]]]);
37191
- const SmoothlyInputFile = /*@__PURE__*/proxyCustomElement(SmoothlyInputFile$1, [6,"smoothly-input-file",{"accept":[1],"color":[1537],"looks":[1537],"camera":[513],"name":[513],"showLabel":[516,"show-label"],"value":[1040],"placeholder":[1537],"dragging":[32]}]);
37262
+ const SmoothlyInputFile = /*@__PURE__*/proxyCustomElement(SmoothlyInputFile$1, [6,"smoothly-input-file",{"changed":[1028],"readonly":[1540],"accept":[1],"color":[1537],"looks":[1537],"camera":[513],"name":[513],"showLabel":[516,"show-label"],"value":[1040],"placeholder":[1537],"dragging":[32]}]);
37192
37263
  const SmoothlyInputMonth = /*@__PURE__*/proxyCustomElement(MonthSelector, [2,"smoothly-input-month",{"value":[1025]}]);
37193
37264
  const SmoothlyInputRadio = /*@__PURE__*/proxyCustomElement(SmoothlyInputRadio$1, [6,"smoothly-input-radio",{"changed":[1028],"value":[1032],"looks":[1537],"clearable":[4],"readonly":[1540],"name":[1]},[[0,"smoothlyRadioButtonRegister","handleRegister"],[0,"smoothlyInputLoad","SmoothlyInputLoadHandler"],[0,"smoothlySelect","smoothlyRadioInputHandler"]]]);
37194
37265
  const SmoothlyInputRadioItem = /*@__PURE__*/proxyCustomElement(SmoothlyInputRadioItem$1, [6,"smoothly-input-radio-item",{"value":[1032],"selected":[1028],"looks":[1537],"name":[1025]}]);