@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,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', 'textAlign'];
@@ -1,63 +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
- textAlign
44
- } = props;
45
- return {
46
- rowHeader: {
47
- label: 'rowHeader',
48
- fontSize: componentTheme.fontSize,
49
- fontFamily: componentTheme.fontFamily,
50
- fontWeight: componentTheme.fontWeight,
51
- color: componentTheme.color,
52
- background: componentTheme.background,
53
- boxSizing: 'border-box',
54
- verticalAlign: 'middle',
55
- lineHeight: componentTheme.lineHeight,
56
- padding: componentTheme.padding,
57
- ...(textAlign && {
58
- textAlign
59
- })
60
- }
61
- };
62
- };
63
- var _default = exports.default = generateStyle;
@@ -1,56 +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
- } = theme;
42
- const componentVariables = {
43
- fontSize: typography?.fontSizeMedium,
44
- fontFamily: typography?.fontFamily,
45
- fontWeight: typography?.fontWeightBold,
46
- color: colors?.contrasts?.grey125125,
47
- background: colors?.contrasts?.white1010,
48
- borderColor: colors?.contrasts?.grey4570,
49
- lineHeight: typography?.lineHeightCondensed,
50
- padding: `${spacing?.xSmall} ${spacing?.small}`
51
- };
52
- return {
53
- ...componentVariables
54
- };
55
- };
56
- var _default = exports.default = generateComponentTheme;
@@ -1,51 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.TableContext = void 0;
7
- var _react = require("react");
8
- /*
9
- * The MIT License (MIT)
10
- *
11
- * Copyright (c) 2015 - present Instructure, Inc.
12
- *
13
- * Permission is hereby granted, free of charge, to any person obtaining a copy
14
- * of this software and associated documentation files (the "Software"), to deal
15
- * in the Software without restriction, including without limitation the rights
16
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
- * copies of the Software, and to permit persons to whom the Software is
18
- * furnished to do so, subject to the following conditions:
19
- *
20
- * The above copyright notice and this permission notice shall be included in all
21
- * copies or substantial portions of the Software.
22
- *
23
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
- * SOFTWARE.
30
- */
31
-
32
- /**
33
- * ---
34
- * category: components/contexts
35
- * ---
36
- * React context created by the `Table` component to hold its data which are
37
- * read by its children. You can access these to make custom Table cells/rows.
38
- *
39
- * It stores the following parameters:
40
- * - `isStacked`: Whether the `Table` is in `stacked` layout.
41
- * - `hover`: Whether highlight rows on mouse hover
42
- * - `headers`: in `stacked` layout the children of the first row of cells
43
- * (e.g. the titles in a table). This is used in `stacked` layout to display
44
- * the titles inline
45
- * @module
46
- */
47
- const TableContext = exports.TableContext = /*#__PURE__*/(0, _react.createContext)({
48
- isStacked: false,
49
- hover: false
50
- });
51
- var _default = exports.default = TableContext;
@@ -1,196 +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.Table = void 0;
8
- var _react = require("react");
9
- var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
10
- var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
11
- var _v11_ = require("@instructure/ui-view/v11_6");
12
- var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
13
- var _emotion = require("@instructure/emotion");
14
- var _styles = _interopRequireDefault(require("./styles"));
15
- var _theme = _interopRequireDefault(require("./theme"));
16
- var _Head = require("./Head");
17
- var _Body = require("./Body");
18
- var _Row = require("./Row");
19
- var _ColHeader = require("./ColHeader");
20
- var _RowHeader = require("./RowHeader");
21
- var _Cell = require("./Cell");
22
- var _props = require("./props");
23
- var _TableContext = _interopRequireDefault(require("./TableContext"));
24
- var _console = require("@instructure/console");
25
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
26
- var _dec, _class;
27
- /*
28
- * The MIT License (MIT)
29
- *
30
- * Copyright (c) 2015 - present Instructure, Inc.
31
- *
32
- * Permission is hereby granted, free of charge, to any person obtaining a copy
33
- * of this software and associated documentation files (the "Software"), to deal
34
- * in the Software without restriction, including without limitation the rights
35
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
36
- * copies of the Software, and to permit persons to whom the Software is
37
- * furnished to do so, subject to the following conditions:
38
- *
39
- * The above copyright notice and this permission notice shall be included in all
40
- * copies or substantial portions of the Software.
41
- *
42
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
45
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
46
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
47
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
48
- * SOFTWARE.
49
- */
50
- /**
51
- ---
52
- category: components
53
- ---
54
- **/
55
- let Table = exports.Table = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = class Table extends _react.Component {
56
- static displayName = "Table";
57
- static componentId = 'Table';
58
- static allowedProps = _props.allowedProps;
59
- static defaultProps = {
60
- children: null,
61
- hover: false,
62
- layout: 'auto'
63
- };
64
- static Head = _Head.Head;
65
- static Body = _Body.Body;
66
- static Row = _Row.Row;
67
- static ColHeader = _ColHeader.ColHeader;
68
- static RowHeader = _RowHeader.RowHeader;
69
- static Cell = _Cell.Cell;
70
- ref = null;
71
- // Reference to hidden aria-live region for announcing caption changes to screen readers
72
- _liveRegionRef = null;
73
- // Timeout for delayed announcement (workaround for Safari/VoiceOver caption update bug)
74
- _announcementTimeout;
75
- handleRef = el => {
76
- this.ref = el;
77
- this.props.elementRef?.(el);
78
- };
79
- componentDidMount() {
80
- this.props.makeStyles?.();
81
- }
82
- componentDidUpdate(prevProps) {
83
- this.props.makeStyles?.();
84
- // Announce caption changes for screen readers (especially VoiceOver)
85
- // Safari/VoiceOver has a known bug where dynamic <caption> updates aren't announced,
86
- // so we use an aria-live region as a workaround
87
- const prevSortInfo = this.getSortedHeaderInfo(prevProps);
88
- const currentSortInfo = this.getSortedHeaderInfo(this.props);
89
- // Only announce if sorting actually changed
90
- const sortingChanged = prevSortInfo?.header !== currentSortInfo?.header || prevSortInfo?.direction !== currentSortInfo?.direction;
91
- if (sortingChanged && currentSortInfo && this._liveRegionRef) {
92
- // Clear any pending announcement
93
- clearTimeout(this._announcementTimeout);
94
- // Clear the live region first (part of the clear-then-set pattern)
95
- this._liveRegionRef.textContent = '';
96
- // Wait 100ms before setting new content to ensure screen readers detect the change
97
- this._announcementTimeout = setTimeout(() => {
98
- if (this._liveRegionRef) {
99
- const currentCaption = this.getCaptionText(this.props);
100
- // Append non-breaking space (\u00A0) to force Safari/VoiceOver to treat
101
- // repeated captions as different announcements
102
- this._liveRegionRef.textContent = currentCaption + '\u00A0';
103
- }
104
- }, 100);
105
- }
106
- }
107
- componentWillUnmount() {
108
- // Clean up pending announcement timeout
109
- clearTimeout(this._announcementTimeout);
110
- }
111
- getHeaders() {
112
- const [headChild] = _react.Children.toArray(this.props.children);
113
- if (!headChild || ! /*#__PURE__*/(0, _react.isValidElement)(headChild)) return undefined;
114
- const [firstRow] = _react.Children.toArray(headChild.props.children);
115
- if (!firstRow || ! /*#__PURE__*/(0, _react.isValidElement)(firstRow)) return undefined;
116
- return _react.Children.map(firstRow.props.children, colHeader => {
117
- if (! /*#__PURE__*/(0, _react.isValidElement)(colHeader)) return undefined;
118
- return colHeader.props.children;
119
- });
120
- }
121
- getSortedHeaderInfo(props) {
122
- const [headChild] = _react.Children.toArray(props.children);
123
- const [firstRow] = _react.Children.toArray(/*#__PURE__*/(0, _react.isValidElement)(headChild) ? headChild.props.children : []);
124
- const colHeaders = _react.Children.toArray(/*#__PURE__*/(0, _react.isValidElement)(firstRow) ? firstRow.props.children : []);
125
- // Find the column with an active sort direction
126
- for (const colHeader of colHeaders) {
127
- if (/*#__PURE__*/(0, _react.isValidElement)(colHeader) && colHeader.props.sortDirection && colHeader.props.sortDirection !== 'none') {
128
- // Extract header text (may be nested in child components)
129
- const headerText = typeof colHeader.props.children === 'string' ? colHeader.props.children : colHeader.props.children?.props?.children ?? '';
130
- return {
131
- header: headerText,
132
- direction: colHeader.props.sortDirection
133
- };
134
- }
135
- }
136
- return null;
137
- }
138
- getCaptionText(props) {
139
- const sortInfo = this.getSortedHeaderInfo(props);
140
- const caption = props.caption;
141
- if (!sortInfo) return caption;
142
- const sortText = ` Sorted by ${sortInfo.header} (${sortInfo.direction})`;
143
- return caption ? caption + sortText : sortText.trim();
144
- }
145
- render() {
146
- const {
147
- margin,
148
- layout,
149
- caption,
150
- children,
151
- hover,
152
- styles,
153
- minWidth
154
- } = this.props;
155
- const isStacked = layout === 'stacked';
156
- const captionText = this.getCaptionText(this.props);
157
- if (!caption) {
158
- (0, _console.error)(false, `[Table] required prop caption is not set.`);
159
- }
160
- return (0, _jsxRuntime.jsxs)(_TableContext.default.Provider, {
161
- value: {
162
- isStacked,
163
- hover: hover,
164
- headers: isStacked ? this.getHeaders() : undefined
165
- },
166
- children: [(0, _jsxRuntime.jsx)("div", {
167
- ref: el => {
168
- this._liveRegionRef = el;
169
- },
170
- "aria-live": "polite",
171
- "aria-atomic": "true",
172
- role: "status",
173
- css: styles?.liveRegion
174
- }), (0, _jsxRuntime.jsxs)(_v11_.View
175
- // All HTML props, except the ones accepted by `View` and `Table`
176
- , {
177
- ..._v11_.View.omitViewProps((0, _omitProps.omitProps)(this.props, Table.allowedProps), Table),
178
- minWidth: minWidth,
179
- as: isStacked ? 'div' : 'table',
180
- margin: margin,
181
- elementRef: this.handleRef,
182
- css: styles?.table,
183
- role: isStacked ? 'table' : undefined,
184
- "aria-label": captionText,
185
- children: [!isStacked && caption && (0, _jsxRuntime.jsx)("caption", {
186
- children: (0, _jsxRuntime.jsx)(_ScreenReaderContent.ScreenReaderContent, {
187
- children: captionText
188
- })
189
- }), _react.Children.map(children, child => /*#__PURE__*/(0, _react.isValidElement)(child) ? (0, _safeCloneElement.safeCloneElement)(child, {
190
- key: child.props.name
191
- }) : child)]
192
- })]
193
- });
194
- }
195
- }) || _class);
196
- var _default = exports.default = Table;
@@ -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 = ['caption', 'children', 'margin', 'elementRef', 'hover', 'layout'];
@@ -1,74 +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
- layout
44
- } = props;
45
- return {
46
- table: {
47
- label: 'table',
48
- fontSize: componentTheme.fontSize,
49
- fontFamily: componentTheme.fontFamily,
50
- fontWeight: componentTheme.fontWeight,
51
- color: componentTheme.color,
52
- background: componentTheme.background,
53
- display: 'table',
54
- width: '100%',
55
- borderCollapse: 'collapse',
56
- borderSpacing: 0,
57
- ...(layout === 'fixed' && {
58
- tableLayout: 'fixed'
59
- }),
60
- caption: {
61
- textAlign: 'start'
62
- }
63
- },
64
- liveRegion: {
65
- label: 'table__liveRegion',
66
- position: 'absolute',
67
- left: '-10000px',
68
- width: '1px',
69
- height: '1px',
70
- overflow: 'hidden'
71
- }
72
- };
73
- };
74
- var _default = exports.default = generateStyle;
@@ -1,59 +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
- key: themeName
41
- } = theme;
42
- const themeSpecificStyle = {
43
- canvas: {
44
- color: theme['ic-brand-font-color-dark']
45
- }
46
- };
47
- const componentVariables = {
48
- fontSize: typography?.fontSizeMedium,
49
- fontFamily: typography?.fontFamily,
50
- fontWeight: typography?.fontWeightNormal,
51
- color: colors?.contrasts?.grey125125,
52
- background: colors?.contrasts?.white1010
53
- };
54
- return {
55
- ...componentVariables,
56
- ...themeSpecificStyle[themeName]
57
- };
58
- };
59
- var _default = exports.default = generateComponentTheme;
@@ -1,85 +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.Body = void 0;
8
- var _react = require("react");
9
- var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
10
- var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.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.Body
45
- ---
46
- **/
47
- let Body = exports.Body = (_dec = (0, _emotion.withStyleNew)(_styles.default), _dec(_class = class Body extends _react.Component {
48
- static displayName = "Body";
49
- static componentId = 'Table.Body';
50
- static contextType = _TableContext.default;
51
- static allowedProps = _props.allowedProps;
52
- static defaultProps = {
53
- children: null
54
- };
55
- componentDidMount() {
56
- this.props.makeStyles?.();
57
- }
58
- componentDidUpdate() {
59
- this.props.makeStyles?.();
60
- }
61
- render() {
62
- const {
63
- children,
64
- styles
65
- } = this.props;
66
- const {
67
- isStacked
68
- } = this.context;
69
- return (0, _jsxRuntime.jsx)(_latest.View, {
70
- ..._latest.View.omitViewProps((0, _omitProps.omitProps)(this.props, Body.allowedProps), Body),
71
- as: isStacked ? 'div' : 'tbody',
72
- css: styles?.body,
73
- role: isStacked ? 'rowgroup' : undefined,
74
- children: _react.Children.map(children, child => {
75
- if (/*#__PURE__*/(0, _react.isValidElement)(child)) {
76
- return (0, _safeCloneElement.safeCloneElement)(child, {
77
- key: child.props.name
78
- });
79
- }
80
- return child;
81
- })
82
- });
83
- }
84
- }) || _class);
85
- var _default = exports.default = Body;
@@ -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'];