mtrl 0.2.7 → 0.2.9

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 (190) hide show
  1. package/index.ts +2 -0
  2. package/package.json +14 -3
  3. package/src/components/badge/api.ts +23 -14
  4. package/src/components/badge/badge.ts +2 -2
  5. package/src/components/badge/config.ts +10 -11
  6. package/src/components/badge/features.ts +15 -10
  7. package/src/components/badge/index.ts +27 -2
  8. package/src/components/badge/types.ts +28 -8
  9. package/src/components/bottom-app-bar/bottom-app-bar.ts +2 -44
  10. package/src/components/bottom-app-bar/config.ts +1 -45
  11. package/src/components/bottom-app-bar/index.ts +7 -1
  12. package/src/components/bottom-app-bar/types.ts +7 -1
  13. package/src/components/button/button.ts +0 -1
  14. package/src/components/button/config.ts +1 -2
  15. package/src/components/button/index.ts +10 -2
  16. package/src/components/button/types.ts +14 -2
  17. package/src/components/card/config.ts +17 -9
  18. package/src/components/card/content.ts +8 -10
  19. package/src/components/card/features.ts +4 -6
  20. package/src/components/card/index.ts +29 -2
  21. package/src/components/card/types.ts +6 -23
  22. package/src/components/checkbox/config.ts +3 -4
  23. package/src/components/checkbox/index.ts +1 -2
  24. package/src/components/checkbox/types.ts +12 -3
  25. package/src/components/chip/api.ts +170 -221
  26. package/src/components/chip/chip.ts +34 -302
  27. package/src/components/chip/config.ts +1 -2
  28. package/src/components/chip/index.ts +10 -2
  29. package/src/components/chip/types.ts +224 -35
  30. package/src/components/datepicker/api.ts +18 -25
  31. package/src/components/datepicker/config.ts +9 -12
  32. package/src/components/datepicker/datepicker.ts +7 -12
  33. package/src/components/datepicker/index.ts +10 -7
  34. package/src/components/datepicker/render.ts +16 -18
  35. package/src/components/datepicker/types.ts +164 -35
  36. package/src/components/datepicker/utils.ts +1 -2
  37. package/src/components/dialog/api.ts +7 -8
  38. package/src/components/dialog/config.ts +3 -4
  39. package/src/components/dialog/features.ts +56 -22
  40. package/src/components/dialog/index.ts +38 -8
  41. package/src/components/dialog/types.ts +33 -10
  42. package/src/components/divider/index.ts +5 -1
  43. package/src/components/extended-fab/config.ts +6 -2
  44. package/src/components/extended-fab/index.ts +7 -2
  45. package/src/components/extended-fab/types.ts +21 -4
  46. package/src/components/fab/config.ts +3 -4
  47. package/src/components/fab/fab.ts +1 -1
  48. package/src/components/fab/index.ts +7 -2
  49. package/src/components/fab/types.ts +21 -4
  50. package/src/components/list/config.ts +4 -5
  51. package/src/components/list/features.ts +6 -7
  52. package/src/components/list/index.ts +7 -9
  53. package/src/components/list/list-item.ts +12 -13
  54. package/src/components/list/types.ts +50 -5
  55. package/src/components/list/utils.ts +30 -3
  56. package/src/components/menu/features/items-manager.ts +9 -9
  57. package/src/components/menu/features/positioning.ts +7 -7
  58. package/src/components/menu/features/visibility.ts +7 -7
  59. package/src/components/menu/index.ts +7 -9
  60. package/src/components/menu/menu-item.ts +6 -6
  61. package/src/components/menu/menu.ts +22 -0
  62. package/src/components/menu/types.ts +29 -10
  63. package/src/components/menu/utils.ts +67 -0
  64. package/src/components/navigation/api.ts +131 -96
  65. package/src/components/navigation/config.ts +22 -10
  66. package/src/components/navigation/features/controller.ts +273 -0
  67. package/src/components/navigation/features/items.ts +160 -87
  68. package/src/components/navigation/index.ts +0 -6
  69. package/src/components/navigation/nav-item.ts +12 -24
  70. package/src/components/navigation/navigation.ts +21 -8
  71. package/src/components/navigation/system-types.ts +124 -0
  72. package/src/components/navigation/system.ts +776 -0
  73. package/src/components/navigation/types.ts +228 -203
  74. package/src/components/progress/api.ts +2 -3
  75. package/src/components/progress/config.ts +2 -3
  76. package/src/components/progress/index.ts +0 -1
  77. package/src/components/progress/progress.ts +1 -2
  78. package/src/components/progress/types.ts +186 -33
  79. package/src/components/radios/config.ts +1 -1
  80. package/src/components/radios/index.ts +0 -1
  81. package/src/components/radios/types.ts +0 -7
  82. package/src/components/search/config.ts +1 -2
  83. package/src/components/search/features/search.ts +14 -15
  84. package/src/components/search/features/states.ts +5 -1
  85. package/src/components/search/features/structure.ts +3 -4
  86. package/src/components/search/index.ts +0 -3
  87. package/src/components/search/types.ts +18 -6
  88. package/src/components/segmented-button/config.ts +20 -7
  89. package/src/components/segmented-button/segment.ts +6 -7
  90. package/src/components/segmented-button/segmented-button.ts +4 -5
  91. package/src/components/segmented-button/types.ts +37 -2
  92. package/src/components/slider/config.ts +20 -2
  93. package/src/components/slider/features/controller.ts +761 -0
  94. package/src/components/slider/features/handlers.ts +18 -15
  95. package/src/components/slider/features/index.ts +3 -2
  96. package/src/components/slider/features/range.ts +104 -0
  97. package/src/components/slider/slider.ts +34 -14
  98. package/src/components/slider/structure.ts +152 -0
  99. package/src/components/slider/types.ts +34 -8
  100. package/src/components/snackbar/config.ts +2 -3
  101. package/src/components/snackbar/constants.ts +0 -32
  102. package/src/components/snackbar/index.ts +0 -1
  103. package/src/components/snackbar/position.ts +9 -1
  104. package/src/components/snackbar/types.ts +122 -46
  105. package/src/components/switch/config.ts +2 -3
  106. package/src/components/switch/index.ts +0 -1
  107. package/src/components/switch/types.ts +3 -2
  108. package/src/components/tabs/config.ts +3 -4
  109. package/src/components/tabs/index.ts +0 -15
  110. package/src/components/tabs/tab-api.ts +12 -4
  111. package/src/components/tabs/tab.ts +18 -6
  112. package/src/components/tabs/types.ts +13 -3
  113. package/src/components/textfield/api.ts +53 -0
  114. package/src/components/textfield/config.ts +2 -3
  115. package/src/components/textfield/features.ts +322 -0
  116. package/src/components/textfield/index.ts +0 -1
  117. package/src/components/textfield/textfield.ts +8 -0
  118. package/src/components/textfield/types.ts +29 -6
  119. package/src/components/timepicker/api.ts +1 -1
  120. package/src/components/timepicker/clockdial.ts +2 -5
  121. package/src/components/timepicker/config.ts +102 -4
  122. package/src/components/timepicker/index.ts +1 -6
  123. package/src/components/timepicker/render.ts +1 -1
  124. package/src/components/timepicker/timepicker.ts +1 -1
  125. package/src/components/tooltip/api.ts +1 -1
  126. package/src/components/tooltip/config.ts +27 -6
  127. package/src/components/tooltip/index.ts +0 -1
  128. package/src/components/tooltip/types.ts +13 -3
  129. package/src/core/compose/features/textinput.ts +15 -2
  130. package/src/core/compose/features/textlabel.ts +0 -3
  131. package/src/core/composition/features/dom.ts +33 -0
  132. package/src/core/composition/features/icon.ts +131 -0
  133. package/src/core/composition/features/index.ts +11 -0
  134. package/src/core/composition/features/label.ts +156 -0
  135. package/src/core/composition/features/structure.ts +22 -0
  136. package/src/core/composition/index.ts +26 -0
  137. package/src/core/index.ts +1 -1
  138. package/src/core/structure.ts +288 -0
  139. package/src/index.ts +1 -0
  140. package/src/styles/components/_navigation-mobile.scss +244 -0
  141. package/src/styles/components/_navigation-system.scss +151 -0
  142. package/src/{components/tabs/_styles.scss → styles/components/_tabs.scss} +1 -1
  143. package/src/{components/textfield/_styles.scss → styles/components/_textfield.scss} +314 -72
  144. package/src/styles/main.scss +98 -49
  145. package/src/components/badge/constants.ts +0 -40
  146. package/src/components/button/constants.ts +0 -11
  147. package/src/components/card/constants.ts +0 -84
  148. package/src/components/datepicker/constants.ts +0 -98
  149. package/src/components/dialog/constants.ts +0 -32
  150. package/src/components/extended-fab/constants.ts +0 -36
  151. package/src/components/fab/constants.ts +0 -41
  152. package/src/components/menu/constants.ts +0 -154
  153. package/src/components/navigation/constants.ts +0 -200
  154. package/src/components/progress/constants.ts +0 -29
  155. package/src/components/search/constants.ts +0 -21
  156. package/src/components/segmented-button/constants.ts +0 -42
  157. package/src/components/slider/features/slider.ts +0 -318
  158. package/src/components/slider/features/structure.ts +0 -181
  159. package/src/components/slider/features/ui.ts +0 -388
  160. package/src/components/switch/constants.ts +0 -80
  161. package/src/components/tabs/constants.ts +0 -89
  162. package/src/components/textfield/constants.ts +0 -100
  163. package/src/components/timepicker/constants.ts +0 -138
  164. /package/src/{components/badge/_styles.scss → styles/components/_badge.scss} +0 -0
  165. /package/src/{components/bottom-app-bar/_styles.scss → styles/components/_bottom-app-bar.scss} +0 -0
  166. /package/src/{components/button/_styles.scss → styles/components/_button.scss} +0 -0
  167. /package/src/{components/card/_styles.scss → styles/components/_card.scss} +0 -0
  168. /package/src/{components/carousel/_styles.scss → styles/components/_carousel.scss} +0 -0
  169. /package/src/{components/checkbox/_styles.scss → styles/components/_checkbox.scss} +0 -0
  170. /package/src/{components/chip/_styles.scss → styles/components/_chip.scss} +0 -0
  171. /package/src/{components/datepicker/_styles.scss → styles/components/_datepicker.scss} +0 -0
  172. /package/src/{components/dialog/_styles.scss → styles/components/_dialog.scss} +0 -0
  173. /package/src/{components/divider/_styles.scss → styles/components/_divider.scss} +0 -0
  174. /package/src/{components/extended-fab/_styles.scss → styles/components/_extended-fab.scss} +0 -0
  175. /package/src/{components/fab/_styles.scss → styles/components/_fab.scss} +0 -0
  176. /package/src/{components/list/_styles.scss → styles/components/_list.scss} +0 -0
  177. /package/src/{components/menu/_styles.scss → styles/components/_menu.scss} +0 -0
  178. /package/src/{components/navigation/_styles.scss → styles/components/_navigation.scss} +0 -0
  179. /package/src/{components/progress/_styles.scss → styles/components/_progress.scss} +0 -0
  180. /package/src/{components/radios/_styles.scss → styles/components/_radios.scss} +0 -0
  181. /package/src/{components/search/_styles.scss → styles/components/_search.scss} +0 -0
  182. /package/src/{components/segmented-button/_styles.scss → styles/components/_segmented-button.scss} +0 -0
  183. /package/src/{components/sheet/_styles.scss → styles/components/_sheet.scss} +0 -0
  184. /package/src/{components/slider/_styles.scss → styles/components/_slider.scss} +0 -0
  185. /package/src/{components/snackbar/_styles.scss → styles/components/_snackbar.scss} +0 -0
  186. /package/src/{components/switch/_styles.scss → styles/components/_switch.scss} +0 -0
  187. /package/src/{components/timepicker/_styles.scss → styles/components/_timepicker.scss} +0 -0
  188. /package/src/{components/tooltip/_styles.scss → styles/components/_tooltip.scss} +0 -0
  189. /package/src/{components/top-app-bar/_styles.scss → styles/components/_top-app-bar.scss} +0 -0
  190. /package/src/styles/utilities/{_color.scss → _colors.scss} +0 -0
@@ -1,234 +1,259 @@
1
- // src/components/button/types.ts
2
- import { BUTTON_VARIANTS } from './constants';
1
+ // src/components/navigation/types.ts
3
2
 
4
3
  /**
5
- * Configuration interface for the Button component
4
+ * Navigation variants following Material Design 3
6
5
  * @category Components
7
6
  */
8
- export interface ButtonConfig {
9
- /**
10
- * Button variant that determines visual styling
11
- * @default 'filled'
12
- */
13
- variant?: keyof typeof BUTTON_VARIANTS | string;
14
-
15
- /**
16
- * Whether the button is initially disabled
17
- * @default false
18
- */
7
+ export type NavVariant = 'rail' | 'drawer' | 'bar' | 'modal' | 'standard';
8
+
9
+ /**
10
+ * Navigation positions
11
+ * @category Components
12
+ */
13
+ export type NavPosition = 'left' | 'right' | 'top' | 'bottom';
14
+
15
+ /**
16
+ * Navigation behaviors
17
+ * @category Components
18
+ */
19
+ export type NavBehavior = 'fixed' | 'dismissible' | 'modal';
20
+
21
+ /**
22
+ * Navigation item state
23
+ * @category Components
24
+ */
25
+ export type NavItemState = 'active' | 'disabled' | 'expanded' | 'collapsed' | 'hovered' | 'focused' | 'pressed';
26
+
27
+ /**
28
+ * Navigation element class names
29
+ * Used internally to maintain consistent class names
30
+ * @internal
31
+ */
32
+ export const NavClass = {
33
+ ITEM: 'nav-item',
34
+ ITEM_CONTAINER: 'nav-item-container',
35
+ ICON: 'nav-item-icon',
36
+ LABEL: 'nav-item-label',
37
+ BADGE: 'nav-item-badge',
38
+ DIVIDER: 'nav-divider',
39
+ SCRIM: 'nav-scrim',
40
+ GROUP: 'nav-group',
41
+ GROUP_TITLE: 'nav-group-title',
42
+ SUBTITLE: 'nav-subtitle',
43
+ NESTED_CONTAINER: 'nav-nested-container',
44
+ NESTED_ITEM: 'nav-nested-item',
45
+ EXPAND_ICON: 'nav-expand-icon'
46
+ } as const;
47
+
48
+ /**
49
+ * Navigation item configuration
50
+ */
51
+ export interface NavItemConfig {
52
+ /** Unique identifier for the item */
53
+ id: string;
54
+
55
+ /** Icon HTML content */
56
+ icon?: string;
57
+
58
+ /** Text label */
59
+ label?: string;
60
+
61
+ /** Badge text */
62
+ badge?: string;
63
+
64
+ /** Whether the item is disabled */
19
65
  disabled?: boolean;
20
66
 
21
- /**
22
- * Initial button text content
23
- * @example 'Submit'
24
- */
25
- text?: string;
67
+ /** Whether the item is active */
68
+ active?: boolean;
26
69
 
27
- /**
28
- * Initial button icon HTML content
29
- * @example '<svg>...</svg>'
30
- */
31
- icon?: string;
70
+ /** Whether nested items are expanded */
71
+ expanded?: boolean;
32
72
 
33
- /**
34
- * Icon size in pixels or other CSS units
35
- * @example '18px'
36
- */
37
- iconSize?: string;
73
+ /** Subtitle text (for drawer items) */
74
+ subtitle?: string;
38
75
 
39
- /**
40
- * Additional CSS classes to add to the button
41
- * @example 'form-submit header-action'
42
- */
43
- class?: string;
76
+ /** Group ID this item belongs to */
77
+ groupId?: string;
78
+
79
+ /** Nested navigation items */
80
+ items?: NavItemConfig[];
81
+ }
82
+
83
+ /**
84
+ * Navigation group configuration
85
+ */
86
+ export interface NavGroupConfig {
87
+ /** Unique identifier for the group */
88
+ id: string;
44
89
 
45
- /**
46
- * Button value attribute
47
- */
48
- value?: string;
49
-
50
- /**
51
- * Button type attribute
52
- * @default 'button'
53
- */
54
- type?: 'button' | 'submit' | 'reset';
55
-
56
- /**
57
- * Whether to enable ripple effect
58
- * @default true
59
- */
60
- ripple?: boolean;
90
+ /** Group title text */
91
+ title: string;
92
+
93
+ /** Whether the group is expanded */
94
+ expanded?: boolean;
95
+ }
61
96
 
62
- /**
63
- * Component prefix for class names
64
- * @default 'mtrl'
65
- */
97
+ /**
98
+ * Navigation item data
99
+ */
100
+ export interface NavItemData {
101
+ /** The item's DOM element */
102
+ element: HTMLElement;
103
+
104
+ /** Item configuration */
105
+ config: NavItemConfig;
106
+ }
107
+
108
+ /**
109
+ * Navigation change event data
110
+ */
111
+ export interface NavChangeEvent {
112
+ /** ID of the selected item */
113
+ id: string;
114
+
115
+ /** Selected item data */
116
+ item: NavItemData;
117
+
118
+ /** Previously selected item data */
119
+ previousItem?: NavItemData | null;
120
+
121
+ /** Path of parent item IDs */
122
+ path: string[];
123
+ }
124
+
125
+ /**
126
+ * Configuration interface for the Navigation component
127
+ */
128
+ export interface NavigationConfig {
129
+ /** Navigation variant */
130
+ variant?: NavVariant | string;
131
+
132
+ /** Navigation position */
133
+ position?: NavPosition | string;
134
+
135
+ /** Navigation behavior */
136
+ behavior?: NavBehavior | string;
137
+
138
+ /** Navigation items */
139
+ items?: NavItemConfig[];
140
+
141
+ /** Navigation groups */
142
+ groups?: NavGroupConfig[];
143
+
144
+ /** Whether the navigation is disabled */
145
+ disabled?: boolean;
146
+
147
+ /** Whether the navigation is expanded (for drawer) */
148
+ expanded?: boolean;
149
+
150
+ /** Whether to show item labels */
151
+ showLabels?: boolean;
152
+
153
+ /** Whether to enable background scrim (for modal drawer) */
154
+ scrimEnabled?: boolean;
155
+
156
+ /** Additional CSS classes */
157
+ class?: string;
158
+
159
+ /** Accessibility label */
160
+ ariaLabel?: string;
161
+
162
+ /** Component prefix for class names */
66
163
  prefix?: string;
67
164
 
68
- /**
69
- * Component name used in class generation
70
- */
165
+ /** Component name */
71
166
  componentName?: string;
167
+ }
168
+
169
+ /**
170
+ * Navigation component interface
171
+ */
172
+ export interface NavigationComponent {
173
+ /** The navigation's DOM element */
174
+ element: HTMLElement;
72
175
 
73
- /**
74
- * Ripple effect configuration
75
- */
76
- rippleConfig?: {
77
- /** Duration of the ripple animation in milliseconds */
78
- duration?: number;
79
- /** Timing function for the ripple animation */
80
- timing?: string;
81
- /** Opacity values for ripple start and end [start, end] */
82
- opacity?: [string, string];
83
- };
176
+ /** Map of navigation items */
177
+ items: Map<string, NavItemData>;
84
178
 
85
- /**
86
- * Accessible name for the button (aria-label)
87
- * Required for icon-only buttons without text
88
- */
89
- ariaLabel?: string;
179
+ /** Adds a navigation item */
180
+ addItem: (config: NavItemConfig) => NavigationComponent;
181
+
182
+ /** Removes a navigation item */
183
+ removeItem: (id: string) => NavigationComponent;
184
+
185
+ /** Gets a navigation item by ID */
186
+ getItem: (id: string) => NavItemData | undefined;
187
+
188
+ /** Gets all navigation items */
189
+ getAllItems: () => NavItemData[];
190
+
191
+ /** Gets the active navigation item */
192
+ getActive: () => NavItemData | null;
193
+
194
+ /** Gets the path to an item (parent IDs) */
195
+ getItemPath: (id: string) => string[];
90
196
 
91
- /**
92
- * Descriptive name for the button
93
- * Used to derive an accessible name for icon-only buttons
94
- */
95
- name?: string;
197
+ /** Sets the active navigation item */
198
+ setActive: (id: string) => NavigationComponent;
199
+
200
+ /** Enables the navigation */
201
+ enable: () => NavigationComponent;
202
+
203
+ /** Disables the navigation */
204
+ disable: () => NavigationComponent;
205
+
206
+ /** Expands the navigation (for drawer) */
207
+ expand: () => NavigationComponent;
208
+
209
+ /** Collapses the navigation (for drawer) */
210
+ collapse: () => NavigationComponent;
211
+
212
+ /** Checks if the navigation is expanded */
213
+ isExpanded: () => boolean;
214
+
215
+ /** Toggles the navigation expansion state */
216
+ toggle: () => NavigationComponent;
217
+
218
+ /** Adds an event listener */
219
+ on: (event: string, handler: Function) => NavigationComponent;
220
+
221
+ /** Removes an event listener */
222
+ off: (event: string, handler: Function) => NavigationComponent;
223
+
224
+ /** Destroys the navigation component */
225
+ destroy: () => void;
96
226
  }
97
227
 
98
228
  /**
99
- * Button component interface
100
- * @category Components
229
+ * Base component interface
101
230
  */
102
- export interface ButtonComponent {
103
- /** The button's DOM element */
104
- element: HTMLButtonElement;
105
-
106
- /** API for managing button text */
107
- text: {
108
- setText: (content: string) => any;
109
- getText: () => string;
110
- getElement: () => HTMLElement | null;
231
+ export interface BaseComponent {
232
+ element: HTMLElement;
233
+ prefix?: string;
234
+ items?: Map<string, NavItemData>;
235
+ emit?: (event: string, data: any) => void;
236
+ on?: (event: string, handler: Function) => any;
237
+ off?: (event: string, handler: Function) => any;
238
+ lifecycle?: {
239
+ destroy: () => void;
111
240
  };
112
-
113
- /** API for managing button icons */
114
- icon: {
115
- setIcon: (html: string) => any;
116
- getIcon: () => string;
117
- getElement: () => HTMLElement | null;
241
+ disabled?: {
242
+ enable: () => any;
243
+ disable: () => any;
118
244
  };
119
-
120
- /** API for managing disabled state */
245
+ [key: string]: any;
246
+ }
247
+
248
+ /**
249
+ * API options interface
250
+ */
251
+ export interface ApiOptions {
121
252
  disabled: {
122
- /** Enables the button */
123
253
  enable: () => void;
124
- /** Disables the button */
125
254
  disable: () => void;
126
- /** Checks if the button is disabled */
127
- isDisabled: () => boolean;
128
255
  };
129
-
130
- /** API for managing component lifecycle */
131
256
  lifecycle: {
132
- /** Destroys the component and cleans up resources */
133
257
  destroy: () => void;
134
258
  };
135
-
136
- /**
137
- * Gets a class name with the component's prefix
138
- * @param name - Base class name
139
- * @returns Prefixed class name
140
- */
141
- getClass: (name: string) => string;
142
-
143
- /**
144
- * Gets the button's value attribute
145
- * @returns Button value
146
- */
147
- getValue: () => string;
148
-
149
- /**
150
- * Sets the button's value attribute
151
- * @param value - New value
152
- * @returns The button component for chaining
153
- */
154
- setValue: (value: string) => ButtonComponent;
155
-
156
- /**
157
- * Enables the button (removes disabled attribute)
158
- * @returns The button component for chaining
159
- */
160
- enable: () => ButtonComponent;
161
-
162
- /**
163
- * Disables the button (adds disabled attribute)
164
- * @returns The button component for chaining
165
- */
166
- disable: () => ButtonComponent;
167
-
168
- /**
169
- * Sets the button's text content
170
- * @param content - Text content
171
- * @returns The button component for chaining
172
- */
173
- setText: (content: string) => ButtonComponent;
174
-
175
- /**
176
- * Gets the button's text content
177
- * @returns Button text content
178
- */
179
- getText: () => string;
180
-
181
- /**
182
- * Sets the button's icon
183
- * @param icon - Icon HTML content
184
- * @returns The button component for chaining
185
- */
186
- setIcon: (icon: string) => ButtonComponent;
187
-
188
- /**
189
- * Gets the button's icon HTML content
190
- * @returns Icon HTML
191
- */
192
- getIcon: () => string;
193
-
194
- /**
195
- * Sets the accessible name (aria-label) for the button
196
- * @param label - Accessible name
197
- * @returns The button component for chaining
198
- */
199
- setAriaLabel: (label: string) => ButtonComponent;
200
-
201
- /**
202
- * Destroys the button component and cleans up resources
203
- */
204
- destroy: () => void;
205
-
206
- /**
207
- * Updates the button's circular style based on content
208
- * Internal method used when changing content
209
- */
210
- updateCircularStyle: () => void;
211
-
212
- /**
213
- * Adds an event listener to the button
214
- * @param event - Event name ('click', 'focus', etc.)
215
- * @param handler - Event handler function
216
- * @returns The button component for chaining
217
- */
218
- on: (event: string, handler: Function) => ButtonComponent;
219
-
220
- /**
221
- * Removes an event listener from the button
222
- * @param event - Event name
223
- * @param handler - Event handler function
224
- * @returns The button component for chaining
225
- */
226
- off: (event: string, handler: Function) => ButtonComponent;
227
-
228
- /**
229
- * Adds CSS classes to the button element
230
- * @param classes - One or more class names to add
231
- * @returns The button component for chaining
232
- */
233
- addClass: (...classes: string[]) => ButtonComponent;
234
259
  }
@@ -1,7 +1,6 @@
1
1
  // src/components/progress/api.ts
2
2
 
3
3
  import { ProgressComponent } from './types';
4
- import { PROGRESS_EVENTS } from './constants';
5
4
 
6
5
  interface ApiOptions {
7
6
  value: {
@@ -80,7 +79,7 @@ export const withAPI = (options: ApiOptions) =>
80
79
  component.labelElement.textContent = formatter(value, options.value.getMax());
81
80
  }
82
81
 
83
- component.emit(PROGRESS_EVENTS.VALUE_CHANGE, { value });
82
+ component.emit('valueChange', { value });
84
83
  return this;
85
84
  },
86
85
 
@@ -163,7 +162,7 @@ export const withAPI = (options: ApiOptions) =>
163
162
  }
164
163
 
165
164
  if (wasIndeterminate !== indeterminate) {
166
- component.emit(PROGRESS_EVENTS.STATE_CHANGE, { indeterminate });
165
+ component.emit('stateChange', { indeterminate });
167
166
  }
168
167
 
169
168
  return this;
@@ -5,13 +5,12 @@ import {
5
5
  BaseComponentConfig
6
6
  } from '../../core/config/component-config';
7
7
  import { ProgressConfig } from './types';
8
- import { PROGRESS_VARIANTS } from './constants';
9
8
 
10
9
  /**
11
10
  * Default configuration for the Progress component
12
11
  */
13
12
  export const defaultConfig: ProgressConfig = {
14
- variant: PROGRESS_VARIANTS.LINEAR,
13
+ variant: 'linear',
15
14
  value: 0,
16
15
  max: 100,
17
16
  buffer: 0,
@@ -52,7 +51,7 @@ export const getElementConfig = (config: ProgressConfig) => {
52
51
  attrs['aria-disabled'] = 'true';
53
52
  }
54
53
 
55
- const isCircular = config.variant === PROGRESS_VARIANTS.CIRCULAR;
54
+ const isCircular = config.variant === 'circular';
56
55
 
57
56
  return createElementConfig(config, {
58
57
  tag: 'div',
@@ -1,5 +1,4 @@
1
1
  // src/components/progress/index.ts
2
2
 
3
3
  export { default } from './progress';
4
- export { PROGRESS_VARIANTS, PROGRESS_EVENTS } from './constants';
5
4
  export { ProgressConfig, ProgressComponent } from './types';
@@ -11,7 +11,6 @@ import {
11
11
  } from '../../core/compose/features';
12
12
  import { withAPI } from './api';
13
13
  import { ProgressConfig, ProgressComponent } from './types';
14
- import { PROGRESS_VARIANTS, PROGRESS_EVENTS } from './constants';
15
14
  import { createBaseConfig, getElementConfig, getApiConfig } from './config';
16
15
 
17
16
  // Helper functions
@@ -104,7 +103,7 @@ const createProgress = (config: ProgressConfig = {}): ProgressComponent => {
104
103
  // Add DOM structure based on variant
105
104
  (component) => {
106
105
  const baseClass = component.getClass('progress');
107
- const isCircular = baseConfig.variant === PROGRESS_VARIANTS.CIRCULAR;
106
+ const isCircular = baseConfig.variant === 'circular';
108
107
 
109
108
  if (isCircular) {
110
109
  const { track, indicator, svg } = createCircularProgressDOM(baseClass);