@pingux/astro 2.45.0 → 2.46.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.
- package/lib/cjs/components/Input/Input.d.ts +4 -0
- package/lib/cjs/components/Input/Input.js +13 -21
- package/lib/cjs/components/Input/Input.stories.d.ts +20 -0
- package/lib/cjs/components/Input/Input.styles.d.ts +8 -0
- package/lib/cjs/components/Input/Input.styles.js +0 -1
- package/lib/cjs/components/Input/Input.test.d.ts +1 -0
- package/lib/cjs/components/Input/Input.test.js +2 -10
- package/lib/cjs/components/Input/index.d.ts +1 -0
- package/lib/cjs/components/PopoverMenu/PopoverMenu.d.ts +4 -0
- package/lib/cjs/components/PopoverMenu/PopoverMenu.js +12 -38
- package/lib/cjs/components/PopoverMenu/PopoverMenu.stories.d.ts +12 -0
- package/lib/cjs/components/PopoverMenu/PopoverMenu.stories.js +1 -1
- package/lib/cjs/components/PopoverMenu/PopoverMenu.styles.d.ts +88 -0
- package/lib/cjs/components/PopoverMenu/PopoverMenu.test.d.ts +1 -0
- package/lib/cjs/components/PopoverMenu/index.d.ts +1 -0
- package/lib/cjs/context/MenuContext/index.d.ts +6 -0
- package/lib/cjs/context/MenuContext/index.js +2 -0
- package/lib/cjs/types/index.d.ts +2 -0
- package/lib/cjs/types/index.js +34 -12
- package/lib/cjs/types/input.d.ts +18 -0
- package/lib/cjs/types/input.js +6 -0
- package/lib/cjs/types/popoverMenu.d.ts +31 -0
- package/lib/cjs/types/popoverMenu.js +6 -0
- package/lib/cjs/types/shared/index.d.ts +1 -0
- package/lib/cjs/types/shared/index.js +12 -1
- package/lib/cjs/types/shared/style.d.ts +1 -0
- package/lib/cjs/types/shared/validPositiveInteger.d.ts +4 -0
- package/lib/cjs/types/shared/validPositiveInteger.js +6 -0
- package/lib/components/Input/Input.js +12 -20
- package/lib/components/Input/Input.styles.js +0 -1
- package/lib/components/Input/Input.test.js +2 -10
- package/lib/components/PopoverMenu/PopoverMenu.js +13 -39
- package/lib/components/PopoverMenu/PopoverMenu.stories.js +1 -1
- package/lib/context/MenuContext/index.js +3 -0
- package/lib/types/index.js +2 -0
- package/lib/types/input.js +1 -0
- package/lib/types/popoverMenu.js +1 -0
- package/lib/types/shared/index.js +2 -1
- package/lib/types/shared/validPositiveInteger.js +1 -0
- package/package.json +1 -1
@@ -9,15 +9,16 @@ _Object$defineProperty(exports, "__esModule", {
|
|
9
9
|
value: true
|
10
10
|
});
|
11
11
|
exports["default"] = void 0;
|
12
|
-
var _isInteger = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/number/is-integer"));
|
13
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
14
13
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
14
|
+
var _base = _interopRequireDefault(require("@emotion/styled/base"));
|
15
15
|
var _react = _interopRequireWildcard(require("react"));
|
16
|
-
var
|
16
|
+
var _styledSystem = require("styled-system");
|
17
17
|
var _themeUi = require("theme-ui");
|
18
|
-
var _isValidPositiveInt = _interopRequireDefault(require("../../utils/devUtils/props/isValidPositiveInt"));
|
19
18
|
var _react2 = require("@emotion/react");
|
20
19
|
var _excluded = ["name", "placeholder", "maxLength"];
|
20
|
+
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); }
|
21
|
+
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; }
|
21
22
|
/**
|
22
23
|
* Base input component.
|
23
24
|
*
|
@@ -28,34 +29,25 @@ var _excluded = ["name", "placeholder", "maxLength"];
|
|
28
29
|
* We instead encourage developers to utilize our Field components wherever possible.
|
29
30
|
* If this component is used, accessibility is left to the developer.
|
30
31
|
*/
|
31
|
-
|
32
|
-
|
32
|
+
|
33
|
+
var ExtendedInput = /*#__PURE__*/(0, _base["default"])(_themeUi.Input, process.env.NODE_ENV === "production" ? {
|
34
|
+
target: "e1lpwkt50"
|
35
|
+
} : {
|
36
|
+
target: "e1lpwkt50",
|
37
|
+
label: "ExtendedInput"
|
38
|
+
})(_styledSystem.layout, _styledSystem.flexbox, _styledSystem.typography, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0lucHV0L0lucHV0LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFpQnNCIiwiZmlsZSI6Ii4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0lucHV0L0lucHV0LnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCwgeyBmb3J3YXJkUmVmIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgZmxleGJveCwgbGF5b3V0LCB0eXBvZ3JhcGh5IH0gZnJvbSAnc3R5bGVkLXN5c3RlbSc7XG5pbXBvcnQgeyBJbnB1dCBhcyBUaGVtZVVJSW5wdXQgfSBmcm9tICd0aGVtZS11aSc7XG5cbmltcG9ydCB7IElucHV0UHJvcHMgfSBmcm9tICcuLi8uLi90eXBlcyc7XG4vKipcbiAqIEJhc2UgaW5wdXQgY29tcG9uZW50LlxuICpcbiAqIEFjY2VwdHMgcmVsZXZhbnQgc3R5bGluZyBwcm9wcyBmcm9tIFtzdHlsZWQtc3lzdGVtXShodHRwczovL3N0eWxlZC1zeXN0ZW0uY29tL3RhYmxlKS5cbiAqIEJ1aWx0IG9uIHRvcCBvZiBbSW5wdXQgZnJvbSBUaGVtZS1VSV0oaHR0cHM6Ly90aGVtZS11aS5jb20vY29tcG9uZW50cy9pbnB1dC8pLlxuICpcbiAqICoqTm90ZSoqOiBUaGlzIGNvbXBvbmVudCBkb2VzIG5vdCBzdXBwbHkgYWxsIG9mIHRoZSBhY2Nlc3NpYmlsaXR5IGFzc2lzdGFuY2Ugb24gaXRzIG93bi5cbiAqIFdlIGluc3RlYWQgZW5jb3VyYWdlIGRldmVsb3BlcnMgdG8gdXRpbGl6ZSBvdXIgRmllbGQgY29tcG9uZW50cyB3aGVyZXZlciBwb3NzaWJsZS5cbiAqIElmIHRoaXMgY29tcG9uZW50IGlzIHVzZWQsIGFjY2Vzc2liaWxpdHkgaXMgbGVmdCB0byB0aGUgZGV2ZWxvcGVyLlxuICovXG5cbmNvbnN0IEV4dGVuZGVkSW5wdXQgPSBzdHlsZWQoVGhlbWVVSUlucHV0KShcbiAgbGF5b3V0LFxuICBmbGV4Ym94LFxuICB0eXBvZ3JhcGh5LFxuKTtcblxuY29uc3QgSW5wdXQgPSBmb3J3YXJkUmVmPEhUTUxJbnB1dEVsZW1lbnQsIElucHV0UHJvcHM+KChwcm9wcywgcmVmKSA9PiB7XG4gIGNvbnN0IHsgbmFtZSwgcGxhY2Vob2xkZXIsIG1heExlbmd0aCwgLi4ub3RoZXJzIH0gPSBwcm9wcztcblxuICByZXR1cm4gKFxuICAgIDxFeHRlbmRlZElucHV0XG4gICAgICByZWY9e3JlZn1cbiAgICAgIG5hbWU9e25hbWV9XG4gICAgICBwbGFjZWhvbGRlcj17cGxhY2Vob2xkZXJ9XG4gICAgICBtYXhMZW5ndGg9e21heExlbmd0aCAmJiBtYXhMZW5ndGh9XG4gICAgICB7Li4ub3RoZXJzfVxuICAgIC8+XG4gICk7XG59KTtcblxuSW5wdXQuZGlzcGxheU5hbWUgPSAnSW5wdXQnO1xuXG5leHBvcnQgZGVmYXVsdCBJbnB1dDtcbiJdfQ== */");
|
33
39
|
var Input = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
34
40
|
var name = props.name,
|
35
41
|
placeholder = props.placeholder,
|
36
42
|
maxLength = props.maxLength,
|
37
43
|
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
38
|
-
return (0, _react2.jsx)(
|
44
|
+
return (0, _react2.jsx)(ExtendedInput, (0, _extends2["default"])({
|
39
45
|
ref: ref,
|
40
46
|
name: name,
|
41
47
|
placeholder: placeholder,
|
42
|
-
maxLength:
|
48
|
+
maxLength: maxLength && maxLength
|
43
49
|
}, others));
|
44
50
|
});
|
45
51
|
Input.displayName = 'Input';
|
46
|
-
Input.propTypes = {
|
47
|
-
/** Defines a string value that labels the current element. */
|
48
|
-
'aria-label': _propTypes["default"].string,
|
49
|
-
/** Id of input. */
|
50
|
-
id: _propTypes["default"].string,
|
51
|
-
/** Name of input. */
|
52
|
-
name: _propTypes["default"].string,
|
53
|
-
/** Max length of input value */
|
54
|
-
maxLength: _isValidPositiveInt["default"],
|
55
|
-
/** Type of input. Accepts most [HTML input types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types) */
|
56
|
-
type: _propTypes["default"].string,
|
57
|
-
/** Placeholder for the input */
|
58
|
-
placeholder: _propTypes["default"].string
|
59
|
-
};
|
60
52
|
var _default = Input;
|
61
53
|
exports["default"] = _default;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { StoryFn } from '@storybook/react';
|
3
|
+
import { InputProps } from '../../types';
|
4
|
+
declare const _default: {
|
5
|
+
title: string;
|
6
|
+
component: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
7
|
+
argTypes: {
|
8
|
+
placeholder: {};
|
9
|
+
type: {};
|
10
|
+
name: {};
|
11
|
+
id: {};
|
12
|
+
};
|
13
|
+
args: {
|
14
|
+
placeholder: string;
|
15
|
+
};
|
16
|
+
};
|
17
|
+
export default _default;
|
18
|
+
export declare const Default: StoryFn<InputProps>;
|
19
|
+
export declare const Password: StoryFn;
|
20
|
+
export declare const LargeInput: StoryFn;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -45,17 +45,9 @@ test('maxlength field with a set maxlength', function () {
|
|
45
45
|
_userEvent["default"].type(input, 'banana');
|
46
46
|
expect(input.value.length).toBe(3);
|
47
47
|
});
|
48
|
-
test('maxlength field is not set as
|
48
|
+
test('maxlength field is not set as undefined', function () {
|
49
49
|
getComponent({
|
50
|
-
maxLength:
|
51
|
-
});
|
52
|
-
var input = _react2.screen.getByTestId(testId);
|
53
|
-
_userEvent["default"].type(input, 'banana');
|
54
|
-
expect(input.value.length).toBe(6);
|
55
|
-
});
|
56
|
-
test('maxlength field is not set as zero', function () {
|
57
|
-
getComponent({
|
58
|
-
maxLength: 0
|
50
|
+
maxLength: undefined
|
59
51
|
});
|
60
52
|
var input = _react2.screen.getByTestId(testId);
|
61
53
|
_userEvent["default"].type(input, 'banana');
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './Input';
|
@@ -23,8 +23,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
23
23
|
var _reactAria = require("react-aria");
|
24
24
|
var _reactStately = require("react-stately");
|
25
25
|
var _interactions = require("@react-aria/interactions");
|
26
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
27
26
|
var _MenuContext = require("../../context/MenuContext");
|
27
|
+
var _hooks = require("../../hooks");
|
28
28
|
var _PopoverContainer = _interopRequireDefault(require("../PopoverContainer"));
|
29
29
|
var _react2 = require("@emotion/react");
|
30
30
|
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); }
|
@@ -33,13 +33,9 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
33
33
|
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) { (0, _defineProperty2["default"])(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; }
|
34
34
|
var PopoverMenu = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
35
35
|
var _context;
|
36
|
-
var menuPopoverRef = (0,
|
37
|
-
var triggerRef = (0, _react.useRef)();
|
38
|
-
var menuRef = (0, _react.useRef)();
|
39
|
-
/* istanbul ignore next */
|
40
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
41
|
-
return menuPopoverRef.current;
|
42
|
-
});
|
36
|
+
var menuPopoverRef = (0, _hooks.useLocalOrForwardRef)(ref);
|
37
|
+
var triggerRef = (0, _react.useRef)(null);
|
38
|
+
var menuRef = (0, _react.useRef)(null);
|
43
39
|
var children = props.children,
|
44
40
|
align = props.align,
|
45
41
|
direction = props.direction,
|
@@ -52,11 +48,12 @@ var PopoverMenu = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
52
48
|
_React$Children$toArr2 = (0, _slicedToArray2["default"])(_React$Children$toArr, 2),
|
53
49
|
menuTrigger = _React$Children$toArr2[0],
|
54
50
|
menu = _React$Children$toArr2[1];
|
55
|
-
var
|
51
|
+
var menuTriggerState = _objectSpread(_objectSpread({}, props), {}, {
|
56
52
|
defaultOpen: isDefaultOpen,
|
57
53
|
closeOnSelect: !isNotClosedOnSelect,
|
58
54
|
shouldFlip: !isNotFlippable
|
59
|
-
})
|
55
|
+
});
|
56
|
+
var state = (0, _reactStately.useMenuTriggerState)(menuTriggerState);
|
60
57
|
var _useMenuTrigger = (0, _reactAria.useMenuTrigger)({}, state, triggerRef),
|
61
58
|
menuTriggerProps = _useMenuTrigger.menuTriggerProps,
|
62
59
|
menuProps = _useMenuTrigger.menuProps;
|
@@ -74,6 +71,8 @@ var PopoverMenu = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
74
71
|
}),
|
75
72
|
positionProps = _useOverlayPosition.overlayProps,
|
76
73
|
placement = _useOverlayPosition.placement;
|
74
|
+
|
75
|
+
/* eslint-disable react/jsx-no-constructed-context-values */
|
77
76
|
var menuContext = _objectSpread(_objectSpread({}, menuProps), {}, {
|
78
77
|
ref: menuRef,
|
79
78
|
onClose: state.close,
|
@@ -102,35 +101,10 @@ var PopoverMenu = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
102
101
|
hasNoArrow: hasNoArrow,
|
103
102
|
isDismissable: true,
|
104
103
|
isNonModal: true
|
105
|
-
}, positionProps, menuProps
|
104
|
+
}, positionProps, menuProps, {
|
105
|
+
role: "dialog"
|
106
|
+
}), contents)));
|
106
107
|
});
|
107
|
-
PopoverMenu.propTypes = {
|
108
|
-
/** Alignment of the popover menu relative to the trigger. */
|
109
|
-
align: _propTypes["default"].oneOf(['start', 'end', 'middle']),
|
110
|
-
/** Where the popover menu opens relative to its trigger. */
|
111
|
-
direction: _propTypes["default"].oneOf(['top', 'right', 'bottom', 'left']),
|
112
|
-
/** Whether the overlay is open by default (controlled). */
|
113
|
-
isOpen: _propTypes["default"].bool,
|
114
|
-
/** Whether the overlay is open by default (uncontrolled). */
|
115
|
-
isDefaultOpen: _propTypes["default"].bool,
|
116
|
-
/** Whether the popover is prevented from closing when a selection is made. */
|
117
|
-
isNotClosedOnSelect: _propTypes["default"].bool,
|
118
|
-
/**
|
119
|
-
* Whether the popover is prevented from flipping directions when insufficient space is
|
120
|
-
* available for the given `direction` placement.
|
121
|
-
*/
|
122
|
-
isNotFlippable: _propTypes["default"].bool,
|
123
|
-
/** Whether the PopoverMenu hides the arrow. */
|
124
|
-
hasNoArrow: _propTypes["default"].bool,
|
125
|
-
/** Whether the PopoverMenu contains focus inside the scope. */
|
126
|
-
isContainFocus: _propTypes["default"].bool,
|
127
|
-
/**
|
128
|
-
* Handler that is called when the overlay's open state changes.
|
129
|
-
*
|
130
|
-
* `(isOpen: boolean) => void`
|
131
|
-
*/
|
132
|
-
onOpenChange: _propTypes["default"].func
|
133
|
-
};
|
134
108
|
PopoverMenu.defaultProps = {
|
135
109
|
align: 'middle',
|
136
110
|
direction: 'bottom',
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { StoryFn } from '@storybook/react';
|
2
|
+
import { PopoverMenuProps } 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<PopoverMenuProps>;
|
6
|
+
export declare const DefaultOpen: StoryFn;
|
7
|
+
export declare const Controlled: StoryFn;
|
8
|
+
export declare const Placement: StoryFn;
|
9
|
+
export declare const NotFlippable: StoryFn;
|
10
|
+
export declare const NotClosedOnSelect: StoryFn;
|
11
|
+
export declare const DisabledItem: StoryFn;
|
12
|
+
export declare const isPressed: StoryFn;
|
@@ -15,7 +15,7 @@ var _addonActions = require("@storybook/addon-actions");
|
|
15
15
|
var _storybookAddonDesigns = require("storybook-addon-designs");
|
16
16
|
var _storybookDocsLayout = _interopRequireDefault(require("../../../.storybook/storybookDocsLayout"));
|
17
17
|
var _index = require("../../index");
|
18
|
-
var _figmaLinks = require("../../utils/designUtils/figmaLinks
|
18
|
+
var _figmaLinks = require("../../utils/designUtils/figmaLinks");
|
19
19
|
var _PopoverMenu = _interopRequireDefault(require("./PopoverMenu.mdx"));
|
20
20
|
var _react2 = require("@emotion/react");
|
21
21
|
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); }
|
@@ -0,0 +1,88 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
arrow: {
|
3
|
+
color: string;
|
4
|
+
'&:before': {
|
5
|
+
content: string;
|
6
|
+
position: string;
|
7
|
+
borderColor: string;
|
8
|
+
borderStyle: string;
|
9
|
+
};
|
10
|
+
};
|
11
|
+
container: {
|
12
|
+
visibility: string;
|
13
|
+
position: string;
|
14
|
+
bg: string;
|
15
|
+
color: string;
|
16
|
+
borderRadius: number;
|
17
|
+
fontSize: string;
|
18
|
+
lineHeight: number;
|
19
|
+
outline: string;
|
20
|
+
transitionProperty: string;
|
21
|
+
WebkitBoxShadow: string;
|
22
|
+
MozBoxShadow: string;
|
23
|
+
boxShadow: string;
|
24
|
+
'&.is-dark-mode': {
|
25
|
+
color: string;
|
26
|
+
bg: string;
|
27
|
+
'&[data-popover-placement^=top] > [data-popover-arrow="arrow"]:before': {
|
28
|
+
borderTopColor: string;
|
29
|
+
};
|
30
|
+
'&[data-popover-placement^=bottom] > [data-popover-arrow="arrow"]:before': {
|
31
|
+
borderBottomColor: string;
|
32
|
+
};
|
33
|
+
'&[data-popover-placement^=left] > [data-popover-arrow="arrow"]:before': {
|
34
|
+
borderLeftColor: string;
|
35
|
+
};
|
36
|
+
'&[data-popover-placement^=right] > [data-popover-arrow="arrow"]:before': {
|
37
|
+
borderRightColor: string;
|
38
|
+
};
|
39
|
+
};
|
40
|
+
'&[data-popover-placement^=top] > [data-popover-arrow="arrow"]': {
|
41
|
+
bottom: number;
|
42
|
+
};
|
43
|
+
'&[data-popover-placement^=top] > [data-popover-arrow="arrow"]:before': {
|
44
|
+
left: string;
|
45
|
+
transform: string;
|
46
|
+
borderWidth: string;
|
47
|
+
borderTopColor: string;
|
48
|
+
transformOrigin: string;
|
49
|
+
};
|
50
|
+
'&[data-popover-placement^=bottom] > [data-popover-arrow="arrow"]': {
|
51
|
+
top: number;
|
52
|
+
};
|
53
|
+
'&[data-popover-placement^=bottom] > [data-popover-arrow="arrow"]:before': {
|
54
|
+
top: string;
|
55
|
+
left: string;
|
56
|
+
transform: string;
|
57
|
+
borderWidth: string;
|
58
|
+
borderBottomColor: string;
|
59
|
+
transformOrigin: string;
|
60
|
+
};
|
61
|
+
'&[data-popover-placement^=left] > [data-popover-arrow="arrow"]': {
|
62
|
+
right: number;
|
63
|
+
};
|
64
|
+
'&[data-popover-placement^=left] > [data-popover-arrow="arrow"]:before': {
|
65
|
+
right: string;
|
66
|
+
top: string;
|
67
|
+
transform: string;
|
68
|
+
borderWidth: string;
|
69
|
+
borderLeftColor: string;
|
70
|
+
transformOrigin: string;
|
71
|
+
};
|
72
|
+
'&[data-popover-placement^=right] > [data-popover-arrow="arrow"]': {
|
73
|
+
left: number;
|
74
|
+
};
|
75
|
+
'&[data-popover-placement^=right] > [data-popover-arrow="arrow"]:before': {
|
76
|
+
left: string;
|
77
|
+
top: string;
|
78
|
+
transform: string;
|
79
|
+
borderWidth: string;
|
80
|
+
borderRightColor: string;
|
81
|
+
transformOrigin: string;
|
82
|
+
};
|
83
|
+
'&.is-open': {
|
84
|
+
visibility: string;
|
85
|
+
};
|
86
|
+
};
|
87
|
+
};
|
88
|
+
export default _default;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './PopoverMenu';
|
@@ -6,6 +6,8 @@ _Object$defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.useMenuContext = exports.MenuContext = void 0;
|
8
8
|
var _react = require("react");
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
10
|
+
|
9
11
|
var MenuContext = /*#__PURE__*/(0, _react.createContext)({});
|
10
12
|
exports.MenuContext = MenuContext;
|
11
13
|
var useMenuContext = function useMenuContext() {
|
package/lib/cjs/types/index.d.ts
CHANGED
@@ -8,12 +8,14 @@ export * from './fieldHelperText';
|
|
8
8
|
export * from './icon';
|
9
9
|
export * from './iconBadge';
|
10
10
|
export * from './iconButton';
|
11
|
+
export * from './input';
|
11
12
|
export * from './item';
|
12
13
|
export * from './link';
|
13
14
|
export * from './listItem';
|
14
15
|
export * from './loader';
|
15
16
|
export * from './overlayPanel';
|
16
17
|
export * from './popoverContainer';
|
18
|
+
export * from './popoverMenu';
|
17
19
|
export * from './separator';
|
18
20
|
export * from './shared';
|
19
21
|
export * from './table';
|
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;
|
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;
|
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");
|
@@ -117,8 +117,19 @@ _forEachInstanceProperty(_context10 = _Object$keys(_iconButton)).call(_context10
|
|
117
117
|
}
|
118
118
|
});
|
119
119
|
});
|
120
|
+
var _input = require("./input");
|
121
|
+
_forEachInstanceProperty(_context11 = _Object$keys(_input)).call(_context11, function (key) {
|
122
|
+
if (key === "default" || key === "__esModule") return;
|
123
|
+
if (key in exports && exports[key] === _input[key]) return;
|
124
|
+
_Object$defineProperty(exports, key, {
|
125
|
+
enumerable: true,
|
126
|
+
get: function get() {
|
127
|
+
return _input[key];
|
128
|
+
}
|
129
|
+
});
|
130
|
+
});
|
120
131
|
var _item = require("./item");
|
121
|
-
_forEachInstanceProperty(
|
132
|
+
_forEachInstanceProperty(_context12 = _Object$keys(_item)).call(_context12, function (key) {
|
122
133
|
if (key === "default" || key === "__esModule") return;
|
123
134
|
if (key in exports && exports[key] === _item[key]) return;
|
124
135
|
_Object$defineProperty(exports, key, {
|
@@ -129,7 +140,7 @@ _forEachInstanceProperty(_context11 = _Object$keys(_item)).call(_context11, func
|
|
129
140
|
});
|
130
141
|
});
|
131
142
|
var _link = require("./link");
|
132
|
-
_forEachInstanceProperty(
|
143
|
+
_forEachInstanceProperty(_context13 = _Object$keys(_link)).call(_context13, function (key) {
|
133
144
|
if (key === "default" || key === "__esModule") return;
|
134
145
|
if (key in exports && exports[key] === _link[key]) return;
|
135
146
|
_Object$defineProperty(exports, key, {
|
@@ -140,7 +151,7 @@ _forEachInstanceProperty(_context12 = _Object$keys(_link)).call(_context12, func
|
|
140
151
|
});
|
141
152
|
});
|
142
153
|
var _listItem = require("./listItem");
|
143
|
-
_forEachInstanceProperty(
|
154
|
+
_forEachInstanceProperty(_context14 = _Object$keys(_listItem)).call(_context14, function (key) {
|
144
155
|
if (key === "default" || key === "__esModule") return;
|
145
156
|
if (key in exports && exports[key] === _listItem[key]) return;
|
146
157
|
_Object$defineProperty(exports, key, {
|
@@ -151,7 +162,7 @@ _forEachInstanceProperty(_context13 = _Object$keys(_listItem)).call(_context13,
|
|
151
162
|
});
|
152
163
|
});
|
153
164
|
var _loader = require("./loader");
|
154
|
-
_forEachInstanceProperty(
|
165
|
+
_forEachInstanceProperty(_context15 = _Object$keys(_loader)).call(_context15, function (key) {
|
155
166
|
if (key === "default" || key === "__esModule") return;
|
156
167
|
if (key in exports && exports[key] === _loader[key]) return;
|
157
168
|
_Object$defineProperty(exports, key, {
|
@@ -162,7 +173,7 @@ _forEachInstanceProperty(_context14 = _Object$keys(_loader)).call(_context14, fu
|
|
162
173
|
});
|
163
174
|
});
|
164
175
|
var _overlayPanel = require("./overlayPanel");
|
165
|
-
_forEachInstanceProperty(
|
176
|
+
_forEachInstanceProperty(_context16 = _Object$keys(_overlayPanel)).call(_context16, function (key) {
|
166
177
|
if (key === "default" || key === "__esModule") return;
|
167
178
|
if (key in exports && exports[key] === _overlayPanel[key]) return;
|
168
179
|
_Object$defineProperty(exports, key, {
|
@@ -173,7 +184,7 @@ _forEachInstanceProperty(_context15 = _Object$keys(_overlayPanel)).call(_context
|
|
173
184
|
});
|
174
185
|
});
|
175
186
|
var _popoverContainer = require("./popoverContainer");
|
176
|
-
_forEachInstanceProperty(
|
187
|
+
_forEachInstanceProperty(_context17 = _Object$keys(_popoverContainer)).call(_context17, function (key) {
|
177
188
|
if (key === "default" || key === "__esModule") return;
|
178
189
|
if (key in exports && exports[key] === _popoverContainer[key]) return;
|
179
190
|
_Object$defineProperty(exports, key, {
|
@@ -183,8 +194,19 @@ _forEachInstanceProperty(_context16 = _Object$keys(_popoverContainer)).call(_con
|
|
183
194
|
}
|
184
195
|
});
|
185
196
|
});
|
197
|
+
var _popoverMenu = require("./popoverMenu");
|
198
|
+
_forEachInstanceProperty(_context18 = _Object$keys(_popoverMenu)).call(_context18, function (key) {
|
199
|
+
if (key === "default" || key === "__esModule") return;
|
200
|
+
if (key in exports && exports[key] === _popoverMenu[key]) return;
|
201
|
+
_Object$defineProperty(exports, key, {
|
202
|
+
enumerable: true,
|
203
|
+
get: function get() {
|
204
|
+
return _popoverMenu[key];
|
205
|
+
}
|
206
|
+
});
|
207
|
+
});
|
186
208
|
var _separator = require("./separator");
|
187
|
-
_forEachInstanceProperty(
|
209
|
+
_forEachInstanceProperty(_context19 = _Object$keys(_separator)).call(_context19, function (key) {
|
188
210
|
if (key === "default" || key === "__esModule") return;
|
189
211
|
if (key in exports && exports[key] === _separator[key]) return;
|
190
212
|
_Object$defineProperty(exports, key, {
|
@@ -195,7 +217,7 @@ _forEachInstanceProperty(_context17 = _Object$keys(_separator)).call(_context17,
|
|
195
217
|
});
|
196
218
|
});
|
197
219
|
var _shared = require("./shared");
|
198
|
-
_forEachInstanceProperty(
|
220
|
+
_forEachInstanceProperty(_context20 = _Object$keys(_shared)).call(_context20, function (key) {
|
199
221
|
if (key === "default" || key === "__esModule") return;
|
200
222
|
if (key in exports && exports[key] === _shared[key]) return;
|
201
223
|
_Object$defineProperty(exports, key, {
|
@@ -206,7 +228,7 @@ _forEachInstanceProperty(_context18 = _Object$keys(_shared)).call(_context18, fu
|
|
206
228
|
});
|
207
229
|
});
|
208
230
|
var _table = require("./table");
|
209
|
-
_forEachInstanceProperty(
|
231
|
+
_forEachInstanceProperty(_context21 = _Object$keys(_table)).call(_context21, function (key) {
|
210
232
|
if (key === "default" || key === "__esModule") return;
|
211
233
|
if (key in exports && exports[key] === _table[key]) return;
|
212
234
|
_Object$defineProperty(exports, key, {
|
@@ -217,7 +239,7 @@ _forEachInstanceProperty(_context19 = _Object$keys(_table)).call(_context19, fun
|
|
217
239
|
});
|
218
240
|
});
|
219
241
|
var _text = require("./text");
|
220
|
-
_forEachInstanceProperty(
|
242
|
+
_forEachInstanceProperty(_context22 = _Object$keys(_text)).call(_context22, function (key) {
|
221
243
|
if (key === "default" || key === "__esModule") return;
|
222
244
|
if (key in exports && exports[key] === _text[key]) return;
|
223
245
|
_Object$defineProperty(exports, key, {
|
@@ -228,7 +250,7 @@ _forEachInstanceProperty(_context20 = _Object$keys(_text)).call(_context20, func
|
|
228
250
|
});
|
229
251
|
});
|
230
252
|
var _tooltipTrigger = require("./tooltipTrigger");
|
231
|
-
_forEachInstanceProperty(
|
253
|
+
_forEachInstanceProperty(_context23 = _Object$keys(_tooltipTrigger)).call(_context23, function (key) {
|
232
254
|
if (key === "default" || key === "__esModule") return;
|
233
255
|
if (key in exports && exports[key] === _tooltipTrigger[key]) return;
|
234
256
|
_Object$defineProperty(exports, key, {
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { TestingAttributes } from './shared/test';
|
2
|
+
import { DOMAttributes, StyleProps, ValidPositiveInteger } from './shared';
|
3
|
+
export interface InputProps extends StyleProps, DOMAttributes, TestingAttributes {
|
4
|
+
/** Defines a string value that labels the current element. */
|
5
|
+
'aria-label'?: string;
|
6
|
+
/** Id of input. */
|
7
|
+
id?: string;
|
8
|
+
/** Name of input. */
|
9
|
+
name?: string;
|
10
|
+
/** Max length of input value */
|
11
|
+
maxLength?: ValidPositiveInteger;
|
12
|
+
/** Type of input. Accepts most [HTML input types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types) */
|
13
|
+
type?: string;
|
14
|
+
/** Placeholder for the input */
|
15
|
+
placeholder?: string;
|
16
|
+
/** Styling variant for the input */
|
17
|
+
variant?: string;
|
18
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { Alignment, Axis } from './shared';
|
3
|
+
export interface PopoverMenuProps {
|
4
|
+
children?: React.ReactNode;
|
5
|
+
/** Alignment of the popover menu relative to the trigger. */
|
6
|
+
align?: Alignment;
|
7
|
+
/** Where the popover menu opens relative to its trigger. */
|
8
|
+
direction?: Axis;
|
9
|
+
/** Whether the overlay is open by default (controlled). */
|
10
|
+
isOpen?: boolean;
|
11
|
+
/** Whether the overlay is open by default (uncontrolled). */
|
12
|
+
isDefaultOpen?: boolean;
|
13
|
+
/** Whether the popover is prevented from closing when a selection is made. */
|
14
|
+
isNotClosedOnSelect?: boolean;
|
15
|
+
closeOnSelect?: boolean;
|
16
|
+
/**
|
17
|
+
* Whether the popover is prevented from flipping directions when insufficient space is
|
18
|
+
* available for the given `direction` placement.
|
19
|
+
*/
|
20
|
+
isNotFlippable?: boolean;
|
21
|
+
/** Whether the PopoverMenu hides the arrow. */
|
22
|
+
hasNoArrow?: boolean;
|
23
|
+
/** Whether the PopoverMenu contains focus inside the scope. */
|
24
|
+
isContainFocus?: boolean;
|
25
|
+
/**
|
26
|
+
* Handler that is called when the overlay's open state changes.
|
27
|
+
*
|
28
|
+
* `(isOpen: boolean) => void`
|
29
|
+
*/
|
30
|
+
onOpenChange?: (isOpen: boolean) => void;
|
31
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _context, _context2, _context3, _context4, _context5;
|
3
|
+
var _context, _context2, _context3, _context4, _context5, _context6;
|
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");
|
@@ -61,4 +61,15 @@ _forEachInstanceProperty(_context5 = _Object$keys(_utils)).call(_context5, funct
|
|
61
61
|
return _utils[key];
|
62
62
|
}
|
63
63
|
});
|
64
|
+
});
|
65
|
+
var _validPositiveInteger = require("./validPositiveInteger");
|
66
|
+
_forEachInstanceProperty(_context6 = _Object$keys(_validPositiveInteger)).call(_context6, function (key) {
|
67
|
+
if (key === "default" || key === "__esModule") return;
|
68
|
+
if (key in exports && exports[key] === _validPositiveInteger[key]) return;
|
69
|
+
_Object$defineProperty(exports, key, {
|
70
|
+
enumerable: true,
|
71
|
+
get: function get() {
|
72
|
+
return _validPositiveInteger[key];
|
73
|
+
}
|
74
|
+
});
|
64
75
|
});
|
@@ -13,6 +13,7 @@ export interface StyleProps extends ThemeUICSSProperties, SxProp {
|
|
13
13
|
}
|
14
14
|
export type Placement = 'bottom' | 'bottom left' | 'bottom right' | 'bottom start' | 'bottom end' | 'top' | 'top left' | 'top right' | 'top start' | 'top end' | 'left' | 'left top' | 'left bottom' | 'start' | 'start top' | 'start bottom' | 'right' | 'right top' | 'right bottom' | 'end' | 'end top' | 'end bottom';
|
15
15
|
export type Axis = 'top' | 'bottom' | 'left' | 'right';
|
16
|
+
export type Alignment = 'start' | 'end' | 'middle';
|
16
17
|
export type SizeAxis = 'width' | 'height';
|
17
18
|
export type PlacementAxis = Axis | 'center';
|
18
19
|
export type PanelSize = 'small' | 'medium' | 'large' | 'full' | 'custom';
|
@@ -0,0 +1,4 @@
|
|
1
|
+
type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc['length']]>;
|
2
|
+
type Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
|
3
|
+
export type ValidPositiveInteger = Range<1, 999>;
|
4
|
+
export {};
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
3
|
+
import _styled from "@emotion/styled/base";
|
3
4
|
var _excluded = ["name", "placeholder", "maxLength"];
|
4
|
-
import _Number$isInteger from "@babel/runtime-corejs3/core-js-stable/number/is-integer";
|
5
5
|
import React, { forwardRef } from 'react';
|
6
|
-
import
|
6
|
+
import { flexbox, layout, typography } from 'styled-system';
|
7
7
|
import { Input as ThemeUIInput } from 'theme-ui';
|
8
|
-
import
|
8
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
9
9
|
/**
|
10
10
|
* Base input component.
|
11
11
|
*
|
@@ -16,32 +16,24 @@ import isValidPositiveInt from '../../utils/devUtils/props/isValidPositiveInt';
|
|
16
16
|
* We instead encourage developers to utilize our Field components wherever possible.
|
17
17
|
* If this component is used, accessibility is left to the developer.
|
18
18
|
*/
|
19
|
-
|
19
|
+
|
20
|
+
var ExtendedInput = /*#__PURE__*/_styled(ThemeUIInput, process.env.NODE_ENV === "production" ? {
|
21
|
+
target: "e1lpwkt50"
|
22
|
+
} : {
|
23
|
+
target: "e1lpwkt50",
|
24
|
+
label: "ExtendedInput"
|
25
|
+
})(layout, flexbox, typography, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0lucHV0L0lucHV0LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFpQnNCIiwiZmlsZSI6Ii4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0lucHV0L0lucHV0LnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCwgeyBmb3J3YXJkUmVmIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgZmxleGJveCwgbGF5b3V0LCB0eXBvZ3JhcGh5IH0gZnJvbSAnc3R5bGVkLXN5c3RlbSc7XG5pbXBvcnQgeyBJbnB1dCBhcyBUaGVtZVVJSW5wdXQgfSBmcm9tICd0aGVtZS11aSc7XG5cbmltcG9ydCB7IElucHV0UHJvcHMgfSBmcm9tICcuLi8uLi90eXBlcyc7XG4vKipcbiAqIEJhc2UgaW5wdXQgY29tcG9uZW50LlxuICpcbiAqIEFjY2VwdHMgcmVsZXZhbnQgc3R5bGluZyBwcm9wcyBmcm9tIFtzdHlsZWQtc3lzdGVtXShodHRwczovL3N0eWxlZC1zeXN0ZW0uY29tL3RhYmxlKS5cbiAqIEJ1aWx0IG9uIHRvcCBvZiBbSW5wdXQgZnJvbSBUaGVtZS1VSV0oaHR0cHM6Ly90aGVtZS11aS5jb20vY29tcG9uZW50cy9pbnB1dC8pLlxuICpcbiAqICoqTm90ZSoqOiBUaGlzIGNvbXBvbmVudCBkb2VzIG5vdCBzdXBwbHkgYWxsIG9mIHRoZSBhY2Nlc3NpYmlsaXR5IGFzc2lzdGFuY2Ugb24gaXRzIG93bi5cbiAqIFdlIGluc3RlYWQgZW5jb3VyYWdlIGRldmVsb3BlcnMgdG8gdXRpbGl6ZSBvdXIgRmllbGQgY29tcG9uZW50cyB3aGVyZXZlciBwb3NzaWJsZS5cbiAqIElmIHRoaXMgY29tcG9uZW50IGlzIHVzZWQsIGFjY2Vzc2liaWxpdHkgaXMgbGVmdCB0byB0aGUgZGV2ZWxvcGVyLlxuICovXG5cbmNvbnN0IEV4dGVuZGVkSW5wdXQgPSBzdHlsZWQoVGhlbWVVSUlucHV0KShcbiAgbGF5b3V0LFxuICBmbGV4Ym94LFxuICB0eXBvZ3JhcGh5LFxuKTtcblxuY29uc3QgSW5wdXQgPSBmb3J3YXJkUmVmPEhUTUxJbnB1dEVsZW1lbnQsIElucHV0UHJvcHM+KChwcm9wcywgcmVmKSA9PiB7XG4gIGNvbnN0IHsgbmFtZSwgcGxhY2Vob2xkZXIsIG1heExlbmd0aCwgLi4ub3RoZXJzIH0gPSBwcm9wcztcblxuICByZXR1cm4gKFxuICAgIDxFeHRlbmRlZElucHV0XG4gICAgICByZWY9e3JlZn1cbiAgICAgIG5hbWU9e25hbWV9XG4gICAgICBwbGFjZWhvbGRlcj17cGxhY2Vob2xkZXJ9XG4gICAgICBtYXhMZW5ndGg9e21heExlbmd0aCAmJiBtYXhMZW5ndGh9XG4gICAgICB7Li4ub3RoZXJzfVxuICAgIC8+XG4gICk7XG59KTtcblxuSW5wdXQuZGlzcGxheU5hbWUgPSAnSW5wdXQnO1xuXG5leHBvcnQgZGVmYXVsdCBJbnB1dDtcbiJdfQ== */");
|
20
26
|
var Input = /*#__PURE__*/forwardRef(function (props, ref) {
|
21
27
|
var name = props.name,
|
22
28
|
placeholder = props.placeholder,
|
23
29
|
maxLength = props.maxLength,
|
24
30
|
others = _objectWithoutProperties(props, _excluded);
|
25
|
-
return ___EmotionJSX(
|
31
|
+
return ___EmotionJSX(ExtendedInput, _extends({
|
26
32
|
ref: ref,
|
27
33
|
name: name,
|
28
34
|
placeholder: placeholder,
|
29
|
-
maxLength:
|
35
|
+
maxLength: maxLength && maxLength
|
30
36
|
}, others));
|
31
37
|
});
|
32
38
|
Input.displayName = 'Input';
|
33
|
-
Input.propTypes = {
|
34
|
-
/** Defines a string value that labels the current element. */
|
35
|
-
'aria-label': PropTypes.string,
|
36
|
-
/** Id of input. */
|
37
|
-
id: PropTypes.string,
|
38
|
-
/** Name of input. */
|
39
|
-
name: PropTypes.string,
|
40
|
-
/** Max length of input value */
|
41
|
-
maxLength: isValidPositiveInt,
|
42
|
-
/** Type of input. Accepts most [HTML input types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types) */
|
43
|
-
type: PropTypes.string,
|
44
|
-
/** Placeholder for the input */
|
45
|
-
placeholder: PropTypes.string
|
46
|
-
};
|
47
39
|
export default Input;
|
@@ -42,17 +42,9 @@ test('maxlength field with a set maxlength', function () {
|
|
42
42
|
userEvent.type(input, 'banana');
|
43
43
|
expect(input.value.length).toBe(3);
|
44
44
|
});
|
45
|
-
test('maxlength field is not set as
|
45
|
+
test('maxlength field is not set as undefined', function () {
|
46
46
|
getComponent({
|
47
|
-
maxLength:
|
48
|
-
});
|
49
|
-
var input = screen.getByTestId(testId);
|
50
|
-
userEvent.type(input, 'banana');
|
51
|
-
expect(input.value.length).toBe(6);
|
52
|
-
});
|
53
|
-
test('maxlength field is not set as zero', function () {
|
54
|
-
getComponent({
|
55
|
-
maxLength: 0
|
47
|
+
maxLength: undefined
|
56
48
|
});
|
57
49
|
var input = screen.getByTestId(testId);
|
58
50
|
userEvent.type(input, 'banana');
|
@@ -12,23 +12,19 @@ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
12
12
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
13
13
|
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; }
|
14
14
|
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; }
|
15
|
-
import React, { forwardRef,
|
15
|
+
import React, { forwardRef, useRef } from 'react';
|
16
16
|
import { DismissButton, FocusScope, useMenuTrigger, useOverlayPosition } from 'react-aria';
|
17
17
|
import { useMenuTriggerState } from 'react-stately';
|
18
18
|
import { PressResponder } from '@react-aria/interactions';
|
19
|
-
import PropTypes from 'prop-types';
|
20
19
|
import { MenuContext } from '../../context/MenuContext';
|
20
|
+
import { useLocalOrForwardRef } from '../../hooks';
|
21
21
|
import PopoverContainer from '../PopoverContainer';
|
22
22
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
23
23
|
var PopoverMenu = /*#__PURE__*/forwardRef(function (props, ref) {
|
24
24
|
var _context;
|
25
|
-
var menuPopoverRef =
|
26
|
-
var triggerRef = useRef();
|
27
|
-
var menuRef = useRef();
|
28
|
-
/* istanbul ignore next */
|
29
|
-
useImperativeHandle(ref, function () {
|
30
|
-
return menuPopoverRef.current;
|
31
|
-
});
|
25
|
+
var menuPopoverRef = useLocalOrForwardRef(ref);
|
26
|
+
var triggerRef = useRef(null);
|
27
|
+
var menuRef = useRef(null);
|
32
28
|
var children = props.children,
|
33
29
|
align = props.align,
|
34
30
|
direction = props.direction,
|
@@ -41,11 +37,12 @@ var PopoverMenu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
41
37
|
_React$Children$toArr2 = _slicedToArray(_React$Children$toArr, 2),
|
42
38
|
menuTrigger = _React$Children$toArr2[0],
|
43
39
|
menu = _React$Children$toArr2[1];
|
44
|
-
var
|
40
|
+
var menuTriggerState = _objectSpread(_objectSpread({}, props), {}, {
|
45
41
|
defaultOpen: isDefaultOpen,
|
46
42
|
closeOnSelect: !isNotClosedOnSelect,
|
47
43
|
shouldFlip: !isNotFlippable
|
48
|
-
})
|
44
|
+
});
|
45
|
+
var state = useMenuTriggerState(menuTriggerState);
|
49
46
|
var _useMenuTrigger = useMenuTrigger({}, state, triggerRef),
|
50
47
|
menuTriggerProps = _useMenuTrigger.menuTriggerProps,
|
51
48
|
menuProps = _useMenuTrigger.menuProps;
|
@@ -63,6 +60,8 @@ var PopoverMenu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
63
60
|
}),
|
64
61
|
positionProps = _useOverlayPosition.overlayProps,
|
65
62
|
placement = _useOverlayPosition.placement;
|
63
|
+
|
64
|
+
/* eslint-disable react/jsx-no-constructed-context-values */
|
66
65
|
var menuContext = _objectSpread(_objectSpread({}, menuProps), {}, {
|
67
66
|
ref: menuRef,
|
68
67
|
onClose: state.close,
|
@@ -91,35 +90,10 @@ var PopoverMenu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
91
90
|
hasNoArrow: hasNoArrow,
|
92
91
|
isDismissable: true,
|
93
92
|
isNonModal: true
|
94
|
-
}, positionProps, menuProps
|
93
|
+
}, positionProps, menuProps, {
|
94
|
+
role: "dialog"
|
95
|
+
}), contents)));
|
95
96
|
});
|
96
|
-
PopoverMenu.propTypes = {
|
97
|
-
/** Alignment of the popover menu relative to the trigger. */
|
98
|
-
align: PropTypes.oneOf(['start', 'end', 'middle']),
|
99
|
-
/** Where the popover menu opens relative to its trigger. */
|
100
|
-
direction: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
|
101
|
-
/** Whether the overlay is open by default (controlled). */
|
102
|
-
isOpen: PropTypes.bool,
|
103
|
-
/** Whether the overlay is open by default (uncontrolled). */
|
104
|
-
isDefaultOpen: PropTypes.bool,
|
105
|
-
/** Whether the popover is prevented from closing when a selection is made. */
|
106
|
-
isNotClosedOnSelect: PropTypes.bool,
|
107
|
-
/**
|
108
|
-
* Whether the popover is prevented from flipping directions when insufficient space is
|
109
|
-
* available for the given `direction` placement.
|
110
|
-
*/
|
111
|
-
isNotFlippable: PropTypes.bool,
|
112
|
-
/** Whether the PopoverMenu hides the arrow. */
|
113
|
-
hasNoArrow: PropTypes.bool,
|
114
|
-
/** Whether the PopoverMenu contains focus inside the scope. */
|
115
|
-
isContainFocus: PropTypes.bool,
|
116
|
-
/**
|
117
|
-
* Handler that is called when the overlay's open state changes.
|
118
|
-
*
|
119
|
-
* `(isOpen: boolean) => void`
|
120
|
-
*/
|
121
|
-
onOpenChange: PropTypes.func
|
122
|
-
};
|
123
97
|
PopoverMenu.defaultProps = {
|
124
98
|
align: 'middle',
|
125
99
|
direction: 'bottom',
|
@@ -4,7 +4,7 @@ import { action } from '@storybook/addon-actions';
|
|
4
4
|
import { withDesign } from 'storybook-addon-designs';
|
5
5
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
6
6
|
import { Button, Item, Menu, OverlayProvider, PopoverMenu, Text } from '../../index';
|
7
|
-
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks
|
7
|
+
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks';
|
8
8
|
import PopoverMenuReadme from './PopoverMenu.mdx';
|
9
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
10
|
export default {
|
@@ -1,4 +1,7 @@
|
|
1
1
|
import { createContext, useContext } from 'react';
|
2
|
+
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
4
|
+
|
2
5
|
export var MenuContext = /*#__PURE__*/createContext({});
|
3
6
|
export var useMenuContext = function useMenuContext() {
|
4
7
|
return useContext(MenuContext);
|
package/lib/types/index.js
CHANGED
@@ -8,12 +8,14 @@ export * from './fieldHelperText';
|
|
8
8
|
export * from './icon';
|
9
9
|
export * from './iconBadge';
|
10
10
|
export * from './iconButton';
|
11
|
+
export * from './input';
|
11
12
|
export * from './item';
|
12
13
|
export * from './link';
|
13
14
|
export * from './listItem';
|
14
15
|
export * from './loader';
|
15
16
|
export * from './overlayPanel';
|
16
17
|
export * from './popoverContainer';
|
18
|
+
export * from './popoverMenu';
|
17
19
|
export * from './separator';
|
18
20
|
export * from './shared';
|
19
21
|
export * from './table';
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|