@pingux/astro 1.28.2-alpha.1 → 1.29.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.
Files changed (85) hide show
  1. package/lib/cjs/components/ArrayField/ArrayField.js +21 -22
  2. package/lib/cjs/components/ArrayField/ArrayField.stories.js +48 -26
  3. package/lib/cjs/components/CheckboxField/CheckboxField.js +11 -39
  4. package/lib/cjs/components/CheckboxField/CheckboxField.stories.js +24 -32
  5. package/lib/cjs/components/ColorField/ColorField.js +27 -20
  6. package/lib/cjs/components/ColorField/ColorField.stories.js +28 -8
  7. package/lib/cjs/components/ComboBox/ComboBoxInput.js +31 -39
  8. package/lib/cjs/components/ComboBoxField/ComboBoxField.js +30 -55
  9. package/lib/cjs/components/ComboBoxField/ComboBoxField.stories.js +65 -45
  10. package/lib/cjs/components/FileInputField/FileInputField.js +33 -27
  11. package/lib/cjs/components/FileInputField/FileInputField.stories.js +27 -7
  12. package/lib/cjs/components/FileInputField/FileSelect.js +41 -10
  13. package/lib/cjs/components/ImageUploadField/ImageUploadField.js +35 -15
  14. package/lib/cjs/components/ImageUploadField/ImageUploadField.stories.js +34 -14
  15. package/lib/cjs/components/LinkSelectField/LinkSelectField.js +18 -20
  16. package/lib/cjs/components/LinkSelectField/LinkSelectField.stories.js +71 -53
  17. package/lib/cjs/components/Messages/Message.js +23 -7
  18. package/lib/cjs/components/Messages/Messages.test.js +25 -70
  19. package/lib/cjs/components/MultivaluesField/MultivaluesField.js +21 -12
  20. package/lib/cjs/components/MultivaluesField/MultivaluesField.stories.js +26 -6
  21. package/lib/cjs/components/NumberField/NumberField.js +15 -13
  22. package/lib/cjs/components/NumberField/NumberField.stories.js +25 -5
  23. package/lib/cjs/components/PasswordField/PasswordField.js +15 -27
  24. package/lib/cjs/components/PasswordField/PasswordField.stories.js +6 -4
  25. package/lib/cjs/components/RadioGroupField/RadioGroupField.js +17 -34
  26. package/lib/cjs/components/RadioGroupField/RadioGroupField.stories.js +25 -30
  27. package/lib/cjs/components/SearchField/SearchField.js +36 -55
  28. package/lib/cjs/components/SearchField/SearchField.stories.js +35 -24
  29. package/lib/cjs/components/SelectField/SelectField.js +27 -7
  30. package/lib/cjs/components/SelectField/SelectField.stories.js +73 -53
  31. package/lib/cjs/components/SelectFieldBase/SelectFieldBase.js +37 -25
  32. package/lib/cjs/components/SwitchField/SwitchField.js +43 -62
  33. package/lib/cjs/components/SwitchField/SwitchField.stories.js +26 -26
  34. package/lib/cjs/components/TextAreaField/TextAreaField.js +16 -20
  35. package/lib/cjs/components/TextAreaField/TextAreaField.stories.js +29 -11
  36. package/lib/cjs/components/TextField/TextField.js +11 -15
  37. package/lib/cjs/components/TextField/TextField.stories.js +30 -10
  38. package/lib/cjs/hooks/useField/useField.js +9 -21
  39. package/lib/cjs/recipes/LogoTabs.stories.js +50 -47
  40. package/lib/cjs/recipes/RadioButtonsWithLinks.stories.js +2 -1
  41. package/lib/cjs/utils/devUtils/props/ariaAttributes.js +116 -0
  42. package/lib/cjs/utils/devUtils/props/ariaAttributes.test.js +65 -0
  43. package/lib/components/ArrayField/ArrayField.js +16 -14
  44. package/lib/components/ArrayField/ArrayField.stories.js +17 -3
  45. package/lib/components/CheckboxField/CheckboxField.js +6 -32
  46. package/lib/components/CheckboxField/CheckboxField.stories.js +17 -32
  47. package/lib/components/ColorField/ColorField.js +22 -16
  48. package/lib/components/ColorField/ColorField.stories.js +18 -3
  49. package/lib/components/ComboBox/ComboBoxInput.js +24 -32
  50. package/lib/components/ComboBoxField/ComboBoxField.js +25 -51
  51. package/lib/components/ComboBoxField/ComboBoxField.stories.js +17 -3
  52. package/lib/components/FileInputField/FileInputField.js +29 -24
  53. package/lib/components/FileInputField/FileInputField.stories.js +18 -3
  54. package/lib/components/FileInputField/FileSelect.js +32 -10
  55. package/lib/components/ImageUploadField/ImageUploadField.js +23 -8
  56. package/lib/components/ImageUploadField/ImageUploadField.stories.js +18 -3
  57. package/lib/components/LinkSelectField/LinkSelectField.js +12 -11
  58. package/lib/components/LinkSelectField/LinkSelectField.stories.js +17 -4
  59. package/lib/components/Messages/Message.js +22 -6
  60. package/lib/components/Messages/Messages.test.js +25 -67
  61. package/lib/components/MultivaluesField/MultivaluesField.js +16 -9
  62. package/lib/components/MultivaluesField/MultivaluesField.stories.js +18 -3
  63. package/lib/components/NumberField/NumberField.js +5 -4
  64. package/lib/components/NumberField/NumberField.stories.js +17 -2
  65. package/lib/components/PasswordField/PasswordField.js +5 -11
  66. package/lib/components/PasswordField/PasswordField.stories.js +4 -3
  67. package/lib/components/RadioGroupField/RadioGroupField.js +12 -28
  68. package/lib/components/RadioGroupField/RadioGroupField.stories.js +17 -27
  69. package/lib/components/SearchField/SearchField.js +28 -48
  70. package/lib/components/SearchField/SearchField.stories.js +20 -14
  71. package/lib/components/SelectField/SelectField.js +18 -3
  72. package/lib/components/SelectField/SelectField.stories.js +18 -4
  73. package/lib/components/SelectFieldBase/SelectFieldBase.js +33 -25
  74. package/lib/components/SwitchField/SwitchField.js +40 -57
  75. package/lib/components/SwitchField/SwitchField.stories.js +18 -23
  76. package/lib/components/TextAreaField/TextAreaField.js +7 -9
  77. package/lib/components/TextAreaField/TextAreaField.stories.js +19 -5
  78. package/lib/components/TextField/TextField.js +4 -6
  79. package/lib/components/TextField/TextField.stories.js +19 -4
  80. package/lib/hooks/useField/useField.js +6 -16
  81. package/lib/recipes/LogoTabs.stories.js +50 -48
  82. package/lib/recipes/RadioButtonsWithLinks.stories.js +2 -1
  83. package/lib/utils/devUtils/props/ariaAttributes.js +85 -0
  84. package/lib/utils/devUtils/props/ariaAttributes.test.js +50 -0
  85. package/package.json +1 -1
@@ -82,42 +82,52 @@ var GoogleLogo = function GoogleLogo(props) {
82
82
  })));
83
83
  };
84
84
 
85
- var logoTabsStyling = {
86
- display: 'inline-flex !important',
87
- '& > div': {
88
- borderStyle: 'none',
89
- borderBottomWidth: '0px !important',
90
- justifyContent: 'space-between'
91
- }
92
- };
93
-
94
- var tabStyling = _objectSpread(_objectSpread({}, tab), {}, {
95
- alignSelf: 'center',
96
- '& > svg': {
97
- borderWidth: 1,
98
- borderStyle: 'dashed',
99
- borderColor: 'neutral.70',
100
- borderRadius: 4,
101
- bg: 'white',
102
- outline: '5px solid white'
85
+ var sx = {
86
+ container: {
87
+ display: 'inline-flex !important',
88
+ position: 'relative',
89
+ width: '500px'
103
90
  },
104
- '&.is-selected > svg': {
105
- borderWidth: 1,
106
- borderStyle: 'solid',
107
- borderColor: 'active',
108
- borderRadius: 4,
109
- bg: 'white',
110
- outline: '5px solid white'
91
+ separator: {
92
+ position: 'absolute',
93
+ top: '25%',
94
+ backgroundColor: 'accent.70'
111
95
  },
112
- // we only want the change the color of icon svgs to active not company logos
113
- '&.is-selected > .mdi-icon > path': {
114
- fill: 'active'
96
+ logoTabsStyling: {
97
+ display: 'inline-flex !important',
98
+ '& > div': {
99
+ borderStyle: 'none',
100
+ borderBottomWidth: '0px !important',
101
+ justifyContent: 'space-between'
102
+ }
115
103
  },
116
- '& > [role="presentation"]': {
117
- height: '0px'
118
- }
119
- });
120
-
104
+ tabStyling: _objectSpread(_objectSpread({}, tab), {}, {
105
+ alignSelf: 'center',
106
+ '& > svg': {
107
+ borderWidth: 1,
108
+ borderStyle: 'dashed',
109
+ borderColor: 'neutral.70',
110
+ borderRadius: 4,
111
+ bg: 'white',
112
+ outline: '5px solid white'
113
+ },
114
+ '&.is-selected > svg': {
115
+ borderWidth: 1,
116
+ borderStyle: 'solid',
117
+ borderColor: 'active',
118
+ borderRadius: 4,
119
+ bg: 'white',
120
+ outline: '5px solid white'
121
+ },
122
+ // we only want the change the color of icon svgs to active not company logos
123
+ '&.is-selected > .mdi-icon > path': {
124
+ fill: 'active'
125
+ },
126
+ '& > [role="presentation"]': {
127
+ height: '0px'
128
+ }
129
+ })
130
+ };
121
131
  export var LogoTabs = function LogoTabs() {
122
132
  var _useState = useState('tab1'),
123
133
  _useState2 = _slicedToArray(_useState, 2),
@@ -130,19 +140,11 @@ export var LogoTabs = function LogoTabs() {
130
140
  setShowMiddleTabs = _useState4[1];
131
141
 
132
142
  return ___EmotionJSX(Box, {
133
- sx: {
134
- display: 'inline-flex !important',
135
- position: 'relative',
136
- width: '500px'
137
- }
143
+ sx: sx.container
138
144
  }, ___EmotionJSX(Separator, {
139
- sx: {
140
- position: 'absolute',
141
- top: '25%'
142
- },
143
- bg: "accent.70"
145
+ sx: sx.separator
144
146
  }), ___EmotionJSX(Tabs, {
145
- sx: logoTabsStyling,
147
+ sx: sx.logoTabsStyling,
146
148
  selectedKey: currentTab,
147
149
  onSelectionChange: setCurrentTab,
148
150
  onClick: setShowMiddleTabs
@@ -158,7 +160,7 @@ export var LogoTabs = function LogoTabs() {
158
160
  color: "#eb4c15",
159
161
  p: "sm"
160
162
  }),
161
- sx: tabStyling
163
+ sx: sx.tabStyling
162
164
  }, ___EmotionJSX(Text, null, "This is content for the source tab")), (showMiddleTabs || currentTab !== 'tab1') && ___EmotionJSX(Tab, {
163
165
  key: "tab2",
164
166
  title: ___EmotionJSX(Text, {
@@ -171,7 +173,7 @@ export var LogoTabs = function LogoTabs() {
171
173
  color: "accent.20",
172
174
  p: "xs"
173
175
  }),
174
- sx: tabStyling
176
+ sx: sx.tabStyling
175
177
  }, ___EmotionJSX(Text, null, "This is content for the custom filter tab")), (showMiddleTabs || currentTab !== 'tab1') && ___EmotionJSX(Tab, {
176
178
  key: "tab3",
177
179
  title: ___EmotionJSX(Text, {
@@ -184,7 +186,7 @@ export var LogoTabs = function LogoTabs() {
184
186
  color: "accent.20",
185
187
  p: "xs"
186
188
  }),
187
- sx: tabStyling
189
+ sx: sx.tabStyling
188
190
  }, ___EmotionJSX(Text, null, "This is content for attribute mapping tab")), ___EmotionJSX(Tab, {
189
191
  key: "tab4",
190
192
  title: ___EmotionJSX(Text, {
@@ -196,6 +198,6 @@ export var LogoTabs = function LogoTabs() {
196
198
  size: 65,
197
199
  p: "sm"
198
200
  }),
199
- sx: tabStyling
201
+ sx: sx.tabStyling
200
202
  }, ___EmotionJSX(Text, null, "This is content for the target tab"))));
201
203
  };
@@ -78,7 +78,8 @@ export var Default = function Default() {
78
78
  fontWeight: 2
79
79
  }
80
80
  }, "Permissions"), ___EmotionJSX(IconButton, {
81
- onPress: onPress
81
+ onPress: onPress,
82
+ "aria-label": "close icon button"
82
83
  }, ___EmotionJSX(Icon, {
83
84
  icon: CloseIcon
84
85
  }))), ___EmotionJSX(Box, null, ___EmotionJSX(Text, {
@@ -0,0 +1,85 @@
1
+ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
2
+ import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
3
+ import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
4
+ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
5
+ import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
6
+ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
7
+ import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
8
+ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
9
+ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
10
+ import _Object$entries from "@babel/runtime-corejs3/core-js-stable/object/entries";
11
+ import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
12
+ import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
13
+
14
+ 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; }
15
+
16
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
17
+
18
+ import omit from 'lodash/omit';
19
+ import PropTypes from 'prop-types';
20
+ var descriptions = {
21
+ ariaControls: 'Identifies the element (or elements) whose contents or presence are controlled by the current element.',
22
+ ariaDescribedby: 'Identifies the element (or elements) that describes the object.',
23
+ ariaDetails: 'Identifies the element (or elements) that provide a detailed, extended description for the object.',
24
+ ariaErrormessage: 'Identifies the element that provides an error message for the object.',
25
+ ariaLabel: 'Defines a string value that labels the current element.',
26
+ ariaLabelledby: 'Identifies the element (or elements) that labels the current element.'
27
+ };
28
+ export var ariaAttributeBaseDocSettings = {
29
+ type: {
30
+ summary: 'string'
31
+ },
32
+ control: {
33
+ type: 'text'
34
+ },
35
+ table: {
36
+ category: 'Aria Attributes'
37
+ }
38
+ };
39
+ export var ariaAttributeBaseArgTypes = {
40
+ 'aria-controls': _objectSpread({
41
+ description: descriptions.ariaControls
42
+ }, ariaAttributeBaseDocSettings),
43
+ 'aria-describedby': _objectSpread({
44
+ description: descriptions.ariaDescribedby
45
+ }, ariaAttributeBaseDocSettings),
46
+ 'aria-details': _objectSpread({
47
+ description: descriptions.ariaDetails
48
+ }, ariaAttributeBaseDocSettings),
49
+ 'aria-errormessage': _objectSpread({
50
+ description: descriptions.ariaErrormessage
51
+ }, ariaAttributeBaseDocSettings),
52
+ 'aria-label': _objectSpread({
53
+ description: descriptions.ariaLabel
54
+ }, ariaAttributeBaseDocSettings),
55
+ 'aria-labelledby': _objectSpread({
56
+ description: descriptions.ariaLabelledby
57
+ }, ariaAttributeBaseDocSettings)
58
+ };
59
+ export var ariaAttributesBasePropTypes = {
60
+ 'aria-controls': PropTypes.string,
61
+ 'aria-describedby': PropTypes.string,
62
+ 'aria-details': PropTypes.string,
63
+ 'aria-errormessage': PropTypes.string,
64
+ 'aria-label': PropTypes.string,
65
+ 'aria-labelledby': PropTypes.string
66
+ };
67
+ export var getAriaAttributeProps = function getAriaAttributeProps(props) {
68
+ var _context;
69
+
70
+ var ariaProps = _reduceInstanceProperty(_context = _Object$entries(props)).call(_context, function (acc, _ref) {
71
+ var _ref2 = _slicedToArray(_ref, 2),
72
+ key = _ref2[0],
73
+ val = _ref2[1];
74
+
75
+ if (key.match(/^aria-.*/)) return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, val));
76
+ return _objectSpread({}, acc);
77
+ }, {});
78
+
79
+ var nonAriaProps = _objectSpread({}, omit(props, _Object$keys(ariaProps)));
80
+
81
+ return {
82
+ ariaProps: ariaProps,
83
+ nonAriaProps: nonAriaProps
84
+ };
85
+ };
@@ -0,0 +1,50 @@
1
+ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
2
+ import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
3
+ import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
4
+ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
5
+ import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
6
+ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
7
+ import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
8
+ import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
9
+ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
10
+
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
+
13
+ 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; }
14
+
15
+ import { getAriaAttributeProps } from './ariaAttributes';
16
+ describe('getAriaAttributeProps', function () {
17
+ var subject = function subject(props) {
18
+ return getAriaAttributeProps(props);
19
+ };
20
+
21
+ var propsWithNoAriaAttributes = {
22
+ propOne: 'prop1',
23
+ propTwo: 'prop2'
24
+ };
25
+ describe('when there are 2 props and no aria attributes', function () {
26
+ it('returns an object with empty ariaProps and 2 nonAriaProps', function () {
27
+ var _subject = subject(propsWithNoAriaAttributes),
28
+ ariaProps = _subject.ariaProps,
29
+ nonAriaProps = _subject.nonAriaProps;
30
+
31
+ expect(_Object$keys(nonAriaProps).length).toBe(2);
32
+ expect(_Object$keys(ariaProps).length).toBe(0);
33
+ });
34
+ });
35
+ describe('when there is an aria-label and an aria-labelledby in the props', function () {
36
+ it('returns an object with ariaProps containing aria-label and aria-labelledby', function () {
37
+ var propsWithAriaAttributes = _objectSpread({
38
+ 'aria-labelledby': 'test labelledby',
39
+ 'aria-label': 'test label'
40
+ }, propsWithNoAriaAttributes);
41
+
42
+ var _subject2 = subject(propsWithAriaAttributes),
43
+ ariaProps = _subject2.ariaProps,
44
+ nonAriaProps = _subject2.nonAriaProps;
45
+
46
+ expect(_Object$keys(nonAriaProps).length).toBe(2);
47
+ expect(_Object$keys(ariaProps).length).toBe(2);
48
+ });
49
+ });
50
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "1.28.2-alpha.1",
3
+ "version": "1.29.0-alpha.0",
4
4
  "description": "PingUX themeable React component library",
5
5
  "repository": {
6
6
  "type": "git",