@pingux/astro 2.47.0 → 2.48.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.
- package/lib/cjs/components/HelpHint/HelpHint.d.ts +4 -0
- package/lib/cjs/components/HelpHint/HelpHint.js +9 -49
- package/lib/cjs/components/HelpHint/HelpHint.stories.d.ts +8 -0
- package/lib/cjs/components/HelpHint/HelpHint.stories.js +2 -2
- package/lib/cjs/components/HelpHint/HelpHint.styles.d.ts +82 -0
- package/lib/cjs/components/HelpHint/HelpHint.test.d.ts +1 -0
- package/lib/cjs/components/HelpHint/index.d.ts +1 -0
- package/lib/cjs/components/IconButton/IconButton.styles.d.ts +51 -1
- package/lib/cjs/types/helpHint.d.ts +48 -0
- package/lib/cjs/types/helpHint.js +6 -0
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +29 -18
- package/lib/cjs/types/popoverContainer.d.ts +2 -1
- package/lib/components/HelpHint/HelpHint.js +11 -51
- package/lib/components/HelpHint/HelpHint.stories.js +2 -2
- package/lib/types/helpHint.js +1 -0
- package/lib/types/index.js +1 -0
- package/package.json +2 -1
@@ -19,12 +19,11 @@ var _react = _interopRequireWildcard(require("react"));
|
|
19
19
|
var _reactAria = require("react-aria");
|
20
20
|
var _reactStately = require("react-stately");
|
21
21
|
var _interactions = require("@react-aria/interactions");
|
22
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
23
22
|
var _ = require("../..");
|
24
23
|
var _hooks = require("../../hooks");
|
25
24
|
var _safariAgent = require("../../styles/safariAgent");
|
26
25
|
var _react2 = require("@emotion/react");
|
27
|
-
var _excluded = ["align", "arrowCrossOffset", "children", "className", "closeDelay", "direction", "hasNoArrow", "iconButtonProps", "isDarkMode", "isNotFlippable", "
|
26
|
+
var _excluded = ["align", "arrowCrossOffset", "children", "className", "closeDelay", "direction", "hasNoArrow", "iconButtonProps", "isDarkMode", "isNotFlippable", "popoverProps", "tooltipProps"];
|
28
27
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
29
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
30
29
|
var HelpIcon = function HelpIcon() {
|
@@ -54,7 +53,6 @@ var HelpHint = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
54
53
|
iconButtonProps = props.iconButtonProps,
|
55
54
|
isDarkMode = props.isDarkMode,
|
56
55
|
isNotFlippable = props.isNotFlippable,
|
57
|
-
offset = props.offset,
|
58
56
|
popoverProps = props.popoverProps,
|
59
57
|
tooltipProps = props.tooltipProps,
|
60
58
|
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
@@ -68,8 +66,8 @@ var HelpHint = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
68
66
|
}
|
69
67
|
}),
|
70
68
|
focusWithinProps = _useFocusWithin.focusWithinProps;
|
71
|
-
var overlayRef = (0, _react.useRef)();
|
72
|
-
var triggerRef = (0,
|
69
|
+
var overlayRef = (0, _react.useRef)(null);
|
70
|
+
var triggerRef = (0, _hooks.useLocalOrForwardRef)(ref);
|
73
71
|
var _useFocusRing = (0, _reactAria.useFocusRing)(),
|
74
72
|
focusProps = _useFocusRing.focusProps,
|
75
73
|
isFocusVisible = _useFocusRing.isFocusVisible;
|
@@ -89,11 +87,6 @@ var HelpHint = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
89
87
|
triggerProps = _useOverlayTrigger.triggerProps,
|
90
88
|
overlayProps = _useOverlayTrigger.overlayProps;
|
91
89
|
|
92
|
-
/* istanbul ignore next */
|
93
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
94
|
-
return triggerRef.current;
|
95
|
-
});
|
96
|
-
|
97
90
|
// Set a timeout to close the overlay upon hover / focus loss,
|
98
91
|
// but keep it open if the trigger or overlay are hovered again before it closes.
|
99
92
|
(0, _react.useEffect)(function () {
|
@@ -130,14 +123,14 @@ var HelpHint = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
130
123
|
isDarkMode: isDarkMode
|
131
124
|
}),
|
132
125
|
classNames = _useStatusClasses.classNames;
|
133
|
-
var addIsSafariCompatiblePropToLinkChildren = function addIsSafariCompatiblePropToLinkChildren(
|
134
|
-
if (
|
126
|
+
var addIsSafariCompatiblePropToLinkChildren = function addIsSafariCompatiblePropToLinkChildren(element) {
|
127
|
+
if (element) {
|
135
128
|
var _context2;
|
136
|
-
return (0, _map["default"])(_context2 = _react["default"].Children).call(_context2,
|
129
|
+
return (0, _map["default"])(_context2 = _react["default"].Children).call(_context2, element, function (child) {
|
137
130
|
if (! /*#__PURE__*/_react["default"].isValidElement(child)) return child;
|
138
131
|
return /*#__PURE__*/_react["default"].cloneElement(child, {
|
139
132
|
children: addIsSafariCompatiblePropToLinkChildren(child.props.children),
|
140
|
-
isSafariCompatible: child.type.
|
133
|
+
isSafariCompatible: typeof child.type === 'string' && child.type === 'Link'
|
141
134
|
});
|
142
135
|
});
|
143
136
|
}
|
@@ -163,10 +156,10 @@ var HelpHint = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
163
156
|
hasNoArrow: hasNoArrow,
|
164
157
|
isDismissable: isFocusWithinOverlay ? !isOpen : true,
|
165
158
|
isNonModal: true,
|
166
|
-
isOpen: isOpen,
|
167
159
|
onClose: close,
|
168
160
|
placement: placement,
|
169
|
-
ref: overlayRef
|
161
|
+
ref: overlayRef,
|
162
|
+
isOpen: isOpen
|
170
163
|
}, (0, _reactAria.mergeProps)(overlayProps, positionProps, popoverProps || tooltipProps, overlayHoverProps, focusWithinProps)), (0, _react2.jsx)(_reactAria.FocusScope, {
|
171
164
|
restoreFocus: true,
|
172
165
|
autoFocus: isFocusVisible
|
@@ -175,39 +168,6 @@ var HelpHint = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
175
168
|
role: "status"
|
176
169
|
}, _safariAgent.isSafari ? addIsSafariCompatiblePropToLinkChildren(children) : children))));
|
177
170
|
});
|
178
|
-
HelpHint.propTypes = {
|
179
|
-
/** Props object that is spread directly into the popover element. */
|
180
|
-
popoverProps: _propTypes["default"].shape({}),
|
181
|
-
/** @ignore Alias for `popoverProps` prop. Exists for backwards-compatibility. */
|
182
|
-
tooltipProps: _propTypes["default"].shape({}),
|
183
|
-
/** Props object that is spread directly into the IconButton element. */
|
184
|
-
iconButtonProps: _propTypes["default"].shape({}),
|
185
|
-
/** Defaults to true, displays dark popover with white text */
|
186
|
-
isDarkMode: _propTypes["default"].bool,
|
187
|
-
/** Where the popover menu opens relative to its trigger. */
|
188
|
-
direction: _propTypes["default"].oneOf(['top', 'right', 'bottom', 'left']),
|
189
|
-
/**
|
190
|
-
* Whether the popover is prevented from flipping directions when insufficient space is
|
191
|
-
* available for the given `direction` placement.
|
192
|
-
*/
|
193
|
-
isNotFlippable: _propTypes["default"].bool,
|
194
|
-
/** Alignment of the popover menu relative to the trigger. */
|
195
|
-
align: _propTypes["default"].oneOf(['start', 'end', 'middle']),
|
196
|
-
/**
|
197
|
-
* Allows to add an arrow to popover container
|
198
|
-
*/
|
199
|
-
hasNoArrow: _propTypes["default"].bool,
|
200
|
-
/** Popover offset relative to its trigger. */
|
201
|
-
offset: _propTypes["default"].number,
|
202
|
-
/** Arrow offset relative to the left of the popover.
|
203
|
-
* Must be passed as a px or percentage. */
|
204
|
-
arrowCrossOffset: _propTypes["default"].string,
|
205
|
-
/** The additional offset applied along the cross axis
|
206
|
-
* between the element and its anchor element. */
|
207
|
-
crossOffset: _propTypes["default"].number,
|
208
|
-
/** Amount of time before the popover closes */
|
209
|
-
closeDelay: _propTypes["default"].number
|
210
|
-
};
|
211
171
|
HelpHint.defaultProps = {
|
212
172
|
align: 'middle',
|
213
173
|
direction: 'top',
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { StoryFn } from '@storybook/react';
|
2
|
+
import { HelpHintProps } 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<HelpHintProps>;
|
6
|
+
export declare const WithPopoverAndIconButtonProps: StoryFn;
|
7
|
+
export declare const ContentWithLink: StoryFn;
|
8
|
+
export declare const WithDelay: StoryFn;
|
@@ -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
|
14
|
+
var _figmaLinks = require("../../utils/designUtils/figmaLinks");
|
15
15
|
var _HelpHint = _interopRequireDefault(require("./HelpHint.mdx"));
|
16
16
|
var _react2 = require("@emotion/react");
|
17
17
|
var _default = {
|
@@ -55,7 +55,7 @@ var WithPopoverAndIconButtonProps = function WithPopoverAndIconButtonProps() {
|
|
55
55
|
p: 50
|
56
56
|
}, (0, _react2.jsx)(_index.HelpHint, {
|
57
57
|
popoverProps: {
|
58
|
-
'data-
|
58
|
+
'data-testid': 'popover-container'
|
59
59
|
},
|
60
60
|
iconButtonProps: {
|
61
61
|
'aria-label': 'Help hint'
|
@@ -0,0 +1,82 @@
|
|
1
|
+
export declare const hintButton: {
|
2
|
+
bg: string;
|
3
|
+
borderColor: string;
|
4
|
+
mt: string;
|
5
|
+
mb: string;
|
6
|
+
ml: string;
|
7
|
+
maxWidth: string;
|
8
|
+
maxHeight: string;
|
9
|
+
borderRadius: string;
|
10
|
+
svg: {
|
11
|
+
height: string;
|
12
|
+
mb: number;
|
13
|
+
};
|
14
|
+
path: {
|
15
|
+
fill: string;
|
16
|
+
};
|
17
|
+
'&.is-hovered': {
|
18
|
+
bg: string;
|
19
|
+
borderColor: string;
|
20
|
+
path: {
|
21
|
+
fill: string;
|
22
|
+
};
|
23
|
+
color: string;
|
24
|
+
boxShadow: string;
|
25
|
+
};
|
26
|
+
'&.is-focused': {
|
27
|
+
outline: string;
|
28
|
+
outlineColor: string;
|
29
|
+
outlineOffset: string;
|
30
|
+
};
|
31
|
+
'&.is-pressed': {
|
32
|
+
bg: string;
|
33
|
+
borderColor: string;
|
34
|
+
color: string;
|
35
|
+
path: {
|
36
|
+
fill: string;
|
37
|
+
};
|
38
|
+
};
|
39
|
+
};
|
40
|
+
declare const _default: {
|
41
|
+
hintButton: {
|
42
|
+
bg: string;
|
43
|
+
borderColor: string;
|
44
|
+
mt: string;
|
45
|
+
mb: string;
|
46
|
+
ml: string;
|
47
|
+
maxWidth: string;
|
48
|
+
maxHeight: string;
|
49
|
+
borderRadius: string;
|
50
|
+
svg: {
|
51
|
+
height: string;
|
52
|
+
mb: number;
|
53
|
+
};
|
54
|
+
path: {
|
55
|
+
fill: string;
|
56
|
+
};
|
57
|
+
'&.is-hovered': {
|
58
|
+
bg: string;
|
59
|
+
borderColor: string;
|
60
|
+
path: {
|
61
|
+
fill: string;
|
62
|
+
};
|
63
|
+
color: string;
|
64
|
+
boxShadow: string;
|
65
|
+
};
|
66
|
+
'&.is-focused': {
|
67
|
+
outline: string;
|
68
|
+
outlineColor: string;
|
69
|
+
outlineOffset: string;
|
70
|
+
};
|
71
|
+
'&.is-pressed': {
|
72
|
+
bg: string;
|
73
|
+
borderColor: string;
|
74
|
+
color: string;
|
75
|
+
path: {
|
76
|
+
fill: string;
|
77
|
+
};
|
78
|
+
};
|
79
|
+
};
|
80
|
+
popoverContainer: any;
|
81
|
+
};
|
82
|
+
export default _default;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './HelpHint';
|
@@ -171,7 +171,57 @@ declare const _default: {
|
|
171
171
|
datePicker: {
|
172
172
|
containedIcon: any;
|
173
173
|
};
|
174
|
-
hintButton:
|
174
|
+
hintButton: {
|
175
|
+
bg: string;
|
176
|
+
borderColor: string;
|
177
|
+
mt: string;
|
178
|
+
mb: string;
|
179
|
+
ml: string;
|
180
|
+
maxWidth: string;
|
181
|
+
maxHeight: string;
|
182
|
+
borderRadius: string;
|
183
|
+
svg: {
|
184
|
+
height: string;
|
185
|
+
mb: number;
|
186
|
+
};
|
187
|
+
path: {
|
188
|
+
fill: string;
|
189
|
+
};
|
190
|
+
'&.is-hovered': {
|
191
|
+
bg: string;
|
192
|
+
borderColor: string;
|
193
|
+
path: {
|
194
|
+
fill: string;
|
195
|
+
};
|
196
|
+
color: string;
|
197
|
+
boxShadow: string;
|
198
|
+
};
|
199
|
+
'&.is-focused': {
|
200
|
+
outline: string;
|
201
|
+
outlineColor: string;
|
202
|
+
outlineOffset: string;
|
203
|
+
};
|
204
|
+
'&.is-pressed': {
|
205
|
+
bg: string;
|
206
|
+
borderColor: string;
|
207
|
+
color: string;
|
208
|
+
path: {
|
209
|
+
fill: string;
|
210
|
+
};
|
211
|
+
};
|
212
|
+
justifyContent: string;
|
213
|
+
appearance: string;
|
214
|
+
alignItems: string;
|
215
|
+
alignSelf: string;
|
216
|
+
display: string;
|
217
|
+
flexGrow: number;
|
218
|
+
flexShrink: number;
|
219
|
+
cursor: string;
|
220
|
+
p: string;
|
221
|
+
width: string;
|
222
|
+
height: string;
|
223
|
+
outline: string;
|
224
|
+
};
|
175
225
|
inverted: {
|
176
226
|
bg: string;
|
177
227
|
borderColor: string;
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
import { DOMAttributes } from './shared/dom';
|
3
|
+
import { TestingAttributes } from './shared/test';
|
4
|
+
import { IconButtonProps } from './iconButton';
|
5
|
+
import { PopoverContainerProps } from './popoverContainer';
|
6
|
+
import { Axis } from './shared';
|
7
|
+
import { TooltipProps } from './tooltipTrigger';
|
8
|
+
interface TooltipWrapperProps extends TooltipProps {
|
9
|
+
isOpen?: boolean;
|
10
|
+
}
|
11
|
+
export interface HelpHintProps extends DOMAttributes, TestingAttributes {
|
12
|
+
/** Props object that is spread directly into the popover element. */
|
13
|
+
popoverProps?: PopoverContainerProps;
|
14
|
+
/** @ignore Alias for `popoverProps` prop. Exists for backwards-compatibility. */
|
15
|
+
tooltipProps?: TooltipWrapperProps;
|
16
|
+
/** Props object that is spread directly into the IconButton element. */
|
17
|
+
iconButtonProps?: IconButtonProps;
|
18
|
+
/** Defaults to true, displays dark popover with white text */
|
19
|
+
isDarkMode?: boolean;
|
20
|
+
/** Where the popover menu opens relative to its trigger. */
|
21
|
+
direction?: Axis;
|
22
|
+
/**
|
23
|
+
* Whether the popover is prevented from flipping directions when insufficient space is
|
24
|
+
* available for the given `direction` placement.
|
25
|
+
*/
|
26
|
+
isNotFlippable?: boolean;
|
27
|
+
/** Alignment of the popover menu relative to the trigger. */
|
28
|
+
align?: 'start' | 'end' | 'middle';
|
29
|
+
/**
|
30
|
+
* Allows to add an arrow to popover container
|
31
|
+
*/
|
32
|
+
hasNoArrow?: boolean;
|
33
|
+
/** Popover offset relative to its trigger. */
|
34
|
+
offset?: number;
|
35
|
+
/** Arrow offset relative to the left of the popover.
|
36
|
+
* Must be passed as a px or percentage. */
|
37
|
+
arrowCrossOffset?: string;
|
38
|
+
/** The additional offset applied along the cross axis
|
39
|
+
* between the element and its anchor element. */
|
40
|
+
crossOffset?: number;
|
41
|
+
/** Amount of time before the popover closes */
|
42
|
+
closeDelay?: number;
|
43
|
+
/** Children node */
|
44
|
+
children?: ReactNode;
|
45
|
+
/** Safari compatible flag */
|
46
|
+
isSafariCompatible?: boolean;
|
47
|
+
}
|
48
|
+
export {};
|
package/lib/cjs/types/index.d.ts
CHANGED
package/lib/cjs/types/index.js
CHANGED
@@ -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;
|
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;
|
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");
|
@@ -84,8 +84,19 @@ _forEachInstanceProperty(_context7 = _Object$keys(_fieldHelperText)).call(_conte
|
|
84
84
|
}
|
85
85
|
});
|
86
86
|
});
|
87
|
+
var _helpHint = require("./helpHint");
|
88
|
+
_forEachInstanceProperty(_context8 = _Object$keys(_helpHint)).call(_context8, function (key) {
|
89
|
+
if (key === "default" || key === "__esModule") return;
|
90
|
+
if (key in exports && exports[key] === _helpHint[key]) return;
|
91
|
+
_Object$defineProperty(exports, key, {
|
92
|
+
enumerable: true,
|
93
|
+
get: function get() {
|
94
|
+
return _helpHint[key];
|
95
|
+
}
|
96
|
+
});
|
97
|
+
});
|
87
98
|
var _icon = require("./icon");
|
88
|
-
_forEachInstanceProperty(
|
99
|
+
_forEachInstanceProperty(_context9 = _Object$keys(_icon)).call(_context9, function (key) {
|
89
100
|
if (key === "default" || key === "__esModule") return;
|
90
101
|
if (key in exports && exports[key] === _icon[key]) return;
|
91
102
|
_Object$defineProperty(exports, key, {
|
@@ -96,7 +107,7 @@ _forEachInstanceProperty(_context8 = _Object$keys(_icon)).call(_context8, functi
|
|
96
107
|
});
|
97
108
|
});
|
98
109
|
var _iconBadge = require("./iconBadge");
|
99
|
-
_forEachInstanceProperty(
|
110
|
+
_forEachInstanceProperty(_context10 = _Object$keys(_iconBadge)).call(_context10, function (key) {
|
100
111
|
if (key === "default" || key === "__esModule") return;
|
101
112
|
if (key in exports && exports[key] === _iconBadge[key]) return;
|
102
113
|
_Object$defineProperty(exports, key, {
|
@@ -107,7 +118,7 @@ _forEachInstanceProperty(_context9 = _Object$keys(_iconBadge)).call(_context9, f
|
|
107
118
|
});
|
108
119
|
});
|
109
120
|
var _iconButton = require("./iconButton");
|
110
|
-
_forEachInstanceProperty(
|
121
|
+
_forEachInstanceProperty(_context11 = _Object$keys(_iconButton)).call(_context11, function (key) {
|
111
122
|
if (key === "default" || key === "__esModule") return;
|
112
123
|
if (key in exports && exports[key] === _iconButton[key]) return;
|
113
124
|
_Object$defineProperty(exports, key, {
|
@@ -118,7 +129,7 @@ _forEachInstanceProperty(_context10 = _Object$keys(_iconButton)).call(_context10
|
|
118
129
|
});
|
119
130
|
});
|
120
131
|
var _input = require("./input");
|
121
|
-
_forEachInstanceProperty(
|
132
|
+
_forEachInstanceProperty(_context12 = _Object$keys(_input)).call(_context12, function (key) {
|
122
133
|
if (key === "default" || key === "__esModule") return;
|
123
134
|
if (key in exports && exports[key] === _input[key]) return;
|
124
135
|
_Object$defineProperty(exports, key, {
|
@@ -129,7 +140,7 @@ _forEachInstanceProperty(_context11 = _Object$keys(_input)).call(_context11, fun
|
|
129
140
|
});
|
130
141
|
});
|
131
142
|
var _item = require("./item");
|
132
|
-
_forEachInstanceProperty(
|
143
|
+
_forEachInstanceProperty(_context13 = _Object$keys(_item)).call(_context13, function (key) {
|
133
144
|
if (key === "default" || key === "__esModule") return;
|
134
145
|
if (key in exports && exports[key] === _item[key]) return;
|
135
146
|
_Object$defineProperty(exports, key, {
|
@@ -140,7 +151,7 @@ _forEachInstanceProperty(_context12 = _Object$keys(_item)).call(_context12, func
|
|
140
151
|
});
|
141
152
|
});
|
142
153
|
var _link = require("./link");
|
143
|
-
_forEachInstanceProperty(
|
154
|
+
_forEachInstanceProperty(_context14 = _Object$keys(_link)).call(_context14, function (key) {
|
144
155
|
if (key === "default" || key === "__esModule") return;
|
145
156
|
if (key in exports && exports[key] === _link[key]) return;
|
146
157
|
_Object$defineProperty(exports, key, {
|
@@ -151,7 +162,7 @@ _forEachInstanceProperty(_context13 = _Object$keys(_link)).call(_context13, func
|
|
151
162
|
});
|
152
163
|
});
|
153
164
|
var _listItem = require("./listItem");
|
154
|
-
_forEachInstanceProperty(
|
165
|
+
_forEachInstanceProperty(_context15 = _Object$keys(_listItem)).call(_context15, function (key) {
|
155
166
|
if (key === "default" || key === "__esModule") return;
|
156
167
|
if (key in exports && exports[key] === _listItem[key]) return;
|
157
168
|
_Object$defineProperty(exports, key, {
|
@@ -162,7 +173,7 @@ _forEachInstanceProperty(_context14 = _Object$keys(_listItem)).call(_context14,
|
|
162
173
|
});
|
163
174
|
});
|
164
175
|
var _loader = require("./loader");
|
165
|
-
_forEachInstanceProperty(
|
176
|
+
_forEachInstanceProperty(_context16 = _Object$keys(_loader)).call(_context16, function (key) {
|
166
177
|
if (key === "default" || key === "__esModule") return;
|
167
178
|
if (key in exports && exports[key] === _loader[key]) return;
|
168
179
|
_Object$defineProperty(exports, key, {
|
@@ -173,7 +184,7 @@ _forEachInstanceProperty(_context15 = _Object$keys(_loader)).call(_context15, fu
|
|
173
184
|
});
|
174
185
|
});
|
175
186
|
var _overlayPanel = require("./overlayPanel");
|
176
|
-
_forEachInstanceProperty(
|
187
|
+
_forEachInstanceProperty(_context17 = _Object$keys(_overlayPanel)).call(_context17, function (key) {
|
177
188
|
if (key === "default" || key === "__esModule") return;
|
178
189
|
if (key in exports && exports[key] === _overlayPanel[key]) return;
|
179
190
|
_Object$defineProperty(exports, key, {
|
@@ -184,7 +195,7 @@ _forEachInstanceProperty(_context16 = _Object$keys(_overlayPanel)).call(_context
|
|
184
195
|
});
|
185
196
|
});
|
186
197
|
var _popoverContainer = require("./popoverContainer");
|
187
|
-
_forEachInstanceProperty(
|
198
|
+
_forEachInstanceProperty(_context18 = _Object$keys(_popoverContainer)).call(_context18, function (key) {
|
188
199
|
if (key === "default" || key === "__esModule") return;
|
189
200
|
if (key in exports && exports[key] === _popoverContainer[key]) return;
|
190
201
|
_Object$defineProperty(exports, key, {
|
@@ -195,7 +206,7 @@ _forEachInstanceProperty(_context17 = _Object$keys(_popoverContainer)).call(_con
|
|
195
206
|
});
|
196
207
|
});
|
197
208
|
var _popoverMenu = require("./popoverMenu");
|
198
|
-
_forEachInstanceProperty(
|
209
|
+
_forEachInstanceProperty(_context19 = _Object$keys(_popoverMenu)).call(_context19, function (key) {
|
199
210
|
if (key === "default" || key === "__esModule") return;
|
200
211
|
if (key in exports && exports[key] === _popoverMenu[key]) return;
|
201
212
|
_Object$defineProperty(exports, key, {
|
@@ -206,7 +217,7 @@ _forEachInstanceProperty(_context18 = _Object$keys(_popoverMenu)).call(_context1
|
|
206
217
|
});
|
207
218
|
});
|
208
219
|
var _rockerButtonGroup = require("./rockerButtonGroup");
|
209
|
-
_forEachInstanceProperty(
|
220
|
+
_forEachInstanceProperty(_context20 = _Object$keys(_rockerButtonGroup)).call(_context20, function (key) {
|
210
221
|
if (key === "default" || key === "__esModule") return;
|
211
222
|
if (key in exports && exports[key] === _rockerButtonGroup[key]) return;
|
212
223
|
_Object$defineProperty(exports, key, {
|
@@ -217,7 +228,7 @@ _forEachInstanceProperty(_context19 = _Object$keys(_rockerButtonGroup)).call(_co
|
|
217
228
|
});
|
218
229
|
});
|
219
230
|
var _separator = require("./separator");
|
220
|
-
_forEachInstanceProperty(
|
231
|
+
_forEachInstanceProperty(_context21 = _Object$keys(_separator)).call(_context21, function (key) {
|
221
232
|
if (key === "default" || key === "__esModule") return;
|
222
233
|
if (key in exports && exports[key] === _separator[key]) return;
|
223
234
|
_Object$defineProperty(exports, key, {
|
@@ -228,7 +239,7 @@ _forEachInstanceProperty(_context20 = _Object$keys(_separator)).call(_context20,
|
|
228
239
|
});
|
229
240
|
});
|
230
241
|
var _shared = require("./shared");
|
231
|
-
_forEachInstanceProperty(
|
242
|
+
_forEachInstanceProperty(_context22 = _Object$keys(_shared)).call(_context22, function (key) {
|
232
243
|
if (key === "default" || key === "__esModule") return;
|
233
244
|
if (key in exports && exports[key] === _shared[key]) return;
|
234
245
|
_Object$defineProperty(exports, key, {
|
@@ -239,7 +250,7 @@ _forEachInstanceProperty(_context21 = _Object$keys(_shared)).call(_context21, fu
|
|
239
250
|
});
|
240
251
|
});
|
241
252
|
var _table = require("./table");
|
242
|
-
_forEachInstanceProperty(
|
253
|
+
_forEachInstanceProperty(_context23 = _Object$keys(_table)).call(_context23, function (key) {
|
243
254
|
if (key === "default" || key === "__esModule") return;
|
244
255
|
if (key in exports && exports[key] === _table[key]) return;
|
245
256
|
_Object$defineProperty(exports, key, {
|
@@ -250,7 +261,7 @@ _forEachInstanceProperty(_context22 = _Object$keys(_table)).call(_context22, fun
|
|
250
261
|
});
|
251
262
|
});
|
252
263
|
var _text = require("./text");
|
253
|
-
_forEachInstanceProperty(
|
264
|
+
_forEachInstanceProperty(_context24 = _Object$keys(_text)).call(_context24, function (key) {
|
254
265
|
if (key === "default" || key === "__esModule") return;
|
255
266
|
if (key in exports && exports[key] === _text[key]) return;
|
256
267
|
_Object$defineProperty(exports, key, {
|
@@ -261,7 +272,7 @@ _forEachInstanceProperty(_context23 = _Object$keys(_text)).call(_context23, func
|
|
261
272
|
});
|
262
273
|
});
|
263
274
|
var _tooltipTrigger = require("./tooltipTrigger");
|
264
|
-
_forEachInstanceProperty(
|
275
|
+
_forEachInstanceProperty(_context25 = _Object$keys(_tooltipTrigger)).call(_context25, function (key) {
|
265
276
|
if (key === "default" || key === "__esModule") return;
|
266
277
|
if (key in exports && exports[key] === _tooltipTrigger[key]) return;
|
267
278
|
_Object$defineProperty(exports, key, {
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { TestingAttributes } from './shared/test';
|
1
2
|
import { DOMAttributes, Modify, StyleProps } from './shared';
|
2
3
|
type PopoverPlacement = 'top' | 'right' | 'bottom' | 'left';
|
3
4
|
type StylePropsExtended = Modify<StyleProps, {
|
@@ -6,7 +7,7 @@ type StylePropsExtended = Modify<StyleProps, {
|
|
6
7
|
export interface PopoverArrowProps extends DOMAttributes, StylePropsExtended {
|
7
8
|
arrowCrossOffset?: string;
|
8
9
|
}
|
9
|
-
export interface PopoverContainerProps extends StylePropsExtended, DOMAttributes {
|
10
|
+
export interface PopoverContainerProps extends StylePropsExtended, DOMAttributes, TestingAttributes {
|
10
11
|
placement?: string;
|
11
12
|
arrowProps?: PopoverArrowProps;
|
12
13
|
arrowCrossOffset?: string;
|
@@ -1,17 +1,16 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
3
3
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
4
|
-
var _excluded = ["align", "arrowCrossOffset", "children", "className", "closeDelay", "direction", "hasNoArrow", "iconButtonProps", "isDarkMode", "isNotFlippable", "
|
4
|
+
var _excluded = ["align", "arrowCrossOffset", "children", "className", "closeDelay", "direction", "hasNoArrow", "iconButtonProps", "isDarkMode", "isNotFlippable", "popoverProps", "tooltipProps"];
|
5
5
|
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
6
6
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
7
7
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
8
|
-
import React, { forwardRef, useEffect,
|
8
|
+
import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
9
9
|
import { FocusScope, mergeProps, useFocusRing, useFocusWithin, useOverlayPosition, useOverlayTrigger } from 'react-aria';
|
10
10
|
import { useOverlayTriggerState } from 'react-stately';
|
11
11
|
import { useHover } from '@react-aria/interactions';
|
12
|
-
import PropTypes from 'prop-types';
|
13
12
|
import { Box, Icon, IconButton, PopoverContainer } from '../..';
|
14
|
-
import { useStatusClasses } from '../../hooks';
|
13
|
+
import { useLocalOrForwardRef, useStatusClasses } from '../../hooks';
|
15
14
|
import { isSafari } from '../../styles/safariAgent';
|
16
15
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
17
16
|
var HelpIcon = function HelpIcon() {
|
@@ -41,7 +40,6 @@ var HelpHint = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
41
40
|
iconButtonProps = props.iconButtonProps,
|
42
41
|
isDarkMode = props.isDarkMode,
|
43
42
|
isNotFlippable = props.isNotFlippable,
|
44
|
-
offset = props.offset,
|
45
43
|
popoverProps = props.popoverProps,
|
46
44
|
tooltipProps = props.tooltipProps,
|
47
45
|
others = _objectWithoutProperties(props, _excluded);
|
@@ -55,8 +53,8 @@ var HelpHint = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
55
53
|
}
|
56
54
|
}),
|
57
55
|
focusWithinProps = _useFocusWithin.focusWithinProps;
|
58
|
-
var overlayRef = useRef();
|
59
|
-
var triggerRef =
|
56
|
+
var overlayRef = useRef(null);
|
57
|
+
var triggerRef = useLocalOrForwardRef(ref);
|
60
58
|
var _useFocusRing = useFocusRing(),
|
61
59
|
focusProps = _useFocusRing.focusProps,
|
62
60
|
isFocusVisible = _useFocusRing.isFocusVisible;
|
@@ -76,11 +74,6 @@ var HelpHint = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
76
74
|
triggerProps = _useOverlayTrigger.triggerProps,
|
77
75
|
overlayProps = _useOverlayTrigger.overlayProps;
|
78
76
|
|
79
|
-
/* istanbul ignore next */
|
80
|
-
useImperativeHandle(ref, function () {
|
81
|
-
return triggerRef.current;
|
82
|
-
});
|
83
|
-
|
84
77
|
// Set a timeout to close the overlay upon hover / focus loss,
|
85
78
|
// but keep it open if the trigger or overlay are hovered again before it closes.
|
86
79
|
useEffect(function () {
|
@@ -117,14 +110,14 @@ var HelpHint = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
117
110
|
isDarkMode: isDarkMode
|
118
111
|
}),
|
119
112
|
classNames = _useStatusClasses.classNames;
|
120
|
-
var addIsSafariCompatiblePropToLinkChildren = function addIsSafariCompatiblePropToLinkChildren(
|
121
|
-
if (
|
113
|
+
var addIsSafariCompatiblePropToLinkChildren = function addIsSafariCompatiblePropToLinkChildren(element) {
|
114
|
+
if (element) {
|
122
115
|
var _context2;
|
123
|
-
return _mapInstanceProperty(_context2 = React.Children).call(_context2,
|
116
|
+
return _mapInstanceProperty(_context2 = React.Children).call(_context2, element, function (child) {
|
124
117
|
if (! /*#__PURE__*/React.isValidElement(child)) return child;
|
125
118
|
return /*#__PURE__*/React.cloneElement(child, {
|
126
119
|
children: addIsSafariCompatiblePropToLinkChildren(child.props.children),
|
127
|
-
isSafariCompatible: child.type.
|
120
|
+
isSafariCompatible: typeof child.type === 'string' && child.type === 'Link'
|
128
121
|
});
|
129
122
|
});
|
130
123
|
}
|
@@ -150,10 +143,10 @@ var HelpHint = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
150
143
|
hasNoArrow: hasNoArrow,
|
151
144
|
isDismissable: isFocusWithinOverlay ? !isOpen : true,
|
152
145
|
isNonModal: true,
|
153
|
-
isOpen: isOpen,
|
154
146
|
onClose: close,
|
155
147
|
placement: placement,
|
156
|
-
ref: overlayRef
|
148
|
+
ref: overlayRef,
|
149
|
+
isOpen: isOpen
|
157
150
|
}, mergeProps(overlayProps, positionProps, popoverProps || tooltipProps, overlayHoverProps, focusWithinProps)), ___EmotionJSX(FocusScope, {
|
158
151
|
restoreFocus: true,
|
159
152
|
autoFocus: isFocusVisible
|
@@ -162,39 +155,6 @@ var HelpHint = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
162
155
|
role: "status"
|
163
156
|
}, isSafari ? addIsSafariCompatiblePropToLinkChildren(children) : children))));
|
164
157
|
});
|
165
|
-
HelpHint.propTypes = {
|
166
|
-
/** Props object that is spread directly into the popover element. */
|
167
|
-
popoverProps: PropTypes.shape({}),
|
168
|
-
/** @ignore Alias for `popoverProps` prop. Exists for backwards-compatibility. */
|
169
|
-
tooltipProps: PropTypes.shape({}),
|
170
|
-
/** Props object that is spread directly into the IconButton element. */
|
171
|
-
iconButtonProps: PropTypes.shape({}),
|
172
|
-
/** Defaults to true, displays dark popover with white text */
|
173
|
-
isDarkMode: PropTypes.bool,
|
174
|
-
/** Where the popover menu opens relative to its trigger. */
|
175
|
-
direction: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
|
176
|
-
/**
|
177
|
-
* Whether the popover is prevented from flipping directions when insufficient space is
|
178
|
-
* available for the given `direction` placement.
|
179
|
-
*/
|
180
|
-
isNotFlippable: PropTypes.bool,
|
181
|
-
/** Alignment of the popover menu relative to the trigger. */
|
182
|
-
align: PropTypes.oneOf(['start', 'end', 'middle']),
|
183
|
-
/**
|
184
|
-
* Allows to add an arrow to popover container
|
185
|
-
*/
|
186
|
-
hasNoArrow: PropTypes.bool,
|
187
|
-
/** Popover offset relative to its trigger. */
|
188
|
-
offset: PropTypes.number,
|
189
|
-
/** Arrow offset relative to the left of the popover.
|
190
|
-
* Must be passed as a px or percentage. */
|
191
|
-
arrowCrossOffset: PropTypes.string,
|
192
|
-
/** The additional offset applied along the cross axis
|
193
|
-
* between the element and its anchor element. */
|
194
|
-
crossOffset: PropTypes.number,
|
195
|
-
/** Amount of time before the popover closes */
|
196
|
-
closeDelay: PropTypes.number
|
197
|
-
};
|
198
158
|
HelpHint.defaultProps = {
|
199
159
|
align: 'middle',
|
200
160
|
direction: 'top',
|
@@ -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, HelpHint, Link, Text } from '../../index';
|
6
|
-
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks
|
6
|
+
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks';
|
7
7
|
import HelpHintReadme from './HelpHint.mdx';
|
8
8
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
9
9
|
export default {
|
@@ -45,7 +45,7 @@ export var WithPopoverAndIconButtonProps = function WithPopoverAndIconButtonProp
|
|
45
45
|
p: 50
|
46
46
|
}, ___EmotionJSX(HelpHint, {
|
47
47
|
popoverProps: {
|
48
|
-
'data-
|
48
|
+
'data-testid': 'popover-container'
|
49
49
|
},
|
50
50
|
iconButtonProps: {
|
51
51
|
'aria-label': 'Help hint'
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/lib/types/index.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pingux/astro",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.48.0-alpha.0",
|
4
4
|
"description": "React component library for Ping Identity's design system",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -78,6 +78,7 @@
|
|
78
78
|
"@react-stately/grid": "~3.3.1",
|
79
79
|
"@react-stately/layout": "^3.13.4",
|
80
80
|
"@react-stately/list": "~3.4.1",
|
81
|
+
"@react-stately/overlays": "^3.6.4",
|
81
82
|
"@react-stately/table": "^3.9.0",
|
82
83
|
"@react-stately/tabs": "^3.6.3",
|
83
84
|
"@react-stately/tree": "^3.7.4",
|