@yoast/related-keyphrase-suggestions 0.1.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/build/components/CountrySelector/index.js +430 -0
- package/build/components/KeyphrasesTable/index.js +225 -0
- package/build/components/Modal/YoastIcon.js +25 -0
- package/build/components/Modal/index.js +66 -0
- package/build/css/style.css +117 -0
- package/build/elements/DifficultyBullet/index.js +104 -0
- package/build/elements/IntentBadge/index.js +57 -0
- package/build/elements/PremiumUpsell/index.js +39 -0
- package/build/elements/TableButton/index.js +86 -0
- package/build/elements/TrendGraph/TrendGraphScreenReader.js +46 -0
- package/build/elements/TrendGraph/index.js +64 -0
- package/build/elements/UserMessage/components/MaxRelatedKeyphrases.js +25 -0
- package/build/elements/UserMessage/components/RequestEmpty.js +24 -0
- package/build/elements/UserMessage/components/RequestFailed.js +24 -0
- package/build/elements/UserMessage/components/RequestLimitReached.js +40 -0
- package/build/elements/UserMessage/components/index.js +5 -0
- package/build/elements/UserMessage/index.js +46 -0
- package/build/index.js +10 -0
- package/package.json +77 -0
- package/readme.md +18 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { __, sprintf } from "@wordpress/i18n";
|
|
4
|
+
import { Alert, Button } from "@yoast/ui-library";
|
|
5
|
+
import { ArrowNarrowRightIcon } from "@heroicons/react/outline";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Display the message for a request that has reached the limit.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} [upsellLink=""] The upsell link.
|
|
11
|
+
* @param {string} [className=""] The class name for the alert.
|
|
12
|
+
*
|
|
13
|
+
* @returns {JSX.Element} The message for limit reached.
|
|
14
|
+
*/
|
|
15
|
+
export const RequestLimitReached = ({
|
|
16
|
+
upsellLink = "",
|
|
17
|
+
className = ""
|
|
18
|
+
}) => {
|
|
19
|
+
return /*#__PURE__*/React.createElement(Alert, {
|
|
20
|
+
variant: "warning",
|
|
21
|
+
className: className
|
|
22
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
className: "yst-flex yst-flex-col yst-items-start"
|
|
24
|
+
}, sprintf(/* translators: %s : Expands to "Semrush". */
|
|
25
|
+
__("You've reached your request limit for today. Check back tomorrow or upgrade your plan over at %s.", "wordpress-seo"), "Semrush"), upsellLink && /*#__PURE__*/React.createElement(Button, {
|
|
26
|
+
variant: "upsell",
|
|
27
|
+
className: "yst-mt-3 yst-gap-1.5",
|
|
28
|
+
as: "a",
|
|
29
|
+
href: upsellLink,
|
|
30
|
+
target: "_blank"
|
|
31
|
+
}, sprintf(/* translators: %s : Expands to "Semrush". */
|
|
32
|
+
__("Upgrade your %s plan", "wordpress-seo"), "Semrush"), /*#__PURE__*/React.createElement(ArrowNarrowRightIcon, {
|
|
33
|
+
className: "yst-w-4 yst-h-4 yst-text-amber-900 rtl:yst-rotate-180"
|
|
34
|
+
}))));
|
|
35
|
+
};
|
|
36
|
+
RequestLimitReached.propTypes = {
|
|
37
|
+
upsellLink: PropTypes.string,
|
|
38
|
+
className: PropTypes.string
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=RequestLimitReached.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { MaxRelatedKeyphrases, RequestEmpty, RequestFailed, RequestLimitReached } from "./components";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Displays the user message following a request or action.
|
|
7
|
+
*
|
|
8
|
+
* @param {?string} [variant=null] The type of message to display.
|
|
9
|
+
* @param {string} [upsellLink=""] The link to the upsell page.
|
|
10
|
+
* @param {string} [className=""] The class name for the button.
|
|
11
|
+
*
|
|
12
|
+
* @returns {JSX.Element} The user message.
|
|
13
|
+
*/
|
|
14
|
+
export const UserMessage = ({
|
|
15
|
+
variant = null,
|
|
16
|
+
upsellLink = "",
|
|
17
|
+
className = ""
|
|
18
|
+
}) => {
|
|
19
|
+
switch (variant) {
|
|
20
|
+
case "requestLimitReached":
|
|
21
|
+
return /*#__PURE__*/React.createElement(RequestLimitReached, {
|
|
22
|
+
upsellLink: upsellLink,
|
|
23
|
+
className: className
|
|
24
|
+
});
|
|
25
|
+
case "requestFailed":
|
|
26
|
+
return /*#__PURE__*/React.createElement(RequestFailed, {
|
|
27
|
+
className: className
|
|
28
|
+
});
|
|
29
|
+
case "requestEmpty":
|
|
30
|
+
return /*#__PURE__*/React.createElement(RequestEmpty, {
|
|
31
|
+
className: className
|
|
32
|
+
});
|
|
33
|
+
case "maxRelatedKeyphrases":
|
|
34
|
+
return /*#__PURE__*/React.createElement(MaxRelatedKeyphrases, {
|
|
35
|
+
className: className
|
|
36
|
+
});
|
|
37
|
+
default:
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
UserMessage.propTypes = {
|
|
42
|
+
variant: PropTypes.oneOf(["requestLimitReached", "requestFailed", "requestEmpty", "maxRelatedKeyphrases"]),
|
|
43
|
+
upsellLink: PropTypes.string,
|
|
44
|
+
className: PropTypes.string
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
package/build/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { TrendGraph } from "./elements/TrendGraph";
|
|
2
|
+
export { KeyphrasesTable } from "./components/KeyphrasesTable";
|
|
3
|
+
export { DifficultyBullet } from "./elements/DifficultyBullet";
|
|
4
|
+
export { IntentBadge } from "./elements/IntentBadge";
|
|
5
|
+
export { TableButton } from "./elements/TableButton";
|
|
6
|
+
export { CountrySelector } from "./components/CountrySelector";
|
|
7
|
+
export { PremiumUpsell } from "./elements/PremiumUpsell";
|
|
8
|
+
export { UserMessage } from "./elements/UserMessage";
|
|
9
|
+
export { Modal } from "./components/Modal";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@yoast/related-keyphrase-suggestions",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Yoast related keyphrase suggestions package",
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"style": "build/css/style.css",
|
|
7
|
+
"files": [
|
|
8
|
+
"build",
|
|
9
|
+
"!*.map"
|
|
10
|
+
],
|
|
11
|
+
"author": "Team Yoast <support@yoast.com>",
|
|
12
|
+
"license": "GPL-3.0",
|
|
13
|
+
"private": false,
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"scripts": {
|
|
16
|
+
"clean:build": "rm -rf build",
|
|
17
|
+
"build": "yarn clean:build && yarn build:js && yarn build:css",
|
|
18
|
+
"build:js": "babel src --out-dir build --ignore \"src/**/*.stories.js\",\"src/**/stories.js\",\"src/**/docs/**/*.js\"",
|
|
19
|
+
"build:css": "node ./scripts/build-css.js",
|
|
20
|
+
"watch": "yarn watch:js & yarn watch:css",
|
|
21
|
+
"watch:js": "yarn build:js --watch",
|
|
22
|
+
"watch:css": "node ./scripts/watch-css.js",
|
|
23
|
+
"storybook": "storybook dev -p 6007",
|
|
24
|
+
"lint": "eslint . --max-warnings=2"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@babel/cli": "^7.25.9",
|
|
28
|
+
"@babel/core": "^7.26.0",
|
|
29
|
+
"@babel/parser": "^7.26.1",
|
|
30
|
+
"@babel/plugin-transform-optional-chaining": "^7.25.9",
|
|
31
|
+
"@babel/plugin-transform-runtime": "^7.25.9",
|
|
32
|
+
"@babel/preset-env": "^7.26.0",
|
|
33
|
+
"@babel/preset-react": "^7.25.9",
|
|
34
|
+
"@storybook/addon-a11y": "^8.6.12",
|
|
35
|
+
"@storybook/addon-docs": "^8.6.12",
|
|
36
|
+
"@storybook/addon-essentials": "^8.6.12",
|
|
37
|
+
"@storybook/addon-interactions": "^8.6.12",
|
|
38
|
+
"@storybook/addon-styling-webpack": "^1.0.1",
|
|
39
|
+
"@storybook/addon-webpack5-compiler-swc": "^3.0.0",
|
|
40
|
+
"@storybook/blocks": "^8.6.12",
|
|
41
|
+
"@storybook/manager-api": "^8.6.12",
|
|
42
|
+
"@storybook/preview-api": "^8.6.12",
|
|
43
|
+
"@storybook/react": "^8.6.12",
|
|
44
|
+
"@storybook/react-webpack5": "^8.6.12",
|
|
45
|
+
"@storybook/test": "^8.6.12",
|
|
46
|
+
"@storybook/theming": "^8.6.12",
|
|
47
|
+
"@wordpress/jest-preset-default": "^8.0.1",
|
|
48
|
+
"@yoast/browserslist-config": "^1.2.4",
|
|
49
|
+
"@yoast/eslint-config": "^8.1.0",
|
|
50
|
+
"@yoast/jest-preset": "^1.0.1",
|
|
51
|
+
"@yoast/postcss-preset": "^1.2.0",
|
|
52
|
+
"@yoast/tailwindcss-preset": "^2.3.0",
|
|
53
|
+
"babel-loader": "^9.2.1",
|
|
54
|
+
"css-loader": "^7.1.2",
|
|
55
|
+
"eslint": "^9.16.0",
|
|
56
|
+
"eslint-plugin-storybook": "^0.12.0",
|
|
57
|
+
"globals": "^15.13.0",
|
|
58
|
+
"postcss": "^8.4.47",
|
|
59
|
+
"postcss-loader": "^8.1.1",
|
|
60
|
+
"puppeteer": "^23.6.0",
|
|
61
|
+
"storybook": "^8.6.12",
|
|
62
|
+
"style-loader": "^4.0.0",
|
|
63
|
+
"tailwindcss": "^3.4.16"
|
|
64
|
+
},
|
|
65
|
+
"dependencies": {
|
|
66
|
+
"@heroicons/react": "^1.0.6",
|
|
67
|
+
"@wordpress/i18n": "^5.10.0",
|
|
68
|
+
"classnames": "^2.5.1",
|
|
69
|
+
"lodash": "^4.17.21",
|
|
70
|
+
"prop-types": "^15.8.1"
|
|
71
|
+
},
|
|
72
|
+
"peerDependencies": {
|
|
73
|
+
"@yoast/ui-library": "^4.2.0",
|
|
74
|
+
"react": "^18.2.0",
|
|
75
|
+
"react-dom": "^18.2.0"
|
|
76
|
+
}
|
|
77
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Welcome to the Yoast releated keyphrase suggestions package!
|
|
2
|
+
A React component library for building user interfaces for Yoast related keyphrase suggestions.
|
|
3
|
+
|
|
4
|
+
[View the changelog here](https://github.com/Yoast/wordpress-seo/blob/trunk/packages/related-keyphrase-suggestions/changelog.md).
|
|
5
|
+
|
|
6
|
+
For internal use only. Not offering support for external use.
|
|
7
|
+
|
|
8
|
+
## Local development
|
|
9
|
+
The components in this package are developed in isolation inside a [Storybook](https://storybook.js.org/), a visual tool for building component libraries. Developing components in isolation helps keep the interfaces flexible while ignoring implementation details.
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
# Install dependencies
|
|
13
|
+
yarn install
|
|
14
|
+
# Run Storybook for local development
|
|
15
|
+
yarn storybook
|
|
16
|
+
# Build a static Storybook
|
|
17
|
+
yarn build:storybook
|
|
18
|
+
```
|