@pingux/astro 2.18.1-alpha.1 → 2.19.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.
@@ -6,55 +6,18 @@ _Object$defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports["default"] = void 0;
9
- var _reverse = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reverse"));
10
- var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
11
- var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/splice"));
12
- var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
13
- var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
14
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
15
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
16
11
  var _react = _interopRequireDefault(require("react"));
17
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
18
- var _buttonAttributes = require("../../components/Button/buttonAttributes");
19
13
  var _index = require("../../index");
20
14
  var _react2 = require("@emotion/react");
21
- var _excluded = ["saveButtonProps", "cancelButtonProps", "refreshButtonProps", "isJustifiedRight", "children"];
22
- var SaveButton = function SaveButton(props) {
23
- return (0, _react2.jsx)(_index.Button, (0, _extends2["default"])({
24
- variant: "primary",
25
- "data-id": "save-button"
26
- }, props), props.text);
27
- };
28
- var CancelButton = function CancelButton(props) {
29
- return (0, _react2.jsx)(_index.Button, (0, _extends2["default"])({
30
- variant: "link",
31
- "data-id": "cancel-button"
32
- }, props), props.text);
33
- };
34
- var RefreshButton = function RefreshButton(props) {
35
- return (0, _react2.jsx)(_index.Button, (0, _extends2["default"])({
36
- "data-id": "refresh-button"
37
- }, props), props.text);
38
- };
15
+ var _excluded = ["align", "children"];
39
16
  var ButtonBar = function ButtonBar(props) {
40
- var _context2;
41
- var saveButtonProps = props.saveButtonProps,
42
- cancelButtonProps = props.cancelButtonProps,
43
- refreshButtonProps = props.refreshButtonProps,
44
- isJustifiedRight = props.isJustifiedRight,
17
+ var _props$align = props.align,
18
+ align = _props$align === void 0 ? 'left' : _props$align,
45
19
  children = props.children,
46
20
  others = (0, _objectWithoutProperties2["default"])(props, _excluded);
47
- var ButtonArray = [(0, _react2.jsx)(SaveButton, saveButtonProps), (0, _react2.jsx)(CancelButton, cancelButtonProps)];
48
- var Content = function Content() {
49
- var _context;
50
- var content = isJustifiedRight ? (0, _reverse["default"])(_context = (0, _slice["default"])(ButtonArray).call(ButtonArray)).call(_context) : ButtonArray;
51
- if (refreshButtonProps) {
52
- (0, _splice["default"])(content).call(content, 1, 0, (0, _react2.jsx)(RefreshButton, refreshButtonProps));
53
- }
54
- return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _map["default"])(content).call(content, function (child) {
55
- return child;
56
- }));
57
- };
58
21
  return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
59
22
  isRow: true,
60
23
  gap: "md",
@@ -62,24 +25,12 @@ var ButtonBar = function ButtonBar(props) {
62
25
  bg: 'white',
63
26
  px: 'lg',
64
27
  py: 'md',
65
- justifyContent: isJustifiedRight ? 'right' : 'left'
28
+ justifyContent: align === 'right' ? 'right' : 'left'
66
29
  }
67
- }, others), children ? (0, _concat["default"])(_context2 = []).call(_context2, children) : (0, _react2.jsx)(Content, null));
30
+ }, others), children);
68
31
  };
69
32
  ButtonBar.propTypes = {
70
- saveButtonProps: _propTypes["default"].shape(_buttonAttributes.buttonPropTypes),
71
- cancelButtonProps: _propTypes["default"].shape(_buttonAttributes.buttonPropTypes),
72
- refreshButtonProps: _propTypes["default"].shape(_buttonAttributes.buttonPropTypes),
73
- isJustifiedRight: _propTypes["default"].bool
74
- };
75
- SaveButton.propTypes = {
76
- text: _propTypes["default"].string
77
- };
78
- CancelButton.propTypes = {
79
- text: _propTypes["default"].string
80
- };
81
- RefreshButton.propTypes = {
82
- text: _propTypes["default"].string
33
+ align: _propTypes["default"].oneOf(['left', 'right'])
83
34
  };
84
35
  var _default = ButtonBar;
85
36
  exports["default"] = _default;
@@ -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.
@@ -5,8 +5,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
5
5
  _Object$defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports["default"] = exports.WithRefreshButton = exports.WithChildren = exports.JustifiedRight = exports.Default = void 0;
9
- var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
8
+ exports["default"] = exports.RightAligned = exports.Default = void 0;
10
9
  var _react = _interopRequireDefault(require("react"));
11
10
  var _storybookDocsLayout = _interopRequireDefault(require("../../../.storybook/storybookDocsLayout"));
12
11
  var _ = require("../..");
@@ -24,77 +23,47 @@ var _default = {
24
23
  return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_ButtonBar["default"], null), (0, _react2.jsx)(_storybookDocsLayout["default"], null));
25
24
  }
26
25
  }
26
+ },
27
+ argTypes: {
28
+ align: {
29
+ control: {
30
+ type: 'text'
31
+ }
32
+ }
27
33
  }
28
34
  };
29
35
  exports["default"] = _default;
30
36
  var Default = function Default(args) {
31
- return (0, _react2.jsx)(_.ButtonBar, (0, _extends2["default"])({
32
- saveButtonProps: {
33
- key: 'save button',
34
- text: 'Save',
35
- onPress: function onPress() {
36
- return alert('Save button pressed');
37
- }
38
- },
39
- cancelButtonProps: {
40
- key: 'cancel button',
41
- text: 'Cancel',
42
- onPress: function onPress() {
43
- return alert('Cancel button pressed');
44
- }
37
+ return (0, _react2.jsx)(_.ButtonBar, args, (0, _react2.jsx)(_.Button, {
38
+ variant: "primary",
39
+ "data-id": "save-button",
40
+ onPress: function onPress() {
41
+ return alert('Save button pressed');
45
42
  }
46
- }, args));
47
- };
48
- exports.Default = Default;
49
- var WithRefreshButton = function WithRefreshButton(args) {
50
- return (0, _react2.jsx)(_.ButtonBar, (0, _extends2["default"])({
51
- saveButtonProps: {
52
- key: 'save button',
53
- text: 'Save',
54
- onPress: function onPress() {
55
- return alert('Save button pressed');
56
- }
57
- },
58
- cancelButtonProps: {
59
- key: 'cancel button',
60
- text: 'Cancel',
61
- onPress: function onPress() {
62
- return alert('Cancel button pressed');
63
- }
64
- },
65
- refreshButtonProps: {
66
- key: 'refresh button',
67
- text: 'Refresh',
68
- onPress: function onPress() {
69
- return alert('Refresh button pressed');
70
- }
43
+ }, "Save"), (0, _react2.jsx)(_.Button, {
44
+ variant: "link",
45
+ "data-id": "cancel-button",
46
+ onPress: function onPress() {
47
+ return alert('Cancel button pressed');
71
48
  }
72
- }, args));
49
+ }, "Cancel"));
73
50
  };
74
- exports.WithRefreshButton = WithRefreshButton;
75
- var JustifiedRight = function JustifiedRight() {
51
+ exports.Default = Default;
52
+ var RightAligned = function RightAligned() {
76
53
  return (0, _react2.jsx)(_.ButtonBar, {
77
- saveButtonProps: {
78
- key: 'next button',
79
- text: 'Next',
80
- onPress: function onPress() {
81
- return alert('Save button pressed');
82
- }
83
- },
84
- cancelButtonProps: {
85
- key: 'cancel button',
86
- text: 'Cancel',
87
- onPress: function onPress() {
88
- return alert('Cancel button pressed');
89
- }
90
- },
91
- isJustifiedRight: true
92
- });
93
- };
94
- exports.JustifiedRight = JustifiedRight;
95
- var WithChildren = function WithChildren(args) {
96
- return (0, _react2.jsx)(_.ButtonBar, args, (0, _react2.jsx)(_.Button, null, "Custom Button!"), (0, _react2.jsx)(_.Button, {
97
- variant: "link"
98
- }, "Custom Link!"));
54
+ align: "right"
55
+ }, (0, _react2.jsx)(_.Button, {
56
+ variant: "primary",
57
+ "data-id": "next-button",
58
+ onPress: function onPress() {
59
+ return alert('Next button pressed');
60
+ }
61
+ }, "Next"), (0, _react2.jsx)(_.Button, {
62
+ variant: "link",
63
+ "data-id": "cancel-button",
64
+ onPress: function onPress() {
65
+ return alert('Cancel button pressed');
66
+ }
67
+ }, "Cancel"));
99
68
  };
100
- exports.WithChildren = WithChildren;
69
+ exports.RightAligned = RightAligned;
@@ -8,35 +8,24 @@ var _testAxe = _interopRequireDefault(require("../../utils/testUtils/testAxe"));
8
8
  var _testWrapper = require("../../utils/testUtils/testWrapper");
9
9
  var _react2 = require("@emotion/react");
10
10
  var testId = 'test-ButtonBar';
11
- var saveButtonProps = {
12
- key: 'save button',
13
- text: 'Save',
14
- onPress: function onPress() {
15
- return alert('Save button pressed');
16
- }
17
- };
18
- var cancelButtonProps = {
19
- key: 'cancel button',
20
- text: 'Cancel',
21
- onPress: function onPress() {
22
- return alert('Cancel button pressed');
23
- }
24
- };
25
- var refreshButtonProps = {
26
- key: 'refresh button',
27
- text: 'Refresh',
28
- onPress: function onPress() {
29
- return alert('Refresh button pressed');
30
- }
31
- };
32
11
  var defaultProps = {
33
- 'data-testid': testId,
34
- saveButtonProps: saveButtonProps,
35
- cancelButtonProps: cancelButtonProps
12
+ 'data-testid': testId
36
13
  };
37
14
  var getComponent = function getComponent() {
38
15
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
39
- return (0, _testWrapper.render)((0, _react2.jsx)(_.ButtonBar, (0, _extends2["default"])({}, defaultProps, props)));
16
+ return (0, _testWrapper.render)((0, _react2.jsx)(_.ButtonBar, (0, _extends2["default"])({}, defaultProps, props), (0, _react2.jsx)(_.Button, {
17
+ variant: "primary",
18
+ "data-id": "save-button",
19
+ onPress: function onPress() {
20
+ return alert('Save button pressed');
21
+ }
22
+ }, "Save"), (0, _react2.jsx)(_.Button, {
23
+ variant: "link",
24
+ "data-id": "cancel-button",
25
+ onPress: function onPress() {
26
+ return alert('Cancel button pressed');
27
+ }
28
+ }, "Cancel")));
40
29
  };
41
30
  var getComponentCustomChildren = function getComponentCustomChildren() {
42
31
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -55,22 +44,11 @@ test('ButtonBar does render', function () {
55
44
  var element = _testWrapper.screen.getByTestId(testId);
56
45
  expect(element).toBeInTheDocument();
57
46
  });
58
- test('renders save and cancel buttons', function () {
47
+ test('renders child save and cancel buttons', function () {
59
48
  getComponent();
60
- var saveButton = _testWrapper.screen.getByText(saveButtonProps.text);
49
+ var saveButton = _testWrapper.screen.getByText('Save');
61
50
  expect(saveButton).toBeInTheDocument();
62
- var cancelButton = _testWrapper.screen.getByText(cancelButtonProps.text);
63
- expect(cancelButton).toBeInTheDocument();
64
- });
65
- test('renders all three buttons', function () {
66
- getComponent({
67
- refreshButtonProps: refreshButtonProps
68
- });
69
- var saveButton = _testWrapper.screen.getByText(saveButtonProps.text);
70
- expect(saveButton).toBeInTheDocument();
71
- var refreshButton = _testWrapper.screen.getByText(refreshButtonProps.text);
72
- expect(refreshButton).toBeInTheDocument();
73
- var cancelButton = _testWrapper.screen.getByText(cancelButtonProps.text);
51
+ var cancelButton = _testWrapper.screen.getByText('Cancel');
74
52
  expect(cancelButton).toBeInTheDocument();
75
53
  });
76
54
  test('renders custom children', function () {
@@ -85,10 +63,29 @@ test('renders custom text', function () {
85
63
  var firstText = _testWrapper.screen.getByText('custom text');
86
64
  expect(firstText).toBeInTheDocument();
87
65
  });
88
- test('isJustifiedRight reverses order of button', function () {
66
+ test('justify-content right when align prop set to right', function () {
89
67
  getComponent({
90
- isJustifiedRight: true
68
+ align: 'right'
91
69
  });
92
- var buttons = _testWrapper.screen.getAllByRole('button');
93
- expect(buttons[0]).toHaveAttribute('data-id', 'cancel-button');
70
+ var element = _testWrapper.screen.getByTestId(testId);
71
+ expect(element).toHaveStyleRule('justify-content', 'right');
72
+ });
73
+ test('justify-content left when align prop is set to left', function () {
74
+ getComponent({
75
+ align: 'left'
76
+ });
77
+ var element = _testWrapper.screen.getByTestId(testId);
78
+ expect(element).toHaveStyleRule('justify-content', 'left');
79
+ });
80
+ test('justify-content left when align prop is excluded', function () {
81
+ getComponent();
82
+ var element = _testWrapper.screen.getByTestId(testId);
83
+ expect(element).toHaveStyleRule('justify-content', 'left');
84
+ });
85
+ test('an error is thrown when align has invalid prop value', function () {
86
+ expect(function () {
87
+ return getComponent({
88
+ align: 'rihgt'
89
+ });
90
+ }).toThrow('Failed prop type');
94
91
  });
@@ -18,6 +18,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/he
18
18
  var _react = _interopRequireDefault(require("react"));
19
19
  var _TrashIcon = _interopRequireDefault(require("@pingux/mdi-react/TrashIcon"));
20
20
  var _index = require("../index");
21
+ var _figmaLinks = require("../utils/designUtils/figmaLinks.js");
21
22
  var _react2 = require("@emotion/react");
22
23
  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; }
23
24
  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; }
@@ -198,6 +199,12 @@ var DisplaySectionHeader = function DisplaySectionHeader(_ref2) {
198
199
  }, ofTheConditionsAreTrueCopy));
199
200
  };
200
201
  exports.DisplaySectionHeader = DisplaySectionHeader;
202
+ Display.parameters = {
203
+ design: {
204
+ type: 'figma',
205
+ url: _figmaLinks.FIGMA_LINKS.conditionFilter.display
206
+ }
207
+ };
201
208
  var Edit = function Edit() {
202
209
  var trashButton = (0, _react2.jsx)(_index.IconButton, {
203
210
  "aria-label": "deleteButton",
@@ -494,4 +501,10 @@ var Edit = function Edit() {
494
501
  alignSelf: "start"
495
502
  }, trashButton))));
496
503
  };
497
- exports.Edit = Edit;
504
+ exports.Edit = Edit;
505
+ Edit.parameters = {
506
+ design: {
507
+ type: 'figma',
508
+ url: _figmaLinks.FIGMA_LINKS.conditionFilter.edit
509
+ }
510
+ };
@@ -39,6 +39,10 @@ var FIGMA_LINKS = {
39
39
  collapsiblePanel: {
40
40
  "default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?type=design&node-id=14546-33229&t=VgqEexa1CXAXfPpp-0'
41
41
  },
42
+ conditionFilter: {
43
+ display: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=218%3A574&mode=dev',
44
+ edit: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=218%3A597&mode=dev'
45
+ },
42
46
  copyText: {
43
47
  "default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?type=design&node-id=218-1442&t=8Wwd3tIBh3GEjCJB-0'
44
48
  },
@@ -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
  });
@@ -13,6 +13,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
13
13
  import React from 'react';
14
14
  import TrashIcon from '@pingux/mdi-react/TrashIcon';
15
15
  import { Badge, Box, Bracket, Button, Icon, IconButton, Item, RockerButton, RockerButtonGroup, SelectField, Text, TextField } from '../index';
16
+ import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.js';
16
17
  import { jsx as ___EmotionJSX } from "@emotion/react";
17
18
  export default {
18
19
  title: 'Recipes/Condition Filter'
@@ -187,6 +188,12 @@ export var DisplaySectionHeader = function DisplaySectionHeader(_ref2) {
187
188
  alignSelf: "center"
188
189
  }, ofTheConditionsAreTrueCopy));
189
190
  };
191
+ Display.parameters = {
192
+ design: {
193
+ type: 'figma',
194
+ url: FIGMA_LINKS.conditionFilter.display
195
+ }
196
+ };
190
197
  export var Edit = function Edit() {
191
198
  var trashButton = ___EmotionJSX(IconButton, {
192
199
  "aria-label": "deleteButton",
@@ -482,4 +489,10 @@ export var Edit = function Edit() {
482
489
  }))), ___EmotionJSX(Box, {
483
490
  alignSelf: "start"
484
491
  }, trashButton))));
492
+ };
493
+ Edit.parameters = {
494
+ design: {
495
+ type: 'figma',
496
+ url: FIGMA_LINKS.conditionFilter.edit
497
+ }
485
498
  };
@@ -32,6 +32,10 @@ export var FIGMA_LINKS = {
32
32
  collapsiblePanel: {
33
33
  "default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?type=design&node-id=14546-33229&t=VgqEexa1CXAXfPpp-0'
34
34
  },
35
+ conditionFilter: {
36
+ display: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=218%3A574&mode=dev',
37
+ edit: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=218%3A597&mode=dev'
38
+ },
35
39
  copyText: {
36
40
  "default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?type=design&node-id=218-1442&t=8Wwd3tIBh3GEjCJB-0'
37
41
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.18.1-alpha.1",
3
+ "version": "2.19.0-alpha.0",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",