mtrl 0.2.4 → 0.2.6

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 (76) hide show
  1. package/package.json +6 -3
  2. package/src/components/badge/_styles.scss +9 -9
  3. package/src/components/button/_styles.scss +0 -56
  4. package/src/components/button/button.ts +0 -2
  5. package/src/components/button/constants.ts +0 -6
  6. package/src/components/button/index.ts +2 -2
  7. package/src/components/button/types.ts +1 -7
  8. package/src/components/card/_styles.scss +67 -25
  9. package/src/components/card/api.ts +54 -3
  10. package/src/components/card/card.ts +33 -2
  11. package/src/components/card/config.ts +143 -21
  12. package/src/components/card/constants.ts +20 -19
  13. package/src/components/card/content.ts +299 -2
  14. package/src/components/card/features.ts +155 -4
  15. package/src/components/card/index.ts +31 -9
  16. package/src/components/card/types.ts +138 -15
  17. package/src/components/chip/chip.ts +1 -9
  18. package/src/components/chip/constants.ts +0 -10
  19. package/src/components/chip/index.ts +1 -1
  20. package/src/components/chip/types.ts +1 -4
  21. package/src/components/progress/_styles.scss +0 -65
  22. package/src/components/progress/config.ts +1 -2
  23. package/src/components/progress/constants.ts +0 -14
  24. package/src/components/progress/index.ts +1 -1
  25. package/src/components/progress/progress.ts +1 -4
  26. package/src/components/progress/types.ts +1 -4
  27. package/src/components/radios/_styles.scss +0 -45
  28. package/src/components/radios/api.ts +85 -60
  29. package/src/components/radios/config.ts +1 -2
  30. package/src/components/radios/constants.ts +0 -9
  31. package/src/components/radios/index.ts +1 -1
  32. package/src/components/radios/radio.ts +34 -11
  33. package/src/components/radios/radios.ts +2 -1
  34. package/src/components/radios/types.ts +1 -7
  35. package/src/components/slider/_styles.scss +193 -281
  36. package/src/components/slider/accessibility.md +59 -0
  37. package/src/components/slider/api.ts +36 -101
  38. package/src/components/slider/config.ts +29 -78
  39. package/src/components/slider/constants.ts +12 -8
  40. package/src/components/slider/features/appearance.ts +1 -47
  41. package/src/components/slider/features/disabled.ts +41 -16
  42. package/src/components/slider/features/interactions.ts +166 -26
  43. package/src/components/slider/features/keyboard.ts +125 -6
  44. package/src/components/slider/features/structure.ts +182 -195
  45. package/src/components/slider/features/ui.ts +234 -303
  46. package/src/components/slider/index.ts +11 -1
  47. package/src/components/slider/slider.ts +1 -1
  48. package/src/components/slider/types.ts +10 -25
  49. package/src/components/tabs/_styles.scss +285 -155
  50. package/src/components/tabs/api.ts +178 -400
  51. package/src/components/tabs/config.ts +46 -52
  52. package/src/components/tabs/constants.ts +85 -8
  53. package/src/components/tabs/features.ts +401 -0
  54. package/src/components/tabs/index.ts +60 -3
  55. package/src/components/tabs/indicator.ts +225 -0
  56. package/src/components/tabs/responsive.ts +144 -0
  57. package/src/components/tabs/scroll-indicators.ts +149 -0
  58. package/src/components/tabs/state.ts +186 -0
  59. package/src/components/tabs/tab-api.ts +258 -0
  60. package/src/components/tabs/tab.ts +255 -0
  61. package/src/components/tabs/tabs.ts +50 -31
  62. package/src/components/tabs/types.ts +324 -128
  63. package/src/components/tabs/utils.ts +107 -0
  64. package/src/components/textfield/_styles.scss +0 -98
  65. package/src/components/textfield/config.ts +2 -3
  66. package/src/components/textfield/constants.ts +0 -14
  67. package/src/components/textfield/index.ts +2 -2
  68. package/src/components/textfield/textfield.ts +0 -2
  69. package/src/components/textfield/types.ts +1 -4
  70. package/src/core/compose/component.ts +1 -1
  71. package/src/core/compose/features/badge.ts +79 -0
  72. package/src/core/compose/features/index.ts +3 -1
  73. package/src/styles/abstract/_theme.scss +106 -2
  74. package/src/components/card/actions.ts +0 -48
  75. package/src/components/card/header.ts +0 -88
  76. package/src/components/card/media.ts +0 -52
@@ -14,104 +14,6 @@ $component: '#{base.$prefix}-textfield';
14
14
  display: inline-flex;
15
15
  flex-direction: column;
16
16
  min-width: 210px;
17
-
18
- // Size variants
19
- &--small {
20
- .#{$component}-input {
21
- height: 40px;
22
- font-size: 14px;
23
- }
24
-
25
- .#{$component}-label {
26
- font-size: 14px;
27
- }
28
-
29
- .#{$component}-helper {
30
- font-size: 11px;
31
- margin-top: 2px;
32
- }
33
-
34
- &.#{$component}--filled {
35
- .#{$component}-input {
36
- padding: 16px 12px 6px;
37
-
38
- &:focus {
39
- padding-bottom: 5px;
40
- }
41
- }
42
-
43
- &:not(.#{$component}--empty) .#{$component}-label,
44
- &.#{$component}--focused .#{$component}-label {
45
- transform: translateY(-85%) scale(0.75);
46
- }
47
- }
48
-
49
- &.#{$component}--outlined {
50
- .#{$component}-input {
51
- padding: 10px 12px 11px;
52
- }
53
-
54
- &:not(.#{$component}--empty) .#{$component}-label,
55
- &.#{$component}--focused .#{$component}-label {
56
- transform: translateY(-130%) scale(0.75);
57
- }
58
-
59
- &.#{$component}--focused .#{$component}-input {
60
- height: 38px;
61
- padding: 9px 11px 10px;
62
- }
63
- }
64
- }
65
-
66
- &--medium {
67
- // Default size, styles already defined in base
68
- }
69
-
70
- &--large {
71
- .#{$component}-input {
72
- height: 64px;
73
- font-size: 16px;
74
- }
75
-
76
- .#{$component}-label {
77
- font-size: 16px;
78
- }
79
-
80
- .#{$component}-helper {
81
- font-size: 13px;
82
- margin-top: 6px;
83
- }
84
-
85
- &.#{$component}--filled {
86
- .#{$component}-input {
87
- padding: 26px 20px 8px;
88
-
89
- &:focus {
90
- padding-bottom: 7px;
91
- }
92
- }
93
-
94
- &:not(.#{$component}--empty) .#{$component}-label,
95
- &.#{$component}--focused .#{$component}-label {
96
- transform: translateY(-110%) scale(0.75);
97
- }
98
- }
99
-
100
- &.#{$component}--outlined {
101
- .#{$component}-input {
102
- padding: 16px 20px 17px;
103
- }
104
-
105
- &:not(.#{$component}--empty) .#{$component}-label,
106
- &.#{$component}--focused .#{$component}-label {
107
- transform: translateY(-170%) scale(0.75);
108
- }
109
-
110
- &.#{$component}--focused .#{$component}-input {
111
- padding: 15px 19px 16px;
112
- }
113
- }
114
- }
115
17
 
116
18
  // Label
117
19
  &-label {
@@ -5,15 +5,14 @@ import {
5
5
  BaseComponentConfig
6
6
  } from '../../core/config/component-config';
7
7
  import { TextfieldConfig, BaseComponent, ApiOptions } from './types';
8
- import { TEXTFIELD_VARIANTS, TEXTFIELD_TYPES, TEXTFIELD_SIZES } from './constants';
8
+ import { TEXTFIELD_VARIANTS, TEXTFIELD_TYPES } from './constants';
9
9
 
10
10
  /**
11
11
  * Default configuration for the Textfield component
12
12
  */
13
13
  export const defaultConfig: TextfieldConfig = {
14
14
  type: TEXTFIELD_TYPES.TEXT,
15
- variant: TEXTFIELD_VARIANTS.FILLED,
16
- size: TEXTFIELD_SIZES.MEDIUM
15
+ variant: TEXTFIELD_VARIANTS.FILLED
17
16
  };
18
17
 
19
18
  /**
@@ -8,15 +8,6 @@ export const TEXTFIELD_VARIANTS = {
8
8
  OUTLINED: 'outlined'
9
9
  } as const;
10
10
 
11
- /**
12
- * Textfield size variants
13
- */
14
- export const TEXTFIELD_SIZES = {
15
- SMALL: 'small',
16
- MEDIUM: 'medium',
17
- LARGE: 'large'
18
- } as const;
19
-
20
11
  /**
21
12
  * Textfield input types
22
13
  */
@@ -45,11 +36,6 @@ export const TEXTFIELD_SCHEMA = {
45
36
  enum: Object.values(TEXTFIELD_VARIANTS),
46
37
  required: false
47
38
  },
48
- size: {
49
- type: 'string',
50
- enum: Object.values(TEXTFIELD_SIZES),
51
- required: false
52
- },
53
39
  name: {
54
40
  type: 'string',
55
41
  required: false
@@ -1,4 +1,4 @@
1
1
  // src/components/textfield/index.ts
2
2
  export { default } from './textfield'
3
- export { TEXTFIELD_VARIANTS, TEXTFIELD_SIZES, TEXTFIELD_TYPES } from './constants'
4
- export { TextfieldConfig, TextfieldComponent } from './types'
3
+ export { TEXTFIELD_VARIANTS, TEXTFIELD_TYPES } from './constants'
4
+ export { TextfieldConfig, TextfieldComponent } from './types'
@@ -6,7 +6,6 @@ import {
6
6
  withDisabled,
7
7
  withLifecycle,
8
8
  withVariant,
9
- withSize,
10
9
  withTextInput,
11
10
  withTextLabel
12
11
  } from '../../core/compose/features';
@@ -32,7 +31,6 @@ const createTextfield = (config: TextfieldConfig = {}): TextfieldComponent => {
32
31
  withEvents(),
33
32
  withElement(getElementConfig(baseConfig)),
34
33
  withVariant(baseConfig),
35
- withSize(baseConfig),
36
34
  withTextInput(baseConfig),
37
35
  withTextLabel(baseConfig),
38
36
  withDisabled(baseConfig),
@@ -1,5 +1,5 @@
1
1
  // src/components/textfield/types.ts
2
- import { TEXTFIELD_VARIANTS, TEXTFIELD_SIZES, TEXTFIELD_TYPES } from './constants';
2
+ import { TEXTFIELD_VARIANTS, TEXTFIELD_TYPES } from './constants';
3
3
 
4
4
  /**
5
5
  * Configuration interface for the Textfield component
@@ -11,9 +11,6 @@ export interface TextfieldConfig {
11
11
  /** Visual variant (filled, outlined) */
12
12
  variant?: keyof typeof TEXTFIELD_VARIANTS | string;
13
13
 
14
- /** Size variant (small, medium, large) */
15
- size?: keyof typeof TEXTFIELD_SIZES | string;
16
-
17
14
  /** Input name attribute */
18
15
  name?: string;
19
16
 
@@ -204,7 +204,7 @@ export const withElement = (options: WithElementOptions = {}) =>
204
204
  className: [
205
205
  base.getClass(options.componentName || base.componentName || 'component'),
206
206
  hasTouchSupport() && options.interactive ? base.getClass('interactive') : null,
207
- options.className
207
+ ...(Array.isArray(options.className) ? options.className : [options.className])
208
208
  ].filter(Boolean),
209
209
  attrs: options.attrs || {},
210
210
  forwardEvents: options.forwardEvents || {},
@@ -0,0 +1,79 @@
1
+ // src/core/compose/features/badge.ts
2
+
3
+ import { BaseComponent, ElementComponent } from '../component';
4
+ import createBadge from '../../../components/badge';
5
+ import { PREFIX } from '../../config';
6
+
7
+ /**
8
+ * Configuration for badge feature
9
+ */
10
+ export interface BadgeConfig {
11
+ /**
12
+ * Badge content to display
13
+ */
14
+ badge?: string | number;
15
+
16
+ /**
17
+ * Custom badge configuration
18
+ */
19
+ badgeConfig?: {
20
+ variant?: string;
21
+ color?: string;
22
+ size?: string;
23
+ position?: string;
24
+ max?: number;
25
+ [key: string]: any;
26
+ };
27
+
28
+ /**
29
+ * CSS class prefix
30
+ */
31
+ prefix?: string;
32
+
33
+ [key: string]: any;
34
+ }
35
+
36
+ /**
37
+ * Component with badge capabilities
38
+ */
39
+ export interface BadgeComponent extends BaseComponent {
40
+ /**
41
+ * Badge component instance
42
+ */
43
+ badge?: any;
44
+ }
45
+
46
+ /**
47
+ * Adds badge functionality to a component
48
+ * Creates and configures a badge component attached to the main component
49
+ *
50
+ * @param {BadgeConfig} config - Badge configuration
51
+ * @returns {Function} Component enhancer with badge functionality
52
+ */
53
+ export const withBadge = <T extends BadgeConfig>(config: T) =>
54
+ <C extends ElementComponent>(component: C): C & BadgeComponent => {
55
+ // Only create badge if content is provided
56
+ if (config.badge === undefined) {
57
+ return component as C & BadgeComponent;
58
+ }
59
+
60
+ // Create badge configuration
61
+ const badgeConfig = {
62
+ content: config.badge,
63
+ standalone: false,
64
+ target: component.element,
65
+ ...config.badgeConfig || {},
66
+ // Default to top-right position if not specified
67
+ position: config.badgeConfig?.position || 'top-right',
68
+ // Set prefix to match parent component
69
+ prefix: config.prefix || PREFIX
70
+ };
71
+
72
+ // Create badge component
73
+ const badge = createBadge(badgeConfig);
74
+
75
+ return {
76
+ ...component,
77
+ badge
78
+ };
79
+ };
@@ -15,6 +15,7 @@ export { withTextInput } from './textinput';
15
15
  export { withTextLabel } from './textlabel';
16
16
  export { withTrack } from './track';
17
17
  export { withEvents as withEnhancedEvents } from './withEvents';
18
+ export { withBadge } from './badge';
18
19
 
19
20
  // State management features
20
21
  export { withDisabled } from './disabled';
@@ -32,4 +33,5 @@ export type { CheckableComponent, CheckableManager } from './checkable';
32
33
  export type { TextInputComponent } from './textinput';
33
34
  export type { LabelComponent, LabelManager } from './textlabel';
34
35
  export type { TrackComponent } from './track';
35
- export type { EnhancedEventComponent } from './withEvents';
36
+ export type { EnhancedEventComponent } from './withEvents';
37
+ export type { BadgeComponent, BadgeConfig } from './badge';
@@ -70,41 +70,93 @@ $mtrl-sys-shape: (
70
70
  --#{$prefix}-sys-color-primary: #D0BCFF;
71
71
  --#{$prefix}-sys-color-primary-rgb: 208, 188, 255;
72
72
  --#{$prefix}-sys-color-on-primary: #381E72;
73
+ --#{$prefix}-sys-color-on-primary-rgb: 56, 30, 114;
73
74
  --#{$prefix}-sys-color-primary-container: #4F378B;
75
+ --#{$prefix}-sys-color-primary-container-rgb: 79, 55, 139;
74
76
  --#{$prefix}-sys-color-on-primary-container: #EADDFF;
77
+ --#{$prefix}-sys-color-on-primary-container-rgb: 234, 221, 255;
75
78
 
76
79
  --#{$prefix}-sys-color-secondary: #CCC2DC;
80
+ --#{$prefix}-sys-color-secondary-rgb: 204, 194, 220;
77
81
  --#{$prefix}-sys-color-on-secondary: #332D41;
82
+ --#{$prefix}-sys-color-on-secondary-rgb: 51, 45, 65;
78
83
  --#{$prefix}-sys-color-secondary-container: #4A4458;
84
+ --#{$prefix}-sys-color-secondary-container-rgb: 74, 68, 88;
79
85
  --#{$prefix}-sys-color-on-secondary-container: #E8DEF8;
86
+ --#{$prefix}-sys-color-on-secondary-container-rgb: 232, 222, 248;
80
87
 
81
88
  --#{$prefix}-sys-color-tertiary: #EFB8C8;
89
+ --#{$prefix}-sys-color-tertiary-rgb: 239, 184, 200;
82
90
  --#{$prefix}-sys-color-on-tertiary: #492532;
91
+ --#{$prefix}-sys-color-on-tertiary-rgb: 73, 37, 50;
83
92
  --#{$prefix}-sys-color-tertiary-container: #633B48;
93
+ --#{$prefix}-sys-color-tertiary-container-rgb: 99, 59, 72;
84
94
  --#{$prefix}-sys-color-on-tertiary-container: #FFD8E4;
95
+ --#{$prefix}-sys-color-on-tertiary-container-rgb: 255, 216, 228;
96
+
97
+ // Status colors
98
+ --#{$prefix}-sys-color-error: #F2B8B5;
99
+ --#{$prefix}-sys-color-error-rgb: 242, 184, 181;
100
+ --#{$prefix}-sys-color-on-error: #601410;
101
+ --#{$prefix}-sys-color-on-error-rgb: 96, 20, 16;
102
+ --#{$prefix}-sys-color-error-container: #8C1D18;
103
+ --#{$prefix}-sys-color-error-container-rgb: 140, 29, 24;
104
+ --#{$prefix}-sys-color-on-error-container: #F9DEDC;
105
+ --#{$prefix}-sys-color-on-error-container-rgb: 249, 222, 220;
106
+
107
+ --#{$prefix}-sys-color-success: #85CFA9;
108
+ --#{$prefix}-sys-color-success-rgb: 133, 207, 169;
109
+ --#{$prefix}-sys-color-on-success: #00392D;
110
+ --#{$prefix}-sys-color-on-success-rgb: 0, 57, 45;
111
+
112
+ --#{$prefix}-sys-color-warning: #FFB95C;
113
+ --#{$prefix}-sys-color-warning-rgb: 255, 185, 92;
114
+ --#{$prefix}-sys-color-on-warning: #3F2200;
115
+ --#{$prefix}-sys-color-on-warning-rgb: 63, 34, 0;
116
+
117
+ --#{$prefix}-sys-color-info: #99CBFF;
118
+ --#{$prefix}-sys-color-info-rgb: 153, 203, 255;
119
+ --#{$prefix}-sys-color-on-info: #003060;
120
+ --#{$prefix}-sys-color-on-info-rgb: 0, 48, 96;
85
121
 
86
122
  // Neutral colors
87
123
  --#{$prefix}-sys-color-surface: #1C1B1F;
124
+ --#{$prefix}-sys-color-surface-rgb: 28, 27, 31;
88
125
  --#{$prefix}-sys-color-surface-dim: #141218;
126
+ --#{$prefix}-sys-color-surface-dim-rgb: 20, 18, 24;
89
127
  --#{$prefix}-sys-color-surface-bright: #3B383D;
128
+ --#{$prefix}-sys-color-surface-bright-rgb: 59, 56, 61;
90
129
  --#{$prefix}-sys-color-surface-container-lowest: #0F0D13;
130
+ --#{$prefix}-sys-color-surface-container-lowest-rgb: 15, 13, 19;
91
131
  --#{$prefix}-sys-color-surface-container-low: #1D1B20;
132
+ --#{$prefix}-sys-color-surface-container-low-rgb: 29, 27, 32;
92
133
  --#{$prefix}-sys-color-surface-container: #211F26;
134
+ --#{$prefix}-sys-color-surface-container-rgb: 33, 31, 38;
93
135
  --#{$prefix}-sys-color-surface-container-high: #2B2930;
136
+ --#{$prefix}-sys-color-surface-container-high-rgb: 43, 41, 48;
94
137
  --#{$prefix}-sys-color-surface-container-highest: #36343B;
138
+ --#{$prefix}-sys-color-surface-container-highest-rgb: 54, 52, 59;
95
139
 
96
140
  --#{$prefix}-sys-color-on-surface: #E6E1E5;
97
- --#{$prefix}-sys-color-on-surface-variant: #CAC4D0;
98
141
  --#{$prefix}-sys-color-on-surface-rgb: 230, 225, 229;
142
+ --#{$prefix}-sys-color-on-surface-variant: #CAC4D0;
143
+ --#{$prefix}-sys-color-on-surface-variant-rgb: 202, 196, 208;
99
144
 
100
145
  // Additional colors
101
146
  --#{$prefix}-sys-color-outline: #938F99;
147
+ --#{$prefix}-sys-color-outline-rgb: 147, 143, 153;
102
148
  --#{$prefix}-sys-color-outline-variant: #444746;
149
+ --#{$prefix}-sys-color-outline-variant-rgb: 68, 71, 70;
103
150
  --#{$prefix}-sys-color-shadow: #000000;
151
+ --#{$prefix}-sys-color-shadow-rgb: 0, 0, 0;
104
152
  --#{$prefix}-sys-color-scrim: #000000;
153
+ --#{$prefix}-sys-color-scrim-rgb: 0, 0, 0;
105
154
  --#{$prefix}-sys-color-inverse-surface: #E6E1E5;
155
+ --#{$prefix}-sys-color-inverse-surface-rgb: 230, 225, 229;
106
156
  --#{$prefix}-sys-color-inverse-on-surface: #313033;
157
+ --#{$prefix}-sys-color-inverse-on-surface-rgb: 49, 48, 51;
107
158
  --#{$prefix}-sys-color-inverse-primary: #6750A4;
159
+ --#{$prefix}-sys-color-inverse-primary-rgb: 103, 80, 164;
108
160
  }
109
161
 
110
162
  @mixin light-theme {
@@ -112,41 +164,93 @@ $mtrl-sys-shape: (
112
164
  --#{$prefix}-sys-color-primary: #6750A4;
113
165
  --#{$prefix}-sys-color-primary-rgb: 103, 80, 164;
114
166
  --#{$prefix}-sys-color-on-primary: #FFFFFF;
167
+ --#{$prefix}-sys-color-on-primary-rgb: 255, 255, 255;
115
168
  --#{$prefix}-sys-color-primary-container: #EADDFF;
169
+ --#{$prefix}-sys-color-primary-container-rgb: 234, 221, 255;
116
170
  --#{$prefix}-sys-color-on-primary-container: #21005D;
171
+ --#{$prefix}-sys-color-on-primary-container-rgb: 33, 0, 93;
117
172
 
118
173
  --#{$prefix}-sys-color-secondary: #625B71;
174
+ --#{$prefix}-sys-color-secondary-rgb: 98, 91, 113;
119
175
  --#{$prefix}-sys-color-on-secondary: #FFFFFF;
176
+ --#{$prefix}-sys-color-on-secondary-rgb: 255, 255, 255;
120
177
  --#{$prefix}-sys-color-secondary-container: #E8DEF8;
178
+ --#{$prefix}-sys-color-secondary-container-rgb: 232, 222, 248;
121
179
  --#{$prefix}-sys-color-on-secondary-container: #1D192B;
180
+ --#{$prefix}-sys-color-on-secondary-container-rgb: 29, 25, 43;
122
181
 
123
182
  --#{$prefix}-sys-color-tertiary: #7D5260;
183
+ --#{$prefix}-sys-color-tertiary-rgb: 125, 82, 96;
124
184
  --#{$prefix}-sys-color-on-tertiary: #FFFFFF;
185
+ --#{$prefix}-sys-color-on-tertiary-rgb: 255, 255, 255;
125
186
  --#{$prefix}-sys-color-tertiary-container: #FFD8E4;
187
+ --#{$prefix}-sys-color-tertiary-container-rgb: 255, 216, 228;
126
188
  --#{$prefix}-sys-color-on-tertiary-container: #31111D;
189
+ --#{$prefix}-sys-color-on-tertiary-container-rgb: 49, 17, 29;
190
+
191
+ // Status colors
192
+ --#{$prefix}-sys-color-error: #B3261E;
193
+ --#{$prefix}-sys-color-error-rgb: 179, 38, 30;
194
+ --#{$prefix}-sys-color-on-error: #FFFFFF;
195
+ --#{$prefix}-sys-color-on-error-rgb: 255, 255, 255;
196
+ --#{$prefix}-sys-color-error-container: #F9DEDC;
197
+ --#{$prefix}-sys-color-error-container-rgb: 249, 222, 220;
198
+ --#{$prefix}-sys-color-on-error-container: #410E0B;
199
+ --#{$prefix}-sys-color-on-error-container-rgb: 65, 14, 11;
200
+
201
+ --#{$prefix}-sys-color-success: #007B5A;
202
+ --#{$prefix}-sys-color-success-rgb: 0, 123, 90;
203
+ --#{$prefix}-sys-color-on-success: #FFFFFF;
204
+ --#{$prefix}-sys-color-on-success-rgb: 255, 255, 255;
205
+
206
+ --#{$prefix}-sys-color-warning: #DD6D06;
207
+ --#{$prefix}-sys-color-warning-rgb: 221, 109, 6;
208
+ --#{$prefix}-sys-color-on-warning: #FFFFFF;
209
+ --#{$prefix}-sys-color-on-warning-rgb: 255, 255, 255;
210
+
211
+ --#{$prefix}-sys-color-info: #0061A4;
212
+ --#{$prefix}-sys-color-info-rgb: 0, 97, 164;
213
+ --#{$prefix}-sys-color-on-info: #FFFFFF;
214
+ --#{$prefix}-sys-color-on-info-rgb: 255, 255, 255;
127
215
 
128
216
  // Neutral colors
129
217
  --#{$prefix}-sys-color-surface: #FFFBFE;
218
+ --#{$prefix}-sys-color-surface-rgb: 255, 251, 254;
130
219
  --#{$prefix}-sys-color-surface-dim: #DED8E1;
220
+ --#{$prefix}-sys-color-surface-dim-rgb: 222, 216, 225;
131
221
  --#{$prefix}-sys-color-surface-bright: #FFF8F7;
222
+ --#{$prefix}-sys-color-surface-bright-rgb: 255, 248, 247;
132
223
  --#{$prefix}-sys-color-surface-container-lowest: #FFFFFF;
224
+ --#{$prefix}-sys-color-surface-container-lowest-rgb: 255, 255, 255;
133
225
  --#{$prefix}-sys-color-surface-container-low: #F7F2FA;
226
+ --#{$prefix}-sys-color-surface-container-low-rgb: 247, 242, 250;
134
227
  --#{$prefix}-sys-color-surface-container: #F3EDF7;
228
+ --#{$prefix}-sys-color-surface-container-rgb: 243, 237, 247;
135
229
  --#{$prefix}-sys-color-surface-container-high: #ECE6F0;
230
+ --#{$prefix}-sys-color-surface-container-high-rgb: 236, 230, 240;
136
231
  --#{$prefix}-sys-color-surface-container-highest: #E6E0E9;
232
+ --#{$prefix}-sys-color-surface-container-highest-rgb: 230, 224, 233;
137
233
 
138
234
  --#{$prefix}-sys-color-on-surface: #1C1B1F;
139
- --#{$prefix}-sys-color-on-surface-variant: #49454F;
140
235
  --#{$prefix}-sys-color-on-surface-rgb: 28, 27, 31;
236
+ --#{$prefix}-sys-color-on-surface-variant: #49454F;
237
+ --#{$prefix}-sys-color-on-surface-variant-rgb: 73, 69, 79;
141
238
 
142
239
  // Additional colors
143
240
  --#{$prefix}-sys-color-outline: #79747E;
241
+ --#{$prefix}-sys-color-outline-rgb: 121, 116, 126;
144
242
  --#{$prefix}-sys-color-outline-variant: #CAC4D0;
243
+ --#{$prefix}-sys-color-outline-variant-rgb: 202, 196, 208;
145
244
  --#{$prefix}-sys-color-shadow: #000000;
245
+ --#{$prefix}-sys-color-shadow-rgb: 0, 0, 0;
146
246
  --#{$prefix}-sys-color-scrim: #000000;
247
+ --#{$prefix}-sys-color-scrim-rgb: 0, 0, 0;
147
248
  --#{$prefix}-sys-color-inverse-surface: #313033;
249
+ --#{$prefix}-sys-color-inverse-surface-rgb: 49, 48, 51;
148
250
  --#{$prefix}-sys-color-inverse-on-surface: #F4EFF4;
251
+ --#{$prefix}-sys-color-inverse-on-surface-rgb: 244, 239, 244;
149
252
  --#{$prefix}-sys-color-inverse-primary: #D0BCFF;
253
+ --#{$prefix}-sys-color-inverse-primary-rgb: 208, 188, 255;
150
254
  }
151
255
 
152
256
  // Auto dark mode based on system preference
@@ -1,48 +0,0 @@
1
- // src/components/card/actions.ts
2
- import { PREFIX } from '../../core/config';
3
- import { pipe } from '../../core/compose';
4
- import { createBase, withElement } from '../../core/compose/component';
5
- import { CardActionsConfig } from './types';
6
-
7
- /**
8
- * Creates a card actions component
9
- * @param {CardActionsConfig} config - Actions configuration
10
- * @returns {HTMLElement} Card actions element
11
- */
12
- export const createCardActions = (config: CardActionsConfig = {}): HTMLElement => {
13
- const baseConfig = {
14
- ...config,
15
- componentName: 'card-actions',
16
- prefix: PREFIX
17
- };
18
-
19
- try {
20
- const actions = pipe(
21
- createBase,
22
- withElement({
23
- tag: 'div',
24
- componentName: 'card-actions',
25
- className: [
26
- config.class,
27
- config.fullBleed ? `${PREFIX}-card-actions--full-bleed` : null,
28
- config.vertical ? `${PREFIX}-card-actions--vertical` : null,
29
- config.align ? `${PREFIX}-card-actions--${config.align}` : null
30
- ]
31
- })
32
- )(baseConfig);
33
-
34
- // Add action elements if provided
35
- if (Array.isArray(config.actions)) {
36
- config.actions.forEach(action => {
37
- if (action instanceof HTMLElement) {
38
- actions.element.appendChild(action);
39
- }
40
- });
41
- }
42
-
43
- return actions.element;
44
- } catch (error) {
45
- console.error('Card actions creation error:', error instanceof Error ? error.message : String(error));
46
- throw new Error(`Failed to create card actions: ${error instanceof Error ? error.message : String(error)}`);
47
- }
48
- };
@@ -1,88 +0,0 @@
1
- // src/components/card/header.ts
2
- import { PREFIX } from '../../core/config';
3
- import { pipe } from '../../core/compose';
4
- import { createBase, withElement } from '../../core/compose/component';
5
- import { createElement } from '../../core/dom/create';
6
- import { CardHeaderConfig } from './types';
7
-
8
- /**
9
- * Creates a card header component
10
- * @param {CardHeaderConfig} config - Header configuration
11
- * @returns {HTMLElement} Card header element
12
- */
13
- export const createCardHeader = (config: CardHeaderConfig = {}): HTMLElement => {
14
- const baseConfig = {
15
- ...config,
16
- componentName: 'card-header',
17
- prefix: PREFIX
18
- };
19
-
20
- try {
21
- const header = pipe(
22
- createBase,
23
- withElement({
24
- tag: 'div',
25
- componentName: 'card-header',
26
- className: config.class
27
- })
28
- )(baseConfig);
29
-
30
- // Create text container
31
- const textContainer = createElement({
32
- tag: 'div',
33
- className: `${PREFIX}-card-header-text`,
34
- container: header.element
35
- });
36
-
37
- // Add title if provided
38
- if (config.title) {
39
- createElement({
40
- tag: 'h3',
41
- className: `${PREFIX}-card-header-title`,
42
- text: config.title,
43
- container: textContainer
44
- });
45
- }
46
-
47
- // Add subtitle if provided
48
- if (config.subtitle) {
49
- createElement({
50
- tag: 'h4',
51
- className: `${PREFIX}-card-header-subtitle`,
52
- text: config.subtitle,
53
- container: textContainer
54
- });
55
- }
56
-
57
- // Add avatar if provided
58
- if (config.avatar) {
59
- const avatarElement = typeof config.avatar === 'string'
60
- ? createElement({
61
- tag: 'div',
62
- className: `${PREFIX}-card-header-avatar`,
63
- html: config.avatar
64
- })
65
- : config.avatar;
66
-
67
- header.element.insertBefore(avatarElement, header.element.firstChild);
68
- }
69
-
70
- // Add action if provided
71
- if (config.action) {
72
- const actionElement = typeof config.action === 'string'
73
- ? createElement({
74
- tag: 'div',
75
- className: `${PREFIX}-card-header-action`,
76
- html: config.action
77
- })
78
- : config.action;
79
-
80
- header.element.appendChild(actionElement);
81
- }
82
-
83
- return header.element;
84
- } catch (error) {
85
- console.error('Card header creation error:', error instanceof Error ? error.message : String(error));
86
- throw new Error(`Failed to create card header: ${error instanceof Error ? error.message : String(error)}`);
87
- }
88
- };
@@ -1,52 +0,0 @@
1
- // src/components/card/media.ts
2
- import { PREFIX } from '../../core/config';
3
- import { pipe } from '../../core/compose';
4
- import { createBase, withElement } from '../../core/compose/component';
5
- import { CardMediaConfig } from './types';
6
-
7
- /**
8
- * Creates a card media component
9
- * @param {CardMediaConfig} config - Media configuration
10
- * @returns {HTMLElement} Card media element
11
- */
12
- export const createCardMedia = (config: CardMediaConfig = {}): HTMLElement => {
13
- const baseConfig = {
14
- ...config,
15
- componentName: 'card-media',
16
- prefix: PREFIX
17
- };
18
-
19
- try {
20
- const media = pipe(
21
- createBase,
22
- withElement({
23
- tag: 'div',
24
- componentName: 'card-media',
25
- className: [
26
- config.class,
27
- config.aspectRatio ? `${PREFIX}-card-media--${config.aspectRatio.replace(':', '-')}` : null,
28
- config.contain ? `${PREFIX}-card-media--contain` : null
29
- ]
30
- })
31
- )(baseConfig);
32
-
33
- // If custom element is provided, use it
34
- if (config.element instanceof HTMLElement) {
35
- media.element.appendChild(config.element);
36
- }
37
-
38
- // Otherwise create an image if src is provided
39
- else if (config.src) {
40
- const img = document.createElement('img');
41
- img.src = config.src;
42
- if (config.alt) img.alt = config.alt;
43
- img.className = `${PREFIX}-card-media-img`;
44
- media.element.appendChild(img);
45
- }
46
-
47
- return media.element;
48
- } catch (error) {
49
- console.error('Card media creation error:', error instanceof Error ? error.message : String(error));
50
- throw new Error(`Failed to create card media: ${error instanceof Error ? error.message : String(error)}`);
51
- }
52
- };