{"id":13805773,"url":"https://github.com/Tradeshift/elements","last_synced_at":"2025-05-13T21:31:31.254Z","repository":{"id":37406022,"uuid":"157683857","full_name":"Tradeshift/elements","owner":"Tradeshift","description":"Tradeshift Elements - Reusable Tradeshift UI Components as Web Components https://tradeshift.github.io/elements","archived":false,"fork":false,"pushed_at":"2025-05-01T12:37:00.000Z","size":29547,"stargazers_count":17,"open_issues_count":53,"forks_count":16,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-09T21:14:15.957Z","etag":null,"topics":["client-side","components","css","customelements","javascript","reusable","shadowdom","tradeshift","ui","webcomponents"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tradeshift.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-11-15T09:15:26.000Z","updated_at":"2025-05-01T12:37:02.000Z","dependencies_parsed_at":"2023-02-18T16:01:28.107Z","dependency_job_id":"5413e835-9ea3-4ae4-b395-1b4da60a85f1","html_url":"https://github.com/Tradeshift/elements","commit_stats":{"total_commits":659,"total_committers":24,"mean_commits":"27.458333333333332","dds":0.6843702579666161,"last_synced_commit":"ed96d91ea255c6858b64b0add390076d9e4b44c5"},"previous_names":[],"tags_count":123,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tradeshift%2Felements","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tradeshift%2Felements/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tradeshift%2Felements/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tradeshift%2Felements/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tradeshift","download_url":"https://codeload.github.com/Tradeshift/elements/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253384012,"owners_count":21899924,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client-side","components","css","customelements","javascript","reusable","shadowdom","tradeshift","ui","webcomponents"],"created_at":"2024-08-04T01:01:04.735Z","updated_at":"2025-05-13T21:31:26.224Z","avatar_url":"https://github.com/Tradeshift.png","language":"JavaScript","funding_links":[],"categories":["Real World"],"sub_categories":["Component Libraries"],"readme":"\u003ch1 align=\"center\"\u003e\n    \u003ca href=\"https://tradeshift.com/\"\u003e\n      \u003cimg alt=\"Tradeshift\" src=\"https://tradeshift.com/wp-content/themes/Tradeshift/img/brand/logo-black.png\"/\u003e\n    \u003c/a\u003e\n\u003c/h1\u003e\n\n\u003ch1 align=\"center\"\u003eElements\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  Reusable Tradeshift UI Components as Web Components\n    \u003ca href=\"https://tradeshift.github.io/elements\"\u003e\n      https://tradeshift.github.io/elements\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.npmjs.com/package/@tradeshift/elements\"\u003e\n      \u003cimg alt=\"NPM Version\" src=\"https://badgen.net/npm/v/@tradeshift/elements\" height=\"20\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://npmcharts.com/compare/@tradeshift/elements?minimal=true\"\u003e\n      \u003cimg alt=\"Downloads per month\" src=\"https://badgen.net/npm/dm/@tradeshift/elements\" height=\"20\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/Tradeshift/elements/graphs/contributors\"\u003e\n      \u003cimg alt=\"Contributors\" src=\"https://badgen.net/github/contributors/Tradeshift/elements\" height=\"20\"/\u003e\n    \u003c/a\u003e\n    \u003cbr/\u003e\n    \u003ca href=\"https://github.com/Tradeshift/elements/issues?q=is%3Aissue+is%3Aclosed\"\u003e\n      \u003cimg alt=\"Closed issues\" src=\"https://badgen.net/github/closed-issues/Tradeshift/elements\" height=\"20\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/Tradeshift/elements/issues\"\u003e\n      \u003cimg alt=\"Open issues\" src=\"https://badgen.net/github/open-issues/Tradeshift/elements\" height=\"20\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/Tradeshift/elements/pulls\"\u003e\n      \u003cimg alt=\"Open pull requests\" src=\"https://badgen.net/github/open-prs/Tradeshift/elements\" height=\"20\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/Tradeshift/elements/pulls?q=is%3Apr+is%3Aclosed\"\u003e\n      \u003cimg alt=\"Closed pull requests\" src=\"https://badgen.net/github/closed-prs/Tradeshift/elements\" height=\"20\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/Tradeshift/elements/commits/master\"\u003e\n      \u003cimg alt=\"Last commit\" src=\"https://badgen.net/github/last-commit/Tradeshift/elements\" height=\"20\"/\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n## ➤ How to use it\n\n- Install the core package of the Elements\n\n```shell\n$ npm i @tradeshift/elements --save\n```\n\n- Install the package of the component you need ([available components](https://github.com/Tradeshift/elements/tree/master/packages/components))\n\n```shell\n$ npm i @tradeshift/elements.button --save\n```\n\n- Import the component\n\n```js\nimport '@tradeshift/elements.button';\n```\n\nor\n\n```html\n\u003cscript src=\"node_modules/@tradeshift/elements/lib/core.umd.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"node_modules/@tradeshift/elements.button/lib/button.umd.js\"\u003e\u003c/script\u003e\n```\n\n- Import the css variables\n\n```js\nimport '@tradeshift/elements/src/vars.css';\n```\n\nor\n\n```html\n\u003clink rel=\"stylesheet\" href=\"node_modules/@tradeshift/elements/src/vars.css\" /\u003e\n```\n\n- Use it\n\n```html\n\u003cts-button type=\"primary\"\u003e Sample Button \u003c/ts-button\u003e\n```\n\n- Our components rely on having the `Open Sans` available, You can see the `font-weight` and `font-style` you need to load [here](https://github.com/Tradeshift/elements/blob/master/packages/core/src/fonts.css), or you can just load it from our package (for now)\n\n```html\n\u003clink rel=\"stylesheet\" href=\"node_modules/@tradeshift/elements/src/fonts.css\" /\u003e\n```\n\n## ➤ Polyfills\n\nFor supporting IE11 you need to do couple of more things\n\n- If you are using the [Tradeshift-ui](https://github.com/Tradeshift/tradeshift-ui) you need to upgrade it to a compatible version:\n\n  - For version `12` you should upgrade to `12.2.9` or newer version\n  - For version `11` you should upgrade to `11.3.2` or newer version\n\n- Don't shim CSS Custom Properties in IE11\n\n```html\n\u003c!-- Place this in the \u003chead\u003e, before the Web Component polyfills are loaded --\u003e\n\u003cscript\u003e\n\tif (!window.Promise) {\n\t\twindow.ShadyCSS = { nativeCss: true };\n\t}\n\u003c/script\u003e\n```\n\n##### You have two options for polyfills library:\n\n1. Use [`@open-wc/polyfills-loader`](https://github.com/open-wc/open-wc/tree/master/packages/polyfills-loader)\n\n- Installation\n\n```shell\n$ npm i @open-wc/polyfills-loader\n```\n\n- Load it\n\n```js\nimport loadPolyfills from '@open-wc/polyfills-loader';\n\nloadPolyfills().then(() =\u003e import('./my-app.js'));\n```\n\n2. Use [`@webcomponents/webcomponentsjs`](https://github.com/webcomponents/polyfills/tree/master/packages/webcomponentsjs)\n\n- Installation\n\n```shell\n$ npm i @webcomponents/webcomponentsjs --save\n```\n\n- Enable ES5 class-less Custom Elements\n\n```html\n\u003cscript src=\"/node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js\"\u003e\u003c/script\u003e\n```\n\n- Load appropriate polyfills and shims with [`@webcomponents/webcomponentsjs`](https://github.com/webcomponents/webcomponentsjs)\n\n```html\n\u003cscript src=\"/node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js\" defer\u003e\u003c/script\u003e\n```\n\n- Load the core and components scripts after `WebComponensReady` event:\n\n```html\n\u003c!-- Load Tradeshift Elements once the polyfills are ready --\u003e\n\u003cscript\u003e\n\twindow.addEventListener('WebComponentsReady', function () {\n\t\t// Load Tradeshift Elements core package\n\t\tvar coreEl = document.createElement('script');\n\t\tcoreEl.setAttribute('src', '/packages/core/lib/core.umd.js');\n\t\tdocument.body.appendChild(coreEl);\n\n\t\t// Load other Tradeshift Elements once the core package is loaded\n\t\tcoreEl.onload = function () {\n\t\t\tvar components = ['root', 'button'];\n\t\t\tcomponents.forEach(function (component) {\n\t\t\t\tvar el = document.createElement('script');\n\t\t\t\tel.setAttribute('src', '/packages/components/' + component + '/lib/' + component + '.umd.js');\n\t\t\t\tdocument.body.appendChild(el);\n\t\t\t});\n\t\t};\n\t});\n\u003c/script\u003e\n```\n\n## ➤ How to run it\n\n- Make sure your node version is \u003e 10. If you are using `nvm` you can just run:\n\n```shell\n$ nvm use\n```\n\n- We are using [lerna](https://github.com/lerna/lerna) to manage our components in single repo but their own packages, so for installation you need to run:\n\n```shell\n$ npx lerna bootstrap     # bootstrap all packages and make sure they work together\n```\n\n- You can start the development server which is watching for changes:\n\n```shell\n$ npm start\n```\n\n- Open [http://127.0.0.1:8080/](http://127.0.0.1:8080/), or e.g. http://127.0.0.1:8080/packages/components/{PACKAGE_NAME}/ if you want to test a specific element and that element (PACKAGE_NAME) has got an `index.html` file. If not, feel free to add one. Example: [http://127.0.0.1:8080/packages/components/action-select/](http://127.0.0.1:8080/packages/components/action-select/)\n\n## ➤ How to contribute\n\nThanks for your interest and help!\n\n- First thing you need to do is read this [[Component Checklist](https://github.com/Tradeshift/elements/wiki/Component-checklist)] which contains lots of important information about what you need to consider when you are creating/changing components\n\n##### [General info](https://github.com/Tradeshift/elements/wiki/Useful-materials-starter)\n\nYou can find some [links to useful materials](https://github.com/Tradeshift/elements/wiki/Useful-materials-starter) about what we are using and some tutorials and articles that can help you get started.\n\n#### `ts.elements`-specific info\n\n- Extend `TSElement`, instead of `LitElement`\n- Import `css`, `unsafeCSS` \u0026 `html` from `@tradeshift/elements` instead of `lit-html`\n- Add the UMD global namespace to [`rollup.globals.json`](https://github.com/Tradeshift/elements/blob/master/rollup.globals.json)\n- Add your package to the [`package.json`](\u003c(https://github.com/Tradeshift/elements/blob/master/package.json)\u003e) dependencies\n\n## ➤ How to create new component\n\nTo make it simpler and more consistent, we added a `Component generator`, You can use our its script to generate a new component from terminal and it will create the component inside `packages/components`\n\n- **NOTE**: Still you need to add the UMD global namespace to [`rollup.globals.json`](https://github.com/Tradeshift/elements/blob/master/rollup.globals.json) and add your package to the [`package.json`](\u003c(https://github.com/Tradeshift/elements/blob/master/package.json)\u003e) dependencies, for now\n\n```shell\n$ npm run component-gen\n```\n\n## ➤ How to release\n\nWe are using [lerna to publish](https://github.com/lerna/lerna/tree/main/commands/version#readme) our elements\n\n- Checkout a master branch.\n- Run the `npm run new-version` command. It will invoke a shell script that:\n  - calculate a new version number\n  - create a new branch with new version number and a new git tag\n  - generate CHANGELOG.md for all components\n  - make a commit with a predefined commit message to created branch\n  - push this branch and git tag to origin\n- Go to Github and create a PR from the branch created at previous step.\n- After merge a new version of elements will be built and published to NPM registry and Github Packages.\n\n---\n\n## ➤ [Polyfill Limitations](https://github.com/Tradeshift/elements/wiki/Polyfill-Limitations)\n\nYou can see a list of limitations that we should watch out for, [here](https://github.com/Tradeshift/elements/wiki/Polyfill-Limitations)\n\n## ➤ License\n\n- You can always create forks on GitHub, submit Issues and Pull Requests.\n- You can only use Tradeshift Elements to make apps on a Tradeshift platform, e.g. tradeshift.com.\n- You can fix a bug until the bugfix is deployed by Tradeshift.\n- You can host Tradeshift Elements yourself.\n- If you want to make a bigger change or just want to talk with us, reach out to our team here on GitHub.\n\nYou can read the full license agreement in the [LICENSE.md](https://github.com/Tradeshift/elements/blob/master/LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTradeshift%2Felements","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTradeshift%2Felements","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTradeshift%2Felements/lists"}