@pingux/astro 2.89.0-alpha.2 → 2.90.0-alpha.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/lib/cjs/components/Card/Card.js +4 -2
- package/lib/cjs/components/Card/Card.stories.d.ts +1 -0
- package/lib/cjs/components/Card/Card.stories.js +26 -2
- package/lib/cjs/components/Card/Card.styles.d.ts +52 -0
- package/lib/cjs/components/Card/Card.styles.js +26 -1
- package/lib/cjs/components/Card/Card.test.d.ts +1 -0
- package/lib/cjs/components/Card/Card.test.js +25 -11
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +16 -0
- package/lib/cjs/styles/themes/next-gen/variants/cards.d.ts +16 -0
- package/lib/cjs/styles/themes/next-gen/variants/cards.js +20 -1
- package/lib/cjs/utils/devUtils/constants/images.d.ts +1 -0
- package/lib/cjs/utils/devUtils/constants/images.js +3 -1
- package/lib/components/Card/Card.js +4 -2
- package/lib/components/Card/Card.stories.js +23 -0
- package/lib/components/Card/Card.styles.js +26 -1
- package/lib/components/Card/Card.test.js +25 -11
- package/lib/styles/themes/next-gen/variants/cards.js +20 -1
- package/lib/utils/devUtils/constants/images.js +1 -0
- package/package.json +1 -1
@@ -9,6 +9,7 @@ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object
|
|
9
9
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
10
10
|
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; }
|
11
11
|
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; }
|
12
|
+
import { checkIcon } from '../../utils/devUtils/constants/images';
|
12
13
|
import { defaultFocus } from '../Button/Buttons.styles';
|
13
14
|
var container = {
|
14
15
|
display: 'flex',
|
@@ -61,11 +62,35 @@ var footer = {
|
|
61
62
|
var body = {
|
62
63
|
p: 24
|
63
64
|
};
|
65
|
+
var activeCard = _objectSpread(_objectSpread({}, interactive), {}, {
|
66
|
+
position: 'relative',
|
67
|
+
cursor: 'pointer',
|
68
|
+
'&.is-selected': {
|
69
|
+
border: '1px solid',
|
70
|
+
borderColor: 'active',
|
71
|
+
':before': {
|
72
|
+
content: '""',
|
73
|
+
backgroundColor: 'active',
|
74
|
+
backgroundImage: "url(".concat(checkIcon, ")"),
|
75
|
+
backgroundSize: '16px 16px',
|
76
|
+
backgroundRepeat: 'no-repeat',
|
77
|
+
backgroundPosition: 'center center',
|
78
|
+
transition: 'background-image 0.25s ease-in-out',
|
79
|
+
position: 'absolute',
|
80
|
+
top: '-8px',
|
81
|
+
right: '-8px',
|
82
|
+
width: '20px',
|
83
|
+
height: '20px',
|
84
|
+
borderRadius: '50%'
|
85
|
+
}
|
86
|
+
}
|
87
|
+
});
|
64
88
|
export default {
|
65
89
|
container: container,
|
66
90
|
interactive: interactive,
|
67
91
|
header: header,
|
68
92
|
footer: footer,
|
69
93
|
flat: flat,
|
70
|
-
body: body
|
94
|
+
body: body,
|
95
|
+
activeCard: activeCard
|
71
96
|
};
|
@@ -82,7 +82,7 @@ test('allows focus within card', function () {
|
|
82
82
|
expect(button).toHaveClass('is-focused');
|
83
83
|
});
|
84
84
|
test('renders Card component with text selection', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
85
|
-
var children, card, range, selection, textField;
|
85
|
+
var children, card, range, selection, selectedText, textField;
|
86
86
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
87
87
|
while (1) switch (_context.prev = _context.next) {
|
88
88
|
case 0:
|
@@ -97,18 +97,32 @@ test('renders Card component with text selection', /*#__PURE__*/_asyncToGenerato
|
|
97
97
|
range = document.createRange();
|
98
98
|
range.selectNodeContents(card);
|
99
99
|
selection = window.getSelection();
|
100
|
-
selection
|
101
|
-
|
100
|
+
if (selection) {
|
101
|
+
selection.removeAllRanges();
|
102
|
+
selection.addRange(range);
|
102
103
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
104
|
+
// Verify that the selection was successful
|
105
|
+
selectedText = selection.toString();
|
106
|
+
expect(selectedText).toBe('Select this text.Interactive TextField');
|
107
|
+
|
108
|
+
// Interact with the TextField
|
109
|
+
textField = screen.getByLabelText('Interactive TextField');
|
110
|
+
userEvent.click(textField);
|
111
|
+
userEvent.type(textField, selectedText);
|
112
|
+
expect(textField).toHaveValue(selectedText);
|
113
|
+
}
|
114
|
+
case 7:
|
110
115
|
case "end":
|
111
116
|
return _context.stop();
|
112
117
|
}
|
113
118
|
}, _callee);
|
114
|
-
})));
|
119
|
+
})));
|
120
|
+
test('is-select class added when isSelected pass to it', function () {
|
121
|
+
getComponent({
|
122
|
+
variant: 'cards.activeCard',
|
123
|
+
isSelected: true
|
124
|
+
});
|
125
|
+
var card = screen.getByTestId(testId);
|
126
|
+
userEvent.click(card);
|
127
|
+
expect(card).toHaveClass('is-selected');
|
128
|
+
});
|
@@ -1,3 +1,14 @@
|
|
1
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
2
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
4
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
5
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
6
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
7
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
8
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
9
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
10
|
+
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; }
|
11
|
+
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; }
|
1
12
|
var interactive = {
|
2
13
|
boxShadow: 'none',
|
3
14
|
borderRadius: '1rem',
|
@@ -15,6 +26,14 @@ var interactive = {
|
|
15
26
|
bg: 'default'
|
16
27
|
}
|
17
28
|
};
|
29
|
+
var activeCard = _objectSpread(_objectSpread({}, interactive), {}, {
|
30
|
+
borderColor: 'border.base',
|
31
|
+
'&.is-hovered': {
|
32
|
+
borderColor: 'active',
|
33
|
+
bg: 'default'
|
34
|
+
}
|
35
|
+
});
|
18
36
|
export default {
|
19
|
-
interactive: interactive
|
37
|
+
interactive: interactive,
|
38
|
+
activeCard: activeCard
|
20
39
|
};
|