@omnic/widget-locations 1.0.46 → 1.0.48

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/README.md CHANGED
@@ -132,36 +132,38 @@ Then `OMNIC_WIDGET_LOCATIONS_CONFIG` has the following structure:
132
132
  `WidgetInputs` type has the following structure:
133
133
 
134
134
  ```typescript
135
- export type ForwardedInputElement<T> = T & {
135
+ export interface ForwardedInputElement extends Pick<HTMLInputElement, "focus" | "blur"> {
136
136
  setValue: (value: string) => void;
137
- };
137
+ }
138
138
 
139
- export interface InputConfig<T> {
139
+ export interface InputConfig {
140
140
  name: string;
141
- ref: RefObject<ForwardedInputElement<T>>;
142
- onClick: (name: string) => void;
141
+ ref: RefObject<ForwardedInputElement>;
142
+ onClick?: (name: string) => void;
143
143
  }
144
144
 
145
145
  export interface WidgetInputs {
146
146
  /**
147
- * Widget Map address input
147
+ Widget Map address input
148
148
  */
149
- address: InputConfig<HTMLInputElement>;
149
+ address: InputConfig;
150
150
  /**
151
151
  * Widget city input
152
152
  */
153
- city: InputConfig<HTMLInputElement>;
153
+ city: InputConfig;
154
154
  /**
155
155
  * Courier delivery apartment input
156
156
  */
157
- apartment: InputConfig<HTMLTextAreaElement>;
157
+ apartment: InputConfig;
158
158
  /**
159
159
  * Courier delivery comment input
160
160
  */
161
- comment: InputConfig<HTMLTextAreaElement>;
161
+ comment: InputConfig;
162
162
  }
163
163
  ```
164
164
 
165
+ **NOTE:** when using screen keyboard do not forget to call `focus()` method for `address` and `city` inputs, so that autocomplete will appear.
166
+
165
167
  Include `styles.css` and `widget.umd.js` in your page:
166
168
 
167
169
  ```html
@@ -1,10 +1,11 @@
1
- import { ReactNode } from "react";
1
+ import { ReactNode, RefObject } from "react";
2
2
  import { ForwardedInputElement } from '../../types/config';
3
3
  interface InputProps extends React.AllHTMLAttributes<HTMLInputElement> {
4
4
  label?: string;
5
5
  className?: string;
6
6
  startAdornment?: ReactNode;
7
7
  endAdornment?: ReactNode;
8
+ inputRef?: RefObject<HTMLInputElement>;
8
9
  }
9
- export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<ForwardedInputElement<HTMLInputElement>>>;
10
+ export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<ForwardedInputElement>>;
10
11
  export {};
@@ -1,3 +1,7 @@
1
- /// <reference types="react" />
1
+ import { RefObject } from "react";
2
2
  import { ForwardedInputElement } from '../../types/config';
3
- export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & import("react").RefAttributes<ForwardedInputElement<HTMLTextAreaElement>>>;
3
+ interface TextAreaProps extends React.ComponentProps<"textarea"> {
4
+ inputRef?: RefObject<HTMLTextAreaElement>;
5
+ }
6
+ export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<TextAreaProps, "ref"> & import("react").RefAttributes<ForwardedInputElement>>;
7
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { InputConfig } from '../types/config';
2
- export declare const useInputValueHandler: <T extends InputConfig<unknown>>(ref: Nullable<T>, callback: (value: string) => void) => {
2
+ export declare const useInputValueHandler: <T extends InputConfig>(input: Nullable<T>) => {
3
3
  readonly ref: T["ref"];
4
4
  readonly name: string | undefined;
5
5
  readonly onClick: () => void;
@@ -11,31 +11,31 @@ export interface MapConfig {
11
11
  center?: Coordinates;
12
12
  provider?: MapProvider;
13
13
  }
14
- export type ForwardedInputElement<T> = T & {
14
+ export interface ForwardedInputElement extends Pick<HTMLInputElement, "focus" | "blur"> {
15
15
  setValue: (value: string) => void;
16
- };
17
- export interface InputConfig<T> {
16
+ }
17
+ export interface InputConfig {
18
18
  name: string;
19
- ref: RefObject<ForwardedInputElement<T>>;
20
- onClick: (name: string) => void;
19
+ ref: RefObject<ForwardedInputElement>;
20
+ onClick?: (name: string) => void;
21
21
  }
22
22
  export interface WidgetInputs {
23
23
  /**
24
- * Widget Map address input
24
+ Widget Map address input
25
25
  */
26
- address: InputConfig<HTMLInputElement>;
26
+ address: InputConfig;
27
27
  /**
28
28
  * Widget city input
29
29
  */
30
- city: InputConfig<HTMLInputElement>;
30
+ city: InputConfig;
31
31
  /**
32
32
  * Courier delivery apartment input
33
33
  */
34
- apartment: InputConfig<HTMLTextAreaElement>;
34
+ apartment: InputConfig;
35
35
  /**
36
36
  * Courier delivery comment input
37
37
  */
38
- comment: InputConfig<HTMLTextAreaElement>;
38
+ comment: InputConfig;
39
39
  }
40
40
  export interface WidgetConfig {
41
41
  INN: INNType;