@universityofmaryland/web-components-library 1.12.14 → 1.12.15
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/README.md +221 -71
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# University of Maryland Web Components Library
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@universityofmaryland/web-components-library)
|
|
4
4
|
|
|
5
|
-
High-level web components built
|
|
5
|
+
High-level web components built on the UMD Elements Library, providing feature-rich, accessible, and brand-compliant UI components for University of Maryland digital experiences.
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
The UMD Web Components Library is the primary interface for developers building UMD websites and applications. It provides a comprehensive collection of web components that implement UMD design patterns, ensuring consistency, accessibility, and brand compliance across all digital properties. These components are built on top of the Elements Library and styled using the Styles Library, creating a complete design system solution.
|
|
6
10
|
|
|
7
11
|
## Installation
|
|
8
12
|
|
|
@@ -14,118 +18,264 @@ npm install @universityofmaryland/web-components-library
|
|
|
14
18
|
yarn add @universityofmaryland/web-components-library
|
|
15
19
|
```
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
### Peer Dependencies
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
import LoadUmdComponents from '@universityofmaryland/web-components-library';
|
|
23
|
+
For complete functionality, install the companion packages:
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
25
|
+
```bash
|
|
26
|
+
npm install @universityofmaryland/web-styles-library
|
|
27
|
+
npm install @universityofmaryland/web-elements-library
|
|
26
28
|
```
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
### Load All Components
|
|
29
33
|
|
|
30
34
|
```javascript
|
|
31
|
-
import
|
|
35
|
+
import LoadUmdComponents from '@universityofmaryland/web-components-library';
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
// Initialize all components
|
|
38
|
+
LoadUmdComponents();
|
|
35
39
|
```
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
### Load Specific Components (Recommended)
|
|
38
42
|
|
|
39
|
-
|
|
43
|
+
```javascript
|
|
44
|
+
import { Components } from '@universityofmaryland/web-components-library';
|
|
40
45
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
// Load only what you need
|
|
47
|
+
Components.card.standard();
|
|
48
|
+
Components.hero.base();
|
|
49
|
+
Components.navigation.primary();
|
|
50
|
+
```
|
|
45
51
|
|
|
46
|
-
###
|
|
52
|
+
### HTML Usage
|
|
47
53
|
|
|
48
54
|
```html
|
|
49
|
-
<umd-element-
|
|
50
|
-
<
|
|
51
|
-
<p slot="
|
|
55
|
+
<umd-element-hero data-theme="dark" data-display="overlay">
|
|
56
|
+
<img slot="image" src="hero.jpg" alt="Hero image" />
|
|
57
|
+
<p slot="eyebrow">Welcome</p>
|
|
58
|
+
<h1 slot="headline">University of Maryland</h1>
|
|
59
|
+
<div slot="text">
|
|
60
|
+
<p>Fearless ideas start here.</p>
|
|
61
|
+
</div>
|
|
52
62
|
<div slot="actions">
|
|
53
|
-
<
|
|
63
|
+
<umd-element-call-to-action data-display="primary">
|
|
64
|
+
<a href="/apply">Apply Now</a>
|
|
65
|
+
</umd-element-call-to-action>
|
|
54
66
|
</div>
|
|
55
|
-
</umd-element-
|
|
67
|
+
</umd-element-hero>
|
|
56
68
|
```
|
|
57
69
|
|
|
58
|
-
|
|
59
|
-
- **Tag name** - Always prefixed with `umd-element-`
|
|
60
|
-
- **Configuration attributes** - Use `data-*` prefix for initial setup
|
|
61
|
-
- **Slots** - Named areas where content can be inserted
|
|
70
|
+
## Component Architecture
|
|
62
71
|
|
|
63
|
-
###
|
|
72
|
+
### Web Components Standards
|
|
64
73
|
|
|
65
|
-
|
|
74
|
+
All components follow W3C Web Components standards:
|
|
66
75
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
- **Custom Elements** - Semantic HTML tags (e.g., `<umd-element-card>`)
|
|
77
|
+
- **Shadow DOM** - Style encapsulation and DOM isolation
|
|
78
|
+
- **Slots** - Content distribution for flexible layouts
|
|
79
|
+
- **Attributes** - Configuration and reactive updates
|
|
80
|
+
|
|
81
|
+
### Naming Convention
|
|
82
|
+
|
|
83
|
+
All components use the `umd-element-` prefix:
|
|
84
|
+
|
|
85
|
+
- `<umd-element-card>`
|
|
86
|
+
- `<umd-element-hero>`
|
|
87
|
+
- `<umd-element-navigation>`
|
|
70
88
|
|
|
71
|
-
|
|
89
|
+
### Attribute System
|
|
90
|
+
|
|
91
|
+
Components use configuration attributes with the `data-*` prefix:
|
|
92
|
+
|
|
93
|
+
- Set initial state: `data-theme="dark"`
|
|
94
|
+
- Configure display: `data-display="overlay"`
|
|
95
|
+
|
|
96
|
+
## Integration with Other Packages
|
|
97
|
+
|
|
98
|
+
### Styles Package Integration
|
|
99
|
+
|
|
100
|
+
The Styles Package provides utility classes for spacing, grids, and typography:
|
|
72
101
|
|
|
73
102
|
```html
|
|
74
|
-
<!--
|
|
103
|
+
<!-- Consistent spacing -->
|
|
75
104
|
<div class="umd-layout-space-vertical-landing">
|
|
76
|
-
<umd-element-hero>
|
|
77
|
-
<!-- Hero content -->
|
|
78
|
-
</umd-element-hero>
|
|
105
|
+
<umd-element-hero><!-- content --></umd-element-hero>
|
|
79
106
|
</div>
|
|
80
107
|
|
|
81
|
-
<!--
|
|
108
|
+
<!-- Responsive grids -->
|
|
82
109
|
<div class="umd-grid-gap-three">
|
|
83
|
-
<umd-element-card><!--
|
|
84
|
-
<umd-element-card><!--
|
|
85
|
-
<umd-element-card><!--
|
|
110
|
+
<umd-element-card><!-- card 1 --></umd-element-card>
|
|
111
|
+
<umd-element-card><!-- card 2 --></umd-element-card>
|
|
112
|
+
<umd-element-card><!-- card 3 --></umd-element-card>
|
|
86
113
|
</div>
|
|
87
114
|
```
|
|
88
115
|
|
|
89
|
-
|
|
116
|
+
[Learn more about Styles integration →](./usage.html#styles-integration)
|
|
117
|
+
|
|
118
|
+
### Elements Package Relationship
|
|
119
|
+
|
|
120
|
+
Components are built on Elements:
|
|
121
|
+
|
|
122
|
+
- Elements provide atomic building blocks
|
|
123
|
+
- Components compose Elements into features
|
|
124
|
+
- Components add interactivity and state management
|
|
125
|
+
|
|
126
|
+
### Feeds Package Integration
|
|
127
|
+
|
|
128
|
+
For dynamic content, combine with Feeds:
|
|
129
|
+
|
|
130
|
+
```javascript
|
|
131
|
+
import { Components } from '@universityofmaryland/web-components-library';
|
|
132
|
+
import { Feeds } from '@universityofmaryland/web-feeds-library';
|
|
133
|
+
|
|
134
|
+
// Initialize components
|
|
135
|
+
Components.feed.newsList();
|
|
136
|
+
|
|
137
|
+
// Component will handle feed display
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Component Categories
|
|
141
|
+
|
|
142
|
+
### Navigation Components
|
|
143
|
+
|
|
144
|
+
- `navigation.primary` - Main site navigation
|
|
145
|
+
- `navigation.drawer` - Mobile navigation drawer
|
|
146
|
+
- `navigation.breadcrumb` - Breadcrumb navigation
|
|
147
|
+
- `navigation.utility` - Utility navigation bar
|
|
90
148
|
|
|
91
|
-
|
|
149
|
+
### Content Components
|
|
150
|
+
|
|
151
|
+
- `hero.*` - Hero sections (base, expand, grid, logo, minimal)
|
|
152
|
+
- `card.*` - Card layouts (standard, article, event, overlay, icon)
|
|
153
|
+
- `carousel.*` - Content carousels
|
|
154
|
+
- `accordion.item` - Expandable content sections
|
|
92
155
|
|
|
93
156
|
### Layout Components
|
|
94
|
-
- `layout.boxLogo` - Box with logo layout
|
|
95
|
-
- `layout.imageExpand` - Expandable image layout
|
|
96
|
-
- `layout.modal` - Modal dialog
|
|
97
|
-
- `layout.scrollTop` - Scroll to top button
|
|
98
|
-
- `layout.stickyColumns` - Sticky columns layout
|
|
99
|
-
|
|
100
|
-
### UI Components
|
|
101
|
-
- `accordion` - Collapsible content panels
|
|
102
|
-
- `actions` - Action buttons and links
|
|
103
|
-
- `alert` - Alert notifications
|
|
104
|
-
- `card` - Various card styles (standard, article, overlay)
|
|
105
|
-
- `carousel` - Image and content carousels
|
|
106
|
-
- `hero` - Hero sections (standard, minimal, expand, logo)
|
|
107
|
-
- `navigation` - Navigation components (header, drawer, breadcrumb)
|
|
108
|
-
- `person` - Person/profile components
|
|
109
|
-
- `quote` - Quote/testimonial components
|
|
110
|
-
- `stat` - Statistics display
|
|
111
|
-
- `tab` - Tabbed interface
|
|
112
|
-
- `text` - Text components
|
|
113
157
|
|
|
114
|
-
|
|
158
|
+
- `layout.modal` - Modal dialogs
|
|
159
|
+
- `layout.stickyColumns` - Sticky column layouts
|
|
160
|
+
- `layout.scrollTop` - Scroll to top functionality
|
|
161
|
+
|
|
162
|
+
### Interactive Components
|
|
163
|
+
|
|
164
|
+
- `tab.display` - Tabbed interfaces
|
|
165
|
+
- `slider.*` - Content sliders
|
|
166
|
+
- `actions.display` - Call-to-action buttons
|
|
167
|
+
|
|
168
|
+
### Media Components
|
|
169
|
+
|
|
170
|
+
- `media.inline` - Inline media players
|
|
171
|
+
- `person.*` - Person/profile displays
|
|
172
|
+
- `quote.display` - Quote/testimonial blocks
|
|
173
|
+
- `stat.display` - Statistics displays
|
|
174
|
+
|
|
175
|
+
## Common Use Cases
|
|
176
|
+
|
|
177
|
+
### Hero with Call-to-Action
|
|
178
|
+
|
|
179
|
+
```html
|
|
180
|
+
<umd-element-hero data-display="overlay">
|
|
181
|
+
<img slot="image" src="campus.jpg" alt="Campus view" />
|
|
182
|
+
<h1 slot="headline">Discover Your Future</h1>
|
|
183
|
+
<p slot="text">Join our community of innovators.</p>
|
|
184
|
+
<div slot="actions">
|
|
185
|
+
<umd-element-call-to-action data-display="primary">
|
|
186
|
+
<a href="/apply">Apply Now</a>
|
|
187
|
+
</umd-element-call-to-action>
|
|
188
|
+
</div>
|
|
189
|
+
</umd-element-hero>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Card Grid Layout
|
|
193
|
+
|
|
194
|
+
```html
|
|
195
|
+
<div class="umd-grid-gap-three">
|
|
196
|
+
<umd-element-card data-theme="light">
|
|
197
|
+
<a slot="image" href="/programs">
|
|
198
|
+
<img src="programs.jpg" alt="Academic programs" />
|
|
199
|
+
</a>
|
|
200
|
+
<h3 slot="headline">
|
|
201
|
+
<a href="/programs">Academic Programs</a>
|
|
202
|
+
</h3>
|
|
203
|
+
<p slot="text">Explore our 200+ degree programs.</p>
|
|
204
|
+
</umd-element-card>
|
|
205
|
+
<!-- Additional cards -->
|
|
206
|
+
</div>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Navigation Header
|
|
115
210
|
|
|
116
|
-
|
|
117
|
-
-
|
|
118
|
-
|
|
119
|
-
|
|
211
|
+
```html
|
|
212
|
+
<umd-element-navigation-header>
|
|
213
|
+
<div slot="logo">
|
|
214
|
+
<a href="/">University of Maryland</a>
|
|
215
|
+
</div>
|
|
216
|
+
<nav slot="primary">
|
|
217
|
+
<ul>
|
|
218
|
+
<li><a href="/about">About</a></li>
|
|
219
|
+
<li><a href="/academics">Academics</a></li>
|
|
220
|
+
<li><a href="/research">Research</a></li>
|
|
221
|
+
</ul>
|
|
222
|
+
</nav>
|
|
223
|
+
</umd-element-navigation-header>
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## TypeScript Support
|
|
227
|
+
|
|
228
|
+
Full TypeScript support with comprehensive type definitions:
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
import type {
|
|
232
|
+
ComponentRef,
|
|
233
|
+
SlotConfiguration,
|
|
234
|
+
ComponentEvents,
|
|
235
|
+
} from '@universityofmaryland/web-components-library';
|
|
236
|
+
|
|
237
|
+
// Type-safe component usage
|
|
238
|
+
const card = document.querySelector<HTMLElement & ComponentEvents>(
|
|
239
|
+
'umd-element-card',
|
|
240
|
+
);
|
|
241
|
+
if (card) {
|
|
242
|
+
card.addEventListener('component:ready', (e) => {
|
|
243
|
+
console.log('Card initialized');
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
```
|
|
120
247
|
|
|
121
248
|
## Browser Support
|
|
122
249
|
|
|
123
|
-
Supports all modern browsers with Web Components support:
|
|
124
250
|
- Chrome 90+
|
|
125
251
|
- Firefox 88+
|
|
126
252
|
- Safari 14+
|
|
127
253
|
- Edge 90+
|
|
128
254
|
|
|
255
|
+
## Documentation
|
|
256
|
+
|
|
257
|
+
- **[Component Reference](./index.html)** - Complete API documentation
|
|
258
|
+
- **[Usage Examples](./usage.html)** - Practical implementation guide with real-world examples
|
|
259
|
+
- **[Advanced Guide](./advanced-usage.html)** - TypeScript, testing, reactive components, and custom development
|
|
260
|
+
- **[Playground](http://playground.designsystem.umd.edu)** - Live component demos
|
|
261
|
+
|
|
262
|
+
## Testing
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# Run tests
|
|
266
|
+
npm test
|
|
267
|
+
|
|
268
|
+
# Watch mode
|
|
269
|
+
npm run test:watch
|
|
270
|
+
|
|
271
|
+
# Coverage report
|
|
272
|
+
npm run test:coverage
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## Contributing
|
|
276
|
+
|
|
277
|
+
See the [main repository](https://github.com/umd-digital/design-system) for contribution guidelines.
|
|
278
|
+
|
|
129
279
|
## License
|
|
130
280
|
|
|
131
|
-
|
|
281
|
+
University of Maryland
|