@myuw-web-components/myuw-search
Advanced tools
Comparing version 1.3.2 to 1.4.0
@@ -260,5 +260,2 @@ var MyUWSearch = (function (exports) { | ||
break; | ||
default: | ||
break; | ||
} | ||
@@ -265,0 +262,0 @@ } |
{ | ||
"name": "@myuw-web-components/myuw-search", | ||
"version": "1.3.2", | ||
"version": "1.4.0", | ||
"description": "A material search field made for use with MyUW web components", | ||
@@ -12,4 +12,4 @@ "module": "dist/myuw-search.min.mjs", | ||
"start": "run-p watch serve", | ||
"prepare": "npm run build", | ||
"pages": "rm -rf demo && mkdir -p demo && cp -r dist demo/ && cp index.html demo/ && gh-pages -d demo --repo git@github.com:myuw-web-components/myuw-search.git" | ||
"sonar": "sonar-scanner", | ||
"prepare": "npm run build" | ||
}, | ||
@@ -27,10 +27,13 @@ "repository": { | ||
"devDependencies": { | ||
"@babel/core": "^7.1.2", | ||
"@babel/preset-env": "^7.1.0", | ||
"live-server": "^1.2.0", | ||
"npm-run-all": "^4.1.3", | ||
"rollup": "^0.63.4", | ||
"rollup-plugin-babel": "^4.0.3", | ||
"@babel/core": "^7.7.2", | ||
"@babel/preset-env": "^7.7.1", | ||
"aws-sdk": "^2.574.0", | ||
"live-server": "^1.2.1", | ||
"mime-types": "^2.1.25", | ||
"npm-run-all": "^4.1.5", | ||
"rollup": "^1.27.2", | ||
"rollup-plugin-babel": "^4.3.3", | ||
"rollup-plugin-html": "^0.2.1", | ||
"rollup-plugin-minify-es": "^1.1.1" | ||
"rollup-plugin-minify-es": "^1.1.1", | ||
"sonarqube-scanner": "^2.5.0" | ||
}, | ||
@@ -37,0 +40,0 @@ "files": [ |
@@ -5,25 +5,20 @@ # `<myuw-search>` | ||
Add the following import to your page's `<head>`: | ||
Include the component as follows: | ||
```html | ||
<script type="module" src="https://unpkg.com/@myuw-web-components/myuw-search@^1?module"></script> | ||
<script nomodule src="https://unpkg.com/@myuw-web-components/myuw-search@^1"></script> | ||
``` | ||
<!-- import the module --> | ||
<script type="module" src="https://cdn.my.wisc.edu/@myuw-web-components/myuw-search@latest/myuw-search.min.mjs"></script> | ||
**Important:** For responsive features to work properly, ensure your application includes the viewport meta tag: | ||
<!-- fallback for browsers without ES2015 module support --> | ||
<script nomodule src="https://cdn.my.wisc.edu/@myuw-web-components/myuw-search@latest/myuw-search.min.js"></script> | ||
```html | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<myuw-search | ||
input-label="Search MyUW" | ||
button-label="Submit search" | ||
icon="search" | ||
></myuw-search> | ||
``` | ||
Use the component's HTML tag wherever you want: | ||
_Note:_ The evergreen "latest" version can be used for convenience, but in production settings it is recommended to use the latest [release version](https://github.com/myuw-web-components/myuw-search/releases) specifically, and upgrade only after testing! | ||
```html | ||
<myuw-search | ||
input-label="Search MyUW" | ||
button-label="Submit search" | ||
icon="search"> | ||
</myuw-search> | ||
``` | ||
Listen for the `myuw-search` CustomEvent and process the value how you like: | ||
@@ -33,8 +28,8 @@ | ||
/* | ||
1. Listen for myuw-search event | ||
2. Get the event data from event.detail.value | ||
3. Do what you want with the search term! | ||
1. Listen for myuw-search event | ||
2. Get the event data from event.detail.value | ||
3. Do what you want with the search term! | ||
*/ | ||
document.body.addEventListener('myuw-search', (event) => { | ||
var valueFromSearchBar = event.detail.value // "detail" object is part of CustomEvent spec | ||
const valueFromSearchBar = event.detail.value // "detail" object is part of CustomEvent spec | ||
/* | ||
@@ -67,4 +62,3 @@ Perform search logic here. For example: | ||
Cross-browser testing provided by:<br/> | ||
<a href="https://www.browserstack.com/"><img width="160" src="https://myuw-web-components.github.io/img/Browserstack-logo.svg" alt="BrowserStack"/></a> |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
59218
11
530
62
1