@stackloop/ui 4.0.8 → 4.0.9

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
@@ -228,10 +228,10 @@ Call `setupRippleEffects()` only once per app (for example in `main.tsx`) to avo
228
228
  **Input**:
229
229
  - **Description:** Unified input API with smart type routing. Supports native text/password/email/etc plus `phone`, `country`, and `date` while keeping a consistent `value` + `onChange` pattern.
230
230
  - **Props:**
231
- - **`type`**: Native HTML input types plus `'phone' | 'country'`.
231
+ - **`type`**: Native HTML input types plus `'phone' | 'tel' | 'country'`.
232
232
  - `type="date"` renders the library `DatePicker`.
233
233
  - `type="country"` renders `CountrySelect`.
234
- - `type="phone"` renders `PhoneInput`.
234
+ - `type="phone"` and `type="tel"` render `PhoneInput`.
235
235
  - **`value`**: `string | number | readonly string[] | Date`.
236
236
  - **`onChange`**: `(value: string | Date) => void` — value-based callback used consistently across smart/native modes.
237
237
  - **`onValueChange`**: `(value: string | Date) => void` — optional backward-compatible alias.
@@ -254,10 +254,14 @@ Call `setupRippleEffects()` only once per app (for example in `main.tsx`) to avo
254
254
  import { Input } from '@stackloop/ui'
255
255
 
256
256
  <Input label="Email" placeholder="you@example.com" />
257
+ <Input label="Phone" type="phone" value={phone} onChange={setPhone} />
258
+ <Input label="Telephone" type="tel" value={phone} onChange={setPhone} />
257
259
 
258
260
  // Password with automatic toggle
259
261
  <Input label="Password" type="password" placeholder="Enter password" />
260
262
 
263
+
264
+ - **Compatibility note:** Regular HTML input types still render a native `<input />`, so existing usage such as `type="email"`, `type="number"`, and `type="text"` remains unchanged.
261
265
  // Phone (single combined value)
262
266
  <Input
263
267
  label="Phone"
package/dist/Input.d.ts CHANGED
@@ -1,16 +1,39 @@
1
1
  import React from 'react';
2
- type SmartInputType = React.HTMLInputTypeAttribute | 'country' | 'phone';
3
- export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'onChange'> {
4
- type?: SmartInputType;
5
- value?: string | number | readonly string[] | Date;
6
- onChange?: (value: string | Date) => void;
7
- onValueChange?: (value: string | Date) => void;
2
+ import { DatePicker } from './DatePicker';
3
+ import { CountrySelect } from './CountrySelect';
4
+ import { PhoneInput } from './PhoneInput';
5
+ type InputValue = string | Date;
6
+ type NativeInputType = Exclude<React.HTMLInputTypeAttribute, 'date' | 'phone' | 'country' | 'tel'>;
7
+ type NativeInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'onChange'> & {
8
+ type?: NativeInputType;
9
+ value?: string | number | readonly string[];
10
+ onChange?: (value: InputValue) => void;
11
+ onValueChange?: (value: InputValue) => void;
8
12
  label?: string;
9
13
  error?: string;
10
14
  hint?: string;
11
15
  leftIcon?: React.ReactNode;
12
16
  rightIcon?: React.ReactNode;
13
17
  animate?: boolean;
14
- }
18
+ };
19
+ type PhoneInputFieldProps = Omit<React.ComponentProps<typeof PhoneInput>, 'value' | 'onChange'> & {
20
+ type: 'phone' | 'tel';
21
+ value?: string;
22
+ onChange?: (value: InputValue) => void;
23
+ onValueChange?: (value: InputValue) => void;
24
+ };
25
+ type CountrySelectInputProps = Omit<React.ComponentProps<typeof CountrySelect>, 'value' | 'onChange'> & {
26
+ type: 'country';
27
+ value?: string;
28
+ onChange?: (value: InputValue) => void;
29
+ onValueChange?: (value: InputValue) => void;
30
+ };
31
+ type DatePickerInputProps = Omit<React.ComponentProps<typeof DatePicker>, 'value' | 'onChange'> & {
32
+ type: 'date';
33
+ value?: Date;
34
+ onChange?: (value: InputValue) => void;
35
+ onValueChange?: (value: InputValue) => void;
36
+ };
37
+ export type InputProps = NativeInputProps | PhoneInputFieldProps | CountrySelectInputProps | DatePickerInputProps;
15
38
  export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
16
39
  export {};