@pingux/astro 2.135.0 → 2.136.0-alpha.1

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.
@@ -91,7 +91,10 @@ var CopyText = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
91
91
  var content = mode === 'link' || mode === 'nonClickableContent' ? children : (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
92
92
  ref: contentRef
93
93
  }, (0, _reactAria.mergeProps)(focusProps, pressProps), {
94
- role: "presentation"
94
+ role: "presentation",
95
+ sx: {
96
+ cursor: 'pointer'
97
+ }
95
98
  }), children);
96
99
  var tooltip = isCopied ? 'Copied!' : tooltipText;
97
100
  var isTooltipOpen = isFocusVisible || isHovered || isCopied;
@@ -4,3 +4,4 @@ declare const _default: import("@storybook/types").ComponentAnnotations<import("
4
4
  export default _default;
5
5
  export declare const Default: StoryFn<ModalProps>;
6
6
  export declare const LargeContent: StoryFn<ModalProps>;
7
+ export declare const WithInputField: StoryFn<ModalProps>;
@@ -5,7 +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.LargeContent = exports.Default = void 0;
8
+ exports["default"] = exports.WithInputField = exports.LargeContent = exports.Default = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
  var _storybookAddonDesigns = require("storybook-addon-designs");
@@ -167,4 +167,57 @@ var LargeContent = function LargeContent(args) {
167
167
  }, "Cancel"))))
168
168
  );
169
169
  };
170
- exports.LargeContent = LargeContent;
170
+ exports.LargeContent = LargeContent;
171
+ var WithInputField = function WithInputField() {
172
+ var state = (0, _hooks.useModalState)();
173
+ return (0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.Button, {
174
+ onPress: state.open,
175
+ "aria-label": "Open modal"
176
+ }, "Open Modal"), state.isOpen && (0, _react2.jsx)(_index.Modal, {
177
+ isOpen: state.isOpen,
178
+ onClose: state.close
179
+ }, (0, _react2.jsx)(_index.Box, {
180
+ gap: "lg"
181
+ }, (0, _react2.jsx)(_index.Text, null, "Lorem ipsum dolor sit amet consectetur"), (0, _react2.jsx)(_index.SelectField, {
182
+ label: "Select an option"
183
+ }, (0, _react2.jsx)(_index.Item, null, "Red"), (0, _react2.jsx)(_index.Item, null, "Green"), (0, _react2.jsx)(_index.Item, null, "Blue")), (0, _react2.jsx)(_index.RadioGroupField, {
184
+ label: "Pick an option",
185
+ name: "options",
186
+ defaultValue: "option1"
187
+ }, (0, _react2.jsx)(_index.RadioField, {
188
+ label: "Option 1",
189
+ value: "option1",
190
+ "data-testid": "option1"
191
+ }), (0, _react2.jsx)(_index.RadioField, {
192
+ label: "Option 2",
193
+ value: "option2",
194
+ "data-testid": "option2"
195
+ }), (0, _react2.jsx)(_index.RadioField, {
196
+ label: "Option 3",
197
+ value: "option3",
198
+ "data-testid": "option3"
199
+ })), (0, _react2.jsx)(_index.Box, {
200
+ isRow: true,
201
+ variant: "modal.buttonsContainer"
202
+ }, (0, _react2.jsx)(_index.Button, {
203
+ variant: "primary",
204
+ onPress: state.close,
205
+ mr: "md",
206
+ "aria-label": "Continue"
207
+ }, "Continue"), (0, _react2.jsx)(_index.Button, {
208
+ variant: "link",
209
+ onPress: state.close,
210
+ "aria-label": "Cancel"
211
+ }, "Cancel")))));
212
+ };
213
+ exports.WithInputField = WithInputField;
214
+ WithInputField.parameters = {
215
+ a11y: {
216
+ config: {
217
+ rules: [{
218
+ id: 'aria-hidden-focus',
219
+ enabled: false
220
+ }]
221
+ }
222
+ }
223
+ };
@@ -12,6 +12,22 @@ var getComponent = function getComponent() {
12
12
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
13
13
  return (0, _testWrapper.render)((0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.Modal, props)));
14
14
  };
15
+ var getModalWithRadioFieldGroup = function getModalWithRadioFieldGroup() {
16
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17
+ return (0, _testWrapper.render)((0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.Modal, props, (0, _react2.jsx)(_index.RadioGroupField, {
18
+ label: "Options",
19
+ name: "options",
20
+ defaultValue: "option1"
21
+ }, (0, _react2.jsx)(_index.RadioField, {
22
+ label: "Option 1",
23
+ value: "option1",
24
+ "data-testid": "option1"
25
+ }), (0, _react2.jsx)(_index.RadioField, {
26
+ label: "Option 2",
27
+ value: "option2",
28
+ "data-testid": "option2"
29
+ })))));
30
+ };
15
31
 
16
32
  // **********
17
33
  // Unit tests
@@ -220,4 +236,20 @@ test('should render sizes correctly with passed size prop', function () {
220
236
  });
221
237
  var fModal = _testWrapper.screen.getByRole('dialog');
222
238
  expect(fModal).toHaveClass('is-full');
239
+ });
240
+ test('should not show focus ring (is-focused class) on radio buttons when clicked with mouse', function () {
241
+ getModalWithRadioFieldGroup();
242
+ var radioA = _testWrapper.screen.getByLabelText('Option 1');
243
+ var radioB = _testWrapper.screen.getByLabelText('Option 2');
244
+ var labelA = _testWrapper.screen.getByText('Option 1');
245
+ var labelB = _testWrapper.screen.getByText('Option 2');
246
+ _userEvent["default"].click(radioA);
247
+ expect(radioA).toBeChecked();
248
+ expect(labelA).toHaveClass('is-checked');
249
+ expect(labelA).not.toHaveClass('is-focused');
250
+ expect(labelB).not.toHaveClass('is-focused');
251
+ _userEvent["default"].click(radioB);
252
+ expect(radioB).toBeChecked();
253
+ expect(labelA).not.toHaveClass('is-focused');
254
+ expect(labelB).not.toHaveClass('is-focused');
223
255
  });
@@ -19,6 +19,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/e
19
19
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
20
20
  var _react = _interopRequireWildcard(require("react"));
21
21
  var _reactAria = require("react-aria");
22
+ var _interactions = require("@react-aria/interactions");
22
23
  var _hooks = require("../../hooks");
23
24
  var _Box = _interopRequireDefault(require("../Box"));
24
25
  var _FieldHelperText = _interopRequireDefault(require("../FieldHelperText"));
@@ -73,11 +74,13 @@ var RadioField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
73
74
  fieldControlInputProps = _useField.fieldControlInputProps,
74
75
  fieldControlWrapperProps = _useField.fieldControlWrapperProps,
75
76
  fieldLabelProps = _useField.fieldLabelProps;
77
+ var _usePress = (0, _interactions.usePress)({}),
78
+ pressProps = _usePress.pressProps;
76
79
  return (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
77
80
  variant: "forms.radio.outerContainer"
78
81
  }, fieldContainerProps), (0, _react2.jsx)(_Label["default"], (0, _extends2["default"])({
79
82
  variant: "forms.label.radio"
80
- }, fieldLabelProps), (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({}, fieldControlWrapperProps, {
83
+ }, fieldLabelProps, pressProps), (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({}, fieldControlWrapperProps, {
81
84
  variant: "forms.radio.controlWrapper"
82
85
  }), (0, _react2.jsx)(_Radio["default"], (0, _extends2["default"])({
83
86
  ref: radioFieldRef
@@ -120,9 +120,25 @@ export declare const radio: {
120
120
  color: string;
121
121
  mr: string;
122
122
  'input ~ &.is-focused': {
123
+ boxShadow: string;
124
+ border: string;
125
+ borderColor: string;
126
+ boxSizing: string;
127
+ transform: string;
128
+ transformOrigin: string;
129
+ outline?: undefined;
130
+ outlineColor?: undefined;
131
+ outlineOffset?: undefined;
132
+ } | {
123
133
  outline: string;
124
134
  outlineColor: string;
125
135
  outlineOffset: string;
136
+ boxShadow?: undefined;
137
+ border?: undefined;
138
+ borderColor?: undefined;
139
+ boxSizing?: undefined;
140
+ transform?: undefined;
141
+ transformOrigin?: undefined;
126
142
  };
127
143
  };
128
144
  };
@@ -176,9 +192,25 @@ declare const _default: {
176
192
  color: string;
177
193
  mr: string;
178
194
  'input ~ &.is-focused': {
195
+ boxShadow: string;
196
+ border: string;
197
+ borderColor: string;
198
+ boxSizing: string;
199
+ transform: string;
200
+ transformOrigin: string;
201
+ outline?: undefined;
202
+ outlineColor?: undefined;
203
+ outlineOffset?: undefined;
204
+ } | {
179
205
  outline: string;
180
206
  outlineColor: string;
181
207
  outlineOffset: string;
208
+ boxShadow?: undefined;
209
+ border?: undefined;
210
+ borderColor?: undefined;
211
+ boxSizing?: undefined;
212
+ transform?: undefined;
213
+ transformOrigin?: undefined;
182
214
  };
183
215
  };
184
216
  };
@@ -14,6 +14,7 @@ _Object$defineProperty(exports, "__esModule", {
14
14
  });
15
15
  exports.select = exports.search = exports.radio = exports.numberField = exports["default"] = exports.comboBox = exports.checkbox = void 0;
16
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
17
+ var _safariAgent = require("../../safariAgent.js");
17
18
  var _colors = _interopRequireDefault(require("./colors/colors"));
18
19
  var _tShirtSizes = _interopRequireDefault(require("./customProperties/tShirtSizes"));
19
20
  var _input = require("./variants/input");
@@ -83,10 +84,19 @@ var radio = {
83
84
  base: {
84
85
  color: 'text.secondary',
85
86
  mr: '8px',
86
- 'input ~ &.is-focused': {
87
+ 'input ~ &.is-focused': /* istanbul ignore next */
88
+ _safariAgent.isSafari ? {
89
+ boxShadow: 'none',
90
+ border: '1px solid',
91
+ borderColor: 'focus',
92
+ boxSizing: 'border-box',
93
+ transform: 'scale(1.1)',
94
+ transformOrigin: 'center'
95
+ }
96
+ /* istanbul ignore next */ : {
87
97
  outline: '1px solid',
88
- outlineColor: '#1a73e8',
89
- outlineOffset: '-3px'
98
+ outlineColor: 'focus',
99
+ outlineOffset: '1px'
90
100
  }
91
101
  }
92
102
  };
@@ -1568,9 +1568,25 @@ declare const _default: {
1568
1568
  color: string;
1569
1569
  mr: string;
1570
1570
  'input ~ &.is-focused': {
1571
+ boxShadow: string;
1572
+ border: string;
1573
+ borderColor: string;
1574
+ boxSizing: string;
1575
+ transform: string;
1576
+ transformOrigin: string;
1577
+ outline?: undefined;
1578
+ outlineColor?: undefined;
1579
+ outlineOffset?: undefined;
1580
+ } | {
1571
1581
  outline: string;
1572
1582
  outlineColor: string;
1573
1583
  outlineOffset: string;
1584
+ boxShadow?: undefined;
1585
+ border?: undefined;
1586
+ borderColor?: undefined;
1587
+ boxSizing?: undefined;
1588
+ transform?: undefined;
1589
+ transformOrigin?: undefined;
1574
1590
  };
1575
1591
  };
1576
1592
  };
@@ -78,7 +78,10 @@ var CopyText = /*#__PURE__*/forwardRef(function (props, ref) {
78
78
  var content = mode === 'link' || mode === 'nonClickableContent' ? children : ___EmotionJSX(Box, _extends({
79
79
  ref: contentRef
80
80
  }, mergeProps(focusProps, pressProps), {
81
- role: "presentation"
81
+ role: "presentation",
82
+ sx: {
83
+ cursor: 'pointer'
84
+ }
82
85
  }), children);
83
86
  var tooltip = isCopied ? 'Copied!' : tooltipText;
84
87
  var isTooltipOpen = isFocusVisible || isHovered || isCopied;
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import { withDesign } from 'storybook-addon-designs';
4
4
  import DocsLayout from '../../../.storybook/storybookDocsLayout';
5
5
  import { useModalState } from '../../hooks';
6
- import { Box, Button, Modal, OverlayProvider, Text } from '../../index';
6
+ import { Box, Button, Item, Modal, OverlayProvider, RadioField, RadioGroupField, SelectField, Text } from '../../index';
7
7
  import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks';
8
8
  import { modalSizes } from '../../utils/devUtils/constants/modalSizes';
9
9
  import ModalReadme from './Modal.mdx';
@@ -156,4 +156,56 @@ export var LargeContent = function LargeContent(args) {
156
156
  "aria-label": "Cancel"
157
157
  }, "Cancel"))))
158
158
  );
159
+ };
160
+ export var WithInputField = function WithInputField() {
161
+ var state = useModalState();
162
+ return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(Button, {
163
+ onPress: state.open,
164
+ "aria-label": "Open modal"
165
+ }, "Open Modal"), state.isOpen && ___EmotionJSX(Modal, {
166
+ isOpen: state.isOpen,
167
+ onClose: state.close
168
+ }, ___EmotionJSX(Box, {
169
+ gap: "lg"
170
+ }, ___EmotionJSX(Text, null, "Lorem ipsum dolor sit amet consectetur"), ___EmotionJSX(SelectField, {
171
+ label: "Select an option"
172
+ }, ___EmotionJSX(Item, null, "Red"), ___EmotionJSX(Item, null, "Green"), ___EmotionJSX(Item, null, "Blue")), ___EmotionJSX(RadioGroupField, {
173
+ label: "Pick an option",
174
+ name: "options",
175
+ defaultValue: "option1"
176
+ }, ___EmotionJSX(RadioField, {
177
+ label: "Option 1",
178
+ value: "option1",
179
+ "data-testid": "option1"
180
+ }), ___EmotionJSX(RadioField, {
181
+ label: "Option 2",
182
+ value: "option2",
183
+ "data-testid": "option2"
184
+ }), ___EmotionJSX(RadioField, {
185
+ label: "Option 3",
186
+ value: "option3",
187
+ "data-testid": "option3"
188
+ })), ___EmotionJSX(Box, {
189
+ isRow: true,
190
+ variant: "modal.buttonsContainer"
191
+ }, ___EmotionJSX(Button, {
192
+ variant: "primary",
193
+ onPress: state.close,
194
+ mr: "md",
195
+ "aria-label": "Continue"
196
+ }, "Continue"), ___EmotionJSX(Button, {
197
+ variant: "link",
198
+ onPress: state.close,
199
+ "aria-label": "Cancel"
200
+ }, "Cancel")))));
201
+ };
202
+ WithInputField.parameters = {
203
+ a11y: {
204
+ config: {
205
+ rules: [{
206
+ id: 'aria-hidden-focus',
207
+ enabled: false
208
+ }]
209
+ }
210
+ }
159
211
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import userEvent from '@testing-library/user-event';
3
- import { Modal, OverlayProvider } from '../../../index';
3
+ import { Modal, OverlayProvider, RadioField, RadioGroupField } from '../../../index';
4
4
  import { render, screen } from '../../../utils/testUtils/testWrapper';
5
5
  import { universalComponentTests } from '../../../utils/testUtils/universalComponentTest';
6
6
 
@@ -10,6 +10,22 @@ var getComponent = function getComponent() {
10
10
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
11
11
  return render(___EmotionJSX(OverlayProvider, null, ___EmotionJSX(Modal, props)));
12
12
  };
13
+ var getModalWithRadioFieldGroup = function getModalWithRadioFieldGroup() {
14
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
15
+ return render(___EmotionJSX(OverlayProvider, null, ___EmotionJSX(Modal, props, ___EmotionJSX(RadioGroupField, {
16
+ label: "Options",
17
+ name: "options",
18
+ defaultValue: "option1"
19
+ }, ___EmotionJSX(RadioField, {
20
+ label: "Option 1",
21
+ value: "option1",
22
+ "data-testid": "option1"
23
+ }), ___EmotionJSX(RadioField, {
24
+ label: "Option 2",
25
+ value: "option2",
26
+ "data-testid": "option2"
27
+ })))));
28
+ };
13
29
 
14
30
  // **********
15
31
  // Unit tests
@@ -218,4 +234,20 @@ test('should render sizes correctly with passed size prop', function () {
218
234
  });
219
235
  var fModal = screen.getByRole('dialog');
220
236
  expect(fModal).toHaveClass('is-full');
237
+ });
238
+ test('should not show focus ring (is-focused class) on radio buttons when clicked with mouse', function () {
239
+ getModalWithRadioFieldGroup();
240
+ var radioA = screen.getByLabelText('Option 1');
241
+ var radioB = screen.getByLabelText('Option 2');
242
+ var labelA = screen.getByText('Option 1');
243
+ var labelB = screen.getByText('Option 2');
244
+ userEvent.click(radioA);
245
+ expect(radioA).toBeChecked();
246
+ expect(labelA).toHaveClass('is-checked');
247
+ expect(labelA).not.toHaveClass('is-focused');
248
+ expect(labelB).not.toHaveClass('is-focused');
249
+ userEvent.click(radioB);
250
+ expect(radioB).toBeChecked();
251
+ expect(labelA).not.toHaveClass('is-focused');
252
+ expect(labelB).not.toHaveClass('is-focused');
221
253
  });
@@ -12,6 +12,7 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
12
12
  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; }
13
13
  import React, { createContext, forwardRef, useContext } from 'react';
14
14
  import { useRadio } from 'react-aria';
15
+ import { usePress } from '@react-aria/interactions';
15
16
  import { useField, useLocalOrForwardRef, usePropWarning } from '../../hooks';
16
17
  import Box from '../Box';
17
18
  import FieldHelperText from '../FieldHelperText';
@@ -61,11 +62,13 @@ var RadioField = /*#__PURE__*/forwardRef(function (props, ref) {
61
62
  fieldControlInputProps = _useField.fieldControlInputProps,
62
63
  fieldControlWrapperProps = _useField.fieldControlWrapperProps,
63
64
  fieldLabelProps = _useField.fieldLabelProps;
65
+ var _usePress = usePress({}),
66
+ pressProps = _usePress.pressProps;
64
67
  return ___EmotionJSX(Box, _extends({
65
68
  variant: "forms.radio.outerContainer"
66
69
  }, fieldContainerProps), ___EmotionJSX(Label, _extends({
67
70
  variant: "forms.label.radio"
68
- }, fieldLabelProps), ___EmotionJSX(Box, _extends({}, fieldControlWrapperProps, {
71
+ }, fieldLabelProps, pressProps), ___EmotionJSX(Box, _extends({}, fieldControlWrapperProps, {
69
72
  variant: "forms.radio.controlWrapper"
70
73
  }), ___EmotionJSX(Radio, _extends({
71
74
  ref: radioFieldRef
@@ -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 { isSafari } from '../../safariAgent.js';
12
13
  import colors from './colors/colors';
13
14
  import tShirtSizes from './customProperties/tShirtSizes';
14
15
  import { fieldControlWrapper, input } from './variants/input';
@@ -71,10 +72,19 @@ export var radio = {
71
72
  base: {
72
73
  color: 'text.secondary',
73
74
  mr: '8px',
74
- 'input ~ &.is-focused': {
75
+ 'input ~ &.is-focused': /* istanbul ignore next */
76
+ isSafari ? {
77
+ boxShadow: 'none',
78
+ border: '1px solid',
79
+ borderColor: 'focus',
80
+ boxSizing: 'border-box',
81
+ transform: 'scale(1.1)',
82
+ transformOrigin: 'center'
83
+ }
84
+ /* istanbul ignore next */ : {
75
85
  outline: '1px solid',
76
- outlineColor: '#1a73e8',
77
- outlineOffset: '-3px'
86
+ outlineColor: 'focus',
87
+ outlineOffset: '1px'
78
88
  }
79
89
  }
80
90
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.135.0",
3
+ "version": "2.136.0-alpha.1",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",