@pingux/astro 2.32.0-alpha.6 → 2.32.0-alpha.8
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/AccordionGroup/AccordionGroup.stories.js +1 -1
- package/lib/cjs/components/Badge/Badge.stories.js +1 -1
- package/lib/cjs/components/Badge/Convenience/ConvenienceBadges.stories.js +1 -1
- package/lib/cjs/components/Bracket/Bracket.stories.js +1 -1
- package/lib/cjs/components/Breadcrumbs/Breadcrumbs.stories.js +1 -1
- package/lib/cjs/components/Button/Button.stories.d.ts +1 -1
- package/lib/cjs/components/Button/Button.stories.js +1 -1
- package/lib/cjs/components/Calendar/Calendar.stories.js +1 -1
- package/lib/cjs/components/Calendar/Calendar.test.js +9 -32
- package/lib/cjs/components/Callout/Callout.stories.js +1 -1
- package/lib/cjs/components/Card/Card.stories.js +1 -1
- package/lib/cjs/components/CodeView/CodeView.stories.js +1 -1
- package/lib/cjs/components/CollapsiblePanel/CollapsiblePanel.stories.js +1 -1
- package/lib/cjs/components/CopyText/CopyText.stories.js +1 -1
- package/lib/cjs/components/HelpHint/HelpHint.stories.js +1 -1
- package/lib/cjs/components/Icon/Icon.stories.js +1 -1
- package/lib/cjs/components/IconBadge/IconBadge.stories.js +1 -1
- package/lib/cjs/components/IconButton/IconButton.stories.js +1 -1
- package/lib/cjs/components/ImageUploadField/ImageUploadField.test.js +47 -14
- package/lib/cjs/components/Label/Label.test.js +10 -7
- package/lib/cjs/components/Link/Link.stories.js +1 -1
- package/lib/cjs/components/Loader/Loader.stories.js +1 -1
- package/lib/cjs/components/Menu/Menu.stories.js +1 -1
- package/lib/cjs/components/Messages/Messages.js +42 -9
- package/lib/cjs/components/Messages/Messages.stories.js +1 -1
- package/lib/cjs/components/Messages/Messages.test.js +7 -4
- package/lib/cjs/components/Modal/Modal.stories.js +1 -1
- package/lib/cjs/components/NavBar/NavBar.stories.js +1 -1
- package/lib/cjs/components/PanelHeader/PanelHeader.stories.js +1 -1
- package/lib/cjs/components/PanelHeader/PanelHeader.test.js +7 -3
- package/lib/cjs/components/PopoverMenu/PopoverMenu.stories.js +1 -1
- package/lib/cjs/components/RequirementsList/RequirementsList.stories.js +1 -1
- package/lib/cjs/components/ScrollBox/ScrollBox.stories.js +1 -1
- package/lib/cjs/components/Separator/Separator.stories.js +1 -1
- package/lib/cjs/components/Stepper/Stepper.stories.js +1 -1
- package/lib/cjs/hooks/useComponentToggle/index.d.ts +1 -0
- package/lib/cjs/hooks/useComponentToggle/useComponentToggle.d.ts +32 -0
- package/lib/cjs/hooks/useComponentToggle/useComponentToggle.js +4 -20
- package/lib/cjs/hooks/useComponentToggle/useComponentToggle.test.d.ts +1 -0
- package/lib/cjs/hooks/useComponentToggle/useComponentToggle.test.js +8 -9
- package/lib/cjs/hooks/useImageUploadState/index.d.ts +1 -0
- package/lib/cjs/hooks/useImageUploadState/useImageUploadState.d.ts +28 -0
- package/lib/cjs/hooks/useImageUploadState/useImageUploadState.js +9 -6
- package/lib/cjs/recipes/AttributeMapping.stories.js +1 -1
- package/lib/cjs/recipes/ConditionFilter.stories.js +1 -1
- package/lib/cjs/recipes/MaskedValue.stories.js +1 -1
- package/lib/cjs/recipes/MultipagePopup.stories.js +1 -1
- package/lib/cjs/recipes/OneWayToBidirectionalArrow.stories.js +1 -1
- package/lib/cjs/recipes/PanelContent.stories.js +1 -1
- package/lib/cjs/recipes/Slider.stories.js +1 -1
- package/lib/cjs/recipes/TrialExperienceIndustryButtons.stories.js +1 -1
- package/lib/cjs/recipes/TrialExperienceStatusBar.stories.js +1 -1
- package/lib/cjs/utils/designUtils/figmaLinks.d.ts +7 -0
- package/lib/cjs/utils/testUtils/setupTests.d.ts +4 -0
- package/lib/cjs/utils/testUtils/testAxe.d.ts +2 -0
- package/lib/cjs/utils/testUtils/testTheme.d.ts +21 -0
- package/lib/cjs/utils/testUtils/testWrapper.d.ts +5 -0
- package/lib/cjs/utils/testUtils/testWrapper.js +3 -2
- package/lib/cjs/utils/testUtils/universalComponentTest.d.ts +5 -0
- package/lib/cjs/utils/testUtils/universalComponentTest.js +86 -0
- package/lib/components/AccordionGroup/AccordionGroup.stories.js +1 -1
- package/lib/components/Badge/Badge.stories.js +1 -1
- package/lib/components/Badge/Convenience/ConvenienceBadges.stories.js +1 -1
- package/lib/components/Bracket/Bracket.stories.js +1 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.stories.js +1 -1
- package/lib/components/Button/Button.stories.js +1 -1
- package/lib/components/Calendar/Calendar.stories.js +1 -1
- package/lib/components/Calendar/Calendar.test.js +9 -32
- package/lib/components/Callout/Callout.stories.js +1 -1
- package/lib/components/Card/Card.stories.js +1 -1
- package/lib/components/CodeView/CodeView.stories.js +1 -1
- package/lib/components/CollapsiblePanel/CollapsiblePanel.stories.js +1 -1
- package/lib/components/CopyText/CopyText.stories.js +1 -1
- package/lib/components/HelpHint/HelpHint.stories.js +1 -1
- package/lib/components/Icon/Icon.stories.js +1 -1
- package/lib/components/IconBadge/IconBadge.stories.js +1 -1
- package/lib/components/IconButton/IconButton.stories.js +1 -1
- package/lib/components/ImageUploadField/ImageUploadField.test.js +47 -14
- package/lib/components/Label/Label.test.js +8 -5
- package/lib/components/Link/Link.stories.js +1 -1
- package/lib/components/Loader/Loader.stories.js +1 -1
- package/lib/components/Menu/Menu.stories.js +1 -1
- package/lib/components/Messages/Messages.js +47 -15
- package/lib/components/Messages/Messages.stories.js +1 -1
- package/lib/components/Messages/Messages.test.js +7 -4
- package/lib/components/Modal/Modal.stories.js +1 -1
- package/lib/components/NavBar/NavBar.stories.js +1 -1
- package/lib/components/PanelHeader/PanelHeader.stories.js +1 -1
- package/lib/components/PanelHeader/PanelHeader.test.js +7 -3
- package/lib/components/PopoverMenu/PopoverMenu.stories.js +1 -1
- package/lib/components/RequirementsList/RequirementsList.stories.js +1 -1
- package/lib/components/ScrollBox/ScrollBox.stories.js +1 -1
- package/lib/components/Separator/Separator.stories.js +1 -1
- package/lib/components/Stepper/Stepper.stories.js +1 -1
- package/lib/hooks/useComponentToggle/useComponentToggle.js +4 -21
- package/lib/hooks/useComponentToggle/useComponentToggle.test.js +8 -9
- package/lib/hooks/useImageUploadState/useImageUploadState.js +9 -6
- package/lib/recipes/AttributeMapping.stories.js +1 -1
- package/lib/recipes/ConditionFilter.stories.js +1 -1
- package/lib/recipes/MaskedValue.stories.js +1 -1
- package/lib/recipes/MultipagePopup.stories.js +1 -1
- package/lib/recipes/OneWayToBidirectionalArrow.stories.js +1 -1
- package/lib/recipes/PanelContent.stories.js +1 -1
- package/lib/recipes/Slider.stories.js +1 -1
- package/lib/recipes/TrialExperienceIndustryButtons.stories.js +1 -1
- package/lib/recipes/TrialExperienceStatusBar.stories.js +1 -1
- package/lib/utils/testUtils/testWrapper.js +3 -2
- package/lib/utils/testUtils/universalComponentTest.js +74 -0
- package/package.json +4 -1
@@ -1,9 +1,8 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import React from 'react';
|
3
3
|
import { fireEvent, render, screen } from '@testing-library/react';
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import Label from '.';
|
4
|
+
import { Input, Label } from '../..';
|
5
|
+
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
7
6
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
7
|
var testId = 'test-label';
|
9
8
|
var defaultProps = {
|
@@ -14,8 +13,12 @@ var getComponent = function getComponent() {
|
|
14
13
|
return render(___EmotionJSX(Label, _extends({}, defaultProps, props)));
|
15
14
|
};
|
16
15
|
|
17
|
-
//
|
18
|
-
|
16
|
+
// Needs to be added to each components test file
|
17
|
+
universalComponentTests({
|
18
|
+
renderComponent: function renderComponent(props) {
|
19
|
+
return ___EmotionJSX(Label, props);
|
20
|
+
}
|
21
|
+
});
|
19
22
|
test('default label', function () {
|
20
23
|
getComponent();
|
21
24
|
var label = screen.getByTestId(testId);
|
@@ -5,7 +5,7 @@ import React from 'react';
|
|
5
5
|
import { withDesign } from 'storybook-addon-designs';
|
6
6
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
7
7
|
import { Link } from '../../index';
|
8
|
-
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.
|
8
|
+
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.ts';
|
9
9
|
import { htmlElements } from '../../utils/devUtils/constants/htmlElements';
|
10
10
|
import LinkReadme from './Link.mdx';
|
11
11
|
import variants from './Link.styles';
|
@@ -5,7 +5,7 @@ import { withDesign } from 'storybook-addon-designs';
|
|
5
5
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
6
6
|
import { Loader } from '../../index';
|
7
7
|
import { flatColorList } from '../../styles/colors';
|
8
|
-
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.
|
8
|
+
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.ts';
|
9
9
|
import LoaderReadme from './Loader.mdx';
|
10
10
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
11
11
|
export default {
|
@@ -5,7 +5,7 @@ import { Item } from 'react-stately';
|
|
5
5
|
import { withDesign } from 'storybook-addon-designs';
|
6
6
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
7
7
|
import { Menu, Text } from '../../index';
|
8
|
-
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.
|
8
|
+
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.ts';
|
9
9
|
import MenuReadme from './Menu.mdx';
|
10
10
|
import { menuArgTypes } from './menuAttributes';
|
11
11
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -1,40 +1,72 @@
|
|
1
|
-
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
2
|
-
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
3
|
-
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
4
|
-
var _excluded = ["items", "onClose"];
|
5
|
-
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; }
|
6
|
-
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; }
|
7
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
8
|
-
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
9
1
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
10
2
|
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
11
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
12
3
|
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
13
4
|
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
14
5
|
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
15
6
|
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
16
7
|
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
17
|
-
import
|
18
|
-
import
|
8
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
9
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
10
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
11
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
12
|
+
var _excluded = ["items", "onClose"];
|
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
|
+
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; }
|
15
|
+
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
16
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
17
|
+
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
18
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
19
|
+
import React, { forwardRef, useCallback, useEffect, useState } from 'react';
|
20
|
+
import { useCollection } from '@react-stately/collections';
|
21
|
+
import { ListCollection } from '@react-stately/list';
|
19
22
|
import PropTypes from 'prop-types';
|
20
23
|
import { statusPropTypes } from '../../utils/docUtils/statusProp';
|
21
24
|
import Box from '../Box';
|
22
25
|
import Message from './Message';
|
23
26
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
24
27
|
var Messages = /*#__PURE__*/forwardRef(function (props, ref) {
|
25
|
-
var _context;
|
26
28
|
var items = props.items,
|
27
29
|
onClose = props.onClose,
|
28
30
|
others = _objectWithoutProperties(props, _excluded);
|
29
|
-
var
|
31
|
+
var _useState = useState([]),
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
33
|
+
messages = _useState2[0],
|
34
|
+
setMessages = _useState2[1];
|
35
|
+
var factory = useCallback(function (nodes) {
|
36
|
+
return new ListCollection(nodes);
|
37
|
+
}, []);
|
38
|
+
var collection = useCollection(props, factory);
|
39
|
+
useEffect(function () {
|
40
|
+
setMessages(_Array$from(collection));
|
41
|
+
}, [collection]);
|
42
|
+
var removeMessage = function removeMessage(key) {
|
43
|
+
setMessages(_mapInstanceProperty(messages).call(messages, function (item) {
|
44
|
+
return item.key === key ? _objectSpread(_objectSpread({}, item), {}, {
|
45
|
+
props: _objectSpread(_objectSpread({}, item.props), {}, {
|
46
|
+
isHidden: true
|
47
|
+
})
|
48
|
+
}) : item;
|
49
|
+
}));
|
50
|
+
_setTimeout(function () {
|
51
|
+
return setMessages(_filterInstanceProperty(messages).call(messages, function (item) {
|
52
|
+
return item.key !== key;
|
53
|
+
}));
|
54
|
+
}, 200);
|
55
|
+
};
|
56
|
+
var onCloseHandler = function onCloseHandler(key) {
|
57
|
+
if (onClose) {
|
58
|
+
onClose(key);
|
59
|
+
}
|
60
|
+
removeMessage(key);
|
61
|
+
};
|
30
62
|
return ___EmotionJSX(Box, _extends({
|
31
63
|
ref: ref,
|
32
64
|
variant: "message.wrapper"
|
33
|
-
}, others), _mapInstanceProperty(
|
65
|
+
}, others), _mapInstanceProperty(messages).call(messages, function (item) {
|
34
66
|
return ___EmotionJSX(Message, {
|
35
67
|
key: item.key,
|
36
68
|
item: item,
|
37
|
-
onClose:
|
69
|
+
onClose: onCloseHandler
|
38
70
|
});
|
39
71
|
}));
|
40
72
|
});
|
@@ -21,7 +21,7 @@ import AccountIcon from '@pingux/mdi-react/AccountIcon';
|
|
21
21
|
import { withDesign } from 'storybook-addon-designs';
|
22
22
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
23
23
|
import { Box, Button, Messages } from '../../index';
|
24
|
-
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.
|
24
|
+
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.ts';
|
25
25
|
import statuses from '../../utils/devUtils/constants/statuses';
|
26
26
|
import { messagesReducerStory as messagesReducer, multiMessagesReducerStory as multiMessagesReducer } from './index';
|
27
27
|
import MessagesReadme from './Messages.mdx';
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
-
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
3
2
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
4
3
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
5
4
|
import React from 'react';
|
5
|
+
import { act } from 'react-dom/test-utils';
|
6
6
|
import { Item } from 'react-stately';
|
7
7
|
import AccountIcon from '@pingux/mdi-react/AccountIcon';
|
8
8
|
import userEvent from '@testing-library/user-event';
|
@@ -92,14 +92,17 @@ test('`onClose` get as first arg key of message', function () {
|
|
92
92
|
expect(onClose).toHaveBeenCalledWith('message1');
|
93
93
|
});
|
94
94
|
test('click on close button removes message after delay', function () {
|
95
|
+
act(function () {
|
96
|
+
global.setTimeout = jest.fn(function (cb) {
|
97
|
+
return cb();
|
98
|
+
});
|
99
|
+
});
|
95
100
|
getComponent();
|
96
101
|
var messages = screen.getByTestId(testId);
|
97
102
|
expect(messages.childElementCount).toBe(2);
|
98
103
|
var buttons = screen.getAllByRole('button');
|
99
104
|
userEvent.click(buttons[0]);
|
100
|
-
|
101
|
-
expect(messages.childElementCount).toBe(1);
|
102
|
-
}, 200);
|
105
|
+
expect(messages.childElementCount).toBe(1);
|
103
106
|
});
|
104
107
|
test('Item accepts a data-id and the data-id can be found in the DOM', function () {
|
105
108
|
getComponent();
|
@@ -4,7 +4,7 @@ import { withDesign } from 'storybook-addon-designs';
|
|
4
4
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
5
5
|
import { useModalState } from '../../hooks';
|
6
6
|
import { Box, Button, Modal, OverlayProvider, Text } from '../../index';
|
7
|
-
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.
|
7
|
+
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.ts';
|
8
8
|
import { modalSizes } from '../../utils/devUtils/constants/modalSizes';
|
9
9
|
import ModalReadme from './Modal.mdx';
|
10
10
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -14,7 +14,7 @@ import ViewGridPlusOutline from '@pingux/mdi-react/ViewGridPlusOutlineIcon';
|
|
14
14
|
import { withDesign } from 'storybook-addon-designs';
|
15
15
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
16
16
|
import { Box, Link, NavBar, NavBarItem, NavBarItemButton, NavBarItemLink, NavBarSection, Separator } from '../../index';
|
17
|
-
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.
|
17
|
+
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.ts';
|
18
18
|
import NavBarReadme from './NavBar.mdx';
|
19
19
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
20
20
|
export default {
|
@@ -5,7 +5,7 @@ import AccountIcon from '@pingux/mdi-react/AccountIcon';
|
|
5
5
|
import ChevronRightIcon from '@pingux/mdi-react/ChevronRightIcon';
|
6
6
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
7
7
|
import { Breadcrumbs, Item, PanelHeader, PanelHeaderCloseButton, PanelHeaderMenu, PanelHeaderSwitchField } from '../../index';
|
8
|
-
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.
|
8
|
+
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.ts';
|
9
9
|
import { pingImg } from '../../utils/devUtils/constants/images';
|
10
10
|
import { SharedItemArgTypes } from '../ListViewItem/listViewItemAttributes';
|
11
11
|
import PanelHeaderReadMe from './PanelHeader.mdx';
|
@@ -16,8 +16,8 @@ import AccountIcon from '@pingux/mdi-react/AccountIcon';
|
|
16
16
|
import { act } from '@testing-library/react';
|
17
17
|
import { PanelHeader, PanelHeaderSwitchField } from '../../index';
|
18
18
|
import { pingImg } from '../../utils/devUtils/constants/images';
|
19
|
-
import axeTest from '../../utils/testUtils/testAxe';
|
20
19
|
import { render, screen } from '../../utils/testUtils/testWrapper';
|
20
|
+
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
21
21
|
import { PANEL_HEADER_ICON } from './PanelHeader';
|
22
22
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
23
23
|
var defaultProps = {
|
@@ -44,8 +44,12 @@ jest.mock('../../hooks/useFallbackImage', function () {
|
|
44
44
|
};
|
45
45
|
});
|
46
46
|
|
47
|
-
//
|
48
|
-
|
47
|
+
// Needs to be added to each components test file
|
48
|
+
universalComponentTests({
|
49
|
+
renderComponent: function renderComponent(props) {
|
50
|
+
return ___EmotionJSX(PanelHeader, _extends({}, defaultProps, props));
|
51
|
+
}
|
52
|
+
});
|
49
53
|
describe('PanelHeader', function () {
|
50
54
|
test('renders data', function () {
|
51
55
|
var _context;
|
@@ -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.ts';
|
8
8
|
import PopoverMenuReadme from './PopoverMenu.mdx';
|
9
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
10
|
export default {
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
2
2
|
import { withDesign } from 'storybook-addon-designs';
|
3
3
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
4
4
|
import { RequirementsList } from '../../index';
|
5
|
-
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.
|
5
|
+
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.ts';
|
6
6
|
import RequirementsListReadme from './RequirementsList.mdx';
|
7
7
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
8
|
export default {
|
@@ -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.
|
6
|
+
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.ts';
|
7
7
|
import ScrollBoxReadme from './ScrollBox.mdx';
|
8
8
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
9
9
|
export default {
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
4
4
|
import { withDesign } from 'storybook-addon-designs';
|
5
5
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
6
6
|
import { Box, Separator } from '../../index';
|
7
|
-
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.
|
7
|
+
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.ts';
|
8
8
|
import SeparatorReadme from './Separator.mdx';
|
9
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
10
|
export default {
|
@@ -4,7 +4,7 @@ import { Item } from 'react-stately';
|
|
4
4
|
import { withDesign } from 'storybook-addon-designs';
|
5
5
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
6
6
|
import { Stepper, Text } from '../../index';
|
7
|
-
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.
|
7
|
+
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.ts';
|
8
8
|
import StepperReadme from './Stepper.mdx';
|
9
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
10
|
export default {
|
@@ -1,31 +1,14 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
2
2
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
3
3
|
import { useProgressiveState } from '../index';
|
4
|
-
|
5
|
-
/**
|
6
|
-
* Returns one of two components that are supplied via props.
|
7
|
-
* A boolean value is used to determine which component to render.
|
8
|
-
* State can be handled by either props or within this hook if props are not provided.
|
9
|
-
* Also returns a function that inverts the boolean attribute, and calls a callback function.
|
10
|
-
* @param {Object} [props] Properties provided to the state
|
11
|
-
* @param {Boolean} [props.condition] Boolean that controls which component is returned.
|
12
|
-
* @param {Component} [props.ComponentToRenderIfTrue]
|
13
|
-
* Component that is returned when the condition is true.
|
14
|
-
* @param {Component} [props.ComponentToRenderIfFalse]
|
15
|
-
* Component that is returned when the condition is false.
|
16
|
-
* @param {Function} [props.onConditionChange]
|
17
|
-
* Callback function that is called, when the condition boolean changes, if it is provided .
|
18
|
-
* @returns {Object} `{ isOpen: Boolean, open: Function, close: Function, toggle: Function }`
|
19
|
-
* @returns {Object} `{ handleCondtionChange: Function, renderedComponent: Component, }`
|
20
|
-
*/
|
21
|
-
|
22
|
-
var useComponentToggle = function useComponentToggle() {
|
23
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4
|
+
var useComponentToggle = function useComponentToggle(props) {
|
24
5
|
var ComponentToRenderIfTrue = props.ComponentToRenderIfTrue,
|
25
6
|
ComponentToRenderIfFalse = props.ComponentToRenderIfFalse,
|
26
7
|
condition = props.condition,
|
27
8
|
onConditionChange = props.onConditionChange;
|
28
|
-
var _useProgressiveState = useProgressiveState(condition, function () {
|
9
|
+
var _useProgressiveState = useProgressiveState(condition, function () {
|
10
|
+
return null;
|
11
|
+
}),
|
29
12
|
_useProgressiveState2 = _slicedToArray(_useProgressiveState, 2),
|
30
13
|
isToggled = _useProgressiveState2[0],
|
31
14
|
setIsToggled = _useProgressiveState2[1];
|
@@ -9,7 +9,6 @@ import _reverseInstanceProperty from "@babel/runtime-corejs3/core-js-stable/inst
|
|
9
9
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
10
10
|
import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
|
11
11
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
|
12
|
-
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
13
12
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
14
13
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = _Object$defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof _Symbol ? _Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return _Object$defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = _Object$create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = _Object$getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype); function defineIteratorMethods(prototype) { var _context3; _forEachInstanceProperty(_context3 = ["next", "throw", "return"]).call(_context3, function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = _Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return _reverseInstanceProperty(keys).call(keys), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { var _context4; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context4 = this.tryEntries).call(_context4, resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
15
14
|
import React, { useState } from 'react';
|
@@ -23,8 +22,8 @@ var condition = false;
|
|
23
22
|
var defaultProps = {
|
24
23
|
condition: condition,
|
25
24
|
onConditionChange: callback,
|
26
|
-
ComponentToRenderIfTrue:
|
27
|
-
ComponentToRenderIfFalse:
|
25
|
+
ComponentToRenderIfTrue: ___EmotionJSX("span", null, "true-string"),
|
26
|
+
ComponentToRenderIfFalse: ___EmotionJSX("span", null, "false-string")
|
28
27
|
};
|
29
28
|
var TestComponent = function TestComponent() {
|
30
29
|
var _useState = useState(false),
|
@@ -34,26 +33,26 @@ var TestComponent = function TestComponent() {
|
|
34
33
|
var conditionalRenderProps = {
|
35
34
|
condition: thisCondition,
|
36
35
|
onConditionChange: setCondition,
|
37
|
-
ComponentToRenderIfTrue:
|
38
|
-
ComponentToRenderIfFalse:
|
36
|
+
ComponentToRenderIfTrue: ___EmotionJSX("span", null, "true-string"),
|
37
|
+
ComponentToRenderIfFalse: ___EmotionJSX("span", null, "false-string"),
|
39
38
|
onConditionChangeProp: callback
|
40
39
|
};
|
41
40
|
var _useComponentToggle = useComponentToggle(conditionalRenderProps),
|
42
41
|
handleConditionChange = _useComponentToggle.handleConditionChange,
|
43
42
|
RenderedComponent = _useComponentToggle.RenderedComponent;
|
44
43
|
return ___EmotionJSX("button", {
|
44
|
+
type: "button",
|
45
45
|
"data-testid": "test-div",
|
46
46
|
onClick: handleConditionChange,
|
47
47
|
onKeyDown: handleConditionChange
|
48
48
|
}, RenderedComponent);
|
49
49
|
};
|
50
50
|
var getComponent = function getComponent() {
|
51
|
-
|
52
|
-
return render(___EmotionJSX(TestComponent, _extends({}, props, defaultProps)));
|
51
|
+
return render(___EmotionJSX(TestComponent, null));
|
53
52
|
};
|
54
53
|
test('default useField', function () {
|
55
54
|
renderHook(function () {
|
56
|
-
return useComponentToggle();
|
55
|
+
return useComponentToggle(defaultProps);
|
57
56
|
});
|
58
57
|
});
|
59
58
|
test('callback function should call, if provided', function () {
|
@@ -76,7 +75,7 @@ test('expect hook to return correct data shape', /*#__PURE__*/_asyncToGenerator(
|
|
76
75
|
}), result = _renderHook2.result;
|
77
76
|
_result$current = result.current, handleConditionChange = _result$current.handleConditionChange, RenderedComponent = _result$current.RenderedComponent;
|
78
77
|
expect(handleConditionChange).toEqual(expect.any(Function));
|
79
|
-
expect(RenderedComponent).toEqual(
|
78
|
+
expect(RenderedComponent).toEqual(___EmotionJSX("span", null, "false-string"));
|
80
79
|
case 4:
|
81
80
|
case "end":
|
82
81
|
return _context.stop();
|
@@ -35,11 +35,15 @@ var useImageUploadState = function useImageUploadState(inputRef) {
|
|
35
35
|
if (previewImage && previewImage !== defaultPreviewImage) {
|
36
36
|
setIsMenuOpen(true);
|
37
37
|
} else {
|
38
|
-
|
38
|
+
var _inputRef$current;
|
39
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.click();
|
39
40
|
}
|
40
41
|
}, [defaultPreviewImage, previewImage, inputRef]);
|
41
42
|
var handleInputChange = useCallback(function (event) {
|
42
43
|
var _event$target;
|
44
|
+
if (!event.target.files) {
|
45
|
+
return;
|
46
|
+
}
|
43
47
|
var eventFileType = (_event$target = event.target) === null || _event$target === void 0 || (_event$target = _event$target.files[0]) === null || _event$target === void 0 || (_event$target = _event$target.type) === null || _event$target === void 0 ? void 0 : _event$target.split('/')[0];
|
44
48
|
if (fileTypes !== null && fileTypes !== void 0 && _includesInstanceProperty(fileTypes).call(fileTypes, eventFileType)) {
|
45
49
|
if (onChange && typeof onChange === 'function') {
|
@@ -52,9 +56,8 @@ var useImageUploadState = function useImageUploadState(inputRef) {
|
|
52
56
|
var _event$target2;
|
53
57
|
setIsImageType(true);
|
54
58
|
var reader = new FileReader();
|
55
|
-
reader.onload = function (
|
56
|
-
|
57
|
-
setPreviewImage(result);
|
59
|
+
reader.onload = function () {
|
60
|
+
setPreviewImage(reader.result);
|
58
61
|
};
|
59
62
|
reader.readAsDataURL((_event$target2 = event.target) === null || _event$target2 === void 0 ? void 0 : _event$target2.files[0]);
|
60
63
|
} else {
|
@@ -76,8 +79,8 @@ var useImageUploadState = function useImageUploadState(inputRef) {
|
|
76
79
|
return setPreviewImage(defaultPreviewImage);
|
77
80
|
}, [defaultPreviewImage]);
|
78
81
|
var showFileDialog = useCallback(function () {
|
79
|
-
var _inputRef$
|
80
|
-
return inputRef === null || inputRef === void 0 || (_inputRef$
|
82
|
+
var _inputRef$current2;
|
83
|
+
return inputRef === null || inputRef === void 0 || (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.click();
|
81
84
|
}, [inputRef]);
|
82
85
|
var handleLabelClick = useCallback(function (e) {
|
83
86
|
e.preventDefault();
|
@@ -9,7 +9,7 @@ import CogsIcon from '@pingux/mdi-react/CogsIcon';
|
|
9
9
|
import DeleteIcon from '@pingux/mdi-react/DeleteIcon';
|
10
10
|
import { v4 as uuid } from 'uuid';
|
11
11
|
import { Badge, Box, Callout, CheckboxField, ComboBoxField, Icon, IconButton, Item, Link, ScrollBox, Separator, Text, TextField } from '../index';
|
12
|
-
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.
|
12
|
+
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.ts';
|
13
13
|
import statuses from '../utils/devUtils/constants/statuses';
|
14
14
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
15
15
|
export default {
|
@@ -14,7 +14,7 @@ import React from 'react';
|
|
14
14
|
import PlusIcon from '@pingux/mdi-react/PlusIcon';
|
15
15
|
import TrashIcon from '@pingux/mdi-react/TrashIcon';
|
16
16
|
import { Badge, Box, Bracket, Button, Icon, IconButton, Item, RockerButton, RockerButtonGroup, SelectField, Text, TextField } from '../index';
|
17
|
-
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.
|
17
|
+
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.ts';
|
18
18
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
19
19
|
export default {
|
20
20
|
title: 'Recipes/Condition Filter',
|
@@ -5,7 +5,7 @@ import EyeOffIcon from '@pingux/mdi-react/EyeOffOutlineIcon';
|
|
5
5
|
import EyeIcon from '@pingux/mdi-react/EyeOutlineIcon';
|
6
6
|
import { useStatusClasses } from '../hooks';
|
7
7
|
import { Box, Icon, IconButton, Text } from '../index';
|
8
|
-
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.
|
8
|
+
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.ts';
|
9
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
10
|
export default {
|
11
11
|
title: 'Recipes/Masked Values',
|
@@ -22,7 +22,7 @@ import MenuUpIcon from '@pingux/mdi-react/MenuUpIcon';
|
|
22
22
|
import { useLayoutEffect } from '@react-aria/utils';
|
23
23
|
import { Box, Button, EnvironmentBreadcrumb, Icon, IconButton, Item, Link, Menu, NavBar, NavBarItem, NavBarItemButton, NavBarSection, OverlayProvider, PopoverContainer, PopoverMenu, Separator, Text } from '../index';
|
24
24
|
import { data, logo, PersonIcon, secondData, thirdData } from '../styles/templates/Nav/NavData';
|
25
|
-
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.
|
25
|
+
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.ts';
|
26
26
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
27
27
|
export default {
|
28
28
|
title: 'Recipes/Multipage Popup',
|
@@ -4,7 +4,7 @@ import CogsIcon from '@pingux/mdi-react/CogsIcon';
|
|
4
4
|
import DeleteIcon from '@pingux/mdi-react/DeleteIcon';
|
5
5
|
import DragVerticalIcon from '@pingux/mdi-react/DragVerticalIcon';
|
6
6
|
import { Box, ComboBoxField, Icon, IconButton, IconButtonToggle, Item } from '../index';
|
7
|
-
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.
|
7
|
+
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.ts';
|
8
8
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
9
9
|
export default {
|
10
10
|
title: 'Recipes/One Way to Bidirectional Arrow'
|
@@ -8,7 +8,7 @@ import PencilIcon from '@pingux/mdi-react/PencilIcon';
|
|
8
8
|
import PlusIcon from '@pingux/mdi-react/PlusIcon';
|
9
9
|
import { useOverlayPanelState } from '../hooks';
|
10
10
|
import { AccordionGroup, Badge, Box, Button, ButtonBar, CheckboxField, EditButton, Icon, Image, ImageUploadField, NoticeIcon, OverlayPanel, OverlayProvider, PanelHeader, PanelHeaderCloseButton, PanelHeaderMenu, PanelHeaderSwitchField, SelectField, Tab, Tabs, Text, TextField } from '../index';
|
11
|
-
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.
|
11
|
+
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.ts';
|
12
12
|
import UserImage from '../utils/devUtils/assets/UserImage.png';
|
13
13
|
import statuses from '../utils/devUtils/constants/statuses';
|
14
14
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -18,7 +18,7 @@ import { useSliderState } from 'react-stately';
|
|
18
18
|
import { useNumberFormatter } from '@react-aria/i18n';
|
19
19
|
import { defaultFocus } from '../components/Button/Buttons.styles';
|
20
20
|
import { Box } from '../index';
|
21
|
-
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.
|
21
|
+
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.ts';
|
22
22
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
23
23
|
export default {
|
24
24
|
title: 'Recipes/Slider'
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
4
4
|
import CloseIcon from '@pingux/mdi-react/CloseIcon';
|
5
5
|
import { useModalState } from '../hooks';
|
6
6
|
import { Box, Button, Icon, IconButton, Modal, OverlayProvider, Text } from '../index';
|
7
|
-
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.
|
7
|
+
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.ts';
|
8
8
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
9
9
|
export default {
|
10
10
|
title: 'Recipes/Trial Experience Buttons'
|
@@ -5,7 +5,7 @@ import React, { useState } from 'react';
|
|
5
5
|
import CheckCircleIcon from '@pingux/mdi-react/CheckCircleIcon';
|
6
6
|
import { v4 as uuid } from 'uuid';
|
7
7
|
import { Box, Icon, IconButton, Link, Separator, Text } from '../index';
|
8
|
-
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.
|
8
|
+
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.ts';
|
9
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
10
|
export default {
|
11
11
|
title: 'Recipes/Trial Experience Nav'
|
@@ -22,7 +22,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
22
22
|
} : {
|
23
23
|
name: "zxbwtf-GlobalTestStyles",
|
24
24
|
styles: ".is-disabled{opacity:0.5;pointer-events:none;};label:GlobalTestStyles;",
|
25
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
25
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy91dGlscy90ZXN0VXRpbHMvdGVzdFdyYXBwZXIudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVVTIiwiZmlsZSI6Ii4uLy4uLy4uL3NyYy91dGlscy90ZXN0VXRpbHMvdGVzdFdyYXBwZXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0LCB7IFJlYWN0Tm9kZSB9IGZyb20gJ3JlYWN0JztcbmltcG9ydCB7IGNzcywgR2xvYmFsIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHsgcmVuZGVyLCBSZW5kZXJPcHRpb25zIH0gZnJvbSAnQHRlc3RpbmctbGlicmFyeS9yZWFjdCc7XG5pbXBvcnQgeyBUaGVtZVByb3ZpZGVyIH0gZnJvbSAndGhlbWUtdWknO1xuXG5pbXBvcnQgdGhlbWUgZnJvbSAnLi4vLi4vc3R5bGVzL3RoZW1lJztcblxuY29uc3QgR2xvYmFsVGVzdFN0eWxlczogUmVhY3QuRkMgPSAoKSA9PiAoXG4gIDxHbG9iYWxcbiAgICBzdHlsZXM9e1xuICAgICAgY3NzYFxuICAgICAgICAuaXMtZGlzYWJsZWQge1xuICAgICAgICAgIG9wYWNpdHk6IDAuNTtcbiAgICAgICAgICBwb2ludGVyLWV2ZW50czogbm9uZTtcbiAgICAgICAgfVxuICAgICAgYFxuICAgIH1cbiAgLz5cbik7XG5cbi8qKlxuICogVE9ETzogQ2hhbmdlIEplc3QgY29uZmlnIHNvIHRoaXMgZG9lc24ndCBoYXZlIHRvIGJlIGltcG9ydGVkIHJlbGF0aXZlbHkuLi5cbiAqIGh0dHBzOi8vdGVzdGluZy1saWJyYXJ5LmNvbS9kb2NzL3JlYWN0LXRlc3RpbmctbGlicmFyeS9zZXR1cC8jY29uZmlndXJpbmctamVzdC13aXRoLXRlc3QtdXRpbHNcbiAqXG4gKiBVc2UgdGhpcyB3cmFwcGVyIHdoZW4gdGVzdGluZyB0aGUgdGhlbWUgb3V0cHV0IGZvclxuICogYSBjb21wb25lbnQgdXNpbmcgLnRvSGF2ZVN0eWxlIG9yIC50b0hhdmVTdHlsZVJ1bGVcbiAqXG4gKiBTZWUgQnV0dG9uLnRlc3QuanMgYXMgYW4gZXhhbXBsZSBmb3IgaG93IHRvIGFwcGx5IGNvbmRpdGlvbmFsIGNsYXNzZXMgYW5kIHRoZW4gdGVzdGluZyB0aGF0XG4gKiB0aG9zZSBjbGFzc2VzIGhhdmUgdGhlIGFwcHJvcHJpYXRlIHN0eWxlcyB0aWVkIHRvIHRoZW0gaW4gdGhlIHRoZW1lLlxuICovXG5cbmludGVyZmFjZSBXcmFwcGVyUHJvcHMge1xuICBjaGlsZHJlbjogUmVhY3ROb2RlO1xufVxuXG5jb25zdCBXcmFwcGVyOiBSZWFjdC5GQzxXcmFwcGVyUHJvcHM+ID0gKHsgY2hpbGRyZW4gfSkgPT4gKFxuICA8VGhlbWVQcm92aWRlciB0aGVtZT17dGhlbWV9PlxuICAgIDxHbG9iYWxUZXN0U3R5bGVzIC8+XG4gICAge2NoaWxkcmVufVxuICA8L1RoZW1lUHJvdmlkZXI+XG4pO1xuXG5jb25zdCBjdXN0b21SZW5kZXIgPSAodWk6IFJlYWN0LlJlYWN0RWxlbWVudCwgb3B0aW9ucz86IFJlbmRlck9wdGlvbnMpID0+IHJlbmRlcih1aSxcbiAgeyB3cmFwcGVyOiBXcmFwcGVyIGFzIFJlYWN0LkZDLCAuLi5vcHRpb25zIH0sXG4pO1xuXG4vLyByZS1leHBvcnQgZXZlcnl0aGluZyAtXG5leHBvcnQgKiBmcm9tICdAdGVzdGluZy1saWJyYXJ5L3JlYWN0JztcblxuLy8gb3ZlcnJpZGUgcmVuZGVyIG1ldGhvZFxuZXhwb3J0IHsgY3VzdG9tUmVuZGVyIGFzIHJlbmRlciB9O1xuIl19 */",
|
26
26
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
27
27
|
};
|
28
28
|
var GlobalTestStyles = function GlobalTestStyles() {
|
@@ -41,6 +41,7 @@ var GlobalTestStyles = function GlobalTestStyles() {
|
|
41
41
|
* See Button.test.js as an example for how to apply conditional classes and then testing that
|
42
42
|
* those classes have the appropriate styles tied to them in the theme.
|
43
43
|
*/
|
44
|
+
|
44
45
|
var Wrapper = function Wrapper(_ref2) {
|
45
46
|
var children = _ref2.children;
|
46
47
|
return ___EmotionJSX(ThemeProvider, {
|
@@ -53,7 +54,7 @@ var customRender = function customRender(ui, options) {
|
|
53
54
|
}, options));
|
54
55
|
};
|
55
56
|
|
56
|
-
// re-export everything
|
57
|
+
// re-export everything -
|
57
58
|
export * from '@testing-library/react';
|
58
59
|
|
59
60
|
// override render method
|