@instructure/ui-byline 11.7.2-snapshot-21 → 11.7.2-snapshot-22
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 +5 -2
- package/es/Byline/v2/index.js +86 -0
- package/es/Byline/v2/props.js +26 -0
- package/es/Byline/v2/styles.js +105 -0
- package/es/exports/b.js +24 -0
- package/lib/Byline/v2/index.js +91 -0
- package/lib/Byline/v2/props.js +31 -0
- package/lib/Byline/v2/styles.js +111 -0
- package/lib/exports/b.js +12 -0
- package/package.json +19 -19
- package/src/Byline/v2/README.md +59 -0
- package/src/Byline/v2/index.tsx +103 -0
- package/src/Byline/v2/props.ts +93 -0
- package/src/Byline/v2/styles.ts +116 -0
- package/src/exports/b.ts +25 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Byline/v2/index.d.ts +30 -0
- package/types/Byline/v2/index.d.ts.map +1 -0
- package/types/Byline/v2/props.d.ts +42 -0
- package/types/Byline/v2/props.d.ts.map +1 -0
- package/types/Byline/v2/styles.d.ts +15 -0
- package/types/Byline/v2/styles.d.ts.map +1 -0
- package/types/exports/b.d.ts +3 -0
- package/types/exports/b.d.ts.map +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [11.7.2-snapshot-
|
|
6
|
+
## [11.7.2-snapshot-22](https://github.com/instructure/instructure-ui/compare/v11.7.1...v11.7.2-snapshot-22) (2026-04-01)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **ui-byline:** rework Byline ([066524f](https://github.com/instructure/instructure-ui/commit/066524ff00c2417b29ac4bd9716f559c023f503e))
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
var _dec, _class, _Byline;
|
|
2
|
+
/*
|
|
3
|
+
* The MIT License (MIT)
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { Component } from 'react';
|
|
27
|
+
import { omitProps } from '@instructure/ui-react-utils';
|
|
28
|
+
import { View } from '@instructure/ui-view/latest';
|
|
29
|
+
import { withStyle } from '@instructure/emotion';
|
|
30
|
+
import generateStyle from "./styles.js";
|
|
31
|
+
import { allowedProps } from "./props.js";
|
|
32
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
33
|
+
/**
|
|
34
|
+
---
|
|
35
|
+
category: components
|
|
36
|
+
---
|
|
37
|
+
**/
|
|
38
|
+
let Byline = (_dec = withStyle(generateStyle), _dec(_class = (_Byline = class Byline extends Component {
|
|
39
|
+
constructor(...args) {
|
|
40
|
+
super(...args);
|
|
41
|
+
this.ref = null;
|
|
42
|
+
this.handleRef = el => {
|
|
43
|
+
const elementRef = this.props.elementRef;
|
|
44
|
+
this.ref = el;
|
|
45
|
+
if (typeof elementRef === 'function') {
|
|
46
|
+
elementRef(el);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
componentDidMount() {
|
|
51
|
+
var _this$props$makeStyle, _this$props;
|
|
52
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
53
|
+
}
|
|
54
|
+
componentDidUpdate() {
|
|
55
|
+
var _this$props$makeStyle2, _this$props2;
|
|
56
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
57
|
+
}
|
|
58
|
+
render() {
|
|
59
|
+
var _this$props$styles, _this$props$styles2, _this$props$styles3, _this$props$styles4, _this$props$styles5, _this$props$styles6;
|
|
60
|
+
const passthroughProps = View.omitViewProps(omitProps(this.props, Byline.allowedProps), Byline);
|
|
61
|
+
return _jsxs(View, {
|
|
62
|
+
...passthroughProps,
|
|
63
|
+
elementRef: this.handleRef,
|
|
64
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.byline,
|
|
65
|
+
margin: this.props.margin,
|
|
66
|
+
maxWidth: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.maxWidth,
|
|
67
|
+
children: [_jsx("div", {
|
|
68
|
+
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.figure,
|
|
69
|
+
children: this.props.children
|
|
70
|
+
}), _jsxs("div", {
|
|
71
|
+
css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.caption,
|
|
72
|
+
children: [this.props.title && _jsx("span", {
|
|
73
|
+
css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.title,
|
|
74
|
+
children: this.props.title
|
|
75
|
+
}), this.props.description && _jsx("div", {
|
|
76
|
+
css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.description,
|
|
77
|
+
children: this.props.description
|
|
78
|
+
})]
|
|
79
|
+
})]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}, _Byline.displayName = "Byline", _Byline.componentId = 'Byline', _Byline.allowedProps = allowedProps, _Byline.defaultProps = {
|
|
83
|
+
alignContent: 'center'
|
|
84
|
+
}, _Byline)) || _class);
|
|
85
|
+
export default Byline;
|
|
86
|
+
export { Byline };
|
|
@@ -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 = ['alignContent', 'children', 'description', 'elementRef', 'margin', 'size', 'title'];
|
|
26
|
+
export { allowedProps };
|
|
@@ -0,0 +1,105 @@
|
|
|
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
|
+
/**
|
|
26
|
+
* ---
|
|
27
|
+
* private: true
|
|
28
|
+
* ---
|
|
29
|
+
* Generates the style object from the theme and provided additional information
|
|
30
|
+
* @param componentTheme The theme variable object.
|
|
31
|
+
* @param params Additional parameters to customize the style.
|
|
32
|
+
* @param sharedTokens Shared token object that stores common values for the theme.
|
|
33
|
+
* @return The final style object, which will be used in the component
|
|
34
|
+
*/
|
|
35
|
+
const generateStyle = (componentTheme, params, _sharedTokens) => {
|
|
36
|
+
const alignContent = params.alignContent,
|
|
37
|
+
size = params.size;
|
|
38
|
+
const widthSizeVariants = {
|
|
39
|
+
small: String(componentTheme.small),
|
|
40
|
+
medium: String(componentTheme.medium),
|
|
41
|
+
large: String(componentTheme.large)
|
|
42
|
+
};
|
|
43
|
+
const widthSizeVariant = widthSizeVariants[size];
|
|
44
|
+
const alignContentVariants = {
|
|
45
|
+
top: {
|
|
46
|
+
alignItems: 'flex-start'
|
|
47
|
+
},
|
|
48
|
+
center: {
|
|
49
|
+
alignItems: 'center'
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const bylineStyles = {
|
|
53
|
+
display: 'flex',
|
|
54
|
+
background: componentTheme.background,
|
|
55
|
+
margin: 0,
|
|
56
|
+
padding: 0,
|
|
57
|
+
fontFamily: componentTheme.fontFamily,
|
|
58
|
+
...alignContentVariants[alignContent]
|
|
59
|
+
};
|
|
60
|
+
const captionStyles = {
|
|
61
|
+
color: componentTheme.color,
|
|
62
|
+
margin: 0,
|
|
63
|
+
padding: 0
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
byline: {
|
|
67
|
+
label: 'byline',
|
|
68
|
+
...bylineStyles,
|
|
69
|
+
// NOTE: needs separate groups for `:is()` and `:-webkit-any()` because of css selector group validation (see https://www.w3.org/TR/selectors-3/#grouping)
|
|
70
|
+
'&:is(figure)': bylineStyles,
|
|
71
|
+
'&:-webkit-any(figure)': bylineStyles
|
|
72
|
+
},
|
|
73
|
+
figure: {
|
|
74
|
+
label: 'byline__figure',
|
|
75
|
+
marginInlineStart: 0,
|
|
76
|
+
marginInlineEnd: componentTheme.figureMargin
|
|
77
|
+
},
|
|
78
|
+
caption: {
|
|
79
|
+
label: 'byline__caption',
|
|
80
|
+
...captionStyles,
|
|
81
|
+
// NOTE: needs separate groups for `:is()` and `:-webkit-any()` because of css selector group validation (see https://www.w3.org/TR/selectors-3/#grouping)
|
|
82
|
+
'&:is(figcaption)': captionStyles,
|
|
83
|
+
'&:-webkit-any(figcaption)': captionStyles
|
|
84
|
+
},
|
|
85
|
+
title: {
|
|
86
|
+
label: 'byline__title',
|
|
87
|
+
textRendering: 'optimizeLegibility',
|
|
88
|
+
WebkitFontSmoothing: 'antialiased',
|
|
89
|
+
MozOsxFontSmoothing: 'grayscale',
|
|
90
|
+
display: 'block',
|
|
91
|
+
margin: componentTheme.titleMargin,
|
|
92
|
+
fontSize: componentTheme.titleFontSize,
|
|
93
|
+
fontWeight: componentTheme.titleFontWeight,
|
|
94
|
+
lineHeight: componentTheme.titleLineHeight
|
|
95
|
+
},
|
|
96
|
+
description: {
|
|
97
|
+
label: 'byline__description',
|
|
98
|
+
fontSize: componentTheme.descriptionFontSize,
|
|
99
|
+
lineHeight: componentTheme.descriptionLineHeight,
|
|
100
|
+
fontWeight: componentTheme.descriptionFontWeight
|
|
101
|
+
},
|
|
102
|
+
maxWidth: widthSizeVariant
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
export default generateStyle;
|
package/es/exports/b.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 { Byline } from "../Byline/v2/index.js";
|
|
@@ -0,0 +1,91 @@
|
|
|
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.Byline = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
10
|
+
var _latest = require("@instructure/ui-view/latest");
|
|
11
|
+
var _emotion = require("@instructure/emotion");
|
|
12
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
13
|
+
var _props = require("./props");
|
|
14
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
15
|
+
var _dec, _class, _Byline;
|
|
16
|
+
/*
|
|
17
|
+
* The MIT License (MIT)
|
|
18
|
+
*
|
|
19
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
20
|
+
*
|
|
21
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
22
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
23
|
+
* in the Software without restriction, including without limitation the rights
|
|
24
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
25
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
26
|
+
* furnished to do so, subject to the following conditions:
|
|
27
|
+
*
|
|
28
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
29
|
+
* copies or substantial portions of the Software.
|
|
30
|
+
*
|
|
31
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
32
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
33
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
34
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
35
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
36
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
37
|
+
* SOFTWARE.
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
---
|
|
41
|
+
category: components
|
|
42
|
+
---
|
|
43
|
+
**/
|
|
44
|
+
let Byline = exports.Byline = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class = (_Byline = class Byline extends _react.Component {
|
|
45
|
+
constructor(...args) {
|
|
46
|
+
super(...args);
|
|
47
|
+
this.ref = null;
|
|
48
|
+
this.handleRef = el => {
|
|
49
|
+
const elementRef = this.props.elementRef;
|
|
50
|
+
this.ref = el;
|
|
51
|
+
if (typeof elementRef === 'function') {
|
|
52
|
+
elementRef(el);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
componentDidMount() {
|
|
57
|
+
var _this$props$makeStyle, _this$props;
|
|
58
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
59
|
+
}
|
|
60
|
+
componentDidUpdate() {
|
|
61
|
+
var _this$props$makeStyle2, _this$props2;
|
|
62
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
63
|
+
}
|
|
64
|
+
render() {
|
|
65
|
+
var _this$props$styles, _this$props$styles2, _this$props$styles3, _this$props$styles4, _this$props$styles5, _this$props$styles6;
|
|
66
|
+
const passthroughProps = _latest.View.omitViewProps((0, _omitProps.omitProps)(this.props, Byline.allowedProps), Byline);
|
|
67
|
+
return (0, _jsxRuntime.jsxs)(_latest.View, {
|
|
68
|
+
...passthroughProps,
|
|
69
|
+
elementRef: this.handleRef,
|
|
70
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.byline,
|
|
71
|
+
margin: this.props.margin,
|
|
72
|
+
maxWidth: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.maxWidth,
|
|
73
|
+
children: [(0, _jsxRuntime.jsx)("div", {
|
|
74
|
+
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.figure,
|
|
75
|
+
children: this.props.children
|
|
76
|
+
}), (0, _jsxRuntime.jsxs)("div", {
|
|
77
|
+
css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.caption,
|
|
78
|
+
children: [this.props.title && (0, _jsxRuntime.jsx)("span", {
|
|
79
|
+
css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.title,
|
|
80
|
+
children: this.props.title
|
|
81
|
+
}), this.props.description && (0, _jsxRuntime.jsx)("div", {
|
|
82
|
+
css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.description,
|
|
83
|
+
children: this.props.description
|
|
84
|
+
})]
|
|
85
|
+
})]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}, _Byline.displayName = "Byline", _Byline.componentId = 'Byline', _Byline.allowedProps = _props.allowedProps, _Byline.defaultProps = {
|
|
89
|
+
alignContent: 'center'
|
|
90
|
+
}, _Byline)) || _class);
|
|
91
|
+
var _default = exports.default = Byline;
|
|
@@ -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 = ['alignContent', 'children', 'description', 'elementRef', 'margin', 'size', 'title'];
|
|
@@ -0,0 +1,111 @@
|
|
|
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 componentTheme The theme variable object.
|
|
37
|
+
* @param params Additional parameters to customize the style.
|
|
38
|
+
* @param sharedTokens Shared token object that stores common values for the theme.
|
|
39
|
+
* @return The final style object, which will be used in the component
|
|
40
|
+
*/
|
|
41
|
+
const generateStyle = (componentTheme, params, _sharedTokens) => {
|
|
42
|
+
const alignContent = params.alignContent,
|
|
43
|
+
size = params.size;
|
|
44
|
+
const widthSizeVariants = {
|
|
45
|
+
small: String(componentTheme.small),
|
|
46
|
+
medium: String(componentTheme.medium),
|
|
47
|
+
large: String(componentTheme.large)
|
|
48
|
+
};
|
|
49
|
+
const widthSizeVariant = widthSizeVariants[size];
|
|
50
|
+
const alignContentVariants = {
|
|
51
|
+
top: {
|
|
52
|
+
alignItems: 'flex-start'
|
|
53
|
+
},
|
|
54
|
+
center: {
|
|
55
|
+
alignItems: 'center'
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const bylineStyles = {
|
|
59
|
+
display: 'flex',
|
|
60
|
+
background: componentTheme.background,
|
|
61
|
+
margin: 0,
|
|
62
|
+
padding: 0,
|
|
63
|
+
fontFamily: componentTheme.fontFamily,
|
|
64
|
+
...alignContentVariants[alignContent]
|
|
65
|
+
};
|
|
66
|
+
const captionStyles = {
|
|
67
|
+
color: componentTheme.color,
|
|
68
|
+
margin: 0,
|
|
69
|
+
padding: 0
|
|
70
|
+
};
|
|
71
|
+
return {
|
|
72
|
+
byline: {
|
|
73
|
+
label: 'byline',
|
|
74
|
+
...bylineStyles,
|
|
75
|
+
// NOTE: needs separate groups for `:is()` and `:-webkit-any()` because of css selector group validation (see https://www.w3.org/TR/selectors-3/#grouping)
|
|
76
|
+
'&:is(figure)': bylineStyles,
|
|
77
|
+
'&:-webkit-any(figure)': bylineStyles
|
|
78
|
+
},
|
|
79
|
+
figure: {
|
|
80
|
+
label: 'byline__figure',
|
|
81
|
+
marginInlineStart: 0,
|
|
82
|
+
marginInlineEnd: componentTheme.figureMargin
|
|
83
|
+
},
|
|
84
|
+
caption: {
|
|
85
|
+
label: 'byline__caption',
|
|
86
|
+
...captionStyles,
|
|
87
|
+
// NOTE: needs separate groups for `:is()` and `:-webkit-any()` because of css selector group validation (see https://www.w3.org/TR/selectors-3/#grouping)
|
|
88
|
+
'&:is(figcaption)': captionStyles,
|
|
89
|
+
'&:-webkit-any(figcaption)': captionStyles
|
|
90
|
+
},
|
|
91
|
+
title: {
|
|
92
|
+
label: 'byline__title',
|
|
93
|
+
textRendering: 'optimizeLegibility',
|
|
94
|
+
WebkitFontSmoothing: 'antialiased',
|
|
95
|
+
MozOsxFontSmoothing: 'grayscale',
|
|
96
|
+
display: 'block',
|
|
97
|
+
margin: componentTheme.titleMargin,
|
|
98
|
+
fontSize: componentTheme.titleFontSize,
|
|
99
|
+
fontWeight: componentTheme.titleFontWeight,
|
|
100
|
+
lineHeight: componentTheme.titleLineHeight
|
|
101
|
+
},
|
|
102
|
+
description: {
|
|
103
|
+
label: 'byline__description',
|
|
104
|
+
fontSize: componentTheme.descriptionFontSize,
|
|
105
|
+
lineHeight: componentTheme.descriptionLineHeight,
|
|
106
|
+
fontWeight: componentTheme.descriptionFontWeight
|
|
107
|
+
},
|
|
108
|
+
maxWidth: widthSizeVariant
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
var _default = exports.default = generateStyle;
|
package/lib/exports/b.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-byline",
|
|
3
|
-
"version": "11.7.2-snapshot-
|
|
3
|
+
"version": "11.7.2-snapshot-22",
|
|
4
4
|
"description": "A Byline component.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -15,19 +15,19 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.27.6",
|
|
18
|
-
"@instructure/emotion": "11.7.2-snapshot-
|
|
19
|
-
"@instructure/
|
|
20
|
-
"@instructure/
|
|
21
|
-
"@instructure/ui-view": "11.7.2-snapshot-
|
|
18
|
+
"@instructure/emotion": "11.7.2-snapshot-22",
|
|
19
|
+
"@instructure/ui-react-utils": "11.7.2-snapshot-22",
|
|
20
|
+
"@instructure/shared-types": "11.7.2-snapshot-22",
|
|
21
|
+
"@instructure/ui-view": "11.7.2-snapshot-22"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@testing-library/jest-dom": "^6.6.3",
|
|
25
25
|
"@testing-library/react": "15.0.7",
|
|
26
26
|
"vitest": "^3.2.2",
|
|
27
|
-
"@instructure/ui-axe-check": "11.7.2-snapshot-
|
|
28
|
-
"@instructure/ui-babel-preset": "11.7.2-snapshot-
|
|
29
|
-
"@instructure/ui-
|
|
30
|
-
"@instructure/ui-
|
|
27
|
+
"@instructure/ui-axe-check": "11.7.2-snapshot-22",
|
|
28
|
+
"@instructure/ui-babel-preset": "11.7.2-snapshot-22",
|
|
29
|
+
"@instructure/ui-color-utils": "11.7.2-snapshot-22",
|
|
30
|
+
"@instructure/ui-themes": "11.7.2-snapshot-22"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": ">=18 <=19"
|
|
@@ -57,18 +57,18 @@
|
|
|
57
57
|
"default": "./es/exports/a.js"
|
|
58
58
|
},
|
|
59
59
|
"./v11_7": {
|
|
60
|
-
"src": "./src/exports/
|
|
61
|
-
"types": "./types/exports/
|
|
62
|
-
"import": "./es/exports/
|
|
63
|
-
"require": "./lib/exports/
|
|
64
|
-
"default": "./es/exports/
|
|
60
|
+
"src": "./src/exports/b.ts",
|
|
61
|
+
"types": "./types/exports/b.d.ts",
|
|
62
|
+
"import": "./es/exports/b.js",
|
|
63
|
+
"require": "./lib/exports/b.js",
|
|
64
|
+
"default": "./es/exports/b.js"
|
|
65
65
|
},
|
|
66
66
|
"./latest": {
|
|
67
|
-
"src": "./src/exports/
|
|
68
|
-
"types": "./types/exports/
|
|
69
|
-
"import": "./es/exports/
|
|
70
|
-
"require": "./lib/exports/
|
|
71
|
-
"default": "./es/exports/
|
|
67
|
+
"src": "./src/exports/b.ts",
|
|
68
|
+
"types": "./types/exports/b.d.ts",
|
|
69
|
+
"import": "./es/exports/b.js",
|
|
70
|
+
"require": "./lib/exports/b.js",
|
|
71
|
+
"default": "./es/exports/b.js"
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
"scripts": {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
describes: Byline
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
A byline component with a visual and a caption:
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
---
|
|
9
|
+
type: example
|
|
10
|
+
---
|
|
11
|
+
<Byline description={lorem.sentence()}>
|
|
12
|
+
<Avatar name="Julia Childer" />
|
|
13
|
+
</Byline>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Create a heading by using the `title` prop, and add space around the Byline
|
|
17
|
+
component via the `margin` prop. To constrain the component's width, use
|
|
18
|
+
the `size` prop.
|
|
19
|
+
|
|
20
|
+
You can also adjust the alignment of the visual object with the descriptive text by
|
|
21
|
+
setting the `alignContent` prop.
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
---
|
|
25
|
+
type: example
|
|
26
|
+
---
|
|
27
|
+
<Byline
|
|
28
|
+
margin="x-large auto"
|
|
29
|
+
size="small"
|
|
30
|
+
alignContent="top"
|
|
31
|
+
title="Graham Taylor"
|
|
32
|
+
description={lorem.paragraph()}
|
|
33
|
+
>
|
|
34
|
+
<Avatar name="Graham Taylor" />
|
|
35
|
+
</Byline>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
---
|
|
40
|
+
type: example
|
|
41
|
+
---
|
|
42
|
+
<Byline
|
|
43
|
+
description={
|
|
44
|
+
<View display="block" margin="0 0 0 x-small">
|
|
45
|
+
<Heading level="h2">
|
|
46
|
+
<Link href="#">Clickable Heading</Link>
|
|
47
|
+
</Heading>
|
|
48
|
+
<Text
|
|
49
|
+
size="x-small"
|
|
50
|
+
transform="uppercase"
|
|
51
|
+
letterSpacing="expanded"
|
|
52
|
+
>
|
|
53
|
+
Something here
|
|
54
|
+
</Text>
|
|
55
|
+
</View>
|
|
56
|
+
}>
|
|
57
|
+
<HeartInstUIIcon size="medium" color="successColor" />
|
|
58
|
+
</Byline>
|
|
59
|
+
```
|