@pingux/astro 1.23.0-alpha.3 → 1.24.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.
@@ -14,8 +14,6 @@ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable
14
14
 
15
15
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
16
16
 
17
- var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
18
-
19
17
  var _react = _interopRequireDefault(require("react"));
20
18
 
21
19
  var _CreateIcon = _interopRequireDefault(require("mdi-react/CreateIcon"));
@@ -35,28 +33,6 @@ var _default = {
35
33
  };
36
34
  exports["default"] = _default;
37
35
 
38
- var BracketSVG = function BracketSVG(props) {
39
- return (0, _react2.jsx)("svg", (0, _extends2["default"])({
40
- xmlns: "http://www.w3.org/2000/svg",
41
- version: "1.1"
42
- }, props), (0, _react2.jsx)("title", null, "bracket-fill"), (0, _react2.jsx)("g", null, (0, _react2.jsx)("title", null, "Layer 1"), (0, _react2.jsx)("path", {
43
- fillRule: "nonzero",
44
- fill: "#CACED3",
45
- id: "Path",
46
- d: "m6, ".concat(props.height - 18, ".89712l0,10c0,2.1422 1.68397,3.89108 3.80036,3.9951l0.19964,0.0049l5,0l0,1l-5,0c-2.76142,0 -5,-2.23858 -5,-5l0,-10l1,0z")
47
- }), (0, _react2.jsx)("line", {
48
- strokeLinecap: "undefined",
49
- strokeLinejoin: "undefined",
50
- id: "svg_1",
51
- y2: "0",
52
- x2: "5.50861",
53
- y1: "".concat(props.height - 17),
54
- x1: "5.50861",
55
- stroke: "#caced3",
56
- fill: "none"
57
- })));
58
- };
59
-
60
36
  var Default = function Default() {
61
37
  var customChipStyles = {
62
38
  '& > span': {
@@ -152,13 +128,7 @@ var Default = function Default() {
152
128
  return (0, _react2.jsx)(_index.Box, {
153
129
  isRow: true,
154
130
  key: item.key
155
- }, (0, _react2.jsx)(_index.Box, {
156
- mt: "-10px",
157
- mr: "-3px"
158
- }, (0, _react2.jsx)(BracketSVG, {
159
- width: "15",
160
- height: "40"
161
- })), (0, _react2.jsx)(_index.Box, {
131
+ }, (0, _react2.jsx)(_index.Bracket, null), (0, _react2.jsx)(_index.Box, {
162
132
  ml: "3px",
163
133
  width: "100%"
164
134
  }, (0, _react2.jsx)(_index.Box, {
@@ -186,13 +156,9 @@ var Default = function Default() {
186
156
  }), (0, _react2.jsx)(_index.Text, null, item.field3))));
187
157
  }), (0, _react2.jsx)(_index.Box, {
188
158
  isRow: true
189
- }, (0, _react2.jsx)(_index.Box, {
190
- mt: "-10px",
191
- mr: "-3px"
192
- }, (0, _react2.jsx)(BracketSVG, {
193
- width: "15",
194
- height: "80"
195
- })), (0, _react2.jsx)(_index.Box, {
159
+ }, (0, _react2.jsx)(_index.Bracket, {
160
+ isLast: true
161
+ }), (0, _react2.jsx)(_index.Box, {
196
162
  variant: "forms.input.container",
197
163
  borderRadius: "4px",
198
164
  p: "sm",
@@ -209,18 +175,14 @@ var Default = function Default() {
209
175
  alignSelf: "center"
210
176
  }), (0, _react2.jsx)(_index.Text, null, " of the conditions are true")), (0, _react2.jsx)(_index.Box, {
211
177
  ml: "sm"
212
- }, (0, _map["default"])(anyConditions).call(anyConditions, function (item) {
178
+ }, (0, _map["default"])(anyConditions).call(anyConditions, function (item, index) {
213
179
  return (0, _react2.jsx)(_index.Box, {
214
180
  isRow: true,
215
- mt: "md",
216
181
  key: item.key
217
- }, (0, _react2.jsx)(_index.Box, {
218
- mt: "-25px",
219
- mr: "-3px"
220
- }, (0, _react2.jsx)(BracketSVG, {
221
- width: "15",
222
- height: "40"
223
- })), (0, _react2.jsx)(_index.Box, {
182
+ }, (0, _react2.jsx)(_index.Bracket, {
183
+ isLast: index === anyConditions.length - 1
184
+ }), (0, _react2.jsx)(_index.Box, {
185
+ mt: "md",
224
186
  variant: "forms.input.container",
225
187
  bg: "white",
226
188
  isRow: true,
@@ -54,11 +54,11 @@ var thumbContainer = {
54
54
  border: '1px solid',
55
55
  borderColor: 'neutral.80',
56
56
  borderRadius: 9999,
57
- '.is-selected &': {
57
+ 'label.is-selected &': {
58
58
  bg: 'active',
59
59
  borderColor: 'active'
60
60
  },
61
- '.is-focused &, &:focus': _objectSpread({}, _buttons.defaultFocus)
61
+ 'label.is-focused &, &:focus': _objectSpread({}, _buttons.defaultFocus)
62
62
  };
63
63
  exports.thumbContainer = thumbContainer;
64
64
  var thumb = {
@@ -73,7 +73,7 @@ var thumb = {
73
73
  transitionTimingFunction: 'ease-out',
74
74
  transitionDuration: '0.1s',
75
75
  transform: 'translateX(0)',
76
- '.is-selected &': {
76
+ 'label.is-selected &': {
77
77
  transform: 'translateX(20px)',
78
78
  borderColor: 'active'
79
79
  }
@@ -356,8 +356,14 @@ var floatLabelWrapper = {
356
356
  left: '3px',
357
357
  zIndex: 2
358
358
  };
359
+ var bracketBase = {
360
+ width: '15px',
361
+ pl: '5px',
362
+ position: 'relative'
363
+ };
359
364
  var _default = {
360
365
  base: base,
366
+ bracketBase: bracketBase,
361
367
  card: card,
362
368
  chip: chip,
363
369
  countChip: countChip,
@@ -0,0 +1,88 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["isLast", "color"];
4
+ import React, { forwardRef, useRef, useImperativeHandle } from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { Box } from '../../index';
7
+ import { line } from '../../styles/colors';
8
+ import { jsx as ___EmotionJSX } from "@emotion/react";
9
+ var Bracket = /*#__PURE__*/forwardRef(function (props, ref) {
10
+ var isLast = props.isLast,
11
+ color = props.color,
12
+ others = _objectWithoutProperties(props, _excluded);
13
+
14
+ var bracketRef = useRef();
15
+ /* istanbul ignore next */
16
+
17
+ useImperativeHandle(ref, function () {
18
+ return bracketRef.current;
19
+ });
20
+ return ___EmotionJSX(Box, _extends({
21
+ variant: "boxes.bracketBase"
22
+ }, others), !isLast && ___EmotionJSX(Box, {
23
+ width: 15,
24
+ sx: {
25
+ position: 'absolute',
26
+ top: 0,
27
+ bottom: 0
28
+ }
29
+ }, ___EmotionJSX("svg", {
30
+ xmlns: "http://www.w3.org/2000/svg",
31
+ version: "1.1",
32
+ preserveAspectRatio: "none",
33
+ viewBox: "0 0 10 10",
34
+ style: {
35
+ flexGrow: 1
36
+ },
37
+ "data-testid": "isLastLayer"
38
+ }, ___EmotionJSX("title", null, "bracket-fill"), ___EmotionJSX("g", null, ___EmotionJSX("title", null, "Layer 3"), ___EmotionJSX("line", {
39
+ strokeLinecap: "undefined",
40
+ strokeLinejoin: "undefined",
41
+ y2: "0",
42
+ x2: "0",
43
+ y1: "10",
44
+ x1: "0",
45
+ stroke: color,
46
+ fill: "none"
47
+ })))), ___EmotionJSX(Box, {
48
+ flexBasis: "50%"
49
+ }, ___EmotionJSX("svg", {
50
+ xmlns: "http://www.w3.org/2000/svg",
51
+ version: "1.1",
52
+ preserveAspectRatio: "none",
53
+ viewBox: "0 0 10 10",
54
+ style: {
55
+ flexGrow: 1
56
+ }
57
+ }, ___EmotionJSX("title", null, "bracket-fill"), ___EmotionJSX("g", null, ___EmotionJSX("title", null, "Layer 1"), ___EmotionJSX("line", {
58
+ strokeLinecap: "undefined",
59
+ strokeLinejoin: "undefined",
60
+ y2: "0",
61
+ x2: "0",
62
+ y1: "10",
63
+ x1: "0",
64
+ stroke: color,
65
+ fill: "none"
66
+ }))), ___EmotionJSX("svg", {
67
+ xmlns: "http://www.w3.org/2000/svg",
68
+ version: "1.1",
69
+ height: "15"
70
+ }, ___EmotionJSX("title", null, "bracket-fill"), ___EmotionJSX("g", {
71
+ transform: "translate(-1, 0)"
72
+ }, ___EmotionJSX("title", null, "Layer 2"), ___EmotionJSX("path", {
73
+ fill: "none",
74
+ stroke: color,
75
+ d: "M1 0C1 2.5 1 8 1 10C1 12.5 3 14.5 5.5 14.5C7.1 14.5 9.33333 14.5 10.5 14.5"
76
+ })))));
77
+ });
78
+ Bracket.defaultProps = {
79
+ color: line.light
80
+ };
81
+ Bracket.propTypes = {
82
+ /** A prop to set the strokes color. */
83
+ color: PropTypes.string,
84
+
85
+ /** Whether or not the bracket is the last in a series of brackets. */
86
+ isLast: PropTypes.bool
87
+ };
88
+ export default Bracket;
@@ -0,0 +1,70 @@
1
+ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
2
+ import React from 'react';
3
+ import { Box, Bracket, Chip, Text } from '../../index';
4
+ import { jsx as ___EmotionJSX } from "@emotion/react";
5
+ export default {
6
+ title: 'Bracket',
7
+ component: Bracket
8
+ };
9
+ export var Default = function Default() {
10
+ var anyConditions = [{
11
+ field1: 'Group',
12
+ field3: 'Marketing',
13
+ key: 'Group1Field'
14
+ }, {
15
+ field1: 'Group',
16
+ field3: 'UX Team',
17
+ key: 'Group2Field'
18
+ }];
19
+ var customChipStyles = {
20
+ '& > span': {
21
+ textTransform: 'none',
22
+ fontWeight: '500'
23
+ },
24
+ minWidth: '65px',
25
+ 'z-index': '1'
26
+ };
27
+ return ___EmotionJSX(Box, {
28
+ p: "md",
29
+ ml: "sm",
30
+ bg: "background"
31
+ }, ___EmotionJSX(Box, {
32
+ isRow: true
33
+ }, ___EmotionJSX(Chip, {
34
+ label: "Any",
35
+ bg: "neutral.20",
36
+ mr: "sm",
37
+ sx: customChipStyles,
38
+ alignSelf: "center"
39
+ }), ___EmotionJSX(Text, null, " of the conditions are true")), _mapInstanceProperty(anyConditions).call(anyConditions, function (item, index) {
40
+ return ___EmotionJSX(Box, {
41
+ isRow: true,
42
+ key: item.key
43
+ }, ___EmotionJSX(Bracket, {
44
+ isLast: index === anyConditions.length - 1
45
+ }), ___EmotionJSX(Box, {
46
+ mt: "md",
47
+ variant: "forms.input.container",
48
+ bg: "white",
49
+ isRow: true,
50
+ alignItems: "center",
51
+ borderRadius: "4px",
52
+ width: "100%",
53
+ sx: {
54
+ '&::after': {
55
+ bg: 'decorative.4'
56
+ }
57
+ }
58
+ }, ___EmotionJSX(Text, {
59
+ pl: "md",
60
+ pr: "sm"
61
+ }, item.field1), ___EmotionJSX(Chip, {
62
+ label: "Equals",
63
+ bg: "accent.90",
64
+ textColor: "neutral.10",
65
+ sx: customChipStyles,
66
+ mr: "sm",
67
+ alignSelf: "center"
68
+ }), ___EmotionJSX(Text, null, item.field3)));
69
+ }));
70
+ };
@@ -0,0 +1,35 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
+ import React from 'react';
3
+ import { render, screen } from '@testing-library/react';
4
+ import Bracket from '.';
5
+ import axeTest from '../../utils/testUtils/testAxe';
6
+ import { jsx as ___EmotionJSX } from "@emotion/react";
7
+ var testId = 'test-bracket';
8
+ var defaultProps = {
9
+ 'data-testid': testId
10
+ };
11
+
12
+ var getComponent = function getComponent() {
13
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
14
+ return render(___EmotionJSX(Bracket, _extends({}, defaultProps, props)));
15
+ }; // // Need to be added to each test file to test accessibility using axe.
16
+
17
+
18
+ axeTest(getComponent);
19
+ test('default bracket', function () {
20
+ getComponent();
21
+ var bracket = screen.getByTestId(testId);
22
+ expect(bracket).toBeInTheDocument();
23
+ });
24
+ test('additional svg does not render if isLast=true', function () {
25
+ getComponent({
26
+ isLast: true
27
+ });
28
+ expect(screen.queryByTestId('isLastLayer')).not.toBeInTheDocument();
29
+ });
30
+ test('additional svg does render if isLast=false', function () {
31
+ getComponent({
32
+ isLast: false
33
+ });
34
+ expect(screen.queryByTestId('isLastLayer')).toBeInTheDocument();
35
+ });
@@ -0,0 +1 @@
1
+ export { default } from './Bracket';
@@ -68,7 +68,6 @@ var Breadcrumbs = /*#__PURE__*/forwardRef(function (props, ref) {
68
68
  ref: breadcrumbsRef,
69
69
  isRow: true,
70
70
  sx: {
71
- overflow: 'auto',
72
71
  paddingInlineStart: 'unset'
73
72
  },
74
73
  as: "ol"
@@ -59,6 +59,12 @@ export function useListLayout(state) {
59
59
  * ListViews are used to display a list of items. Users can select,
60
60
  * view, or edit items in this list. This virtualized component supports
61
61
  * asynchronous data in infinitely scrollable lists.
62
+ *
63
+ * NOTE: be careful with putting focusable elements inside ListView.
64
+ * It is using a grid (useList hook) with its own event listeners under the hood.
65
+ * [react-specttrum-github-issue](https://github.com/adobe/react-spectrum/issues/2801)
66
+ * If you decided to add a focusable element inside ListView,
67
+ * you should stop bubbling of a pointerDown event and put a focus on the element.
62
68
  */
63
69
 
64
70
  var ListView = /*#__PURE__*/forwardRef(function (props, ref) {
@@ -21,6 +21,7 @@ import PropTypes from 'prop-types';
21
21
  import omit from 'lodash/omit';
22
22
  import { useToggleState } from '@react-stately/toggle';
23
23
  import { useSwitch } from '@react-aria/switch';
24
+ import { usePress } from '@react-aria/interactions';
24
25
  import { useField, usePropWarning } from '../../hooks';
25
26
  import statuses from '../../utils/devUtils/constants/statuses';
26
27
  import Box from '../Box';
@@ -71,6 +72,12 @@ var SwitchField = /*#__PURE__*/forwardRef(function (props, ref) {
71
72
  var state = useToggleState(_objectSpread({
72
73
  defaultSelected: isDefaultSelected
73
74
  }, props));
75
+
76
+ var _usePress = usePress({
77
+ isDisabled: isDisabled
78
+ }),
79
+ containerPressProps = _usePress.pressProps;
80
+
74
81
  var whitelistedProps = omit(props, _Object$keys(others));
75
82
 
76
83
  var _useSwitch = useSwitch(_objectSpread({
@@ -82,9 +89,9 @@ var SwitchField = /*#__PURE__*/forwardRef(function (props, ref) {
82
89
  isSelected: inputProps.checked
83
90
  };
84
91
 
85
- var _useField = useField(_objectSpread(_objectSpread({
92
+ var _useField = useField(_objectSpread(_objectSpread(_objectSpread({
86
93
  statusClasses: statusClasses
87
- }, props), {}, {
94
+ }, containerPressProps), props), {}, {
88
95
  controlProps: _objectSpread(_objectSpread({}, controlProps), inputProps)
89
96
  })),
90
97
  fieldContainerProps = _useField.fieldContainerProps,
package/lib/index.js CHANGED
@@ -17,6 +17,8 @@ export { default as Avatar } from './components/Avatar';
17
17
  export * from './components/Avatar';
18
18
  export { default as Box } from './components/Box';
19
19
  export * from './components/Box';
20
+ export { default as Bracket } from './components/Bracket';
21
+ export * from './components/Bracket';
20
22
  export { default as Breadcrumbs } from './components/Breadcrumbs';
21
23
  export * from './components/Breadcrumbs';
22
24
  export { default as Button } from './components/Button';
@@ -1,39 +1,15 @@
1
1
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
2
2
  import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
3
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
4
3
  import React from 'react';
5
4
  import CreateIcon from 'mdi-react/CreateIcon';
6
5
  import DragVerticalIcon from 'mdi-react/DragVerticalIcon';
7
6
  import TrashIcon from 'mdi-react/TrashIcon';
8
- import { Box, Button, Chip, IconButton, Icon, Item, OverlayProvider, RockerButtonGroup, RockerButton, SelectField, Text, TextField } from '../index';
7
+ import { Box, Bracket, Button, Chip, IconButton, Icon, Item, OverlayProvider, RockerButtonGroup, RockerButton, SelectField, Text, TextField } from '../index';
9
8
  import OverlayPanel from '../components/OverlayPanel';
10
9
  import { jsx as ___EmotionJSX } from "@emotion/react";
11
10
  export default {
12
11
  title: 'Recipes/ConditionalFilter'
13
12
  };
14
-
15
- var BracketSVG = function BracketSVG(props) {
16
- return ___EmotionJSX("svg", _extends({
17
- xmlns: "http://www.w3.org/2000/svg",
18
- version: "1.1"
19
- }, props), ___EmotionJSX("title", null, "bracket-fill"), ___EmotionJSX("g", null, ___EmotionJSX("title", null, "Layer 1"), ___EmotionJSX("path", {
20
- fillRule: "nonzero",
21
- fill: "#CACED3",
22
- id: "Path",
23
- d: "m6, ".concat(props.height - 18, ".89712l0,10c0,2.1422 1.68397,3.89108 3.80036,3.9951l0.19964,0.0049l5,0l0,1l-5,0c-2.76142,0 -5,-2.23858 -5,-5l0,-10l1,0z")
24
- }), ___EmotionJSX("line", {
25
- strokeLinecap: "undefined",
26
- strokeLinejoin: "undefined",
27
- id: "svg_1",
28
- y2: "0",
29
- x2: "5.50861",
30
- y1: "".concat(props.height - 17),
31
- x1: "5.50861",
32
- stroke: "#caced3",
33
- fill: "none"
34
- })));
35
- };
36
-
37
13
  export var Default = function Default() {
38
14
  var customChipStyles = {
39
15
  '& > span': {
@@ -130,13 +106,7 @@ export var Default = function Default() {
130
106
  return ___EmotionJSX(Box, {
131
107
  isRow: true,
132
108
  key: item.key
133
- }, ___EmotionJSX(Box, {
134
- mt: "-10px",
135
- mr: "-3px"
136
- }, ___EmotionJSX(BracketSVG, {
137
- width: "15",
138
- height: "40"
139
- })), ___EmotionJSX(Box, {
109
+ }, ___EmotionJSX(Bracket, null), ___EmotionJSX(Box, {
140
110
  ml: "3px",
141
111
  width: "100%"
142
112
  }, ___EmotionJSX(Box, {
@@ -164,13 +134,9 @@ export var Default = function Default() {
164
134
  }), ___EmotionJSX(Text, null, item.field3))));
165
135
  }), ___EmotionJSX(Box, {
166
136
  isRow: true
167
- }, ___EmotionJSX(Box, {
168
- mt: "-10px",
169
- mr: "-3px"
170
- }, ___EmotionJSX(BracketSVG, {
171
- width: "15",
172
- height: "80"
173
- })), ___EmotionJSX(Box, {
137
+ }, ___EmotionJSX(Bracket, {
138
+ isLast: true
139
+ }), ___EmotionJSX(Box, {
174
140
  variant: "forms.input.container",
175
141
  borderRadius: "4px",
176
142
  p: "sm",
@@ -187,18 +153,14 @@ export var Default = function Default() {
187
153
  alignSelf: "center"
188
154
  }), ___EmotionJSX(Text, null, " of the conditions are true")), ___EmotionJSX(Box, {
189
155
  ml: "sm"
190
- }, _mapInstanceProperty(anyConditions).call(anyConditions, function (item) {
156
+ }, _mapInstanceProperty(anyConditions).call(anyConditions, function (item, index) {
191
157
  return ___EmotionJSX(Box, {
192
158
  isRow: true,
193
- mt: "md",
194
159
  key: item.key
195
- }, ___EmotionJSX(Box, {
196
- mt: "-25px",
197
- mr: "-3px"
198
- }, ___EmotionJSX(BracketSVG, {
199
- width: "15",
200
- height: "40"
201
- })), ___EmotionJSX(Box, {
160
+ }, ___EmotionJSX(Bracket, {
161
+ isLast: index === anyConditions.length - 1
162
+ }), ___EmotionJSX(Box, {
163
+ mt: "md",
202
164
  variant: "forms.input.container",
203
165
  bg: "white",
204
166
  isRow: true,
@@ -33,11 +33,11 @@ export var thumbContainer = {
33
33
  border: '1px solid',
34
34
  borderColor: 'neutral.80',
35
35
  borderRadius: 9999,
36
- '.is-selected &': {
36
+ 'label.is-selected &': {
37
37
  bg: 'active',
38
38
  borderColor: 'active'
39
39
  },
40
- '.is-focused &, &:focus': _objectSpread({}, defaultFocus)
40
+ 'label.is-focused &, &:focus': _objectSpread({}, defaultFocus)
41
41
  };
42
42
  export var thumb = {
43
43
  width: 20,
@@ -51,7 +51,7 @@ export var thumb = {
51
51
  transitionTimingFunction: 'ease-out',
52
52
  transitionDuration: '0.1s',
53
53
  transform: 'translateX(0)',
54
- '.is-selected &': {
54
+ 'label.is-selected &': {
55
55
  transform: 'translateX(20px)',
56
56
  borderColor: 'active'
57
57
  }
@@ -336,8 +336,14 @@ var floatLabelWrapper = {
336
336
  left: '3px',
337
337
  zIndex: 2
338
338
  };
339
+ var bracketBase = {
340
+ width: '15px',
341
+ pl: '5px',
342
+ position: 'relative'
343
+ };
339
344
  export default {
340
345
  base: base,
346
+ bracketBase: bracketBase,
341
347
  card: card,
342
348
  chip: chip,
343
349
  countChip: countChip,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "1.23.0-alpha.3",
3
+ "version": "1.24.0-alpha.0",
4
4
  "description": "PingUX themeable React component library",
5
5
  "author": "ux-development@pingidentity.com",
6
6
  "license": "Apache-2.0",