├── .bowerrc ├── deploy.enc ├── favicon.ico ├── OSS_Notice.pdf ├── monogram-wdmk.png ├── .gitignore ├── .editorconfig ├── .github ├── PULL_REQUEST_TEMPLATE.md ├── stale.yml └── ISSUE_TEMPLATE.md ├── wct.conf.json ├── polymer.json ├── .jshintrc ├── css ├── px-context-browser-animations-styles.html ├── px-context-browser-trigger-styles.html ├── px-context-browser-columns-styles.html ├── px-context-browser-panel-styles.html ├── px-context-browser-header-styles.html ├── px-context-browser-item-styles.html ├── px-context-browser-styles.html └── px-context-browser-filter-styles.html ├── test ├── index.html ├── test-helpers.js ├── chai-expect-eventually.js ├── px-context-browser-fixture.html └── px-context-browser-tests.js ├── package.json ├── sass ├── px-context-browser-trigger.scss ├── px-context-browser-columns.scss ├── px-context-browser-animations.scss ├── px-context-browser-filter.scss ├── px-context-browser-panel.scss ├── px-context-browser-header.scss ├── px-context-browser-item.scss └── px-context-browser.scss ├── px-context-browser-contextual-notification.html ├── px-context-browser-panel.html ├── examples ├── is-selectable.html ├── custom-keys.html ├── favorites.html └── favorites-app.html ├── bower.json ├── demo ├── px-context-browser-trigger-demo.html ├── index.html └── px-context-browser-demo.html ├── README.md ├── index.html ├── px-context-browser-header.html ├── px-context-browser-actions.html ├── px-context-browser-trigger.html ├── scripts ├── build.sh └── ghp.sh ├── .travis.yml ├── px-context-browser-filter.html ├── px-context-browser-favorited-temp.html ├── gulpfile.js ├── px-context-browser-columns.html ├── CONTRIBUTING.md ├── px-context-browser-item.html ├── LICENSE └── HISTORY.md /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "./bower_components" 3 | } -------------------------------------------------------------------------------- /deploy.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/predixdesignsystem/px-context-browser/HEAD/deploy.enc -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/predixdesignsystem/px-context-browser/HEAD/favicon.ico -------------------------------------------------------------------------------- /OSS_Notice.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/predixdesignsystem/px-context-browser/HEAD/OSS_Notice.pdf -------------------------------------------------------------------------------- /monogram-wdmk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/predixdesignsystem/px-context-browser/HEAD/monogram-wdmk.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | temp 4 | bower_components 5 | .idea 6 | reports 7 | bower_components-*/ 8 | bower-*.json 9 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | 10 | # Change these settings to your own preference 11 | indent_style = space 12 | indent_size = 2 13 | 14 | # We recommend you to keep these unchanged 15 | end_of_line = lf 16 | charset = utf-8 17 | trim_trailing_whitespace = true 18 | insert_final_newline = true 19 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Pull Request Hi, Thanks for helping us improve the Predix UI platform by submitting a Pull Request. To help us merge your Pull Request as fast as possible, please fill out the following sections: * ## A description of the changes proposed in the pull request: * ## A reference to a related issue (if applicable): * ## @mentions of the person or team responsible for reviewing proposed changes: * ## working tests: #### The tests need to be functional and/or unit tests, written for the wct framework, and placed in the test folder, following our testing guidelines. -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Issues/PRs with no activity for a year will be marked as stale 2 | daysUntilStale: 365 3 | 4 | # If no one has replied inside a week after an issue is marked stale, close it. 5 | daysUntilClose: 7 6 | 7 | staleLabel: wontfix 8 | markComment: > 9 | This issue or PR has been automatically marked as stale because there has been 10 | no activity in over a year. It will be closed in 1 week if no further activity occurs. 11 | Thanks for your contribution, and please don't hesitate to comment if this issue/PR 12 | is still relevant. 13 | exemptLabels: 14 | - pinned 15 | - security 16 | -------------------------------------------------------------------------------- /wct.conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "verbose": false, 3 | "compile": "auto", 4 | "plugins": { 5 | "local": { 6 | "browsers": [ 7 | "chrome", 8 | "firefox" 9 | ] 10 | }, 11 | "sauce": { 12 | "disabled": true, 13 | "browsers": [ 14 | { 15 | "browserName": "microsoftedge", 16 | "platform": "Windows 10", 17 | "version": "" 18 | }, 19 | { 20 | "browserName": "internet explorer", 21 | "platform": "Windows 8.1", 22 | "version": "11" 23 | }, 24 | { 25 | "browserName": "safari", 26 | "platform": "OS X 10.12", 27 | "version": "10" 28 | }, 29 | { 30 | "browserName": "safari", 31 | "platform": "OS X 10.12", 32 | "version": "11" 33 | } 34 | ] 35 | } 36 | }, 37 | "suites": [ 38 | "test/index.html" 39 | ] 40 | } -------------------------------------------------------------------------------- /polymer.json: -------------------------------------------------------------------------------- 1 | { 2 | "entrypoint": "index.html", 3 | "shell": "demo/index.html", 4 | "sources": [ 5 | "demo/**/*", 6 | "*.html", 7 | "*.js", 8 | "favicon.ico", 9 | "bower.json", 10 | "bower_components/px-demo/monogram-wdmk.png", 11 | "bower_components/px-demo/*.html", 12 | "bower_components/px-dark-theme/*.html", 13 | "bower_components/px-dark-demo-theme/*.html", 14 | "bower_components/px-typography-design/type/*", 15 | "bower_components/px-code-editor/ace/theme-predix.js", 16 | "bower_components/px-code-editor/ace/mode-javascript.js", 17 | "bower_components/px-code-editor/load-*.js", 18 | "bower_components/js-beautify/js/lib/*.js" 19 | ], 20 | "builds": [ 21 | { 22 | "name": "unbundled", 23 | "preset": "es5-bundled", 24 | "js": {"minify":false}, 25 | "html": {"minify":false}, 26 | "bundle": false, 27 | "addServiceWorker": false 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "curly": true, 3 | "eqeqeq": true, 4 | "immed": true, 5 | "latedef": true, 6 | "noarg": true, 7 | "sub": true, 8 | "undef": true, 9 | "boss": true, 10 | "eqnull": true, 11 | "node": true, 12 | "browser": true, 13 | "expr":true, 14 | "globals" : { 15 | "it" : false, 16 | "xit" : false, 17 | "describe" : false, 18 | "xdescribe" : false, 19 | "before" : false, 20 | "after" : false, 21 | "beforeEach" : false, 22 | "afterEach" : false, 23 | "expect" : false, 24 | "spyOn" : false, 25 | "alert" : false, 26 | "require" : false, 27 | "requirejs" : false, 28 | "Card" : true, 29 | "iOS" : false, 30 | "$" : true, 31 | "define" : false, 32 | "angular": false, 33 | "Polymer": false 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Submit an Issue Hi, Thanks for helping us improve the Predix UI platform by submitting an issue. Before you begin, please check the list of existing issues to avoid submitting a duplicate issue. To help us solve this issue as fast as possible, please fill out the following sections: ## Expected behavior and actual behavior: ## Steps to reproduce the problem: ## Environment (_component version number, Browser (including version), operating system, hardware, etc_): ## Screenshots (_optional, but very helpful_): ## Code examples help us better understand the issue - follow the appropriate codepen for the component by going to https://predix-ui.com, finding the component in question, and clicking on the pencil icon under the demo. 2 | Once you've created your code example, you can save it under a new url. 3 | Please note that you should NOT use the same methods for production as the ones used in codepen - these methods are not production ready. -------------------------------------------------------------------------------- /css/px-context-browser-animations-styles.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 23 | -------------------------------------------------------------------------------- /test/index.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "px-context-browser", 3 | "author": "General Electric", 4 | "description": "A Px component", 5 | "version": "2.2.0", 6 | "private": false, 7 | "extName": null, 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/PredixDev/px-context-browser.git" 11 | }, 12 | "homepage": "https://www.predix-ui.com/", 13 | "dependencies": { 14 | "node-sass-import-once": "^1.2.0" 15 | }, 16 | "devDependencies": { 17 | "bower": "^1.8.0", 18 | "browser-sync": "^2.13.0", 19 | "ensure-px-license": "^1.0.0", 20 | "gulp": "^3.9.1", 21 | "gulp-autoprefixer": "^3.1.0", 22 | "gulp-bump": "^2.4.0", 23 | "gulp-clean": "^0.3.2", 24 | "gulp-concat": "^2.6.0", 25 | "gulp-cssmin": "^0.1.7", 26 | "gulp-if": "^2.0.1", 27 | "gulp-load-plugins": "^1.2.4", 28 | "gulp-match": "^1.0.2", 29 | "gulp-rename": "^1.2.2", 30 | "gulp-sass": "^2.3.2", 31 | "gulp-sequence": "^0.4.5", 32 | "gulp-style-modules": "^0.1.0", 33 | "node-sass-import-once": "^1.2.0", 34 | "polymer-cli": "^1.5.7", 35 | "stream-combiner2": "^1.1.1", 36 | "yargs": "^6.0.0" 37 | }, 38 | "scripts": { 39 | "test": "./node_modules/.bin/wct", 40 | "build": "./scripts/build.sh" 41 | }, 42 | "license": "Apache-2.0" 43 | } 44 | -------------------------------------------------------------------------------- /sass/px-context-browser-trigger.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, General Electric 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Settings 18 | @import "px-defaults-design/_settings.defaults.scss"; 19 | 20 | // Generic 21 | @import "px-normalize-design/_generic.normalize-mini.scss"; 22 | @import "px-box-sizing-design/_generic.box-sizing.scss"; 23 | 24 | // Component 25 | :host { 26 | display: flex; 27 | align-items: center; 28 | justify-content: center; 29 | height: var(--px-context-browser-trigger-height, 32px); 30 | width: var(--px-context-browser-trigger-width, 32px); 31 | --iron-icon-width: 100%; 32 | --iron-icon-height: 100%; 33 | padding: 2px; 34 | cursor: pointer; 35 | } 36 | :host(:hover) { 37 | background-color: var(--px-context-browser-trigger-hover-background, lightgray); 38 | } 39 | px-icon { 40 | stroke: var(--px-context-browser-trigger-icon-color, currentcolor); 41 | } 42 | -------------------------------------------------------------------------------- /css/px-context-browser-trigger-styles.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 23 | -------------------------------------------------------------------------------- /px-context-browser-contextual-notification.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 24 | 48 | 49 | -------------------------------------------------------------------------------- /sass/px-context-browser-columns.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, General Electric 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Settings 18 | @import "px-defaults-design/_settings.defaults.scss"; 19 | 20 | // Generic 21 | @import "px-normalize-design/_generic.normalize-mini.scss"; 22 | @import "px-box-sizing-design/_generic.box-sizing.scss"; 23 | 24 | // Component 25 | .column-animation > ::slotted(:not(.active):not(.animating)) { 26 | display: none !important; 27 | } 28 | 29 | .column-animation > ::slotted(.animating) { 30 | opacity: 0; 31 | } 32 | 33 | .column-animation > ::slotted(.fade-in-right) { 34 | animation-name: fadeInRight; 35 | animation-duration: 350ms; 36 | } 37 | 38 | .column-animation > ::slotted(.fade-in-left) { 39 | animation-name: fadeInLeft; 40 | animation-duration: 350ms; 41 | } 42 | 43 | .column-animation > ::slotted(.fade-out-right) { 44 | animation-name: fadeOutRight; 45 | animation-duration: 350ms; 46 | } 47 | 48 | .column-animation > ::slotted(.fade-out-left) { 49 | animation-name: fadeOutLeft; 50 | animation-duration: 350ms; 51 | } 52 | -------------------------------------------------------------------------------- /css/px-context-browser-columns-styles.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 23 | -------------------------------------------------------------------------------- /px-context-browser-panel.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 36 | 37 | 49 | -------------------------------------------------------------------------------- /test/test-helpers.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2018, General Electric 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | function afterNextRender(cb) { 19 | requestAnimationFrame(() => { 20 | setTimeout(() => { 21 | cb(); 22 | }); 23 | }); 24 | }; 25 | 26 | /** 27 | * Waits for a flush then a render to happen 1 or more times before calling 28 | * its callback function. Useful for waiting a bit in your test `beforeEach` 29 | * hook for your fixture to initialize and go through a few renders before 30 | * you test it. 31 | 32 | * @param {Function} callback Function to call when the flush+render cycle(s) have completed 33 | * @param {[type]} waitFor Number of flush+render cycle(s) to wait for, default is 1 34 | */ 35 | function flushAndRender(callback, waitFor) { 36 | waitFor = waitFor || 1; 37 | let renderCount = 0; 38 | 39 | const doFlushAndRender = () => { 40 | flush(() => { 41 | afterNextRender(() => { 42 | renderCount++; 43 | if (renderCount === waitFor) { 44 | callback(); 45 | } 46 | else { 47 | doFlushAndRender(); 48 | } 49 | }); 50 | }); 51 | }; 52 | doFlushAndRender(); 53 | }; 54 | -------------------------------------------------------------------------------- /examples/is-selectable.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | Context Browser Demo -- Custom Keys 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /sass/px-context-browser-animations.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, General Electric 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // IMPORTANT NOTE: Due to the limitations of the Shady DOM polyfill, it is 18 | // difficult to ensure keyframe animations are in the right scope for slotted 19 | // elements (see https://github.com/Polymer/polymer/issues/4688). To solve this, 20 | // the keyframe animations below are included in both the Shadow DOM of the 21 | // component that has the elements that will animate slotted and in the 22 | // host component that will be animated. 23 | 24 | @keyframes fadeInRight { 25 | from { 26 | opacity: 0; 27 | transform: translateX(-100%); 28 | } 29 | 30 | to { 31 | opacity: 1; 32 | transform: none; 33 | } 34 | } 35 | 36 | @keyframes fadeOutRight { 37 | from { 38 | opacity: 1; 39 | transform: none; 40 | } 41 | to { 42 | opacity: 0; 43 | transform: translateX(100%); 44 | } 45 | } 46 | 47 | @keyframes fadeInLeft { 48 | from { 49 | opacity: 0; 50 | transform: translateX(100%); 51 | } 52 | 53 | to { 54 | opacity: 1; 55 | transform: none; 56 | } 57 | } 58 | 59 | @keyframes fadeOutLeft { 60 | from { 61 | opacity: 1; 62 | transform: none; 63 | } 64 | to { 65 | opacity: 0; 66 | transform: translateX(-100%); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /examples/custom-keys.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | Context Browser Demo -- Custom Keys 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "px-context-browser", 3 | "version": "2.2.0", 4 | "main": [ 5 | "px-context-browser.html" 6 | ], 7 | "ignore": [ 8 | "*.enc", 9 | ".*", 10 | "npm-debug.log", 11 | "gulpfile.js", 12 | "sass", 13 | "bower_components", 14 | "node_modules", 15 | "test", 16 | "OSS_Notice.pdf", 17 | "px-context-browser.png", 18 | "scripts", 19 | "wct.conf.*", 20 | ".github", 21 | "HISTORY.md", 22 | "CONTRIBUTING.md", 23 | "LICENSE.md", 24 | "README.md", 25 | "monogram-wdmk.png" 26 | ], 27 | "dependencies": { 28 | "polymer": "#1.9 - 2", 29 | "px-icon-set": "^2.0.0", 30 | "iron-a11y-keys": "^2.0.0", 31 | "iron-resizable-behavior": "^2.0.0", 32 | "web-animations-js": "^2.2.0", 33 | "iron-dropdown": "^2.0.0", 34 | "px-app-helpers": "^2.1.0", 35 | "iron-media-query": "^2.0.0", 36 | "px-progress-bar": "^1.2.1", 37 | "app-localize-behavior": "^2.0.0", 38 | "px-notification": "^1.0.3" 39 | }, 40 | "devDependencies": { 41 | "promise-polyfill": "polymerlabs/promise-polyfill#^2.0.0", 42 | "px-box-sizing-design": "^1.0.0", 43 | "px-colors-design": "^1.0.0", 44 | "px-defaults-design": "^2.0.0", 45 | "px-demo": "^3.0.0", 46 | "px-forms-design": "^2.0.0", 47 | "px-normalize-design": "^1.0.0", 48 | "px-theme": "^3.3.0", 49 | "iron-ajax": "^2.0.2", 50 | "px-shadows-design": "^1.0.0", 51 | "web-component-tester": "^6.3.0", 52 | "px-headings-design": "^1.0.3", 53 | "iron-test-helpers": "^2.0.0" 54 | }, 55 | "resolutions": { 56 | "webcomponentsjs": "^1.0.0" 57 | }, 58 | "variants": { 59 | "1.x": { 60 | "dependencies": { 61 | "polymer": "^1.9.0" 62 | }, 63 | "devDependencies": { 64 | "web-component-tester": "^5.0.0" 65 | }, 66 | "resolutions": { 67 | "webcomponentsjs": "^0.7.0" 68 | } 69 | } 70 | }, 71 | "license": "Apache-2.0" 72 | } -------------------------------------------------------------------------------- /sass/px-context-browser-filter.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, General Electric 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Settings 18 | @import "px-defaults-design/_settings.defaults.scss"; 19 | 20 | // Generic 21 | @import "px-normalize-design/_generic.normalize.scss"; 22 | @import "px-box-sizing-design/_generic.box-sizing.scss"; 23 | 24 | // Base 25 | @import "px-forms-design/_base.forms.scss"; 26 | 27 | :host { 28 | display: none; 29 | } 30 | 31 | :host([active]) { 32 | display: block; 33 | } 34 | 35 | .filter__form { 36 | position: relative; 37 | display: block; 38 | padding: calculateRem(10px) calculateRem(15px); 39 | box-sizing: border-box; 40 | } 41 | 42 | // iOS Safari requires a minimum input text size of 16px, or it will automatically 43 | // zoom the page when the input becomes focused even if the developer marks 44 | // the page as un-zoomable. Manually setting the font size to 16px gets around 45 | // this issue. 46 | input.filter__box { 47 | font-size: 16px; 48 | } 49 | 50 | .filter__icon { 51 | position: absolute; 52 | top: calculateRem(10px); 53 | right: calculateRem(15px); 54 | width: 1.5rem; 55 | height: 2rem; 56 | display: block; 57 | padding: 4px; 58 | color: var(--px-input-text-color--placeholder, lightgray); 59 | --iron-icon-width: 100%; 60 | --iron-icon-height: 100%; 61 | } 62 | .filter__icon--tappable { 63 | cursor: pointer; 64 | } 65 | 66 | .filter__box { 67 | padding-right: 1.5rem; 68 | } 69 | 70 | //removes the 'x' in edge and ie11's text input fields 71 | .filter__box::-ms-clear { 72 | display: none; 73 | width: 0; 74 | height: 0; 75 | } 76 | -------------------------------------------------------------------------------- /demo/px-context-browser-trigger-demo.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 52 | 53 | 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # px-context-browser [![Build Status](https://travis-ci.org/PredixDev/px-context-browser.svg?branch=master)](https://travis-ci.org/PredixDev/px-context-browser) 2 | 3 | ## Overview 4 | 5 | `px-context-browser` is a component that allows users to navigate through a graph of assets (like physical places or equipment) and select a specific asset they want to inspect. Other pieces of a web app can bind to the context — the asset the user selects - and use that information to update the UI with relevant information about that asset. 6 | 7 | ## Usage 8 | 9 | ### Prerequisites 10 | 1. node.js 11 | 2. npm 12 | 3. bower 13 | 4. [webcomponents-lite.js polyfill](https://github.com/webcomponents/webcomponentsjs) 14 | 15 | Node, npm and bower are necessary to install the component and dependencies. webcomponents.js adds support for web components and custom elements to your application. 16 | 17 | ### Getting Started 18 | 19 | First, install the component via bower on the command line. 20 | 21 | ``` 22 | bower install px-context-browser --save 23 | ``` 24 | 25 | Second, import the component to your application with the following tag in your head. 26 | 27 | ``` 28 | 29 | ``` 30 | 31 | Finally, use the component in your application: 32 | 33 | ``` 34 | 35 | 36 | ``` 37 | 38 |
39 |
40 | 41 | ## Documentation 42 | 43 | Read the full API and view the demo [here](https://predixdev.github.io/px-context-browser). 44 | 45 | ## Local Development 46 | 47 | From the component's directory... 48 | 49 | ``` 50 | $ npm install 51 | $ bower install 52 | $ gulp sass 53 | ``` 54 | 55 | From the component's directory, to start a local server run: 56 | 57 | ``` 58 | $ gulp serve 59 | ``` 60 | 61 | Navigate to the root of that server (e.g. http://localhost:8080/) in a browser to open the API documentation page, with link to the "Demo" / working examples. 62 | 63 | ### GE Coding Style Guide 64 | [GE JS Developer's Guide](https://github.com/GeneralElectric/javascript) 65 | 66 |
67 |
68 | 69 | ## Known Issues 70 | 71 | Please use [Github Issues](https://github.com/PredixDev/px-context-browser/issues) to submit any bugs you might find. 72 | -------------------------------------------------------------------------------- /test/chai-expect-eventually.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2018, General Electric 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | function checkEventually(within, every, testValFn, assertValFn, finishedFn) { 19 | var started = new Date(); 20 | var task = setInterval(function() { 21 | var elapsed = new Date() - started; 22 | if (testValFn() === assertValFn()) { 23 | // Test succeeded 24 | clearInterval(task); 25 | finishedFn(true); 26 | } 27 | if (elapsed >= within) { 28 | // Test failed and no time left to try again 29 | clearInterval(task); 30 | finishedFn(false); 31 | } 32 | }, every); 33 | }; 34 | 35 | if (chai && chai.Assertion) { 36 | chai.Assertion.addMethod('eventuallyEqual', function(assertValue, settings, done) { 37 | settings = settings || {}; 38 | var within = settings.within || 1000; 39 | var every = settings.every || 100; 40 | 41 | var getTestValue = function() { 42 | if (typeof this._obj === 'function') { 43 | return this._obj(); 44 | } 45 | return this._obj; 46 | }.bind(this); 47 | 48 | var getAssertValue = function() { 49 | return assertValue; 50 | }.bind(this); 51 | 52 | var finishedFn = function() { 53 | var testVal = getTestValue(); 54 | var assertVal = getAssertValue(); 55 | var eqStr = 'expected #{exp} to equal #{act} within '+within+'ms'; 56 | var notEqStr = 'expected #{exp} to not equal #{act} within '+within+'ms'; 57 | this.assert( 58 | testVal === assertVal, 59 | eqStr, 60 | notEqStr, 61 | testVal, 62 | assertVal 63 | ); 64 | if (done) { 65 | done(); 66 | } 67 | }.bind(this); 68 | 69 | checkEventually(within, every, getTestValue, getAssertValue, finishedFn); 70 | }); 71 | } 72 | -------------------------------------------------------------------------------- /demo/index.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 33 | 34 | 75 | -------------------------------------------------------------------------------- /sass/px-context-browser-panel.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, General Electric 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Settings 18 | @import "px-defaults-design/_settings.defaults.scss"; 19 | 20 | // Generic 21 | @import "px-normalize-design/_generic.normalize.scss"; 22 | @import "px-box-sizing-design/_generic.box-sizing.scss"; 23 | 24 | //Ojects 25 | @import "px-shadows-design/_objects.shadows.scss"; 26 | 27 | // Component 28 | .pointer { 29 | height: 0; 30 | width: 0; 31 | margin-left: 15px; 32 | position: relative; 33 | z-index: 1; 34 | border-left: 16px solid transparent; 35 | border-right: 16px solid transparent; 36 | border-bottom: 16px solid var(--px-context-browser-panel-border-color, lightgray); 37 | } 38 | 39 | .pointer:after { 40 | content: ""; 41 | position: absolute; 42 | left: -15px; 43 | top: 2px; 44 | width: 0; 45 | height: 0; 46 | border-left: 15px solid transparent; 47 | border-right: 15px solid transparent; 48 | border-bottom: 15px solid var(--px-context-browser-panel-background-color, white); 49 | z-index: 1; 50 | } 51 | 52 | :host([collapsed]) .pointer { 53 | display: none; 54 | } 55 | 56 | :host([has-header]) .pointer:after { 57 | border-bottom-color: var(--px-context-browser-header-background-color, whiteSmoke); 58 | } 59 | 60 | .panel-body { 61 | display: block; 62 | position: relative; 63 | width: var(--px-context-browser-panel-width, calculateRem(320px)); 64 | border-style: solid; 65 | border-width: 1px; 66 | border-color: var(--px-context-browser-panel-border-color, lightgray); 67 | box-shadow: $inuit-shadow-navigation; 68 | background-color: var(--px-context-browser-panel-background-color, white); 69 | } 70 | 71 | :host([collapsed]) { 72 | position: relative; 73 | } 74 | 75 | :host([collapsed]) .panel-body { 76 | position: relative; 77 | width: 100vw; 78 | height: 80vh; 79 | display: flex; 80 | flex-direction: column; 81 | } 82 | 83 | px-progress-bar { 84 | --px-progress-bar-height: 2px; 85 | } 86 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Predix UI 23 | 24 | 25 | 29 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /px-context-browser-header.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 43 | 44 | 75 | -------------------------------------------------------------------------------- /sass/px-context-browser-header.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, General Electric 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Settings 18 | @import "px-defaults-design/_settings.defaults.scss"; 19 | 20 | // Generic 21 | @import "px-normalize-design/_generic.normalize.scss"; 22 | @import "px-box-sizing-design/_generic.box-sizing.scss"; 23 | 24 | //Ojects 25 | @import "px-shadows-design/_objects.shadows.scss"; 26 | 27 | // Component 28 | :host { 29 | display: none; 30 | flex-direction: row; 31 | position: relative; 32 | height: calculateRem(40px); 33 | background-color: var(--px-context-browser-header-background-color, whiteSmoke); 34 | border-bottom: 1px solid var(--px-context-browser-header-border-color, lightgray); 35 | box-shadow: $inuit-shadow-component; 36 | padding-left: calculateRem(15px); 37 | padding-right: calculateRem(15px); 38 | z-index: 2; 39 | } 40 | 41 | :host([active]) { 42 | display: flex; 43 | } 44 | 45 | :host([collapsed]) { 46 | background-color: var(--px-context-browser-header-background-color, white); 47 | border-bottom: 1px solid var(--px-context-browser-header-border-color, lightgray); 48 | } 49 | 50 | .context-browser-header-label { 51 | display: flex; 52 | align-items: center; 53 | color: var(--px-context-browser-header-text-color, teal); 54 | cursor: pointer; 55 | user-select: none; 56 | min-width: 0; 57 | flex: 1 1 auto; 58 | } 59 | 60 | .context-browser-header-label__arrow { 61 | flex: 0 0 auto; 62 | margin-right: calculateRem(5px); 63 | display: inline-flex; 64 | } 65 | 66 | .context-browser-header-label__link { 67 | flex: 1 1 auto; 68 | font-weight: 700; 69 | white-space: nowrap; 70 | overflow: hidden; 71 | text-overflow: ellipsis; 72 | } 73 | .actions { 74 | flex: 0 0 auto; 75 | margin-left: calculateRem(10px); 76 | display: flex; 77 | align-items: center; 78 | } 79 | .action { 80 | flex: 0 0 auto; 81 | padding: calculateRem(1px); 82 | width: calculateRem(20px); 83 | height: calculateRem(20px); 84 | margin-left: calculateRem(5px); 85 | margin-right: calculateRem(5px); 86 | cursor: pointer; 87 | color: var(--px-context-browser-icon-stroke, dimgray); 88 | } 89 | .action--last { 90 | margin-right: 0; 91 | } 92 | -------------------------------------------------------------------------------- /px-context-browser-actions.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 40 | 41 | 46 | 47 | 48 | 49 | 67 | 68 | 73 | 74 | 75 | 76 | 89 | 90 | 95 | -------------------------------------------------------------------------------- /examples/favorites.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | Context Browser Demo -- Favorites 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /px-context-browser-trigger.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 32 | 33 | 37 | 91 | 92 | -------------------------------------------------------------------------------- /test/px-context-browser-fixture.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Web Component Test : Fixture for px-context-browser 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 55 | 56 | 57 | 58 | 64 | 65 | 66 | 67 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # ------------------------------------------------------------------------------ 4 | # CREATES A LOCAL VERSION OF THE DEMO/DOCS BUILD 5 | # 6 | # The `scripts/ghp.sh` file is run by Travis CI to build the docs/demo pages and 7 | # deploy those pages to by pushing to a special Github repo. 8 | # 9 | # This script has a small subset of the build steps. It can be used for fast 10 | # local builds to simulate the production site. Alternatively, it can be used 11 | # to create a local build that can be pushed to the docs site if a hotfix is 12 | # needed and Travis is taking too long. 13 | # 14 | # CONFIGURING YOUR PROJECT: 15 | # 16 | # Your project should include at least the following files, in addition to any 17 | # code for the project itself: 18 | # 19 | # project/ 20 | # |- scripts/build.sh 21 | # |- node_modules/ 22 | # |- bower_components/ 23 | # |- bower.json 24 | # |- polymer.json 25 | # |- package.json 26 | # 27 | # package.json requirements: 28 | # - `bower` and `polymer-cli` (1.3.0+) must be installed as devDependencies 29 | # 30 | # bower.json requirements: 31 | # - the repo name must be in the "name" field 32 | # 33 | # polymer.json requirements: 34 | # - the build must be configured, with all required sources listed 35 | # 36 | # Additionally, the `build/` directory should be empty and added to `.gitignore` 37 | # to ensure nothing important is overwritten. 38 | # 39 | # HOW TO USE IT: 40 | # 41 | # These commands should be run from the root of your project. 42 | # 43 | # 1. This file should be saved in your project as `scripts/build.sh`. 44 | # 2. Run `yarn install` or `npm install` (your choice) 45 | # 3. Run `bower install` 46 | # 4. Run `./scripts/build.sh` 47 | # ------------------------------------------------------------------------------ 48 | 49 | # Find repo name from the bower file 50 | REPO_NAME=$(grep "name" bower.json | sed 's/"name": "//' | sed 's/",//' | sed -e 's/^[[:space:]]*//') 51 | 52 | echo "Starting build for $REPO_NAME" 53 | 54 | # Bower install theme dependencies 55 | ./node_modules/.bin/bower install px-theme px-dark-theme px-dark-demo-theme 56 | 57 | # Run polymer build to transpile code. The output will be placed in the 58 | # `build/unbundled` directory 59 | ./node_modules/.bin/polymer build 60 | 61 | # Open the build directory 62 | cd build/ 63 | 64 | # Rename unbundled --> $REPO_NAME, move all the bower_components/ up one level 65 | # so they're beside to $REPO_NAME 66 | mv unbundled $REPO_NAME 67 | rm -rf "$REPO_NAME/bower_components/$REPO_NAME/" 68 | find "$REPO_NAME/bower_components" -mindepth 1 -maxdepth 1 -print0 | xargs -0 -I {} mv {} . 69 | rm -rf "$REPO_NAME/bower_components/" 70 | 71 | # Add the redirect 72 | # Note: We are not overwriting the component's documentation `index.html` file 73 | # here, we are making sure that http://url/px-something/ redirects to 74 | # http://url/px-something/px-something/, where the demo page is installed 75 | echo "" > index.html 76 | 77 | echo "" 78 | echo "================================================" 79 | echo "Build finished in $(pwd)" 80 | echo "================================================" 81 | echo "" 82 | -------------------------------------------------------------------------------- /css/px-context-browser-panel-styles.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 23 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | dist: trusty 3 | language: node_js 4 | node_js: 5 | - stable 6 | branches: 7 | except: 8 | - gh-pages 9 | addons: 10 | firefox: latest 11 | apt: 12 | sources: 13 | - google-chrome 14 | packages: 15 | - google-chrome-stable 16 | before_script: 17 | - yarn add polymer-cli 18 | - polymer install --variants 19 | script: 20 | - xvfb-run wct --skip-plugin sauce 21 | - if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then wct --plugin sauce --skip-plugin 22 | local; fi 23 | after_success: 24 | - if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then openssl aes-256-cbc -k "$DEPLOYSECRET" 25 | -in deploy.enc -out deploy_key -d; fi 26 | - cd $TRAVIS_BUILD_DIR/scripts 27 | - chmod 755 ghp.sh 28 | - "./ghp.sh" 29 | env: 30 | global: 31 | - secure: aZpqcoQqAkts03dcEOlCbxlxT3nzL/w7y1+/9PaS2wqep+MoqLOF1eH8ACIlEnbekd5ppp7jefb2aBxMdGrtN+Ft9d0ko/k48di5v/812pIgiU+FLGOu7VmRPaOvOJqXA0QJ+5Mwai9Q7WBEDt7KLjv+sevw75C1Ub10RHlkrRJ5QbC/NH3vjAPfgYdhu6Y4MeUx0E4QFNS7hOXBPH4BnR7XQ6vFkgbZdRZlLO0Nqy3jHyOgmi9I62gUN12D3sb8LWe81VVfW6/B2ixwfLwr23FEwEnfidcBMU7zxkqf/cG5aHlCFnDe72NFmi46EIZnKp5C0AZdbO0Mo2J7/DlawJ/dPgfnK9aOZzf2drk4I6B1An4EzwSbynqnDTYr8odigtRI/B0teylhNjwTmphkVjjyK9GUVV81orWyewm89/BQrxtDMcquCGqwdeBrkVUFdYDQtZHyKm3qKcPF41JkxEPvSbm21GqUalPShRVRl+Gzzr0QR+ucPcQ01F/nc0o8m232Dx27cRYG24+P2UcoOLBs1zoiaa9lo8gL3pXIq+Vw3nPlH7jNnYvZYZm08jzAaO7y9puFyi8NOARdR3M1gQ3/owAyDCXJ8GwSN0TbP8sCOL7qL0bzacwbAn2EgxPmfhOjvFu6sgBsY0Pld1gayNUzfSh0hFFj7jw1Xa+cCsY= 32 | - secure: Y/LIdgyBJ/arwgccc4LlimTRjIa9+b7GxhWmhis4/sqljAHU07XXGEEGAn065fRpAyKcs8Q3lz6Fb6swib1RvZfwZD72WXOFbimegS02BHbO6n/wYUZVfZHPQMpRh/l2RX5qXCUWY6JwABKhX6TClfJnctLKCh48nL7nEC53OluUm98/l6XlfG4FNYsgO3P1dm/i08m+tslRX8vLImmNXXwPFUGzWbdFHy4KMxpUAYPBJqGHTeCFP641sDaZAnyxESNdxwReZGNz4I7adRaPgDo7WBodCBazSuCt3PIHqcW3xJSHi7nOVcm8GXoEi/CBQfCbIqOzG/GusyAhuHOsRbG6WudIn6qSpe8uqJXFYN7GdHJnJFbr+TvujOv16D+oW8l3rCzkl2Dng4S2pKC0erFuOBGNgNfeZkELcojI6ombezUr+2Nwn7rGdrB3j1swee6ByP4wmlFIHMD/IkANoVh9nqVaAARumZGJ/qlgGa9JHjkZX4b15Ma8KG0TvSOzaBJaatbJH1ESo3Yn0BayGnO60ztMtZyxCJLju9bc+rOL+8/nv3pTFrYQ4PQOBCPJwg+/H5NGyp0I8JpburAu/vWZpqSLTck5CYsfesX0EzdR6RUbaKV2ef/kKKMt9VqhEywONF9OdEAywoBOiXkZB0YZAUXpSEK7hAU4DoGz4GE= 33 | - secure: f+NHiy+4XBPb5aIGfk683k6o4GAdp3Lzhjtn+dy5IqCXvsrMSW1oA982qdHfJfALltTnrul8pwvPm3kY1wimYcsGErQEP9KWgwldLbiQVdPHR+kM2vg1hJAuyvb643XNTBBoi+8B/EEazXAIz7Zp3Y2mPd02vVfBM0QYQ3eYZC5MkUpx3G9iNHI8Kr9kwNFOQXdUPkiB5fOXVlmO0cPM5XynHDVnI1k3Y1N5ouLP6RoYFMlwDXBY1ifb4KyH09qZYhCiTnpDC1CSLGmB/5YFYm4b9U0vO80YYxG6MBJvg8LcE5Yvtr4qip7jDHL3MA3IOKRLtNssKTejX8Z+Dhu5yERlhxf6MSIeKiiPE9rEehvZTbOo2L8mu0653KCJ4EXibPPjl9piNqt/opGQpFpWJpFSeUruP3MDh79d0MS51RURCOnsmWJNE4TRPqvKLA/4fHPhgky9E9vta/98YllFkiL+UIOwjYadVZMNQi/z4DpvX5ABO4B0aPHizxB3fWEL433ixpnZaFE7TnCCfFKdsNzx5ZmcBfkDs0Wjf7j7sSjxsq2ClHzM1siHCTQp9SElxsJLb7N3QPgPhcCt+ne33HFrN7Hv1+QfiK1Rs0sHUhuWGZMYLljBHD0l9fcSNwPGuuHVvl1c6Evyshuwhg46TW7OxrK4s4l7zD4vFvSpRFs= 34 | - secure: h/PPgMOSgAIv6b3D5PCm11ZlSNIiK98u6dcOTOAn2coN2WpSEqJTxDLQuzOovngX0liMr3e40aydeb3IOx168bcdnFeDN/kmxDVTbcYbgkxm7staJaVpEzi3jLG1vaa03xeLxxLor2g4YxvzrHuzV2Cjy4vqKqjSBkUhdUbj1sJQbz6aL9B0N9vReEypFKWZ3kKphuy17XWEqGF64b6s17yFDjTg20BUSqZYeGR1CAJE2QqcKXNSo7Kv84TqDIipP67vhRaFywBCk0YpCsSGx7ur58P3BOPQLOOArcXSEf2kqg7HenqOwmR0n2yHPDLicjr3L7VtjL85j94xM8dGkPiZwt9ogwO+kNlVkmRrgwCb1LuKMJUCDpXC7YVcOFtEJ955pl4rBvnYEV0Rs58HTqqCp1R4NE0yKVDIXsLAjzLRAISiwTfb0UDZWI2u3pI6KQNGHRVG27J/CZfmWxZg+WdiL8nV0P4ay2Ov0vjuZ3SWbVwrSpHRYEuO+BjrPTfROAvu+Q2SBYsEJRkqf8yzVhktdfL3bKOA5Ahchy7ivRPJpXZvaTNvQWUmj/PcIGE+egwGRyNlNzGjWdKXcZULI3ihKdSBKdwmbSNL9kN1+Pvp3T1i7avwKYOOOSSOQkdjUZhGm7dkMpNU7R8SYXPEVr0LmC2Az6bGihfG9j4+e3Q= 35 | -------------------------------------------------------------------------------- /css/px-context-browser-header-styles.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 23 | -------------------------------------------------------------------------------- /px-context-browser-filter.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 48 | 112 | 113 | -------------------------------------------------------------------------------- /css/px-context-browser-item-styles.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 23 | -------------------------------------------------------------------------------- /px-context-browser-favorited-temp.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 117 | -------------------------------------------------------------------------------- /sass/px-context-browser-item.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, General Electric 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Settings 18 | @import "px-defaults-design/_settings.defaults.scss"; 19 | 20 | // Generic 21 | @import "px-normalize-design/_generic.normalize-mini.scss"; 22 | @import "px-box-sizing-design/_generic.box-sizing.scss"; 23 | 24 | // Base 25 | @import "px-headings-design/_base.headings.scss"; 26 | 27 | // Component 28 | :host { 29 | display: flex; 30 | height: calculateRem(30px); 31 | color: var(--px-context-browser-item-text-color, black); 32 | transition: background-color .2s ease-in-out; 33 | } 34 | 35 | .context-browser-item { 36 | flex: 1 1 auto; 37 | display: flex; 38 | align-items: center; 39 | cursor: pointer; 40 | min-width: 0; 41 | } 42 | 43 | :host([style-as-favorite]) { 44 | height: calculateRem(60px); 45 | } 46 | 47 | :host(:hover), 48 | :host(:focus) { 49 | background-color: var(--px-context-browser-item-background-color--hover, whitesmoke); 50 | } 51 | 52 | :host([collapsed]:hover), 53 | :host([collapsed]:focus) { 54 | background-color: transparent; 55 | } 56 | // In collapsed mode, show hover color on active (e.g. on pressed interaction) 57 | :host([collapsed]:active) { 58 | background-color: var(--px-context-browser-item-background-color--hover, whitesmoke); 59 | } 60 | 61 | :host(:focus) { 62 | outline: none; 63 | } 64 | 65 | :host([selected]), 66 | :host([selected][collapsed]) { 67 | background-color: var(--px-context-browser-item-background-color--selected, steelblue); 68 | color: var(--px-context-browser-item-text-color--selected, white); 69 | } 70 | 71 | .context-browser-text { 72 | display: block; 73 | width: 100%; 74 | flex: 1 1 auto; 75 | padding-left: calculateRem(15px); 76 | padding-right: calculateRem(15px); 77 | cursor: pointer; 78 | user-select: none; 79 | min-width: 0; 80 | } 81 | 82 | .context-browser-text__label { 83 | white-space: nowrap; 84 | overflow: hidden; 85 | text-overflow: ellipsis; 86 | } 87 | 88 | .context-browser-text__breadcrumbs { 89 | color: var(--px-context-browser-item-breadcrumbs-color, gray); 90 | white-space: nowrap; 91 | overflow: hidden; 92 | text-overflow: ellipsis; 93 | } 94 | 95 | :host([selected]) .context-browser-text__breadcrumbs { 96 | color: var(--px-context-browser-item-breadcrumbs-color--selected, white); 97 | } 98 | 99 | .actions { 100 | margin-left: auto; 101 | opacity: 0; 102 | transition: opacity .2s ease-in-out; 103 | display: none; 104 | flex: 0 0 auto; 105 | } 106 | :host([style-as-favorite]) .actions { 107 | display: flex; 108 | opacity: 1; 109 | } 110 | :host(:hover) .actions, 111 | :host(:focus) .actions, 112 | :host([selected]) .actions { 113 | display: flex; 114 | opacity: 1; 115 | } 116 | :host([collapsed]:hover) .actions, 117 | :host([collapsed]:focus) .actions, 118 | :host([selected][collapsed]) .actions { 119 | display: none; 120 | } 121 | .action { 122 | width: calculateRem(20px); 123 | height: calculateRem(20px); 124 | margin-left: calculateRem(5px); 125 | margin-right: calculateRem(5px); 126 | cursor: pointer; 127 | color: var(--px-context-browser-icon-stroke, dimgray); 128 | } 129 | :host([selected]) .action { 130 | color: var(--px-context-browser-icon-stroke--item-selected, white);; 131 | } 132 | // For the default context browser, the last .action isn't the last-child because 133 | // of dom-ifs, it's 3rd-to-last 134 | .action:nth-last-child(3) { 135 | margin-right: calculateRem(15px); 136 | } 137 | // For the favorites context browser, there's only one .action 138 | :host([style-as-favorite]) .action { 139 | margin-right: calculateRem(15px); 140 | } 141 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2018, General Electric 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | 'use strict'; 19 | const path = require('path'); 20 | const gulp = require('gulp'); 21 | const pkg = require('./package.json'); 22 | const $ = require('gulp-load-plugins')(); 23 | const gulpSequence = require('gulp-sequence'); 24 | const importOnce = require('node-sass-import-once'); 25 | const stylemod = require('gulp-style-modules'); 26 | const browserSync = require('browser-sync').create(); 27 | const gulpif = require('gulp-if'); 28 | const combiner = require('stream-combiner2'); 29 | const bump = require('gulp-bump'); 30 | const argv = require('yargs').argv; 31 | const exec = require('child_process').exec; 32 | const { ensureLicense } = require('ensure-px-license'); 33 | 34 | const sassOptions = { 35 | importer: importOnce, 36 | importOnce: { 37 | index: true, 38 | bower: true 39 | } 40 | }; 41 | 42 | gulp.task('clean', function() { 43 | return gulp.src(['.tmp', 'css'], { read: false }) 44 | .pipe($.clean()); 45 | }); 46 | 47 | function handleError(err) { 48 | console.log(err.toString()); 49 | this.emit('end'); 50 | } 51 | 52 | function buildCSS() { 53 | return combiner.obj([ 54 | $.sass(sassOptions), 55 | $.autoprefixer({ 56 | browsers: ['last 2 versions'], 57 | cascade: false, 58 | flexbox: false 59 | }), 60 | gulpif(!argv.debug, $.cssmin()) 61 | ]).on('error', handleError); 62 | } 63 | 64 | gulp.task('sass', function() { 65 | return gulp.src(['./sass/*.scss']) 66 | .pipe(buildCSS()) 67 | .pipe(stylemod({ 68 | moduleId(file) { 69 | return path.basename(file.path, path.extname(file.path)) + '-styles'; 70 | } 71 | })) 72 | .pipe(ensureLicense()) 73 | .pipe(gulp.dest('css')) 74 | .pipe(browserSync.stream({ match: 'css/*.html' })); 75 | }); 76 | 77 | gulp.task('watch', function() { 78 | gulp.watch(['sass/*.scss'], ['sass']); 79 | }); 80 | 81 | gulp.task('serve', function() { 82 | browserSync.init({ 83 | port: 8080, 84 | notify: false, 85 | reloadOnRestart: true, 86 | logPrefix: `${pkg.name}`, 87 | https: false, 88 | server: ['./', 'bower_components'], 89 | }); 90 | 91 | gulp.watch(['css/*-styles.html', '*.html', '*.js', 'demo/*.html']).on('change', browserSync.reload); 92 | gulp.watch(['sass/*.scss'], ['sass']); 93 | }); 94 | 95 | gulp.task('bump:patch', function() { 96 | gulp.src(['./bower.json', './package.json']) 97 | .pipe(bump({ type: 'patch' })) 98 | .pipe(gulp.dest('./')); 99 | }); 100 | 101 | gulp.task('bump:minor', function() { 102 | gulp.src(['./bower.json', './package.json']) 103 | .pipe(bump({ type: 'minor' })) 104 | .pipe(gulp.dest('./')); 105 | }); 106 | 107 | gulp.task('bump:major', function() { 108 | gulp.src(['./bower.json', './package.json']) 109 | .pipe(bump({ type: 'major' })) 110 | .pipe(gulp.dest('./')); 111 | }); 112 | 113 | gulp.task('license', function() { 114 | return gulp.src(['./**/*.{html,js,css,scss}', '!./node_modules/**/*', '!./bower_components?(-1.x)/**/*']) 115 | .pipe(ensureLicense()) 116 | .pipe(gulp.dest('.')); 117 | }); 118 | 119 | gulp.task('default', function(callback) { 120 | gulpSequence('clean', 'sass', 'generate-api', 'license')(callback); 121 | }); 122 | 123 | /** 124 | * Special task for Polymer component repos. Analyzes the component source code 125 | * and generates documentation in `[component-name]-api.json`. 126 | */ 127 | gulp.task('generate-api', function (cb) { 128 | exec(`node_modules/.bin/polymer analyze ${pkg.name}.html > ${pkg.name}-api.json`, function(err, stdout, stderr) { 129 | console.log(stdout); 130 | console.log(stderr); 131 | cb(err); 132 | }); 133 | }); 134 | -------------------------------------------------------------------------------- /scripts/ghp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Exit with nonzero exit code if anything fails 4 | set -e 5 | 6 | # ------------------------------------------------------------------------------ 7 | # CONFIGURE SCRIPT 8 | # ------------------------------------------------------------------------------ 9 | 10 | # Set our source branch (where we'll build from) and our target branch (where we 11 | # want to send the build page to) 12 | SOURCE_BRANCH="master" 13 | TARGET_BRANCH="gh-pages" 14 | REPO=`git config remote.origin.url` 15 | 16 | # Find out our repo name from the bower file 17 | REPO_NAME=$(grep "name" bower.json | sed 's/"name": "//' | sed 's/",//' | sed -e 's/^[[:space:]]*//') 18 | echo "repo name is $REPO_NAME" 19 | 20 | # We get the URL in this format: "https://github.com/PredixDev/px-something" 21 | # First, we need to replace https-style remote URL with a SSH-style remote 22 | # URL we can push to below 23 | SSH_GIT=${REPO/https:\/\/github.com\//git@github.com:} 24 | 25 | # Now, the URL is in this format: "git@github.com:PredixDev/px-something" 26 | # Next, replace `PredixDev` Github organization with `predix-ui` so configure 27 | # the correct remote to push to. 28 | # The resulting URL will be: "git@github.com:predix-ui/px-something" 29 | SSH_GIT_PREDIXUI=${SSH_GIT/:PredixDev\//:predix-ui\/} 30 | 31 | # Prep git credentials 32 | GIT_USER_NAME="Travis CI" 33 | GIT_USER_EMAIL="PredixtravisCI@ge.com" 34 | GIT_COMMIT_MESSAGE="[Travis] Rebuild documentation (commit: $TRAVIS_COMMIT)" 35 | 36 | # Set git credentials 37 | git config user.name $GIT_USER_NAME 38 | git config user.email $GIT_USER_EMAIL 39 | 40 | # ------------------------------------------------------------------------------ 41 | # CHECK IF BUILD SHOULD RUN 42 | # ------------------------------------------------------------------------------ 43 | 44 | # Check if this CI run should run a deploy. We should only deploy if this CI run 45 | # is not a pull request and if this CI run is from the master branch. 46 | if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then 47 | echo "Skipping deploy; just doing a build." 48 | exit 0 49 | fi 50 | 51 | # ------------------------------------------------------------------------------ 52 | # BUILD 53 | # ------------------------------------------------------------------------------ 54 | 55 | # Ensure we're in the build directory 56 | cd $TRAVIS_BUILD_DIR 57 | 58 | # Bower install theme dependencies 59 | ./node_modules/.bin/bower install px-theme px-dark-theme px-dark-demo-theme 60 | 61 | # Run polymer build to transpile code. The output will be placed in the 62 | # `build/unbundled` directory 63 | ./node_modules/.bin/polymer build 64 | 65 | # ------------------------------------------------------------------------------ 66 | # MOVE FILES TO PREP FOR DEPLOY 67 | # ------------------------------------------------------------------------------ 68 | 69 | # Open the build directory 70 | cd build/ 71 | 72 | # Rename unbundled --> $REPO_NAME, move all the bower_components/ up one level 73 | # so they're beside to $REPO_NAME 74 | mv unbundled $REPO_NAME 75 | rm -rf "$REPO_NAME/bower_components/$REPO_NAME/" 76 | find "$REPO_NAME/bower_components" -mindepth 1 -maxdepth 1 -print0 | xargs -0 -I {} mv {} . 77 | rm -rf "$REPO_NAME/bower_components/" 78 | 79 | # Add the redirect 80 | # Note: We are not overwriting the component's documentation `index.html` file 81 | # here, we are making sure that http://url/px-something/ redirects to 82 | # http://url/px-something/px-something/, where the demo page is installed 83 | echo "" > index.html 84 | 85 | # Make sure the deploy key and node modules aren't checked into the build 86 | touch .gitignore 87 | echo "deploy_key" >> .gitignore 88 | echo "node_modules/" >> .gitignore 89 | 90 | # ------------------------------------------------------------------------------ 91 | # GIT PUSH TO REMOTES 92 | # ------------------------------------------------------------------------------ 93 | 94 | # Initialize a fresh git repo in this subdirectory we'll commit to 95 | git init . 96 | 97 | # Checkout a new orphan brach to build on 98 | git checkout --orphan $TARGET_BRANCH 99 | 100 | # Add and commit changes 101 | git add -A . >/dev/null 102 | echo "git add done" 103 | git commit -m "${GIT_COMMIT_MESSAGE}" >/dev/null 104 | echo "git commit done" 105 | 106 | # Prep the ssh key we'll use to deploy 107 | eval `ssh-agent -s` 108 | chmod 0400 $TRAVIS_BUILD_DIR/deploy_key 109 | 110 | # Push to predix-ui/repo `gh-pages` branch (force to override out-of-date refs) 111 | ssh-add $TRAVIS_BUILD_DIR/deploy_key 112 | git push $SSH_GIT_PREDIXUI $TARGET_BRANCH --force 113 | 114 | # Wait for Github Pages to rebuild and drop the cloudflare cache 115 | 116 | 117 | -------------------------------------------------------------------------------- /css/px-context-browser-styles.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 23 | -------------------------------------------------------------------------------- /sass/px-context-browser.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, General Electric 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Settings 18 | @import "px-defaults-design/_settings.defaults.scss"; 19 | 20 | // Generic 21 | @import "px-normalize-design/_generic.normalize.scss"; 22 | @import "px-box-sizing-design/_generic.box-sizing.scss"; 23 | 24 | // Base 25 | @import "px-headings-design/_base.headings.scss"; 26 | 27 | // Component 28 | :host([collapsed]) .backdrop { 29 | position: fixed; 30 | left: 0; 31 | top: 0; 32 | width: 100%; 33 | height: 100%; 34 | background-color: rgba(0,0,0,0.65); 35 | opacity: 0; 36 | transition: opacity 200ms ease; 37 | z-index: -1; 38 | } 39 | 40 | :host([collapsed]) .backdrop[visible] { 41 | opacity: 1; 42 | } 43 | 44 | :host([collapsed]) px-context-browser-panel { 45 | position: relative; 46 | z-index: 2; 47 | } 48 | 49 | .column { 50 | display: block; 51 | position: absolute; 52 | left: 0; 53 | top: 0; 54 | width: 100%; 55 | height: 100%; 56 | overflow-y: hidden; 57 | } 58 | 59 | .column.active { 60 | overflow-y: auto; 61 | } 62 | 63 | .column.animating { 64 | overflow-y: hidden; 65 | } 66 | 67 | $item-height: 30px; 68 | $item-height-favorites: 60px; 69 | 70 | px-context-browser-columns { 71 | display: block; 72 | position: relative; 73 | overflow: hidden; 74 | min-height: $item-height; 75 | transition: min-height 350ms; 76 | padding-top: 1px; 77 | } 78 | 79 | :host([favorited-opened]) px-context-browser-columns { 80 | min-height: $item-height-favorites; 81 | } 82 | 83 | px-context-browser-columns[visible-count] { 84 | min-height: ($item-height*10) + 1px; 85 | } 86 | px-context-browser-columns[visible-count="1"] { 87 | min-height: $item-height + 1px; 88 | } 89 | px-context-browser-columns[visible-count="2"] { 90 | min-height: ($item-height*2) + 1px; 91 | } 92 | px-context-browser-columns[visible-count="3"] { 93 | min-height: ($item-height*3) + 1px; 94 | } 95 | px-context-browser-columns[visible-count="4"] { 96 | min-height: ($item-height*4) + 1px; 97 | } 98 | px-context-browser-columns[visible-count="5"] { 99 | min-height: ($item-height*5) + 1px; 100 | } 101 | px-context-browser-columns[visible-count="6"] { 102 | min-height: ($item-height*6) + 1px; 103 | } 104 | px-context-browser-columns[visible-count="7"] { 105 | min-height: ($item-height*7) + 1px; 106 | } 107 | px-context-browser-columns[visible-count="8"] { 108 | min-height: ($item-height*8) + 1px; 109 | } 110 | px-context-browser-columns[visible-count="9"] { 111 | min-height: ($item-height*9) + 1px; 112 | } 113 | 114 | :host([favorited-opened]) px-context-browser-columns[visible-count] { 115 | min-height: ($item-height-favorites*10) + 1px; 116 | } 117 | 118 | :host([favorited-opened]) px-context-browser-columns[visible-count="1"] { 119 | min-height: $item-height-favorites + 1px; 120 | } 121 | :host([favorited-opened]) px-context-browser-columns[visible-count="2"] { 122 | min-height: ($item-height-favorites*2) + 1px; 123 | } 124 | :host([favorited-opened]) px-context-browser-columns[visible-count="3"] { 125 | min-height: ($item-height-favorites*3) + 1px; 126 | } 127 | :host([favorited-opened]) px-context-browser-columns[visible-count="4"] { 128 | min-height: ($item-height-favorites*4) + 1px; 129 | } 130 | :host([favorited-opened]) px-context-browser-columns[visible-count="5"] { 131 | min-height: ($item-height-favorites*5) + 1px; 132 | } 133 | :host([favorited-opened]) px-context-browser-columns[visible-count="6"] { 134 | min-height: ($item-height-favorites*6) + 1px; 135 | } 136 | :host([favorited-opened]) px-context-browser-columns[visible-count="7"] { 137 | min-height: ($item-height-favorites*7) + 1px; 138 | } 139 | :host([favorited-opened]) px-context-browser-columns[visible-count="8"] { 140 | min-height: ($item-height-favorites*8) + 1px; 141 | } 142 | :host([favorited-opened]) px-context-browser-columns[visible-count="9"] { 143 | min-height: ($item-height-favorites*9) + 1px; 144 | } 145 | 146 | px-context-browser-columns[collapsed], 147 | px-context-browser-columns[collapsed][visible-count], 148 | px-context-browser-columns[collapsed][visible-count="*"] { 149 | min-height: auto; 150 | flex: 1 1 auto; 151 | } 152 | 153 | .context-browser-favorites--empty__container { 154 | display: flex; 155 | flex-direction: column; 156 | align-items: center; 157 | justify-content: center; 158 | max-width: 80%; 159 | margin-left: auto; 160 | margin-right: auto; 161 | height: calculateRem(340px); 162 | } 163 | 164 | .context-browser-favorites--empty__text { 165 | color: var(--px-context-browser-item-text-color, black); 166 | margin-bottom: calculateRem(10px); 167 | text-align: center; 168 | } 169 | 170 | .context-browser-favorites--empty__subtext { 171 | color: var(--px-context-browser-item-breadcrumbs-color, gray); 172 | line-height: calculateRem(12px); 173 | text-align: center; 174 | max-width: 100%; 175 | } 176 | 177 | .context-browser-favorites--empty__icon { 178 | margin-bottom: calculateRem(30px); 179 | --iron-icon-height: calculateRem(70px); 180 | --iron-icon-width: calculateRem(70px); 181 | --iron-icon-fill-color: var(--px-context-browser-empty-favorites-icon-color, whitesmoke); 182 | --iron-icon-stroke-color: var(--px-context-browser-empty-favorites-icon-stroke-color, lightgray);; 183 | stroke-width: calculateRem(0.5px); 184 | } 185 | -------------------------------------------------------------------------------- /px-context-browser-columns.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 30 | 31 | 177 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Predix UI Hi, Want to contribute your suggestions to Predix UI? **Here's how you can help.** Please follow the below steps carefully, so your suggestions will be clear and developers can make effective fixes. ## Using the GitHub issue tracker The GitHub issue tracker is the preferred channel for [bug reports](#bug-reports), [features requests](#feature-requests) and [submitting pull requests](#pull-requests), so please respect the following restrictions: * Please **do not** use the GitHub issue tracker for personal support requests. Stack Overflow ([`predix ui`](https://stackoverflow.com/questions/tagged/predix-ui) tag), or [Predix.io](https://predix.io) are better places to get help. * Please **do not** derail or troll issues. Keep the discussion on topic and respect the opinions of others. * Please **do not** post vague comments like "+1" or ":thumbsup:". Use [GitHub's "reactions" feature](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments). We reserve the right to delete comments. ## Issues and labels Our bug tracker utilizes several labels to help organize and identify issues. Here's what they represent and how we use them: - `browser bug` - Issues that are reported to us, but are actually the result of a browser-specific bug. These issues are diagnosed with reduced test cases and result in an issue opened on that browser's own bug tracker. - `confirmed` - Issues that have been confirmed with a reduced test case and identify a bug in a Predix UI component. - `css` - Issues stemming from our compiled CSS or source Sass files. - `docs` - Issues for improving or updating our documentation. - `examples` - Issues involving the example templates included in our docs. - `enhancement` - Issues asking for a new feature to be added, or an existing one to be extended or modified. New features require a minor version bump (e.g., `v3.0.0` to `v3.1.0`). - `grunt` - Issues with our included JavaScript-based Gruntfile, which is used to run all our tests, concatenate and compile source files, and more. - `help wanted` - Issues that we need or would like the community to help us resolve. - `js` - Issues stemming from our compiled or source JavaScript files. - `meta` - Issues with the project itself or our GitHub repository. ## Bug reports A bug is a _demonstrable problem_ caused by the code in the repository. Good bug reports are extremely helpful. Guidelines for bug reports: 0. **Validate and lint your code**; [validate your HTML](http://html5.validator.nu) and [lint your HTML](http://www.dirtymarkup.com/) to ensure your problem isn't caused by a simple error in your own code. 1. **Use the GitHub issue search**; check if the issue has already been reported. 2. **Check if the issue has been fixed**; try to reproduce the issue by using the latest `master` or development branch in the repository. 3. **Isolate the problem**; ideally create a [reduced test case](https://css-tricks.com/reduced-test-cases/) and a live example using [CodePen](http://codepen.io/mdwragg/pen/LNwmpB) or [jsfiddle](https://jsfiddle.net/Lqmcwhw0/3/). A good bug report shouldn't require others to get more information. Please be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What browser(s) and OS experience the problem? Do other browsers show the bug differently? What would you expect for the outcome? Such details will help people fix potential bugs. Example: > Short and descriptive example bug report title > > A summary of the issue and the browser/OS environment in which it occurs. If > suitable, include the steps required to reproduce the bug. > > 1. This is the first step > 2. This is the second step > 3. Further steps, etc. > > `` - a link to the reduced test case > > Any other information relevant to the bug report. This might include the lines of code that you have identified as > causing the bug, and potential solutions (and your opinions on their > merits). ## Feature Requests Feature requests are welcome, but before opening one, determine if your idea suits the scope and aims of Predix UI. *You* need to make a strong case and convince the Predix UI team to adopt your feature. Please provide as much detail and context as possible. ## Pull Requests Your pull requests�patches, improvements, and new features�are a big help. The requests should be focused and avoid unrelated commits. **Please ask** before making a significant pull request (e.g., implementing features, refactoring code, or porting to a different language) that Predix UI developers might not merge into the component. Please follow the [coding guidelines](#code-guidelines) used throughout the project (indentation, accurate comments, etc.) and any other requirements (such as test coverage). **Do not edit any of the CSS files directly!** The files are automatically generated. You should edit the source files in [`sass/`] instead. **Do not edit the `gh-pages` branch.** That branch is generated from the documentation source files and is managed separately by the Predix UI team. Please use the following process to have your work considered for the project: 1. [Fork](https://help.github.com/fork-a-repo/) the component. 2. Create a new topic branch (off the main project development branch) to contain your feature, change, or fix: ``` bash git checkout -b ``` 3. Commit your changes in logical chunks. Please adhere to these [git commit message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) or your code is unlikely to be merged into the main project. Use Git's [interactive rebase](https://help.github.com/articles/interactive-rebase) feature to tidy up your commits before making them public. 4. Locally merge (or rebase) the latest commits into your branch: ``` bash git pull [--rebase] origin master ``` 5. Push your topic branch up to your fork: ``` bash git push origin ``` 6. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) with a clear title and description against the `master` branch. ## Code guidelines ### HTML [Adhere to the Code Guide.](http://codeguide.co/#html) - Use tags and elements appropriate for an HTML5 doctype (e.g., self-closing tags). - Use [WAI-ARIA](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) attributes in documentation examples to promote accessibility. ### CSS [Adhere to the Code Guide.](http://codeguide.co/#css) - When feasible, default color palettes should comply with [WCAG color contrast guidelines](http://www.w3.org/TR/WCAG20/#visual-audio-contrast). - Except in rare cases, don't remove default `:focus` styles (via e.g. `outline: none;`) without providing alternative styles. See [this A11Y Project post](http://a11yproject.com/posts/never-remove-css-outlines/) for more details. ### JS - 2 spaces (no tabs) - "Attractive" - no errors / warnings -------------------------------------------------------------------------------- /css/px-context-browser-filter-styles.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 23 | -------------------------------------------------------------------------------- /examples/favorites-app.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | Favorite Foods app 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 69 | 70 | 223 | 224 | 225 | -------------------------------------------------------------------------------- /px-context-browser-item.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 66 | 67 | 249 | -------------------------------------------------------------------------------- /demo/px-context-browser-demo.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 115 | 116 | 256 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /HISTORY.md: -------------------------------------------------------------------------------- 1 | v2.2.0 2 | ================== 3 | * Set `showFavorited` default value to false. The developer should set the 4 | `show-favorited` attribute on the context browser element to enable favoriting 5 | 6 | v2.1.7 7 | ================== 8 | * Replace px-context-browser-contextual-notification with px-notification 9 | 10 | v2.1.6 11 | ================== 12 | * reduce icon-set imports 13 | 14 | v2.1.5 15 | ================== 16 | * fixing demo pages for IE11 17 | 18 | v2.1.4 19 | ================== 20 | * Add support for localization 21 | 22 | v2.1.3 23 | ================== 24 | * Fix truncation for items and header in ie11 25 | 26 | v2.1.2 27 | ================== 28 | * Demo fix: Remove dead demo code for trigger 29 | 30 | v2.1.1 31 | ================== 32 | * Demo fix: ensure template has rendered before querying it 33 | 34 | v2.1.0 35 | ================== 36 | * Add Polymer 1.x/2.x hybrid element support 37 | * Add favoriting feature to allow users to 'favorite' items in the context 38 | browser and see those items listed in a separate Favorited Items Panel 39 | 40 | v2.0.14 41 | ================== 42 | * add device flags 43 | 44 | v2.0.13 45 | ================== 46 | * cut over to px-icon-set for actions 47 | 48 | v2.0.12 49 | ================== 50 | * Adds `isSelectable` configuration for items 51 | 52 | v2.0.11 53 | ================== 54 | * Fix label color bug (#89) 55 | 56 | v2.0.10 57 | ================== 58 | * change default behavior to close on-select, add keep-open property to prevent (#86) 59 | 60 | v2.0.9 61 | ================== 62 | * fix documentation 63 | 64 | v2.0.8 65 | ================== 66 | * fix documentation 67 | 68 | v2.0.7 69 | ================== 70 | * fix documentation 71 | 72 | v2.0.6 73 | ================== 74 | * Fixes support for custom keys (id, children, label) and adds support 75 | for changing keys at runtime 76 | 77 | v2.0.5 78 | ================== 79 | * Fix to support runtime re-assignment of `items` 80 | 81 | v2.0.4 82 | ================== 83 | * Fix comment for analyzer 84 | 85 | v2.0.3 86 | ================== 87 | * Fix bug so that filter icon shows up in IE 88 | 89 | v2.0.2 90 | ================== 91 | * Fix bugs in demo 92 | 93 | v2.0.1 94 | ================== 95 | * Fix dark theme 96 | 97 | v2.0.0 98 | ================== 99 | * Complete rebuild of the context browser with all new APIs. See the 100 | documentation for more information on the new APIs and how to migrate your 101 | existing code. 102 | * New, refreshed design. The browser is now a single column panel that opens 103 | when its trigger is tapped. 104 | * Re-architected to work side-by-side with other Predix Design System components 105 | used to navigate assets/context (px-tree, px-breadcrumbs). 106 | * The `` tag no longer places a button 107 | on the page. Use the px-context-browser tag together with a `` tag show a button 108 | that opens the browser. See the documentation for more information on binding 109 | these two elements together. 110 | * The `browserContext` property has been renamed to `items`. The structure of 111 | the context browser items has been completely overhauled. 112 | * The `browserContext` property `name` has been replaced with `label`. 113 | * The `browserContext` property `identifier` has been replaced with `id`. 114 | * The `browserContext` property `isOpenable` has been removed. 115 | * The initial context and direct context modes have been removed. Set the 116 | `selected` property instead to select an item after loading the data. 117 | * The `disabled` property has been removed. 118 | * The `disableInfiniteScroll` property has been removed. 119 | * The `handlers` property has been removed. Listen to the event 120 | `px-app-asset-children-requested` to be notified when new children should be 121 | loaded. Listen to the event `selected-changed` to be notified when an item is 122 | selected (tapped or selected through data binding). See the documentation for 123 | more info. There is no event fired when an item is tapped but not selected as 124 | that interaction pattern has been removed. 125 | * The `idField` and `labelField` properties have been removed. Use the `keys` 126 | property to set both instead. 127 | * The `openedItemName` property has been removed. Listen to the event 128 | `selected-changed` to be notified when a new item is selected. 129 | * The `resize` property has been removed. 130 | * The `selectedItem` property has been renamed to `selected`. Its behaviors are 131 | also slightly different, see the documentation. 132 | * The `showChevron` property has been renamed to `showArrow`. 133 | * The `showColumnBrowser` property has been removed. 134 | * The `showColumnTypeahead` property has been removed. Use the `showFilter` 135 | property to show a filter field at the top of the column. 136 | * The `addParents` method has been removed. Instead, add items from the root of 137 | the graph using `addChildren`. 138 | * The `toggleColumnBrowser` method has been removed. Toggle the `collapsed` 139 | property to show or hide the context browser. 140 | * The events have changed completely. See the documentation for more details. 141 | 142 | v1.8.0 143 | ================== 144 | * added localization for 'Open' 145 | 146 | v1.7.0 147 | ================== 148 | * added a disableInfiniteScroll property to... disable infinite scrolling, which happens automatically on scroll. 149 | 150 | v1.6.11 151 | ================== 152 | * merge PR #39 - Add an onRejected promise handler for to getChildren 153 | 154 | v1.6.10 155 | ================== 156 | * fix #37 regarding labels in breadcrumb 157 | 158 | v1.6.9 159 | ================== 160 | * merge PR #36 - allow selectedAsset to have children. 161 | 162 | v1.6.8 163 | ================== 164 | * merge PR #35 165 | 166 | v1.6.7 167 | ================== 168 | * fix unit tests for typeahead 169 | 170 | v1.6.6 171 | ================== 172 | * changed 'search' to 'filter' in typeahead 173 | 174 | v1.6.5 175 | ================== 176 | * fixed memory leak, causing using setinterval. 177 | * re-wrote some functions for readability 178 | * added lots of documentation. 179 | 180 | v1.6.4 181 | ================== 182 | * increased context browser from 2 to 5 183 | * created css variable --px-cb-background-z-index 184 | * created css variable --px-cb-spinner-z-index 185 | 186 | v1.6.3 187 | ================== 188 | * put in cloudflare cache cleaner 189 | 190 | v1.6.2 191 | ================== 192 | * put in new demo 193 | 194 | v1.6.1 195 | ================== 196 | * Update colors design to pick up new colors 197 | 198 | v1.6.0 199 | ================== 200 | * merge PR #32, allow CB to be disabled 201 | 202 | v1.5.3 203 | ================== 204 | * merge PR that fixed typeahead bug 205 | 206 | v1.5.2 207 | ================== 208 | * changing ghp.sh to account for Alpha releases 209 | 210 | v1.5.1 211 | ================== 212 | * fixed win8.1 ie11 test bug. 213 | 214 | v1.5.0 215 | ================== 216 | * add search per column (filter) capability 217 | 218 | v1.4.5 219 | ================== 220 | * fixed bug that removed the scrollbars 221 | 222 | v1.4.4 223 | ================== 224 | * rebuild sass for headings design update 225 | 226 | v1.4.3 227 | ================== 228 | * added an extra visuallyhidden class to ensure the selected context browser item doesn't show up when open is clicked. 229 | 230 | v1.4.2 231 | ================== 232 | * removed content-wrapper__item class 233 | 234 | v1.4.1 235 | ================== 236 | * Update missed design depndencies 237 | 238 | v1.4.0 239 | ================== 240 | * Updated dependencies 241 | 242 | v1.3.17 243 | ================== 244 | * changing browser in wct testing from safari 8 to safari 10 on elcapitan 245 | 246 | v1.3.16 247 | ================== 248 | * updating slider dependency 249 | 250 | v1.3.15 251 | ================== 252 | * changing all devDeps to ^ 253 | 254 | v1.3.14 255 | ================== 256 | * Update px-theme to 2.0.1 and update test fixtures 257 | 258 | v1.3.13 259 | ================== 260 | * update dependencies for dropdown 261 | 262 | v1.3.12 263 | ================== 264 | * changed i to iron-icon 265 | 266 | v1.3.11 267 | ================== 268 | * removing px-theme style call 269 | 270 | v1.3.10 271 | ================== 272 | * changed css variables to be consistent with BEM 273 | 274 | v1.3.9 275 | ================== 276 | * bower updating px-demo-snippet 277 | 278 | v1.3.8 279 | ==================== 280 | * added style variables for theming 281 | 282 | v1.3.7 283 | ==================== 284 | * updated the header so it's always vertically centered. 285 | 286 | v1.3.6 287 | ==================== 288 | * Update dependencies 289 | 290 | v1.3.3 291 | ==================== 292 | * Add some top to make sure expanded 'ruler' is correctly positioned. 293 | 294 | v1.3.2 295 | ==================== 296 | * Revert position change introduced in v1.0.7. Was causing issues in seed app by pushing content down the page. 297 | 298 | v1.3.1 299 | ==================== 300 | * Fix dropdown icon size. CSS shadow dom fixes and load order of sass partials. 301 | 302 | v1.3.0 303 | ==================== 304 | * Grunt to gulp conversion and move to style modues. 305 | 306 | v1.2.0 307 | ==================== 308 | * Add content tag to allow insertion of deck selector. 309 | 310 | v1.1.0 311 | ==================== 312 | * migrate styles to style module 313 | 314 | v1.0.10 315 | ==================== 316 | * fixed demo bugs 317 | 318 | v1.0.9 319 | ==================== 320 | * brought the Q library back in for local dev. 321 | 322 | v1.0.8 323 | ==================== 324 | * updated mega demo styles and bower px-demo-snippet to ^ 325 | 326 | v1.0.7 327 | ==================== 328 | * Chrome changed its behavior from version 51 to 52, and was causing the header to be hidden behind the absolutely positioned browser. I changed the positioning to relative. also switched the old font awesome to one that works in shadow dom. 329 | 330 | v1.0.6 331 | ==================== 332 | * PR that changed how the breadcrumbs are rebuilt, allowing items with children not in the selected path 333 | v1.0.5 334 | ==================== 335 | * removed the old demo vulcanize from the auto build script 336 | 337 | v1.0.4 338 | ==================== 339 | * added image to readme, removed watch, added view on github 340 | 341 | v1.0.3 342 | ==================== 343 | * updated gh-pages script to vulcanize demo 344 | 345 | v1.0.2 346 | ==================== 347 | * Add import and config of px-iconography-design (again) 348 | * Add import and config of px-typography-design (again) 349 | * removed importQ.html from ignore 350 | 351 | v1.0.1 352 | ==================== 353 | * added new demo 354 | 355 | v1.0.0 356 | ==================== 357 | * Add import and config of px-iconography-design 358 | * Add import and config of px-typography-design 359 | 360 | v0.10.0 361 | ==================== 362 | * Upgrade to Polymer 1.5.0 363 | 364 | v0.9.7 365 | ==================== 366 | * Merged PR which fixed lazy loading spinner bug 367 | 368 | v0.9.5 369 | ==================== 370 | * removed unnecessary check on breadcrumbs 371 | 372 | v0.9.5 373 | ==================== 374 | * added oss_notice to bower ignore 375 | 376 | v0.9.4 377 | ==================== 378 | * added pull request test 379 | 380 | v0.9.3 381 | ==================== 382 | * added auto github pages functionality 383 | 384 | v0.9.2 385 | ==================== 386 | * fixed tests 387 | 388 | v0.9.1 389 | ==================== 390 | * fixed the breadcrumbs so they adhere to specs 391 | 392 | v0.9.0 393 | ==================== 394 | * Upgrade to Polymer 1.4.0 395 | 396 | v0.8.6 397 | ==================== 398 | * cleaned up docs a bit, and cleaned up css class methods. 399 | 400 | v0.8.5 401 | ==================== 402 | * Updated travis file 403 | 404 | v0.8.4 405 | ==================== 406 | * Updated documentation for api only. 407 | 408 | v0.8.3 409 | ==================== 410 | * updated the link for Github Issues 411 | 412 | v0.8.2 413 | ==================== 414 | * changed line height for selected items to help differentiate them from non-selected items 415 | 416 | v0.8.1 417 | ==================== 418 | * Updated License 419 | 420 | v0.8.0 421 | ==================== 422 | * Removed the default reference to the item chevron, since the Predix asset team does not support that. the functionality is still there, but now, you have to pass an attribute (has-children) and set it to true to ensure the chevrons show up. 423 | -------------------------------------------------------------------------------- /test/px-context-browser-tests.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2018, General Electric 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | const convertNodeListToArray = (l) => Array.isArray(l) ? l : Array.prototype.slice.call(l || []); 19 | 20 | describe('px-context-browser', function() { 21 | it('opens when the trigger is tapped', function(done) { 22 | var fx = fixture('ContextBrowser'); 23 | 24 | flush(() => { 25 | var triggerEl = fx.querySelector('px-context-browser-trigger'); 26 | var browserEl = fx.querySelector('px-context-browser'); 27 | 28 | browserEl.items = [{ id: 'home', label: 'Home' }]; 29 | browserEl.openTrigger = triggerEl.trigger; 30 | 31 | triggerEl.click(); 32 | 33 | setTimeout(function() { 34 | expect(browserEl.opened).to.equal(true); 35 | done(); 36 | }, 250); 37 | }); 38 | }); 39 | 40 | it('resets its active item to the parent of the selected item 5s after it is closed', function(done) { 41 | var fx = fixture('ContextBrowserBindingFixture'); 42 | 43 | flush(() => { 44 | var triggerEl = fx.querySelector('px-context-browser-trigger'); 45 | var browserEl = fx.querySelector('px-context-browser'); 46 | 47 | browserEl.openTrigger = triggerEl; 48 | browserEl.items = [ 49 | { id: "home", label: "Home" }, 50 | { id: "asset", label: "Assets", children: [ 51 | { id: "a1", label: "Asset 1" }, 52 | { id: "a2", label: "Asset 2" } 53 | ] } 54 | ]; 55 | triggerEl.click(); 56 | 57 | setTimeout(function() { 58 | browserEl.selectedRoute = ['asset', 'a1']; 59 | }, 250); 60 | setTimeout(function() { 61 | browserEl.active = null; 62 | document.body.click(); 63 | }, 500); 64 | setTimeout(function() { 65 | triggerEl.click(); 66 | }, 6500); 67 | setTimeout(function() { 68 | expect(browserEl.active).to.equal(browserEl.items[1]); 69 | done(); 70 | }, (6500 + 250)); 71 | }); 72 | }); 73 | 74 | it('resets its active item to the parent of the selected item 5s after it is closed when `opened` is data-bound in', function(done) { 75 | var fx = fixture('ContextBrowserBindingFixture'); 76 | 77 | flush(() => { 78 | var triggerEl = fx.querySelector('px-context-browser-trigger'); 79 | var browserEl = fx.querySelector('px-context-browser'); 80 | 81 | browserEl.openTrigger = triggerEl; 82 | browserEl.items = [ 83 | { id: "home", label: "Home" }, 84 | { id: "asset", label: "Assets", children: [ 85 | { id: "a1", label: "Asset 1" }, 86 | { id: "a2", label: "Asset 2" } 87 | ] } 88 | ]; 89 | 90 | browserEl.opened = false; 91 | triggerEl.click(); 92 | 93 | setTimeout(function() { 94 | browserEl.selectedRoute = ['asset', 'a1']; 95 | }, 250); 96 | setTimeout(function() { 97 | browserEl.active = null; 98 | document.body.click(); 99 | }, 500); 100 | setTimeout(function() { 101 | triggerEl.click(); 102 | }, 6500); 103 | setTimeout(function() { 104 | expect(browserEl.active).to.equal(browserEl.items[1]); 105 | done(); 106 | }, (6500 + 250)); 107 | }); 108 | }); 109 | 110 | // it('does not reset its active item if it is reopened after less than 5s', function(done) { 111 | // var fx = fixture('ContextBrowserBindingFixture'); 112 | // var boundEl = fx.querySelector('#app'); 113 | // var triggerEl = fx.querySelector('px-context-browser-trigger'); 114 | // var browserEl = fx.querySelector('px-context-browser'); 115 | // 116 | // boundEl.items = [ 117 | // { id: "home", label: "Home" }, 118 | // { id: "asset", label: "Assets", children: [ 119 | // { id: "a1", label: "Asset 1" }, 120 | // { id: "a2", label: "Asset 2" } 121 | // ] } 122 | // ]; 123 | // 124 | // triggerEl.click(); 125 | // 126 | // setTimeout(function() { 127 | // browserEl.selectedRoute = ['asset', 'a1']; 128 | // }, 250); 129 | // setTimeout(function() { 130 | // browserEl.active = null; 131 | // document.body.click(); 132 | // }, 500); 133 | // setTimeout(function() { 134 | // triggerEl.click(); 135 | // }, 1000); 136 | // setTimeout(function() { 137 | // expect(browserEl.active).to.equal(null); 138 | // done(); 139 | // }, (1000 + 250)); 140 | // }); 141 | // 142 | // it('does not reset its active item if it is reopened after less than 5s when `opened` is data-bound in', function(done) { 143 | // var fx = fixture('ContextBrowserBindingFixture'); 144 | // var boundEl = fx.querySelector('#app'); 145 | // var triggerEl = fx.querySelector('px-context-browser-trigger'); 146 | // var browserEl = fx.querySelector('px-context-browser'); 147 | // 148 | // boundEl.items = [ 149 | // { id: "home", label: "Home" }, 150 | // { id: "asset", label: "Assets", children: [ 151 | // { id: "a1", label: "Asset 1" }, 152 | // { id: "a2", label: "Asset 2" } 153 | // ] } 154 | // ]; 155 | // 156 | // boundEl.opened = false; 157 | // triggerEl.click(); 158 | // 159 | // setTimeout(function() { 160 | // browserEl.selectedRoute = ['asset', 'a1']; 161 | // }, 250); 162 | // setTimeout(function() { 163 | // browserEl.active = null; 164 | // document.body.click(); 165 | // }, 500); 166 | // setTimeout(function() { 167 | // triggerEl.click(); 168 | // }, 2000); 169 | // setTimeout(function() { 170 | // expect(browserEl.active).to.equal(null); 171 | // done(); 172 | // }, (2000 + 250)); 173 | // }); 174 | 175 | }); 176 | 177 | describe('px-context-browser [favorited behaviors]', () => { 178 | let fx; 179 | let items; 180 | let openTrigger; 181 | let favoritedTrigger; 182 | let browser; 183 | 184 | beforeEach(done => { 185 | fx = fixture('ContextBrowserFavoritedFixture'); 186 | flush(() => { 187 | browser = fx.querySelector('px-context-browser'); 188 | openTrigger = fx.querySelector('#openTrigger'); 189 | favoritedTrigger = fx.querySelector('#favoritedTrigger'); 190 | browser.openTrigger = openTrigger; 191 | browser.favoritedTrigger = favoritedTrigger; 192 | items = [ 193 | { id: "home", label: "Home" }, 194 | { id: "asset", label: "Assets", children: [ 195 | { id: "a1", label: "Asset 1" }, 196 | { id: "a2", label: "The Second Asset", children: [ 197 | { id: "abc", label: "ABC" }, 198 | { id: "long", label: "My Very Long Child Asset", children: [ 199 | { id: "fave", label: "My Favorite Asset" } 200 | ]} 201 | ]} 202 | ]} 203 | ]; 204 | browser.items = items; 205 | done(); 206 | }); 207 | }); 208 | 209 | it('opens the favorited panel when the favorited trigger is tapped', (done) => { 210 | favoritedTrigger.click(); 211 | flush(() => { 212 | expect(browser.favoritedOpened).to.be.true; 213 | done(); 214 | }); 215 | }); 216 | 217 | it('opens the favorited panel to an empty view if there are no currently favorited items', (done) => { 218 | favoritedTrigger.click(); 219 | flushAndRender(() => { 220 | const emptyText = Polymer.dom(browser.root).querySelector('.context-browser-favorites--empty__text'); 221 | const emptyTextRect = emptyText.getBoundingClientRect(); 222 | expect(emptyTextRect.left > 0).to.be.true; 223 | expect(emptyTextRect.height).to.be.closeTo(19, 5); 224 | done(); 225 | }, 10); 226 | }); 227 | 228 | it('opens the favorited panel to a list view if there are favorited items', (done) => { 229 | browser.favorited = [items[0], items[1]]; 230 | favoritedTrigger.click(); 231 | flush(() => { 232 | const itemEls = Polymer.dom(browser.root).querySelectorAll('px-context-browser-item'); 233 | const favoritedItem = convertNodeListToArray(itemEls).filter(item => item.styleAsFavorite && item.label === 'Home')[0]; 234 | favoritedItemRect = favoritedItem.getBoundingClientRect(); 235 | expect(favoritedItemRect.left > 0).to.be.true; 236 | expect(favoritedItemRect.height).to.be.closeTo(60, 5); 237 | done(); 238 | }); 239 | }); 240 | 241 | it('immediately adds an item to `favorited` when the user taps the favorite icon in the regular browser', (done) => { 242 | openTrigger.click(); 243 | flush(() => { 244 | expect(browser.favorited.length === 0).to.be.true; 245 | const itemEls = Polymer.dom(browser.root).querySelectorAll('px-context-browser-item'); 246 | const homeItem = convertNodeListToArray(itemEls).filter(item => !item.styleAsFavorite && item.label === 'Home')[0]; 247 | const favIcon = Polymer.dom(homeItem.root).querySelector('px-context-browser-action-favorite'); 248 | MockInteractions.tap(favIcon); 249 | flush(() => { 250 | expect(browser.favorited.indexOf(items[0]) > -1).to.be.true; 251 | done(); 252 | }); 253 | }); 254 | }); 255 | 256 | it('immediately removes a currently favorited item from `favorited` when the user taps the favorite icon in the regular browser', (done) => { 257 | browser.favorited = [items[0], items[1]]; 258 | openTrigger.click(); 259 | flush(() => { 260 | const itemEls = Polymer.dom(browser.root).querySelectorAll('px-context-browser-item'); 261 | const homeItem = convertNodeListToArray(itemEls).filter(item => !item.styleAsFavorite && item.label === 'Home')[0]; 262 | const favIcon = Polymer.dom(homeItem.root).querySelector('px-context-browser-action-favorite'); 263 | // Must use the MockInteractions tap event here to ensure test triggers listeners 264 | // in Polymer 2.x with shadow DOM 265 | MockInteractions.tap(favIcon); 266 | expect(browser.favorited.indexOf(items[0]) === -1).to.be.true; 267 | done(); 268 | }); 269 | }); 270 | 271 | it('marks an item as defavorited but keeps it in the favorites list when the user taps the favorite icon in the favorites browser', (done) => { 272 | browser.favorited = [items[0],items[1]]; 273 | favoritedTrigger.click(); 274 | flush(() => { 275 | const itemEls = Polymer.dom(browser.root).querySelectorAll('px-context-browser-item'); 276 | const homeItem = convertNodeListToArray(itemEls).filter(item => item.styleAsFavorite && item.label === 'Home')[0]; 277 | const favIcon = Polymer.dom(homeItem.root).querySelector('px-context-browser-action-favorite'); 278 | MockInteractions.tap(favIcon); 279 | flush(() => { 280 | expect(browser.favorited.indexOf(items[0]) > -1).to.be.true; 281 | expect(favIcon.hasAttribute('active')).to.be.false; 282 | done(); 283 | }); 284 | }); 285 | }); 286 | 287 | it('updates favorited when the favorites browser is closed for > 5 seconds and the state is dirty', (done) => { 288 | browser.favorited = [items[0], items[1]]; 289 | favoritedTrigger.click(); 290 | flush(() => { 291 | const itemEls = Polymer.dom(browser.root).querySelectorAll('px-context-browser-item'); 292 | const homeItem = convertNodeListToArray(itemEls).filter(item => item.styleAsFavorite && item.label === 'Home')[0]; 293 | const favIcon = Polymer.dom(homeItem.root).querySelector('px-context-browser-action-favorite'); 294 | MockInteractions.tap(favIcon); 295 | favoritedTrigger.click(); 296 | // wait at least 5 seconds 297 | expect(() => browser.favorited.indexOf(items[0]) === -1) 298 | .to.eventuallyEqual(true, {within: 9000, every: 250}, done); 299 | }); 300 | }); 301 | 302 | it('updates favorited when the user opens the regular browser and the state is dirty', (done) => { 303 | browser.favorited = [items[0], items[1]]; 304 | favoritedTrigger.click(); 305 | flush(() => { 306 | const itemEls = Polymer.dom(browser.root).querySelectorAll('px-context-browser-item'); 307 | const homeItem = convertNodeListToArray(itemEls).filter(item => item.styleAsFavorite && item.label === 'Home')[0]; 308 | const favIcon = Polymer.dom(homeItem.root).querySelector('px-context-browser-action-favorite'); 309 | MockInteractions.tap(favIcon); 310 | openTrigger.click(); 311 | // wait at least 5 seconds 312 | expect(() => browser.favorited.indexOf(items[0]) === -1) 313 | .to.eventuallyEqual(true, {within: 9000, every: 250}, done); 314 | }); 315 | }); 316 | 317 | it('shows breadcrumbs for non-root items in the Favorites Panel', (done) => { 318 | browser.favorited = [items[1].children[1].children[0]]; 319 | favoritedTrigger.click(); 320 | flushAndRender(() => { 321 | const itemEls = Polymer.dom(browser.root).querySelectorAll('px-context-browser-item'); 322 | const favoriteItem = convertNodeListToArray(itemEls).filter(item => item.styleAsFavorite && item.label === 'ABC')[0]; 323 | const itemBreadcrumbs = Polymer.dom(favoriteItem.root).querySelector('#breadcrumbs'); 324 | expect(itemBreadcrumbs.innerText.trim()).to.equal("Assets > The Second Asset"); 325 | done(); 326 | }, 10); 327 | }); 328 | 329 | it('truncates breadcrumbs text from the front if too long', (done) => { 330 | browser.favorited = [items[1].children[1].children[1].children[0]]; 331 | favoritedTrigger.click(); 332 | flushAndRender(() => { 333 | const itemEls = Polymer.dom(browser.root).querySelectorAll('px-context-browser-item'); 334 | const favoriteItem = convertNodeListToArray(itemEls).filter(item => item.styleAsFavorite && item.label === 'My Favorite Asset')[0]; 335 | const itemBreadcrumbs = Polymer.dom(favoriteItem.root).querySelector('#breadcrumbs'); 336 | expect(itemBreadcrumbs.innerText.trim()).to.equal("... > The Second Asset > My Very Long Child Asset"); 337 | done(); 338 | }, 10); 339 | }); 340 | 341 | it('breadcrumbs truncation algorithm works as expected', (done) => { 342 | const items = ['US', 'CA', 'Oakland']; 343 | const oneItem = ['Oakland']; 344 | const fontStyles = {size: "15px", family: "\"GE Inspira Sans\", sans-serif"}; 345 | favoritedTrigger.click(); 346 | flush(() => { 347 | const itemEl = Polymer.dom(browser.root).querySelector('px-context-browser-item'); 348 | expect(itemEl._truncateBreadcrumbs(items, fontStyles, 120)).to.equal('US > CA > Oakland'); // width = 117 349 | expect(itemEl._truncateBreadcrumbs(items, fontStyles, 110)).to.equal('... > CA > Oakland'); // width = 108 350 | expect(itemEl._truncateBreadcrumbs(items, fontStyles, 100)).to.equal('... > Oakland'); // width = 76 351 | expect(itemEl._truncateBreadcrumbs(items, fontStyles, 70)).to.equal('... > Oakland'); // end truncation will happen through CSS 352 | expect(itemEl._truncateBreadcrumbs(oneItem, fontStyles, 60)).to.equal('Oakland'); // width = 52 353 | expect(itemEl._truncateBreadcrumbs(oneItem, fontStyles, 50)).to.equal('Oakland'); // end truncation will happen through CSS 354 | done(); 355 | }); 356 | }); 357 | 358 | it('shows a contextual notification in the favorites panel but not the regular context browser if `favoritedSyncFailed` is true', (done) => { 359 | browser.favoritedSyncFailed = true; 360 | favoritedTrigger.click(); 361 | setTimeout(() => { 362 | const contextualNotification = Polymer.dom(browser.root).querySelector('px-context-browser-contextual-notification'); 363 | let contextualNotificationRect = contextualNotification.getBoundingClientRect(); 364 | expect(contextualNotificationRect.left > 0).to.be.true; 365 | expect(contextualNotificationRect.height).to.be.closeTo(80, 5); 366 | openTrigger.click(); 367 | 368 | flushAndRender(() => { 369 | contextualNotificationRect = contextualNotification.getBoundingClientRect(); 370 | expect(contextualNotificationRect.left).to.equal(0); 371 | expect(contextualNotificationRect.height).to.equal(0); 372 | done(); 373 | }, 10); 374 | }, 1000); 375 | }); 376 | 377 | it('fires the `px-app-asset-favorited-sync-requested` event when the contextual notification resync button is tapped', (done) => { 378 | var eventSpy = sinon.spy(); 379 | browser.addEventListener('px-app-asset-favorited-sync-requested', eventSpy); 380 | 381 | browser.favoritedSyncFailed = true; 382 | favoritedTrigger.click(); 383 | setTimeout(() => { 384 | const contextualNotification = Polymer.dom(browser.root).querySelector('px-context-browser-contextual-notification'); 385 | const notification = Polymer.dom(contextualNotification.root).querySelector('px-notification'); 386 | const resyncIcon = Polymer.dom(notification.root).querySelector('.notification-right px-icon'); 387 | console.log(resyncIcon); 388 | 389 | MockInteractions.tap(resyncIcon); 390 | // resyncIcon.click(); 391 | expect(eventSpy).to.have.been.calledOnce; 392 | done(); 393 | }, 600); 394 | }); 395 | 396 | it('updates the panel height to show the correct number of items in the Favorites Panel when new items are favorited', (done) => { 397 | browser.favorited = [items[0], items[1]]; 398 | favoritedTrigger.click(); 399 | 400 | setTimeout(() => { 401 | const panel = Polymer.dom(browser.root).querySelector('#favoritedPanel'); 402 | let panelRect = panel.getBoundingClientRect(); 403 | expect(panelRect.left).to.be.greaterThan(0); 404 | expect(panelRect.height).to.be.closeTo(140, 5); 405 | 406 | browser.favorite(items[1].children[0]); 407 | setTimeout(() => { 408 | let panelRect = panel.getBoundingClientRect(); 409 | expect(panelRect.left).to.be.greaterThan(0); 410 | expect(panelRect.height).to.be.closeTo(200, 5); 411 | done(); 412 | }, 2000); 413 | }, 2000); 414 | }); 415 | 416 | it('updates the panel height to show the correct number of items in the Favorites Panel when items are filtered', (done) => { 417 | browser.favorited = [items[0], items[1], items[1].children[0]]; 418 | browser.showFilter = true; 419 | favoritedTrigger.click(); 420 | 421 | setTimeout(() => { 422 | const panel = Polymer.dom(browser.root).querySelector('#favoritedPanel'); 423 | let panelRect = panel.getBoundingClientRect(); 424 | expect(panelRect.left).to.be.greaterThan(0); 425 | expect(panelRect.height).to.be.closeTo(252, 5); 426 | 427 | browser.favoritedFilter = "h"; 428 | setTimeout(() => { 429 | let panelRect = panel.getBoundingClientRect(); 430 | expect(panelRect.left).to.be.greaterThan(0); 431 | expect(panelRect.height).to.be.closeTo(132, 5); 432 | done(); 433 | }, 2000); 434 | }, 2000); 435 | }); 436 | 437 | }); 438 | --------------------------------------------------------------------------------