@telus-uds/components-web 1.4.0 → 1.5.0
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 +11 -2
- package/lib/Paragraph/Paragraph.js +107 -0
- package/lib/Paragraph/index.js +13 -0
- package/lib/index.js +9 -0
- package/lib-module/Paragraph/Paragraph.js +89 -0
- package/lib-module/Paragraph/index.js +2 -0
- package/lib-module/index.js +1 -0
- package/package.json +2 -2
- package/src/Paragraph/Paragraph.jsx +79 -0
- package/src/Paragraph/index.js +3 -0
- package/src/index.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-web
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 18 Apr 2023 11:46:09 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.5.0
|
|
8
|
+
|
|
9
|
+
Tue, 18 Apr 2023 11:46:09 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Paragraph multibranded (akshay.pandey1@telus.com)
|
|
14
|
+
- Bump @telus-uds/components-base to v1.34.1
|
|
15
|
+
|
|
7
16
|
## 1.4.0
|
|
8
17
|
|
|
9
|
-
Thu, 13 Apr 2023 05:
|
|
18
|
+
Thu, 13 Apr 2023 05:59:09 GMT
|
|
10
19
|
|
|
11
20
|
### Minor changes
|
|
12
21
|
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
+
|
|
14
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
15
|
+
|
|
16
|
+
var _utils = require("../utils");
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
23
|
+
|
|
24
|
+
const StyledParagraph = /*#__PURE__*/_styledComponents.default.p.withConfig({
|
|
25
|
+
displayName: "Paragraph__StyledParagraph",
|
|
26
|
+
componentId: "components-web__sc-1bg9r8p-0"
|
|
27
|
+
})(["", " ", " &:first-child{margin-block-start:0em;}&:last-child{margin-block-end:0em;}"], _ref => {
|
|
28
|
+
let {
|
|
29
|
+
align
|
|
30
|
+
} = _ref;
|
|
31
|
+
return align ? `text-align: ${align};` : '';
|
|
32
|
+
}, _ref2 => {
|
|
33
|
+
let {
|
|
34
|
+
linesBetween
|
|
35
|
+
} = _ref2;
|
|
36
|
+
return `
|
|
37
|
+
margin-block-start: ${linesBetween}em;
|
|
38
|
+
margin-block-end: ${linesBetween}em;
|
|
39
|
+
`;
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Block text as an HTML ```<p>``` element.
|
|
43
|
+
*
|
|
44
|
+
* ##Usage criteria
|
|
45
|
+
*
|
|
46
|
+
* - All body text should be contained in a **Paragraph**, regardless of length.
|
|
47
|
+
* - If the Paragraph is on a dark background, variant **{ invert: true }** must be used to maintain sufficient colour
|
|
48
|
+
contrast.
|
|
49
|
+
* - All Allium Typography variants other than header size variants are supported.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
const Paragraph = _ref3 => {
|
|
54
|
+
let {
|
|
55
|
+
children,
|
|
56
|
+
variant,
|
|
57
|
+
tokens,
|
|
58
|
+
testID,
|
|
59
|
+
align,
|
|
60
|
+
linesBetween = 1,
|
|
61
|
+
...rest
|
|
62
|
+
} = _ref3;
|
|
63
|
+
const style = (0, _utils.useTypographyTheme)(variant, tokens);
|
|
64
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledParagraph, {
|
|
65
|
+
linesBetween: linesBetween,
|
|
66
|
+
"data-testid": testID,
|
|
67
|
+
align: align,
|
|
68
|
+
style: style,
|
|
69
|
+
...selectProps(rest),
|
|
70
|
+
children: children
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
Paragraph.propTypes = { ...selectedSystemPropTypes,
|
|
75
|
+
children: _propTypes.default.node.isRequired,
|
|
76
|
+
testID: _propTypes.default.string,
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Sets the alignment style for the paragraph. Same options as Typography's `align` prop.
|
|
80
|
+
* 'justify' should be avoided as it usually reduces ease of reading.
|
|
81
|
+
*/
|
|
82
|
+
align: _propTypes.default.oneOf(['auto', 'left', 'right', 'center', 'justify']),
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* How much space between consecutive paragraphs, or between a paragraph and its siblings, in CSS
|
|
86
|
+
* `em` units: 1 gives space equal to one line of paragraph text, 0.5 would be half a line, etc.
|
|
87
|
+
* @default 1
|
|
88
|
+
*/
|
|
89
|
+
linesBetween: _propTypes.default.number,
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Paragraph takes the same tokens overrides as Typography
|
|
93
|
+
*/
|
|
94
|
+
tokens: _propTypes.default.oneOf([_propTypes.default.object, _propTypes.default.func]),
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Paragraph takes any of Typography's theme variants except for header sizes
|
|
98
|
+
*/
|
|
99
|
+
variant: _propTypes.default.exact({
|
|
100
|
+
bold: _propTypes.default.bool,
|
|
101
|
+
colour: _propTypes.default.oneOf(['secondary', 'tertiary']),
|
|
102
|
+
inverse: _propTypes.default.bool,
|
|
103
|
+
size: _propTypes.default.oneOf(['micro', 'small', 'large'])
|
|
104
|
+
})
|
|
105
|
+
};
|
|
106
|
+
var _default = Paragraph;
|
|
107
|
+
exports.default = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _Paragraph = _interopRequireDefault(require("./Paragraph"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _Paragraph.default;
|
|
13
|
+
exports.default = _default;
|
package/lib/index.js
CHANGED
|
@@ -10,6 +10,7 @@ var _exportNames = {
|
|
|
10
10
|
ResponsiveImage: true,
|
|
11
11
|
Ribbon: true,
|
|
12
12
|
DatePicker: true,
|
|
13
|
+
Paragraph: true,
|
|
13
14
|
Span: true,
|
|
14
15
|
ExpandCollapseMini: true,
|
|
15
16
|
Callout: true,
|
|
@@ -60,6 +61,12 @@ Object.defineProperty(exports, "OrderedList", {
|
|
|
60
61
|
return _OrderedList.default;
|
|
61
62
|
}
|
|
62
63
|
});
|
|
64
|
+
Object.defineProperty(exports, "Paragraph", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () {
|
|
67
|
+
return _Paragraph.default;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
63
70
|
Object.defineProperty(exports, "PreviewCard", {
|
|
64
71
|
enumerable: true,
|
|
65
72
|
get: function () {
|
|
@@ -109,6 +116,8 @@ var _Ribbon = _interopRequireDefault(require("./Ribbon"));
|
|
|
109
116
|
|
|
110
117
|
var _DatePicker = _interopRequireDefault(require("./DatePicker"));
|
|
111
118
|
|
|
119
|
+
var _Paragraph = _interopRequireDefault(require("./Paragraph"));
|
|
120
|
+
|
|
112
121
|
var _Span = _interopRequireDefault(require("./Span"));
|
|
113
122
|
|
|
114
123
|
var _ExpandCollapseMini = _interopRequireDefault(require("./ExpandCollapseMini"));
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { selectSystemProps } from '@telus-uds/components-base';
|
|
5
|
+
import { htmlAttrs, useTypographyTheme } from '../utils';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
8
|
+
const StyledParagraph = /*#__PURE__*/styled.p.withConfig({
|
|
9
|
+
displayName: "Paragraph__StyledParagraph",
|
|
10
|
+
componentId: "components-web__sc-1bg9r8p-0"
|
|
11
|
+
})(["", " ", " &:first-child{margin-block-start:0em;}&:last-child{margin-block-end:0em;}"], _ref => {
|
|
12
|
+
let {
|
|
13
|
+
align
|
|
14
|
+
} = _ref;
|
|
15
|
+
return align ? `text-align: ${align};` : '';
|
|
16
|
+
}, _ref2 => {
|
|
17
|
+
let {
|
|
18
|
+
linesBetween
|
|
19
|
+
} = _ref2;
|
|
20
|
+
return `
|
|
21
|
+
margin-block-start: ${linesBetween}em;
|
|
22
|
+
margin-block-end: ${linesBetween}em;
|
|
23
|
+
`;
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Block text as an HTML ```<p>``` element.
|
|
27
|
+
*
|
|
28
|
+
* ##Usage criteria
|
|
29
|
+
*
|
|
30
|
+
* - All body text should be contained in a **Paragraph**, regardless of length.
|
|
31
|
+
* - If the Paragraph is on a dark background, variant **{ invert: true }** must be used to maintain sufficient colour
|
|
32
|
+
contrast.
|
|
33
|
+
* - All Allium Typography variants other than header size variants are supported.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
const Paragraph = _ref3 => {
|
|
37
|
+
let {
|
|
38
|
+
children,
|
|
39
|
+
variant,
|
|
40
|
+
tokens,
|
|
41
|
+
testID,
|
|
42
|
+
align,
|
|
43
|
+
linesBetween = 1,
|
|
44
|
+
...rest
|
|
45
|
+
} = _ref3;
|
|
46
|
+
const style = useTypographyTheme(variant, tokens);
|
|
47
|
+
return /*#__PURE__*/_jsx(StyledParagraph, {
|
|
48
|
+
linesBetween: linesBetween,
|
|
49
|
+
"data-testid": testID,
|
|
50
|
+
align: align,
|
|
51
|
+
style: style,
|
|
52
|
+
...selectProps(rest),
|
|
53
|
+
children: children
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
Paragraph.propTypes = { ...selectedSystemPropTypes,
|
|
58
|
+
children: PropTypes.node.isRequired,
|
|
59
|
+
testID: PropTypes.string,
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Sets the alignment style for the paragraph. Same options as Typography's `align` prop.
|
|
63
|
+
* 'justify' should be avoided as it usually reduces ease of reading.
|
|
64
|
+
*/
|
|
65
|
+
align: PropTypes.oneOf(['auto', 'left', 'right', 'center', 'justify']),
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* How much space between consecutive paragraphs, or between a paragraph and its siblings, in CSS
|
|
69
|
+
* `em` units: 1 gives space equal to one line of paragraph text, 0.5 would be half a line, etc.
|
|
70
|
+
* @default 1
|
|
71
|
+
*/
|
|
72
|
+
linesBetween: PropTypes.number,
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Paragraph takes the same tokens overrides as Typography
|
|
76
|
+
*/
|
|
77
|
+
tokens: PropTypes.oneOf([PropTypes.object, PropTypes.func]),
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Paragraph takes any of Typography's theme variants except for header sizes
|
|
81
|
+
*/
|
|
82
|
+
variant: PropTypes.exact({
|
|
83
|
+
bold: PropTypes.bool,
|
|
84
|
+
colour: PropTypes.oneOf(['secondary', 'tertiary']),
|
|
85
|
+
inverse: PropTypes.bool,
|
|
86
|
+
size: PropTypes.oneOf(['micro', 'small', 'large'])
|
|
87
|
+
})
|
|
88
|
+
};
|
|
89
|
+
export default Paragraph;
|
package/lib-module/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { default as PreviewCard } from './PreviewCard';
|
|
|
4
4
|
export { default as ResponsiveImage } from './ResponsiveImage';
|
|
5
5
|
export { default as Ribbon } from './Ribbon';
|
|
6
6
|
export { default as DatePicker } from './DatePicker';
|
|
7
|
+
export { default as Paragraph } from './Paragraph';
|
|
7
8
|
export { default as Span } from './Span';
|
|
8
9
|
export { default as ExpandCollapseMini } from './ExpandCollapseMini';
|
|
9
10
|
export { default as Callout } from './Callout';
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
],
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@gorhom/portal": "^1.0.14",
|
|
8
|
-
"@telus-uds/components-base": "1.34.
|
|
8
|
+
"@telus-uds/components-base": "1.34.1",
|
|
9
9
|
"@telus-uds/system-constants": "^1.2.0",
|
|
10
10
|
"react-dates": "^21.8.0",
|
|
11
11
|
"react-moment-proptypes": "^1.8.1",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"skip": true
|
|
59
59
|
},
|
|
60
60
|
"types": "types/index.d.ts",
|
|
61
|
-
"version": "1.
|
|
61
|
+
"version": "1.5.0"
|
|
62
62
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import styled from 'styled-components'
|
|
4
|
+
import { selectSystemProps } from '@telus-uds/components-base'
|
|
5
|
+
|
|
6
|
+
import { htmlAttrs, useTypographyTheme } from '../utils'
|
|
7
|
+
|
|
8
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
9
|
+
|
|
10
|
+
const StyledParagraph = styled.p`
|
|
11
|
+
${({ align }) => (align ? `text-align: ${align};` : '')}
|
|
12
|
+
${({ linesBetween }) => `
|
|
13
|
+
margin-block-start: ${linesBetween}em;
|
|
14
|
+
margin-block-end: ${linesBetween}em;
|
|
15
|
+
`}
|
|
16
|
+
&:first-child {
|
|
17
|
+
margin-block-start: 0em;
|
|
18
|
+
}
|
|
19
|
+
&:last-child {
|
|
20
|
+
margin-block-end: 0em;
|
|
21
|
+
}
|
|
22
|
+
`
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Block text as an HTML ```<p>``` element.
|
|
26
|
+
*
|
|
27
|
+
* ##Usage criteria
|
|
28
|
+
*
|
|
29
|
+
* - All body text should be contained in a **Paragraph**, regardless of length.
|
|
30
|
+
* - If the Paragraph is on a dark background, variant **{ invert: true }** must be used to maintain sufficient colour
|
|
31
|
+
contrast.
|
|
32
|
+
* - All Allium Typography variants other than header size variants are supported.
|
|
33
|
+
*/
|
|
34
|
+
const Paragraph = ({ children, variant, tokens, testID, align, linesBetween = 1, ...rest }) => {
|
|
35
|
+
const style = useTypographyTheme(variant, tokens)
|
|
36
|
+
return (
|
|
37
|
+
<StyledParagraph
|
|
38
|
+
linesBetween={linesBetween}
|
|
39
|
+
data-testid={testID}
|
|
40
|
+
align={align}
|
|
41
|
+
style={style}
|
|
42
|
+
{...selectProps(rest)}
|
|
43
|
+
>
|
|
44
|
+
{children}
|
|
45
|
+
</StyledParagraph>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
Paragraph.propTypes = {
|
|
50
|
+
...selectedSystemPropTypes,
|
|
51
|
+
children: PropTypes.node.isRequired,
|
|
52
|
+
testID: PropTypes.string,
|
|
53
|
+
/**
|
|
54
|
+
* Sets the alignment style for the paragraph. Same options as Typography's `align` prop.
|
|
55
|
+
* 'justify' should be avoided as it usually reduces ease of reading.
|
|
56
|
+
*/
|
|
57
|
+
align: PropTypes.oneOf(['auto', 'left', 'right', 'center', 'justify']),
|
|
58
|
+
/**
|
|
59
|
+
* How much space between consecutive paragraphs, or between a paragraph and its siblings, in CSS
|
|
60
|
+
* `em` units: 1 gives space equal to one line of paragraph text, 0.5 would be half a line, etc.
|
|
61
|
+
* @default 1
|
|
62
|
+
*/
|
|
63
|
+
linesBetween: PropTypes.number,
|
|
64
|
+
/**
|
|
65
|
+
* Paragraph takes the same tokens overrides as Typography
|
|
66
|
+
*/
|
|
67
|
+
tokens: PropTypes.oneOf([PropTypes.object, PropTypes.func]),
|
|
68
|
+
/**
|
|
69
|
+
* Paragraph takes any of Typography's theme variants except for header sizes
|
|
70
|
+
*/
|
|
71
|
+
variant: PropTypes.exact({
|
|
72
|
+
bold: PropTypes.bool,
|
|
73
|
+
colour: PropTypes.oneOf(['secondary', 'tertiary']),
|
|
74
|
+
inverse: PropTypes.bool,
|
|
75
|
+
size: PropTypes.oneOf(['micro', 'small', 'large'])
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default Paragraph
|
package/src/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { default as PreviewCard } from './PreviewCard'
|
|
|
4
4
|
export { default as ResponsiveImage } from './ResponsiveImage'
|
|
5
5
|
export { default as Ribbon } from './Ribbon'
|
|
6
6
|
export { default as DatePicker } from './DatePicker'
|
|
7
|
+
export { default as Paragraph } from './Paragraph'
|
|
7
8
|
export { default as Span } from './Span'
|
|
8
9
|
export { default as ExpandCollapseMini } from './ExpandCollapseMini'
|
|
9
10
|
export { default as Callout } from './Callout'
|