@pingux/astro 1.1.0-alpha.9 → 1.1.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 (62) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/lib/cjs/components/CodeView/CodeView.js +165 -0
  3. package/lib/cjs/components/CodeView/CodeView.stories.js +93 -0
  4. package/lib/cjs/components/CodeView/CodeView.test.js +211 -0
  5. package/lib/cjs/components/CodeView/index.js +18 -0
  6. package/lib/cjs/components/CopyText/CopyText.js +34 -11
  7. package/lib/cjs/components/FileInputField/FileItem.js +2 -1
  8. package/lib/cjs/components/NavBar/NavBar.js +38 -0
  9. package/lib/cjs/components/NavBar/NavBar.stories.js +679 -0
  10. package/lib/cjs/components/NavBar/NavBar.test.js +116 -0
  11. package/lib/cjs/components/NavBar/index.js +18 -0
  12. package/lib/cjs/components/NavBarSection/NavBarItemBody.js +56 -0
  13. package/lib/cjs/components/NavBarSection/NavBarItemHeader.js +47 -0
  14. package/lib/cjs/components/NavBarSection/NavBarSection.js +82 -0
  15. package/lib/cjs/components/NavBarSection/index.js +18 -0
  16. package/lib/cjs/components/OverlayPanel/OverlayPanel.js +53 -6
  17. package/lib/cjs/components/OverlayPanel/OverlayPanel.stories.js +59 -47
  18. package/lib/cjs/components/OverlayPanel/OverlayPanel.test.js +84 -0
  19. package/lib/cjs/components/Separator/Separator.js +1 -1
  20. package/lib/cjs/components/TooltipTrigger/TooltipTrigger.js +10 -5
  21. package/lib/cjs/hooks/useOverlayPanelState/useOverlayPanelState.js +20 -1
  22. package/lib/cjs/hooks/useOverlayPanelState/useOverlayPanelState.test.js +7 -3
  23. package/lib/cjs/index.js +84 -30
  24. package/lib/cjs/styles/variants/accordion.js +32 -1
  25. package/lib/cjs/styles/variants/boxes.js +24 -1
  26. package/lib/cjs/styles/variants/buttons.js +29 -1
  27. package/lib/cjs/styles/variants/codeView.js +80 -0
  28. package/lib/cjs/styles/variants/link.js +1 -1
  29. package/lib/cjs/styles/variants/separator.js +46 -3
  30. package/lib/cjs/styles/variants/text.js +15 -0
  31. package/lib/cjs/styles/variants/variants.js +3 -0
  32. package/lib/components/CodeView/CodeView.js +130 -0
  33. package/lib/components/CodeView/CodeView.stories.js +67 -0
  34. package/lib/components/CodeView/CodeView.test.js +171 -0
  35. package/lib/components/CodeView/index.js +1 -0
  36. package/lib/components/CopyText/CopyText.js +35 -11
  37. package/lib/components/FileInputField/FileItem.js +2 -1
  38. package/lib/components/NavBar/NavBar.js +24 -0
  39. package/lib/components/NavBar/NavBar.stories.js +650 -0
  40. package/lib/components/NavBar/NavBar.test.js +92 -0
  41. package/lib/components/NavBar/index.js +1 -0
  42. package/lib/components/NavBarSection/NavBarItemBody.js +37 -0
  43. package/lib/components/NavBarSection/NavBarItemHeader.js +31 -0
  44. package/lib/components/NavBarSection/NavBarSection.js +65 -0
  45. package/lib/components/NavBarSection/index.js +1 -0
  46. package/lib/components/OverlayPanel/OverlayPanel.js +52 -8
  47. package/lib/components/OverlayPanel/OverlayPanel.stories.js +59 -49
  48. package/lib/components/OverlayPanel/OverlayPanel.test.js +73 -1
  49. package/lib/components/Separator/Separator.js +1 -1
  50. package/lib/components/TooltipTrigger/TooltipTrigger.js +10 -5
  51. package/lib/hooks/useOverlayPanelState/useOverlayPanelState.js +20 -1
  52. package/lib/hooks/useOverlayPanelState/useOverlayPanelState.test.js +7 -3
  53. package/lib/index.js +5 -0
  54. package/lib/styles/variants/accordion.js +32 -1
  55. package/lib/styles/variants/boxes.js +24 -1
  56. package/lib/styles/variants/buttons.js +29 -1
  57. package/lib/styles/variants/codeView.js +68 -0
  58. package/lib/styles/variants/link.js +1 -1
  59. package/lib/styles/variants/separator.js +33 -1
  60. package/lib/styles/variants/text.js +15 -0
  61. package/lib/styles/variants/variants.js +2 -0
  62. package/package.json +4 -2
@@ -14,11 +14,30 @@ var useOverlayPanelState = function useOverlayPanelState() {
14
14
  var isDefaultOpen = props.isDefaultOpen,
15
15
  isOpen = props.isOpen,
16
16
  onOpenChange = props.onOpenChange;
17
- return useOverlayTriggerState({
17
+ var state = useOverlayTriggerState({
18
18
  defaultOpen: isDefaultOpen,
19
19
  isOpen: isOpen,
20
20
  onOpenChange: onOpenChange
21
21
  });
22
+
23
+ var onClose = function onClose(stateProp, triggerRef, onCloseProp) {
24
+ if (stateProp) {
25
+ stateProp.close();
26
+ }
27
+
28
+ if (triggerRef === null || triggerRef === void 0 ? void 0 : triggerRef.current) {
29
+ triggerRef.current.focus();
30
+ }
31
+
32
+ if (onCloseProp) {
33
+ onCloseProp();
34
+ }
35
+ };
36
+
37
+ return {
38
+ state: state,
39
+ onClose: onClose
40
+ };
22
41
  };
23
42
 
24
43
  export default useOverlayPanelState;
@@ -7,8 +7,12 @@ test('default useOverlayPanelState', function () {
7
7
  result = _renderHook.result;
8
8
 
9
9
  expect(result.current).toEqual(expect.objectContaining({
10
- open: expect.any(Function),
11
- close: expect.any(Function),
12
- toggle: expect.any(Function)
10
+ state: {
11
+ open: expect.any(Function),
12
+ close: expect.any(Function),
13
+ toggle: expect.any(Function),
14
+ isOpen: expect.any(Boolean)
15
+ },
16
+ onClose: expect.any(Function)
13
17
  }));
14
18
  });
package/lib/index.js CHANGED
@@ -27,6 +27,7 @@ export { default as CheckboxField } from './components/CheckboxField';
27
27
  export * from './components/CheckboxField';
28
28
  export { default as Chip } from './components/Chip';
29
29
  export * from './components/Chip';
30
+ export { default as CodeView } from './components/CodeView';
30
31
  export { default as ComboBoxField } from './components/ComboBoxField';
31
32
  export { default as CopyText } from './components/CopyText';
32
33
  export { default as ColorField } from './components/ColorField';
@@ -68,6 +69,10 @@ export { default as Messages } from './components/Messages';
68
69
  export * from './components/Messages';
69
70
  export { default as Modal } from './components/Modal';
70
71
  export * from './components/Modal';
72
+ export { default as NavBar } from './components/NavBar';
73
+ export * from './components/NavBar';
74
+ export { default as NavBarSection } from './components/NavBarSection';
75
+ export * from './components/NavBarSection';
71
76
  export { default as MultivaluesField } from './components/MultivaluesField';
72
77
  export { default as OverlayPanel } from './components/OverlayPanel';
73
78
  export * from './components/OverlayPanel';
@@ -56,6 +56,36 @@ var accordionGridHeader = {
56
56
  }
57
57
  }
58
58
  };
59
+ var accordionGridHeaderNav = {
60
+ padding: '10px 15px 10px 15px',
61
+ cursor: 'pointer',
62
+ minHeight: '40px',
63
+ lineHeight: '30px',
64
+ outline: 'none',
65
+ display: 'flex',
66
+ justifyContent: 'flex-start',
67
+ flexShrink: 0,
68
+ wordBreak: 'inherit',
69
+ whiteSpace: 'nowrap',
70
+ color: 'neutral.95',
71
+ flexGrow: 1,
72
+ fontWeight: 0,
73
+ fontSize: '16px',
74
+ mt: '5px',
75
+ '&.is-focused': {
76
+ outline: 'none',
77
+ boxShadow: 'focus',
78
+ WebkitBoxShadow: 'focus',
79
+ MozBoxShadow: 'focus'
80
+ },
81
+ '&.is-hovered': {
82
+ backgroundColor: 'accent.10',
83
+ boxShadow: 'inset 2px 0 0 0 white'
84
+ },
85
+ '&.is-pressed': {
86
+ backgroundColor: 'accent.10'
87
+ }
88
+ };
59
89
  var accordionGridBody = {
60
90
  display: 'none !important',
61
91
  pl: 'sm',
@@ -69,5 +99,6 @@ export default {
69
99
  accordionGridBody: accordionGridBody,
70
100
  accordionTitle: accordionTitle,
71
101
  accordion: accordion,
72
- accordionBody: accordionBody
102
+ accordionBody: accordionBody,
103
+ accordionGridHeaderNav: accordionGridHeaderNav
73
104
  };
@@ -189,6 +189,26 @@ var expandableRow = {
189
189
  }
190
190
  }
191
191
  };
192
+ var navBar = {
193
+ height: '100%',
194
+ width: '230px',
195
+ position: 'absolute',
196
+ zIndex: '1',
197
+ top: '0',
198
+ left: '0',
199
+ backgroundColor: 'accent.20',
200
+ overflowY: 'hidden'
201
+ };
202
+ var navBarSectionContainer = {
203
+ height: '100%',
204
+ maxHeight: '100%',
205
+ overflowY: 'overlay !important'
206
+ };
207
+ var navBarItemHeaderContainer = {
208
+ flexGrow: 1,
209
+ alignItems: 'center',
210
+ maxWidth: '180px'
211
+ };
192
212
  var datePicker = {
193
213
  '.react-calendar': {
194
214
  width: 280,
@@ -270,5 +290,8 @@ export default {
270
290
  radioContainer: radioContainer,
271
291
  scrollbox: scrollbox,
272
292
  topShadowScrollbox: topShadowScrollbox,
273
- bottomShadowScrollbox: bottomShadowScrollbox
293
+ bottomShadowScrollbox: bottomShadowScrollbox,
294
+ navBar: navBar,
295
+ navBarSectionContainer: navBarSectionContainer,
296
+ navBarItemHeaderContainer: navBarItemHeaderContainer
274
297
  };
@@ -52,6 +52,33 @@ var defaultFocus = {
52
52
  outline: 'none',
53
53
  boxShadow: 'focus'
54
54
  };
55
+ var navItemButton = {
56
+ textDecoration: 'none',
57
+ outline: 'none',
58
+ cursor: 'pointer',
59
+ borderRadius: 0,
60
+ backgroundColor: 'transparent',
61
+ paddingTop: '5px',
62
+ paddingBottom: '5px',
63
+ display: 'block',
64
+ color: 'neutral.95',
65
+ fontSize: 'sm',
66
+ fontWeight: 1,
67
+ flexGrow: '1',
68
+ width: '100%',
69
+ textAlign: 'left',
70
+ lineHeight: '16px',
71
+ whiteSpace: 'break-spaces',
72
+ overflowWrap: 'break-word',
73
+ maxWidth: '100%',
74
+ wordWrap: 'break-word',
75
+ wordBreak: 'break-word',
76
+ '&.is-focused': _objectSpread({}, defaultFocus),
77
+ '&.is-hovered': {
78
+ bg: 'accent.10',
79
+ boxShadow: 'inset 2px 0 0 0 white'
80
+ }
81
+ };
55
82
  var iconButton = {
56
83
  justifyContent: 'center',
57
84
  appearance: 'none',
@@ -67,7 +94,7 @@ var iconButton = {
67
94
  width: 'inherit',
68
95
  height: 'inherit',
69
96
  path: {
70
- fill: 'neutral.20'
97
+ fill: 'neutral.40'
71
98
  },
72
99
  outline: 'none',
73
100
  '&.is-focused': _objectSpread({}, defaultFocus),
@@ -516,6 +543,7 @@ export default {
516
543
  text: text,
517
544
  helpHint: helpHint,
518
545
  modalCloseButton: modalCloseButton,
546
+ navItemButton: navItemButton,
519
547
  applicationPortalPinned: applicationPortalPinned,
520
548
  applicationPortal: applicationPortal,
521
549
  square: square,
@@ -0,0 +1,68 @@
1
+ import 'a11y-syntax-highlighting/dist/prism/a11y-light.min.css';
2
+ var wrapper = {
3
+ bg: 'accent.99',
4
+ border: '1px solid',
5
+ borderColor: 'accent.95',
6
+ width: 400,
7
+ height: 200,
8
+ my: 5,
9
+ overflow: 'auto',
10
+ alignItems: 'center',
11
+ '&.is-focused, &:focus': {
12
+ boxShadow: 'focus',
13
+ outline: 'none'
14
+ },
15
+ pre: {
16
+ backgroundColor: 'transparent',
17
+ m: 0,
18
+ p: 10,
19
+ pr: 0,
20
+ height: '100%',
21
+ width: '100%',
22
+ overflowX: 'hidden',
23
+ overflowY: 'auto',
24
+ fontFamily: 'standard',
25
+ fontSize: 'sm',
26
+ '& .token-line': {
27
+ display: 'block',
28
+ alignItems: 'center',
29
+ '& .token': {
30
+ whiteSpace: 'pre-wrap',
31
+ wordBreak: 'break-all'
32
+ }
33
+ }
34
+ },
35
+ '&.has-no-copy-button': {
36
+ pre: {
37
+ p: 10
38
+ }
39
+ },
40
+ '&.has-line-numbers': {
41
+ pre: {
42
+ p: '0 10px 0 0',
43
+ overflow: 'auto',
44
+ '& .token-line:first-of-type *': {
45
+ pt: 10
46
+ },
47
+ '& .token-line': {
48
+ display: 'flex',
49
+ '& .token': {
50
+ whiteSpace: 'pre'
51
+ }
52
+ }
53
+ }
54
+ }
55
+ };
56
+ var lineNo = {
57
+ display: 'table-cell',
58
+ userSelect: 'none',
59
+ p: 5,
60
+ m: '0 10px 0 0',
61
+ bg: 'accent.30',
62
+ minWidth: 26,
63
+ color: 'white'
64
+ };
65
+ export default {
66
+ wrapper: wrapper,
67
+ lineNo: lineNo
68
+ };
@@ -1,5 +1,5 @@
1
1
  var link = {
2
- color: 'active',
2
+ color: 'white',
3
3
  fontFamily: 'standard',
4
4
  fontSize: 'md',
5
5
  textDecoration: 'none',
@@ -1,4 +1,18 @@
1
- export default {
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 _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
10
+
11
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (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 source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
14
+
15
+ var base = {
2
16
  bg: 'neutral.80',
3
17
  width: '100%',
4
18
  height: '1px',
@@ -8,4 +22,22 @@ export default {
8
22
  height: '100%',
9
23
  mx: '5px'
10
24
  }
25
+ };
26
+
27
+ var navBarSeparator = _objectSpread(_objectSpread({}, base), {}, {
28
+ width: '100%',
29
+ backgroundColor: 'neutral.60'
30
+ });
31
+
32
+ var navBarSubtitleSeparator = _objectSpread(_objectSpread({}, base), {}, {
33
+ ml: '45px',
34
+ width: 'calc(100% - 75px)',
35
+ mb: '15px',
36
+ backgroundColor: 'neutral.60'
37
+ });
38
+
39
+ export default {
40
+ base: base,
41
+ navBarSeparator: navBarSeparator,
42
+ navBarSubtitleSeparator: navBarSubtitleSeparator
11
43
  };
@@ -119,6 +119,19 @@ var expandableRow = {
119
119
  }
120
120
  }
121
121
  };
122
+ var navBarSubtitle = {
123
+ fontWeight: 3,
124
+ fontSize: '11px',
125
+ color: 'accent.80'
126
+ };
127
+
128
+ var navBarHeaderText = _objectSpread(_objectSpread({}, wordWrap), {}, {
129
+ whiteSpace: 'break-spaces',
130
+ lineHeight: '13px',
131
+ fontSize: '13px',
132
+ fontWeight: 1
133
+ });
134
+
122
135
  export var text = {
123
136
  base: base,
124
137
  bodyStrong: _objectSpread(_objectSpread({}, wordWrap), {}, {
@@ -182,6 +195,8 @@ export var text = {
182
195
  textOverflow: 'ellipsis'
183
196
  }),
184
197
  expandableRow: expandableRow,
198
+ navBarHeaderText: navBarHeaderText,
199
+ navBarSubtitle: navBarSubtitle,
185
200
  placeholder: {
186
201
  fontWeight: -1,
187
202
  color: 'text.secondary',
@@ -14,6 +14,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
14
14
 
15
15
  import accordion from './accordion';
16
16
  import boxes from './boxes';
17
+ import codeView from './codeView';
17
18
  import images from './images';
18
19
  import imageUpload from './imageUpload';
19
20
  import link from './link';
@@ -35,6 +36,7 @@ import tooltip from './tooltip';
35
36
  export default _objectSpread(_objectSpread({
36
37
  accordion: accordion,
37
38
  boxes: boxes,
39
+ codeView: codeView,
38
40
  images: images,
39
41
  imageUpload: imageUpload,
40
42
  loader: loader,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "1.1.0-alpha.9",
3
+ "version": "1.1.0",
4
4
  "description": "PingUX themeable React component library",
5
5
  "author": "uxdev@pingidentity.com",
6
6
  "license": "Apache-2.0",
@@ -78,7 +78,7 @@
78
78
  "@react-aria/color": "^3.0.0-beta.2",
79
79
  "@react-aria/combobox": "^3.0.0",
80
80
  "@react-aria/dialog": "^3.1.2",
81
- "@react-aria/focus": "^3.2.3",
81
+ "@react-aria/focus": "^3.5.0",
82
82
  "@react-aria/grid": "^3.0.0-beta.1",
83
83
  "@react-aria/i18n": "^3.3.0",
84
84
  "@react-aria/interactions": "^3.5.0",
@@ -126,12 +126,14 @@
126
126
  "@styled-system/props": "^5.1.5",
127
127
  "@styled-system/theme-get": "^5.1.2",
128
128
  "@tippyjs/react": "4.2.0",
129
+ "a11y-syntax-highlighting": "0.2.0",
129
130
  "chroma-js": "^2.1.0",
130
131
  "classnames": "^2.2.6",
131
132
  "emotion-normalize": "^11.0.1",
132
133
  "lodash": "^4.17.21",
133
134
  "mdi-react": "^7.4.0",
134
135
  "moment": "^2.29.1",
136
+ "prism-react-renderer": "^1.2.1",
135
137
  "prop-types": "^15.7.2",
136
138
  "react-calendar": "^3.4.0",
137
139
  "react-color": "^2.19.3",