@instructure/ui-table 8.8.1-snapshot.3 → 8.9.0

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.
Files changed (113) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/es/Table/Body/index.js +17 -29
  3. package/{src/Table/Cell/types.ts → es/Table/Body/props.js} +14 -8
  4. package/es/Table/Cell/index.js +17 -29
  5. package/{src/Table/types.ts → es/Table/Cell/props.js} +12 -11
  6. package/es/Table/ColHeader/index.js +22 -63
  7. package/es/Table/ColHeader/props.js +66 -0
  8. package/es/Table/Head/index.js +18 -29
  9. package/{src/Table/Body/types.ts → es/Table/Head/props.js} +13 -8
  10. package/es/Table/Row/index.js +17 -29
  11. package/{src/Table/ColHeader/types.ts → es/Table/Row/props.js} +16 -12
  12. package/es/Table/RowHeader/index.js +16 -27
  13. package/{src/Table/Head/types.ts → es/Table/RowHeader/props.js} +11 -6
  14. package/es/Table/index.js +23 -62
  15. package/es/Table/props.js +66 -0
  16. package/lib/Table/Body/index.js +17 -30
  17. package/lib/Table/Body/props.js +50 -0
  18. package/lib/Table/Cell/index.js +17 -29
  19. package/lib/Table/Cell/props.js +47 -0
  20. package/lib/Table/ColHeader/index.js +22 -63
  21. package/lib/Table/ColHeader/props.js +77 -0
  22. package/lib/Table/Head/index.js +18 -30
  23. package/lib/Table/Head/props.js +49 -0
  24. package/lib/Table/Row/index.js +17 -30
  25. package/lib/Table/Row/props.js +54 -0
  26. package/lib/Table/RowHeader/index.js +16 -27
  27. package/lib/Table/RowHeader/props.js +46 -0
  28. package/lib/Table/index.js +22 -62
  29. package/lib/Table/props.js +81 -0
  30. package/package.json +17 -18
  31. package/src/Table/Body/index.tsx +8 -26
  32. package/src/Table/{Row/types.ts → Body/props.ts} +39 -3
  33. package/src/Table/Cell/index.tsx +9 -25
  34. package/src/Table/Cell/props.ts +62 -0
  35. package/src/Table/Cell/styles.ts +1 -1
  36. package/src/Table/ColHeader/index.tsx +9 -51
  37. package/src/Table/ColHeader/props.ts +94 -0
  38. package/src/Table/ColHeader/styles.ts +1 -1
  39. package/src/Table/Head/index.tsx +8 -24
  40. package/src/Table/Head/props.ts +62 -0
  41. package/src/Table/Row/index.tsx +9 -28
  42. package/src/Table/Row/props.ts +70 -0
  43. package/src/Table/Row/styles.ts +1 -1
  44. package/src/Table/RowHeader/index.tsx +9 -24
  45. package/src/Table/RowHeader/{types.ts → props.ts} +28 -3
  46. package/src/Table/RowHeader/styles.ts +1 -1
  47. package/src/Table/index.tsx +12 -51
  48. package/src/Table/props.ts +93 -0
  49. package/src/Table/styles.ts +1 -1
  50. package/src/index.ts +7 -7
  51. package/types/Table/Body/index.d.ts +13 -16
  52. package/types/Table/Body/index.d.ts.map +1 -1
  53. package/types/Table/Body/props.d.ts +17 -0
  54. package/types/Table/Body/props.d.ts.map +1 -0
  55. package/types/Table/Cell/index.d.ts +14 -14
  56. package/types/Table/Cell/index.d.ts.map +1 -1
  57. package/types/Table/Cell/props.d.ts +17 -0
  58. package/types/Table/Cell/props.d.ts.map +1 -0
  59. package/types/Table/Cell/styles.d.ts +1 -1
  60. package/types/Table/ColHeader/index.d.ts +22 -40
  61. package/types/Table/ColHeader/index.d.ts.map +1 -1
  62. package/types/Table/ColHeader/props.d.ts +21 -0
  63. package/types/Table/ColHeader/props.d.ts.map +1 -0
  64. package/types/Table/ColHeader/styles.d.ts +1 -1
  65. package/types/Table/Head/index.d.ts +11 -15
  66. package/types/Table/Head/index.d.ts.map +1 -1
  67. package/types/Table/Head/props.d.ts +16 -0
  68. package/types/Table/Head/props.d.ts.map +1 -0
  69. package/types/Table/Row/index.d.ts +14 -17
  70. package/types/Table/Row/index.d.ts.map +1 -1
  71. package/types/Table/Row/props.d.ts +17 -0
  72. package/types/Table/Row/props.d.ts.map +1 -0
  73. package/types/Table/Row/styles.d.ts +1 -1
  74. package/types/Table/RowHeader/index.d.ts +12 -13
  75. package/types/Table/RowHeader/index.d.ts.map +1 -1
  76. package/types/Table/RowHeader/props.d.ts +16 -0
  77. package/types/Table/RowHeader/props.d.ts.map +1 -0
  78. package/types/Table/RowHeader/styles.d.ts +1 -1
  79. package/types/Table/index.d.ts +18 -41
  80. package/types/Table/index.d.ts.map +1 -1
  81. package/types/Table/props.d.ts +19 -0
  82. package/types/Table/props.d.ts.map +1 -0
  83. package/types/Table/styles.d.ts +1 -1
  84. package/types/index.d.ts +7 -7
  85. package/LICENSE.md +0 -27
  86. package/es/Table/Body/types.js +0 -1
  87. package/es/Table/Cell/types.js +0 -1
  88. package/es/Table/ColHeader/types.js +0 -1
  89. package/es/Table/Head/types.js +0 -1
  90. package/es/Table/Row/types.js +0 -1
  91. package/es/Table/RowHeader/types.js +0 -1
  92. package/es/Table/types.js +0 -1
  93. package/lib/Table/Body/types.js +0 -1
  94. package/lib/Table/Cell/types.js +0 -1
  95. package/lib/Table/ColHeader/types.js +0 -1
  96. package/lib/Table/Head/types.js +0 -1
  97. package/lib/Table/Row/types.js +0 -1
  98. package/lib/Table/RowHeader/types.js +0 -1
  99. package/lib/Table/types.js +0 -1
  100. package/types/Table/Body/types.d.ts +0 -9
  101. package/types/Table/Body/types.d.ts.map +0 -1
  102. package/types/Table/Cell/types.d.ts +0 -9
  103. package/types/Table/Cell/types.d.ts.map +0 -1
  104. package/types/Table/ColHeader/types.d.ts +0 -12
  105. package/types/Table/ColHeader/types.d.ts.map +0 -1
  106. package/types/Table/Head/types.d.ts +0 -8
  107. package/types/Table/Head/types.d.ts.map +0 -1
  108. package/types/Table/Row/types.d.ts +0 -9
  109. package/types/Table/Row/types.d.ts.map +0 -1
  110. package/types/Table/RowHeader/types.d.ts +0 -7
  111. package/types/Table/RowHeader/types.d.ts.map +0 -1
  112. package/types/Table/types.d.ts +0 -12
  113. package/types/Table/types.d.ts.map +0 -1
@@ -22,9 +22,34 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- export type TableRowHeaderProps = {
26
- makeStyles?: (...args: any[]) => any
27
- styles?: any
25
+ import React from 'react'
26
+ import PropTypes from 'prop-types'
27
+
28
+ import type { PropValidators } from '@instructure/shared-types'
29
+ import type { WithStyleProps } from '@instructure/emotion'
30
+
31
+ type TableRowHeaderOwnProps = {
28
32
  isStacked?: boolean
29
33
  textAlign?: 'start' | 'center' | 'end'
34
+ children?: React.ReactNode | ((...args: any[]) => React.ReactNode)
30
35
  }
36
+
37
+ type PropKeys = keyof TableRowHeaderOwnProps
38
+
39
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
40
+
41
+ type TableRowHeaderProps = TableRowHeaderOwnProps & WithStyleProps
42
+
43
+ const propTypes: PropValidators<PropKeys> = {
44
+ children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
45
+ isStacked: PropTypes.bool,
46
+ /**
47
+ * Control the text alignment in row header
48
+ */
49
+ textAlign: PropTypes.oneOf(['start', 'center', 'end'])
50
+ }
51
+
52
+ const allowedProps: AllowedPropKeys = ['children', 'isStacked', 'textAlign']
53
+
54
+ export type { TableRowHeaderProps }
55
+ export { propTypes, allowedProps }
@@ -23,7 +23,7 @@
23
23
  */
24
24
 
25
25
  import { TableRowHeaderTheme } from '@instructure/shared-types'
26
- import { TableRowHeaderProps } from './types'
26
+ import { TableRowHeaderProps } from './props'
27
27
 
28
28
  /**
29
29
  * ---
@@ -24,18 +24,16 @@
24
24
 
25
25
  /** @jsx jsx */
26
26
  import { Component, Children, ReactElement } from 'react'
27
- import PropTypes from 'prop-types'
28
27
 
29
28
  import {
30
29
  matchComponentTypes,
31
30
  safeCloneElement,
32
31
  omitProps
33
32
  } from '@instructure/ui-react-utils'
34
- import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types'
35
33
  import { View } from '@instructure/ui-view'
36
34
  import { ScreenReaderContent } from '@instructure/ui-a11y-content'
37
35
 
38
- import { withStyle, jsx, ThemeablePropTypes } from '@instructure/emotion'
36
+ import { withStyle, jsx } from '@instructure/emotion'
39
37
 
40
38
  import generateStyle from './styles'
41
39
  import generateComponentTheme from './theme'
@@ -46,7 +44,8 @@ import { Row } from './Row'
46
44
  import { ColHeader } from './ColHeader'
47
45
  import { RowHeader } from './RowHeader'
48
46
  import { Cell } from './Cell'
49
- import { TableProps } from './types'
47
+ import type { TableProps } from './props'
48
+ import { allowedProps, propTypes } from './props'
50
49
 
51
50
  /**
52
51
  ---
@@ -57,48 +56,13 @@ category: components
57
56
  class Table extends Component<TableProps> {
58
57
  static readonly componentId = 'Table'
59
58
 
60
- static propTypes = {
61
- // eslint-disable-next-line react/require-default-props
62
- makeStyles: PropTypes.func,
63
- // eslint-disable-next-line react/require-default-props
64
- styles: PropTypes.object,
65
- /**
66
- * Provide a screen reader friendly description. Anything passed to this
67
- * prop will be wrapped by `<ScreenReaderContent>` when it is rendered.
68
- */
69
- caption: PropTypes.node.isRequired,
70
- /**
71
- * Build table via `Table.Head` and `Table.Body`
72
- */
73
- children: ChildrenPropTypes.oneOf([Head, Body]),
74
- /**
75
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
76
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
77
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
78
- */
79
- margin: ThemeablePropTypes.spacing,
80
- /**
81
- * Provide a reference to the underlying html element
82
- */
83
- elementRef: PropTypes.func,
84
- /**
85
- * Highlight each row on hover
86
- */
87
- hover: PropTypes.bool,
88
- /**
89
- * `auto` lets the browser determine table column widths based on cell content,
90
- * while `fixed` forces columns of equal width. `stacked` renders table in one
91
- * column to be more readable on narrow screens
92
- */
93
- layout: PropTypes.oneOf(['auto', 'fixed', 'stacked'])
94
- }
59
+ static allowedProps = allowedProps
60
+ static propTypes = propTypes
95
61
 
96
62
  static defaultProps = {
97
63
  children: null,
98
64
  hover: false,
99
- layout: 'auto',
100
- margin: undefined,
101
- elementRef: undefined
65
+ layout: 'auto'
102
66
  }
103
67
 
104
68
  static Head = Head
@@ -109,14 +73,11 @@ class Table extends Component<TableProps> {
109
73
  static Cell = Cell
110
74
 
111
75
  componentDidMount() {
112
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
113
- this.props.makeStyles()
76
+ this.props.makeStyles?.()
114
77
  }
115
78
 
116
- // @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
117
- componentDidUpdate(prevProps, prevState, snapshot) {
118
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
119
- this.props.makeStyles()
79
+ componentDidUpdate() {
80
+ this.props.makeStyles?.()
120
81
  }
121
82
 
122
83
  getHeaders() {
@@ -158,9 +119,9 @@ class Table extends Component<TableProps> {
158
119
  as={isStacked ? 'div' : 'table'}
159
120
  margin={margin}
160
121
  elementRef={elementRef}
161
- css={styles.table}
162
- role={isStacked ? 'table' : null}
163
- aria-label={isStacked ? (caption as string) : null}
122
+ css={styles?.table}
123
+ role={isStacked ? 'table' : undefined}
124
+ aria-label={isStacked ? (caption as string) : undefined}
164
125
  >
165
126
  {!isStacked && (
166
127
  <caption>
@@ -0,0 +1,93 @@
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
+ import React from 'react'
25
+ import PropTypes from 'prop-types'
26
+
27
+ import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types'
28
+ import { ThemeablePropTypes } from '@instructure/emotion'
29
+
30
+ import { Head } from './Head'
31
+ import { Body } from './Body'
32
+
33
+ import type { Spacing, WithStyleProps } from '@instructure/emotion'
34
+ import type { PropValidators } from '@instructure/shared-types'
35
+
36
+ type TableOwnProps = {
37
+ caption: React.ReactNode
38
+ margin?: Spacing
39
+ elementRef?: (...args: any[]) => any
40
+ hover?: boolean
41
+ layout?: 'auto' | 'fixed' | 'stacked'
42
+ children?: React.ReactNode
43
+ }
44
+
45
+ type PropKeys = keyof TableOwnProps
46
+
47
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
48
+
49
+ type TableProps = TableOwnProps & WithStyleProps
50
+
51
+ const propTypes: PropValidators<PropKeys> = {
52
+ /**
53
+ * Provide a screen reader friendly description. Anything passed to this
54
+ * prop will be wrapped by `<ScreenReaderContent>` when it is rendered.
55
+ */
56
+ caption: PropTypes.node.isRequired,
57
+ /**
58
+ * Build table via `Table.Head` and `Table.Body`
59
+ */
60
+ children: ChildrenPropTypes.oneOf([Head, Body]),
61
+ /**
62
+ * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
63
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
64
+ * familiar CSS-like shorthand. For example: `margin="small auto large"`.
65
+ */
66
+ margin: ThemeablePropTypes.spacing,
67
+ /**
68
+ * Provide a reference to the underlying html element
69
+ */
70
+ elementRef: PropTypes.func,
71
+ /**
72
+ * Highlight each row on hover
73
+ */
74
+ hover: PropTypes.bool,
75
+ /**
76
+ * `auto` lets the browser determine table column widths based on cell content,
77
+ * while `fixed` forces columns of equal width. `stacked` renders table in one
78
+ * column to be more readable on narrow screens
79
+ */
80
+ layout: PropTypes.oneOf(['auto', 'fixed', 'stacked'])
81
+ }
82
+
83
+ const allowedProps: AllowedPropKeys = [
84
+ 'caption',
85
+ 'children',
86
+ 'margin',
87
+ 'elementRef',
88
+ 'hover',
89
+ 'layout'
90
+ ]
91
+
92
+ export type { TableProps }
93
+ export { propTypes, allowedProps }
@@ -23,7 +23,7 @@
23
23
  */
24
24
 
25
25
  import { TableTheme } from '@instructure/shared-types'
26
- import { TableProps } from './types'
26
+ import { TableProps } from './props'
27
27
 
28
28
  /**
29
29
  * ---
package/src/index.ts CHANGED
@@ -23,10 +23,10 @@
23
23
  */
24
24
  export { Table } from './Table'
25
25
 
26
- export type { TableProps } from './Table/types'
27
- export type { TableBodyProps } from './Table/Body/types'
28
- export type { TableCellProps } from './Table/Cell/types'
29
- export type { TableColHeaderProps } from './Table/ColHeader/types'
30
- export type { TableHeadProps } from './Table/Head/types'
31
- export type { TableRowProps } from './Table/Row/types'
32
- export type { TableRowHeaderProps } from './Table/RowHeader/types'
26
+ export type { TableProps } from './Table/props'
27
+ export type { TableBodyProps } from './Table/Body/props'
28
+ export type { TableCellProps } from './Table/Cell/props'
29
+ export type { TableColHeaderProps } from './Table/ColHeader/props'
30
+ export type { TableHeadProps } from './Table/Head/props'
31
+ export type { TableRowProps } from './Table/Row/props'
32
+ export type { TableRowHeaderProps } from './Table/RowHeader/props'
@@ -1,8 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { Component } from 'react';
3
- import PropTypes from 'prop-types';
4
3
  import { jsx } from '@instructure/emotion';
5
- import { TableBodyProps } from './types';
4
+ import type { TableBodyProps } from './props';
6
5
  /**
7
6
  ---
8
7
  parent: Table
@@ -11,20 +10,18 @@ id: Table.Body
11
10
  **/
12
11
  declare class Body extends Component<TableBodyProps> {
13
12
  static readonly componentId = "Table.Body";
14
- static propTypes: {
15
- /**
16
- * `Table.Row`
17
- */
18
- makeStyles: PropTypes.Requireable<(...args: any[]) => any>;
19
- styles: PropTypes.Requireable<object>;
20
- children: {
21
- (props: Record<string, any>, propName: string, componentName: string): Error | null;
22
- isRequired: (props: Record<string, any>, propName: string, componentName: string, location?: string | undefined, propFullName?: string | undefined) => Error | null;
23
- };
24
- hover: PropTypes.Requireable<boolean>;
25
- isStacked: PropTypes.Requireable<boolean>;
26
- headers: PropTypes.Requireable<(string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray | null | undefined)[]>;
27
- };
13
+ static allowedProps: readonly (keyof {
14
+ hover?: boolean | undefined;
15
+ isStacked?: boolean | undefined;
16
+ headers?: (import("react").ReactNode | ((...args: any[]) => any))[] | undefined;
17
+ children?: import("react").ReactNode;
18
+ })[];
19
+ static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
20
+ hover?: boolean | undefined;
21
+ isStacked?: boolean | undefined;
22
+ headers?: (import("react").ReactNode | ((...args: any[]) => any))[] | undefined;
23
+ children?: import("react").ReactNode;
24
+ }>;
28
25
  static defaultProps: {
29
26
  children: null;
30
27
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Table/Body/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAA0B,MAAM,OAAO,CAAA;AACzD,OAAO,SAAS,MAAM,YAAY,CAAA;AASlC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAKrD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAExC;;;;;GAKG;AACH,cACM,IAAK,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC1C,MAAM,CAAC,QAAQ,CAAC,WAAW,gBAAe;IAG1C,MAAM,CAAC,SAAS;QACd;;WAEG;;;;;;;;;;MAWJ;IAGD,MAAM,CAAC,YAAY;;MAElB;IAED,iBAAiB;IAMjB,kBAAkB,CAAC,SAAS,KAAA,EAAE,SAAS,KAAA,EAAE,QAAQ,KAAA;IAKjD,MAAM;CAwBP;AAED,eAAe,IAAI,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Table/Body/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAA0B,MAAM,OAAO,CAAA;AAQzD,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAKrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAG7C;;;;;GAKG;AACH,cACM,IAAK,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC1C,MAAM,CAAC,QAAQ,CAAC,WAAW,gBAAe;IAE1C,MAAM,CAAC,YAAY;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY;;MAElB;IAED,iBAAiB;IAKjB,kBAAkB,CAAC,SAAS,KAAA,EAAE,SAAS,KAAA,EAAE,QAAQ,KAAA;IAIjD,MAAM;CAwBP;AAED,eAAe,IAAI,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import type { PropValidators } from '@instructure/shared-types';
3
+ import type { WithStyleProps } from '@instructure/emotion';
4
+ declare type TableBodyOwnProps = {
5
+ hover?: boolean;
6
+ isStacked?: boolean;
7
+ headers?: (React.ReactNode | ((...args: any[]) => any))[];
8
+ children?: React.ReactNode;
9
+ };
10
+ declare type PropKeys = keyof TableBodyOwnProps;
11
+ declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
12
+ declare type TableBodyProps = TableBodyOwnProps & WithStyleProps;
13
+ declare const propTypes: PropValidators<PropKeys>;
14
+ declare const allowedProps: AllowedPropKeys;
15
+ export type { TableBodyProps };
16
+ export { propTypes, allowedProps };
17
+ //# sourceMappingURL=props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/Table/Body/props.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,aAAK,iBAAiB,GAAG;IACvB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC,EAAE,CAAA;IACzD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AAED,aAAK,QAAQ,GAAG,MAAM,iBAAiB,CAAA;AAEvC,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,cAAc,GAAG,iBAAiB,GAAG,cAAc,CAAA;AAExD,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAUvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAKnB,CAAA;AAED,YAAY,EAAE,cAAc,EAAE,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
@@ -1,8 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { Component } from 'react';
3
- import PropTypes from 'prop-types';
4
3
  import { jsx } from '@instructure/emotion';
5
- import { TableCellProps } from './types';
4
+ import type { TableCellProps } from './props';
6
5
  /**
7
6
  ---
8
7
  parent: Table
@@ -11,23 +10,24 @@ id: Table.Cell
11
10
  **/
12
11
  declare class Cell extends Component<TableCellProps> {
13
12
  static readonly componentId = "Table.Cell";
14
- static propTypes: {
15
- makeStyles: PropTypes.Requireable<(...args: any[]) => any>;
16
- styles: PropTypes.Requireable<object>;
17
- children: PropTypes.Requireable<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
18
- isStacked: PropTypes.Requireable<boolean>;
19
- header: PropTypes.Requireable<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
20
- /**
21
- * Control the text alignment in cell
22
- */
23
- textAlign: PropTypes.Requireable<string>;
24
- };
13
+ static allowedProps: readonly (keyof {
14
+ isStacked?: boolean | undefined;
15
+ header?: import("react").ReactNode | ((...args: any[]) => any);
16
+ textAlign?: "start" | "center" | "end" | undefined;
17
+ children?: import("react").ReactNode | ((...args: any[]) => import("react").ReactNode);
18
+ })[];
19
+ static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
20
+ isStacked?: boolean | undefined;
21
+ header?: import("react").ReactNode | ((...args: any[]) => any);
22
+ textAlign?: "start" | "center" | "end" | undefined;
23
+ children?: import("react").ReactNode | ((...args: any[]) => import("react").ReactNode);
24
+ }>;
25
25
  static defaultProps: {
26
26
  textAlign: string;
27
27
  children: null;
28
28
  };
29
29
  componentDidMount(): void;
30
- componentDidUpdate(prevProps: any, prevState: any, snapshot: any): void;
30
+ componentDidUpdate(): void;
31
31
  render(): jsx.JSX.Element;
32
32
  }
33
33
  export default Cell;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Table/Cell/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,SAAS,MAAM,YAAY,CAAA;AAKlC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAIrD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAExC;;;;;GAKG;AACH,cACM,IAAK,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC1C,MAAM,CAAC,QAAQ,CAAC,WAAW,gBAAe;IAG1C,MAAM,CAAC,SAAS;;;;;;QAQd;;WAEG;;MAEJ;IAGD,MAAM,CAAC,YAAY;;;MAGlB;IAED,iBAAiB;IAMjB,kBAAkB,CAAC,SAAS,KAAA,EAAE,SAAS,KAAA,EAAE,QAAQ,KAAA;IAKjD,MAAM;CAgBP;AAED,eAAe,IAAI,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Table/Cell/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAIrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAG7C;;;;;GAKG;AACH,cACM,IAAK,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC1C,MAAM,CAAC,QAAQ,CAAC,WAAW,gBAAe;IAE1C,MAAM,CAAC,YAAY;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY;;;MAGlB;IAED,iBAAiB;IAIjB,kBAAkB;IAIlB,MAAM;CAgBP;AAED,eAAe,IAAI,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import type { WithStyleProps } from '@instructure/emotion';
3
+ import type { PropValidators } from '@instructure/shared-types';
4
+ declare type TableCellOwnProps = {
5
+ isStacked?: boolean;
6
+ header?: React.ReactNode | ((...args: any[]) => any);
7
+ textAlign?: 'start' | 'center' | 'end';
8
+ children?: React.ReactNode | ((...args: any[]) => React.ReactNode);
9
+ };
10
+ declare type PropKeys = keyof TableCellOwnProps;
11
+ declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
12
+ declare type TableCellProps = TableCellOwnProps & WithStyleProps;
13
+ declare const propTypes: PropValidators<PropKeys>;
14
+ declare const allowedProps: AllowedPropKeys;
15
+ export type { TableCellProps };
16
+ export { propTypes, allowedProps };
17
+ //# sourceMappingURL=props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/Table/Cell/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAE/D,aAAK,iBAAiB,GAAG;IACvB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CAAA;IACpD,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;IACtC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,KAAK,CAAC,SAAS,CAAC,CAAA;CACnE,CAAA;AAED,aAAK,QAAQ,GAAG,MAAM,iBAAiB,CAAA;AAEvC,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,cAAc,GAAG,iBAAiB,GAAG,cAAc,CAAA;AAExD,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAQvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAKnB,CAAA;AAED,YAAY,EAAE,cAAc,EAAE,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { TableCellTheme } from '@instructure/shared-types';
2
- import { TableCellProps } from './types';
2
+ import { TableCellProps } from './props';
3
3
  /**
4
4
  * ---
5
5
  * private: true
@@ -1,8 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { Component } from 'react';
3
- import PropTypes from 'prop-types';
4
3
  import { jsx } from '@instructure/emotion';
5
- import { TableColHeaderProps } from './types';
4
+ import type { TableColHeaderProps } from './props';
6
5
  /**
7
6
  ---
8
7
  parent: Table
@@ -11,51 +10,34 @@ id: Table.ColHeader
11
10
  **/
12
11
  declare class ColHeader extends Component<TableColHeaderProps> {
13
12
  static readonly componentId = "Table.ColHeader";
14
- static propTypes: {
15
- makeStyles: PropTypes.Requireable<(...args: any[]) => any>;
16
- styles: PropTypes.Requireable<object>;
17
- /**
18
- * A unique id for this column. The `id` is also used as option in combobox,
19
- * when sortable table is in stacked layout,
20
- * and no `stackedSortByLabel` is provided.
21
- */
22
- id: PropTypes.Validator<string>;
23
- /**
24
- * A custom string to display as option text in the combobox (instead of
25
- * using the `id` prop), when sortable table is in stacked layout.
26
- */
27
- stackedSortByLabel: PropTypes.Requireable<string>;
28
- children: PropTypes.Requireable<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
29
- /**
30
- * Control the width of column.
31
- */
32
- width: PropTypes.Requireable<string | number>;
33
- /**
34
- * Control the text alignment in column header
35
- */
36
- textAlign: PropTypes.Requireable<string>;
37
- /**
38
- * The string of sorting direction
39
- */
40
- sortDirection: PropTypes.Requireable<string>;
41
- /**
42
- * Callback fired when column header is clicked. Parameters: `(event, { id })`
43
- */
44
- onRequestSort: PropTypes.Requireable<(...args: any[]) => any>;
45
- /**
46
- * The column header scope attribute. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope
47
- */
48
- scope: PropTypes.Requireable<string>;
49
- };
13
+ static allowedProps: readonly (keyof {
14
+ id: string;
15
+ stackedSortByLabel?: string | undefined;
16
+ width?: string | number | undefined;
17
+ textAlign?: "start" | "center" | "end" | undefined;
18
+ sortDirection?: "none" | "ascending" | "descending" | undefined;
19
+ onRequestSort?: ((...args: any[]) => any) | undefined;
20
+ scope?: "row" | "col" | "rowgroup" | "colgroup" | "auto" | undefined;
21
+ children?: import("react").ReactNode | ((...args: any[]) => import("react").ReactNode);
22
+ })[];
23
+ static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
24
+ id: string;
25
+ stackedSortByLabel?: string | undefined;
26
+ width?: string | number | undefined;
27
+ textAlign?: "start" | "center" | "end" | undefined;
28
+ sortDirection?: "none" | "ascending" | "descending" | undefined;
29
+ onRequestSort?: ((...args: any[]) => any) | undefined;
30
+ scope?: "row" | "col" | "rowgroup" | "colgroup" | "auto" | undefined;
31
+ children?: import("react").ReactNode | ((...args: any[]) => import("react").ReactNode);
32
+ }>;
50
33
  static defaultProps: {
51
34
  textAlign: string;
52
35
  sortDirection: string;
53
- stackedSortByLabel: undefined;
54
36
  children: null;
55
37
  scope: string;
56
38
  };
57
39
  componentDidMount(): void;
58
- componentDidUpdate(prevProps: any, prevState: any, snapshot: any): void;
40
+ componentDidUpdate(): void;
59
41
  handleClick: (event: any) => void;
60
42
  renderSortArrow(): jsx.JSX.Element | null;
61
43
  render(): jsx.JSX.Element;