@pingux/astro 1.1.0-alpha.7 → 1.1.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +71 -0
- package/lib/cjs/components/CodeView/CodeView.js +175 -0
- package/lib/cjs/components/CodeView/CodeView.stories.js +93 -0
- package/lib/cjs/components/CodeView/CodeView.test.js +211 -0
- package/lib/cjs/components/CodeView/index.js +18 -0
- package/lib/cjs/components/CopyText/CopyText.js +34 -11
- package/lib/cjs/components/FileInputField/FileItem.js +2 -1
- package/lib/cjs/components/List/List.js +3 -0
- package/lib/cjs/components/List/List.stories.js +7 -2
- package/lib/cjs/components/NavBar/NavBar.js +38 -0
- package/lib/cjs/components/NavBar/NavBar.stories.js +679 -0
- package/lib/cjs/components/NavBar/NavBar.test.js +116 -0
- package/lib/cjs/components/NavBar/index.js +18 -0
- package/lib/cjs/components/NavBarSection/NavBarItemBody.js +56 -0
- package/lib/cjs/components/NavBarSection/NavBarItemHeader.js +47 -0
- package/lib/cjs/components/NavBarSection/NavBarSection.js +82 -0
- package/lib/cjs/components/NavBarSection/index.js +18 -0
- package/lib/cjs/components/OverlayPanel/OverlayPanel.js +53 -6
- package/lib/cjs/components/OverlayPanel/OverlayPanel.stories.js +59 -47
- package/lib/cjs/components/OverlayPanel/OverlayPanel.test.js +84 -0
- package/lib/cjs/components/PopoverMenu/PopoverMenu.js +1 -3
- package/lib/cjs/components/Separator/Separator.js +1 -1
- package/lib/cjs/components/TextArea/TextArea.js +5 -1
- package/lib/cjs/components/TooltipTrigger/TooltipTrigger.js +10 -5
- package/lib/cjs/hooks/useOverlayPanelState/useOverlayPanelState.js +20 -1
- package/lib/cjs/hooks/useOverlayPanelState/useOverlayPanelState.test.js +7 -3
- package/lib/cjs/index.js +84 -30
- package/lib/cjs/styles/variants/accordion.js +32 -1
- package/lib/cjs/styles/variants/boxes.js +24 -1
- package/lib/cjs/styles/variants/buttons.js +29 -1
- package/lib/cjs/styles/variants/codeView.js +77 -0
- package/lib/cjs/styles/variants/link.js +1 -1
- package/lib/cjs/styles/variants/separator.js +46 -3
- package/lib/cjs/styles/variants/text.js +15 -0
- package/lib/cjs/styles/variants/variants.js +3 -0
- package/lib/components/CodeView/CodeView.js +139 -0
- package/lib/components/CodeView/CodeView.stories.js +67 -0
- package/lib/components/CodeView/CodeView.test.js +171 -0
- package/lib/components/CodeView/index.js +1 -0
- package/lib/components/CopyText/CopyText.js +35 -11
- package/lib/components/FileInputField/FileItem.js +2 -1
- package/lib/components/List/List.js +2 -0
- package/lib/components/List/List.stories.js +6 -2
- package/lib/components/NavBar/NavBar.js +24 -0
- package/lib/components/NavBar/NavBar.stories.js +650 -0
- package/lib/components/NavBar/NavBar.test.js +92 -0
- package/lib/components/NavBar/index.js +1 -0
- package/lib/components/NavBarSection/NavBarItemBody.js +37 -0
- package/lib/components/NavBarSection/NavBarItemHeader.js +31 -0
- package/lib/components/NavBarSection/NavBarSection.js +65 -0
- package/lib/components/NavBarSection/index.js +1 -0
- package/lib/components/OverlayPanel/OverlayPanel.js +52 -8
- package/lib/components/OverlayPanel/OverlayPanel.stories.js +59 -49
- package/lib/components/OverlayPanel/OverlayPanel.test.js +73 -1
- package/lib/components/PopoverMenu/PopoverMenu.js +1 -3
- package/lib/components/Separator/Separator.js +1 -1
- package/lib/components/TextArea/TextArea.js +5 -1
- package/lib/components/TooltipTrigger/TooltipTrigger.js +10 -5
- package/lib/hooks/useOverlayPanelState/useOverlayPanelState.js +20 -1
- package/lib/hooks/useOverlayPanelState/useOverlayPanelState.test.js +7 -3
- package/lib/index.js +5 -0
- package/lib/styles/variants/accordion.js +32 -1
- package/lib/styles/variants/boxes.js +24 -1
- package/lib/styles/variants/buttons.js +29 -1
- package/lib/styles/variants/codeView.js +67 -0
- package/lib/styles/variants/link.js +1 -1
- package/lib/styles/variants/separator.js +33 -1
- package/lib/styles/variants/text.js +15 -0
- package/lib/styles/variants/variants.js +2 -0
- package/package.json +3 -2
@@ -1,8 +1,8 @@
|
|
1
|
-
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
1
|
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
3
2
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
3
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
4
4
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
5
|
-
import React, { forwardRef, useEffect, useState } from 'react';
|
5
|
+
import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
6
6
|
import PropTypes from 'prop-types';
|
7
7
|
import { useFocusRing } from '@react-aria/focus';
|
8
8
|
import { Pressable, useHover } from '@react-aria/interactions';
|
@@ -14,19 +14,20 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
14
14
|
|
15
15
|
var TooltipWrapper = function TooltipWrapper(_ref) {
|
16
16
|
var children = _ref.children,
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
tooltip = _ref.tooltip,
|
18
|
+
others = _objectWithoutProperties(_ref, ["children", "tooltip"]);
|
19
|
+
|
20
|
+
return ___EmotionJSX(TooltipTrigger, _extends({
|
20
21
|
key: tooltip,
|
21
22
|
direction: "top",
|
22
23
|
isNotFlippable: true,
|
23
|
-
isOpen: isOpen,
|
24
24
|
offset: 5
|
25
|
-
}, children, ___EmotionJSX(Tooltip, null, tooltip));
|
25
|
+
}, others), children, ___EmotionJSX(Tooltip, null, tooltip));
|
26
26
|
};
|
27
27
|
|
28
28
|
TooltipWrapper.propTypes = {
|
29
29
|
isOpen: PropTypes.bool,
|
30
|
+
targetRef: PropTypes.shape({}),
|
30
31
|
tooltip: PropTypes.string
|
31
32
|
};
|
32
33
|
/**
|
@@ -38,7 +39,9 @@ var CopyText = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
38
39
|
textToCopy = props.textToCopy,
|
39
40
|
tooltipText = props.tooltipText,
|
40
41
|
mode = props.mode,
|
41
|
-
|
42
|
+
tooltipProps = props.tooltipProps,
|
43
|
+
wrapperProps = props.wrapperProps,
|
44
|
+
others = _objectWithoutProperties(props, ["children", "textToCopy", "tooltipText", "mode", "tooltipProps", "wrapperProps"]);
|
42
45
|
|
43
46
|
var value = textToCopy || (mode === 'link' ? children.props.href : children.props.children);
|
44
47
|
|
@@ -75,13 +78,28 @@ var CopyText = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
75
78
|
return undefined;
|
76
79
|
}, [isCopied]);
|
77
80
|
var copyToClipboard = useCopyToClipboard(value, setIsCopied);
|
78
|
-
var content = mode === 'link' ? children : ___EmotionJSX(Button, _extends({
|
81
|
+
var content = mode === 'link' || mode === 'nonClickableContent' ? children : ___EmotionJSX(Button, _extends({
|
79
82
|
variant: "quiet",
|
80
83
|
onPress: copyToClipboard,
|
81
84
|
"aria-label": "copy-content"
|
82
85
|
}, focusProps), children);
|
83
86
|
var tooltip = isCopied ? 'Copied!' : tooltipText;
|
84
87
|
var isTooltipOpen = isFocusVisible || isHovered || isCopied;
|
88
|
+
var wrapperRef = useRef();
|
89
|
+
|
90
|
+
if (mode === 'nonClickableContent') {
|
91
|
+
return ___EmotionJSX(TooltipWrapper, _extends({
|
92
|
+
isOpen: isTooltipOpen,
|
93
|
+
tooltip: tooltip,
|
94
|
+
targetRef: wrapperRef
|
95
|
+
}, tooltipProps), ___EmotionJSX(Box, _extends({
|
96
|
+
ref: wrapperRef,
|
97
|
+
isRow: true,
|
98
|
+
tabIndex: 0
|
99
|
+
}, mergeProps(hoverProps, others), wrapperProps), content, ___EmotionJSX(CopyButton, _extends({
|
100
|
+
onPress: copyToClipboard
|
101
|
+
}, focusProps))));
|
102
|
+
}
|
85
103
|
|
86
104
|
if (mode === 'link') {
|
87
105
|
return ___EmotionJSX(Box, _extends({
|
@@ -109,13 +127,19 @@ var CopyText = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
109
127
|
});
|
110
128
|
CopyText.propTypes = {
|
111
129
|
/** The behavioral pattern to apply to the component. */
|
112
|
-
mode: PropTypes.oneOf(['text', 'link']),
|
130
|
+
mode: PropTypes.oneOf(['text', 'link', 'nonClickableContent']),
|
113
131
|
|
114
132
|
/** The text to be copied instead of the text inside the child component. */
|
115
133
|
textToCopy: PropTypes.string,
|
116
134
|
|
117
135
|
/** The text to be displayed in the tooltip. */
|
118
|
-
tooltipText: PropTypes.string
|
136
|
+
tooltipText: PropTypes.string,
|
137
|
+
|
138
|
+
/** Props to apply to the tooltip in nonClickableContent mode. */
|
139
|
+
tooltipProps: PropTypes.shape({}),
|
140
|
+
|
141
|
+
/** Props to apply to the wrapper in nonClickableContent mode. */
|
142
|
+
wrapperProps: PropTypes.shape({})
|
119
143
|
};
|
120
144
|
CopyText.defaultProps = {
|
121
145
|
mode: 'text',
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
3
3
|
import React, { forwardRef } from 'react';
|
4
4
|
import Box from '../Box/Box';
|
5
|
+
import { useDeprecationWarning } from '../../hooks';
|
5
6
|
/**
|
6
7
|
* The intended use of List is to hold a collection of <ListItem/> components.
|
7
8
|
* Accepts most of the styling props from [styled-system](https://styled-system.com/table).
|
@@ -12,6 +13,7 @@ var List = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
12
13
|
var children = props.children,
|
13
14
|
others = _objectWithoutProperties(props, ["children"]);
|
14
15
|
|
16
|
+
useDeprecationWarning('The List component will be deprecated in Astro-UI 2.0.0, use ListView instead.');
|
15
17
|
return ___EmotionJSX(Box, _extends({
|
16
18
|
ref: ref,
|
17
19
|
role: "list",
|
@@ -3,10 +3,14 @@ import List from '.';
|
|
3
3
|
import ListItem from '../ListItem';
|
4
4
|
import Text from '../Text';
|
5
5
|
import Separator from '../Separator';
|
6
|
+
import withDeprecationWarning from '../../utils/devUtils/decorators/withDeprecationWarning';
|
6
7
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
7
8
|
export default {
|
8
|
-
title: 'List',
|
9
|
-
component: [List, ListItem]
|
9
|
+
title: 'Deprecated/List',
|
10
|
+
component: [List, ListItem],
|
11
|
+
decorators: [function (Story, context) {
|
12
|
+
return withDeprecationWarning(Story, context, 'The `List` component will be deprecated in Astro-UI 2.0.0, use `ListView` instead.');
|
13
|
+
}]
|
10
14
|
};
|
11
15
|
export var Default = function Default() {
|
12
16
|
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Text, {
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import Box from '../Box/Box';
|
3
|
+
/**
|
4
|
+
* Composed component that spreads children.
|
5
|
+
*
|
6
|
+
* This component is built to have the NavBarSection component passed into it.
|
7
|
+
*
|
8
|
+
* NavBarSection is an iterative component that
|
9
|
+
* will build an AccordionGridGroup using
|
10
|
+
* the array of objects that is passed into it.
|
11
|
+
*
|
12
|
+
*/
|
13
|
+
|
14
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
15
|
+
|
16
|
+
var NavBar = function NavBar(props) {
|
17
|
+
return ___EmotionJSX(Box, {
|
18
|
+
variant: "boxes.navBar",
|
19
|
+
role: "navigation",
|
20
|
+
as: "nav"
|
21
|
+
}, props.children);
|
22
|
+
};
|
23
|
+
|
24
|
+
export default NavBar;
|