@pingux/astro 1.10.0-alpha.3 → 1.10.1-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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.10.0](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.9.0...@pingux/astro@1.10.0) (2022-04-28)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * [UIP-5300] Multiple inputs not focusable within AccordionGridGroup ([421f210](https://gitlab.corp.pingidentity.com/ux/pingux/commit/421f21046e0638c44ecb34085bd64af681301b3c))
12
+ * [UIP-5408] float label Tweaks ([eaa79fd](https://gitlab.corp.pingidentity.com/ux/pingux/commit/eaa79fd1da40eed988759a0d0e4c626d1c338dc2))
13
+
14
+
15
+ ### Features
16
+
17
+ * [UIP-5334] add container widths to box ([5b672d2](https://gitlab.corp.pingidentity.com/ux/pingux/commit/5b672d2b3198e637ee7b0947a221e8ae3cdb60f3))
18
+ * [UIP-5397] ArrayField Component - Allow a limit on the number of Fields ([61dcdcd](https://gitlab.corp.pingidentity.com/ux/pingux/commit/61dcdcd929c540e8353996755889a320202ad003))
19
+ * [UIP-5401] Add initial Slider recipe ([1fba9ae](https://gitlab.corp.pingidentity.com/ux/pingux/commit/1fba9ae445f77359bf9db716864b7755e6d0c392))
20
+
21
+
22
+
23
+
24
+
6
25
  # [1.9.0](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.8.1...@pingux/astro@1.9.0) (2022-04-21)
7
26
 
8
27
 
@@ -121,6 +121,7 @@ var ComboBoxField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
121
121
  isNotFlippable = props.isNotFlippable,
122
122
  direction = props.direction,
123
123
  scrollBoxProps = props.scrollBoxProps,
124
+ controlProps = props.controlProps,
124
125
  defaultFilter = props.defaultFilter;
125
126
  var comboBoxOptions = {
126
127
  children: children,
@@ -238,6 +239,11 @@ var ComboBoxField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
238
239
  });
239
240
  (0, _utils.useLayoutEffect)(onResize, [onResize]);
240
241
 
242
+ var handleInputOpen = function handleInputOpen(e) {
243
+ if (!state.isOpen && menuTrigger === 'focus') buttonRef.current.click();
244
+ if (controlProps !== null && controlProps !== void 0 && controlProps.onClick) controlProps.onClick(e);
245
+ };
246
+
241
247
  var style = _objectSpread(_objectSpread({}, overlayProps.style), {}, {
242
248
  width: menuWidth,
243
249
  minWidth: menuWidth
@@ -266,7 +272,10 @@ var ComboBoxField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
266
272
  labelProps: labelProps,
267
273
  inputRef: inputRef,
268
274
  triggerProps: buttonProps,
269
- triggerRef: buttonRef
275
+ triggerRef: buttonRef,
276
+ controlProps: _objectSpread(_objectSpread({}, controlProps), {}, {
277
+ onClick: handleInputOpen
278
+ })
270
279
  })), (0, _react2.jsx)(_PopoverContainer["default"], {
271
280
  isOpen: state.isOpen,
272
281
  ref: popoverRef,
@@ -414,6 +423,11 @@ ComboBoxField.propTypes = {
414
423
  /** @ignore */
415
424
  scrollBoxProps: _propTypes["default"].shape({
416
425
  maxHeight: _propTypes["default"].string
426
+ }),
427
+
428
+ /** Props object that is spread directly into the ComboBoxInput element. */
429
+ controlProps: _propTypes["default"].shape({
430
+ onClick: _propTypes["default"].func
417
431
  })
418
432
  };
419
433
  ComboBoxField.defaultProps = {
@@ -300,6 +300,28 @@ test('should open list on focus when menuTrigger is set to use focus', function
300
300
  expect(_testWrapper.screen.queryByRole('listbox')).toBeInTheDocument();
301
301
  expect(_testWrapper.screen.queryAllByRole('option')).toHaveLength(items.length);
302
302
  });
303
+ test('should open list on focus on click after selection when menuTrigger is set to use focus', function () {
304
+ getComponent({
305
+ menuTrigger: 'focus'
306
+ });
307
+
308
+ var input = _testWrapper.screen.getByRole('combobox');
309
+
310
+ expect(_testWrapper.screen.queryByRole('listbox')).not.toBeInTheDocument();
311
+
312
+ _userEvent["default"].click(input);
313
+
314
+ expect(_testWrapper.screen.queryByRole('listbox')).toBeInTheDocument();
315
+
316
+ _userEvent["default"].click(_testWrapper.screen.queryAllByRole('option')[0]);
317
+
318
+ expect(_testWrapper.screen.queryByRole('listbox')).not.toBeInTheDocument();
319
+ expect(input).toHaveFocus();
320
+
321
+ _userEvent["default"].click(input);
322
+
323
+ expect(_testWrapper.screen.queryByRole('listbox')).toBeInTheDocument();
324
+ });
303
325
  test('Item accepts a data-id and the data-id can be found in the DOM', function () {
304
326
  getComponent();
305
327
 
@@ -175,7 +175,7 @@ test('select field with helper text', function () {
175
175
  expect(fieldHelperText).toBeInTheDocument();
176
176
  expect(fieldHelperText).toHaveClass("is-".concat(_statuses["default"].ERROR));
177
177
  });
178
- test('label floats after user\'s interacting', function () {
178
+ test("label floats after user's interacting", function () {
179
179
  getComponent({
180
180
  labelMode: _constants.modes.FLOAT,
181
181
  value: ''
@@ -187,7 +187,7 @@ test('label floats after user\'s interacting', function () {
187
187
 
188
188
  _userEvent["default"].tab();
189
189
 
190
- expect(textAreaContainer).toHaveClass('is-float-label-active');
190
+ expect(textAreaContainer).toHaveClass('is-float-label');
191
191
  });
192
192
  test('clicking on the visible button opens the popuplist', function () {
193
193
  getComponent();
@@ -190,7 +190,7 @@ var useField = function useField() {
190
190
 
191
191
  var isFloatLabel = labelMode === _constants.modes.FLOAT || (labelProps === null || labelProps === void 0 ? void 0 : labelProps.labelMode) === _constants.modes.FLOAT;
192
192
  var isLeftLabel = labelMode === _constants.modes.LEFT || (labelProps === null || labelProps === void 0 ? void 0 : labelProps.labelMode) === _constants.modes.LEFT;
193
- var isFloatLabelActive = isFloatLabel && (hasValue || hasFocusWithin || (containerProps === null || containerProps === void 0 ? void 0 : containerProps.isFloatLabelActive));
193
+ var isFloatLabelActive = isFloatLabel && (hasValue || (containerProps === null || containerProps === void 0 ? void 0 : containerProps.isFloatLabelActive));
194
194
 
195
195
  var _useStatusClasses2 = (0, _hooks.useStatusClasses)(containerProps === null || containerProps === void 0 ? void 0 : containerProps.className, {
196
196
  'field-container': true,
@@ -165,7 +165,7 @@ test('should return isFloatLabelActive class for container', function () {
165
165
  (0, _reactHooks.act)(function () {
166
166
  return result.current.fieldContainerProps.onFocus({});
167
167
  });
168
- expect(result.current.fieldContainerProps.className).toContain('is-float-label-active'); // Does not have the class if the container loses focus within it
168
+ expect(result.current.fieldContainerProps.className).toContain('is-float-label'); // Does not have the class if the container loses focus within it
169
169
 
170
170
  (0, _reactHooks.act)(function () {
171
171
  return result.current.fieldContainerProps.onBlur({
@@ -54,7 +54,7 @@ var label = _objectSpread(_objectSpread({}, _text.text.label), {}, {
54
54
  left: 'md',
55
55
  mb: 0,
56
56
  transformOrigin: 'top left',
57
- transition: 'all 0.2s ease-out',
57
+ transition: 'all 0.1s ease-out',
58
58
  pointerEvents: 'none',
59
59
  paddingRight: '25px',
60
60
  paddingLeft: '1px' // Otherwise, certain characters get cut off on the left from the overflow
@@ -75,6 +75,7 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
75
75
  isNotFlippable = props.isNotFlippable,
76
76
  direction = props.direction,
77
77
  scrollBoxProps = props.scrollBoxProps,
78
+ controlProps = props.controlProps,
78
79
  defaultFilter = props.defaultFilter;
79
80
  var comboBoxOptions = {
80
81
  children: children,
@@ -192,6 +193,11 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
192
193
  });
193
194
  useLayoutEffect(onResize, [onResize]);
194
195
 
196
+ var handleInputOpen = function handleInputOpen(e) {
197
+ if (!state.isOpen && menuTrigger === 'focus') buttonRef.current.click();
198
+ if (controlProps !== null && controlProps !== void 0 && controlProps.onClick) controlProps.onClick(e);
199
+ };
200
+
195
201
  var style = _objectSpread(_objectSpread({}, overlayProps.style), {}, {
196
202
  width: menuWidth,
197
203
  minWidth: menuWidth
@@ -221,7 +227,10 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
221
227
  labelProps: labelProps,
222
228
  inputRef: inputRef,
223
229
  triggerProps: buttonProps,
224
- triggerRef: buttonRef
230
+ triggerRef: buttonRef,
231
+ controlProps: _objectSpread(_objectSpread({}, controlProps), {}, {
232
+ onClick: handleInputOpen
233
+ })
225
234
  })), ___EmotionJSX(PopoverContainer, {
226
235
  isOpen: state.isOpen,
227
236
  ref: popoverRef,
@@ -369,6 +378,11 @@ ComboBoxField.propTypes = {
369
378
  /** @ignore */
370
379
  scrollBoxProps: PropTypes.shape({
371
380
  maxHeight: PropTypes.string
381
+ }),
382
+
383
+ /** Props object that is spread directly into the ComboBoxInput element. */
384
+ controlProps: PropTypes.shape({
385
+ onClick: PropTypes.func
372
386
  })
373
387
  };
374
388
  ComboBoxField.defaultProps = {
@@ -227,6 +227,20 @@ test('should open list on focus when menuTrigger is set to use focus', function
227
227
  expect(screen.queryByRole('listbox')).toBeInTheDocument();
228
228
  expect(screen.queryAllByRole('option')).toHaveLength(items.length);
229
229
  });
230
+ test('should open list on focus on click after selection when menuTrigger is set to use focus', function () {
231
+ getComponent({
232
+ menuTrigger: 'focus'
233
+ });
234
+ var input = screen.getByRole('combobox');
235
+ expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
236
+ userEvent.click(input);
237
+ expect(screen.queryByRole('listbox')).toBeInTheDocument();
238
+ userEvent.click(screen.queryAllByRole('option')[0]);
239
+ expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
240
+ expect(input).toHaveFocus();
241
+ userEvent.click(input);
242
+ expect(screen.queryByRole('listbox')).toBeInTheDocument();
243
+ });
230
244
  test('Item accepts a data-id and the data-id can be found in the DOM', function () {
231
245
  getComponent();
232
246
  var button = screen.queryByRole('button');
@@ -136,7 +136,7 @@ test('select field with helper text', function () {
136
136
  expect(fieldHelperText).toBeInTheDocument();
137
137
  expect(fieldHelperText).toHaveClass("is-".concat(statuses.ERROR));
138
138
  });
139
- test('label floats after user\'s interacting', function () {
139
+ test("label floats after user's interacting", function () {
140
140
  getComponent({
141
141
  labelMode: modes.FLOAT,
142
142
  value: ''
@@ -144,7 +144,7 @@ test('label floats after user\'s interacting', function () {
144
144
  var textAreaContainer = screen.getByTestId(testId);
145
145
  expect(textAreaContainer).not.toHaveClass('is-float-label-active');
146
146
  userEvent.tab();
147
- expect(textAreaContainer).toHaveClass('is-float-label-active');
147
+ expect(textAreaContainer).toHaveClass('is-float-label');
148
148
  });
149
149
  test('clicking on the visible button opens the popuplist', function () {
150
150
  getComponent();
@@ -159,7 +159,7 @@ var useField = function useField() {
159
159
 
160
160
  var isFloatLabel = labelMode === labelModes.FLOAT || (labelProps === null || labelProps === void 0 ? void 0 : labelProps.labelMode) === labelModes.FLOAT;
161
161
  var isLeftLabel = labelMode === labelModes.LEFT || (labelProps === null || labelProps === void 0 ? void 0 : labelProps.labelMode) === labelModes.LEFT;
162
- var isFloatLabelActive = isFloatLabel && (hasValue || hasFocusWithin || (containerProps === null || containerProps === void 0 ? void 0 : containerProps.isFloatLabelActive));
162
+ var isFloatLabelActive = isFloatLabel && (hasValue || (containerProps === null || containerProps === void 0 ? void 0 : containerProps.isFloatLabelActive));
163
163
 
164
164
  var _useStatusClasses2 = useStatusClasses(containerProps === null || containerProps === void 0 ? void 0 : containerProps.className, {
165
165
  'field-container': true,
@@ -148,7 +148,7 @@ test('should return isFloatLabelActive class for container', function () {
148
148
  act(function () {
149
149
  return result.current.fieldContainerProps.onFocus({});
150
150
  });
151
- expect(result.current.fieldContainerProps.className).toContain('is-float-label-active'); // Does not have the class if the container loses focus within it
151
+ expect(result.current.fieldContainerProps.className).toContain('is-float-label'); // Does not have the class if the container loses focus within it
152
152
 
153
153
  act(function () {
154
154
  return result.current.fieldContainerProps.onBlur({
@@ -36,7 +36,7 @@ export var label = _objectSpread(_objectSpread({}, text.label), {}, {
36
36
  left: 'md',
37
37
  mb: 0,
38
38
  transformOrigin: 'top left',
39
- transition: 'all 0.2s ease-out',
39
+ transition: 'all 0.1s ease-out',
40
40
  pointerEvents: 'none',
41
41
  paddingRight: '25px',
42
42
  paddingLeft: '1px' // Otherwise, certain characters get cut off on the left from the overflow
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "1.10.0-alpha.3",
3
+ "version": "1.10.1-alpha.0",
4
4
  "description": "PingUX themeable React component library",
5
5
  "author": "ux-development@pingidentity.com",
6
6
  "license": "Apache-2.0",