@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 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Text/v1/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGxC;;;;GAIG;AACH,cACM,IAAK,SAAQ,SAAS,CAAC,SAAS,CAAC;IACrC,MAAM,CAAC,QAAQ,CAAC,WAAW,UAAS;IAEpC,MAAM,CAAC,YAAY;;;;;;;;;;;;;SAAe;IAElC,MAAM,CAAC,YAAY;;;;;;MAMT;IAEV,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,GAAI,IAAI,OAAO,GAAG,IAAI,UAM9B;IAED,UAAU;IAeV,iBAAiB;IAKjB,kBAAkB;IAKlB,MAAM;CAeP;AAED,eAAe,IAAI,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Text/v1/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGxC;;;;GAIG;AACH,cACM,IAAK,SAAQ,SAAS,CAAC,SAAS,CAAC;IACrC,MAAM,CAAC,WAAW,SAAS;IAC3B,MAAM,CAAC,QAAQ,CAAC,WAAW,UAAS;IAEpC,MAAM,CAAC,YAAY;;;;;;;;;;;;;SAAe;IAElC,MAAM,CAAC,YAAY;;;;;;MAMT;IAEV,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,GAAI,IAAI,OAAO,GAAG,IAAI,UAM9B;IAED,UAAU;IAeV,iBAAiB;IAKjB,kBAAkB;IAKlB,MAAM;CAeP;AAED,eAAe,IAAI,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -6,6 +6,7 @@ category: components
6
6
  ---
7
7
  **/
8
8
  declare class Text extends Component<TextProps> {
9
+ static displayName: string;
9
10
  static readonly componentId = "Text";
10
11
  static allowedProps: readonly (keyof {
11
12
  as?: import("@instructure/shared-types").AsElementType;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Text/v2/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGxC;;;;GAIG;AACH,cACM,IAAK,SAAQ,SAAS,CAAC,SAAS,CAAC;IACrC,MAAM,CAAC,QAAQ,CAAC,WAAW,UAAS;IAEpC,MAAM,CAAC,YAAY;;;;;;;;;;;;;SAAe;IAElC,MAAM,CAAC,YAAY;;;;;;MAMT;IAEV,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,GAAI,IAAI,OAAO,GAAG,IAAI,UAM9B;IAED,UAAU;IAeV,iBAAiB;IAKjB,kBAAkB;IAKlB,MAAM;CAeP;AAED,eAAe,IAAI,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Text/v2/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGxC;;;;GAIG;AACH,cACM,IAAK,SAAQ,SAAS,CAAC,SAAS,CAAC;IACrC,MAAM,CAAC,WAAW,SAAS;IAC3B,MAAM,CAAC,QAAQ,CAAC,WAAW,UAAS;IAEpC,MAAM,CAAC,YAAY;;;;;;;;;;;;;SAAe;IAElC,MAAM,CAAC,YAAY;;;;;;MAMT;IAEV,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,GAAI,IAAI,OAAO,GAAG,IAAI,UAM9B;IAED,UAAU;IAeV,iBAAiB;IAKjB,kBAAkB;IAKlB,MAAM;CAeP;AAED,eAAe,IAAI,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -1,3 +1,3 @@
1
- export { Text } from '../Text/v1';
1
+ export { Text } from '../Text/v1/index.js';
2
2
  export type { TextProps } from '../Text/v1/props';
3
3
  //# sourceMappingURL=a.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"a.d.ts","sourceRoot":"","sources":["../../src/exports/a.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA"}
1
+ {"version":3,"file":"a.d.ts","sourceRoot":"","sources":["../../src/exports/a.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA"}
@@ -1,3 +1,3 @@
1
- export { Text } from '../Text/v2';
1
+ export { Text } from '../Text/v2/index.js';
2
2
  export type { TextProps } from '../Text/v2/props';
3
3
  //# sourceMappingURL=b.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"b.d.ts","sourceRoot":"","sources":["../../src/exports/b.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA"}
1
+ {"version":3,"file":"b.d.ts","sourceRoot":"","sources":["../../src/exports/b.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA"}
@@ -1,100 +0,0 @@
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;
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.withStyle)(_styles.default, _theme.default), _dec(_class = class Text extends _react.Component {
46
- static displayName = "Text";
47
- static componentId = 'Text';
48
- static allowedProps = _props.allowedProps;
49
- static defaultProps = {
50
- as: 'span',
51
- wrap: 'normal',
52
- size: 'medium',
53
- letterSpacing: 'normal',
54
- children: null
55
- };
56
- ref = null;
57
- handleRef = el => {
58
- this.ref = el;
59
- const {
60
- elementRef
61
- } = this.props;
62
- if (typeof elementRef === 'function') {
63
- elementRef(el);
64
- }
65
- };
66
- checkProps() {
67
- const {
68
- variant,
69
- lineHeight,
70
- weight,
71
- fontStyle
72
- } = this.props;
73
- if (variant) {
74
- if (lineHeight) {}
75
- if (weight) {}
76
- if (fontStyle) {}
77
- }
78
- }
79
- componentDidMount() {
80
- this.props.makeStyles?.();
81
- this.checkProps();
82
- }
83
- componentDidUpdate() {
84
- this.props.makeStyles?.();
85
- this.checkProps();
86
- }
87
- render() {
88
- const {
89
- children
90
- } = this.props;
91
- const ElementType = (0, _getElementType.getElementType)(Text, this.props);
92
- return (0, _jsxRuntime.jsx)(ElementType, {
93
- ...(0, _passthroughProps.passthroughProps)(this.props),
94
- css: this.props.styles?.text,
95
- ref: this.handleRef,
96
- children: children
97
- });
98
- }
99
- }) || _class);
100
- var _default = exports.default = Text;
@@ -1,31 +0,0 @@
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'];
@@ -1,274 +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 {Object} componentTheme The theme variable object.
37
- * @param {Object} props the props of the component, the style is applied to
38
- * @param {Object} state the state of the component, the style is applied to
39
- * @return {Object} The final style object, which will be used in the component
40
- */
41
- const generateStyle = (componentTheme, props) => {
42
- const {
43
- size,
44
- wrap,
45
- weight,
46
- fontStyle,
47
- transform,
48
- lineHeight,
49
- letterSpacing,
50
- color,
51
- variant
52
- } = props;
53
- const variants = {
54
- descriptionPage: {
55
- fontStyle: 'normal',
56
- fontWeight: componentTheme.weightRegular,
57
- fontSize: componentTheme.descriptionPage,
58
- lineHeight: componentTheme.lineHeight150
59
- },
60
- descriptionSection: {
61
- fontStyle: 'normal',
62
- fontWeight: componentTheme.weightRegular,
63
- fontSize: componentTheme.descriptionSection,
64
- lineHeight: componentTheme.lineHeight150
65
- },
66
- content: {
67
- fontStyle: 'normal',
68
- fontWeight: componentTheme.weightRegular,
69
- fontSize: componentTheme.content,
70
- lineHeight: componentTheme.lineHeight150
71
- },
72
- contentImportant: {
73
- fontStyle: 'normal',
74
- fontWeight: componentTheme.weightImportant,
75
- fontSize: componentTheme.content,
76
- lineHeight: componentTheme.lineHeight150
77
- },
78
- contentQuote: {
79
- fontStyle: 'italic',
80
- fontWeight: componentTheme.weightRegular,
81
- fontSize: componentTheme.content,
82
- lineHeight: componentTheme.lineHeight150
83
- },
84
- contentSmall: {
85
- fontStyle: 'normal',
86
- fontWeight: componentTheme.weightRegular,
87
- fontSize: componentTheme.contentSmall,
88
- lineHeight: componentTheme.lineHeight150
89
- },
90
- legend: {
91
- fontStyle: 'normal',
92
- fontWeight: componentTheme.weightRegular,
93
- fontSize: componentTheme.legend,
94
- lineHeight: componentTheme.lineHeight150
95
- }
96
- };
97
- const colorVariants = {
98
- primary: {
99
- color: componentTheme.primaryColor
100
- },
101
- secondary: {
102
- color: componentTheme.secondaryColor
103
- },
104
- 'primary-inverse': {
105
- color: componentTheme.primaryInverseColor
106
- },
107
- 'secondary-inverse': {
108
- color: componentTheme.secondaryInverseColor
109
- },
110
- success: {
111
- color: componentTheme.successColor
112
- },
113
- brand: {
114
- color: componentTheme.brandColor
115
- },
116
- danger: {
117
- color: componentTheme.dangerColor
118
- },
119
- alert: {
120
- color: componentTheme.alertColor
121
- },
122
- warning: {
123
- color: componentTheme.warningColor
124
- },
125
- 'ai-highlight': {
126
- color: componentTheme.aiColor,
127
- background: componentTheme.aiBackgroundColor
128
- }
129
- };
130
- const wrapStyle = {
131
- overflowWrap: 'break-word',
132
- wordBreak: 'break-word',
133
- hyphens: 'auto'
134
- };
135
- const weightStyle = {
136
- normal: {
137
- fontWeight: componentTheme.fontWeightNormal
138
- },
139
- light: {
140
- fontWeight: componentTheme.fontWeightLight
141
- },
142
- bold: {
143
- fontWeight: componentTheme.fontWeightBold
144
- },
145
- weightRegular: {
146
- fontWeight: componentTheme.weightRegular
147
- },
148
- weightImportant: {
149
- fontWeight: componentTheme.weightImportant
150
- }
151
- };
152
- const fontSizeVariants = {
153
- 'x-small': componentTheme.fontSizeXSmall,
154
- small: componentTheme.fontSizeSmall,
155
- medium: componentTheme.fontSizeMedium,
156
- large: componentTheme.fontSizeLarge,
157
- 'x-large': componentTheme.fontSizeXLarge,
158
- 'xx-large': componentTheme.fontSizeXXLarge,
159
- descriptionPage: componentTheme.descriptionPage,
160
- descriptionSection: componentTheme.descriptionSection,
161
- content: componentTheme.content,
162
- contentSmall: componentTheme.contentSmall,
163
- legend: componentTheme.legend
164
- };
165
- const lineHeightVariants = {
166
- default: {
167
- lineHeight: componentTheme.lineHeight
168
- },
169
- fit: {
170
- lineHeight: componentTheme.lineHeightFit
171
- },
172
- condensed: {
173
- lineHeight: componentTheme.lineHeightCondensed
174
- },
175
- double: {
176
- lineHeight: componentTheme.lineHeightDouble
177
- },
178
- lineHeight100: {
179
- lineHeight: componentTheme.lineHeight100
180
- },
181
- lineHeight125: {
182
- lineHeight: componentTheme.lineHeight125
183
- },
184
- lineHeight150: {
185
- lineHeight: componentTheme.lineHeight150
186
- }
187
- };
188
- const letterSpacingVariants = {
189
- normal: componentTheme.letterSpacingNormal,
190
- condensed: componentTheme.letterSpacingCondensed,
191
- expanded: componentTheme.letterSpacingExpanded
192
- };
193
- const calcTextStyles = () => {
194
- if (variant) {
195
- return variants[variant];
196
- }
197
- return {
198
- ...(weight ? weightStyle[weight] : {}),
199
- ...(fontStyle ? {
200
- fontStyle: fontStyle
201
- } : {}),
202
- fontSize: fontSizeVariants[size],
203
- ...(lineHeight ? lineHeightVariants[lineHeight] : {})
204
- };
205
- };
206
- const baseStyles = {
207
- '&:focus': {
208
- outline: 'none'
209
- },
210
- ...(color ? colorVariants[color] : {}),
211
- ...(wrap === 'break-word' ? wrapStyle : {}),
212
- letterSpacing: letterSpacingVariants[letterSpacing],
213
- ...(transform ? {
214
- textTransform: transform
215
- } : {}),
216
- ...calcTextStyles()
217
- };
218
- const inputStyles = {
219
- ...baseStyles,
220
- outline: 0,
221
- appearance: 'none',
222
- boxSizing: 'border-box',
223
- background: 'none',
224
- border: 'none',
225
- borderRadius: 0,
226
- padding: 0,
227
- margin: 0,
228
- color: 'inherit',
229
- height: 'auto',
230
- width: '100%',
231
- lineHeight: 'inherit',
232
- textAlign: 'start',
233
- boxShadow: 'none',
234
- display: 'block'
235
- };
236
- return {
237
- text: {
238
- label: 'text',
239
- fontFamily: componentTheme.fontFamily,
240
- ...baseStyles,
241
- // NOTE: needs separate groups for `:is()` and `:-webkit-any()` because of css selector group validation (see https://www.w3.org/TR/selectors-3/#grouping)
242
- '&:is(input)[type]': inputStyles,
243
- '&:-webkit-any(input)[type]': inputStyles,
244
- 'sub, sup': {
245
- fontSize: '75%',
246
- lineHeight: 0,
247
- position: 'relative',
248
- verticalAlign: 'baseline'
249
- },
250
- sup: {
251
- top: '-0.4em'
252
- },
253
- sub: {
254
- bottom: '-0.4em'
255
- },
256
- 'pre, code': {
257
- all: 'initial',
258
- fontFamily: componentTheme.fontFamilyMonospace
259
- },
260
- 'i, em': {
261
- fontStyle: 'italic'
262
- },
263
- 'b, strong': {
264
- fontWeight: componentTheme.fontWeightBold
265
- },
266
- p: {
267
- display: 'block',
268
- padding: 0,
269
- margin: componentTheme.paragraphMargin
270
- }
271
- }
272
- };
273
- };
274
- var _default = exports.default = generateStyle;
@@ -1,69 +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
- * Generates the theme object for the component from the theme and provided additional information
33
- * @param {Object} theme The actual theme object.
34
- * @return {Object} The final theme object with the overrides and component variables
35
- */
36
- const generateComponentTheme = theme => {
37
- const {
38
- colors,
39
- typography,
40
- spacing,
41
- key: themeName
42
- } = theme;
43
- const themeSpecificStyle = {
44
- canvas: {
45
- primaryColor: theme['ic-brand-font-color-dark'],
46
- brandColor: theme['ic-brand-primary']
47
- }
48
- };
49
- const componentVariables = {
50
- ...typography,
51
- primaryInverseColor: colors?.contrasts?.white1010,
52
- primaryColor: colors?.contrasts?.grey125125,
53
- secondaryColor: colors?.contrasts?.grey5782,
54
- secondaryInverseColor: colors?.contrasts?.grey1111,
55
- brandColor: colors?.contrasts?.blue5782,
56
- dangerColor: colors?.contrasts?.red5782,
57
- successColor: colors?.contrasts?.green5782,
58
- alertColor: colors?.contrasts?.blue5782,
59
- warningColor: colors?.contrasts?.orange5782,
60
- aiColor: colors?.contrasts?.violet5790,
61
- aiBackgroundColor: colors?.contrasts?.violet1212,
62
- paragraphMargin: `${spacing.medium} 0`
63
- };
64
- return {
65
- ...componentVariables,
66
- ...themeSpecificStyle[themeName]
67
- };
68
- };
69
- var _default = exports.default = generateComponentTheme;
@@ -1,99 +0,0 @@
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 _props = require("./props");
14
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
15
- var _dec, _class;
16
- /*
17
- * The MIT License (MIT)
18
- *
19
- * Copyright (c) 2015 - present Instructure, Inc.
20
- *
21
- * Permission is hereby granted, free of charge, to any person obtaining a copy
22
- * of this software and associated documentation files (the "Software"), to deal
23
- * in the Software without restriction, including without limitation the rights
24
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
- * copies of the Software, and to permit persons to whom the Software is
26
- * furnished to do so, subject to the following conditions:
27
- *
28
- * The above copyright notice and this permission notice shall be included in all
29
- * copies or substantial portions of the Software.
30
- *
31
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
- * SOFTWARE.
38
- */
39
- /**
40
- ---
41
- category: components
42
- ---
43
- **/
44
- let Text = exports.Text = (_dec = (0, _emotion.withStyleNew)(_styles.default), _dec(_class = class Text extends _react.Component {
45
- static displayName = "Text";
46
- static componentId = 'Text';
47
- static allowedProps = _props.allowedProps;
48
- static defaultProps = {
49
- as: 'span',
50
- wrap: 'normal',
51
- size: 'medium',
52
- letterSpacing: 'normal',
53
- children: null
54
- };
55
- ref = null;
56
- handleRef = el => {
57
- this.ref = el;
58
- const {
59
- elementRef
60
- } = this.props;
61
- if (typeof elementRef === 'function') {
62
- elementRef(el);
63
- }
64
- };
65
- checkProps() {
66
- const {
67
- variant,
68
- lineHeight,
69
- weight,
70
- fontStyle
71
- } = this.props;
72
- if (variant) {
73
- if (lineHeight) {}
74
- if (weight) {}
75
- if (fontStyle) {}
76
- }
77
- }
78
- componentDidMount() {
79
- this.props.makeStyles?.();
80
- this.checkProps();
81
- }
82
- componentDidUpdate() {
83
- this.props.makeStyles?.();
84
- this.checkProps();
85
- }
86
- render() {
87
- const {
88
- children
89
- } = this.props;
90
- const ElementType = (0, _getElementType.getElementType)(Text, this.props);
91
- return (0, _jsxRuntime.jsx)(ElementType, {
92
- ...(0, _passthroughProps.passthroughProps)(this.props),
93
- css: this.props.styles?.text,
94
- ref: this.handleRef,
95
- children: children
96
- });
97
- }
98
- }) || _class);
99
- var _default = exports.default = Text;