@volvo-cars/ced-os-react-components
Advanced tools
Comparing version 2.5.8 to 2.5.9
{ | ||
"name": "@volvo-cars/ced-os-react-components", | ||
"version": "2.5.8", | ||
"version": "2.5.9", | ||
"description": "Set of components for developing UIs in the onboarding and support apps", | ||
@@ -21,5 +21,10 @@ "keywords": [], | ||
"types": "lib/types", | ||
"bin": { | ||
"support-content-to-html": "./lib/bin/support-content-to-html.js" | ||
}, | ||
"main": "./lib/cjs/index.js", | ||
"module": "./lib/esm/index.mjs", | ||
"exports": { | ||
".": { | ||
"import": "./lib/esm/index.js", | ||
"import": "./lib/esm/index.mjs", | ||
"require": "./lib/cjs/index.js" | ||
@@ -26,0 +31,0 @@ }, |
@@ -18,3 +18,2 @@ # Support Web Components | ||
### Publish | ||
@@ -36,3 +35,3 @@ | ||
2. For each iteration use `npm version prerelease` to create new pre-release version with bumped prefix, eg `2.0.0-rc.0` | ||
3. To promote the pre-release to a release run `npm version major` | ||
3. To promote the pre-release to a release run `npm version major` | ||
@@ -47,3 +46,2 @@ ## Usage | ||
### Install from Github package registry | ||
@@ -68,3 +66,2 @@ | ||
### Example usage | ||
@@ -76,9 +73,8 @@ | ||
- Load the styles of the components and base theme `@volvo-cars/ced-os-react-components/lib/index.css` | ||
- Load the styles of the theme(s) to be used. | ||
- Load the styles of the theme(s) to be used. | ||
- `@volvo-cars/ced-os-react-components/lib/theme-polestar.css` | ||
- `@volvo-cars/ced-os-react-components/lib/theme-volvo.css`, and add the class | ||
- Alternatively override custom properties (variables) on `.dcs-base-theme` in your own styles to create a custom theme (See all variables in [lib/theme-base.css](lib/theme-base.css)). | ||
- The theme `classNames` are applied automatically - `.dcs-base-theme` for base styles and if either "volvo" or "polestar" | ||
is passed to the `theme` prop the respective theme className of `dcs-volvo-theme` or `dcs-polestar-theme` is set. | ||
- The theme `classNames` are applied automatically - `.dcs-base-theme` for base styles and if either "volvo" or "polestar" | ||
is passed to the `theme` prop the respective theme className of `dcs-volvo-theme` or `dcs-polestar-theme` is set. | ||
@@ -97,4 +93,4 @@ #### JSONArticle | ||
return ( | ||
<JSONArticle data-article-id={articleId} data={content} theme="volvo" config={{ | ||
<JSONArticle data-article-id={articleId} data={content} theme="volvo" config={{ | ||
locale: 'en-GB', // optional - will set correct direction based on locale | ||
@@ -108,3 +104,3 @@ linkComponent: (props)=> {/* optional custom link component eg. next/link */} | ||
} | ||
}} /> | ||
}} /> | ||
); | ||
@@ -116,10 +112,31 @@ }; | ||
If you want to use the renderer without creating a full JS project, with NPM etc, you can use the standalone solution. | ||
If you want to use the renderer without creating a full JS project, with NPM etc, you can use the standalone solution. | ||
[Example here](https://volvo-cars.github.io/ced-onboarding-support-components/standalone-example.html). | ||
[Example here](https://volvo-cars.github.io/ced-onboarding-support-components/standalone-example.html). | ||
Include the `standalone-example.iife.js` and `standalone-example.css` files found in the npm package under `@volvo-cars/ced-onboarding-support-components/lib`, in the [HTML template file](src/standalone/standalone-example.ejs), make sure to make the following replacements: | ||
* `article: null` must be replaced with `article: '<article>'`, where `article` is the (JSON representation) of an article. It must contain an `externalId`. It must also contain the content of the document, i.e. a `title` and optionally also a `description` and `body`. These fields may be directly on the `article` object itself, or nested inside of `article.content` or `article.jsonContent`. | ||
* `articleLinkClicked: null` may be replaced with `articleLinkClicked: function(articleId, targetId) { ... }`, where the function will be called whenever the user clicks a link to another article. The function takes two arguments: the ID of the article being linked to, as well as (optionally) the ID of the target element (will typically just be `null`). If `articleLinkClicked` is left as `null`, it will default to working as a normal link, such that if the current URL is `foo/bar/articleId1`, and the user clicks a link to an article with ID `articleId2`, it will navigate to `foo/bar/articleId2` (or `foo/bar/articleId2#targetId`, if `targetId` is not null). | ||
* `linkClicked: null` may be replaced with `linkClicked: function(href) { ... }`, where the function will be called whenever the user clicks on an external link. The function takes one argument: the URL of the link target. If `linkClicked` is left as null, it will default to simply navigating to the link. | ||
- `article: null` must be replaced with `article: '<article>'`, where `article` is the (JSON representation) of an article. It must contain an `externalId`. It must also contain the content of the document, i.e. a `title` and optionally also a `description` and `body`. These fields may be directly on the `article` object itself, or nested inside of `article.content` or `article.jsonContent`. | ||
- `articleLinkClicked: null` may be replaced with `articleLinkClicked: function(articleId, targetId) { ... }`, where the function will be called whenever the user clicks a link to another article. The function takes two arguments: the ID of the article being linked to, as well as (optionally) the ID of the target element (will typically just be `null`). If `articleLinkClicked` is left as `null`, it will default to working as a normal link, such that if the current URL is `foo/bar/articleId1`, and the user clicks a link to an article with ID `articleId2`, it will navigate to `foo/bar/articleId2` (or `foo/bar/articleId2#targetId`, if `targetId` is not null). | ||
- `linkClicked: null` may be replaced with `linkClicked: function(href) { ... }`, where the function will be called whenever the user clicks on an external link. The function takes one argument: the URL of the link target. If `linkClicked` is left as null, it will default to simply navigating to the link. | ||
### Command line usage (CLI) | ||
Run directly using `npx` without install | ||
``` | ||
npx @volvo-cars/ced-os-react-components [JSON file path or JSON string] [options] | ||
``` | ||
Or install globally and then use the command | ||
``` | ||
support-content-to-html [JSON file path or JSON string] [options] | ||
``` | ||
**Options:** | ||
`--file=[input filename]` - The file contents is used as input to render | ||
`--out=[output filename]` - The render result is written to a file | ||
`--json=[JSON string]` - The string is used as input to render | ||
`--clean` Option to remove all classnames |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1090045
234
14488
135
2
10