@pingux/astro 1.2.0-alpha.4 → 1.2.0-alpha.5
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/Button/Button.stories.js +43 -2
- package/lib/cjs/components/Button/Button.test.js +26 -0
- package/lib/cjs/styles/variants/buttons.js +54 -1
- package/lib/cjs/styles/variants/text.js +14 -0
- package/lib/components/Button/Button.stories.js +36 -0
- package/lib/components/Button/Button.test.js +20 -0
- package/lib/styles/variants/buttons.js +54 -1
- package/lib/styles/variants/text.js +14 -0
- package/package.json +1 -1
@@ -8,12 +8,18 @@ _Object$defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
9
9
|
});
|
10
10
|
|
11
|
-
exports.InlineButton = exports.TextButton = exports.TextIconButton = exports.Disabled = exports.Default = exports["default"] = void 0;
|
11
|
+
exports.ColorBlockButton = exports.InlineButton = exports.TextButton = exports.TextIconButton = exports.Disabled = exports.Default = exports["default"] = void 0;
|
12
|
+
|
13
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
14
|
+
|
15
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
12
16
|
|
13
17
|
var _react = _interopRequireDefault(require("react"));
|
14
18
|
|
15
19
|
var _AddCircleIcon = _interopRequireDefault(require("mdi-react/AddCircleIcon"));
|
16
20
|
|
21
|
+
var _CreateIcon = _interopRequireDefault(require("mdi-react/CreateIcon"));
|
22
|
+
|
17
23
|
var _Box = _interopRequireDefault(require("../Box"));
|
18
24
|
|
19
25
|
var _ = _interopRequireDefault(require("."));
|
@@ -56,6 +62,13 @@ var _default = {
|
|
56
62
|
type: 'text'
|
57
63
|
}
|
58
64
|
}
|
65
|
+
},
|
66
|
+
parameters: {
|
67
|
+
docs: {
|
68
|
+
source: {
|
69
|
+
type: 'code'
|
70
|
+
}
|
71
|
+
}
|
59
72
|
}
|
60
73
|
};
|
61
74
|
exports["default"] = _default;
|
@@ -110,4 +123,32 @@ var InlineButton = function InlineButton() {
|
|
110
123
|
}, "Inline");
|
111
124
|
};
|
112
125
|
|
113
|
-
exports.InlineButton = InlineButton;
|
126
|
+
exports.InlineButton = InlineButton;
|
127
|
+
|
128
|
+
var ColorBlockButton = function ColorBlockButton(args) {
|
129
|
+
// Change `isConfigured` property in storybook controls
|
130
|
+
var isConfigured = args.isConfigured,
|
131
|
+
props = (0, _objectWithoutProperties2["default"])(args, ["isConfigured"]);
|
132
|
+
return (0, _react2.jsx)(_["default"], (0, _extends2["default"])({}, props, {
|
133
|
+
variant: "colorBlock",
|
134
|
+
className: isConfigured ? 'is-configured' : ''
|
135
|
+
}), (0, _react2.jsx)(_Box["default"], null, (0, _react2.jsx)(_Text["default"], {
|
136
|
+
variant: "buttonTitle"
|
137
|
+
}, "Title"), (0, _react2.jsx)(_Text["default"], {
|
138
|
+
variant: "buttonSubtitle"
|
139
|
+
}, "Info")), (0, _react2.jsx)(_Icon["default"], {
|
140
|
+
icon: _CreateIcon["default"]
|
141
|
+
}));
|
142
|
+
};
|
143
|
+
|
144
|
+
exports.ColorBlockButton = ColorBlockButton;
|
145
|
+
ColorBlockButton.story = {
|
146
|
+
argTypes: {
|
147
|
+
isConfigured: {
|
148
|
+
control: {
|
149
|
+
type: 'boolean'
|
150
|
+
},
|
151
|
+
defaultValue: false
|
152
|
+
}
|
153
|
+
}
|
154
|
+
};
|
@@ -122,4 +122,30 @@ test('button renders children when not loading', function () {
|
|
122
122
|
expect(childWrapper).toBeInTheDocument();
|
123
123
|
expect(childWrapper).toBeVisible();
|
124
124
|
expect(_testWrapper.screen.queryByRole('progressbar')).not.toBeInTheDocument();
|
125
|
+
});
|
126
|
+
test('color block button renders in default state', function () {
|
127
|
+
getComponent({
|
128
|
+
variant: 'colorBlock'
|
129
|
+
});
|
130
|
+
|
131
|
+
var button = _testWrapper.screen.getByRole('button');
|
132
|
+
|
133
|
+
expect(button).toBeInTheDocument();
|
134
|
+
expect(button).not.toHaveClass('is-configured');
|
135
|
+
|
136
|
+
_userEvent["default"].tab();
|
137
|
+
|
138
|
+
expect(button).toHaveClass('is-focused');
|
139
|
+
expect(button).toHaveFocus();
|
140
|
+
});
|
141
|
+
test('color block button renders in configured state', function () {
|
142
|
+
getComponent({
|
143
|
+
variant: 'colorBlock',
|
144
|
+
className: 'is-configured'
|
145
|
+
});
|
146
|
+
|
147
|
+
var button = _testWrapper.screen.getByRole('button');
|
148
|
+
|
149
|
+
expect(button).toBeInTheDocument();
|
150
|
+
expect(button).toHaveClass('is-configured');
|
125
151
|
});
|
@@ -556,6 +556,58 @@ var tooltipInline = _objectSpread(_objectSpread({}, text), {}, {
|
|
556
556
|
}
|
557
557
|
});
|
558
558
|
|
559
|
+
var colorBlock = {
|
560
|
+
bg: 'neutral.95',
|
561
|
+
border: '1px solid',
|
562
|
+
borderColor: 'neutral.90',
|
563
|
+
borderRadius: 10,
|
564
|
+
outline: 'none',
|
565
|
+
cursor: 'pointer',
|
566
|
+
width: 150,
|
567
|
+
minHeight: 40,
|
568
|
+
p: '5px 15px',
|
569
|
+
display: 'flex',
|
570
|
+
justifyContent: 'space-between',
|
571
|
+
alignItems: 'center',
|
572
|
+
'&.is-hovered': {
|
573
|
+
bg: 'neutral.80'
|
574
|
+
},
|
575
|
+
'&.is-focused': _objectSpread({}, defaultFocus),
|
576
|
+
'&.is-pressed': {
|
577
|
+
bg: 'neutral.60',
|
578
|
+
borderColor: 'neutral.60'
|
579
|
+
},
|
580
|
+
'& span': {
|
581
|
+
color: 'text.primary',
|
582
|
+
textAlign: 'left'
|
583
|
+
},
|
584
|
+
'&>div': {
|
585
|
+
alignItems: 'baseline'
|
586
|
+
},
|
587
|
+
'&>svg': {
|
588
|
+
color: 'text.secondary',
|
589
|
+
fill: 'text.secondary'
|
590
|
+
},
|
591
|
+
'&.is-configured': {
|
592
|
+
bg: 'active',
|
593
|
+
borderColor: 'active',
|
594
|
+
'& span': {
|
595
|
+
color: 'white'
|
596
|
+
},
|
597
|
+
'&>svg': {
|
598
|
+
color: 'white',
|
599
|
+
fill: 'white'
|
600
|
+
}
|
601
|
+
},
|
602
|
+
'&.is-configured.is-hovered': {
|
603
|
+
bg: 'accent.40',
|
604
|
+
borderColor: 'accent.40'
|
605
|
+
},
|
606
|
+
'&.is-configured.is-pressed': {
|
607
|
+
bg: 'accent.20',
|
608
|
+
borderColor: 'accent.20'
|
609
|
+
}
|
610
|
+
};
|
559
611
|
var _default = {
|
560
612
|
accordionHeader: accordionHeader,
|
561
613
|
chipDeleteButton: chipDeleteButton,
|
@@ -595,6 +647,7 @@ var _default = {
|
|
595
647
|
invertedSquare: invertedSquare,
|
596
648
|
tooltipChip: tooltipChip,
|
597
649
|
tooltipIconButton: tooltipIconButton,
|
598
|
-
tooltipInline: tooltipInline
|
650
|
+
tooltipInline: tooltipInline,
|
651
|
+
colorBlock: colorBlock
|
599
652
|
};
|
600
653
|
exports["default"] = _default;
|
@@ -178,6 +178,20 @@ var text = {
|
|
178
178
|
color: 'accent.30',
|
179
179
|
fontFamily: 'standard'
|
180
180
|
}),
|
181
|
+
buttonTitle: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
182
|
+
fontSize: 'xs',
|
183
|
+
fontWeight: 0,
|
184
|
+
color: 'text.primary',
|
185
|
+
fontFamily: 'standard',
|
186
|
+
lineHeight: '13px'
|
187
|
+
}),
|
188
|
+
buttonSubtitle: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
189
|
+
fontSize: 'sm',
|
190
|
+
fontWeight: 3,
|
191
|
+
color: 'text.primary',
|
192
|
+
fontFamily: 'standard',
|
193
|
+
lineHeight: '16px'
|
194
|
+
}),
|
181
195
|
capsLabel: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
182
196
|
color: 'text.secondary',
|
183
197
|
textTransform: 'uppercase',
|
@@ -1,5 +1,8 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
1
3
|
import React from 'react';
|
2
4
|
import AddCircleIcon from 'mdi-react/AddCircleIcon';
|
5
|
+
import CreateIcon from 'mdi-react/CreateIcon';
|
3
6
|
import Box from '../Box';
|
4
7
|
import Button from '.';
|
5
8
|
import Icon from '../Icon';
|
@@ -36,6 +39,13 @@ export default {
|
|
36
39
|
type: 'text'
|
37
40
|
}
|
38
41
|
}
|
42
|
+
},
|
43
|
+
parameters: {
|
44
|
+
docs: {
|
45
|
+
source: {
|
46
|
+
type: 'code'
|
47
|
+
}
|
48
|
+
}
|
39
49
|
}
|
40
50
|
};
|
41
51
|
export var Default = function Default(args) {
|
@@ -74,4 +84,30 @@ export var InlineButton = function InlineButton() {
|
|
74
84
|
mb: "sm",
|
75
85
|
variant: "inline"
|
76
86
|
}, "Inline");
|
87
|
+
};
|
88
|
+
export var ColorBlockButton = function ColorBlockButton(args) {
|
89
|
+
// Change `isConfigured` property in storybook controls
|
90
|
+
var isConfigured = args.isConfigured,
|
91
|
+
props = _objectWithoutProperties(args, ["isConfigured"]);
|
92
|
+
|
93
|
+
return ___EmotionJSX(Button, _extends({}, props, {
|
94
|
+
variant: "colorBlock",
|
95
|
+
className: isConfigured ? 'is-configured' : ''
|
96
|
+
}), ___EmotionJSX(Box, null, ___EmotionJSX(Text, {
|
97
|
+
variant: "buttonTitle"
|
98
|
+
}, "Title"), ___EmotionJSX(Text, {
|
99
|
+
variant: "buttonSubtitle"
|
100
|
+
}, "Info")), ___EmotionJSX(Icon, {
|
101
|
+
icon: CreateIcon
|
102
|
+
}));
|
103
|
+
};
|
104
|
+
ColorBlockButton.story = {
|
105
|
+
argTypes: {
|
106
|
+
isConfigured: {
|
107
|
+
control: {
|
108
|
+
type: 'boolean'
|
109
|
+
},
|
110
|
+
defaultValue: false
|
111
|
+
}
|
112
|
+
}
|
77
113
|
};
|
@@ -89,4 +89,24 @@ test('button renders children when not loading', function () {
|
|
89
89
|
expect(childWrapper).toBeInTheDocument();
|
90
90
|
expect(childWrapper).toBeVisible();
|
91
91
|
expect(screen.queryByRole('progressbar')).not.toBeInTheDocument();
|
92
|
+
});
|
93
|
+
test('color block button renders in default state', function () {
|
94
|
+
getComponent({
|
95
|
+
variant: 'colorBlock'
|
96
|
+
});
|
97
|
+
var button = screen.getByRole('button');
|
98
|
+
expect(button).toBeInTheDocument();
|
99
|
+
expect(button).not.toHaveClass('is-configured');
|
100
|
+
userEvent.tab();
|
101
|
+
expect(button).toHaveClass('is-focused');
|
102
|
+
expect(button).toHaveFocus();
|
103
|
+
});
|
104
|
+
test('color block button renders in configured state', function () {
|
105
|
+
getComponent({
|
106
|
+
variant: 'colorBlock',
|
107
|
+
className: 'is-configured'
|
108
|
+
});
|
109
|
+
var button = screen.getByRole('button');
|
110
|
+
expect(button).toBeInTheDocument();
|
111
|
+
expect(button).toHaveClass('is-configured');
|
92
112
|
});
|
@@ -534,6 +534,58 @@ var tooltipInline = _objectSpread(_objectSpread({}, text), {}, {
|
|
534
534
|
}
|
535
535
|
});
|
536
536
|
|
537
|
+
var colorBlock = {
|
538
|
+
bg: 'neutral.95',
|
539
|
+
border: '1px solid',
|
540
|
+
borderColor: 'neutral.90',
|
541
|
+
borderRadius: 10,
|
542
|
+
outline: 'none',
|
543
|
+
cursor: 'pointer',
|
544
|
+
width: 150,
|
545
|
+
minHeight: 40,
|
546
|
+
p: '5px 15px',
|
547
|
+
display: 'flex',
|
548
|
+
justifyContent: 'space-between',
|
549
|
+
alignItems: 'center',
|
550
|
+
'&.is-hovered': {
|
551
|
+
bg: 'neutral.80'
|
552
|
+
},
|
553
|
+
'&.is-focused': _objectSpread({}, defaultFocus),
|
554
|
+
'&.is-pressed': {
|
555
|
+
bg: 'neutral.60',
|
556
|
+
borderColor: 'neutral.60'
|
557
|
+
},
|
558
|
+
'& span': {
|
559
|
+
color: 'text.primary',
|
560
|
+
textAlign: 'left'
|
561
|
+
},
|
562
|
+
'&>div': {
|
563
|
+
alignItems: 'baseline'
|
564
|
+
},
|
565
|
+
'&>svg': {
|
566
|
+
color: 'text.secondary',
|
567
|
+
fill: 'text.secondary'
|
568
|
+
},
|
569
|
+
'&.is-configured': {
|
570
|
+
bg: 'active',
|
571
|
+
borderColor: 'active',
|
572
|
+
'& span': {
|
573
|
+
color: 'white'
|
574
|
+
},
|
575
|
+
'&>svg': {
|
576
|
+
color: 'white',
|
577
|
+
fill: 'white'
|
578
|
+
}
|
579
|
+
},
|
580
|
+
'&.is-configured.is-hovered': {
|
581
|
+
bg: 'accent.40',
|
582
|
+
borderColor: 'accent.40'
|
583
|
+
},
|
584
|
+
'&.is-configured.is-pressed': {
|
585
|
+
bg: 'accent.20',
|
586
|
+
borderColor: 'accent.20'
|
587
|
+
}
|
588
|
+
};
|
537
589
|
export default {
|
538
590
|
accordionHeader: accordionHeader,
|
539
591
|
chipDeleteButton: chipDeleteButton,
|
@@ -573,5 +625,6 @@ export default {
|
|
573
625
|
invertedSquare: invertedSquare,
|
574
626
|
tooltipChip: tooltipChip,
|
575
627
|
tooltipIconButton: tooltipIconButton,
|
576
|
-
tooltipInline: tooltipInline
|
628
|
+
tooltipInline: tooltipInline,
|
629
|
+
colorBlock: colorBlock
|
577
630
|
};
|
@@ -158,6 +158,20 @@ export var text = {
|
|
158
158
|
color: 'accent.30',
|
159
159
|
fontFamily: 'standard'
|
160
160
|
}),
|
161
|
+
buttonTitle: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
162
|
+
fontSize: 'xs',
|
163
|
+
fontWeight: 0,
|
164
|
+
color: 'text.primary',
|
165
|
+
fontFamily: 'standard',
|
166
|
+
lineHeight: '13px'
|
167
|
+
}),
|
168
|
+
buttonSubtitle: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
169
|
+
fontSize: 'sm',
|
170
|
+
fontWeight: 3,
|
171
|
+
color: 'text.primary',
|
172
|
+
fontFamily: 'standard',
|
173
|
+
lineHeight: '16px'
|
174
|
+
}),
|
161
175
|
capsLabel: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
162
176
|
color: 'text.secondary',
|
163
177
|
textTransform: 'uppercase',
|