sprintify-ui 0.0.167 → 0.0.169

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.0.167",
3
+ "version": "0.0.169",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -7,23 +7,23 @@ export default {
7
7
  argTypes: {},
8
8
  args: {
9
9
  countries: [
10
- { code: 'US', name: 'United States', id: 'us' },
11
- { code: 'CA', name: 'Canada', id: 'ca' },
12
- { code: 'MX', name: 'Mexico', id: 'mx' },
10
+ { name: 'United States', id: 'us' },
11
+ { name: 'Canada', id: 'ca' },
12
+ { name: 'Mexico', id: 'mx' },
13
13
  ],
14
14
  regions: [
15
- { code: 'AL', name: 'Alabama', id: 'al', country_id: 'us' },
16
- { code: 'AK', name: 'Alaska', id: 'ak', country_id: 'us' },
17
- { code: 'AZ', name: 'Arizona', id: 'az', country_id: 'us' },
18
- { code: 'AB', name: 'Alberta', id: 'ab', country_id: 'ca' },
19
- { code: 'BC', name: 'British Columbia', id: 'bc', country_id: 'ca' },
20
- { code: 'MB', name: 'Manitoba', id: 'mb', country_id: 'ca' },
21
- { code: 'NS', name: 'Nova Scotia', id: 'ns', country_id: 'ca' },
22
- { code: 'ON', name: 'Ontario', id: 'on', country_id: 'ca' },
23
- { code: 'PE', name: 'Prince Edward Island', id: 'pe', country_id: 'ca' },
24
- { code: 'QC', name: 'Quebec', id: 'qc', country_id: 'ca' },
25
- { code: 'SK', name: 'Saskatchewan', id: 'sk', country_id: 'ca' },
26
- { code: 'NT', name: 'Northwest Territories', id: 'nt', country_id: 'ca' },
15
+ { name: 'Alabama', id: 'us-al', country_id: 'us' },
16
+ { name: 'Alaska', id: 'us-ak', country_id: 'us' },
17
+ { name: 'Arizona', id: 'us-az', country_id: 'us' },
18
+ { name: 'Alberta', id: 'ca-ab', country_id: 'ca' },
19
+ { name: 'British Columbia', id: 'ca-bc', country_id: 'ca' },
20
+ { name: 'Manitoba', id: 'ca-mb', country_id: 'ca' },
21
+ { name: 'Nova Scotia', id: 'ca-ns', country_id: 'ca' },
22
+ { name: 'Ontario', id: 'ca-on', country_id: 'ca' },
23
+ { name: 'Prince Edward Island', id: 'ca-pe', country_id: 'ca' },
24
+ { name: 'Quebec', id: 'ca-qc', country_id: 'ca' },
25
+ { name: 'Saskatchewan', id: 'ca-sk', country_id: 'ca' },
26
+ { name: 'Northwest Territories', id: 'ca-nt', country_id: 'ca' },
27
27
  ],
28
28
  },
29
29
  };
@@ -31,7 +31,16 @@ export default {
31
31
  const Template = (args) => ({
32
32
  components: { BaseAddressForm, ShowValue },
33
33
  setup() {
34
- const form = ref({});
34
+ const form = ref({
35
+ shipping_address: {
36
+ address_1: '333 rue Sherbrooke Est',
37
+ address_2: 'Suite 100',
38
+ city: 'Montreal',
39
+ country: 'ca',
40
+ region: 'qc',
41
+ postal_code: 'H2X 4E3',
42
+ },
43
+ });
35
44
  return { args, form };
36
45
  },
37
46
  template: `
@@ -62,15 +62,11 @@
62
62
  <BaseSelect
63
63
  :model-value="normalizedModelValue.country ?? ''"
64
64
  class="w-full"
65
+ :options="countries"
66
+ label-key="name"
67
+ value-key="id"
65
68
  @update:model-value="update('country', $event)"
66
69
  >
67
- <option
68
- v-for="country in countries"
69
- :key="country.id"
70
- :value="country.id"
71
- >
72
- {{ country.name }}
73
- </option>
74
70
  </BaseSelect>
75
71
  </BaseField>
76
72
  <BaseField
@@ -85,11 +81,11 @@
85
81
  :name="`${namePrefix}region`"
86
82
  class="w-full"
87
83
  required
84
+ :options="regions"
85
+ label-key="name"
86
+ value-key="id"
88
87
  @update:model-value="update('region', $event)"
89
88
  >
90
- <option v-for="region in regions" :key="region.id" :value="region.id">
91
- {{ region.name }}
92
- </option>
93
89
  </BaseSelect>
94
90
  </BaseField>
95
91
  </div>
@@ -214,6 +210,7 @@ function fillAddress() {
214
210
  const place = autocomplete.getPlace();
215
211
  let address1 = '';
216
212
  let postcode = '';
213
+ let region = '';
217
214
 
218
215
  const newForm = cloneDeep(props.modelValue);
219
216
 
@@ -249,7 +246,7 @@ function fillAddress() {
249
246
  newForm.city = component.long_name;
250
247
  break;
251
248
  case 'administrative_area_level_1': {
252
- newForm.region = component.short_name.toLowerCase();
249
+ region = component.short_name.toLowerCase();
253
250
  break;
254
251
  }
255
252
  case 'country':
@@ -258,15 +255,15 @@ function fillAddress() {
258
255
  }
259
256
  }
260
257
 
261
- nextTick(() => {
262
- newForm.address_1 = address1;
258
+ newForm.region = newForm.country + '-' + region;
259
+ newForm.address_1 = address1;
260
+ newForm.postal_code = postcode;
263
261
 
262
+ nextTick(() => {
264
263
  // Force value change
265
- if (address1Input.value) {
266
- //address1Input.value.value = address1;
267
- }
268
-
269
- newForm.postal_code = postcode;
264
+ /* if (address1Input.value) {
265
+ address1Input.value.value = address1;
266
+ } */
270
267
 
271
268
  emit('update:model-value', newForm);
272
269
  });