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
|
@@ -32,6 +32,14 @@ interface ApiOptions {
|
|
|
32
32
|
showTicks: (show: boolean) => void;
|
|
33
33
|
showCurrentValue: (show: boolean) => void;
|
|
34
34
|
};
|
|
35
|
+
text: {
|
|
36
|
+
setText: (text: string) => void;
|
|
37
|
+
getText: () => string;
|
|
38
|
+
};
|
|
39
|
+
icon: {
|
|
40
|
+
setIcon: (html: string) => void;
|
|
41
|
+
getIcon: () => string;
|
|
42
|
+
};
|
|
35
43
|
events: {
|
|
36
44
|
on: (event: string, handler: Function) => void;
|
|
37
45
|
off: (event: string, handler: Function) => void;
|
|
@@ -42,230 +50,143 @@ interface ApiOptions {
|
|
|
42
50
|
}
|
|
43
51
|
|
|
44
52
|
/**
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
|
-
interface ComponentWithElements {
|
|
48
|
-
element: HTMLElement;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Enhances a slider component with API methods
|
|
53
|
+
* Enhances a slider component with a streamlined API
|
|
53
54
|
* @param {ApiOptions} options - API configuration options
|
|
54
55
|
* @returns {Function} Higher-order function that adds API methods to component
|
|
55
56
|
* @internal This is an internal utility for the Slider component
|
|
56
57
|
*/
|
|
57
58
|
export const withAPI = (options: ApiOptions) =>
|
|
58
|
-
(component:
|
|
59
|
+
(component: { element: HTMLElement }): SliderComponent => {
|
|
59
60
|
return {
|
|
60
61
|
...component as any,
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
* @returns {SliderComponent} Slider component instance for chaining
|
|
67
|
-
*/
|
|
63
|
+
// Element access
|
|
64
|
+
element: component.element,
|
|
65
|
+
|
|
66
|
+
// Value management
|
|
68
67
|
setValue(value: number, triggerEvent: boolean = true) {
|
|
69
68
|
options.slider.setValue(value, triggerEvent);
|
|
70
69
|
return this;
|
|
71
70
|
},
|
|
72
71
|
|
|
73
|
-
/**
|
|
74
|
-
* Gets slider value
|
|
75
|
-
* @returns {number} Current slider value
|
|
76
|
-
*/
|
|
77
72
|
getValue() {
|
|
78
73
|
return options.slider.getValue();
|
|
79
74
|
},
|
|
80
75
|
|
|
81
|
-
/**
|
|
82
|
-
* Sets secondary slider value (for range slider)
|
|
83
|
-
* @param {number} value - New secondary value
|
|
84
|
-
* @param {boolean} [triggerEvent=true] - Whether to trigger change event
|
|
85
|
-
* @returns {SliderComponent} Slider component instance for chaining
|
|
86
|
-
*/
|
|
87
76
|
setSecondValue(value: number, triggerEvent: boolean = true) {
|
|
88
77
|
options.slider.setSecondValue(value, triggerEvent);
|
|
89
78
|
return this;
|
|
90
79
|
},
|
|
91
80
|
|
|
92
|
-
/**
|
|
93
|
-
* Gets secondary slider value
|
|
94
|
-
* @returns {number|null} Current secondary value or null
|
|
95
|
-
*/
|
|
96
81
|
getSecondValue() {
|
|
97
82
|
return options.slider.getSecondValue();
|
|
98
83
|
},
|
|
99
84
|
|
|
100
|
-
|
|
101
|
-
* Sets slider minimum value
|
|
102
|
-
* @param {number} min - New minimum value
|
|
103
|
-
* @returns {SliderComponent} Slider component instance for chaining
|
|
104
|
-
*/
|
|
85
|
+
// Range management
|
|
105
86
|
setMin(min: number) {
|
|
106
87
|
options.slider.setMin(min);
|
|
107
88
|
return this;
|
|
108
89
|
},
|
|
109
90
|
|
|
110
|
-
/**
|
|
111
|
-
* Gets slider minimum value
|
|
112
|
-
* @returns {number} Current minimum value
|
|
113
|
-
*/
|
|
114
91
|
getMin() {
|
|
115
92
|
return options.slider.getMin();
|
|
116
93
|
},
|
|
117
94
|
|
|
118
|
-
/**
|
|
119
|
-
* Sets slider maximum value
|
|
120
|
-
* @param {number} max - New maximum value
|
|
121
|
-
* @returns {SliderComponent} Slider component instance for chaining
|
|
122
|
-
*/
|
|
123
95
|
setMax(max: number) {
|
|
124
96
|
options.slider.setMax(max);
|
|
125
97
|
return this;
|
|
126
98
|
},
|
|
127
99
|
|
|
128
|
-
/**
|
|
129
|
-
* Gets slider maximum value
|
|
130
|
-
* @returns {number} Current maximum value
|
|
131
|
-
*/
|
|
132
100
|
getMax() {
|
|
133
101
|
return options.slider.getMax();
|
|
134
102
|
},
|
|
135
103
|
|
|
136
|
-
/**
|
|
137
|
-
* Sets slider step size
|
|
138
|
-
* @param {number} step - New step size
|
|
139
|
-
* @returns {SliderComponent} Slider component instance for chaining
|
|
140
|
-
*/
|
|
141
104
|
setStep(step: number) {
|
|
142
105
|
options.slider.setStep(step);
|
|
143
106
|
return this;
|
|
144
107
|
},
|
|
145
108
|
|
|
146
|
-
/**
|
|
147
|
-
* Gets slider step size
|
|
148
|
-
* @returns {number} Current step size
|
|
149
|
-
*/
|
|
150
109
|
getStep() {
|
|
151
110
|
return options.slider.getStep();
|
|
152
111
|
},
|
|
153
112
|
|
|
154
|
-
|
|
155
|
-
* Enables the slider
|
|
156
|
-
* @returns {SliderComponent} Slider component instance for chaining
|
|
157
|
-
*/
|
|
113
|
+
// State management
|
|
158
114
|
enable() {
|
|
159
115
|
options.disabled.enable();
|
|
160
116
|
return this;
|
|
161
117
|
},
|
|
162
118
|
|
|
163
|
-
/**
|
|
164
|
-
* Disables the slider
|
|
165
|
-
* @returns {SliderComponent} Slider component instance for chaining
|
|
166
|
-
*/
|
|
167
119
|
disable() {
|
|
168
120
|
options.disabled.disable();
|
|
169
121
|
return this;
|
|
170
122
|
},
|
|
171
123
|
|
|
172
|
-
/**
|
|
173
|
-
* Checks if slider is disabled
|
|
174
|
-
* @returns {boolean} True if slider is disabled
|
|
175
|
-
*/
|
|
176
124
|
isDisabled() {
|
|
177
125
|
return options.disabled.isDisabled();
|
|
178
126
|
},
|
|
179
127
|
|
|
180
|
-
|
|
181
|
-
* Sets slider color
|
|
182
|
-
* @param {string} color - Color variant
|
|
183
|
-
* @returns {SliderComponent} Slider component instance for chaining
|
|
184
|
-
*/
|
|
128
|
+
// Appearance management
|
|
185
129
|
setColor(color: keyof typeof SLIDER_COLORS | typeof SLIDER_COLORS[keyof typeof SLIDER_COLORS]) {
|
|
186
130
|
options.appearance.setColor(color);
|
|
187
131
|
return this;
|
|
188
132
|
},
|
|
189
133
|
|
|
190
|
-
/**
|
|
191
|
-
* Gets slider color
|
|
192
|
-
* @returns {string} Current color name
|
|
193
|
-
*/
|
|
194
134
|
getColor() {
|
|
195
135
|
return options.appearance.getColor();
|
|
196
136
|
},
|
|
197
137
|
|
|
198
|
-
/**
|
|
199
|
-
* Sets slider size
|
|
200
|
-
* @param {string} size - Size variant
|
|
201
|
-
* @returns {SliderComponent} Slider component instance for chaining
|
|
202
|
-
*/
|
|
203
138
|
setSize(size: keyof typeof SLIDER_SIZES | typeof SLIDER_SIZES[keyof typeof SLIDER_SIZES]) {
|
|
204
139
|
options.appearance.setSize(size);
|
|
205
140
|
return this;
|
|
206
141
|
},
|
|
207
142
|
|
|
208
|
-
/**
|
|
209
|
-
* Gets slider size
|
|
210
|
-
* @returns {string} Current size name
|
|
211
|
-
*/
|
|
212
143
|
getSize() {
|
|
213
144
|
return options.appearance.getSize();
|
|
214
145
|
},
|
|
215
146
|
|
|
216
|
-
/**
|
|
217
|
-
* Shows or hides tick marks
|
|
218
|
-
* @param {boolean} show - Whether to show ticks
|
|
219
|
-
* @returns {SliderComponent} Slider component instance for chaining
|
|
220
|
-
*/
|
|
221
147
|
showTicks(show: boolean) {
|
|
222
148
|
options.appearance.showTicks(show);
|
|
223
149
|
return this;
|
|
224
150
|
},
|
|
225
151
|
|
|
226
|
-
/**
|
|
227
|
-
* Shows or hides current value while dragging
|
|
228
|
-
* @param {boolean} show - Whether to show value bubble
|
|
229
|
-
* @returns {SliderComponent} Slider component instance for chaining
|
|
230
|
-
*/
|
|
231
152
|
showCurrentValue(show: boolean) {
|
|
232
153
|
options.appearance.showCurrentValue(show);
|
|
233
154
|
return this;
|
|
234
155
|
},
|
|
235
156
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
157
|
+
// Label and icon management
|
|
158
|
+
setLabel(text: string) {
|
|
159
|
+
if (options.text?.setText) options.text.setText(text);
|
|
160
|
+
return this;
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
getLabel() {
|
|
164
|
+
return options.text?.getText ? options.text.getText() : '';
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
setIcon(iconHtml: string) {
|
|
168
|
+
if (options.icon?.setIcon) options.icon.setIcon(iconHtml);
|
|
169
|
+
return this;
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
getIcon() {
|
|
173
|
+
return options.icon?.getIcon ? options.icon.getIcon() : '';
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
// Event management
|
|
242
177
|
on(event: keyof typeof SLIDER_EVENTS | typeof SLIDER_EVENTS[keyof typeof SLIDER_EVENTS], handler: (event: SliderEvent) => void) {
|
|
243
|
-
if (options.events
|
|
244
|
-
options.events.on(event, handler);
|
|
245
|
-
}
|
|
178
|
+
if (options.events?.on) options.events.on(event, handler);
|
|
246
179
|
return this;
|
|
247
180
|
},
|
|
248
181
|
|
|
249
|
-
/**
|
|
250
|
-
* Removes event listener
|
|
251
|
-
* @param {string} event - Event name
|
|
252
|
-
* @param {Function} handler - Event handler
|
|
253
|
-
* @returns {SliderComponent} Slider component instance for chaining
|
|
254
|
-
*/
|
|
255
182
|
off(event: keyof typeof SLIDER_EVENTS | typeof SLIDER_EVENTS[keyof typeof SLIDER_EVENTS], handler: (event: SliderEvent) => void) {
|
|
256
|
-
if (options.events
|
|
257
|
-
options.events.off(event, handler);
|
|
258
|
-
}
|
|
183
|
+
if (options.events?.off) options.events.off(event, handler);
|
|
259
184
|
return this;
|
|
260
185
|
},
|
|
261
186
|
|
|
262
|
-
|
|
263
|
-
* Destroys the slider component and cleans up resources
|
|
264
|
-
*/
|
|
187
|
+
// Lifecycle management
|
|
265
188
|
destroy() {
|
|
266
|
-
if (options.lifecycle
|
|
267
|
-
options.lifecycle.destroy();
|
|
268
|
-
}
|
|
189
|
+
if (options.lifecycle?.destroy) options.lifecycle.destroy();
|
|
269
190
|
}
|
|
270
191
|
};
|
|
271
192
|
};
|
|
@@ -21,7 +21,9 @@ export const defaultConfig: SliderConfig = {
|
|
|
21
21
|
showValue: true,
|
|
22
22
|
snapToSteps: true,
|
|
23
23
|
range: false,
|
|
24
|
-
|
|
24
|
+
iconPosition: 'start',
|
|
25
|
+
labelPosition: 'start',
|
|
26
|
+
valueFormatter: (value) => value.toString()
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
/**
|
|
@@ -37,62 +39,62 @@ export const createBaseConfig = (config: SliderConfig = {}): SliderConfig =>
|
|
|
37
39
|
* @param {SliderConfig} config - Slider configuration
|
|
38
40
|
* @returns {Object} Element configuration object for withElement
|
|
39
41
|
*/
|
|
40
|
-
export const getElementConfig = (config: SliderConfig) =>
|
|
41
|
-
|
|
42
|
+
export const getElementConfig = (config: SliderConfig) =>
|
|
43
|
+
createElementConfig(config, {
|
|
42
44
|
tag: 'div',
|
|
43
45
|
attrs: {
|
|
44
|
-
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
'aria-valuemin': config.min,
|
|
48
|
-
'aria-valuemax': config.max,
|
|
49
|
-
'aria-valuenow': config.value,
|
|
50
|
-
'aria-orientation': 'horizontal'
|
|
46
|
+
tabindex: '-1',
|
|
47
|
+
'aria-disabled': config.disabled === true ? 'true' : 'false',
|
|
48
|
+
role: 'none'
|
|
51
49
|
},
|
|
52
50
|
className: config.class
|
|
53
51
|
});
|
|
54
|
-
};
|
|
55
52
|
|
|
56
53
|
/**
|
|
57
54
|
* Creates API configuration for the Slider component
|
|
58
55
|
* @param {Object} comp - Component with slider features
|
|
59
56
|
* @returns {Object} API configuration object
|
|
60
57
|
*/
|
|
61
|
-
export const getApiConfig = (comp) => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
58
|
+
export const getApiConfig = (comp) => ({
|
|
59
|
+
slider: {
|
|
60
|
+
setValue: (v, t) => comp.slider?.setValue(v, t),
|
|
61
|
+
getValue: () => comp.slider?.getValue() ?? 0,
|
|
62
|
+
setSecondValue: (v, t) => comp.slider?.setSecondValue(v, t),
|
|
63
|
+
getSecondValue: () => comp.slider?.getSecondValue() ?? null,
|
|
64
|
+
setMin: (m) => comp.slider?.setMin(m),
|
|
65
|
+
getMin: () => comp.slider?.getMin() ?? 0,
|
|
66
|
+
setMax: (m) => comp.slider?.setMax(m),
|
|
67
|
+
getMax: () => comp.slider?.getMax() ?? 100,
|
|
68
|
+
setStep: (s) => comp.slider?.setStep(s),
|
|
69
|
+
getStep: () => comp.slider?.getStep() ?? 1,
|
|
70
|
+
regenerateTicks: () => comp.slider?.regenerateTicks?.()
|
|
71
|
+
},
|
|
72
|
+
disabled: {
|
|
73
|
+
enable: () => comp.disabled?.enable?.(),
|
|
74
|
+
disable: () => comp.disabled?.disable?.(),
|
|
75
|
+
isDisabled: () => comp.disabled?.isDisabled?.() ?? false
|
|
76
|
+
},
|
|
77
|
+
appearance: {
|
|
78
|
+
setColor: (c) => comp.appearance?.setColor?.(c),
|
|
79
|
+
getColor: () => comp.appearance?.getColor?.() ?? 'primary',
|
|
80
|
+
setSize: (s) => comp.appearance?.setSize?.(s),
|
|
81
|
+
getSize: () => comp.appearance?.getSize?.() ?? 'medium',
|
|
82
|
+
showTicks: (s) => comp.appearance?.showTicks?.(s),
|
|
83
|
+
showCurrentValue: (s) => comp.appearance?.showCurrentValue?.(s)
|
|
84
|
+
},
|
|
85
|
+
text: {
|
|
86
|
+
setText: (t) => comp.label?.setText?.(t),
|
|
87
|
+
getText: () => comp.label?.getText?.() ?? ''
|
|
88
|
+
},
|
|
89
|
+
icon: {
|
|
90
|
+
setIcon: (h) => comp.icon?.setIcon?.(h),
|
|
91
|
+
getIcon: () => comp.icon?.getIcon?.() ?? ''
|
|
92
|
+
},
|
|
93
|
+
events: {
|
|
94
|
+
on: (e, h) => comp.on?.(e, h),
|
|
95
|
+
off: (e, h) => comp.off?.(e, h)
|
|
96
|
+
},
|
|
97
|
+
lifecycle: {
|
|
98
|
+
destroy: () => comp.lifecycle?.destroy?.()
|
|
99
|
+
}
|
|
100
|
+
});
|