mtrl 0.2.5 → 0.2.7

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 (196) hide show
  1. package/index.ts +18 -0
  2. package/package.json +1 -1
  3. package/src/components/badge/_styles.scss +123 -115
  4. package/src/components/badge/api.ts +57 -59
  5. package/src/components/badge/badge.ts +16 -2
  6. package/src/components/badge/config.ts +65 -11
  7. package/src/components/badge/constants.ts +22 -12
  8. package/src/components/badge/features.ts +44 -40
  9. package/src/components/badge/types.ts +42 -30
  10. package/src/components/bottom-app-bar/_styles.scss +103 -0
  11. package/src/components/bottom-app-bar/bottom-app-bar.ts +196 -0
  12. package/src/components/bottom-app-bar/config.ts +73 -0
  13. package/src/components/bottom-app-bar/index.ts +11 -0
  14. package/src/components/bottom-app-bar/types.ts +108 -0
  15. package/src/components/button/_styles.scss +0 -66
  16. package/src/components/button/api.ts +5 -0
  17. package/src/components/button/button.ts +0 -2
  18. package/src/components/button/config.ts +5 -0
  19. package/src/components/button/constants.ts +0 -6
  20. package/src/components/button/index.ts +2 -2
  21. package/src/components/button/types.ts +7 -7
  22. package/src/components/card/_styles.scss +67 -25
  23. package/src/components/card/api.ts +54 -3
  24. package/src/components/card/card.ts +25 -6
  25. package/src/components/card/config.ts +189 -22
  26. package/src/components/card/constants.ts +20 -19
  27. package/src/components/card/content.ts +299 -2
  28. package/src/components/card/features.ts +158 -4
  29. package/src/components/card/index.ts +31 -9
  30. package/src/components/card/types.ts +166 -15
  31. package/src/components/checkbox/_styles.scss +0 -2
  32. package/src/components/chip/chip.ts +1 -9
  33. package/src/components/chip/constants.ts +0 -10
  34. package/src/components/chip/index.ts +1 -1
  35. package/src/components/chip/types.ts +1 -4
  36. package/src/components/datepicker/_styles.scss +358 -0
  37. package/src/components/datepicker/api.ts +272 -0
  38. package/src/components/datepicker/config.ts +144 -0
  39. package/src/components/datepicker/constants.ts +98 -0
  40. package/src/components/datepicker/datepicker.ts +346 -0
  41. package/src/components/datepicker/index.ts +9 -0
  42. package/src/components/datepicker/render.ts +452 -0
  43. package/src/components/datepicker/types.ts +268 -0
  44. package/src/components/datepicker/utils.ts +290 -0
  45. package/src/components/dialog/_styles.scss +174 -128
  46. package/src/components/dialog/api.ts +48 -13
  47. package/src/components/dialog/config.ts +9 -5
  48. package/src/components/dialog/dialog.ts +6 -3
  49. package/src/components/dialog/features.ts +290 -130
  50. package/src/components/dialog/types.ts +7 -4
  51. package/src/components/divider/_styles.scss +57 -0
  52. package/src/components/divider/config.ts +81 -0
  53. package/src/components/divider/divider.ts +37 -0
  54. package/src/components/divider/features.ts +207 -0
  55. package/src/components/divider/index.ts +5 -0
  56. package/src/components/divider/types.ts +55 -0
  57. package/src/components/extended-fab/_styles.scss +267 -0
  58. package/src/components/extended-fab/api.ts +141 -0
  59. package/src/components/extended-fab/config.ts +108 -0
  60. package/src/components/extended-fab/constants.ts +36 -0
  61. package/src/components/extended-fab/extended-fab.ts +125 -0
  62. package/src/components/extended-fab/index.ts +4 -0
  63. package/src/components/extended-fab/types.ts +287 -0
  64. package/src/components/fab/_styles.scss +225 -0
  65. package/src/components/fab/api.ts +97 -0
  66. package/src/components/fab/config.ts +94 -0
  67. package/src/components/fab/constants.ts +41 -0
  68. package/src/components/fab/fab.ts +67 -0
  69. package/src/components/fab/index.ts +4 -0
  70. package/src/components/fab/types.ts +234 -0
  71. package/src/components/navigation/_styles.scss +1 -0
  72. package/src/components/navigation/api.ts +78 -50
  73. package/src/components/navigation/features/items.ts +280 -0
  74. package/src/components/navigation/nav-item.ts +72 -23
  75. package/src/components/navigation/navigation.ts +54 -2
  76. package/src/components/navigation/types.ts +210 -188
  77. package/src/components/progress/_styles.scss +0 -65
  78. package/src/components/progress/config.ts +1 -2
  79. package/src/components/progress/constants.ts +0 -14
  80. package/src/components/progress/index.ts +1 -1
  81. package/src/components/progress/progress.ts +1 -4
  82. package/src/components/progress/types.ts +1 -4
  83. package/src/components/radios/_styles.scss +0 -45
  84. package/src/components/radios/api.ts +85 -60
  85. package/src/components/radios/config.ts +1 -2
  86. package/src/components/radios/constants.ts +0 -9
  87. package/src/components/radios/index.ts +1 -1
  88. package/src/components/radios/radio.ts +34 -11
  89. package/src/components/radios/radios.ts +2 -1
  90. package/src/components/radios/types.ts +1 -7
  91. package/src/components/search/_styles.scss +306 -0
  92. package/src/components/search/api.ts +203 -0
  93. package/src/components/search/config.ts +87 -0
  94. package/src/components/search/constants.ts +21 -0
  95. package/src/components/search/features/index.ts +4 -0
  96. package/src/components/search/features/search.ts +718 -0
  97. package/src/components/search/features/states.ts +165 -0
  98. package/src/components/search/features/structure.ts +198 -0
  99. package/src/components/search/index.ts +10 -0
  100. package/src/components/search/search.ts +52 -0
  101. package/src/components/search/types.ts +163 -0
  102. package/src/components/segmented-button/_styles.scss +117 -0
  103. package/src/components/segmented-button/config.ts +67 -0
  104. package/src/components/segmented-button/constants.ts +42 -0
  105. package/src/components/segmented-button/index.ts +4 -0
  106. package/src/components/segmented-button/segment.ts +155 -0
  107. package/src/components/segmented-button/segmented-button.ts +250 -0
  108. package/src/components/segmented-button/types.ts +219 -0
  109. package/src/components/slider/_styles.scss +221 -168
  110. package/src/components/slider/accessibility.md +59 -0
  111. package/src/components/slider/api.ts +41 -120
  112. package/src/components/slider/config.ts +51 -49
  113. package/src/components/slider/features/handlers.ts +495 -0
  114. package/src/components/slider/features/index.ts +1 -2
  115. package/src/components/slider/features/slider.ts +66 -84
  116. package/src/components/slider/features/states.ts +195 -0
  117. package/src/components/slider/features/structure.ts +141 -184
  118. package/src/components/slider/features/ui.ts +150 -201
  119. package/src/components/slider/index.ts +2 -11
  120. package/src/components/slider/slider.ts +9 -12
  121. package/src/components/slider/types.ts +39 -24
  122. package/src/components/switch/_styles.scss +0 -2
  123. package/src/components/tabs/_styles.scss +346 -154
  124. package/src/components/tabs/api.ts +178 -400
  125. package/src/components/tabs/config.ts +46 -52
  126. package/src/components/tabs/constants.ts +85 -8
  127. package/src/components/tabs/features.ts +403 -0
  128. package/src/components/tabs/index.ts +60 -3
  129. package/src/components/tabs/indicator.ts +285 -0
  130. package/src/components/tabs/responsive.ts +144 -0
  131. package/src/components/tabs/scroll-indicators.ts +149 -0
  132. package/src/components/tabs/state.ts +186 -0
  133. package/src/components/tabs/tab-api.ts +258 -0
  134. package/src/components/tabs/tab.ts +255 -0
  135. package/src/components/tabs/tabs.ts +50 -31
  136. package/src/components/tabs/types.ts +332 -128
  137. package/src/components/tabs/utils.ts +107 -0
  138. package/src/components/textfield/_styles.scss +0 -98
  139. package/src/components/textfield/config.ts +2 -3
  140. package/src/components/textfield/constants.ts +0 -14
  141. package/src/components/textfield/index.ts +2 -2
  142. package/src/components/textfield/textfield.ts +0 -2
  143. package/src/components/textfield/types.ts +1 -4
  144. package/src/components/timepicker/README.md +277 -0
  145. package/src/components/timepicker/_styles.scss +451 -0
  146. package/src/components/timepicker/api.ts +632 -0
  147. package/src/components/timepicker/clockdial.ts +482 -0
  148. package/src/components/timepicker/config.ts +130 -0
  149. package/src/components/timepicker/constants.ts +138 -0
  150. package/src/components/timepicker/index.ts +8 -0
  151. package/src/components/timepicker/render.ts +613 -0
  152. package/src/components/timepicker/timepicker.ts +117 -0
  153. package/src/components/timepicker/types.ts +336 -0
  154. package/src/components/timepicker/utils.ts +241 -0
  155. package/src/components/top-app-bar/_styles.scss +225 -0
  156. package/src/components/top-app-bar/config.ts +83 -0
  157. package/src/components/top-app-bar/index.ts +11 -0
  158. package/src/components/top-app-bar/top-app-bar.ts +316 -0
  159. package/src/components/top-app-bar/types.ts +140 -0
  160. package/src/core/build/_ripple.scss +6 -6
  161. package/src/core/build/ripple.ts +72 -95
  162. package/src/core/compose/component.ts +1 -1
  163. package/src/core/compose/features/badge.ts +79 -0
  164. package/src/core/compose/features/icon.ts +3 -1
  165. package/src/core/compose/features/index.ts +3 -1
  166. package/src/core/compose/features/ripple.ts +4 -1
  167. package/src/core/compose/features/textlabel.ts +26 -2
  168. package/src/core/dom/create.ts +5 -0
  169. package/src/index.ts +9 -0
  170. package/src/styles/abstract/_theme.scss +115 -3
  171. package/src/styles/themes/_autumn.scss +21 -0
  172. package/src/styles/themes/_base-theme.scss +61 -0
  173. package/src/styles/themes/_baseline.scss +58 -0
  174. package/src/styles/themes/_bluekhaki.scss +125 -0
  175. package/src/styles/themes/_brownbeige.scss +125 -0
  176. package/src/styles/themes/_browngreen.scss +125 -0
  177. package/src/styles/themes/_forest.scss +6 -0
  178. package/src/styles/themes/_greenbeige.scss +125 -0
  179. package/src/styles/themes/_material.scss +125 -0
  180. package/src/styles/themes/_ocean.scss +6 -0
  181. package/src/styles/themes/_sageivory.scss +125 -0
  182. package/src/styles/themes/_spring.scss +6 -0
  183. package/src/styles/themes/_summer.scss +5 -0
  184. package/src/styles/themes/_sunset.scss +5 -0
  185. package/src/styles/themes/_tealcaramel.scss +125 -0
  186. package/src/styles/themes/_winter.scss +6 -0
  187. package/src/components/card/actions.ts +0 -48
  188. package/src/components/card/header.ts +0 -88
  189. package/src/components/card/media.ts +0 -52
  190. package/src/components/navigation/features/items.js +0 -192
  191. package/src/components/slider/features/appearance.ts +0 -94
  192. package/src/components/slider/features/disabled.ts +0 -43
  193. package/src/components/slider/features/events.ts +0 -164
  194. package/src/components/slider/features/interactions.ts +0 -261
  195. package/src/components/slider/features/keyboard.ts +0 -112
  196. package/src/core/collection/adapters/mongodb.js +0 -232
@@ -0,0 +1,196 @@
1
+ // src/components/bottom-app-bar/bottom-app-bar.ts
2
+ /**
3
+ * @module components/bottom-app-bar
4
+ * @description Bottom app bar implementation
5
+ */
6
+
7
+ import {
8
+ createBase,
9
+ withElement,
10
+ withEvents,
11
+ withLifecycle,
12
+ ElementComponent,
13
+ BaseComponent
14
+ } from '../../core/compose';
15
+
16
+ import { createConfig, BottomAppBarConfig } from './config';
17
+
18
+ /**
19
+ * Bottom app bar component interface
20
+ */
21
+ export interface BottomAppBar extends ElementComponent {
22
+ /**
23
+ * Adds an action button to the bottom bar
24
+ * @param {HTMLElement} button - Button element to add
25
+ * @returns {BottomAppBar} BottomAppBar instance for chaining
26
+ */
27
+ addAction: (button: HTMLElement) => BottomAppBar;
28
+
29
+ /**
30
+ * Adds a floating action button to the bottom bar
31
+ * @param {HTMLElement} fab - FAB element to add
32
+ * @returns {BottomAppBar} BottomAppBar instance for chaining
33
+ */
34
+ addFab: (fab: HTMLElement) => BottomAppBar;
35
+
36
+ /**
37
+ * Shows the bottom bar
38
+ * @returns {BottomAppBar} BottomAppBar instance for chaining
39
+ */
40
+ show: () => BottomAppBar;
41
+
42
+ /**
43
+ * Hides the bottom bar
44
+ * @returns {BottomAppBar} BottomAppBar instance for chaining
45
+ */
46
+ hide: () => BottomAppBar;
47
+
48
+ /**
49
+ * Checks if the bottom bar is visible
50
+ * @returns {boolean} Whether the bottom bar is visible
51
+ */
52
+ isVisible: () => boolean;
53
+
54
+ /**
55
+ * Get the actions container element
56
+ * @returns {HTMLElement} Actions container element
57
+ */
58
+ getActionsContainer: () => HTMLElement;
59
+ }
60
+
61
+ /**
62
+ * Creates a bottom app bar component
63
+ *
64
+ * @param {BottomAppBarConfig} config - Configuration options
65
+ * @returns {BottomAppBar} Bottom app bar component instance
66
+ */
67
+ export const createBottomAppBar = (config: BottomAppBarConfig = {}): BottomAppBar => {
68
+ // Process configuration with defaults
69
+ const componentConfig = createConfig(config);
70
+
71
+ // Create base component
72
+ const component = createBase(componentConfig);
73
+
74
+ // Create actions container
75
+ const actionsContainer = document.createElement('div');
76
+ actionsContainer.className = `${component.getClass('bottom-app-bar')}-actions`;
77
+
78
+ // FAB container for proper positioning
79
+ const fabContainer = document.createElement('div');
80
+ fabContainer.className = `${component.getClass('bottom-app-bar')}-fab-container`;
81
+
82
+ // Apply Element enhancer
83
+ const enhancedComponent = withElement({
84
+ tag: componentConfig.tag,
85
+ componentName: 'bottom-app-bar',
86
+ className: [
87
+ componentConfig.hasFab ? `${component.getClass('bottom-app-bar')}--with-fab` : '',
88
+ componentConfig.fabPosition === 'center' ? `${component.getClass('bottom-app-bar')}--fab-center` : '',
89
+ componentConfig.class
90
+ ],
91
+ attrs: {
92
+ role: 'toolbar',
93
+ 'aria-label': 'Bottom app bar'
94
+ },
95
+ interactive: true
96
+ })(component);
97
+
98
+ // Apply events enhancer for component events
99
+ const withEventsComponent = withEvents()(enhancedComponent);
100
+
101
+ // Apply lifecycle enhancer for cleanup
102
+ const withLifecycleComponent = withLifecycle()(withEventsComponent);
103
+
104
+ // Append actions and FAB containers to the main element
105
+ withLifecycleComponent.element.appendChild(actionsContainer);
106
+ withLifecycleComponent.element.appendChild(fabContainer);
107
+
108
+ // Flag to track visibility
109
+ let isVisible = true;
110
+
111
+ // Previous scroll position for determining scroll direction
112
+ let prevScrollY = window.scrollY;
113
+
114
+ // Handle scrolling behavior if autoHide is enabled
115
+ if (componentConfig.autoHide) {
116
+ const handleScroll = () => {
117
+ const currentScrollY = window.scrollY;
118
+
119
+ // Determine scroll direction
120
+ if (currentScrollY > prevScrollY + 10) {
121
+ // Scrolling down - hide the bottom bar
122
+ if (isVisible) {
123
+ bottomBar.hide();
124
+ componentConfig.onVisibilityChange?.(false);
125
+ }
126
+ } else if (currentScrollY < prevScrollY - 10) {
127
+ // Scrolling up - show the bottom bar
128
+ if (!isVisible) {
129
+ bottomBar.show();
130
+ componentConfig.onVisibilityChange?.(true);
131
+ }
132
+ }
133
+
134
+ prevScrollY = currentScrollY;
135
+ };
136
+
137
+ // Add scroll event listener
138
+ window.addEventListener('scroll', handleScroll, { passive: true });
139
+
140
+ // Clean up event listener on destroy
141
+ const originalDestroy = withLifecycleComponent.lifecycle.destroy;
142
+ withLifecycleComponent.lifecycle.destroy = () => {
143
+ window.removeEventListener('scroll', handleScroll);
144
+ originalDestroy();
145
+ };
146
+ }
147
+
148
+ const bottomBar: BottomAppBar = {
149
+ ...withLifecycleComponent,
150
+
151
+ addAction(button: HTMLElement) {
152
+ actionsContainer.appendChild(button);
153
+ return this;
154
+ },
155
+
156
+ addFab(fab: HTMLElement) {
157
+ // Clear existing FAB if any
158
+ fabContainer.innerHTML = '';
159
+
160
+ // Add the new FAB
161
+ fabContainer.appendChild(fab);
162
+
163
+ // Update component class to indicate it has a FAB
164
+ this.element.classList.add(`${component.getClass('bottom-app-bar')}--with-fab`);
165
+
166
+ return this;
167
+ },
168
+
169
+ show() {
170
+ this.element.classList.remove(`${component.getClass('bottom-app-bar')}--hidden`);
171
+ isVisible = true;
172
+ return this;
173
+ },
174
+
175
+ hide() {
176
+ this.element.classList.add(`${component.getClass('bottom-app-bar')}--hidden`);
177
+ isVisible = false;
178
+ return this;
179
+ },
180
+
181
+ isVisible() {
182
+ return isVisible;
183
+ },
184
+
185
+ getActionsContainer() {
186
+ return actionsContainer;
187
+ }
188
+ };
189
+
190
+ // Set the appropriate styles for transitions if needed
191
+ if (componentConfig.autoHide && componentConfig.transitionDuration) {
192
+ bottomBar.element.style.transition = `transform ${componentConfig.transitionDuration}ms ease-in-out`;
193
+ }
194
+
195
+ return bottomBar;
196
+ };
@@ -0,0 +1,73 @@
1
+ // src/components/bottom-app-bar/config.ts
2
+ /**
3
+ * @module components/bottom-app-bar
4
+ * @description Configuration for bottom app bar component
5
+ */
6
+
7
+ import { createComponentConfig, BaseComponentConfig } from '../../core/config/component-config';
8
+ import { PREFIX } from '../../core/config';
9
+
10
+ /**
11
+ * Configuration options for bottom app bar
12
+ */
13
+ export interface BottomAppBarConfig extends BaseComponentConfig {
14
+ /**
15
+ * Element to use for the container
16
+ * @default 'div'
17
+ */
18
+ tag?: string;
19
+
20
+ /**
21
+ * Whether to show FAB in the bottom bar
22
+ * @default false
23
+ */
24
+ hasFab?: boolean;
25
+
26
+ /**
27
+ * FAB position in bottom bar
28
+ * @default 'end'
29
+ */
30
+ fabPosition?: 'center' | 'end';
31
+
32
+ /**
33
+ * Additional CSS classes to apply
34
+ */
35
+ class?: string;
36
+
37
+ /**
38
+ * Whether to enable auto-hide on scroll
39
+ * @default false
40
+ */
41
+ autoHide?: boolean;
42
+
43
+ /**
44
+ * Transition duration for show/hide in ms
45
+ * @default 300
46
+ */
47
+ transitionDuration?: number;
48
+
49
+ /**
50
+ * Optional callback when scrolling shows/hides the bar
51
+ */
52
+ onVisibilityChange?: (visible: boolean) => void;
53
+ }
54
+
55
+ /**
56
+ * Default configuration for bottom app bar
57
+ */
58
+ export const defaultConfig: Partial<BottomAppBarConfig> = {
59
+ tag: 'div',
60
+ hasFab: false,
61
+ fabPosition: 'end',
62
+ autoHide: false,
63
+ transitionDuration: 300
64
+ };
65
+
66
+ /**
67
+ * Creates the configuration for a bottom app bar component
68
+ *
69
+ * @param {BottomAppBarConfig} config - User provided configuration
70
+ * @returns {BottomAppBarConfig} Complete configuration with defaults applied
71
+ */
72
+ export const createConfig = (config: BottomAppBarConfig = {} as BottomAppBarConfig): BottomAppBarConfig =>
73
+ createComponentConfig(defaultConfig, config, 'bottom-app-bar') as BottomAppBarConfig;
@@ -0,0 +1,11 @@
1
+ // src/components/bottom-app-bar/index.ts
2
+ /**
3
+ * @module components/bottom-app-bar
4
+ * @description Bottom app bar component for mobile interfaces
5
+ */
6
+
7
+ import { createBottomAppBar } from './bottom-app-bar';
8
+
9
+ export default createBottomAppBar;
10
+ export { createBottomAppBar };
11
+ export type { BottomAppBarConfig } from './config';
@@ -0,0 +1,108 @@
1
+ // src/components/bottom-app-bar/types.ts
2
+ /**
3
+ * @module components/bottom-app-bar
4
+ * @description Type definitions for Bottom App Bar component
5
+ */
6
+
7
+ import { ElementComponent } from '../../core/compose';
8
+
9
+ /**
10
+ * Configuration options for Bottom App Bar component
11
+ * @category Components
12
+ */
13
+ export interface BottomAppBarConfig {
14
+ /**
15
+ * Element to use for the container
16
+ * @default 'div'
17
+ */
18
+ tag?: string;
19
+
20
+ /**
21
+ * Whether to show FAB in the bottom bar
22
+ * @default false
23
+ */
24
+ hasFab?: boolean;
25
+
26
+ /**
27
+ * FAB position in bottom bar
28
+ * @default 'end'
29
+ */
30
+ fabPosition?: 'center' | 'end';
31
+
32
+ /**
33
+ * Additional CSS classes to apply
34
+ */
35
+ class?: string;
36
+
37
+ /**
38
+ * Whether to enable auto-hide on scroll
39
+ * @default false
40
+ */
41
+ autoHide?: boolean;
42
+
43
+ /**
44
+ * Transition duration for show/hide in ms
45
+ * @default 300
46
+ */
47
+ transitionDuration?: number;
48
+
49
+ /**
50
+ * Optional callback when scrolling shows/hides the bar
51
+ */
52
+ onVisibilityChange?: (visible: boolean) => void;
53
+
54
+ /**
55
+ * Component prefix for class names
56
+ * @default 'mtrl'
57
+ */
58
+ prefix?: string;
59
+
60
+ /**
61
+ * Component name for class generation
62
+ */
63
+ componentName?: string;
64
+ }
65
+
66
+ /**
67
+ * Bottom App Bar component interface
68
+ * @category Components
69
+ */
70
+ export interface BottomAppBar extends ElementComponent {
71
+ /**
72
+ * Adds an action button to the bottom bar
73
+ * @param {HTMLElement} button - Button element to add
74
+ * @returns {BottomAppBar} BottomAppBar instance for chaining
75
+ */
76
+ addAction: (button: HTMLElement) => BottomAppBar;
77
+
78
+ /**
79
+ * Adds a floating action button to the bottom bar
80
+ * @param {HTMLElement} fab - FAB element to add
81
+ * @returns {BottomAppBar} BottomAppBar instance for chaining
82
+ */
83
+ addFab: (fab: HTMLElement) => BottomAppBar;
84
+
85
+ /**
86
+ * Shows the bottom bar
87
+ * @returns {BottomAppBar} BottomAppBar instance for chaining
88
+ */
89
+ show: () => BottomAppBar;
90
+
91
+ /**
92
+ * Hides the bottom bar
93
+ * @returns {BottomAppBar} BottomAppBar instance for chaining
94
+ */
95
+ hide: () => BottomAppBar;
96
+
97
+ /**
98
+ * Checks if the bottom bar is visible
99
+ * @returns {boolean} Whether the bottom bar is visible
100
+ */
101
+ isVisible: () => boolean;
102
+
103
+ /**
104
+ * Get the actions container element
105
+ * @returns {HTMLElement} Actions container element
106
+ */
107
+ getActionsContainer: () => HTMLElement;
108
+ }
@@ -8,7 +8,6 @@
8
8
  $component: '#{base.$prefix}-button';
9
9
 
10
10
  .#{$component} {
11
- // @include m.touch-target;
12
11
  // Base styles
13
12
  position: relative;
14
13
  display: inline-flex;
@@ -95,31 +94,10 @@ $component: '#{base.$prefix}-button';
95
94
  .#{$component}-icon {
96
95
  margin: 0;
97
96
  }
98
-
99
- .#{$component}--small {
100
- width: 32px;
101
- height: 32px;
102
- }
103
-
104
- .#{$component}--large {
105
- width: 48px;
106
- height: 48px;
107
- }
108
- }
109
-
110
- // Ripple container
111
- .ripple {
112
- position: absolute;
113
- border-radius: 50%;
114
- transform: scale(0);
115
- pointer-events: none;
116
- background-color: currentColor;
117
- opacity: 0.12;
118
97
  }
119
98
 
120
99
  &--disabled {
121
100
  opacity: 0.38
122
-
123
101
  }
124
102
 
125
103
  // Variants
@@ -136,11 +114,6 @@ $component: '#{base.$prefix}-button';
136
114
  @include m.state-layer(t.color('on-primary'), 'pressed');
137
115
  @include m.elevation(0);
138
116
  }
139
-
140
- // &:disabled {
141
- // background-color: t.alpha('on-surface', 0.12);
142
- // color: t.alpha('on-surface', 0.38);
143
- // }
144
117
  }
145
118
 
146
119
  // Elevated button variant
@@ -170,10 +143,6 @@ $component: '#{base.$prefix}-button';
170
143
  .#{$component}-icon {
171
144
  color: t.color('primary');
172
145
  }
173
-
174
- // &:disabled .#{$component}-icon {
175
- // color: t.alpha('on-surface', 0.38);
176
- // }
177
146
  }
178
147
 
179
148
  &--tonal {
@@ -189,11 +158,6 @@ $component: '#{base.$prefix}-button';
189
158
  @include m.state-layer(t.color('on-secondary-container'), 'pressed');
190
159
  @include m.elevation(0);
191
160
  }
192
-
193
- // &:disabled {
194
- // background-color: t.alpha('on-surface', 0.12);
195
- // color: t.alpha('on-surface', 0.38);
196
- // }
197
161
  }
198
162
 
199
163
  &--outlined {
@@ -208,11 +172,6 @@ $component: '#{base.$prefix}-button';
208
172
  &:active {
209
173
  @include m.state-layer(t.color('primary'), 'pressed');
210
174
  }
211
-
212
- // &:disabled {
213
- // border-color: t.alpha('on-surface', 0.12);
214
- // color: t.alpha('on-surface', 0.38);
215
- // }
216
175
  }
217
176
 
218
177
  &--text {
@@ -233,36 +192,11 @@ $component: '#{base.$prefix}-button';
233
192
  }
234
193
  }
235
194
 
236
- // Size variants
237
- &--small {
238
- height: 32px;
239
- min-width: 48px;
240
- padding: 0 v.button('padding-horizontal-small');
241
- font-size: 13px;
242
- }
243
-
244
- &--large {
245
- height: 48px;
246
- min-width: 78px;
247
- padding: 0 32px;
248
- font-size: 16px;
249
- }
250
-
251
195
  // Special case for icon-only buttons
252
196
  &--icon-only {
253
197
  min-width: v.button('height');
254
198
  width: v.button('height');
255
199
  padding: 0;
256
200
  border-radius: 50%;
257
-
258
- &.#{$component}--small {
259
- min-width: 32px;
260
- width: 32px;
261
- }
262
-
263
- &.#{$component}--large {
264
- min-width: 48px;
265
- width: 48px;
266
- }
267
201
  }
268
202
  }
@@ -73,6 +73,11 @@ export const withAPI = ({ disabled, lifecycle }: ApiOptions) =>
73
73
  getIcon() {
74
74
  return component.icon.getIcon();
75
75
  },
76
+
77
+ setAriaLabel(label: string) {
78
+ component.element.setAttribute('aria-label', label);
79
+ return this;
80
+ },
76
81
 
77
82
  destroy() {
78
83
  lifecycle.destroy();
@@ -7,7 +7,6 @@ import {
7
7
  withText,
8
8
  withIcon,
9
9
  withVariant,
10
- withSize,
11
10
  withRipple,
12
11
  withDisabled,
13
12
  withLifecycle
@@ -31,7 +30,6 @@ const createButton = (config: ButtonConfig = {}) => {
31
30
  withEvents(),
32
31
  withElement(getElementConfig(baseConfig)),
33
32
  withVariant(baseConfig),
34
- withSize(baseConfig),
35
33
  withText(baseConfig),
36
34
  withIcon(baseConfig),
37
35
  withDisabled(baseConfig),
@@ -45,6 +45,11 @@ export const getElementConfig = (config: ButtonConfig) => {
45
45
  attrs.value = config.value;
46
46
  }
47
47
 
48
+ // Add aria-label attribute for accessibility
49
+ if (config.ariaLabel) {
50
+ attrs['aria-label'] = config.ariaLabel;
51
+ }
52
+
48
53
  return createElementConfig(config, {
49
54
  tag: 'button',
50
55
  attrs,
@@ -8,10 +8,4 @@ export const BUTTON_VARIANTS = {
8
8
  OUTLINED: 'outlined',
9
9
  ELEVATED: 'elevated',
10
10
  TEXT: 'text'
11
- }
12
-
13
- export const BUTTON_SIZES = {
14
- SMALL: 'small',
15
- MEDIUM: 'medium',
16
- LARGE: 'large'
17
11
  }
@@ -1,4 +1,4 @@
1
1
  // src/components/button/index.ts
2
2
  export { default } from './button'
3
- export { BUTTON_VARIANTS, BUTTON_SIZES } from './constants'
4
- export { ButtonConfig, ButtonComponent } from './types'
3
+ export { BUTTON_VARIANTS } from './constants'
4
+ export { ButtonConfig, ButtonComponent } from './types'
@@ -1,5 +1,5 @@
1
1
  // src/components/button/types.ts
2
- import { BUTTON_VARIANTS, BUTTON_SIZES } from './constants';
2
+ import { BUTTON_VARIANTS } from './constants';
3
3
 
4
4
  /**
5
5
  * Configuration interface for the Button component
@@ -12,12 +12,6 @@ export interface ButtonConfig {
12
12
  */
13
13
  variant?: keyof typeof BUTTON_VARIANTS | string;
14
14
 
15
- /**
16
- * Button size
17
- * @default 'medium'
18
- */
19
- size?: keyof typeof BUTTON_SIZES | string;
20
-
21
15
  /**
22
16
  * Whether the button is initially disabled
23
17
  * @default false
@@ -87,6 +81,12 @@ export interface ButtonConfig {
87
81
  /** Opacity values for ripple start and end [start, end] */
88
82
  opacity?: [string, string];
89
83
  };
84
+
85
+ /**
86
+ * Accessible name for the button (aria-label)
87
+ * Required for icon-only buttons without text
88
+ */
89
+ ariaLabel?: string;
90
90
  }
91
91
 
92
92
  /**