@stackloop/ui 3.3.4 → 4.0.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.
Potentially problematic release.
This version of @stackloop/ui might be problematic. Click here for more details.
- package/README.md +79 -8
- package/dist/CountrySelect.d.ts +3 -0
- package/dist/DatePicker.d.ts +2 -0
- package/dist/Input.d.ts +7 -1
- package/dist/PhoneInput.d.ts +1 -1
- package/dist/Toast.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3033 -2565
- package/dist/index.js.map +1 -1
- package/dist/ripple.d.ts +6 -0
- package/dist/stackloop-ui.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -199,16 +199,25 @@ Components with the `animate` prop:
|
|
|
199
199
|
```
|
|
200
200
|
|
|
201
201
|
**Input**:
|
|
202
|
-
- **Description:**
|
|
202
|
+
- **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.
|
|
203
203
|
- **Props:**
|
|
204
|
+
- **`type`**: Native HTML input types plus `'phone' | 'country'`.
|
|
205
|
+
- `type="date"` renders the library `DatePicker`.
|
|
206
|
+
- `type="country"` renders `CountrySelect`.
|
|
207
|
+
- `type="phone"` renders `PhoneInput`.
|
|
208
|
+
- **`value`**: `string | number | readonly string[] | Date`.
|
|
209
|
+
- **`onChange`**: `(value: string | Date) => void` — value-based callback used consistently across smart/native modes.
|
|
210
|
+
- **`onValueChange`**: `(value: string | Date) => void` — optional backward-compatible alias.
|
|
204
211
|
- **`label`**: `string` — optional.
|
|
205
212
|
- **`error`**: `string` — optional.
|
|
206
213
|
- **`hint`**: `string` — optional.
|
|
207
214
|
- **`leftIcon`** / **`rightIcon`**: `ReactNode` — optional.
|
|
208
215
|
- **`className`**: `string` — optional.
|
|
209
|
-
- Inherits `input` HTML attributes.
|
|
216
|
+
- Inherits most `input` HTML attributes.
|
|
210
217
|
- **Features:**
|
|
211
218
|
- **Password Toggle:** When `type="password"`, automatically displays an Eye/EyeOff icon to toggle password visibility. This overrides any custom `rightIcon`.
|
|
219
|
+
- **Consistent Value API:** Same controlled pattern for text, phone, country, and date.
|
|
220
|
+
- **Lightweight Composition:** Smart types reuse existing specialized components instead of duplicating logic.
|
|
212
221
|
- **Icon Support:** Display icons on left or right side of input
|
|
213
222
|
- **Validation:** Built-in error and hint display
|
|
214
223
|
- **Accessibility:** Proper labels and ARIA attributes
|
|
@@ -221,6 +230,32 @@ Components with the `animate` prop:
|
|
|
221
230
|
|
|
222
231
|
// Password with automatic toggle
|
|
223
232
|
<Input label="Password" type="password" placeholder="Enter password" />
|
|
233
|
+
|
|
234
|
+
// Phone (single combined value)
|
|
235
|
+
<Input
|
|
236
|
+
label="Phone"
|
|
237
|
+
type="phone"
|
|
238
|
+
value={phone}
|
|
239
|
+
onChange={(nextValue) => setPhone(String(nextValue))}
|
|
240
|
+
/>
|
|
241
|
+
|
|
242
|
+
// Country
|
|
243
|
+
<Input
|
|
244
|
+
label="Country"
|
|
245
|
+
type="country"
|
|
246
|
+
value={country}
|
|
247
|
+
onChange={(nextValue) => setCountry(String(nextValue))}
|
|
248
|
+
/>
|
|
249
|
+
|
|
250
|
+
// Date
|
|
251
|
+
<Input
|
|
252
|
+
label="Date"
|
|
253
|
+
type="date"
|
|
254
|
+
value={selectedDate}
|
|
255
|
+
onChange={(nextValue) => {
|
|
256
|
+
if (nextValue instanceof Date) setSelectedDate(nextValue)
|
|
257
|
+
}}
|
|
258
|
+
/>
|
|
224
259
|
|
|
225
260
|
// With icons
|
|
226
261
|
<Input
|
|
@@ -231,18 +266,27 @@ Components with the `animate` prop:
|
|
|
231
266
|
```
|
|
232
267
|
|
|
233
268
|
**PhoneInput**:
|
|
234
|
-
- **Description:** Phone
|
|
269
|
+
- **Description:** Phone input with country selector and a single editable value field (country code + number in the same input).
|
|
235
270
|
- **Props:**
|
|
236
271
|
- **`value`**: `string` — optional.
|
|
237
|
-
- **`onChange`**: `(
|
|
272
|
+
- **`onChange`**: `(value: string) => void` — optional.
|
|
238
273
|
- **`country`**: `string` — optional ISO2 override (e.g. `US`).
|
|
239
274
|
- **`defaultCountry`**: `string` — default: `'US'`.
|
|
240
275
|
- **`autoDetect`**: `boolean` — default: `true`. Uses `navigator.language` to select a country.
|
|
241
276
|
- **`onCountryChange`**: `(country: Country) => void` — optional.
|
|
277
|
+
- **`label`**: `string` — optional.
|
|
278
|
+
- **`required`**: `boolean` — optional. Shows a required marker (`*`) on label and passes `required` to the inner input.
|
|
279
|
+
- **`error`**: `string` — optional. Shows error state and helper text.
|
|
280
|
+
- **`hint`**: `string` — optional. Shown only when `error` is not present.
|
|
242
281
|
- **`searchable`**: `boolean` — default: `true`.
|
|
243
282
|
- **`showFlags`**: `boolean` — default: `true`.
|
|
244
283
|
- **`animate`**: `boolean` — default: `true`.
|
|
284
|
+
- **`className`**: `string` — optional.
|
|
245
285
|
- Inherits standard `input` HTML attributes.
|
|
286
|
+
- **Behavior:**
|
|
287
|
+
- Default selected country auto-fills dial code when the input is empty.
|
|
288
|
+
- User can edit/delete the dial code directly in the same input.
|
|
289
|
+
- Dropdown opens up or down based on available viewport space.
|
|
246
290
|
- **Usage:**
|
|
247
291
|
|
|
248
292
|
```jsx
|
|
@@ -251,7 +295,9 @@ Components with the `animate` prop:
|
|
|
251
295
|
<PhoneInput
|
|
252
296
|
label="Phone"
|
|
253
297
|
value={phone}
|
|
254
|
-
onChange={
|
|
298
|
+
onChange={setPhone}
|
|
299
|
+
required
|
|
300
|
+
hint="Include area code"
|
|
255
301
|
searchable
|
|
256
302
|
autoDetect
|
|
257
303
|
/>
|
|
@@ -264,11 +310,16 @@ Components with the `animate` prop:
|
|
|
264
310
|
- **`onChange`**: `(value: string) => void` — optional.
|
|
265
311
|
- **`onCountryChange`**: `(country: Country) => void` — optional.
|
|
266
312
|
- **`label`**: `string` — optional.
|
|
313
|
+
- **`required`**: `boolean` — optional. Shows a required marker (`*`) and `aria-required` on trigger.
|
|
267
314
|
- **`placeholder`**: `string` — optional.
|
|
315
|
+
- **`error`**: `string` — optional. Adds error border/ring and error message.
|
|
316
|
+
- **`hint`**: `string` — optional. Shown only when `error` is not present.
|
|
268
317
|
- **`searchable`**: `boolean` — default: `true`.
|
|
269
318
|
- **`clearable`**: `boolean` — default: `true`.
|
|
270
319
|
- **`showFlags`**: `boolean` — default: `true`.
|
|
320
|
+
- **`disabled`**: `boolean` — optional.
|
|
271
321
|
- **`animate`**: `boolean` — default: `true`.
|
|
322
|
+
- **`className`**: `string` — optional.
|
|
272
323
|
- **Usage:**
|
|
273
324
|
|
|
274
325
|
```jsx
|
|
@@ -278,6 +329,8 @@ Components with the `animate` prop:
|
|
|
278
329
|
label="Country"
|
|
279
330
|
value={country}
|
|
280
331
|
onChange={setCountry}
|
|
332
|
+
required
|
|
333
|
+
hint="Used for regional formatting"
|
|
281
334
|
searchable
|
|
282
335
|
/>
|
|
283
336
|
```
|
|
@@ -644,17 +697,35 @@ Components with the `animate` prop:
|
|
|
644
697
|
```
|
|
645
698
|
|
|
646
699
|
**DatePicker**:
|
|
647
|
-
- **Description:** Date picker with
|
|
700
|
+
- **Description:** Date picker with day grid, min/max date constraints, and fast custom month/year pickers.
|
|
648
701
|
- **Props:**
|
|
649
702
|
- **`value`**: `Date` — optional.
|
|
650
703
|
- **`onChange`**: `(date: Date) => void` — required.
|
|
651
|
-
- **`label
|
|
704
|
+
- **`label`**: `string` — optional.
|
|
705
|
+
- **`required`**: `boolean` — optional. Shows required marker (`*`) and `aria-required`.
|
|
706
|
+
- **`placeholder`**: `string` — default: `'Select date'`.
|
|
707
|
+
- **`error`**: `string` — optional.
|
|
708
|
+
- **`hint`**: `string` — optional. Shown only when `error` is not present.
|
|
709
|
+
- **`disabled`**: `boolean` — optional.
|
|
710
|
+
- **`minDate`** / **`maxDate`**: `Date` — optional.
|
|
711
|
+
- **`animate`**: `boolean` — default: `true`.
|
|
712
|
+
- **`className`**: `string` — optional.
|
|
713
|
+
- **Features:**
|
|
714
|
+
- **Custom Month Menu:** Scrollable month dropdown/dropup (no native browser select).
|
|
715
|
+
- **Custom Year Menu:** Scrollable year dropdown/dropup that supports quick jumps across many years.
|
|
716
|
+
- **Adaptive Positioning:** Month/year menus open upward when there is insufficient viewport space below.
|
|
652
717
|
- **Usage:**
|
|
653
718
|
|
|
654
719
|
```jsx
|
|
655
720
|
import { DatePicker } from '@stackloop/ui'
|
|
656
721
|
|
|
657
|
-
<DatePicker
|
|
722
|
+
<DatePicker
|
|
723
|
+
label="Date of birth"
|
|
724
|
+
value={date}
|
|
725
|
+
onChange={setDate}
|
|
726
|
+
required
|
|
727
|
+
hint="Choose month/year quickly from the menu"
|
|
728
|
+
/>
|
|
658
729
|
```
|
|
659
730
|
|
|
660
731
|
**DualSlider**:
|
package/dist/CountrySelect.d.ts
CHANGED
|
@@ -5,7 +5,10 @@ export interface CountrySelectProps {
|
|
|
5
5
|
onChange?: (value: string) => void;
|
|
6
6
|
onCountryChange?: (country: Country) => void;
|
|
7
7
|
label?: string;
|
|
8
|
+
required?: boolean;
|
|
8
9
|
placeholder?: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
hint?: string;
|
|
9
12
|
searchable?: boolean;
|
|
10
13
|
clearable?: boolean;
|
|
11
14
|
showFlags?: boolean;
|
package/dist/DatePicker.d.ts
CHANGED
package/dist/Input.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
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;
|
|
3
8
|
label?: string;
|
|
4
9
|
error?: string;
|
|
5
10
|
hint?: string;
|
|
@@ -8,3 +13,4 @@ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>
|
|
|
8
13
|
animate?: boolean;
|
|
9
14
|
}
|
|
10
15
|
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
16
|
+
export {};
|
package/dist/PhoneInput.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { type Country } from './countries';
|
|
3
3
|
export interface PhoneInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange'> {
|
|
4
4
|
value?: string;
|
|
5
|
-
onChange?: (
|
|
5
|
+
onChange?: (value: string) => void;
|
|
6
6
|
country?: string;
|
|
7
7
|
defaultCountry?: string;
|
|
8
8
|
autoDetect?: boolean;
|
package/dist/Toast.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export type ToastVariant = 'success' | 'error' | 'warning' | 'info' | 'default';
|
|
2
|
+
export type ToastVariant = 'success' | 'error' | 'warning' | 'info' | 'default' | 'loading';
|
|
3
3
|
export type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
4
4
|
export interface Toast {
|
|
5
5
|
id: string;
|