@universityofmaryland/web-elements-library 1.5.0-beta.0 → 1.5.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 +1 -1
- package/dist/composite/banner/promo.d.ts.map +1 -1
- package/dist/composite/banner/promo.js +6 -3
- package/dist/composite/banner/promo.js.map +1 -1
- package/dist/composite/banner/promo.mjs +6 -3
- package/dist/composite/banner/promo.mjs.map +1 -1
- package/dist/composite/footer/elements/main-section/index.js.map +1 -1
- package/dist/composite/footer/elements/main-section/index.mjs.map +1 -1
- package/dist/composite/navigation/header.d.ts.map +1 -1
- package/dist/composite/navigation/header.js +4 -1
- package/dist/composite/navigation/header.js.map +1 -1
- package/dist/composite/navigation/header.mjs +4 -1
- package/dist/composite/navigation/header.mjs.map +1 -1
- package/dist/composite/quote/elements/icon.d.ts +3 -2
- package/dist/composite/quote/elements/icon.d.ts.map +1 -1
- package/dist/composite/quote/elements/icon.js +23 -16
- package/dist/composite/quote/elements/icon.js.map +1 -1
- package/dist/composite/quote/elements/icon.mjs +23 -16
- package/dist/composite/quote/elements/icon.mjs.map +1 -1
- package/dist/composite/quote/elements/image.d.ts.map +1 -1
- package/dist/composite/quote/elements/image.js +6 -6
- package/dist/composite/quote/elements/image.js.map +1 -1
- package/dist/composite/quote/elements/image.mjs +6 -6
- package/dist/composite/quote/elements/image.mjs.map +1 -1
- package/dist/composite/quote/elements/index.d.ts +1 -0
- package/dist/composite/quote/elements/index.d.ts.map +1 -1
- package/dist/composite/quote/elements/index.js +2 -0
- package/dist/composite/quote/elements/index.js.map +1 -1
- package/dist/composite/quote/elements/index.mjs +2 -0
- package/dist/composite/quote/elements/index.mjs.map +1 -1
- package/dist/composite/quote/elements/quote.d.ts +13 -0
- package/dist/composite/quote/elements/quote.d.ts.map +1 -0
- package/dist/composite/quote/elements/quote.js +114 -0
- package/dist/composite/quote/elements/quote.js.map +1 -0
- package/dist/composite/quote/elements/quote.mjs +97 -0
- package/dist/composite/quote/elements/quote.mjs.map +1 -0
- package/dist/composite/quote/elements/text.d.ts +1 -1
- package/dist/composite/quote/elements/text.d.ts.map +1 -1
- package/dist/composite/quote/elements/text.js +103 -172
- package/dist/composite/quote/elements/text.js.map +1 -1
- package/dist/composite/quote/elements/text.mjs +103 -172
- package/dist/composite/quote/elements/text.mjs.map +1 -1
- package/dist/composite/quote/featured.d.ts +3 -0
- package/dist/composite/quote/featured.d.ts.map +1 -1
- package/dist/composite/quote/featured.js +14 -7
- package/dist/composite/quote/featured.js.map +1 -1
- package/dist/composite/quote/featured.mjs +14 -7
- package/dist/composite/quote/featured.mjs.map +1 -1
- package/dist/composite/quote/helper/animation.d.ts.map +1 -1
- package/dist/composite/quote/helper/animation.js +67 -36
- package/dist/composite/quote/helper/animation.js.map +1 -1
- package/dist/composite/quote/helper/animation.mjs +67 -36
- package/dist/composite/quote/helper/animation.mjs.map +1 -1
- package/dist/composite/quote/inline.d.ts +3 -0
- package/dist/composite/quote/inline.d.ts.map +1 -1
- package/dist/composite/quote/inline.js +15 -7
- package/dist/composite/quote/inline.js.map +1 -1
- package/dist/composite/quote/inline.mjs +15 -7
- package/dist/composite/quote/inline.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
const token = require("@universityofmaryland/web-styles-library/token");
|
|
3
3
|
const typography = require("@universityofmaryland/web-styles-library/typography");
|
|
4
4
|
const index = require("../../../model/elements/index.js");
|
|
5
|
-
const icon = require("./icon.js");
|
|
6
5
|
const action = require("./action.js");
|
|
6
|
+
const quote = require("./quote.js");
|
|
7
7
|
const _constants = require("../_constants.js");
|
|
8
8
|
function _interopNamespaceDefault(e) {
|
|
9
9
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -23,198 +23,129 @@ function _interopNamespaceDefault(e) {
|
|
|
23
23
|
}
|
|
24
24
|
const token__namespace = /* @__PURE__ */ _interopNamespaceDefault(token);
|
|
25
25
|
const typography__namespace = /* @__PURE__ */ _interopNamespaceDefault(typography);
|
|
26
|
-
const
|
|
26
|
+
const createChildren = (props) => {
|
|
27
27
|
const {
|
|
28
|
-
|
|
29
|
-
isThemeMaryland,
|
|
30
|
-
isSizeLarge = false,
|
|
31
|
-
isTypeFeatured = false,
|
|
32
|
-
image,
|
|
33
|
-
quote,
|
|
28
|
+
action: action$1,
|
|
34
29
|
attribution,
|
|
35
30
|
attributionSubText,
|
|
36
|
-
|
|
37
|
-
includesAnimation
|
|
31
|
+
hasImage,
|
|
32
|
+
includesAnimation,
|
|
33
|
+
isThemeDark,
|
|
34
|
+
quote: quote$1,
|
|
35
|
+
shouldHaveWhiteText
|
|
38
36
|
} = props;
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
element: quoteTextElement,
|
|
50
|
-
className: "quote-container-quote",
|
|
51
|
-
children: quoteChildren,
|
|
37
|
+
const wrapperChildren = [];
|
|
38
|
+
if (quote$1) {
|
|
39
|
+
wrapperChildren.push(
|
|
40
|
+
quote({ ...props, shouldHaveWhiteText, quote: quote$1, hasImage })
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
if (attribution) {
|
|
44
|
+
const attributionElement = index.create({
|
|
45
|
+
element: attribution,
|
|
46
|
+
className: "quote-container-attribution",
|
|
52
47
|
elementStyles: {
|
|
53
48
|
element: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
...(isThemeDark || isThemeMaryland) && {
|
|
60
|
-
color: token__namespace.color.white
|
|
49
|
+
marginTop: token__namespace.spacing.sm,
|
|
50
|
+
...includesAnimation && {
|
|
51
|
+
opacity: "0",
|
|
52
|
+
transform: "translateY(20px)",
|
|
53
|
+
transition: "opacity 1s ease, transform 0.5s ease"
|
|
61
54
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
position: "absolute",
|
|
65
|
-
left: `-${token__namespace.spacing.md}`,
|
|
66
|
-
top: "7px",
|
|
67
|
-
height: "calc(100% - 14px)",
|
|
68
|
-
width: "2px",
|
|
69
|
-
display: "block",
|
|
70
|
-
backgroundColor: token__namespace.color.red,
|
|
71
|
-
...isThemeMaryland && { backgroundColor: token__namespace.color.gold },
|
|
72
|
-
...image && !isTypeFeatured && {
|
|
73
|
-
display: "none"
|
|
74
|
-
},
|
|
75
|
-
[`@container (min-width: ${_constants.SMALL}px)`]: {
|
|
76
|
-
left: `-${token__namespace.spacing.md}`
|
|
77
|
-
},
|
|
78
|
-
[`@container (max-width: ${_constants.SMALL - 1}px)`]: {
|
|
79
|
-
...!isTypeFeatured && {
|
|
80
|
-
display: "block"
|
|
81
|
-
}
|
|
82
|
-
}
|
|
55
|
+
...isThemeDark && {
|
|
56
|
+
color: token__namespace.color.white
|
|
83
57
|
},
|
|
84
|
-
[
|
|
58
|
+
[`& *`]: {
|
|
85
59
|
color: "currentColor",
|
|
86
|
-
...typography__namespace.sans.
|
|
87
|
-
...isSizeLarge && { ...typography__namespace.sans.extraLarge }
|
|
60
|
+
...typography__namespace.sans.medium
|
|
88
61
|
}
|
|
89
62
|
}
|
|
90
63
|
}
|
|
91
64
|
});
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
element: {
|
|
111
|
-
marginTop: token__namespace.spacing.sm,
|
|
112
|
-
...includesAnimation && {
|
|
113
|
-
opacity: "0",
|
|
114
|
-
transform: "translateY(20px)",
|
|
115
|
-
transition: "opacity 1s ease, transform 0.5s ease"
|
|
116
|
-
},
|
|
117
|
-
...isThemeDark && {
|
|
118
|
-
color: token__namespace.color.white
|
|
119
|
-
},
|
|
120
|
-
[`& *`]: {
|
|
121
|
-
color: "currentColor",
|
|
122
|
-
...typography__namespace.sans.medium
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
wrapperChildren.push(attributionElement);
|
|
128
|
-
}
|
|
129
|
-
if (attributionSubText) {
|
|
130
|
-
const attributionSubTextElement = index.create({
|
|
131
|
-
element: attributionSubText,
|
|
132
|
-
className: "quote-container-text-attribution-sub-text",
|
|
133
|
-
elementStyles: {
|
|
134
|
-
element: {
|
|
135
|
-
color: token__namespace.color.gray.dark,
|
|
136
|
-
fontStyle: "italic",
|
|
137
|
-
...typography__namespace.sans.small,
|
|
138
|
-
...includesAnimation && {
|
|
139
|
-
opacity: "0",
|
|
140
|
-
transform: "translateY(20px)",
|
|
141
|
-
transition: "opacity 1s ease, transform 0.5s ease"
|
|
142
|
-
},
|
|
143
|
-
...(isThemeDark || isThemeMaryland) && {
|
|
144
|
-
color: token__namespace.color.white
|
|
145
|
-
}
|
|
65
|
+
wrapperChildren.push(attributionElement);
|
|
66
|
+
}
|
|
67
|
+
if (attributionSubText) {
|
|
68
|
+
const attributionSubTextElement = index.create({
|
|
69
|
+
element: attributionSubText,
|
|
70
|
+
className: "quote-container-text-attribution-sub-text",
|
|
71
|
+
elementStyles: {
|
|
72
|
+
element: {
|
|
73
|
+
color: token__namespace.color.gray.dark,
|
|
74
|
+
fontStyle: "italic",
|
|
75
|
+
...typography__namespace.sans.small,
|
|
76
|
+
...includesAnimation && {
|
|
77
|
+
opacity: "0",
|
|
78
|
+
transform: "translateY(20px)",
|
|
79
|
+
transition: "opacity 1s ease, transform 0.5s ease"
|
|
80
|
+
},
|
|
81
|
+
...shouldHaveWhiteText && {
|
|
82
|
+
color: token__namespace.color.white
|
|
146
83
|
}
|
|
147
84
|
}
|
|
148
|
-
}
|
|
149
|
-
wrapperChildren.push(attributionSubTextElement);
|
|
150
|
-
}
|
|
151
|
-
if (action$1) {
|
|
152
|
-
const actionElement = action({
|
|
153
|
-
...props2,
|
|
154
|
-
action: action$1
|
|
155
|
-
});
|
|
156
|
-
wrapperChildren.push(actionElement);
|
|
157
|
-
}
|
|
158
|
-
return wrapperChildren;
|
|
159
|
-
};
|
|
160
|
-
const splitWords = (quote2) => {
|
|
161
|
-
const text = quote2.textContent ?? "";
|
|
162
|
-
const words = text.trim().split(/\s+/);
|
|
163
|
-
const wordElements = words.map((word, index2) => {
|
|
164
|
-
const wordElement = document.createElement("div");
|
|
165
|
-
wordElement.classList.add("quote-text-split-word");
|
|
166
|
-
Object.assign(wordElement.style, {
|
|
167
|
-
display: "inline-block",
|
|
168
|
-
whiteSpace: "pre-wrap",
|
|
169
|
-
opacity: "0",
|
|
170
|
-
transform: "translateY(20px)",
|
|
171
|
-
transition: "opacity 1s ease, transform 0.5s ease"
|
|
172
|
-
});
|
|
173
|
-
wordElement.textContent = word + (index2 < words.length - 1 ? " " : "");
|
|
174
|
-
return wordElement;
|
|
85
|
+
}
|
|
175
86
|
});
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
children: wrapperChildren
|
|
87
|
+
wrapperChildren.push(attributionSubTextElement);
|
|
88
|
+
}
|
|
89
|
+
if (action$1) {
|
|
90
|
+
const actionElement = action({
|
|
91
|
+
...props,
|
|
92
|
+
action: action$1
|
|
183
93
|
});
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
94
|
+
wrapperChildren.push(actionElement);
|
|
95
|
+
}
|
|
96
|
+
return wrapperChildren;
|
|
97
|
+
};
|
|
98
|
+
const elementText = (props) => {
|
|
99
|
+
const {
|
|
100
|
+
image,
|
|
101
|
+
isSizeLarge = false,
|
|
102
|
+
isThemeDark,
|
|
103
|
+
isThemeMaryland,
|
|
104
|
+
isTypeFeatured = false
|
|
105
|
+
} = props;
|
|
106
|
+
const shouldHaveWhiteText = isThemeDark || isThemeMaryland;
|
|
107
|
+
const isSizeLargeAndNotFeatured = isSizeLarge && !isTypeFeatured;
|
|
108
|
+
const hasImage = image != null;
|
|
109
|
+
const isHasImageAndNotFeatured = hasImage && !isTypeFeatured;
|
|
110
|
+
const wrapper = index.createDiv({
|
|
111
|
+
className: "quote-text-container-wrapper",
|
|
112
|
+
children: [
|
|
113
|
+
...createChildren({
|
|
114
|
+
...props,
|
|
115
|
+
shouldHaveWhiteText,
|
|
116
|
+
hasImage
|
|
117
|
+
})
|
|
118
|
+
]
|
|
119
|
+
});
|
|
120
|
+
return index.createDiv({
|
|
121
|
+
className: "quote-text-container",
|
|
122
|
+
children: [wrapper],
|
|
123
|
+
elementStyles: {
|
|
124
|
+
element: {
|
|
125
|
+
width: "100%",
|
|
126
|
+
...typography__namespace.sans.medium,
|
|
127
|
+
[`@container (max-width: ${_constants.SMALL - 1}px)`]: {
|
|
128
|
+
paddingLeft: token__namespace.spacing.md,
|
|
129
|
+
...!hasImage && {
|
|
130
|
+
paddingTop: token__namespace.spacing.lg
|
|
203
131
|
},
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
132
|
+
...isSizeLargeAndNotFeatured && {
|
|
133
|
+
paddingTop: token__namespace.spacing["2xl"]
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
[`@container (min-width: ${_constants.SMALL}px)`]: {
|
|
137
|
+
paddingLeft: token__namespace.spacing["4xl"],
|
|
138
|
+
...isHasImageAndNotFeatured && { paddingLeft: "0" }
|
|
139
|
+
},
|
|
140
|
+
[`& *`]: {
|
|
141
|
+
...typography__namespace.sans.medium,
|
|
142
|
+
...shouldHaveWhiteText && {
|
|
143
|
+
color: token__namespace.color.white
|
|
212
144
|
}
|
|
213
145
|
}
|
|
214
146
|
}
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
return CreateQuoteTextContainer(props);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
218
149
|
};
|
|
219
150
|
module.exports = elementText;
|
|
220
151
|
//# sourceMappingURL=text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sources":["../../../../source/composite/quote/elements/text.ts"],"sourcesContent":["import * as token from '@universityofmaryland/web-styles-library/token';\nimport * as typography from '@universityofmaryland/web-styles-library/typography';\nimport { ElementModel } from 'model';\nimport { default as elementIcon } from './icon';\nimport { default as elementAction } from './action';\nimport { SMALL } from '../_constants';\nimport { type QuoteTextProps } from '../_types';\nimport { type ElementVisual } from '../../../_types';\n\nexport default (props: QuoteTextProps) => {\n const {\n isThemeDark,\n isThemeMaryland,\n isSizeLarge = false,\n isTypeFeatured = false,\n image,\n quote,\n attribution,\n attributionSubText,\n action,\n includesAnimation,\n } = props;\n\n const createQuoteText = (\n quote: HTMLElement,\n quoteChildren: ElementVisual[],\n ) => {\n let quoteTextElement: HTMLElement = quote;\n const wordsList = splitWords(quote);\n\n if (includesAnimation) {\n quoteTextElement = document.createElement('div');\n\n wordsList.map((word) => {\n quoteTextElement.appendChild(word);\n });\n }\n\n const quoteElement = ElementModel.create({\n element: quoteTextElement,\n className: 'quote-container-quote',\n children: quoteChildren,\n elementStyles: {\n element: {\n position: 'relative',\n fontWeight: '700',\n color: token.color.black,\n ...typography.sans.larger,\n\n ...(isSizeLarge && { ...typography.sans.extraLarge }),\n\n ...((isThemeDark || isThemeMaryland) && {\n color: token.color.white,\n }),\n\n [`&::before`]: {\n content: '\"\"',\n position: 'absolute',\n left: `-${token.spacing.md}`,\n top: '7px',\n height: 'calc(100% - 14px)',\n width: '2px',\n display: 'block',\n backgroundColor: token.color.red,\n ...(isThemeMaryland && { backgroundColor: token.color.gold }),\n\n ...(image &&\n !isTypeFeatured && {\n display: 'none',\n }),\n\n [`@container (min-width: ${SMALL}px)`]: {\n left: `-${token.spacing.md}`,\n },\n\n [`@container (max-width: ${SMALL - 1}px)`]: {\n ...(!isTypeFeatured && {\n display: 'block',\n }),\n },\n },\n\n ['& *']: {\n color: 'currentColor',\n ...typography.sans.larger,\n ...(isSizeLarge && { ...typography.sans.extraLarge }),\n },\n },\n },\n });\n\n return quoteElement;\n };\n\n const getQuoteTextContainerChildren = (props: QuoteTextProps) => {\n const wrapperChildren: ElementVisual[] = [];\n\n if (quote) {\n const quoteChildren: ElementVisual[] = [];\n const iconSpan = elementIcon(props);\n\n if (!image) {\n quoteChildren.push(iconSpan);\n }\n\n const quoteElement = createQuoteText(quote, quoteChildren);\n\n wrapperChildren.push(quoteElement);\n }\n\n if (attribution) {\n const attributionElement = ElementModel.create({\n element: attribution,\n className: 'quote-container-attribution',\n elementStyles: {\n element: {\n marginTop: token.spacing.sm,\n\n ...(includesAnimation && {\n opacity: '0',\n transform: 'translateY(20px)',\n transition: 'opacity 1s ease, transform 0.5s ease',\n }),\n\n ...(isThemeDark && {\n color: token.color.white,\n }),\n\n [`& *`]: {\n color: 'currentColor',\n ...typography.sans.medium,\n },\n },\n },\n });\n\n wrapperChildren.push(attributionElement);\n }\n\n if (attributionSubText) {\n const attributionSubTextElement = ElementModel.create({\n element: attributionSubText,\n className: 'quote-container-text-attribution-sub-text',\n elementStyles: {\n element: {\n color: token.color.gray.dark,\n fontStyle: 'italic',\n ...typography.sans.small,\n\n ...(includesAnimation && {\n opacity: '0',\n transform: 'translateY(20px)',\n transition: 'opacity 1s ease, transform 0.5s ease',\n }),\n\n ...((isThemeDark || isThemeMaryland) && {\n color: token.color.white,\n }),\n },\n },\n });\n\n wrapperChildren.push(attributionSubTextElement);\n }\n\n if (action) {\n const actionElement = elementAction({\n ...props,\n action,\n });\n\n wrapperChildren.push(actionElement);\n }\n\n return wrapperChildren;\n };\n\n const splitWords = (quote: HTMLElement) => {\n const text = quote.textContent ?? '';\n const words = text.trim().split(/\\s+/);\n\n const wordElements = words.map((word, index) => {\n const wordElement = document.createElement('div');\n wordElement.classList.add('quote-text-split-word');\n\n Object.assign(wordElement.style, {\n display: 'inline-block',\n whiteSpace: 'pre-wrap',\n opacity: '0',\n transform: 'translateY(20px)',\n transition: 'opacity 1s ease, transform 0.5s ease',\n });\n\n wordElement.textContent = word + (index < words.length - 1 ? ' ' : '');\n\n return wordElement;\n });\n\n return wordElements;\n };\n\n const CreateQuoteTextContainer = (props: QuoteTextProps) => {\n const wrapperChildren = getQuoteTextContainerChildren(props);\n\n const wrapper = ElementModel.createDiv({\n className: 'quote-text-container-wrapper',\n children: wrapperChildren,\n });\n\n return ElementModel.createDiv({\n className: 'quote-text-container',\n children: [wrapper],\n elementStyles: {\n element: {\n width: '100%',\n ...typography.sans.medium,\n\n [`@container (max-width: ${SMALL - 1}px)`]: {\n paddingTop: token.spacing.lg,\n paddingLeft: token.spacing.md,\n\n ...(!isTypeFeatured && {\n ...(isSizeLarge && { paddingTop: token.spacing['2xl'] }),\n }),\n },\n\n [`@container (min-width: ${SMALL}px)`]: {\n paddingLeft: token.spacing['4xl'],\n\n ...(!isTypeFeatured && {\n ...(image && { paddingLeft: '0' }),\n }),\n },\n\n [`& *`]: {\n ...typography.sans.medium,\n\n ...(isThemeDark && {\n color: token.color.white,\n }),\n\n ...(isThemeMaryland && {\n color: token.color.white,\n }),\n },\n },\n },\n });\n };\n\n return CreateQuoteTextContainer(props);\n};\n"],"names":["action","quote","ElementModel.create","token","typography","SMALL","props","elementIcon","elementAction","index","ElementModel.createDiv"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAA,cAAe,CAAC,UAA0B;AACxC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AA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M,QAAQ;AAAA,YAC1B,aAAaA,iBAAM,QAAQ;AAAA,YAE3B,GAAI,CAAC,kBAAkB;AAAA,cACrB,GAAI,eAAe,EAAE,YAAYA,iBAAM,QAAQ,KAAK,EAAA;AAAA,YAAE;AAAA,UACxD;AAAA,UAGF,CAAC,0BAA0BE,gBAAK,KAAK,GAAG;AAAA,YACtC,aAAaF,iBAAM,QAAQ,KAAK;AAAA,YAEhC,GAAI,CAAC,kBAAkB;AAAA,cACrB,GAAI,SAAS,EAAE,aAAa,IAAA;AAAA,YAAI;AAAA,UAClC;AAAA,UAGF,CAAC,KAAK,GAAG;AAAA,YACP,GAAGC,sBAAW,KAAK;AAAA,YAEnB,GAAI,eAAe;AAAA,cACjB,OAAOD,iBAAM,MAAM;AAAA,YAAA;AAAA,YAGrB,GAAI,mBAAmB;AAAA,cACrB,OAAOA,iBAAM,MAAM;AAAA,YAAA;AAAA,UACrB;AAAA,QACF;AAAA,MACF;AAAA,IACF,CACD;AAAA,EACH;AAEA,SAAO,yBAAyB,KAAK;AACvC;;"}
|
|
1
|
+
{"version":3,"file":"text.js","sources":["../../../../source/composite/quote/elements/text.ts"],"sourcesContent":["import * as token from '@universityofmaryland/web-styles-library/token';\nimport * as typography from '@universityofmaryland/web-styles-library/typography';\nimport { ElementModel } from 'model';\nimport { default as elementAction } from './action';\nimport { default as elementQuote } from './quote';\nimport { SMALL } from '../_constants';\nimport { type QuoteTextProps } from '../_types';\nimport { type ElementVisual } from '../../../_types';\n\ninterface ChildrenProps\n extends Pick<\n QuoteTextProps,\n | 'quote'\n | 'image'\n | 'attribution'\n | 'attributionSubText'\n | 'action'\n | 'isThemeDark'\n | 'isSizeLarge'\n | 'isTypeFeatured'\n | 'includesAnimation'\n > {\n shouldHaveWhiteText?: boolean;\n hasImage: boolean;\n}\n\nconst createChildren = (props: ChildrenProps) => {\n const {\n action,\n attribution,\n attributionSubText,\n hasImage,\n includesAnimation,\n isThemeDark,\n quote,\n shouldHaveWhiteText,\n } = props;\n const wrapperChildren: ElementVisual[] = [];\n\n if (quote) {\n wrapperChildren.push(\n elementQuote({ ...props, shouldHaveWhiteText, quote, hasImage }),\n );\n }\n\n if (attribution) {\n const attributionElement = ElementModel.create({\n element: attribution,\n className: 'quote-container-attribution',\n elementStyles: {\n element: {\n marginTop: token.spacing.sm,\n\n ...(includesAnimation && {\n opacity: '0',\n transform: 'translateY(20px)',\n transition: 'opacity 1s ease, transform 0.5s ease',\n }),\n\n ...(isThemeDark && {\n color: token.color.white,\n }),\n\n [`& *`]: {\n color: 'currentColor',\n ...typography.sans.medium,\n },\n },\n },\n });\n\n wrapperChildren.push(attributionElement);\n }\n\n if (attributionSubText) {\n const attributionSubTextElement = ElementModel.create({\n element: attributionSubText,\n className: 'quote-container-text-attribution-sub-text',\n elementStyles: {\n element: {\n color: token.color.gray.dark,\n fontStyle: 'italic',\n ...typography.sans.small,\n\n ...(includesAnimation && {\n opacity: '0',\n transform: 'translateY(20px)',\n transition: 'opacity 1s ease, transform 0.5s ease',\n }),\n\n ...(shouldHaveWhiteText && {\n color: token.color.white,\n }),\n },\n },\n });\n\n wrapperChildren.push(attributionSubTextElement);\n }\n\n if (action) {\n const actionElement = elementAction({\n ...props,\n action,\n });\n\n wrapperChildren.push(actionElement);\n }\n\n return wrapperChildren;\n};\n\nexport default (\n props: Pick<\n QuoteTextProps,\n | 'isThemeDark'\n | 'isThemeMaryland'\n | 'isSizeLarge'\n | 'isTypeFeatured'\n | 'image'\n | 'quote'\n | 'attribution'\n | 'attributionSubText'\n | 'action'\n | 'includesAnimation'\n >,\n) => {\n const {\n image,\n isSizeLarge = false,\n isThemeDark,\n isThemeMaryland,\n isTypeFeatured = false,\n } = props;\n const shouldHaveWhiteText = isThemeDark || isThemeMaryland;\n const isSizeLargeAndNotFeatured = isSizeLarge && !isTypeFeatured;\n const hasImage = image != null;\n const isHasImageAndNotFeatured = hasImage && !isTypeFeatured;\n\n const wrapper = ElementModel.createDiv({\n className: 'quote-text-container-wrapper',\n children: [\n ...createChildren({\n ...props,\n shouldHaveWhiteText,\n hasImage,\n }),\n ],\n });\n\n return ElementModel.createDiv({\n className: 'quote-text-container',\n children: [wrapper],\n elementStyles: {\n element: {\n width: '100%',\n ...typography.sans.medium,\n\n [`@container (max-width: ${SMALL - 1}px)`]: {\n paddingLeft: token.spacing.md,\n\n ...(!hasImage && {\n paddingTop: token.spacing.lg,\n }),\n\n ...(isSizeLargeAndNotFeatured && {\n paddingTop: token.spacing['2xl'],\n }),\n },\n\n [`@container (min-width: ${SMALL}px)`]: {\n paddingLeft: token.spacing['4xl'],\n\n ...(isHasImageAndNotFeatured && { paddingLeft: '0' }),\n },\n\n [`& *`]: {\n ...typography.sans.medium,\n\n ...(shouldHaveWhiteText && {\n color: token.color.white,\n }),\n },\n },\n },\n });\n};\n"],"names":["action","quote","elementQuote","ElementModel.create","token","typography","elementAction","ElementModel.createDiv","SMALL"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,iBAAiB,CAAC,UAAyB;AAC/C,QAAM;AAAA,IAAA,QACJA;AAAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAAA,OACAC;AAAAA,IACA;AAAA,EAAA,IACE;AACJ,QAAM,kBAAmC,CAAA;AAEzC,MAAIA,SAAO;AACT,oBAAgB;AAAA,MACdC,MAAa,EAAE,GAAG,OAAO,qBAAA,OAAqBD,SAAO,UAAU;AAAA,IAAA;AAAA,EAEnE;AAEA,MAAI,aAAa;AACf,UAAM,qBAAqBE,MAAAA,OAAoB;AAAA,MAC7C,SAAS;AAAA,MACT,WAAW;AAAA,MACX,eAAe;AAAA,QACb,SAAS;AAAA,UACP,WAAWC,iBAAM,QAAQ;AAAA,UAEzB,GAAI,qBAAqB;AAAA,YACvB,SAAS;AAAA,YACT,WAAW;AAAA,YACX,YAAY;AAAA,UAAA;AAAA,UAGd,GAAI,eAAe;AAAA,YACjB,OAAOA,iBAAM,MAAM;AAAA,UAAA;AAA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AW;AAAA,IACX,UAAU,CAAC,OAAO;AAAA,IAClB,eAAe;AAAA,MACb,SAAS;AAAA,QACP,OAAO;AAAA,QACP,GAAGF,sBAAW,KAAK;AAAA,QAEnB,CAAC,0BAA0BG,WAAAA,QAAQ,CAAC,KAAK,GAAG;AAAA,UAC1C,aAAaJ,iBAAM,QAAQ;AAAA,UAE3B,GAAI,CAAC,YAAY;AAAA,YACf,YAAYA,iBAAM,QAAQ;AAAA,UAAA;AAAA,UAG5B,GAAI,6BAA6B;AAAA,YAC/B,YAAYA,iBAAM,QAAQ,KAAK;AAAA,UAAA;AAAA,QACjC;AAAA,QAGF,CAAC,0BAA0BI,gBAAK,KAAK,GAAG;AAAA,UACtC,aAAaJ,iBAAM,QAAQ,KAAK;AAAA,UAEhC,GAAI,4BAA4B,EAAE,aAAa,IAAA;AAAA,QAAI;AAAA,QAGrD,CAAC,KAAK,GAAG;AAAA,UACP,GAAGC,sBAAW,KAAK;AAAA,UAEnB,GAAI,uBAAuB;AAAA,YACzB,OAAOD,iBAAM,MAAM;AAAA,UAAA;AAAA,QACrB;AAAA,MACF;AAAA,IACF;AAAA,EACF,CACD;AACH;;"}
|
|
@@ -1,201 +1,132 @@
|
|
|
1
1
|
import * as token from "@universityofmaryland/web-styles-library/token";
|
|
2
2
|
import * as typography from "@universityofmaryland/web-styles-library/typography";
|
|
3
3
|
import { createDiv, create } from "../../../model/elements/index.mjs";
|
|
4
|
-
import elementIcon from "./icon.mjs";
|
|
5
4
|
import elementAction from "./action.mjs";
|
|
5
|
+
import elementQuote from "./quote.mjs";
|
|
6
6
|
import { SMALL } from "../_constants.mjs";
|
|
7
|
-
const
|
|
7
|
+
const createChildren = (props) => {
|
|
8
8
|
const {
|
|
9
|
-
|
|
10
|
-
isThemeMaryland,
|
|
11
|
-
isSizeLarge = false,
|
|
12
|
-
isTypeFeatured = false,
|
|
13
|
-
image,
|
|
14
|
-
quote,
|
|
9
|
+
action,
|
|
15
10
|
attribution,
|
|
16
11
|
attributionSubText,
|
|
17
|
-
|
|
18
|
-
includesAnimation
|
|
12
|
+
hasImage,
|
|
13
|
+
includesAnimation,
|
|
14
|
+
isThemeDark,
|
|
15
|
+
quote,
|
|
16
|
+
shouldHaveWhiteText
|
|
19
17
|
} = props;
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
element: quoteTextElement,
|
|
31
|
-
className: "quote-container-quote",
|
|
32
|
-
children: quoteChildren,
|
|
18
|
+
const wrapperChildren = [];
|
|
19
|
+
if (quote) {
|
|
20
|
+
wrapperChildren.push(
|
|
21
|
+
elementQuote({ ...props, shouldHaveWhiteText, quote, hasImage })
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
if (attribution) {
|
|
25
|
+
const attributionElement = create({
|
|
26
|
+
element: attribution,
|
|
27
|
+
className: "quote-container-attribution",
|
|
33
28
|
elementStyles: {
|
|
34
29
|
element: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
...(isThemeDark || isThemeMaryland) && {
|
|
41
|
-
color: token.color.white
|
|
30
|
+
marginTop: token.spacing.sm,
|
|
31
|
+
...includesAnimation && {
|
|
32
|
+
opacity: "0",
|
|
33
|
+
transform: "translateY(20px)",
|
|
34
|
+
transition: "opacity 1s ease, transform 0.5s ease"
|
|
42
35
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
position: "absolute",
|
|
46
|
-
left: `-${token.spacing.md}`,
|
|
47
|
-
top: "7px",
|
|
48
|
-
height: "calc(100% - 14px)",
|
|
49
|
-
width: "2px",
|
|
50
|
-
display: "block",
|
|
51
|
-
backgroundColor: token.color.red,
|
|
52
|
-
...isThemeMaryland && { backgroundColor: token.color.gold },
|
|
53
|
-
...image && !isTypeFeatured && {
|
|
54
|
-
display: "none"
|
|
55
|
-
},
|
|
56
|
-
[`@container (min-width: ${SMALL}px)`]: {
|
|
57
|
-
left: `-${token.spacing.md}`
|
|
58
|
-
},
|
|
59
|
-
[`@container (max-width: ${SMALL - 1}px)`]: {
|
|
60
|
-
...!isTypeFeatured && {
|
|
61
|
-
display: "block"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
36
|
+
...isThemeDark && {
|
|
37
|
+
color: token.color.white
|
|
64
38
|
},
|
|
65
|
-
[
|
|
39
|
+
[`& *`]: {
|
|
66
40
|
color: "currentColor",
|
|
67
|
-
...typography.sans.
|
|
68
|
-
...isSizeLarge && { ...typography.sans.extraLarge }
|
|
41
|
+
...typography.sans.medium
|
|
69
42
|
}
|
|
70
43
|
}
|
|
71
44
|
}
|
|
72
45
|
});
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
element: {
|
|
92
|
-
marginTop: token.spacing.sm,
|
|
93
|
-
...includesAnimation && {
|
|
94
|
-
opacity: "0",
|
|
95
|
-
transform: "translateY(20px)",
|
|
96
|
-
transition: "opacity 1s ease, transform 0.5s ease"
|
|
97
|
-
},
|
|
98
|
-
...isThemeDark && {
|
|
99
|
-
color: token.color.white
|
|
100
|
-
},
|
|
101
|
-
[`& *`]: {
|
|
102
|
-
color: "currentColor",
|
|
103
|
-
...typography.sans.medium
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
wrapperChildren.push(attributionElement);
|
|
109
|
-
}
|
|
110
|
-
if (attributionSubText) {
|
|
111
|
-
const attributionSubTextElement = create({
|
|
112
|
-
element: attributionSubText,
|
|
113
|
-
className: "quote-container-text-attribution-sub-text",
|
|
114
|
-
elementStyles: {
|
|
115
|
-
element: {
|
|
116
|
-
color: token.color.gray.dark,
|
|
117
|
-
fontStyle: "italic",
|
|
118
|
-
...typography.sans.small,
|
|
119
|
-
...includesAnimation && {
|
|
120
|
-
opacity: "0",
|
|
121
|
-
transform: "translateY(20px)",
|
|
122
|
-
transition: "opacity 1s ease, transform 0.5s ease"
|
|
123
|
-
},
|
|
124
|
-
...(isThemeDark || isThemeMaryland) && {
|
|
125
|
-
color: token.color.white
|
|
126
|
-
}
|
|
46
|
+
wrapperChildren.push(attributionElement);
|
|
47
|
+
}
|
|
48
|
+
if (attributionSubText) {
|
|
49
|
+
const attributionSubTextElement = create({
|
|
50
|
+
element: attributionSubText,
|
|
51
|
+
className: "quote-container-text-attribution-sub-text",
|
|
52
|
+
elementStyles: {
|
|
53
|
+
element: {
|
|
54
|
+
color: token.color.gray.dark,
|
|
55
|
+
fontStyle: "italic",
|
|
56
|
+
...typography.sans.small,
|
|
57
|
+
...includesAnimation && {
|
|
58
|
+
opacity: "0",
|
|
59
|
+
transform: "translateY(20px)",
|
|
60
|
+
transition: "opacity 1s ease, transform 0.5s ease"
|
|
61
|
+
},
|
|
62
|
+
...shouldHaveWhiteText && {
|
|
63
|
+
color: token.color.white
|
|
127
64
|
}
|
|
128
65
|
}
|
|
129
|
-
}
|
|
130
|
-
wrapperChildren.push(attributionSubTextElement);
|
|
131
|
-
}
|
|
132
|
-
if (action) {
|
|
133
|
-
const actionElement = elementAction({
|
|
134
|
-
...props2,
|
|
135
|
-
action
|
|
136
|
-
});
|
|
137
|
-
wrapperChildren.push(actionElement);
|
|
138
|
-
}
|
|
139
|
-
return wrapperChildren;
|
|
140
|
-
};
|
|
141
|
-
const splitWords = (quote2) => {
|
|
142
|
-
const text = quote2.textContent ?? "";
|
|
143
|
-
const words = text.trim().split(/\s+/);
|
|
144
|
-
const wordElements = words.map((word, index) => {
|
|
145
|
-
const wordElement = document.createElement("div");
|
|
146
|
-
wordElement.classList.add("quote-text-split-word");
|
|
147
|
-
Object.assign(wordElement.style, {
|
|
148
|
-
display: "inline-block",
|
|
149
|
-
whiteSpace: "pre-wrap",
|
|
150
|
-
opacity: "0",
|
|
151
|
-
transform: "translateY(20px)",
|
|
152
|
-
transition: "opacity 1s ease, transform 0.5s ease"
|
|
153
|
-
});
|
|
154
|
-
wordElement.textContent = word + (index < words.length - 1 ? " " : "");
|
|
155
|
-
return wordElement;
|
|
66
|
+
}
|
|
156
67
|
});
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
children: wrapperChildren
|
|
68
|
+
wrapperChildren.push(attributionSubTextElement);
|
|
69
|
+
}
|
|
70
|
+
if (action) {
|
|
71
|
+
const actionElement = elementAction({
|
|
72
|
+
...props,
|
|
73
|
+
action
|
|
164
74
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
75
|
+
wrapperChildren.push(actionElement);
|
|
76
|
+
}
|
|
77
|
+
return wrapperChildren;
|
|
78
|
+
};
|
|
79
|
+
const elementText = (props) => {
|
|
80
|
+
const {
|
|
81
|
+
image,
|
|
82
|
+
isSizeLarge = false,
|
|
83
|
+
isThemeDark,
|
|
84
|
+
isThemeMaryland,
|
|
85
|
+
isTypeFeatured = false
|
|
86
|
+
} = props;
|
|
87
|
+
const shouldHaveWhiteText = isThemeDark || isThemeMaryland;
|
|
88
|
+
const isSizeLargeAndNotFeatured = isSizeLarge && !isTypeFeatured;
|
|
89
|
+
const hasImage = image != null;
|
|
90
|
+
const isHasImageAndNotFeatured = hasImage && !isTypeFeatured;
|
|
91
|
+
const wrapper = createDiv({
|
|
92
|
+
className: "quote-text-container-wrapper",
|
|
93
|
+
children: [
|
|
94
|
+
...createChildren({
|
|
95
|
+
...props,
|
|
96
|
+
shouldHaveWhiteText,
|
|
97
|
+
hasImage
|
|
98
|
+
})
|
|
99
|
+
]
|
|
100
|
+
});
|
|
101
|
+
return createDiv({
|
|
102
|
+
className: "quote-text-container",
|
|
103
|
+
children: [wrapper],
|
|
104
|
+
elementStyles: {
|
|
105
|
+
element: {
|
|
106
|
+
width: "100%",
|
|
107
|
+
...typography.sans.medium,
|
|
108
|
+
[`@container (max-width: ${SMALL - 1}px)`]: {
|
|
109
|
+
paddingLeft: token.spacing.md,
|
|
110
|
+
...!hasImage && {
|
|
111
|
+
paddingTop: token.spacing.lg
|
|
184
112
|
},
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
113
|
+
...isSizeLargeAndNotFeatured && {
|
|
114
|
+
paddingTop: token.spacing["2xl"]
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
[`@container (min-width: ${SMALL}px)`]: {
|
|
118
|
+
paddingLeft: token.spacing["4xl"],
|
|
119
|
+
...isHasImageAndNotFeatured && { paddingLeft: "0" }
|
|
120
|
+
},
|
|
121
|
+
[`& *`]: {
|
|
122
|
+
...typography.sans.medium,
|
|
123
|
+
...shouldHaveWhiteText && {
|
|
124
|
+
color: token.color.white
|
|
193
125
|
}
|
|
194
126
|
}
|
|
195
127
|
}
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
return CreateQuoteTextContainer(props);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
199
130
|
};
|
|
200
131
|
export {
|
|
201
132
|
elementText as default
|