@francofantomius/material-components 0.1.0 → 1.0.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.
- package/CHANGELOG.md +62 -0
- package/README.md +277 -83
- package/custom-elements.json +21010 -2354
- package/dist/chunks/badge-G4EjcMoy.js +89 -0
- package/dist/chunks/badge-G4EjcMoy.js.map +1 -0
- package/dist/chunks/button-B4TSZ7Sl.js +250 -0
- package/dist/chunks/button-B4TSZ7Sl.js.map +1 -0
- package/dist/chunks/card-DVffdPpv.js +163 -0
- package/dist/chunks/card-DVffdPpv.js.map +1 -0
- package/dist/chunks/checkbox-BqlboAHd.js +194 -0
- package/dist/chunks/checkbox-BqlboAHd.js.map +1 -0
- package/dist/chunks/chip-CI1ZINnr.js +169 -0
- package/dist/chunks/chip-CI1ZINnr.js.map +1 -0
- package/dist/chunks/code-C5UFBkCh.js +1830 -0
- package/dist/chunks/code-C5UFBkCh.js.map +1 -0
- package/dist/chunks/decorate-DXuynaiA.js +39 -0
- package/dist/chunks/decorate-DXuynaiA.js.map +1 -0
- package/dist/chunks/dialog-DGVEE5m_.js +158 -0
- package/dist/chunks/dialog-DGVEE5m_.js.map +1 -0
- package/dist/chunks/divider-DNepwoZv.js +82 -0
- package/dist/chunks/divider-DNepwoZv.js.map +1 -0
- package/dist/chunks/fab-C9j3WBHE.js +150 -0
- package/dist/chunks/fab-C9j3WBHE.js.map +1 -0
- package/dist/chunks/focus-ring-CuiJuM-y.js +71 -0
- package/dist/chunks/focus-ring-CuiJuM-y.js.map +1 -0
- package/dist/chunks/{form-associated-fKbeX_2P.js → form-associated-Cty_ZaS9.js} +26 -27
- package/dist/chunks/form-associated-Cty_ZaS9.js.map +1 -0
- package/dist/chunks/icon-DrNqcNEL.js +62 -0
- package/dist/chunks/icon-DrNqcNEL.js.map +1 -0
- package/dist/chunks/icon-button-BdSc7eot.js +188 -0
- package/dist/chunks/icon-button-BdSc7eot.js.map +1 -0
- package/dist/chunks/list-D8olR7oZ.js +204 -0
- package/dist/chunks/list-D8olR7oZ.js.map +1 -0
- package/dist/chunks/navigation-drawer-CKl44Ef5.js +531 -0
- package/dist/chunks/navigation-drawer-CKl44Ef5.js.map +1 -0
- package/dist/chunks/player-C4ydiIpr.js +1582 -0
- package/dist/chunks/player-C4ydiIpr.js.map +1 -0
- package/dist/chunks/progress-LQmLMDjX.js +266 -0
- package/dist/chunks/progress-LQmLMDjX.js.map +1 -0
- package/dist/chunks/radio-Bily78NT.js +205 -0
- package/dist/chunks/radio-Bily78NT.js.map +1 -0
- package/dist/chunks/ripple-squbKHhj.js +135 -0
- package/dist/chunks/ripple-squbKHhj.js.map +1 -0
- package/dist/chunks/search-bar-TXnqJ-gd.js +698 -0
- package/dist/chunks/search-bar-TXnqJ-gd.js.map +1 -0
- package/dist/chunks/snackbar-Wsz3BzEY.js +161 -0
- package/dist/chunks/snackbar-Wsz3BzEY.js.map +1 -0
- package/dist/chunks/switch-DdukrvXb.js +190 -0
- package/dist/chunks/switch-DdukrvXb.js.map +1 -0
- package/dist/chunks/table-aRTYzDyE.js +773 -0
- package/dist/chunks/table-aRTYzDyE.js.map +1 -0
- package/dist/chunks/tabs-BfOtoeir.js +191 -0
- package/dist/chunks/tabs-BfOtoeir.js.map +1 -0
- package/dist/chunks/text-field-hN6-2HQy.js +338 -0
- package/dist/chunks/text-field-hN6-2HQy.js.map +1 -0
- package/dist/chunks/top-app-bar-Dgbp6CFv.js +228 -0
- package/dist/chunks/top-app-bar-Dgbp6CFv.js.map +1 -0
- package/dist/components/account-menu/account-menu.css.d.ts +3 -0
- package/dist/components/account-menu/account-menu.css.d.ts.map +1 -0
- package/dist/components/account-menu/account-menu.d.ts +111 -0
- package/dist/components/account-menu/account-menu.d.ts.map +1 -0
- package/dist/components/app-drawer/app-drawer.css.d.ts +3 -0
- package/dist/components/app-drawer/app-drawer.css.d.ts.map +1 -0
- package/dist/components/app-drawer/app-drawer.d.ts +173 -0
- package/dist/components/app-drawer/app-drawer.d.ts.map +1 -0
- package/dist/components/badge/badge.js +2 -91
- package/dist/components/button/button.js +2 -261
- package/dist/components/card/card.js +2 -167
- package/dist/components/checkbox/checkbox.css.d.ts.map +1 -1
- package/dist/components/checkbox/checkbox.js +2 -186
- package/dist/components/chip/chip.js +3 -172
- package/dist/components/code/code.css.d.ts +2 -0
- package/dist/components/code/code.css.d.ts.map +1 -0
- package/dist/components/code/code.d.ts +106 -0
- package/dist/components/code/code.d.ts.map +1 -0
- package/dist/components/code/code.js +5 -0
- package/dist/components/code/highlighter.d.ts +8 -0
- package/dist/components/code/highlighter.d.ts.map +1 -0
- package/dist/components/code/linter.d.ts +44 -0
- package/dist/components/code/linter.d.ts.map +1 -0
- package/dist/components/dialog/dialog.js +2 -165
- package/dist/components/divider/divider.js +2 -79
- package/dist/components/fab/fab.js +2 -153
- package/dist/components/icon/icon.js +2 -68
- package/dist/components/icon-button/icon-button.css.d.ts.map +1 -1
- package/dist/components/icon-button/icon-button.js +1 -189
- package/dist/components/list/list.css.d.ts.map +1 -1
- package/dist/components/list/list.d.ts.map +1 -1
- package/dist/components/list/list.js +3 -188
- package/dist/components/navigation-drawer/navigation-drawer.css.d.ts +3 -0
- package/dist/components/navigation-drawer/navigation-drawer.css.d.ts.map +1 -0
- package/dist/components/navigation-drawer/navigation-drawer.d.ts +76 -0
- package/dist/components/navigation-drawer/navigation-drawer.d.ts.map +1 -0
- package/dist/components/navigation-drawer/navigation-drawer.js +8 -0
- package/dist/components/player/player.css.d.ts +2 -0
- package/dist/components/player/player.css.d.ts.map +1 -0
- package/dist/components/player/player.d.ts +99 -0
- package/dist/components/player/player.d.ts.map +1 -0
- package/dist/components/player/player.js +7 -0
- package/dist/components/progress/progress.css.d.ts.map +1 -1
- package/dist/components/progress/progress.d.ts +2 -0
- package/dist/components/progress/progress.d.ts.map +1 -1
- package/dist/components/progress/progress.js +3 -181
- package/dist/components/radio/radio.css.d.ts.map +1 -1
- package/dist/components/radio/radio.js +3 -203
- package/dist/components/search-bar/search-bar.css.d.ts +2 -0
- package/dist/components/search-bar/search-bar.css.d.ts.map +1 -0
- package/dist/components/search-bar/search-bar.d.ts +81 -0
- package/dist/components/search-bar/search-bar.d.ts.map +1 -0
- package/dist/components/search-bar/search-bar.js +5 -0
- package/dist/components/snackbar/snackbar.js +2 -162
- package/dist/components/switch/switch.css.d.ts.map +1 -1
- package/dist/components/switch/switch.js +2 -169
- package/dist/components/table/table.css.d.ts +8 -0
- package/dist/components/table/table.css.d.ts.map +1 -0
- package/dist/components/table/table.d.ts +158 -0
- package/dist/components/table/table.d.ts.map +1 -0
- package/dist/components/table/table.js +13 -0
- package/dist/components/tabs/tabs.js +3 -198
- package/dist/components/text-field/text-field.css.d.ts.map +1 -1
- package/dist/components/text-field/text-field.d.ts +1 -1
- package/dist/components/text-field/text-field.d.ts.map +1 -1
- package/dist/components/text-field/text-field.js +2 -325
- package/dist/components/top-app-bar/top-app-bar.css.d.ts +2 -0
- package/dist/components/top-app-bar/top-app-bar.css.d.ts.map +1 -0
- package/dist/components/top-app-bar/top-app-bar.d.ts +29 -0
- package/dist/components/top-app-bar/top-app-bar.d.ts.map +1 -0
- package/dist/components/top-app-bar/top-app-bar.js +5 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2264 -58
- package/dist/index.js.map +1 -1
- package/dist/internal/focus-ring/focus-ring.d.ts.map +1 -1
- package/dist/internal/focus-ring/focus-ring.js +4 -0
- package/dist/internal/ripple/ripple.css.d.ts.map +1 -1
- package/dist/internal/ripple/ripple.d.ts +0 -3
- package/dist/internal/ripple/ripple.d.ts.map +1 -1
- package/dist/internal/ripple/ripple.js +2 -142
- package/dist/tokens/index.js +336 -11
- package/dist/tokens/index.js.map +1 -1
- package/package.json +118 -12
- package/dist/chunks/base-component-DQTjlEVL.js +0 -34
- package/dist/chunks/base-component-DQTjlEVL.js.map +0 -1
- package/dist/chunks/focus-ring-Dl-XoEKK.js +0 -71
- package/dist/chunks/focus-ring-Dl-XoEKK.js.map +0 -1
- package/dist/chunks/form-associated-fKbeX_2P.js.map +0 -1
- package/dist/chunks/theme.css-DV3DRha-.js +0 -263
- package/dist/chunks/theme.css-DV3DRha-.js.map +0 -1
- package/dist/components/badge/badge.js.map +0 -1
- package/dist/components/button/button.js.map +0 -1
- package/dist/components/card/card.js.map +0 -1
- package/dist/components/checkbox/checkbox.js.map +0 -1
- package/dist/components/chip/chip.js.map +0 -1
- package/dist/components/dialog/dialog.js.map +0 -1
- package/dist/components/divider/divider.js.map +0 -1
- package/dist/components/fab/fab.js.map +0 -1
- package/dist/components/icon/icon.js.map +0 -1
- package/dist/components/icon-button/icon-button.js.map +0 -1
- package/dist/components/list/list.js.map +0 -1
- package/dist/components/progress/progress.js.map +0 -1
- package/dist/components/radio/radio.js.map +0 -1
- package/dist/components/snackbar/snackbar.js.map +0 -1
- package/dist/components/switch/switch.js.map +0 -1
- package/dist/components/tabs/tabs.js.map +0 -1
- package/dist/components/text-field/text-field.js.map +0 -1
- package/dist/internal/ripple/ripple.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.0] - 2026-08-21
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
#### Core & Architecture
|
|
13
|
+
- **Lit 3 Foundation**: Built natively with Lit 3, TypeScript, and modern standard Web Components.
|
|
14
|
+
- **Granular Subpath Exports**: Support for tree-shakeable individual component imports (e.g. `@francofantomius/material-components/button`) alongside full bundle imports.
|
|
15
|
+
- **Form-Associated Custom Elements (FACE)**: Seamless form participation, validation constraint handling, and FormData support for all input components (`md-text-field`, `md-checkbox`, `md-radio`, `md-switch`).
|
|
16
|
+
- **Internal State & Interaction Mixins**:
|
|
17
|
+
- `MdRipple`: Material Design 3 interactive ripple state layer.
|
|
18
|
+
- `MdFocusRing`: Accessible high-contrast focus rings for keyboard navigation.
|
|
19
|
+
- `MdBaseComponent`: Unified base class with token inheritance and theming utilities.
|
|
20
|
+
- **Custom Elements Manifest**: Generated `custom-elements.json` for IDE autocomplete and documentation tooling.
|
|
21
|
+
|
|
22
|
+
#### Design Tokens & Theming
|
|
23
|
+
- **Material Design 3 (M3) Color System**: Full tokenized color system with tonal palettes, surface tints, containers, and contrast-compliant roles.
|
|
24
|
+
- **Dynamic Theming**: Support for light, dark, and custom theme overrides via CSS custom properties and `data-theme` attribute.
|
|
25
|
+
- **Elevation Tokens**: Elevation levels 0 through 5 with corresponding box shadows and surface tint opacities.
|
|
26
|
+
- **Motion & Typography**: M3 standard easing curves, durations, and typography type scales (Display, Headline, Title, Body, Label).
|
|
27
|
+
- **Shape Tokens**: Corner radius scales from `none` (0px) to `full` (9999px).
|
|
28
|
+
|
|
29
|
+
#### Components
|
|
30
|
+
- **Buttons & FABs**:
|
|
31
|
+
- `md-button`: Filled, elevated, tonal, outlined, and text button variants with leading and trailing icon slots.
|
|
32
|
+
- `md-icon-button`: Standard, filled, tonal, and outlined icon buttons with toggle support.
|
|
33
|
+
- `md-fab`: Floating action buttons with small, regular, and large sizes, plus extended FAB styling.
|
|
34
|
+
- **Form & Input Controls**:
|
|
35
|
+
- `md-text-field`: Filled and outlined variants, label animations, helper text, error text, prefix/suffix icons, character counters, and native form integration.
|
|
36
|
+
- `md-checkbox`: Controlled and uncontrolled states, indeterminate state, and custom touch targets.
|
|
37
|
+
- `md-switch`: Material 3 toggle switch with icon customization for checked and unchecked states.
|
|
38
|
+
- `md-radio` & `md-radio-group`: Accessible radio buttons with grouped keyboard arrow navigation.
|
|
39
|
+
- **Navigation & App Bars**:
|
|
40
|
+
- `md-top-app-bar`: Small, center-aligned, medium, and large variants with navigation slots, action item slots, and scroll-elevation behaviors.
|
|
41
|
+
- `md-navigation-drawer`: Standard and modal navigation drawers with `md-navigation-drawer-item` sub-components, active indicator pill styles, and badge indicators.
|
|
42
|
+
- `md-app-drawer`: Google Apps style grid launcher with customizable apps, drag-and-drop reordering, edit mode, search filter, fullscreen display, and back button support.
|
|
43
|
+
- `md-account-menu`: Profile switcher drawer and menu supporting multiple user accounts, account switching, sign-out actions, management links, fullscreen mode, and back navigation.
|
|
44
|
+
- `md-tabs` & `md-tab`: Primary and secondary tab bars with animated active indicator lines.
|
|
45
|
+
- **Data Display & Feedback**:
|
|
46
|
+
- `md-card`: Elevated, filled, and outlined card containers with header, media, content, and action sections.
|
|
47
|
+
- `md-dialog`: Accessible modal dialogs with customizable headline, body, and action buttons.
|
|
48
|
+
- `md-table`: Feature-packed data table with sortable columns, row selection checkboxes, pagination controls, sticky headers, and dense mode.
|
|
49
|
+
- `md-list` & `md-list-item`: Single-line, two-line, and three-line list items supporting leading icons/avatars, headline/supporting text, trailing metadata, and interactive states.
|
|
50
|
+
- `md-progress`: Linear and circular progress indicators supporting determinate, indeterminate, and M3 Expressive wavy indicator modes.
|
|
51
|
+
- `md-badge`: Small dot badges, numeric count badges, and maximum threshold capping (e.g. `99+`).
|
|
52
|
+
- `md-chip`: Assist, filter, input, and suggestion chips with selectable and removable capabilities.
|
|
53
|
+
- `md-snackbar`: Toast notification system with custom duration, action triggers, and dismiss options.
|
|
54
|
+
- `md-search-bar`: Expandable search bar and search view with suggestion slots, trailing icons, clear button, and mobile full-screen transitions.
|
|
55
|
+
- **Media & Developer Tools**:
|
|
56
|
+
- `md-player`: Media player supporting video and audio playback (`md-video-player`, `md-audio-player`), custom play/pause/seek controls, volume slider, fullscreen toggle, time displays, and keyboard accessibility.
|
|
57
|
+
- `md-code`: Code block viewer with built-in syntax highlighting, copy-to-clipboard button, line numbers, and error / lint annotation support.
|
|
58
|
+
- `md-icon`: Material Symbols icon renderer supporting font-based and custom SVG icons.
|
|
59
|
+
|
|
60
|
+
#### Documentation & Testing
|
|
61
|
+
- Comprehensive documentation site with live interactive code examples, component playgrounds, and guides for framework integration (React, Vue, Angular, Svelte, Solid), form handling, and theming.
|
|
62
|
+
- Automated unit and integration test suite powered by Vitest and Happy-DOM.
|
package/README.md
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
# @francofantomius/material-components
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="left">
|
|
4
|
+
<a href="https://www.npmjs.com/package/@francofantomius/material-components"><img src="https://img.shields.io/npm/v/@francofantomius/material-components?color=6750A4&label=npm&logo=npm" alt="npm version" /></a>
|
|
5
|
+
<a href="https://lit.dev/"><img src="https://img.shields.io/badge/Lit-3.x-324FFF?logo=lit&logoColor=white" alt="Lit 3" /></a>
|
|
6
|
+
<a href="https://vite.dev/"><img src="https://img.shields.io/badge/Vite-8.x-646CFF?logo=vite&logoColor=white" alt="Vite 8" /></a>
|
|
7
|
+
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-Ready-3178C6?logo=typescript&logoColor=white" alt="TypeScript" /></a>
|
|
8
|
+
<a href="https://m3.material.io/"><img src="https://img.shields.io/badge/Material%20Design-3-6750A4?logo=materialdesign&logoColor=white" alt="Material Design 3" /></a>
|
|
9
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT" /></a>
|
|
10
|
+
<a href="https://bundlephobia.com/package/@francofantomius/material-components"><img src="https://img.shields.io/badge/ESM-tree--shakeable-success" alt="Tree Shakeable ESM" /></a>
|
|
11
|
+
</p>
|
|
4
12
|
|
|
5
|
-
|
|
13
|
+
A modern, accessible, and lightweight **Material Design 3 (M3)** Web Components library built with [Lit](https://lit.dev/), [Vite](https://vite.dev/), and [TypeScript](https://www.typescriptlang.org/).
|
|
14
|
+
|
|
15
|
+
Works natively across all modern browsers and seamlessly integrates with **React**, **Vue**, **Angular**, **Svelte**, **Solid**, or plain HTML/JavaScript.
|
|
6
16
|
|
|
7
17
|
---
|
|
8
18
|
|
|
9
19
|
## Features
|
|
10
20
|
|
|
11
21
|
- **Material Design 3**: Fully tokenized CSS design tokens for dynamic theming (Light/Dark mode and custom color palettes).
|
|
12
|
-
- **
|
|
13
|
-
- **Form-Associated Custom Elements (FACE)**:
|
|
14
|
-
- **Lightweight and Tree-Shakeable**: Pure ESM with subpath exports (`@francofantomius/material-components/button`).
|
|
15
|
-
- **TypeScript
|
|
16
|
-
- **Accessible**: WCAG
|
|
22
|
+
- **23+ Core Components**: Complete suite of components including Top App Bars, Navigation Drawers, Data Tables, Media Players, Code Blocks/Linters, Search Bars, Form Elements, Dialogs, Cards, and more.
|
|
23
|
+
- **Form-Associated Custom Elements (FACE)**: Native form participation, constraint validation, and `FormData` compatibility.
|
|
24
|
+
- **Lightweight and Tree-Shakeable**: Pure ESM with granular subpath exports (`@francofantomius/material-components/button`).
|
|
25
|
+
- **TypeScript & Custom Elements Manifest**: First-class type definitions (`.d.ts`), source maps, and standard `custom-elements.json` for IDE autocomplete.
|
|
26
|
+
- **Accessible (a11y)**: WCAG-compliant contrast ratios, high-visibility focus rings, ARIA roles, and full keyboard navigation.
|
|
17
27
|
|
|
18
28
|
---
|
|
19
29
|
|
|
@@ -27,61 +37,176 @@ npm install @francofantomius/material-components lit
|
|
|
27
37
|
|
|
28
38
|
## Quick Start
|
|
29
39
|
|
|
30
|
-
### 1. Load Fonts and Icons (
|
|
40
|
+
### 1. Load Fonts and Icons (Recommended)
|
|
31
41
|
Add Google Roboto and Material Symbols to your HTML:
|
|
32
42
|
```html
|
|
33
43
|
<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
44
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" />
|
|
35
45
|
```
|
|
36
46
|
|
|
37
|
-
### 2. Import
|
|
47
|
+
### 2. Import Components
|
|
38
48
|
|
|
39
|
-
####
|
|
49
|
+
#### Granular Subpath Imports (Recommended for production)
|
|
40
50
|
```typescript
|
|
41
|
-
import '@francofantomius/material-components';
|
|
51
|
+
import '@francofantomius/material-components/button';
|
|
52
|
+
import '@francofantomius/material-components/text-field';
|
|
53
|
+
import '@francofantomius/material-components/top-app-bar';
|
|
54
|
+
import '@francofantomius/material-components/navigation-drawer';
|
|
55
|
+
import '@francofantomius/material-components/table';
|
|
56
|
+
import '@francofantomius/material-components/search-bar';
|
|
57
|
+
import '@francofantomius/material-components/app-drawer';
|
|
58
|
+
import '@francofantomius/material-components/account-menu';
|
|
59
|
+
import '@francofantomius/material-components/code';
|
|
60
|
+
import '@francofantomius/material-components/player';
|
|
42
61
|
```
|
|
43
62
|
|
|
44
|
-
####
|
|
63
|
+
#### Global Bundle Import (Ideal for prototyping)
|
|
45
64
|
```typescript
|
|
46
|
-
import '@francofantomius/material-components
|
|
47
|
-
|
|
48
|
-
|
|
65
|
+
import '@francofantomius/material-components';
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Usage Examples
|
|
71
|
+
|
|
72
|
+
### Navigation & Top App Bar
|
|
73
|
+
```html
|
|
74
|
+
<!-- Top App Bar -->
|
|
75
|
+
<md-top-app-bar variant="center-aligned" headline="My Application">
|
|
76
|
+
<md-icon-button slot="navigation" icon="menu" aria-label="Open menu"></md-icon-button>
|
|
77
|
+
<md-icon-button slot="actions" icon="search" aria-label="Search"></md-icon-button>
|
|
78
|
+
<md-icon-button slot="actions" icon="account_circle" aria-label="Account"></md-icon-button>
|
|
79
|
+
</md-top-app-bar>
|
|
80
|
+
|
|
81
|
+
<!-- Navigation Drawer -->
|
|
82
|
+
<md-navigation-drawer headline="Navigation" type="modal">
|
|
83
|
+
<md-navigation-drawer-item icon="inbox" label="Inbox" badge="24" active></md-navigation-drawer-item>
|
|
84
|
+
<md-navigation-drawer-item icon="send" label="Outbox"></md-navigation-drawer-item>
|
|
85
|
+
<md-navigation-drawer-item icon="favorite" label="Favorites"></md-navigation-drawer-item>
|
|
86
|
+
<md-navigation-drawer-item icon="settings" label="Settings"></md-navigation-drawer-item>
|
|
87
|
+
</md-navigation-drawer>
|
|
49
88
|
```
|
|
50
89
|
|
|
51
|
-
|
|
90
|
+
### Buttons, FABs & Icons
|
|
52
91
|
```html
|
|
53
|
-
|
|
54
|
-
<md-button variant="
|
|
55
|
-
<md-button variant="
|
|
56
|
-
<md-
|
|
92
|
+
<md-button variant="filled" icon="send">Send</md-button>
|
|
93
|
+
<md-button variant="elevated">Elevated</md-button>
|
|
94
|
+
<md-button variant="tonal">Tonal</md-button>
|
|
95
|
+
<md-button variant="outlined">Outlined</md-button>
|
|
96
|
+
<md-button variant="text">Text</md-button>
|
|
97
|
+
|
|
98
|
+
<md-icon-button icon="favorite" aria-label="Favorite"></md-icon-button>
|
|
99
|
+
<md-fab icon="edit" label="Compose"></md-fab>
|
|
100
|
+
<md-icon name="star" filled></md-icon>
|
|
101
|
+
```
|
|
57
102
|
|
|
58
|
-
|
|
103
|
+
### Form Controls (Native Form Association)
|
|
104
|
+
```html
|
|
59
105
|
<form id="login-form">
|
|
60
|
-
<md-text-field label="
|
|
61
|
-
<md-
|
|
62
|
-
|
|
106
|
+
<md-text-field label="Full Name" name="name" required leading-icon="person"></md-text-field>
|
|
107
|
+
<md-text-field label="Email" name="email" type="email" required leading-icon="email"></md-text-field>
|
|
108
|
+
|
|
109
|
+
<md-checkbox name="newsletter" checked>Subscribe to newsletter</md-checkbox>
|
|
110
|
+
<md-switch name="notifications" selected icons>Enable notifications</md-switch>
|
|
111
|
+
|
|
112
|
+
<md-radio-group name="tier">
|
|
113
|
+
<md-radio value="free" label="Free" checked></md-radio>
|
|
114
|
+
<md-radio value="pro" label="Pro"></md-radio>
|
|
115
|
+
</md-radio-group>
|
|
116
|
+
|
|
63
117
|
<md-button type="submit" variant="filled">Log In</md-button>
|
|
64
118
|
</form>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Data Table
|
|
122
|
+
```html
|
|
123
|
+
<md-table bordered striped hoverable id="my-table"></md-table>
|
|
124
|
+
|
|
125
|
+
<script>
|
|
126
|
+
const table = document.getElementById('my-table');
|
|
127
|
+
table.columns = [
|
|
128
|
+
{ key: 'name', label: 'User', sortable: true },
|
|
129
|
+
{ key: 'role', label: 'Role', sortable: true },
|
|
130
|
+
{ key: 'score', label: 'Score', numeric: true, sortable: true }
|
|
131
|
+
];
|
|
132
|
+
table.rows = [
|
|
133
|
+
{ name: 'Alice Smith', role: 'Admin', score: 98 },
|
|
134
|
+
{ name: 'Bob Jones', role: 'Developer', score: 85 }
|
|
135
|
+
];
|
|
136
|
+
table.selectable = true;
|
|
137
|
+
table.paginated = true;
|
|
138
|
+
</script>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Search Bar with Live Suggestions
|
|
142
|
+
```html
|
|
143
|
+
<md-search-bar placeholder="Search products..." id="search-bar"></md-search-bar>
|
|
144
|
+
|
|
145
|
+
<script>
|
|
146
|
+
const search = document.getElementById('search-bar');
|
|
147
|
+
search.suggestions = [
|
|
148
|
+
{ label: 'Documentation', icon: 'description', supportingText: 'Getting started guide' },
|
|
149
|
+
{ label: 'Component Gallery', icon: 'widgets', supportingText: 'Explore all 23 components' }
|
|
150
|
+
];
|
|
151
|
+
search.addEventListener('search', (e) => console.log('Query:', e.detail.value));
|
|
152
|
+
</script>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Code Block & Syntax Linter
|
|
156
|
+
```html
|
|
157
|
+
<md-code
|
|
158
|
+
language="typescript"
|
|
159
|
+
filename="example.ts"
|
|
160
|
+
line-numbers
|
|
161
|
+
highlight-lines="2, 4-5"
|
|
162
|
+
lint
|
|
163
|
+
copyable
|
|
164
|
+
code="const greeting: string = 'Hello, world!';\nconsole.log(greeting);"
|
|
165
|
+
></md-code>
|
|
166
|
+
```
|
|
65
167
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
168
|
+
### Media Player (Audio & Video)
|
|
169
|
+
```html
|
|
170
|
+
<!-- Audio Player -->
|
|
171
|
+
<md-player
|
|
172
|
+
type="audio"
|
|
173
|
+
src="https://example.com/audio.mp3"
|
|
174
|
+
track-title="Ambient Soundscape"
|
|
175
|
+
artist="Sound Design"
|
|
176
|
+
></md-player>
|
|
177
|
+
|
|
178
|
+
<!-- Video Player -->
|
|
179
|
+
<md-player
|
|
180
|
+
type="video"
|
|
181
|
+
src="https://example.com/video.mp4"
|
|
182
|
+
poster="https://example.com/poster.jpg"
|
|
183
|
+
track-title="Product Demo"
|
|
184
|
+
></md-player>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### App Drawer & Account Menu
|
|
188
|
+
```html
|
|
189
|
+
<!-- App Launcher Grid -->
|
|
190
|
+
<md-app-drawer headline="Apps">
|
|
191
|
+
<md-app-drawer-item icon="mail" label="Mail" badge="3"></md-app-drawer-item>
|
|
192
|
+
<md-app-drawer-item icon="calendar_today" label="Calendar"></md-app-drawer-item>
|
|
193
|
+
<md-app-drawer-item icon="folder" label="Drive"></md-app-drawer-item>
|
|
194
|
+
</md-app-drawer>
|
|
195
|
+
|
|
196
|
+
<!-- Account Menu & Switcher -->
|
|
197
|
+
<md-account-menu
|
|
198
|
+
name="Franco Fantomius"
|
|
199
|
+
email="franco.fantomius@example.com"
|
|
200
|
+
initials="F"
|
|
201
|
+
role-title="Lead Architect"
|
|
202
|
+
organization="Material Components Team"
|
|
203
|
+
storage-used="10.4 GB"
|
|
204
|
+
storage-total="15 GB"
|
|
205
|
+
storage-progress="0.69"
|
|
206
|
+
>
|
|
207
|
+
<md-account-item slot="accounts" name="Franco Fantomius" email="franco.fantomius@example.com" initials="F" active></md-account-item>
|
|
208
|
+
<md-account-item slot="accounts" name="Work Profile" email="franco@company.com" initials="W"></md-account-item>
|
|
209
|
+
</md-account-menu>
|
|
85
210
|
```
|
|
86
211
|
|
|
87
212
|
---
|
|
@@ -89,7 +214,7 @@ import '@francofantomius/material-components/card';
|
|
|
89
214
|
## Theming and Dark Mode
|
|
90
215
|
|
|
91
216
|
### Dynamic Theming via CSS Custom Properties
|
|
92
|
-
The library uses standard CSS custom properties adhering to Material 3
|
|
217
|
+
The library uses standard CSS custom properties adhering to Material Design 3 specifications:
|
|
93
218
|
|
|
94
219
|
```css
|
|
95
220
|
:root {
|
|
@@ -125,65 +250,134 @@ applyTheme({
|
|
|
125
250
|
|
|
126
251
|
## Component List
|
|
127
252
|
|
|
128
|
-
| Component | Tag | Key Properties &
|
|
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
|
-
| **
|
|
134
|
-
| **
|
|
135
|
-
| **
|
|
136
|
-
| **
|
|
137
|
-
| **
|
|
138
|
-
| **
|
|
139
|
-
| **
|
|
140
|
-
| **
|
|
141
|
-
| **
|
|
142
|
-
| **
|
|
143
|
-
| **
|
|
144
|
-
| **
|
|
145
|
-
| **
|
|
253
|
+
| Component | Tag(s) | Subpath Export | Key Properties & Attributes |
|
|
254
|
+
| :--- | :--- | :--- | :--- |
|
|
255
|
+
| **Button** | `<md-button>` | `/button` | `variant` (filled, elevated, tonal, outlined, text), `icon`, `loading`, `disabled`, `href`, `type` |
|
|
256
|
+
| **Icon Button** | `<md-icon-button>` | `/icon-button` | `variant` (standard, filled, tonal, outlined), `icon`, `toggle`, `selected`, `disabled` |
|
|
257
|
+
| **FAB** | `<md-fab>` | `/fab` | `size` (small, medium, large), `label`, `icon`, `lowered` |
|
|
258
|
+
| **Icon** | `<md-icon>` | `/icon` | `name`, `filled`, `size` |
|
|
259
|
+
| **Text Field** | `<md-text-field>` | `/text-field` | `variant` (filled, outlined), `label`, `value`, `prefix-text`, `suffix-text`, `error`, `supporting-text`, `leading-icon`, `trailing-icon` |
|
|
260
|
+
| **Checkbox** | `<md-checkbox>` | `/checkbox` | `checked`, `indeterminate`, `error`, `disabled`, `name`, `value` |
|
|
261
|
+
| **Switch** | `<md-switch>` | `/switch` | `selected`, `icons`, `disabled`, `name`, `value` |
|
|
262
|
+
| **Radio** | `<md-radio>`, `<md-radio-group>` | `/radio` | `checked`, `value`, `name`, `row`, `disabled` |
|
|
263
|
+
| **Card** | `<md-card>` | `/card` | `variant` (elevated, filled, outlined), `interactive`, `href` |
|
|
264
|
+
| **Dialog** | `<md-dialog>` | `/dialog` | `open`, `headline`, `icon`, `showModal()`, `close()`, `cancelable` |
|
|
265
|
+
| **Divider** | `<md-divider>` | `/divider` | `vertical`, `inset`, `inset-start`, `inset-end` |
|
|
266
|
+
| **Progress** | `<md-progress>` | `/progress` | `type` (linear, circular), `value` (0 to 1, or indeterminate), `buffer` |
|
|
267
|
+
| **Badge** | `<md-badge>` | `/badge` | `value`, `dot`, `max` |
|
|
268
|
+
| **Chip** | `<md-chip>`, `<md-chip-set>` | `/chip` | `variant` (assist, filter, input, suggestion), `label`, `selected`, `removable`, `elevated` |
|
|
269
|
+
| **Tabs** | `<md-tabs>`, `<md-tab>` | `/tabs` | `active-index`, `icon`, `label`, `secondary` |
|
|
270
|
+
| **List** | `<md-list>`, `<md-list-item>` | `/list` | `headline`, `supporting-text`, `trailing-supporting-text`, `interactive`, `href`, `lines` |
|
|
271
|
+
| **Snackbar** | `<md-snackbar>` | `/snackbar` | `open`, `message`, `action-text`, `closeable`, `timeout-ms`, `stacked` |
|
|
272
|
+
| **Top App Bar** | `<md-top-app-bar>`, `<md-top-bar>` | `/top-app-bar` | `variant` (center-aligned, small, medium, large), `headline`, `subtitle`, `elevated`, `fixed` |
|
|
273
|
+
| **Navigation Drawer** | `<md-navigation-drawer>`, `<md-drawer>`, `<md-menu-bar>`, `<md-navigation-drawer-item>` | `/navigation-drawer` | `open`, `type` (modal, standard, responsive), `pivot` (left, right), `headline`, `responsive`, `closed` |
|
|
274
|
+
| **App Drawer** | `<md-app-drawer>`, `<md-app-launcher>`, `<md-apps-menu>`, `<md-app-drawer-item>`, `<md-app-item>` | `/app-drawer` | `open`, `headline`, `icon`, `columns`, `reorderable`, `editable`, `modal`, `alignment`, `pivot` |
|
|
275
|
+
| **Account Menu** | `<md-account-menu>`, `<md-account-drawer>`, `<md-account-profile>`, `<md-account-item>` | `/account-menu` | `open`, `name`, `email`, `avatar`, `initials`, `storage-used`, `storage-total`, `show-tabs`, `modal`, `alignment` |
|
|
276
|
+
| **Table / Data Table** | `<md-table>`, `<md-data-table>`, `<md-table-head>`, `<md-table-body>`, `<md-table-row>`, `<md-table-cell>`, `<md-table-header-cell>`, `<md-table-pagination>` | `/table` | `columns`, `rows`, `selectable`, `sortable`, `paginated`, `page`, `page-size`, `bordered`, `striped`, `sticky-header`, `loading` |
|
|
277
|
+
| **Search Bar** | `<md-search-bar>`, `<md-search>` | `/search-bar` | `value`, `placeholder`, `active`, `suggestions`, `leading-icon`, `trailing-icon`, `responsive`, `fullscreen` |
|
|
278
|
+
| **Code Block & Linter** | `<md-code>`, `<md-code-block>` | `/code` | `code`, `language`, `label` / `filename`, `line-numbers`, `highlight-lines`, `lint`, `copyable`, `wrap-lines`, `max-height` |
|
|
279
|
+
| **Media Player** | `<md-player>`, `<md-media-player>`, `<md-audio-player>`, `<md-video-player>` | `/player` | `type` (audio, video), `variant` (elevated, filled, outlined, compact, full), `src`, `track-title`, `artist`, `poster`, `currentTime`, `duration`, `volume`, `playback-rate` |
|
|
280
|
+
| **Internal Helpers** | `<md-ripple>`, `<md-focus-ring>` | `/ripple`, `/focus-ring` | Interactive ripple effect & WCAG focus indicators |
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## Subpath Exports Reference
|
|
285
|
+
|
|
286
|
+
```typescript
|
|
287
|
+
import { applyTheme } from '@francofantomius/material-components/theme';
|
|
288
|
+
import { MdButton } from '@francofantomius/material-components/button';
|
|
289
|
+
import { MdIconButton } from '@francofantomius/material-components/icon-button';
|
|
290
|
+
import { MdFab } from '@francofantomius/material-components/fab';
|
|
291
|
+
import { MdIcon } from '@francofantomius/material-components/icon';
|
|
292
|
+
import { MdTextField } from '@francofantomius/material-components/text-field';
|
|
293
|
+
import { MdCheckbox } from '@francofantomius/material-components/checkbox';
|
|
294
|
+
import { MdSwitch } from '@francofantomius/material-components/switch';
|
|
295
|
+
import { MdRadio, MdRadioGroup } from '@francofantomius/material-components/radio';
|
|
296
|
+
import { MdCard } from '@francofantomius/material-components/card';
|
|
297
|
+
import { MdDialog } from '@francofantomius/material-components/dialog';
|
|
298
|
+
import { MdDivider } from '@francofantomius/material-components/divider';
|
|
299
|
+
import { MdProgress } from '@francofantomius/material-components/progress';
|
|
300
|
+
import { MdBadge } from '@francofantomius/material-components/badge';
|
|
301
|
+
import { MdChip, MdChipSet } from '@francofantomius/material-components/chip';
|
|
302
|
+
import { MdTabs, MdTab } from '@francofantomius/material-components/tabs';
|
|
303
|
+
import { MdList, MdListItem } from '@francofantomius/material-components/list';
|
|
304
|
+
import { MdSnackbar } from '@francofantomius/material-components/snackbar';
|
|
305
|
+
import { MdTopAppBar, MdTopBar } from '@francofantomius/material-components/top-app-bar';
|
|
306
|
+
import { MdNavigationDrawer, MdDrawer, MdMenuBar, MdNavigationDrawerItem } from '@francofantomius/material-components/navigation-drawer';
|
|
307
|
+
import { MdAppDrawer, MdAppDrawerItem, MdAppLauncher, MdAppsMenu } from '@francofantomius/material-components/app-drawer';
|
|
308
|
+
import { MdAccountMenu, MdAccountItem, MdAccountDrawer, MdAccountProfile } from '@francofantomius/material-components/account-menu';
|
|
309
|
+
import { MdTable, MdDataTable, MdTableHeaderCell, MdTableCell, MdTableRow } from '@francofantomius/material-components/table';
|
|
310
|
+
import { MdSearchBar, MdSearch } from '@francofantomius/material-components/search-bar';
|
|
311
|
+
import { MdCode, MdCodeBlock } from '@francofantomius/material-components/code';
|
|
312
|
+
import { MdPlayer, MdMediaPlayer, MdAudioPlayer, MdVideoPlayer } from '@francofantomius/material-components/player';
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## Framework Integration
|
|
318
|
+
|
|
319
|
+
Because Web Components are browser standards, they work seamlessly with any framework:
|
|
320
|
+
|
|
321
|
+
### React
|
|
322
|
+
```tsx
|
|
323
|
+
import '@francofantomius/material-components/button';
|
|
324
|
+
import '@francofantomius/material-components/text-field';
|
|
325
|
+
|
|
326
|
+
export function LoginForm() {
|
|
327
|
+
return (
|
|
328
|
+
<div>
|
|
329
|
+
<md-text-field label="Username" onInput={(e: any) => console.log(e.target.value)}></md-text-field>
|
|
330
|
+
<md-button variant="filled" onClick={() => alert('Clicked')}>Submit</md-button>
|
|
331
|
+
</div>
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Vue
|
|
337
|
+
```vue
|
|
338
|
+
<script setup>
|
|
339
|
+
import '@francofantomius/material-components/button';
|
|
340
|
+
import '@francofantomius/material-components/switch';
|
|
341
|
+
</script>
|
|
342
|
+
|
|
343
|
+
<template>
|
|
344
|
+
<md-switch selected icons>Notifications</md-switch>
|
|
345
|
+
<md-button variant="tonal">Save</md-button>
|
|
346
|
+
</template>
|
|
347
|
+
```
|
|
146
348
|
|
|
147
349
|
---
|
|
148
350
|
|
|
149
|
-
## Development
|
|
351
|
+
## Development Scripts
|
|
150
352
|
|
|
151
353
|
```bash
|
|
152
|
-
# Start local
|
|
354
|
+
# Start local development playground & documentation
|
|
153
355
|
npm run dev
|
|
154
356
|
|
|
155
|
-
#
|
|
156
|
-
npm run docs:dev
|
|
157
|
-
|
|
158
|
-
# Run unit tests
|
|
357
|
+
# Run unit tests with Vitest
|
|
159
358
|
npm test
|
|
160
359
|
|
|
161
|
-
# Type check
|
|
360
|
+
# Type check TypeScript codebase
|
|
162
361
|
npm run typecheck
|
|
163
362
|
|
|
164
|
-
# Build library &
|
|
363
|
+
# Build ESM library, docs & generate Custom Elements Manifest
|
|
165
364
|
npm run build
|
|
166
365
|
|
|
167
|
-
#
|
|
168
|
-
npm run
|
|
366
|
+
# Preview docs site build
|
|
367
|
+
npm run preview
|
|
169
368
|
```
|
|
170
369
|
|
|
171
370
|
---
|
|
172
371
|
|
|
173
|
-
## Automated Publishing
|
|
372
|
+
## Automated Publishing (Trusted Publishing)
|
|
174
373
|
|
|
175
|
-
This repository
|
|
374
|
+
This repository is configured for **npm Trusted Publishing** using GitHub Actions OpenID Connect (OIDC). No long-lived static tokens or secrets are required.
|
|
176
375
|
|
|
177
376
|
### How it works:
|
|
178
|
-
1. When
|
|
179
|
-
2. It queries npm to
|
|
180
|
-
3. If the version is new, it runs typecheck, tests, builds the library, and publishes the package
|
|
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.
|
|
377
|
+
1. When changes are pushed to `main`, the workflow checks the `version` field in `package.json`.
|
|
378
|
+
2. It queries npm to verify if this version is already published.
|
|
379
|
+
3. If the version is new, it runs typecheck, tests, builds the library, exchanges an OIDC token with npm, and publishes the package with cryptographic provenance (`--provenance`).
|
|
380
|
+
4. It automatically creates a Git tag (`v<version>`) and a GitHub Release.
|
|
187
381
|
|
|
188
382
|
---
|
|
189
383
|
|