dash-button-web 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/dash-button.cjs.entry.js +2549 -0
  3. package/dist/cjs/dash-button.cjs.entry.js.map +1 -0
  4. package/dist/cjs/index-8282b36b.js +1733 -0
  5. package/dist/cjs/index-8282b36b.js.map +1 -0
  6. package/dist/cjs/index.cjs.js +4 -0
  7. package/dist/cjs/index.cjs.js.map +1 -0
  8. package/dist/cjs/loader.cjs.js +15 -0
  9. package/dist/cjs/loader.cjs.js.map +1 -0
  10. package/dist/cjs/web-compnont.cjs.js +25 -0
  11. package/dist/cjs/web-compnont.cjs.js.map +1 -0
  12. package/dist/collection/collection-manifest.json +12 -0
  13. package/dist/collection/components/my-component/dash-button.css +169 -0
  14. package/dist/collection/components/my-component/dash-button.e2e.js +26 -0
  15. package/dist/collection/components/my-component/dash-button.e2e.js.map +1 -0
  16. package/dist/collection/components/my-component/dash-button.js +195 -0
  17. package/dist/collection/components/my-component/dash-button.js.map +1 -0
  18. package/dist/collection/components/my-component/dash-button.spec.js +35 -0
  19. package/dist/collection/components/my-component/dash-button.spec.js.map +1 -0
  20. package/dist/collection/index.js +2 -0
  21. package/dist/collection/index.js.map +1 -0
  22. package/dist/components/dash-button.d.ts +11 -0
  23. package/dist/components/dash-button.js +2574 -0
  24. package/dist/components/dash-button.js.map +1 -0
  25. package/dist/components/index.d.ts +33 -0
  26. package/dist/components/index.js +3 -0
  27. package/dist/components/index.js.map +1 -0
  28. package/dist/esm/dash-button.entry.js +2545 -0
  29. package/dist/esm/dash-button.entry.js.map +1 -0
  30. package/dist/esm/index-2b6c17bc.js +1706 -0
  31. package/dist/esm/index-2b6c17bc.js.map +1 -0
  32. package/dist/esm/index.js +3 -0
  33. package/dist/esm/index.js.map +1 -0
  34. package/dist/esm/loader.js +11 -0
  35. package/dist/esm/loader.js.map +1 -0
  36. package/dist/esm/polyfills/core-js.js +11 -0
  37. package/dist/esm/polyfills/dom.js +79 -0
  38. package/dist/esm/polyfills/es5-html-element.js +1 -0
  39. package/dist/esm/polyfills/index.js +34 -0
  40. package/dist/esm/polyfills/system.js +6 -0
  41. package/dist/esm/web-compnont.js +20 -0
  42. package/dist/esm/web-compnont.js.map +1 -0
  43. package/dist/index.cjs.js +1 -0
  44. package/dist/index.js +1 -0
  45. package/dist/types/components/my-component/dash-button.d.ts +19 -0
  46. package/dist/types/components.d.ts +49 -0
  47. package/dist/types/index.d.ts +1 -0
  48. package/dist/types/stencil-public-runtime.d.ts +1681 -0
  49. package/dist/web-compnont/index.esm.js +2 -0
  50. package/dist/web-compnont/index.esm.js.map +1 -0
  51. package/dist/web-compnont/p-35259f64.js +3 -0
  52. package/dist/web-compnont/p-35259f64.js.map +1 -0
  53. package/dist/web-compnont/p-97a6df2d.entry.js +10 -0
  54. package/dist/web-compnont/p-97a6df2d.entry.js.map +1 -0
  55. package/dist/web-compnont/web-compnont.esm.js +2 -0
  56. package/dist/web-compnont/web-compnont.esm.js.map +1 -0
  57. package/loader/cdn.js +3 -0
  58. package/loader/index.cjs.js +3 -0
  59. package/loader/index.d.ts +21 -0
  60. package/loader/index.es2017.js +3 -0
  61. package/loader/index.js +4 -0
  62. package/loader/package.json +11 -0
  63. package/package.json +41 -0
  64. package/readme.md +124 -0
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+
4
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"file":"index.cjs.js","mappings":";;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-8282b36b.js');
6
+
7
+ const defineCustomElements = (win, options) => {
8
+ if (typeof window === 'undefined') return undefined;
9
+ return index.bootstrapLazy([["dash-button.cjs",[[1,"dash-button",{"showPostLoginText":[4,"show-post-login-text"],"silentCheckSso":[4,"silent-check-sso"],"redirectUri":[1,"redirect-uri"],"keycloakUri":[1,"keycloak-uri"],"realm":[1],"clientId":[1,"client-id"],"keycloak":[32],"isAuth":[32],"givenName":[32],"silentCheckSsoRedirectUri":[32]}]]]], options);
10
+ };
11
+
12
+ exports.setNonce = index.setNonce;
13
+ exports.defineCustomElements = defineCustomElements;
14
+
15
+ //# sourceMappingURL=loader.cjs.js.map
@@ -0,0 +1 @@
1
+ {"file":"loader.cjs.js","mappings":";;;;;;AAGY,MAAC,oBAAoB,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK;AACtD,EAAE,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,OAAO,SAAS,CAAC;AAEtD,EAAE,OAAOA,mBAAa,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;AAC9D;;;;;","names":["bootstrapLazy"],"sources":["@lazy-external-entrypoint?app-data=conditional"],"sourcesContent":["export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\nexport const defineCustomElements = (win, options) => {\n if (typeof window === 'undefined') return undefined;\n globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n};\n"],"version":3}
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-8282b36b.js');
6
+
7
+ /*
8
+ Stencil Client Patch Browser v4.12.0 | MIT Licensed | https://stenciljs.com
9
+ */
10
+ const patchBrowser = () => {
11
+ const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('web-compnont.cjs.js', document.baseURI).href));
12
+ const opts = {};
13
+ if (importMeta !== '') {
14
+ opts.resourcesUrl = new URL('.', importMeta).href;
15
+ }
16
+ return index.promiseResolve(opts);
17
+ };
18
+
19
+ patchBrowser().then(options => {
20
+ return index.bootstrapLazy([["dash-button.cjs",[[1,"dash-button",{"showPostLoginText":[4,"show-post-login-text"],"silentCheckSso":[4,"silent-check-sso"],"redirectUri":[1,"redirect-uri"],"keycloakUri":[1,"keycloak-uri"],"realm":[1],"clientId":[1,"client-id"],"keycloak":[32],"isAuth":[32],"givenName":[32],"silentCheckSsoRedirectUri":[32]}]]]], options);
21
+ });
22
+
23
+ exports.setNonce = index.setNonce;
24
+
25
+ //# sourceMappingURL=web-compnont.cjs.js.map
@@ -0,0 +1 @@
1
+ {"file":"web-compnont.cjs.js","mappings":";;;;;;AAAA;AACA;AACA;AAGA,MAAM,YAAY,GAAG,MAAM;AAa3B,IAAI,MAAM,UAAU,GAAG,8MAAe,CAAC;AACvC,IAAI,MAAM,IAAI,GAAiE,EAAE,CAAC;AAClF,IAAI,IAAI,UAAU,KAAK,EAAE,EAAE;AAC3B,QAAQ,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC;AAC1D,KAAK;AACL,IAAI,OAAOA,oBAAc,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;;ACpBD,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,IAAI;AAE/B,EAAE,OAAOC,mBAAa,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC,CAAC;;;;","names":["promiseResolve","bootstrapLazy"],"sources":["node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v4.12.0 | MIT Licensed | https://stenciljs.com\n */\nimport { BUILD, NAMESPACE } from '@stencil/core/internal/app-data';\nimport { consoleDevInfo, doc, promiseResolve, H } from '@stencil/core';\nconst patchBrowser = () => {\n // NOTE!! This fn cannot use async/await!\n if (BUILD.isDev && !BUILD.isTesting) {\n consoleDevInfo('Running in development mode.');\n }\n if (BUILD.cloneNodeFix) {\n // opted-in to polyfill cloneNode() for slot polyfilled components\n patchCloneNodeFix(H.prototype);\n }\n const scriptElm = BUILD.scriptDataOpts\n ? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\\/${NAMESPACE}(\\\\.esm)?\\\\.js($|\\\\?|#)`).test(s.src) ||\n s.getAttribute('data-stencil-namespace') === NAMESPACE)\n : null;\n const importMeta = import.meta.url;\n const opts = BUILD.scriptDataOpts ? (scriptElm || {})['data-opts'] || {} : {};\n if (importMeta !== '') {\n opts.resourcesUrl = new URL('.', importMeta).href;\n }\n return promiseResolve(opts);\n};\nconst patchCloneNodeFix = (HTMLElementPrototype) => {\n const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;\n HTMLElementPrototype.cloneNode = function (deep) {\n if (this.nodeName === 'TEMPLATE') {\n return nativeCloneNodeFn.call(this, deep);\n }\n const clonedNode = nativeCloneNodeFn.call(this, false);\n const srcChildNodes = this.childNodes;\n if (deep) {\n for (let i = 0; i < srcChildNodes.length; i++) {\n // Node.ATTRIBUTE_NODE === 2, and checking because IE11\n if (srcChildNodes[i].nodeType !== 2) {\n clonedNode.appendChild(srcChildNodes[i].cloneNode(true));\n }\n }\n }\n return clonedNode;\n };\n};\nexport { patchBrowser };\n","export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { patchBrowser } from '@stencil/core/internal/client/patch-browser';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\npatchBrowser().then(options => {\n globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n});\n"],"version":3}
@@ -0,0 +1,12 @@
1
+ {
2
+ "entries": [
3
+ "components/my-component/dash-button.js"
4
+ ],
5
+ "compiler": {
6
+ "name": "@stencil/core",
7
+ "version": "4.12.0",
8
+ "typescriptVersion": "5.3.3"
9
+ },
10
+ "collections": [],
11
+ "bundles": []
12
+ }
@@ -0,0 +1,169 @@
1
+ .button {
2
+ display: flex;
3
+ height: 50px;
4
+ padding: 0;
5
+ background: #3e7671;
6
+ border: none;
7
+ outline: none;
8
+ border-radius: 5px;
9
+ overflow: hidden;
10
+ font-size: 16px;
11
+ font-weight: 500;
12
+ cursor: pointer;
13
+ min-width: 220px;
14
+ max-width: 220px;
15
+ }
16
+
17
+ .button:hover {
18
+ background: #008168;
19
+ }
20
+
21
+ .button:active {
22
+ background: #3e7671;
23
+ }
24
+
25
+ .button-text{
26
+ display: block;
27
+ margin: auto;
28
+ padding: 0 24px;
29
+ color: #fff;
30
+ text-overflow: ellipsis;
31
+ overflow:hidden;
32
+ white-space:nowrap;
33
+ width: 80px;
34
+ }
35
+
36
+ .button-icon {
37
+ margin: auto;
38
+ padding: 10px;
39
+ }
40
+
41
+ .button-profile {
42
+ display: inline-flex;
43
+ align-items: center;
44
+ color: #fff;
45
+ }
46
+
47
+ .button-profile img {
48
+ height: 50px;
49
+ }
50
+
51
+ .button-text-full-width {
52
+ width: auto!important;
53
+ }
54
+
55
+ .button-link {
56
+ text-decoration: none!important;
57
+ }
58
+
59
+ /* Menu icon */
60
+ .gg-menu-grid-r {
61
+ color: #fff;
62
+ box-sizing: border-box;
63
+ position: relative;
64
+ display: block;
65
+ transform: scale(var(--ggs,1));
66
+ width: 16px;
67
+ height: 16px;
68
+ }
69
+
70
+ .gg-menu-grid-r::before {
71
+ content: "";
72
+ display: block;
73
+ box-sizing: border-box;
74
+ position: absolute;
75
+ width: 4px;
76
+ height: 4px;
77
+ background: currentColor;
78
+ box-shadow:
79
+ 0 6px 0,
80
+ 6px 6px 0,
81
+ 12px 6px 0,
82
+ 6px 12px 0,
83
+ 12px 12px 0,
84
+ 6px 0 0,
85
+ 12px 0 0,
86
+ 0 12px 0;
87
+ }
88
+
89
+ /* Drop down section */
90
+ .dropdown {
91
+ position: relative;
92
+ display: inline-block;
93
+ }
94
+
95
+ .dropdown-content {
96
+ display: none;
97
+ position: absolute;
98
+ right: 0;
99
+ background-color: #f9f9f9;
100
+ min-width: 180px;
101
+ box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
102
+ z-index: 1;
103
+ border-radius: 5px;
104
+ }
105
+
106
+ .dropdown-content a {
107
+ color: #71797E;
108
+ padding: 16px 20px;
109
+ text-decoration: none;
110
+ display: block;
111
+ cursor: pointer;
112
+ }
113
+
114
+ .dropdown-content a:hover {
115
+ background-color: #f1f1f1;
116
+ color: #000;
117
+ opacity: 0.7;
118
+ }
119
+
120
+ .dropdown:hover .dropdown-content {
121
+ display: block;
122
+ }
123
+
124
+
125
+ /* Modal Content */
126
+ .modal {
127
+ display: none;
128
+ position: fixed;
129
+ z-index: 1;
130
+ padding-top: 100px;
131
+ left: 0;
132
+ top: 0;
133
+ width: 100%;
134
+ height: 100%;
135
+ overflow: auto;
136
+ background-color: rgb(0,0,0);
137
+ background-color: rgba(0,0,0,0.4);
138
+ text-align: center;
139
+ }
140
+
141
+
142
+ .modal-content {
143
+ background-color: #fefefe;
144
+ margin: auto;
145
+ padding: 20px;
146
+ border: 1px solid #888;
147
+ width: 40%;
148
+ }
149
+
150
+ .close {
151
+ color: #aaaaaa;
152
+ float: right;
153
+ font-size: 28px;
154
+ font-weight: bold;
155
+ }
156
+
157
+ .close:hover,
158
+ .close:focus {
159
+ color: #000;
160
+ text-decoration: none;
161
+ cursor: pointer;
162
+ }
163
+
164
+ .modal-app {
165
+ background-color: #c3e9bc;
166
+ padding: 15px;
167
+ margin: 10px;
168
+ border-radius: 5px;
169
+ }
@@ -0,0 +1,26 @@
1
+ import { newE2EPage } from "@stencil/core/testing";
2
+ describe('dash-button', () => {
3
+ it('renders', async () => {
4
+ const page = await newE2EPage();
5
+ await page.setContent('<dash-button></dash-button>');
6
+ const element = await page.find('dash-button');
7
+ expect(element).toHaveClass('hydrated');
8
+ });
9
+ it('renders changes to the name data', async () => {
10
+ const page = await newE2EPage();
11
+ await page.setContent('<dash-button></dash-button>');
12
+ const component = await page.find('dash-button');
13
+ const element = await page.find('dash-button >>> div');
14
+ expect(element.textContent).toEqual(`Hello, World! I'm `);
15
+ component.setProperty('first', 'James');
16
+ await page.waitForChanges();
17
+ expect(element.textContent).toEqual(`Hello, World! I'm James`);
18
+ component.setProperty('last', 'Quincy');
19
+ await page.waitForChanges();
20
+ expect(element.textContent).toEqual(`Hello, World! I'm James Quincy`);
21
+ component.setProperty('middle', 'Earl');
22
+ await page.waitForChanges();
23
+ expect(element.textContent).toEqual(`Hello, World! I'm James Earl Quincy`);
24
+ });
25
+ });
26
+ //# sourceMappingURL=dash-button.e2e.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dash-button.e2e.js","sourceRoot":"","sources":["../../../src/components/my-component/dash-button.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QACvB,MAAM,IAAI,GAAG,MAAM,UAAU,EAAE,CAAC;QAEhC,MAAM,IAAI,CAAC,UAAU,CAAC,6BAA6B,CAAC,CAAC;QACrD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC/C,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;QAChD,MAAM,IAAI,GAAG,MAAM,UAAU,EAAE,CAAC;QAEhC,MAAM,IAAI,CAAC,UAAU,CAAC,6BAA6B,CAAC,CAAC;QACrD,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACjD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QACvD,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;QAE1D,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAC5B,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;QAE/D,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACxC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAC5B,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC;QAEtE,SAAS,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACxC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAC5B,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,qCAAqC,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newE2EPage } from '@stencil/core/testing';\n\ndescribe('dash-button', () => {\n it('renders', async () => {\n const page = await newE2EPage();\n\n await page.setContent('<dash-button></dash-button>');\n const element = await page.find('dash-button');\n expect(element).toHaveClass('hydrated');\n });\n\n it('renders changes to the name data', async () => {\n const page = await newE2EPage();\n\n await page.setContent('<dash-button></dash-button>');\n const component = await page.find('dash-button');\n const element = await page.find('dash-button >>> div');\n expect(element.textContent).toEqual(`Hello, World! I'm `);\n\n component.setProperty('first', 'James');\n await page.waitForChanges();\n expect(element.textContent).toEqual(`Hello, World! I'm James`);\n\n component.setProperty('last', 'Quincy');\n await page.waitForChanges();\n expect(element.textContent).toEqual(`Hello, World! I'm James Quincy`);\n\n component.setProperty('middle', 'Earl');\n await page.waitForChanges();\n expect(element.textContent).toEqual(`Hello, World! I'm James Earl Quincy`);\n });\n});\n"]}
@@ -0,0 +1,195 @@
1
+ import { h } from "@stencil/core";
2
+ import Keycloak from "keycloak-js";
3
+ export class DashButtonComponent {
4
+ constructor() {
5
+ this.showPostLoginText = false;
6
+ this.silentCheckSso = false;
7
+ this.redirectUri = undefined;
8
+ this.keycloakUri = "http://localhost:8080";
9
+ this.realm = "";
10
+ this.clientId = "";
11
+ this.keycloak = new Keycloak({
12
+ url: this.keycloakUri,
13
+ realm: this.realm,
14
+ clientId: this.clientId,
15
+ });
16
+ this.isAuth = false;
17
+ this.givenName = "";
18
+ this.silentCheckSsoRedirectUri = window.location.origin + '/assets/verificar-sso.html';
19
+ }
20
+ ;
21
+ connectedCallback() {
22
+ this.keycloak.init({
23
+ onLoad: 'check-sso',
24
+ checkLoginIframe: false,
25
+ silentCheckSsoRedirectUri: this.silentCheckSso ? this.silentCheckSsoRedirectUri : '',
26
+ }).then(res => {
27
+ if (res) {
28
+ this.isAuth = true;
29
+ localStorage.setItem("keycloak", JSON.stringify(this.keycloak));
30
+ this.givenName = JSON.parse(localStorage.getItem('keycloak')).idTokenParsed.given_name;
31
+ }
32
+ });
33
+ }
34
+ login() {
35
+ this.keycloak.login();
36
+ }
37
+ logout() {
38
+ localStorage.removeItem("keycloak");
39
+ this.keycloak.logout();
40
+ }
41
+ showModal() {
42
+ const appModal = this.el.shadowRoot.querySelector('#appListModal');
43
+ appModal.style.display = "block";
44
+ }
45
+ closeModal() {
46
+ const appModal = this.el.shadowRoot.querySelector('#appListModal');
47
+ appModal.style.display = "none";
48
+ }
49
+ render() {
50
+ return h("div", { key: '29a7944051bce29ea8ff3f1db8f2b44b5a157e84' }, h("div", { key: 'a44011e412f06a00bca1a6de134391cc1eb248c2' }, (() => {
51
+ if (this.isAuth && this.showPostLoginText) {
52
+ return (h("a", { href: this.redirectUri, id: "login-btn", class: "button button-link" }, h("span", { class: "button-text button-text-full-width" }, "Go to Dashboard")));
53
+ }
54
+ else if (this.isAuth) {
55
+ return (h("div", { id: "profile-btn", class: "dropdown" }, h("button", { type: "button", class: "button" }, h("span", { class: "button-profile" }, h("img", { src: "https://i.pravatar.cc/100?img=32", alt: "" })), h("span", { id: "given-name", class: "button-text" }, this.givenName), h("div", { class: "button-icon" }, h("span", { class: "gg-menu-grid-r" }))), h("div", { class: "dropdown-content" }, h("a", { onClick: this.showModal.bind(this), id: "applications-btn" }, "Applications"), h("a", { onClick: this.logout.bind(this), id: "logout-btn" }, "Logout"))));
56
+ }
57
+ else {
58
+ return (h("button", { onClick: this.login.bind(this), id: "login-btn", type: "button", class: "button" }, h("span", { class: "button-text" }, "Login")));
59
+ }
60
+ })()), h("div", { key: '475cbe51090c78848032e9044c9f11e460969121', id: "appListModal", class: "modal" }, h("div", { key: 'e0a2a1ffa3de0d45001f40fb46d258ade64dc933', class: "modal-content" }, h("span", { key: '5fa70d2fcac6816d9a9ee41c329bd9c787014cbb', onClick: this.closeModal.bind(this), class: "close" }, "\u00D7"), h("h3", { key: 'de74b78ba75d815758e0d7c68474d7cdb7673ae7' }, "Applications"), h("div", { key: '1ed88b256cb82aef902f08179e24cbd0be810bd9', class: "modal-app" }, "App 1"), h("div", { key: 'e3e32a260fa06452fb38e64e4593cae1d8530c7b', class: "modal-app" }, "App 2"))));
61
+ }
62
+ static get is() { return "dash-button"; }
63
+ static get encapsulation() { return "shadow"; }
64
+ static get originalStyleUrls() {
65
+ return {
66
+ "$": ["dash-button.css"]
67
+ };
68
+ }
69
+ static get styleUrls() {
70
+ return {
71
+ "$": ["dash-button.css"]
72
+ };
73
+ }
74
+ static get properties() {
75
+ return {
76
+ "showPostLoginText": {
77
+ "type": "boolean",
78
+ "mutable": false,
79
+ "complexType": {
80
+ "original": "boolean",
81
+ "resolved": "boolean",
82
+ "references": {}
83
+ },
84
+ "required": false,
85
+ "optional": false,
86
+ "docs": {
87
+ "tags": [],
88
+ "text": ""
89
+ },
90
+ "attribute": "show-post-login-text",
91
+ "reflect": false,
92
+ "defaultValue": "false"
93
+ },
94
+ "silentCheckSso": {
95
+ "type": "boolean",
96
+ "mutable": false,
97
+ "complexType": {
98
+ "original": "boolean",
99
+ "resolved": "boolean",
100
+ "references": {}
101
+ },
102
+ "required": false,
103
+ "optional": false,
104
+ "docs": {
105
+ "tags": [],
106
+ "text": ""
107
+ },
108
+ "attribute": "silent-check-sso",
109
+ "reflect": false,
110
+ "defaultValue": "false"
111
+ },
112
+ "redirectUri": {
113
+ "type": "string",
114
+ "mutable": false,
115
+ "complexType": {
116
+ "original": "string",
117
+ "resolved": "string",
118
+ "references": {}
119
+ },
120
+ "required": false,
121
+ "optional": false,
122
+ "docs": {
123
+ "tags": [],
124
+ "text": ""
125
+ },
126
+ "attribute": "redirect-uri",
127
+ "reflect": false
128
+ },
129
+ "keycloakUri": {
130
+ "type": "string",
131
+ "mutable": false,
132
+ "complexType": {
133
+ "original": "string",
134
+ "resolved": "string",
135
+ "references": {}
136
+ },
137
+ "required": false,
138
+ "optional": false,
139
+ "docs": {
140
+ "tags": [],
141
+ "text": ""
142
+ },
143
+ "attribute": "keycloak-uri",
144
+ "reflect": false,
145
+ "defaultValue": "\"http://localhost:8080\""
146
+ },
147
+ "realm": {
148
+ "type": "string",
149
+ "mutable": false,
150
+ "complexType": {
151
+ "original": "string",
152
+ "resolved": "string",
153
+ "references": {}
154
+ },
155
+ "required": false,
156
+ "optional": false,
157
+ "docs": {
158
+ "tags": [],
159
+ "text": ""
160
+ },
161
+ "attribute": "realm",
162
+ "reflect": false,
163
+ "defaultValue": "\"\""
164
+ },
165
+ "clientId": {
166
+ "type": "string",
167
+ "mutable": false,
168
+ "complexType": {
169
+ "original": "string",
170
+ "resolved": "string",
171
+ "references": {}
172
+ },
173
+ "required": false,
174
+ "optional": false,
175
+ "docs": {
176
+ "tags": [],
177
+ "text": ""
178
+ },
179
+ "attribute": "client-id",
180
+ "reflect": false,
181
+ "defaultValue": "\"\""
182
+ }
183
+ };
184
+ }
185
+ static get states() {
186
+ return {
187
+ "keycloak": {},
188
+ "isAuth": {},
189
+ "givenName": {},
190
+ "silentCheckSsoRedirectUri": {}
191
+ };
192
+ }
193
+ static get elementRef() { return "el"; }
194
+ }
195
+ //# sourceMappingURL=dash-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dash-button.js","sourceRoot":"","sources":["../../../src/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AAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,kBAAkB,mBAAiB;4BAC7E,SAAG,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,YAAY,aAAW,CAC5D,CACF,CACL,CAAA;gBACL,CAAC;qBAAM,CAAC;oBACN,OAAO,CACL,cAAQ,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,WAAW,EAAC,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,QAAQ;wBACjF,YAAM,KAAK,EAAC,aAAa,YAAa,CAC/B,CACV,CAAA;gBACH,CAAC;YACP,CAAC,CAAC,EAAE,CAEJ;YAEN,4DAAK,EAAE,EAAC,cAAc,EAAC,KAAK,EAAC,OAAO;gBAElC,4DAAK,KAAK,EAAC,eAAe;oBACxB,6DAAM,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAC,OAAO,aAAe;oBACvE,4EAAqB;oBACrB,4DAAK,KAAK,EAAC,WAAW,YAAY;oBAClC,4DAAK,KAAK,EAAC,WAAW,YAAY,CAC9B,CAEF,CACF,CAAC;IACP,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, State, h, Element } from '@stencil/core';\nimport Keycloak from \"keycloak-js\";\n\n\n@Component({\n tag: 'dash-button',\n styleUrl: 'dash-button.css',\n shadow: true,\n})\nexport class DashButtonComponent {\n\n @Element() el;\n \n @Prop() showPostLoginText: boolean = false;\n @Prop() silentCheckSso: boolean = false;\n @Prop() redirectUri: string;\n\n @Prop() keycloakUri: string = \"http://localhost:8080\";\n @Prop() realm: string = \"\";\n @Prop() clientId: string = \"\";\n\n @State() keycloak: any = new Keycloak({\n url: this.keycloakUri,\n realm: this.realm,\n clientId: this.clientId,\n });;\n\n @State() isAuth = false;\n @State() givenName: string = \"\";\n @State() silentCheckSsoRedirectUri: string = window.location.origin + '/assets/verificar-sso.html';\n\n connectedCallback() {\n this.keycloak.init(\n {\n onLoad: 'check-sso',\n checkLoginIframe: false,\n silentCheckSsoRedirectUri: this.silentCheckSso ? this.silentCheckSsoRedirectUri : '',\n }).then(res => {\n if(res) {\n this.isAuth = true\n localStorage.setItem(\"keycloak\", JSON.stringify(this.keycloak));\n\n this.givenName = JSON.parse(localStorage.getItem('keycloak')).idTokenParsed.given_name\n } \n \n });\n\n }\n\n login() { \n this.keycloak.login() \n }\n\n logout() {\n localStorage.removeItem(\"keycloak\");\n this.keycloak.logout() \n } \n\n showModal() {\n const appModal = this.el.shadowRoot.querySelector('#appListModal');\n appModal.style.display = \"block\";\n }\n\n closeModal() {\n const appModal = this.el.shadowRoot.querySelector('#appListModal');\n appModal.style.display = \"none\";\n }\n\n render() {\n return <div>\n <div>\n {\n (() => {\n if(this.isAuth && this.showPostLoginText) {\n return (\n <a href={this.redirectUri} id=\"login-btn\" class=\"button button-link\">\n <span class=\"button-text button-text-full-width\">Go to Dashboard</span>\n </a>\n )\n } else if (this.isAuth) {\n return (\n <div id=\"profile-btn\" class=\"dropdown\">\n <button type=\"button\" class=\"button\">\n <span class=\"button-profile\">\n <img src=\"https://i.pravatar.cc/100?img=32\" alt=\"\"/>\n </span>\n <span id=\"given-name\" class=\"button-text\">{this.givenName}</span>\n <div class=\"button-icon\">\n <span class=\"gg-menu-grid-r\"></span>\n </div>\n </button>\n <div class=\"dropdown-content\">\n <a onClick={this.showModal.bind(this)} id=\"applications-btn\">Applications</a>\n <a onClick={this.logout.bind(this)} id=\"logout-btn\">Logout</a>\n </div>\n </div>\n )\n } else {\n return (\n <button onClick={this.login.bind(this)} id=\"login-btn\" type=\"button\" class=\"button\">\n <span class=\"button-text\">Login</span>\n </button>\n )\n }\n })() \n } \n </div>\n \n <div id=\"appListModal\" class=\"modal\">\n \n <div class=\"modal-content\">\n <span onClick={this.closeModal.bind(this)} class=\"close\">&times;</span>\n <h3>Applications</h3>\n <div class=\"modal-app\">App 1</div>\n <div class=\"modal-app\">App 2</div>\n </div>\n \n </div>\n </div>;\n }\n}\n"]}
@@ -0,0 +1,35 @@
1
+ import { newSpecPage } from "@stencil/core/testing";
2
+ import { DashButtonComponent } from "./dash-button";
3
+ describe('dash-button', () => {
4
+ it('renders', async () => {
5
+ const { root } = await newSpecPage({
6
+ components: [DashButtonComponent],
7
+ html: '<dash-button></dash-button>',
8
+ });
9
+ expect(root).toEqualHtml(`
10
+ <dash-button>
11
+ <mock:shadow-root>
12
+ <div>
13
+ Hello, World! I'm
14
+ </div>
15
+ </mock:shadow-root>
16
+ </dash-button>
17
+ `);
18
+ });
19
+ it('renders with values', async () => {
20
+ const { root } = await newSpecPage({
21
+ components: [DashButtonComponent],
22
+ html: `<dash-button first="Stencil" last="'Don't call me a framework' JS"></dash-button>`,
23
+ });
24
+ expect(root).toEqualHtml(`
25
+ <dash-button first="Stencil" last="'Don't call me a framework' JS">
26
+ <mock:shadow-root>
27
+ <div>
28
+ Hello, World! I'm Stencil 'Don't call me a framework' JS
29
+ </div>
30
+ </mock:shadow-root>
31
+ </dash-button>
32
+ `);
33
+ });
34
+ });
35
+ //# sourceMappingURL=dash-button.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dash-button.spec.js","sourceRoot":"","sources":["../../../src/components/my-component/dash-button.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QACvB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,WAAW,CAAC;YACjC,UAAU,EAAE,CAAC,mBAAmB,CAAC;YACjC,IAAI,EAAE,6BAA6B;SACpC,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;KAQxB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;QACnC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,WAAW,CAAC;YACjC,UAAU,EAAE,CAAC,mBAAmB,CAAC;YACjC,IAAI,EAAE,mFAAmF;SAC1F,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;KAQxB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { DashButtonComponent } from './dash-button';\n\ndescribe('dash-button', () => {\n it('renders', async () => {\n const { root } = await newSpecPage({\n components: [DashButtonComponent],\n html: '<dash-button></dash-button>',\n });\n expect(root).toEqualHtml(`\n <dash-button>\n <mock:shadow-root>\n <div>\n Hello, World! I'm\n </div>\n </mock:shadow-root>\n </dash-button>\n `);\n });\n\n it('renders with values', async () => {\n const { root } = await newSpecPage({\n components: [DashButtonComponent],\n html: `<dash-button first=\"Stencil\" last=\"'Don't call me a framework' JS\"></dash-button>`,\n });\n expect(root).toEqualHtml(`\n <dash-button first=\"Stencil\" last=\"'Don't call me a framework' JS\">\n <mock:shadow-root>\n <div>\n Hello, World! I'm Stencil 'Don't call me a framework' JS\n </div>\n </mock:shadow-root>\n </dash-button>\n `);\n });\n});\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './components';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC","sourcesContent":["export * from './components';\n"]}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface DashButton extends Components.DashButton, HTMLElement {}
4
+ export const DashButton: {
5
+ prototype: DashButton;
6
+ new (): DashButton;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;