@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
|
@@ -8,40 +8,68 @@ export interface DrawerProps {
|
|
|
8
8
|
isOpen: boolean;
|
|
9
9
|
/**
|
|
10
10
|
* Handler method that invokes on close attempt
|
|
11
|
-
* @returns void
|
|
12
11
|
*/
|
|
13
12
|
onClose?: () => void;
|
|
14
13
|
/**
|
|
15
|
-
*
|
|
14
|
+
* Controls whether clicking outside / backdrop closes the drawer.
|
|
15
|
+
* Set to false to prevent accidental dismissal.
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
closeOnOutsideClick?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Drawer alignment on the page ('start' | 'end' | 'top' | 'bottom' | 'center')
|
|
16
21
|
* @default "end"
|
|
17
22
|
*/
|
|
18
23
|
align?: DrawerAlignment;
|
|
19
24
|
/**
|
|
20
|
-
* Whether to add backdrop
|
|
21
|
-
* @default
|
|
25
|
+
* Whether to add backdrop overlay
|
|
26
|
+
* @default true
|
|
22
27
|
*/
|
|
23
28
|
backdrop?: boolean;
|
|
24
29
|
/**
|
|
25
|
-
* Drawer title
|
|
30
|
+
* Optional Drawer title
|
|
26
31
|
*/
|
|
27
|
-
title
|
|
32
|
+
title?: ReactNode;
|
|
28
33
|
/**
|
|
29
34
|
* Controls if the title should be sticky on top
|
|
30
35
|
*/
|
|
31
36
|
titleSticky?: boolean;
|
|
32
37
|
/**
|
|
33
|
-
* Drawer description
|
|
38
|
+
* Drawer description text
|
|
34
39
|
*/
|
|
35
40
|
description?: ReactNode;
|
|
36
41
|
/**
|
|
37
|
-
*
|
|
42
|
+
* Main content of the drawer
|
|
38
43
|
*/
|
|
39
44
|
children?: ReactNode;
|
|
40
45
|
/**
|
|
41
|
-
*
|
|
46
|
+
* Optional drawer footer action bar (e.g. action buttons)
|
|
47
|
+
*/
|
|
48
|
+
footer?: ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Keeps the footer sticky at the bottom of the drawer
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
footerSticky?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Drawer size ('xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full')
|
|
42
56
|
* @default "md"
|
|
43
57
|
*/
|
|
44
58
|
size?: DrawerSize;
|
|
59
|
+
/**
|
|
60
|
+
* Shows top-right ✕ close button
|
|
61
|
+
* @default true
|
|
62
|
+
*/
|
|
63
|
+
showCloseButton?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Shows left ← back button in header
|
|
66
|
+
*/
|
|
67
|
+
showBackButton?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Displays top drag handle pill (especially for mobile bottom sheets)
|
|
70
|
+
* Defaults to true when align="bottom"
|
|
71
|
+
*/
|
|
72
|
+
dragHandle?: boolean;
|
|
45
73
|
/**
|
|
46
74
|
* Dialog Panel class
|
|
47
75
|
*/
|
|
@@ -58,10 +86,6 @@ export interface DrawerProps {
|
|
|
58
86
|
* Drawer description class
|
|
59
87
|
*/
|
|
60
88
|
descriptionClass?: string;
|
|
61
|
-
/**
|
|
62
|
-
* Should show back button on Drawer
|
|
63
|
-
*/
|
|
64
|
-
showBackButton?: boolean;
|
|
65
89
|
}
|
|
66
90
|
export type AlignmentMap = {
|
|
67
91
|
[key in DrawerAlignment]: string;
|
|
@@ -36,16 +36,32 @@ export type DropdownItem = {
|
|
|
36
36
|
/** Unique ID for the item. */
|
|
37
37
|
id: string;
|
|
38
38
|
/** Display label (optional if using custom render). */
|
|
39
|
-
label?:
|
|
39
|
+
label?: ReactNode;
|
|
40
|
+
/** Subtitle description text displayed underneath the label. */
|
|
41
|
+
description?: ReactNode;
|
|
42
|
+
/** Icon displayed on the left side of the item. */
|
|
43
|
+
icon?: ReactNode;
|
|
44
|
+
/** Keyboard shortcut key badge on the right side (e.g. '⌘K'). */
|
|
45
|
+
shortcut?: string;
|
|
46
|
+
/** Marks item as destructive action (renders in red styling). */
|
|
47
|
+
danger?: boolean;
|
|
48
|
+
/** Group or section title header displayed above this item. */
|
|
49
|
+
groupTitle?: string;
|
|
40
50
|
/** If true, renders a horizontal divider instead of an item. */
|
|
41
51
|
divider?: boolean;
|
|
42
52
|
/** Optional: mark item as disabled. */
|
|
43
53
|
disabled?: boolean;
|
|
54
|
+
/** Custom click handler for this item. */
|
|
55
|
+
onClick?: (item: DropdownItem) => void;
|
|
44
56
|
/** Allow additional arbitrary metadata. */
|
|
45
57
|
[key: string]: any;
|
|
46
58
|
};
|
|
47
59
|
/** Base props shared between both trigger modes. */
|
|
48
60
|
type DropdownBaseProps = {
|
|
61
|
+
/** Outer container / trigger class name */
|
|
62
|
+
className?: string;
|
|
63
|
+
/** Width size variant or custom width ('auto' | 'sm' | 'md' | 'lg' | 'xl' | string). Default is 'md' (w-56) */
|
|
64
|
+
width?: 'auto' | 'sm' | 'md' | 'lg' | 'xl' | string;
|
|
49
65
|
/** Additional classes for the menu container. */
|
|
50
66
|
itemsContainerClass?: string;
|
|
51
67
|
/** Enables menu transition animations. Default: true */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { HeadingTextProps } from './HeadingText.types';
|
|
3
|
-
export declare const HeadingText: {
|
|
4
|
-
Title: React.
|
|
5
|
-
SubTitle: React.
|
|
6
|
-
SubTitle2: React.
|
|
7
|
-
SubTitle3: React.
|
|
8
|
-
SubTitle4: React.
|
|
2
|
+
import type { HeadingTextProps } from './HeadingText.types';
|
|
3
|
+
export declare const HeadingText: React.ForwardRefExoticComponent<HeadingTextProps & React.RefAttributes<HTMLHeadingElement>> & {
|
|
4
|
+
Title: React.ForwardRefExoticComponent<HeadingTextProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
5
|
+
SubTitle: React.ForwardRefExoticComponent<HeadingTextProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
6
|
+
SubTitle2: React.ForwardRefExoticComponent<HeadingTextProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
7
|
+
SubTitle3: React.ForwardRefExoticComponent<HeadingTextProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
8
|
+
SubTitle4: React.ForwardRefExoticComponent<HeadingTextProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
9
9
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,58 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
3
|
+
export type HeadingSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl';
|
|
4
|
+
export type HeadingWeight = 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold';
|
|
5
|
+
export type HeadingAlign = 'left' | 'center' | 'right';
|
|
6
|
+
export interface HeadingTextProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Heading HTML element level: 1 (h1), 2 (h2), 3 (h3), 4 (h4), 5 (h5), 6 (h6).
|
|
10
|
+
* Defaults to `1`.
|
|
11
|
+
*/
|
|
12
|
+
level?: HeadingLevel;
|
|
13
|
+
/**
|
|
14
|
+
* Visual font size override.
|
|
15
|
+
*/
|
|
16
|
+
size?: HeadingSize;
|
|
17
|
+
/**
|
|
18
|
+
* Font weight override.
|
|
19
|
+
*/
|
|
20
|
+
weight?: HeadingWeight;
|
|
21
|
+
/**
|
|
22
|
+
* Muted secondary text color.
|
|
23
|
+
*/
|
|
24
|
+
muted?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Error red text color.
|
|
27
|
+
*/
|
|
28
|
+
error?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Success green text color.
|
|
31
|
+
*/
|
|
32
|
+
success?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Warning amber text color.
|
|
35
|
+
*/
|
|
36
|
+
warning?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Info blue text color.
|
|
39
|
+
*/
|
|
40
|
+
info?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Inverted text color for dark backgrounds.
|
|
43
|
+
*/
|
|
44
|
+
invert?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Text alignment (`left`, `center`, `right`).
|
|
47
|
+
*/
|
|
48
|
+
align?: HeadingAlign;
|
|
49
|
+
/**
|
|
50
|
+
* Letter spacing / tracking (`tighter`, `tight`, `normal`, `wide`).
|
|
51
|
+
*/
|
|
52
|
+
tracking?: 'tighter' | 'tight' | 'normal' | 'wide';
|
|
53
|
+
/**
|
|
54
|
+
* Truncate text with ellipsis.
|
|
55
|
+
*/
|
|
56
|
+
truncate?: boolean;
|
|
4
57
|
className?: string;
|
|
5
58
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { InputProps } from './Input.types';
|
|
2
|
-
export declare function buildInputClass(className?: string, { isFocusWithin, disabled }?: {
|
|
1
|
+
import type { InputProps, InputSize } from './Input.types';
|
|
2
|
+
export declare function buildInputClass(className?: string, { isFocusWithin, disabled, hasError, size, }?: {
|
|
3
3
|
isFocusWithin?: boolean;
|
|
4
4
|
disabled?: boolean;
|
|
5
|
+
hasError?: boolean;
|
|
6
|
+
size?: InputSize;
|
|
5
7
|
}): string;
|
|
6
8
|
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -1,12 +1,45 @@
|
|
|
1
1
|
import type { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import type { InputCustomProps } from '../common-type';
|
|
3
|
-
export
|
|
3
|
+
export type InputSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'>, InputCustomProps {
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Size scale of the input component.
|
|
7
|
+
* - `sm` (compact 28px/text-xs)
|
|
8
|
+
* - `md` (standard 36px/text-sm default)
|
|
9
|
+
* - `lg` (prominent 44px/text-base)
|
|
10
|
+
* Defaults to `"md"`.
|
|
11
|
+
*/
|
|
12
|
+
size?: InputSize;
|
|
13
|
+
/**
|
|
14
|
+
* Space for right icon / control
|
|
6
15
|
*/
|
|
7
16
|
rightGroup?: ReactNode;
|
|
8
17
|
/**
|
|
9
|
-
* Space for left icon
|
|
18
|
+
* Space for left icon / control
|
|
10
19
|
*/
|
|
11
20
|
leftGroup?: ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* Static prefix addon text or element (e.g. `"https://"` or `"$"`).
|
|
23
|
+
*/
|
|
24
|
+
prefix?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Static suffix addon text or element (e.g. `".com"` or `"USD"`).
|
|
27
|
+
*/
|
|
28
|
+
suffix?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Renders a 1-Click clear `✕` button when text is present.
|
|
31
|
+
*/
|
|
32
|
+
clearable?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Callback fired when clear button is clicked.
|
|
35
|
+
*/
|
|
36
|
+
onClear?: () => void;
|
|
37
|
+
/**
|
|
38
|
+
* Renders a live character count (`12 / 50`) below the input field.
|
|
39
|
+
*/
|
|
40
|
+
showCount?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Helper message rendered below the input field.
|
|
43
|
+
*/
|
|
44
|
+
helperText?: ReactNode;
|
|
12
45
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface PasswordInputProps extends Omit<InputProps, 'rightGroup' | 'type' | 'placeholder'> {
|
|
3
|
-
}
|
|
1
|
+
import type { PasswordInputProps } from './PasswordInput.types';
|
|
4
2
|
export declare const PASSWORD_TYPE = "password";
|
|
5
3
|
export declare const PASSWORD_PLACEHOLDER = "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
|
|
6
|
-
export declare
|
|
4
|
+
export declare function evaluatePasswordStrength(val: string): {
|
|
5
|
+
score: number;
|
|
6
|
+
label: 'Weak' | 'Fair' | 'Good' | 'Strong';
|
|
7
|
+
colorClass: string;
|
|
8
|
+
percent: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const PasswordInput: import("react").ForwardRefExoticComponent<PasswordInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { InputProps } from '../Input';
|
|
2
|
+
export interface PasswordInputProps extends Omit<InputProps, 'rightGroup' | 'type'> {
|
|
3
|
+
/**
|
|
4
|
+
* Automatically evaluates and renders a visual password strength indicator bar
|
|
5
|
+
* (Weak, Fair, Good, Strong) based on length, digits, symbols, and uppercase letters.
|
|
6
|
+
*/
|
|
7
|
+
showStrength?: boolean;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type QuantityStepperSize = 'sm' | 'md' | 'lg';
|
|
3
|
+
export interface QuantityStepperProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value' | 'size' | 'prefix'> {
|
|
4
|
+
/**
|
|
5
|
+
* Numeric value of the stepper
|
|
6
|
+
*/
|
|
7
|
+
value: number;
|
|
8
|
+
/**
|
|
9
|
+
* Callback fired when value changes
|
|
10
|
+
*/
|
|
11
|
+
onChange: (value: number) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Minimum allowable value
|
|
14
|
+
* @default 0
|
|
15
|
+
*/
|
|
16
|
+
min?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Maximum allowable value
|
|
19
|
+
* @default 99999
|
|
20
|
+
*/
|
|
21
|
+
max?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Increment/decrement step interval
|
|
24
|
+
* @default 1
|
|
25
|
+
*/
|
|
26
|
+
step?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Optional field label text
|
|
29
|
+
*/
|
|
30
|
+
label?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Size variant controlling button and text dimensions
|
|
33
|
+
* @default "md"
|
|
34
|
+
*/
|
|
35
|
+
size?: QuantityStepperSize;
|
|
36
|
+
/**
|
|
37
|
+
* Optional prefix icon or element
|
|
38
|
+
*/
|
|
39
|
+
prefix?: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Optional suffix element (e.g. unit label like "kg", "items")
|
|
42
|
+
*/
|
|
43
|
+
suffix?: ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* Disabled state for input and controls
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RadioProps } from './Radio.types';
|
|
1
|
+
import type { RadioProps } from './Radio.types';
|
|
2
2
|
export declare const Radio: import("react").ForwardRefExoticComponent<RadioProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import type { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import type { InputCustomProps } from '../common-type';
|
|
3
|
-
export
|
|
4
|
-
|
|
3
|
+
export type RadioSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export type RadioTheme = 'primary' | 'success' | 'danger';
|
|
5
|
+
export interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'>, Omit<InputCustomProps, 'labelHint'> {
|
|
6
|
+
/** Force type to radio only */
|
|
5
7
|
type?: 'radio';
|
|
8
|
+
/** Optional subtext description below radio label */
|
|
9
|
+
description?: ReactNode;
|
|
10
|
+
/** Size variant ('sm' | 'md' | 'lg') @default "md" */
|
|
11
|
+
size?: RadioSize;
|
|
12
|
+
/** Color accent theme ('primary' | 'success' | 'danger') @default "primary" */
|
|
13
|
+
theme?: RadioTheme;
|
|
6
14
|
/** Extra class for outer wrapper */
|
|
7
15
|
wrapperClass?: string;
|
|
8
16
|
/** Input container class */
|
|
9
17
|
containerClass?: string;
|
|
10
18
|
/** Label class */
|
|
11
19
|
labelClass?: string;
|
|
20
|
+
/** Description subtext class */
|
|
21
|
+
descriptionClass?: string;
|
|
12
22
|
/** Error message */
|
|
13
23
|
error?: string | ReactNode;
|
|
14
24
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { ChangeEvent, ReactNode } from 'react';
|
|
2
|
+
import type { RadioSize, RadioTheme } from '../Radio/Radio.types';
|
|
3
|
+
export type RadioGroupVariant = 'default' | 'cards';
|
|
4
|
+
export type RadioGroupColumns = 1 | 2 | 3 | 4;
|
|
2
5
|
export type RadionGroupItem = {
|
|
3
6
|
/**
|
|
4
7
|
* The display label shown next to the radio button.
|
|
@@ -6,19 +9,43 @@ export type RadionGroupItem = {
|
|
|
6
9
|
label: string;
|
|
7
10
|
/**
|
|
8
11
|
* The underlying value associated with the option.
|
|
9
|
-
* Can be any type, including string, number, or object.
|
|
10
12
|
*/
|
|
11
13
|
value: any;
|
|
14
|
+
/**
|
|
15
|
+
* Optional subtext description for rich option items.
|
|
16
|
+
*/
|
|
17
|
+
description?: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Optional icon displayed next to the item label.
|
|
20
|
+
*/
|
|
21
|
+
icon?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Disable individual option item
|
|
24
|
+
*/
|
|
25
|
+
disabled?: boolean;
|
|
12
26
|
};
|
|
13
27
|
export interface RadioGroupProps {
|
|
14
28
|
/**
|
|
15
29
|
* The name attribute shared by all radio buttons in the group.
|
|
16
|
-
* Ensures only one option can be selected at a time.
|
|
17
30
|
*/
|
|
18
31
|
name: string;
|
|
19
32
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
33
|
+
* Visual variant mode: 'default' or 'cards' (rich selectable card tiles)
|
|
34
|
+
* @default "default"
|
|
35
|
+
*/
|
|
36
|
+
variant?: RadioGroupVariant;
|
|
37
|
+
/**
|
|
38
|
+
* Size variant for all radios in the group ('sm' | 'md' | 'lg')
|
|
39
|
+
* @default "md"
|
|
40
|
+
*/
|
|
41
|
+
size?: RadioSize;
|
|
42
|
+
/**
|
|
43
|
+
* Theme accent color ('primary' | 'success' | 'danger')
|
|
44
|
+
* @default "primary"
|
|
45
|
+
*/
|
|
46
|
+
theme?: RadioTheme;
|
|
47
|
+
/**
|
|
48
|
+
* Optional label displayed above the radio group.
|
|
22
49
|
*/
|
|
23
50
|
label?: ReactNode;
|
|
24
51
|
/**
|
|
@@ -31,33 +58,34 @@ export interface RadioGroupProps {
|
|
|
31
58
|
labelWrapperClass?: string;
|
|
32
59
|
/**
|
|
33
60
|
* Optional hint content displayed beside the label.
|
|
34
|
-
* Useful for showing small guidance text.
|
|
35
61
|
*/
|
|
36
62
|
labelHint?: ReactNode;
|
|
37
63
|
/**
|
|
38
|
-
* Custom CSS classes applied to the outer container
|
|
39
|
-
* that wraps the entire radio group.
|
|
64
|
+
* Custom CSS classes applied to the outer container.
|
|
40
65
|
*/
|
|
41
66
|
containerClass?: string;
|
|
42
67
|
/**
|
|
43
68
|
* The currently selected value.
|
|
44
|
-
* When provided, the component becomes controlled.
|
|
45
69
|
*/
|
|
46
70
|
value?: any;
|
|
47
71
|
/**
|
|
48
72
|
* The list of options to render.
|
|
49
|
-
* - Strings → converted to { label, value } internally
|
|
50
|
-
* - Objects → must follow RadionButtonGroupItem structure
|
|
51
73
|
*/
|
|
52
74
|
options: string[] | RadionGroupItem[];
|
|
75
|
+
/**
|
|
76
|
+
* Grid column layout when variant="cards" or row=true (1 | 2 | 3 | 4)
|
|
77
|
+
*/
|
|
78
|
+
columns?: RadioGroupColumns;
|
|
79
|
+
/**
|
|
80
|
+
* Disables all options in the radio group.
|
|
81
|
+
*/
|
|
82
|
+
disabled?: boolean;
|
|
53
83
|
/**
|
|
54
84
|
* Whether to display radio buttons horizontally in a row.
|
|
55
|
-
* Defaults to vertical column layout.
|
|
56
85
|
*/
|
|
57
86
|
row?: boolean;
|
|
58
87
|
/**
|
|
59
|
-
* Change handler called when
|
|
60
|
-
* Receives the native ChangeEvent from the input element.
|
|
88
|
+
* Change handler called when selected value changes.
|
|
61
89
|
*/
|
|
62
90
|
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
63
91
|
error?: string | null;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { RadioSwitchProps } from './RadioSwitch.types';
|
|
3
|
-
/**
|
|
4
|
-
* GPU-accelerated Radio Switch with perfect highlight alignment.
|
|
5
|
-
* Supports wrapping, icons, descriptions, and dark mode.
|
|
6
|
-
*/
|
|
7
3
|
export declare const RadioSwitch: React.FC<RadioSwitchProps>;
|
|
@@ -1,45 +1,20 @@
|
|
|
1
1
|
import type { RadioGroupProps } from '@headlessui/react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Can be:
|
|
5
|
-
* - a string → used as both label & value
|
|
6
|
-
* - an object → allows custom label, value, and an optional description
|
|
7
|
-
*/
|
|
2
|
+
export type RadioSwitchSize = 'sm' | 'md' | 'lg';
|
|
3
|
+
export type RadioSwitchTheme = 'primary' | 'secondary' | 'dark';
|
|
8
4
|
export type RadioSwitchItem = string | {
|
|
9
|
-
/** Text shown inside the switch option */
|
|
10
5
|
label: string;
|
|
11
|
-
/** The underlying value for this option */
|
|
12
6
|
value: string;
|
|
13
|
-
/** Optional description shown below the label (small text) */
|
|
14
7
|
description?: string;
|
|
8
|
+
disabled?: boolean;
|
|
15
9
|
};
|
|
16
|
-
/**
|
|
17
|
-
* Props for the RadioSwitch component.
|
|
18
|
-
* Extends HeadlessUI's RadioGroupProps.
|
|
19
|
-
*/
|
|
20
10
|
export type RadioSwitchProps = RadioGroupProps & {
|
|
21
|
-
/**
|
|
22
|
-
* Accessible label for the group.
|
|
23
|
-
* Used internally for aria-label.
|
|
24
|
-
*/
|
|
25
11
|
label?: string;
|
|
26
|
-
/**
|
|
27
|
-
* The currently selected value.
|
|
28
|
-
* Makes this a controlled component.
|
|
29
|
-
*/
|
|
30
12
|
selected: string;
|
|
31
|
-
/**
|
|
32
|
-
* Callback fired when selection changes.
|
|
33
|
-
* Receives the selected string value.
|
|
34
|
-
*/
|
|
35
13
|
onChange: (value: string) => void;
|
|
36
|
-
/**
|
|
37
|
-
* List of switch options.
|
|
38
|
-
* Can be:
|
|
39
|
-
* - an array of strings
|
|
40
|
-
* - an array of objects with label/value/description
|
|
41
|
-
*/
|
|
42
14
|
items: RadioSwitchItem[];
|
|
15
|
+
size?: RadioSwitchSize;
|
|
16
|
+
theme?: RadioSwitchTheme;
|
|
17
|
+
disabled?: boolean;
|
|
43
18
|
switchClass?: string;
|
|
44
19
|
wrapperClass?: string;
|
|
45
20
|
contentClass?: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RangeInputProps } from './RangeInput.types';
|
|
1
|
+
import type { RangeInputProps } from './RangeInput.types';
|
|
2
2
|
export declare const RangeInput: import("react").ForwardRefExoticComponent<RangeInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import type { InputCustomProps } from '../common-type';
|
|
3
|
-
export
|
|
3
|
+
export type RangeInputSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export interface RangeInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'>, InputCustomProps {
|
|
5
|
+
/**
|
|
6
|
+
* Size scale of the slider (`"sm"` | `"md"` | `"lg"`). Defaults to `"md"`.
|
|
7
|
+
*/
|
|
8
|
+
size?: RangeInputSize;
|
|
4
9
|
/** Extra class for outer wrapper */
|
|
5
10
|
wrapperClass?: string;
|
|
6
11
|
/** Input container class */
|
|
@@ -9,6 +14,14 @@ export interface RangeInputProps extends Omit<InputHTMLAttributes<HTMLInputEleme
|
|
|
9
14
|
labelClass?: string;
|
|
10
15
|
/** Error message */
|
|
11
16
|
error?: string | ReactNode;
|
|
17
|
+
/** Helper guidance message rendered below the slider */
|
|
18
|
+
helperText?: ReactNode;
|
|
19
|
+
/** Whether to display current value on the right side of the slider. Defaults to `true`. */
|
|
12
20
|
showValue?: boolean;
|
|
21
|
+
/** String suffix appended to value display (e.g. `"%"`, `"px"`, `"₹"`) */
|
|
13
22
|
valueSuffix?: string;
|
|
23
|
+
/** Floating value tooltip popup badge displayed above the thumb on hover or drag */
|
|
24
|
+
showTooltip?: boolean;
|
|
25
|
+
/** Step tick marks displayed along slider track (boolean or map of values to labels) */
|
|
26
|
+
marks?: boolean | Record<number, string>;
|
|
14
27
|
}
|