@pingux/astro 2.0.0-beta.1 → 2.0.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # `@pingux/astro`
2
2
 
3
- Astro is a lightweight, composable, and themeable React component library. Astro was created to help developers and designers create consistent, user friendly, and accessible UIs across all Ping products. Please visit https://pingidentity.design for more information and to read individual component documentation.
3
+ Astro is a lightweight, composable, and themeable React component library. Astro was created to help developers and designers create consistent, user friendly, and accessible UIs across all Ping products. Please visit https://pingidentity.design for more information. To read individual component documentation, [our Storybook docs site](https://storybook.pingidentity.design) is a great resource.
4
4
 
5
5
  ## Installing
6
6
 
@@ -21,8 +21,8 @@ Yarn:
21
21
 
22
22
  All apps should be wrapped in an `<AstroWrapper>` for full functionality and styling.
23
23
 
24
- ```
25
- import { AstroWrapper } from ‘@pingux/astro’;
24
+ ```js
25
+ import { AstroWrapper } from '@pingux/astro';
26
26
 
27
27
  <AstroWrapper>
28
28
  <App />
@@ -37,9 +37,9 @@ Astro uses [Storybook](https://storybook.js.org/) for component documentation. O
37
37
 
38
38
  The Storybook server defaults to `https://localhost:6006`. This port can be customized by running the command start -p 9009. For example, this will start Storybook on port 9009. More information on customizing Storybook CLI options can be found at https://storybook.js.org/docs/react/api/cli-options.
39
39
 
40
- Component prop documentation is available under the documentation tab per each component story. Most props can be toggled and configured for preview purposes within the prop table.
40
+ Component prop documentation is available under the "documentation" tab per each component story. Most props can be toggled and configured for preview purposes within the prop table.
41
41
 
42
- For example, to view the disabled button styling, navigate to the Button story’s props table, locate the isDisabled prop, and toggle to true”. This change allows you to preview the disabled button’s styling and functionality.
42
+ For example, to view the disabled button styling, navigate to the Button story’s props table, locate the "isDisabled" prop, and toggle to "true". This change allows you to preview the disabled button’s styling and functionality.
43
43
 
44
44
  ## Yarn
45
45
  We use a modern version of [Yarn](https://yarnpkg.com/getting-started) for package management with the [Plug'n'Play](https://yarnpkg.com/features/pnp) feature enabled. This allows for a [Zero Install](https://yarnpkg.com/features/zero-installs) approach to be used.
package/lib/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # `@pingux/astro`
2
2
 
3
- Astro is a lightweight, composable, and themeable React component library. Astro was created to help developers and designers create consistent, user friendly, and accessible UIs across all Ping products. Please visit https://pingidentity.design for more information and to read individual component documentation.
3
+ Astro is a lightweight, composable, and themeable React component library. Astro was created to help developers and designers create consistent, user friendly, and accessible UIs across all Ping products. Please visit https://pingidentity.design for more information. To read individual component documentation, [our Storybook docs site](https://storybook.pingidentity.design) is a great resource.
4
4
 
5
5
  ## Installing
6
6
 
@@ -21,8 +21,8 @@ Yarn:
21
21
 
22
22
  All apps should be wrapped in an `<AstroWrapper>` for full functionality and styling.
23
23
 
24
- ```
25
- import { AstroWrapper } from ‘@pingux/astro’;
24
+ ```js
25
+ import { AstroWrapper } from '@pingux/astro';
26
26
 
27
27
  <AstroWrapper>
28
28
  <App />
@@ -37,9 +37,9 @@ Astro uses [Storybook](https://storybook.js.org/) for component documentation. O
37
37
 
38
38
  The Storybook server defaults to `https://localhost:6006`. This port can be customized by running the command start -p 9009. For example, this will start Storybook on port 9009. More information on customizing Storybook CLI options can be found at https://storybook.js.org/docs/react/api/cli-options.
39
39
 
40
- Component prop documentation is available under the documentation tab per each component story. Most props can be toggled and configured for preview purposes within the prop table.
40
+ Component prop documentation is available under the "documentation" tab per each component story. Most props can be toggled and configured for preview purposes within the prop table.
41
41
 
42
- For example, to view the disabled button styling, navigate to the Button story’s props table, locate the isDisabled prop, and toggle to true”. This change allows you to preview the disabled button’s styling and functionality.
42
+ For example, to view the disabled button styling, navigate to the Button story’s props table, locate the "isDisabled" prop, and toggle to "true". This change allows you to preview the disabled button’s styling and functionality.
43
43
 
44
44
  ## Yarn
45
45
  We use a modern version of [Yarn](https://yarnpkg.com/getting-started) for package management with the [Plug'n'Play](https://yarnpkg.com/features/pnp) feature enabled. This allows for a [Zero Install](https://yarnpkg.com/features/zero-installs) approach to be used.
@@ -32,8 +32,7 @@ var TooltipWrapper = function TooltipWrapper(_ref) {
32
32
  others = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
33
33
  return (0, _react2.jsx)(_index.TooltipTrigger, (0, _extends2["default"])({
34
34
  key: tooltip,
35
- direction: "top",
36
- isNotFlippable: true
35
+ direction: "top"
37
36
  }, others), children, (0, _react2.jsx)(_index.Tooltip, null, tooltip));
38
37
  };
39
38
  TooltipWrapper.propTypes = {
@@ -15,6 +15,11 @@ var _react2 = require("@emotion/react");
15
15
  var _default = {
16
16
  title: 'Components/CopyText',
17
17
  component: _index.CopyText,
18
+ decorators: [function (Story) {
19
+ return (0, _react2.jsx)(_index.Box, {
20
+ pt: "10px"
21
+ }, (0, _react2.jsx)(Story, null));
22
+ }],
18
23
  parameters: {
19
24
  docs: {
20
25
  page: function page() {
@@ -18,6 +18,7 @@ exports["default"] = void 0;
18
18
  var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
19
19
  var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
20
20
  var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/from"));
21
+ var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim"));
21
22
  var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
22
23
  var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
23
24
  var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
@@ -202,7 +203,10 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
202
203
  }, [isOpen]);
203
204
  var addNewBadgeFromInput = function addNewBadgeFromInput(inputValue) {
204
205
  var _context3, _context4;
205
- var key = inputValue;
206
+ var key = (0, _trim["default"])(inputValue).call(inputValue);
207
+ if (key === '') {
208
+ return;
209
+ }
206
210
  if (state.selectionManager.isSelected(key)) {
207
211
  return;
208
212
  }
@@ -582,4 +582,28 @@ test('form does not submit when adding custom value', function () {
582
582
  expect(input).toHaveValue('');
583
583
  _userEvent["default"].type(input, '{enter}');
584
584
  expect(onFormSubmit).not.toHaveBeenCalled();
585
+ });
586
+ test('in non-restrictive mode the value should be trimmed', function () {
587
+ getComponent({
588
+ mode: 'non-restrictive'
589
+ });
590
+ var input = _testWrapper.screen.getByRole('combobox');
591
+ expect(input).toHaveValue('');
592
+ var value = 'test ';
593
+ var trimmedValue = 'test';
594
+ _userEvent["default"].type(input, value);
595
+ _userEvent["default"].type(input, '{enter}');
596
+ var badge = _testWrapper.screen.queryByText(value, {
597
+ normalizer: (0, _testWrapper.getDefaultNormalizer)({
598
+ trim: false
599
+ })
600
+ });
601
+ var trimmedBadge = _testWrapper.screen.queryByText(trimmedValue, {
602
+ normalizer: (0, _testWrapper.getDefaultNormalizer)({
603
+ trim: false
604
+ })
605
+ });
606
+ expect(badge).not.toBeInTheDocument();
607
+ expect(trimmedBadge).toBeInTheDocument();
608
+ expect(input).toHaveValue('');
585
609
  });
@@ -112,7 +112,7 @@ var NavBarPrimaryItemHeader = function NavBarPrimaryItemHeader(_ref) {
112
112
  },
113
113
  "aria-hidden": "true"
114
114
  }), (0, _react2.jsx)(_index.Text, {
115
- variant: "navBarHeaderText"
115
+ variant: "variants.navBar.headerText"
116
116
  }, heading), (0, _react2.jsx)(_index.Box, {
117
117
  isRow: true,
118
118
  alignItems: "center",
@@ -142,7 +142,7 @@ var SectionItem = function SectionItem(_ref2) {
142
142
  var PrimaryItem = function PrimaryItem(_ref3) {
143
143
  var item = _ref3.item;
144
144
  return (0, _react2.jsx)(_.Link, {
145
- variant: "buttons.navBarSectionButton",
145
+ variant: "variants.navBar.sectionButton",
146
146
  href: item.href,
147
147
  target: "_blank"
148
148
  }, (0, _react2.jsx)(_NavBarItemHeader["default"], {
@@ -130,10 +130,14 @@ var Required = function Required() {
130
130
  };
131
131
  exports.Required = Required;
132
132
  var WithTooltip = function WithTooltip() {
133
+ var tooltipTrigger = (0, _react.useRef)();
133
134
  return (0, _react2.jsx)(_index.TooltipTrigger, {
134
135
  crossOffset: 15,
135
- offset: 20
136
- }, (0, _react2.jsx)(_interactions.Pressable, null, (0, _react2.jsx)(_index.SwitchField, {
136
+ offset: 20,
137
+ targetRef: tooltipTrigger
138
+ }, (0, _react2.jsx)(_interactions.Pressable, {
139
+ ref: tooltipTrigger
140
+ }, (0, _react2.jsx)(_index.SwitchField, {
137
141
  "aria-label": "my-label",
138
142
  value: "my-switch"
139
143
  })), (0, _react2.jsx)(_index.Tooltip, null, "Tooltip Content"));
@@ -127,7 +127,7 @@ var Default = function Default(_ref) {
127
127
  var color = '#CACED3';
128
128
  return (0, _react2.jsx)(_index.Box, {
129
129
  sx: {
130
- width: '20px',
130
+ width: '15px',
131
131
  position: 'relative'
132
132
  }
133
133
  }, (0, _react2.jsx)(_index.Box, {
@@ -185,7 +185,7 @@ var Default = function Default(_ref) {
185
185
  position: 'absolute',
186
186
  bottom: 0,
187
187
  left: 12,
188
- top: 55
188
+ top: 50
189
189
  }
190
190
  }, (0, _react2.jsx)("svg", {
191
191
  xmlns: "http://www.w3.org/2000/svg",
@@ -19,8 +19,7 @@ var TooltipWrapper = function TooltipWrapper(_ref) {
19
19
  others = _objectWithoutProperties(_ref, _excluded);
20
20
  return ___EmotionJSX(TooltipTrigger, _extends({
21
21
  key: tooltip,
22
- direction: "top",
23
- isNotFlippable: true
22
+ direction: "top"
24
23
  }, others), children, ___EmotionJSX(Tooltip, null, tooltip));
25
24
  };
26
25
  TooltipWrapper.propTypes = {
@@ -1,12 +1,17 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
2
  import React from 'react';
3
3
  import DocsLayout from '../../../.storybook/storybookDocsLayout';
4
- import { CopyText, Link, Text } from '../../index';
4
+ import { Box, CopyText, Link, Text } from '../../index';
5
5
  import CopyTextReadme from './CopyText.mdx';
6
6
  import { jsx as ___EmotionJSX } from "@emotion/react";
7
7
  export default {
8
8
  title: 'Components/CopyText',
9
9
  component: CopyText,
10
+ decorators: [function (Story) {
11
+ return ___EmotionJSX(Box, {
12
+ pt: "10px"
13
+ }, ___EmotionJSX(Story, null));
14
+ }],
10
15
  parameters: {
11
16
  docs: {
12
17
  page: function page() {
@@ -15,6 +15,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
15
15
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
16
16
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
17
17
  import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
18
+ import _trimInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/trim";
18
19
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
19
20
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
20
21
  import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
@@ -191,7 +192,10 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
191
192
  }, [isOpen]);
192
193
  var addNewBadgeFromInput = function addNewBadgeFromInput(inputValue) {
193
194
  var _context3, _context4;
194
- var key = inputValue;
195
+ var key = _trimInstanceProperty(inputValue).call(inputValue);
196
+ if (key === '') {
197
+ return;
198
+ }
195
199
  if (state.selectionManager.isSelected(key)) {
196
200
  return;
197
201
  }
@@ -16,7 +16,7 @@ import userEvent from '@testing-library/user-event';
16
16
  import { axe } from 'jest-axe';
17
17
  import { Item, MultivaluesField, OverlayProvider } from '../../index';
18
18
  import statuses from '../../utils/devUtils/constants/statuses';
19
- import { render, screen, within } from '../../utils/testUtils/testWrapper';
19
+ import { getDefaultNormalizer, render, screen, within } from '../../utils/testUtils/testWrapper';
20
20
  import { jsx as ___EmotionJSX } from "@emotion/react";
21
21
  var items = [{
22
22
  id: 1,
@@ -579,4 +579,28 @@ test('form does not submit when adding custom value', function () {
579
579
  expect(input).toHaveValue('');
580
580
  userEvent.type(input, '{enter}');
581
581
  expect(onFormSubmit).not.toHaveBeenCalled();
582
+ });
583
+ test('in non-restrictive mode the value should be trimmed', function () {
584
+ getComponent({
585
+ mode: 'non-restrictive'
586
+ });
587
+ var input = screen.getByRole('combobox');
588
+ expect(input).toHaveValue('');
589
+ var value = 'test ';
590
+ var trimmedValue = 'test';
591
+ userEvent.type(input, value);
592
+ userEvent.type(input, '{enter}');
593
+ var badge = screen.queryByText(value, {
594
+ normalizer: getDefaultNormalizer({
595
+ trim: false
596
+ })
597
+ });
598
+ var trimmedBadge = screen.queryByText(trimmedValue, {
599
+ normalizer: getDefaultNormalizer({
600
+ trim: false
601
+ })
602
+ });
603
+ expect(badge).not.toBeInTheDocument();
604
+ expect(trimmedBadge).toBeInTheDocument();
605
+ expect(input).toHaveValue('');
582
606
  });
@@ -99,7 +99,7 @@ var NavBarPrimaryItemHeader = function NavBarPrimaryItemHeader(_ref) {
99
99
  },
100
100
  "aria-hidden": "true"
101
101
  }), ___EmotionJSX(Text, {
102
- variant: "navBarHeaderText"
102
+ variant: "variants.navBar.headerText"
103
103
  }, heading), ___EmotionJSX(Box, {
104
104
  isRow: true,
105
105
  alignItems: "center",
@@ -129,7 +129,7 @@ var SectionItem = function SectionItem(_ref2) {
129
129
  var PrimaryItem = function PrimaryItem(_ref3) {
130
130
  var item = _ref3.item;
131
131
  return ___EmotionJSX(Link, {
132
- variant: "buttons.navBarSectionButton",
132
+ variant: "variants.navBar.sectionButton",
133
133
  href: item.href,
134
134
  target: "_blank"
135
135
  }, ___EmotionJSX(NavBarItemHeader, {
@@ -10,7 +10,7 @@ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
10
10
  import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
11
11
  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; }
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
- import React, { useState } from 'react';
13
+ import React, { useRef, useState } from 'react';
14
14
  import { Pressable } from '@react-aria/interactions';
15
15
  import { SwitchField, Tooltip, TooltipTrigger } from '../../index';
16
16
  import statuses from '../../utils/devUtils/constants/statuses';
@@ -112,10 +112,14 @@ export var Required = function Required() {
112
112
  });
113
113
  };
114
114
  export var WithTooltip = function WithTooltip() {
115
+ var tooltipTrigger = useRef();
115
116
  return ___EmotionJSX(TooltipTrigger, {
116
117
  crossOffset: 15,
117
- offset: 20
118
- }, ___EmotionJSX(Pressable, null, ___EmotionJSX(SwitchField, {
118
+ offset: 20,
119
+ targetRef: tooltipTrigger
120
+ }, ___EmotionJSX(Pressable, {
121
+ ref: tooltipTrigger
122
+ }, ___EmotionJSX(SwitchField, {
119
123
  "aria-label": "my-label",
120
124
  value: "my-switch"
121
125
  })), ___EmotionJSX(Tooltip, null, "Tooltip Content"));
@@ -113,7 +113,7 @@ export var Default = function Default(_ref) {
113
113
  var color = '#CACED3';
114
114
  return ___EmotionJSX(Box, {
115
115
  sx: {
116
- width: '20px',
116
+ width: '15px',
117
117
  position: 'relative'
118
118
  }
119
119
  }, ___EmotionJSX(Box, {
@@ -171,7 +171,7 @@ export var Default = function Default(_ref) {
171
171
  position: 'absolute',
172
172
  bottom: 0,
173
173
  left: 12,
174
- top: 55
174
+ top: 50
175
175
  }
176
176
  }, ___EmotionJSX("svg", {
177
177
  xmlns: "http://www.w3.org/2000/svg",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.0.0-beta.1",
3
+ "version": "2.0.0",
4
4
  "description": "PingUX themeable React component library",
5
5
  "repository": {
6
6
  "type": "git",