@mt-gloss/ui 0.0.2
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 +33 -0
- package/index.css +1 -0
- package/index.d.ts +80 -0
- package/index.js +17560 -0
- package/lib/Accordion.d.ts +103 -0
- package/lib/AsyncLoader.d.ts +41 -0
- package/lib/Badge.d.ts +42 -0
- package/lib/Button.d.ts +73 -0
- package/lib/ButtonGroup.d.ts +72 -0
- package/lib/Card.d.ts +140 -0
- package/lib/Checkbox.d.ts +70 -0
- package/lib/CheckboxGroup.d.ts +162 -0
- package/lib/Chip.d.ts +68 -0
- package/lib/ColorPicker.d.ts +82 -0
- package/lib/DatePicker.d.ts +102 -0
- package/lib/DateRangePicker.d.ts +109 -0
- package/lib/Dropdown.d.ts +65 -0
- package/lib/FileUpload.d.ts +109 -0
- package/lib/Form.d.ts +119 -0
- package/lib/FormField.d.ts +69 -0
- package/lib/Input.d.ts +89 -0
- package/lib/InputGroup.d.ts +59 -0
- package/lib/Link.d.ts +69 -0
- package/lib/MaskedInput.d.ts +95 -0
- package/lib/Menu.d.ts +132 -0
- package/lib/NumberInput.d.ts +81 -0
- package/lib/Radio.d.ts +60 -0
- package/lib/RadioGroup.d.ts +163 -0
- package/lib/RangeSlider.d.ts +105 -0
- package/lib/Rating.d.ts +115 -0
- package/lib/SegmentedControl.d.ts +96 -0
- package/lib/Select.d.ts +205 -0
- package/lib/Slider.d.ts +111 -0
- package/lib/SplitButton.d.ts +84 -0
- package/lib/Textarea.d.ts +59 -0
- package/lib/TimePicker.d.ts +93 -0
- package/lib/Toggle.d.ts +68 -0
- package/lib/Tooltip.d.ts +89 -0
- package/lib/Transition.d.ts +107 -0
- package/lib/composed/AddressSelect.d.ts +132 -0
- package/lib/composed/PasswordInput.d.ts +75 -0
- package/lib/composed/PaymentMethodSelect.d.ts +96 -0
- package/lib/composed/PhoneInput.d.ts +71 -0
- package/lib/composed/SearchInput.d.ts +80 -0
- package/lib/composed/TagInput.d.ts +98 -0
- package/lib/composed/index.d.ts +12 -0
- package/lib/dashboard/ChartControlBar/ChartControlBar.d.ts +45 -0
- package/lib/dashboard/ChartControlBar/FilterInput.d.ts +34 -0
- package/lib/dashboard/ChartControlBar/FusedShape.d.ts +32 -0
- package/lib/dashboard/ChartControlBar/Row1Controls.d.ts +62 -0
- package/lib/dashboard/ChartControlBar/Row2FilterTray.d.ts +62 -0
- package/lib/dashboard/ChartControlBar/fixtures/controlBarStates.d.ts +4 -0
- package/lib/dashboard/ChartControlBar/index.d.ts +8 -0
- package/lib/dashboard/ChartControlBar/types.d.ts +37 -0
- package/lib/dashboard/ChartControlBar/useFilterLayout.d.ts +51 -0
- package/lib/dashboard/FilterChip/FilterChip.d.ts +26 -0
- package/lib/dashboard/FilterChip/fixtures/filterChips.d.ts +11 -0
- package/lib/dashboard/FilterChip/index.d.ts +3 -0
- package/lib/dashboard/FilterChip/types.d.ts +17 -0
- package/lib/dashboard/MetricCard/CardShell.d.ts +22 -0
- package/lib/dashboard/MetricCard/GutterActions.d.ts +56 -0
- package/lib/dashboard/MetricCard/MetricCard.d.ts +33 -0
- package/lib/dashboard/MetricCard/StackedGroupCard.d.ts +43 -0
- package/lib/dashboard/MetricCard/TrendIndicator.d.ts +20 -0
- package/lib/dashboard/MetricCard/fixtures/allVariants.d.ts +6 -0
- package/lib/dashboard/MetricCard/fixtures/sparklineCard.d.ts +5 -0
- package/lib/dashboard/MetricCard/fixtures/standardCard.d.ts +7 -0
- package/lib/dashboard/MetricCard/fixtures/states.d.ts +19 -0
- package/lib/dashboard/MetricCard/index.d.ts +20 -0
- package/lib/dashboard/MetricCard/types.d.ts +109 -0
- package/lib/dashboard/MetricCard/useSlideOutReveal.d.ts +42 -0
- package/lib/dashboard/MetricCard/utils/formatTrend.d.ts +2 -0
- package/lib/dashboard/MetricCard/utils/formatValue.d.ts +2 -0
- package/lib/dashboard/MetricCard/visualizations/BarsBg.d.ts +25 -0
- package/lib/dashboard/MetricCard/visualizations/DonutChart.d.ts +26 -0
- package/lib/dashboard/MetricCard/visualizations/ObjectArrow.d.ts +28 -0
- package/lib/dashboard/MetricCard/visualizations/SparklineBg.d.ts +24 -0
- package/lib/dashboard/MetricCardGrid/MetricCardGrid.d.ts +28 -0
- package/lib/dashboard/MetricCardGrid/fixtures/gridCards.d.ts +3 -0
- package/lib/dashboard/MetricCardGrid/fixtures/layouts.d.ts +7 -0
- package/lib/dashboard/MetricCardGrid/index.d.ts +4 -0
- package/lib/dashboard/MetricCardGrid/types.d.ts +28 -0
- package/lib/dashboard/Skeleton/Skeleton.d.ts +25 -0
- package/lib/dashboard/Skeleton/SkeletonCard.d.ts +20 -0
- package/lib/dashboard/Skeleton/SkeletonChart.d.ts +18 -0
- package/lib/dashboard/Skeleton/SkeletonTable.d.ts +18 -0
- package/lib/dashboard/Skeleton/fixtures/skeletonSamples.d.ts +7 -0
- package/lib/dashboard/Skeleton/index.d.ts +6 -0
- package/lib/dashboard/Skeleton/types.d.ts +55 -0
- package/lib/dashboard/TabGroup/TabGroup.d.ts +27 -0
- package/lib/dashboard/TabGroup/fixtures/tabGroups.d.ts +7 -0
- package/lib/dashboard/TabGroup/index.d.ts +3 -0
- package/lib/dashboard/TabGroup/types.d.ts +22 -0
- package/lib/dashboard/TabbedDataView/TabbedDataView.d.ts +29 -0
- package/lib/dashboard/TabbedDataView/fixtures/tabConfigs.d.ts +9 -0
- package/lib/dashboard/TabbedDataView/index.d.ts +3 -0
- package/lib/dashboard/TabbedDataView/types.d.ts +20 -0
- package/lib/dashboard/TimeFrame/ExpandableChip.d.ts +22 -0
- package/lib/dashboard/TimeFrame/HybridDatePicker.d.ts +24 -0
- package/lib/dashboard/TimeFrame/MarketPresetRow.d.ts +16 -0
- package/lib/dashboard/TimeFrame/MiniCalendar.d.ts +16 -0
- package/lib/dashboard/TimeFrame/TimeFrame.d.ts +21 -0
- package/lib/dashboard/TimeFrame/fixtures/timeFrameSamples.d.ts +17 -0
- package/lib/dashboard/TimeFrame/index.d.ts +14 -0
- package/lib/dashboard/TimeFrame/types.d.ts +202 -0
- package/lib/dashboard/TimeFrame/utils/dateHelpers.d.ts +1 -0
- package/lib/dashboard/TimeFrame/utils/presets.d.ts +1 -0
- package/lib/dashboard/TimeFrame/utils/smartDateFormat.d.ts +1 -0
- package/lib/dashboard/UnifiedBreakdownTable/UnifiedBreakdownTable.d.ts +24 -0
- package/lib/dashboard/UnifiedBreakdownTable/fixtures/columns.d.ts +5 -0
- package/lib/dashboard/UnifiedBreakdownTable/fixtures/itemRows.d.ts +15 -0
- package/lib/dashboard/UnifiedBreakdownTable/fixtures/orderRows.d.ts +15 -0
- package/lib/dashboard/UnifiedBreakdownTable/index.d.ts +7 -0
- package/lib/dashboard/UnifiedBreakdownTable/types.d.ts +61 -0
- package/lib/dashboard/UnifiedContextMenu/UnifiedContextMenu.d.ts +5 -0
- package/lib/dashboard/UnifiedContextMenu/fixtures/menuActions.d.ts +9 -0
- package/lib/dashboard/UnifiedContextMenu/index.d.ts +3 -0
- package/lib/dashboard/UnifiedContextMenu/types.d.ts +130 -0
- package/lib/dashboard/index.d.ts +10 -0
- package/lib/hooks/index.d.ts +3 -0
- package/lib/hooks/useArrowNavigation.d.ts +106 -0
- package/lib/hooks/useFocusReturn.d.ts +26 -0
- package/lib/hooks/useFocusTrap.d.ts +50 -0
- package/lib/patterns/feedback/DestructiveModal.d.ts +31 -0
- package/lib/patterns/feedback/index.d.ts +1 -0
- package/lib/patterns/forms/AddressGroup.d.ts +37 -0
- package/lib/patterns/forms/CreditCardForm.d.ts +41 -0
- package/lib/patterns/forms/LoginForm.d.ts +38 -0
- package/lib/patterns/forms/index.d.ts +3 -0
- package/lib/patterns/index.d.ts +14 -0
- package/lib/patterns/types.d.ts +63 -0
- package/lib/types/icon.d.ts +27 -0
- package/lib/utils/animations.d.ts +60 -0
- package/lib/utils/renderIcon.d.ts +21 -0
- package/package.json +59 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface NumberInputProps {
|
|
3
|
+
/**
|
|
4
|
+
* Current value
|
|
5
|
+
*/
|
|
6
|
+
value?: number;
|
|
7
|
+
/**
|
|
8
|
+
* Default value (uncontrolled)
|
|
9
|
+
*/
|
|
10
|
+
defaultValue?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Change handler
|
|
13
|
+
*/
|
|
14
|
+
onChange?: (value: number) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Minimum value
|
|
17
|
+
*/
|
|
18
|
+
min?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Maximum value
|
|
21
|
+
*/
|
|
22
|
+
max?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Step increment
|
|
25
|
+
* @default 1
|
|
26
|
+
*/
|
|
27
|
+
step?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Show stepper buttons
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
showStepper?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Stepper button position
|
|
35
|
+
* @default 'right'
|
|
36
|
+
*/
|
|
37
|
+
stepperPosition?: 'right' | 'sides';
|
|
38
|
+
/**
|
|
39
|
+
* Format display value
|
|
40
|
+
*/
|
|
41
|
+
formatValue?: (value: number) => string;
|
|
42
|
+
/**
|
|
43
|
+
* Parse input back to number
|
|
44
|
+
*/
|
|
45
|
+
parseValue?: (input: string) => number;
|
|
46
|
+
/**
|
|
47
|
+
* Label text
|
|
48
|
+
*/
|
|
49
|
+
label?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Helper text
|
|
52
|
+
*/
|
|
53
|
+
helperText?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Validation status
|
|
56
|
+
*/
|
|
57
|
+
status?: 'default' | 'success' | 'error';
|
|
58
|
+
/**
|
|
59
|
+
* Disabled state
|
|
60
|
+
*/
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Placeholder text
|
|
64
|
+
*/
|
|
65
|
+
placeholder?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Additional CSS class names
|
|
68
|
+
*/
|
|
69
|
+
className?: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* NumberInput component with stepper buttons
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* <NumberInput value={5} onChange={setValue} min={0} max={10} />
|
|
77
|
+
* <NumberInput step={0.5} formatValue={(v) => `$${v.toFixed(2)}`} />
|
|
78
|
+
* <NumberInput stepperPosition="sides" />
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & React.RefAttributes<HTMLInputElement>>;
|
package/lib/Radio.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the radio is checked (controlled)
|
|
5
|
+
*/
|
|
6
|
+
checked?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Callback when checked state changes
|
|
9
|
+
*/
|
|
10
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Label text displayed next to the radio
|
|
13
|
+
*/
|
|
14
|
+
label?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Description text displayed below the label
|
|
17
|
+
*/
|
|
18
|
+
description?: React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Helper text displayed below the radio
|
|
21
|
+
*/
|
|
22
|
+
helperText?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Validation/status state
|
|
25
|
+
* @default 'default'
|
|
26
|
+
*/
|
|
27
|
+
status?: 'default' | 'success' | 'error';
|
|
28
|
+
/**
|
|
29
|
+
* Whether the field is required
|
|
30
|
+
*/
|
|
31
|
+
required?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Size of the radio
|
|
34
|
+
* @default 'md'
|
|
35
|
+
*/
|
|
36
|
+
size?: 'sm' | 'md' | 'lg';
|
|
37
|
+
/**
|
|
38
|
+
* Position of the label relative to the radio
|
|
39
|
+
* @default 'right'
|
|
40
|
+
*/
|
|
41
|
+
labelPosition?: 'left' | 'right';
|
|
42
|
+
/**
|
|
43
|
+
* Additional CSS class names
|
|
44
|
+
*/
|
|
45
|
+
className?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Radio component for single-choice selection
|
|
49
|
+
*
|
|
50
|
+
* Must be used with RadioGroup for proper functionality.
|
|
51
|
+
* Uses convex physics - radio elevates slightly on hover.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```tsx
|
|
55
|
+
* <Radio name="plan" value="basic" label="Basic Plan" />
|
|
56
|
+
* <Radio name="plan" value="pro" label="Pro Plan" description="Best for teams" />
|
|
57
|
+
* <Radio name="plan" value="enterprise" label="Enterprise" disabled />
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { RadioProps } from './Radio';
|
|
3
|
+
/**
|
|
4
|
+
* Option definition for RadioGroup
|
|
5
|
+
*/
|
|
6
|
+
export interface RadioGroupOption<T = string> {
|
|
7
|
+
/**
|
|
8
|
+
* Unique value for the option
|
|
9
|
+
*/
|
|
10
|
+
value: T;
|
|
11
|
+
/**
|
|
12
|
+
* Display label for the radio
|
|
13
|
+
*/
|
|
14
|
+
label: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Description text below the label
|
|
17
|
+
*/
|
|
18
|
+
description?: React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Whether this option is disabled
|
|
21
|
+
*/
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface RadioGroupProps<T = string> {
|
|
25
|
+
/**
|
|
26
|
+
* Selected value (controlled)
|
|
27
|
+
*/
|
|
28
|
+
value?: T;
|
|
29
|
+
/**
|
|
30
|
+
* Default selected value (uncontrolled)
|
|
31
|
+
*/
|
|
32
|
+
defaultValue?: T;
|
|
33
|
+
/**
|
|
34
|
+
* Callback when selection changes
|
|
35
|
+
*/
|
|
36
|
+
onChange?: (value: T) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Array of options to render as radios
|
|
39
|
+
* If not provided, use Radio children
|
|
40
|
+
*/
|
|
41
|
+
options?: RadioGroupOption<T>[];
|
|
42
|
+
/**
|
|
43
|
+
* Radio children (alternative to options)
|
|
44
|
+
*/
|
|
45
|
+
children?: React.ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* Layout orientation
|
|
48
|
+
* @default 'vertical'
|
|
49
|
+
*/
|
|
50
|
+
orientation?: 'horizontal' | 'vertical';
|
|
51
|
+
/**
|
|
52
|
+
* Size applied to all radios
|
|
53
|
+
* @default 'md'
|
|
54
|
+
*/
|
|
55
|
+
size?: 'sm' | 'md' | 'lg';
|
|
56
|
+
/**
|
|
57
|
+
* Group label displayed above the radios
|
|
58
|
+
*/
|
|
59
|
+
label?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Helper text displayed below the group
|
|
62
|
+
*/
|
|
63
|
+
helperText?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Validation status
|
|
66
|
+
* @default 'default'
|
|
67
|
+
*/
|
|
68
|
+
status?: 'default' | 'success' | 'error';
|
|
69
|
+
/**
|
|
70
|
+
* Whether a selection is required
|
|
71
|
+
*/
|
|
72
|
+
required?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Disable all radios in the group
|
|
75
|
+
*/
|
|
76
|
+
disabled?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Name attribute for form submission (required for radio groups)
|
|
79
|
+
*/
|
|
80
|
+
name: string;
|
|
81
|
+
/**
|
|
82
|
+
* Additional CSS class names
|
|
83
|
+
*/
|
|
84
|
+
className?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Context for sharing RadioGroup state with child radios
|
|
88
|
+
*/
|
|
89
|
+
export interface RadioGroupContextValue<T = string> {
|
|
90
|
+
/**
|
|
91
|
+
* Currently selected value
|
|
92
|
+
*/
|
|
93
|
+
value: T | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Select a value
|
|
96
|
+
*/
|
|
97
|
+
select: (value: T) => void;
|
|
98
|
+
/**
|
|
99
|
+
* Check if a value is selected
|
|
100
|
+
*/
|
|
101
|
+
isSelected: (value: T) => boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Group-level props to apply to radios
|
|
104
|
+
*/
|
|
105
|
+
groupProps: {
|
|
106
|
+
size?: 'sm' | 'md' | 'lg';
|
|
107
|
+
status?: 'default' | 'success' | 'error';
|
|
108
|
+
disabled?: boolean;
|
|
109
|
+
name: string;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Whether radio is in a group
|
|
113
|
+
*/
|
|
114
|
+
isInGroup: boolean;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Hook to access RadioGroup context
|
|
118
|
+
*/
|
|
119
|
+
export declare function useRadioGroupContext<T = string>(): RadioGroupContextValue<T> | null;
|
|
120
|
+
/**
|
|
121
|
+
* RadioGroup component for managing single-choice selections
|
|
122
|
+
*
|
|
123
|
+
* Provides context to child radios and manages selected value state.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```tsx
|
|
127
|
+
* // Using options prop
|
|
128
|
+
* <RadioGroup
|
|
129
|
+
* name="plan"
|
|
130
|
+
* label="Select a plan"
|
|
131
|
+
* options={[
|
|
132
|
+
* { value: 'basic', label: 'Basic', description: '$9/month' },
|
|
133
|
+
* { value: 'pro', label: 'Pro', description: '$29/month' },
|
|
134
|
+
* { value: 'enterprise', label: 'Enterprise', description: 'Contact us' },
|
|
135
|
+
* ]}
|
|
136
|
+
* onChange={(value) => console.log(value)}
|
|
137
|
+
* />
|
|
138
|
+
*
|
|
139
|
+
* // Using children
|
|
140
|
+
* <RadioGroup name="size" label="Select size" orientation="horizontal">
|
|
141
|
+
* <Radio value="sm" label="Small" />
|
|
142
|
+
* <Radio value="md" label="Medium" />
|
|
143
|
+
* <Radio value="lg" label="Large" />
|
|
144
|
+
* </RadioGroup>
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
export declare function RadioGroup<T = string>({ value, defaultValue, onChange, options, children, orientation, size, label, helperText, status, required, disabled, name, className, }: RadioGroupProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
148
|
+
export declare namespace RadioGroup {
|
|
149
|
+
var displayName: string;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Wrapper to make a Radio work within RadioGroup context
|
|
153
|
+
*/
|
|
154
|
+
export interface GroupRadioProps extends Omit<RadioProps, 'checked' | 'onChange' | 'name'> {
|
|
155
|
+
/**
|
|
156
|
+
* Value for this radio within the group
|
|
157
|
+
*/
|
|
158
|
+
value: string;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Radio that automatically integrates with RadioGroup context
|
|
162
|
+
*/
|
|
163
|
+
export declare const GroupRadio: React.ForwardRefExoticComponent<GroupRadioProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SliderMark } from './Slider';
|
|
3
|
+
export interface RangeSliderProps {
|
|
4
|
+
/**
|
|
5
|
+
* Current range value [min, max] (controlled)
|
|
6
|
+
*/
|
|
7
|
+
value?: [number, number];
|
|
8
|
+
/**
|
|
9
|
+
* Default range value (uncontrolled)
|
|
10
|
+
*/
|
|
11
|
+
defaultValue?: [number, number];
|
|
12
|
+
/**
|
|
13
|
+
* Callback when range changes during drag
|
|
14
|
+
*/
|
|
15
|
+
onChange?: (value: [number, number]) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Callback when drag ends (final value)
|
|
18
|
+
*/
|
|
19
|
+
onChangeEnd?: (value: [number, number]) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Minimum value
|
|
22
|
+
* @default 0
|
|
23
|
+
*/
|
|
24
|
+
min?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Maximum value
|
|
27
|
+
* @default 100
|
|
28
|
+
*/
|
|
29
|
+
max?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Step increment
|
|
32
|
+
* @default 1
|
|
33
|
+
*/
|
|
34
|
+
step?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Minimum distance between thumbs
|
|
37
|
+
* @default 0
|
|
38
|
+
*/
|
|
39
|
+
minDistance?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Show marks on the track
|
|
42
|
+
*/
|
|
43
|
+
marks?: boolean | SliderMark[];
|
|
44
|
+
/**
|
|
45
|
+
* Show current values above thumbs
|
|
46
|
+
*/
|
|
47
|
+
showValue?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Format the displayed value
|
|
50
|
+
*/
|
|
51
|
+
formatValue?: (value: number) => string;
|
|
52
|
+
/**
|
|
53
|
+
* Orientation of the slider
|
|
54
|
+
* @default 'horizontal'
|
|
55
|
+
*/
|
|
56
|
+
orientation?: 'horizontal' | 'vertical';
|
|
57
|
+
/**
|
|
58
|
+
* Size of the slider
|
|
59
|
+
* @default 'md'
|
|
60
|
+
*/
|
|
61
|
+
size?: 'sm' | 'md' | 'lg';
|
|
62
|
+
/**
|
|
63
|
+
* Label displayed above the slider
|
|
64
|
+
*/
|
|
65
|
+
label?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Helper text displayed below the slider
|
|
68
|
+
*/
|
|
69
|
+
helperText?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Validation/status state
|
|
72
|
+
* @default 'default'
|
|
73
|
+
*/
|
|
74
|
+
status?: 'default' | 'success' | 'error';
|
|
75
|
+
/**
|
|
76
|
+
* Whether the slider is disabled
|
|
77
|
+
*/
|
|
78
|
+
disabled?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Additional CSS class names
|
|
81
|
+
*/
|
|
82
|
+
className?: string;
|
|
83
|
+
/**
|
|
84
|
+
* ID for the slider (auto-generated if not provided)
|
|
85
|
+
*/
|
|
86
|
+
id?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Name attribute for form submission
|
|
89
|
+
*/
|
|
90
|
+
name?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* RangeSlider component for selecting a range of values
|
|
94
|
+
*
|
|
95
|
+
* Features two draggable thumbs for selecting min/max range.
|
|
96
|
+
* Supports keyboard navigation with arrow keys.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```tsx
|
|
100
|
+
* <RangeSlider value={priceRange} onChange={setPriceRange} />
|
|
101
|
+
* <RangeSlider min={0} max={1000} step={50} minDistance={100} />
|
|
102
|
+
* <RangeSlider formatValue={(v) => `$${v}`} showValue />
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export declare const RangeSlider: React.ForwardRefExoticComponent<RangeSliderProps & React.RefAttributes<HTMLInputElement>>;
|
package/lib/Rating.d.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface RatingProps {
|
|
3
|
+
/**
|
|
4
|
+
* Current rating value (controlled)
|
|
5
|
+
*/
|
|
6
|
+
value?: number;
|
|
7
|
+
/**
|
|
8
|
+
* Default rating value
|
|
9
|
+
* @default 0
|
|
10
|
+
*/
|
|
11
|
+
defaultValue?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Callback when rating changes
|
|
14
|
+
*/
|
|
15
|
+
onChange?: (value: number) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Maximum rating value
|
|
18
|
+
* @default 5
|
|
19
|
+
*/
|
|
20
|
+
max?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Icon for filled state
|
|
23
|
+
* @default 'star'
|
|
24
|
+
*/
|
|
25
|
+
icon?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Icon for empty state
|
|
28
|
+
* @default 'star'
|
|
29
|
+
*/
|
|
30
|
+
emptyIcon?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Icon for half-filled state (requires allowHalf)
|
|
33
|
+
* @default 'star'
|
|
34
|
+
*/
|
|
35
|
+
halfIcon?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Allow half-star ratings
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
allowHalf?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Allow clearing the rating by clicking current value
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
allowClear?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Read-only mode (no interaction)
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
readOnly?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Size of the rating stars
|
|
53
|
+
* @default 'md'
|
|
54
|
+
*/
|
|
55
|
+
size?: 'sm' | 'md' | 'lg';
|
|
56
|
+
/**
|
|
57
|
+
* Color of filled stars
|
|
58
|
+
* @default '#f59e0b' (amber)
|
|
59
|
+
*/
|
|
60
|
+
color?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Show rating value as text
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
showValue?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Format the displayed value
|
|
68
|
+
*/
|
|
69
|
+
formatValue?: (value: number) => string;
|
|
70
|
+
/**
|
|
71
|
+
* Label text
|
|
72
|
+
*/
|
|
73
|
+
label?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Helper text
|
|
76
|
+
*/
|
|
77
|
+
helperText?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Validation status
|
|
80
|
+
* @default 'default'
|
|
81
|
+
*/
|
|
82
|
+
status?: 'default' | 'success' | 'error';
|
|
83
|
+
/**
|
|
84
|
+
* Whether the rating is disabled
|
|
85
|
+
*/
|
|
86
|
+
disabled?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Additional CSS class names
|
|
89
|
+
*/
|
|
90
|
+
className?: string;
|
|
91
|
+
/**
|
|
92
|
+
* ID for the input
|
|
93
|
+
*/
|
|
94
|
+
id?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Name for form submission
|
|
97
|
+
*/
|
|
98
|
+
name?: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Rating - Star rating component
|
|
102
|
+
*
|
|
103
|
+
* Features customizable icons, half-star support, and hover preview.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```tsx
|
|
107
|
+
* <Rating
|
|
108
|
+
* value={rating}
|
|
109
|
+
* onChange={setRating}
|
|
110
|
+
* max={5}
|
|
111
|
+
* allowHalf
|
|
112
|
+
* />
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export declare const Rating: React.ForwardRefExoticComponent<RatingProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IconValue } from './types/icon';
|
|
3
|
+
export interface SegmentedControlOption {
|
|
4
|
+
/**
|
|
5
|
+
* Unique value for this option
|
|
6
|
+
*/
|
|
7
|
+
value: string;
|
|
8
|
+
/**
|
|
9
|
+
* Display label for the option
|
|
10
|
+
*/
|
|
11
|
+
label: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Icon to display before the label
|
|
14
|
+
*/
|
|
15
|
+
icon?: IconValue;
|
|
16
|
+
/**
|
|
17
|
+
* Whether this option is disabled
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface SegmentedControlProps {
|
|
22
|
+
/**
|
|
23
|
+
* Array of options to display
|
|
24
|
+
*/
|
|
25
|
+
options: SegmentedControlOption[];
|
|
26
|
+
/**
|
|
27
|
+
* Currently selected value (controlled)
|
|
28
|
+
*/
|
|
29
|
+
value?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Default selected value (uncontrolled)
|
|
32
|
+
*/
|
|
33
|
+
defaultValue?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Callback when selection changes
|
|
36
|
+
*/
|
|
37
|
+
onChange?: (value: string) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Size of the control
|
|
40
|
+
* @default 'md'
|
|
41
|
+
*/
|
|
42
|
+
size?: 'sm' | 'md' | 'lg';
|
|
43
|
+
/**
|
|
44
|
+
* Whether the control spans full width of container
|
|
45
|
+
*/
|
|
46
|
+
fullWidth?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the entire control is disabled
|
|
49
|
+
*/
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Label displayed above the control
|
|
53
|
+
*/
|
|
54
|
+
label?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Helper text displayed below the control
|
|
57
|
+
*/
|
|
58
|
+
helperText?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Validation/status state
|
|
61
|
+
* @default 'default'
|
|
62
|
+
*/
|
|
63
|
+
status?: 'default' | 'success' | 'error';
|
|
64
|
+
/**
|
|
65
|
+
* Additional CSS class names
|
|
66
|
+
*/
|
|
67
|
+
className?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Name attribute for form submission
|
|
70
|
+
*/
|
|
71
|
+
name?: string;
|
|
72
|
+
/**
|
|
73
|
+
* ID for the control (auto-generated if not provided)
|
|
74
|
+
*/
|
|
75
|
+
id?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* SegmentedControl for single selection from a small set of options
|
|
79
|
+
*
|
|
80
|
+
* Features a sliding indicator with spring physics for smooth transitions.
|
|
81
|
+
* Supports keyboard navigation with arrow keys.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* <SegmentedControl
|
|
86
|
+
* options={[
|
|
87
|
+
* { value: 'day', label: 'Day' },
|
|
88
|
+
* { value: 'week', label: 'Week' },
|
|
89
|
+
* { value: 'month', label: 'Month' },
|
|
90
|
+
* ]}
|
|
91
|
+
* value={view}
|
|
92
|
+
* onChange={setView}
|
|
93
|
+
* />
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export declare const SegmentedControl: React.ForwardRefExoticComponent<SegmentedControlProps & React.RefAttributes<HTMLDivElement>>;
|