smoothly 0.3.66 → 0.3.68

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.
@@ -611,6 +611,12 @@ class StateEditor {
611
611
  padStart(length, padding) {
612
612
  return this.pad(length, padding, 0);
613
613
  }
614
+ toLower() {
615
+ return this.map(symbol => symbol.toLowerCase());
616
+ }
617
+ toUpper() {
618
+ return this.map(symbol => symbol.toUpperCase());
619
+ }
614
620
  map(mapping) {
615
621
  let result = this;
616
622
  let j = 0;
@@ -752,12 +758,12 @@ function parse(value, type, ...argument) {
752
758
  return handler ? handler.fromString(handler.unformat(StateEditor.modify(value)).value) : undefined;
753
759
  }
754
760
 
755
- class Handler$f {
761
+ class Handler$h {
756
762
  toString(data) {
757
763
  return typeof data == "string" ? data : "";
758
764
  }
759
765
  fromString(value) {
760
- return typeof value == "string" ? value : undefined;
766
+ return typeof value == "string" && !!value ? value : undefined;
761
767
  }
762
768
  format(unformatted) {
763
769
  return { ...unformatted, type: "tel", autocomplete: "cc-csc", length: [3, 3], pattern: /^\d{3}$/ };
@@ -769,9 +775,9 @@ class Handler$f {
769
775
  return state.value.length < 3 && symbol >= "0" && symbol <= "9";
770
776
  }
771
777
  }
772
- add("card-csc", () => new Handler$f());
778
+ add("card-csc", () => new Handler$h());
773
779
 
774
- class Handler$e {
780
+ class Handler$g {
775
781
  toString(data) {
776
782
  return Array.isArray(data) && data.length == 2 && typeof data[0] == "number" && typeof data[1] == "number"
777
783
  ? data[0].toString().padStart(2, "0") + data[1].toString().padStart(2, "0")
@@ -797,14 +803,14 @@ class Handler$e {
797
803
  return state.value.length < 4 && symbol >= "0" && symbol <= "9";
798
804
  }
799
805
  }
800
- add("card-expires", () => new Handler$e());
806
+ add("card-expires", () => new Handler$g());
801
807
 
802
- class Handler$d {
808
+ class Handler$f {
803
809
  toString(data) {
804
810
  return typeof data == "string" ? data : "";
805
811
  }
806
812
  fromString(value) {
807
- return typeof value == "string" ? value : undefined;
813
+ return typeof value == "string" && !!value ? value : undefined;
808
814
  }
809
815
  format(unformatted) {
810
816
  const issuer = getIssuer(unformatted.value);
@@ -826,7 +832,7 @@ class Handler$d {
826
832
  return symbol >= "0" && symbol <= "9" && state.value.length < issuer.length[0];
827
833
  }
828
834
  }
829
- add("card-number", () => new Handler$d());
835
+ add("card-number", () => new Handler$f());
830
836
  function getIssuer(value) {
831
837
  let result = defaultIssuer;
832
838
  for (const key in issuers)
@@ -7176,7 +7182,7 @@ add("date", (parameters) => {
7176
7182
  return create();
7177
7183
  });
7178
7184
 
7179
- class Handler$c extends Base {
7185
+ class Handler$e extends Base {
7180
7186
  constructor(separator) {
7181
7187
  super(separator);
7182
7188
  }
@@ -7224,11 +7230,11 @@ class Handler$c extends Base {
7224
7230
  : state.selection.start < 8 && symbol >= "0" && symbol <= "9";
7225
7231
  }
7226
7232
  }
7227
- register("dd.mm.YYYY", () => new Handler$c("."));
7228
- register("dd/mm/YYYY", () => new Handler$c("/"));
7229
- register("dd-mm-YYYY", () => new Handler$c("-"));
7233
+ register("dd.mm.YYYY", () => new Handler$e("."));
7234
+ register("dd/mm/YYYY", () => new Handler$e("/"));
7235
+ register("dd-mm-YYYY", () => new Handler$e("-"));
7230
7236
 
7231
- class Handler$b extends Base {
7237
+ class Handler$d extends Base {
7232
7238
  constructor(separator) {
7233
7239
  super(separator);
7234
7240
  }
@@ -7273,9 +7279,9 @@ class Handler$b extends Base {
7273
7279
  return result;
7274
7280
  }
7275
7281
  }
7276
- register("mm/dd/YYYY", () => new Handler$b("/"));
7282
+ register("mm/dd/YYYY", () => new Handler$d("/"));
7277
7283
 
7278
- class Handler$a extends Base {
7284
+ class Handler$c extends Base {
7279
7285
  constructor(separator) {
7280
7286
  super(separator);
7281
7287
  }
@@ -7324,9 +7330,9 @@ class Handler$a extends Base {
7324
7330
  : state.selection.start < 8 && symbol >= "0" && symbol <= "9";
7325
7331
  }
7326
7332
  }
7327
- register("YYYY-mm-dd", () => new Handler$a("-"));
7333
+ register("YYYY-mm-dd", () => new Handler$c("-"));
7328
7334
 
7329
- class Handler$9 {
7335
+ class Handler$b {
7330
7336
  toString(data) {
7331
7337
  return typeof data == "string" ? data : "";
7332
7338
  }
@@ -7379,7 +7385,7 @@ class Handler$9 {
7379
7385
  ((symbol >= "0" && symbol <= "9") || symbol == "-" || symbol == ":" || symbol == "." || symbol == " "));
7380
7386
  }
7381
7387
  }
7382
- add("date-time", () => new Handler$9());
7388
+ add("date-time", () => new Handler$b());
7383
7389
  function formatDate(unformatted, format) {
7384
7390
  let result = unformatted;
7385
7391
  switch (format) {
@@ -7476,7 +7482,7 @@ function daysPerMonth(year, month) {
7476
7482
  return result;
7477
7483
  }
7478
7484
 
7479
- class Handler$8 {
7485
+ class Handler$a {
7480
7486
  toString(data) {
7481
7487
  return Array.isArray(data) && data.length == 2 && typeof data[0] == "number" && typeof data[1] == "number"
7482
7488
  ? data[0].toString() + " / " + data[1].toString()
@@ -7532,9 +7538,9 @@ class Handler$8 {
7532
7538
  return state.value.length < 7 && ((symbol >= "0" && symbol <= "9") || symbol == "/" || symbol == " ");
7533
7539
  }
7534
7540
  }
7535
- add("divisor", () => new Handler$8());
7541
+ add("divisor", () => new Handler$a());
7536
7542
 
7537
- class Handler$7 {
7543
+ class Handler$9 {
7538
7544
  constructor() {
7539
7545
  this.separator = ":";
7540
7546
  this.patterns = {
@@ -7616,9 +7622,96 @@ class Handler$7 {
7616
7622
  return !!nextValue.match(this.patterns.allowed);
7617
7623
  }
7618
7624
  }
7619
- add("duration", () => new Handler$7());
7625
+ add("duration", () => new Handler$9());
7620
7626
 
7621
- class Handler$6 {
7627
+ class Handler$8 {
7628
+ constructor(settings, mode) {
7629
+ this.settings = settings;
7630
+ this.mode = mode;
7631
+ }
7632
+ toString(data) {
7633
+ return typeof data == "string" ? data : "";
7634
+ }
7635
+ fromString(value) {
7636
+ return typeof value == "string" && !!value ? value : undefined;
7637
+ }
7638
+ split(unformatted) {
7639
+ let firstAllowedSymbol;
7640
+ let previousAllowedSymbol = "";
7641
+ return unformatted
7642
+ .map((symbol, index) => {
7643
+ const newSymbol = index !== 0 &&
7644
+ symbol === symbol.toUpperCase() &&
7645
+ isNaN(+symbol) &&
7646
+ previousAllowedSymbol !== " " &&
7647
+ this.isSymbolAllowed(symbol) &&
7648
+ firstAllowedSymbol
7649
+ ? " " + symbol
7650
+ : (symbol === "_" || symbol === "-") && previousAllowedSymbol !== " "
7651
+ ? " "
7652
+ : (symbol === " " && previousAllowedSymbol === " ") ||
7653
+ !this.isSymbolAllowed(symbol) ||
7654
+ (!firstAllowedSymbol && !this.isSymbolLetter(symbol) && this.mode !== "code")
7655
+ ? ""
7656
+ : symbol;
7657
+ !firstAllowedSymbol && (firstAllowedSymbol = this.isSymbolLetter(symbol));
7658
+ this.isSymbolAllowed(symbol) && (previousAllowedSymbol = symbol);
7659
+ return newSymbol;
7660
+ })
7661
+ .toLower()
7662
+ .delete("-")
7663
+ .delete("_");
7664
+ }
7665
+ isSymbolLetter(symbol) {
7666
+ return (symbol >= "a" && symbol <= "z") || (symbol >= "A" && symbol <= "Z");
7667
+ }
7668
+ isSymbolAllowed(symbol) {
7669
+ return this.isSymbolLetter(symbol) || (symbol >= "0" && symbol <= "9") || symbol === " ";
7670
+ }
7671
+ format(unformatted) {
7672
+ const alignedString = this.split(unformatted);
7673
+ let result;
7674
+ switch (this.mode) {
7675
+ case "code":
7676
+ result = alignedString.delete(" ");
7677
+ break;
7678
+ case "pascal":
7679
+ case "camel":
7680
+ let previousSpace;
7681
+ result = alignedString
7682
+ .map((symbol, index) => {
7683
+ const newSymbol = (index === 0 && this.mode === "pascal") || previousSpace ? symbol.toUpperCase() : symbol.toLowerCase();
7684
+ previousSpace = symbol == " ";
7685
+ return newSymbol;
7686
+ })
7687
+ .delete(" ");
7688
+ break;
7689
+ case "snake":
7690
+ case "attribute":
7691
+ result = alignedString.replace(" ", this.mode === "snake" ? "_" : "-");
7692
+ break;
7693
+ default:
7694
+ result = unformatted;
7695
+ }
7696
+ return { ...result, ...this.settings, type: "text", autocomplete: "on" };
7697
+ }
7698
+ unformat(formatted) {
7699
+ return formatted;
7700
+ }
7701
+ allowed(symbol, state) {
7702
+ return (this.isSymbolLetter(symbol) ||
7703
+ (symbol >= "0" && symbol <= "9" && (this.mode == "code" || state.value.length > 0)) ||
7704
+ (symbol == "_" && this.mode == "snake" && state.value.length > 0) ||
7705
+ (symbol == "-" && this.mode == "attribute" && state.value.length > 0));
7706
+ }
7707
+ }
7708
+ add("identifier-code", (settings) => new Handler$8(settings || {}, "code"));
7709
+ add("identifier-pascal", (settings) => new Handler$8(settings || {}, "pascal"));
7710
+ add("identifier-snake", (settings) => new Handler$8(settings || {}, "snake"));
7711
+ add("identifier-camel", (settings) => new Handler$8(settings || {}, "camel"));
7712
+ add("identifier-attribute", (settings) => new Handler$8(settings || {}, "attribute"));
7713
+
7714
+ class Handler$7 {
7622
7715
  constructor(country) {
7623
7716
  this.country = country;
7624
7717
  }
@@ -7626,7 +7719,7 @@ class Handler$6 {
7626
7719
  return typeof data == "string" ? data : "";
7627
7720
  }
7628
7721
  fromString(value) {
7629
- return typeof value == "string" ? value : undefined;
7722
+ return typeof value == "string" && !!value ? value : undefined;
7630
7723
  }
7631
7724
  format(unformatted) {
7632
7725
  let result = unformatted;
@@ -7649,14 +7742,39 @@ class Handler$6 {
7649
7742
  return state.value.length < 13 && symbol >= "0" && symbol <= "9";
7650
7743
  }
7651
7744
  }
7652
- add("identity-number", (argument) => new Handler$6(argument && argument.length > 0 ? argument[0] : undefined));
7745
+ add("identity-number", (argument) => new Handler$7(argument && argument.length > 0 ? argument[0] : undefined));
7746
+
7747
+ class Handler$6 {
7748
+ toString(data) {
7749
+ return typeof data == "number" ? data.toString() : "";
7750
+ }
7751
+ fromString(value) {
7752
+ const parsed = typeof value == "string" ? Number.parseInt(value) : undefined;
7753
+ return typeof parsed == "number" && !Number.isNaN(parsed) ? parsed : undefined;
7754
+ }
7755
+ format(unformatted) {
7756
+ return {
7757
+ ...unformatted,
7758
+ type: "number",
7759
+ length: [3, undefined],
7760
+ pattern: /^[0-9]+$/,
7761
+ };
7762
+ }
7763
+ unformat(formatted) {
7764
+ return formatted;
7765
+ }
7766
+ allowed(symbol, state) {
7767
+ return symbol >= "0" && symbol <= "9";
7768
+ }
7769
+ }
7770
+ add("integer", () => new Handler$6());
7653
7771
 
7654
7772
  class Handler$5 {
7655
7773
  toString(data) {
7656
7774
  return typeof data == "string" ? data : "";
7657
7775
  }
7658
7776
  fromString(value) {
7659
- return typeof value == "string" ? value : undefined;
7777
+ return typeof value == "string" && !!value ? value : undefined;
7660
7778
  }
7661
7779
  format(unformatted) {
7662
7780
  return { ...unformatted, type: "password", autocomplete: "current-password" };
@@ -7998,7 +8116,7 @@ class Handler$3 {
7998
8116
  return typeof data == "string" ? data : "";
7999
8117
  }
8000
8118
  fromString(value) {
8001
- return typeof value == "string" ? value : undefined;
8119
+ return typeof value == "string" && !!value ? value : undefined;
8002
8120
  }
8003
8121
  format(unformatted) {
8004
8122
  let result = unformatted;
@@ -8075,7 +8193,7 @@ class Handler$2 {
8075
8193
  return typeof data == "string" ? data : "";
8076
8194
  }
8077
8195
  fromString(value) {
8078
- return typeof value == "string" ? value : undefined;
8196
+ return typeof value == "string" && !!value ? value : undefined;
8079
8197
  }
8080
8198
  format(unformatted) {
8081
8199
  const result = !unformatted.value.includes(" ") && unformatted.value.length >= 4 ? unformatted.insert(3, " ") : unformatted;
@@ -8108,19 +8226,17 @@ class Handler$1 {
8108
8226
  return result != undefined && !isNaN(result) ? result : undefined;
8109
8227
  }
8110
8228
  format(unformatted) {
8111
- let separator = unformatted.value && unformatted.value.includes(".") ? unformatted.value.indexOf(".") : undefined;
8112
8229
  let result = unformatted.value == "NaN" ? unformatted.replace(0, unformatted.value.length, "") : StateEditor.copy(unformatted);
8230
+ const decimals = this.currency && Currency.decimalDigits(this.currency);
8231
+ if (!result.value.includes(".") && decimals && Math.abs(Number.parseFloat(result.value)) > 0)
8232
+ result = result.suffix(".0");
8233
+ let separator = result.value && result.value.includes(".") ? result.value.indexOf(".") : undefined;
8113
8234
  if (separator == 0) {
8114
8235
  result = result.prepend("0");
8115
8236
  separator++;
8116
8237
  }
8117
8238
  if (separator != undefined) {
8118
- const adjust = separator +
8119
- 1 +
8120
- (!this.currency || Currency.decimalDigits(this.currency) == undefined
8121
- ? 2
8122
- : Currency.decimalDigits(this.currency) ?? 2) -
8123
- result.value.length;
8239
+ const adjust = separator + 1 + (decimals ?? 2) - result.value.length;
8124
8240
  result = adjust < 0 ? result.truncate(result.value.length + adjust) : result.suffix("0".repeat(adjust));
8125
8241
  }
8126
8242
  else
@@ -8163,7 +8279,7 @@ class Handler {
8163
8279
  return typeof data == "string" ? data : "";
8164
8280
  }
8165
8281
  fromString(value) {
8166
- return typeof value == "string" ? value : undefined;
8282
+ return typeof value == "string" && !!value ? value : undefined;
8167
8283
  }
8168
8284
  format(unformatted) {
8169
8285
  return { ...unformatted, type: "text", ...this.settings };
@@ -9213,7 +9329,7 @@ const SmoothlyInputDemo = class {
9213
9329
  }
9214
9330
  render() {
9215
9331
  return [
9216
- index.h("form", { action: "done", style: { position: "relative" } }, index.h("header", null, index.h("h5", null, "Form")), index.h("main", null, index.h("fieldset", null, index.h("h2", null, "Smoothly Input"), index.h("h3", null, "Card"), index.h("smoothly-input", { type: "text", name: "name", readonly: true, value: "Readonly", onSmoothlyBlur: () => console.log("smoothly blur") }, "Readonly"), index.h("smoothly-input", { type: "text", name: "name.last", onSmoothlyChange: e => console.log("smoothly change event") }, "Name"), index.h("smoothly-input", { type: "text", name: "name.first", onSmoothlyChange: e => console.log("smoothly change event") }, "Name"), index.h("smoothly-input-date", null), index.h("smoothly-input", { type: "date", name: "date" }, "Date"), index.h("smoothly-input", { type: "date-time", name: "date-time" }, "Date-Time"), index.h("smoothly-input", { type: "divisor", name: "divisor" }, "Divisor"), index.h("smoothly-input", { type: "text", name: "street", value: "street" }, "Street"), index.h("smoothly-input", { type: "card-number", name: "card" }, "Card #"), index.h("smoothly-input", { type: "card-expires", name: "card", style: { width: "calc(60% - 2px)" } }, "Expires"), index.h("smoothly-input", { type: "card-csc", name: "card", style: { width: "calc(40% - 1px)", borderLeft: "none" } }, "CVV/CVC"), index.h("h3", null, "Contact"), index.h("smoothly-input", { type: "postal-code", name: "zip", style: { width: "calc(60% - 2px)" } }, "ZipCode"), index.h("smoothly-input", { type: "text", name: "testing" }, "Texttest"), index.h("smoothly-input", { type: "password", name: "password" }, "Password"), index.h("smoothly-input", { type: "email", name: "email" }, "Email"), index.h("smoothly-input", { type: "price", currency: "SEK", name: "price" }, "Price"), index.h("smoothly-input", { type: "percent", name: "percent" }, "Percent"), index.h("smoothly-input", { type: "phone", name: "phone" }, "Phone"), index.h("smoothly-input-date", { name: "some-date" }, "Calendar"), index.h("smoothly-input-date", { name: "some-date", color: "tertiary" }, "Calendar (chosen color)"), index.h("smoothly-input-date", { name: "some-date", flexible: true }, "Calendar (no min-width)")), index.h("fieldset", null, index.h("h2", null, "Smoothly Radio"), index.h("h3", null, "Deselectable Radio List with button"), index.h("smoothly-radio-button", { deselectable: true, decoration: "button" }, index.h("smoothly-radio-button-item", { value: { some: "content", yes: "sir" }, color: "primary", iconColor: "medium" }, index.h("span", null, "Option 1"), index.h("span", { slot: "expansion" }, "Some description.")), index.h("smoothly-radio-button-item", { value: { some: "thing", yes: "miss" }, iconColor: "light" }, index.h("span", null, "Option 2"), index.h("span", { slot: "expansion" }, "Some other description.")), index.h("smoothly-radio-button-item", { value: { some: "one", yes: "kid" }, iconColor: "danger" }, index.h("span", null, "Option 3")), index.h("smoothly-radio-button-item", { value: { some: "some", yes: "thing" }, disabled: true }, index.h("span", null, "Option 4 (Disabled)"))), index.h("h3", null, "Radio List with button"), index.h("smoothly-radio-button", { decoration: "button" }, index.h("smoothly-radio-button-item", { value: { some: "content", yes: "sir" }, color: "warning" }, index.h("span", null, "Option 1"), index.h("span", { slot: "expansion" }, "Some description.")), index.h("smoothly-radio-button-item", { value: { some: "thing", yes: "miss" } }, index.h("span", null, "Option 2"), index.h("span", { slot: "expansion" }, "Some other description.")), index.h("smoothly-radio-button-item", { value: { some: "one", yes: "kid" } }, index.h("span", null, "Option 3"))), index.h("h3", null, "Radio List ", index.h("b", null, "without button")), index.h("smoothly-radio-button", null, index.h("smoothly-radio-button-item", { value: { some: "content", yes: "sir" }, selected: true, color: "light" }, index.h("span", null, "Option 1"), index.h("span", { slot: "expansion" }, "Some description.")), index.h("smoothly-radio-button-item", { value: { some: "thing", yes: "miss" }, color: "light" }, index.h("span", null, "Option 2"), index.h("span", { slot: "expansion" }, "Some other description.")), index.h("smoothly-radio-button-item", { value: { some: "one", yes: "kid" }, color: "light" }, index.h("span", null, "Option 3"))), index.h("smoothly-radio", { name: "option", value: "1" }, "option 1"), index.h("smoothly-radio", { name: "option", value: "2", checked: true }, "option 2"), index.h("smoothly-radio", { name: "option", value: "3" }, "option 3")), index.h("fieldset", null, index.h("h2", null, "Smoothly Accordion"), index.h("smoothly-accordion", null, index.h("smoothly-accordion-item", { name: "A", open: true }, index.h("smoothly-radio", { name: "a", value: "1" }, "a 1"), index.h("smoothly-radio", { name: "a", value: "2", checked: true }, "a 2"), index.h("smoothly-radio", { name: "a", value: "3" }, "a 3")), index.h("smoothly-accordion-item", { name: "B" }, index.h("smoothly-radio", { name: "b", value: "1" }, "b 1"), index.h("smoothly-radio", { name: "b", value: "2" }, "b 2"), index.h("smoothly-radio", { name: "b", value: "3" }, "b 3")))), index.h("fieldset", null, index.h("h2", null, "Smoothly checkbox"), index.h("smoothly-checkbox", { selectAll: true, intermediate: true }), index.h("smoothly-checkbox", null), index.h("smoothly-checkbox", { disabled: true })), index.h("fieldset", null, index.h("h2", null, "Smoothly addresses"), index.h("smoothly-address-display", { value: '{ "countryCode": "SE", "street": "Korkstigen 2", "zipCode": "654 31", "city": "Fejksala" }' }), index.h("smoothly-address", { editable: false, value: '{ "countryCode": "SE", "street": "Stigv\u00E4gen 34", "zipCode": "123 45", "city": "Hobbiton" }' }), index.h("smoothly-addresses", { allowed: "billing delivery visit", editable: true, value: '{ "billing": { "countryCode": "SE", "street": "Rundslingan 3", "zipCode": "987 65", "city": "Klotby" }, "visit": { "countryCode": "SE", "street": "G\u00E5ngbanan 34", "zipCode": "543 21", "city": "Trasktr\u00E4sk" } }' }))), index.h("footer", null, index.h("smoothly-submit", { expand: "block", onSubmit: (e) => alert(e), color: "success" }, "Submit"), index.h("smoothly-submit", { disabled: true, expand: "block", onClick: e => console.log(e), onSubmit: (e) => alert(e), color: "success" }, "Submit"), index.h("smoothly-trigger", { expand: "block", color: "success", onClick: (e) => console.log(e.detail) }, "Trigger"))),
9332
+ index.h("form", { action: "done", style: { position: "relative" } }, index.h("header", null, index.h("h5", null, "Form")), index.h("main", null, index.h("fieldset", null, index.h("h2", null, "Smoothly Input"), index.h("h3", null, "Card"), index.h("smoothly-input", { type: "text", name: "name", readonly: true, value: "Readonly", onSmoothlyBlur: () => console.log("smoothly blur") }, "Readonly"), index.h("smoothly-input", { type: "text", name: "name.last", onSmoothlyChange: e => console.log("smoothly change event") }, "Name"), index.h("smoothly-input", { type: "text", name: "name.first", onSmoothlyChange: e => console.log("smoothly change event") }, "Name"), index.h("smoothly-input-date", null), index.h("smoothly-input", { type: "date", name: "date" }, "Date"), index.h("smoothly-input", { type: "date-time", name: "date-time" }, "Date-Time"), index.h("smoothly-input", { type: "divisor", name: "divisor" }, "Divisor"), index.h("smoothly-input", { type: "text", name: "street", value: "street" }, "Street"), index.h("smoothly-input", { type: "card-number", name: "card" }, "Card #"), index.h("smoothly-input", { type: "card-expires", name: "card", style: { width: "calc(60% - 2px)" } }, "Expires"), index.h("smoothly-input", { type: "card-csc", name: "card", style: { width: "calc(40% - 1px)", borderLeft: "none" } }, "CVV/CVC"), index.h("h3", null, "Contact"), index.h("smoothly-input", { type: "postal-code", name: "zip", style: { width: "calc(60% - 2px)" } }, "ZipCode"), index.h("smoothly-input", { type: "text", name: "testing" }, "Texttest"), index.h("smoothly-input", { type: "integer", name: "integer" }, "Integer"), index.h("smoothly-input", { type: "identifier-code", name: "identifier-code" }, "Identifier"), index.h("smoothly-input", { type: "password", name: "password" }, "Password"), index.h("smoothly-input", { type: "email", name: "email" }, "Email"), index.h("smoothly-input", { type: "price", currency: "SEK", name: "price" }, "Price"), index.h("smoothly-input", { type: "percent", name: "percent" }, "Percent"), index.h("smoothly-input", { type: "phone", name: "phone" }, "Phone"), index.h("smoothly-input-date", { name: "some-date" }, "Calendar"), index.h("smoothly-input-date", { name: "some-date", color: "tertiary" }, "Calendar (chosen color)"), index.h("smoothly-input-date", { name: "some-date", flexible: true }, "Calendar (no min-width)")), index.h("fieldset", null, index.h("h2", null, "Smoothly Radio"), index.h("h3", null, "Deselectable Radio List with button"), index.h("smoothly-radio-button", { deselectable: true, decoration: "button" }, index.h("smoothly-radio-button-item", { value: { some: "content", yes: "sir" }, color: "primary", iconColor: "medium" }, index.h("span", null, "Option 1"), index.h("span", { slot: "expansion" }, "Some description.")), index.h("smoothly-radio-button-item", { value: { some: "thing", yes: "miss" }, iconColor: "light" }, index.h("span", null, "Option 2"), index.h("span", { slot: "expansion" }, "Some other description.")), index.h("smoothly-radio-button-item", { value: { some: "one", yes: "kid" }, iconColor: "danger" }, index.h("span", null, "Option 3")), index.h("smoothly-radio-button-item", { value: { some: "some", yes: "thing" }, disabled: true }, index.h("span", null, "Option 4 (Disabled)"))), index.h("h3", null, "Radio List with button"), index.h("smoothly-radio-button", { decoration: "button" }, index.h("smoothly-radio-button-item", { value: { some: "content", yes: "sir" }, color: "warning" }, index.h("span", null, "Option 1"), index.h("span", { slot: "expansion" }, "Some description.")), index.h("smoothly-radio-button-item", { value: { some: "thing", yes: "miss" } }, index.h("span", null, "Option 2"), index.h("span", { slot: "expansion" }, "Some other description.")), index.h("smoothly-radio-button-item", { value: { some: "one", yes: "kid" } }, index.h("span", null, "Option 3"))), index.h("h3", null, "Radio List ", index.h("b", null, "without button")), index.h("smoothly-radio-button", null, index.h("smoothly-radio-button-item", { value: { some: "content", yes: "sir" }, selected: true, color: "light" }, index.h("span", null, "Option 1"), index.h("span", { slot: "expansion" }, "Some description.")), index.h("smoothly-radio-button-item", { value: { some: "thing", yes: "miss" }, color: "light" }, index.h("span", null, "Option 2"), index.h("span", { slot: "expansion" }, "Some other description.")), index.h("smoothly-radio-button-item", { value: { some: "one", yes: "kid" }, color: "light" }, index.h("span", null, "Option 3"))), index.h("smoothly-radio", { name: "option", value: "1" }, "option 1"), index.h("smoothly-radio", { name: "option", value: "2", checked: true }, "option 2"), index.h("smoothly-radio", { name: "option", value: "3" }, "option 3")), index.h("fieldset", null, index.h("h2", null, "Smoothly Accordion"), index.h("smoothly-accordion", null, index.h("smoothly-accordion-item", { name: "A", open: true }, index.h("smoothly-radio", { name: "a", value: "1" }, "a 1"), index.h("smoothly-radio", { name: "a", value: "2", checked: true }, "a 2"), index.h("smoothly-radio", { name: "a", value: "3" }, "a 3")), index.h("smoothly-accordion-item", { name: "B" }, index.h("smoothly-radio", { name: "b", value: "1" }, "b 1"), index.h("smoothly-radio", { name: "b", value: "2" }, "b 2"), index.h("smoothly-radio", { name: "b", value: "3" }, "b 3")))), index.h("fieldset", null, index.h("h2", null, "Smoothly checkbox"), index.h("smoothly-checkbox", { selectAll: true, intermediate: true }), index.h("smoothly-checkbox", null), index.h("smoothly-checkbox", { disabled: true })), index.h("fieldset", null, index.h("h2", null, "Smoothly addresses"), index.h("smoothly-address-display", { value: '{ "countryCode": "SE", "street": "Korkstigen 2", "zipCode": "654 31", "city": "Fejksala" }' }), index.h("smoothly-address", { editable: false, value: '{ "countryCode": "SE", "street": "Stigv\u00E4gen 34", "zipCode": "123 45", "city": "Hobbiton" }' }), index.h("smoothly-addresses", { allowed: "billing delivery visit", editable: true, value: '{ "billing": { "countryCode": "SE", "street": "Rundslingan 3", "zipCode": "987 65", "city": "Klotby" }, "visit": { "countryCode": "SE", "street": "G\u00E5ngbanan 34", "zipCode": "543 21", "city": "Trasktr\u00E4sk" } }' }))), index.h("footer", null, index.h("smoothly-submit", { expand: "block", onSubmit: (e) => alert(e), color: "success" }, "Submit"), index.h("smoothly-submit", { disabled: true, expand: "block", onClick: e => console.log(e), onSubmit: (e) => alert(e), color: "success" }, "Submit"), index.h("smoothly-trigger", { expand: "block", color: "success", onClick: (e) => console.log(e.detail) }, "Trigger"))),
9217
9333
  index.h("smoothly-backtotop", null),
9218
9334
  ];
9219
9335
  }
@@ -59,7 +59,7 @@ export class SmoothlyDisplay {
59
59
  "mutable": false,
60
60
  "complexType": {
61
61
  "original": "Type",
62
- "resolved": "\"card-csc\" | \"card-expires\" | \"card-number\" | \"date\" | \"date-time\" | \"divisor\" | \"duration\" | \"email\" | \"identity-number\" | \"password\" | \"percent\" | \"phone\" | \"postal-code\" | \"price\" | \"text\"",
62
+ "resolved": "\"text\" | \"divisor\" | \"email\" | \"postal-code\" | \"date\" | \"password\" | \"card-csc\" | \"card-expires\" | \"card-number\" | \"date-time\" | \"duration\" | \"identifier-code\" | \"identifier-pascal\" | \"identifier-snake\" | \"identifier-camel\" | \"identifier-attribute\" | \"identity-number\" | \"integer\" | \"percent\" | \"phone\" | \"price\"",
63
63
  "references": {
64
64
  "Type": {
65
65
  "location": "import",
@@ -2,7 +2,7 @@ import { h } from "@stencil/core";
2
2
  export class SmoothlyInputDemo {
3
3
  render() {
4
4
  return [
5
- h("form", { action: "done", style: { position: "relative" } }, h("header", null, h("h5", null, "Form")), h("main", null, h("fieldset", null, h("h2", null, "Smoothly Input"), h("h3", null, "Card"), h("smoothly-input", { type: "text", name: "name", readonly: true, value: "Readonly", onSmoothlyBlur: () => console.log("smoothly blur") }, "Readonly"), h("smoothly-input", { type: "text", name: "name.last", onSmoothlyChange: e => console.log("smoothly change event") }, "Name"), h("smoothly-input", { type: "text", name: "name.first", onSmoothlyChange: e => console.log("smoothly change event") }, "Name"), h("smoothly-input-date", null), h("smoothly-input", { type: "date", name: "date" }, "Date"), h("smoothly-input", { type: "date-time", name: "date-time" }, "Date-Time"), h("smoothly-input", { type: "divisor", name: "divisor" }, "Divisor"), h("smoothly-input", { type: "text", name: "street", value: "street" }, "Street"), h("smoothly-input", { type: "card-number", name: "card" }, "Card #"), h("smoothly-input", { type: "card-expires", name: "card", style: { width: "calc(60% - 2px)" } }, "Expires"), h("smoothly-input", { type: "card-csc", name: "card", style: { width: "calc(40% - 1px)", borderLeft: "none" } }, "CVV/CVC"), h("h3", null, "Contact"), h("smoothly-input", { type: "postal-code", name: "zip", style: { width: "calc(60% - 2px)" } }, "ZipCode"), h("smoothly-input", { type: "text", name: "testing" }, "Texttest"), h("smoothly-input", { type: "password", name: "password" }, "Password"), h("smoothly-input", { type: "email", name: "email" }, "Email"), h("smoothly-input", { type: "price", currency: "SEK", name: "price" }, "Price"), h("smoothly-input", { type: "percent", name: "percent" }, "Percent"), h("smoothly-input", { type: "phone", name: "phone" }, "Phone"), h("smoothly-input-date", { name: "some-date" }, "Calendar"), h("smoothly-input-date", { name: "some-date", color: "tertiary" }, "Calendar (chosen color)"), h("smoothly-input-date", { name: "some-date", flexible: true }, "Calendar (no min-width)")), h("fieldset", null, h("h2", null, "Smoothly Radio"), h("h3", null, "Deselectable Radio List with button"), h("smoothly-radio-button", { deselectable: true, decoration: "button" }, h("smoothly-radio-button-item", { value: { some: "content", yes: "sir" }, color: "primary", iconColor: "medium" }, h("span", null, "Option 1"), h("span", { slot: "expansion" }, "Some description.")), h("smoothly-radio-button-item", { value: { some: "thing", yes: "miss" }, iconColor: "light" }, h("span", null, "Option 2"), h("span", { slot: "expansion" }, "Some other description.")), h("smoothly-radio-button-item", { value: { some: "one", yes: "kid" }, iconColor: "danger" }, h("span", null, "Option 3")), h("smoothly-radio-button-item", { value: { some: "some", yes: "thing" }, disabled: true }, h("span", null, "Option 4 (Disabled)"))), h("h3", null, "Radio List with button"), h("smoothly-radio-button", { decoration: "button" }, h("smoothly-radio-button-item", { value: { some: "content", yes: "sir" }, color: "warning" }, h("span", null, "Option 1"), h("span", { slot: "expansion" }, "Some description.")), h("smoothly-radio-button-item", { value: { some: "thing", yes: "miss" } }, h("span", null, "Option 2"), h("span", { slot: "expansion" }, "Some other description.")), h("smoothly-radio-button-item", { value: { some: "one", yes: "kid" } }, h("span", null, "Option 3"))), h("h3", null, "Radio List ", h("b", null, "without button")), h("smoothly-radio-button", null, h("smoothly-radio-button-item", { value: { some: "content", yes: "sir" }, selected: true, color: "light" }, h("span", null, "Option 1"), h("span", { slot: "expansion" }, "Some description.")), h("smoothly-radio-button-item", { value: { some: "thing", yes: "miss" }, color: "light" }, h("span", null, "Option 2"), h("span", { slot: "expansion" }, "Some other description.")), h("smoothly-radio-button-item", { value: { some: "one", yes: "kid" }, color: "light" }, h("span", null, "Option 3"))), h("smoothly-radio", { name: "option", value: "1" }, "option 1"), h("smoothly-radio", { name: "option", value: "2", checked: true }, "option 2"), h("smoothly-radio", { name: "option", value: "3" }, "option 3")), h("fieldset", null, h("h2", null, "Smoothly Accordion"), h("smoothly-accordion", null, h("smoothly-accordion-item", { name: "A", open: true }, h("smoothly-radio", { name: "a", value: "1" }, "a 1"), h("smoothly-radio", { name: "a", value: "2", checked: true }, "a 2"), h("smoothly-radio", { name: "a", value: "3" }, "a 3")), h("smoothly-accordion-item", { name: "B" }, h("smoothly-radio", { name: "b", value: "1" }, "b 1"), h("smoothly-radio", { name: "b", value: "2" }, "b 2"), h("smoothly-radio", { name: "b", value: "3" }, "b 3")))), h("fieldset", null, h("h2", null, "Smoothly checkbox"), h("smoothly-checkbox", { selectAll: true, intermediate: true }), h("smoothly-checkbox", null), h("smoothly-checkbox", { disabled: true })), h("fieldset", null, h("h2", null, "Smoothly addresses"), h("smoothly-address-display", { value: '{ "countryCode": "SE", "street": "Korkstigen 2", "zipCode": "654 31", "city": "Fejksala" }' }), h("smoothly-address", { editable: false, value: '{ "countryCode": "SE", "street": "Stigv\u00E4gen 34", "zipCode": "123 45", "city": "Hobbiton" }' }), h("smoothly-addresses", { allowed: "billing delivery visit", editable: true, value: '{ "billing": { "countryCode": "SE", "street": "Rundslingan 3", "zipCode": "987 65", "city": "Klotby" }, "visit": { "countryCode": "SE", "street": "G\u00E5ngbanan 34", "zipCode": "543 21", "city": "Trasktr\u00E4sk" } }' }))), h("footer", null, h("smoothly-submit", { expand: "block", onSubmit: (e) => alert(e), color: "success" }, "Submit"), h("smoothly-submit", { disabled: true, expand: "block", onClick: e => console.log(e), onSubmit: (e) => alert(e), color: "success" }, "Submit"), h("smoothly-trigger", { expand: "block", color: "success", onClick: (e) => console.log(e.detail) }, "Trigger"))),
5
+ h("form", { action: "done", style: { position: "relative" } }, h("header", null, h("h5", null, "Form")), h("main", null, h("fieldset", null, h("h2", null, "Smoothly Input"), h("h3", null, "Card"), h("smoothly-input", { type: "text", name: "name", readonly: true, value: "Readonly", onSmoothlyBlur: () => console.log("smoothly blur") }, "Readonly"), h("smoothly-input", { type: "text", name: "name.last", onSmoothlyChange: e => console.log("smoothly change event") }, "Name"), h("smoothly-input", { type: "text", name: "name.first", onSmoothlyChange: e => console.log("smoothly change event") }, "Name"), h("smoothly-input-date", null), h("smoothly-input", { type: "date", name: "date" }, "Date"), h("smoothly-input", { type: "date-time", name: "date-time" }, "Date-Time"), h("smoothly-input", { type: "divisor", name: "divisor" }, "Divisor"), h("smoothly-input", { type: "text", name: "street", value: "street" }, "Street"), h("smoothly-input", { type: "card-number", name: "card" }, "Card #"), h("smoothly-input", { type: "card-expires", name: "card", style: { width: "calc(60% - 2px)" } }, "Expires"), h("smoothly-input", { type: "card-csc", name: "card", style: { width: "calc(40% - 1px)", borderLeft: "none" } }, "CVV/CVC"), h("h3", null, "Contact"), h("smoothly-input", { type: "postal-code", name: "zip", style: { width: "calc(60% - 2px)" } }, "ZipCode"), h("smoothly-input", { type: "text", name: "testing" }, "Texttest"), h("smoothly-input", { type: "integer", name: "integer" }, "Integer"), h("smoothly-input", { type: "identifier-code", name: "identifier-code" }, "Identifier"), h("smoothly-input", { type: "password", name: "password" }, "Password"), h("smoothly-input", { type: "email", name: "email" }, "Email"), h("smoothly-input", { type: "price", currency: "SEK", name: "price" }, "Price"), h("smoothly-input", { type: "percent", name: "percent" }, "Percent"), h("smoothly-input", { type: "phone", name: "phone" }, "Phone"), h("smoothly-input-date", { name: "some-date" }, "Calendar"), h("smoothly-input-date", { name: "some-date", color: "tertiary" }, "Calendar (chosen color)"), h("smoothly-input-date", { name: "some-date", flexible: true }, "Calendar (no min-width)")), h("fieldset", null, h("h2", null, "Smoothly Radio"), h("h3", null, "Deselectable Radio List with button"), h("smoothly-radio-button", { deselectable: true, decoration: "button" }, h("smoothly-radio-button-item", { value: { some: "content", yes: "sir" }, color: "primary", iconColor: "medium" }, h("span", null, "Option 1"), h("span", { slot: "expansion" }, "Some description.")), h("smoothly-radio-button-item", { value: { some: "thing", yes: "miss" }, iconColor: "light" }, h("span", null, "Option 2"), h("span", { slot: "expansion" }, "Some other description.")), h("smoothly-radio-button-item", { value: { some: "one", yes: "kid" }, iconColor: "danger" }, h("span", null, "Option 3")), h("smoothly-radio-button-item", { value: { some: "some", yes: "thing" }, disabled: true }, h("span", null, "Option 4 (Disabled)"))), h("h3", null, "Radio List with button"), h("smoothly-radio-button", { decoration: "button" }, h("smoothly-radio-button-item", { value: { some: "content", yes: "sir" }, color: "warning" }, h("span", null, "Option 1"), h("span", { slot: "expansion" }, "Some description.")), h("smoothly-radio-button-item", { value: { some: "thing", yes: "miss" } }, h("span", null, "Option 2"), h("span", { slot: "expansion" }, "Some other description.")), h("smoothly-radio-button-item", { value: { some: "one", yes: "kid" } }, h("span", null, "Option 3"))), h("h3", null, "Radio List ", h("b", null, "without button")), h("smoothly-radio-button", null, h("smoothly-radio-button-item", { value: { some: "content", yes: "sir" }, selected: true, color: "light" }, h("span", null, "Option 1"), h("span", { slot: "expansion" }, "Some description.")), h("smoothly-radio-button-item", { value: { some: "thing", yes: "miss" }, color: "light" }, h("span", null, "Option 2"), h("span", { slot: "expansion" }, "Some other description.")), h("smoothly-radio-button-item", { value: { some: "one", yes: "kid" }, color: "light" }, h("span", null, "Option 3"))), h("smoothly-radio", { name: "option", value: "1" }, "option 1"), h("smoothly-radio", { name: "option", value: "2", checked: true }, "option 2"), h("smoothly-radio", { name: "option", value: "3" }, "option 3")), h("fieldset", null, h("h2", null, "Smoothly Accordion"), h("smoothly-accordion", null, h("smoothly-accordion-item", { name: "A", open: true }, h("smoothly-radio", { name: "a", value: "1" }, "a 1"), h("smoothly-radio", { name: "a", value: "2", checked: true }, "a 2"), h("smoothly-radio", { name: "a", value: "3" }, "a 3")), h("smoothly-accordion-item", { name: "B" }, h("smoothly-radio", { name: "b", value: "1" }, "b 1"), h("smoothly-radio", { name: "b", value: "2" }, "b 2"), h("smoothly-radio", { name: "b", value: "3" }, "b 3")))), h("fieldset", null, h("h2", null, "Smoothly checkbox"), h("smoothly-checkbox", { selectAll: true, intermediate: true }), h("smoothly-checkbox", null), h("smoothly-checkbox", { disabled: true })), h("fieldset", null, h("h2", null, "Smoothly addresses"), h("smoothly-address-display", { value: '{ "countryCode": "SE", "street": "Korkstigen 2", "zipCode": "654 31", "city": "Fejksala" }' }), h("smoothly-address", { editable: false, value: '{ "countryCode": "SE", "street": "Stigv\u00E4gen 34", "zipCode": "123 45", "city": "Hobbiton" }' }), h("smoothly-addresses", { allowed: "billing delivery visit", editable: true, value: '{ "billing": { "countryCode": "SE", "street": "Rundslingan 3", "zipCode": "987 65", "city": "Klotby" }, "visit": { "countryCode": "SE", "street": "G\u00E5ngbanan 34", "zipCode": "543 21", "city": "Trasktr\u00E4sk" } }' }))), h("footer", null, h("smoothly-submit", { expand: "block", onSubmit: (e) => alert(e), color: "success" }, "Submit"), h("smoothly-submit", { disabled: true, expand: "block", onClick: e => console.log(e), onSubmit: (e) => alert(e), color: "success" }, "Submit"), h("smoothly-trigger", { expand: "block", color: "success", onClick: (e) => console.log(e.detail) }, "Trigger"))),
6
6
  h("smoothly-backtotop", null),
7
7
  ];
8
8
  }