sveltacular 0.0.66 → 0.0.67

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.
@@ -28,6 +28,7 @@ const cleanValue = (value2) => {
28
28
  };
29
29
  const publishChange = () => {
30
30
  value = cleanValue(`${areaCode}${localExt}${lastFour}`);
31
+ console.log("publishChange", value);
31
32
  dispatch("change", value);
32
33
  return value;
33
34
  };
@@ -53,8 +54,7 @@ const valueChanged = (event) => {
53
54
  }
54
55
  props.target.value = newValue.slice(0, props.maxLength);
55
56
  if (newValue.length >= props.maxLength) {
56
- if (props.nextInput)
57
- props.nextInput.focus();
57
+ setTimeout(() => props.nextInput && props.nextInput.focus(), 1);
58
58
  }
59
59
  };
60
60
  const keyDown = (event) => {
@@ -78,7 +78,6 @@ const keyDown = (event) => {
78
78
  return isDelete ? props.value.slice(0, -1) : props.value + event.key;
79
79
  })();
80
80
  if (newValue.length >= props.maxLength) {
81
- event.preventDefault();
82
81
  props.target.value = newValue.slice(0, props.maxLength);
83
82
  if (props.nextInput)
84
83
  props.nextInput.focus();
@@ -1,23 +1,23 @@
1
1
  <script>import { capitalize } from "../../helpers/capitalize.js";
2
2
  import MobilePhoneIcon from "../../icons/mobile-phone-icon.svelte";
3
3
  import PhoneIcon from "../../icons/phone-icon.svelte";
4
- export let phoneNumber;
4
+ export let value;
5
5
  export let type = "mobile";
6
- const getDigits = (phoneNumber2) => {
7
- return phoneNumber2.replace(/[^0-9]/g, "");
6
+ const getDigits = (phoneNumber) => {
7
+ return phoneNumber.replace(/[^0-9]/g, "");
8
8
  };
9
- const formatPhoneNumber = (phoneNumber2) => {
10
- const cleaned = getDigits(phoneNumber2);
9
+ const formatPhoneNumber = (phoneNumber) => {
10
+ const cleaned = getDigits(phoneNumber);
11
11
  const match = cleaned.match(/^(\d{3})(\d{3})(\d{4})$/);
12
12
  if (match) {
13
13
  return "(" + match[1] + ") " + match[2] + "-" + match[3];
14
14
  }
15
- return phoneNumber2;
15
+ return phoneNumber;
16
16
  };
17
17
  $:
18
- formattedPhoneNumber = formatPhoneNumber(phoneNumber);
18
+ formattedPhoneNumber = formatPhoneNumber(value);
19
19
  $:
20
- phoneNumberDigits = getDigits(phoneNumber);
20
+ phoneNumberDigits = getDigits(value);
21
21
  $:
22
22
  protocol = type === "sms" ? "sms:" : "tel:";
23
23
  $:
@@ -1,7 +1,7 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
- phoneNumber: string;
4
+ value: string;
5
5
  type?: "sms" | "mobile" | "home" | "work" | "fax" | "other" | undefined;
6
6
  };
7
7
  events: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveltacular",
3
- "version": "0.0.66",
3
+ "version": "0.0.67",
4
4
  "description": "A Svelte component library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",