@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,162 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CheckboxProps } from './Checkbox';
|
|
3
|
+
/**
|
|
4
|
+
* Option definition for CheckboxGroup
|
|
5
|
+
*/
|
|
6
|
+
export interface CheckboxGroupOption<T = string> {
|
|
7
|
+
/**
|
|
8
|
+
* Unique value for the option
|
|
9
|
+
*/
|
|
10
|
+
value: T;
|
|
11
|
+
/**
|
|
12
|
+
* Display label for the checkbox
|
|
13
|
+
*/
|
|
14
|
+
label: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Whether this option is disabled
|
|
17
|
+
*/
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Helper text for this specific option
|
|
21
|
+
*/
|
|
22
|
+
helperText?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface CheckboxGroupProps<T = string> {
|
|
25
|
+
/**
|
|
26
|
+
* Selected values (controlled)
|
|
27
|
+
*/
|
|
28
|
+
value?: T[];
|
|
29
|
+
/**
|
|
30
|
+
* Default selected values (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 checkboxes
|
|
39
|
+
* If not provided, use Checkbox children
|
|
40
|
+
*/
|
|
41
|
+
options?: CheckboxGroupOption<T>[];
|
|
42
|
+
/**
|
|
43
|
+
* Checkbox 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 checkboxes
|
|
53
|
+
* @default 'md'
|
|
54
|
+
*/
|
|
55
|
+
size?: 'sm' | 'md' | 'lg';
|
|
56
|
+
/**
|
|
57
|
+
* Group label displayed above the checkboxes
|
|
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 at least one option is required
|
|
71
|
+
*/
|
|
72
|
+
required?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Disable all checkboxes in the group
|
|
75
|
+
*/
|
|
76
|
+
disabled?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Name attribute for form submission
|
|
79
|
+
*/
|
|
80
|
+
name?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Additional CSS class names
|
|
83
|
+
*/
|
|
84
|
+
className?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Context for sharing CheckboxGroup state with child checkboxes
|
|
88
|
+
*/
|
|
89
|
+
export interface CheckboxGroupContextValue<T = string> {
|
|
90
|
+
/**
|
|
91
|
+
* Currently selected values
|
|
92
|
+
*/
|
|
93
|
+
values: T[];
|
|
94
|
+
/**
|
|
95
|
+
* Toggle a value's selection state
|
|
96
|
+
*/
|
|
97
|
+
toggle: (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 checkboxes
|
|
104
|
+
*/
|
|
105
|
+
groupProps: {
|
|
106
|
+
size?: 'sm' | 'md' | 'lg';
|
|
107
|
+
status?: 'default' | 'success' | 'error';
|
|
108
|
+
disabled?: boolean;
|
|
109
|
+
name?: string;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Whether checkbox is in a group
|
|
113
|
+
*/
|
|
114
|
+
isInGroup: boolean;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Hook to access CheckboxGroup context
|
|
118
|
+
*/
|
|
119
|
+
export declare function useCheckboxGroupContext<T = string>(): CheckboxGroupContextValue<T> | null;
|
|
120
|
+
/**
|
|
121
|
+
* CheckboxGroup component for managing multiple checkbox selections
|
|
122
|
+
*
|
|
123
|
+
* Provides context to child checkboxes and manages selected values state.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```tsx
|
|
127
|
+
* // Using options prop
|
|
128
|
+
* <CheckboxGroup
|
|
129
|
+
* label="Select toppings"
|
|
130
|
+
* options={[
|
|
131
|
+
* { value: 'cheese', label: 'Extra Cheese' },
|
|
132
|
+
* { value: 'pepperoni', label: 'Pepperoni' },
|
|
133
|
+
* { value: 'mushrooms', label: 'Mushrooms' },
|
|
134
|
+
* ]}
|
|
135
|
+
* onChange={(values) => console.log(values)}
|
|
136
|
+
* />
|
|
137
|
+
*
|
|
138
|
+
* // Using children
|
|
139
|
+
* <CheckboxGroup label="Preferences" orientation="horizontal">
|
|
140
|
+
* <Checkbox value="newsletter" label="Subscribe to newsletter" />
|
|
141
|
+
* <Checkbox value="updates" label="Receive product updates" />
|
|
142
|
+
* </CheckboxGroup>
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
export declare function CheckboxGroup<T = string>({ value, defaultValue, onChange, options, children, orientation, size, label, helperText, status, required, disabled, name, className, }: CheckboxGroupProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
146
|
+
export declare namespace CheckboxGroup {
|
|
147
|
+
var displayName: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Wrapper to make a Checkbox work within CheckboxGroup context
|
|
151
|
+
* This is used when rendering Checkbox children in a group
|
|
152
|
+
*/
|
|
153
|
+
export interface GroupCheckboxProps extends Omit<CheckboxProps, 'checked' | 'onChange'> {
|
|
154
|
+
/**
|
|
155
|
+
* Value for this checkbox within the group
|
|
156
|
+
*/
|
|
157
|
+
value: string;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Checkbox that automatically integrates with CheckboxGroup context
|
|
161
|
+
*/
|
|
162
|
+
export declare const GroupCheckbox: React.ForwardRefExoticComponent<GroupCheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
package/lib/Chip.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type ChipVariant = 'default' | 'filled' | 'outlined';
|
|
3
|
+
export type ChipColor = 'default' | 'primary' | 'success' | 'warning' | 'error';
|
|
4
|
+
export type ChipSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
export interface ChipProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'onClick'> {
|
|
6
|
+
/**
|
|
7
|
+
* Visual style variant
|
|
8
|
+
*/
|
|
9
|
+
variant?: ChipVariant;
|
|
10
|
+
/**
|
|
11
|
+
* Color theme
|
|
12
|
+
*/
|
|
13
|
+
color?: ChipColor;
|
|
14
|
+
/**
|
|
15
|
+
* Size of the chip
|
|
16
|
+
*/
|
|
17
|
+
size?: ChipSize;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the chip can be deleted (shows X button)
|
|
20
|
+
*/
|
|
21
|
+
deletable?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Callback when delete button is clicked
|
|
24
|
+
*/
|
|
25
|
+
onDelete?: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the chip is clickable/selectable
|
|
28
|
+
*/
|
|
29
|
+
clickable?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Click handler for clickable chips
|
|
32
|
+
*/
|
|
33
|
+
onClick?: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the chip is in selected state
|
|
36
|
+
*/
|
|
37
|
+
selected?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the chip is disabled
|
|
40
|
+
*/
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Icon to display before the label
|
|
44
|
+
*/
|
|
45
|
+
icon?: React.ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* Content of the chip
|
|
48
|
+
*/
|
|
49
|
+
children?: React.ReactNode;
|
|
50
|
+
/**
|
|
51
|
+
* Additional CSS class names
|
|
52
|
+
*/
|
|
53
|
+
className?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Chip component - interactive tag/pill for filtering, selection, and input
|
|
57
|
+
*
|
|
58
|
+
* DOM Structure: `<span class="gloss-chip">`
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```tsx
|
|
62
|
+
* <Chip>Default</Chip>
|
|
63
|
+
* <Chip color="primary" clickable onClick={() => {}}>Clickable</Chip>
|
|
64
|
+
* <Chip deletable onDelete={() => {}}>Removable</Chip>
|
|
65
|
+
* <Chip icon={<Icon name="tag" />}>With Icon</Chip>
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare const Chip: React.ForwardRefExoticComponent<ChipProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type ColorFormat = 'hex' | 'rgb' | 'hsl';
|
|
3
|
+
export interface ColorPickerProps {
|
|
4
|
+
/**
|
|
5
|
+
* Current color value (controlled)
|
|
6
|
+
* Accepts hex, rgb(), or hsl() format
|
|
7
|
+
*/
|
|
8
|
+
value?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Default color value
|
|
11
|
+
* @default '#3b82f6'
|
|
12
|
+
*/
|
|
13
|
+
defaultValue?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Callback when color changes
|
|
16
|
+
*/
|
|
17
|
+
onChange?: (color: string) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Output format
|
|
20
|
+
* @default 'hex'
|
|
21
|
+
*/
|
|
22
|
+
format?: ColorFormat;
|
|
23
|
+
/**
|
|
24
|
+
* Whether to show alpha channel
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
showAlpha?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Preset color swatches
|
|
30
|
+
*/
|
|
31
|
+
presets?: string[];
|
|
32
|
+
/**
|
|
33
|
+
* Display variant
|
|
34
|
+
* @default 'compact'
|
|
35
|
+
*/
|
|
36
|
+
variant?: 'compact' | 'full' | 'inline';
|
|
37
|
+
/**
|
|
38
|
+
* Label text
|
|
39
|
+
*/
|
|
40
|
+
label?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Helper text
|
|
43
|
+
*/
|
|
44
|
+
helperText?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Validation status
|
|
47
|
+
* @default 'default'
|
|
48
|
+
*/
|
|
49
|
+
status?: 'default' | 'success' | 'error';
|
|
50
|
+
/**
|
|
51
|
+
* Whether the picker is disabled
|
|
52
|
+
*/
|
|
53
|
+
disabled?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Additional CSS class names
|
|
56
|
+
*/
|
|
57
|
+
className?: string;
|
|
58
|
+
/**
|
|
59
|
+
* ID for the input
|
|
60
|
+
*/
|
|
61
|
+
id?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Name for form submission
|
|
64
|
+
*/
|
|
65
|
+
name?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* ColorPicker - Color selection with various modes
|
|
69
|
+
*
|
|
70
|
+
* Features hue/saturation picker, presets, and multiple formats.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```tsx
|
|
74
|
+
* <ColorPicker
|
|
75
|
+
* value={color}
|
|
76
|
+
* onChange={setColor}
|
|
77
|
+
* format="hex"
|
|
78
|
+
* presets={['#ff0000', '#00ff00', '#0000ff']}
|
|
79
|
+
* />
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export declare const ColorPicker: React.ForwardRefExoticComponent<ColorPickerProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface DatePickerProps {
|
|
3
|
+
/**
|
|
4
|
+
* Current selected date (controlled)
|
|
5
|
+
*/
|
|
6
|
+
value?: Date | null;
|
|
7
|
+
/**
|
|
8
|
+
* Default selected date (uncontrolled)
|
|
9
|
+
*/
|
|
10
|
+
defaultValue?: Date | null;
|
|
11
|
+
/**
|
|
12
|
+
* Callback when date changes
|
|
13
|
+
*/
|
|
14
|
+
onChange?: (date: Date | null) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Minimum selectable date
|
|
17
|
+
*/
|
|
18
|
+
minDate?: Date;
|
|
19
|
+
/**
|
|
20
|
+
* Maximum selectable date
|
|
21
|
+
*/
|
|
22
|
+
maxDate?: Date;
|
|
23
|
+
/**
|
|
24
|
+
* Array of dates that cannot be selected
|
|
25
|
+
*/
|
|
26
|
+
disabledDates?: Date[];
|
|
27
|
+
/**
|
|
28
|
+
* Function to determine if a date is disabled
|
|
29
|
+
*/
|
|
30
|
+
isDateDisabled?: (date: Date) => boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Date format for display
|
|
33
|
+
* @default 'MM/DD/YYYY'
|
|
34
|
+
*/
|
|
35
|
+
format?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Placeholder text
|
|
38
|
+
* @default 'Select date'
|
|
39
|
+
*/
|
|
40
|
+
placeholder?: string;
|
|
41
|
+
/**
|
|
42
|
+
* First day of the week (0 = Sunday, 1 = Monday)
|
|
43
|
+
* @default 0
|
|
44
|
+
*/
|
|
45
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
46
|
+
/**
|
|
47
|
+
* Label text
|
|
48
|
+
*/
|
|
49
|
+
label?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Helper text
|
|
52
|
+
*/
|
|
53
|
+
helperText?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Validation status
|
|
56
|
+
* @default 'default'
|
|
57
|
+
*/
|
|
58
|
+
status?: 'default' | 'success' | 'error';
|
|
59
|
+
/**
|
|
60
|
+
* Whether the input is disabled
|
|
61
|
+
*/
|
|
62
|
+
disabled?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Whether to show clear button
|
|
65
|
+
* @default true
|
|
66
|
+
*/
|
|
67
|
+
clearable?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Icon displayed in the input
|
|
70
|
+
* @default 'calendar'
|
|
71
|
+
*/
|
|
72
|
+
leftIcon?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Additional CSS class names
|
|
75
|
+
*/
|
|
76
|
+
className?: string;
|
|
77
|
+
/**
|
|
78
|
+
* ID for the input
|
|
79
|
+
*/
|
|
80
|
+
id?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Name for form submission
|
|
83
|
+
*/
|
|
84
|
+
name?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* DatePicker - Date selection with calendar dropdown
|
|
88
|
+
*
|
|
89
|
+
* Features month/year navigation, keyboard support, disabled dates,
|
|
90
|
+
* and customizable date formatting.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```tsx
|
|
94
|
+
* <DatePicker
|
|
95
|
+
* value={date}
|
|
96
|
+
* onChange={setDate}
|
|
97
|
+
* minDate={new Date()}
|
|
98
|
+
* label="Start date"
|
|
99
|
+
* />
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface DateRange {
|
|
3
|
+
start: Date | null;
|
|
4
|
+
end: Date | null;
|
|
5
|
+
}
|
|
6
|
+
export interface DateRangePreset {
|
|
7
|
+
label: string;
|
|
8
|
+
range: DateRange;
|
|
9
|
+
}
|
|
10
|
+
export interface DateRangePickerProps {
|
|
11
|
+
/**
|
|
12
|
+
* Current date range (controlled)
|
|
13
|
+
*/
|
|
14
|
+
value?: DateRange;
|
|
15
|
+
/**
|
|
16
|
+
* Default date range (uncontrolled)
|
|
17
|
+
*/
|
|
18
|
+
defaultValue?: DateRange;
|
|
19
|
+
/**
|
|
20
|
+
* Callback when range changes
|
|
21
|
+
*/
|
|
22
|
+
onChange?: (range: DateRange) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Minimum selectable date
|
|
25
|
+
*/
|
|
26
|
+
minDate?: Date;
|
|
27
|
+
/**
|
|
28
|
+
* Maximum selectable date
|
|
29
|
+
*/
|
|
30
|
+
maxDate?: Date;
|
|
31
|
+
/**
|
|
32
|
+
* Maximum number of days in range
|
|
33
|
+
*/
|
|
34
|
+
maxDays?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Preset date ranges
|
|
37
|
+
*/
|
|
38
|
+
presets?: DateRangePreset[];
|
|
39
|
+
/**
|
|
40
|
+
* Whether to show presets panel
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
showPresets?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Date format for display
|
|
46
|
+
* @default 'MM/DD/YYYY'
|
|
47
|
+
*/
|
|
48
|
+
format?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Placeholder text
|
|
51
|
+
* @default 'Select dates'
|
|
52
|
+
*/
|
|
53
|
+
placeholder?: string;
|
|
54
|
+
/**
|
|
55
|
+
* First day of the week
|
|
56
|
+
* @default 0
|
|
57
|
+
*/
|
|
58
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
59
|
+
/**
|
|
60
|
+
* Label text
|
|
61
|
+
*/
|
|
62
|
+
label?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Helper text
|
|
65
|
+
*/
|
|
66
|
+
helperText?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Validation status
|
|
69
|
+
* @default 'default'
|
|
70
|
+
*/
|
|
71
|
+
status?: 'default' | 'success' | 'error';
|
|
72
|
+
/**
|
|
73
|
+
* Whether the input is disabled
|
|
74
|
+
*/
|
|
75
|
+
disabled?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Whether to show clear button
|
|
78
|
+
* @default true
|
|
79
|
+
*/
|
|
80
|
+
clearable?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Additional CSS class names
|
|
83
|
+
*/
|
|
84
|
+
className?: string;
|
|
85
|
+
/**
|
|
86
|
+
* ID for the input
|
|
87
|
+
*/
|
|
88
|
+
id?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Name for form submission
|
|
91
|
+
*/
|
|
92
|
+
name?: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* DateRangePicker - Date range selection with dual calendar
|
|
96
|
+
*
|
|
97
|
+
* Features preset ranges, two-month view, and keyboard support.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```tsx
|
|
101
|
+
* <DateRangePicker
|
|
102
|
+
* value={dateRange}
|
|
103
|
+
* onChange={setDateRange}
|
|
104
|
+
* showPresets
|
|
105
|
+
* presets={customPresets}
|
|
106
|
+
* />
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare const DateRangePicker: React.ForwardRefExoticComponent<DateRangePickerProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface DropdownItem {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface DropdownProps {
|
|
8
|
+
/**
|
|
9
|
+
* Trigger element (ReactNode) or text for the dropdown
|
|
10
|
+
*/
|
|
11
|
+
trigger?: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Array of dropdown items
|
|
14
|
+
*/
|
|
15
|
+
items: DropdownItem[];
|
|
16
|
+
/**
|
|
17
|
+
* Currently selected value
|
|
18
|
+
*/
|
|
19
|
+
value?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Callback when selection changes
|
|
22
|
+
*/
|
|
23
|
+
onChange?: (value: string) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Additional CSS class names
|
|
26
|
+
*/
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Dropdown component with concave trigger and convex menu
|
|
31
|
+
*
|
|
32
|
+
* @deprecated Use `Select` component instead for rich content support.
|
|
33
|
+
* The Select component supports arbitrary ReactNode content in options,
|
|
34
|
+
* multi-line displays, icons, and custom render functions.
|
|
35
|
+
*
|
|
36
|
+
* DOM Structure:
|
|
37
|
+
* - `.gloss-dropdown` wrapper
|
|
38
|
+
* - `.gloss-dropdown__trigger` (with `--active` when open)
|
|
39
|
+
* - `.gloss-dropdown__menu` (conditionally rendered)
|
|
40
|
+
* - `.gloss-dropdown__item` (with `--selected` for active item)
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* // Deprecated usage:
|
|
45
|
+
* <Dropdown
|
|
46
|
+
* items={[
|
|
47
|
+
* { label: 'Active', value: 'active' },
|
|
48
|
+
* { label: 'Pending', value: 'pending' }
|
|
49
|
+
* ]}
|
|
50
|
+
* value="active"
|
|
51
|
+
* onChange={(val) => console.log(val)}
|
|
52
|
+
* />
|
|
53
|
+
*
|
|
54
|
+
* // Migrate to Select:
|
|
55
|
+
* <Select
|
|
56
|
+
* options={[
|
|
57
|
+
* { label: 'Active', value: 'active' },
|
|
58
|
+
* { label: 'Pending', value: 'pending' }
|
|
59
|
+
* ]}
|
|
60
|
+
* value="active"
|
|
61
|
+
* onChange={(val) => console.log(val)}
|
|
62
|
+
* />
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare const Dropdown: React.FC<DropdownProps>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface FileUploadFile {
|
|
3
|
+
file: File;
|
|
4
|
+
id: string;
|
|
5
|
+
progress?: number;
|
|
6
|
+
error?: string;
|
|
7
|
+
preview?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface FileUploadProps {
|
|
10
|
+
/**
|
|
11
|
+
* Current files (controlled)
|
|
12
|
+
*/
|
|
13
|
+
value?: FileUploadFile[];
|
|
14
|
+
/**
|
|
15
|
+
* Callback when files change
|
|
16
|
+
*/
|
|
17
|
+
onChange?: (files: FileUploadFile[]) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Accepted file types (e.g., 'image/*', '.pdf')
|
|
20
|
+
*/
|
|
21
|
+
accept?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Maximum file size in bytes
|
|
24
|
+
*/
|
|
25
|
+
maxSize?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Maximum number of files
|
|
28
|
+
*/
|
|
29
|
+
maxFiles?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Allow multiple file selection
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
multiple?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Display variant
|
|
37
|
+
* @default 'dropzone'
|
|
38
|
+
*/
|
|
39
|
+
variant?: 'dropzone' | 'button' | 'compact';
|
|
40
|
+
/**
|
|
41
|
+
* Show file previews (for images)
|
|
42
|
+
* @default true
|
|
43
|
+
*/
|
|
44
|
+
showPreview?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Custom preview renderer
|
|
47
|
+
*/
|
|
48
|
+
renderPreview?: (file: FileUploadFile) => React.ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Text displayed in dropzone
|
|
51
|
+
* @default 'Drag and drop files here, or click to browse'
|
|
52
|
+
*/
|
|
53
|
+
dropzoneText?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Button text for button variant
|
|
56
|
+
* @default 'Upload file'
|
|
57
|
+
*/
|
|
58
|
+
buttonText?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Label text
|
|
61
|
+
*/
|
|
62
|
+
label?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Helper text
|
|
65
|
+
*/
|
|
66
|
+
helperText?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Validation status
|
|
69
|
+
* @default 'default'
|
|
70
|
+
*/
|
|
71
|
+
status?: 'default' | 'success' | 'error';
|
|
72
|
+
/**
|
|
73
|
+
* Whether the upload is disabled
|
|
74
|
+
*/
|
|
75
|
+
disabled?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Callback when validation error occurs
|
|
78
|
+
*/
|
|
79
|
+
onError?: (error: string) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Additional CSS class names
|
|
82
|
+
*/
|
|
83
|
+
className?: string;
|
|
84
|
+
/**
|
|
85
|
+
* ID for the input
|
|
86
|
+
*/
|
|
87
|
+
id?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Name for form submission
|
|
90
|
+
*/
|
|
91
|
+
name?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* FileUpload - File upload with drag and drop support
|
|
95
|
+
*
|
|
96
|
+
* Features dropzone, file previews, progress indicators, and validation.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```tsx
|
|
100
|
+
* <FileUpload
|
|
101
|
+
* accept="image/*"
|
|
102
|
+
* maxSize={5 * 1024 * 1024}
|
|
103
|
+
* maxFiles={3}
|
|
104
|
+
* multiple
|
|
105
|
+
* onChange={handleFiles}
|
|
106
|
+
* />
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare const FileUpload: React.ForwardRefExoticComponent<FileUploadProps & React.RefAttributes<HTMLInputElement>>;
|