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