@pingux/astro 2.48.0-alpha.0 → 2.48.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.
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ScrollBoxProps } from '../../types';
3
+ declare const ScrollBox: React.ForwardRefExoticComponent<ScrollBoxProps & React.RefAttributes<HTMLDivElement>>;
4
+ export default ScrollBox;
@@ -20,8 +20,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/he
20
20
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
21
21
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
22
22
  var _react = _interopRequireWildcard(require("react"));
23
- var _propTypes = _interopRequireDefault(require("prop-types"));
24
- var _useStatusClasses2 = _interopRequireDefault(require("../../hooks/useStatusClasses"));
23
+ var _hooks = require("../../hooks");
25
24
  var _Box = _interopRequireDefault(require("../Box"));
26
25
  var _react2 = require("@emotion/react");
27
26
  var _excluded = ["maxHeight", "children", "sx", "hasShadows", "onScroll"];
@@ -48,31 +47,30 @@ var ScrollBox = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
48
47
  _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
49
48
  isBottomShadowShowing = _useState6[0],
50
49
  setIsBottomShadowShowing = _useState6[1];
51
- var outerRef = (0, _react.useRef)();
52
- /* istanbul ignore next */
53
- (0, _react.useImperativeHandle)(ref, function () {
54
- return outerRef.current;
55
- });
50
+ var outerRef = (0, _hooks.useLocalOrForwardRef)(ref);
56
51
 
57
52
  /* istanbul ignore next */
58
53
  (0, _react.useLayoutEffect)(function () {
59
- if (outerRef.current && outerRef.current.firstChild) {
60
- if (outerRef.current.firstChild.offsetHeight !== 0) {
61
- setIsBottomShadowShowing(outerRef.current.firstChild.scrollHeight - outerRef.current.firstChild.offsetHeight !== outerRef.current.firstChild.scrollTop);
62
- setIsTopShadowShowing(outerRef.current.firstChild.scrollTop !== 0);
54
+ var _outerRef$current;
55
+ var firstChildNode = (_outerRef$current = outerRef.current) === null || _outerRef$current === void 0 ? void 0 : _outerRef$current.firstChild;
56
+ if (outerRef.current && firstChildNode) {
57
+ if (firstChildNode.offsetHeight !== 0) {
58
+ firstChildNode.setAttribute('tabindex', '0');
59
+ setIsBottomShadowShowing(firstChildNode.scrollHeight - firstChildNode.offsetHeight !== firstChildNode.scrollTop);
60
+ setIsTopShadowShowing(firstChildNode.scrollTop !== 0);
63
61
  }
64
62
  }
65
63
  }, [scrollTopPosition]);
66
64
 
67
65
  /* istanbul ignore next */
68
66
  var onScroll = function onScroll() {
69
- var _outerRef$current;
70
- if ((_outerRef$current = outerRef.current) !== null && _outerRef$current !== void 0 && _outerRef$current.firstChild) {
71
- var _outerRef$current2;
72
- setScrollTopPosition((_outerRef$current2 = outerRef.current) === null || _outerRef$current2 === void 0 || (_outerRef$current2 = _outerRef$current2.firstChild) === null || _outerRef$current2 === void 0 ? void 0 : _outerRef$current2.scrollTop);
67
+ var _outerRef$current2;
68
+ var firstChildNode = (_outerRef$current2 = outerRef.current) === null || _outerRef$current2 === void 0 ? void 0 : _outerRef$current2.firstChild;
69
+ if (firstChildNode) {
70
+ setScrollTopPosition(firstChildNode.scrollTop);
73
71
  }
74
72
  };
75
- var _useStatusClasses = (0, _useStatusClasses2["default"])('', {
73
+ var _useStatusClasses = (0, _hooks.useStatusClasses)('', {
76
74
  hasShadows: hasShadows,
77
75
  isTopShadowShowing: isTopShadowShowing,
78
76
  isBottomShadowShowing: isBottomShadowShowing
@@ -100,13 +98,5 @@ ScrollBox.defaultProps = {
100
98
  maxHeight: '100%',
101
99
  hasShadows: false
102
100
  };
103
- ScrollBox.propTypes = {
104
- /** Height at which the content within ScrollBox will overflow */
105
- maxHeight: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object, _propTypes["default"].number]),
106
- /** Callback that fires when scrolling is done inside the ScrollBox */
107
- onScroll: _propTypes["default"].func,
108
- /** If true the box will render top and bottom shadows with scroll */
109
- hasShadows: _propTypes["default"].bool
110
- };
111
101
  var _default = ScrollBox;
112
102
  exports["default"] = _default;
@@ -0,0 +1,5 @@
1
+ import { StoryFn } from '@storybook/react';
2
+ import { ScrollBoxProps } from '../../types';
3
+ declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
4
+ export default _default;
5
+ export declare const Default: StoryFn<ScrollBoxProps>;
@@ -11,7 +11,7 @@ var _react = _interopRequireDefault(require("react"));
11
11
  var _storybookAddonDesigns = require("storybook-addon-designs");
12
12
  var _storybookDocsLayout = _interopRequireDefault(require("../../../.storybook/storybookDocsLayout"));
13
13
  var _index = require("../../index");
14
- var _figmaLinks = require("../../utils/designUtils/figmaLinks.ts");
14
+ var _figmaLinks = require("../../utils/designUtils/figmaLinks");
15
15
  var _ScrollBox = _interopRequireDefault(require("./ScrollBox.mdx"));
16
16
  var _react2 = require("@emotion/react");
17
17
  var _default = {
@@ -0,0 +1,41 @@
1
+ declare const _default: {
2
+ container: {
3
+ '&::-webkit-scrollbar': {
4
+ display: string;
5
+ width: string;
6
+ };
7
+ '&::-webkit-scrollbar-track': {
8
+ width: string;
9
+ display: string;
10
+ };
11
+ '&::-webkit-scrollbar-thumb': {
12
+ borderRadius: string;
13
+ display: string;
14
+ };
15
+ position: string;
16
+ '& > *': {
17
+ overflow: string;
18
+ };
19
+ };
20
+ topShadowBox: {
21
+ '&.has-shadows.is-top-shadow-showing': {
22
+ position: string;
23
+ zIndex: string;
24
+ boxShadow: string;
25
+ height: string;
26
+ marginBottom: string;
27
+ backgroundColor: string;
28
+ };
29
+ };
30
+ bottomShadowBox: {
31
+ '&.has-shadows.is-bottom-shadow-showing': {
32
+ position: string;
33
+ zIndex: string;
34
+ boxShadow: string;
35
+ height: string;
36
+ marginTop: string;
37
+ backgroundColor: string;
38
+ };
39
+ };
40
+ };
41
+ export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export { default } from './ScrollBox';
@@ -18,6 +18,7 @@ export * from './overlayPanel';
18
18
  export * from './popoverContainer';
19
19
  export * from './popoverMenu';
20
20
  export * from './rockerButtonGroup';
21
+ export * from './scrollBox';
21
22
  export * from './separator';
22
23
  export * from './shared';
23
24
  export * from './table';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25;
3
+ var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25, _context26;
4
4
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
5
5
  var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
6
6
  var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
@@ -227,8 +227,19 @@ _forEachInstanceProperty(_context20 = _Object$keys(_rockerButtonGroup)).call(_co
227
227
  }
228
228
  });
229
229
  });
230
+ var _scrollBox = require("./scrollBox");
231
+ _forEachInstanceProperty(_context21 = _Object$keys(_scrollBox)).call(_context21, function (key) {
232
+ if (key === "default" || key === "__esModule") return;
233
+ if (key in exports && exports[key] === _scrollBox[key]) return;
234
+ _Object$defineProperty(exports, key, {
235
+ enumerable: true,
236
+ get: function get() {
237
+ return _scrollBox[key];
238
+ }
239
+ });
240
+ });
230
241
  var _separator = require("./separator");
231
- _forEachInstanceProperty(_context21 = _Object$keys(_separator)).call(_context21, function (key) {
242
+ _forEachInstanceProperty(_context22 = _Object$keys(_separator)).call(_context22, function (key) {
232
243
  if (key === "default" || key === "__esModule") return;
233
244
  if (key in exports && exports[key] === _separator[key]) return;
234
245
  _Object$defineProperty(exports, key, {
@@ -239,7 +250,7 @@ _forEachInstanceProperty(_context21 = _Object$keys(_separator)).call(_context21,
239
250
  });
240
251
  });
241
252
  var _shared = require("./shared");
242
- _forEachInstanceProperty(_context22 = _Object$keys(_shared)).call(_context22, function (key) {
253
+ _forEachInstanceProperty(_context23 = _Object$keys(_shared)).call(_context23, function (key) {
243
254
  if (key === "default" || key === "__esModule") return;
244
255
  if (key in exports && exports[key] === _shared[key]) return;
245
256
  _Object$defineProperty(exports, key, {
@@ -250,7 +261,7 @@ _forEachInstanceProperty(_context22 = _Object$keys(_shared)).call(_context22, fu
250
261
  });
251
262
  });
252
263
  var _table = require("./table");
253
- _forEachInstanceProperty(_context23 = _Object$keys(_table)).call(_context23, function (key) {
264
+ _forEachInstanceProperty(_context24 = _Object$keys(_table)).call(_context24, function (key) {
254
265
  if (key === "default" || key === "__esModule") return;
255
266
  if (key in exports && exports[key] === _table[key]) return;
256
267
  _Object$defineProperty(exports, key, {
@@ -261,7 +272,7 @@ _forEachInstanceProperty(_context23 = _Object$keys(_table)).call(_context23, fun
261
272
  });
262
273
  });
263
274
  var _text = require("./text");
264
- _forEachInstanceProperty(_context24 = _Object$keys(_text)).call(_context24, function (key) {
275
+ _forEachInstanceProperty(_context25 = _Object$keys(_text)).call(_context25, function (key) {
265
276
  if (key === "default" || key === "__esModule") return;
266
277
  if (key in exports && exports[key] === _text[key]) return;
267
278
  _Object$defineProperty(exports, key, {
@@ -272,7 +283,7 @@ _forEachInstanceProperty(_context24 = _Object$keys(_text)).call(_context24, func
272
283
  });
273
284
  });
274
285
  var _tooltipTrigger = require("./tooltipTrigger");
275
- _forEachInstanceProperty(_context25 = _Object$keys(_tooltipTrigger)).call(_context25, function (key) {
286
+ _forEachInstanceProperty(_context26 = _Object$keys(_tooltipTrigger)).call(_context26, function (key) {
276
287
  if (key === "default" || key === "__esModule") return;
277
288
  if (key in exports && exports[key] === _tooltipTrigger[key]) return;
278
289
  _Object$defineProperty(exports, key, {
@@ -0,0 +1,9 @@
1
+ import { UIEventHandler } from 'react';
2
+ import { FocusableElement } from './shared/dom';
3
+ import { BoxProps } from './box';
4
+ export interface ScrollBoxProps extends BoxProps {
5
+ /** Callback that fires when scrolling is done inside the ScrollBox */
6
+ onScroll?: UIEventHandler<FocusableElement>;
7
+ /** If true the box will render top and bottom shadows with scroll */
8
+ hasShadows?: boolean;
9
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
+ _Object$defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
@@ -13,9 +13,8 @@ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectW
13
13
  var _excluded = ["maxHeight", "children", "sx", "hasShadows", "onScroll"];
14
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
15
  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; }
16
- import React, { forwardRef, useImperativeHandle, useLayoutEffect, useRef, useState } from 'react';
17
- import PropTypes from 'prop-types';
18
- import useStatusClasses from '../../hooks/useStatusClasses';
16
+ import React, { forwardRef, useLayoutEffect, useState } from 'react';
17
+ import { useLocalOrForwardRef, useStatusClasses } from '../../hooks';
19
18
  import Box from '../Box';
20
19
  import { jsx as ___EmotionJSX } from "@emotion/react";
21
20
  var ScrollBox = /*#__PURE__*/forwardRef(function (props, ref) {
@@ -37,28 +36,27 @@ var ScrollBox = /*#__PURE__*/forwardRef(function (props, ref) {
37
36
  _useState6 = _slicedToArray(_useState5, 2),
38
37
  isBottomShadowShowing = _useState6[0],
39
38
  setIsBottomShadowShowing = _useState6[1];
40
- var outerRef = useRef();
41
- /* istanbul ignore next */
42
- useImperativeHandle(ref, function () {
43
- return outerRef.current;
44
- });
39
+ var outerRef = useLocalOrForwardRef(ref);
45
40
 
46
41
  /* istanbul ignore next */
47
42
  useLayoutEffect(function () {
48
- if (outerRef.current && outerRef.current.firstChild) {
49
- if (outerRef.current.firstChild.offsetHeight !== 0) {
50
- setIsBottomShadowShowing(outerRef.current.firstChild.scrollHeight - outerRef.current.firstChild.offsetHeight !== outerRef.current.firstChild.scrollTop);
51
- setIsTopShadowShowing(outerRef.current.firstChild.scrollTop !== 0);
43
+ var _outerRef$current;
44
+ var firstChildNode = (_outerRef$current = outerRef.current) === null || _outerRef$current === void 0 ? void 0 : _outerRef$current.firstChild;
45
+ if (outerRef.current && firstChildNode) {
46
+ if (firstChildNode.offsetHeight !== 0) {
47
+ firstChildNode.setAttribute('tabindex', '0');
48
+ setIsBottomShadowShowing(firstChildNode.scrollHeight - firstChildNode.offsetHeight !== firstChildNode.scrollTop);
49
+ setIsTopShadowShowing(firstChildNode.scrollTop !== 0);
52
50
  }
53
51
  }
54
52
  }, [scrollTopPosition]);
55
53
 
56
54
  /* istanbul ignore next */
57
55
  var onScroll = function onScroll() {
58
- var _outerRef$current;
59
- if ((_outerRef$current = outerRef.current) !== null && _outerRef$current !== void 0 && _outerRef$current.firstChild) {
60
- var _outerRef$current2;
61
- setScrollTopPosition((_outerRef$current2 = outerRef.current) === null || _outerRef$current2 === void 0 || (_outerRef$current2 = _outerRef$current2.firstChild) === null || _outerRef$current2 === void 0 ? void 0 : _outerRef$current2.scrollTop);
56
+ var _outerRef$current2;
57
+ var firstChildNode = (_outerRef$current2 = outerRef.current) === null || _outerRef$current2 === void 0 ? void 0 : _outerRef$current2.firstChild;
58
+ if (firstChildNode) {
59
+ setScrollTopPosition(firstChildNode.scrollTop);
62
60
  }
63
61
  };
64
62
  var _useStatusClasses = useStatusClasses('', {
@@ -89,12 +87,4 @@ ScrollBox.defaultProps = {
89
87
  maxHeight: '100%',
90
88
  hasShadows: false
91
89
  };
92
- ScrollBox.propTypes = {
93
- /** Height at which the content within ScrollBox will overflow */
94
- maxHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.number]),
95
- /** Callback that fires when scrolling is done inside the ScrollBox */
96
- onScroll: PropTypes.func,
97
- /** If true the box will render top and bottom shadows with scroll */
98
- hasShadows: PropTypes.bool
99
- };
100
90
  export default ScrollBox;
@@ -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 { Box, ScrollBox } from '../../index';
6
- import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.ts';
6
+ import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks';
7
7
  import ScrollBoxReadme from './ScrollBox.mdx';
8
8
  import { jsx as ___EmotionJSX } from "@emotion/react";
9
9
  export default {
@@ -18,6 +18,7 @@ export * from './overlayPanel';
18
18
  export * from './popoverContainer';
19
19
  export * from './popoverMenu';
20
20
  export * from './rockerButtonGroup';
21
+ export * from './scrollBox';
21
22
  export * from './separator';
22
23
  export * from './shared';
23
24
  export * from './table';
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.48.0-alpha.0",
3
+ "version": "2.48.0-alpha.1",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",