@universityofmaryland/web-elements-library 1.2.1 → 1.3.1
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 +316 -2
- package/dist/__tests__/examples/component-test.example.d.ts +2 -0
- package/dist/__tests__/examples/component-test.example.d.ts.map +1 -0
- package/dist/__tests__/fixtures/content.d.ts +62 -0
- package/dist/__tests__/fixtures/content.d.ts.map +1 -0
- package/dist/__tests__/fixtures/elements.d.ts +48 -0
- package/dist/__tests__/fixtures/elements.d.ts.map +1 -0
- package/dist/__tests__/helpers/element.d.ts +23 -0
- package/dist/__tests__/helpers/element.d.ts.map +1 -0
- package/dist/__tests__/helpers/index.d.ts +2 -0
- package/dist/__tests__/helpers/index.d.ts.map +1 -0
- package/dist/__tests__/helpers/setup.d.ts +1 -0
- package/dist/__tests__/helpers/setup.d.ts.map +1 -0
- package/dist/__tests__/jest.setup.d.ts +6 -0
- package/dist/__tests__/jest.setup.d.ts.map +1 -0
- package/dist/__tests__/mocks/styles.d.ts +242 -0
- package/dist/__tests__/mocks/styles.d.ts.map +1 -0
- package/dist/__tests__/utils/assertions.d.ts +30 -0
- package/dist/__tests__/utils/assertions.d.ts.map +1 -0
- package/dist/__tests__/utils/events.d.ts +13 -0
- package/dist/__tests__/utils/events.d.ts.map +1 -0
- package/dist/__tests__/utils/index.d.ts +4 -0
- package/dist/__tests__/utils/index.d.ts.map +1 -0
- package/dist/__tests__/utils/timers.d.ts +20 -0
- package/dist/__tests__/utils/timers.d.ts.map +1 -0
- package/dist/_types.d.ts +193 -0
- package/dist/_types.d.ts.map +1 -0
- package/dist/atomic/animations/brand/chevron-flow.d.ts +2 -2
- package/dist/atomic/animations/brand/chevron-flow.d.ts.map +1 -1
- package/dist/atomic/assets/image/gif.d.ts +2 -1
- package/dist/atomic/assets/image/gif.d.ts.map +1 -1
- package/dist/atomic/assets/image/index.d.ts +2 -0
- package/dist/atomic/assets/image/index.d.ts.map +1 -1
- package/dist/atomic/assets/image/placeholder.d.ts +9 -0
- package/dist/atomic/assets/image/placeholder.d.ts.map +1 -0
- package/dist/atomic/assets/index.d.ts +1 -0
- package/dist/atomic/assets/index.d.ts.map +1 -1
- package/dist/atomic/assets/video/index.d.ts +3 -0
- package/dist/atomic/assets/video/index.d.ts.map +1 -0
- package/dist/atomic/assets/video/observed-auto-play.d.ts +17 -0
- package/dist/atomic/assets/video/observed-auto-play.d.ts.map +1 -0
- package/dist/atomic/assets/video/toggle.d.ts +17 -0
- package/dist/atomic/assets/video/toggle.d.ts.map +1 -0
- package/dist/atomic/text-lockup/date.d.ts.map +1 -1
- package/dist/atomic/text-lockup/index.d.ts +1 -0
- package/dist/atomic/text-lockup/index.d.ts.map +1 -1
- package/dist/atomic/text-lockup/large.d.ts +17 -0
- package/dist/atomic/text-lockup/large.d.ts.map +1 -0
- package/dist/atomic/text-lockup/medium.d.ts +17 -0
- package/dist/atomic/text-lockup/medium.d.ts.map +1 -0
- package/dist/atomic/text-lockup/small.d.ts.map +1 -1
- package/dist/composite/__tests__/card/block.test.d.ts +2 -0
- package/dist/composite/__tests__/card/block.test.d.ts.map +1 -0
- package/dist/composite/__tests__/card/list.test.d.ts +2 -0
- package/dist/composite/__tests__/card/list.test.d.ts.map +1 -0
- package/dist/composite/__tests__/card/overlay.test.d.ts +2 -0
- package/dist/composite/__tests__/card/overlay.test.d.ts.map +1 -0
- package/dist/composite/__tests__/hero/custom/expand.test.d.ts +2 -0
- package/dist/composite/__tests__/hero/custom/expand.test.d.ts.map +1 -0
- package/dist/composite/__tests__/hero/custom/grid.test.d.ts +2 -0
- package/dist/composite/__tests__/hero/custom/grid.test.d.ts.map +1 -0
- package/dist/composite/__tests__/hero/custom/video-arrow.test.d.ts +2 -0
- package/dist/composite/__tests__/hero/custom/video-arrow.test.d.ts.map +1 -0
- package/dist/composite/__tests__/hero/logo.test.d.ts +2 -0
- package/dist/composite/__tests__/hero/logo.test.d.ts.map +1 -0
- package/dist/composite/__tests__/hero/minimal.test.d.ts +2 -0
- package/dist/composite/__tests__/hero/minimal.test.d.ts.map +1 -0
- package/dist/composite/__tests__/hero/overlay.test.d.ts +2 -0
- package/dist/composite/__tests__/hero/overlay.test.d.ts.map +1 -0
- package/dist/composite/__tests__/hero/stacked.test.d.ts +2 -0
- package/dist/composite/__tests__/hero/stacked.test.d.ts.map +1 -0
- package/dist/composite/__tests__/hero/standard.test.d.ts +2 -0
- package/dist/composite/__tests__/hero/standard.test.d.ts.map +1 -0
- package/dist/composite/__tests__/test-helpers/element.d.ts +23 -0
- package/dist/composite/__tests__/test-helpers/element.d.ts.map +1 -0
- package/dist/composite/__tests__/test-helpers/setup.d.ts +1 -0
- package/dist/composite/__tests__/test-helpers/setup.d.ts.map +1 -0
- package/dist/composite/__tests__/types/card-types.test.d.ts +2 -0
- package/dist/composite/__tests__/types/card-types.test.d.ts.map +1 -0
- package/dist/composite/__tests__/types/hero-types.test.d.ts +2 -0
- package/dist/composite/__tests__/types/hero-types.test.d.ts.map +1 -0
- package/dist/composite/__tests__/types/type-compilation.test.d.ts +2 -0
- package/dist/composite/__tests__/types/type-compilation.test.d.ts.map +1 -0
- package/dist/composite/accordion/item.d.ts +2 -2
- package/dist/composite/accordion/item.d.ts.map +1 -1
- package/dist/composite/alert/elements/text.d.ts.map +1 -1
- package/dist/composite/alert/site.d.ts.map +1 -1
- package/dist/composite/banner/promo.d.ts.map +1 -1
- package/dist/composite/card/_types.d.ts +21 -17
- package/dist/composite/card/_types.d.ts.map +1 -1
- package/dist/composite/card/index.d.ts +1 -0
- package/dist/composite/card/index.d.ts.map +1 -1
- package/dist/composite/card/video/block.d.ts +15 -0
- package/dist/composite/card/video/block.d.ts.map +1 -0
- package/dist/composite/card/video/index.d.ts +3 -0
- package/dist/composite/card/video/index.d.ts.map +1 -0
- package/dist/composite/card/video/short.d.ts +10 -0
- package/dist/composite/card/video/short.d.ts.map +1 -0
- package/dist/composite/carousel/cards/index.d.ts.map +1 -1
- package/dist/composite/carousel/elements/blocks.d.ts.map +1 -1
- package/dist/composite/carousel/image/standard.d.ts.map +1 -1
- package/dist/composite/footer/elements/main-section/row-links/index.d.ts.map +1 -1
- package/dist/composite/footer/elements/main-section/row-links/link-columns.d.ts.map +1 -1
- package/dist/composite/footer/elements/main-section/row-logo/contact.d.ts.map +1 -1
- package/dist/composite/footer/elements/main-section/row-logo/index.d.ts.map +1 -1
- package/dist/composite/footer/elements/main-section/social.d.ts.map +1 -1
- package/dist/composite/footer/elements/utility-section/index.d.ts.map +1 -1
- package/dist/composite/hero/_types.d.ts +70 -0
- package/dist/composite/hero/_types.d.ts.map +1 -0
- package/dist/composite/hero/custom/expand.d.ts +18 -0
- package/dist/composite/hero/custom/expand.d.ts.map +1 -0
- package/dist/composite/hero/custom/grid.d.ts +23 -0
- package/dist/composite/hero/custom/grid.d.ts.map +1 -0
- package/dist/composite/hero/custom/index.d.ts +4 -0
- package/dist/composite/hero/custom/index.d.ts.map +1 -0
- package/dist/composite/hero/custom/video-arrow.d.ts +15 -0
- package/dist/composite/hero/custom/video-arrow.d.ts.map +1 -0
- package/dist/composite/hero/index.d.ts +3 -4
- package/dist/composite/hero/index.d.ts.map +1 -1
- package/dist/composite/hero/logo.d.ts +4 -5
- package/dist/composite/hero/logo.d.ts.map +1 -1
- package/dist/composite/hero/minimal.d.ts +4 -9
- package/dist/composite/hero/minimal.d.ts.map +1 -1
- package/dist/composite/hero/overlay.d.ts +4 -8
- package/dist/composite/hero/overlay.d.ts.map +1 -1
- package/dist/composite/hero/stacked.d.ts +4 -11
- package/dist/composite/hero/stacked.d.ts.map +1 -1
- package/dist/composite/hero/standard.d.ts +4 -9
- package/dist/composite/hero/standard.d.ts.map +1 -1
- package/dist/composite/layout/box/logo.d.ts.map +1 -1
- package/dist/composite/layout/image/expand.d.ts.map +1 -1
- package/dist/composite/layout/section-intro/small.d.ts.map +1 -1
- package/dist/composite/layout/section-intro/wide.d.ts.map +1 -1
- package/dist/composite/layout/sticky-columns/index.d.ts.map +1 -1
- package/dist/composite/media/elements/caption.d.ts.map +1 -1
- package/dist/composite/navigation/elements/item/index.d.ts.map +1 -1
- package/dist/composite/navigation/elements/slider/action.d.ts.map +1 -1
- package/dist/composite/navigation/elements/slider/index.d.ts.map +1 -1
- package/dist/composite/navigation/elements/slider/slide-first.d.ts.map +1 -1
- package/dist/composite/navigation/elements/slider/slides.d.ts.map +1 -1
- package/dist/composite/navigation/header.d.ts.map +1 -1
- package/dist/composite/navigation/utility/alert.d.ts.map +1 -1
- package/dist/composite/navigation/utility/index.d.ts.map +1 -1
- package/dist/composite/pathway/elements/text.d.ts.map +1 -1
- package/dist/composite/pathway/hero.d.ts +1 -1
- package/dist/composite/pathway/hero.d.ts.map +1 -1
- package/dist/composite/pathway/highlight.d.ts.map +1 -1
- package/dist/composite/pathway/overlay.d.ts +1 -1
- package/dist/composite/pathway/overlay.d.ts.map +1 -1
- package/dist/composite/pathway/standard.d.ts +1 -1
- package/dist/composite/pathway/standard.d.ts.map +1 -1
- package/dist/composite/pathway/sticky.d.ts +1 -1
- package/dist/composite/pathway/sticky.d.ts.map +1 -1
- package/dist/composite/person/bio/full.d.ts +2 -1
- package/dist/composite/person/bio/full.d.ts.map +1 -1
- package/dist/composite/quote/elements/text.d.ts.map +1 -1
- package/dist/composite/slider/events.d.ts +1 -1
- package/dist/composite/stat/display.d.ts +2 -2
- package/dist/composite/stat/display.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +52 -24
- package/dist/layout/image.d.ts.map +1 -1
- package/dist/model/elements/headline.d.ts +10 -0
- package/dist/model/elements/headline.d.ts.map +1 -1
- package/dist/model/elements/index.d.ts +8 -2
- package/dist/model/elements/index.d.ts.map +1 -1
- package/dist/model/elements/layout.d.ts +15 -0
- package/dist/model/elements/layout.d.ts.map +1 -1
- package/dist/model/elements/rich-text.d.ts +5 -0
- package/dist/model/elements/rich-text.d.ts.map +1 -1
- package/dist/model/modifiers/_types.d.ts +7 -0
- package/dist/model/modifiers/_types.d.ts.map +1 -1
- package/dist/model/modifiers/index.d.ts.map +1 -1
- package/dist/utilities/index.d.ts +1 -1
- package/dist/utilities/index.d.ts.map +1 -1
- package/dist/utilities/theme/animations.d.ts.map +1 -0
- package/dist/utilities/theme/assets.d.ts.map +1 -0
- package/dist/utilities/{styles → theme}/index.d.ts +1 -0
- package/dist/utilities/theme/index.d.ts.map +1 -0
- package/dist/utilities/theme/media.d.ts +6 -0
- package/dist/utilities/theme/media.d.ts.map +1 -0
- package/package.json +8 -3
- package/dist/composite/hero/brand/index.d.ts +0 -18
- package/dist/composite/hero/brand/index.d.ts.map +0 -1
- package/dist/composite/hero/brand/video.d.ts +0 -17
- package/dist/composite/hero/brand/video.d.ts.map +0 -1
- package/dist/composite/hero/elements/image.d.ts +0 -17
- package/dist/composite/hero/elements/image.d.ts.map +0 -1
- package/dist/composite/hero/elements/index.d.ts +0 -27
- package/dist/composite/hero/elements/index.d.ts.map +0 -1
- package/dist/composite/hero/elements/text.d.ts +0 -25
- package/dist/composite/hero/elements/text.d.ts.map +0 -1
- package/dist/composite/hero/expand.d.ts +0 -22
- package/dist/composite/hero/expand.d.ts.map +0 -1
- package/dist/utilities/styles/animations.d.ts.map +0 -1
- package/dist/utilities/styles/assets.d.ts.map +0 -1
- package/dist/utilities/styles/index.d.ts.map +0 -1
- /package/dist/utilities/{styles → theme}/animations.d.ts +0 -0
- /package/dist/utilities/{styles → theme}/assets.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# University of Maryland Web Elements Library
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@universityofmaryland/web-elements-library)
|
|
4
4
|
|
|
5
5
|
Foundational UI elements that make up the University of Maryland Components Library. This library provides the building blocks used to create more complex UI components while maintaining consistent design patterns across all UMD digital properties. Elements are crafted to be lightweight, accessible, and easily combinable into larger structures while adhering to UMD brand guidelines.
|
|
6
6
|
|
|
@@ -14,6 +14,30 @@ npm install @universityofmaryland/web-elements-library
|
|
|
14
14
|
yarn add @universityofmaryland/web-elements-library
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
Here's a simple example to get you started with the Elements library:
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
import { Composite } from '@universityofmaryland/web-elements-library';
|
|
23
|
+
|
|
24
|
+
// Create a hero section
|
|
25
|
+
const hero = Composite.hero.standard({
|
|
26
|
+
headline: document.createElement('h1'),
|
|
27
|
+
text: document.createElement('p'),
|
|
28
|
+
image: document.querySelector('img'),
|
|
29
|
+
isThemeDark: true
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Add the hero to your page
|
|
33
|
+
document.getElementById('hero-container').appendChild(hero.element);
|
|
34
|
+
|
|
35
|
+
// Inject the associated styles
|
|
36
|
+
const styleElement = document.createElement('style');
|
|
37
|
+
styleElement.textContent = hero.styles;
|
|
38
|
+
document.head.appendChild(styleElement);
|
|
39
|
+
```
|
|
40
|
+
|
|
17
41
|
## Usage
|
|
18
42
|
|
|
19
43
|
### Importing Elements
|
|
@@ -88,7 +112,7 @@ Available composite elements:
|
|
|
88
112
|
- `banner` - Banner elements
|
|
89
113
|
- `card` - Card elements (block, list, overlay)
|
|
90
114
|
- `carousel` - Carousel/slider elements
|
|
91
|
-
- `hero` - Hero section elements
|
|
115
|
+
- `hero` - Hero section elements (see detailed section below)
|
|
92
116
|
- `layout` - Layout compositions
|
|
93
117
|
- `media` - Media display elements
|
|
94
118
|
- `navigation` - Navigation elements
|
|
@@ -99,6 +123,171 @@ Available composite elements:
|
|
|
99
123
|
- `social` - Social media elements
|
|
100
124
|
- `tabs` - Tabbed interface elements
|
|
101
125
|
|
|
126
|
+
#### Hero Elements
|
|
127
|
+
|
|
128
|
+
The hero category provides multiple variations for creating impactful page headers and feature sections:
|
|
129
|
+
|
|
130
|
+
##### Standard Hero
|
|
131
|
+
The default hero pattern with flexible content and media options:
|
|
132
|
+
|
|
133
|
+
```javascript
|
|
134
|
+
const heroStandard = Composite.hero.standard({
|
|
135
|
+
headline: document.createElement('h1'),
|
|
136
|
+
eyebrow: document.createElement('span'),
|
|
137
|
+
text: document.createElement('p'),
|
|
138
|
+
actions: document.createElement('div'),
|
|
139
|
+
image: document.querySelector('img'),
|
|
140
|
+
video: document.querySelector('video'),
|
|
141
|
+
includesAnimation: true,
|
|
142
|
+
isHeightSmall: false,
|
|
143
|
+
isHeightFull: false,
|
|
144
|
+
isTextCenter: false,
|
|
145
|
+
isTextRight: false,
|
|
146
|
+
isThemeDark: true
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
##### Minimal Hero
|
|
151
|
+
A simplified hero with essential content only:
|
|
152
|
+
|
|
153
|
+
```javascript
|
|
154
|
+
const heroMinimal = Composite.hero.minimal({
|
|
155
|
+
headline: document.createElement('h1'),
|
|
156
|
+
text: document.createElement('p'),
|
|
157
|
+
eyebrow: document.createElement('span'),
|
|
158
|
+
isThemeDark: false
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
##### Stacked Hero
|
|
163
|
+
Hero with vertically stacked content and media:
|
|
164
|
+
|
|
165
|
+
```javascript
|
|
166
|
+
const heroStacked = Composite.hero.stacked({
|
|
167
|
+
headline: document.createElement('h1'),
|
|
168
|
+
text: document.createElement('p'),
|
|
169
|
+
image: document.querySelector('img'),
|
|
170
|
+
includesAnimation: true,
|
|
171
|
+
isHeightSmall: false,
|
|
172
|
+
isHeightFull: true,
|
|
173
|
+
isWidthLarge: true, // Stacked-specific property
|
|
174
|
+
isThemeDark: true
|
|
175
|
+
});
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
##### Overlay Hero
|
|
179
|
+
Hero with overlay effects and advanced styling options:
|
|
180
|
+
|
|
181
|
+
```javascript
|
|
182
|
+
const heroOverlay = Composite.hero.overlay({
|
|
183
|
+
headline: document.createElement('h1'),
|
|
184
|
+
text: document.createElement('p'),
|
|
185
|
+
image: document.querySelector('img'),
|
|
186
|
+
hasBorder: true,
|
|
187
|
+
isTransparent: false,
|
|
188
|
+
isSticky: false,
|
|
189
|
+
isTextCenter: true,
|
|
190
|
+
isThemeDark: true
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
##### Logo Hero
|
|
195
|
+
Hero featuring institutional branding:
|
|
196
|
+
|
|
197
|
+
```javascript
|
|
198
|
+
const heroLogo = Composite.hero.logo({
|
|
199
|
+
headline: document.createElement('h1'),
|
|
200
|
+
logo: document.createElement('div'), // Logo element
|
|
201
|
+
text: document.createElement('p'),
|
|
202
|
+
actions: document.createElement('div'),
|
|
203
|
+
image: document.querySelector('img'),
|
|
204
|
+
isThemeDark: true,
|
|
205
|
+
isThemeLight: false,
|
|
206
|
+
isThemeMaryland: false
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
##### Custom Hero Variations
|
|
211
|
+
|
|
212
|
+
The library also provides specialized hero patterns for specific use cases:
|
|
213
|
+
|
|
214
|
+
###### Expand Hero
|
|
215
|
+
Hero with expandable content sections:
|
|
216
|
+
|
|
217
|
+
```javascript
|
|
218
|
+
const heroExpand = Composite.hero.custom.expand({
|
|
219
|
+
headline: document.createElement('h1'),
|
|
220
|
+
text: document.createElement('p'),
|
|
221
|
+
expandedContent: document.createElement('div'), // Content revealed on expand
|
|
222
|
+
includesAnimation: true,
|
|
223
|
+
isThemeDark: true
|
|
224
|
+
});
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
###### Grid Hero
|
|
228
|
+
Hero with content blocks arranged in a grid:
|
|
229
|
+
|
|
230
|
+
```javascript
|
|
231
|
+
const heroGrid = Composite.hero.custom.grid({
|
|
232
|
+
headline: document.createElement('h1'),
|
|
233
|
+
text: document.createElement('p'),
|
|
234
|
+
blocks: [
|
|
235
|
+
document.createElement('div'), // Grid block 1
|
|
236
|
+
document.createElement('div'), // Grid block 2
|
|
237
|
+
document.createElement('div'), // Grid block 3
|
|
238
|
+
document.createElement('div') // Grid block 4
|
|
239
|
+
],
|
|
240
|
+
image: document.querySelector('img'),
|
|
241
|
+
isThemeDark: true
|
|
242
|
+
});
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
###### Video Arrow Hero
|
|
246
|
+
Hero with prominent video playback controls:
|
|
247
|
+
|
|
248
|
+
```javascript
|
|
249
|
+
const heroVideoArrow = Composite.hero.custom.videoArrow({
|
|
250
|
+
headline: document.createElement('h1'),
|
|
251
|
+
text: document.createElement('p'),
|
|
252
|
+
video: document.querySelector('video'),
|
|
253
|
+
image: document.querySelector('img'), // Poster image
|
|
254
|
+
videoControls: true,
|
|
255
|
+
includesAnimation: true,
|
|
256
|
+
isThemeDark: true
|
|
257
|
+
});
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
##### Hero Properties Reference
|
|
261
|
+
|
|
262
|
+
Common properties across hero variants:
|
|
263
|
+
- `headline` - Main heading element
|
|
264
|
+
- `eyebrow` - Small text above headline
|
|
265
|
+
- `text` - Descriptive paragraph text
|
|
266
|
+
- `actions` - CTA buttons or links
|
|
267
|
+
- `image` - Hero image element
|
|
268
|
+
- `video` - Hero video element
|
|
269
|
+
- `includesAnimation` - Enable entrance animations
|
|
270
|
+
- `isThemeDark` - Dark theme styling
|
|
271
|
+
|
|
272
|
+
Size properties (Standard, Stacked, Overlay):
|
|
273
|
+
- `isHeightSmall` - Reduced height variant
|
|
274
|
+
- `isHeightFull` - Full viewport height
|
|
275
|
+
|
|
276
|
+
Layout properties (Standard, Overlay):
|
|
277
|
+
- `isTextCenter` - Center-aligned text
|
|
278
|
+
- `isTextRight` - Right-aligned text
|
|
279
|
+
|
|
280
|
+
Theme properties (Logo):
|
|
281
|
+
- `isThemeLight` - Light theme variant
|
|
282
|
+
- `isThemeMaryland` - Maryland brand theme
|
|
283
|
+
|
|
284
|
+
Unique properties:
|
|
285
|
+
- `isWidthLarge` (Stacked) - Extended width layout
|
|
286
|
+
- `hasBorder`, `isTransparent`, `isSticky` (Overlay) - Styling options
|
|
287
|
+
- `expandedContent` (Expand) - Hidden content section
|
|
288
|
+
- `blocks` (Grid) - Array of content blocks
|
|
289
|
+
- `videoControls` (Video Arrow) - Show video controls
|
|
290
|
+
|
|
102
291
|
### Layout Elements
|
|
103
292
|
|
|
104
293
|
Elements specifically designed for controlling page layout:
|
|
@@ -195,6 +384,131 @@ All elements are built with accessibility as a priority:
|
|
|
195
384
|
|
|
196
385
|
For complete documentation of all available elements and their options, see the [official UMD Design System documentation](https://umd-digital.github.io/design-system/).
|
|
197
386
|
|
|
387
|
+
## Testing
|
|
388
|
+
|
|
389
|
+
The Elements library includes comprehensive test coverage for all components. Tests are written using Jest and follow a consistent pattern:
|
|
390
|
+
|
|
391
|
+
### Running Tests
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
# Run all tests
|
|
395
|
+
npm test
|
|
396
|
+
|
|
397
|
+
# Run tests in watch mode
|
|
398
|
+
npm run test:watch
|
|
399
|
+
|
|
400
|
+
# Run tests with coverage
|
|
401
|
+
npm run test:coverage
|
|
402
|
+
|
|
403
|
+
# Run specific test file
|
|
404
|
+
npm test -- source/composite/__tests__/hero/standard.test.ts
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### Test Structure
|
|
408
|
+
|
|
409
|
+
Tests are organized by component category and located in `__tests__` directories:
|
|
410
|
+
|
|
411
|
+
```
|
|
412
|
+
source/
|
|
413
|
+
├── composite/
|
|
414
|
+
│ └── __tests__/
|
|
415
|
+
│ ├── hero/
|
|
416
|
+
│ │ ├── standard.test.ts
|
|
417
|
+
│ │ ├── minimal.test.ts
|
|
418
|
+
│ │ ├── stacked.test.ts
|
|
419
|
+
│ │ ├── overlay.test.ts
|
|
420
|
+
│ │ ├── logo.test.ts
|
|
421
|
+
│ │ └── custom/
|
|
422
|
+
│ │ ├── expand.test.ts
|
|
423
|
+
│ │ ├── grid.test.ts
|
|
424
|
+
│ │ └── video-arrow.test.ts
|
|
425
|
+
│ ├── card/
|
|
426
|
+
│ │ ├── block.test.ts
|
|
427
|
+
│ │ ├── list.test.ts
|
|
428
|
+
│ │ └── overlay.test.ts
|
|
429
|
+
│ └── types/
|
|
430
|
+
│ ├── hero-types.test.ts
|
|
431
|
+
│ └── card-types.test.ts
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
### Writing Tests
|
|
435
|
+
|
|
436
|
+
When adding new elements, include tests that cover:
|
|
437
|
+
|
|
438
|
+
1. **Basic Structure** - Element creation with minimal props
|
|
439
|
+
2. **Content Properties** - All content variations
|
|
440
|
+
3. **Asset Properties** - Image and video handling
|
|
441
|
+
4. **Animation Properties** - Animation flags and behaviors
|
|
442
|
+
5. **Theme Properties** - Theme variations
|
|
443
|
+
6. **Edge Cases** - Null/undefined handling
|
|
444
|
+
7. **Type Safety** - TypeScript interface compliance
|
|
445
|
+
|
|
446
|
+
Example test pattern:
|
|
447
|
+
|
|
448
|
+
```javascript
|
|
449
|
+
import { Composite } from '@universityofmaryland/web-elements-library';
|
|
450
|
+
import type { HeroStandardProps } from '../../hero/_types';
|
|
451
|
+
|
|
452
|
+
describe('Hero Standard Component', () => {
|
|
453
|
+
beforeEach(() => {
|
|
454
|
+
jest.clearAllMocks();
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
it('should create a standard hero with minimal props', () => {
|
|
458
|
+
const props: HeroStandardProps = {
|
|
459
|
+
isThemeDark: true
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
const result = Composite.hero.standard(props);
|
|
463
|
+
|
|
464
|
+
expect(result).toBeDefined();
|
|
465
|
+
expect(result.element).toBeInstanceOf(HTMLElement);
|
|
466
|
+
expect(typeof result.styles).toBe('string');
|
|
467
|
+
});
|
|
468
|
+
});
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
## TypeScript Support
|
|
472
|
+
|
|
473
|
+
The library is written in TypeScript and provides comprehensive type definitions for all elements:
|
|
474
|
+
|
|
475
|
+
### Import Types
|
|
476
|
+
|
|
477
|
+
```typescript
|
|
478
|
+
import type {
|
|
479
|
+
HeroStandardProps,
|
|
480
|
+
HeroMinimalProps,
|
|
481
|
+
HeroStackedProps,
|
|
482
|
+
HeroOverlayProps,
|
|
483
|
+
HeroLogoProps,
|
|
484
|
+
HeroGridProps,
|
|
485
|
+
HeroExpandProps,
|
|
486
|
+
HeroVideoArrowProps,
|
|
487
|
+
CardBlockProps,
|
|
488
|
+
CardListProps,
|
|
489
|
+
CardOverlayProps
|
|
490
|
+
} from '@universityofmaryland/web-elements-library';
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
### Type Safety
|
|
494
|
+
|
|
495
|
+
All element functions are strictly typed to ensure proper usage:
|
|
496
|
+
|
|
497
|
+
```typescript
|
|
498
|
+
// TypeScript will enforce required properties
|
|
499
|
+
const hero: HeroStandardProps = {
|
|
500
|
+
headline: document.createElement('h1'),
|
|
501
|
+
// isThemeDark is optional with boolean type
|
|
502
|
+
isThemeDark: true
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
// Type error if invalid property is provided
|
|
506
|
+
const invalidHero: HeroStandardProps = {
|
|
507
|
+
headline: document.createElement('h1'),
|
|
508
|
+
invalidProp: true // TypeScript error
|
|
509
|
+
};
|
|
510
|
+
```
|
|
511
|
+
|
|
198
512
|
## Contributing
|
|
199
513
|
|
|
200
514
|
For contribution guidelines, please refer to the main repository README.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-test.example.d.ts","sourceRoot":"","sources":["../../../source/__tests__/examples/component-test.example.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export declare const testContent: {
|
|
2
|
+
text: {
|
|
3
|
+
headline: string;
|
|
4
|
+
subheadline: string;
|
|
5
|
+
eyebrow: string;
|
|
6
|
+
description: string;
|
|
7
|
+
longDescription: string;
|
|
8
|
+
cta: string;
|
|
9
|
+
};
|
|
10
|
+
urls: {
|
|
11
|
+
internal: string;
|
|
12
|
+
external: string;
|
|
13
|
+
anchor: string;
|
|
14
|
+
image: string;
|
|
15
|
+
video: string;
|
|
16
|
+
document: string;
|
|
17
|
+
};
|
|
18
|
+
media: {
|
|
19
|
+
image: {
|
|
20
|
+
src: string;
|
|
21
|
+
alt: string;
|
|
22
|
+
srcset: string;
|
|
23
|
+
};
|
|
24
|
+
video: {
|
|
25
|
+
src: string;
|
|
26
|
+
poster: string;
|
|
27
|
+
sources: {
|
|
28
|
+
src: string;
|
|
29
|
+
type: string;
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
person: {
|
|
34
|
+
name: string;
|
|
35
|
+
title: string;
|
|
36
|
+
description: string;
|
|
37
|
+
email: string;
|
|
38
|
+
phone: string;
|
|
39
|
+
image: string;
|
|
40
|
+
link: string;
|
|
41
|
+
};
|
|
42
|
+
event: {
|
|
43
|
+
title: string;
|
|
44
|
+
date: Date;
|
|
45
|
+
location: string;
|
|
46
|
+
description: string;
|
|
47
|
+
link: string;
|
|
48
|
+
};
|
|
49
|
+
lists: {
|
|
50
|
+
links: {
|
|
51
|
+
text: string;
|
|
52
|
+
url: string;
|
|
53
|
+
}[];
|
|
54
|
+
items: string[];
|
|
55
|
+
social: {
|
|
56
|
+
platform: string;
|
|
57
|
+
url: string;
|
|
58
|
+
}[];
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export default testContent;
|
|
62
|
+
//# sourceMappingURL=content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../source/__tests__/fixtures/content.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwEvB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare function createContainer(className?: string): HTMLElement;
|
|
2
|
+
export declare function createCardStructure(): {
|
|
3
|
+
container: HTMLElement;
|
|
4
|
+
image: HTMLImageElement;
|
|
5
|
+
content: HTMLElement;
|
|
6
|
+
headline: HTMLElement;
|
|
7
|
+
description: HTMLElement;
|
|
8
|
+
link: HTMLAnchorElement;
|
|
9
|
+
};
|
|
10
|
+
export declare function createHeroStructure(): {
|
|
11
|
+
container: HTMLElement;
|
|
12
|
+
background: HTMLElement;
|
|
13
|
+
content: HTMLElement;
|
|
14
|
+
headline: HTMLElement;
|
|
15
|
+
subheadline: HTMLElement;
|
|
16
|
+
description: HTMLElement;
|
|
17
|
+
cta: HTMLAnchorElement;
|
|
18
|
+
};
|
|
19
|
+
export declare function createListStructure(itemCount?: number): {
|
|
20
|
+
container: HTMLElement;
|
|
21
|
+
items: HTMLElement[];
|
|
22
|
+
};
|
|
23
|
+
export declare function createMediaStructure(type?: 'image' | 'video'): {
|
|
24
|
+
container: HTMLElement;
|
|
25
|
+
media: HTMLImageElement | HTMLVideoElement;
|
|
26
|
+
caption: HTMLElement;
|
|
27
|
+
};
|
|
28
|
+
export declare function createNavStructure(): {
|
|
29
|
+
nav: HTMLElement;
|
|
30
|
+
list: HTMLElement;
|
|
31
|
+
items: HTMLCollection;
|
|
32
|
+
};
|
|
33
|
+
export declare function createFormStructure(): {
|
|
34
|
+
form: HTMLFormElement;
|
|
35
|
+
input: HTMLInputElement;
|
|
36
|
+
button: HTMLButtonElement;
|
|
37
|
+
};
|
|
38
|
+
declare const _default: {
|
|
39
|
+
createContainer: typeof createContainer;
|
|
40
|
+
createCardStructure: typeof createCardStructure;
|
|
41
|
+
createHeroStructure: typeof createHeroStructure;
|
|
42
|
+
createListStructure: typeof createListStructure;
|
|
43
|
+
createMediaStructure: typeof createMediaStructure;
|
|
44
|
+
createNavStructure: typeof createNavStructure;
|
|
45
|
+
createFormStructure: typeof createFormStructure;
|
|
46
|
+
};
|
|
47
|
+
export default _default;
|
|
48
|
+
//# sourceMappingURL=elements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../../source/__tests__/fixtures/elements.ts"],"names":[],"mappings":"AASA,wBAAgB,eAAe,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,WAAW,CAK/D;AAKD,wBAAgB,mBAAmB;;;;;;;EAgBlC;AAKD,wBAAgB,mBAAmB;;;;;;;;EAkBlC;AAKD,wBAAgB,mBAAmB,CAAC,SAAS,GAAE,MAAU;;;EAaxD;AAKD,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,OAAO,GAAG,OAAiB;;;;EAWrE;AAKD,wBAAgB,kBAAkB;;;;EAmBjC;AAKD,wBAAgB,mBAAmB;;;;EAoBlC;;;;;;;;;;AAED,wBAQE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ContentElement, ElementModel } from '../../_types';
|
|
2
|
+
export interface TestElementConfig {
|
|
3
|
+
element?: HTMLElement;
|
|
4
|
+
className?: string;
|
|
5
|
+
styles?: string;
|
|
6
|
+
attributes?: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
export declare function createElement(tagName?: string, content?: string, attributes?: Record<string, string>): HTMLElement;
|
|
9
|
+
export declare function createContentElement(tagName?: string, content?: string): ContentElement;
|
|
10
|
+
export declare function createImageElement(src?: string, alt?: string): HTMLImageElement;
|
|
11
|
+
export declare function createVideoElement(src?: string): HTMLVideoElement;
|
|
12
|
+
export declare function createLinkElement(href?: string, text?: string): HTMLAnchorElement;
|
|
13
|
+
export declare function validateElementStructure(result: any, expectedConfig: {
|
|
14
|
+
hasElement?: boolean;
|
|
15
|
+
hasStyles?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
tagName?: string;
|
|
18
|
+
}): void;
|
|
19
|
+
export declare function getChildByClass(parent: HTMLElement, className: string): HTMLElement | null;
|
|
20
|
+
export declare function countChildren(parent: HTMLElement): number;
|
|
21
|
+
export declare function containsText(element: HTMLElement, text: string): boolean;
|
|
22
|
+
export declare function createMockElementModel(config?: TestElementConfig): ElementModel;
|
|
23
|
+
//# sourceMappingURL=element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../source/__tests__/helpers/element.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjE,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAKD,wBAAgB,aAAa,CAC3B,OAAO,GAAE,MAAc,EACvB,OAAO,CAAC,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAClC,WAAW,CAcb;AAKD,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,MAAY,EACrB,OAAO,CAAC,EAAE,MAAM,GACf,cAAc,CAGhB;AAKD,wBAAgB,kBAAkB,CAChC,GAAG,GAAE,MAAmB,EACxB,GAAG,GAAE,MAAqB,GACzB,gBAAgB,CAKlB;AAKD,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAmB,GAAG,gBAAgB,CAI7E;AAKD,wBAAgB,iBAAiB,CAC/B,IAAI,GAAE,MAAY,EAClB,IAAI,GAAE,MAAoB,GACzB,iBAAiB,CAKnB;AAKD,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,GAAG,EACX,cAAc,EAAE;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GACA,IAAI,CAsBN;AAKD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,WAAW,EACnB,SAAS,EAAE,MAAM,GAChB,WAAW,GAAG,IAAI,CAEpB;AAKD,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAEzD;AAKD,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAExE;AAKD,wBAAgB,sBAAsB,CACpC,MAAM,GAAE,iBAAsB,GAC7B,YAAY,CAKd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/__tests__/helpers/index.ts"],"names":[],"mappings":"AAKA,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../source/__tests__/helpers/setup.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest.setup.d.ts","sourceRoot":"","sources":["../../source/__tests__/jest.setup.ts"],"names":[],"mappings":"AAMA,OAAO,iBAAiB,CAAC;AAOzB,OAAO,CAAC,MAAM,CAAC;IACb,MAAM,SAAS,EAAE,cAAc,SAAS,CAAC,CAAC;IAC1C,MAAM,WAAW,EAAE,cAAc,WAAW,CAAC,CAAC;CAC/C"}
|