mtrl 0.2.2 → 0.2.4
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/.typedocignore +11 -0
- package/DOCS.md +153 -0
- package/index.ts +18 -3
- package/package.json +7 -2
- package/src/components/badge/_styles.scss +174 -0
- package/src/components/badge/api.ts +292 -0
- package/src/components/badge/badge.ts +52 -0
- package/src/components/badge/config.ts +68 -0
- package/src/components/badge/constants.ts +30 -0
- package/src/components/badge/features.ts +185 -0
- package/src/components/badge/index.ts +4 -0
- package/src/components/badge/types.ts +105 -0
- package/src/components/button/types.ts +174 -29
- package/src/components/carousel/_styles.scss +645 -0
- package/src/components/carousel/api.ts +147 -0
- package/src/components/carousel/carousel.ts +178 -0
- package/src/components/carousel/config.ts +91 -0
- package/src/components/carousel/constants.ts +95 -0
- package/src/components/carousel/features/drag.ts +388 -0
- package/src/components/carousel/features/index.ts +8 -0
- package/src/components/carousel/features/slides.ts +682 -0
- package/src/components/carousel/index.ts +38 -0
- package/src/components/carousel/types.ts +327 -0
- package/src/components/dialog/_styles.scss +213 -0
- package/src/components/dialog/api.ts +283 -0
- package/src/components/dialog/config.ts +113 -0
- package/src/components/dialog/constants.ts +32 -0
- package/src/components/dialog/dialog.ts +56 -0
- package/src/components/dialog/features.ts +713 -0
- package/src/components/dialog/index.ts +15 -0
- package/src/components/dialog/types.ts +221 -0
- package/src/components/progress/_styles.scss +13 -1
- package/src/components/progress/api.ts +2 -2
- package/src/components/progress/progress.ts +2 -2
- package/src/components/progress/types.ts +3 -0
- package/src/components/radios/_styles.scss +232 -0
- package/src/components/radios/api.ts +100 -0
- package/src/components/radios/config.ts +60 -0
- package/src/components/radios/constants.ts +28 -0
- package/src/components/radios/index.ts +4 -0
- package/src/components/radios/radio.ts +269 -0
- package/src/components/radios/radios.ts +42 -0
- package/src/components/radios/types.ts +232 -0
- package/src/components/sheet/_styles.scss +236 -0
- package/src/components/sheet/api.ts +96 -0
- package/src/components/sheet/config.ts +66 -0
- package/src/components/sheet/constants.ts +20 -0
- package/src/components/sheet/features/content.ts +51 -0
- package/src/components/sheet/features/gestures.ts +177 -0
- package/src/components/sheet/features/index.ts +6 -0
- package/src/components/sheet/features/position.ts +42 -0
- package/src/components/sheet/features/state.ts +116 -0
- package/src/components/sheet/features/title.ts +86 -0
- package/src/components/sheet/index.ts +4 -0
- package/src/components/sheet/sheet.ts +57 -0
- package/src/components/sheet/types.ts +266 -0
- package/src/components/slider/_styles.scss +518 -0
- package/src/components/slider/api.ts +336 -0
- package/src/components/slider/config.ts +145 -0
- package/src/components/slider/constants.ts +28 -0
- package/src/components/slider/features/appearance.ts +140 -0
- package/src/components/slider/features/disabled.ts +43 -0
- package/src/components/slider/features/events.ts +164 -0
- package/src/components/slider/features/index.ts +5 -0
- package/src/components/slider/features/interactions.ts +256 -0
- package/src/components/slider/features/keyboard.ts +114 -0
- package/src/components/slider/features/slider.ts +336 -0
- package/src/components/slider/features/structure.ts +264 -0
- package/src/components/slider/features/ui.ts +518 -0
- package/src/components/slider/index.ts +9 -0
- package/src/components/slider/slider.ts +58 -0
- package/src/components/slider/types.ts +166 -0
- package/src/components/tabs/_styles.scss +224 -0
- package/src/components/tabs/api.ts +443 -0
- package/src/components/tabs/config.ts +80 -0
- package/src/components/tabs/constants.ts +12 -0
- package/src/components/tabs/index.ts +4 -0
- package/src/components/tabs/tabs.ts +52 -0
- package/src/components/tabs/types.ts +247 -0
- package/src/components/textfield/_styles.scss +97 -4
- package/src/components/tooltip/_styles.scss +241 -0
- package/src/components/tooltip/api.ts +411 -0
- package/src/components/tooltip/config.ts +78 -0
- package/src/components/tooltip/constants.ts +27 -0
- package/src/components/tooltip/index.ts +4 -0
- package/src/components/tooltip/tooltip.ts +60 -0
- package/src/components/tooltip/types.ts +178 -0
- package/src/core/build/_ripple.scss +79 -0
- package/src/core/build/constants.ts +48 -0
- package/src/core/build/icon.ts +137 -0
- package/src/core/build/ripple.ts +216 -0
- package/src/core/build/text.ts +91 -0
- package/src/index.ts +9 -1
- package/src/styles/abstract/_variables.scss +24 -12
- package/tsconfig.json +22 -0
- package/typedoc.json +28 -0
- package/typedoc.simple.json +14 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// src/core/build/text.ts
|
|
2
|
+
/**
|
|
3
|
+
* @module core/build
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Configuration for text manager
|
|
8
|
+
*/
|
|
9
|
+
export interface TextConfig {
|
|
10
|
+
/**
|
|
11
|
+
* CSS class prefix
|
|
12
|
+
*/
|
|
13
|
+
prefix?: string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Component type
|
|
17
|
+
*/
|
|
18
|
+
type?: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Element to insert before
|
|
22
|
+
*/
|
|
23
|
+
beforeElement?: HTMLElement;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Text manager interface
|
|
28
|
+
*/
|
|
29
|
+
export interface TextManager {
|
|
30
|
+
/**
|
|
31
|
+
* Sets text content
|
|
32
|
+
* @param text - Text content to set
|
|
33
|
+
* @returns TextManager instance for chaining
|
|
34
|
+
*/
|
|
35
|
+
setText: (text: string) => TextManager;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Gets current text content
|
|
39
|
+
* @returns Current text
|
|
40
|
+
*/
|
|
41
|
+
getText: () => string;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Gets text element
|
|
45
|
+
* @returns Text element or null if not created
|
|
46
|
+
*/
|
|
47
|
+
getElement: () => HTMLElement | null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Creates a text manager for a component
|
|
52
|
+
*
|
|
53
|
+
* @param element - Parent element
|
|
54
|
+
* @param config - Text configuration
|
|
55
|
+
* @returns Text manager interface
|
|
56
|
+
*/
|
|
57
|
+
export const createText = (element: HTMLElement, config: TextConfig = {}): TextManager => {
|
|
58
|
+
let textElement: HTMLElement | null = null;
|
|
59
|
+
const PREFIX = config.prefix || 'mtrl';
|
|
60
|
+
|
|
61
|
+
const createElement = (content: string): HTMLElement => {
|
|
62
|
+
const span = document.createElement('span');
|
|
63
|
+
span.className = `${PREFIX}-${config.type || 'component'}-text`;
|
|
64
|
+
span.textContent = content;
|
|
65
|
+
return span;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
setText(text: string): TextManager {
|
|
70
|
+
if (!textElement && text) {
|
|
71
|
+
textElement = createElement(text);
|
|
72
|
+
if (config.beforeElement) {
|
|
73
|
+
element.insertBefore(textElement, config.beforeElement);
|
|
74
|
+
} else {
|
|
75
|
+
element.appendChild(textElement);
|
|
76
|
+
}
|
|
77
|
+
} else if (textElement) {
|
|
78
|
+
textElement.textContent = text;
|
|
79
|
+
}
|
|
80
|
+
return this;
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
getText(): string {
|
|
84
|
+
return textElement ? textElement.textContent || '' : '';
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
getElement(): HTMLElement | null {
|
|
88
|
+
return textElement;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -2,13 +2,21 @@
|
|
|
2
2
|
export { createElement } from './core/dom/create'
|
|
3
3
|
export { default as createLayout } from './core/layout'
|
|
4
4
|
export { default as createButton } from './components/button'
|
|
5
|
+
export { default as createBadge } from './components/badge'
|
|
5
6
|
export { default as createCard } from './components/card'
|
|
7
|
+
export { default as createCarousel } from './components/carousel'
|
|
6
8
|
export { default as createCheckbox } from './components/checkbox'
|
|
7
9
|
export { default as createChip } from './components/chip'
|
|
10
|
+
export { default as createDialog } from './components/dialog'
|
|
8
11
|
export { default as createMenu } from './components/menu'
|
|
9
12
|
export { default as createNavigation } from './components/navigation'
|
|
10
13
|
export { default as createProgress } from './components/progress'
|
|
14
|
+
export { default as createRadios } from './components/radios'
|
|
15
|
+
export { default as createSheet } from './components/sheet'
|
|
16
|
+
export { default as createSlider } from './components/slider'
|
|
11
17
|
export { default as createSnackbar } from './components/snackbar'
|
|
12
18
|
export { default as createSwitch } from './components/switch'
|
|
19
|
+
export { default as createTabs } from './components/tabs'
|
|
13
20
|
export { default as createTextfield } from './components/textfield'
|
|
14
|
-
export { default as
|
|
21
|
+
export { default as createTooltip } from './components/tooltip'
|
|
22
|
+
export { default as createList } from './components/list'
|
|
@@ -180,18 +180,22 @@ $z-index: (
|
|
|
180
180
|
) !default;
|
|
181
181
|
|
|
182
182
|
// Component-specific tokens
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
183
|
+
$card: (
|
|
184
|
+
'width': 344px,
|
|
185
|
+
'width-small': 344px,
|
|
186
|
+
'width-medium': 480px,
|
|
187
|
+
'width-large': 624px,
|
|
188
|
+
'border-radius': 12px,
|
|
189
|
+
'padding': 16px
|
|
190
|
+
) !default;
|
|
191
|
+
|
|
192
|
+
// Chip configuration
|
|
193
|
+
$chip-config: (
|
|
194
|
+
'height': 32px,
|
|
195
|
+
'border-radius': 8px,
|
|
196
|
+
'padding-horizontal': 12px
|
|
197
|
+
) !default;
|
|
198
|
+
|
|
195
199
|
$button: (
|
|
196
200
|
'height': 40px,
|
|
197
201
|
'min-width': 64px,
|
|
@@ -234,4 +238,12 @@ $button: (
|
|
|
234
238
|
|
|
235
239
|
@function button($prop) {
|
|
236
240
|
@return map.get($button, $prop);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
@function card($key) {
|
|
244
|
+
@return map.get($card, $key);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
@function chip($key) {
|
|
248
|
+
@return map.get($chip-config, $key);
|
|
237
249
|
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"outDir": "./dist",
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"strict": false,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"sourceMap": true,
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"jsx": "preserve",
|
|
15
|
+
"noImplicitAny": false,
|
|
16
|
+
"allowJs": true,
|
|
17
|
+
"noErrorTruncation": true,
|
|
18
|
+
"noEmitOnError": false
|
|
19
|
+
},
|
|
20
|
+
"include": ["src/**/*"],
|
|
21
|
+
"exclude": ["node_modules", "**/*.test.ts", "**/*.spec.ts"]
|
|
22
|
+
}
|
package/typedoc.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// typedoc.json
|
|
2
|
+
{
|
|
3
|
+
"entryPoints": ["./src/index.ts"],
|
|
4
|
+
"out": "docs",
|
|
5
|
+
"name": "MTRL Documentation",
|
|
6
|
+
"exclude": ["**/node_modules/**", "**/*.test.ts", "**/*.spec.ts"],
|
|
7
|
+
"excludePrivate": true,
|
|
8
|
+
"excludeExternals": true,
|
|
9
|
+
"theme": "default",
|
|
10
|
+
"categoryOrder": ["Core", "Components", "Utilities", "*"],
|
|
11
|
+
"categorizeByGroup": true,
|
|
12
|
+
"readme": "README.md",
|
|
13
|
+
"includeVersion": true,
|
|
14
|
+
"hideGenerator": true,
|
|
15
|
+
"searchInComments": true,
|
|
16
|
+
"sort": ["static-first", "alphabetical"],
|
|
17
|
+
"navigationLinks": {
|
|
18
|
+
"GitHub": "https://github.com/floor/mtrl"
|
|
19
|
+
},
|
|
20
|
+
"skipErrorChecking": true,
|
|
21
|
+
"skipLibCheck": true,
|
|
22
|
+
"skipDiagnostics": true,
|
|
23
|
+
"disableSources": false,
|
|
24
|
+
"validation": {
|
|
25
|
+
"invalidLink": false,
|
|
26
|
+
"notDocumented": false
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// typedoc.simple.json
|
|
2
|
+
{
|
|
3
|
+
"entryPoints": ["./src/index.js"],
|
|
4
|
+
"out": "docs",
|
|
5
|
+
"name": "MTRL Documentation",
|
|
6
|
+
"exclude": ["**/node_modules/**", "**/*.test.js", "**/*.spec.js"],
|
|
7
|
+
"excludePrivate": true,
|
|
8
|
+
"theme": "default",
|
|
9
|
+
"readme": "README.md",
|
|
10
|
+
"includeVersion": true,
|
|
11
|
+
"entryPointStrategy": "expand",
|
|
12
|
+
"treatWarningsAsErrors": false,
|
|
13
|
+
"tsconfig": false
|
|
14
|
+
}
|