mtrl 0.2.7 → 0.2.8
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/demo/build.ts +349 -0
- package/demo/index.html +110 -0
- package/demo/main.js +448 -0
- package/demo/styles.css +239 -0
- package/package.json +14 -3
- package/server.ts +86 -0
- package/src/components/badge/api.ts +23 -14
- package/src/components/badge/badge.ts +2 -2
- package/src/components/badge/config.ts +10 -11
- package/src/components/badge/features.ts +15 -10
- package/src/components/badge/index.ts +27 -2
- package/src/components/badge/types.ts +28 -8
- package/src/components/bottom-app-bar/bottom-app-bar.ts +2 -44
- package/src/components/bottom-app-bar/config.ts +1 -45
- package/src/components/bottom-app-bar/index.ts +7 -1
- package/src/components/bottom-app-bar/types.ts +7 -1
- package/src/components/button/button.ts +0 -1
- package/src/components/button/config.ts +1 -2
- package/src/components/button/index.ts +10 -2
- package/src/components/button/types.ts +14 -2
- package/src/components/card/config.ts +17 -9
- package/src/components/card/content.ts +8 -10
- package/src/components/card/features.ts +4 -6
- package/src/components/card/index.ts +29 -2
- package/src/components/card/types.ts +6 -23
- package/src/components/checkbox/config.ts +3 -4
- package/src/components/checkbox/index.ts +1 -2
- package/src/components/checkbox/types.ts +12 -3
- package/src/components/chip/api.ts +170 -221
- package/src/components/chip/chip.ts +34 -302
- package/src/components/chip/config.ts +1 -2
- package/src/components/chip/index.ts +10 -2
- package/src/components/chip/types.ts +224 -35
- package/src/components/datepicker/api.ts +18 -25
- package/src/components/datepicker/config.ts +9 -12
- package/src/components/datepicker/datepicker.ts +7 -12
- package/src/components/datepicker/index.ts +10 -7
- package/src/components/datepicker/render.ts +16 -18
- package/src/components/datepicker/types.ts +164 -35
- package/src/components/datepicker/utils.ts +1 -2
- package/src/components/dialog/api.ts +7 -8
- package/src/components/dialog/config.ts +3 -4
- package/src/components/dialog/features.ts +56 -22
- package/src/components/dialog/index.ts +38 -8
- package/src/components/dialog/types.ts +33 -10
- package/src/components/divider/index.ts +5 -1
- package/src/components/extended-fab/config.ts +6 -2
- package/src/components/extended-fab/index.ts +7 -2
- package/src/components/extended-fab/types.ts +21 -4
- package/src/components/fab/config.ts +3 -4
- package/src/components/fab/fab.ts +1 -1
- package/src/components/fab/index.ts +7 -2
- package/src/components/fab/types.ts +21 -4
- package/src/components/list/config.ts +4 -5
- package/src/components/list/features.ts +6 -7
- package/src/components/list/index.ts +7 -9
- package/src/components/list/list-item.ts +12 -13
- package/src/components/list/types.ts +50 -5
- package/src/components/list/utils.ts +30 -3
- package/src/components/menu/features/items-manager.ts +9 -9
- package/src/components/menu/features/positioning.ts +7 -7
- package/src/components/menu/features/visibility.ts +7 -7
- package/src/components/menu/index.ts +7 -9
- package/src/components/menu/menu-item.ts +6 -6
- package/src/components/menu/menu.ts +22 -0
- package/src/components/menu/types.ts +29 -10
- package/src/components/menu/utils.ts +67 -0
- package/src/components/navigation/config.ts +22 -10
- package/src/components/navigation/features/items.ts +31 -27
- package/src/components/navigation/index.ts +0 -6
- package/src/components/navigation/nav-item.ts +12 -24
- package/src/components/navigation/navigation.ts +4 -6
- package/src/components/navigation/types.ts +228 -203
- package/src/components/progress/api.ts +2 -3
- package/src/components/progress/config.ts +2 -3
- package/src/components/progress/index.ts +0 -1
- package/src/components/progress/progress.ts +1 -2
- package/src/components/progress/types.ts +186 -33
- package/src/components/radios/config.ts +1 -1
- package/src/components/radios/index.ts +0 -1
- package/src/components/radios/types.ts +0 -7
- package/src/components/search/config.ts +1 -2
- package/src/components/search/features/search.ts +14 -15
- package/src/components/search/features/states.ts +5 -1
- package/src/components/search/features/structure.ts +3 -4
- package/src/components/search/index.ts +0 -3
- package/src/components/search/types.ts +18 -6
- package/src/components/segmented-button/config.ts +20 -7
- package/src/components/segmented-button/segment.ts +6 -7
- package/src/components/segmented-button/segmented-button.ts +4 -5
- package/src/components/segmented-button/types.ts +37 -2
- package/src/components/slider/types.ts +34 -8
- package/src/components/snackbar/config.ts +2 -3
- package/src/components/snackbar/constants.ts +0 -32
- package/src/components/snackbar/index.ts +0 -1
- package/src/components/snackbar/position.ts +9 -1
- package/src/components/snackbar/types.ts +122 -46
- package/src/components/switch/config.ts +2 -3
- package/src/components/switch/index.ts +0 -1
- package/src/components/switch/types.ts +3 -2
- package/src/components/tabs/config.ts +3 -4
- package/src/components/tabs/index.ts +0 -15
- package/src/components/tabs/tab-api.ts +12 -4
- package/src/components/tabs/tab.ts +18 -6
- package/src/components/tabs/types.ts +13 -3
- package/src/components/textfield/config.ts +2 -3
- package/src/components/textfield/index.ts +0 -1
- package/src/components/textfield/types.ts +17 -3
- package/src/components/timepicker/api.ts +1 -1
- package/src/components/timepicker/clockdial.ts +1 -1
- package/src/components/timepicker/config.ts +102 -4
- package/src/components/timepicker/index.ts +1 -6
- package/src/components/timepicker/render.ts +1 -1
- package/src/components/timepicker/timepicker.ts +1 -1
- package/src/components/tooltip/api.ts +1 -1
- package/src/components/tooltip/config.ts +27 -6
- package/src/components/tooltip/index.ts +0 -1
- package/src/components/tooltip/types.ts +13 -3
- package/src/core/compose/features/textlabel.ts +0 -3
- package/src/{components/tabs/_styles.scss → styles/components/_tabs.scss} +1 -1
- package/src/{components/textfield/_styles.scss → styles/components/_textfield.scss} +70 -67
- package/src/styles/main.scss +98 -49
- package/src/components/badge/constants.ts +0 -40
- package/src/components/button/constants.ts +0 -11
- package/src/components/card/constants.ts +0 -84
- package/src/components/datepicker/constants.ts +0 -98
- package/src/components/dialog/constants.ts +0 -32
- package/src/components/extended-fab/constants.ts +0 -36
- package/src/components/fab/constants.ts +0 -41
- package/src/components/menu/constants.ts +0 -154
- package/src/components/navigation/constants.ts +0 -200
- package/src/components/progress/constants.ts +0 -29
- package/src/components/search/constants.ts +0 -21
- package/src/components/segmented-button/constants.ts +0 -42
- package/src/components/switch/constants.ts +0 -80
- package/src/components/tabs/constants.ts +0 -89
- package/src/components/timepicker/constants.ts +0 -138
- /package/src/{components/badge/_styles.scss → styles/components/_badge.scss} +0 -0
- /package/src/{components/bottom-app-bar/_styles.scss → styles/components/_bottom-app-bar.scss} +0 -0
- /package/src/{components/button/_styles.scss → styles/components/_button.scss} +0 -0
- /package/src/{components/card/_styles.scss → styles/components/_card.scss} +0 -0
- /package/src/{components/carousel/_styles.scss → styles/components/_carousel.scss} +0 -0
- /package/src/{components/checkbox/_styles.scss → styles/components/_checkbox.scss} +0 -0
- /package/src/{components/chip/_styles.scss → styles/components/_chip.scss} +0 -0
- /package/src/{components/datepicker/_styles.scss → styles/components/_datepicker.scss} +0 -0
- /package/src/{components/dialog/_styles.scss → styles/components/_dialog.scss} +0 -0
- /package/src/{components/divider/_styles.scss → styles/components/_divider.scss} +0 -0
- /package/src/{components/extended-fab/_styles.scss → styles/components/_extended-fab.scss} +0 -0
- /package/src/{components/fab/_styles.scss → styles/components/_fab.scss} +0 -0
- /package/src/{components/list/_styles.scss → styles/components/_list.scss} +0 -0
- /package/src/{components/menu/_styles.scss → styles/components/_menu.scss} +0 -0
- /package/src/{components/navigation/_styles.scss → styles/components/_navigation.scss} +0 -0
- /package/src/{components/progress/_styles.scss → styles/components/_progress.scss} +0 -0
- /package/src/{components/radios/_styles.scss → styles/components/_radios.scss} +0 -0
- /package/src/{components/search/_styles.scss → styles/components/_search.scss} +0 -0
- /package/src/{components/segmented-button/_styles.scss → styles/components/_segmented-button.scss} +0 -0
- /package/src/{components/sheet/_styles.scss → styles/components/_sheet.scss} +0 -0
- /package/src/{components/slider/_styles.scss → styles/components/_slider.scss} +0 -0
- /package/src/{components/snackbar/_styles.scss → styles/components/_snackbar.scss} +0 -0
- /package/src/{components/switch/_styles.scss → styles/components/_switch.scss} +0 -0
- /package/src/{components/timepicker/_styles.scss → styles/components/_timepicker.scss} +0 -0
- /package/src/{components/tooltip/_styles.scss → styles/components/_tooltip.scss} +0 -0
- /package/src/{components/top-app-bar/_styles.scss → styles/components/_top-app-bar.scss} +0 -0
- /package/src/styles/utilities/{_color.scss → _colors.scss} +0 -0
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
// src/components/card/config.ts
|
|
2
|
-
|
|
3
2
|
import {
|
|
4
3
|
createComponentConfig,
|
|
5
4
|
createElementConfig
|
|
6
5
|
} from '../../core/config/component-config';
|
|
7
|
-
import { CARD_VARIANTS, CARD_ELEVATIONS } from './constants';
|
|
8
6
|
import {
|
|
9
7
|
createCardHeader,
|
|
10
8
|
createCardContent,
|
|
@@ -18,7 +16,7 @@ import { CardComponent, CardSchema, ButtonConfig, BaseComponent } from './types'
|
|
|
18
16
|
* @const {CardSchema}
|
|
19
17
|
*/
|
|
20
18
|
export const defaultConfig: CardSchema = {
|
|
21
|
-
variant:
|
|
19
|
+
variant: 'elevated',
|
|
22
20
|
interactive: false,
|
|
23
21
|
fullWidth: false,
|
|
24
22
|
clickable: false,
|
|
@@ -191,6 +189,16 @@ export const getApiConfig = (comp: any) => ({
|
|
|
191
189
|
}
|
|
192
190
|
});
|
|
193
191
|
|
|
192
|
+
/**
|
|
193
|
+
* Card elevation levels
|
|
194
|
+
*/
|
|
195
|
+
export const CARD_ELEVATION_LEVELS = {
|
|
196
|
+
LEVEL0: 0,
|
|
197
|
+
LEVEL1: 1,
|
|
198
|
+
LEVEL2: 2,
|
|
199
|
+
LEVEL4: 4
|
|
200
|
+
};
|
|
201
|
+
|
|
194
202
|
/**
|
|
195
203
|
* Adds interactive behavior to card component
|
|
196
204
|
* Uses the MTRL elevation system for proper elevation levels
|
|
@@ -206,14 +214,14 @@ export const withInteractiveBehavior = (comp: BaseComponent): BaseComponent => {
|
|
|
206
214
|
if (isInteractive) {
|
|
207
215
|
// Mouse interactions
|
|
208
216
|
comp.element.addEventListener('mouseenter', () => {
|
|
209
|
-
if (config.variant ===
|
|
210
|
-
comp.element.style.setProperty('--card-elevation', String(
|
|
217
|
+
if (config.variant === 'elevated') {
|
|
218
|
+
comp.element.style.setProperty('--card-elevation', String(CARD_ELEVATION_LEVELS.LEVEL2));
|
|
211
219
|
}
|
|
212
220
|
});
|
|
213
221
|
|
|
214
222
|
comp.element.addEventListener('mouseleave', () => {
|
|
215
|
-
if (config.variant ===
|
|
216
|
-
comp.element.style.setProperty('--card-elevation', String(
|
|
223
|
+
if (config.variant === 'elevated') {
|
|
224
|
+
comp.element.style.setProperty('--card-elevation', String(CARD_ELEVATION_LEVELS.LEVEL1));
|
|
217
225
|
}
|
|
218
226
|
});
|
|
219
227
|
|
|
@@ -241,7 +249,7 @@ export const withInteractiveBehavior = (comp: BaseComponent): BaseComponent => {
|
|
|
241
249
|
comp.element.setAttribute('draggable', 'true');
|
|
242
250
|
|
|
243
251
|
comp.element.addEventListener('dragstart', (e: DragEvent) => {
|
|
244
|
-
comp.element.style.setProperty('--card-elevation', String(
|
|
252
|
+
comp.element.style.setProperty('--card-elevation', String(CARD_ELEVATION_LEVELS.LEVEL4));
|
|
245
253
|
comp.element.classList.add(`${comp.getClass('card')}--dragging`);
|
|
246
254
|
comp.emit?.('dragstart', { event: e });
|
|
247
255
|
|
|
@@ -254,7 +262,7 @@ export const withInteractiveBehavior = (comp: BaseComponent): BaseComponent => {
|
|
|
254
262
|
});
|
|
255
263
|
|
|
256
264
|
comp.element.addEventListener('dragend', (e: DragEvent) => {
|
|
257
|
-
comp.element.style.setProperty('--card-elevation', String(
|
|
265
|
+
comp.element.style.setProperty('--card-elevation', String(CARD_ELEVATION_LEVELS.LEVEL1));
|
|
258
266
|
comp.element.classList.remove(`${comp.getClass('card')}--dragging`);
|
|
259
267
|
comp.emit?.('dragend', { event: e });
|
|
260
268
|
});
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
import { PREFIX } from '../../core/config';
|
|
3
3
|
import { pipe } from '../../core/compose';
|
|
4
4
|
import { createBase, withElement } from '../../core/compose/component';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { createElement } from '../../core/dom/create';
|
|
6
|
+
import { CardContentConfig, CardHeaderConfig, CardMediaConfig, CardActionsConfig } from './types';
|
|
7
|
+
|
|
8
|
+
// Constants for content padding
|
|
9
|
+
export const CARD_CONTENT_PADDING = true;
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
12
|
* Creates a card content component
|
|
@@ -78,9 +81,6 @@ export const createCardContent = (config: CardContentConfig = {}): HTMLElement =
|
|
|
78
81
|
}
|
|
79
82
|
};
|
|
80
83
|
|
|
81
|
-
// src/components/card/header.ts
|
|
82
|
-
import { createElement } from '../../core/dom/create';
|
|
83
|
-
|
|
84
84
|
/**
|
|
85
85
|
* Creates a card header component
|
|
86
86
|
*
|
|
@@ -103,7 +103,7 @@ import { createElement } from '../../core/dom/create';
|
|
|
103
103
|
* });
|
|
104
104
|
* ```
|
|
105
105
|
*/
|
|
106
|
-
export const createCardHeader = (config:
|
|
106
|
+
export const createCardHeader = (config: CardHeaderConfig = {}): HTMLElement => {
|
|
107
107
|
const baseConfig = {
|
|
108
108
|
...config,
|
|
109
109
|
componentName: 'card-header',
|
|
@@ -200,7 +200,6 @@ export const createCardHeader = (config: any = {}): HTMLElement => {
|
|
|
200
200
|
}
|
|
201
201
|
};
|
|
202
202
|
|
|
203
|
-
// src/components/card/actions.ts
|
|
204
203
|
/**
|
|
205
204
|
* Creates a card actions component
|
|
206
205
|
*
|
|
@@ -225,7 +224,7 @@ export const createCardHeader = (config: any = {}): HTMLElement => {
|
|
|
225
224
|
* });
|
|
226
225
|
* ```
|
|
227
226
|
*/
|
|
228
|
-
export const createCardActions = (config:
|
|
227
|
+
export const createCardActions = (config: CardActionsConfig = {}): HTMLElement => {
|
|
229
228
|
const baseConfig = {
|
|
230
229
|
...config,
|
|
231
230
|
componentName: 'card-actions',
|
|
@@ -273,7 +272,6 @@ export const createCardActions = (config: any = {}): HTMLElement => {
|
|
|
273
272
|
}
|
|
274
273
|
};
|
|
275
274
|
|
|
276
|
-
// src/components/card/media.ts
|
|
277
275
|
/**
|
|
278
276
|
* Creates a card media component
|
|
279
277
|
*
|
|
@@ -296,7 +294,7 @@ export const createCardActions = (config: any = {}): HTMLElement => {
|
|
|
296
294
|
* });
|
|
297
295
|
* ```
|
|
298
296
|
*/
|
|
299
|
-
export const createCardMedia = (config:
|
|
297
|
+
export const createCardMedia = (config: CardMediaConfig = {}): HTMLElement => {
|
|
300
298
|
const baseConfig = {
|
|
301
299
|
...config,
|
|
302
300
|
componentName: 'card-media',
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
import { PREFIX } from '../../core/config';
|
|
3
3
|
import { createElement } from '../../core/dom/create';
|
|
4
4
|
import { BaseComponent, CardComponent, LoadingFeature, ExpandableFeature, SwipeableFeature } from './types';
|
|
5
|
-
|
|
6
|
-
import { createCardHeader, createCardContent, createCardMedia, createCardActions } from './content';
|
|
7
|
-
import { BaseComponent, CardComponent, CardHeaderConfig, CardContentConfig, CardMediaConfig, CardActionsConfig, CardSchema, ButtonConfig } from './types';
|
|
5
|
+
import { CARD_ELEVATION_LEVELS } from './config';
|
|
8
6
|
|
|
9
7
|
interface LoadingConfig {
|
|
10
8
|
initialState?: boolean;
|
|
@@ -115,9 +113,9 @@ export const withElevation = (component: BaseComponent): BaseComponent => {
|
|
|
115
113
|
|
|
116
114
|
// Set initial elevation based on variant
|
|
117
115
|
if (config.variant === 'elevated') {
|
|
118
|
-
component.element.style.setProperty('--card-elevation',
|
|
116
|
+
component.element.style.setProperty('--card-elevation', String(CARD_ELEVATION_LEVELS.LEVEL1));
|
|
119
117
|
} else {
|
|
120
|
-
component.element.style.setProperty('--card-elevation',
|
|
118
|
+
component.element.style.setProperty('--card-elevation', String(CARD_ELEVATION_LEVELS.LEVEL0));
|
|
121
119
|
}
|
|
122
120
|
|
|
123
121
|
return component;
|
|
@@ -266,7 +264,7 @@ export const withExpandable = (config: ExpandableConfig = {}) => (component: Bas
|
|
|
266
264
|
* onSwipeLeft: (card) => console.log('Swiped left'),
|
|
267
265
|
* onSwipeRight: (card) => console.log('Swiped right')
|
|
268
266
|
* })
|
|
269
|
-
* )({ variant:
|
|
267
|
+
* )({ variant: 'elevated' });
|
|
270
268
|
* ```
|
|
271
269
|
*/
|
|
272
270
|
export const withSwipeable = (config: SwipeableConfig = {}) => (component: BaseComponent): BaseComponent & { swipeable: SwipeableFeature } => {
|
|
@@ -29,7 +29,7 @@ export {
|
|
|
29
29
|
|
|
30
30
|
export {
|
|
31
31
|
CardVariant,
|
|
32
|
-
|
|
32
|
+
CardElevationLevel,
|
|
33
33
|
CardSchema,
|
|
34
34
|
CardHeaderConfig,
|
|
35
35
|
CardContentConfig,
|
|
@@ -38,4 +38,31 @@ export {
|
|
|
38
38
|
CardAriaAttributes,
|
|
39
39
|
CardComponent
|
|
40
40
|
} from './types';
|
|
41
|
-
|
|
41
|
+
|
|
42
|
+
// Export card constants for backward compatibility
|
|
43
|
+
export const CARD_VARIANTS = {
|
|
44
|
+
ELEVATED: 'elevated',
|
|
45
|
+
FILLED: 'filled',
|
|
46
|
+
OUTLINED: 'outlined'
|
|
47
|
+
} as const;
|
|
48
|
+
|
|
49
|
+
export const CARD_ELEVATIONS = {
|
|
50
|
+
LEVEL0: 0,
|
|
51
|
+
LEVEL1: 1,
|
|
52
|
+
LEVEL2: 2,
|
|
53
|
+
LEVEL4: 4
|
|
54
|
+
} as const;
|
|
55
|
+
|
|
56
|
+
// Additional constants
|
|
57
|
+
export const CARD_WIDTHS = {
|
|
58
|
+
SMALL: '344px',
|
|
59
|
+
MEDIUM: '480px',
|
|
60
|
+
LARGE: '624px',
|
|
61
|
+
FULL: '100%'
|
|
62
|
+
} as const;
|
|
63
|
+
|
|
64
|
+
export const CARD_CORNER_RADIUS = {
|
|
65
|
+
SMALL: '8px',
|
|
66
|
+
MEDIUM: '12px',
|
|
67
|
+
LARGE: '16px'
|
|
68
|
+
} as const;
|
|
@@ -1,31 +1,14 @@
|
|
|
1
1
|
// src/components/card/types.ts
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
|
-
* Card variant types
|
|
4
|
-
* @enum {string}
|
|
4
|
+
* Card variant types
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
7
|
-
/** Elevated card with shadow */
|
|
8
|
-
ELEVATED = 'elevated',
|
|
9
|
-
/** Filled card with higher surface container color */
|
|
10
|
-
FILLED = 'filled',
|
|
11
|
-
/** Outlined card with border */
|
|
12
|
-
OUTLINED = 'outlined'
|
|
13
|
-
}
|
|
6
|
+
export type CardVariant = 'elevated' | 'filled' | 'outlined';
|
|
14
7
|
|
|
15
8
|
/**
|
|
16
|
-
* Card elevation levels
|
|
17
|
-
* @enum {number}
|
|
9
|
+
* Card elevation levels
|
|
18
10
|
*/
|
|
19
|
-
export
|
|
20
|
-
/** No elevation (for filled and outlined variants) */
|
|
21
|
-
LEVEL0 = 0,
|
|
22
|
-
/** Default elevation for elevated cards */
|
|
23
|
-
LEVEL1 = 1,
|
|
24
|
-
/** Elevation for hovered state */
|
|
25
|
-
LEVEL2 = 2,
|
|
26
|
-
/** Elevation for dragged state */
|
|
27
|
-
LEVEL4 = 4
|
|
28
|
-
}
|
|
11
|
+
export type CardElevationLevel = 0 | 1 | 2 | 4;
|
|
29
12
|
|
|
30
13
|
/**
|
|
31
14
|
* Button configuration interface for buttons shorthand
|
|
@@ -48,7 +31,7 @@ export interface ButtonConfig {
|
|
|
48
31
|
*/
|
|
49
32
|
export interface CardSchema {
|
|
50
33
|
/** Card variant type (elevated, filled, outlined) */
|
|
51
|
-
variant?: CardVariant;
|
|
34
|
+
variant?: CardVariant | string;
|
|
52
35
|
/** Whether the card is interactive */
|
|
53
36
|
interactive?: boolean;
|
|
54
37
|
/** Whether the card should take full width */
|
|
@@ -5,14 +5,13 @@ import {
|
|
|
5
5
|
BaseComponentConfig
|
|
6
6
|
} from '../../core/config/component-config';
|
|
7
7
|
import { CheckboxConfig, BaseComponent, ApiOptions } from './types';
|
|
8
|
-
import { CHECKBOX_VARIANTS, CHECKBOX_LABEL_POSITION } from './constants';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Default configuration for the Checkbox component
|
|
12
11
|
*/
|
|
13
12
|
export const defaultConfig: CheckboxConfig = {
|
|
14
|
-
variant:
|
|
15
|
-
labelPosition:
|
|
13
|
+
variant: 'filled',
|
|
14
|
+
labelPosition: 'end'
|
|
16
15
|
};
|
|
17
16
|
|
|
18
17
|
/**
|
|
@@ -58,7 +57,7 @@ export const withCheckIcon = (config: CheckboxConfig) => (component: BaseCompone
|
|
|
58
57
|
* @param {CheckboxConfig} config - Component configuration
|
|
59
58
|
*/
|
|
60
59
|
export const withLabelPosition = (config: CheckboxConfig) => (component: BaseComponent): BaseComponent => {
|
|
61
|
-
const position = config.labelPosition ||
|
|
60
|
+
const position = config.labelPosition || 'end';
|
|
62
61
|
const positionClass = `${config.prefix}-checkbox--label-${position}`;
|
|
63
62
|
|
|
64
63
|
component.element.classList.add(positionClass);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
// src/components/checkbox/index.ts
|
|
2
2
|
export { default } from './checkbox';
|
|
3
|
-
export {
|
|
4
|
-
export { CheckboxConfig, CheckboxComponent } from './types';
|
|
3
|
+
export { CheckboxConfig, CheckboxComponent, CheckboxVariant, CheckboxLabelPosition } from './types';
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
// src/components/checkbox/types.ts
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Checkbox variant types
|
|
5
|
+
*/
|
|
6
|
+
export type CheckboxVariant = 'filled' | 'outlined';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Checkbox label position types
|
|
10
|
+
*/
|
|
11
|
+
export type CheckboxLabelPosition = 'start' | 'end';
|
|
3
12
|
|
|
4
13
|
/**
|
|
5
14
|
* Configuration interface for the Checkbox component
|
|
@@ -27,10 +36,10 @@ export interface CheckboxConfig {
|
|
|
27
36
|
label?: string;
|
|
28
37
|
|
|
29
38
|
/** Label position (start/end) */
|
|
30
|
-
labelPosition?:
|
|
39
|
+
labelPosition?: CheckboxLabelPosition | string;
|
|
31
40
|
|
|
32
41
|
/** Visual variant */
|
|
33
|
-
variant?:
|
|
42
|
+
variant?: CheckboxVariant | string;
|
|
34
43
|
|
|
35
44
|
/** Additional CSS classes */
|
|
36
45
|
class?: string;
|