@pingux/astro 2.18.1-alpha.0 → 2.18.1-alpha.2

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.
@@ -12,7 +12,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
12
12
  _Object$defineProperty(exports, "__esModule", {
13
13
  value: true
14
14
  });
15
- exports["default"] = exports.Edit = exports.Display = void 0;
15
+ exports["default"] = exports.Edit = exports.DisplaySectionHeader = exports.DisplayRow = exports.Display = void 0;
16
16
  var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
17
17
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
18
18
  var _react = _interopRequireDefault(require("react"));
@@ -25,67 +25,77 @@ var _default = {
25
25
  title: 'Recipes/Condition Filter'
26
26
  };
27
27
  exports["default"] = _default;
28
- var customBadgeStyles = {
29
- marginRight: 'sm',
30
- '& > span': {
31
- fontWeight: 1,
32
- textTransform: 'none'
33
- },
34
- ml: '3px',
35
- minWidth: '65px',
36
- height: '20px',
37
- 'z-index': '1'
28
+ var borderBox = {
29
+ borderColor: 'neutral.80',
30
+ borderRadius: '3px 4px 4px 3px',
31
+ borderStyle: 'solid',
32
+ borderWidth: '1px 1px 1px 0px',
33
+ width: '100%',
34
+ '&::after': {
35
+ bg: 'decorative.4',
36
+ width: '2px'
37
+ }
38
38
  };
39
39
  var sx = {
40
- equalBadgeStyles: _objectSpread(_objectSpread({}, customBadgeStyles), {}, {
41
- bg: 'accent.95',
42
- textColor: 'neutral.10',
43
- alignSelf: 'center',
44
- height: '21px',
45
- minWidth: '51px'
46
- }),
47
- borderedBoxStyles: {
48
- '&::after': {
49
- bg: 'decorative.4',
50
- width: '2px',
51
- display: 'block'
40
+ badge: {
41
+ condition: {
42
+ height: '20px',
43
+ minWidth: '65px'
52
44
  },
53
- borderColor: 'neutral.80',
54
- borderRadius: '3px 4px 4px 3px',
55
- borderStyle: 'solid',
56
- borderWidth: '1px 1px 1px 0px',
57
- padding: 'sm',
58
- width: '100%'
45
+ equal: {
46
+ alignSelf: 'center',
47
+ bg: 'accent.95'
48
+ }
59
49
  },
60
- allConditionsBox: {
61
- '&::after': {
62
- bg: 'decorative.4',
63
- width: '2px'
50
+ borderedBoxStyles: _objectSpread(_objectSpread({}, borderBox), {}, {
51
+ padding: 'sm'
52
+ }),
53
+ display: {
54
+ borderBox: _objectSpread(_objectSpread({}, borderBox), {}, {
55
+ ml: '20px',
56
+ mt: 'md',
57
+ p: 'sm',
58
+ pl: 0
59
+ }),
60
+ bracket: {
61
+ position: 'absolute',
62
+ height: '56px'
63
+ },
64
+ container: {
65
+ bg: 'accent.99',
66
+ maxWidth: '318px',
67
+ p: 'sm',
68
+ pl: 0
64
69
  },
65
- alignItems: 'center',
66
- borderRadius: '4px',
67
- marginTop: 'md',
68
- fontWeight: 1
70
+ rowBox: {
71
+ alignItems: 'center',
72
+ bg: 'white',
73
+ borderRadius: '4px',
74
+ fontWeight: 1,
75
+ marginTop: 'md',
76
+ minHeight: '25px',
77
+ ml: '20px',
78
+ pl: '13px'
79
+ }
69
80
  },
70
81
  defaultText: {
71
- textTransform: 'none',
72
82
  color: 'inherit',
73
83
  fontSize: 'sm',
74
84
  fontWeight: '3'
75
- },
76
- textStyles: {
77
- pl: 'md',
78
- pr: 'sm'
79
85
  }
80
86
  };
81
87
  var allConditions = [{
82
88
  field1: 'Family Name',
89
+ field3: 'Smith',
90
+ key: 'familyNameField'
91
+ }, {
92
+ field1: 'Given Name',
83
93
  field3: 'John',
84
- key: 'FamilyNameField'
94
+ key: 'givenNameField'
85
95
  }, {
86
- field1: 'Full Name',
87
- field3: 'Alex Smith',
88
- key: 'FullNameField'
96
+ field1: 'Email',
97
+ field3: 'jsmith@company.com',
98
+ key: 'emailField'
89
99
  }];
90
100
  var anyConditions = [{
91
101
  field1: 'Group',
@@ -105,124 +115,89 @@ var noneConditions = [{
105
115
  field3: 'Banana',
106
116
  key: 'Miscellaneous2'
107
117
  }];
118
+ var ofTheConditionsAreTrueCopy = ' of the conditions are true';
108
119
  var Display = function Display() {
109
- return (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Box, {
110
- bg: "accent.99",
111
- maxWidth: "318px",
112
- p: "sm"
113
- }, (0, _react2.jsx)(_index.Box, {
114
- isRow: true
115
- }), (0, _react2.jsx)(_index.Box, {
116
- isRow: true
117
- }, (0, _react2.jsx)(_index.Badge, {
118
- label: "All",
119
- bg: "decorative.4",
120
- sx: customBadgeStyles
121
- }), (0, _react2.jsx)(_index.Text, null, " of the conditions are true")), (0, _map["default"])(allConditions).call(allConditions, function (item) {
122
- return (0, _react2.jsx)(_index.Box, {
123
- isRow: true,
120
+ return (0, _react2.jsx)(_index.Box, {
121
+ sx: sx.display.container
122
+ }, (0, _react2.jsx)(DisplaySectionHeader, null), (0, _map["default"])(allConditions).call(allConditions, function (item) {
123
+ return (0, _react2.jsx)(DisplayRow, {
124
+ item: item,
124
125
  key: item.key
125
- }, (0, _react2.jsx)(_index.Bracket, null), (0, _react2.jsx)(_index.Box, {
126
- width: "100%"
127
- }, (0, _react2.jsx)(_index.Box, {
128
- variant: "forms.input.fieldControlWrapper",
129
- bg: "white",
130
- isRow: true,
131
- sx: sx.allConditionsBox
132
- }, (0, _react2.jsx)(_index.Text, {
133
- sx: sx.textStyles
134
- }, item.field1), (0, _react2.jsx)(_index.Badge, {
135
- label: "Equals",
136
- sx: sx.equalBadgeStyles,
137
- textColor: "neutral.10"
138
- }), (0, _react2.jsx)(_index.Text, null, item.field3))));
126
+ });
139
127
  }), (0, _react2.jsx)(_index.Box, {
140
- isRow: true
141
- }, (0, _react2.jsx)(_index.Bracket, null), (0, _react2.jsx)(_index.Box, {
142
- variant: "forms.input.fieldControlWrapper",
143
- mt: "md",
144
- sx: sx.borderedBoxStyles
145
- }, (0, _react2.jsx)(_index.Box, {
146
- isRow: true
147
- }, (0, _react2.jsx)(_index.Badge, {
148
- label: "Any",
149
- bg: "decorative.7",
150
- sx: customBadgeStyles,
151
- alignSelf: "center"
152
- }), (0, _react2.jsx)(_index.Text, null, " of the conditions are true")), (0, _react2.jsx)(_index.Box, {
128
+ isRow: true,
153
129
  ml: "xs"
154
- }, (0, _map["default"])(anyConditions).call(anyConditions, function (item, index) {
155
- return (0, _react2.jsx)(_index.Box, {
156
- isRow: true,
157
- key: item.key
158
- }, (0, _react2.jsx)(_index.Bracket, {
159
- ml: 0,
160
- isLast: index === anyConditions.length - 1
161
- }), (0, _react2.jsx)(_index.Box, {
162
- mt: "md",
163
- variant: "forms.input.fieldControlWrapper",
164
- bg: "white",
165
- isRow: true,
166
- width: "100%",
167
- sx: _objectSpread(_objectSpread({}, sx.allConditionsBox), {}, {
168
- '&::after': {
169
- bg: 'decorative.7',
170
- width: '2px'
171
- }
172
- })
173
- }, (0, _react2.jsx)(_index.Text, {
174
- sx: sx.textStyles
175
- }, item.field1), (0, _react2.jsx)(_index.Badge, {
176
- label: "Equals",
177
- textColor: "neutral.10",
178
- sx: sx.equalBadgeStyles
179
- }), (0, _react2.jsx)(_index.Text, null, item.field3)));
180
- })))), (0, _react2.jsx)(_index.Box, {
181
- isRow: true
182
130
  }, (0, _react2.jsx)(_index.Bracket, {
131
+ sx: _objectSpread(_objectSpread({}, sx.display.bracket), {}, {
132
+ height: '148px'
133
+ }),
183
134
  isLast: true
184
135
  }), (0, _react2.jsx)(_index.Box, {
185
- variant: "forms.input.fieldControlWrapper",
186
- mt: "md",
187
- sx: sx.borderedBoxStyles
136
+ sx: sx.display.borderBox,
137
+ variant: "forms.input.fieldControlWrapper"
138
+ }, (0, _react2.jsx)(DisplaySectionHeader, {
139
+ badgeColor: "decorative.7",
140
+ label: "Any"
141
+ }), (0, _map["default"])(anyConditions).call(anyConditions, function (item, index) {
142
+ return (0, _react2.jsx)(DisplayRow, {
143
+ barColor: "decorative.7",
144
+ isLast: index === anyConditions.length - 1,
145
+ item: item,
146
+ key: item.key
147
+ });
148
+ }))));
149
+ };
150
+ exports.Display = Display;
151
+ var DisplayRow = function DisplayRow(_ref) {
152
+ var _ref$item = _ref.item,
153
+ item = _ref$item === void 0 ? allConditions[0] : _ref$item,
154
+ _ref$isLast = _ref.isLast,
155
+ isLast = _ref$isLast === void 0 ? false : _ref$isLast,
156
+ _ref$barColor = _ref.barColor,
157
+ barColor = _ref$barColor === void 0 ? 'decorative.4' : _ref$barColor;
158
+ return (0, _react2.jsx)(_index.Box, {
159
+ isRow: true,
160
+ ml: "xs"
161
+ }, (0, _react2.jsx)(_index.Bracket, {
162
+ sx: sx.display.bracket,
163
+ isLast: isLast
164
+ }), (0, _react2.jsx)(_index.Box, {
165
+ width: "100%"
188
166
  }, (0, _react2.jsx)(_index.Box, {
189
- isRow: true
167
+ gap: "sm",
168
+ isRow: true,
169
+ sx: _objectSpread(_objectSpread({}, sx.display.rowBox), {}, {
170
+ '&::after': {
171
+ bg: barColor,
172
+ width: '2px'
173
+ }
174
+ }),
175
+ variant: "forms.input.fieldControlWrapper"
176
+ }, (0, _react2.jsx)(_index.Text, null, item.field1), (0, _react2.jsx)(_index.Badge, {
177
+ label: "Equals",
178
+ sx: sx.badge.equal,
179
+ textColor: "neutral.10"
180
+ }), (0, _react2.jsx)(_index.Text, null, item.field3))));
181
+ };
182
+ exports.DisplayRow = DisplayRow;
183
+ var DisplaySectionHeader = function DisplaySectionHeader(_ref2) {
184
+ var _ref2$badgeColor = _ref2.badgeColor,
185
+ badgeColor = _ref2$badgeColor === void 0 ? 'decorative.4' : _ref2$badgeColor,
186
+ _ref2$label = _ref2.label,
187
+ label = _ref2$label === void 0 ? 'All' : _ref2$label;
188
+ return (0, _react2.jsx)(_index.Box, {
189
+ isRow: true,
190
+ ml: "sm"
190
191
  }, (0, _react2.jsx)(_index.Badge, {
191
- label: "None",
192
- bg: "accent.20",
193
- sx: customBadgeStyles,
192
+ bg: badgeColor,
193
+ label: label,
194
+ sx: sx.badge.condition
195
+ }), (0, _react2.jsx)(_index.Text, {
196
+ ml: "sm",
194
197
  alignSelf: "center"
195
- }), (0, _react2.jsx)(_index.Text, null, " of the conditions are true")), (0, _react2.jsx)(_index.Box, {
196
- ml: "xs"
197
- }, (0, _map["default"])(noneConditions).call(noneConditions, function (item, index) {
198
- return (0, _react2.jsx)(_index.Box, {
199
- isRow: true,
200
- key: item.key
201
- }, (0, _react2.jsx)(_index.Bracket, {
202
- ml: 0,
203
- isLast: index === noneConditions.length - 1
204
- }), (0, _react2.jsx)(_index.Box, {
205
- mt: "md",
206
- variant: "forms.input.fieldControlWrapper",
207
- bg: "white",
208
- isRow: true,
209
- width: "100%",
210
- sx: _objectSpread(_objectSpread({}, sx.allConditionsBox), {}, {
211
- '&::after': {
212
- bg: 'accent.20',
213
- width: '2px'
214
- }
215
- })
216
- }, (0, _react2.jsx)(_index.Text, {
217
- sx: sx.textStyles
218
- }, item.field1), (0, _react2.jsx)(_index.Badge, {
219
- label: "Equals",
220
- textColor: "neutral.10",
221
- sx: sx.equalBadgeStyles
222
- }), (0, _react2.jsx)(_index.Text, null, item.field3)));
223
- }))))));
198
+ }, ofTheConditionsAreTrueCopy));
224
199
  };
225
- exports.Display = Display;
200
+ exports.DisplaySectionHeader = DisplaySectionHeader;
226
201
  var Edit = function Edit() {
227
202
  var trashButton = (0, _react2.jsx)(_index.IconButton, {
228
203
  "aria-label": "deleteButton",
@@ -277,7 +252,7 @@ var Edit = function Edit() {
277
252
  }
278
253
  }, (0, _react2.jsx)(_index.Text, {
279
254
  sx: sx.defaultText
280
- }, "NONE"))), (0, _react2.jsx)(_index.Text, null, " of the conditions are true"), (0, _react2.jsx)(_index.Button, {
255
+ }, "NONE"))), (0, _react2.jsx)(_index.Text, null, ofTheConditionsAreTrueCopy), (0, _react2.jsx)(_index.Button, {
281
256
  variant: "inline",
282
257
  width: "fit-content",
283
258
  role: "button",
@@ -368,7 +343,7 @@ var Edit = function Edit() {
368
343
  }
369
344
  }, (0, _react2.jsx)(_index.Text, {
370
345
  sx: sx.defaultText
371
- }, "NONE"))), (0, _react2.jsx)(_index.Text, null, " of the conditions are true"), (0, _react2.jsx)(_index.Button, {
346
+ }, "NONE"))), (0, _react2.jsx)(_index.Text, null, ofTheConditionsAreTrueCopy), (0, _react2.jsx)(_index.Button, {
372
347
  variant: "inline",
373
348
  width: "fit-content",
374
349
  role: "button",
@@ -464,7 +439,7 @@ var Edit = function Edit() {
464
439
  }
465
440
  }, (0, _react2.jsx)(_index.Text, {
466
441
  sx: sx.defaultText
467
- }, "NONE"))), (0, _react2.jsx)(_index.Text, null, " of the conditions are true"), (0, _react2.jsx)(_index.Button, {
442
+ }, "NONE"))), (0, _react2.jsx)(_index.Text, null, ofTheConditionsAreTrueCopy), (0, _react2.jsx)(_index.Button, {
468
443
  variant: "inline",
469
444
  width: "fit-content",
470
445
  role: "button",
@@ -1,52 +1,15 @@
1
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
2
1
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
3
- var _excluded = ["saveButtonProps", "cancelButtonProps", "refreshButtonProps", "isJustifiedRight", "children"];
4
- import _reverseInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reverse";
5
- import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
6
- import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
7
- import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
8
- import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
2
+ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["align", "children"];
9
4
  import React from 'react';
10
5
  import PropTypes from 'prop-types';
11
- import { buttonPropTypes } from '../../components/Button/buttonAttributes';
12
- import { Box, Button } from '../../index';
6
+ import { Box } from '../../index';
13
7
  import { jsx as ___EmotionJSX } from "@emotion/react";
14
- var SaveButton = function SaveButton(props) {
15
- return ___EmotionJSX(Button, _extends({
16
- variant: "primary",
17
- "data-id": "save-button"
18
- }, props), props.text);
19
- };
20
- var CancelButton = function CancelButton(props) {
21
- return ___EmotionJSX(Button, _extends({
22
- variant: "link",
23
- "data-id": "cancel-button"
24
- }, props), props.text);
25
- };
26
- var RefreshButton = function RefreshButton(props) {
27
- return ___EmotionJSX(Button, _extends({
28
- "data-id": "refresh-button"
29
- }, props), props.text);
30
- };
31
8
  var ButtonBar = function ButtonBar(props) {
32
- var _context2;
33
- var saveButtonProps = props.saveButtonProps,
34
- cancelButtonProps = props.cancelButtonProps,
35
- refreshButtonProps = props.refreshButtonProps,
36
- isJustifiedRight = props.isJustifiedRight,
9
+ var _props$align = props.align,
10
+ align = _props$align === void 0 ? 'left' : _props$align,
37
11
  children = props.children,
38
12
  others = _objectWithoutProperties(props, _excluded);
39
- var ButtonArray = [___EmotionJSX(SaveButton, saveButtonProps), ___EmotionJSX(CancelButton, cancelButtonProps)];
40
- var Content = function Content() {
41
- var _context;
42
- var content = isJustifiedRight ? _reverseInstanceProperty(_context = _sliceInstanceProperty(ButtonArray).call(ButtonArray)).call(_context) : ButtonArray;
43
- if (refreshButtonProps) {
44
- _spliceInstanceProperty(content).call(content, 1, 0, ___EmotionJSX(RefreshButton, refreshButtonProps));
45
- }
46
- return ___EmotionJSX(React.Fragment, null, _mapInstanceProperty(content).call(content, function (child) {
47
- return child;
48
- }));
49
- };
50
13
  return ___EmotionJSX(Box, _extends({
51
14
  isRow: true,
52
15
  gap: "md",
@@ -54,23 +17,11 @@ var ButtonBar = function ButtonBar(props) {
54
17
  bg: 'white',
55
18
  px: 'lg',
56
19
  py: 'md',
57
- justifyContent: isJustifiedRight ? 'right' : 'left'
20
+ justifyContent: align === 'right' ? 'right' : 'left'
58
21
  }
59
- }, others), children ? _concatInstanceProperty(_context2 = []).call(_context2, children) : ___EmotionJSX(Content, null));
22
+ }, others), children);
60
23
  };
61
24
  ButtonBar.propTypes = {
62
- saveButtonProps: PropTypes.shape(buttonPropTypes),
63
- cancelButtonProps: PropTypes.shape(buttonPropTypes),
64
- refreshButtonProps: PropTypes.shape(buttonPropTypes),
65
- isJustifiedRight: PropTypes.bool
66
- };
67
- SaveButton.propTypes = {
68
- text: PropTypes.string
69
- };
70
- CancelButton.propTypes = {
71
- text: PropTypes.string
72
- };
73
- RefreshButton.propTypes = {
74
- text: PropTypes.string
25
+ align: PropTypes.oneOf(['left', 'right'])
75
26
  };
76
27
  export default ButtonBar;
@@ -6,8 +6,4 @@ import { Meta } from '@storybook/addon-docs';
6
6
 
7
7
  This is a composed component that renders children in a simplified, organized and consistent manner.
8
8
 
9
- The default children are controlled by three prop objects, **saveButtonProps**, **cancelButtonProps**, and **refreshButtonProps**. The SaveButton and the CancelButton will render by default. The RefreshButton will only render if **refreshButtonProps** are supplied.
10
-
11
- The **isJustifiedRight** prop will reverse the order of the children, and justify them to the right.
12
-
13
- Supplying the ButtonBar with children using default React syntax will override the default render and render the custom children.
9
+ If the **align** prop is set to right it will justify the children to the right. Default is left justification.
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
1
  import React from 'react';
3
2
  import DocsLayout from '../../../.storybook/storybookDocsLayout';
4
3
  import { Button, ButtonBar } from '../..';
@@ -16,72 +15,44 @@ export default {
16
15
  return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(ButtonBarReadme, null), ___EmotionJSX(DocsLayout, null));
17
16
  }
18
17
  }
18
+ },
19
+ argTypes: {
20
+ align: {
21
+ control: {
22
+ type: 'text'
23
+ }
24
+ }
19
25
  }
20
26
  };
21
27
  export var Default = function Default(args) {
22
- return ___EmotionJSX(ButtonBar, _extends({
23
- saveButtonProps: {
24
- key: 'save button',
25
- text: 'Save',
26
- onPress: function onPress() {
27
- return alert('Save button pressed');
28
- }
29
- },
30
- cancelButtonProps: {
31
- key: 'cancel button',
32
- text: 'Cancel',
33
- onPress: function onPress() {
34
- return alert('Cancel button pressed');
35
- }
28
+ return ___EmotionJSX(ButtonBar, args, ___EmotionJSX(Button, {
29
+ variant: "primary",
30
+ "data-id": "save-button",
31
+ onPress: function onPress() {
32
+ return alert('Save button pressed');
36
33
  }
37
- }, args));
38
- };
39
- export var WithRefreshButton = function WithRefreshButton(args) {
40
- return ___EmotionJSX(ButtonBar, _extends({
41
- saveButtonProps: {
42
- key: 'save button',
43
- text: 'Save',
44
- onPress: function onPress() {
45
- return alert('Save button pressed');
46
- }
47
- },
48
- cancelButtonProps: {
49
- key: 'cancel button',
50
- text: 'Cancel',
51
- onPress: function onPress() {
52
- return alert('Cancel button pressed');
53
- }
54
- },
55
- refreshButtonProps: {
56
- key: 'refresh button',
57
- text: 'Refresh',
58
- onPress: function onPress() {
59
- return alert('Refresh button pressed');
60
- }
34
+ }, "Save"), ___EmotionJSX(Button, {
35
+ variant: "link",
36
+ "data-id": "cancel-button",
37
+ onPress: function onPress() {
38
+ return alert('Cancel button pressed');
61
39
  }
62
- }, args));
40
+ }, "Cancel"));
63
41
  };
64
- export var JustifiedRight = function JustifiedRight() {
42
+ export var RightAligned = function RightAligned() {
65
43
  return ___EmotionJSX(ButtonBar, {
66
- saveButtonProps: {
67
- key: 'next button',
68
- text: 'Next',
69
- onPress: function onPress() {
70
- return alert('Save button pressed');
71
- }
72
- },
73
- cancelButtonProps: {
74
- key: 'cancel button',
75
- text: 'Cancel',
76
- onPress: function onPress() {
77
- return alert('Cancel button pressed');
78
- }
79
- },
80
- isJustifiedRight: true
81
- });
82
- };
83
- export var WithChildren = function WithChildren(args) {
84
- return ___EmotionJSX(ButtonBar, args, ___EmotionJSX(Button, null, "Custom Button!"), ___EmotionJSX(Button, {
85
- variant: "link"
86
- }, "Custom Link!"));
44
+ align: "right"
45
+ }, ___EmotionJSX(Button, {
46
+ variant: "primary",
47
+ "data-id": "next-button",
48
+ onPress: function onPress() {
49
+ return alert('Next button pressed');
50
+ }
51
+ }, "Next"), ___EmotionJSX(Button, {
52
+ variant: "link",
53
+ "data-id": "cancel-button",
54
+ onPress: function onPress() {
55
+ return alert('Cancel button pressed');
56
+ }
57
+ }, "Cancel"));
87
58
  };
@@ -1,39 +1,28 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
2
  import React from 'react';
3
- import { ButtonBar } from '../..';
3
+ import { Button, ButtonBar } from '../..';
4
4
  import axeTest from '../../utils/testUtils/testAxe';
5
5
  import { render, screen } from '../../utils/testUtils/testWrapper';
6
6
  import { jsx as ___EmotionJSX } from "@emotion/react";
7
7
  var testId = 'test-ButtonBar';
8
- var saveButtonProps = {
9
- key: 'save button',
10
- text: 'Save',
11
- onPress: function onPress() {
12
- return alert('Save button pressed');
13
- }
14
- };
15
- var cancelButtonProps = {
16
- key: 'cancel button',
17
- text: 'Cancel',
18
- onPress: function onPress() {
19
- return alert('Cancel button pressed');
20
- }
21
- };
22
- var refreshButtonProps = {
23
- key: 'refresh button',
24
- text: 'Refresh',
25
- onPress: function onPress() {
26
- return alert('Refresh button pressed');
27
- }
28
- };
29
8
  var defaultProps = {
30
- 'data-testid': testId,
31
- saveButtonProps: saveButtonProps,
32
- cancelButtonProps: cancelButtonProps
9
+ 'data-testid': testId
33
10
  };
34
11
  var getComponent = function getComponent() {
35
12
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
36
- return render(___EmotionJSX(ButtonBar, _extends({}, defaultProps, props)));
13
+ return render(___EmotionJSX(ButtonBar, _extends({}, defaultProps, props), ___EmotionJSX(Button, {
14
+ variant: "primary",
15
+ "data-id": "save-button",
16
+ onPress: function onPress() {
17
+ return alert('Save button pressed');
18
+ }
19
+ }, "Save"), ___EmotionJSX(Button, {
20
+ variant: "link",
21
+ "data-id": "cancel-button",
22
+ onPress: function onPress() {
23
+ return alert('Cancel button pressed');
24
+ }
25
+ }, "Cancel")));
37
26
  };
38
27
  var getComponentCustomChildren = function getComponentCustomChildren() {
39
28
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -52,22 +41,11 @@ test('ButtonBar does render', function () {
52
41
  var element = screen.getByTestId(testId);
53
42
  expect(element).toBeInTheDocument();
54
43
  });
55
- test('renders save and cancel buttons', function () {
44
+ test('renders child save and cancel buttons', function () {
56
45
  getComponent();
57
- var saveButton = screen.getByText(saveButtonProps.text);
46
+ var saveButton = screen.getByText('Save');
58
47
  expect(saveButton).toBeInTheDocument();
59
- var cancelButton = screen.getByText(cancelButtonProps.text);
60
- expect(cancelButton).toBeInTheDocument();
61
- });
62
- test('renders all three buttons', function () {
63
- getComponent({
64
- refreshButtonProps: refreshButtonProps
65
- });
66
- var saveButton = screen.getByText(saveButtonProps.text);
67
- expect(saveButton).toBeInTheDocument();
68
- var refreshButton = screen.getByText(refreshButtonProps.text);
69
- expect(refreshButton).toBeInTheDocument();
70
- var cancelButton = screen.getByText(cancelButtonProps.text);
48
+ var cancelButton = screen.getByText('Cancel');
71
49
  expect(cancelButton).toBeInTheDocument();
72
50
  });
73
51
  test('renders custom children', function () {
@@ -82,10 +60,29 @@ test('renders custom text', function () {
82
60
  var firstText = screen.getByText('custom text');
83
61
  expect(firstText).toBeInTheDocument();
84
62
  });
85
- test('isJustifiedRight reverses order of button', function () {
63
+ test('justify-content right when align prop set to right', function () {
86
64
  getComponent({
87
- isJustifiedRight: true
65
+ align: 'right'
88
66
  });
89
- var buttons = screen.getAllByRole('button');
90
- expect(buttons[0]).toHaveAttribute('data-id', 'cancel-button');
67
+ var element = screen.getByTestId(testId);
68
+ expect(element).toHaveStyleRule('justify-content', 'right');
69
+ });
70
+ test('justify-content left when align prop is set to left', function () {
71
+ getComponent({
72
+ align: 'left'
73
+ });
74
+ var element = screen.getByTestId(testId);
75
+ expect(element).toHaveStyleRule('justify-content', 'left');
76
+ });
77
+ test('justify-content left when align prop is excluded', function () {
78
+ getComponent();
79
+ var element = screen.getByTestId(testId);
80
+ expect(element).toHaveStyleRule('justify-content', 'left');
81
+ });
82
+ test('an error is thrown when align has invalid prop value', function () {
83
+ expect(function () {
84
+ return getComponent({
85
+ align: 'rihgt'
86
+ });
87
+ }).toThrow('Failed prop type');
91
88
  });