@paolojulian.dev/design-system 4.2.2 → 4.4.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/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
+ import { AnchorHTMLAttributes } from 'react';
2
+ import { ButtonHTMLAttributes } from 'react';
1
3
  import { ClassProp } from 'class-variance-authority/types';
2
4
  import { CSSProperties } from 'react';
5
+ import { ElementType } from 'react';
3
6
  import { FC } from 'react';
4
7
  import { ForwardRefExoticComponent } from 'react';
5
8
  import { HTMLAttributes } from 'react';
@@ -7,19 +10,441 @@ import { InputHTMLAttributes } from 'react';
7
10
  import { JSX } from 'react/jsx-runtime';
8
11
  import { ReactNode } from 'react';
9
12
  import { RefAttributes } from 'react';
13
+ import { TextareaHTMLAttributes } from 'react';
10
14
  import { VariantProps } from 'class-variance-authority';
11
15
 
16
+ export declare const PBadge: ForwardRefExoticComponent< {
17
+ as?: ElementType;
18
+ variant?: PBadgeVariant;
19
+ size?: PBadgeSize;
20
+ appearance?: PBadgeAppearance;
21
+ leftIcon?: ReactNode;
22
+ rightIcon?: ReactNode;
23
+ children: ReactNode;
24
+ className?: string;
25
+ } & Omit<HTMLAttributes<HTMLElement>, "children" | "className" | "color"> & RefAttributes<HTMLElement>>;
26
+
27
+ export declare type PBadgeAppearance = 'subtle' | 'solid' | 'outline';
28
+
29
+ export declare type PBadgeProps = {
30
+ as?: ElementType;
31
+ variant?: PBadgeVariant;
32
+ size?: PBadgeSize;
33
+ appearance?: PBadgeAppearance;
34
+ leftIcon?: ReactNode;
35
+ rightIcon?: ReactNode;
36
+ children: ReactNode;
37
+ className?: string;
38
+ } & Omit<HTMLAttributes<HTMLElement>, 'children' | 'className' | 'color'>;
39
+
40
+ export declare type PBadgeRef = HTMLElement;
41
+
42
+ export declare type PBadgeSize = 'sm' | 'md';
43
+
44
+ export declare type PBadgeVariant = 'primary' | 'danger' | 'warning' | 'success' | 'info' | 'neutral';
45
+
46
+ export declare const PButton: ForwardRefExoticComponent<PButtonProps & RefAttributes<PButtonRef>>;
47
+
48
+ declare type PButtonAsAnchorProps = PButtonBaseProps & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'className' | 'children'> & {
49
+ href: string;
50
+ disabled?: boolean;
51
+ type?: never;
52
+ };
53
+
54
+ declare type PButtonAsButtonProps = PButtonBaseProps & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'className' | 'children'> & {
55
+ href?: undefined;
56
+ };
57
+
58
+ declare type PButtonBaseProps = {
59
+ variant?: PButtonVariant;
60
+ size?: PButtonSize;
61
+ fullWidth?: boolean;
62
+ isActive?: boolean;
63
+ isLoading?: boolean;
64
+ leftIcon?: ReactNode;
65
+ rightIcon?: ReactNode;
66
+ children: ReactNode;
67
+ className?: string;
68
+ };
69
+
70
+ export declare type PButtonProps = PButtonAsButtonProps | PButtonAsAnchorProps;
71
+
72
+ export declare type PButtonRef = HTMLButtonElement | HTMLAnchorElement;
73
+
74
+ declare type PButtonSize = 'sm' | 'md' | 'lg';
75
+
76
+ declare type PButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'danger' | 'ghost';
77
+
78
+ export declare const PCard: ForwardRefExoticComponent<PCardProps & RefAttributes<HTMLElement>>;
79
+
80
+ declare type PCardAnchorProps = PCardBaseProps & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'className' | 'children' | 'style' | 'title'> & {
81
+ href: string;
82
+ };
83
+
84
+ declare type PCardArticleProps = PCardBaseProps & Omit<HTMLAttributes<HTMLElement>, 'className' | 'children' | 'style' | 'title'> & {
85
+ href?: undefined;
86
+ };
87
+
88
+ declare type PCardBaseProps = {
89
+ prefix?: ReactNode;
90
+ eyebrow?: ReactNode;
91
+ title: ReactNode;
92
+ description?: ReactNode;
93
+ media?: ReactNode;
94
+ actions?: ReactNode;
95
+ density?: PCardDensity;
96
+ fullWidth?: boolean;
97
+ width?: CSSProperties['width'];
98
+ minWidth?: CSSProperties['minWidth'];
99
+ height?: CSSProperties['height'];
100
+ minHeight?: CSSProperties['minHeight'];
101
+ className?: string;
102
+ style?: CSSProperties;
103
+ children?: ReactNode;
104
+ };
105
+
106
+ declare type PCardDensity = 'compact' | 'default' | 'spacious';
107
+
108
+ export declare type PCardProps = PCardArticleProps | PCardAnchorProps;
109
+
110
+ export declare type PCardRef = HTMLElement;
111
+
112
+ export declare const PDatePicker: ForwardRefExoticComponent< {
113
+ label: string;
114
+ value?: string;
115
+ defaultValue?: string;
116
+ onValueChange?: (value: string, details: {
117
+ date: Date | null;
118
+ source: PDatePickerChangeSource;
119
+ }) => void;
120
+ presets?: PDatePickerPreset[];
121
+ customLabel?: string;
122
+ showCustom?: boolean;
123
+ presetColumns?: PDatePickerPresetColumns;
124
+ placeholder?: string;
125
+ helperText?: string;
126
+ isError?: boolean;
127
+ errorMessage?: string;
128
+ min?: string;
129
+ max?: string;
130
+ name?: string;
131
+ disabled?: boolean;
132
+ readOnly?: boolean;
133
+ required?: boolean;
134
+ locale?: string;
135
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
136
+ className?: string;
137
+ } & Omit<HTMLAttributes<HTMLDivElement>, "className" | "defaultValue" | "onChange"> & RefAttributes<HTMLDivElement>>;
138
+
139
+ export declare type PDatePickerChangeSource = 'preset' | 'calendar';
140
+
141
+ export declare type PDatePickerPreset = {
142
+ label: string;
143
+ value: string | Date | (() => string | Date);
144
+ };
145
+
146
+ export declare type PDatePickerPresetColumns = 2 | 3 | 4 | 'auto';
147
+
148
+ export declare const PDatePickerPresets: {
149
+ today: {
150
+ label: string;
151
+ value: () => Date;
152
+ };
153
+ yesterday: {
154
+ label: string;
155
+ value: () => Date;
156
+ };
157
+ tomorrow: {
158
+ label: string;
159
+ value: () => Date;
160
+ };
161
+ startOfMonth: {
162
+ label: string;
163
+ value: () => Date;
164
+ };
165
+ endOfMonth: {
166
+ label: string;
167
+ value: () => Date;
168
+ };
169
+ };
170
+
171
+ export declare type PDatePickerProps = {
172
+ label: string;
173
+ value?: string;
174
+ defaultValue?: string;
175
+ onValueChange?: (value: string, details: {
176
+ date: Date | null;
177
+ source: PDatePickerChangeSource;
178
+ }) => void;
179
+ presets?: PDatePickerPreset[];
180
+ customLabel?: string;
181
+ showCustom?: boolean;
182
+ presetColumns?: PDatePickerPresetColumns;
183
+ placeholder?: string;
184
+ helperText?: string;
185
+ isError?: boolean;
186
+ errorMessage?: string;
187
+ min?: string;
188
+ max?: string;
189
+ name?: string;
190
+ disabled?: boolean;
191
+ readOnly?: boolean;
192
+ required?: boolean;
193
+ locale?: string;
194
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
195
+ className?: string;
196
+ } & Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'defaultValue' | 'onChange'>;
197
+
198
+ export declare type PDatePickerRef = HTMLDivElement;
199
+
200
+ export declare const PDateRangePicker: ForwardRefExoticComponent< {
201
+ label: string;
202
+ value?: PDateRangeValue;
203
+ defaultValue?: PDateRangeValue;
204
+ onValueChange?: (value: PDateRangeValue, details: {
205
+ startDate: Date | null;
206
+ endDate: Date | null;
207
+ source: PDateRangePickerChangeSource;
208
+ }) => void;
209
+ presets?: PDateRangePickerPreset[];
210
+ customLabel?: string;
211
+ showCustom?: boolean;
212
+ presetColumns?: PDateRangePickerPresetColumns;
213
+ placeholder?: string;
214
+ helperText?: string;
215
+ isError?: boolean;
216
+ errorMessage?: string;
217
+ min?: string;
218
+ max?: string;
219
+ nameStart?: string;
220
+ nameEnd?: string;
221
+ disabled?: boolean;
222
+ readOnly?: boolean;
223
+ required?: boolean;
224
+ locale?: string;
225
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
226
+ className?: string;
227
+ } & Omit<HTMLAttributes<HTMLDivElement>, "className" | "defaultValue" | "onChange"> & RefAttributes<HTMLDivElement>>;
228
+
229
+ export declare type PDateRangePickerChangeSource = 'preset' | 'calendar';
230
+
231
+ export declare type PDateRangePickerPreset = {
232
+ label: string;
233
+ value: PDateRangeValue | (() => PDateRangeValue);
234
+ };
235
+
236
+ export declare type PDateRangePickerPresetColumns = 2 | 3 | 4 | 'auto';
237
+
238
+ export declare const PDateRangePickerPresets: {
239
+ thisWeek: {
240
+ label: string;
241
+ value: () => {
242
+ start: string;
243
+ end: string;
244
+ };
245
+ };
246
+ last7Days: {
247
+ label: string;
248
+ value: () => {
249
+ start: string;
250
+ end: string;
251
+ };
252
+ };
253
+ last14Days: {
254
+ label: string;
255
+ value: () => {
256
+ start: string;
257
+ end: string;
258
+ };
259
+ };
260
+ last30Days: {
261
+ label: string;
262
+ value: () => {
263
+ start: string;
264
+ end: string;
265
+ };
266
+ };
267
+ thisMonth: {
268
+ label: string;
269
+ value: () => {
270
+ start: string;
271
+ end: string;
272
+ };
273
+ };
274
+ lastMonth: {
275
+ label: string;
276
+ value: () => {
277
+ start: string;
278
+ end: string;
279
+ };
280
+ };
281
+ monthToDate: {
282
+ label: string;
283
+ value: () => {
284
+ start: string;
285
+ end: string;
286
+ };
287
+ };
288
+ yearToDate: {
289
+ label: string;
290
+ value: () => {
291
+ start: string;
292
+ end: string;
293
+ };
294
+ };
295
+ };
296
+
297
+ export declare type PDateRangePickerProps = {
298
+ label: string;
299
+ value?: PDateRangeValue;
300
+ defaultValue?: PDateRangeValue;
301
+ onValueChange?: (value: PDateRangeValue, details: {
302
+ startDate: Date | null;
303
+ endDate: Date | null;
304
+ source: PDateRangePickerChangeSource;
305
+ }) => void;
306
+ presets?: PDateRangePickerPreset[];
307
+ customLabel?: string;
308
+ showCustom?: boolean;
309
+ presetColumns?: PDateRangePickerPresetColumns;
310
+ placeholder?: string;
311
+ helperText?: string;
312
+ isError?: boolean;
313
+ errorMessage?: string;
314
+ min?: string;
315
+ max?: string;
316
+ nameStart?: string;
317
+ nameEnd?: string;
318
+ disabled?: boolean;
319
+ readOnly?: boolean;
320
+ required?: boolean;
321
+ locale?: string;
322
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
323
+ className?: string;
324
+ } & Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'defaultValue' | 'onChange'>;
325
+
326
+ export declare type PDateRangePickerRef = HTMLDivElement;
327
+
328
+ export declare type PDateRangeValue = {
329
+ start?: string;
330
+ end?: string;
331
+ };
332
+
333
+ export declare const PHighlight: ForwardRefExoticComponent< {
334
+ as?: ElementType;
335
+ variant?: PHighlightVariant;
336
+ /** Controls whether the highlight is text-only or a filled background. */
337
+ appearance?: PHighlightAppearance;
338
+ /** Custom highlight color. Text color by default, background color for `appearance="background"`. */
339
+ color?: CSSProperties["color"];
340
+ /** Custom foreground color for `appearance="background"`. */
341
+ textColor?: CSSProperties["color"];
342
+ children: ReactNode;
343
+ className?: string;
344
+ style?: CSSProperties;
345
+ } & Omit<HTMLAttributes<HTMLElement>, "children" | "className" | "style" | "color"> & RefAttributes<HTMLElement>>;
346
+
347
+ export declare type PHighlightAppearance = 'text' | 'background';
348
+
349
+ export declare type PHighlightProps = {
350
+ as?: ElementType;
351
+ variant?: PHighlightVariant;
352
+ /** Controls whether the highlight is text-only or a filled background. */
353
+ appearance?: PHighlightAppearance;
354
+ /** Custom highlight color. Text color by default, background color for `appearance="background"`. */
355
+ color?: CSSProperties['color'];
356
+ /** Custom foreground color for `appearance="background"`. */
357
+ textColor?: CSSProperties['color'];
358
+ children: ReactNode;
359
+ className?: string;
360
+ style?: CSSProperties;
361
+ } & Omit<HTMLAttributes<HTMLElement>, 'children' | 'className' | 'color' | 'style'>;
362
+
363
+ export declare type PHighlightRef = HTMLElement;
364
+
365
+ export declare type PHighlightVariant = 'primary' | 'danger' | 'warning' | 'success' | 'info' | 'neutral';
366
+
367
+ export declare const PHorizontalSlider: ForwardRefExoticComponent< {
368
+ children: ReactNode;
369
+ /** Accessible label for the keyboard-focusable scroll region. */
370
+ ariaLabel?: string;
371
+ /** Gap between slider items. Accepts any CSS gap value. */
372
+ gap?: CSSProperties["gap"];
373
+ /** Disables horizontal snap alignment when free scrolling is preferred. */
374
+ snap?: boolean;
375
+ scrollerClassName?: string;
376
+ listClassName?: string;
377
+ itemClassName?: string;
378
+ } & Omit<HTMLAttributes<HTMLDivElement>, "children" | "className"> & {
379
+ className?: string;
380
+ } & RefAttributes<HTMLDivElement>>;
381
+
382
+ export declare type PHorizontalSliderProps = {
383
+ children: ReactNode;
384
+ /** Accessible label for the keyboard-focusable scroll region. */
385
+ ariaLabel?: string;
386
+ /** Gap between slider items. Accepts any CSS gap value. */
387
+ gap?: CSSProperties['gap'];
388
+ /** Disables horizontal snap alignment when free scrolling is preferred. */
389
+ snap?: boolean;
390
+ scrollerClassName?: string;
391
+ listClassName?: string;
392
+ itemClassName?: string;
393
+ } & Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'className'> & {
394
+ className?: string;
395
+ };
396
+
397
+ export declare type PHorizontalSliderRef = HTMLDivElement;
398
+
12
399
  declare interface Props {
13
400
  title: string;
14
401
  }
15
402
 
16
403
  export declare function PSectionHeader({ title }: Props): JSX.Element;
17
404
 
405
+ export declare const PTextArea: ForwardRefExoticComponent< {
406
+ /**
407
+ * Applied to the root wrapper element.
408
+ * Override design tokens via CSS custom properties, e.g.:
409
+ * `[--p-textarea-ring:var(--p-color-info)] [--p-textarea-bg:var(--p-color-info-surface)]`
410
+ */
411
+ className?: string;
412
+ /** Applied to the inner `<textarea>` element for layout / spacing overrides. */
413
+ textareaClassName?: string;
414
+ /** Visible label — doubles as the floating label and the placeholder. */
415
+ label: string;
416
+ /** Shown below the field when there is no error. */
417
+ helperText?: string;
418
+ isError?: boolean;
419
+ /** Shown below the field when `isError` is true. Announced immediately via `role="alert"`. */
420
+ errorMessage?: string;
421
+ } & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "className" | "aria-describedby" | "aria-label" | "placeholder"> & RefAttributes<HTMLTextAreaElement>>;
422
+
423
+ export declare type PTextAreaProps = {
424
+ /**
425
+ * Applied to the root wrapper element.
426
+ * Override design tokens via CSS custom properties, e.g.:
427
+ * `[--p-textarea-ring:var(--p-color-info)] [--p-textarea-bg:var(--p-color-info-surface)]`
428
+ */
429
+ className?: string;
430
+ /** Applied to the inner `<textarea>` element for layout / spacing overrides. */
431
+ textareaClassName?: string;
432
+ /** Visible label — doubles as the floating label and the placeholder. */
433
+ label: string;
434
+ /** Shown below the field when there is no error. */
435
+ helperText?: string;
436
+ isError?: boolean;
437
+ /** Shown below the field when `isError` is true. Announced immediately via `role="alert"`. */
438
+ errorMessage?: string;
439
+ } & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'className' | 'placeholder' | 'aria-label' | 'aria-describedby'>;
440
+
441
+ export declare type PTextAreaRef = HTMLTextAreaElement;
442
+
18
443
  export declare const PTextInput: ForwardRefExoticComponent< {
19
444
  /**
20
445
  * Applied to the root wrapper element.
21
446
  * Override design tokens via CSS custom properties, e.g.:
22
- * `[--p-input-ring:blue] [--p-input-bg:#f5f5f5]`
447
+ * `[--p-input-ring:var(--p-color-info)] [--p-input-bg:var(--p-color-info-surface)]`
23
448
  */
24
449
  className?: string;
25
450
  /** Applied to the inner `<input>` element for layout / spacing overrides. */
@@ -39,7 +464,7 @@ export declare type PTextInputProps = {
39
464
  /**
40
465
  * Applied to the root wrapper element.
41
466
  * Override design tokens via CSS custom properties, e.g.:
42
- * `[--p-input-ring:blue] [--p-input-bg:#f5f5f5]`
467
+ * `[--p-input-ring:var(--p-color-info)] [--p-input-bg:var(--p-color-info-surface)]`
43
468
  */
44
469
  className?: string;
45
470
  /** Applied to the inner `<input>` element for layout / spacing overrides. */
@@ -63,7 +488,7 @@ export declare interface PTypographyProps extends VariantProps<typeof PTypograph
63
488
  }
64
489
 
65
490
  declare const PTypographyVariants: (props?: ({
66
- variant?: "serif" | "body" | "body-wide" | "heading" | "heading-lg" | "heading-xl" | null | undefined;
491
+ variant?: "body" | "heading" | "serif" | "body-wide" | "heading-lg" | "heading-xl" | null | undefined;
67
492
  } & ClassProp) | undefined) => string;
68
493
 
69
494
  export declare const Row: FC<RowProps>;