@pingux/astro 1.7.0-alpha.10 → 1.7.0-alpha.11
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/lib/cjs/components/Text/Text.js +5 -1
- package/lib/cjs/components/Text/Text.stories.js +56 -2
- package/lib/cjs/components/Text/Text.test.js +46 -0
- package/lib/components/Text/Text.js +7 -2
- package/lib/components/Text/Text.stories.js +50 -0
- package/lib/components/Text/Text.test.js +36 -0
- package/package.json +1 -1
@@ -31,7 +31,11 @@ var ExtendedText = ( /*#__PURE__*/0, _base["default"])(_themeUi.Text, process.en
|
|
31
31
|
} : {
|
32
32
|
target: "eifd86o0",
|
33
33
|
label: "ExtendedText"
|
34
|
-
})(_styledSystem.layout, _styledSystem.flexbox, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
34
|
+
})(_styledSystem.layout, _styledSystem.flexbox, _styledSystem.typography, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL1RleHQvVGV4dC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFRcUIiLCJmaWxlIjoiLi4vLi4vLi4vLi4vc3JjL2NvbXBvbmVudHMvVGV4dC9UZXh0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0IGZyb20gJ3JlYWN0JztcbmltcG9ydCBQcm9wVHlwZXMgZnJvbSAncHJvcC10eXBlcyc7XG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5pbXBvcnQgeyBsYXlvdXQsIGZsZXhib3gsIHR5cG9ncmFwaHkgfSBmcm9tICdzdHlsZWQtc3lzdGVtJztcbmltcG9ydCB7IFRleHQgYXMgVGhlbWVVSVRleHQgfSBmcm9tICd0aGVtZS11aSc7XG5cbmltcG9ydCB7IHRleHRWYXJpYW50cyB9IGZyb20gJy4uLy4uL3V0aWxzL2RldlV0aWxzL2NvbnN0YW50cy92YXJpYW50cyc7XG5cbmNvbnN0IEV4dGVuZGVkVGV4dCA9IHN0eWxlZChUaGVtZVVJVGV4dCkobGF5b3V0LCBmbGV4Ym94LCB0eXBvZ3JhcGh5KTtcblxuLyoqXG4gKiBUaGUgVGV4dCBjb21wb25lbnQgaXMgdXNlZCBmb3IgZGlzcGxheWluZyB0ZXh0LlxuICogVGV4dCBzdXBwb3J0cyBbVHlwb2dyYXBoeSBQcm9wcyBmcm9tIFN0eWxlZCBTeXN0ZW0gXShodHRwczovL3N0eWxlZC1zeXN0ZW0uY29tL3RhYmxlLyN0eXBvZ3JhcGh5KS5cbiAqL1xuXG5jb25zdCBUZXh0ID0gUmVhY3QuZm9yd2FyZFJlZigocHJvcHMsIHJlZikgPT4gKFxuICA8RXh0ZW5kZWRUZXh0IHZhcmlhbnQ9XCJiYXNlXCIgey4uLnByb3BzfSByZWY9e3JlZn0gLz5cbikpO1xuXG5UZXh0LnByb3BUeXBlcyA9IHtcbiAgdmFyaWFudDogUHJvcFR5cGVzLnN0cmluZyxcbn07XG5cblxuVGV4dC5kZWZhdWx0UHJvcHMgPSB7XG4gIHZhcmlhbnQ6IHRleHRWYXJpYW50cy5CQVNFLFxufTtcblxuVGV4dC5kaXNwbGF5TmFtZSA9ICdUZXh0JztcblxuZXhwb3J0IGRlZmF1bHQgVGV4dDtcbiJdfQ== */");
|
35
|
+
/**
|
36
|
+
* The Text component is used for displaying text.
|
37
|
+
* Text supports [Typography Props from Styled System ](https://styled-system.com/table/#typography).
|
38
|
+
*/
|
35
39
|
|
36
40
|
var Text = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
37
41
|
return (0, _react2.jsx)(ExtendedText, (0, _extends2["default"])({
|
@@ -8,7 +8,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
9
9
|
});
|
10
10
|
|
11
|
-
exports["default"] = exports.WithCustomWidth = exports.Default = void 0;
|
11
|
+
exports["default"] = exports.WithCustomWidth = exports.TypographyStyleProps = exports.Default = void 0;
|
12
12
|
|
13
13
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
14
14
|
|
@@ -24,6 +24,8 @@ var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
24
24
|
|
25
25
|
var _react = _interopRequireDefault(require("react"));
|
26
26
|
|
27
|
+
var _themeUi = require("theme-ui");
|
28
|
+
|
27
29
|
var _Text = _interopRequireDefault(require("./Text"));
|
28
30
|
|
29
31
|
var _variants = require("../../utils/devUtils/constants/variants.js");
|
@@ -123,4 +125,56 @@ var WithCustomWidth = function WithCustomWidth() {
|
|
123
125
|
}, "superlongtextinonelinewithnowhitespacessoitcanbelongerthatanywidth"));
|
124
126
|
};
|
125
127
|
|
126
|
-
exports.WithCustomWidth = WithCustomWidth;
|
128
|
+
exports.WithCustomWidth = WithCustomWidth;
|
129
|
+
|
130
|
+
var TypographyStyleProps = function TypographyStyleProps() {
|
131
|
+
var textProps = {
|
132
|
+
fontFamily: 'times',
|
133
|
+
fontSize: 'md',
|
134
|
+
fontWeight: 900,
|
135
|
+
lineHeight: '2em',
|
136
|
+
letterSpacing: '5px',
|
137
|
+
textAlign: 'right',
|
138
|
+
fontStyle: 'italic'
|
139
|
+
};
|
140
|
+
var loremText = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.';
|
141
|
+
return (0, _react2.jsx)(_index.Box, {
|
142
|
+
p: "xx",
|
143
|
+
gap: "md"
|
144
|
+
}, (0, _react2.jsx)(_Text["default"], {
|
145
|
+
variant: "title"
|
146
|
+
}, "The Text component allows typography style props to be passed in directly."), (0, _react2.jsx)(_Text["default"], textProps, loremText), (0, _react2.jsx)(_themeUi.Divider, null), (0, _react2.jsx)(_Text["default"], {
|
147
|
+
variant: "title"
|
148
|
+
}, "Typography styles can also be passed in through the sx prop for the same result."), (0, _react2.jsx)(_Text["default"], {
|
149
|
+
sx: textProps
|
150
|
+
}, loremText));
|
151
|
+
};
|
152
|
+
|
153
|
+
exports.TypographyStyleProps = TypographyStyleProps;
|
154
|
+
TypographyStyleProps.argTypes = {
|
155
|
+
variant: {
|
156
|
+
control: {
|
157
|
+
type: 'none'
|
158
|
+
}
|
159
|
+
},
|
160
|
+
children: {
|
161
|
+
control: {
|
162
|
+
type: 'none'
|
163
|
+
}
|
164
|
+
},
|
165
|
+
color: {
|
166
|
+
control: {
|
167
|
+
type: 'none'
|
168
|
+
}
|
169
|
+
},
|
170
|
+
bg: {
|
171
|
+
control: {
|
172
|
+
type: 'none'
|
173
|
+
}
|
174
|
+
},
|
175
|
+
tabPanelProps: {
|
176
|
+
control: {
|
177
|
+
type: 'none'
|
178
|
+
}
|
179
|
+
}
|
180
|
+
};
|
@@ -2,6 +2,24 @@
|
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
4
4
|
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
6
|
+
|
7
|
+
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
8
|
+
|
9
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
10
|
+
|
11
|
+
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
12
|
+
|
13
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
14
|
+
|
15
|
+
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
16
|
+
|
17
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
18
|
+
|
19
|
+
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
20
|
+
|
21
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
22
|
+
|
5
23
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
6
24
|
|
7
25
|
var _react = _interopRequireDefault(require("react"));
|
@@ -18,6 +36,10 @@ var _testTheme = _interopRequireDefault(require("../../utils/testUtils/testTheme
|
|
18
36
|
|
19
37
|
var _react2 = require("@emotion/react");
|
20
38
|
|
39
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
40
|
+
|
41
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
42
|
+
|
21
43
|
var testId = 'test-text';
|
22
44
|
var defaultProps = {
|
23
45
|
'data-testid': testId
|
@@ -40,4 +62,28 @@ test('default text', function () {
|
|
40
62
|
|
41
63
|
expect(text).toBeInstanceOf(HTMLSpanElement);
|
42
64
|
expect(text).toBeInTheDocument();
|
65
|
+
});
|
66
|
+
test('typography props will be applied', function () {
|
67
|
+
var customTypographyProps = {
|
68
|
+
fontFamily: 'times',
|
69
|
+
fontSize: 'xx',
|
70
|
+
fontWeight: 900,
|
71
|
+
lineHeight: '2em',
|
72
|
+
letterSpacing: '5px',
|
73
|
+
textAlign: 'right',
|
74
|
+
fontStyle: 'italic'
|
75
|
+
};
|
76
|
+
getComponent(_objectSpread({}, customTypographyProps));
|
77
|
+
|
78
|
+
var text = _testWrapper.screen.getByTestId(testId);
|
79
|
+
|
80
|
+
expect(text).toHaveStyle({
|
81
|
+
fontFamily: 'times',
|
82
|
+
fontSize: '23px',
|
83
|
+
fontWeight: 900,
|
84
|
+
lineHeight: '2em',
|
85
|
+
letterSpacing: '5px',
|
86
|
+
textAlign: 'right',
|
87
|
+
fontStyle: 'italic'
|
88
|
+
});
|
43
89
|
});
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
2
2
|
import _styled from "@emotion/styled/base";
|
3
3
|
import React from 'react';
|
4
4
|
import PropTypes from 'prop-types';
|
5
|
-
import { layout, flexbox } from 'styled-system';
|
5
|
+
import { layout, flexbox, typography } from 'styled-system';
|
6
6
|
import { Text as ThemeUIText } from 'theme-ui';
|
7
7
|
import { textVariants } from '../../utils/devUtils/constants/variants';
|
8
8
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -12,7 +12,12 @@ var ExtendedText = /*#__PURE__*/_styled(ThemeUIText, process.env.NODE_ENV === "p
|
|
12
12
|
} : {
|
13
13
|
target: "eifd86o0",
|
14
14
|
label: "ExtendedText"
|
15
|
-
})(layout, flexbox, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
15
|
+
})(layout, flexbox, typography, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21wb25lbnRzL1RleHQvVGV4dC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFRcUIiLCJmaWxlIjoiLi4vLi4vLi4vc3JjL2NvbXBvbmVudHMvVGV4dC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5TmFtZSA9ICdUZXh0JztcblxuZXhwb3J0IGRlZmF1bHQgVGV4dDtcbiJdfQ== */");
|
16
|
+
/**
|
17
|
+
* The Text component is used for displaying text.
|
18
|
+
* Text supports [Typography Props from Styled System ](https://styled-system.com/table/#typography).
|
19
|
+
*/
|
20
|
+
|
16
21
|
|
17
22
|
var Text = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
18
23
|
return ___EmotionJSX(ExtendedText, _extends({
|
@@ -9,6 +9,7 @@ var _excluded = ["children", "bg"];
|
|
9
9
|
var _context;
|
10
10
|
|
11
11
|
import React from 'react';
|
12
|
+
import { Divider } from 'theme-ui';
|
12
13
|
import Text from './Text';
|
13
14
|
import { textVariants } from '../../utils/devUtils/constants/variants.js';
|
14
15
|
import { flatColorList } from '../../styles/colors.js';
|
@@ -93,4 +94,53 @@ export var WithCustomWidth = function WithCustomWidth() {
|
|
93
94
|
}, ___EmotionJSX(Text, {
|
94
95
|
p: "xl"
|
95
96
|
}, "superlongtextinonelinewithnowhitespacessoitcanbelongerthatanywidth"));
|
97
|
+
};
|
98
|
+
export var TypographyStyleProps = function TypographyStyleProps() {
|
99
|
+
var textProps = {
|
100
|
+
fontFamily: 'times',
|
101
|
+
fontSize: 'md',
|
102
|
+
fontWeight: 900,
|
103
|
+
lineHeight: '2em',
|
104
|
+
letterSpacing: '5px',
|
105
|
+
textAlign: 'right',
|
106
|
+
fontStyle: 'italic'
|
107
|
+
};
|
108
|
+
var loremText = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.';
|
109
|
+
return ___EmotionJSX(Box, {
|
110
|
+
p: "xx",
|
111
|
+
gap: "md"
|
112
|
+
}, ___EmotionJSX(Text, {
|
113
|
+
variant: "title"
|
114
|
+
}, "The Text component allows typography style props to be passed in directly."), ___EmotionJSX(Text, textProps, loremText), ___EmotionJSX(Divider, null), ___EmotionJSX(Text, {
|
115
|
+
variant: "title"
|
116
|
+
}, "Typography styles can also be passed in through the sx prop for the same result."), ___EmotionJSX(Text, {
|
117
|
+
sx: textProps
|
118
|
+
}, loremText));
|
119
|
+
};
|
120
|
+
TypographyStyleProps.argTypes = {
|
121
|
+
variant: {
|
122
|
+
control: {
|
123
|
+
type: 'none'
|
124
|
+
}
|
125
|
+
},
|
126
|
+
children: {
|
127
|
+
control: {
|
128
|
+
type: 'none'
|
129
|
+
}
|
130
|
+
},
|
131
|
+
color: {
|
132
|
+
control: {
|
133
|
+
type: 'none'
|
134
|
+
}
|
135
|
+
},
|
136
|
+
bg: {
|
137
|
+
control: {
|
138
|
+
type: 'none'
|
139
|
+
}
|
140
|
+
},
|
141
|
+
tabPanelProps: {
|
142
|
+
control: {
|
143
|
+
type: 'none'
|
144
|
+
}
|
145
|
+
}
|
96
146
|
};
|
@@ -1,4 +1,18 @@
|
|
1
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
2
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
3
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
4
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
5
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
6
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
7
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
8
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
9
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
1
10
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
11
|
+
|
12
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
13
|
+
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
15
|
+
|
2
16
|
import React from 'react';
|
3
17
|
import { ThemeProvider } from 'theme-ui';
|
4
18
|
import { render, screen } from '../../utils/testUtils/testWrapper';
|
@@ -26,4 +40,26 @@ test('default text', function () {
|
|
26
40
|
var text = screen.getByTestId(testId);
|
27
41
|
expect(text).toBeInstanceOf(HTMLSpanElement);
|
28
42
|
expect(text).toBeInTheDocument();
|
43
|
+
});
|
44
|
+
test('typography props will be applied', function () {
|
45
|
+
var customTypographyProps = {
|
46
|
+
fontFamily: 'times',
|
47
|
+
fontSize: 'xx',
|
48
|
+
fontWeight: 900,
|
49
|
+
lineHeight: '2em',
|
50
|
+
letterSpacing: '5px',
|
51
|
+
textAlign: 'right',
|
52
|
+
fontStyle: 'italic'
|
53
|
+
};
|
54
|
+
getComponent(_objectSpread({}, customTypographyProps));
|
55
|
+
var text = screen.getByTestId(testId);
|
56
|
+
expect(text).toHaveStyle({
|
57
|
+
fontFamily: 'times',
|
58
|
+
fontSize: '23px',
|
59
|
+
fontWeight: 900,
|
60
|
+
lineHeight: '2em',
|
61
|
+
letterSpacing: '5px',
|
62
|
+
textAlign: 'right',
|
63
|
+
fontStyle: 'italic'
|
64
|
+
});
|
29
65
|
});
|