mtrl 0.2.2 → 0.2.4

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 (97) hide show
  1. package/.typedocignore +11 -0
  2. package/DOCS.md +153 -0
  3. package/index.ts +18 -3
  4. package/package.json +7 -2
  5. package/src/components/badge/_styles.scss +174 -0
  6. package/src/components/badge/api.ts +292 -0
  7. package/src/components/badge/badge.ts +52 -0
  8. package/src/components/badge/config.ts +68 -0
  9. package/src/components/badge/constants.ts +30 -0
  10. package/src/components/badge/features.ts +185 -0
  11. package/src/components/badge/index.ts +4 -0
  12. package/src/components/badge/types.ts +105 -0
  13. package/src/components/button/types.ts +174 -29
  14. package/src/components/carousel/_styles.scss +645 -0
  15. package/src/components/carousel/api.ts +147 -0
  16. package/src/components/carousel/carousel.ts +178 -0
  17. package/src/components/carousel/config.ts +91 -0
  18. package/src/components/carousel/constants.ts +95 -0
  19. package/src/components/carousel/features/drag.ts +388 -0
  20. package/src/components/carousel/features/index.ts +8 -0
  21. package/src/components/carousel/features/slides.ts +682 -0
  22. package/src/components/carousel/index.ts +38 -0
  23. package/src/components/carousel/types.ts +327 -0
  24. package/src/components/dialog/_styles.scss +213 -0
  25. package/src/components/dialog/api.ts +283 -0
  26. package/src/components/dialog/config.ts +113 -0
  27. package/src/components/dialog/constants.ts +32 -0
  28. package/src/components/dialog/dialog.ts +56 -0
  29. package/src/components/dialog/features.ts +713 -0
  30. package/src/components/dialog/index.ts +15 -0
  31. package/src/components/dialog/types.ts +221 -0
  32. package/src/components/progress/_styles.scss +13 -1
  33. package/src/components/progress/api.ts +2 -2
  34. package/src/components/progress/progress.ts +2 -2
  35. package/src/components/progress/types.ts +3 -0
  36. package/src/components/radios/_styles.scss +232 -0
  37. package/src/components/radios/api.ts +100 -0
  38. package/src/components/radios/config.ts +60 -0
  39. package/src/components/radios/constants.ts +28 -0
  40. package/src/components/radios/index.ts +4 -0
  41. package/src/components/radios/radio.ts +269 -0
  42. package/src/components/radios/radios.ts +42 -0
  43. package/src/components/radios/types.ts +232 -0
  44. package/src/components/sheet/_styles.scss +236 -0
  45. package/src/components/sheet/api.ts +96 -0
  46. package/src/components/sheet/config.ts +66 -0
  47. package/src/components/sheet/constants.ts +20 -0
  48. package/src/components/sheet/features/content.ts +51 -0
  49. package/src/components/sheet/features/gestures.ts +177 -0
  50. package/src/components/sheet/features/index.ts +6 -0
  51. package/src/components/sheet/features/position.ts +42 -0
  52. package/src/components/sheet/features/state.ts +116 -0
  53. package/src/components/sheet/features/title.ts +86 -0
  54. package/src/components/sheet/index.ts +4 -0
  55. package/src/components/sheet/sheet.ts +57 -0
  56. package/src/components/sheet/types.ts +266 -0
  57. package/src/components/slider/_styles.scss +518 -0
  58. package/src/components/slider/api.ts +336 -0
  59. package/src/components/slider/config.ts +145 -0
  60. package/src/components/slider/constants.ts +28 -0
  61. package/src/components/slider/features/appearance.ts +140 -0
  62. package/src/components/slider/features/disabled.ts +43 -0
  63. package/src/components/slider/features/events.ts +164 -0
  64. package/src/components/slider/features/index.ts +5 -0
  65. package/src/components/slider/features/interactions.ts +256 -0
  66. package/src/components/slider/features/keyboard.ts +114 -0
  67. package/src/components/slider/features/slider.ts +336 -0
  68. package/src/components/slider/features/structure.ts +264 -0
  69. package/src/components/slider/features/ui.ts +518 -0
  70. package/src/components/slider/index.ts +9 -0
  71. package/src/components/slider/slider.ts +58 -0
  72. package/src/components/slider/types.ts +166 -0
  73. package/src/components/tabs/_styles.scss +224 -0
  74. package/src/components/tabs/api.ts +443 -0
  75. package/src/components/tabs/config.ts +80 -0
  76. package/src/components/tabs/constants.ts +12 -0
  77. package/src/components/tabs/index.ts +4 -0
  78. package/src/components/tabs/tabs.ts +52 -0
  79. package/src/components/tabs/types.ts +247 -0
  80. package/src/components/textfield/_styles.scss +97 -4
  81. package/src/components/tooltip/_styles.scss +241 -0
  82. package/src/components/tooltip/api.ts +411 -0
  83. package/src/components/tooltip/config.ts +78 -0
  84. package/src/components/tooltip/constants.ts +27 -0
  85. package/src/components/tooltip/index.ts +4 -0
  86. package/src/components/tooltip/tooltip.ts +60 -0
  87. package/src/components/tooltip/types.ts +178 -0
  88. package/src/core/build/_ripple.scss +79 -0
  89. package/src/core/build/constants.ts +48 -0
  90. package/src/core/build/icon.ts +137 -0
  91. package/src/core/build/ripple.ts +216 -0
  92. package/src/core/build/text.ts +91 -0
  93. package/src/index.ts +9 -1
  94. package/src/styles/abstract/_variables.scss +24 -12
  95. package/tsconfig.json +22 -0
  96. package/typedoc.json +28 -0
  97. package/typedoc.simple.json +14 -0
@@ -1,118 +1,263 @@
1
+ // src/components/button/types.ts
2
+ import { BUTTON_VARIANTS, BUTTON_SIZES } from './constants';
3
+
1
4
  /**
2
5
  * Configuration interface for the Button component
6
+ * @category Components
3
7
  */
4
8
  export interface ButtonConfig {
5
- /** Button variant (filled, tonal, outlined, elevated, text) */
6
- variant?: keyof typeof BUTTON_VARIANTS | BUTTON_VARIANTS;
9
+ /**
10
+ * Button variant that determines visual styling
11
+ * @default 'filled'
12
+ */
13
+ variant?: keyof typeof BUTTON_VARIANTS | string;
7
14
 
8
- /** Button size (small, medium, large) */
9
- size?: keyof typeof BUTTON_SIZES | BUTTON_SIZES;
15
+ /**
16
+ * Button size
17
+ * @default 'medium'
18
+ */
19
+ size?: keyof typeof BUTTON_SIZES | string;
10
20
 
11
- /** Whether the button is initially disabled */
21
+ /**
22
+ * Whether the button is initially disabled
23
+ * @default false
24
+ */
12
25
  disabled?: boolean;
13
26
 
14
- /** Initial button text content */
27
+ /**
28
+ * Initial button text content
29
+ * @example 'Submit'
30
+ */
15
31
  text?: string;
16
32
 
17
- /** Initial button icon HTML content */
33
+ /**
34
+ * Initial button icon HTML content
35
+ * @example '<svg>...</svg>'
36
+ */
18
37
  icon?: string;
19
38
 
20
- /** Icon size */
39
+ /**
40
+ * Icon size in pixels or other CSS units
41
+ * @example '18px'
42
+ */
21
43
  iconSize?: string;
22
44
 
23
- /** Additional CSS classes */
45
+ /**
46
+ * Additional CSS classes to add to the button
47
+ * @example 'form-submit header-action'
48
+ */
24
49
  class?: string;
25
50
 
26
- /** Button value attribute */
51
+ /**
52
+ * Button value attribute
53
+ */
27
54
  value?: string;
28
55
 
29
- /** Button type attribute (default: 'button') */
56
+ /**
57
+ * Button type attribute
58
+ * @default 'button'
59
+ */
30
60
  type?: 'button' | 'submit' | 'reset';
31
61
 
32
- /** Whether to enable ripple effect */
62
+ /**
63
+ * Whether to enable ripple effect
64
+ * @default true
65
+ */
33
66
  ripple?: boolean;
67
+
68
+ /**
69
+ * Component prefix for class names
70
+ * @default 'mtrl'
71
+ */
72
+ prefix?: string;
73
+
74
+ /**
75
+ * Component name used in class generation
76
+ */
77
+ componentName?: string;
34
78
 
35
- /** Ripple effect configuration */
79
+ /**
80
+ * Ripple effect configuration
81
+ */
36
82
  rippleConfig?: {
83
+ /** Duration of the ripple animation in milliseconds */
37
84
  duration?: number;
85
+ /** Timing function for the ripple animation */
38
86
  timing?: string;
87
+ /** Opacity values for ripple start and end [start, end] */
39
88
  opacity?: [string, string];
40
89
  };
41
90
  }
42
91
 
43
92
  /**
44
- * Icon API interface
93
+ * Icon API interface for managing button icons
94
+ * @category Components
45
95
  */
46
96
  export interface IconAPI {
97
+ /**
98
+ * Sets the icon HTML content
99
+ * @param html - HTML string for the icon
100
+ * @returns The icon API for chaining
101
+ */
47
102
  setIcon: (html: string) => IconAPI;
103
+
104
+ /**
105
+ * Gets the current icon HTML content
106
+ * @returns HTML string for the icon
107
+ */
48
108
  getIcon: () => string;
109
+
110
+ /**
111
+ * Gets the icon DOM element
112
+ * @returns The icon element or null if not present
113
+ */
49
114
  getElement: () => HTMLElement | null;
50
115
  }
51
116
 
52
117
  /**
53
- * Text API interface
118
+ * Text API interface for managing button text
119
+ * @category Components
54
120
  */
55
121
  export interface TextAPI {
122
+ /**
123
+ * Sets the text content
124
+ * @param content - Text content
125
+ * @returns The text API for chaining
126
+ */
56
127
  setText: (content: string) => TextAPI;
128
+
129
+ /**
130
+ * Gets the current text content
131
+ * @returns Button text content
132
+ */
57
133
  getText: () => string;
134
+
135
+ /**
136
+ * Gets the text DOM element
137
+ * @returns The text element or null if not present
138
+ */
58
139
  getElement: () => HTMLElement | null;
59
140
  }
60
141
 
61
142
  /**
62
143
  * Button component interface
144
+ * @category Components
63
145
  */
64
146
  export interface ButtonComponent {
147
+ /** The button's DOM element */
65
148
  element: HTMLButtonElement;
149
+
150
+ /** API for managing button text */
66
151
  text: TextAPI;
152
+
153
+ /** API for managing button icons */
67
154
  icon: IconAPI;
155
+
156
+ /** API for managing disabled state */
68
157
  disabled: {
158
+ /** Enables the button */
69
159
  enable: () => void;
160
+ /** Disables the button */
70
161
  disable: () => void;
162
+ /** Checks if the button is disabled */
71
163
  isDisabled: () => boolean;
72
164
  };
165
+
166
+ /** API for managing component lifecycle */
73
167
  lifecycle: {
168
+ /** Destroys the component and cleans up resources */
74
169
  destroy: () => void;
75
170
  };
76
171
 
77
- /** Gets the class with the specified name */
172
+ /**
173
+ * Gets a class name with the component's prefix
174
+ * @param name - Base class name
175
+ * @returns Prefixed class name
176
+ */
78
177
  getClass: (name: string) => string;
79
178
 
80
- /** Gets the button's value */
179
+ /**
180
+ * Gets the button's value attribute
181
+ * @returns Button value
182
+ */
81
183
  getValue: () => string;
82
184
 
83
- /** Sets the button's value */
185
+ /**
186
+ * Sets the button's value attribute
187
+ * @param value - New value
188
+ * @returns The button component for chaining
189
+ */
84
190
  setValue: (value: string) => ButtonComponent;
85
191
 
86
- /** Enables the button */
192
+ /**
193
+ * Enables the button (removes disabled attribute)
194
+ * @returns The button component for chaining
195
+ */
87
196
  enable: () => ButtonComponent;
88
197
 
89
- /** Disables the button */
198
+ /**
199
+ * Disables the button (adds disabled attribute)
200
+ * @returns The button component for chaining
201
+ */
90
202
  disable: () => ButtonComponent;
91
203
 
92
- /** Sets the button's text content */
204
+ /**
205
+ * Sets the button's text content
206
+ * @param content - Text content
207
+ * @returns The button component for chaining
208
+ */
93
209
  setText: (content: string) => ButtonComponent;
94
210
 
95
- /** Gets the button's text content */
211
+ /**
212
+ * Gets the button's text content
213
+ * @returns Button text content
214
+ */
96
215
  getText: () => string;
97
216
 
98
- /** Sets the button's icon */
217
+ /**
218
+ * Sets the button's icon
219
+ * @param icon - Icon HTML content
220
+ * @returns The button component for chaining
221
+ */
99
222
  setIcon: (icon: string) => ButtonComponent;
100
223
 
101
- /** Gets the button's icon */
224
+ /**
225
+ * Gets the button's icon HTML content
226
+ * @returns Icon HTML
227
+ */
102
228
  getIcon: () => string;
103
229
 
104
- /** Destroys the button component and cleans up resources */
230
+ /**
231
+ * Destroys the button component and cleans up resources
232
+ */
105
233
  destroy: () => void;
106
234
 
107
- /** Updates the button's circular style based on content */
235
+ /**
236
+ * Updates the button's circular style based on content
237
+ * Internal method used when changing content
238
+ */
108
239
  updateCircularStyle: () => void;
109
240
 
110
- /** Adds event listener */
241
+ /**
242
+ * Adds an event listener to the button
243
+ * @param event - Event name ('click', 'focus', etc.)
244
+ * @param handler - Event handler function
245
+ * @returns The button component for chaining
246
+ */
111
247
  on: (event: string, handler: Function) => ButtonComponent;
112
248
 
113
- /** Removes event listener */
249
+ /**
250
+ * Removes an event listener from the button
251
+ * @param event - Event name
252
+ * @param handler - Event handler function
253
+ * @returns The button component for chaining
254
+ */
114
255
  off: (event: string, handler: Function) => ButtonComponent;
115
256
 
116
- /** Add CSS classes */
257
+ /**
258
+ * Adds CSS classes to the button element
259
+ * @param classes - One or more class names to add
260
+ * @returns The button component for chaining
261
+ */
117
262
  addClass: (...classes: string[]) => ButtonComponent;
118
263
  }