@stackloop/ui 4.0.8 → 4.0.10
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 +6 -5
- package/dist/Input.d.ts +30 -7
- package/dist/assets/index-B5bbIoAj.js +17 -0
- package/dist/assets/index-s9Mdf6_E.css +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.html +2 -2
- package/dist/index.js +1096 -1076
- package/dist/index.js.map +1 -1
- package/dist/stackloop-ui.css +1 -1
- package/package.json +1 -1
- package/dist/assets/index-DHBqG65w.js +0 -17
- package/dist/assets/index-Z5A9fp3I.css +0 -1
package/README.md
CHANGED
|
@@ -47,7 +47,6 @@ If using Tailwind CSS v4 with `@theme`, the library's theme variables are alread
|
|
|
47
47
|
@theme {
|
|
48
48
|
/* Override library colors */
|
|
49
49
|
--color-primary: #your-color;
|
|
50
|
-
--color-primary-dark: #your-darker-color;
|
|
51
50
|
--color-border: #your-border-color;
|
|
52
51
|
--color-border-dark: #your-darker-border;
|
|
53
52
|
--color-secondary: #your-secondary-bg;
|
|
@@ -88,7 +87,6 @@ The library uses a simplified color system with semantic variables:
|
|
|
88
87
|
| Variable | Default | Description |
|
|
89
88
|
|----------|---------|-------------|
|
|
90
89
|
| `--color-primary` | `#525252` | Primary brand color |
|
|
91
|
-
| `--color-primary-dark` | `#404040` | Darker primary variant |
|
|
92
90
|
| `--color-border` | `#e5e5e5` | Default border color |
|
|
93
91
|
| `--color-border-dark` | `#d4d4d4` | Darker border variant |
|
|
94
92
|
| `--color-secondary` | `#fafafa` | Secondary background |
|
|
@@ -110,7 +108,6 @@ Create a custom theme file or extend the existing one:
|
|
|
110
108
|
@theme {
|
|
111
109
|
/* Brand colors */
|
|
112
110
|
--color-primary: #3b82f6;
|
|
113
|
-
--color-primary-dark: #2563eb;
|
|
114
111
|
|
|
115
112
|
/* Borders */
|
|
116
113
|
--color-border: #e2e8f0;
|
|
@@ -228,10 +225,10 @@ Call `setupRippleEffects()` only once per app (for example in `main.tsx`) to avo
|
|
|
228
225
|
**Input**:
|
|
229
226
|
- **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
227
|
- **Props:**
|
|
231
|
-
- **`type`**: Native HTML input types plus `'phone' | 'country'`.
|
|
228
|
+
- **`type`**: Native HTML input types plus `'phone' | 'tel' | 'country'`.
|
|
232
229
|
- `type="date"` renders the library `DatePicker`.
|
|
233
230
|
- `type="country"` renders `CountrySelect`.
|
|
234
|
-
- `type="phone"`
|
|
231
|
+
- `type="phone"` and `type="tel"` render `PhoneInput`.
|
|
235
232
|
- **`value`**: `string | number | readonly string[] | Date`.
|
|
236
233
|
- **`onChange`**: `(value: string | Date) => void` — value-based callback used consistently across smart/native modes.
|
|
237
234
|
- **`onValueChange`**: `(value: string | Date) => void` — optional backward-compatible alias.
|
|
@@ -254,10 +251,14 @@ Call `setupRippleEffects()` only once per app (for example in `main.tsx`) to avo
|
|
|
254
251
|
import { Input } from '@stackloop/ui'
|
|
255
252
|
|
|
256
253
|
<Input label="Email" placeholder="you@example.com" />
|
|
254
|
+
<Input label="Phone" type="phone" value={phone} onChange={setPhone} />
|
|
255
|
+
<Input label="Telephone" type="tel" value={phone} onChange={setPhone} />
|
|
257
256
|
|
|
258
257
|
// Password with automatic toggle
|
|
259
258
|
<Input label="Password" type="password" placeholder="Enter password" />
|
|
260
259
|
|
|
260
|
+
|
|
261
|
+
- **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
262
|
// Phone (single combined value)
|
|
262
263
|
<Input
|
|
263
264
|
label="Phone"
|
package/dist/Input.d.ts
CHANGED
|
@@ -1,16 +1,39 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 {};
|