sprintify-ui 0.0.175 → 0.0.176

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.
@@ -2185,12 +2185,10 @@ const el = /* @__PURE__ */ new WeakMap(), tl = (t) => {
2185
2185
  },
2186
2186
  emits: ["update:model-value"],
2187
2187
  setup(t, { emit: i }) {
2188
- const e = t, r = Y(
2189
- () => {
2190
- const p = St(e.modelValue ?? {});
2191
- return p.address_1 = p.address_1 ?? "", p.address_2 = p.address_2 ?? "", p.city = p.city ?? "", p.postal_code = p.postal_code ?? "", p.country = p.country ?? "", p.region = p.region ?? "", p;
2192
- }
2193
- ), o = Y(() => e.countries && mt(e.countries) && e.countries.length ? e.countries : nt.countries), a = Y(() => e.regions && mt(e.regions) && e.regions.length ? e.regions : nt.regions), l = Y(() => a.value.filter(
2188
+ const e = t, r = Y(() => {
2189
+ const p = St(e.modelValue ?? {});
2190
+ return p.address_1 = p.address_1 ?? "", p.address_2 = p.address_2 ?? "", p.city = p.city ?? "", p.postal_code = p.postal_code ?? "", p.country = p.country ?? "", p.region = p.region ?? "", p;
2191
+ }), o = Y(() => e.countries && mt(e.countries) && e.countries.length ? e.countries : nt.countries), a = Y(() => e.regions && mt(e.regions) && e.regions.length ? e.regions : nt.regions), l = Y(() => a.value.filter(
2194
2192
  (p) => p.country_id == r.value.country
2195
2193
  )), u = Y(() => e.prefix ? e.prefix + "." : "");
2196
2194
  function c(p, w) {
@@ -2219,7 +2217,7 @@ const el = /* @__PURE__ */ new WeakMap(), tl = (t) => {
2219
2217
  return;
2220
2218
  const p = d.getPlace();
2221
2219
  let w = "", b = "", v = "";
2222
- const g = St(e.modelValue);
2220
+ const g = St(e.modelValue ?? {});
2223
2221
  if (p.address_components) {
2224
2222
  for (const n of p.address_components)
2225
2223
  switch (n.types[0]) {
@@ -1,7 +1,7 @@
1
1
  import { Country } from '@/types/Country';
2
2
  import { Region } from '@/types/Region';
3
3
  declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
4
- modelValue: Record<string, string | number | null | undefined>;
4
+ modelValue: Record<string, string | number | null | undefined> | null | undefined;
5
5
  prefix: string | null;
6
6
  countries?: Country[] | undefined;
7
7
  regions?: Region[] | undefined;
@@ -11,7 +11,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
11
11
  countries(): never[];
12
12
  regions(): never[];
13
13
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:model-value"[], "update:model-value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
14
- modelValue: Record<string, string | number | null | undefined>;
14
+ modelValue: Record<string, string | number | null | undefined> | null | undefined;
15
15
  prefix: string | null;
16
16
  countries?: Country[] | undefined;
17
17
  regions?: Region[] | undefined;
@@ -23,7 +23,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
23
23
  }>>> & {
24
24
  "onUpdate:model-value"?: ((...args: any[]) => any) | undefined;
25
25
  }, {
26
- modelValue: Record<string, string | number | null | undefined>;
26
+ modelValue: Record<string, string | number | null | undefined> | null | undefined;
27
27
  prefix: string | null;
28
28
  countries: Country[];
29
29
  regions: Region[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.0.175",
3
+ "version": "0.0.176",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -100,9 +100,11 @@ import BaseInput from './BaseInput.vue';
100
100
  import BaseSelect from './BaseSelect.vue';
101
101
  import { config } from '..';
102
102
 
103
+ type Address = Record<string, string | number | null | undefined>;
104
+
103
105
  const props = withDefaults(
104
106
  defineProps<{
105
- modelValue: Record<string, string | number | null | undefined>;
107
+ modelValue: undefined | null | Address;
106
108
  prefix: string | null;
107
109
  countries?: Country[];
108
110
  regions?: Region[];
@@ -123,18 +125,16 @@ const props = withDefaults(
123
125
 
124
126
  const emit = defineEmits(['update:model-value']);
125
127
 
126
- const normalizedModelValue = computed(
127
- (): Record<string, string | number | null | undefined> => {
128
- const form = cloneDeep(props.modelValue ?? {});
129
- form.address_1 = form.address_1 ?? '';
130
- form.address_2 = form.address_2 ?? '';
131
- form.city = form.city ?? '';
132
- form.postal_code = form.postal_code ?? '';
133
- form.country = form.country ?? '';
134
- form.region = form.region ?? '';
135
- return form;
136
- }
137
- );
128
+ const normalizedModelValue = computed((): Address => {
129
+ const form = cloneDeep(props.modelValue ?? {});
130
+ form.address_1 = form.address_1 ?? '';
131
+ form.address_2 = form.address_2 ?? '';
132
+ form.city = form.city ?? '';
133
+ form.postal_code = form.postal_code ?? '';
134
+ form.country = form.country ?? '';
135
+ form.region = form.region ?? '';
136
+ return form;
137
+ });
138
138
 
139
139
  const countries = computed((): Country[] => {
140
140
  if (props.countries && isArray(props.countries) && props.countries.length) {
@@ -211,7 +211,7 @@ function fillAddress() {
211
211
  let postcode = '';
212
212
  let region = '';
213
213
 
214
- const newForm = cloneDeep(props.modelValue);
214
+ const newForm = cloneDeep(props.modelValue ?? {});
215
215
 
216
216
  if (!place.address_components) {
217
217
  return;