@instructure/ui-table 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.
Files changed (128) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE.md +1 -0
  3. package/{lib/Table/v1/Cell/props.js → babel.config.cjs} +12 -7
  4. package/es/Table/v1/Body/index.js +6 -5
  5. package/es/Table/v1/Cell/index.js +6 -5
  6. package/es/Table/v1/ColHeader/index.js +5 -4
  7. package/es/Table/v1/Head/index.js +6 -5
  8. package/es/Table/v1/Row/index.js +6 -5
  9. package/es/Table/v1/RowHeader/index.js +6 -5
  10. package/es/Table/v1/index.js +11 -11
  11. package/es/Table/v2/Body/index.js +5 -4
  12. package/es/Table/v2/Cell/index.js +5 -4
  13. package/es/Table/v2/ColHeader/index.js +3 -3
  14. package/es/Table/v2/Head/index.js +5 -4
  15. package/es/Table/v2/Row/index.js +5 -4
  16. package/es/Table/v2/RowHeader/index.js +5 -4
  17. package/es/Table/v2/index.js +10 -10
  18. package/es/exports/a.js +8 -8
  19. package/es/exports/b.js +8 -8
  20. package/package.json +16 -21
  21. package/src/Table/v1/Body/index.tsx +5 -4
  22. package/src/Table/v1/Cell/index.tsx +5 -4
  23. package/src/Table/v1/ColHeader/index.tsx +4 -3
  24. package/src/Table/v1/Head/index.tsx +5 -4
  25. package/src/Table/v1/Head/props.ts +1 -1
  26. package/src/Table/v1/Row/index.tsx +5 -4
  27. package/src/Table/v1/RowHeader/index.tsx +5 -4
  28. package/src/Table/v1/index.tsx +11 -10
  29. package/src/Table/v2/Body/index.tsx +4 -3
  30. package/src/Table/v2/Cell/index.tsx +4 -3
  31. package/src/Table/v2/ColHeader/index.tsx +3 -2
  32. package/src/Table/v2/Head/index.tsx +4 -3
  33. package/src/Table/v2/Head/props.ts +1 -1
  34. package/src/Table/v2/Row/index.tsx +4 -3
  35. package/src/Table/v2/RowHeader/index.tsx +4 -3
  36. package/src/Table/v2/index.tsx +10 -9
  37. package/src/exports/a.ts +8 -8
  38. package/src/exports/b.ts +8 -8
  39. package/tsconfig.build.tsbuildinfo +1 -1
  40. package/types/Table/v1/Body/index.d.ts +3 -2
  41. package/types/Table/v1/Body/index.d.ts.map +1 -1
  42. package/types/Table/v1/Cell/index.d.ts +3 -2
  43. package/types/Table/v1/Cell/index.d.ts.map +1 -1
  44. package/types/Table/v1/ColHeader/index.d.ts +1 -0
  45. package/types/Table/v1/ColHeader/index.d.ts.map +1 -1
  46. package/types/Table/v1/Head/index.d.ts +3 -2
  47. package/types/Table/v1/Head/index.d.ts.map +1 -1
  48. package/types/Table/v1/Head/props.d.ts +1 -1
  49. package/types/Table/v1/Head/props.d.ts.map +1 -1
  50. package/types/Table/v1/Row/index.d.ts +3 -2
  51. package/types/Table/v1/Row/index.d.ts.map +1 -1
  52. package/types/Table/v1/RowHeader/index.d.ts +3 -2
  53. package/types/Table/v1/RowHeader/index.d.ts.map +1 -1
  54. package/types/Table/v1/index.d.ts +7 -6
  55. package/types/Table/v1/index.d.ts.map +1 -1
  56. package/types/Table/v2/Body/index.d.ts +3 -2
  57. package/types/Table/v2/Body/index.d.ts.map +1 -1
  58. package/types/Table/v2/Cell/index.d.ts +3 -2
  59. package/types/Table/v2/Cell/index.d.ts.map +1 -1
  60. package/types/Table/v2/ColHeader/index.d.ts +1 -0
  61. package/types/Table/v2/ColHeader/index.d.ts.map +1 -1
  62. package/types/Table/v2/Head/index.d.ts +3 -2
  63. package/types/Table/v2/Head/index.d.ts.map +1 -1
  64. package/types/Table/v2/Head/props.d.ts +1 -1
  65. package/types/Table/v2/Head/props.d.ts.map +1 -1
  66. package/types/Table/v2/Row/index.d.ts +3 -2
  67. package/types/Table/v2/Row/index.d.ts.map +1 -1
  68. package/types/Table/v2/RowHeader/index.d.ts +3 -2
  69. package/types/Table/v2/RowHeader/index.d.ts.map +1 -1
  70. package/types/Table/v2/index.d.ts +7 -6
  71. package/types/Table/v2/index.d.ts.map +1 -1
  72. package/types/exports/a.d.ts +8 -8
  73. package/types/exports/a.d.ts.map +1 -1
  74. package/types/exports/b.d.ts +8 -8
  75. package/types/exports/b.d.ts.map +1 -1
  76. package/lib/Table/v1/Body/index.js +0 -86
  77. package/lib/Table/v1/Body/props.js +0 -31
  78. package/lib/Table/v1/Body/styles.js +0 -51
  79. package/lib/Table/v1/Body/theme.js +0 -52
  80. package/lib/Table/v1/Cell/index.js +0 -79
  81. package/lib/Table/v1/Cell/styles.js +0 -63
  82. package/lib/Table/v1/Cell/theme.js +0 -56
  83. package/lib/Table/v1/ColHeader/index.js +0 -125
  84. package/lib/Table/v1/ColHeader/props.js +0 -31
  85. package/lib/Table/v1/ColHeader/styles.js +0 -108
  86. package/lib/Table/v1/ColHeader/theme.js +0 -69
  87. package/lib/Table/v1/Head/index.js +0 -179
  88. package/lib/Table/v1/Head/props.js +0 -31
  89. package/lib/Table/v1/Head/styles.js +0 -51
  90. package/lib/Table/v1/Head/theme.js +0 -52
  91. package/lib/Table/v1/Row/index.js +0 -93
  92. package/lib/Table/v1/Row/props.js +0 -31
  93. package/lib/Table/v1/Row/styles.js +0 -74
  94. package/lib/Table/v1/Row/theme.js +0 -63
  95. package/lib/Table/v1/RowHeader/index.js +0 -79
  96. package/lib/Table/v1/RowHeader/props.js +0 -31
  97. package/lib/Table/v1/RowHeader/styles.js +0 -63
  98. package/lib/Table/v1/RowHeader/theme.js +0 -56
  99. package/lib/Table/v1/TableContext.js +0 -51
  100. package/lib/Table/v1/index.js +0 -196
  101. package/lib/Table/v1/props.js +0 -31
  102. package/lib/Table/v1/styles.js +0 -74
  103. package/lib/Table/v1/theme.js +0 -59
  104. package/lib/Table/v2/Body/index.js +0 -85
  105. package/lib/Table/v2/Body/props.js +0 -31
  106. package/lib/Table/v2/Body/styles.js +0 -51
  107. package/lib/Table/v2/Cell/index.js +0 -78
  108. package/lib/Table/v2/Cell/props.js +0 -31
  109. package/lib/Table/v2/Cell/styles.js +0 -62
  110. package/lib/Table/v2/ColHeader/index.js +0 -124
  111. package/lib/Table/v2/ColHeader/props.js +0 -31
  112. package/lib/Table/v2/ColHeader/styles.js +0 -101
  113. package/lib/Table/v2/Head/index.js +0 -179
  114. package/lib/Table/v2/Head/props.js +0 -31
  115. package/lib/Table/v2/Head/styles.js +0 -51
  116. package/lib/Table/v2/Row/index.js +0 -92
  117. package/lib/Table/v2/Row/props.js +0 -31
  118. package/lib/Table/v2/Row/styles.js +0 -75
  119. package/lib/Table/v2/RowHeader/index.js +0 -78
  120. package/lib/Table/v2/RowHeader/props.js +0 -31
  121. package/lib/Table/v2/RowHeader/styles.js +0 -62
  122. package/lib/Table/v2/TableContext.js +0 -51
  123. package/lib/Table/v2/index.js +0 -195
  124. package/lib/Table/v2/props.js +0 -31
  125. package/lib/Table/v2/styles.js +0 -74
  126. package/lib/exports/a.js +0 -61
  127. package/lib/exports/b.js +0 -61
  128. package/lib/package.json +0 -1
@@ -1,51 +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
- * @return {Object} The final style object, which will be used in the component
38
- */
39
- const generateStyle = componentTheme => {
40
- return {
41
- body: {
42
- label: 'body',
43
- fontSize: componentTheme.fontSize,
44
- fontFamily: componentTheme.fontFamily,
45
- fontWeight: componentTheme.fontWeight,
46
- color: componentTheme.color,
47
- background: componentTheme.background
48
- }
49
- };
50
- };
51
- var _default = exports.default = generateStyle;
@@ -1,78 +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.Cell = void 0;
8
- var _react = require("react");
9
- var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
10
- var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
11
- var _latest = require("@instructure/ui-view/latest");
12
- var _emotion = require("@instructure/emotion");
13
- var _styles = _interopRequireDefault(require("./styles"));
14
- var _props = require("./props");
15
- var _TableContext = _interopRequireDefault(require("../TableContext"));
16
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
- var _dec, _class;
18
- /*
19
- * The MIT License (MIT)
20
- *
21
- * Copyright (c) 2015 - present Instructure, Inc.
22
- *
23
- * Permission is hereby granted, free of charge, to any person obtaining a copy
24
- * of this software and associated documentation files (the "Software"), to deal
25
- * in the Software without restriction, including without limitation the rights
26
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
27
- * copies of the Software, and to permit persons to whom the Software is
28
- * furnished to do so, subject to the following conditions:
29
- *
30
- * The above copyright notice and this permission notice shall be included in all
31
- * copies or substantial portions of the Software.
32
- *
33
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
36
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
38
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39
- * SOFTWARE.
40
- */
41
- /**
42
- ---
43
- parent: Table
44
- id: Table.Cell
45
- ---
46
- **/
47
- let Cell = exports.Cell = (_dec = (0, _emotion.withStyleNew)(_styles.default), _dec(_class = class Cell extends _react.Component {
48
- static displayName = "Cell";
49
- static componentId = 'Table.Cell';
50
- static contextType = _TableContext.default;
51
- static allowedProps = _props.allowedProps;
52
- static defaultProps = {
53
- textAlign: 'start',
54
- children: null
55
- };
56
- componentDidMount() {
57
- this.props.makeStyles?.();
58
- }
59
- componentDidUpdate() {
60
- this.props.makeStyles?.();
61
- }
62
- render() {
63
- const {
64
- children,
65
- styles,
66
- header
67
- } = this.props;
68
- const isStacked = this.context.isStacked;
69
- return (0, _jsxRuntime.jsxs)(_latest.View, {
70
- ..._latest.View.omitViewProps((0, _omitProps.omitProps)(this.props, Cell.allowedProps), Cell),
71
- as: isStacked ? 'div' : 'td',
72
- css: styles?.cell,
73
- role: isStacked ? 'cell' : undefined,
74
- children: [header && (0, _callRenderProp.callRenderProp)(header), header && ': ', (0, _callRenderProp.callRenderProp)(children)]
75
- });
76
- }
77
- }) || _class);
78
- var _default = exports.default = Cell;
@@ -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 = ['children', 'header', 'textAlign'];
@@ -1,62 +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
- * @return {Object} The final style object, which will be used in the component
39
- */
40
- const generateStyle = (componentTheme, props) => {
41
- const {
42
- textAlign
43
- } = props;
44
- return {
45
- cell: {
46
- label: 'cell',
47
- fontSize: componentTheme.fontSize,
48
- fontFamily: componentTheme.fontFamily,
49
- fontWeight: componentTheme.fontWeight,
50
- color: componentTheme.color,
51
- background: componentTheme.background,
52
- boxSizing: 'border-box',
53
- verticalAlign: 'middle',
54
- lineHeight: componentTheme.lineHeight,
55
- padding: `${componentTheme.paddingVertical} ${componentTheme.paddingHorizontal}`,
56
- ...(textAlign && {
57
- textAlign
58
- })
59
- }
60
- };
61
- };
62
- var _default = exports.default = generateStyle;
@@ -1,124 +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.ColHeader = void 0;
8
- var _react = require("react");
9
- var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
10
- var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
11
- var _emotion = require("@instructure/emotion");
12
- var _styles = _interopRequireDefault(require("./styles"));
13
- var _props = require("./props");
14
- var _uiIcons = require("@instructure/ui-icons");
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
- parent: Table
43
- id: Table.ColHeader
44
- ---
45
- **/
46
- let ColHeader = exports.ColHeader = (_dec = (0, _emotion.withStyleNew)(_styles.default), _dec(_class = class ColHeader extends _react.Component {
47
- static displayName = "ColHeader";
48
- static componentId = 'Table.ColHeader';
49
- static allowedProps = _props.allowedProps;
50
- static defaultProps = {
51
- textAlign: 'start',
52
- sortDirection: 'none',
53
- children: null,
54
- scope: 'col'
55
- };
56
- componentDidMount() {
57
- this.props.makeStyles?.();
58
- }
59
- componentDidUpdate() {
60
- this.props.makeStyles?.();
61
- }
62
- handleClick = event => {
63
- const {
64
- id,
65
- onRequestSort
66
- } = this.props;
67
- onRequestSort && onRequestSort(event, {
68
- id
69
- });
70
- };
71
- renderSortArrow() {
72
- const {
73
- sortDirection,
74
- onRequestSort
75
- } = this.props;
76
- if (sortDirection === 'ascending') {
77
- return (0, _jsxRuntime.jsx)(_uiIcons.ChevronUpInstUIIcon, {
78
- color: "infoColor",
79
- size: "sm"
80
- });
81
- }
82
- if (sortDirection === 'descending') {
83
- return (0, _jsxRuntime.jsx)(_uiIcons.ChevronDownInstUIIcon, {
84
- color: "infoColor",
85
- size: "sm"
86
- });
87
- }
88
- if (onRequestSort) {
89
- return (0, _jsxRuntime.jsx)(_uiIcons.ChevronsUpDownInstUIIcon, {
90
- color: "baseColor",
91
- size: "sm"
92
- });
93
- }
94
- return undefined;
95
- }
96
- render() {
97
- const {
98
- onRequestSort,
99
- width,
100
- children,
101
- sortDirection,
102
- scope,
103
- styles
104
- } = this.props;
105
- return (0, _jsxRuntime.jsxs)("th", {
106
- ...(0, _omitProps.omitProps)(this.props, ColHeader.allowedProps),
107
- css: styles?.colHeader,
108
- style: {
109
- width
110
- },
111
- scope: scope,
112
- "aria-sort": sortDirection,
113
- children: [onRequestSort && (0, _jsxRuntime.jsx)("button", {
114
- onClick: this.handleClick,
115
- css: styles?.button,
116
- children: (0, _jsxRuntime.jsxs)("div", {
117
- css: styles?.buttonContent,
118
- children: [(0, _callRenderProp.callRenderProp)(children), this.renderSortArrow()]
119
- })
120
- }), !onRequestSort && children, !onRequestSort && this.renderSortArrow()]
121
- });
122
- }
123
- }) || _class);
124
- var _default = exports.default = ColHeader;
@@ -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 = ['id', 'stackedSortByLabel', 'children', 'width', 'textAlign', 'sortDirection', 'onRequestSort', 'scope'];
@@ -1,101 +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} sharedTokens Shared token object that stores common values for the theme.
39
- * @return {Object} The final style object, which will be used in the component
40
- */
41
- const generateStyle = (componentTheme, props, sharedTokens) => {
42
- const {
43
- onRequestSort,
44
- textAlign
45
- } = props;
46
- const headerStyle = {
47
- color: componentTheme.color,
48
- fontSize: componentTheme.fontSize,
49
- fontFamily: componentTheme.fontFamily,
50
- fontWeight: 'bold',
51
- lineHeight: componentTheme.lineHeight,
52
- padding: `${componentTheme.paddingVertical} ${componentTheme.paddingHorizontal}`
53
- };
54
- const buttonTextAlignVariants = {
55
- start: {
56
- flexDirection: 'row'
57
- },
58
- center: {
59
- justifyContent: 'center'
60
- },
61
- end: {
62
- flexDirection: 'row-reverse'
63
- }
64
- };
65
- return {
66
- colHeader: {
67
- label: 'colHeader',
68
- background: componentTheme.background,
69
- verticalAlign: 'middle',
70
- boxSizing: 'border-box',
71
- ...(!onRequestSort && headerStyle),
72
- textAlign: textAlign
73
- },
74
- button: {
75
- label: 'colHeader__button',
76
- ...headerStyle,
77
- display: 'flex',
78
- alignItems: 'center',
79
- boxSizing: 'border-box',
80
- border: 'none',
81
- width: '100%',
82
- height: '100%',
83
- background: 'transparent',
84
- cursor: 'pointer',
85
- outline: 'none',
86
- '&::-moz-focus-inner': {
87
- border: 0
88
- },
89
- '&:focus': {
90
- outline: `${sharedTokens.focusOutline.width} ${sharedTokens.focusOutline.style} ${sharedTokens.focusOutline.infoColor}`
91
- },
92
- ...(textAlign && buttonTextAlignVariants[textAlign])
93
- },
94
- buttonContent: {
95
- label: 'colHeader__buttonContent',
96
- display: 'flex',
97
- alignItems: 'center'
98
- }
99
- };
100
- };
101
- var _default = exports.default = generateStyle;
@@ -1,179 +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.Head = void 0;
8
- var _react = require("react");
9
- var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
10
- var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
11
- var _latest = require("@instructure/ui-simple-select/latest");
12
- var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
13
- var _uiIcons = require("@instructure/ui-icons");
14
- var _console = require("@instructure/console");
15
- var _emotion = require("@instructure/emotion");
16
- var _styles = _interopRequireDefault(require("./styles"));
17
- var _props = require("./props");
18
- var _TableContext = _interopRequireDefault(require("../TableContext"));
19
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
20
- var _dec, _class;
21
- /*
22
- * The MIT License (MIT)
23
- *
24
- * Copyright (c) 2015 - present Instructure, Inc.
25
- *
26
- * Permission is hereby granted, free of charge, to any person obtaining a copy
27
- * of this software and associated documentation files (the "Software"), to deal
28
- * in the Software without restriction, including without limitation the rights
29
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
30
- * copies of the Software, and to permit persons to whom the Software is
31
- * furnished to do so, subject to the following conditions:
32
- *
33
- * The above copyright notice and this permission notice shall be included in all
34
- * copies or substantial portions of the Software.
35
- *
36
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
39
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
41
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
42
- * SOFTWARE.
43
- */
44
- /**
45
- ---
46
- parent: Table
47
- id: Table.Head
48
- ---
49
- **/
50
- let Head = exports.Head = (_dec = (0, _emotion.withStyleNew)(_styles.default), _dec(_class = class Head extends _react.Component {
51
- static displayName = "Head";
52
- static componentId = 'Table.Head';
53
- static contextType = _TableContext.default;
54
- static allowedProps = _props.allowedProps;
55
- static defaultProps = {
56
- children: null
57
- };
58
-
59
- /**
60
- * Returns `true` if the first child's children have a `onRequestSort` prop
61
- */
62
- get isSortable() {
63
- const [firstRow] = _react.Children.toArray(this.props.children);
64
- let sortable = false;
65
- if (firstRow && firstRow.props && firstRow.props.children) {
66
- _react.Children.forEach(firstRow.props.children, grandchild => {
67
- if (grandchild?.props?.onRequestSort) {
68
- sortable = true;
69
- return;
70
- }
71
- });
72
- }
73
- return sortable;
74
- }
75
- componentDidMount() {
76
- this.props.makeStyles?.();
77
- }
78
- componentDidUpdate() {
79
- if (this.isSortable && typeof this.props.renderSortLabel === 'undefined') {
80
- (0, _console.warn)(false, '[Table.Head] The `renderSortLabel` prop should be provided when Table is sortable.');
81
- }
82
- this.props.makeStyles?.();
83
- }
84
-
85
- /**
86
- * This `Select` is used in `stacked` layout. It's populated by iterating
87
- * through the first child's children (by default `ColHeader`) and reading
88
- * there the `id`, `stackedSortByLabel`, `sortDirection`, `onRequestSort` props
89
- */
90
- renderSelect() {
91
- const {
92
- children,
93
- renderSortLabel
94
- } = this.props;
95
- const [firstRow] = _react.Children.toArray(children);
96
- if (!firstRow?.props?.children) {
97
- return null;
98
- }
99
- const options = [];
100
- const clickHandlers = {};
101
- let selectedOption;
102
- let count = 0;
103
- _react.Children.forEach(firstRow.props.children, grandchild => {
104
- count += 1;
105
- if (!grandchild?.props) return; // grandchild can be false
106
- const {
107
- id,
108
- stackedSortByLabel,
109
- sortDirection,
110
- onRequestSort
111
- } = grandchild.props;
112
- if (id && onRequestSort) {
113
- const label = stackedSortByLabel || id;
114
- options.push({
115
- id,
116
- label
117
- });
118
- clickHandlers[id] = onRequestSort;
119
- if (sortDirection !== 'none') {
120
- selectedOption = id;
121
- }
122
- }
123
- });
124
- if (!options.length) {
125
- return null;
126
- }
127
- const handleSelect = (event, {
128
- value
129
- }) => {
130
- if (value && typeof clickHandlers[value] === 'function') {
131
- clickHandlers[value](event, {
132
- id: `${value}`
133
- });
134
- }
135
- };
136
- return (0, _jsxRuntime.jsx)("div", {
137
- role: "rowgroup",
138
- children: (0, _jsxRuntime.jsx)("div", {
139
- role: "row",
140
- children: (0, _jsxRuntime.jsx)("div", {
141
- role: "cell",
142
- "aria-colspan": count,
143
- children: (0, _jsxRuntime.jsx)(_latest.SimpleSelect, {
144
- renderLabel: renderSortLabel ? (0, _callRenderProp.callRenderProp)(renderSortLabel) : (0, _jsxRuntime.jsx)(_ScreenReaderContent.ScreenReaderContent, {}),
145
- renderBeforeInput: selectedOption ? () => (0, _jsxRuntime.jsx)(_uiIcons.CheckInstUIIcon, {}) : undefined,
146
- value: selectedOption,
147
- onChange: handleSelect,
148
- children: options.map(({
149
- id,
150
- label
151
- }) => (0, _jsxRuntime.jsx)(_latest.SimpleSelect.Option, {
152
- id: id,
153
- value: id,
154
- renderBeforeLabel: id === selectedOption ? () => (0, _jsxRuntime.jsx)(_uiIcons.CheckInstUIIcon, {}) : () => (0, _jsxRuntime.jsx)("span", {
155
- style: {
156
- visibility: 'hidden'
157
- },
158
- children: (0, _jsxRuntime.jsx)(_uiIcons.CheckInstUIIcon, {})
159
- }),
160
- children: label
161
- }, id))
162
- })
163
- })
164
- })
165
- });
166
- }
167
- render() {
168
- const {
169
- children,
170
- styles
171
- } = this.props;
172
- return this.context.isStacked ? this.renderSelect() : (0, _jsxRuntime.jsx)("thead", {
173
- ...(0, _omitProps.omitProps)(this.props, Head.allowedProps),
174
- css: styles?.head,
175
- children: children
176
- });
177
- }
178
- }) || _class);
179
- var _default = exports.default = Head;
@@ -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 = ['children', 'renderSortLabel'];