@pk-design/react-tailwind 1.5.4 → 1.6.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/react-tailwind.cjs.js +1429 -289
- package/dist/react-tailwind.cjs.js.map +1 -1
- package/dist/react-tailwind.es.js +1420 -292
- package/dist/react-tailwind.es.js.map +1 -1
- package/dist/types/components/BodyText/BodyText.d.ts +1 -1
- package/dist/types/components/BodyText/BodyText.types.d.ts +47 -8
- package/dist/types/components/Breadcrumb/Breadcrumb.d.ts +2 -3
- package/dist/types/components/Breadcrumb/Breadcrumb.types.d.ts +43 -10
- package/dist/types/components/Button/Button.types.d.ts +17 -63
- package/dist/types/components/ButtonGroup/ButtonGroup.types.d.ts +16 -0
- package/dist/types/components/Card/Card.d.ts +7 -1
- package/dist/types/components/Card/Card.types.d.ts +48 -42
- package/dist/types/components/Checkbox/Checkbox.types.d.ts +28 -1
- package/dist/types/components/CheckboxGroup/CheckboxGroup.types.d.ts +53 -1
- package/dist/types/components/DetailedInformation/DetailedInformation.d.ts +1 -1
- package/dist/types/components/DetailedInformation/DetailedInformation.types.d.ts +47 -3
- package/dist/types/components/Drawer/Drawer.types.d.ts +37 -13
- package/dist/types/components/Dropdown/Dropdown.types.d.ts +17 -1
- package/dist/types/components/HeadingText/HeadingText.d.ts +7 -7
- package/dist/types/components/HeadingText/HeadingText.test.d.ts +1 -0
- package/dist/types/components/HeadingText/HeadingText.types.d.ts +56 -3
- package/dist/types/components/Input/Input.d.ts +4 -2
- package/dist/types/components/Input/Input.types.d.ts +36 -3
- package/dist/types/components/Loader/index.d.ts +1 -1
- package/dist/types/components/PasswordInput/PasswordInput.d.ts +8 -4
- package/dist/types/components/PasswordInput/PasswordInput.types.d.ts +8 -0
- package/dist/types/components/QuantityStepper/QuantityStepper.d.ts +3 -0
- package/dist/types/components/QuantityStepper/QuantityStepper.test.d.ts +1 -0
- package/dist/types/components/QuantityStepper/QuantityStepper.types.d.ts +49 -0
- package/dist/types/components/QuantityStepper/index.d.ts +2 -0
- package/dist/types/components/Radio/Radio.d.ts +1 -1
- package/dist/types/components/Radio/Radio.types.d.ts +12 -2
- package/dist/types/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/types/components/RadioGroup/RadioGroup.types.d.ts +41 -13
- package/dist/types/components/RadioSwitch/RadioSwitch.d.ts +0 -4
- package/dist/types/components/RadioSwitch/RadioSwitch.types.d.ts +6 -31
- package/dist/types/components/RangeInput/RangeInput.d.ts +1 -1
- package/dist/types/components/RangeInput/RangeInput.types.d.ts +14 -1
- package/dist/types/components/RangeSlider/RangeSlider.d.ts +1 -1
- package/dist/types/components/RangeSlider/RangeSlider.types.d.ts +28 -13
- package/dist/types/components/SegmentedControl/SegmentedControl.d.ts +3 -0
- package/dist/types/components/SegmentedControl/SegmentedControl.test.d.ts +1 -0
- package/dist/types/components/SegmentedControl/SegmentedControl.types.d.ts +53 -0
- package/dist/types/components/SegmentedControl/index.d.ts +2 -0
- package/dist/types/components/SelectBox/SelectBox.types.d.ts +23 -14
- package/dist/types/components/Skeleton/Skeleton.d.ts +2 -0
- package/dist/types/components/Skeleton/Skeleton.test.d.ts +1 -0
- package/dist/types/components/Skeleton/Skeleton.types.d.ts +38 -0
- package/dist/types/components/Skeleton/index.d.ts +2 -0
- package/dist/types/components/StatusPill/StatusPill.d.ts +2 -0
- package/dist/types/components/StatusPill/StatusPill.test.d.ts +1 -0
- package/dist/types/components/StatusPill/StatusPill.types.d.ts +29 -0
- package/dist/types/components/StatusPill/index.d.ts +2 -0
- package/dist/types/components/StickyActionBar/StickyActionBar.d.ts +2 -0
- package/dist/types/components/StickyActionBar/StickyActionBar.test.d.ts +1 -0
- package/dist/types/components/StickyActionBar/StickyActionBar.types.d.ts +30 -0
- package/dist/types/components/StickyActionBar/index.d.ts +2 -0
- package/dist/types/components/TextContent/TextContent.d.ts +2 -2
- package/dist/types/components/TextContent/TextContent.types.d.ts +47 -7
- package/dist/types/components/Textarea/Textarea.types.d.ts +37 -3
- package/dist/types/components/Toast/Toast.d.ts +1 -1
- package/dist/types/components/Toast/Toast.types.d.ts +117 -43
- package/dist/types/components/Toast/ToastProvider.d.ts +3 -6
- package/dist/types/index.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,32 +1,35 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type RangeSliderSize = 'sm' | 'md' | 'lg';
|
|
1
3
|
/**
|
|
2
4
|
* Props for the RangeSlider component.
|
|
3
5
|
* A dual-thumb, draggable range selector with support for labels,
|
|
4
|
-
*
|
|
6
|
+
* step increments, marks, tooltips, keyboard navigation, and error display.
|
|
5
7
|
*/
|
|
6
8
|
export interface RangeSliderProps {
|
|
7
9
|
/**
|
|
8
10
|
* Top label displayed above the slider.
|
|
9
|
-
* Useful for identifying the field in forms.
|
|
10
11
|
*/
|
|
11
12
|
label?: string;
|
|
12
13
|
/**
|
|
13
14
|
* Optional hint displayed to the right of the label.
|
|
14
|
-
* Often used for contextual help or inline descriptions.
|
|
15
15
|
*/
|
|
16
|
-
labelHint?:
|
|
16
|
+
labelHint?: ReactNode;
|
|
17
17
|
/**
|
|
18
18
|
* Custom Tailwind classes applied to the label element.
|
|
19
19
|
*/
|
|
20
20
|
labelClass?: string;
|
|
21
21
|
/**
|
|
22
|
-
* Custom Tailwind classes applied to the outer container
|
|
23
|
-
* that wraps the entire slider component.
|
|
22
|
+
* Custom Tailwind classes applied to the outer container.
|
|
24
23
|
*/
|
|
25
24
|
containerClass?: string;
|
|
26
25
|
/**
|
|
27
26
|
* Custom Tailwind classes applied to the slider thumbs.
|
|
28
27
|
*/
|
|
29
28
|
className?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Size scale of the range slider (`"sm"` | `"md"` | `"lg"`). Defaults to `"md"`.
|
|
31
|
+
*/
|
|
32
|
+
size?: RangeSliderSize;
|
|
30
33
|
/**
|
|
31
34
|
* The minimum allowed numeric value of the slider.
|
|
32
35
|
*/
|
|
@@ -35,31 +38,43 @@ export interface RangeSliderProps {
|
|
|
35
38
|
* The maximum allowed numeric value of the slider.
|
|
36
39
|
*/
|
|
37
40
|
max: number;
|
|
41
|
+
/**
|
|
42
|
+
* Step increment precision for thumbs (e.g. `1`, `5`, `10`, `0.5`).
|
|
43
|
+
* Defaults to `1`.
|
|
44
|
+
*/
|
|
45
|
+
step?: number;
|
|
38
46
|
/**
|
|
39
47
|
* The current selected minimum value (left thumb).
|
|
40
|
-
* This makes the component fully controlled.
|
|
41
48
|
*/
|
|
42
49
|
valueMin: number;
|
|
43
50
|
/**
|
|
44
51
|
* The current selected maximum value (right thumb).
|
|
45
|
-
* This makes the component fully controlled.
|
|
46
52
|
*/
|
|
47
53
|
valueMax: number;
|
|
48
54
|
/**
|
|
49
55
|
* Callback triggered whenever either thumb moves.
|
|
50
|
-
* Receives the updated min and max values.
|
|
51
56
|
*/
|
|
52
57
|
onChange: (min: number, max: number) => void;
|
|
53
58
|
/**
|
|
54
|
-
* Optional string appended to displayed values.
|
|
55
|
-
* Example: "kg", "₹", "cm", "hrs", "%".
|
|
59
|
+
* Optional string appended to displayed values (e.g. `"kg"`, `"₹"`, `"%"`, `"hrs"`).
|
|
56
60
|
*/
|
|
57
61
|
valueSuffix?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Floating value tooltip popups displayed above active thumbs on drag or hover.
|
|
64
|
+
*/
|
|
65
|
+
showTooltips?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Custom tick marks and labels displayed along slider track (e.g. `{ 0: '$0', 50: '$50', 100: '$100' }`).
|
|
68
|
+
*/
|
|
69
|
+
marks?: Record<number, string>;
|
|
58
70
|
/**
|
|
59
71
|
* Error message to display below the slider.
|
|
60
|
-
* If provided, the slider is styled with an error state.
|
|
61
72
|
*/
|
|
62
|
-
error?: string |
|
|
73
|
+
error?: string | ReactNode;
|
|
74
|
+
/**
|
|
75
|
+
* Guidance helper text rendered below the slider.
|
|
76
|
+
*/
|
|
77
|
+
helperText?: ReactNode;
|
|
63
78
|
/**
|
|
64
79
|
* Whether the error message should be shown.
|
|
65
80
|
* Defaults to true.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface SegmentedControlOption<T extends string = string> {
|
|
3
|
+
/**
|
|
4
|
+
* Visible label or element for the segment option
|
|
5
|
+
*/
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Unique value associated with the option
|
|
9
|
+
*/
|
|
10
|
+
value: T;
|
|
11
|
+
/**
|
|
12
|
+
* Optional tooltip or title text
|
|
13
|
+
*/
|
|
14
|
+
title?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Optional icon rendered before the label
|
|
17
|
+
*/
|
|
18
|
+
icon?: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Defines if option is disabled
|
|
21
|
+
*/
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export type SegmentedControlSize = 'sm' | 'md' | 'lg';
|
|
25
|
+
export interface SegmentedControlProps<T extends string = string> extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'value'> {
|
|
26
|
+
/**
|
|
27
|
+
* Options list to display in the control
|
|
28
|
+
*/
|
|
29
|
+
options: SegmentedControlOption<T>[];
|
|
30
|
+
/**
|
|
31
|
+
* Currently selected value
|
|
32
|
+
*/
|
|
33
|
+
value: T;
|
|
34
|
+
/**
|
|
35
|
+
* Callback triggered when selection changes
|
|
36
|
+
*/
|
|
37
|
+
onChange: (value: T) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Global disabled state for the entire control
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Size variant controlling padding and text size
|
|
45
|
+
* @default "md"
|
|
46
|
+
*/
|
|
47
|
+
size?: SegmentedControlSize;
|
|
48
|
+
/**
|
|
49
|
+
* Expand control to span full container width
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
fullWidth?: boolean;
|
|
53
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
+
export type SelectBoxSize = 'sm' | 'md' | 'lg';
|
|
2
3
|
export type BaseOption = {
|
|
3
4
|
/** Unique value for the option (used for selection comparison) */
|
|
4
5
|
value: string;
|
|
@@ -9,15 +10,25 @@ export type BaseOption = {
|
|
|
9
10
|
/** Additional metadata fields allowed on the option */
|
|
10
11
|
[k: string]: any;
|
|
11
12
|
};
|
|
13
|
+
export type OptionGroup<T = BaseOption> = {
|
|
14
|
+
/** Section header label for the group */
|
|
15
|
+
group: string;
|
|
16
|
+
/** Options belonging to this group */
|
|
17
|
+
options: T[];
|
|
18
|
+
};
|
|
12
19
|
export interface SelectBoxProps<T extends BaseOption | string = BaseOption> {
|
|
13
20
|
/** List of options to display in the dropdown */
|
|
14
|
-
options
|
|
21
|
+
options?: T[];
|
|
22
|
+
/** List of option groups to display in the dropdown (alternative to options) */
|
|
23
|
+
groups?: OptionGroup<T>[];
|
|
15
24
|
/**
|
|
16
25
|
* Currently selected option(s).
|
|
17
26
|
* - For single select: a single T or null
|
|
18
27
|
* - For multi-select: T[]
|
|
19
28
|
*/
|
|
20
29
|
selected?: T | T[] | null;
|
|
30
|
+
/** Size scale of the SelectBox component (`"sm"` | `"md"` | `"lg"`). Defaults to `"md"`. */
|
|
31
|
+
size?: SelectBoxSize;
|
|
21
32
|
/** Name of the field inside option objects to use as the label (defaults to "label") */
|
|
22
33
|
labelKey?: string;
|
|
23
34
|
/** Name of the field inside option objects to use as the value (defaults to "value") */
|
|
@@ -49,13 +60,7 @@ export interface SelectBoxProps<T extends BaseOption | string = BaseOption> {
|
|
|
49
60
|
/** CSS classes applied to the dropdown options container */
|
|
50
61
|
dropdownContainerClass?: string;
|
|
51
62
|
/**
|
|
52
|
-
* Whether the open dropdown traps focus and makes the rest of the page
|
|
53
|
-
* inert (Headless UI's default Combobox behavior). Disabled by default so
|
|
54
|
-
* elements rendered inside the control itself — like the `allowClear`
|
|
55
|
-
* button — and the rest of the page stay interactive while the dropdown
|
|
56
|
-
* is open, matching common combobox libraries (e.g. react-select). Set to
|
|
57
|
-
* `true` to restore Headless UI's modal focus-trapping behavior.
|
|
58
|
-
*
|
|
63
|
+
* Whether the open dropdown traps focus and makes the rest of the page inert.
|
|
59
64
|
* @default false
|
|
60
65
|
*/
|
|
61
66
|
modalDropdown?: boolean;
|
|
@@ -63,15 +68,24 @@ export interface SelectBoxProps<T extends BaseOption | string = BaseOption> {
|
|
|
63
68
|
multiple?: boolean;
|
|
64
69
|
/** Maximum number of selections allowed in multi-select mode */
|
|
65
70
|
maxSelection?: number;
|
|
71
|
+
/**
|
|
72
|
+
* Automatically renders a "Select All" / "Clear All" action header inside multi-select dropdowns.
|
|
73
|
+
*/
|
|
74
|
+
showSelectAll?: boolean;
|
|
66
75
|
/**
|
|
67
76
|
* Whether to commit value selection immediately when clicking options.
|
|
68
|
-
* Headless UI uses "immediate" to control Combobox selection behavior.
|
|
69
77
|
*/
|
|
70
78
|
immediate?: boolean;
|
|
71
79
|
/** Whether to show an error message below the field */
|
|
72
80
|
showErrorMessage?: boolean;
|
|
73
81
|
/** Error message displayed below the component */
|
|
74
82
|
error?: string | ReactNode;
|
|
83
|
+
/** Helper guidance message rendered below the field */
|
|
84
|
+
helperText?: ReactNode;
|
|
85
|
+
/** Optional icon or element displayed on the left side of the input */
|
|
86
|
+
leftGroup?: ReactNode;
|
|
87
|
+
/** Custom option renderer function */
|
|
88
|
+
renderOption?: (option: T, isSelected: boolean) => ReactNode;
|
|
75
89
|
/**
|
|
76
90
|
* Enables async search mode:
|
|
77
91
|
* - Component will not filter options locally
|
|
@@ -100,11 +114,6 @@ export interface SelectBoxProps<T extends BaseOption | string = BaseOption> {
|
|
|
100
114
|
noOptionsText?: string;
|
|
101
115
|
/**
|
|
102
116
|
* Callback when the user chooses the "create/add" option.
|
|
103
|
-
*
|
|
104
|
-
* It may:
|
|
105
|
-
* - return void (do nothing automatically)
|
|
106
|
-
* - return a string or BaseOption → the component will auto-add/select it
|
|
107
|
-
* - return a Promise resolving to the above
|
|
108
117
|
*/
|
|
109
118
|
onAdd?: (value: string) => Promise<T | string | void> | T | string | void;
|
|
110
119
|
/** Show a clear (X) button for single-select mode */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ElementType, JSX } from 'react';
|
|
2
|
+
import type { PolymorphicRef } from '../common-type';
|
|
3
|
+
export type SkeletonVariant = 'text' | 'circular' | 'rectangular' | 'rounded';
|
|
4
|
+
export type SkeletonAnimation = 'pulse' | 'wave' | 'none';
|
|
5
|
+
export interface SkeletonBaseProps {
|
|
6
|
+
/**
|
|
7
|
+
* Shape variant of the skeleton element
|
|
8
|
+
* @default "text"
|
|
9
|
+
*/
|
|
10
|
+
variant?: SkeletonVariant;
|
|
11
|
+
/**
|
|
12
|
+
* Animation style for the placeholder shimmer
|
|
13
|
+
* @default "pulse"
|
|
14
|
+
*/
|
|
15
|
+
animation?: SkeletonAnimation;
|
|
16
|
+
/**
|
|
17
|
+
* Explicit width (number in px or CSS string like "100%", "200px")
|
|
18
|
+
*/
|
|
19
|
+
width?: number | string;
|
|
20
|
+
/**
|
|
21
|
+
* Explicit height (number in px or CSS string like "1rem", "40px")
|
|
22
|
+
*/
|
|
23
|
+
height?: number | string;
|
|
24
|
+
/**
|
|
25
|
+
* Optional custom border radius override
|
|
26
|
+
*/
|
|
27
|
+
borderRadius?: number | string;
|
|
28
|
+
}
|
|
29
|
+
export type PolymorphicSkeletonProps<C extends ElementType, Props = {}> = Props & {
|
|
30
|
+
as?: C;
|
|
31
|
+
} & Omit<ComponentPropsWithoutRef<C>, keyof Props | 'as'>;
|
|
32
|
+
export type SkeletonProps<C extends ElementType = 'div'> = PolymorphicSkeletonProps<C, SkeletonBaseProps>;
|
|
33
|
+
export interface SkeletonComponent {
|
|
34
|
+
<C extends ElementType = 'div'>(props: SkeletonProps<C> & {
|
|
35
|
+
ref?: PolymorphicRef<C>;
|
|
36
|
+
}): JSX.Element;
|
|
37
|
+
displayName?: string;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type StatusPillTheme = 'success' | 'warning' | 'danger' | 'info' | 'secondary';
|
|
3
|
+
export type StatusPillSize = 'sm' | 'md';
|
|
4
|
+
export interface StatusPillProps extends HTMLAttributes<HTMLSpanElement> {
|
|
5
|
+
/**
|
|
6
|
+
* Status theme tone
|
|
7
|
+
* @default "secondary"
|
|
8
|
+
*/
|
|
9
|
+
theme?: StatusPillTheme;
|
|
10
|
+
/**
|
|
11
|
+
* Size variant controlling padding and text size
|
|
12
|
+
* @default "sm"
|
|
13
|
+
*/
|
|
14
|
+
size?: StatusPillSize;
|
|
15
|
+
/**
|
|
16
|
+
* Display indicator dot inside the status pill
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
19
|
+
dot?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Enable pulsing animation on indicator dot
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
pulse?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Label content of the status pill
|
|
27
|
+
*/
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface StickyActionBarProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Primary summary content rendered on the left/start side (e.g. Total amount, item count)
|
|
5
|
+
*/
|
|
6
|
+
summaryContent?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Action buttons rendered on the right/end side (e.g. Save, Cancel buttons)
|
|
9
|
+
*/
|
|
10
|
+
actionsContent?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Optional expandable drawer content triggered when clicking summary
|
|
13
|
+
*/
|
|
14
|
+
drawerContent?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Title for the expandable summary drawer
|
|
17
|
+
* @default "Summary Details"
|
|
18
|
+
*/
|
|
19
|
+
drawerTitle?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Positioning mode for the bar
|
|
22
|
+
* @default "fixed"
|
|
23
|
+
*/
|
|
24
|
+
position?: 'fixed' | 'sticky' | 'relative';
|
|
25
|
+
/**
|
|
26
|
+
* Custom maximum width container class
|
|
27
|
+
* @default "max-w-5xl"
|
|
28
|
+
*/
|
|
29
|
+
containerMaxWidth?: string;
|
|
30
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TextContentProps } from './TextContent.types';
|
|
3
|
-
export declare const TextContent: React.ForwardRefExoticComponent<TextContentProps & React.RefAttributes<
|
|
2
|
+
import type { TextContentProps } from './TextContent.types';
|
|
3
|
+
export declare const TextContent: React.ForwardRefExoticComponent<TextContentProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -1,23 +1,63 @@
|
|
|
1
|
-
import type { HTMLAttributes } from 'react';
|
|
2
|
-
export
|
|
1
|
+
import type { HTMLAttributes, JSX, ReactNode } from 'react';
|
|
2
|
+
export type TextContentSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
3
|
+
export type TextContentWeight = 'light' | 'normal' | 'medium' | 'semibold' | 'bold';
|
|
4
|
+
export interface TextContentProps extends HTMLAttributes<HTMLElement> {
|
|
5
|
+
children?: ReactNode;
|
|
3
6
|
/**
|
|
4
|
-
*
|
|
7
|
+
* HTML element to render (e.g. `span`, `code`, `mark`, `label`, `b`, `i`, `div`, `time`).
|
|
8
|
+
* Defaults to `span`.
|
|
9
|
+
*/
|
|
10
|
+
as?: keyof JSX.IntrinsicElements;
|
|
11
|
+
/**
|
|
12
|
+
* Font size variant (`xs`, `sm`, `md`, `lg`, `xl`).
|
|
13
|
+
*/
|
|
14
|
+
size?: TextContentSize;
|
|
15
|
+
/**
|
|
16
|
+
* Font weight variant (`light`, `normal`, `medium`, `semibold`, `bold`).
|
|
17
|
+
*/
|
|
18
|
+
weight?: TextContentWeight;
|
|
19
|
+
/**
|
|
20
|
+
* Shortcut for extra-small text (`text-xs/5`). Retained for backward compatibility.
|
|
5
21
|
*/
|
|
6
22
|
xsmall?: boolean;
|
|
7
23
|
/**
|
|
8
|
-
*
|
|
24
|
+
* Shortcut for small text (`text-sm/6`). Retained for backward compatibility.
|
|
9
25
|
*/
|
|
10
26
|
small?: boolean;
|
|
11
27
|
/**
|
|
12
|
-
*
|
|
28
|
+
* Shortcut for semibold text (`font-semibold`). Retained for backward compatibility.
|
|
13
29
|
*/
|
|
14
30
|
strong?: boolean;
|
|
15
31
|
/**
|
|
16
|
-
* Apply muted gray tone
|
|
32
|
+
* Apply muted gray tone.
|
|
17
33
|
*/
|
|
18
34
|
muted?: boolean;
|
|
19
35
|
/**
|
|
20
|
-
* Apply error
|
|
36
|
+
* Apply error red text color.
|
|
21
37
|
*/
|
|
22
38
|
error?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Apply success green text color.
|
|
41
|
+
*/
|
|
42
|
+
success?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Apply warning amber text color.
|
|
45
|
+
*/
|
|
46
|
+
warning?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Apply info blue text color.
|
|
49
|
+
*/
|
|
50
|
+
info?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Inverted text color for dark background contexts.
|
|
53
|
+
*/
|
|
54
|
+
invert?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Monospace font family (`font-mono`) for code snippets or numbers.
|
|
57
|
+
*/
|
|
58
|
+
monospace?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Truncate single line text with ellipsis.
|
|
61
|
+
*/
|
|
62
|
+
truncate?: boolean;
|
|
23
63
|
}
|
|
@@ -1,6 +1,40 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TextareaHTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import type { InputCustomProps } from '../common-type';
|
|
3
|
+
export type TextareaSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export type TextareaResize = 'none' | 'vertical' | 'horizontal' | 'both';
|
|
3
5
|
export interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement>, InputCustomProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Space for right icon / control
|
|
8
|
+
*/
|
|
9
|
+
rightGroup?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Space for left icon / control
|
|
12
|
+
*/
|
|
13
|
+
leftGroup?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Size scale of the textarea.
|
|
16
|
+
* - `sm` (compact padding/text-xs)
|
|
17
|
+
* - `md` (standard padding/text-sm default)
|
|
18
|
+
* - `lg` (prominent padding/text-base)
|
|
19
|
+
* Defaults to `"md"`.
|
|
20
|
+
*/
|
|
21
|
+
size?: TextareaSize;
|
|
22
|
+
/**
|
|
23
|
+
* Automatically expands textarea height as text lines are typed.
|
|
24
|
+
* Defaults to `false`.
|
|
25
|
+
*/
|
|
26
|
+
autoSize?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Renders a live character count (`140 / 500`) below the textarea.
|
|
29
|
+
*/
|
|
30
|
+
showCount?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Helper guidance text rendered below the textarea.
|
|
33
|
+
*/
|
|
34
|
+
helperText?: ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* CSS resize control behavior.
|
|
37
|
+
* Defaults to `"vertical"`.
|
|
38
|
+
*/
|
|
39
|
+
resize?: TextareaResize;
|
|
6
40
|
}
|