@instructure/ui-table 11.6.0 → 11.6.1-snapshot-129
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -308
- package/es/Table/{Body → v1/Body}/index.js +2 -2
- package/es/Table/{Cell → v1/Cell}/index.js +2 -2
- package/es/Table/{ColHeader → v1/ColHeader}/index.js +1 -1
- package/es/Table/{Head → v1/Head}/index.js +2 -2
- package/es/Table/{Row → v1/Row}/index.js +2 -2
- package/es/Table/{RowHeader → v1/RowHeader}/index.js +2 -2
- package/es/Table/{index.js → v1/index.js} +2 -2
- package/es/Table/v2/Body/index.js +73 -0
- package/es/Table/v2/Body/props.js +26 -0
- package/es/Table/v2/Body/styles.js +45 -0
- package/es/Table/v2/Cell/index.js +68 -0
- package/es/Table/v2/Cell/props.js +26 -0
- package/es/Table/v2/Cell/styles.js +54 -0
- package/es/Table/v2/ColHeader/index.js +117 -0
- package/es/Table/v2/ColHeader/props.js +26 -0
- package/es/Table/v2/ColHeader/styles.js +93 -0
- package/es/Table/v2/Head/index.js +173 -0
- package/es/Table/v2/Head/props.js +26 -0
- package/es/Table/v2/Head/styles.js +45 -0
- package/es/Table/v2/Row/index.js +82 -0
- package/es/Table/v2/Row/props.js +26 -0
- package/es/Table/v2/Row/styles.js +67 -0
- package/es/Table/v2/RowHeader/index.js +68 -0
- package/es/Table/v2/RowHeader/props.js +26 -0
- package/es/Table/v2/RowHeader/styles.js +54 -0
- package/es/Table/v2/TableContext.js +46 -0
- package/es/Table/v2/index.js +135 -0
- package/es/Table/v2/props.js +26 -0
- package/es/Table/v2/styles.js +58 -0
- package/es/exports/a.js +31 -0
- package/es/exports/b.js +31 -0
- package/lib/Table/{Body → v1/Body}/index.js +4 -4
- package/lib/Table/{Cell → v1/Cell}/index.js +4 -4
- package/lib/Table/{ColHeader → v1/ColHeader}/index.js +4 -4
- package/lib/Table/{Head → v1/Head}/index.js +5 -5
- package/lib/Table/{Row → v1/Row}/index.js +4 -4
- package/lib/Table/{RowHeader → v1/RowHeader}/index.js +4 -4
- package/lib/Table/{index.js → v1/index.js} +4 -4
- package/lib/Table/v2/Body/index.js +79 -0
- package/lib/Table/v2/Body/props.js +31 -0
- package/lib/Table/v2/Body/styles.js +51 -0
- package/lib/Table/v2/Cell/index.js +74 -0
- package/lib/Table/v2/Cell/props.js +31 -0
- package/lib/Table/v2/Cell/styles.js +60 -0
- package/lib/Table/v2/ColHeader/index.js +122 -0
- package/lib/Table/v2/ColHeader/props.js +31 -0
- package/lib/Table/v2/ColHeader/styles.js +99 -0
- package/lib/Table/v2/Head/index.js +179 -0
- package/lib/Table/v2/Head/props.js +31 -0
- package/lib/Table/v2/Head/styles.js +51 -0
- package/lib/Table/v2/Row/index.js +88 -0
- package/lib/Table/v2/Row/props.js +31 -0
- package/lib/Table/v2/Row/styles.js +73 -0
- package/lib/Table/v2/RowHeader/index.js +74 -0
- package/lib/Table/v2/RowHeader/props.js +31 -0
- package/lib/Table/v2/RowHeader/styles.js +60 -0
- package/lib/Table/v2/TableContext.js +51 -0
- package/lib/Table/v2/index.js +140 -0
- package/lib/Table/v2/props.js +31 -0
- package/lib/Table/v2/styles.js +64 -0
- package/lib/{index.js → exports/a.js} +9 -9
- package/lib/exports/b.js +61 -0
- package/package.json +43 -21
- package/src/Table/{Body → v1/Body}/index.tsx +2 -2
- package/src/Table/{Cell → v1/Cell}/index.tsx +2 -2
- package/src/Table/{ColHeader → v1/ColHeader}/index.tsx +1 -1
- package/src/Table/{Head → v1/Head}/index.tsx +3 -3
- package/src/Table/{README.md → v1/README.md} +1 -1
- package/src/Table/{Row → v1/Row}/index.tsx +2 -2
- package/src/Table/{RowHeader → v1/RowHeader}/index.tsx +2 -2
- package/src/Table/{index.tsx → v1/index.tsx} +2 -2
- package/src/Table/v2/Body/index.tsx +91 -0
- package/src/Table/v2/Body/props.ts +50 -0
- package/src/Table/v2/Body/styles.ts +51 -0
- package/src/Table/v2/Cell/index.tsx +83 -0
- package/src/Table/v2/Cell/props.ts +54 -0
- package/src/Table/v2/Cell/styles.ts +60 -0
- package/src/Table/v2/ColHeader/index.tsx +118 -0
- package/src/Table/v2/ColHeader/props.ts +93 -0
- package/src/Table/v2/ColHeader/styles.ts +95 -0
- package/src/Table/v2/Head/index.tsx +200 -0
- package/src/Table/v2/Head/props.ts +64 -0
- package/src/Table/v2/Head/styles.ts +51 -0
- package/src/Table/v2/README.md +1155 -0
- package/src/Table/v2/Row/index.tsx +105 -0
- package/src/Table/v2/Row/props.ts +67 -0
- package/src/Table/v2/Row/styles.ts +78 -0
- package/src/Table/v2/RowHeader/index.tsx +84 -0
- package/src/Table/v2/RowHeader/props.ts +48 -0
- package/src/Table/v2/RowHeader/styles.ts +60 -0
- package/src/Table/v2/TableContext.ts +66 -0
- package/src/Table/v2/index.tsx +160 -0
- package/src/Table/v2/props.ts +98 -0
- package/src/Table/v2/styles.ts +63 -0
- package/src/exports/a.ts +39 -0
- package/src/exports/b.ts +39 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Table/v1/Body/index.d.ts.map +1 -0
- package/types/Table/v1/Body/props.d.ts.map +1 -0
- package/types/Table/v1/Body/styles.d.ts.map +1 -0
- package/types/Table/v1/Body/theme.d.ts.map +1 -0
- package/types/Table/v1/Cell/index.d.ts.map +1 -0
- package/types/Table/v1/Cell/props.d.ts.map +1 -0
- package/types/Table/v1/Cell/styles.d.ts.map +1 -0
- package/types/Table/v1/Cell/theme.d.ts.map +1 -0
- package/types/Table/v1/ColHeader/index.d.ts.map +1 -0
- package/types/Table/v1/ColHeader/props.d.ts.map +1 -0
- package/types/Table/v1/ColHeader/styles.d.ts.map +1 -0
- package/types/Table/v1/ColHeader/theme.d.ts.map +1 -0
- package/types/Table/v1/Head/index.d.ts.map +1 -0
- package/types/Table/v1/Head/props.d.ts.map +1 -0
- package/types/Table/v1/Head/styles.d.ts.map +1 -0
- package/types/Table/v1/Head/theme.d.ts.map +1 -0
- package/types/Table/v1/Row/index.d.ts.map +1 -0
- package/types/Table/v1/Row/props.d.ts.map +1 -0
- package/types/Table/v1/Row/styles.d.ts.map +1 -0
- package/types/Table/v1/Row/theme.d.ts.map +1 -0
- package/types/Table/v1/RowHeader/index.d.ts.map +1 -0
- package/types/Table/v1/RowHeader/props.d.ts.map +1 -0
- package/types/Table/v1/RowHeader/styles.d.ts.map +1 -0
- package/types/Table/v1/RowHeader/theme.d.ts.map +1 -0
- package/types/Table/v1/TableContext.d.ts.map +1 -0
- package/types/Table/v1/index.d.ts.map +1 -0
- package/types/Table/v1/props.d.ts.map +1 -0
- package/types/Table/v1/styles.d.ts.map +1 -0
- package/types/Table/v1/theme.d.ts.map +1 -0
- package/types/Table/v2/Body/index.d.ts +24 -0
- package/types/Table/v2/Body/index.d.ts.map +1 -0
- package/types/Table/v2/Body/props.d.ts +20 -0
- package/types/Table/v2/Body/props.d.ts.map +1 -0
- package/types/Table/v2/Body/styles.d.ts +13 -0
- package/types/Table/v2/Body/styles.d.ts.map +1 -0
- package/types/Table/v2/Cell/index.d.ts +29 -0
- package/types/Table/v2/Cell/index.d.ts.map +1 -0
- package/types/Table/v2/Cell/props.d.ts +23 -0
- package/types/Table/v2/Cell/props.d.ts.map +1 -0
- package/types/Table/v2/Cell/styles.d.ts +14 -0
- package/types/Table/v2/Cell/styles.d.ts.map +1 -0
- package/types/Table/v2/ColHeader/index.d.ts +37 -0
- package/types/Table/v2/ColHeader/index.d.ts.map +1 -0
- package/types/Table/v2/ColHeader/props.d.ts +47 -0
- package/types/Table/v2/ColHeader/props.d.ts.map +1 -0
- package/types/Table/v2/ColHeader/styles.d.ts +15 -0
- package/types/Table/v2/ColHeader/styles.d.ts.map +1 -0
- package/types/Table/v2/Head/index.d.ts +38 -0
- package/types/Table/v2/Head/index.d.ts.map +1 -0
- package/types/Table/v2/Head/props.d.ts +34 -0
- package/types/Table/v2/Head/props.d.ts.map +1 -0
- package/types/Table/v2/Head/styles.d.ts +13 -0
- package/types/Table/v2/Head/styles.d.ts.map +1 -0
- package/types/Table/v2/Row/index.d.ts +27 -0
- package/types/Table/v2/Row/index.d.ts.map +1 -0
- package/types/Table/v2/Row/props.d.ts +29 -0
- package/types/Table/v2/Row/props.d.ts.map +1 -0
- package/types/Table/v2/Row/styles.d.ts +19 -0
- package/types/Table/v2/Row/styles.d.ts.map +1 -0
- package/types/Table/v2/RowHeader/index.d.ts +28 -0
- package/types/Table/v2/RowHeader/index.d.ts.map +1 -0
- package/types/Table/v2/RowHeader/props.d.ts +17 -0
- package/types/Table/v2/RowHeader/props.d.ts.map +1 -0
- package/types/Table/v2/RowHeader/styles.d.ts +14 -0
- package/types/Table/v2/RowHeader/styles.d.ts.map +1 -0
- package/types/Table/v2/TableContext.d.ts +36 -0
- package/types/Table/v2/TableContext.d.ts.map +1 -0
- package/types/Table/v2/index.d.ts +45 -0
- package/types/Table/v2/index.d.ts.map +1 -0
- package/types/Table/v2/props.d.ts +53 -0
- package/types/Table/v2/props.d.ts.map +1 -0
- package/types/Table/v2/styles.d.ts +15 -0
- package/types/Table/v2/styles.d.ts.map +1 -0
- package/types/exports/a.d.ts +16 -0
- package/types/exports/a.d.ts.map +1 -0
- package/types/exports/b.d.ts +16 -0
- package/types/exports/b.d.ts.map +1 -0
- package/es/index.js +0 -31
- package/src/index.ts +0 -39
- package/types/Table/Body/index.d.ts.map +0 -1
- package/types/Table/Body/props.d.ts.map +0 -1
- package/types/Table/Body/styles.d.ts.map +0 -1
- package/types/Table/Body/theme.d.ts.map +0 -1
- package/types/Table/Cell/index.d.ts.map +0 -1
- package/types/Table/Cell/props.d.ts.map +0 -1
- package/types/Table/Cell/styles.d.ts.map +0 -1
- package/types/Table/Cell/theme.d.ts.map +0 -1
- package/types/Table/ColHeader/index.d.ts.map +0 -1
- package/types/Table/ColHeader/props.d.ts.map +0 -1
- package/types/Table/ColHeader/styles.d.ts.map +0 -1
- package/types/Table/ColHeader/theme.d.ts.map +0 -1
- package/types/Table/Head/index.d.ts.map +0 -1
- package/types/Table/Head/props.d.ts.map +0 -1
- package/types/Table/Head/styles.d.ts.map +0 -1
- package/types/Table/Head/theme.d.ts.map +0 -1
- package/types/Table/Row/index.d.ts.map +0 -1
- package/types/Table/Row/props.d.ts.map +0 -1
- package/types/Table/Row/styles.d.ts.map +0 -1
- package/types/Table/Row/theme.d.ts.map +0 -1
- package/types/Table/RowHeader/index.d.ts.map +0 -1
- package/types/Table/RowHeader/props.d.ts.map +0 -1
- package/types/Table/RowHeader/styles.d.ts.map +0 -1
- package/types/Table/RowHeader/theme.d.ts.map +0 -1
- package/types/Table/TableContext.d.ts.map +0 -1
- package/types/Table/index.d.ts.map +0 -1
- package/types/Table/props.d.ts.map +0 -1
- package/types/Table/styles.d.ts.map +0 -1
- package/types/Table/theme.d.ts.map +0 -1
- package/types/index.d.ts +0 -16
- package/types/index.d.ts.map +0 -1
- /package/es/Table/{Body → v1/Body}/props.js +0 -0
- /package/es/Table/{Body → v1/Body}/styles.js +0 -0
- /package/es/Table/{Body → v1/Body}/theme.js +0 -0
- /package/es/Table/{Cell → v1/Cell}/props.js +0 -0
- /package/es/Table/{Cell → v1/Cell}/styles.js +0 -0
- /package/es/Table/{Cell → v1/Cell}/theme.js +0 -0
- /package/es/Table/{ColHeader → v1/ColHeader}/props.js +0 -0
- /package/es/Table/{ColHeader → v1/ColHeader}/styles.js +0 -0
- /package/es/Table/{ColHeader → v1/ColHeader}/theme.js +0 -0
- /package/es/Table/{Head → v1/Head}/props.js +0 -0
- /package/es/Table/{Head → v1/Head}/styles.js +0 -0
- /package/es/Table/{Head → v1/Head}/theme.js +0 -0
- /package/es/Table/{Row → v1/Row}/props.js +0 -0
- /package/es/Table/{Row → v1/Row}/styles.js +0 -0
- /package/es/Table/{Row → v1/Row}/theme.js +0 -0
- /package/es/Table/{RowHeader → v1/RowHeader}/props.js +0 -0
- /package/es/Table/{RowHeader → v1/RowHeader}/styles.js +0 -0
- /package/es/Table/{RowHeader → v1/RowHeader}/theme.js +0 -0
- /package/es/Table/{TableContext.js → v1/TableContext.js} +0 -0
- /package/es/Table/{props.js → v1/props.js} +0 -0
- /package/es/Table/{styles.js → v1/styles.js} +0 -0
- /package/es/Table/{theme.js → v1/theme.js} +0 -0
- /package/lib/Table/{Body → v1/Body}/props.js +0 -0
- /package/lib/Table/{Body → v1/Body}/styles.js +0 -0
- /package/lib/Table/{Body → v1/Body}/theme.js +0 -0
- /package/lib/Table/{Cell → v1/Cell}/props.js +0 -0
- /package/lib/Table/{Cell → v1/Cell}/styles.js +0 -0
- /package/lib/Table/{Cell → v1/Cell}/theme.js +0 -0
- /package/lib/Table/{ColHeader → v1/ColHeader}/props.js +0 -0
- /package/lib/Table/{ColHeader → v1/ColHeader}/styles.js +0 -0
- /package/lib/Table/{ColHeader → v1/ColHeader}/theme.js +0 -0
- /package/lib/Table/{Head → v1/Head}/props.js +0 -0
- /package/lib/Table/{Head → v1/Head}/styles.js +0 -0
- /package/lib/Table/{Head → v1/Head}/theme.js +0 -0
- /package/lib/Table/{Row → v1/Row}/props.js +0 -0
- /package/lib/Table/{Row → v1/Row}/styles.js +0 -0
- /package/lib/Table/{Row → v1/Row}/theme.js +0 -0
- /package/lib/Table/{RowHeader → v1/RowHeader}/props.js +0 -0
- /package/lib/Table/{RowHeader → v1/RowHeader}/styles.js +0 -0
- /package/lib/Table/{RowHeader → v1/RowHeader}/theme.js +0 -0
- /package/lib/Table/{TableContext.js → v1/TableContext.js} +0 -0
- /package/lib/Table/{props.js → v1/props.js} +0 -0
- /package/lib/Table/{styles.js → v1/styles.js} +0 -0
- /package/lib/Table/{theme.js → v1/theme.js} +0 -0
- /package/src/Table/{Body → v1/Body}/props.ts +0 -0
- /package/src/Table/{Body → v1/Body}/styles.ts +0 -0
- /package/src/Table/{Body → v1/Body}/theme.ts +0 -0
- /package/src/Table/{Cell → v1/Cell}/props.ts +0 -0
- /package/src/Table/{Cell → v1/Cell}/styles.ts +0 -0
- /package/src/Table/{Cell → v1/Cell}/theme.ts +0 -0
- /package/src/Table/{ColHeader → v1/ColHeader}/props.ts +0 -0
- /package/src/Table/{ColHeader → v1/ColHeader}/styles.ts +0 -0
- /package/src/Table/{ColHeader → v1/ColHeader}/theme.ts +0 -0
- /package/src/Table/{Head → v1/Head}/props.ts +0 -0
- /package/src/Table/{Head → v1/Head}/styles.ts +0 -0
- /package/src/Table/{Head → v1/Head}/theme.ts +0 -0
- /package/src/Table/{Row → v1/Row}/props.ts +0 -0
- /package/src/Table/{Row → v1/Row}/styles.ts +0 -0
- /package/src/Table/{Row → v1/Row}/theme.ts +0 -0
- /package/src/Table/{RowHeader → v1/RowHeader}/props.ts +0 -0
- /package/src/Table/{RowHeader → v1/RowHeader}/styles.ts +0 -0
- /package/src/Table/{RowHeader → v1/RowHeader}/theme.ts +0 -0
- /package/src/Table/{TableContext.ts → v1/TableContext.ts} +0 -0
- /package/src/Table/{props.ts → v1/props.ts} +0 -0
- /package/src/Table/{styles.ts → v1/styles.ts} +0 -0
- /package/src/Table/{theme.ts → v1/theme.ts} +0 -0
- /package/types/Table/{Body → v1/Body}/index.d.ts +0 -0
- /package/types/Table/{Body → v1/Body}/props.d.ts +0 -0
- /package/types/Table/{Body → v1/Body}/styles.d.ts +0 -0
- /package/types/Table/{Body → v1/Body}/theme.d.ts +0 -0
- /package/types/Table/{Cell → v1/Cell}/index.d.ts +0 -0
- /package/types/Table/{Cell → v1/Cell}/props.d.ts +0 -0
- /package/types/Table/{Cell → v1/Cell}/styles.d.ts +0 -0
- /package/types/Table/{Cell → v1/Cell}/theme.d.ts +0 -0
- /package/types/Table/{ColHeader → v1/ColHeader}/index.d.ts +0 -0
- /package/types/Table/{ColHeader → v1/ColHeader}/props.d.ts +0 -0
- /package/types/Table/{ColHeader → v1/ColHeader}/styles.d.ts +0 -0
- /package/types/Table/{ColHeader → v1/ColHeader}/theme.d.ts +0 -0
- /package/types/Table/{Head → v1/Head}/index.d.ts +0 -0
- /package/types/Table/{Head → v1/Head}/props.d.ts +0 -0
- /package/types/Table/{Head → v1/Head}/styles.d.ts +0 -0
- /package/types/Table/{Head → v1/Head}/theme.d.ts +0 -0
- /package/types/Table/{Row → v1/Row}/index.d.ts +0 -0
- /package/types/Table/{Row → v1/Row}/props.d.ts +0 -0
- /package/types/Table/{Row → v1/Row}/styles.d.ts +0 -0
- /package/types/Table/{Row → v1/Row}/theme.d.ts +0 -0
- /package/types/Table/{RowHeader → v1/RowHeader}/index.d.ts +0 -0
- /package/types/Table/{RowHeader → v1/RowHeader}/props.d.ts +0 -0
- /package/types/Table/{RowHeader → v1/RowHeader}/styles.d.ts +0 -0
- /package/types/Table/{RowHeader → v1/RowHeader}/theme.d.ts +0 -0
- /package/types/Table/{TableContext.d.ts → v1/TableContext.d.ts} +0 -0
- /package/types/Table/{index.d.ts → v1/index.d.ts} +0 -0
- /package/types/Table/{props.d.ts → v1/props.d.ts} +0 -0
- /package/types/Table/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/Table/{theme.d.ts → v1/theme.d.ts} +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
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
|
|
39
|
+
* @return {Object} The final style object, which will be used in the component
|
|
40
|
+
*/
|
|
41
|
+
const generateStyle = (componentTheme, props, _sharedTokens) => {
|
|
42
|
+
const layout = props.layout;
|
|
43
|
+
return {
|
|
44
|
+
table: {
|
|
45
|
+
label: 'table',
|
|
46
|
+
fontSize: componentTheme.fontSize,
|
|
47
|
+
fontFamily: componentTheme.fontFamily,
|
|
48
|
+
fontWeight: componentTheme.fontWeight,
|
|
49
|
+
color: componentTheme.color,
|
|
50
|
+
background: componentTheme.background,
|
|
51
|
+
display: 'table',
|
|
52
|
+
width: '100%',
|
|
53
|
+
borderCollapse: 'collapse',
|
|
54
|
+
borderSpacing: 0,
|
|
55
|
+
...(layout === 'fixed' && {
|
|
56
|
+
tableLayout: 'fixed'
|
|
57
|
+
}),
|
|
58
|
+
caption: {
|
|
59
|
+
textAlign: 'start'
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
var _default = exports.default = generateStyle;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "Table", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _v.Table;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "TableBody", {
|
|
@@ -51,11 +51,11 @@ Object.defineProperty(exports, "TableRowHeader", {
|
|
|
51
51
|
return _RowHeader.RowHeader;
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
-
var
|
|
55
|
-
var _TableContext = require("
|
|
56
|
-
var _Body = require("
|
|
57
|
-
var _Cell = require("
|
|
58
|
-
var _ColHeader = require("
|
|
59
|
-
var _Head = require("
|
|
60
|
-
var _Row = require("
|
|
61
|
-
var _RowHeader = require("
|
|
54
|
+
var _v = require("../Table/v1");
|
|
55
|
+
var _TableContext = require("../Table/v1/TableContext");
|
|
56
|
+
var _Body = require("../Table/v1/Body");
|
|
57
|
+
var _Cell = require("../Table/v1/Cell");
|
|
58
|
+
var _ColHeader = require("../Table/v1/ColHeader");
|
|
59
|
+
var _Head = require("../Table/v1/Head");
|
|
60
|
+
var _Row = require("../Table/v1/Row");
|
|
61
|
+
var _RowHeader = require("../Table/v1/RowHeader");
|
package/lib/exports/b.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Table", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _v.Table;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "TableBody", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _Body.Body;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "TableCell", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _Cell.Cell;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "TableColHeader", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _ColHeader.ColHeader;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "TableContext", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _TableContext.TableContext;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "TableHead", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _Head.Head;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "TableRow", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _Row.Row;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "TableRowHeader", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _RowHeader.RowHeader;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
var _v = require("../Table/v2");
|
|
55
|
+
var _TableContext = require("../Table/v2/TableContext");
|
|
56
|
+
var _Body = require("../Table/v2/Body");
|
|
57
|
+
var _Cell = require("../Table/v2/Cell");
|
|
58
|
+
var _ColHeader = require("../Table/v2/ColHeader");
|
|
59
|
+
var _Head = require("../Table/v2/Head");
|
|
60
|
+
var _Row = require("../Table/v2/Row");
|
|
61
|
+
var _RowHeader = require("../Table/v2/RowHeader");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-table",
|
|
3
|
-
"version": "11.6.
|
|
3
|
+
"version": "11.6.1-snapshot-129",
|
|
4
4
|
"description": "A styled HTML table component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -15,25 +15,25 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.27.6",
|
|
18
|
-
"@instructure/
|
|
19
|
-
"@instructure/
|
|
20
|
-
"@instructure/
|
|
21
|
-
"@instructure/
|
|
22
|
-
"@instructure/ui-icons": "11.6.
|
|
23
|
-
"@instructure/ui-react-utils": "11.6.
|
|
24
|
-
"@instructure/ui-
|
|
25
|
-
"@instructure/ui-
|
|
26
|
-
"@instructure/ui-
|
|
18
|
+
"@instructure/emotion": "11.6.1-snapshot-129",
|
|
19
|
+
"@instructure/console": "11.6.1-snapshot-129",
|
|
20
|
+
"@instructure/shared-types": "11.6.1-snapshot-129",
|
|
21
|
+
"@instructure/ui-a11y-content": "11.6.1-snapshot-129",
|
|
22
|
+
"@instructure/ui-icons": "11.6.1-snapshot-129",
|
|
23
|
+
"@instructure/ui-react-utils": "11.6.1-snapshot-129",
|
|
24
|
+
"@instructure/ui-utils": "11.6.1-snapshot-129",
|
|
25
|
+
"@instructure/ui-simple-select": "11.6.1-snapshot-129",
|
|
26
|
+
"@instructure/ui-view": "11.6.1-snapshot-129"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@testing-library/jest-dom": "^6.6.3",
|
|
30
30
|
"@testing-library/react": "15.0.7",
|
|
31
31
|
"@testing-library/user-event": "^14.6.1",
|
|
32
32
|
"vitest": "^3.2.2",
|
|
33
|
-
"@instructure/ui-axe-check": "11.6.
|
|
34
|
-
"@instructure/ui-babel-preset": "11.6.
|
|
35
|
-
"@instructure/ui-color-utils": "11.6.
|
|
36
|
-
"@instructure/ui-themes": "11.6.
|
|
33
|
+
"@instructure/ui-axe-check": "11.6.1-snapshot-129",
|
|
34
|
+
"@instructure/ui-babel-preset": "11.6.1-snapshot-129",
|
|
35
|
+
"@instructure/ui-color-utils": "11.6.1-snapshot-129",
|
|
36
|
+
"@instructure/ui-themes": "11.6.1-snapshot-129"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": ">=18 <=19"
|
|
@@ -43,17 +43,39 @@
|
|
|
43
43
|
},
|
|
44
44
|
"sideEffects": false,
|
|
45
45
|
"exports": {
|
|
46
|
-
".": {
|
|
47
|
-
"types": "./types/index.d.ts",
|
|
48
|
-
"import": "./es/index.js",
|
|
49
|
-
"require": "./lib/index.js",
|
|
50
|
-
"default": "./es/index.js"
|
|
51
|
-
},
|
|
52
46
|
"./lib/*": "./lib/*",
|
|
53
47
|
"./es/*": "./es/*",
|
|
54
48
|
"./types/*": "./types/*",
|
|
55
49
|
"./package.json": "./package.json",
|
|
56
|
-
"./src/*": "./src/*"
|
|
50
|
+
"./src/*": "./src/*",
|
|
51
|
+
".": {
|
|
52
|
+
"src": "./src/exports/a.ts",
|
|
53
|
+
"types": "./types/exports/a.d.ts",
|
|
54
|
+
"import": "./es/exports/a.js",
|
|
55
|
+
"require": "./lib/exports/a.js",
|
|
56
|
+
"default": "./es/exports/a.js"
|
|
57
|
+
},
|
|
58
|
+
"./v11_6": {
|
|
59
|
+
"src": "./src/exports/a.ts",
|
|
60
|
+
"types": "./types/exports/a.d.ts",
|
|
61
|
+
"import": "./es/exports/a.js",
|
|
62
|
+
"require": "./lib/exports/a.js",
|
|
63
|
+
"default": "./es/exports/a.js"
|
|
64
|
+
},
|
|
65
|
+
"./v11_7": {
|
|
66
|
+
"src": "./src/exports/b.ts",
|
|
67
|
+
"types": "./types/exports/b.d.ts",
|
|
68
|
+
"import": "./es/exports/b.js",
|
|
69
|
+
"require": "./lib/exports/b.js",
|
|
70
|
+
"default": "./es/exports/b.js"
|
|
71
|
+
},
|
|
72
|
+
"./latest": {
|
|
73
|
+
"src": "./src/exports/b.ts",
|
|
74
|
+
"types": "./types/exports/b.d.ts",
|
|
75
|
+
"import": "./es/exports/b.js",
|
|
76
|
+
"require": "./lib/exports/b.js",
|
|
77
|
+
"default": "./es/exports/b.js"
|
|
78
|
+
}
|
|
57
79
|
},
|
|
58
80
|
"scripts": {
|
|
59
81
|
"lint": "ui-scripts lint",
|
|
@@ -31,8 +31,8 @@ import {
|
|
|
31
31
|
} from 'react'
|
|
32
32
|
|
|
33
33
|
import { safeCloneElement, omitProps } from '@instructure/ui-react-utils'
|
|
34
|
-
import { View } from '@instructure/ui-view'
|
|
35
|
-
import { withStyle } from '@instructure/emotion'
|
|
34
|
+
import { View } from '@instructure/ui-view/v11_6'
|
|
35
|
+
import { withStyleLegacy as withStyle } from '@instructure/emotion'
|
|
36
36
|
|
|
37
37
|
import generateStyle from './styles'
|
|
38
38
|
import generateComponentTheme from './theme'
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
import { Component, ContextType } from 'react'
|
|
26
26
|
|
|
27
27
|
import { omitProps, callRenderProp } from '@instructure/ui-react-utils'
|
|
28
|
-
import { View } from '@instructure/ui-view'
|
|
28
|
+
import { View } from '@instructure/ui-view/v11_6'
|
|
29
29
|
|
|
30
|
-
import { withStyle } from '@instructure/emotion'
|
|
30
|
+
import { withStyleLegacy as withStyle } from '@instructure/emotion'
|
|
31
31
|
|
|
32
32
|
import generateStyle from './styles'
|
|
33
33
|
import generateComponentTheme from './theme'
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
IconMiniArrowDoubleLine
|
|
32
32
|
} from '@instructure/ui-icons'
|
|
33
33
|
|
|
34
|
-
import { withStyle } from '@instructure/emotion'
|
|
34
|
+
import { withStyleLegacy as withStyle } from '@instructure/emotion'
|
|
35
35
|
|
|
36
36
|
import generateStyle from './styles'
|
|
37
37
|
import generateComponentTheme from './theme'
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
import { Component, Children, ContextType, type ReactElement } from 'react'
|
|
26
26
|
|
|
27
27
|
import { omitProps, callRenderProp } from '@instructure/ui-react-utils'
|
|
28
|
-
import { SimpleSelect } from '@instructure/ui-simple-select'
|
|
29
|
-
import type { SimpleSelectProps } from '@instructure/ui-simple-select'
|
|
28
|
+
import { SimpleSelect } from '@instructure/ui-simple-select/v11_6'
|
|
29
|
+
import type { SimpleSelectProps } from '@instructure/ui-simple-select/v11_6'
|
|
30
30
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content'
|
|
31
31
|
import { IconCheckLine } from '@instructure/ui-icons'
|
|
32
32
|
import { warn } from '@instructure/console'
|
|
33
33
|
|
|
34
|
-
import { withStyle } from '@instructure/emotion'
|
|
34
|
+
import { withStyleLegacy as withStyle } from '@instructure/emotion'
|
|
35
35
|
|
|
36
36
|
import generateStyle from './styles'
|
|
37
37
|
import generateComponentTheme from './theme'
|
|
@@ -31,9 +31,9 @@ import {
|
|
|
31
31
|
} from 'react'
|
|
32
32
|
|
|
33
33
|
import { omitProps, safeCloneElement } from '@instructure/ui-react-utils'
|
|
34
|
-
import { View } from '@instructure/ui-view'
|
|
34
|
+
import { View } from '@instructure/ui-view/v11_6'
|
|
35
35
|
|
|
36
|
-
import { withStyle } from '@instructure/emotion'
|
|
36
|
+
import { withStyleLegacy as withStyle } from '@instructure/emotion'
|
|
37
37
|
|
|
38
38
|
import generateStyle from './styles'
|
|
39
39
|
import generateComponentTheme from './theme'
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
import { Component, ContextType } from 'react'
|
|
26
26
|
|
|
27
27
|
import { omitProps, callRenderProp } from '@instructure/ui-react-utils'
|
|
28
|
-
import { View } from '@instructure/ui-view'
|
|
28
|
+
import { View } from '@instructure/ui-view/v11_6'
|
|
29
29
|
|
|
30
|
-
import { withStyle } from '@instructure/emotion'
|
|
30
|
+
import { withStyleLegacy as withStyle } from '@instructure/emotion'
|
|
31
31
|
|
|
32
32
|
import generateStyle from './styles'
|
|
33
33
|
import generateComponentTheme from './theme'
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
import { Component, Children, isValidElement, ReactElement } from 'react'
|
|
26
26
|
|
|
27
27
|
import { safeCloneElement, omitProps } from '@instructure/ui-react-utils'
|
|
28
|
-
import { View } from '@instructure/ui-view'
|
|
28
|
+
import { View } from '@instructure/ui-view/v11_6'
|
|
29
29
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content'
|
|
30
30
|
|
|
31
|
-
import { withStyle } from '@instructure/emotion'
|
|
31
|
+
import { withStyleLegacy as withStyle } from '@instructure/emotion'
|
|
32
32
|
|
|
33
33
|
import generateStyle from './styles'
|
|
34
34
|
import generateComponentTheme from './theme'
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
|
|
25
|
+
import {
|
|
26
|
+
Component,
|
|
27
|
+
Children,
|
|
28
|
+
ContextType,
|
|
29
|
+
isValidElement,
|
|
30
|
+
type ReactElement
|
|
31
|
+
} from 'react'
|
|
32
|
+
|
|
33
|
+
import { safeCloneElement, omitProps } from '@instructure/ui-react-utils'
|
|
34
|
+
import { View } from '@instructure/ui-view/latest'
|
|
35
|
+
import { withStyle } from '@instructure/emotion'
|
|
36
|
+
|
|
37
|
+
import generateStyle from './styles'
|
|
38
|
+
import type { TableBodyProps } from './props'
|
|
39
|
+
import { allowedProps } from './props'
|
|
40
|
+
import TableContext from '../TableContext'
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
---
|
|
44
|
+
parent: Table
|
|
45
|
+
id: Table.Body
|
|
46
|
+
---
|
|
47
|
+
**/
|
|
48
|
+
@withStyle(generateStyle)
|
|
49
|
+
class Body extends Component<TableBodyProps> {
|
|
50
|
+
static readonly componentId = 'Table.Body'
|
|
51
|
+
static contextType = TableContext
|
|
52
|
+
declare context: ContextType<typeof TableContext>
|
|
53
|
+
static allowedProps = allowedProps
|
|
54
|
+
static defaultProps = {
|
|
55
|
+
children: null
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
componentDidMount() {
|
|
59
|
+
this.props.makeStyles?.()
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
componentDidUpdate() {
|
|
63
|
+
this.props.makeStyles?.()
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
render() {
|
|
67
|
+
const { children, styles } = this.props
|
|
68
|
+
const { isStacked } = this.context
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<View
|
|
72
|
+
{...View.omitViewProps(omitProps(this.props, Body.allowedProps), Body)}
|
|
73
|
+
as={isStacked ? 'div' : 'tbody'}
|
|
74
|
+
css={styles?.body}
|
|
75
|
+
role={isStacked ? 'rowgroup' : undefined}
|
|
76
|
+
>
|
|
77
|
+
{Children.map(children, (child) => {
|
|
78
|
+
if (isValidElement(child)) {
|
|
79
|
+
return safeCloneElement(child, {
|
|
80
|
+
key: (child as ReactElement<any>).props.name
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
return child
|
|
84
|
+
})}
|
|
85
|
+
</View>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export default Body
|
|
91
|
+
export { Body }
|
|
@@ -0,0 +1,50 @@
|
|
|
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 type { OtherHTMLAttributes } from '@instructure/shared-types'
|
|
26
|
+
import type { ComponentStyle, WithStyleProps } from '@instructure/emotion'
|
|
27
|
+
|
|
28
|
+
type TableBodyOwnProps = {
|
|
29
|
+
/**
|
|
30
|
+
* Body's children should be a container component where each child represents
|
|
31
|
+
* a row.
|
|
32
|
+
*
|
|
33
|
+
* `Table.Row` by default
|
|
34
|
+
*/
|
|
35
|
+
children?: React.ReactNode
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
type PropKeys = keyof TableBodyOwnProps
|
|
39
|
+
|
|
40
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
41
|
+
|
|
42
|
+
type TableBodyProps = TableBodyOwnProps &
|
|
43
|
+
WithStyleProps<null, TableBodyStyle> &
|
|
44
|
+
OtherHTMLAttributes<TableBodyOwnProps>
|
|
45
|
+
|
|
46
|
+
type TableBodyStyle = ComponentStyle<'body'>
|
|
47
|
+
const allowedProps: AllowedPropKeys = ['children']
|
|
48
|
+
|
|
49
|
+
export type { TableBodyProps, TableBodyStyle }
|
|
50
|
+
export { allowedProps }
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
|
|
25
|
+
import type { NewComponentTypes } from '@instructure/ui-themes'
|
|
26
|
+
import type { TableBodyStyle } from './props'
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* ---
|
|
30
|
+
* private: true
|
|
31
|
+
* ---
|
|
32
|
+
* Generates the style object from the theme and provided additional information
|
|
33
|
+
* @param {Object} componentTheme The theme variable object.
|
|
34
|
+
* @return {Object} The final style object, which will be used in the component
|
|
35
|
+
*/
|
|
36
|
+
const generateStyle = (
|
|
37
|
+
componentTheme: NewComponentTypes['TableBody']
|
|
38
|
+
): TableBodyStyle => {
|
|
39
|
+
return {
|
|
40
|
+
body: {
|
|
41
|
+
label: 'body',
|
|
42
|
+
fontSize: componentTheme.fontSize,
|
|
43
|
+
fontFamily: componentTheme.fontFamily,
|
|
44
|
+
fontWeight: componentTheme.fontWeight,
|
|
45
|
+
color: componentTheme.color,
|
|
46
|
+
background: componentTheme.background
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default generateStyle
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
|
|
25
|
+
import { Component, ContextType } from 'react'
|
|
26
|
+
|
|
27
|
+
import { omitProps, callRenderProp } from '@instructure/ui-react-utils'
|
|
28
|
+
import { View } from '@instructure/ui-view/latest'
|
|
29
|
+
|
|
30
|
+
import { withStyle } from '@instructure/emotion'
|
|
31
|
+
|
|
32
|
+
import generateStyle from './styles'
|
|
33
|
+
import type { TableCellProps } from './props'
|
|
34
|
+
import { allowedProps } from './props'
|
|
35
|
+
import TableContext from '../TableContext'
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
---
|
|
39
|
+
parent: Table
|
|
40
|
+
id: Table.Cell
|
|
41
|
+
---
|
|
42
|
+
**/
|
|
43
|
+
@withStyle(generateStyle)
|
|
44
|
+
class Cell extends Component<TableCellProps> {
|
|
45
|
+
static readonly componentId = 'Table.Cell'
|
|
46
|
+
static contextType = TableContext
|
|
47
|
+
declare context: ContextType<typeof TableContext>
|
|
48
|
+
static allowedProps = allowedProps
|
|
49
|
+
|
|
50
|
+
static defaultProps = {
|
|
51
|
+
textAlign: 'start',
|
|
52
|
+
children: null
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
componentDidMount() {
|
|
56
|
+
this.props.makeStyles?.()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
componentDidUpdate() {
|
|
60
|
+
this.props.makeStyles?.()
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
render() {
|
|
64
|
+
const { children, styles, header } = this.props
|
|
65
|
+
const isStacked = this.context.isStacked
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<View
|
|
69
|
+
{...View.omitViewProps(omitProps(this.props, Cell.allowedProps), Cell)}
|
|
70
|
+
as={isStacked ? 'div' : 'td'}
|
|
71
|
+
css={styles?.cell}
|
|
72
|
+
role={isStacked ? 'cell' : undefined}
|
|
73
|
+
>
|
|
74
|
+
{header && callRenderProp(header)}
|
|
75
|
+
{header && ': '}
|
|
76
|
+
{callRenderProp(children)}
|
|
77
|
+
</View>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export default Cell
|
|
83
|
+
export { Cell }
|