@pingux/astro 2.88.0-alpha.3 → 2.89.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/CodeView/CodeView.js +29 -4
- package/lib/cjs/components/CodeView/CodeView.test.js +10 -0
- package/lib/cjs/components/CopyText/CopyText.js +2 -2
- package/lib/cjs/components/NavigationHeader/HeaderAccountMenu.d.ts +9 -0
- package/lib/cjs/components/NavigationHeader/HeaderAccountMenu.js +75 -0
- package/lib/cjs/components/NavigationHeader/NavigationHeader.d.ts +9 -0
- package/lib/cjs/components/NavigationHeader/NavigationHeader.js +49 -0
- package/lib/cjs/components/NavigationHeader/NavigationHeader.mdx +31 -0
- package/lib/cjs/components/NavigationHeader/NavigationHeader.stories.d.ts +12 -0
- package/lib/cjs/components/NavigationHeader/NavigationHeader.stories.js +210 -0
- package/lib/cjs/components/NavigationHeader/NavigationHeader.test.d.ts +1 -0
- package/lib/cjs/components/NavigationHeader/NavigationHeader.test.js +361 -0
- package/lib/cjs/components/NavigationHeader/index.d.ts +1 -0
- package/lib/cjs/components/NavigationHeader/index.js +14 -0
- package/lib/cjs/hooks/useField/useField.d.ts +78 -78
- package/lib/cjs/index.d.ts +2 -0
- package/lib/cjs/index.js +55 -36
- package/lib/cjs/styles/themes/next-gen/codeView/codeView.d.ts +15 -1
- package/lib/cjs/styles/themes/next-gen/codeView/codeView.js +22 -6
- package/lib/cjs/styles/themes/next-gen/convertedComponentList.d.ts +1 -0
- package/lib/cjs/styles/themes/next-gen/convertedComponentList.js +4 -2
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +261 -7
- package/lib/cjs/styles/themes/next-gen/next-gen.js +2 -0
- package/lib/cjs/styles/themes/next-gen/variants/button.d.ts +5 -0
- package/lib/cjs/styles/themes/next-gen/variants/button.js +6 -4
- package/lib/cjs/styles/themes/next-gen/variants/navigationHeader.d.ts +140 -0
- package/lib/cjs/styles/themes/next-gen/variants/navigationHeader.js +131 -0
- package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +107 -6
- package/lib/cjs/styles/themes/next-gen/variants/variants.js +15 -9
- package/lib/cjs/types/codeView.d.ts +3 -2
- package/lib/cjs/types/copyText.d.ts +1 -1
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +65 -54
- package/lib/cjs/utils/devUtils/constants/images.d.ts +2 -0
- package/lib/cjs/utils/devUtils/constants/images.js +6 -2
- package/lib/components/CodeView/CodeView.js +30 -5
- package/lib/components/CodeView/CodeView.test.js +10 -0
- package/lib/components/CopyText/CopyText.js +2 -2
- package/lib/components/NavigationHeader/HeaderAccountMenu.js +66 -0
- package/lib/components/NavigationHeader/NavigationHeader.js +37 -0
- package/lib/components/NavigationHeader/NavigationHeader.mdx +31 -0
- package/lib/components/NavigationHeader/NavigationHeader.stories.js +195 -0
- package/lib/components/NavigationHeader/NavigationHeader.test.js +358 -0
- package/lib/components/NavigationHeader/index.js +1 -0
- package/lib/index.js +2 -0
- package/lib/styles/themes/next-gen/codeView/codeView.js +20 -5
- package/lib/styles/themes/next-gen/convertedComponentList.js +2 -1
- package/lib/styles/themes/next-gen/next-gen.js +2 -0
- package/lib/styles/themes/next-gen/variants/button.js +6 -4
- package/lib/styles/themes/next-gen/variants/navigationHeader.js +123 -0
- package/lib/styles/themes/next-gen/variants/variants.js +14 -8
- package/lib/types/index.js +1 -0
- package/lib/utils/devUtils/constants/images.js +3 -1
- package/package.json +1 -1
@@ -27,9 +27,10 @@ var _utils = require("@react-aria/utils");
|
|
27
27
|
var _prismReactRenderer = _interopRequireWildcard(require("prism-react-renderer"));
|
28
28
|
var _ = require("../..");
|
29
29
|
var _hooks = require("../../hooks");
|
30
|
+
var _codeView = _interopRequireDefault(require("../../styles/themes/next-gen/codeView/codeView"));
|
30
31
|
var _CodeView = _interopRequireDefault(require("./CodeView.styles"));
|
31
32
|
var _react2 = require("@emotion/react");
|
32
|
-
var _excluded = ["children", "className", "hasLineNumbers", "hasNoCopyButton", "language", "Prism", "stylesProp"];
|
33
|
+
var _excluded = ["children", "className", "hasLineNumbers", "hasNoCopyButton", "language", "isNextGen", "Prism", "stylesProp"];
|
33
34
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
34
35
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
35
36
|
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; }
|
@@ -40,9 +41,9 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
40
41
|
hasLineNumbers = props.hasLineNumbers,
|
41
42
|
hasNoCopyButton = props.hasNoCopyButton,
|
42
43
|
language = props.language,
|
44
|
+
isNextGen = props.isNextGen,
|
43
45
|
customPrism = props.Prism,
|
44
|
-
|
45
|
-
stylesProp = _props$stylesProp === void 0 ? _CodeView["default"] : _props$stylesProp,
|
46
|
+
stylesProp = props.stylesProp,
|
46
47
|
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
47
48
|
var _useFocusRing = (0, _focus.useFocusRing)(),
|
48
49
|
isFocusVisible = _useFocusRing.isFocusVisible,
|
@@ -64,8 +65,9 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
64
65
|
return tokens.length.toString().length * 12;
|
65
66
|
};
|
66
67
|
var code = (children === null || children === void 0 ? void 0 : (0, _trim["default"])(children).call(children)) || '';
|
68
|
+
var codeViewTheme = (stylesProp === null || stylesProp === void 0 ? void 0 : stylesProp.theme) || (isNextGen ? _codeView["default"].theme : _CodeView["default"].theme);
|
67
69
|
var content = (0, _react2.jsx)(_prismReactRenderer["default"], (0, _extends2["default"])({}, _prismReactRenderer.defaultProps, {
|
68
|
-
theme:
|
70
|
+
theme: codeViewTheme,
|
69
71
|
code: code,
|
70
72
|
language: language,
|
71
73
|
Prism: customPrism || _prismReactRenderer.Prism
|
@@ -100,6 +102,29 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
100
102
|
}));
|
101
103
|
}));
|
102
104
|
});
|
105
|
+
if (isNextGen) {
|
106
|
+
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
107
|
+
ref: ref,
|
108
|
+
variant: "codeView.wrapper",
|
109
|
+
className: classNames
|
110
|
+
}, (0, _utils.mergeProps)(focusProps, hoverProps, others), {
|
111
|
+
role: "none"
|
112
|
+
}), (0, _react2.jsx)(_.Box, {
|
113
|
+
isRow: true,
|
114
|
+
justifyContent: "space-between",
|
115
|
+
alignItems: "center",
|
116
|
+
variant: "codeView.header"
|
117
|
+
}, (0, _react2.jsx)(_.Text, {
|
118
|
+
color: "gray-300",
|
119
|
+
mb: "0",
|
120
|
+
mr: "sm",
|
121
|
+
py: "sm"
|
122
|
+
}, language === null || language === void 0 ? void 0 : language.toUpperCase()), (0, _react2.jsx)(_.CopyText, {
|
123
|
+
ref: ref,
|
124
|
+
mode: "rightText",
|
125
|
+
textToCopy: children
|
126
|
+
}, "Copy")), content);
|
127
|
+
}
|
103
128
|
if (hasNoCopyButton) {
|
104
129
|
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
105
130
|
ref: ref,
|
@@ -201,4 +201,14 @@ test('renders CodeView component with highlighted code', function () {
|
|
201
201
|
var codeViewElement = _testWrapper.screen.getByTestId(testId).querySelector('pre');
|
202
202
|
expect(codeViewElement).toBeInTheDocument();
|
203
203
|
expect(codeViewElement).toHaveClass("language-".concat(language));
|
204
|
+
});
|
205
|
+
test('isNextGen prop renders CodeView component with next-gen theme', function () {
|
206
|
+
var children = ' ';
|
207
|
+
getComponent({
|
208
|
+
children: children,
|
209
|
+
isNextGen: true,
|
210
|
+
language: 'json'
|
211
|
+
});
|
212
|
+
var codeViewElement = _testWrapper.screen.getByTestId(testId);
|
213
|
+
expect(codeViewElement).toHaveTextContent('JSON');
|
204
214
|
});
|
@@ -147,9 +147,9 @@ var CopyText = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
147
147
|
variant: "copyText.copy"
|
148
148
|
}, others, {
|
149
149
|
role: "presentation"
|
150
|
-
}), content, (0, _react2.jsx)(_CopyButton["default"], (0, _extends2["default"])({
|
150
|
+
}), mode !== 'rightText' && content, (0, _react2.jsx)(_CopyButton["default"], (0, _extends2["default"])({
|
151
151
|
onPress: copyToClipboard
|
152
|
-
}, focusProps, iconButtonProps)))));
|
152
|
+
}, focusProps, iconButtonProps)), mode === 'rightText' && content)));
|
153
153
|
});
|
154
154
|
CopyText.defaultProps = {
|
155
155
|
mode: 'text',
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { AvatarProps } from '../../types';
|
3
|
+
import { userDataProps } from './NavigationHeader.stories';
|
4
|
+
interface HeaderAccountMenuProps {
|
5
|
+
userData?: userDataProps;
|
6
|
+
avatarProps?: AvatarProps;
|
7
|
+
}
|
8
|
+
declare const HeaderAccountMenu: (props: HeaderAccountMenuProps) => React.JSX.Element;
|
9
|
+
export default HeaderAccountMenu;
|
@@ -0,0 +1,75 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports["default"] = void 0;
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
11
|
+
var _ChevronDownIcon = _interopRequireDefault(require("@pingux/mdi-react/ChevronDownIcon"));
|
12
|
+
var _LogoutVariantIcon = _interopRequireDefault(require("@pingux/mdi-react/LogoutVariantIcon"));
|
13
|
+
var _ = require("../..");
|
14
|
+
var _react2 = require("@emotion/react");
|
15
|
+
var HeaderAccountMenu = function HeaderAccountMenu(props) {
|
16
|
+
var userData = props.userData,
|
17
|
+
avatarProps = props.avatarProps;
|
18
|
+
return (0, _react2.jsx)(_.OverlayProvider, null, (0, _react2.jsx)(_.PopoverMenu, null, (0, _react2.jsx)(_.Button, {
|
19
|
+
variant: "navigationHeader.accountButton"
|
20
|
+
}, (0, _react2.jsx)(_.Box, {
|
21
|
+
isRow: true,
|
22
|
+
alignItems: "center",
|
23
|
+
gap: "xs"
|
24
|
+
}, (0, _react2.jsx)(_.Avatar, (0, _extends2["default"])({
|
25
|
+
src: userData === null || userData === void 0 ? void 0 : userData.image,
|
26
|
+
alt: "Avatar",
|
27
|
+
"aria-label": "Avatar"
|
28
|
+
}, avatarProps)), (0, _react2.jsx)(_.Icon, {
|
29
|
+
icon: _ChevronDownIcon["default"],
|
30
|
+
size: "16px",
|
31
|
+
color: "gray-800"
|
32
|
+
}))), (0, _react2.jsx)(_.Menu, {
|
33
|
+
variant: "navigationHeader.dropdownMenu"
|
34
|
+
}, (0, _react2.jsx)(_.Item, {
|
35
|
+
key: "profile"
|
36
|
+
}, (0, _react2.jsx)(_.Link, {
|
37
|
+
href: "#",
|
38
|
+
variant: "navigationHeader.dropdownMenuItem"
|
39
|
+
}, (0, _react2.jsx)(_.Box, {
|
40
|
+
isRow: true,
|
41
|
+
alignItems: "center",
|
42
|
+
gap: "md"
|
43
|
+
}, (0, _react2.jsx)(_.Avatar, (0, _extends2["default"])({
|
44
|
+
src: userData === null || userData === void 0 ? void 0 : userData.image,
|
45
|
+
alt: "Avatar",
|
46
|
+
"aria-label": "Avatar"
|
47
|
+
}, avatarProps)), (0, _react2.jsx)(_.Box, {
|
48
|
+
ml: "0"
|
49
|
+
}, (0, _react2.jsx)(_.Text, {
|
50
|
+
as: "h5",
|
51
|
+
variant: "h5",
|
52
|
+
mb: "0"
|
53
|
+
}, userData === null || userData === void 0 ? void 0 : userData.firstName, ' ', userData === null || userData === void 0 ? void 0 : userData.lastName), (0, _react2.jsx)(_.Text, {
|
54
|
+
color: "gray-500",
|
55
|
+
fontSize: "sm"
|
56
|
+
}, userData === null || userData === void 0 ? void 0 : userData.email))))), (0, _react2.jsx)(_.Item, {
|
57
|
+
isSeparator: true,
|
58
|
+
textValue: "-",
|
59
|
+
my: "sm"
|
60
|
+
}, (0, _react2.jsx)(_.Separator, null)), (0, _react2.jsx)(_.Item, {
|
61
|
+
key: "signOut"
|
62
|
+
}, (0, _react2.jsx)(_.Link, {
|
63
|
+
color: "gray-700",
|
64
|
+
variant: "navigationHeader.dropdownMenuItem"
|
65
|
+
}, (0, _react2.jsx)(_.Box, {
|
66
|
+
isRow: true,
|
67
|
+
alignItems: "center"
|
68
|
+
}, (0, _react2.jsx)(_.Icon, {
|
69
|
+
icon: _LogoutVariantIcon["default"],
|
70
|
+
size: "18px",
|
71
|
+
mr: "sm"
|
72
|
+
}), (0, _react2.jsx)(_.Text, null, "Sign Out")))))));
|
73
|
+
};
|
74
|
+
var _default = HeaderAccountMenu;
|
75
|
+
exports["default"] = _default;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ThemeUICSSObject } from 'theme-ui';
|
3
|
+
interface NavigationHeaderProps {
|
4
|
+
isSticky?: boolean;
|
5
|
+
children?: React.ReactNode;
|
6
|
+
sx?: ThemeUICSSObject;
|
7
|
+
}
|
8
|
+
declare const NavigationHeader: React.ForwardRefExoticComponent<NavigationHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
9
|
+
export default NavigationHeader;
|
@@ -0,0 +1,49 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
4
|
+
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
5
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
6
|
+
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
7
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
8
|
+
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
9
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
10
|
+
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
11
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
12
|
+
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
13
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
14
|
+
_Object$defineProperty(exports, "__esModule", {
|
15
|
+
value: true
|
16
|
+
});
|
17
|
+
exports["default"] = void 0;
|
18
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
19
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
20
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
21
|
+
var _react = _interopRequireWildcard(require("react"));
|
22
|
+
var _ = require("../..");
|
23
|
+
var _react2 = require("@emotion/react");
|
24
|
+
var _excluded = ["children", "isSticky"];
|
25
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
27
|
+
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; }
|
28
|
+
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) { (0, _defineProperty2["default"])(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; }
|
29
|
+
var NavigationHeader = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
30
|
+
var children = props.children,
|
31
|
+
isSticky = props.isSticky,
|
32
|
+
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
33
|
+
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
34
|
+
as: "nav",
|
35
|
+
ref: ref,
|
36
|
+
variant: "navigationHeader.container",
|
37
|
+
sx: _objectSpread(_objectSpread({}, props === null || props === void 0 ? void 0 : props.sx), isSticky && {
|
38
|
+
position: 'sticky'
|
39
|
+
})
|
40
|
+
}, others), (0, _react2.jsx)(_.Box, {
|
41
|
+
variant: "navigationHeader.wrapper"
|
42
|
+
}, (0, _react2.jsx)(_.Box, {
|
43
|
+
isRow: true,
|
44
|
+
justifyContent: "space-between",
|
45
|
+
alignItems: "center"
|
46
|
+
}, children)));
|
47
|
+
});
|
48
|
+
var _default = NavigationHeader;
|
49
|
+
exports["default"] = _default;
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { Meta } from '@storybook/addon-docs';
|
2
|
+
|
3
|
+
<Meta title="Components/NavigationHeader/NavigationHeader" />
|
4
|
+
|
5
|
+
# NavigationHeader
|
6
|
+
The Header component is designed to help users navigate to different pages.
|
7
|
+
It incorporates several child components, including Link, Image, Avatar, and PopUp, allowing for a customizable and functional navigation experience.
|
8
|
+
|
9
|
+
### Required components
|
10
|
+
This component can be used independently and does not require additional components.
|
11
|
+
|
12
|
+
### Accessibility
|
13
|
+
|
14
|
+
This component should adhere to the [WAI-ARIA Navigation](https://www.w3.org/WAI/ARIA/apg/patterns/landmarks/examples/navigation.html) accessibility guidelines.
|
15
|
+
|
16
|
+
#### Keyboard Navigation
|
17
|
+
|
18
|
+
These keys provide additional functionality to the component.
|
19
|
+
|
20
|
+
| Key | Functions |
|
21
|
+
| -------------- | ----------------------------------------------------------------------------------------------------------------- |
|
22
|
+
| Tab | Focuses item and follows the page tab sequence. |
|
23
|
+
| Shift + Tab | Moves focus to the previous focusable component. |
|
24
|
+
| Space or Enter | Pressing Space or Enter on a focused trigger opens or closes the dropdown menu and selects the MenuItems it is focused on. |
|
25
|
+
| Arrow keys | Moves the selection through the popover. |
|
26
|
+
| Esc | Pressing the escape key closes the popover and focuses on the previous focusable component. |
|
27
|
+
|
28
|
+
#### Screen readers
|
29
|
+
|
30
|
+
This component uses the following attributes to assist screen readers:
|
31
|
+
- Each Link component uses the **`aria-label`** attribute to provide an accessible name.
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
3
|
+
export default _default;
|
4
|
+
export interface userDataProps {
|
5
|
+
email: string;
|
6
|
+
firstName: string;
|
7
|
+
lastName: string;
|
8
|
+
image?: string;
|
9
|
+
}
|
10
|
+
export declare const Default: ({ ...args }: {
|
11
|
+
[x: string]: any;
|
12
|
+
}) => React.JSX.Element;
|
@@ -0,0 +1,210 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
4
|
+
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
6
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
7
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
8
|
+
_Object$defineProperty(exports, "__esModule", {
|
9
|
+
value: true
|
10
|
+
});
|
11
|
+
exports["default"] = exports.Default = void 0;
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
13
|
+
var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectDestructuringEmpty"));
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
15
|
+
var _react = _interopRequireWildcard(require("react"));
|
16
|
+
var _HelpCircleOutlineIcon = _interopRequireDefault(require("@pingux/mdi-react/HelpCircleOutlineIcon"));
|
17
|
+
var _MoonWaningCrescentIcon = _interopRequireDefault(require("@pingux/mdi-react/MoonWaningCrescentIcon"));
|
18
|
+
var _WhiteBalanceSunnyIcon = _interopRequireDefault(require("@pingux/mdi-react/WhiteBalanceSunnyIcon"));
|
19
|
+
var _storybookDocsLayout = _interopRequireDefault(require("../../../.storybook/storybookDocsLayout"));
|
20
|
+
var _index = require("../../index");
|
21
|
+
var _images = require("../../utils/devUtils/constants/images");
|
22
|
+
var _HeaderAccountMenu = _interopRequireDefault(require("./HeaderAccountMenu"));
|
23
|
+
var _NavigationHeader = _interopRequireDefault(require("./NavigationHeader.mdx"));
|
24
|
+
var _react2 = require("@emotion/react");
|
25
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
27
|
+
var _default = {
|
28
|
+
title: 'Components/NavigationHeader',
|
29
|
+
component: _index.NavigationHeader,
|
30
|
+
parameters: {
|
31
|
+
docs: {
|
32
|
+
page: function page() {
|
33
|
+
return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_NavigationHeader["default"], null), (0, _react2.jsx)(_storybookDocsLayout["default"], null));
|
34
|
+
},
|
35
|
+
source: {
|
36
|
+
type: 'code'
|
37
|
+
}
|
38
|
+
}
|
39
|
+
},
|
40
|
+
argTypes: {
|
41
|
+
src: {
|
42
|
+
control: {
|
43
|
+
type: 'none'
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
};
|
48
|
+
exports["default"] = _default;
|
49
|
+
var iconButtonSX = {
|
50
|
+
minWidth: '56px',
|
51
|
+
borderRadius: '3px',
|
52
|
+
py: 'xs',
|
53
|
+
px: 'sm'
|
54
|
+
};
|
55
|
+
var placeholderSeparator = {
|
56
|
+
bg: 'gray-300',
|
57
|
+
flexShrink: 0
|
58
|
+
};
|
59
|
+
|
60
|
+
// Breakpoints for display property
|
61
|
+
var breakpointDisplaysXS = ['none', 'none', 'block', 'block', 'block', 'block'];
|
62
|
+
var breakpointDisplaySmall = ['none', 'none', 'none', 'none', 'block', 'block'];
|
63
|
+
var userData = {
|
64
|
+
email: 'bjensen@example.com',
|
65
|
+
firstName: 'Barbara',
|
66
|
+
lastName: 'Jensen',
|
67
|
+
image: _images.userImage
|
68
|
+
};
|
69
|
+
var Default = function Default(_ref) {
|
70
|
+
var args = (0, _extends2["default"])({}, ((0, _objectDestructuringEmpty2["default"])(_ref), _ref));
|
71
|
+
var _useState = (0, _react.useState)(false),
|
72
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
73
|
+
isLoggedIn = _useState2[0],
|
74
|
+
setIsLoggedIn = _useState2[1];
|
75
|
+
return (0, _react2.jsx)(_index.Box, {
|
76
|
+
p: "0"
|
77
|
+
}, (0, _react2.jsx)(_index.NavigationHeader, (0, _extends2["default"])({}, args, {
|
78
|
+
isSticky: true,
|
79
|
+
"aria-labelledby": "next-gen-header"
|
80
|
+
}), (0, _react2.jsx)(_index.Link, {
|
81
|
+
href: "#",
|
82
|
+
variant: "navigationHeader.logoBand"
|
83
|
+
}, (0, _react2.jsx)(_index.Box, {
|
84
|
+
isRow: true,
|
85
|
+
alignItems: "center",
|
86
|
+
justifyContent: "center",
|
87
|
+
py: "sm",
|
88
|
+
flex: "0 0 auto"
|
89
|
+
}, (0, _react2.jsx)(_index.Image, {
|
90
|
+
src: _images.pingLogoHorizontal,
|
91
|
+
alt: "Ping Identity Logo",
|
92
|
+
mr: "md",
|
93
|
+
sx: {
|
94
|
+
height: '24px'
|
95
|
+
}
|
96
|
+
}), (0, _react2.jsx)(_index.Separator, {
|
97
|
+
orientation: "vertical",
|
98
|
+
sx: placeholderSeparator,
|
99
|
+
style: {
|
100
|
+
height: '28px',
|
101
|
+
margin: '0'
|
102
|
+
}
|
103
|
+
}), (0, _react2.jsx)(_index.Text, {
|
104
|
+
as: "h2",
|
105
|
+
variant: "navigationHeader.headerPlaceholder",
|
106
|
+
id: "next-gen-header"
|
107
|
+
}, "Marketplace"))), (0, _react2.jsx)(_index.Box, {
|
108
|
+
as: "ul",
|
109
|
+
isRow: true,
|
110
|
+
alignItems: "center",
|
111
|
+
p: "0",
|
112
|
+
ml: "auto",
|
113
|
+
flex: "0 0 auto"
|
114
|
+
}, (0, _react2.jsx)(_index.Box, {
|
115
|
+
as: "li",
|
116
|
+
display: breakpointDisplaySmall
|
117
|
+
}, (0, _react2.jsx)(_index.Link, {
|
118
|
+
"aria-label": "Browse",
|
119
|
+
href: "#",
|
120
|
+
variant: "navigationHeader.link"
|
121
|
+
}, "Browse")), (0, _react2.jsx)(_index.Box, {
|
122
|
+
as: "li",
|
123
|
+
display: breakpointDisplaySmall
|
124
|
+
}, (0, _react2.jsx)(_index.Link, {
|
125
|
+
"aria-label": "My Content",
|
126
|
+
href: "#",
|
127
|
+
variant: "navigationHeader.link"
|
128
|
+
}, "My Content")), (0, _react2.jsx)(_index.Box, {
|
129
|
+
as: "li",
|
130
|
+
display: breakpointDisplaySmall
|
131
|
+
}, (0, _react2.jsx)(_index.Link, {
|
132
|
+
"aria-label": "Reports",
|
133
|
+
href: "#",
|
134
|
+
variant: "navigationHeader.link"
|
135
|
+
}, "Reports")), (0, _react2.jsx)(_index.Box, {
|
136
|
+
as: "li",
|
137
|
+
display: breakpointDisplaysXS
|
138
|
+
}, (0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.PopoverMenu, {
|
139
|
+
isContainFocus: true
|
140
|
+
}, (0, _react2.jsx)(_index.IconButton, {
|
141
|
+
"aria-label": "Help & Support",
|
142
|
+
variant: "headerNav"
|
143
|
+
}, (0, _react2.jsx)(_index.Icon, {
|
144
|
+
size: "24px",
|
145
|
+
color: "gray-800",
|
146
|
+
icon: _HelpCircleOutlineIcon["default"],
|
147
|
+
title: {
|
148
|
+
name: 'help circle outline icon'
|
149
|
+
}
|
150
|
+
})), (0, _react2.jsx)(_index.Menu, {
|
151
|
+
variant: "navigationHeader.dropdownMenu"
|
152
|
+
}, (0, _react2.jsx)(_index.Item, {
|
153
|
+
key: "Help & Support"
|
154
|
+
}, (0, _react2.jsx)(_index.Link, {
|
155
|
+
href: "Help & Support",
|
156
|
+
"aria-label": "Help & Support",
|
157
|
+
variant: "navigationHeader.dropdownMenuItem"
|
158
|
+
}, "Help & Support")), (0, _react2.jsx)(_index.Item, {
|
159
|
+
key: "Doc"
|
160
|
+
}, (0, _react2.jsx)(_index.Link, {
|
161
|
+
href: "Doc",
|
162
|
+
"aria-label": "Doc",
|
163
|
+
variant: "navigationHeader.dropdownMenuItem"
|
164
|
+
}, "Doc")), (0, _react2.jsx)(_index.Item, {
|
165
|
+
key: "Developer"
|
166
|
+
}, (0, _react2.jsx)(_index.Link, {
|
167
|
+
href: "Developer",
|
168
|
+
"aria-label": "Developer",
|
169
|
+
variant: "navigationHeader.dropdownMenuItem"
|
170
|
+
}, "Developer")), (0, _react2.jsx)(_index.Item, {
|
171
|
+
key: "Labs"
|
172
|
+
}, (0, _react2.jsx)(_index.Link, {
|
173
|
+
href: "Labs",
|
174
|
+
"aria-label": "Labs",
|
175
|
+
variant: "navigationHeader.dropdownMenuItem"
|
176
|
+
}, "Labs")))))), (0, _react2.jsx)(_index.Box, {
|
177
|
+
as: "li",
|
178
|
+
display: breakpointDisplaysXS
|
179
|
+
}, (0, _react2.jsx)(_index.IconButtonToggle, {
|
180
|
+
toggledIcon: _WhiteBalanceSunnyIcon["default"],
|
181
|
+
defaultIcon: _MoonWaningCrescentIcon["default"],
|
182
|
+
iconProps: {
|
183
|
+
size: '24px'
|
184
|
+
},
|
185
|
+
buttonProps: {
|
186
|
+
'aria-label': 'theme icon',
|
187
|
+
sx: iconButtonSX,
|
188
|
+
variant: 'headerNav'
|
189
|
+
}
|
190
|
+
})), (0, _react2.jsx)(_index.Box, {
|
191
|
+
as: "li",
|
192
|
+
display: breakpointDisplaysXS
|
193
|
+
}, isLoggedIn ? (0, _react2.jsx)(_HeaderAccountMenu["default"], {
|
194
|
+
userData: userData,
|
195
|
+
avatarProps: {
|
196
|
+
defaultText: 'KL',
|
197
|
+
size: 'avatar.md',
|
198
|
+
backgroundColor: 'red-100',
|
199
|
+
color: 'red-800'
|
200
|
+
}
|
201
|
+
}) : (0, _react2.jsx)(_index.Link, {
|
202
|
+
href: "#",
|
203
|
+
variant: "navigationHeader.link",
|
204
|
+
"aria-label": "Sign In",
|
205
|
+
onPress: function onPress() {
|
206
|
+
return setIsLoggedIn(!isLoggedIn);
|
207
|
+
}
|
208
|
+
}, "Sign In")))));
|
209
|
+
};
|
210
|
+
exports.Default = Default;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|