@arkyn/components 1.3.105 → 1.3.108

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/GoogleSearchPlaces/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAYvD,iBAAS,kBAAkB,CAAC,EAC1B,QAAQ,EACR,cAAc,EACd,OAAO,EACP,GAAG,IAAI,EACR,EAAE,uBAAuB,2CAiDzB;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/GoogleSearchPlaces/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAYvD,iBAAS,kBAAkB,CAAC,EAC1B,QAAQ,EACR,cAAc,EACd,OAAO,EACP,GAAG,IAAI,EACR,EAAE,uBAAuB,2CA2DzB;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -15,11 +15,19 @@ function GoogleSearchPlaces({ onChange, onPlaceChanged, options, ...rest }) {
15
15
  return data.long_name;
16
16
  return "";
17
17
  }
18
+ function findDataShort(key) {
19
+ const data = address_components.find((item) => item.types[0] === key);
20
+ if (data)
21
+ return data.short_name;
22
+ return "";
23
+ }
18
24
  if (place) {
19
25
  const street = findData("route");
26
+ const streetNumber = findData("streetNumber");
20
27
  const district = findData("sublocality_level_1");
21
28
  const city = findData("administrative_area_level_2");
22
29
  const state = findData("administrative_area_level_1");
30
+ const stateShortName = findDataShort("administrative_area_level_1");
23
31
  const cep = findData("postal_code");
24
32
  const lat = place.geometry?.location?.lat();
25
33
  const lng = place.geometry?.location?.lng();
@@ -29,6 +37,8 @@ function GoogleSearchPlaces({ onChange, onPlaceChanged, options, ...rest }) {
29
37
  state,
30
38
  district,
31
39
  cep,
40
+ streetNumber,
41
+ stateShortName,
32
42
  coordinates: { lat, lng },
33
43
  };
34
44
  onPlaceChanged && onPlaceChanged(sendPlace);
@@ -13,6 +13,6 @@ function Switch(props) {
13
13
  }
14
14
  const checkedClass = currentChecked ? "checkedTrue" : "checkedFalse";
15
15
  const className = `arkynSwitch ${checkedClass} ${size} ${baseClassName}`;
16
- return (_jsx("button", { id: id, type: "button", onClick: handleCheck, className: className, ...rest, name: name, ref: inputRef, value: currentChecked ? value || "checked" : "" }));
16
+ return (_jsx("button", { type: "button", onClick: handleCheck, className: className, ...rest, children: _jsx("input", { id: id, type: "hidden", name: name, ref: inputRef, onClick: handleCheck, value: currentChecked ? value || "checked" : unCheckedValue }) }));
17
17
  }
18
18
  export { Switch };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkyn/components",
3
- "version": "1.3.105",
3
+ "version": "1.3.108",
4
4
  "main": "./dist/bundle.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Lucas Gonçalves",
@@ -32,11 +32,19 @@ function GoogleSearchPlaces({
32
32
  return "";
33
33
  }
34
34
 
35
+ function findDataShort(key: string) {
36
+ const data = address_components.find((item) => item.types[0] === key);
37
+ if (data) return data.short_name;
38
+ return "";
39
+ }
40
+
35
41
  if (place) {
36
42
  const street = findData("route");
43
+ const streetNumber = findData("streetNumber");
37
44
  const district = findData("sublocality_level_1");
38
45
  const city = findData("administrative_area_level_2");
39
46
  const state = findData("administrative_area_level_1");
47
+ const stateShortName = findDataShort("administrative_area_level_1");
40
48
  const cep = findData("postal_code");
41
49
 
42
50
  const lat = place.geometry?.location?.lat();
@@ -48,6 +56,8 @@ function GoogleSearchPlaces({
48
56
  state,
49
57
  district,
50
58
  cep,
59
+ streetNumber,
60
+ stateShortName,
51
61
  coordinates: { lat, lng },
52
62
  };
53
63
 
@@ -32,16 +32,16 @@ function Switch(props: SwitchProps) {
32
32
  const className = `arkynSwitch ${checkedClass} ${size} ${baseClassName}`;
33
33
 
34
34
  return (
35
- <button
36
- id={id}
37
- type="button"
38
- onClick={handleCheck}
39
- className={className}
40
- {...rest}
41
- name={name}
42
- ref={inputRef as any}
43
- value={currentChecked ? value || "checked" : ""}
44
- />
35
+ <button type="button" onClick={handleCheck} className={className} {...rest}>
36
+ <input
37
+ id={id}
38
+ type="hidden"
39
+ name={name}
40
+ ref={inputRef}
41
+ onClick={handleCheck}
42
+ value={currentChecked ? value || "checked" : unCheckedValue}
43
+ />
44
+ </button>
45
45
  );
46
46
  }
47
47