@francofantomius/material-components 0.1.0

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 (148) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +192 -0
  3. package/custom-elements.json +5448 -0
  4. package/dist/chunks/base-component-DQTjlEVL.js +34 -0
  5. package/dist/chunks/base-component-DQTjlEVL.js.map +1 -0
  6. package/dist/chunks/focus-ring-Dl-XoEKK.js +71 -0
  7. package/dist/chunks/focus-ring-Dl-XoEKK.js.map +1 -0
  8. package/dist/chunks/form-associated-fKbeX_2P.js +74 -0
  9. package/dist/chunks/form-associated-fKbeX_2P.js.map +1 -0
  10. package/dist/chunks/theme.css-DV3DRha-.js +263 -0
  11. package/dist/chunks/theme.css-DV3DRha-.js.map +1 -0
  12. package/dist/components/badge/badge.css.d.ts +2 -0
  13. package/dist/components/badge/badge.css.d.ts.map +1 -0
  14. package/dist/components/badge/badge.d.ts +16 -0
  15. package/dist/components/badge/badge.d.ts.map +1 -0
  16. package/dist/components/badge/badge.js +93 -0
  17. package/dist/components/badge/badge.js.map +1 -0
  18. package/dist/components/button/button.css.d.ts +2 -0
  19. package/dist/components/button/button.css.d.ts.map +1 -0
  20. package/dist/components/button/button.d.ts +25 -0
  21. package/dist/components/button/button.d.ts.map +1 -0
  22. package/dist/components/button/button.js +263 -0
  23. package/dist/components/button/button.js.map +1 -0
  24. package/dist/components/card/card.css.d.ts +2 -0
  25. package/dist/components/card/card.css.d.ts.map +1 -0
  26. package/dist/components/card/card.d.ts +18 -0
  27. package/dist/components/card/card.d.ts.map +1 -0
  28. package/dist/components/card/card.js +169 -0
  29. package/dist/components/card/card.js.map +1 -0
  30. package/dist/components/checkbox/checkbox.css.d.ts +2 -0
  31. package/dist/components/checkbox/checkbox.css.d.ts.map +1 -0
  32. package/dist/components/checkbox/checkbox.d.ts +24 -0
  33. package/dist/components/checkbox/checkbox.d.ts.map +1 -0
  34. package/dist/components/checkbox/checkbox.js +188 -0
  35. package/dist/components/checkbox/checkbox.js.map +1 -0
  36. package/dist/components/chip/chip.css.d.ts +3 -0
  37. package/dist/components/chip/chip.css.d.ts.map +1 -0
  38. package/dist/components/chip/chip.d.ts +27 -0
  39. package/dist/components/chip/chip.d.ts.map +1 -0
  40. package/dist/components/chip/chip.js +174 -0
  41. package/dist/components/chip/chip.js.map +1 -0
  42. package/dist/components/dialog/dialog.css.d.ts +2 -0
  43. package/dist/components/dialog/dialog.css.d.ts.map +1 -0
  44. package/dist/components/dialog/dialog.d.ts +22 -0
  45. package/dist/components/dialog/dialog.d.ts.map +1 -0
  46. package/dist/components/dialog/dialog.js +167 -0
  47. package/dist/components/dialog/dialog.js.map +1 -0
  48. package/dist/components/divider/divider.css.d.ts +2 -0
  49. package/dist/components/divider/divider.css.d.ts.map +1 -0
  50. package/dist/components/divider/divider.d.ts +16 -0
  51. package/dist/components/divider/divider.d.ts.map +1 -0
  52. package/dist/components/divider/divider.js +81 -0
  53. package/dist/components/divider/divider.js.map +1 -0
  54. package/dist/components/fab/fab.css.d.ts +2 -0
  55. package/dist/components/fab/fab.css.d.ts.map +1 -0
  56. package/dist/components/fab/fab.d.ts +19 -0
  57. package/dist/components/fab/fab.d.ts.map +1 -0
  58. package/dist/components/fab/fab.js +155 -0
  59. package/dist/components/fab/fab.js.map +1 -0
  60. package/dist/components/icon/icon.css.d.ts +2 -0
  61. package/dist/components/icon/icon.css.d.ts.map +1 -0
  62. package/dist/components/icon/icon.d.ts +15 -0
  63. package/dist/components/icon/icon.d.ts.map +1 -0
  64. package/dist/components/icon/icon.js +70 -0
  65. package/dist/components/icon/icon.js.map +1 -0
  66. package/dist/components/icon-button/icon-button.css.d.ts +2 -0
  67. package/dist/components/icon-button/icon-button.css.d.ts.map +1 -0
  68. package/dist/components/icon-button/icon-button.d.ts +22 -0
  69. package/dist/components/icon-button/icon-button.d.ts.map +1 -0
  70. package/dist/components/icon-button/icon-button.js +192 -0
  71. package/dist/components/icon-button/icon-button.js.map +1 -0
  72. package/dist/components/list/list.css.d.ts +3 -0
  73. package/dist/components/list/list.css.d.ts.map +1 -0
  74. package/dist/components/list/list.d.ts +25 -0
  75. package/dist/components/list/list.d.ts.map +1 -0
  76. package/dist/components/list/list.js +190 -0
  77. package/dist/components/list/list.js.map +1 -0
  78. package/dist/components/progress/progress.css.d.ts +2 -0
  79. package/dist/components/progress/progress.css.d.ts.map +1 -0
  80. package/dist/components/progress/progress.d.ts +19 -0
  81. package/dist/components/progress/progress.d.ts.map +1 -0
  82. package/dist/components/progress/progress.js +183 -0
  83. package/dist/components/progress/progress.js.map +1 -0
  84. package/dist/components/radio/radio.css.d.ts +3 -0
  85. package/dist/components/radio/radio.css.d.ts.map +1 -0
  86. package/dist/components/radio/radio.d.ts +38 -0
  87. package/dist/components/radio/radio.d.ts.map +1 -0
  88. package/dist/components/radio/radio.js +205 -0
  89. package/dist/components/radio/radio.js.map +1 -0
  90. package/dist/components/snackbar/snackbar.css.d.ts +2 -0
  91. package/dist/components/snackbar/snackbar.css.d.ts.map +1 -0
  92. package/dist/components/snackbar/snackbar.d.ts +24 -0
  93. package/dist/components/snackbar/snackbar.d.ts.map +1 -0
  94. package/dist/components/snackbar/snackbar.js +164 -0
  95. package/dist/components/snackbar/snackbar.js.map +1 -0
  96. package/dist/components/switch/switch.css.d.ts +2 -0
  97. package/dist/components/switch/switch.css.d.ts.map +1 -0
  98. package/dist/components/switch/switch.d.ts +22 -0
  99. package/dist/components/switch/switch.d.ts.map +1 -0
  100. package/dist/components/switch/switch.js +171 -0
  101. package/dist/components/switch/switch.js.map +1 -0
  102. package/dist/components/tabs/tabs.css.d.ts +3 -0
  103. package/dist/components/tabs/tabs.css.d.ts.map +1 -0
  104. package/dist/components/tabs/tabs.d.ts +33 -0
  105. package/dist/components/tabs/tabs.d.ts.map +1 -0
  106. package/dist/components/tabs/tabs.js +200 -0
  107. package/dist/components/tabs/tabs.js.map +1 -0
  108. package/dist/components/text-field/text-field.css.d.ts +2 -0
  109. package/dist/components/text-field/text-field.css.d.ts.map +1 -0
  110. package/dist/components/text-field/text-field.d.ts +40 -0
  111. package/dist/components/text-field/text-field.d.ts.map +1 -0
  112. package/dist/components/text-field/text-field.js +327 -0
  113. package/dist/components/text-field/text-field.js.map +1 -0
  114. package/dist/index.d.ts +23 -0
  115. package/dist/index.d.ts.map +1 -0
  116. package/dist/index.js +59 -0
  117. package/dist/index.js.map +1 -0
  118. package/dist/internal/base-component.d.ts +13 -0
  119. package/dist/internal/base-component.d.ts.map +1 -0
  120. package/dist/internal/focus-ring/focus-ring.css.d.ts +2 -0
  121. package/dist/internal/focus-ring/focus-ring.css.d.ts.map +1 -0
  122. package/dist/internal/focus-ring/focus-ring.d.ts +18 -0
  123. package/dist/internal/focus-ring/focus-ring.d.ts.map +1 -0
  124. package/dist/internal/form-associated.d.ts +26 -0
  125. package/dist/internal/form-associated.d.ts.map +1 -0
  126. package/dist/internal/ripple/ripple.css.d.ts +2 -0
  127. package/dist/internal/ripple/ripple.css.d.ts.map +1 -0
  128. package/dist/internal/ripple/ripple.d.ts +26 -0
  129. package/dist/internal/ripple/ripple.d.ts.map +1 -0
  130. package/dist/internal/ripple/ripple.js +144 -0
  131. package/dist/internal/ripple/ripple.js.map +1 -0
  132. package/dist/tokens/colors.d.ts +42 -0
  133. package/dist/tokens/colors.d.ts.map +1 -0
  134. package/dist/tokens/elevation.d.ts +9 -0
  135. package/dist/tokens/elevation.d.ts.map +1 -0
  136. package/dist/tokens/index.d.ts +7 -0
  137. package/dist/tokens/index.d.ts.map +1 -0
  138. package/dist/tokens/index.js +13 -0
  139. package/dist/tokens/index.js.map +1 -0
  140. package/dist/tokens/motion.d.ts +21 -0
  141. package/dist/tokens/motion.d.ts.map +1 -0
  142. package/dist/tokens/shape.d.ts +10 -0
  143. package/dist/tokens/shape.d.ts.map +1 -0
  144. package/dist/tokens/theme.css.d.ts +4 -0
  145. package/dist/tokens/theme.css.d.ts.map +1 -0
  146. package/dist/tokens/typography.d.ts +101 -0
  147. package/dist/tokens/typography.d.ts.map +1 -0
  148. package/package.json +133 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 francofantomius
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,192 @@
1
+ # @francofantomius/material-components
2
+
3
+ A modern, accessible, and lightweight **Material Design 3 (M3)** Web Components library built with [Lit](https://lit.dev/).
4
+
5
+ Works natively across all modern browsers and seamlessly integrates with **React**, **Vue**, **Angular**, **Svelte**, **Solid**, or plain HTML.
6
+
7
+ ---
8
+
9
+ ## Features
10
+
11
+ - **Material Design 3**: Fully tokenized CSS design tokens for dynamic theming (Light/Dark mode and custom color palettes).
12
+ - **16+ Core Components**: Buttons, Text Fields, Checkboxes, Switches, Radio Groups, Cards, Dialogs, Progress, Badges, Chips, Tabs, Lists, Snackbars, and more.
13
+ - **Form-Associated Custom Elements (FACE)**: Inputs directly integrate with native `<form>` elements, form validation, and `FormData`.
14
+ - **Lightweight and Tree-Shakeable**: Pure ESM with subpath exports (`@francofantomius/material-components/button`).
15
+ - **TypeScript and IDE Autocomplete**: Full TypeScript types and Custom Elements Manifest (`custom-elements.json`).
16
+ - **Accessible**: WCAG compliant focus rings, ARIA roles, and keyboard navigation.
17
+
18
+ ---
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ npm install @francofantomius/material-components lit
24
+ ```
25
+
26
+ ---
27
+
28
+ ## Quick Start
29
+
30
+ ### 1. Load Fonts and Icons (Optional but recommended)
31
+ Add Google Roboto and Material Symbols to your HTML:
32
+ ```html
33
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
34
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" />
35
+ ```
36
+
37
+ ### 2. Import and Use Components
38
+
39
+ #### Global Bundle Import
40
+ ```typescript
41
+ import '@francofantomius/material-components';
42
+ ```
43
+
44
+ #### Tree-shakeable Subpath Imports (Recommended)
45
+ ```typescript
46
+ import '@francofantomius/material-components/button';
47
+ import '@francofantomius/material-components/text-field';
48
+ import '@francofantomius/material-components/card';
49
+ ```
50
+
51
+ #### Use in HTML / JSX / Templates
52
+ ```html
53
+ <!-- Buttons & Icons -->
54
+ <md-button variant="filled" icon="send">Submit</md-button>
55
+ <md-button variant="outlined">Cancel</md-button>
56
+ <md-icon-button icon="favorite"></md-icon-button>
57
+
58
+ <!-- Form Inputs with Native Form Integration -->
59
+ <form id="login-form">
60
+ <md-text-field label="Email" name="email" type="email" required></md-text-field>
61
+ <md-checkbox name="remember" checked>Remember me</md-checkbox>
62
+ <md-switch name="notifications" selected icons>Enable Notifications</md-switch>
63
+ <md-button type="submit" variant="filled">Log In</md-button>
64
+ </form>
65
+
66
+ <!-- Card Surface -->
67
+ <md-card variant="outlined" interactive>
68
+ <div slot="header">
69
+ <h3>Card Title</h3>
70
+ </div>
71
+ Card body content here.
72
+ <div slot="actions">
73
+ <md-button variant="text">Dismiss</md-button>
74
+ <md-button variant="filled">Open</md-button>
75
+ </div>
76
+ </md-card>
77
+
78
+ <!-- Modal Dialog -->
79
+ <md-dialog id="my-dialog" headline="Dialog Title" icon="info">
80
+ Dialog content description.
81
+ <div slot="actions">
82
+ <md-button id="close-btn" variant="text">Close</md-button>
83
+ </div>
84
+ </md-dialog>
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Theming and Dark Mode
90
+
91
+ ### Dynamic Theming via CSS Custom Properties
92
+ The library uses standard CSS custom properties adhering to Material 3 specs:
93
+
94
+ ```css
95
+ :root {
96
+ --md-sys-color-primary: #6750A4;
97
+ --md-sys-color-on-primary: #FFFFFF;
98
+ --md-sys-color-surface: #FEF7FF;
99
+ --md-sys-color-on-surface: #1D1B20;
100
+ }
101
+
102
+ [data-theme='dark'] {
103
+ --md-sys-color-primary: #D0BCFF;
104
+ --md-sys-color-on-primary: #381E72;
105
+ --md-sys-color-surface: #141218;
106
+ --md-sys-color-on-surface: #E6E0E9;
107
+ }
108
+ ```
109
+
110
+ ### TypeScript Theme Helper
111
+ ```typescript
112
+ import { applyTheme, darkColorScheme } from '@francofantomius/material-components/theme';
113
+
114
+ // Apply dark theme
115
+ applyTheme(darkColorScheme);
116
+
117
+ // Apply custom brand colors
118
+ applyTheme({
119
+ primary: '#006A60',
120
+ onPrimary: '#FFFFFF',
121
+ });
122
+ ```
123
+
124
+ ---
125
+
126
+ ## Component List
127
+
128
+ | Component | Tag | Key Properties & Variants |
129
+ | :--- | :--- | :--- |
130
+ | **Button** | `<md-button>` | `variant` (filled, elevated, tonal, outlined, text), `icon`, `loading`, `disabled`, `href` |
131
+ | **Icon Button** | `<md-icon-button>` | `variant` (standard, filled, tonal, outlined), `icon`, `toggle`, `selected` |
132
+ | **FAB** | `<md-fab>` | `size` (small, medium, large), `label`, `icon`, `lowered` |
133
+ | **Text Field** | `<md-text-field>` | `variant` (filled, outlined), `label`, `value`, `prefix-text`, `suffix-text`, `error`, `supporting-text` |
134
+ | **Checkbox** | `<md-checkbox>` | `checked`, `indeterminate`, `error`, `disabled`, `name`, `value` |
135
+ | **Switch** | `<md-switch>` | `selected`, `icons`, `disabled`, `name`, `value` |
136
+ | **Radio** | `<md-radio>`, `<md-radio-group>` | `checked`, `value`, `name`, `row` |
137
+ | **Card** | `<md-card>` | `variant` (elevated, filled, outlined), `interactive`, `href` |
138
+ | **Dialog** | `<md-dialog>` | `open`, `headline`, `icon`, `showModal()`, `close()` |
139
+ | **Divider** | `<md-divider>` | `vertical`, `inset`, `inset-start`, `inset-end` |
140
+ | **Progress** | `<md-progress>` | `type` (linear, circular), `value` (0 to 1, or indeterminate), `buffer` |
141
+ | **Badge** | `<md-badge>` | `value`, `dot` |
142
+ | **Chip** | `<md-chip>`, `<md-chip-set>` | `variant` (assist, filter, input, suggestion), `label`, `selected`, `removable` |
143
+ | **Tabs** | `<md-tabs>`, `<md-tab>` | `active-index`, `icon`, `label` |
144
+ | **List** | `<md-list>`, `<md-list-item>` | `headline`, `supporting-text`, `interactive`, `href` |
145
+ | **Snackbar** | `<md-snackbar>` | `open`, `message`, `action-text`, `closeable`, `timeout-ms` |
146
+
147
+ ---
148
+
149
+ ## Development and Testing
150
+
151
+ ```bash
152
+ # Start local interactive Vite playground
153
+ npm run dev
154
+
155
+ # Start local VitePress documentation
156
+ npm run docs:dev
157
+
158
+ # Run unit tests
159
+ npm test
160
+
161
+ # Type check
162
+ npm run typecheck
163
+
164
+ # Build library & custom elements manifest
165
+ npm run build
166
+
167
+ # Build documentation for production
168
+ npm run docs:build
169
+ ```
170
+
171
+ ---
172
+
173
+ ## Automated Publishing
174
+
175
+ This repository includes a GitHub Actions workflow (`.github/workflows/publish-npm.yml`) that automatically publishes new releases to npm whenever a new version is pushed to the `main` branch.
176
+
177
+ ### How it works:
178
+ 1. When code is pushed to `main`, the workflow inspects the `version` field in `package.json`.
179
+ 2. It queries npm to check if that version is already published.
180
+ 3. If the version is new, it runs typecheck, tests, builds the library, and publishes the package to npm with provenance.
181
+ 4. It creates a Git tag `v<version>` and a GitHub Release.
182
+
183
+ ### Setup requirement:
184
+ Add your npm automation token as a secret in your GitHub repository:
185
+ - Go to **Settings > Secrets and variables > Actions**
186
+ - Add secret **`NPM_TOKEN`** with an npm Automation / Publish token.
187
+
188
+ ---
189
+
190
+ ## License
191
+
192
+ MIT © [francofantomius](https://github.com/francofantomius)