@automattic/vip-design-system 2.10.0 → 2.10.2
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/babel.config.js +23 -19
- package/build/declaration.d.js +0 -1
- package/build/system/Accordion/Accordion.js +28 -33
- package/build/system/Accordion/Accordion.stories.js +34 -35
- package/build/system/Accordion/Accordion.test.js +35 -34
- package/build/system/Accordion/index.js +5 -8
- package/build/system/Avatar/Avatar.js +13 -17
- package/build/system/Avatar/Avatar.stories.js +10 -12
- package/build/system/Avatar/Avatar.test.js +15 -14
- package/build/system/Avatar/index.js +4 -6
- package/build/system/Badge/Badge.js +9 -14
- package/build/system/Badge/Badge.stories.js +23 -23
- package/build/system/Badge/Badge.test.js +15 -14
- package/build/system/Badge/index.js +4 -6
- package/build/system/Box/Box.js +9 -13
- package/build/system/Box/Box.stories.js +5 -8
- package/build/system/Breadcrumbs/Breadcrumbs.js +34 -38
- package/build/system/Breadcrumbs/Breadcrumbs.stories.js +18 -21
- package/build/system/Breadcrumbs/Breadcrumbs.test.js +28 -30
- package/build/system/Breadcrumbs/styles.js +5 -9
- package/build/system/Button/Button.js +11 -17
- package/build/system/Button/Button.stories.js +34 -33
- package/build/system/Button/Button.test.js +17 -16
- package/build/system/Button/ButtonSubmit.js +12 -16
- package/build/system/Button/ButtonSubmit.stories.js +12 -16
- package/build/system/Button/ButtonSubmit.test.js +15 -14
- package/build/system/Button/index.js +5 -8
- package/build/system/Card/Card.js +12 -14
- package/build/system/Card/Card.stories.js +21 -24
- package/build/system/Card/Card.test.js +19 -18
- package/build/system/Card/index.js +4 -6
- package/build/system/Code/Code.js +19 -23
- package/build/system/Code/Code.stories.js +16 -18
- package/build/system/Code/Code.test.js +20 -19
- package/build/system/Code/index.js +4 -6
- package/build/system/Drawer/Drawer.js +25 -30
- package/build/system/Drawer/Drawer.stories.js +38 -39
- package/build/system/Drawer/Drawer.test.js +19 -18
- package/build/system/Drawer/styles.js +9 -11
- package/build/system/Dropdown/Dropdown.js +23 -26
- package/build/system/Dropdown/Dropdown.test.js +16 -18
- package/build/system/Dropdown/DropdownContent.js +14 -20
- package/build/system/Dropdown/DropdownItem.js +19 -25
- package/build/system/Dropdown/DropdownLabel.js +10 -16
- package/build/system/Dropdown/DropdownSeparator.js +10 -16
- package/build/system/Dropdown/index.js +20 -23
- package/build/system/FilterDropdown/FilterDropdown.js +23 -29
- package/build/system/FilterDropdown/FilterDropdown.stories.js +9 -11
- package/build/system/FilterDropdown/FilterDropdown.test.js +7 -10
- package/build/system/Flex/Flex.js +7 -10
- package/build/system/Flex/Flex.stories.js +6 -10
- package/build/system/Flex/index.js +4 -6
- package/build/system/Footer/Footer.d.ts +33 -0
- package/build/system/Footer/Footer.js +82 -0
- package/build/system/Footer/Footer.stories.d.ts +41 -0
- package/build/system/Footer/Footer.stories.js +53 -0
- package/build/system/Footer/Footer.test.d.ts +1 -0
- package/build/system/Footer/Footer.test.js +36 -0
- package/build/system/Form/Checkbox/Checkbox.js +14 -18
- package/build/system/Form/Checkbox/Checkbox.stories.js +47 -48
- package/build/system/Form/Checkbox/Checkbox.test.js +23 -21
- package/build/system/Form/Checkbox/styles.js +7 -10
- package/build/system/Form/Input.js +19 -18
- package/build/system/Form/Input.stories.js +16 -18
- package/build/system/Form/Input.styles.js +5 -9
- package/build/system/Form/Label.js +14 -16
- package/build/system/Form/Label.stories.js +15 -15
- package/build/system/Form/Radio/Radio.js +13 -18
- package/build/system/Form/Radio/Radio.stories.js +43 -43
- package/build/system/Form/Radio/Radio.test.js +19 -18
- package/build/system/Form/Radio/RadioOption.js +22 -23
- package/build/system/Form/Radio/styles.js +7 -10
- package/build/system/Form/RadioGroupChip.js +26 -29
- package/build/system/Form/RadioGroupChip.stories.js +12 -15
- package/build/system/Form/RadioGroupChip.test.js +12 -11
- package/build/system/Form/RequiredLabel.js +3 -7
- package/build/system/Form/Toggle.js +11 -16
- package/build/system/Form/Toggle.stories.js +25 -27
- package/build/system/Form/Toggle.test.js +12 -11
- package/build/system/Form/Validation.js +10 -12
- package/build/system/Form/index.d.ts +2 -1
- package/build/system/Form/index.js +2 -0
- package/build/system/Grid/Grid.js +7 -10
- package/build/system/Grid/Grid.stories.js +6 -10
- package/build/system/Grid/index.js +4 -6
- package/build/system/Heading/Heading.js +9 -14
- package/build/system/Heading/Heading.stories.js +13 -16
- package/build/system/Hr/Hr.js +3 -7
- package/build/system/Hr/Hr.stories.js +10 -11
- package/build/system/Hr/Hr.test.js +14 -14
- package/build/system/Link/Link.js +11 -14
- package/build/system/Link/Link.stories.js +11 -14
- package/build/system/Link/index.js +4 -6
- package/build/system/LinkExternal/LinkExternal.d.ts +23 -3
- package/build/system/LinkExternal/LinkExternal.js +17 -23
- package/build/system/LinkExternal/LinkExternal.stories.d.ts +1 -8
- package/build/system/LinkExternal/LinkExternal.stories.js +4 -9
- package/build/system/LinkExternal/LinkExternal.test.js +14 -15
- package/build/system/MobileMenu/MobileMenu.js +24 -29
- package/build/system/MobileMenu/MobileMenu.stories.js +66 -67
- package/build/system/MobileMenu/MobileMenu.test.js +21 -22
- package/build/system/Nav/Nav.js +26 -32
- package/build/system/Nav/Nav.stories.js +97 -99
- package/build/system/Nav/Nav.test.js +32 -28
- package/build/system/Nav/NavItem.js +40 -45
- package/build/system/Nav/NavItemGroup.js +34 -39
- package/build/system/Nav/NavItemGroup.test.js +26 -23
- package/build/system/Nav/styles/variants/breadcrumbs.js +4 -7
- package/build/system/Nav/styles/variants/menu.js +8 -12
- package/build/system/Nav/styles/variants/menugroup.js +7 -11
- package/build/system/Nav/styles/variants/primary.js +4 -8
- package/build/system/Nav/styles/variants/tabs.js +3 -7
- package/build/system/Nav/styles/variants/toolbar.js +5 -8
- package/build/system/Nav/styles.js +26 -29
- package/build/system/NewDialog/DialogClose.js +14 -18
- package/build/system/NewDialog/DialogClose.test.js +11 -14
- package/build/system/NewDialog/DialogDescription.js +9 -15
- package/build/system/NewDialog/DialogOverlay.js +11 -13
- package/build/system/NewDialog/DialogTitle.js +7 -15
- package/build/system/NewDialog/NewDialog.js +24 -29
- package/build/system/NewDialog/index.js +7 -11
- package/build/system/NewDialog/styles.js +1 -5
- package/build/system/NewForm/Fieldset.js +13 -17
- package/build/system/NewForm/Form.js +8 -13
- package/build/system/NewForm/FormAutocomplete.js +2 -2
- package/build/system/NewForm/Legend.js +11 -15
- package/build/system/Notice/Notice.js +22 -25
- package/build/system/Notice/Notice.stories.js +41 -43
- package/build/system/Notice/index.js +5 -5
- package/build/system/Page/Page.js +4 -8
- package/build/system/Page/Page.test.js +14 -14
- package/build/system/Progress/Progress.js +21 -24
- package/build/system/Progress/Progress.stories.js +9 -15
- package/build/system/Progress/Progress.test.js +14 -13
- package/build/system/Progress/index.js +4 -6
- package/build/system/ScreenReaderText/ScreenReaderText.js +9 -9
- package/build/system/Spinner/Spinner.js +9 -14
- package/build/system/Spinner/Spinner.stories.js +6 -10
- package/build/system/Spinner/Spinner.test.js +14 -13
- package/build/system/Spinner/index.js +1 -6
- package/build/system/Table/Table.js +20 -22
- package/build/system/Table/Table.stories.js +29 -30
- package/build/system/Table/TableCell.js +9 -11
- package/build/system/Table/TableRow.js +10 -11
- package/build/system/Table/index.js +6 -10
- package/build/system/Text/Text.js +9 -14
- package/build/system/Text/Text.stories.js +24 -25
- package/build/system/Text/index.js +4 -6
- package/build/system/Toolbar/Logo.js +11 -15
- package/build/system/Toolbar/Toolbar.js +12 -17
- package/build/system/Toolbar/Toolbar.stories.js +47 -50
- package/build/system/Toolbar/Toolbar.test.js +26 -24
- package/build/system/Toolbar/ToolbarUtilNav.js +9 -16
- package/build/system/Toolbar/index.js +10 -15
- package/build/system/Tooltip/Tooltip.js +9 -14
- package/build/system/Tooltip/Tooltip.stories.js +29 -31
- package/build/system/Tooltip/index.js +5 -5
- package/build/system/Wizard/Wizard.js +11 -18
- package/build/system/Wizard/Wizard.stories.js +37 -38
- package/build/system/Wizard/WizardStep.js +26 -32
- package/build/system/Wizard/index.js +6 -7
- package/build/system/assets/a8cLogo.d.ts +2 -0
- package/build/system/assets/a8cLogo.js +39 -0
- package/build/system/index.d.ts +2 -1
- package/build/system/index.js +2 -0
- package/build/system/theme/breakpoints.js +1 -5
- package/build/system/utils/stories/CustomLink.js +7 -13
- package/package.json +1 -1
- package/src/system/Footer/Footer.stories.tsx +46 -0
- package/src/system/Footer/Footer.test.tsx +40 -0
- package/src/system/Footer/Footer.tsx +120 -0
- package/src/system/Form/index.js +2 -0
- package/src/system/LinkExternal/LinkExternal.tsx +27 -8
- package/src/system/NewForm/FormAutocomplete.js +2 -2
- package/src/system/assets/a8cLogo.tsx +30 -0
- package/src/system/index.js +2 -0
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.Validation = void 0;
|
|
5
|
-
var _md = require("react-icons/md");
|
|
6
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
7
1
|
var _excluded = ["children", "isValid", "describedId"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
4
|
/** @jsxImportSource theme-ui */
|
|
5
|
+
|
|
9
6
|
/**
|
|
10
7
|
* External dependencies
|
|
11
8
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import { MdErrorOutline, MdCheckCircle } from 'react-icons/md';
|
|
10
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
14
12
|
var errorColor = 'texts.error';
|
|
15
13
|
var helperColor = 'texts.helper';
|
|
16
|
-
var Validation =
|
|
14
|
+
export var Validation = function Validation(_ref) {
|
|
17
15
|
var children = _ref.children,
|
|
18
16
|
isValid = _ref.isValid,
|
|
19
17
|
describedId = _ref.describedId,
|
|
20
18
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
21
|
-
return (
|
|
19
|
+
return _jsxs("p", _extends({
|
|
22
20
|
sx: {
|
|
23
21
|
color: isValid ? helperColor : errorColor,
|
|
24
22
|
display: 'flex',
|
|
@@ -28,12 +26,12 @@ var Validation = exports.Validation = function Validation(_ref) {
|
|
|
28
26
|
},
|
|
29
27
|
id: describedId ? "describe-" + describedId + "-validation" : undefined
|
|
30
28
|
}, props, {
|
|
31
|
-
children: [isValid ? (
|
|
29
|
+
children: [isValid ? _jsx(MdCheckCircle, {
|
|
32
30
|
sx: {
|
|
33
31
|
mr: 1
|
|
34
32
|
},
|
|
35
33
|
"aria-hidden": "true"
|
|
36
|
-
}) : (
|
|
34
|
+
}) : _jsx(MdErrorOutline, {
|
|
37
35
|
sx: {
|
|
38
36
|
mr: 1
|
|
39
37
|
},
|
|
@@ -3,9 +3,10 @@ import { InputWithCopyButton } from './InputWithCopyButton';
|
|
|
3
3
|
import { Label } from './Label';
|
|
4
4
|
import { Radio } from './Radio/Radio';
|
|
5
5
|
import { RadioBoxGroup } from './RadioBoxGroup';
|
|
6
|
+
import { RadioGroupChip } from './RadioGroupChip';
|
|
6
7
|
import { Textarea } from './Textarea';
|
|
7
8
|
import { Toggle } from './Toggle';
|
|
8
9
|
import { ToggleRow } from './ToggleRow';
|
|
9
10
|
import { Validation } from './Validation';
|
|
10
11
|
import { Checkbox } from './Checkbox/Checkbox';
|
|
11
|
-
export { Input, InputWithCopyButton, Label, Radio, RadioBoxGroup, Textarea, Toggle, ToggleRow, Validation, Checkbox };
|
|
12
|
+
export { Input, InputWithCopyButton, Label, Radio, RadioBoxGroup, RadioGroupChip, Textarea, Toggle, ToggleRow, Validation, Checkbox };
|
|
@@ -7,6 +7,7 @@ import { InputWithCopyButton } from './InputWithCopyButton';
|
|
|
7
7
|
import { Label } from './Label';
|
|
8
8
|
import { Radio } from './Radio/Radio';
|
|
9
9
|
import { RadioBoxGroup } from './RadioBoxGroup';
|
|
10
|
+
import { RadioGroupChip } from './RadioGroupChip';
|
|
10
11
|
import { Textarea } from './Textarea';
|
|
11
12
|
import { Toggle } from './Toggle';
|
|
12
13
|
import { ToggleRow } from './ToggleRow';
|
|
@@ -18,6 +19,7 @@ export {
|
|
|
18
19
|
Label,
|
|
19
20
|
Radio,
|
|
20
21
|
RadioBoxGroup,
|
|
22
|
+
RadioGroupChip,
|
|
21
23
|
Textarea,
|
|
22
24
|
Toggle,
|
|
23
25
|
ToggleRow,
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.Grid = void 0;
|
|
5
|
-
var _react = require("react");
|
|
6
|
-
var _themeUi = require("theme-ui");
|
|
7
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
8
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /**
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
/**
|
|
9
3
|
* External dependencies
|
|
10
4
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
import { forwardRef } from 'react';
|
|
6
|
+
import { Grid as ThemeGrid } from 'theme-ui';
|
|
7
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
8
|
+
export var Grid = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
9
|
+
return _jsx(ThemeGrid, _extends({}, props, {
|
|
13
10
|
ref: ref
|
|
14
11
|
}));
|
|
15
12
|
});
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = exports.Default = void 0;
|
|
5
|
-
var _ = require("..");
|
|
6
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
7
1
|
/**
|
|
8
2
|
* Internal dependencies
|
|
9
3
|
*/
|
|
10
|
-
|
|
4
|
+
import { Grid } from '..';
|
|
5
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
6
|
+
export default {
|
|
11
7
|
title: 'Grid',
|
|
12
|
-
component:
|
|
8
|
+
component: Grid
|
|
13
9
|
};
|
|
14
|
-
var Default =
|
|
15
|
-
return (
|
|
10
|
+
export var Default = function Default() {
|
|
11
|
+
return _jsx(Grid, {
|
|
16
12
|
children: "Hello"
|
|
17
13
|
});
|
|
18
14
|
};
|
|
@@ -1,32 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.Heading = void 0;
|
|
5
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
6
|
-
var _react = require("react");
|
|
7
|
-
var _themeUi = require("theme-ui");
|
|
8
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
9
1
|
var _excluded = ["variant", "sx", "className"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
4
|
/**
|
|
11
5
|
* External dependencies
|
|
12
6
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
import { forwardRef } from 'react';
|
|
9
|
+
import { Heading as ThemeHeading } from 'theme-ui';
|
|
10
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
11
|
+
export var Heading = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
17
12
|
var _ref$variant = _ref.variant,
|
|
18
13
|
variant = _ref$variant === void 0 ? 'h3' : _ref$variant,
|
|
19
14
|
sx = _ref.sx,
|
|
20
15
|
className = _ref.className,
|
|
21
16
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
22
|
-
return (
|
|
17
|
+
return _jsx(ThemeHeading, _extends({
|
|
23
18
|
as: variant,
|
|
24
19
|
sx: _extends({
|
|
25
20
|
color: 'heading',
|
|
26
21
|
// pass variant prop to sx
|
|
27
22
|
variant: "text." + variant.toString()
|
|
28
23
|
}, sx),
|
|
29
|
-
className: (
|
|
24
|
+
className: classNames('vip-heading-component', className),
|
|
30
25
|
ref: ref
|
|
31
26
|
}, rest));
|
|
32
27
|
});
|
|
@@ -1,34 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = exports.Default = void 0;
|
|
5
|
-
var _ = require("..");
|
|
6
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
7
1
|
/**
|
|
8
2
|
* Internal dependencies
|
|
9
3
|
*/
|
|
10
|
-
|
|
4
|
+
import { Box, Heading } from '..';
|
|
5
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
7
|
+
export default {
|
|
11
8
|
title: 'Heading',
|
|
12
|
-
component:
|
|
9
|
+
component: Heading
|
|
13
10
|
};
|
|
14
|
-
var Default =
|
|
15
|
-
return (
|
|
16
|
-
children: [(
|
|
11
|
+
export var Default = function Default() {
|
|
12
|
+
return _jsxs(Box, {
|
|
13
|
+
children: [_jsx(Heading, {
|
|
17
14
|
variant: "h1",
|
|
18
15
|
children: "Your Applications"
|
|
19
|
-
}), (
|
|
16
|
+
}), _jsx(Heading, {
|
|
20
17
|
variant: "h2",
|
|
21
18
|
children: "Heading Two"
|
|
22
|
-
}), (
|
|
19
|
+
}), _jsx(Heading, {
|
|
23
20
|
variant: "h3",
|
|
24
21
|
children: "Heading Three"
|
|
25
|
-
}), (
|
|
22
|
+
}), _jsx(Heading, {
|
|
26
23
|
variant: "h4",
|
|
27
24
|
children: "Heading Four"
|
|
28
|
-
}), (
|
|
25
|
+
}), _jsx(Heading, {
|
|
29
26
|
variant: "h5",
|
|
30
27
|
children: "Heading Five"
|
|
31
|
-
}), (
|
|
28
|
+
}), _jsx(Heading, {
|
|
32
29
|
variant: "h6",
|
|
33
30
|
children: "Heading Six"
|
|
34
31
|
})]
|
package/build/system/Hr/Hr.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.Hr = void 0;
|
|
5
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
6
1
|
var _excluded = ["sx"];
|
|
2
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
7
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
8
4
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
5
|
/** @jsxImportSource theme-ui */
|
|
10
6
|
|
|
11
|
-
var Hr =
|
|
7
|
+
export var Hr = function Hr(_ref) {
|
|
12
8
|
var sx = _ref.sx,
|
|
13
9
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
14
|
-
return (
|
|
10
|
+
return _jsx("hr", _extends({
|
|
15
11
|
sx: _extends({
|
|
16
12
|
my: 4,
|
|
17
13
|
border: 0,
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = exports.Default = void 0;
|
|
5
|
-
var _Hr = require("./Hr");
|
|
6
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
7
1
|
/**
|
|
8
2
|
* External dependencies
|
|
9
3
|
*/
|
|
4
|
+
import { Hr } from './Hr';
|
|
5
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
6
|
+
import { Fragment as _Fragment } from "theme-ui/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
10
8
|
/**
|
|
11
9
|
* Internal dependencies
|
|
12
10
|
*/
|
|
13
|
-
|
|
11
|
+
|
|
12
|
+
export default {
|
|
14
13
|
title: 'Hr',
|
|
15
|
-
component:
|
|
14
|
+
component: Hr,
|
|
16
15
|
parameters: {
|
|
17
16
|
docs: {
|
|
18
17
|
description: {
|
|
@@ -21,10 +20,10 @@ var _default = exports["default"] = {
|
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
22
|
};
|
|
24
|
-
var Default =
|
|
23
|
+
export var Default = {
|
|
25
24
|
render: function render() {
|
|
26
|
-
return (
|
|
27
|
-
children: ["Horizontal Line:", (
|
|
25
|
+
return _jsxs(_Fragment, {
|
|
26
|
+
children: ["Horizontal Line:", _jsx(Hr, {})]
|
|
28
27
|
});
|
|
29
28
|
}
|
|
30
29
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = require("@testing-library/react");
|
|
4
|
-
var _jestAxe = require("jest-axe");
|
|
5
|
-
var _themeUi = require("theme-ui");
|
|
6
|
-
var _Hr = require("./Hr");
|
|
7
|
-
var _theme = _interopRequireDefault(require("../theme"));
|
|
8
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
1
|
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 e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(typeof e + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
11
2
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
12
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
3
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
4
|
+
/** @jsxImportSource theme-ui */
|
|
5
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
6
|
+
// @ts-nocheck
|
|
7
|
+
import { render } from '@testing-library/react';
|
|
8
|
+
import { axe } from 'jest-axe';
|
|
9
|
+
import { ThemeUIProvider } from 'theme-ui';
|
|
10
|
+
import { Hr } from './Hr';
|
|
11
|
+
import theme from '../theme';
|
|
12
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
13
13
|
var renderWithTheme = function renderWithTheme(children) {
|
|
14
|
-
return
|
|
15
|
-
theme:
|
|
14
|
+
return render(_jsx(ThemeUIProvider, {
|
|
15
|
+
theme: theme,
|
|
16
16
|
children: children
|
|
17
17
|
}));
|
|
18
18
|
};
|
|
19
19
|
var renderComponent = function renderComponent() {
|
|
20
|
-
return renderWithTheme((
|
|
20
|
+
return renderWithTheme(_jsx(Hr, {}));
|
|
21
21
|
};
|
|
22
22
|
describe('<Hr />', function () {
|
|
23
23
|
it('renders the Hr component', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
@@ -28,7 +28,7 @@ describe('<Hr />', function () {
|
|
|
28
28
|
_renderComponent = renderComponent(), container = _renderComponent.container;
|
|
29
29
|
_context.t0 = expect;
|
|
30
30
|
_context.next = 4;
|
|
31
|
-
return
|
|
31
|
+
return axe(container);
|
|
32
32
|
case 4:
|
|
33
33
|
_context.t1 = _context.sent;
|
|
34
34
|
(0, _context.t0)(_context.t1).toHaveNoViolations();
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.linkUnderlineProperties = exports.defaultLinkComponentStyle = exports.LinkVariant = exports.Link = void 0;
|
|
5
|
-
var _react = require("react");
|
|
6
|
-
var _themeUi = require("theme-ui");
|
|
7
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
8
1
|
var _excluded = ["variant", "sx"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
4
|
/**
|
|
10
5
|
* External dependencies
|
|
11
6
|
*/
|
|
7
|
+
import { forwardRef } from 'react';
|
|
8
|
+
import { Link as ThemeLink } from 'theme-ui';
|
|
9
|
+
|
|
12
10
|
// Temporary interface until we add types to the theme definition.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var LinkVariant = exports.LinkVariant = /*#__PURE__*/function (LinkVariant) {
|
|
11
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
12
|
+
export var LinkVariant = /*#__PURE__*/function (LinkVariant) {
|
|
16
13
|
LinkVariant[LinkVariant["primary"] = 0] = "primary";
|
|
17
14
|
LinkVariant[LinkVariant["button-primary"] = 1] = "button-primary";
|
|
18
15
|
LinkVariant[LinkVariant["button-secondary"] = 2] = "button-secondary";
|
|
@@ -22,22 +19,22 @@ var LinkVariant = exports.LinkVariant = /*#__PURE__*/function (LinkVariant) {
|
|
|
22
19
|
LinkVariant[LinkVariant["button-danger"] = 6] = "button-danger";
|
|
23
20
|
return LinkVariant;
|
|
24
21
|
}({});
|
|
25
|
-
var linkUnderlineProperties =
|
|
22
|
+
export var linkUnderlineProperties = {
|
|
26
23
|
textDecorationLine: 'underline',
|
|
27
24
|
textDecorationThickness: '0.07rem',
|
|
28
25
|
textUnderlineOffset: '0.250rem'
|
|
29
26
|
};
|
|
30
|
-
var defaultLinkComponentStyle =
|
|
27
|
+
export var defaultLinkComponentStyle = {
|
|
31
28
|
'&:focus-visible': function focusVisible(theme) {
|
|
32
29
|
return theme.outline;
|
|
33
30
|
}
|
|
34
31
|
};
|
|
35
|
-
var Link =
|
|
32
|
+
export var Link = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
36
33
|
var _ref$variant = _ref.variant,
|
|
37
34
|
variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
|
|
38
35
|
sx = _ref.sx,
|
|
39
36
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
40
|
-
return (
|
|
37
|
+
return _jsx(ThemeLink, _extends({
|
|
41
38
|
variant: variant,
|
|
42
39
|
sx: _extends({}, defaultLinkComponentStyle, sx),
|
|
43
40
|
ref: ref
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = exports.Default = exports.ButtonVariants = void 0;
|
|
5
|
-
var _Link = require("./Link");
|
|
6
|
-
var _Flex = require("../Flex/Flex");
|
|
7
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
8
1
|
/**
|
|
9
2
|
* External dependencies
|
|
10
3
|
*/
|
|
4
|
+
import { Link, LinkVariant } from './Link';
|
|
5
|
+
import { Flex } from '../Flex/Flex';
|
|
6
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
11
7
|
/**
|
|
12
8
|
* Internal dependencies
|
|
13
9
|
*/
|
|
14
|
-
|
|
10
|
+
|
|
11
|
+
export default {
|
|
15
12
|
title: 'Navigation/Link',
|
|
16
|
-
component:
|
|
13
|
+
component: Link,
|
|
17
14
|
argTypes: {
|
|
18
15
|
variant: {
|
|
19
16
|
type: 'select',
|
|
20
|
-
options: Object.values(
|
|
17
|
+
options: Object.values(LinkVariant)
|
|
21
18
|
}
|
|
22
19
|
},
|
|
23
20
|
parameters: {
|
|
@@ -28,20 +25,20 @@ var _default = exports["default"] = {
|
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
27
|
};
|
|
31
|
-
var Default =
|
|
28
|
+
export var Default = {
|
|
32
29
|
args: {
|
|
33
30
|
children: 'Hello',
|
|
34
31
|
href: '#!'
|
|
35
32
|
}
|
|
36
33
|
};
|
|
37
34
|
var buttonTypes = ['button-primary', 'button-secondary', 'button-tertiary', 'button-danger', 'button-display', 'button-ghost'];
|
|
38
|
-
var ButtonVariants =
|
|
39
|
-
return (
|
|
35
|
+
export var ButtonVariants = function ButtonVariants() {
|
|
36
|
+
return _jsx(Flex, {
|
|
40
37
|
sx: {
|
|
41
38
|
gap: 2
|
|
42
39
|
},
|
|
43
40
|
children: buttonTypes.map(function (variant, index) {
|
|
44
|
-
return (
|
|
41
|
+
return _jsx(Link, {
|
|
45
42
|
href: "#!",
|
|
46
43
|
variant: variant,
|
|
47
44
|
children: "Hello"
|
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
type
|
|
2
|
+
import type { LinkProps } from '../Link/Link';
|
|
3
|
+
export type LinkExternalProps = LinkProps & {
|
|
4
|
+
/**
|
|
5
|
+
* Element to be linked.
|
|
6
|
+
**/
|
|
3
7
|
children?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Additional text to include after `defaultScreenReaderText` if enabled.
|
|
10
|
+
**/
|
|
4
11
|
screenReaderText?: string | number;
|
|
5
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Optional arrow icon.
|
|
14
|
+
*
|
|
15
|
+
* @default true
|
|
16
|
+
**/
|
|
6
17
|
showExternalIcon?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Include default text which reads as: `link, <link text>, external link`
|
|
20
|
+
* or if `newTab` is `true`, reads as: `link, <link text>, external link, opens in a new tab`
|
|
21
|
+
**/
|
|
7
22
|
defaultScreenReaderText?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* If link should open in a new tab.
|
|
25
|
+
*
|
|
26
|
+
* @default false
|
|
27
|
+
**/
|
|
8
28
|
newTab?: boolean;
|
|
9
29
|
};
|
|
10
|
-
export declare const LinkExternal:
|
|
30
|
+
export declare const LinkExternal: ({ children, screenReaderText, showExternalIcon, newTab, ...rest }: LinkExternalProps) => import("react").JSX.Element;
|
|
11
31
|
export default LinkExternal;
|
|
@@ -1,48 +1,42 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports["default"] = exports.LinkExternal = void 0;
|
|
5
|
-
var _i18nCalypso = require("i18n-calypso");
|
|
6
|
-
var _Link = require("../Link");
|
|
7
|
-
var _ScreenReaderText = _interopRequireDefault(require("../ScreenReaderText"));
|
|
8
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
9
|
-
var _excluded = ["children", "screenReaderText", "href", "showExternalIcon", "newTab"];
|
|
1
|
+
var _excluded = ["children", "screenReaderText", "showExternalIcon", "newTab"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
4
|
/**
|
|
11
5
|
* External dependencies
|
|
12
6
|
*/
|
|
7
|
+
import { translate } from 'i18n-calypso';
|
|
8
|
+
|
|
13
9
|
/**
|
|
14
10
|
* Internal dependencies
|
|
15
11
|
*/
|
|
12
|
+
import { Link } from '../Link';
|
|
13
|
+
import ScreenReaderText from '../ScreenReaderText';
|
|
14
|
+
import { jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
15
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
16
16
|
// Screen reader announcements
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var DEFAULT_EXTERNAL_LINK_TEXT = (0, _i18nCalypso.translate)(', external link'); // reads as: link, <link text>, external link
|
|
21
|
-
var NEW_TAB_TEXT = (0, _i18nCalypso.translate)(', opens in a new tab'); // reads as: link, <link text>, external link, opens in a new tab
|
|
22
|
-
|
|
23
|
-
var LinkExternal = exports.LinkExternal = function LinkExternal(_ref) {
|
|
17
|
+
var DEFAULT_EXTERNAL_LINK_TEXT = translate(', external link');
|
|
18
|
+
var NEW_TAB_TEXT = translate(', opens in a new tab');
|
|
19
|
+
export var LinkExternal = function LinkExternal(_ref) {
|
|
24
20
|
var _ref$children = _ref.children,
|
|
25
21
|
children = _ref$children === void 0 ? null : _ref$children,
|
|
26
22
|
_ref$screenReaderText = _ref.screenReaderText,
|
|
27
23
|
screenReaderText = _ref$screenReaderText === void 0 ? '' : _ref$screenReaderText,
|
|
28
|
-
href = _ref.href,
|
|
29
24
|
_ref$showExternalIcon = _ref.showExternalIcon,
|
|
30
25
|
showExternalIcon = _ref$showExternalIcon === void 0 ? true : _ref$showExternalIcon,
|
|
31
26
|
_ref$newTab = _ref.newTab,
|
|
32
27
|
newTab = _ref$newTab === void 0 ? false : _ref$newTab,
|
|
33
28
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
34
|
-
return (
|
|
29
|
+
return _jsxs(Link, _extends({
|
|
35
30
|
as: "a",
|
|
36
31
|
target: newTab ? '_blank' : '_self',
|
|
37
|
-
rel: newTab ? 'noopener noreferrer' : ''
|
|
38
|
-
href: href
|
|
32
|
+
rel: newTab ? 'noopener noreferrer' : ''
|
|
39
33
|
}, rest, {
|
|
40
|
-
children: [children, (
|
|
34
|
+
children: [children, _jsxs(ScreenReaderText, {
|
|
41
35
|
children: [screenReaderText, DEFAULT_EXTERNAL_LINK_TEXT, newTab ? NEW_TAB_TEXT : '']
|
|
42
|
-
}), showExternalIcon && (
|
|
36
|
+
}), showExternalIcon && _jsx("span", {
|
|
43
37
|
"aria-hidden": "true",
|
|
44
38
|
children: "\xA0\u2197"
|
|
45
39
|
})]
|
|
46
40
|
}));
|
|
47
41
|
};
|
|
48
|
-
|
|
42
|
+
export default LinkExternal;
|
|
@@ -3,14 +3,7 @@ import LinkExternal from './LinkExternal';
|
|
|
3
3
|
import type { StoryObj } from '@storybook/react';
|
|
4
4
|
declare const _default: {
|
|
5
5
|
title: string;
|
|
6
|
-
component: import("react").
|
|
7
|
-
children?: import("react").ReactNode;
|
|
8
|
-
screenReaderText?: string | number | undefined;
|
|
9
|
-
href: string;
|
|
10
|
-
showExternalIcon?: boolean | undefined;
|
|
11
|
-
defaultScreenReaderText?: boolean | undefined;
|
|
12
|
-
newTab?: boolean | undefined;
|
|
13
|
-
}>;
|
|
6
|
+
component: ({ children, screenReaderText, showExternalIcon, newTab, ...rest }: import("./LinkExternal").LinkExternalProps) => import("react").JSX.Element;
|
|
14
7
|
};
|
|
15
8
|
export default _default;
|
|
16
9
|
type Story = StoryObj<typeof LinkExternal>;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = exports.Default = void 0;
|
|
5
|
-
var _LinkExternal = _interopRequireDefault(require("./LinkExternal"));
|
|
6
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
7
|
-
var _default = exports["default"] = {
|
|
1
|
+
import LinkExternal from './LinkExternal';
|
|
2
|
+
export default {
|
|
8
3
|
title: 'Navigation/LinkExternal',
|
|
9
|
-
component:
|
|
4
|
+
component: LinkExternal
|
|
10
5
|
};
|
|
11
|
-
var Default =
|
|
6
|
+
export var Default = {
|
|
12
7
|
args: {
|
|
13
8
|
children: 'View on GitHub',
|
|
14
9
|
href: 'https://github.com/Automattic/vip-design-system'
|