@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
package/lib/Select.d.ts
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IconValue } from './types/icon';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for a single select option
|
|
5
|
+
*/
|
|
6
|
+
export interface SelectOption<T = string> {
|
|
7
|
+
/**
|
|
8
|
+
* Unique value for selection tracking
|
|
9
|
+
*/
|
|
10
|
+
value: T;
|
|
11
|
+
/**
|
|
12
|
+
* Content to render in the dropdown menu
|
|
13
|
+
* Can be string for simple cases or ReactNode for rich content
|
|
14
|
+
*/
|
|
15
|
+
label: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Optional: Different content for trigger when selected
|
|
18
|
+
* If not provided, uses `label`
|
|
19
|
+
* Useful for abbreviated displays in trigger vs full content in menu
|
|
20
|
+
*/
|
|
21
|
+
triggerLabel?: React.ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Optional icon (name from sprite or ReactNode)
|
|
24
|
+
*/
|
|
25
|
+
icon?: IconValue;
|
|
26
|
+
/**
|
|
27
|
+
* Optional description/secondary text rendered below the label
|
|
28
|
+
*/
|
|
29
|
+
description?: React.ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Whether this option is disabled
|
|
32
|
+
*/
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Props for custom trigger renderer
|
|
37
|
+
*/
|
|
38
|
+
export interface SelectTriggerRenderProps<T = string> {
|
|
39
|
+
selectedOption: SelectOption<T> | undefined;
|
|
40
|
+
isOpen: boolean;
|
|
41
|
+
placeholder: React.ReactNode;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Props for custom option renderer
|
|
45
|
+
*/
|
|
46
|
+
export interface SelectOptionRenderProps<T = string> {
|
|
47
|
+
option: SelectOption<T>;
|
|
48
|
+
isSelected: boolean;
|
|
49
|
+
isDisabled: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Option group for grouped options
|
|
53
|
+
*/
|
|
54
|
+
export interface SelectOptionGroup<T = string> {
|
|
55
|
+
label: string;
|
|
56
|
+
options: SelectOption<T>[];
|
|
57
|
+
}
|
|
58
|
+
export interface SelectProps<T = string> {
|
|
59
|
+
/**
|
|
60
|
+
* Array of selectable options (can be flat or grouped)
|
|
61
|
+
*/
|
|
62
|
+
options: SelectOption<T>[] | SelectOptionGroup<T>[];
|
|
63
|
+
/**
|
|
64
|
+
* Currently selected value(s)
|
|
65
|
+
*/
|
|
66
|
+
value?: T | T[];
|
|
67
|
+
/**
|
|
68
|
+
* Callback when selection changes
|
|
69
|
+
*/
|
|
70
|
+
onChange?: (value: T | T[], option: SelectOption<T> | SelectOption<T>[]) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Placeholder when no value is selected
|
|
73
|
+
* @default 'Select...'
|
|
74
|
+
*/
|
|
75
|
+
placeholder?: React.ReactNode;
|
|
76
|
+
/**
|
|
77
|
+
* Custom trigger renderer (overrides default)
|
|
78
|
+
*/
|
|
79
|
+
renderTrigger?: (props: SelectTriggerRenderProps<T>) => React.ReactNode;
|
|
80
|
+
/**
|
|
81
|
+
* Custom option renderer (overrides default)
|
|
82
|
+
*/
|
|
83
|
+
renderOption?: (props: SelectOptionRenderProps<T>) => React.ReactNode;
|
|
84
|
+
/**
|
|
85
|
+
* Icon displayed on the left side of the trigger
|
|
86
|
+
*/
|
|
87
|
+
leftIcon?: IconValue;
|
|
88
|
+
/**
|
|
89
|
+
* Icon displayed on the right side of the trigger (replaces chevron if provided)
|
|
90
|
+
*/
|
|
91
|
+
rightIcon?: IconValue;
|
|
92
|
+
/**
|
|
93
|
+
* Icon alignment for multi-line content
|
|
94
|
+
* @default 'center'
|
|
95
|
+
*/
|
|
96
|
+
iconAlign?: 'top' | 'center';
|
|
97
|
+
/**
|
|
98
|
+
* Whether to show selection indicator (check icon) on selected option
|
|
99
|
+
* @default true
|
|
100
|
+
*/
|
|
101
|
+
showSelectionIndicator?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Size variant
|
|
104
|
+
* @default 'md'
|
|
105
|
+
*/
|
|
106
|
+
size?: 'sm' | 'md' | 'lg';
|
|
107
|
+
/**
|
|
108
|
+
* Disabled state
|
|
109
|
+
*/
|
|
110
|
+
disabled?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Show clear button when value is selected
|
|
113
|
+
* @default false
|
|
114
|
+
*/
|
|
115
|
+
clearable?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Callback when cleared
|
|
118
|
+
*/
|
|
119
|
+
onClear?: () => void;
|
|
120
|
+
/**
|
|
121
|
+
* Enable multi-select mode
|
|
122
|
+
* @default false
|
|
123
|
+
*/
|
|
124
|
+
multiple?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* How to display multiple selections in trigger
|
|
127
|
+
* @default 'chips'
|
|
128
|
+
*/
|
|
129
|
+
multiDisplayMode?: 'chips' | 'count' | 'text';
|
|
130
|
+
/**
|
|
131
|
+
* Max chips to show before collapsing
|
|
132
|
+
* @default 3
|
|
133
|
+
*/
|
|
134
|
+
maxChips?: number;
|
|
135
|
+
/**
|
|
136
|
+
* Enable search/filter
|
|
137
|
+
* @default false
|
|
138
|
+
*/
|
|
139
|
+
searchable?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Placeholder for search input
|
|
142
|
+
* @default 'Search...'
|
|
143
|
+
*/
|
|
144
|
+
searchPlaceholder?: string;
|
|
145
|
+
/**
|
|
146
|
+
* Custom filter function
|
|
147
|
+
*/
|
|
148
|
+
filterOption?: (option: SelectOption<T>, searchValue: string) => boolean;
|
|
149
|
+
/**
|
|
150
|
+
* No results message
|
|
151
|
+
* @default 'No options found'
|
|
152
|
+
*/
|
|
153
|
+
noResultsMessage?: React.ReactNode;
|
|
154
|
+
/**
|
|
155
|
+
* Loading state
|
|
156
|
+
* @default false
|
|
157
|
+
*/
|
|
158
|
+
loading?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Loading message
|
|
161
|
+
* @default 'Loading...'
|
|
162
|
+
*/
|
|
163
|
+
loadingMessage?: React.ReactNode;
|
|
164
|
+
/**
|
|
165
|
+
* Enable creating new options from search input
|
|
166
|
+
* @default false
|
|
167
|
+
*/
|
|
168
|
+
creatable?: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Callback when a new option is created
|
|
171
|
+
* Return the new option object, or void to handle externally
|
|
172
|
+
*/
|
|
173
|
+
onCreateOption?: (inputValue: string) => SelectOption<T> | void;
|
|
174
|
+
/**
|
|
175
|
+
* Custom label for the create option row
|
|
176
|
+
* @default (inputValue) => `Create "${inputValue}"`
|
|
177
|
+
*/
|
|
178
|
+
createOptionLabel?: (inputValue: string) => React.ReactNode;
|
|
179
|
+
/**
|
|
180
|
+
* Validate whether a new option can be created
|
|
181
|
+
* @default () => true
|
|
182
|
+
*/
|
|
183
|
+
isValidNewOption?: (inputValue: string, existingOptions: SelectOption<T>[]) => boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Callback when search value changes (for async loading)
|
|
186
|
+
*/
|
|
187
|
+
onSearchChange?: (searchValue: string) => void;
|
|
188
|
+
/**
|
|
189
|
+
* Debounce delay for onSearchChange in ms
|
|
190
|
+
* @default 300
|
|
191
|
+
*/
|
|
192
|
+
searchDebounce?: number;
|
|
193
|
+
/**
|
|
194
|
+
* Callback when dropdown open state changes
|
|
195
|
+
*/
|
|
196
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
197
|
+
/**
|
|
198
|
+
* Additional CSS class names
|
|
199
|
+
*/
|
|
200
|
+
className?: string;
|
|
201
|
+
}
|
|
202
|
+
export declare function Select<T = string>({ options, value, onChange, placeholder, renderTrigger, renderOption, leftIcon, rightIcon, iconAlign, showSelectionIndicator, size, disabled, clearable, onClear, multiple, multiDisplayMode, maxChips, searchable, searchPlaceholder, filterOption, noResultsMessage, loading, loadingMessage, creatable, onCreateOption, createOptionLabel, isValidNewOption, onSearchChange, searchDebounce, onOpenChange, className, }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
203
|
+
export declare namespace Select {
|
|
204
|
+
var displayName: string;
|
|
205
|
+
}
|
package/lib/Slider.d.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface SliderMark {
|
|
3
|
+
/**
|
|
4
|
+
* Value at which to place the mark
|
|
5
|
+
*/
|
|
6
|
+
value: number;
|
|
7
|
+
/**
|
|
8
|
+
* Label to display at the mark
|
|
9
|
+
*/
|
|
10
|
+
label?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export interface SliderProps {
|
|
13
|
+
/**
|
|
14
|
+
* Current value (controlled)
|
|
15
|
+
*/
|
|
16
|
+
value?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Default value (uncontrolled)
|
|
19
|
+
*/
|
|
20
|
+
defaultValue?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Callback when value changes during drag
|
|
23
|
+
*/
|
|
24
|
+
onChange?: (value: number) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Callback when drag ends (final value)
|
|
27
|
+
*/
|
|
28
|
+
onChangeEnd?: (value: number) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Minimum value
|
|
31
|
+
* @default 0
|
|
32
|
+
*/
|
|
33
|
+
min?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Maximum value
|
|
36
|
+
* @default 100
|
|
37
|
+
*/
|
|
38
|
+
max?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Step increment
|
|
41
|
+
* @default 1
|
|
42
|
+
*/
|
|
43
|
+
step?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Show marks on the track
|
|
46
|
+
* - true: show marks at each step
|
|
47
|
+
* - array: show marks at specified values
|
|
48
|
+
*/
|
|
49
|
+
marks?: boolean | SliderMark[];
|
|
50
|
+
/**
|
|
51
|
+
* Show current value above thumb
|
|
52
|
+
*/
|
|
53
|
+
showValue?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Format the displayed value
|
|
56
|
+
*/
|
|
57
|
+
formatValue?: (value: number) => string;
|
|
58
|
+
/**
|
|
59
|
+
* Orientation of the slider
|
|
60
|
+
* @default 'horizontal'
|
|
61
|
+
*/
|
|
62
|
+
orientation?: 'horizontal' | 'vertical';
|
|
63
|
+
/**
|
|
64
|
+
* Size of the slider
|
|
65
|
+
* @default 'md'
|
|
66
|
+
*/
|
|
67
|
+
size?: 'sm' | 'md' | 'lg';
|
|
68
|
+
/**
|
|
69
|
+
* Label displayed above the slider
|
|
70
|
+
*/
|
|
71
|
+
label?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Helper text displayed below the slider
|
|
74
|
+
*/
|
|
75
|
+
helperText?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Validation/status state
|
|
78
|
+
* @default 'default'
|
|
79
|
+
*/
|
|
80
|
+
status?: 'default' | 'success' | 'error';
|
|
81
|
+
/**
|
|
82
|
+
* Whether the slider is disabled
|
|
83
|
+
*/
|
|
84
|
+
disabled?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Additional CSS class names
|
|
87
|
+
*/
|
|
88
|
+
className?: string;
|
|
89
|
+
/**
|
|
90
|
+
* ID for the slider (auto-generated if not provided)
|
|
91
|
+
*/
|
|
92
|
+
id?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Name attribute for form submission
|
|
95
|
+
*/
|
|
96
|
+
name?: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Slider component for selecting a value from a range
|
|
100
|
+
*
|
|
101
|
+
* Features concave track with convex thumb using spring physics.
|
|
102
|
+
* Supports keyboard navigation with arrow keys.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```tsx
|
|
106
|
+
* <Slider value={volume} onChange={setVolume} />
|
|
107
|
+
* <Slider min={0} max={100} step={10} marks showValue />
|
|
108
|
+
* <Slider formatValue={(v) => `${v}%`} />
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export declare const Slider: React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ButtonVariant } from './Button';
|
|
3
|
+
import { IconValue } from './types/icon';
|
|
4
|
+
export interface SplitButtonMenuItem {
|
|
5
|
+
/**
|
|
6
|
+
* Menu item label
|
|
7
|
+
*/
|
|
8
|
+
label: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Click handler
|
|
11
|
+
*/
|
|
12
|
+
onClick: () => void;
|
|
13
|
+
/**
|
|
14
|
+
* Optional icon
|
|
15
|
+
*/
|
|
16
|
+
icon?: IconValue;
|
|
17
|
+
/**
|
|
18
|
+
* Disabled state
|
|
19
|
+
*/
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Render a divider before this item
|
|
23
|
+
*/
|
|
24
|
+
divider?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface SplitButtonProps {
|
|
27
|
+
/**
|
|
28
|
+
* Main button content
|
|
29
|
+
*/
|
|
30
|
+
children: React.ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Main button click handler
|
|
33
|
+
*/
|
|
34
|
+
onClick?: () => void;
|
|
35
|
+
/**
|
|
36
|
+
* Dropdown menu items
|
|
37
|
+
*/
|
|
38
|
+
menuItems: SplitButtonMenuItem[];
|
|
39
|
+
/**
|
|
40
|
+
* Button variant
|
|
41
|
+
* @default 'primary'
|
|
42
|
+
*/
|
|
43
|
+
variant?: ButtonVariant;
|
|
44
|
+
/**
|
|
45
|
+
* Button size
|
|
46
|
+
* @default 'md'
|
|
47
|
+
*/
|
|
48
|
+
size?: 'sm' | 'md' | 'lg';
|
|
49
|
+
/**
|
|
50
|
+
* Disabled state for both buttons
|
|
51
|
+
*/
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Icon for dropdown trigger button
|
|
55
|
+
* @default 'chevron-down'
|
|
56
|
+
*/
|
|
57
|
+
dropdownIcon?: IconValue;
|
|
58
|
+
/**
|
|
59
|
+
* Left icon for main button
|
|
60
|
+
*/
|
|
61
|
+
leftIcon?: IconValue;
|
|
62
|
+
/**
|
|
63
|
+
* Additional CSS class names
|
|
64
|
+
*/
|
|
65
|
+
className?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* SplitButton component - main action button with dropdown menu
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```tsx
|
|
72
|
+
* <SplitButton
|
|
73
|
+
* onClick={() => console.log('Save')}
|
|
74
|
+
* menuItems={[
|
|
75
|
+
* { label: 'Save as draft', onClick: () => {} },
|
|
76
|
+
* { label: 'Save and publish', onClick: () => {} },
|
|
77
|
+
* { divider: true, label: 'Delete', onClick: () => {}, icon: 'trash' },
|
|
78
|
+
* ]}
|
|
79
|
+
* >
|
|
80
|
+
* Save
|
|
81
|
+
* </SplitButton>
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare const SplitButton: React.ForwardRefExoticComponent<SplitButtonProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface TextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'prefix'> {
|
|
3
|
+
/**
|
|
4
|
+
* Label text for the textarea
|
|
5
|
+
*/
|
|
6
|
+
label?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Validation/interaction status
|
|
9
|
+
* @default 'default'
|
|
10
|
+
*/
|
|
11
|
+
status?: 'default' | 'success' | 'error' | 'pending';
|
|
12
|
+
/**
|
|
13
|
+
* Helper text displayed below the textarea
|
|
14
|
+
*/
|
|
15
|
+
helperText?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Whether the field is required
|
|
18
|
+
*/
|
|
19
|
+
required?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Enable auto-resize based on content
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
autoResize?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Minimum rows when auto-resizing
|
|
27
|
+
* @default 3
|
|
28
|
+
*/
|
|
29
|
+
minRows?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Maximum rows when auto-resizing
|
|
32
|
+
* @default 10
|
|
33
|
+
*/
|
|
34
|
+
maxRows?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Show character counter (requires maxLength to be set)
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
showCounter?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Custom counter renderer
|
|
42
|
+
*/
|
|
43
|
+
renderCounter?: (current: number, max: number) => React.ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* Additional CSS class names
|
|
46
|
+
*/
|
|
47
|
+
className?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Textarea component with auto-resize support
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* <Textarea label="Description" placeholder="Enter description..." />
|
|
55
|
+
* <Textarea autoResize minRows={2} maxRows={6} />
|
|
56
|
+
* <Textarea maxLength={500} showCounter />
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface TimePickerProps {
|
|
3
|
+
/**
|
|
4
|
+
* Current time value (HH:mm or HH:mm:ss format)
|
|
5
|
+
*/
|
|
6
|
+
value?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Default time value
|
|
9
|
+
*/
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Callback when time changes
|
|
13
|
+
*/
|
|
14
|
+
onChange?: (time: string) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Time format
|
|
17
|
+
* @default '12h'
|
|
18
|
+
*/
|
|
19
|
+
format?: '12h' | '24h';
|
|
20
|
+
/**
|
|
21
|
+
* Whether to show seconds
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
showSeconds?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Step in minutes for the dropdown options
|
|
27
|
+
* @default 30
|
|
28
|
+
*/
|
|
29
|
+
step?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Minimum selectable time (HH:mm format)
|
|
32
|
+
*/
|
|
33
|
+
minTime?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Maximum selectable time (HH:mm format)
|
|
36
|
+
*/
|
|
37
|
+
maxTime?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Placeholder text
|
|
40
|
+
* @default 'Select time'
|
|
41
|
+
*/
|
|
42
|
+
placeholder?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Label text
|
|
45
|
+
*/
|
|
46
|
+
label?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Helper text
|
|
49
|
+
*/
|
|
50
|
+
helperText?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Validation status
|
|
53
|
+
* @default 'default'
|
|
54
|
+
*/
|
|
55
|
+
status?: 'default' | 'success' | 'error';
|
|
56
|
+
/**
|
|
57
|
+
* Whether the input is disabled
|
|
58
|
+
*/
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Whether to show clear button
|
|
62
|
+
* @default true
|
|
63
|
+
*/
|
|
64
|
+
clearable?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Additional CSS class names
|
|
67
|
+
*/
|
|
68
|
+
className?: string;
|
|
69
|
+
/**
|
|
70
|
+
* ID for the input
|
|
71
|
+
*/
|
|
72
|
+
id?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Name for form submission
|
|
75
|
+
*/
|
|
76
|
+
name?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* TimePicker - Time selection with dropdown
|
|
80
|
+
*
|
|
81
|
+
* Features 12/24 hour format, step intervals, and keyboard support.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* <TimePicker
|
|
86
|
+
* value={time}
|
|
87
|
+
* onChange={setTime}
|
|
88
|
+
* format="12h"
|
|
89
|
+
* step={15}
|
|
90
|
+
* />
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare const TimePicker: React.ForwardRefExoticComponent<TimePickerProps & React.RefAttributes<HTMLInputElement>>;
|
package/lib/Toggle.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ToggleProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the toggle is on (controlled)
|
|
5
|
+
*/
|
|
6
|
+
checked?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Default on state (uncontrolled)
|
|
9
|
+
*/
|
|
10
|
+
defaultChecked?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Callback when toggle state changes
|
|
13
|
+
*/
|
|
14
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Callback with just the boolean value (convenience)
|
|
17
|
+
*/
|
|
18
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Label text displayed next to the toggle
|
|
21
|
+
*/
|
|
22
|
+
label?: React.ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Text displayed inside the track when on
|
|
25
|
+
*/
|
|
26
|
+
onLabel?: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Text displayed inside the track when off
|
|
29
|
+
*/
|
|
30
|
+
offLabel?: React.ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Helper text displayed below the toggle
|
|
33
|
+
*/
|
|
34
|
+
helperText?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Validation/status state
|
|
37
|
+
* @default 'default'
|
|
38
|
+
*/
|
|
39
|
+
status?: 'default' | 'success' | 'error';
|
|
40
|
+
/**
|
|
41
|
+
* Size of the toggle
|
|
42
|
+
* @default 'md'
|
|
43
|
+
*/
|
|
44
|
+
size?: 'sm' | 'md' | 'lg';
|
|
45
|
+
/**
|
|
46
|
+
* Position of the label relative to the toggle
|
|
47
|
+
* @default 'right'
|
|
48
|
+
*/
|
|
49
|
+
labelPosition?: 'left' | 'right';
|
|
50
|
+
/**
|
|
51
|
+
* Additional CSS class names
|
|
52
|
+
*/
|
|
53
|
+
className?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Toggle/Switch component for boolean on/off states
|
|
57
|
+
*
|
|
58
|
+
* Uses spring physics for the thumb movement and smooth color transitions.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```tsx
|
|
62
|
+
* <Toggle label="Enable notifications" />
|
|
63
|
+
* <Toggle label="Dark mode" defaultChecked />
|
|
64
|
+
* <Toggle label="Auto-save" onLabel="ON" offLabel="OFF" />
|
|
65
|
+
* <Toggle label="Feature flag" size="sm" disabled />
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare const Toggle: React.ForwardRefExoticComponent<ToggleProps & React.RefAttributes<HTMLInputElement>>;
|
package/lib/Tooltip.d.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type TooltipPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
|
|
3
|
+
export type TooltipVariant = 'dark' | 'light' | 'primary' | 'success' | 'warning' | 'error';
|
|
4
|
+
export type TooltipTrigger = 'hover' | 'click' | 'focus' | 'manual';
|
|
5
|
+
export interface TooltipProps {
|
|
6
|
+
/**
|
|
7
|
+
* Tooltip content
|
|
8
|
+
*/
|
|
9
|
+
content: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Element that triggers the tooltip
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactElement;
|
|
14
|
+
/**
|
|
15
|
+
* Tooltip placement
|
|
16
|
+
* @default 'top'
|
|
17
|
+
*/
|
|
18
|
+
placement?: TooltipPlacement;
|
|
19
|
+
/**
|
|
20
|
+
* Color variant
|
|
21
|
+
* @default 'dark'
|
|
22
|
+
*/
|
|
23
|
+
variant?: TooltipVariant;
|
|
24
|
+
/**
|
|
25
|
+
* What triggers the tooltip
|
|
26
|
+
* @default 'hover'
|
|
27
|
+
*/
|
|
28
|
+
trigger?: TooltipTrigger;
|
|
29
|
+
/**
|
|
30
|
+
* Delay before showing tooltip (ms)
|
|
31
|
+
* @default 200
|
|
32
|
+
*/
|
|
33
|
+
delay?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Delay before hiding tooltip (ms)
|
|
36
|
+
* @default 0
|
|
37
|
+
*/
|
|
38
|
+
hideDelay?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Disable the tooltip
|
|
41
|
+
*/
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Render tooltip in a portal (useful for overflow containers)
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
portal?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Additional CSS class for tooltip content
|
|
50
|
+
*/
|
|
51
|
+
className?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Max width of tooltip
|
|
54
|
+
* @default 250
|
|
55
|
+
*/
|
|
56
|
+
maxWidth?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Controlled open state (for trigger='manual')
|
|
59
|
+
*/
|
|
60
|
+
open?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Callback when open state changes
|
|
63
|
+
*/
|
|
64
|
+
onOpenChange?: (open: boolean) => void;
|
|
65
|
+
/**
|
|
66
|
+
* Show arrow pointer
|
|
67
|
+
* @default true
|
|
68
|
+
*/
|
|
69
|
+
arrow?: boolean;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Tooltip component for displaying contextual information
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* <Tooltip content="Save your changes">
|
|
77
|
+
* <Button iconOnly leftIcon="save" aria-label="Save" />
|
|
78
|
+
* </Tooltip>
|
|
79
|
+
*
|
|
80
|
+
* <Tooltip content="This action cannot be undone" placement="bottom" variant="error">
|
|
81
|
+
* <Button variant="danger">Delete</Button>
|
|
82
|
+
* </Tooltip>
|
|
83
|
+
*
|
|
84
|
+
* <Tooltip content="Click to copy" trigger="click">
|
|
85
|
+
* <Button>Copy to clipboard</Button>
|
|
86
|
+
* </Tooltip>
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare const Tooltip: React.FC<TooltipProps>;
|