@instructure/ui-text 11.7.3 → 11.7.4-pr-snapshot-1781695314229

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.
@@ -1,282 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- /**
32
- * ---
33
- * private: true
34
- * ---
35
- * Generates the style object from the theme and provided additional information
36
- * @param componentTheme The theme variable object.
37
- * @param params Additional parameters to customize the style.
38
- * @return The final style object, which will be used in the component
39
- */
40
- const generateStyle = (componentTheme, params) => {
41
- const {
42
- color,
43
- fontStyle,
44
- lineHeight,
45
- letterSpacing,
46
- transform,
47
- size,
48
- variant,
49
- weight,
50
- wrap
51
- } = params;
52
- const variants = {
53
- descriptionPage: {
54
- fontFamily: componentTheme.descriptionPage.fontFamily,
55
- fontWeight: componentTheme.descriptionPage.fontWeight,
56
- fontSize: componentTheme.descriptionPage.fontSize,
57
- lineHeight: componentTheme.descriptionPage.lineHeight
58
- },
59
- descriptionSection: {
60
- fontFamily: componentTheme.descriptionSection.fontFamily,
61
- fontWeight: componentTheme.descriptionSection.fontWeight,
62
- fontSize: componentTheme.descriptionSection.fontSize,
63
- lineHeight: componentTheme.descriptionSection.lineHeight
64
- },
65
- content: {
66
- fontFamily: componentTheme.content.fontFamily,
67
- fontWeight: componentTheme.content.fontWeight,
68
- fontSize: componentTheme.content.fontSize,
69
- lineHeight: componentTheme.content.lineHeight
70
- },
71
- contentImportant: {
72
- fontFamily: componentTheme.contentImportant.fontFamily,
73
- fontWeight: componentTheme.contentImportant.fontWeight,
74
- fontSize: componentTheme.contentImportant.fontSize,
75
- lineHeight: componentTheme.contentImportant.lineHeight
76
- },
77
- contentQuote: {
78
- fontFamily: componentTheme.contentQuote.fontFamily,
79
- fontWeight: componentTheme.contentQuote.fontWeight,
80
- fontSize: componentTheme.contentQuote.fontSize,
81
- lineHeight: componentTheme.contentQuote.lineHeight
82
- },
83
- contentSmall: {
84
- fontFamily: componentTheme.contentSmall.fontFamily,
85
- fontWeight: componentTheme.contentSmall.fontWeight,
86
- fontSize: componentTheme.contentSmall.fontSize,
87
- lineHeight: componentTheme.contentSmall.lineHeight
88
- },
89
- legend: {
90
- fontFamily: componentTheme.legend.fontFamily,
91
- fontWeight: componentTheme.legend.fontWeight,
92
- fontSize: componentTheme.legend.fontSize,
93
- lineHeight: componentTheme.legend.lineHeight
94
- }
95
- };
96
- const colorVariants = {
97
- inherit: {},
98
- primary: {
99
- color: componentTheme.baseColor
100
- },
101
- secondary: {
102
- color: componentTheme.mutedColor
103
- },
104
- 'primary-inverse': {
105
- color: componentTheme.inverseColor
106
- },
107
- 'secondary-inverse': {
108
- color: componentTheme.inverseColor
109
- },
110
- success: {
111
- color: componentTheme.successColor
112
- },
113
- brand: {
114
- color: componentTheme.primaryColor
115
- },
116
- danger: {
117
- color: componentTheme.errorColor
118
- },
119
- warning: {
120
- color: componentTheme.warningColor
121
- },
122
- 'primary-on': {
123
- color: componentTheme.baseOnColor
124
- },
125
- 'secondary-on': {
126
- color: componentTheme.mutedOnColor
127
- },
128
- 'ai-highlight': {
129
- color: componentTheme.aiColor,
130
- background: componentTheme.aiBackgroundColor
131
- }
132
- };
133
- const wrapStyle = {
134
- overflowWrap: 'break-word',
135
- wordBreak: 'break-word',
136
- hyphens: 'auto'
137
- };
138
- const weightStyle = {
139
- normal: {
140
- fontWeight: componentTheme.fontWeightNormal
141
- },
142
- light: {
143
- fontWeight: componentTheme.fontWeightLight
144
- },
145
- bold: {
146
- fontWeight: componentTheme.fontWeightBold
147
- },
148
- weightRegular: {
149
- fontWeight: componentTheme.fontWeightRegular
150
- },
151
- weightImportant: {
152
- fontWeight: componentTheme.fontWeightImportant
153
- }
154
- };
155
- const fontSizeVariants = {
156
- 'x-small': componentTheme.fontSizeXSmall,
157
- small: componentTheme.fontSizeSmall,
158
- medium: componentTheme.fontSizeMedium,
159
- large: componentTheme.fontSizeLarge,
160
- 'x-large': componentTheme.fontSizeXLarge,
161
- 'xx-large': componentTheme.fontSizeXXLarge,
162
- // these are deprecated
163
- descriptionPage: componentTheme.descriptionPage.fontSize,
164
- descriptionSection: componentTheme.descriptionSection.fontSize,
165
- content: componentTheme.content.fontSize,
166
- contentSmall: componentTheme.contentSmall.fontSize,
167
- legend: componentTheme.legend.fontSize
168
- };
169
- const lineHeightVariants = {
170
- default: {
171
- lineHeight: componentTheme.lineHeight
172
- },
173
- fit: {
174
- lineHeight: componentTheme.lineHeightFit
175
- },
176
- condensed: {
177
- lineHeight: componentTheme.lineHeightCondensed
178
- },
179
- double: {
180
- lineHeight: componentTheme.lineHeightDouble
181
- },
182
- lineHeight100: {
183
- lineHeight: componentTheme.lineHeight100
184
- },
185
- lineHeight125: {
186
- lineHeight: componentTheme.lineHeight125
187
- },
188
- lineHeight150: {
189
- lineHeight: componentTheme.lineHeight150
190
- }
191
- };
192
- const letterSpacingVariants = {
193
- normal: componentTheme.letterSpacingNormal,
194
- condensed: componentTheme.letterSpacingCondensed,
195
- expanded: componentTheme.letterSpacingExpanded
196
- };
197
- const calcTextStyles = () => {
198
- if (variant) {
199
- return variants[variant];
200
- }
201
- return {
202
- ...(weight ? weightStyle[weight] : {}),
203
- ...(fontStyle ? {
204
- fontStyle: fontStyle
205
- } : {}),
206
- fontSize: fontSizeVariants[size],
207
- ...(lineHeight ? lineHeightVariants[lineHeight] : {})
208
- };
209
- };
210
- const baseStyles = {
211
- '&:focus': {
212
- outline: 'none'
213
- },
214
- ...(color ? colorVariants[color] : {
215
- color: componentTheme.baseColor
216
- }),
217
- ...(wrap === 'break-word' ? wrapStyle : {}),
218
- letterSpacing: letterSpacingVariants[letterSpacing],
219
- ...(transform ? {
220
- textTransform: transform
221
- } : {}),
222
- ...calcTextStyles()
223
- };
224
- const inputStyles = {
225
- ...baseStyles,
226
- outline: 0,
227
- appearance: 'none',
228
- boxSizing: 'border-box',
229
- background: 'none',
230
- border: 'none',
231
- borderRadius: 0,
232
- padding: 0,
233
- margin: 0,
234
- height: 'auto',
235
- width: '100%',
236
- lineHeight: 'inherit',
237
- textAlign: 'start',
238
- boxShadow: 'none',
239
- display: 'block'
240
- };
241
- return {
242
- text: {
243
- label: 'text',
244
- fontFamily: componentTheme.fontFamily,
245
- ...baseStyles,
246
- // NOTE: needs separate groups for `:is()` and `:-webkit-any()` because
247
- // of css selector group validation (see https://www.w3.org/TR/selectors-3/#grouping)
248
- '&:is(input)[type]': inputStyles,
249
- '&:-webkit-any(input)[type]': inputStyles,
250
- 'sub, sup': {
251
- fontSize: '75%',
252
- lineHeight: 0,
253
- position: 'relative',
254
- verticalAlign: 'baseline'
255
- },
256
- sup: {
257
- top: '-0.4em'
258
- },
259
- sub: {
260
- bottom: '-0.4em'
261
- },
262
- 'pre, code': {
263
- all: 'initial',
264
- fontFamily: componentTheme.fontFamilyMonospace,
265
- background: '#99999945',
266
- color: 'inherit'
267
- },
268
- 'i, em': {
269
- fontStyle: 'italic'
270
- },
271
- 'b, strong': {
272
- fontWeight: componentTheme.fontWeightBold
273
- },
274
- p: {
275
- display: 'block',
276
- padding: 0,
277
- margin: componentTheme.paragraphMargin
278
- }
279
- }
280
- };
281
- };
282
- var _default = exports.default = generateStyle;
package/lib/exports/a.js DELETED
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Text", {
7
- enumerable: true,
8
- get: function () {
9
- return _v.Text;
10
- }
11
- });
12
- var _v = require("../Text/v1");
package/lib/exports/b.js DELETED
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Text", {
7
- enumerable: true,
8
- get: function () {
9
- return _v.Text;
10
- }
11
- });
12
- var _v = require("../Text/v2");
package/lib/package.json DELETED
@@ -1 +0,0 @@
1
- {"type":"commonjs"}