mtrl 0.2.6 → 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 (147) hide show
  1. package/index.ts +18 -0
  2. package/package.json +1 -1
  3. package/src/components/badge/_styles.scss +117 -109
  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 -10
  16. package/src/components/button/api.ts +5 -0
  17. package/src/components/button/config.ts +5 -0
  18. package/src/components/button/types.ts +6 -0
  19. package/src/components/card/card.ts +13 -25
  20. package/src/components/card/config.ts +67 -22
  21. package/src/components/card/features.ts +3 -0
  22. package/src/components/card/types.ts +28 -0
  23. package/src/components/checkbox/_styles.scss +0 -2
  24. package/src/components/datepicker/_styles.scss +358 -0
  25. package/src/components/datepicker/api.ts +272 -0
  26. package/src/components/datepicker/config.ts +144 -0
  27. package/src/components/datepicker/constants.ts +98 -0
  28. package/src/components/datepicker/datepicker.ts +346 -0
  29. package/src/components/datepicker/index.ts +9 -0
  30. package/src/components/datepicker/render.ts +452 -0
  31. package/src/components/datepicker/types.ts +268 -0
  32. package/src/components/datepicker/utils.ts +290 -0
  33. package/src/components/dialog/_styles.scss +174 -128
  34. package/src/components/dialog/api.ts +48 -13
  35. package/src/components/dialog/config.ts +9 -5
  36. package/src/components/dialog/dialog.ts +6 -3
  37. package/src/components/dialog/features.ts +290 -130
  38. package/src/components/dialog/types.ts +7 -4
  39. package/src/components/divider/_styles.scss +57 -0
  40. package/src/components/divider/config.ts +81 -0
  41. package/src/components/divider/divider.ts +37 -0
  42. package/src/components/divider/features.ts +207 -0
  43. package/src/components/divider/index.ts +5 -0
  44. package/src/components/divider/types.ts +55 -0
  45. package/src/components/extended-fab/_styles.scss +267 -0
  46. package/src/components/extended-fab/api.ts +141 -0
  47. package/src/components/extended-fab/config.ts +108 -0
  48. package/src/components/extended-fab/constants.ts +36 -0
  49. package/src/components/extended-fab/extended-fab.ts +125 -0
  50. package/src/components/extended-fab/index.ts +4 -0
  51. package/src/components/extended-fab/types.ts +287 -0
  52. package/src/components/fab/_styles.scss +225 -0
  53. package/src/components/fab/api.ts +97 -0
  54. package/src/components/fab/config.ts +94 -0
  55. package/src/components/fab/constants.ts +41 -0
  56. package/src/components/fab/fab.ts +67 -0
  57. package/src/components/fab/index.ts +4 -0
  58. package/src/components/fab/types.ts +234 -0
  59. package/src/components/navigation/_styles.scss +1 -0
  60. package/src/components/navigation/api.ts +78 -50
  61. package/src/components/navigation/features/items.ts +280 -0
  62. package/src/components/navigation/nav-item.ts +72 -23
  63. package/src/components/navigation/navigation.ts +54 -2
  64. package/src/components/navigation/types.ts +210 -188
  65. package/src/components/search/_styles.scss +306 -0
  66. package/src/components/search/api.ts +203 -0
  67. package/src/components/search/config.ts +87 -0
  68. package/src/components/search/constants.ts +21 -0
  69. package/src/components/search/features/index.ts +4 -0
  70. package/src/components/search/features/search.ts +718 -0
  71. package/src/components/search/features/states.ts +165 -0
  72. package/src/components/search/features/structure.ts +198 -0
  73. package/src/components/search/index.ts +10 -0
  74. package/src/components/search/search.ts +52 -0
  75. package/src/components/search/types.ts +163 -0
  76. package/src/components/segmented-button/_styles.scss +117 -0
  77. package/src/components/segmented-button/config.ts +67 -0
  78. package/src/components/segmented-button/constants.ts +42 -0
  79. package/src/components/segmented-button/index.ts +4 -0
  80. package/src/components/segmented-button/segment.ts +155 -0
  81. package/src/components/segmented-button/segmented-button.ts +250 -0
  82. package/src/components/segmented-button/types.ts +219 -0
  83. package/src/components/slider/_styles.scss +83 -24
  84. package/src/components/slider/accessibility.md +5 -5
  85. package/src/components/slider/api.ts +41 -120
  86. package/src/components/slider/config.ts +51 -47
  87. package/src/components/slider/features/handlers.ts +495 -0
  88. package/src/components/slider/features/index.ts +1 -2
  89. package/src/components/slider/features/slider.ts +66 -84
  90. package/src/components/slider/features/states.ts +195 -0
  91. package/src/components/slider/features/structure.ts +136 -206
  92. package/src/components/slider/features/ui.ts +145 -206
  93. package/src/components/slider/index.ts +2 -11
  94. package/src/components/slider/slider.ts +9 -12
  95. package/src/components/slider/types.ts +39 -24
  96. package/src/components/switch/_styles.scss +0 -2
  97. package/src/components/tabs/_styles.scss +94 -32
  98. package/src/components/tabs/features.ts +4 -2
  99. package/src/components/tabs/indicator.ts +73 -13
  100. package/src/components/tabs/types.ts +10 -2
  101. package/src/components/timepicker/README.md +277 -0
  102. package/src/components/timepicker/_styles.scss +451 -0
  103. package/src/components/timepicker/api.ts +632 -0
  104. package/src/components/timepicker/clockdial.ts +482 -0
  105. package/src/components/timepicker/config.ts +130 -0
  106. package/src/components/timepicker/constants.ts +138 -0
  107. package/src/components/timepicker/index.ts +8 -0
  108. package/src/components/timepicker/render.ts +613 -0
  109. package/src/components/timepicker/timepicker.ts +117 -0
  110. package/src/components/timepicker/types.ts +336 -0
  111. package/src/components/timepicker/utils.ts +241 -0
  112. package/src/components/top-app-bar/_styles.scss +225 -0
  113. package/src/components/top-app-bar/config.ts +83 -0
  114. package/src/components/top-app-bar/index.ts +11 -0
  115. package/src/components/top-app-bar/top-app-bar.ts +316 -0
  116. package/src/components/top-app-bar/types.ts +140 -0
  117. package/src/core/build/_ripple.scss +6 -6
  118. package/src/core/build/ripple.ts +72 -95
  119. package/src/core/compose/features/icon.ts +3 -1
  120. package/src/core/compose/features/ripple.ts +4 -1
  121. package/src/core/compose/features/textlabel.ts +26 -2
  122. package/src/core/dom/create.ts +5 -0
  123. package/src/index.ts +9 -0
  124. package/src/styles/abstract/_theme.scss +9 -1
  125. package/src/styles/themes/_autumn.scss +21 -0
  126. package/src/styles/themes/_base-theme.scss +61 -0
  127. package/src/styles/themes/_baseline.scss +58 -0
  128. package/src/styles/themes/_bluekhaki.scss +125 -0
  129. package/src/styles/themes/_brownbeige.scss +125 -0
  130. package/src/styles/themes/_browngreen.scss +125 -0
  131. package/src/styles/themes/_forest.scss +6 -0
  132. package/src/styles/themes/_greenbeige.scss +125 -0
  133. package/src/styles/themes/_material.scss +125 -0
  134. package/src/styles/themes/_ocean.scss +6 -0
  135. package/src/styles/themes/_sageivory.scss +125 -0
  136. package/src/styles/themes/_spring.scss +6 -0
  137. package/src/styles/themes/_summer.scss +5 -0
  138. package/src/styles/themes/_sunset.scss +5 -0
  139. package/src/styles/themes/_tealcaramel.scss +125 -0
  140. package/src/styles/themes/_winter.scss +6 -0
  141. package/src/components/navigation/features/items.js +0 -192
  142. package/src/components/slider/features/appearance.ts +0 -94
  143. package/src/components/slider/features/disabled.ts +0 -68
  144. package/src/components/slider/features/events.ts +0 -164
  145. package/src/components/slider/features/interactions.ts +0 -396
  146. package/src/components/slider/features/keyboard.ts +0 -233
  147. package/src/core/collection/adapters/mongodb.js +0 -232
@@ -1,6 +1,7 @@
1
- // src/components/dialog/api.ts
1
+ // src/components/dialog/api.ts (partial update)
2
2
  import { DialogComponent, DialogEvent, DialogButton, DialogConfirmOptions } from './types';
3
3
  import { DIALOG_SIZES, DIALOG_ANIMATIONS, DIALOG_FOOTER_ALIGNMENTS, DIALOG_EVENTS } from './constants';
4
+ import { removeClass } from '../../core/dom/classes';
4
5
 
5
6
  interface ApiOptions {
6
7
  visibility: {
@@ -33,6 +34,10 @@ interface ApiOptions {
33
34
  size: {
34
35
  setSize: (size: keyof typeof DIALOG_SIZES | DIALOG_SIZES) => void;
35
36
  };
37
+ dividers: {
38
+ toggleHeaderDivider: (show: boolean) => void;
39
+ toggleFooterDivider: (show: boolean) => void;
40
+ };
36
41
  events: {
37
42
  on: (event: string, handler: Function) => void;
38
43
  off: (event: string, handler: Function) => void;
@@ -46,6 +51,7 @@ interface ApiOptions {
46
51
  interface ComponentWithElements {
47
52
  element: HTMLElement;
48
53
  overlay: HTMLElement;
54
+ getClass: (name: string) => string;
49
55
  confirm?: (options: DialogConfirmOptions) => Promise<boolean>;
50
56
  }
51
57
 
@@ -130,7 +136,7 @@ export const withAPI = (options: ApiOptions) =>
130
136
  getSubtitle() {
131
137
  return options.content.getSubtitle();
132
138
  },
133
-
139
+
134
140
  /**
135
141
  * Sets dialog content
136
142
  * @param {string} content - Content HTML
@@ -186,7 +192,25 @@ export const withAPI = (options: ApiOptions) =>
186
192
  options.buttons.setFooterAlignment(alignment);
187
193
  return this;
188
194
  },
195
+
196
+ /**
197
+ * Shows or hides the divider
198
+ * @param {boolean} show - Whether to show the divider
199
+ * @returns {DialogComponent} Dialog component instance for chaining
200
+ */
201
+ toggleDivider(show: boolean) {
202
+ options.divider.toggleDivider(show);
203
+ return this;
204
+ },
189
205
 
206
+ /**
207
+ * Checks if the dialog has a divider
208
+ * @returns {boolean} True if the dialog has a divider
209
+ */
210
+ hasDivider() {
211
+ return options.divider.hasDivider();
212
+ },
213
+
190
214
  /**
191
215
  * Sets dialog size
192
216
  * @param {string} size - Size variant
@@ -261,20 +285,31 @@ export const withAPI = (options: ApiOptions) =>
261
285
  * Destroys the dialog and removes it from DOM
262
286
  */
263
287
  destroy() {
264
- // Close the dialog first
288
+ // Close the dialog first if it's open
289
+ console.log('destroy', this.isOpen());
265
290
  if (this.isOpen()) {
266
- this.close();
267
- }
268
-
269
- // Small delay to allow animations to complete
270
- setTimeout(() => {
271
- options.lifecycle.destroy();
291
+ // We'll handle removal directly rather than calling this.close()
292
+ // to avoid animation delay in critical cleanup
293
+ const dialogVisibleClass = `${component.getClass('dialog')}--visible`;
294
+ const overlayVisibleClass = `${component.getClass('dialog-overlay')}--visible`;
272
295
 
273
- // Remove the overlay from DOM
274
- if (component.overlay && component.overlay.parentNode) {
275
- component.overlay.parentNode.removeChild(component.overlay);
296
+ // Remove visibility classes using core utilities
297
+ removeClass(component.element, dialogVisibleClass);
298
+ removeClass(component.overlay, overlayVisibleClass);
299
+
300
+ // Call any cleanup needed
301
+ if (options.focus && options.focus.releaseFocus) {
302
+ options.focus.releaseFocus();
276
303
  }
277
- }, 150);
304
+ }
305
+
306
+ // Call lifecycle destroy
307
+ options.lifecycle.destroy();
308
+
309
+ // Immediately remove from DOM
310
+ if (component.overlay && component.overlay.parentNode) {
311
+ component.overlay.parentNode.removeChild(component.overlay);
312
+ }
278
313
  },
279
314
 
280
315
  // Pass through element references
@@ -20,8 +20,7 @@ export const defaultConfig: DialogConfig = {
20
20
  modal: true,
21
21
  autofocus: true,
22
22
  trapFocus: true,
23
- headerDivider: false,
24
- footerDivider: false,
23
+ divider: false, // Default to no divider
25
24
  animationDuration: 150,
26
25
  buttons: []
27
26
  };
@@ -100,10 +99,15 @@ export const getApiConfig = (comp) => ({
100
99
  size: {
101
100
  setSize: (size) => comp.size.setSize(size)
102
101
  },
102
+ divider: {
103
+ toggleDivider: (show) => comp.divider.toggleDivider(show),
104
+ hasDivider: () => comp.divider.hasDivider()
105
+ },
103
106
  events: {
104
- on: (event, handler) => comp.events.on(event, handler),
105
- off: (event, handler) => comp.events.off(event, handler),
106
- trigger: (event, data) => comp.events.trigger(event, data)
107
+ // Use the direct component methods from withEvents()
108
+ on: (event, handler) => comp.on(event, handler),
109
+ off: (event, handler) => comp.off(event, handler),
110
+ trigger: (event, data) => comp.emit(event, data)
107
111
  },
108
112
  lifecycle: {
109
113
  destroy: () => comp.lifecycle.destroy()
@@ -8,7 +8,8 @@ import {
8
8
  withContent,
9
9
  withButtons,
10
10
  withSize,
11
- withConfirm
11
+ withConfirm,
12
+ withDivider // Simplified to single divider feature
12
13
  } from './features';
13
14
  import { withAPI } from './api';
14
15
  import { DialogConfig, DialogComponent } from './types';
@@ -23,15 +24,17 @@ const createDialog = (config: DialogConfig = {}): DialogComponent => {
23
24
  const baseConfig = createBaseConfig(config);
24
25
 
25
26
  try {
27
+ // Maintain original order but setup event-based communication
26
28
  const dialog = pipe(
27
29
  createBase,
28
30
  withEvents(),
29
31
  withElement(getElementConfig(baseConfig)),
30
- withStructure(baseConfig),
31
- withVisibility(),
32
+ withStructure(baseConfig), // Keep structure first to create overlay
33
+ withVisibility(), // Then add visibility features
32
34
  withContent(),
33
35
  withButtons(),
34
36
  withSize(),
37
+ withDivider(), // Simplified divider feature
35
38
  withConfirm(),
36
39
  withLifecycle(),
37
40
  comp => withAPI(getApiConfig(comp))(comp)