@stackloop/ui 3.0.0 → 3.2.0

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
@@ -163,7 +163,7 @@ import { Button, Modal } from '@stackloop/ui'
163
163
 
164
164
  Components with the `animate` prop:
165
165
 
166
- - `AudioRecorder`, `Badge`, `BottomSheet`, `Button`, `Card`, `CameraCapture`, `Checkbox`, `DatePicker`, `Drawer`, `Dropdown`, `DualSlider`, `FileUploader`, `FloatingActionButton`, `Input`, `Modal`, `Pagination`, `RadioPills`, `Select`, `Slider`, `Spinner`, `StepProgress`, `Table`, `Textarea`, `ThumbnailGrid`, `Toggle`, `ToastProvider`
166
+ - `AudioRecorder`, `Badge`, `BottomSheet`, `Button`, `Card`, `CameraCapture`, `Checkbox`, `CountrySelect`, `DatePicker`, `Drawer`, `Dropdown`, `DualSlider`, `FileUploader`, `FloatingActionButton`, `Input`, `Modal`, `Pagination`, `PhoneInput`, `RadioPills`, `Select`, `Slider`, `Spinner`, `StepProgress`, `Table`, `Textarea`, `ThumbnailGrid`, `Toggle`, `ToastProvider`
167
167
 
168
168
  **Checkbox**:
169
169
  - **Description:** Accessible checkbox with optional label and description.
@@ -230,6 +230,58 @@ Components with the `animate` prop:
230
230
  />
231
231
  ```
232
232
 
233
+ **PhoneInput**:
234
+ - **Description:** Phone number input with a country calling code selector and optional locale-based default.
235
+ - **Props:**
236
+ - **`value`**: `string` — optional.
237
+ - **`onChange`**: `(value: string) => void` — optional.
238
+ - **`country`**: `string` — optional ISO2 override (e.g. `US`).
239
+ - **`defaultCountry`**: `string` — default: `'US'`.
240
+ - **`autoDetect`**: `boolean` — default: `true`. Uses `navigator.language` to select a country.
241
+ - **`onCountryChange`**: `(country: Country) => void` — optional.
242
+ - **`searchable`**: `boolean` — default: `true`.
243
+ - **`showFlags`**: `boolean` — default: `true`.
244
+ - **`animate`**: `boolean` — default: `true`.
245
+ - Inherits standard `input` HTML attributes.
246
+ - **Usage:**
247
+
248
+ ```jsx
249
+ import { PhoneInput } from '@stackloop/ui'
250
+
251
+ <PhoneInput
252
+ label="Phone"
253
+ value={phone}
254
+ onChange={setPhone}
255
+ searchable
256
+ autoDetect
257
+ />
258
+ ```
259
+
260
+ **CountrySelect**:
261
+ - **Description:** Country selector built on `Select` with optional flags and search.
262
+ - **Props:**
263
+ - **`value`**: `string` — optional (ISO2, e.g. `US`).
264
+ - **`onChange`**: `(value: string) => void` — optional.
265
+ - **`onCountryChange`**: `(country: Country) => void` — optional.
266
+ - **`label`**: `string` — optional.
267
+ - **`placeholder`**: `string` — optional.
268
+ - **`searchable`**: `boolean` — default: `true`.
269
+ - **`clearable`**: `boolean` — default: `true`.
270
+ - **`showFlags`**: `boolean` — default: `true`.
271
+ - **`animate`**: `boolean` — default: `true`.
272
+ - **Usage:**
273
+
274
+ ```jsx
275
+ import { CountrySelect } from '@stackloop/ui'
276
+
277
+ <CountrySelect
278
+ label="Country"
279
+ value={country}
280
+ onChange={setCountry}
281
+ searchable
282
+ />
283
+ ```
284
+
233
285
  **Modal**:
234
286
  - **Description:** Centered modal with backdrop, title and Escape-to-close handling.
235
287
  - **Props:**
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { type Country } from './countries';
3
+ export interface CountrySelectProps {
4
+ value?: string;
5
+ onChange?: (value: string) => void;
6
+ onCountryChange?: (country: Country) => void;
7
+ label?: string;
8
+ placeholder?: string;
9
+ searchable?: boolean;
10
+ clearable?: boolean;
11
+ showFlags?: boolean;
12
+ disabled?: boolean;
13
+ animate?: boolean;
14
+ className?: string;
15
+ }
16
+ export declare const CountrySelect: React.FC<CountrySelectProps>;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { type Country } from './countries';
3
+ export interface PhoneInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange'> {
4
+ value?: string;
5
+ onChange?: (value: string) => void;
6
+ country?: string;
7
+ defaultCountry?: string;
8
+ autoDetect?: boolean;
9
+ onCountryChange?: (country: Country) => void;
10
+ label?: string;
11
+ error?: string;
12
+ hint?: string;
13
+ searchable?: boolean;
14
+ showFlags?: boolean;
15
+ animate?: boolean;
16
+ className?: string;
17
+ }
18
+ export declare const PhoneInput: React.FC<PhoneInputProps>;
@@ -0,0 +1,6 @@
1
+ export interface Country {
2
+ iso2: string;
3
+ name: string;
4
+ dialCode: string;
5
+ }
6
+ export declare const countries: Country[];