@pushwoosh/dumb-components 1.1.42 → 1.1.43
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/ai-documentation.mdx +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/native/NativeTimeInput.d.ts +3 -0
- package/native/NativeTimeInput.js +8 -0
- package/native/ai-documentation.mdx +70 -18
- package/native/index.d.ts +1 -0
- package/native/index.js +2 -1
- package/package.json +1 -1
package/ai-documentation.mdx
CHANGED
|
@@ -55,7 +55,7 @@ import { useElementWidth, useOnClickOutside } from '@pushwoosh/dumb-components/h
|
|
|
55
55
|
### Base Components
|
|
56
56
|
| Component | Description | Documentation |
|
|
57
57
|
|-----------|-------------|---------------|
|
|
58
|
-
| [Native](./native/ai-documentation.mdx) | Styled native HTML elements (Input, Select, Textarea) | 📖 |
|
|
58
|
+
| [Native](./native/ai-documentation.mdx) | Styled native HTML elements (Input, Select, Textarea, NativeTimeInput) | 📖 |
|
|
59
59
|
|
|
60
60
|
## 🤖 AI Agent Quick Reference
|
|
61
61
|
|
package/index.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export { PushPreview } from './PushPreview';
|
|
|
30
30
|
export { Toast, ToastProvider, useToast } from './Toast';
|
|
31
31
|
export { AutosizeInput, PageHeader, PageHeaderEditable } from './PageHeader';
|
|
32
32
|
export { ExportResult } from './ExportResult';
|
|
33
|
-
export { NativeInput, NativeTextarea, NativeSelect } from './native';
|
|
33
|
+
export { NativeInput, NativeTextarea, NativeSelect, NativeTimeInput, } from './native';
|
|
34
34
|
export { FieldBox } from './FieldBox';
|
|
35
35
|
export { NumberPicker } from './NumberPicker';
|
|
36
36
|
export { CodeEditor } from './CodeEditor';
|
package/index.js
CHANGED
|
@@ -30,7 +30,7 @@ export { PushPreview } from './PushPreview';
|
|
|
30
30
|
export { Toast, ToastProvider, useToast } from './Toast';
|
|
31
31
|
export { AutosizeInput, PageHeader, PageHeaderEditable } from './PageHeader';
|
|
32
32
|
export { ExportResult } from './ExportResult';
|
|
33
|
-
export { NativeInput, NativeTextarea, NativeSelect } from './native';
|
|
33
|
+
export { NativeInput, NativeTextarea, NativeSelect, NativeTimeInput } from './native';
|
|
34
34
|
export { FieldBox } from './FieldBox';
|
|
35
35
|
export { NumberPicker } from './NumberPicker';
|
|
36
36
|
export { CodeEditor } from './CodeEditor';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Color } from '@pushwoosh/kit-constants';
|
|
3
|
+
export const NativeTimeInput = styled.input.attrs({
|
|
4
|
+
type: 'time'
|
|
5
|
+
}).withConfig({
|
|
6
|
+
displayName: "NativeTimeInput",
|
|
7
|
+
componentId: "sc-r1vjhd-0"
|
|
8
|
+
})(["border:1px solid ", ";border-radius:4px;color:", ";font-size:14px;line-height:1.4;padding:8px 12px;height:36px;box-sizing:border-box;appearance:none;&:focus{border-color:", ";outline:none;}&::-webkit-calendar-picker-indicator{display:none;-webkit-appearance:none;}"], Color.FORM, Color.MAIN, Color.BRIGHT);
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
> Part of @pushwoosh/dumb-components library
|
|
5
5
|
|
|
6
6
|
## Overview
|
|
7
|
-
**Components:** NativeInput, NativeSelect, NativeTextarea
|
|
8
|
-
**Import Path:** `import { NativeInput, NativeSelect, NativeTextarea } from '@pushwoosh/dumb-components'`
|
|
9
|
-
**Files:**
|
|
7
|
+
**Components:** NativeInput, NativeSelect, NativeTextarea, NativeTimeInput
|
|
8
|
+
**Import Path:** `import { NativeInput, NativeSelect, NativeTextarea, NativeTimeInput } from '@pushwoosh/dumb-components'`
|
|
9
|
+
**Files:**
|
|
10
10
|
- `native/Input.tsx` - Styled native input component
|
|
11
|
-
- `native/Select.tsx` - Styled native select component
|
|
11
|
+
- `native/Select.tsx` - Styled native select component
|
|
12
12
|
- `native/Textarea.tsx` - Styled native textarea component
|
|
13
|
+
- `native/TimeInput.tsx` - Styled native time input component
|
|
13
14
|
- `native/index.ts` - Main exports
|
|
14
15
|
**Type:** Base Form Components / Styled HTML Elements
|
|
15
16
|
**Description:** Styled-components wrappers around native HTML form elements. These provide consistent Pushwoosh Design System styling while maintaining native HTML behavior. Used internally by enhanced components like EnhancedInput.
|
|
@@ -47,6 +48,13 @@ interface NativeTextareaProps {
|
|
|
47
48
|
// value, onChange, placeholder, rows, cols, disabled, etc.
|
|
48
49
|
```
|
|
49
50
|
|
|
51
|
+
### NativeTimeInputProps
|
|
52
|
+
```typescript
|
|
53
|
+
// NativeTimeInput is a styled input[type="time"] element
|
|
54
|
+
// Extends all standard HTMLInputElement attributes:
|
|
55
|
+
// value, onChange, disabled, readOnly, min, max, step, etc.
|
|
56
|
+
```
|
|
57
|
+
|
|
50
58
|
## Import & Usage
|
|
51
59
|
|
|
52
60
|
### NativeInput
|
|
@@ -94,7 +102,7 @@ import { NativeTextarea } from '@pushwoosh/dumb-components';
|
|
|
94
102
|
|
|
95
103
|
function BasicTextarea() {
|
|
96
104
|
const [value, setValue] = useState('');
|
|
97
|
-
|
|
105
|
+
|
|
98
106
|
return (
|
|
99
107
|
<NativeTextarea
|
|
100
108
|
value={value}
|
|
@@ -106,6 +114,22 @@ function BasicTextarea() {
|
|
|
106
114
|
}
|
|
107
115
|
```
|
|
108
116
|
|
|
117
|
+
### NativeTimeInput
|
|
118
|
+
```tsx
|
|
119
|
+
import { NativeTimeInput } from '@pushwoosh/dumb-components';
|
|
120
|
+
|
|
121
|
+
function BasicTimeInput() {
|
|
122
|
+
const [time, setTime] = useState('09:00');
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<NativeTimeInput
|
|
126
|
+
value={time}
|
|
127
|
+
onChange={(e) => setTime(e.target.value)}
|
|
128
|
+
/>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
109
133
|
## Advanced Examples
|
|
110
134
|
|
|
111
135
|
### Form with Validation
|
|
@@ -186,7 +210,7 @@ function ValidationForm() {
|
|
|
186
210
|
|
|
187
211
|
### Different Input Types
|
|
188
212
|
```tsx
|
|
189
|
-
import { NativeInput } from '@pushwoosh/dumb-components';
|
|
213
|
+
import { NativeInput, NativeTimeInput } from '@pushwoosh/dumb-components';
|
|
190
214
|
|
|
191
215
|
function InputTypes() {
|
|
192
216
|
const [formData, setFormData] = useState({
|
|
@@ -194,9 +218,10 @@ function InputTypes() {
|
|
|
194
218
|
password: '',
|
|
195
219
|
number: '',
|
|
196
220
|
date: '',
|
|
221
|
+
time: '09:00',
|
|
197
222
|
url: ''
|
|
198
223
|
});
|
|
199
|
-
|
|
224
|
+
|
|
200
225
|
return (
|
|
201
226
|
<div>
|
|
202
227
|
<NativeInput
|
|
@@ -205,14 +230,14 @@ function InputTypes() {
|
|
|
205
230
|
onChange={(e) => setFormData({ ...formData, email: e.target.value })}
|
|
206
231
|
placeholder="email@example.com"
|
|
207
232
|
/>
|
|
208
|
-
|
|
233
|
+
|
|
209
234
|
<NativeInput
|
|
210
235
|
type="password"
|
|
211
236
|
value={formData.password}
|
|
212
237
|
onChange={(e) => setFormData({ ...formData, password: e.target.value })}
|
|
213
238
|
placeholder="Password"
|
|
214
239
|
/>
|
|
215
|
-
|
|
240
|
+
|
|
216
241
|
<NativeInput
|
|
217
242
|
type="number"
|
|
218
243
|
value={formData.number}
|
|
@@ -221,13 +246,18 @@ function InputTypes() {
|
|
|
221
246
|
min="0"
|
|
222
247
|
max="100"
|
|
223
248
|
/>
|
|
224
|
-
|
|
249
|
+
|
|
225
250
|
<NativeInput
|
|
226
251
|
type="date"
|
|
227
252
|
value={formData.date}
|
|
228
253
|
onChange={(e) => setFormData({ ...formData, date: e.target.value })}
|
|
229
254
|
/>
|
|
230
|
-
|
|
255
|
+
|
|
256
|
+
<NativeTimeInput
|
|
257
|
+
value={formData.time}
|
|
258
|
+
onChange={(e) => setFormData({ ...formData, time: e.target.value })}
|
|
259
|
+
/>
|
|
260
|
+
|
|
231
261
|
<NativeInput
|
|
232
262
|
type="url"
|
|
233
263
|
value={formData.url}
|
|
@@ -308,7 +338,7 @@ function GroupedSelect() {
|
|
|
308
338
|
|
|
309
339
|
### Disabled and ReadOnly States
|
|
310
340
|
```tsx
|
|
311
|
-
import { NativeInput, NativeSelect, NativeTextarea } from '@pushwoosh/dumb-components';
|
|
341
|
+
import { NativeInput, NativeSelect, NativeTextarea, NativeTimeInput } from '@pushwoosh/dumb-components';
|
|
312
342
|
|
|
313
343
|
function DisabledStates() {
|
|
314
344
|
return (
|
|
@@ -319,23 +349,33 @@ function DisabledStates() {
|
|
|
319
349
|
disabled
|
|
320
350
|
placeholder="This is disabled"
|
|
321
351
|
/>
|
|
322
|
-
|
|
352
|
+
|
|
323
353
|
<NativeSelect disabled>
|
|
324
354
|
<option>Disabled select</option>
|
|
325
355
|
</NativeSelect>
|
|
326
|
-
|
|
356
|
+
|
|
327
357
|
<NativeTextarea
|
|
328
358
|
value="Disabled textarea"
|
|
329
359
|
disabled
|
|
330
360
|
rows={3}
|
|
331
361
|
/>
|
|
332
|
-
|
|
362
|
+
|
|
363
|
+
<NativeTimeInput
|
|
364
|
+
value="09:00"
|
|
365
|
+
disabled
|
|
366
|
+
/>
|
|
367
|
+
|
|
333
368
|
{/* Read-only inputs */}
|
|
334
369
|
<NativeInput
|
|
335
370
|
value="Read-only input"
|
|
336
371
|
readOnly
|
|
337
372
|
/>
|
|
338
|
-
|
|
373
|
+
|
|
374
|
+
<NativeTimeInput
|
|
375
|
+
value="09:00"
|
|
376
|
+
readOnly
|
|
377
|
+
/>
|
|
378
|
+
|
|
339
379
|
<NativeTextarea
|
|
340
380
|
value="Read-only textarea content"
|
|
341
381
|
readOnly
|
|
@@ -385,6 +425,17 @@ function DisabledStates() {
|
|
|
385
425
|
| `wrap` | `'soft' \| 'hard'` | - | `'soft'` | Text wrapping behavior |
|
|
386
426
|
| `resize` | `string` | - | - | CSS resize property |
|
|
387
427
|
|
|
428
|
+
### NativeTimeInput Specific Props
|
|
429
|
+
| Prop | Type | Required | Default | Description |
|
|
430
|
+
|------|------|----------|---------|-------------|
|
|
431
|
+
| `value` | `string` | - | - | Time value in HH:MM format |
|
|
432
|
+
| `onChange` | `(e: ChangeEvent) => void` | - | - | Change handler |
|
|
433
|
+
| `min` | `string` | - | - | Minimum time value |
|
|
434
|
+
| `max` | `string` | - | - | Maximum time value |
|
|
435
|
+
| `step` | `number` | - | - | Step value in seconds |
|
|
436
|
+
| `disabled` | `boolean` | - | `false` | Disable the input |
|
|
437
|
+
| `readOnly` | `boolean` | - | `false` | Make input read-only |
|
|
438
|
+
|
|
388
439
|
## AI Agent Guidelines
|
|
389
440
|
|
|
390
441
|
### ✅ Recommended Patterns
|
|
@@ -417,11 +468,12 @@ function DisabledStates() {
|
|
|
417
468
|
|
|
418
469
|
### Styling Notes
|
|
419
470
|
- Components use `styled-components` with design system constants
|
|
420
|
-
- Border radius uses `ShapeRadius.CONTROL`
|
|
471
|
+
- Border radius uses `ShapeRadius.CONTROL` (4px for TimeInput)
|
|
421
472
|
- Colors are from Pushwoosh color palette
|
|
422
473
|
- Font sizes and line heights are from typography scale
|
|
423
|
-
- Input height is standardized using `UnitSize.FIELD_HEIGHT`
|
|
474
|
+
- Input height is standardized using `UnitSize.FIELD_HEIGHT` (36px for NativeTimeInput)
|
|
424
475
|
- Focus outline is removed in favor of border styling
|
|
476
|
+
- NativeTimeInput hides the native calendar picker indicator for consistent styling
|
|
425
477
|
|
|
426
478
|
## Related Components
|
|
427
479
|
- **EnhancedInput** - Uses NativeInput internally with icons and clear functionality
|
package/native/index.d.ts
CHANGED
package/native/index.js
CHANGED