@instructure/ui-card 0.0.0-stage → 11.7.10-snapshot--1
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 +17 -0
- package/LICENSE.md +28 -0
- package/README.md +23 -2
- package/es/Card/v1/index.js +59 -0
- package/es/Card/v1/props.js +26 -0
- package/es/Card/v1/styles.js +99 -0
- package/es/exports/a.js +24 -0
- package/lib/Card/v1/index.js +65 -0
- package/lib/Card/v1/props.js +31 -0
- package/lib/Card/v1/styles.js +105 -0
- package/lib/exports/a.js +12 -0
- package/lib/package.json +1 -0
- package/package.json +69 -3
- package/src/Card/v1/README.md +105 -0
- package/src/Card/v1/index.tsx +57 -0
- package/src/Card/v1/props.ts +55 -0
- package/src/Card/v1/styles.ts +107 -0
- package/src/exports/a.ts +25 -0
- package/tsconfig.build.json +29 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +4 -0
- package/types/Card/v1/index.d.ts +10 -0
- package/types/Card/v1/index.d.ts.map +1 -0
- package/types/Card/v1/props.d.ts +23 -0
- package/types/Card/v1/props.d.ts.map +1 -0
- package/types/Card/v1/styles.d.ts +14 -0
- package/types/Card/v1/styles.d.ts.map +1 -0
- package/types/exports/a.d.ts +3 -0
- package/types/exports/a.d.ts.map +1 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [11.7.10-snapshot--1](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.10-snapshot--1) (2026-10-14)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **ui-card:** add Card component with base and nested variants ([#2743](https://github.com/instructure/instructure-ui/issues/2743)) ([2b652ea](https://github.com/instructure/instructure-ui/commit/2b652ea90c73805905ebb6302c45c52aa2d7f69a))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## [11.7.9](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9) (2026-10-13)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **ui-card:** add Card component with base and nested variants ([#2743](https://github.com/instructure/instructure-ui/issues/2743)) ([2b652ea](https://github.com/instructure/instructure-ui/commit/2b652ea90c73805905ebb6302c45c52aa2d7f69a))
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: The MIT License (MIT)
|
|
3
|
+
category: Getting Started
|
|
4
|
+
order: 9
|
|
5
|
+
isWIP: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# The MIT License (MIT)
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2015 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.
|
package/README.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
## ui-card
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[![npm][npm]][npm-url]
|
|
4
|
+
[![MIT License][license-badge]][license]
|
|
5
|
+
[![Code of Conduct][coc-badge]][coc]
|
|
6
|
+
|
|
7
|
+
### Components
|
|
8
|
+
|
|
9
|
+
The `ui-card` package contains the following:
|
|
10
|
+
|
|
11
|
+
- Card
|
|
12
|
+
|
|
13
|
+
### Installation
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install @instructure/ui-card
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
[npm]: https://img.shields.io/npm/v/@instructure/ui-card.svg
|
|
20
|
+
[npm-url]: https://npmjs.com/package/@instructure/ui-card
|
|
21
|
+
[license-badge]: https://img.shields.io/npm/l/instructure-ui.svg?style=flat-square
|
|
22
|
+
[license]: https://github.com/instructure/instructure-ui/blob/master/LICENSE.md
|
|
23
|
+
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
|
|
24
|
+
[coc]: https://github.com/instructure/instructure-ui/blob/master/CODE_OF_CONDUCT.md
|
|
@@ -0,0 +1,59 @@
|
|
|
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 { useStyleNew } from '@instructure/emotion';
|
|
25
|
+
import { passthroughProps } from '@instructure/ui-react-utils';
|
|
26
|
+
import generateStyle from './styles.js';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
---
|
|
30
|
+
category: components/Cards
|
|
31
|
+
---
|
|
32
|
+
**/
|
|
33
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
34
|
+
const Card = ({
|
|
35
|
+
children,
|
|
36
|
+
variant = 'base',
|
|
37
|
+
themeOverride,
|
|
38
|
+
...rest
|
|
39
|
+
}) => {
|
|
40
|
+
const styles = useStyleNew({
|
|
41
|
+
generateStyle,
|
|
42
|
+
themeOverride,
|
|
43
|
+
params: {
|
|
44
|
+
variant
|
|
45
|
+
},
|
|
46
|
+
componentId: 'Card',
|
|
47
|
+
displayName: 'Card'
|
|
48
|
+
});
|
|
49
|
+
return _jsx("div", {
|
|
50
|
+
...passthroughProps(rest),
|
|
51
|
+
css: styles?.card,
|
|
52
|
+
children: _jsx("div", {
|
|
53
|
+
css: styles?.content,
|
|
54
|
+
children: children
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
export default Card;
|
|
59
|
+
export { Card };
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
const allowedProps = ['children', 'variant'];
|
|
26
|
+
export { allowedProps };
|
|
@@ -0,0 +1,99 @@
|
|
|
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 { boxShadowObjectsToCSSString } from '@instructure/ui-themes';
|
|
26
|
+
/**
|
|
27
|
+
* ---
|
|
28
|
+
* private: true
|
|
29
|
+
* ---
|
|
30
|
+
* Generates the style object from the theme and provided additional information
|
|
31
|
+
* @param componentTheme The theme variable object.
|
|
32
|
+
* @param props the props of the component, the style is applied to
|
|
33
|
+
* @return The final style object, which will be used in the component
|
|
34
|
+
*/
|
|
35
|
+
const generateStyle = (componentTheme, props) => {
|
|
36
|
+
const {
|
|
37
|
+
variant
|
|
38
|
+
} = props;
|
|
39
|
+
const variantSizeStyles = {
|
|
40
|
+
base: {
|
|
41
|
+
sm: {
|
|
42
|
+
borderRadius: componentTheme.borderRadiusBaseSm,
|
|
43
|
+
padding: componentTheme.paddingBaseSm
|
|
44
|
+
},
|
|
45
|
+
md: {
|
|
46
|
+
borderRadius: componentTheme.borderRadiusBaseMd,
|
|
47
|
+
padding: componentTheme.paddingBaseMd
|
|
48
|
+
},
|
|
49
|
+
lg: {
|
|
50
|
+
borderRadius: componentTheme.borderRadiusBaseLg,
|
|
51
|
+
padding: componentTheme.paddingBaseLg
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
nested: {
|
|
55
|
+
sm: {
|
|
56
|
+
borderRadius: componentTheme.borderRadiusNestedSm,
|
|
57
|
+
padding: componentTheme.paddingNestedSm
|
|
58
|
+
},
|
|
59
|
+
md: {
|
|
60
|
+
borderRadius: componentTheme.borderRadiusNestedMd,
|
|
61
|
+
padding: componentTheme.paddingNestedMd
|
|
62
|
+
},
|
|
63
|
+
lg: {
|
|
64
|
+
borderRadius: componentTheme.borderRadiusNestedLg,
|
|
65
|
+
padding: componentTheme.paddingNestedLg
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const variantVariants = {
|
|
70
|
+
base: {
|
|
71
|
+
background: componentTheme.backgroundColor,
|
|
72
|
+
boxShadow: boxShadowObjectsToCSSString(componentTheme.boxShadow)
|
|
73
|
+
},
|
|
74
|
+
nested: {
|
|
75
|
+
border: `1px solid ${componentTheme.nestedBorderColor}`
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
card: {
|
|
80
|
+
label: 'card',
|
|
81
|
+
containerType: 'inline-size',
|
|
82
|
+
width: '100%'
|
|
83
|
+
},
|
|
84
|
+
content: {
|
|
85
|
+
overflowWrap: 'anywhere',
|
|
86
|
+
...variantVariants[variant],
|
|
87
|
+
[`@container (width < ${componentTheme.breakpointMd})`]: {
|
|
88
|
+
...variantSizeStyles[variant]?.sm
|
|
89
|
+
},
|
|
90
|
+
[`@container ((width >= ${componentTheme.breakpointMd}) and (width < ${componentTheme.breakpointLg}))`]: {
|
|
91
|
+
...variantSizeStyles[variant]?.md
|
|
92
|
+
},
|
|
93
|
+
[`@container (width >= ${componentTheme.breakpointLg})`]: {
|
|
94
|
+
...variantSizeStyles[variant]?.lg
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
export default generateStyle;
|
package/es/exports/a.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
export { Card } from '../Card/v1/index.js';
|
|
@@ -0,0 +1,65 @@
|
|
|
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.Card = void 0;
|
|
8
|
+
var _emotion = require("@instructure/emotion");
|
|
9
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
10
|
+
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
11
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
12
|
+
/*
|
|
13
|
+
* The MIT License (MIT)
|
|
14
|
+
*
|
|
15
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
16
|
+
*
|
|
17
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
18
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
19
|
+
* in the Software without restriction, including without limitation the rights
|
|
20
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
21
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
22
|
+
* furnished to do so, subject to the following conditions:
|
|
23
|
+
*
|
|
24
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
25
|
+
* copies or substantial portions of the Software.
|
|
26
|
+
*
|
|
27
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
30
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
31
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
|
+
* SOFTWARE.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
---
|
|
38
|
+
category: components/Cards
|
|
39
|
+
---
|
|
40
|
+
**/const Card = ({
|
|
41
|
+
children,
|
|
42
|
+
variant = 'base',
|
|
43
|
+
themeOverride,
|
|
44
|
+
...rest
|
|
45
|
+
}) => {
|
|
46
|
+
const styles = (0, _emotion.useStyleNew)({
|
|
47
|
+
generateStyle: _styles.default,
|
|
48
|
+
themeOverride,
|
|
49
|
+
params: {
|
|
50
|
+
variant
|
|
51
|
+
},
|
|
52
|
+
componentId: 'Card',
|
|
53
|
+
displayName: 'Card'
|
|
54
|
+
});
|
|
55
|
+
return (0, _jsxRuntime.jsx)("div", {
|
|
56
|
+
...(0, _uiReactUtils.passthroughProps)(rest),
|
|
57
|
+
css: styles?.card,
|
|
58
|
+
children: (0, _jsxRuntime.jsx)("div", {
|
|
59
|
+
css: styles?.content,
|
|
60
|
+
children: children
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
exports.Card = Card;
|
|
65
|
+
var _default = exports.default = Card;
|
|
@@ -0,0 +1,31 @@
|
|
|
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', 'variant'];
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _uiThemes = require("@instructure/ui-themes");
|
|
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
|
+
* private: true
|
|
35
|
+
* ---
|
|
36
|
+
* Generates the style object from the theme and provided additional information
|
|
37
|
+
* @param componentTheme The theme variable object.
|
|
38
|
+
* @param props the props of the component, the style is applied to
|
|
39
|
+
* @return The final style object, which will be used in the component
|
|
40
|
+
*/
|
|
41
|
+
const generateStyle = (componentTheme, props) => {
|
|
42
|
+
const {
|
|
43
|
+
variant
|
|
44
|
+
} = props;
|
|
45
|
+
const variantSizeStyles = {
|
|
46
|
+
base: {
|
|
47
|
+
sm: {
|
|
48
|
+
borderRadius: componentTheme.borderRadiusBaseSm,
|
|
49
|
+
padding: componentTheme.paddingBaseSm
|
|
50
|
+
},
|
|
51
|
+
md: {
|
|
52
|
+
borderRadius: componentTheme.borderRadiusBaseMd,
|
|
53
|
+
padding: componentTheme.paddingBaseMd
|
|
54
|
+
},
|
|
55
|
+
lg: {
|
|
56
|
+
borderRadius: componentTheme.borderRadiusBaseLg,
|
|
57
|
+
padding: componentTheme.paddingBaseLg
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
nested: {
|
|
61
|
+
sm: {
|
|
62
|
+
borderRadius: componentTheme.borderRadiusNestedSm,
|
|
63
|
+
padding: componentTheme.paddingNestedSm
|
|
64
|
+
},
|
|
65
|
+
md: {
|
|
66
|
+
borderRadius: componentTheme.borderRadiusNestedMd,
|
|
67
|
+
padding: componentTheme.paddingNestedMd
|
|
68
|
+
},
|
|
69
|
+
lg: {
|
|
70
|
+
borderRadius: componentTheme.borderRadiusNestedLg,
|
|
71
|
+
padding: componentTheme.paddingNestedLg
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const variantVariants = {
|
|
76
|
+
base: {
|
|
77
|
+
background: componentTheme.backgroundColor,
|
|
78
|
+
boxShadow: (0, _uiThemes.boxShadowObjectsToCSSString)(componentTheme.boxShadow)
|
|
79
|
+
},
|
|
80
|
+
nested: {
|
|
81
|
+
border: `1px solid ${componentTheme.nestedBorderColor}`
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
card: {
|
|
86
|
+
label: 'card',
|
|
87
|
+
containerType: 'inline-size',
|
|
88
|
+
width: '100%'
|
|
89
|
+
},
|
|
90
|
+
content: {
|
|
91
|
+
overflowWrap: 'anywhere',
|
|
92
|
+
...variantVariants[variant],
|
|
93
|
+
[`@container (width < ${componentTheme.breakpointMd})`]: {
|
|
94
|
+
...variantSizeStyles[variant]?.sm
|
|
95
|
+
},
|
|
96
|
+
[`@container ((width >= ${componentTheme.breakpointMd}) and (width < ${componentTheme.breakpointLg}))`]: {
|
|
97
|
+
...variantSizeStyles[variant]?.md
|
|
98
|
+
},
|
|
99
|
+
[`@container (width >= ${componentTheme.breakpointLg})`]: {
|
|
100
|
+
...variantSizeStyles[variant]?.lg
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
var _default = exports.default = generateStyle;
|
package/lib/exports/a.js
ADDED
package/lib/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-card",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "11.7.10-snapshot--1",
|
|
4
|
+
"description": "A basic wrapper component for grouping content with padding, border radius, shadow, and background.",
|
|
5
|
+
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
|
+
"module": "./es/index.js",
|
|
7
|
+
"main": "./lib/index.js",
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/instructure/instructure-ui.git"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://instructure.github.io/instructure-ui/",
|
|
14
|
+
"bugs": "https://github.com/instructure/instructure-ui/issues",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@babel/runtime": "^7.29.7",
|
|
18
|
+
"@instructure/emotion": "11.7.10-snapshot--1",
|
|
19
|
+
"@instructure/shared-types": "11.7.10-snapshot--1",
|
|
20
|
+
"@instructure/ui-react-utils": "11.7.10-snapshot--1",
|
|
21
|
+
"@instructure/ui-themes": "11.7.10-snapshot--1"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@instructure/ui-axe-check": "11.7.10-snapshot--1",
|
|
25
|
+
"@instructure/ui-babel-preset": "11.7.10-snapshot--1",
|
|
26
|
+
"vitest": "^5.0.0"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"react": ">=18 <=19"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"sideEffects": false,
|
|
35
|
+
"exports": {
|
|
36
|
+
"./lib/*": "./lib/*",
|
|
37
|
+
"./es/*": "./es/*",
|
|
38
|
+
"./types/*": "./types/*",
|
|
39
|
+
"./package.json": "./package.json",
|
|
40
|
+
"./src/*": "./src/*",
|
|
41
|
+
".": {
|
|
42
|
+
"src": "./src/exports/a.ts",
|
|
43
|
+
"types": "./types/exports/a.d.ts",
|
|
44
|
+
"import": "./es/exports/a.js",
|
|
45
|
+
"require": "./lib/exports/a.js",
|
|
46
|
+
"default": "./es/exports/a.js"
|
|
47
|
+
},
|
|
48
|
+
"./v11_7": {
|
|
49
|
+
"src": "./src/exports/a.ts",
|
|
50
|
+
"types": "./types/exports/a.d.ts",
|
|
51
|
+
"import": "./es/exports/a.js",
|
|
52
|
+
"require": "./lib/exports/a.js",
|
|
53
|
+
"default": "./es/exports/a.js"
|
|
54
|
+
},
|
|
55
|
+
"./latest": {
|
|
56
|
+
"src": "./src/exports/a.ts",
|
|
57
|
+
"types": "./types/exports/a.d.ts",
|
|
58
|
+
"import": "./es/exports/a.js",
|
|
59
|
+
"require": "./lib/exports/a.js",
|
|
60
|
+
"default": "./es/exports/a.js"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"lint": "ui-scripts lint",
|
|
65
|
+
"lint:fix": "ui-scripts lint --fix",
|
|
66
|
+
"clean": "ui-scripts clean",
|
|
67
|
+
"build": "ui-scripts build --modules es,cjs",
|
|
68
|
+
"build:watch": "pnpm run ts:check -- --watch & ui-scripts build --watch",
|
|
69
|
+
"build:types": "tsc -p tsconfig.build.json",
|
|
70
|
+
"ts:check": "tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
|
|
71
|
+
}
|
|
6
72
|
}
|