@instructure/ui-text 8.9.2-snapshot.7 → 8.10.1-snapshot.8

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 CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [8.10.0](https://github.com/instructure/instructure-ui/compare/v8.9.1...v8.10.0) (2021-09-28)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-text
9
+
6
10
  ## [8.9.1](https://github.com/instructure/instructure-ui/compare/v8.9.0...v8.9.1) (2021-09-16)
7
11
 
8
12
  **Note:** Version bump only for package @instructure/ui-text
@@ -27,7 +27,7 @@ export default {
27
27
  maxExamples: 1000,
28
28
  getComponentProps: props => {
29
29
  return {
30
- children: ['x-small', 'small', 'medium', 'large'].includes(props.size) ? 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor ullamco' : 'Lorem ipsum dolor sit amet, consectetur'
30
+ children: props.size && ['x-small', 'small', 'medium', 'large'].includes(props.size) ? 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor ullamco' : 'Lorem ipsum dolor sit amet, consectetur'
31
31
  };
32
32
  },
33
33
  getExampleProps: props => {
package/es/Text/index.js CHANGED
@@ -35,6 +35,7 @@ import { allowedProps, propTypes } from './props';
35
35
  ---
36
36
  category: components
37
37
  ---
38
+ @tsProps
38
39
  **/
39
40
 
40
41
  let Text = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class Text extends Component {
@@ -44,7 +45,7 @@ let Text = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
44
45
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
45
46
  }
46
47
 
47
- componentDidUpdate(prevProps, prevState, snapshot) {
48
+ componentDidUpdate() {
48
49
  var _this$props$makeStyle2, _this$props2;
49
50
 
50
51
  (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
@@ -55,10 +56,13 @@ let Text = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
55
56
 
56
57
  const children = this.props.children;
57
58
  const ElementType = getElementType(Text, this.props);
58
- return jsx(ElementType, Object.assign({}, passthroughProps(this.props), {
59
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.text,
60
- ref: this.props.elementRef
61
- }), children);
59
+ return (// @ts-expect-error TODO: AsElementType is not compatible for ref
60
+ jsx(ElementType // @ts-expect-error TODO: `ref` prop causes: "Expression produces a union type that is too complex to represent.ts(2590)"
61
+ , Object.assign({}, passthroughProps(this.props), {
62
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.text,
63
+ ref: this.props.elementRef
64
+ }), children)
65
+ );
62
66
  }
63
67
 
64
68
  }, _class2.displayName = "Text", _class2.componentId = 'Text', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
package/es/Text/props.js CHANGED
@@ -23,15 +23,8 @@
23
23
  */
24
24
  import PropTypes from 'prop-types';
25
25
  const propTypes = {
26
- /**
27
- * the element type to render as
28
- */
29
26
  as: PropTypes.elementType,
30
27
  children: PropTypes.node,
31
-
32
- /**
33
- * Color of the text
34
- */
35
28
  color: PropTypes.oneOf(['primary', 'secondary', 'brand', 'success', 'warning', 'danger', 'alert', 'primary-inverse', 'secondary-inverse']),
36
29
  elementRef: PropTypes.func,
37
30
  fontStyle: PropTypes.oneOf(['italic', 'normal']),
@@ -34,7 +34,7 @@ var _default = {
34
34
  maxExamples: 1000,
35
35
  getComponentProps: props => {
36
36
  return {
37
- children: ['x-small', 'small', 'medium', 'large'].includes(props.size) ? 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor ullamco' : 'Lorem ipsum dolor sit amet, consectetur'
37
+ children: props.size && ['x-small', 'small', 'medium', 'large'].includes(props.size) ? 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor ullamco' : 'Lorem ipsum dolor sit amet, consectetur'
38
38
  };
39
39
  },
40
40
  getExampleProps: props => {
package/lib/Text/index.js CHANGED
@@ -27,6 +27,7 @@ var _dec, _class, _class2, _temp;
27
27
  ---
28
28
  category: components
29
29
  ---
30
+ @tsProps
30
31
  **/
31
32
  let Text = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class Text extends _react.Component {
32
33
  componentDidMount() {
@@ -35,7 +36,7 @@ let Text = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
35
36
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
36
37
  }
37
38
 
38
- componentDidUpdate(prevProps, prevState, snapshot) {
39
+ componentDidUpdate() {
39
40
  var _this$props$makeStyle2, _this$props2;
40
41
 
41
42
  (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
@@ -46,10 +47,13 @@ let Text = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
46
47
 
47
48
  const children = this.props.children;
48
49
  const ElementType = (0, _getElementType.getElementType)(Text, this.props);
49
- return (0, _emotion.jsx)(ElementType, Object.assign({}, (0, _passthroughProps.passthroughProps)(this.props), {
50
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.text,
51
- ref: this.props.elementRef
52
- }), children);
50
+ return (// @ts-expect-error TODO: AsElementType is not compatible for ref
51
+ (0, _emotion.jsx)(ElementType // @ts-expect-error TODO: `ref` prop causes: "Expression produces a union type that is too complex to represent.ts(2590)"
52
+ , Object.assign({}, (0, _passthroughProps.passthroughProps)(this.props), {
53
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.text,
54
+ ref: this.props.elementRef
55
+ }), children)
56
+ );
53
57
  }
54
58
 
55
59
  }, _class2.displayName = "Text", _class2.componentId = 'Text', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
package/lib/Text/props.js CHANGED
@@ -33,15 +33,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
33
33
  * SOFTWARE.
34
34
  */
35
35
  const propTypes = {
36
- /**
37
- * the element type to render as
38
- */
39
36
  as: _propTypes.default.elementType,
40
37
  children: _propTypes.default.node,
41
-
42
- /**
43
- * Color of the text
44
- */
45
38
  color: _propTypes.default.oneOf(['primary', 'secondary', 'brand', 'success', 'warning', 'danger', 'alert', 'primary-inverse', 'secondary-inverse']),
46
39
  elementRef: _propTypes.default.func,
47
40
  fontStyle: _propTypes.default.oneOf(['italic', 'normal']),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-text",
3
- "version": "8.9.2-snapshot.7+1a56581cd",
3
+ "version": "8.10.1-snapshot.8+21f46f4e3",
4
4
  "description": "A component for styling textual content",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "type": "commonjs",
@@ -25,16 +25,16 @@
25
25
  "license": "MIT",
26
26
  "dependencies": {
27
27
  "@babel/runtime": "^7.13.10",
28
- "@instructure/console": "8.9.2-snapshot.7+1a56581cd",
29
- "@instructure/emotion": "8.9.2-snapshot.7+1a56581cd",
30
- "@instructure/shared-types": "8.9.2-snapshot.7+1a56581cd",
31
- "@instructure/ui-react-utils": "8.9.2-snapshot.7+1a56581cd",
28
+ "@instructure/console": "8.10.1-snapshot.8+21f46f4e3",
29
+ "@instructure/emotion": "8.10.1-snapshot.8+21f46f4e3",
30
+ "@instructure/shared-types": "8.10.1-snapshot.8+21f46f4e3",
31
+ "@instructure/ui-react-utils": "8.10.1-snapshot.8+21f46f4e3",
32
32
  "prop-types": "^15"
33
33
  },
34
34
  "devDependencies": {
35
- "@instructure/ui-babel-preset": "8.9.2-snapshot.7+1a56581cd",
36
- "@instructure/ui-test-utils": "8.9.2-snapshot.7+1a56581cd",
37
- "@instructure/ui-themes": "8.9.2-snapshot.7+1a56581cd"
35
+ "@instructure/ui-babel-preset": "8.10.1-snapshot.8+21f46f4e3",
36
+ "@instructure/ui-test-utils": "8.10.1-snapshot.8+21f46f4e3",
37
+ "@instructure/ui-themes": "8.10.1-snapshot.8+21f46f4e3"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "react": ">=16.8 <=17"
@@ -43,5 +43,5 @@
43
43
  "access": "public"
44
44
  },
45
45
  "sideEffects": false,
46
- "gitHead": "1a56581cde6bd3b4f9fe5cd11ae420bd1222fe15"
46
+ "gitHead": "21f46f4e342898b019ab943a7e69a455621d9576"
47
47
  }
@@ -21,21 +21,22 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+ import { TextProps } from '../props'
24
25
 
25
26
  export default {
26
27
  sectionProp: 'weight',
27
28
  maxExamplesPerPage: 50,
28
29
  maxExamples: 1000,
29
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'props' implicitly has an 'any' type.
30
- getComponentProps: (props) => {
30
+ getComponentProps: (props: TextProps) => {
31
31
  return {
32
- children: ['x-small', 'small', 'medium', 'large'].includes(props.size)
33
- ? 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor ullamco'
34
- : 'Lorem ipsum dolor sit amet, consectetur'
32
+ children:
33
+ props.size &&
34
+ ['x-small', 'small', 'medium', 'large'].includes(props.size)
35
+ ? 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor ullamco'
36
+ : 'Lorem ipsum dolor sit amet, consectetur'
35
37
  }
36
38
  },
37
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'props' implicitly has an 'any' type.
38
- getExampleProps: (props) => {
39
+ getExampleProps: (props: TextProps) => {
39
40
  return {
40
41
  background: props?.color?.includes('inverse')
41
42
  ? 'primary-inverse'
@@ -43,8 +44,7 @@ export default {
43
44
  maxWidth: '25rem'
44
45
  }
45
46
  },
46
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'props' implicitly has an 'any' type.
47
- filter: (props) => {
47
+ filter: (props: TextProps) => {
48
48
  return (
49
49
  // Only generate a 1 variation for non-'primary' color
50
50
  (props.color !== 'primary' &&
@@ -37,6 +37,7 @@ import { allowedProps, propTypes } from './props'
37
37
  ---
38
38
  category: components
39
39
  ---
40
+ @tsProps
40
41
  **/
41
42
  @withStyle(generateStyle, generateComponentTheme)
42
43
  class Text extends Component<TextProps> {
@@ -57,8 +58,7 @@ class Text extends Component<TextProps> {
57
58
  this.props.makeStyles?.()
58
59
  }
59
60
 
60
- // @ts-expect-error ts-migrate(6133) FIXME: 'prevProps' is declared but its value is never rea... Remove this comment to see the full error message
61
- componentDidUpdate(prevProps, prevState, snapshot) {
61
+ componentDidUpdate() {
62
62
  this.props.makeStyles?.()
63
63
  }
64
64
 
@@ -68,8 +68,9 @@ class Text extends Component<TextProps> {
68
68
  const ElementType = getElementType(Text, this.props)
69
69
 
70
70
  return (
71
+ // @ts-expect-error TODO: AsElementType is not compatible for ref
71
72
  <ElementType
72
- //@ts-expect-error TODO: `ref` prop causes: "Expression produces a union type that is too complex to represent.ts(2590)"
73
+ // @ts-expect-error TODO: `ref` prop causes: "Expression produces a union type that is too complex to represent.ts(2590)"
73
74
  {...passthroughProps(this.props)}
74
75
  css={this.props.styles?.text}
75
76
  ref={this.props.elementRef}
package/src/Text/props.ts CHANGED
@@ -21,14 +21,25 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+
24
25
  import React from 'react'
25
26
  import PropTypes from 'prop-types'
26
27
 
27
- import type { PropValidators, AsElementType } from '@instructure/shared-types'
28
- import type { WithStyleProps } from '@instructure/emotion'
28
+ import type {
29
+ PropValidators,
30
+ AsElementType,
31
+ TextTheme
32
+ } from '@instructure/shared-types'
33
+ import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
29
34
 
30
35
  type TextOwnProps = {
36
+ /**
37
+ * the element type to render as
38
+ */
31
39
  as?: AsElementType
40
+ /**
41
+ * Color of the text
42
+ */
32
43
  color?:
33
44
  | 'primary'
34
45
  | 'secondary'
@@ -39,7 +50,10 @@ type TextOwnProps = {
39
50
  | 'alert'
40
51
  | 'primary-inverse'
41
52
  | 'secondary-inverse'
42
- elementRef?: (...args: any[]) => any
53
+ /**
54
+ * Provides a reference to the underlying HTML element
55
+ */
56
+ elementRef?: (element: HTMLElement | null) => void
43
57
  fontStyle?: 'italic' | 'normal'
44
58
  letterSpacing?: 'normal' | 'condensed' | 'expanded'
45
59
  lineHeight?: 'default' | 'fit' | 'condensed' | 'double'
@@ -54,17 +68,13 @@ type PropKeys = keyof TextOwnProps
54
68
 
55
69
  type AllowedPropKeys = Readonly<Array<PropKeys>>
56
70
 
57
- type TextProps = TextOwnProps & WithStyleProps
71
+ type TextProps = TextOwnProps & WithStyleProps<TextTheme, TextStyle>
72
+
73
+ type TextStyle = ComponentStyle<'text'>
58
74
 
59
75
  const propTypes: PropValidators<PropKeys> = {
60
- /**
61
- * the element type to render as
62
- */
63
76
  as: PropTypes.elementType,
64
77
  children: PropTypes.node,
65
- /**
66
- * Color of the text
67
- */
68
78
  color: PropTypes.oneOf([
69
79
  'primary',
70
80
  'secondary',
@@ -107,5 +117,5 @@ const allowedProps: AllowedPropKeys = [
107
117
  'wrap'
108
118
  ]
109
119
 
110
- export type { TextProps }
120
+ export type { TextProps, TextStyle }
111
121
  export { propTypes, allowedProps }
@@ -22,8 +22,8 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import { TextTheme } from '@instructure/shared-types'
26
- import { TextProps } from './props'
25
+ import type { TextTheme } from '@instructure/shared-types'
26
+ import type { TextProps, TextStyle } from './props'
27
27
 
28
28
  /**
29
29
  * ---
@@ -35,7 +35,10 @@ import { TextProps } from './props'
35
35
  * @param {Object} state the state of the component, the style is applied to
36
36
  * @return {Object} The final style object, which will be used in the component
37
37
  */
38
- const generateStyle = (componentTheme: TextTheme, props: TextProps) => {
38
+ const generateStyle = (
39
+ componentTheme: TextTheme,
40
+ props: TextProps
41
+ ): TextStyle => {
39
42
  const {
40
43
  size,
41
44
  wrap,
@@ -1,15 +1,16 @@
1
+ import { TextProps } from '../props';
1
2
  declare const _default: {
2
3
  sectionProp: string;
3
4
  maxExamplesPerPage: number;
4
5
  maxExamples: number;
5
- getComponentProps: (props: any) => {
6
+ getComponentProps: (props: TextProps) => {
6
7
  children: string;
7
8
  };
8
- getExampleProps: (props: any) => {
9
+ getExampleProps: (props: TextProps) => {
9
10
  background: string;
10
11
  maxWidth: string;
11
12
  };
12
- filter: (props: any) => boolean;
13
+ filter: (props: TextProps) => boolean;
13
14
  };
14
15
  export default _default;
15
16
  //# sourceMappingURL=Text.examples.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Text.examples.d.ts","sourceRoot":"","sources":["../../../src/Text/__examples__/Text.examples.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAwBA,wBA2CC"}
1
+ {"version":3,"file":"Text.examples.d.ts","sourceRoot":"","sources":["../../../src/Text/__examples__/Text.examples.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;;;;;+BAMP,SAAS;;;6BASX,SAAS;;;;oBAQlB,SAAS;;AArB3B,wBA0CC"}
@@ -6,13 +6,14 @@ import type { TextProps } from './props';
6
6
  ---
7
7
  category: components
8
8
  ---
9
+ @tsProps
9
10
  **/
10
11
  declare class Text extends Component<TextProps> {
11
12
  static readonly componentId = "Text";
12
13
  static allowedProps: readonly (keyof {
13
14
  as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
14
15
  color?: "primary" | "secondary" | "brand" | "success" | "warning" | "danger" | "alert" | "primary-inverse" | "secondary-inverse" | undefined;
15
- elementRef?: ((...args: any[]) => any) | undefined;
16
+ elementRef?: ((element: HTMLElement | null) => void) | undefined;
16
17
  fontStyle?: "italic" | "normal" | undefined;
17
18
  letterSpacing?: "normal" | "condensed" | "expanded" | undefined;
18
19
  lineHeight?: "condensed" | "default" | "fit" | "double" | undefined;
@@ -25,7 +26,7 @@ declare class Text extends Component<TextProps> {
25
26
  static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
26
27
  as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
27
28
  color?: "primary" | "secondary" | "brand" | "success" | "warning" | "danger" | "alert" | "primary-inverse" | "secondary-inverse" | undefined;
28
- elementRef?: ((...args: any[]) => any) | undefined;
29
+ elementRef?: ((element: HTMLElement | null) => void) | undefined;
29
30
  fontStyle?: "italic" | "normal" | undefined;
30
31
  letterSpacing?: "normal" | "condensed" | "expanded" | undefined;
31
32
  lineHeight?: "condensed" | "default" | "fit" | "double" | undefined;
@@ -43,7 +44,7 @@ declare class Text extends Component<TextProps> {
43
44
  readonly children: null;
44
45
  };
45
46
  componentDidMount(): void;
46
- componentDidUpdate(prevProps: any, prevState: any, snapshot: any): void;
47
+ componentDidUpdate(): void;
47
48
  render(): jsx.JSX.Element;
48
49
  }
49
50
  export default Text;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Text/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAGrD,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;IAClC,MAAM,CAAC,SAAS;;;;;;;;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY;;;;;;MAMT;IAEV,iBAAiB;IAKjB,kBAAkB,CAAC,SAAS,KAAA,EAAE,SAAS,KAAA,EAAE,QAAQ,KAAA;IAIjD,MAAM;CAgBP;AAED,eAAe,IAAI,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Text/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAGrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGxC;;;;;GAKG;AACH,cACM,IAAK,SAAQ,SAAS,CAAC,SAAS,CAAC;IACrC,MAAM,CAAC,QAAQ,CAAC,WAAW,UAAS;IAEpC,MAAM,CAAC,YAAY;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;;;;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY;;;;;;MAMT;IAEV,iBAAiB;IAIjB,kBAAkB;IAIlB,MAAM;CAiBP;AAED,eAAe,IAAI,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -1,10 +1,19 @@
1
1
  import React from 'react';
2
- import type { PropValidators, AsElementType } from '@instructure/shared-types';
3
- import type { WithStyleProps } from '@instructure/emotion';
2
+ import type { PropValidators, AsElementType, TextTheme } from '@instructure/shared-types';
3
+ import type { WithStyleProps, ComponentStyle } from '@instructure/emotion';
4
4
  declare type TextOwnProps = {
5
+ /**
6
+ * the element type to render as
7
+ */
5
8
  as?: AsElementType;
9
+ /**
10
+ * Color of the text
11
+ */
6
12
  color?: 'primary' | 'secondary' | 'brand' | 'success' | 'warning' | 'danger' | 'alert' | 'primary-inverse' | 'secondary-inverse';
7
- elementRef?: (...args: any[]) => any;
13
+ /**
14
+ * Provides a reference to the underlying HTML element
15
+ */
16
+ elementRef?: (element: HTMLElement | null) => void;
8
17
  fontStyle?: 'italic' | 'normal';
9
18
  letterSpacing?: 'normal' | 'condensed' | 'expanded';
10
19
  lineHeight?: 'default' | 'fit' | 'condensed' | 'double';
@@ -16,9 +25,10 @@ declare type TextOwnProps = {
16
25
  };
17
26
  declare type PropKeys = keyof TextOwnProps;
18
27
  declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
19
- declare type TextProps = TextOwnProps & WithStyleProps;
28
+ declare type TextProps = TextOwnProps & WithStyleProps<TextTheme, TextStyle>;
29
+ declare type TextStyle = ComponentStyle<'text'>;
20
30
  declare const propTypes: PropValidators<PropKeys>;
21
31
  declare const allowedProps: AllowedPropKeys;
22
- export type { TextProps };
32
+ export type { TextProps, TextStyle };
23
33
  export { propTypes, allowedProps };
24
34
  //# sourceMappingURL=props.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Text/props.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,aAAK,YAAY,GAAG;IAClB,EAAE,CAAC,EAAE,aAAa,CAAA;IAClB,KAAK,CAAC,EACF,SAAS,GACT,WAAW,GACX,OAAO,GACP,SAAS,GACT,SAAS,GACT,QAAQ,GACR,OAAO,GACP,iBAAiB,GACjB,mBAAmB,CAAA;IACvB,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACpC,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC/B,aAAa,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,UAAU,CAAA;IACnD,UAAU,CAAC,EAAE,SAAS,GAAG,KAAK,GAAG,WAAW,GAAG,QAAQ,CAAA;IACvD,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAA;IACxE,SAAS,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,WAAW,GAAG,WAAW,CAAA;IAC7D,MAAM,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;IACpC,IAAI,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAA;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AAED,aAAK,QAAQ,GAAG,MAAM,YAAY,CAAA;AAElC,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,SAAS,GAAG,YAAY,GAAG,cAAc,CAAA;AAE9C,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAmCvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAYnB,CAAA;AAED,YAAY,EAAE,SAAS,EAAE,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Text/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,SAAS,EACV,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1E,aAAK,YAAY,GAAG;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE,aAAa,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EACF,SAAS,GACT,WAAW,GACX,OAAO,GACP,SAAS,GACT,SAAS,GACT,QAAQ,GACR,OAAO,GACP,iBAAiB,GACjB,mBAAmB,CAAA;IACvB;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAA;IAClD,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC/B,aAAa,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,UAAU,CAAA;IACnD,UAAU,CAAC,EAAE,SAAS,GAAG,KAAK,GAAG,WAAW,GAAG,QAAQ,CAAA;IACvD,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAA;IACxE,SAAS,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,WAAW,GAAG,WAAW,CAAA;IAC7D,MAAM,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;IACpC,IAAI,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAA;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AAED,aAAK,QAAQ,GAAG,MAAM,YAAY,CAAA;AAElC,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,SAAS,GAAG,YAAY,GAAG,cAAc,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;AAEpE,aAAK,SAAS,GAAG,cAAc,CAAC,MAAM,CAAC,CAAA;AAEvC,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CA6BvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAYnB,CAAA;AAED,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
@@ -1,5 +1,5 @@
1
- import { TextTheme } from '@instructure/shared-types';
2
- import { TextProps } from './props';
1
+ import type { TextTheme } from '@instructure/shared-types';
2
+ import type { TextProps, TextStyle } from './props';
3
3
  /**
4
4
  * ---
5
5
  * private: true
@@ -10,107 +10,6 @@ import { TextProps } from './props';
10
10
  * @param {Object} state the state of the component, the style is applied to
11
11
  * @return {Object} The final style object, which will be used in the component
12
12
  */
13
- declare const generateStyle: (componentTheme: TextTheme, props: TextProps) => {
14
- text: {
15
- '&:is(input)[type]': {
16
- outline: number;
17
- appearance: string;
18
- boxSizing: string;
19
- background: string;
20
- border: string;
21
- borderRadius: number;
22
- padding: number;
23
- margin: number;
24
- color: string;
25
- height: string;
26
- width: string;
27
- lineHeight: string;
28
- textAlign: string;
29
- boxShadow: string;
30
- display: string;
31
- textTransform?: "none" | "capitalize" | "uppercase" | "lowercase" | undefined;
32
- letterSpacing: string | number;
33
- fontSize: string | 0;
34
- fontStyle?: "italic" | "normal" | undefined;
35
- fontWeight?: number | undefined;
36
- overflowWrap?: string | undefined;
37
- wordBreak?: string | undefined;
38
- hyphens?: string | undefined;
39
- '&:focus': {
40
- outline: string;
41
- };
42
- };
43
- '&:-webkit-any(input)[type]': {
44
- outline: number;
45
- appearance: string;
46
- boxSizing: string;
47
- background: string;
48
- border: string;
49
- borderRadius: number;
50
- padding: number;
51
- margin: number;
52
- color: string;
53
- height: string;
54
- width: string;
55
- lineHeight: string;
56
- textAlign: string;
57
- boxShadow: string;
58
- display: string;
59
- textTransform?: "none" | "capitalize" | "uppercase" | "lowercase" | undefined;
60
- letterSpacing: string | number;
61
- fontSize: string | 0;
62
- fontStyle?: "italic" | "normal" | undefined;
63
- fontWeight?: number | undefined;
64
- overflowWrap?: string | undefined;
65
- wordBreak?: string | undefined;
66
- hyphens?: string | undefined;
67
- '&:focus': {
68
- outline: string;
69
- };
70
- };
71
- 'sub, sup': {
72
- fontSize: string;
73
- lineHeight: number;
74
- position: string;
75
- verticalAlign: string;
76
- };
77
- sup: {
78
- top: string;
79
- };
80
- sub: {
81
- bottom: string;
82
- };
83
- 'pre, code': {
84
- all: string;
85
- fontFamily: string;
86
- };
87
- 'i, em': {
88
- fontStyle: string;
89
- };
90
- 'b, strong': {
91
- fontWeight: number;
92
- };
93
- p: {
94
- display: string;
95
- padding: number;
96
- margin: string | 0;
97
- };
98
- textTransform?: "none" | "capitalize" | "uppercase" | "lowercase" | undefined;
99
- letterSpacing: string | number;
100
- lineHeight?: string | number | undefined;
101
- fontSize: string | 0;
102
- fontStyle?: "italic" | "normal" | undefined;
103
- fontWeight?: number | undefined;
104
- overflowWrap?: string | undefined;
105
- wordBreak?: string | undefined;
106
- hyphens?: string | undefined;
107
- color?: string | undefined;
108
- '&:focus': {
109
- outline: string;
110
- };
111
- label: string;
112
- fontFamily: string;
113
- };
114
- };
13
+ declare const generateStyle: (componentTheme: TextTheme, props: TextProps) => TextStyle;
115
14
  export default generateStyle;
116
15
  //# sourceMappingURL=styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/Text/styles.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC;;;;;;;;;GASG;AACH,QAAA,MAAM,aAAa,mBAAoB,SAAS,SAAS,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkIjE,CAAA;AAED,eAAe,aAAa,CAAA"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/Text/styles.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnD;;;;;;;;;GASG;AACH,QAAA,MAAM,aAAa,mBACD,SAAS,SAClB,SAAS,KACf,SAkIF,CAAA;AAED,eAAe,aAAa,CAAA"}