mtrl 0.2.2 → 0.2.3

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.
Files changed (92) hide show
  1. package/.typedocignore +11 -0
  2. package/DOCS.md +153 -0
  3. package/index.ts +18 -3
  4. package/package.json +7 -2
  5. package/src/components/badge/_styles.scss +174 -0
  6. package/src/components/badge/api.ts +292 -0
  7. package/src/components/badge/badge.ts +52 -0
  8. package/src/components/badge/config.ts +68 -0
  9. package/src/components/badge/constants.ts +30 -0
  10. package/src/components/badge/features.ts +185 -0
  11. package/src/components/badge/index.ts +4 -0
  12. package/src/components/badge/types.ts +105 -0
  13. package/src/components/button/types.ts +174 -29
  14. package/src/components/carousel/_styles.scss +645 -0
  15. package/src/components/carousel/api.ts +147 -0
  16. package/src/components/carousel/carousel.ts +178 -0
  17. package/src/components/carousel/config.ts +91 -0
  18. package/src/components/carousel/constants.ts +95 -0
  19. package/src/components/carousel/features/drag.ts +388 -0
  20. package/src/components/carousel/features/index.ts +8 -0
  21. package/src/components/carousel/features/slides.ts +682 -0
  22. package/src/components/carousel/index.ts +38 -0
  23. package/src/components/carousel/types.ts +327 -0
  24. package/src/components/dialog/_styles.scss +213 -0
  25. package/src/components/dialog/api.ts +283 -0
  26. package/src/components/dialog/config.ts +113 -0
  27. package/src/components/dialog/constants.ts +32 -0
  28. package/src/components/dialog/dialog.ts +56 -0
  29. package/src/components/dialog/features.ts +713 -0
  30. package/src/components/dialog/index.ts +15 -0
  31. package/src/components/dialog/types.ts +221 -0
  32. package/src/components/progress/_styles.scss +13 -1
  33. package/src/components/progress/api.ts +2 -2
  34. package/src/components/progress/progress.ts +2 -2
  35. package/src/components/progress/types.ts +3 -0
  36. package/src/components/radios/_styles.scss +232 -0
  37. package/src/components/radios/api.ts +100 -0
  38. package/src/components/radios/config.ts +60 -0
  39. package/src/components/radios/constants.ts +28 -0
  40. package/src/components/radios/index.ts +4 -0
  41. package/src/components/radios/radio.ts +269 -0
  42. package/src/components/radios/radios.ts +42 -0
  43. package/src/components/radios/types.ts +232 -0
  44. package/src/components/sheet/_styles.scss +236 -0
  45. package/src/components/sheet/api.ts +96 -0
  46. package/src/components/sheet/config.ts +66 -0
  47. package/src/components/sheet/constants.ts +20 -0
  48. package/src/components/sheet/features/content.ts +51 -0
  49. package/src/components/sheet/features/gestures.ts +177 -0
  50. package/src/components/sheet/features/index.ts +6 -0
  51. package/src/components/sheet/features/position.ts +42 -0
  52. package/src/components/sheet/features/state.ts +116 -0
  53. package/src/components/sheet/features/title.ts +86 -0
  54. package/src/components/sheet/index.ts +4 -0
  55. package/src/components/sheet/sheet.ts +57 -0
  56. package/src/components/sheet/types.ts +266 -0
  57. package/src/components/slider/_styles.scss +518 -0
  58. package/src/components/slider/api.ts +336 -0
  59. package/src/components/slider/config.ts +145 -0
  60. package/src/components/slider/constants.ts +28 -0
  61. package/src/components/slider/features/appearance.ts +140 -0
  62. package/src/components/slider/features/disabled.ts +43 -0
  63. package/src/components/slider/features/events.ts +164 -0
  64. package/src/components/slider/features/index.ts +5 -0
  65. package/src/components/slider/features/interactions.ts +256 -0
  66. package/src/components/slider/features/keyboard.ts +114 -0
  67. package/src/components/slider/features/slider.ts +336 -0
  68. package/src/components/slider/features/structure.ts +264 -0
  69. package/src/components/slider/features/ui.ts +518 -0
  70. package/src/components/slider/index.ts +9 -0
  71. package/src/components/slider/slider.ts +58 -0
  72. package/src/components/slider/types.ts +166 -0
  73. package/src/components/tabs/_styles.scss +224 -0
  74. package/src/components/tabs/api.ts +443 -0
  75. package/src/components/tabs/config.ts +80 -0
  76. package/src/components/tabs/constants.ts +12 -0
  77. package/src/components/tabs/index.ts +4 -0
  78. package/src/components/tabs/tabs.ts +52 -0
  79. package/src/components/tabs/types.ts +247 -0
  80. package/src/components/textfield/_styles.scss +97 -4
  81. package/src/components/tooltip/_styles.scss +241 -0
  82. package/src/components/tooltip/api.ts +411 -0
  83. package/src/components/tooltip/config.ts +78 -0
  84. package/src/components/tooltip/constants.ts +27 -0
  85. package/src/components/tooltip/index.ts +4 -0
  86. package/src/components/tooltip/tooltip.ts +60 -0
  87. package/src/components/tooltip/types.ts +178 -0
  88. package/src/index.ts +9 -1
  89. package/src/styles/abstract/_variables.scss +24 -12
  90. package/tsconfig.json +22 -0
  91. package/typedoc.json +28 -0
  92. package/typedoc.simple.json +14 -0
@@ -0,0 +1,178 @@
1
+ // src/components/tooltip/types.ts
2
+ import { TOOLTIP_POSITIONS, TOOLTIP_VARIANTS } from './constants';
3
+
4
+ /**
5
+ * Configuration interface for the Tooltip component
6
+ * @category Components
7
+ */
8
+ export interface TooltipConfig {
9
+ /**
10
+ * Tooltip content text
11
+ * @example 'Delete item'
12
+ */
13
+ text?: string;
14
+
15
+ /**
16
+ * HTML element that triggers the tooltip
17
+ * @example document.querySelector('#my-button')
18
+ */
19
+ target?: HTMLElement;
20
+
21
+ /**
22
+ * Tooltip position relative to the target
23
+ * @default 'bottom'
24
+ */
25
+ position?: keyof typeof TOOLTIP_POSITIONS | string;
26
+
27
+ /**
28
+ * Tooltip variant that determines visual styling
29
+ * @default 'default'
30
+ */
31
+ variant?: keyof typeof TOOLTIP_VARIANTS | string;
32
+
33
+ /**
34
+ * Whether the tooltip is initially visible
35
+ * @default false
36
+ */
37
+ visible?: boolean;
38
+
39
+ /**
40
+ * Show delay in milliseconds
41
+ * @default 300
42
+ */
43
+ showDelay?: number;
44
+
45
+ /**
46
+ * Hide delay in milliseconds
47
+ * @default 100
48
+ */
49
+ hideDelay?: number;
50
+
51
+ /**
52
+ * Whether to show the tooltip on focus
53
+ * @default true
54
+ */
55
+ showOnFocus?: boolean;
56
+
57
+ /**
58
+ * Whether to show the tooltip on hover
59
+ * @default true
60
+ */
61
+ showOnHover?: boolean;
62
+
63
+ /**
64
+ * Additional CSS classes to add to the tooltip
65
+ */
66
+ class?: string;
67
+
68
+ /**
69
+ * Component prefix for class names
70
+ * @default 'mtrl'
71
+ */
72
+ prefix?: string;
73
+
74
+ /**
75
+ * Component name used in class generation
76
+ */
77
+ componentName?: string;
78
+
79
+ /**
80
+ * Optional z-index for the tooltip
81
+ */
82
+ zIndex?: number;
83
+
84
+ /**
85
+ * Whether to enable rich (HTML) content
86
+ * @default false
87
+ */
88
+ rich?: boolean;
89
+ }
90
+
91
+ /**
92
+ * Tooltip component interface
93
+ * @category Components
94
+ */
95
+ export interface TooltipComponent {
96
+ /** The tooltip's DOM element */
97
+ element: HTMLElement;
98
+
99
+ /** The tooltip's target element */
100
+ target: HTMLElement | null;
101
+
102
+ /** API for managing component lifecycle */
103
+ lifecycle: {
104
+ /** Destroys the component and cleans up resources */
105
+ destroy: () => void;
106
+ };
107
+
108
+ /**
109
+ * Gets a class name with the component's prefix
110
+ * @param name - Base class name
111
+ * @returns Prefixed class name
112
+ */
113
+ getClass: (name: string) => string;
114
+
115
+ /**
116
+ * Sets the tooltip text content
117
+ * @param text - New text content
118
+ * @returns The tooltip component for chaining
119
+ */
120
+ setText: (text: string) => TooltipComponent;
121
+
122
+ /**
123
+ * Gets the tooltip text content
124
+ * @returns Tooltip text content
125
+ */
126
+ getText: () => string;
127
+
128
+ /**
129
+ * Sets the tooltip position
130
+ * @param position - Position value
131
+ * @returns The tooltip component for chaining
132
+ */
133
+ setPosition: (position: keyof typeof TOOLTIP_POSITIONS | string) => TooltipComponent;
134
+
135
+ /**
136
+ * Gets the current tooltip position
137
+ * @returns Current position
138
+ */
139
+ getPosition: () => string;
140
+
141
+ /**
142
+ * Sets the tooltip target element
143
+ * @param target - Element to attach tooltip to
144
+ * @returns The tooltip component for chaining
145
+ */
146
+ setTarget: (target: HTMLElement) => TooltipComponent;
147
+
148
+ /**
149
+ * Shows the tooltip
150
+ * @param immediate - Whether to show immediately (bypassing delay)
151
+ * @returns The tooltip component for chaining
152
+ */
153
+ show: (immediate?: boolean) => TooltipComponent;
154
+
155
+ /**
156
+ * Hides the tooltip
157
+ * @param immediate - Whether to hide immediately (bypassing delay)
158
+ * @returns The tooltip component for chaining
159
+ */
160
+ hide: (immediate?: boolean) => TooltipComponent;
161
+
162
+ /**
163
+ * Checks if the tooltip is currently visible
164
+ * @returns Whether the tooltip is visible
165
+ */
166
+ isVisible: () => boolean;
167
+
168
+ /**
169
+ * Updates the tooltip's position relative to its target
170
+ * @returns The tooltip component for chaining
171
+ */
172
+ updatePosition: () => TooltipComponent;
173
+
174
+ /**
175
+ * Destroys the tooltip component and cleans up resources
176
+ */
177
+ destroy: () => void;
178
+ }
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 createList } from './components/list'
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
- @function card($key) {
184
- $card: (
185
- 'width': 344px,
186
- 'width-small': 344px,
187
- 'width-medium': 480px,
188
- 'width-large': 624px,
189
- 'border-radius': 12px,
190
- 'padding': 16px
191
- );
192
-
193
- @return map-get($card, $key);
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
+ }