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.
- package/index.ts +18 -0
- package/package.json +1 -1
- package/src/components/badge/_styles.scss +123 -115
- package/src/components/badge/api.ts +57 -59
- package/src/components/badge/badge.ts +16 -2
- package/src/components/badge/config.ts +65 -11
- package/src/components/badge/constants.ts +22 -12
- package/src/components/badge/features.ts +44 -40
- package/src/components/badge/types.ts +42 -30
- package/src/components/bottom-app-bar/_styles.scss +103 -0
- package/src/components/bottom-app-bar/bottom-app-bar.ts +196 -0
- package/src/components/bottom-app-bar/config.ts +73 -0
- package/src/components/bottom-app-bar/index.ts +11 -0
- package/src/components/bottom-app-bar/types.ts +108 -0
- package/src/components/button/_styles.scss +0 -66
- package/src/components/button/api.ts +5 -0
- package/src/components/button/button.ts +0 -2
- package/src/components/button/config.ts +5 -0
- package/src/components/button/constants.ts +0 -6
- package/src/components/button/index.ts +2 -2
- package/src/components/button/types.ts +7 -7
- package/src/components/card/_styles.scss +67 -25
- package/src/components/card/api.ts +54 -3
- package/src/components/card/card.ts +25 -6
- package/src/components/card/config.ts +189 -22
- package/src/components/card/constants.ts +20 -19
- package/src/components/card/content.ts +299 -2
- package/src/components/card/features.ts +158 -4
- package/src/components/card/index.ts +31 -9
- package/src/components/card/types.ts +166 -15
- package/src/components/checkbox/_styles.scss +0 -2
- package/src/components/chip/chip.ts +1 -9
- package/src/components/chip/constants.ts +0 -10
- package/src/components/chip/index.ts +1 -1
- package/src/components/chip/types.ts +1 -4
- package/src/components/datepicker/_styles.scss +358 -0
- package/src/components/datepicker/api.ts +272 -0
- package/src/components/datepicker/config.ts +144 -0
- package/src/components/datepicker/constants.ts +98 -0
- package/src/components/datepicker/datepicker.ts +346 -0
- package/src/components/datepicker/index.ts +9 -0
- package/src/components/datepicker/render.ts +452 -0
- package/src/components/datepicker/types.ts +268 -0
- package/src/components/datepicker/utils.ts +290 -0
- package/src/components/dialog/_styles.scss +174 -128
- package/src/components/dialog/api.ts +48 -13
- package/src/components/dialog/config.ts +9 -5
- package/src/components/dialog/dialog.ts +6 -3
- package/src/components/dialog/features.ts +290 -130
- package/src/components/dialog/types.ts +7 -4
- package/src/components/divider/_styles.scss +57 -0
- package/src/components/divider/config.ts +81 -0
- package/src/components/divider/divider.ts +37 -0
- package/src/components/divider/features.ts +207 -0
- package/src/components/divider/index.ts +5 -0
- package/src/components/divider/types.ts +55 -0
- package/src/components/extended-fab/_styles.scss +267 -0
- package/src/components/extended-fab/api.ts +141 -0
- package/src/components/extended-fab/config.ts +108 -0
- package/src/components/extended-fab/constants.ts +36 -0
- package/src/components/extended-fab/extended-fab.ts +125 -0
- package/src/components/extended-fab/index.ts +4 -0
- package/src/components/extended-fab/types.ts +287 -0
- package/src/components/fab/_styles.scss +225 -0
- package/src/components/fab/api.ts +97 -0
- package/src/components/fab/config.ts +94 -0
- package/src/components/fab/constants.ts +41 -0
- package/src/components/fab/fab.ts +67 -0
- package/src/components/fab/index.ts +4 -0
- package/src/components/fab/types.ts +234 -0
- package/src/components/navigation/_styles.scss +1 -0
- package/src/components/navigation/api.ts +78 -50
- package/src/components/navigation/features/items.ts +280 -0
- package/src/components/navigation/nav-item.ts +72 -23
- package/src/components/navigation/navigation.ts +54 -2
- package/src/components/navigation/types.ts +210 -188
- package/src/components/progress/_styles.scss +0 -65
- package/src/components/progress/config.ts +1 -2
- package/src/components/progress/constants.ts +0 -14
- package/src/components/progress/index.ts +1 -1
- package/src/components/progress/progress.ts +1 -4
- package/src/components/progress/types.ts +1 -4
- package/src/components/radios/_styles.scss +0 -45
- package/src/components/radios/api.ts +85 -60
- package/src/components/radios/config.ts +1 -2
- package/src/components/radios/constants.ts +0 -9
- package/src/components/radios/index.ts +1 -1
- package/src/components/radios/radio.ts +34 -11
- package/src/components/radios/radios.ts +2 -1
- package/src/components/radios/types.ts +1 -7
- package/src/components/search/_styles.scss +306 -0
- package/src/components/search/api.ts +203 -0
- package/src/components/search/config.ts +87 -0
- package/src/components/search/constants.ts +21 -0
- package/src/components/search/features/index.ts +4 -0
- package/src/components/search/features/search.ts +718 -0
- package/src/components/search/features/states.ts +165 -0
- package/src/components/search/features/structure.ts +198 -0
- package/src/components/search/index.ts +10 -0
- package/src/components/search/search.ts +52 -0
- package/src/components/search/types.ts +163 -0
- package/src/components/segmented-button/_styles.scss +117 -0
- package/src/components/segmented-button/config.ts +67 -0
- package/src/components/segmented-button/constants.ts +42 -0
- package/src/components/segmented-button/index.ts +4 -0
- package/src/components/segmented-button/segment.ts +155 -0
- package/src/components/segmented-button/segmented-button.ts +250 -0
- package/src/components/segmented-button/types.ts +219 -0
- package/src/components/slider/_styles.scss +221 -168
- package/src/components/slider/accessibility.md +59 -0
- package/src/components/slider/api.ts +41 -120
- package/src/components/slider/config.ts +51 -49
- package/src/components/slider/features/handlers.ts +495 -0
- package/src/components/slider/features/index.ts +1 -2
- package/src/components/slider/features/slider.ts +66 -84
- package/src/components/slider/features/states.ts +195 -0
- package/src/components/slider/features/structure.ts +141 -184
- package/src/components/slider/features/ui.ts +150 -201
- package/src/components/slider/index.ts +2 -11
- package/src/components/slider/slider.ts +9 -12
- package/src/components/slider/types.ts +39 -24
- package/src/components/switch/_styles.scss +0 -2
- package/src/components/tabs/_styles.scss +346 -154
- package/src/components/tabs/api.ts +178 -400
- package/src/components/tabs/config.ts +46 -52
- package/src/components/tabs/constants.ts +85 -8
- package/src/components/tabs/features.ts +403 -0
- package/src/components/tabs/index.ts +60 -3
- package/src/components/tabs/indicator.ts +285 -0
- package/src/components/tabs/responsive.ts +144 -0
- package/src/components/tabs/scroll-indicators.ts +149 -0
- package/src/components/tabs/state.ts +186 -0
- package/src/components/tabs/tab-api.ts +258 -0
- package/src/components/tabs/tab.ts +255 -0
- package/src/components/tabs/tabs.ts +50 -31
- package/src/components/tabs/types.ts +332 -128
- package/src/components/tabs/utils.ts +107 -0
- package/src/components/textfield/_styles.scss +0 -98
- package/src/components/textfield/config.ts +2 -3
- package/src/components/textfield/constants.ts +0 -14
- package/src/components/textfield/index.ts +2 -2
- package/src/components/textfield/textfield.ts +0 -2
- package/src/components/textfield/types.ts +1 -4
- package/src/components/timepicker/README.md +277 -0
- package/src/components/timepicker/_styles.scss +451 -0
- package/src/components/timepicker/api.ts +632 -0
- package/src/components/timepicker/clockdial.ts +482 -0
- package/src/components/timepicker/config.ts +130 -0
- package/src/components/timepicker/constants.ts +138 -0
- package/src/components/timepicker/index.ts +8 -0
- package/src/components/timepicker/render.ts +613 -0
- package/src/components/timepicker/timepicker.ts +117 -0
- package/src/components/timepicker/types.ts +336 -0
- package/src/components/timepicker/utils.ts +241 -0
- package/src/components/top-app-bar/_styles.scss +225 -0
- package/src/components/top-app-bar/config.ts +83 -0
- package/src/components/top-app-bar/index.ts +11 -0
- package/src/components/top-app-bar/top-app-bar.ts +316 -0
- package/src/components/top-app-bar/types.ts +140 -0
- package/src/core/build/_ripple.scss +6 -6
- package/src/core/build/ripple.ts +72 -95
- package/src/core/compose/component.ts +1 -1
- package/src/core/compose/features/badge.ts +79 -0
- package/src/core/compose/features/icon.ts +3 -1
- package/src/core/compose/features/index.ts +3 -1
- package/src/core/compose/features/ripple.ts +4 -1
- package/src/core/compose/features/textlabel.ts +26 -2
- package/src/core/dom/create.ts +5 -0
- package/src/index.ts +9 -0
- package/src/styles/abstract/_theme.scss +115 -3
- package/src/styles/themes/_autumn.scss +21 -0
- package/src/styles/themes/_base-theme.scss +61 -0
- package/src/styles/themes/_baseline.scss +58 -0
- package/src/styles/themes/_bluekhaki.scss +125 -0
- package/src/styles/themes/_brownbeige.scss +125 -0
- package/src/styles/themes/_browngreen.scss +125 -0
- package/src/styles/themes/_forest.scss +6 -0
- package/src/styles/themes/_greenbeige.scss +125 -0
- package/src/styles/themes/_material.scss +125 -0
- package/src/styles/themes/_ocean.scss +6 -0
- package/src/styles/themes/_sageivory.scss +125 -0
- package/src/styles/themes/_spring.scss +6 -0
- package/src/styles/themes/_summer.scss +5 -0
- package/src/styles/themes/_sunset.scss +5 -0
- package/src/styles/themes/_tealcaramel.scss +125 -0
- package/src/styles/themes/_winter.scss +6 -0
- package/src/components/card/actions.ts +0 -48
- package/src/components/card/header.ts +0 -88
- package/src/components/card/media.ts +0 -52
- package/src/components/navigation/features/items.js +0 -192
- package/src/components/slider/features/appearance.ts +0 -94
- package/src/components/slider/features/disabled.ts +0 -43
- package/src/components/slider/features/events.ts +0 -164
- package/src/components/slider/features/interactions.ts +0 -261
- package/src/components/slider/features/keyboard.ts +0 -112
- 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
|
-
|
|
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
|
|
274
|
-
|
|
275
|
-
|
|
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
|
-
}
|
|
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
|
-
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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)
|