@pingux/astro 1.2.0-alpha.8 → 1.3.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 +64 -0
- package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.js +35 -22
- package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.stories.js +148 -169
- package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.test.js +25 -30
- package/lib/cjs/components/AccordionGridItem/AccordionGridItem.js +29 -14
- package/lib/cjs/components/AccordionGridItem/AccordionGridItemBody.js +8 -5
- package/lib/cjs/components/AccordionGridItem/AccordionGridItemHeader.js +20 -17
- package/lib/cjs/components/AccordionGroup/AccordionGroup.js +2 -1
- package/lib/cjs/components/AccordionGroup/AccordionGroup.test.js +20 -1
- package/lib/cjs/components/ArrayField/ArrayField.js +213 -0
- package/lib/cjs/components/ArrayField/ArrayField.stories.js +223 -0
- package/lib/cjs/components/ArrayField/ArrayField.test.js +208 -0
- package/lib/cjs/components/ArrayField/ArrayFieldDeleteButton.js +61 -0
- package/lib/cjs/components/ArrayField/index.js +27 -0
- package/lib/cjs/components/Breadcrumbs/Breadcrumbs.stories.js +3 -3
- package/lib/cjs/components/Button/Button.js +14 -2
- package/lib/cjs/components/Button/Button.stories.js +33 -33
- package/lib/cjs/components/CodeView/CodeView.js +3 -3
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +5 -3
- package/lib/cjs/components/Link/Link.js +2 -1
- package/lib/cjs/components/ListView/ListView.js +9 -13
- package/lib/cjs/components/ListView/ListView.stories.js +3 -0
- package/lib/cjs/components/ListViewItem/ListViewItem.js +15 -3
- package/lib/cjs/components/Loader/Loader.stories.js +3 -3
- package/lib/cjs/components/Modal/Modal.js +3 -0
- package/lib/cjs/components/Modal/Modal.stories.js +12 -67
- package/lib/cjs/components/NavBar/NavBar.js +30 -4
- package/lib/cjs/components/NavBar/NavBar.stories.js +70 -463
- package/lib/cjs/components/NavBar/NavBar.test.js +51 -1
- package/lib/cjs/components/NavBarSection/NavBarItem.js +137 -0
- package/lib/cjs/components/NavBarSection/NavBarItemButton.js +96 -0
- package/lib/cjs/components/NavBarSection/NavBarItemHeader.js +1 -1
- package/lib/cjs/components/NavBarSection/NavBarItemLink.js +98 -0
- package/lib/cjs/components/NavBarSection/NavBarSection.js +10 -8
- package/lib/cjs/components/NavBarSection/index.js +28 -1
- package/lib/cjs/components/OverlayPanel/OverlayPanel.js +2 -16
- package/lib/cjs/components/OverlayPanel/OverlayPanel.test.js +44 -0
- package/lib/cjs/components/RockerButton/RockerButton.js +14 -22
- package/lib/cjs/components/RockerButtonGroup/RockerButtonGroup.js +5 -9
- package/lib/cjs/components/RockerButtonGroup/RockerButtonGroup.stories.js +4 -22
- package/lib/cjs/components/RockerButtonGroup/RockerButtonGroup.test.js +5 -14
- package/lib/cjs/components/SearchField/SearchField.stories.js +1 -15
- package/lib/cjs/components/SelectFieldBase/SelectFieldBase.js +8 -1
- package/lib/cjs/components/TextAreaField/TextAreaField.js +54 -9
- package/lib/cjs/components/TextAreaField/TextAreaField.stories.js +31 -52
- package/lib/cjs/components/TextAreaField/TextAreaField.test.js +12 -0
- package/lib/cjs/context/AccordionGridContext/index.js +20 -0
- package/lib/cjs/context/NavBarContext/index.js +20 -0
- package/lib/cjs/hooks/index.js +9 -0
- package/lib/cjs/hooks/useAriaLabelWarning/useAriaLabelWarning.js +2 -1
- package/lib/cjs/hooks/useField/useField.js +5 -0
- package/lib/cjs/{components/AccordionGridGroup/AccordionGridContext.js → hooks/useNavBarPress/index.js} +7 -6
- package/lib/cjs/hooks/useNavBarPress/useNavBarPress.js +38 -0
- package/lib/cjs/hooks/useNavBarPress/useNavBarPress.test.js +42 -0
- package/lib/cjs/hooks/useRockerButton/useRockerButton.js +4 -6
- package/lib/cjs/index.js +80 -58
- package/lib/cjs/layouts/ListLayout.stories.js +6 -6
- package/lib/cjs/recipes/ConditionalFilter.stories.js +7 -3
- package/lib/cjs/recipes/RadioButtonsWithLinks.stories.js +1 -1
- package/lib/cjs/styles/variants/accordion.js +39 -7
- package/lib/cjs/styles/variants/boxes.js +10 -24
- package/lib/cjs/styles/variants/buttons.js +27 -1
- package/lib/cjs/styles/variants/codeView.js +91 -0
- package/lib/cjs/styles/variants/navBar.js +68 -0
- package/lib/cjs/styles/variants/separator.js +2 -1
- package/lib/cjs/styles/variants/text.js +3 -1
- package/lib/cjs/styles/variants/variants.js +3 -0
- package/lib/components/AccordionGridGroup/AccordionGridGroup.js +35 -22
- package/lib/components/AccordionGridGroup/AccordionGridGroup.stories.js +143 -166
- package/lib/components/AccordionGridGroup/AccordionGridGroup.test.js +24 -25
- package/lib/components/AccordionGridItem/AccordionGridItem.js +29 -15
- package/lib/components/AccordionGridItem/AccordionGridItemBody.js +8 -6
- package/lib/components/AccordionGridItem/AccordionGridItemHeader.js +22 -18
- package/lib/components/AccordionGroup/AccordionGroup.js +2 -1
- package/lib/components/AccordionGroup/AccordionGroup.test.js +16 -2
- package/lib/components/ArrayField/ArrayField.js +179 -0
- package/lib/components/ArrayField/ArrayField.stories.js +196 -0
- package/lib/components/ArrayField/ArrayField.test.js +185 -0
- package/lib/components/ArrayField/ArrayFieldDeleteButton.js +43 -0
- package/lib/components/ArrayField/index.js +2 -0
- package/lib/components/Breadcrumbs/Breadcrumbs.stories.js +3 -3
- package/lib/components/Button/Button.js +15 -3
- package/lib/components/Button/Button.stories.js +17 -15
- package/lib/components/CodeView/CodeView.js +2 -2
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +5 -3
- package/lib/components/Link/Link.js +2 -1
- package/lib/components/ListView/ListView.js +9 -12
- package/lib/components/ListView/ListView.stories.js +3 -0
- package/lib/components/ListViewItem/ListViewItem.js +14 -3
- package/lib/components/Loader/Loader.stories.js +1 -1
- package/lib/components/Modal/Modal.js +4 -1
- package/lib/components/Modal/Modal.stories.js +11 -60
- package/lib/components/NavBar/NavBar.js +25 -4
- package/lib/components/NavBar/NavBar.stories.js +71 -462
- package/lib/components/NavBar/NavBar.test.js +39 -2
- package/lib/components/NavBarSection/NavBarItem.js +111 -0
- package/lib/components/NavBarSection/NavBarItemButton.js +69 -0
- package/lib/components/NavBarSection/NavBarItemHeader.js +1 -1
- package/lib/components/NavBarSection/NavBarItemLink.js +71 -0
- package/lib/components/NavBarSection/NavBarSection.js +9 -8
- package/lib/components/NavBarSection/index.js +4 -1
- package/lib/components/OverlayPanel/OverlayPanel.js +3 -16
- package/lib/components/OverlayPanel/OverlayPanel.test.js +38 -0
- package/lib/components/RockerButton/RockerButton.js +14 -21
- package/lib/components/RockerButtonGroup/RockerButtonGroup.js +5 -9
- package/lib/components/RockerButtonGroup/RockerButtonGroup.stories.js +2 -17
- package/lib/components/RockerButtonGroup/RockerButtonGroup.test.js +5 -11
- package/lib/components/SearchField/SearchField.stories.js +0 -11
- package/lib/components/SelectFieldBase/SelectFieldBase.js +8 -1
- package/lib/components/TextAreaField/TextAreaField.js +54 -10
- package/lib/components/TextAreaField/TextAreaField.stories.js +26 -42
- package/lib/components/TextAreaField/TextAreaField.test.js +13 -0
- package/lib/context/AccordionGridContext/index.js +5 -0
- package/lib/context/NavBarContext/index.js +5 -0
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/useAriaLabelWarning/useAriaLabelWarning.js +2 -1
- package/lib/hooks/useField/useField.js +5 -0
- package/lib/hooks/useNavBarPress/index.js +1 -0
- package/lib/hooks/useNavBarPress/useNavBarPress.js +27 -0
- package/lib/hooks/useNavBarPress/useNavBarPress.test.js +36 -0
- package/lib/hooks/useRockerButton/useRockerButton.js +4 -6
- package/lib/index.js +2 -0
- package/lib/layouts/ListLayout.stories.js +6 -6
- package/lib/recipes/ConditionalFilter.stories.js +7 -3
- package/lib/recipes/RadioButtonsWithLinks.stories.js +1 -1
- package/lib/styles/variants/accordion.js +26 -5
- package/lib/styles/variants/boxes.js +10 -24
- package/lib/styles/variants/buttons.js +27 -1
- package/lib/styles/variants/codeView.js +91 -0
- package/lib/styles/variants/navBar.js +46 -0
- package/lib/styles/variants/separator.js +2 -1
- package/lib/styles/variants/text.js +3 -1
- package/lib/styles/variants/variants.js +2 -0
- package/package.json +5 -3
- package/lib/cjs/recipes/ArrayField.stories.js +0 -169
- package/lib/components/AccordionGridGroup/AccordionGridContext.js +0 -2
- package/lib/recipes/ArrayField.stories.js +0 -134
@@ -21,7 +21,7 @@ import { useButton } from '@react-aria/button';
|
|
21
21
|
import { useHover } from '@react-aria/interactions';
|
22
22
|
import { useFocusRing } from '@react-aria/focus';
|
23
23
|
import { mergeProps } from '@react-aria/utils';
|
24
|
-
import { useStatusClasses, usePropWarning } from '../../hooks';
|
24
|
+
import { useStatusClasses, usePropWarning, useAriaLabelWarning, useDeprecationWarning } from '../../hooks';
|
25
25
|
import Loader from '../Loader';
|
26
26
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
27
27
|
var Button = /*#__PURE__*/forwardRef(function (props, ref) {
|
@@ -37,7 +37,8 @@ var Button = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
37
37
|
onPressChange = props.onPressChange,
|
38
38
|
onPressUp = props.onPressUp,
|
39
39
|
children = props.children,
|
40
|
-
|
40
|
+
variant = props.variant,
|
41
|
+
others = _objectWithoutProperties(props, ["className", "isDisabled", "isLoading", "onHoverStart", "onHoverChange", "onHoverEnd", "onPress", "onPressStart", "onPressEnd", "onPressChange", "onPressUp", "children", "variant"]);
|
41
42
|
|
42
43
|
var buttonRef = useRef();
|
43
44
|
usePropWarning(props, 'disabled', 'isDisabled');
|
@@ -69,7 +70,17 @@ var Button = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
69
70
|
}),
|
70
71
|
classNames = _useStatusClasses.classNames;
|
71
72
|
|
73
|
+
useDeprecationWarning('The "icon" variant for `Button` is deprecated in Astro-UI 1.0.0, use the `IconButton` component instead.', {
|
74
|
+
isActive: props.variant === 'icon'
|
75
|
+
});
|
76
|
+
useDeprecationWarning('The "danger" variant for `Button` will be deprecated in Astro-UI 2.0.0, use the `critical` variant instead.', {
|
77
|
+
isActive: props.variant === 'danger'
|
78
|
+
});
|
79
|
+
useDeprecationWarning('The "text" variant for `Button` will be deprecated in Astro-UI 2.0.0, use the `link` variant instead.', {
|
80
|
+
isActive: props.variant === 'text'
|
81
|
+
});
|
72
82
|
var ariaLabel = props['aria-label'];
|
83
|
+
useAriaLabelWarning('Button', ariaLabel, variant === 'filter');
|
73
84
|
return ___EmotionJSX(ThemeUIButton, _extends({
|
74
85
|
"aria-label": ariaLabel,
|
75
86
|
ref: buttonRef,
|
@@ -80,7 +91,8 @@ var Button = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
80
91
|
display: 'flex',
|
81
92
|
justifyContent: 'center',
|
82
93
|
alignItems: 'center'
|
83
|
-
}
|
94
|
+
},
|
95
|
+
variant: variant
|
84
96
|
}, others, mergeProps(hoverProps, focusProps, buttonProps)), isLoading ? ___EmotionJSX("span", {
|
85
97
|
style: {
|
86
98
|
visibility: 'hidden'
|
@@ -3,11 +3,9 @@ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectW
|
|
3
3
|
import React from 'react';
|
4
4
|
import AddCircleIcon from 'mdi-react/AddCircleIcon';
|
5
5
|
import CreateIcon from 'mdi-react/CreateIcon';
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import Icon from '
|
9
|
-
import Text from '../Text';
|
10
|
-
import { buttonVariants } from '../../utils/devUtils/constants/variants'; // removing the iconButton variants from this story.
|
6
|
+
import FilterIcon from 'mdi-react/FilterIcon';
|
7
|
+
import { buttonVariants } from '../../utils/devUtils/constants/variants';
|
8
|
+
import { Box, Button, Icon, SearchField, Text } from '../../index'; // removing the iconButton variants from this story.
|
11
9
|
|
12
10
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
13
11
|
var variants = buttonVariants;
|
@@ -69,16 +67,6 @@ export var TextIconButton = function TextIconButton() {
|
|
69
67
|
size: 20
|
70
68
|
}), "Add a Form"));
|
71
69
|
};
|
72
|
-
export var TextButton = function TextButton() {
|
73
|
-
return ___EmotionJSX(Button, {
|
74
|
-
mb: "sm",
|
75
|
-
variant: "text",
|
76
|
-
"aria-label": "Add option"
|
77
|
-
}, ___EmotionJSX(Text, {
|
78
|
-
variant: "label",
|
79
|
-
color: "active"
|
80
|
-
}, " + Add Option"));
|
81
|
-
};
|
82
70
|
export var InlineButton = function InlineButton() {
|
83
71
|
return ___EmotionJSX(Button, {
|
84
72
|
mb: "sm",
|
@@ -110,4 +98,18 @@ ColorBlockButton.story = {
|
|
110
98
|
defaultValue: false
|
111
99
|
}
|
112
100
|
}
|
101
|
+
};
|
102
|
+
export var FilterButton = function FilterButton() {
|
103
|
+
return ___EmotionJSX(Box, {
|
104
|
+
p: "xx",
|
105
|
+
isRow: true,
|
106
|
+
gap: "md"
|
107
|
+
}, ___EmotionJSX(SearchField, {
|
108
|
+
"aria-label": "search items"
|
109
|
+
}), ___EmotionJSX(Button, {
|
110
|
+
variant: "filter",
|
111
|
+
"aria-label": "filter button"
|
112
|
+
}, ___EmotionJSX(Icon, {
|
113
|
+
icon: FilterIcon
|
114
|
+
})));
|
113
115
|
};
|
@@ -22,9 +22,9 @@ import { useFocusRing } from '@react-aria/focus';
|
|
22
22
|
import { useHover } from '@react-aria/interactions';
|
23
23
|
import { mergeProps } from '@react-aria/utils';
|
24
24
|
import Highlight, { defaultProps } from 'prism-react-renderer';
|
25
|
-
import github from 'prism-react-renderer/themes/github';
|
26
25
|
import { useStatusClasses } from '../../hooks';
|
27
26
|
import { Box, CopyText } from '../..';
|
27
|
+
import codeView from '../../styles/variants/codeView';
|
28
28
|
/**
|
29
29
|
* Component for code syntax highlighting.
|
30
30
|
* Built on top of [prism-react-renderer](https://github.com/FormidableLabs/prism-react-renderer).
|
@@ -61,7 +61,7 @@ var CodeView = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
61
61
|
};
|
62
62
|
|
63
63
|
var content = ___EmotionJSX(Highlight, _extends({}, defaultProps, {
|
64
|
-
theme:
|
64
|
+
theme: codeView.theme,
|
65
65
|
code: (children === null || children === void 0 ? void 0 : _trimInstanceProperty(children).call(children)) || '',
|
66
66
|
language: language
|
67
67
|
}), function (_ref) {
|
@@ -271,9 +271,11 @@ EnvironmentBreadcrumb.propTypes = {
|
|
271
271
|
/** The list of environments. */
|
272
272
|
items: isIterableProp,
|
273
273
|
|
274
|
-
/**
|
275
|
-
*
|
276
|
-
*
|
274
|
+
/**
|
275
|
+
* Filter function to generate a filtered list of nodes.
|
276
|
+
*
|
277
|
+
* `(nodes: Iterable<Node>) => Iterable<Node>`
|
278
|
+
*/
|
277
279
|
itemsFilter: PropTypes.func,
|
278
280
|
|
279
281
|
/** Callback function that fires when the dropdown is opened. */
|
@@ -12,7 +12,8 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
12
12
|
var Link = /*#__PURE__*/forwardRef(function (props, ref) {
|
13
13
|
var className = props.className,
|
14
14
|
isDisabled = props.isDisabled,
|
15
|
-
|
15
|
+
onPress = props.onPress,
|
16
|
+
others = _objectWithoutProperties(props, ["className", "isDisabled", "onPress"]);
|
16
17
|
|
17
18
|
var linkRef = useRef();
|
18
19
|
usePropWarning(props, 'disabled', 'isDisabled');
|
@@ -19,7 +19,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
19
19
|
import React, { useMemo, forwardRef, useRef, useImperativeHandle } from 'react';
|
20
20
|
import { GridCollection, useGridState } from '@react-stately/grid';
|
21
21
|
import { GridKeyboardDelegate, useGrid } from '@react-aria/grid';
|
22
|
-
import { mergeProps } from '@react-aria/utils';
|
23
22
|
import { ListLayout } from '@react-stately/layout';
|
24
23
|
import { useListState } from '@react-stately/list';
|
25
24
|
import PropTypes from 'prop-types';
|
@@ -58,12 +57,9 @@ export function useListLayout(state) {
|
|
58
57
|
return layout;
|
59
58
|
}
|
60
59
|
var ListView = /*#__PURE__*/forwardRef(function (props, ref) {
|
61
|
-
var
|
62
|
-
loadingState = props.loadingState,
|
63
|
-
selectedKeys = props.selectedKeys,
|
60
|
+
var loadingState = props.loadingState,
|
64
61
|
onLoadMore = props.onLoadMore,
|
65
|
-
|
66
|
-
selectionMode = props.selectionMode;
|
62
|
+
selectionStyle = props.selectionStyle;
|
67
63
|
var isLoading = loadingState === loadingStates.LOADING_MORE || loadingState === loadingStates.LOADING;
|
68
64
|
|
69
65
|
var renderWrapper = function renderWrapper(parent, reusableView) {
|
@@ -115,11 +111,9 @@ var ListView = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
115
111
|
});
|
116
112
|
}, [collection]);
|
117
113
|
var state = useGridState(_objectSpread(_objectSpread({}, props), {}, {
|
118
|
-
disabledKeys: disabledKeys,
|
119
|
-
selectedKeys: selectedKeys,
|
120
114
|
collection: gridCollection,
|
121
|
-
|
122
|
-
|
115
|
+
focusMode: 'cell',
|
116
|
+
selectionBehavior: selectionStyle === 'highlight' ? 'replace' : 'toggle'
|
123
117
|
}));
|
124
118
|
var layout = useListLayout(state);
|
125
119
|
var keyboardDelegate = useMemo(function () {
|
@@ -154,7 +148,7 @@ var ListView = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
154
148
|
state: state,
|
155
149
|
keyboardDelegate: keyboardDelegate
|
156
150
|
}
|
157
|
-
}, ___EmotionJSX(Virtualizer, _extends({},
|
151
|
+
}, ___EmotionJSX(Virtualizer, _extends({}, gridProps, {
|
158
152
|
onLoadMore: onLoadMore,
|
159
153
|
ref: listViewRef,
|
160
154
|
focusedKey: focusedKey,
|
@@ -221,6 +215,9 @@ ListView.propTypes = {
|
|
221
215
|
/** The type of selection that is allowed in the collection. */
|
222
216
|
selectionMode: PropTypes.oneOf(['none', 'single', 'multiple']),
|
223
217
|
|
218
|
+
/** */
|
219
|
+
selectionStyle: PropTypes.oneOf(['highlight', undefined]),
|
220
|
+
|
224
221
|
/** Callback function that fires when the selected key changes. */
|
225
222
|
onSelectionChange: PropTypes.func,
|
226
223
|
|
@@ -233,6 +230,6 @@ ListView.propTypes = {
|
|
233
230
|
};
|
234
231
|
ListView.defaultProps = {
|
235
232
|
'aria-label': 'listView',
|
236
|
-
|
233
|
+
selectionMode: 'single'
|
237
234
|
};
|
238
235
|
export default ListView;
|
@@ -734,6 +734,9 @@ InfiniteLoadingList.parameters = {
|
|
734
734
|
description: {
|
735
735
|
story: 'Note: Keep in mind the maxHeight may impact when the scroll callback is triggered. If you notice it\'s being called too often, try adjusting that value or loading more objects to prevent this behavior.'
|
736
736
|
}
|
737
|
+
},
|
738
|
+
chromatic: {
|
739
|
+
delay: 5000
|
737
740
|
}
|
738
741
|
};
|
739
742
|
export var MultipleSelection = function MultipleSelection(_ref6) {
|
@@ -6,6 +6,7 @@ import { useFocusRing } from '@react-aria/focus';
|
|
6
6
|
import PropTypes from 'prop-types';
|
7
7
|
import { useGridCell, useGridRow } from '@react-aria/grid';
|
8
8
|
import { useHover } from '@react-aria/interactions';
|
9
|
+
import { useSelectableItem } from '@react-aria/selection';
|
9
10
|
import { ListViewContext } from '../ListView/ListViewContext';
|
10
11
|
import Box from '../Box';
|
11
12
|
import { useStatusClasses } from '../../hooks';
|
@@ -15,7 +16,9 @@ var ListViewItem = function ListViewItem(props) {
|
|
15
16
|
var _context;
|
16
17
|
|
17
18
|
var item = props.item,
|
18
|
-
_props$item
|
19
|
+
_props$item = props.item,
|
20
|
+
key = _props$item.key,
|
21
|
+
_props$item$props = _props$item.props,
|
19
22
|
listItemProps = _props$item$props.listItemProps,
|
20
23
|
rowProps = _props$item$props.rowProps,
|
21
24
|
_props$item$props$has = _props$item$props.hasSeparator,
|
@@ -51,7 +54,7 @@ var ListViewItem = function ListViewItem(props) {
|
|
51
54
|
}, state, rowRef),
|
52
55
|
raRowProps = _useGridRow.rowProps;
|
53
56
|
|
54
|
-
var isSelected =
|
57
|
+
var isSelected = state.selectionManager.isSelected(item.key);
|
55
58
|
|
56
59
|
var _useGridCell = useGridCell({
|
57
60
|
node: cellNode,
|
@@ -59,7 +62,15 @@ var ListViewItem = function ListViewItem(props) {
|
|
59
62
|
}, state, cellRef),
|
60
63
|
gridCellProps = _useGridCell.gridCellProps;
|
61
64
|
|
62
|
-
var
|
65
|
+
var _useSelectableItem = useSelectableItem({
|
66
|
+
isDisabled: isDisabled,
|
67
|
+
selectionManager: state.selectionManager,
|
68
|
+
key: key,
|
69
|
+
ref: cellRef
|
70
|
+
}),
|
71
|
+
selectableItemProps = _useSelectableItem.itemProps;
|
72
|
+
|
73
|
+
var mergedProps = mergeProps(gridCellProps, hoverProps, focusWithinProps, focusProps, selectableItemProps);
|
63
74
|
|
64
75
|
var _useStatusClasses = useStatusClasses(className, {
|
65
76
|
isHovered: isHovered,
|
@@ -31,7 +31,7 @@ export default {
|
|
31
31
|
export var Default = function Default(args) {
|
32
32
|
return ___EmotionJSX(Loader, args);
|
33
33
|
};
|
34
|
-
export var
|
34
|
+
export var CustomColor = function CustomColor() {
|
35
35
|
return ___EmotionJSX(Loader, {
|
36
36
|
color: "neutral.60"
|
37
37
|
});
|
@@ -24,7 +24,7 @@ import Box from '../Box';
|
|
24
24
|
import IconButton from '../IconButton';
|
25
25
|
import Icon from '../Icon';
|
26
26
|
import Text from '../Text';
|
27
|
-
import { useStatusClasses } from '../../hooks';
|
27
|
+
import { useStatusClasses, useDeprecationWarning } from '../../hooks';
|
28
28
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
29
29
|
var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
|
30
30
|
var className = props.className,
|
@@ -85,6 +85,9 @@ var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
85
85
|
}),
|
86
86
|
classNames = _useStatusClasses.classNames;
|
87
87
|
|
88
|
+
useDeprecationWarning('The "dark" variant for Modal will be deprecated in Astro-UI 2.0.0.', {
|
89
|
+
isActive: others.variant === 'modal.dark'
|
90
|
+
});
|
88
91
|
return ___EmotionJSX(OverlayContainer, null, ___EmotionJSX(Box, _extends({
|
89
92
|
className: classNames,
|
90
93
|
variant: "modal.container"
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
-
import
|
3
|
-
import React, { useCallback, useState } from 'react';
|
2
|
+
import React from 'react';
|
4
3
|
import { useModalState } from '../../hooks';
|
5
|
-
import { OverlayProvider, Box, Button, Text, Modal
|
4
|
+
import { OverlayProvider, Box, Button, Text, Modal } from '../../index';
|
6
5
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
7
6
|
export default {
|
8
7
|
title: 'Modal',
|
@@ -12,7 +11,7 @@ export default {
|
|
12
11
|
control: {
|
13
12
|
type: 'text'
|
14
13
|
},
|
15
|
-
defaultValue: '
|
14
|
+
defaultValue: 'Continue'
|
16
15
|
},
|
17
16
|
role: {},
|
18
17
|
id: {
|
@@ -20,7 +19,9 @@ export default {
|
|
20
19
|
type: 'text'
|
21
20
|
}
|
22
21
|
},
|
23
|
-
hasCloseButton: {
|
22
|
+
hasCloseButton: {
|
23
|
+
defaultValue: true
|
24
|
+
},
|
24
25
|
isClosedOnBlur: {},
|
25
26
|
isDismissable: {},
|
26
27
|
isKeyboardDismissDisabled: {},
|
@@ -68,16 +69,6 @@ export default {
|
|
68
69
|
};
|
69
70
|
export var Default = function Default(args) {
|
70
71
|
var state = useModalState();
|
71
|
-
|
72
|
-
var _useState = useState(''),
|
73
|
-
_useState2 = _slicedToArray(_useState, 2),
|
74
|
-
inputValue = _useState2[0],
|
75
|
-
setInputValue = _useState2[1];
|
76
|
-
|
77
|
-
var onTextFieldChange = useCallback(function (_ref) {
|
78
|
-
var value = _ref.target.value;
|
79
|
-
setInputValue(value.toUpperCase());
|
80
|
-
}, []);
|
81
72
|
return (// Application must be wrapped in an OverlayProvider so that it can be hidden from screen
|
82
73
|
// readers when an overlay opens.
|
83
74
|
___EmotionJSX(OverlayProvider, null, ___EmotionJSX(Button, {
|
@@ -88,57 +79,17 @@ export var Default = function Default(args) {
|
|
88
79
|
onClose: state.close
|
89
80
|
}), ___EmotionJSX(Text, {
|
90
81
|
pt: "lg"
|
91
|
-
}, "
|
92
|
-
pt: "lg"
|
93
|
-
}, "Type the word DELETE to confirm deletion of this group"), ___EmotionJSX(TextField, {
|
94
|
-
value: inputValue,
|
95
|
-
onChange: onTextFieldChange,
|
96
|
-
"aria-label": "user input"
|
97
|
-
}), ___EmotionJSX(Box, {
|
98
|
-
isRow: true,
|
99
|
-
pt: "lg",
|
100
|
-
mr: "auto"
|
101
|
-
}, ___EmotionJSX(Button, {
|
102
|
-
variant: "critical",
|
103
|
-
onPress: state.close,
|
104
|
-
mr: "md",
|
105
|
-
isDisabled: Boolean(inputValue !== 'DELETE'),
|
106
|
-
"aria-label": "Delete"
|
107
|
-
}, "Delete"), ___EmotionJSX(Button, {
|
108
|
-
onPress: state.close,
|
109
|
-
"aria-label": "Cancel"
|
110
|
-
}, "Cancel"))))
|
111
|
-
);
|
112
|
-
};
|
113
|
-
export var DarkVariant = function DarkVariant() {
|
114
|
-
var state = useModalState();
|
115
|
-
return (// Application must be wrapped in an OverlayProvider so that it can be hidden from screen
|
116
|
-
// readers when a modal opens.
|
117
|
-
___EmotionJSX(OverlayProvider, null, ___EmotionJSX(Button, {
|
118
|
-
onPress: state.open,
|
119
|
-
"aria-label": "Open modal"
|
120
|
-
}, "Open Modal"), state.isOpen && ___EmotionJSX(Modal, {
|
121
|
-
variant: "modal.dark",
|
122
|
-
title: "Question",
|
123
|
-
isOpen: state.isOpen,
|
124
|
-
onClose: state.close,
|
125
|
-
isDismissable: true,
|
126
|
-
hasCloseButton: true
|
127
|
-
}, ___EmotionJSX(Text, {
|
128
|
-
variant: "subtitle",
|
129
|
-
color: "white",
|
130
|
-
pt: "lg"
|
131
|
-
}, "Would you ever really just click a button?"), ___EmotionJSX(Box, {
|
82
|
+
}, "Do you want to continue with this action that you\u2018re performing?"), ___EmotionJSX(Box, {
|
132
83
|
isRow: true,
|
133
84
|
pt: "lg",
|
134
85
|
mr: "auto"
|
135
86
|
}, ___EmotionJSX(Button, {
|
136
87
|
variant: "primary",
|
137
|
-
mr: "md",
|
138
88
|
onPress: state.close,
|
139
|
-
|
140
|
-
|
141
|
-
|
89
|
+
mr: "md",
|
90
|
+
"aria-label": "Continue"
|
91
|
+
}, "Continue"), ___EmotionJSX(Button, {
|
92
|
+
variant: "link",
|
142
93
|
onPress: state.close,
|
143
94
|
"aria-label": "Cancel"
|
144
95
|
}, "Cancel"))))
|
@@ -1,4 +1,7 @@
|
|
1
|
-
import
|
1
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
2
|
+
import React, { useState } from 'react';
|
3
|
+
import { NavBarContext } from '../../context/NavBarContext';
|
4
|
+
import { isIterableProp } from '../../utils/devUtils/props/isIterable';
|
2
5
|
import Box from '../Box/Box';
|
3
6
|
/**
|
4
7
|
* Composed component that spreads children.
|
@@ -14,11 +17,29 @@ import Box from '../Box/Box';
|
|
14
17
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
15
18
|
|
16
19
|
var NavBar = function NavBar(props) {
|
17
|
-
|
18
|
-
|
20
|
+
var defaultSelectedKeys = props.defaultSelectedKeys;
|
21
|
+
|
22
|
+
var _useState = useState(defaultSelectedKeys),
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
24
|
+
selectedKeys = _useState2[0],
|
25
|
+
setSelectedKeys = _useState2[1];
|
26
|
+
|
27
|
+
return ___EmotionJSX(NavBarContext.Provider, {
|
28
|
+
value: {
|
29
|
+
selectedKeys: selectedKeys,
|
30
|
+
setSelectedKeys: setSelectedKeys
|
31
|
+
}
|
32
|
+
}, ___EmotionJSX(Box, {
|
33
|
+
variant: "navBar.container",
|
19
34
|
role: "navigation",
|
20
35
|
as: "nav"
|
21
|
-
}, props.children);
|
36
|
+
}, props.children));
|
22
37
|
};
|
23
38
|
|
39
|
+
NavBar.propTypes = {
|
40
|
+
defaultSelectedKeys: isIterableProp
|
41
|
+
};
|
42
|
+
NavBar.defaultProps = {
|
43
|
+
defaultSelectedKeys: []
|
44
|
+
};
|
24
45
|
export default NavBar;
|