@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.
Files changed (135) hide show
  1. package/README.md +33 -0
  2. package/index.css +1 -0
  3. package/index.d.ts +80 -0
  4. package/index.js +17560 -0
  5. package/lib/Accordion.d.ts +103 -0
  6. package/lib/AsyncLoader.d.ts +41 -0
  7. package/lib/Badge.d.ts +42 -0
  8. package/lib/Button.d.ts +73 -0
  9. package/lib/ButtonGroup.d.ts +72 -0
  10. package/lib/Card.d.ts +140 -0
  11. package/lib/Checkbox.d.ts +70 -0
  12. package/lib/CheckboxGroup.d.ts +162 -0
  13. package/lib/Chip.d.ts +68 -0
  14. package/lib/ColorPicker.d.ts +82 -0
  15. package/lib/DatePicker.d.ts +102 -0
  16. package/lib/DateRangePicker.d.ts +109 -0
  17. package/lib/Dropdown.d.ts +65 -0
  18. package/lib/FileUpload.d.ts +109 -0
  19. package/lib/Form.d.ts +119 -0
  20. package/lib/FormField.d.ts +69 -0
  21. package/lib/Input.d.ts +89 -0
  22. package/lib/InputGroup.d.ts +59 -0
  23. package/lib/Link.d.ts +69 -0
  24. package/lib/MaskedInput.d.ts +95 -0
  25. package/lib/Menu.d.ts +132 -0
  26. package/lib/NumberInput.d.ts +81 -0
  27. package/lib/Radio.d.ts +60 -0
  28. package/lib/RadioGroup.d.ts +163 -0
  29. package/lib/RangeSlider.d.ts +105 -0
  30. package/lib/Rating.d.ts +115 -0
  31. package/lib/SegmentedControl.d.ts +96 -0
  32. package/lib/Select.d.ts +205 -0
  33. package/lib/Slider.d.ts +111 -0
  34. package/lib/SplitButton.d.ts +84 -0
  35. package/lib/Textarea.d.ts +59 -0
  36. package/lib/TimePicker.d.ts +93 -0
  37. package/lib/Toggle.d.ts +68 -0
  38. package/lib/Tooltip.d.ts +89 -0
  39. package/lib/Transition.d.ts +107 -0
  40. package/lib/composed/AddressSelect.d.ts +132 -0
  41. package/lib/composed/PasswordInput.d.ts +75 -0
  42. package/lib/composed/PaymentMethodSelect.d.ts +96 -0
  43. package/lib/composed/PhoneInput.d.ts +71 -0
  44. package/lib/composed/SearchInput.d.ts +80 -0
  45. package/lib/composed/TagInput.d.ts +98 -0
  46. package/lib/composed/index.d.ts +12 -0
  47. package/lib/dashboard/ChartControlBar/ChartControlBar.d.ts +45 -0
  48. package/lib/dashboard/ChartControlBar/FilterInput.d.ts +34 -0
  49. package/lib/dashboard/ChartControlBar/FusedShape.d.ts +32 -0
  50. package/lib/dashboard/ChartControlBar/Row1Controls.d.ts +62 -0
  51. package/lib/dashboard/ChartControlBar/Row2FilterTray.d.ts +62 -0
  52. package/lib/dashboard/ChartControlBar/fixtures/controlBarStates.d.ts +4 -0
  53. package/lib/dashboard/ChartControlBar/index.d.ts +8 -0
  54. package/lib/dashboard/ChartControlBar/types.d.ts +37 -0
  55. package/lib/dashboard/ChartControlBar/useFilterLayout.d.ts +51 -0
  56. package/lib/dashboard/FilterChip/FilterChip.d.ts +26 -0
  57. package/lib/dashboard/FilterChip/fixtures/filterChips.d.ts +11 -0
  58. package/lib/dashboard/FilterChip/index.d.ts +3 -0
  59. package/lib/dashboard/FilterChip/types.d.ts +17 -0
  60. package/lib/dashboard/MetricCard/CardShell.d.ts +22 -0
  61. package/lib/dashboard/MetricCard/GutterActions.d.ts +56 -0
  62. package/lib/dashboard/MetricCard/MetricCard.d.ts +33 -0
  63. package/lib/dashboard/MetricCard/StackedGroupCard.d.ts +43 -0
  64. package/lib/dashboard/MetricCard/TrendIndicator.d.ts +20 -0
  65. package/lib/dashboard/MetricCard/fixtures/allVariants.d.ts +6 -0
  66. package/lib/dashboard/MetricCard/fixtures/sparklineCard.d.ts +5 -0
  67. package/lib/dashboard/MetricCard/fixtures/standardCard.d.ts +7 -0
  68. package/lib/dashboard/MetricCard/fixtures/states.d.ts +19 -0
  69. package/lib/dashboard/MetricCard/index.d.ts +20 -0
  70. package/lib/dashboard/MetricCard/types.d.ts +109 -0
  71. package/lib/dashboard/MetricCard/useSlideOutReveal.d.ts +42 -0
  72. package/lib/dashboard/MetricCard/utils/formatTrend.d.ts +2 -0
  73. package/lib/dashboard/MetricCard/utils/formatValue.d.ts +2 -0
  74. package/lib/dashboard/MetricCard/visualizations/BarsBg.d.ts +25 -0
  75. package/lib/dashboard/MetricCard/visualizations/DonutChart.d.ts +26 -0
  76. package/lib/dashboard/MetricCard/visualizations/ObjectArrow.d.ts +28 -0
  77. package/lib/dashboard/MetricCard/visualizations/SparklineBg.d.ts +24 -0
  78. package/lib/dashboard/MetricCardGrid/MetricCardGrid.d.ts +28 -0
  79. package/lib/dashboard/MetricCardGrid/fixtures/gridCards.d.ts +3 -0
  80. package/lib/dashboard/MetricCardGrid/fixtures/layouts.d.ts +7 -0
  81. package/lib/dashboard/MetricCardGrid/index.d.ts +4 -0
  82. package/lib/dashboard/MetricCardGrid/types.d.ts +28 -0
  83. package/lib/dashboard/Skeleton/Skeleton.d.ts +25 -0
  84. package/lib/dashboard/Skeleton/SkeletonCard.d.ts +20 -0
  85. package/lib/dashboard/Skeleton/SkeletonChart.d.ts +18 -0
  86. package/lib/dashboard/Skeleton/SkeletonTable.d.ts +18 -0
  87. package/lib/dashboard/Skeleton/fixtures/skeletonSamples.d.ts +7 -0
  88. package/lib/dashboard/Skeleton/index.d.ts +6 -0
  89. package/lib/dashboard/Skeleton/types.d.ts +55 -0
  90. package/lib/dashboard/TabGroup/TabGroup.d.ts +27 -0
  91. package/lib/dashboard/TabGroup/fixtures/tabGroups.d.ts +7 -0
  92. package/lib/dashboard/TabGroup/index.d.ts +3 -0
  93. package/lib/dashboard/TabGroup/types.d.ts +22 -0
  94. package/lib/dashboard/TabbedDataView/TabbedDataView.d.ts +29 -0
  95. package/lib/dashboard/TabbedDataView/fixtures/tabConfigs.d.ts +9 -0
  96. package/lib/dashboard/TabbedDataView/index.d.ts +3 -0
  97. package/lib/dashboard/TabbedDataView/types.d.ts +20 -0
  98. package/lib/dashboard/TimeFrame/ExpandableChip.d.ts +22 -0
  99. package/lib/dashboard/TimeFrame/HybridDatePicker.d.ts +24 -0
  100. package/lib/dashboard/TimeFrame/MarketPresetRow.d.ts +16 -0
  101. package/lib/dashboard/TimeFrame/MiniCalendar.d.ts +16 -0
  102. package/lib/dashboard/TimeFrame/TimeFrame.d.ts +21 -0
  103. package/lib/dashboard/TimeFrame/fixtures/timeFrameSamples.d.ts +17 -0
  104. package/lib/dashboard/TimeFrame/index.d.ts +14 -0
  105. package/lib/dashboard/TimeFrame/types.d.ts +202 -0
  106. package/lib/dashboard/TimeFrame/utils/dateHelpers.d.ts +1 -0
  107. package/lib/dashboard/TimeFrame/utils/presets.d.ts +1 -0
  108. package/lib/dashboard/TimeFrame/utils/smartDateFormat.d.ts +1 -0
  109. package/lib/dashboard/UnifiedBreakdownTable/UnifiedBreakdownTable.d.ts +24 -0
  110. package/lib/dashboard/UnifiedBreakdownTable/fixtures/columns.d.ts +5 -0
  111. package/lib/dashboard/UnifiedBreakdownTable/fixtures/itemRows.d.ts +15 -0
  112. package/lib/dashboard/UnifiedBreakdownTable/fixtures/orderRows.d.ts +15 -0
  113. package/lib/dashboard/UnifiedBreakdownTable/index.d.ts +7 -0
  114. package/lib/dashboard/UnifiedBreakdownTable/types.d.ts +61 -0
  115. package/lib/dashboard/UnifiedContextMenu/UnifiedContextMenu.d.ts +5 -0
  116. package/lib/dashboard/UnifiedContextMenu/fixtures/menuActions.d.ts +9 -0
  117. package/lib/dashboard/UnifiedContextMenu/index.d.ts +3 -0
  118. package/lib/dashboard/UnifiedContextMenu/types.d.ts +130 -0
  119. package/lib/dashboard/index.d.ts +10 -0
  120. package/lib/hooks/index.d.ts +3 -0
  121. package/lib/hooks/useArrowNavigation.d.ts +106 -0
  122. package/lib/hooks/useFocusReturn.d.ts +26 -0
  123. package/lib/hooks/useFocusTrap.d.ts +50 -0
  124. package/lib/patterns/feedback/DestructiveModal.d.ts +31 -0
  125. package/lib/patterns/feedback/index.d.ts +1 -0
  126. package/lib/patterns/forms/AddressGroup.d.ts +37 -0
  127. package/lib/patterns/forms/CreditCardForm.d.ts +41 -0
  128. package/lib/patterns/forms/LoginForm.d.ts +38 -0
  129. package/lib/patterns/forms/index.d.ts +3 -0
  130. package/lib/patterns/index.d.ts +14 -0
  131. package/lib/patterns/types.d.ts +63 -0
  132. package/lib/types/icon.d.ts +27 -0
  133. package/lib/utils/animations.d.ts +60 -0
  134. package/lib/utils/renderIcon.d.ts +21 -0
  135. package/package.json +59 -0
package/lib/Form.d.ts ADDED
@@ -0,0 +1,119 @@
1
+ import { default as React } from 'react';
2
+ export interface FormErrors {
3
+ [key: string]: string | undefined;
4
+ }
5
+ export interface FormTouched {
6
+ [key: string]: boolean;
7
+ }
8
+ export interface FormContextValue {
9
+ /**
10
+ * Form values
11
+ */
12
+ values: Record<string, unknown>;
13
+ /**
14
+ * Form errors
15
+ */
16
+ errors: FormErrors;
17
+ /**
18
+ * Touched fields
19
+ */
20
+ touched: FormTouched;
21
+ /**
22
+ * Whether form is submitting
23
+ */
24
+ isSubmitting: boolean;
25
+ /**
26
+ * Whether form is valid
27
+ */
28
+ isValid: boolean;
29
+ /**
30
+ * Set a field value
31
+ */
32
+ setFieldValue: (name: string, value: unknown) => void;
33
+ /**
34
+ * Set a field error
35
+ */
36
+ setFieldError: (name: string, error: string | undefined) => void;
37
+ /**
38
+ * Mark a field as touched
39
+ */
40
+ setFieldTouched: (name: string, touched?: boolean) => void;
41
+ /**
42
+ * Get field props for binding to input
43
+ */
44
+ getFieldProps: (name: string) => {
45
+ value: unknown;
46
+ onChange: (value: unknown) => void;
47
+ onBlur: () => void;
48
+ name: string;
49
+ error: string | undefined;
50
+ touched: boolean;
51
+ };
52
+ }
53
+ export declare function useFormContext(): FormContextValue;
54
+ export interface FormProps<T extends Record<string, unknown>> {
55
+ /**
56
+ * Initial form values
57
+ */
58
+ initialValues: T;
59
+ /**
60
+ * Validation function
61
+ */
62
+ validate?: (values: T) => FormErrors | Promise<FormErrors>;
63
+ /**
64
+ * Submit handler
65
+ */
66
+ onSubmit: (values: T) => void | Promise<void>;
67
+ /**
68
+ * Validate on change
69
+ * @default true
70
+ */
71
+ validateOnChange?: boolean;
72
+ /**
73
+ * Validate on blur
74
+ * @default true
75
+ */
76
+ validateOnBlur?: boolean;
77
+ /**
78
+ * Form children (can be render prop)
79
+ */
80
+ children: React.ReactNode | ((context: FormContextValue) => React.ReactNode);
81
+ /**
82
+ * Additional class name
83
+ */
84
+ className?: string;
85
+ /**
86
+ * Prevent default form submission
87
+ * @default true
88
+ */
89
+ preventDefault?: boolean;
90
+ }
91
+ /**
92
+ * Form component with validation and state management
93
+ *
94
+ * @example
95
+ * ```tsx
96
+ * <Form
97
+ * initialValues={{ email: '', password: '' }}
98
+ * validate={(values) => {
99
+ * const errors: FormErrors = {};
100
+ * if (!values.email) errors.email = 'Required';
101
+ * if (!values.password) errors.password = 'Required';
102
+ * return errors;
103
+ * }}
104
+ * onSubmit={(values) => console.log(values)}
105
+ * >
106
+ * <FormField name="email" label="Email">
107
+ * <Input />
108
+ * </FormField>
109
+ * <FormField name="password" label="Password">
110
+ * <Input type="password" />
111
+ * </FormField>
112
+ * <Button type="submit">Submit</Button>
113
+ * </Form>
114
+ * ```
115
+ */
116
+ export declare function Form<T extends Record<string, unknown>>({ initialValues, validate, onSubmit, validateOnChange, validateOnBlur, children, className, preventDefault, }: FormProps<T>): import("react/jsx-runtime").JSX.Element;
117
+ export declare namespace Form {
118
+ var displayName: string;
119
+ }
@@ -0,0 +1,69 @@
1
+ import { default as React } from 'react';
2
+ interface FormControlProps {
3
+ id?: string;
4
+ name?: string;
5
+ value?: unknown;
6
+ onChange?: (value: unknown) => void;
7
+ onBlur?: (event: React.FocusEvent) => void;
8
+ status?: string;
9
+ 'aria-describedby'?: string;
10
+ 'aria-invalid'?: boolean;
11
+ 'aria-required'?: boolean;
12
+ }
13
+ export interface FormFieldProps {
14
+ /**
15
+ * Field name (must match a key in form values)
16
+ */
17
+ name: string;
18
+ /**
19
+ * Field label
20
+ */
21
+ label?: React.ReactNode;
22
+ /**
23
+ * Helper text shown below the field
24
+ */
25
+ helperText?: React.ReactNode;
26
+ /**
27
+ * Whether the field is required
28
+ * @default false
29
+ */
30
+ required?: boolean;
31
+ /**
32
+ * Child form control (Input, Select, Textarea, etc.)
33
+ */
34
+ children: React.ReactElement<FormControlProps>;
35
+ /**
36
+ * Additional class name
37
+ */
38
+ className?: string;
39
+ /**
40
+ * Label position
41
+ * @default 'top'
42
+ */
43
+ labelPosition?: 'top' | 'left' | 'right';
44
+ /**
45
+ * Hide the label visually (still accessible)
46
+ * @default false
47
+ */
48
+ hideLabel?: boolean;
49
+ }
50
+ /**
51
+ * FormField component for wrapping form controls
52
+ *
53
+ * Automatically connects to Form context for:
54
+ * - Value binding
55
+ * - Error display
56
+ * - Touched state
57
+ * - Accessibility (labels, descriptions)
58
+ *
59
+ * @example
60
+ * ```tsx
61
+ * <Form initialValues={{ email: '' }} onSubmit={handleSubmit}>
62
+ * <FormField name="email" label="Email" required helperText="We'll never share your email">
63
+ * <Input type="email" placeholder="Enter your email" />
64
+ * </FormField>
65
+ * </Form>
66
+ * ```
67
+ */
68
+ export declare const FormField: React.FC<FormFieldProps>;
69
+ export {};
package/lib/Input.d.ts ADDED
@@ -0,0 +1,89 @@
1
+ import { default as React } from 'react';
2
+ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'prefix' | 'onCopy'> {
3
+ /**
4
+ * Label text for the input
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 input
14
+ */
15
+ helperText?: string;
16
+ /**
17
+ * Whether the field is required
18
+ */
19
+ required?: boolean;
20
+ /**
21
+ * Icon or element displayed on the left side of the input
22
+ */
23
+ leftIcon?: React.ReactNode;
24
+ /**
25
+ * Icon or element displayed on the right side of the input
26
+ */
27
+ rightIcon?: React.ReactNode;
28
+ /**
29
+ * Vertical alignment of icons relative to input
30
+ * @default 'center'
31
+ */
32
+ iconAlign?: 'top' | 'center';
33
+ /**
34
+ * Shows clear button when input has value
35
+ * @default false
36
+ */
37
+ clearable?: boolean;
38
+ /**
39
+ * Callback when clear button is clicked
40
+ */
41
+ onClear?: () => void;
42
+ /**
43
+ * Shows copy button to copy input value
44
+ * @default false
45
+ */
46
+ copyable?: boolean;
47
+ /**
48
+ * Callback after successful copy
49
+ */
50
+ onCopy?: (value: string) => void;
51
+ /**
52
+ * Show character counter (requires maxLength to be set)
53
+ * @default false
54
+ */
55
+ showCounter?: boolean;
56
+ /**
57
+ * Custom counter renderer
58
+ */
59
+ renderCounter?: (current: number, max: number) => React.ReactNode;
60
+ /**
61
+ * @deprecated Use leftIcon instead
62
+ * Prefix text or element displayed before the input (e.g., "$" for currency)
63
+ */
64
+ prefix?: React.ReactNode;
65
+ /**
66
+ * @deprecated Use rightIcon instead
67
+ * Suffix text or element displayed after the input
68
+ */
69
+ suffix?: React.ReactNode;
70
+ /**
71
+ * Additional CSS class names
72
+ */
73
+ className?: string;
74
+ }
75
+ /**
76
+ * Input component with label, status indicators, and helper text
77
+ *
78
+ * DOM Structure:
79
+ * - If label/helper present: wraps in `.gloss-input-anatomy`
80
+ * - Input: `<input class="gloss-input gloss-input--{status}">`
81
+ *
82
+ * @example
83
+ * ```tsx
84
+ * <Input label="Email" placeholder="name@example.com" />
85
+ * <Input label="Username" status="success" helperText="Available!" />
86
+ * <Input label="Password" status="error" helperText="Too short" required />
87
+ * ```
88
+ */
89
+ export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,59 @@
1
+ import { default as React } from 'react';
2
+ export interface InputGroupProps {
3
+ /**
4
+ * Child elements (Inputs, InputAddons, Buttons)
5
+ */
6
+ children: React.ReactNode;
7
+ /**
8
+ * Visual style for connected inputs (removes gaps, merges borders)
9
+ * @default false
10
+ */
11
+ attached?: boolean;
12
+ /**
13
+ * Additional CSS class names
14
+ */
15
+ className?: string;
16
+ }
17
+ export interface InputAddonProps {
18
+ /**
19
+ * Addon content (text, icon, etc.)
20
+ */
21
+ children: React.ReactNode;
22
+ /**
23
+ * Position in group (affects border radius)
24
+ * @default 'left'
25
+ */
26
+ position?: 'left' | 'right';
27
+ /**
28
+ * Additional CSS class names
29
+ */
30
+ className?: string;
31
+ }
32
+ /**
33
+ * InputGroup component for grouping inputs with addons
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * <InputGroup attached>
38
+ * <InputAddon position="left">https://</InputAddon>
39
+ * <Input placeholder="example.com" />
40
+ * </InputGroup>
41
+ *
42
+ * <InputGroup attached>
43
+ * <InputAddon position="left">$</InputAddon>
44
+ * <Input type="number" placeholder="0.00" />
45
+ * <InputAddon position="right">.00</InputAddon>
46
+ * </InputGroup>
47
+ * ```
48
+ */
49
+ export declare const InputGroup: React.ForwardRefExoticComponent<InputGroupProps & React.RefAttributes<HTMLDivElement>>;
50
+ /**
51
+ * InputAddon component for prepending/appending content to inputs
52
+ *
53
+ * @example
54
+ * ```tsx
55
+ * <InputAddon position="left">@</InputAddon>
56
+ * <InputAddon position="right">.com</InputAddon>
57
+ * ```
58
+ */
59
+ export declare const InputAddon: React.ForwardRefExoticComponent<InputAddonProps & React.RefAttributes<HTMLSpanElement>>;
package/lib/Link.d.ts ADDED
@@ -0,0 +1,69 @@
1
+ import { default as React } from 'react';
2
+ import { IconValue } from './types/icon';
3
+ export type LinkVariant = 'default' | 'muted' | 'danger';
4
+ export interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {
5
+ /**
6
+ * URL the link points to
7
+ */
8
+ href?: string;
9
+ /**
10
+ * Visual style variant
11
+ * @default 'default'
12
+ */
13
+ variant?: LinkVariant;
14
+ /**
15
+ * Size of the link text
16
+ * @default 'md'
17
+ */
18
+ size?: 'sm' | 'md' | 'lg';
19
+ /**
20
+ * Icon displayed before the link text
21
+ */
22
+ leftIcon?: IconValue;
23
+ /**
24
+ * Icon displayed after the link text
25
+ */
26
+ rightIcon?: IconValue;
27
+ /**
28
+ * Opens link in new tab with security attributes (adds external-link icon)
29
+ */
30
+ external?: boolean;
31
+ /**
32
+ * Disabled state - prevents interaction
33
+ */
34
+ disabled?: boolean;
35
+ /**
36
+ * Underline behavior
37
+ * @default 'hover'
38
+ */
39
+ underline?: 'always' | 'hover' | 'none';
40
+ /**
41
+ * Render as different element (e.g., for Next.js Link integration)
42
+ * When using with Next.js, pass the Link component from next/link as `as`
43
+ * and spread href and other props through
44
+ */
45
+ as?: React.ElementType;
46
+ /**
47
+ * Content of the link
48
+ */
49
+ children?: React.ReactNode;
50
+ /**
51
+ * Additional CSS class names
52
+ */
53
+ className?: string;
54
+ }
55
+ /**
56
+ * Link component for navigation with consistent styling
57
+ *
58
+ * Features underline animations, icons, and external link handling.
59
+ * Can be composed with framework-specific link components using the `as` prop.
60
+ *
61
+ * @example
62
+ * ```tsx
63
+ * <Link href="/about">About Us</Link>
64
+ * <Link href="https://example.com" external>External Site</Link>
65
+ * <Link href="/settings" leftIcon="settings">Settings</Link>
66
+ * <Link variant="muted" size="sm">Learn more</Link>
67
+ * ```
68
+ */
69
+ export declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
@@ -0,0 +1,95 @@
1
+ import { default as React } from 'react';
2
+ import { default as IMask } from 'imask';
3
+ import { InputProps } from './Input';
4
+ /**
5
+ * Mask configuration options
6
+ * @see https://imask.js.org/guide.html
7
+ */
8
+ export interface MaskConfig {
9
+ /**
10
+ * Mask pattern string (e.g., '0000 0000 0000 0000' for credit card)
11
+ * '0' = digit, 'a' = letter, '*' = any character
12
+ */
13
+ mask: string | RegExp | NumberConstructor | Array<string | RegExp | {
14
+ mask: string;
15
+ [key: string]: unknown;
16
+ }>;
17
+ /**
18
+ * Placeholder character for unfilled positions
19
+ * @default '_'
20
+ */
21
+ placeholderChar?: string;
22
+ /**
23
+ * Whether to show placeholder characters (lazy mode hides unfilled)
24
+ * @default true
25
+ */
26
+ lazy?: boolean;
27
+ /**
28
+ * Custom definitions for mask characters
29
+ * @example { '#': /[0-9]/ }
30
+ */
31
+ definitions?: Record<string, RegExp>;
32
+ /**
33
+ * Whether to include mask characters in the value
34
+ * false = masked value, true = unmasked value, 'typed' = typed value
35
+ * @default false
36
+ */
37
+ unmask?: boolean | 'typed';
38
+ /**
39
+ * Additional imask options
40
+ */
41
+ [key: string]: unknown;
42
+ }
43
+ type IMaskInstance = ReturnType<typeof IMask>;
44
+ /**
45
+ * Built-in mask presets for common use cases
46
+ */
47
+ export declare const MaskPresets: Record<string, MaskConfig>;
48
+ export type MaskPresetName = keyof typeof MaskPresets;
49
+ export interface MaskedInputProps extends Omit<InputProps, 'onChange' | 'value'> {
50
+ /**
51
+ * Mask configuration object or preset name
52
+ */
53
+ mask: MaskConfig | MaskPresetName;
54
+ /**
55
+ * Current value (can be masked or unmasked depending on mask config)
56
+ */
57
+ value?: string;
58
+ /**
59
+ * Callback with unmasked value when input is accepted
60
+ */
61
+ onAccept?: (value: string, maskRef: IMaskInstance) => void;
62
+ /**
63
+ * Callback when mask is complete
64
+ */
65
+ onComplete?: (value: string, maskRef: IMaskInstance) => void;
66
+ /**
67
+ * Standard onChange for form compatibility (fires with masked value)
68
+ */
69
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
70
+ }
71
+ /**
72
+ * Input component with built-in masking support
73
+ *
74
+ * Wraps the base Input component with imask integration for
75
+ * formatted input like credit cards, phone numbers, dates, etc.
76
+ *
77
+ * @example
78
+ * ```tsx
79
+ * // Using a preset
80
+ * <MaskedInput
81
+ * mask="creditCard"
82
+ * label="Card Number"
83
+ * onAccept={(value) => setCardNumber(value)}
84
+ * />
85
+ *
86
+ * // Custom mask
87
+ * <MaskedInput
88
+ * mask={{ mask: '000-000-0000' }}
89
+ * label="Phone"
90
+ * onAccept={(value) => setPhone(value)}
91
+ * />
92
+ * ```
93
+ */
94
+ export declare const MaskedInput: React.ForwardRefExoticComponent<MaskedInputProps & React.RefAttributes<HTMLInputElement>>;
95
+ export {};
package/lib/Menu.d.ts ADDED
@@ -0,0 +1,132 @@
1
+ import { default as React } from 'react';
2
+ import { AccordionShowCount } from './Accordion';
3
+ export type MenuLevel = 0 | 1 | 2;
4
+ export interface MenuProps extends React.HTMLAttributes<HTMLElement> {
5
+ /**
6
+ * Content of the menu (MenuGroup or MenuItem components)
7
+ */
8
+ children: React.ReactNode;
9
+ /**
10
+ * Additional CSS class names
11
+ */
12
+ className?: string;
13
+ }
14
+ /**
15
+ * Menu - navigation container with collapsible groups
16
+ *
17
+ * DOM Structure: `<nav class="gloss-menu">`
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * <Menu>
22
+ * <MenuGroup label="Components" showCount="never">
23
+ * <MenuGroup label="Input" showCount="collapsed-only">
24
+ * <MenuItem href="/input" icon={<Icon name="input" />}>Text</MenuItem>
25
+ * </MenuGroup>
26
+ * </MenuGroup>
27
+ * </Menu>
28
+ * ```
29
+ */
30
+ export declare const Menu: React.ForwardRefExoticComponent<MenuProps & React.RefAttributes<HTMLElement>>;
31
+ export interface MenuGroupProps extends React.HTMLAttributes<HTMLDivElement> {
32
+ /**
33
+ * Label text for the group header
34
+ */
35
+ label: string;
36
+ /**
37
+ * Icon to display on the left side of the header
38
+ */
39
+ icon?: React.ReactNode;
40
+ /**
41
+ * Whether the group is expanded by default
42
+ */
43
+ defaultOpen?: boolean;
44
+ /**
45
+ * Controlled open state
46
+ */
47
+ open?: boolean;
48
+ /**
49
+ * Callback when open state changes
50
+ */
51
+ onOpenChange?: (open: boolean) => void;
52
+ /**
53
+ * When to show the item count badge
54
+ */
55
+ showCount?: AccordionShowCount;
56
+ /**
57
+ * Whether the group is disabled
58
+ */
59
+ disabled?: boolean;
60
+ /**
61
+ * Content of the group (MenuItem or nested MenuGroup)
62
+ */
63
+ children: React.ReactNode;
64
+ /**
65
+ * Additional CSS class names
66
+ */
67
+ className?: string;
68
+ }
69
+ /**
70
+ * MenuGroup - collapsible section within Menu
71
+ *
72
+ * DOM Structure: `<div class="gloss-menu-group">`
73
+ */
74
+ export declare const MenuGroup: React.ForwardRefExoticComponent<MenuGroupProps & React.RefAttributes<HTMLDivElement>>;
75
+ export interface MenuItemProps extends React.HTMLAttributes<HTMLElement> {
76
+ /**
77
+ * URL for the item (renders as anchor if provided)
78
+ */
79
+ href?: string;
80
+ /**
81
+ * Custom component to render as (e.g., Next.js Link)
82
+ * When provided with href, renders the component with href prop
83
+ */
84
+ as?: React.ElementType;
85
+ /**
86
+ * Icon to display on the left side
87
+ */
88
+ icon?: React.ReactNode;
89
+ /**
90
+ * Whether the item is currently active/selected
91
+ */
92
+ active?: boolean;
93
+ /**
94
+ * Whether the item is disabled
95
+ */
96
+ disabled?: boolean;
97
+ /**
98
+ * Click handler (for non-link items)
99
+ */
100
+ onClick?: (e: React.MouseEvent) => void;
101
+ /**
102
+ * Content of the item
103
+ */
104
+ children: React.ReactNode;
105
+ /**
106
+ * Additional CSS class names
107
+ */
108
+ className?: string;
109
+ }
110
+ /**
111
+ * MenuItem - individual navigation item
112
+ *
113
+ * DOM Structure: `<a class="gloss-menu-item">` or `<button class="gloss-menu-item">`
114
+ *
115
+ * @example
116
+ * // With Next.js Link
117
+ * import Link from 'next/link';
118
+ * <MenuItem as={Link} href="/dashboard" icon={<Icon name="home" />}>Dashboard</MenuItem>
119
+ */
120
+ export declare const MenuItem: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLElement>>;
121
+ export interface MenuDividerProps extends React.HTMLAttributes<HTMLHRElement> {
122
+ /**
123
+ * Additional CSS class names
124
+ */
125
+ className?: string;
126
+ }
127
+ /**
128
+ * MenuDivider - visual separator between menu items
129
+ *
130
+ * DOM Structure: `<hr class="gloss-menu-divider">`
131
+ */
132
+ export declare const MenuDivider: React.ForwardRefExoticComponent<MenuDividerProps & React.RefAttributes<HTMLHRElement>>;