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.
- package/index.ts +18 -0
- package/package.json +1 -1
- package/src/components/badge/_styles.scss +117 -109
- 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 -10
- package/src/components/button/api.ts +5 -0
- package/src/components/button/config.ts +5 -0
- package/src/components/button/types.ts +6 -0
- package/src/components/card/card.ts +13 -25
- package/src/components/card/config.ts +67 -22
- package/src/components/card/features.ts +3 -0
- package/src/components/card/types.ts +28 -0
- package/src/components/checkbox/_styles.scss +0 -2
- 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/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 +83 -24
- package/src/components/slider/accessibility.md +5 -5
- package/src/components/slider/api.ts +41 -120
- package/src/components/slider/config.ts +51 -47
- 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 +136 -206
- package/src/components/slider/features/ui.ts +145 -206
- 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 +94 -32
- package/src/components/tabs/features.ts +4 -2
- package/src/components/tabs/indicator.ts +73 -13
- package/src/components/tabs/types.ts +10 -2
- 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/features/icon.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 +9 -1
- 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/navigation/features/items.js +0 -192
- package/src/components/slider/features/appearance.ts +0 -94
- package/src/components/slider/features/disabled.ts +0 -68
- package/src/components/slider/features/events.ts +0 -164
- package/src/components/slider/features/interactions.ts +0 -396
- package/src/components/slider/features/keyboard.ts +0 -233
- package/src/core/collection/adapters/mongodb.js +0 -232
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// src/components/divider/config.ts
|
|
2
|
+
import { createComponentConfig } from '../../core/config/component-config';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration options for divider components
|
|
6
|
+
*/
|
|
7
|
+
export interface DividerConfig {
|
|
8
|
+
/**
|
|
9
|
+
* CSS class prefix (defaults to 'mtrl')
|
|
10
|
+
*/
|
|
11
|
+
prefix?: string;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* CSS class to add to the divider
|
|
15
|
+
*/
|
|
16
|
+
class?: string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Orientation of the divider ('horizontal' or 'vertical')
|
|
20
|
+
* @default 'horizontal'
|
|
21
|
+
*/
|
|
22
|
+
orientation?: 'horizontal' | 'vertical';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Variant of the divider ('full-width' or 'inset')
|
|
26
|
+
* @default 'full-width'
|
|
27
|
+
*/
|
|
28
|
+
variant?: 'full-width' | 'inset' | 'middle-inset';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Custom inset value (left margin for horizontal, top margin for vertical)
|
|
32
|
+
* @default 16 for 'inset', undefined for 'full-width'
|
|
33
|
+
*/
|
|
34
|
+
insetStart?: number;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Custom inset end value (right margin for horizontal, bottom margin for vertical)
|
|
38
|
+
* @default 0 for 'inset', undefined for 'full-width'
|
|
39
|
+
*/
|
|
40
|
+
insetEnd?: number;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Color of the divider (uses 'outline-variant' from theme by default)
|
|
44
|
+
*/
|
|
45
|
+
color?: string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Thickness of the divider in pixels
|
|
49
|
+
* @default 1
|
|
50
|
+
*/
|
|
51
|
+
thickness?: number;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Used internally for component composition
|
|
55
|
+
* @private
|
|
56
|
+
*/
|
|
57
|
+
componentName?: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Default configuration for dividers
|
|
62
|
+
*/
|
|
63
|
+
export const defaultConfig: Partial<DividerConfig> = {
|
|
64
|
+
orientation: 'horizontal',
|
|
65
|
+
variant: 'full-width',
|
|
66
|
+
thickness: 1
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Creates a base configuration object for divider
|
|
71
|
+
*
|
|
72
|
+
* @param config - User provided configuration
|
|
73
|
+
* @returns Complete configuration with defaults applied
|
|
74
|
+
*/
|
|
75
|
+
export const createBaseConfig = (config: DividerConfig = {}): DividerConfig => {
|
|
76
|
+
return createComponentConfig(
|
|
77
|
+
defaultConfig as DividerConfig,
|
|
78
|
+
config,
|
|
79
|
+
'divider'
|
|
80
|
+
);
|
|
81
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// src/components/divider/divider.ts
|
|
2
|
+
import {
|
|
3
|
+
createBase,
|
|
4
|
+
withElement,
|
|
5
|
+
pipe,
|
|
6
|
+
withVariant
|
|
7
|
+
} from '../../core/compose';
|
|
8
|
+
import { PREFIX } from '../../core/config';
|
|
9
|
+
import { DividerConfig, createBaseConfig } from './config';
|
|
10
|
+
import { withOrientation, withInset, withStyle } from './features';
|
|
11
|
+
import { DividerComponent } from './types';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates a divider component
|
|
15
|
+
*
|
|
16
|
+
* @param config - Divider configuration options
|
|
17
|
+
* @returns Divider component instance
|
|
18
|
+
*/
|
|
19
|
+
export const createDivider = (config: DividerConfig = {}): DividerComponent => {
|
|
20
|
+
// Process configuration
|
|
21
|
+
const processedConfig = createBaseConfig(config);
|
|
22
|
+
|
|
23
|
+
// Create component through composition
|
|
24
|
+
return pipe(
|
|
25
|
+
createBase,
|
|
26
|
+
withElement({
|
|
27
|
+
tag: 'hr',
|
|
28
|
+
componentName: 'divider',
|
|
29
|
+
prefix: processedConfig.prefix || PREFIX,
|
|
30
|
+
className: config.class
|
|
31
|
+
}),
|
|
32
|
+
withOrientation(processedConfig),
|
|
33
|
+
withVariant(processedConfig),
|
|
34
|
+
withInset(processedConfig),
|
|
35
|
+
withStyle(processedConfig)
|
|
36
|
+
)(processedConfig) as DividerComponent;
|
|
37
|
+
};
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
// src/components/divider/features.ts
|
|
2
|
+
import { BaseComponent, ElementComponent } from '../../core/compose';
|
|
3
|
+
import { DividerConfig } from './config';
|
|
4
|
+
import { DividerComponent } from './types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Adds orientation functionality to divider
|
|
8
|
+
*
|
|
9
|
+
* @param config - Divider configuration
|
|
10
|
+
* @returns Function that enhances a component with orientation capabilities
|
|
11
|
+
*/
|
|
12
|
+
export const withOrientation = (config: DividerConfig) =>
|
|
13
|
+
<C extends ElementComponent & BaseComponent>(component: C): C & Partial<DividerComponent> => {
|
|
14
|
+
const orientation = config.orientation || 'horizontal';
|
|
15
|
+
|
|
16
|
+
// Apply the orientation class
|
|
17
|
+
component.element.classList.add(`${component.getClass('divider')}--${orientation}`);
|
|
18
|
+
|
|
19
|
+
// Set styles based on orientation and thickness
|
|
20
|
+
const thickness = config.thickness || 1;
|
|
21
|
+
|
|
22
|
+
if (orientation === 'horizontal') {
|
|
23
|
+
component.element.style.height = `${thickness}px`;
|
|
24
|
+
component.element.style.width = '100%';
|
|
25
|
+
} else {
|
|
26
|
+
component.element.style.width = `${thickness}px`;
|
|
27
|
+
component.element.style.height = '100%';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
...component,
|
|
32
|
+
|
|
33
|
+
getOrientation() {
|
|
34
|
+
return orientation;
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
setOrientation(newOrientation: 'horizontal' | 'vertical') {
|
|
38
|
+
// Remove existing orientation class
|
|
39
|
+
component.element.classList.remove(`${component.getClass('divider')}--${orientation}`);
|
|
40
|
+
|
|
41
|
+
// Add new orientation class
|
|
42
|
+
component.element.classList.add(`${component.getClass('divider')}--${newOrientation}`);
|
|
43
|
+
|
|
44
|
+
// Update styles
|
|
45
|
+
if (newOrientation === 'horizontal') {
|
|
46
|
+
component.element.style.height = `${thickness}px`;
|
|
47
|
+
component.element.style.width = '100%';
|
|
48
|
+
|
|
49
|
+
// Reset vertical styles
|
|
50
|
+
component.element.style.marginTop = '';
|
|
51
|
+
component.element.style.marginBottom = '';
|
|
52
|
+
} else {
|
|
53
|
+
component.element.style.width = `${thickness}px`;
|
|
54
|
+
component.element.style.height = '100%';
|
|
55
|
+
|
|
56
|
+
// Reset horizontal styles
|
|
57
|
+
component.element.style.marginLeft = '';
|
|
58
|
+
component.element.style.marginRight = '';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return this as unknown as DividerComponent;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Adds inset functionality to divider
|
|
68
|
+
*
|
|
69
|
+
* @param config - Divider configuration
|
|
70
|
+
* @returns Function that enhances a component with inset capabilities
|
|
71
|
+
*/
|
|
72
|
+
export const withInset = (config: DividerConfig) =>
|
|
73
|
+
<C extends ElementComponent & Partial<DividerComponent>>(component: C): C & Partial<DividerComponent> => {
|
|
74
|
+
const variant = config.variant || 'full-width';
|
|
75
|
+
const orientation = config.orientation || 'horizontal';
|
|
76
|
+
|
|
77
|
+
// Apply inset styles based on variant
|
|
78
|
+
if (variant === 'inset' || variant === 'middle-inset') {
|
|
79
|
+
if (orientation === 'horizontal') {
|
|
80
|
+
const insetStart = config.insetStart !== undefined ? config.insetStart : 16;
|
|
81
|
+
const insetEnd = config.insetEnd !== undefined ? config.insetEnd : (variant === 'middle-inset' ? 16 : 0);
|
|
82
|
+
|
|
83
|
+
component.element.style.marginLeft = `${insetStart}px`;
|
|
84
|
+
component.element.style.marginRight = `${insetEnd}px`;
|
|
85
|
+
} else {
|
|
86
|
+
const insetStart = config.insetStart !== undefined ? config.insetStart : 16;
|
|
87
|
+
const insetEnd = config.insetEnd !== undefined ? config.insetEnd : (variant === 'middle-inset' ? 16 : 0);
|
|
88
|
+
|
|
89
|
+
component.element.style.marginTop = `${insetStart}px`;
|
|
90
|
+
component.element.style.marginBottom = `${insetEnd}px`;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
...component,
|
|
96
|
+
|
|
97
|
+
getVariant() {
|
|
98
|
+
return variant as 'full-width' | 'inset' | 'middle-inset';
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
setVariant(newVariant: 'full-width' | 'inset' | 'middle-inset') {
|
|
102
|
+
// Remove existing variant class
|
|
103
|
+
component.element.classList.remove(`${component.getClass('divider')}--${variant}`);
|
|
104
|
+
|
|
105
|
+
// Add new variant class
|
|
106
|
+
component.element.classList.add(`${component.getClass('divider')}--${newVariant}`);
|
|
107
|
+
|
|
108
|
+
// Update styles
|
|
109
|
+
const currentOrientation = component.getOrientation ? component.getOrientation() : orientation;
|
|
110
|
+
|
|
111
|
+
if (newVariant === 'full-width') {
|
|
112
|
+
if (currentOrientation === 'horizontal') {
|
|
113
|
+
component.element.style.marginLeft = '';
|
|
114
|
+
component.element.style.marginRight = '';
|
|
115
|
+
} else {
|
|
116
|
+
component.element.style.marginTop = '';
|
|
117
|
+
component.element.style.marginBottom = '';
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
const insetStart = config.insetStart !== undefined ? config.insetStart : 16;
|
|
121
|
+
const insetEnd = config.insetEnd !== undefined ? config.insetEnd : (newVariant === 'middle-inset' ? 16 : 0);
|
|
122
|
+
|
|
123
|
+
if (currentOrientation === 'horizontal') {
|
|
124
|
+
component.element.style.marginLeft = `${insetStart}px`;
|
|
125
|
+
component.element.style.marginRight = `${insetEnd}px`;
|
|
126
|
+
} else {
|
|
127
|
+
component.element.style.marginTop = `${insetStart}px`;
|
|
128
|
+
component.element.style.marginBottom = `${insetEnd}px`;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return this as unknown as DividerComponent;
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
setInset(insetStart?: number, insetEnd?: number) {
|
|
136
|
+
const currentOrientation = component.getOrientation ? component.getOrientation() : orientation;
|
|
137
|
+
const currentVariant = component.getVariant ? component.getVariant() : variant;
|
|
138
|
+
|
|
139
|
+
if (currentVariant !== 'full-width') {
|
|
140
|
+
if (currentOrientation === 'horizontal') {
|
|
141
|
+
if (insetStart !== undefined) {
|
|
142
|
+
component.element.style.marginLeft = `${insetStart}px`;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (insetEnd !== undefined) {
|
|
146
|
+
component.element.style.marginRight = `${insetEnd}px`;
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
if (insetStart !== undefined) {
|
|
150
|
+
component.element.style.marginTop = `${insetStart}px`;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (insetEnd !== undefined) {
|
|
154
|
+
component.element.style.marginBottom = `${insetEnd}px`;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return this as unknown as DividerComponent;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Adds style customization to divider
|
|
166
|
+
*
|
|
167
|
+
* @param config - Divider configuration
|
|
168
|
+
* @returns Function that enhances a component with style capabilities
|
|
169
|
+
*/
|
|
170
|
+
export const withStyle = (config: DividerConfig) =>
|
|
171
|
+
<C extends ElementComponent & Partial<DividerComponent>>(component: C): C & Partial<DividerComponent> => {
|
|
172
|
+
// Apply custom color if provided
|
|
173
|
+
if (config.color) {
|
|
174
|
+
component.element.style.backgroundColor = config.color;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Apply thickness
|
|
178
|
+
const thickness = config.thickness || 1;
|
|
179
|
+
const orientation = config.orientation || 'horizontal';
|
|
180
|
+
|
|
181
|
+
if (orientation === 'horizontal') {
|
|
182
|
+
component.element.style.height = `${thickness}px`;
|
|
183
|
+
} else {
|
|
184
|
+
component.element.style.width = `${thickness}px`;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return {
|
|
188
|
+
...component,
|
|
189
|
+
|
|
190
|
+
setThickness(newThickness: number) {
|
|
191
|
+
const currentOrientation = component.getOrientation ? component.getOrientation() : orientation;
|
|
192
|
+
|
|
193
|
+
if (currentOrientation === 'horizontal') {
|
|
194
|
+
component.element.style.height = `${newThickness}px`;
|
|
195
|
+
} else {
|
|
196
|
+
component.element.style.width = `${newThickness}px`;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return this as unknown as DividerComponent;
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
setColor(color: string) {
|
|
203
|
+
component.element.style.backgroundColor = color;
|
|
204
|
+
return this as unknown as DividerComponent;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// src/components/divider/types.ts
|
|
2
|
+
import { BaseComponent, ElementComponent } from '../../core/compose';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Divider component interface
|
|
6
|
+
*/
|
|
7
|
+
export interface DividerComponent extends BaseComponent, ElementComponent {
|
|
8
|
+
/**
|
|
9
|
+
* Gets current orientation
|
|
10
|
+
* @returns Current orientation
|
|
11
|
+
*/
|
|
12
|
+
getOrientation: () => 'horizontal' | 'vertical';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Sets orientation of the divider
|
|
16
|
+
* @param orientation - New orientation
|
|
17
|
+
* @returns DividerComponent instance for chaining
|
|
18
|
+
*/
|
|
19
|
+
setOrientation: (orientation: 'horizontal' | 'vertical') => DividerComponent;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Gets current variant
|
|
23
|
+
* @returns Current variant
|
|
24
|
+
*/
|
|
25
|
+
getVariant: () => 'full-width' | 'inset' | 'middle-inset';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Sets variant of the divider
|
|
29
|
+
* @param variant - New variant
|
|
30
|
+
* @returns DividerComponent instance for chaining
|
|
31
|
+
*/
|
|
32
|
+
setVariant: (variant: 'full-width' | 'inset' | 'middle-inset') => DividerComponent;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Sets custom inset values
|
|
36
|
+
* @param insetStart - Start inset value
|
|
37
|
+
* @param insetEnd - End inset value
|
|
38
|
+
* @returns DividerComponent instance for chaining
|
|
39
|
+
*/
|
|
40
|
+
setInset: (insetStart?: number, insetEnd?: number) => DividerComponent;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Sets thickness of the divider
|
|
44
|
+
* @param thickness - Thickness in pixels
|
|
45
|
+
* @returns DividerComponent instance for chaining
|
|
46
|
+
*/
|
|
47
|
+
setThickness: (thickness: number) => DividerComponent;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Sets custom color for the divider
|
|
51
|
+
* @param color - CSS color value
|
|
52
|
+
* @returns DividerComponent instance for chaining
|
|
53
|
+
*/
|
|
54
|
+
setColor: (color: string) => DividerComponent;
|
|
55
|
+
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
// src/components/extended-fab/_styles.scss
|
|
2
|
+
@use '../../styles/abstract/base' as base;
|
|
3
|
+
@use '../../styles/abstract/variables' as v;
|
|
4
|
+
@use '../../styles/abstract/functions' as f;
|
|
5
|
+
@use '../../styles/abstract/mixins' as m;
|
|
6
|
+
@use '../../styles/abstract/theme' as t;
|
|
7
|
+
|
|
8
|
+
$component: '#{base.$prefix}-extended-fab';
|
|
9
|
+
|
|
10
|
+
.#{$component} {
|
|
11
|
+
// Base styles
|
|
12
|
+
position: relative;
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
border: none;
|
|
17
|
+
background-color: t.color('primary-container');
|
|
18
|
+
color: t.color('on-primary-container');
|
|
19
|
+
font: inherit;
|
|
20
|
+
text-decoration: none;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
user-select: none;
|
|
23
|
+
vertical-align: middle;
|
|
24
|
+
appearance: none;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
|
|
27
|
+
// Extended FAB uses elevation in all variants
|
|
28
|
+
@include m.elevation(3);
|
|
29
|
+
|
|
30
|
+
// Transitions for all property changes including collapse/expand
|
|
31
|
+
@include m.motion-transition(
|
|
32
|
+
transform,
|
|
33
|
+
box-shadow,
|
|
34
|
+
background-color,
|
|
35
|
+
color,
|
|
36
|
+
width,
|
|
37
|
+
border-radius,
|
|
38
|
+
padding
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
// Focus styles
|
|
42
|
+
&:focus {
|
|
43
|
+
outline: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&:focus-visible {
|
|
47
|
+
outline: 2px solid t.color('outline');
|
|
48
|
+
outline-offset: 2px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Extended FAB dimensions (56dp height, min-width 80dp)
|
|
52
|
+
height: 56px;
|
|
53
|
+
min-width: 80px;
|
|
54
|
+
padding: 0 16px;
|
|
55
|
+
border-radius: f.get-shape('large'); // 16px corners
|
|
56
|
+
|
|
57
|
+
// Flexbox layout for icon and text
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: row;
|
|
60
|
+
align-items: center;
|
|
61
|
+
gap: 8px;
|
|
62
|
+
|
|
63
|
+
// Text styles
|
|
64
|
+
&-text {
|
|
65
|
+
@include m.typography('label-large');
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
text-overflow: ellipsis;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Icon sizing and positioning
|
|
72
|
+
&-icon {
|
|
73
|
+
display: inline-flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
width: 24px;
|
|
77
|
+
height: 24px;
|
|
78
|
+
flex-shrink: 0;
|
|
79
|
+
|
|
80
|
+
svg {
|
|
81
|
+
width: 24px;
|
|
82
|
+
height: 24px;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Width variants
|
|
87
|
+
&--fixed {
|
|
88
|
+
// Default behavior (width based on content)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&--fluid {
|
|
92
|
+
width: 100%;
|
|
93
|
+
justify-content: center;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// RTL support for icon positioning
|
|
97
|
+
html[dir="rtl"] & {
|
|
98
|
+
.#{$component}-icon {
|
|
99
|
+
order: 1;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.#{$component}-text {
|
|
103
|
+
order: 0;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Color variants - primary is the default
|
|
108
|
+
|
|
109
|
+
// Primary variant (default)
|
|
110
|
+
&--primary {
|
|
111
|
+
background-color: t.color('primary-container');
|
|
112
|
+
color: t.color('on-primary-container');
|
|
113
|
+
|
|
114
|
+
&:hover {
|
|
115
|
+
@include m.state-layer(t.color('on-primary-container'), 'hover');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&:active {
|
|
119
|
+
@include m.state-layer(t.color('on-primary-container'), 'pressed');
|
|
120
|
+
@include m.elevation(1);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Secondary variant
|
|
125
|
+
&--secondary {
|
|
126
|
+
background-color: t.color('secondary-container');
|
|
127
|
+
color: t.color('on-secondary-container');
|
|
128
|
+
|
|
129
|
+
&:hover {
|
|
130
|
+
@include m.state-layer(t.color('on-secondary-container'), 'hover');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&:active {
|
|
134
|
+
@include m.state-layer(t.color('on-secondary-container'), 'pressed');
|
|
135
|
+
@include m.elevation(1);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Tertiary variant
|
|
140
|
+
&--tertiary {
|
|
141
|
+
background-color: t.color('tertiary-container');
|
|
142
|
+
color: t.color('on-tertiary-container');
|
|
143
|
+
|
|
144
|
+
&:hover {
|
|
145
|
+
@include m.state-layer(t.color('on-tertiary-container'), 'hover');
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&:active {
|
|
149
|
+
@include m.state-layer(t.color('on-tertiary-container'), 'pressed');
|
|
150
|
+
@include m.elevation(1);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Surface variant
|
|
155
|
+
&--surface {
|
|
156
|
+
background-color: t.color('surface');
|
|
157
|
+
color: t.color('primary');
|
|
158
|
+
|
|
159
|
+
&:hover {
|
|
160
|
+
@include m.state-layer(t.color('primary'), 'hover');
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
&:active {
|
|
164
|
+
@include m.state-layer(t.color('primary'), 'pressed');
|
|
165
|
+
@include m.elevation(1);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Collapsed state (transforms into regular FAB)
|
|
170
|
+
&--collapsed {
|
|
171
|
+
width: 56px;
|
|
172
|
+
min-width: 56px;
|
|
173
|
+
border-radius: 50%;
|
|
174
|
+
padding: 0;
|
|
175
|
+
|
|
176
|
+
.#{$component}-text {
|
|
177
|
+
// Hide text but keep it accessible to screen readers
|
|
178
|
+
|
|
179
|
+
display: none;
|
|
180
|
+
opacity: 0;
|
|
181
|
+
width: 0;
|
|
182
|
+
overflow: hidden;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.#{$component}-icon {
|
|
186
|
+
margin: 0;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Lowered state (when pressed)
|
|
191
|
+
&--lowered {
|
|
192
|
+
@include m.elevation(1);
|
|
193
|
+
transform: translateY(1px);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Disabled state
|
|
197
|
+
&--disabled,
|
|
198
|
+
&:disabled {
|
|
199
|
+
pointer-events: none;
|
|
200
|
+
@include m.elevation(0);
|
|
201
|
+
background-color: t.alpha('on-surface', 0.12);
|
|
202
|
+
color: t.alpha('on-surface', 0.38);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Positioning utilities
|
|
206
|
+
&--top-right {
|
|
207
|
+
position: fixed;
|
|
208
|
+
top: 16px;
|
|
209
|
+
right: 16px;
|
|
210
|
+
z-index: v.z-index('dropdown');
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
&--top-left {
|
|
214
|
+
position: fixed;
|
|
215
|
+
top: 16px;
|
|
216
|
+
left: 16px;
|
|
217
|
+
z-index: v.z-index('dropdown');
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
&--bottom-right {
|
|
221
|
+
position: fixed;
|
|
222
|
+
bottom: 16px;
|
|
223
|
+
right: 16px;
|
|
224
|
+
z-index: v.z-index('dropdown');
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
&--bottom-left {
|
|
228
|
+
position: fixed;
|
|
229
|
+
bottom: 16px;
|
|
230
|
+
left: 16px;
|
|
231
|
+
z-index: v.z-index('dropdown');
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Optional animations
|
|
235
|
+
@keyframes extended-fab-enter {
|
|
236
|
+
from {
|
|
237
|
+
transform: scale(0);
|
|
238
|
+
opacity: 0;
|
|
239
|
+
}
|
|
240
|
+
to {
|
|
241
|
+
transform: scale(1);
|
|
242
|
+
opacity: 1;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
&--animate-enter {
|
|
247
|
+
animation: extended-fab-enter 0.3s f.get-motion-easing('emphasized-decelerate') forwards;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Responsive behavior for different screen sizes
|
|
251
|
+
@media (max-width: v.breakpoint('sm')) {
|
|
252
|
+
// Center alignment option for mobile
|
|
253
|
+
&--center-mobile {
|
|
254
|
+
left: 50%;
|
|
255
|
+
transform: translateX(-50%);
|
|
256
|
+
|
|
257
|
+
&.#{$component}--lowered {
|
|
258
|
+
transform: translateX(-50%) translateY(1px);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Collapsible behavior on scroll
|
|
264
|
+
&--collapsible {
|
|
265
|
+
transition-duration: 0.2s;
|
|
266
|
+
}
|
|
267
|
+
}
|