@nyaruka/temba-components 0.52.2 → 0.53.0

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.
package/dist/sw.js CHANGED
@@ -1,2 +1,2 @@
1
- if(!self.define){let e,t={};const o=(o,n)=>(o=new URL(o+".js",n).href,t[o]||new Promise((t=>{if("document"in self){const e=document.createElement("script");e.src=o,e.onload=t,document.head.appendChild(e)}else e=o,importScripts(o),t()})).then((()=>{let e=t[o];if(!e)throw new Error(`Module ${o} didn’t register its module`);return e})));self.define=(n,s)=>{const i=e||("document"in self?document.currentScript.src:"")||location.href;if(t[i])return;let r={};const d=e=>o(e,i),l={module:{uri:i},exports:r,require:d};t[i]=Promise.all(n.map((e=>l[e]||d(e)))).then((e=>(s(...e),r)))}}define(["./workbox-919adfb7"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"8cd40058.js",revision:"39d8729192153916f2b1629f115e267d"},{url:"templates/components-body.html",revision:"fbd4b5de506b70c9f1658f3dc2d9d66c"},{url:"templates/components-head.html",revision:"265f022b3a980549c4a480f148d383ec"}],{}),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"))),e.registerRoute("polyfills/*.js",new e.CacheFirst,"GET")}));
1
+ if(!self.define){let e,t={};const o=(o,n)=>(o=new URL(o+".js",n).href,t[o]||new Promise((t=>{if("document"in self){const e=document.createElement("script");e.src=o,e.onload=t,document.head.appendChild(e)}else e=o,importScripts(o),t()})).then((()=>{let e=t[o];if(!e)throw new Error(`Module ${o} didn’t register its module`);return e})));self.define=(n,s)=>{const i=e||("document"in self?document.currentScript.src:"")||location.href;if(t[i])return;let r={};const l=e=>o(e,i),f={module:{uri:i},exports:r,require:l};t[i]=Promise.all(n.map((e=>f[e]||l(e)))).then((e=>(s(...e),r)))}}define(["./workbox-919adfb7"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"0fd963e1.js",revision:"599a8884032e255f92a7def9f0f25ad2"},{url:"templates/components-body.html",revision:"4e10e0d4acbb976dc67ddf31fc80faa2"},{url:"templates/components-head.html",revision:"72b89371e44b8ab7eff290e0c7a39a0e"}],{}),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"))),e.registerRoute("polyfills/*.js",new e.CacheFirst,"GET")}));
2
2
  //# sourceMappingURL=sw.js.map
package/dist/sw.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sw.js","sources":["../../../../../tmp/ccb598d328f783f4d1902e48555bdc1b/sw.js"],"sourcesContent":["import {registerRoute as workbox_routing_registerRoute} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-routing/registerRoute.mjs';\nimport {CacheFirst as workbox_strategies_CacheFirst} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-strategies/CacheFirst.mjs';\nimport {clientsClaim as workbox_core_clientsClaim} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-core/clientsClaim.mjs';\nimport {precacheAndRoute as workbox_precaching_precacheAndRoute} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-precaching/precacheAndRoute.mjs';\nimport {NavigationRoute as workbox_routing_NavigationRoute} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-routing/NavigationRoute.mjs';\nimport {createHandlerBoundToURL as workbox_precaching_createHandlerBoundToURL} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-precaching/createHandlerBoundToURL.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\n\n\n\n\n\n\nself.skipWaiting();\n\nworkbox_core_clientsClaim();\n\n\n/**\n * The precacheAndRoute() method efficiently caches and responds to\n * requests for URLs in the manifest.\n * See https://goo.gl/S9QRab\n */\nworkbox_precaching_precacheAndRoute([\n {\n \"url\": \"8cd40058.js\",\n \"revision\": \"39d8729192153916f2b1629f115e267d\"\n },\n {\n \"url\": \"templates/components-body.html\",\n \"revision\": \"fbd4b5de506b70c9f1658f3dc2d9d66c\"\n },\n {\n \"url\": \"templates/components-head.html\",\n \"revision\": \"265f022b3a980549c4a480f148d383ec\"\n }\n], {});\n\nworkbox_routing_registerRoute(new workbox_routing_NavigationRoute(workbox_precaching_createHandlerBoundToURL(\"/index.html\")));\n\n\nworkbox_routing_registerRoute(\"polyfills/*.js\", new workbox_strategies_CacheFirst(), 'GET');\n\n\n\n\n"],"names":["self","skipWaiting","workbox_core_clientsClaim","workbox_precaching_precacheAndRoute","url","revision","workbox","registerRoute","workbox_routing_NavigationRoute","workbox_precaching_createHandlerBoundToURL","workbox_strategies_CacheFirst"],"mappings":"0nBAwBAA,KAAKC,cAELC,EAAAA,eAQAC,EAAAA,iBAAoC,CAClC,CACEC,IAAO,cACPC,SAAY,oCAEd,CACED,IAAO,iCACPC,SAAY,oCAEd,CACED,IAAO,iCACPC,SAAY,qCAEb,CAAE,GAEwBC,EAAAC,cAAC,IAAIC,EAAAA,gBAAgCC,EAAAA,wBAA2C,iBAGhFH,EAAAC,cAAC,iBAAkB,IAAIG,aAAiC"}
1
+ {"version":3,"file":"sw.js","sources":["../../../../../tmp/b8655df738033f48dbc356c776da1d95/sw.js"],"sourcesContent":["import {registerRoute as workbox_routing_registerRoute} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-routing/registerRoute.mjs';\nimport {CacheFirst as workbox_strategies_CacheFirst} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-strategies/CacheFirst.mjs';\nimport {clientsClaim as workbox_core_clientsClaim} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-core/clientsClaim.mjs';\nimport {precacheAndRoute as workbox_precaching_precacheAndRoute} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-precaching/precacheAndRoute.mjs';\nimport {NavigationRoute as workbox_routing_NavigationRoute} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-routing/NavigationRoute.mjs';\nimport {createHandlerBoundToURL as workbox_precaching_createHandlerBoundToURL} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-precaching/createHandlerBoundToURL.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\n\n\n\n\n\n\nself.skipWaiting();\n\nworkbox_core_clientsClaim();\n\n\n/**\n * The precacheAndRoute() method efficiently caches and responds to\n * requests for URLs in the manifest.\n * See https://goo.gl/S9QRab\n */\nworkbox_precaching_precacheAndRoute([\n {\n \"url\": \"0fd963e1.js\",\n \"revision\": \"599a8884032e255f92a7def9f0f25ad2\"\n },\n {\n \"url\": \"templates/components-body.html\",\n \"revision\": \"4e10e0d4acbb976dc67ddf31fc80faa2\"\n },\n {\n \"url\": \"templates/components-head.html\",\n \"revision\": \"72b89371e44b8ab7eff290e0c7a39a0e\"\n }\n], {});\n\nworkbox_routing_registerRoute(new workbox_routing_NavigationRoute(workbox_precaching_createHandlerBoundToURL(\"/index.html\")));\n\n\nworkbox_routing_registerRoute(\"polyfills/*.js\", new workbox_strategies_CacheFirst(), 'GET');\n\n\n\n\n"],"names":["self","skipWaiting","workbox_core_clientsClaim","workbox_precaching_precacheAndRoute","url","revision","workbox","registerRoute","workbox_routing_NavigationRoute","workbox_precaching_createHandlerBoundToURL","workbox_strategies_CacheFirst"],"mappings":"0nBAwBAA,KAAKC,cAELC,EAAAA,eAQAC,EAAAA,iBAAoC,CAClC,CACEC,IAAO,cACPC,SAAY,oCAEd,CACED,IAAO,iCACPC,SAAY,oCAEd,CACED,IAAO,iCACPC,SAAY,qCAEb,CAAE,GAEwBC,EAAAC,cAAC,IAAIC,EAAAA,gBAAgCC,EAAAA,wBAA2C,iBAGhFH,EAAAC,cAAC,iBAAkB,IAAIG,aAAiC"}
@@ -1 +1 @@
1
- <script type="module" src="{{STATIC_URL}}@nyaruka/temba-components/dist/8cd40058.js"></script><script>window.TEMBA_COMPONENTS_VERSION="0.52.2"</script>
1
+ <script type="module" src="{{STATIC_URL}}@nyaruka/temba-components/dist/0fd963e1.js"></script><script>window.TEMBA_COMPONENTS_VERSION="0.53.0"</script>
@@ -1 +1 @@
1
- <link rel="modulepreload" href="{{STATIC_URL}}@nyaruka/temba-components/dist/8cd40058.js" crossorigin="anonymous">
1
+ <link rel="modulepreload" href="{{STATIC_URL}}@nyaruka/temba-components/dist/0fd963e1.js" crossorigin="anonymous">
@@ -251,4 +251,7 @@ __decorate([
251
251
  __decorate([
252
252
  property({ type: String })
253
253
  ], Button.prototype, "href", void 0);
254
+ __decorate([
255
+ property({ type: Number })
256
+ ], Button.prototype, "index", void 0);
254
257
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/button/Button.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAkB,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,OAAO,MAAO,SAAQ,UAAU;IAAtC;;QA2JE,MAAC,GAAG,CAAC,CAAC;IAiGR,CAAC;IA3PC,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4IT,CAAC;IACJ,CAAC;IAsCO,WAAW,CAAC,GAAe;QACjC,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,GAAG,CAAC,cAAc,EAAE,CAA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AQ;YAChC,eAAe,EAAE,IAAI,CAAC,MAAM;YAC5B,kBAAkB,EAAE,IAAI,CAAC,SAAS;YAClC,oBAAoB,EAAE,IAAI,CAAC,WAAW;YACtC,cAAc,EAAE,IAAI,CAAC,KAAK;YAC1B,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC;;qBAEW,IAAI,CAAC,eAAe;mBACtB,IAAI,CAAC,aAAa;sBACf,IAAI,CAAC,aAAa;iBACvB,IAAI,CAAC,WAAW;iBAChB,IAAI,CAAC,WAAW;;;qCAGI,UAAU;;;KAG1C,CAAC;IACJ,CAAC;CACF;AA1GC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uCACX;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCACT;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCACT;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iCACrB;AAGN;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CACP;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qCACb;AAGf;IADC,QAAQ,EAAE;oCACE;AAGb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wCACV;AAGlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CACR;AAGpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sCACZ;AAGhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qCACb;AAGf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oCACd","sourcesContent":["import { LitElement, TemplateResult, html, css } from 'lit';\nimport { getClasses } from '../utils';\n\nimport { property } from 'lit/decorators.js';\n\nexport class Button extends LitElement {\n static get styles() {\n return css`\n :host {\n display: inline-block;\n font-family: var(--font-family);\n font-weight: 400;\n }\n\n .small {\n font-size: 0.8em;\n --button-y: 0px;\n --button-x: 0.5em;\n }\n\n .v-2.button-container {\n background: var(--button-bg);\n background-image: var(--button-bg-img);\n color: var(--button-text);\n box-shadow: var(--button-shadow);\n transition: all calc(var(--transition-speed) / 2) ease-in;\n }\n\n .button-container {\n color: #fff;\n cursor: pointer;\n display: block;\n border-radius: var(--curvature);\n outline: none;\n transition: background ease-in var(--transition-speed);\n user-select: none;\n -webkit-user-select: none;\n text-align: center;\n }\n\n .button-name {\n white-space: nowrap;\n }\n\n .secondary-button:hover .button-mask {\n border: 1px solid var(--color-button-secondary);\n }\n\n .button-mask:hover {\n background: rgba(0, 0, 0, 0.05);\n }\n\n .button-container:focus {\n outline: none;\n margin: 0;\n }\n\n .button-container:focus {\n box-shadow: var(--widget-box-shadow-focused);\n }\n\n .button-container.secondary-button:focus .button-mask {\n background: transparent;\n }\n\n .button-mask {\n padding: var(--button-y) var(--button-x);\n border-radius: var(--curvature);\n border: 1px solid transparent;\n transition: var(--transition-speed);\n background: var(--button-mask);\n }\n\n .button-container.disabled-button {\n background: rgba(0, 0, 0, 0.05);\n color: rgba(255, 255, 255, 0.45);\n cursor: default;\n }\n\n .button-container.disabled-button .button-mask {\n box-shadow: 0 0 0px 1px var(--color-button-disabled);\n }\n\n .button-container.disabled-button:hover .button-mask {\n box-shadow: 0 0 0px 1px var(--color-button-disabled);\n background: rgba(0, 0, 0, 0.05);\n }\n\n .button-container.active-button .button-mask {\n }\n\n .secondary-button.active-button {\n background: transparent;\n color: var(--color-text);\n }\n\n .secondary-button.active-button .button-mask {\n border: none;\n }\n\n .button-container.secondary-button.active-button:focus .button-mask {\n background: transparent;\n box-shadow: none;\n }\n\n .primary-button {\n background: var(--color-button-primary);\n color: var(--color-button-primary-text);\n }\n\n .light-button {\n background: var(--color-button-light);\n color: var(--color-button-light-text);\n }\n\n .attention-button {\n background: var(--color-button-attention);\n color: var(--color-button-primary-text);\n }\n\n .secondary-button {\n background: transparent;\n color: var(--color-text);\n font-weight: 300;\n }\n\n .destructive-button {\n background: var(--color-button-destructive);\n color: var(--color-button-destructive-text);\n }\n\n .button-mask.disabled-button {\n background: rgba(0, 0, 0, 0.1);\n }\n\n .secondary-button .button-mask:hover {\n background: transparent;\n }\n\n .submit-animation {\n padding: 1px 4px;\n }\n\n .submit-animation temba-loading {\n margin-bottom: -3px;\n line-height: normal;\n }\n `;\n }\n\n @property({ type: Boolean })\n primary: boolean;\n\n @property({ type: Boolean })\n secondary: boolean;\n\n @property({ type: Boolean })\n attention: boolean;\n\n @property({ type: Number })\n v = 1;\n\n @property({ type: Boolean })\n destructive: boolean;\n\n @property({ type: Boolean })\n light: boolean;\n\n @property()\n name: string;\n\n @property({ type: Boolean })\n disabled: boolean;\n\n @property({ type: Boolean })\n submitting: boolean;\n\n @property({ type: Boolean })\n active: boolean;\n\n @property({ type: Boolean })\n small: boolean;\n\n @property({ type: String })\n href: string;\n\n private handleClick(evt: MouseEvent) {\n if (this.disabled) {\n evt.preventDefault();\n evt.stopPropagation();\n }\n\n if (this.href && !this.disabled) {\n this.ownerDocument.location.href = this.href;\n evt.preventDefault();\n evt.stopPropagation();\n }\n }\n\n private handleKeyUp(event: KeyboardEvent): void {\n this.active = false;\n if (event.key === 'Enter') {\n this.click();\n }\n }\n\n private handleMouseDown(): void {\n if (!this.disabled && !this.submitting) {\n this.active = true;\n this.classList.add('active');\n }\n }\n\n private handleMouseUp(): void {\n this.active = false;\n this.classList.remove('active');\n }\n\n public render(): TemplateResult {\n const buttonName = this.submitting\n ? html`<div class=\"submit-animation\">\n <temba-loading units=\"3\" size=\"8\" color=\"#eee\"></temba-loading>\n </div>`\n : this.name;\n\n return html`\n <div\n class=\"button-container \n v-${this.v}\n ${getClasses({\n 'primary-button':\n this.primary ||\n (!this.primary &&\n !this.secondary &&\n !this.attention &&\n this.v == 1),\n 'secondary-button': this.secondary,\n 'disabled-button': this.disabled,\n 'active-button': this.active,\n 'attention-button': this.attention,\n 'destructive-button': this.destructive,\n 'light-button': this.light,\n small: this.small,\n })}\"\n tabindex=\"0\"\n @mousedown=${this.handleMouseDown}\n @mouseup=${this.handleMouseUp}\n @mouseleave=${this.handleMouseUp}\n @keyup=${this.handleKeyUp}\n @click=${this.handleClick}\n >\n <div class=\"button-mask\">\n <div class=\"button-name\">${buttonName}</div>\n </div>\n </div>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/button/Button.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAkB,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,OAAO,MAAO,SAAQ,UAAU;IAAtC;;QA2JE,MAAC,GAAG,CAAC,CAAC;IAoGR,CAAC;IA9PC,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4IT,CAAC;IACJ,CAAC;IAyCO,WAAW,CAAC,GAAe;QACjC,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,GAAG,CAAC,cAAc,EAAE,CAAC;YACrB,GAAG,CAAC,eAAe,EAAE,CAAC;SACvB;QAED,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAC/B,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;YAC7C,GAAG,CAAC,cAAc,EAAE,CAAC;YACrB,GAAG,CAAC,e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C,aAAa;sBACf,IAAI,CAAC,aAAa;iBACvB,IAAI,CAAC,WAAW;iBAChB,IAAI,CAAC,WAAW;;;qCAGI,UAAU;;;KAG1C,CAAC;IACJ,CAAC;CACF;AA7GC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uCACX;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCACT;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCACT;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iCACrB;AAGN;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CACP;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qCACb;AAGf;IADC,QAAQ,EAAE;oCACE;AAGb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wCACV;AAGlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CACR;AAGpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sCACZ;AAGhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qCACb;AAGf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oCACd;AAGb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCACZ","sourcesContent":["import { LitElement, TemplateResult, html, css } from 'lit';\nimport { getClasses } from '../utils';\n\nimport { property } from 'lit/decorators.js';\n\nexport class Button extends LitElement {\n static get styles() {\n return css`\n :host {\n display: inline-block;\n font-family: var(--font-family);\n font-weight: 400;\n }\n\n .small {\n font-size: 0.8em;\n --button-y: 0px;\n --button-x: 0.5em;\n }\n\n .v-2.button-container {\n background: var(--button-bg);\n background-image: var(--button-bg-img);\n color: var(--button-text);\n box-shadow: var(--button-shadow);\n transition: all calc(var(--transition-speed) / 2) ease-in;\n }\n\n .button-container {\n color: #fff;\n cursor: pointer;\n display: block;\n border-radius: var(--curvature);\n outline: none;\n transition: background ease-in var(--transition-speed);\n user-select: none;\n -webkit-user-select: none;\n text-align: center;\n }\n\n .button-name {\n white-space: nowrap;\n }\n\n .secondary-button:hover .button-mask {\n border: 1px solid var(--color-button-secondary);\n }\n\n .button-mask:hover {\n background: rgba(0, 0, 0, 0.05);\n }\n\n .button-container:focus {\n outline: none;\n margin: 0;\n }\n\n .button-container:focus {\n box-shadow: var(--widget-box-shadow-focused);\n }\n\n .button-container.secondary-button:focus .button-mask {\n background: transparent;\n }\n\n .button-mask {\n padding: var(--button-y) var(--button-x);\n border-radius: var(--curvature);\n border: 1px solid transparent;\n transition: var(--transition-speed);\n background: var(--button-mask);\n }\n\n .button-container.disabled-button {\n background: rgba(0, 0, 0, 0.05);\n color: rgba(255, 255, 255, 0.45);\n cursor: default;\n }\n\n .button-container.disabled-button .button-mask {\n box-shadow: 0 0 0px 1px var(--color-button-disabled);\n }\n\n .button-container.disabled-button:hover .button-mask {\n box-shadow: 0 0 0px 1px var(--color-button-disabled);\n background: rgba(0, 0, 0, 0.05);\n }\n\n .button-container.active-button .button-mask {\n }\n\n .secondary-button.active-button {\n background: transparent;\n color: var(--color-text);\n }\n\n .secondary-button.active-button .button-mask {\n border: none;\n }\n\n .button-container.secondary-button.active-button:focus .button-mask {\n background: transparent;\n box-shadow: none;\n }\n\n .primary-button {\n background: var(--color-button-primary);\n color: var(--color-button-primary-text);\n }\n\n .light-button {\n background: var(--color-button-light);\n color: var(--color-button-light-text);\n }\n\n .attention-button {\n background: var(--color-button-attention);\n color: var(--color-button-primary-text);\n }\n\n .secondary-button {\n background: transparent;\n color: var(--color-text);\n font-weight: 300;\n }\n\n .destructive-button {\n background: var(--color-button-destructive);\n color: var(--color-button-destructive-text);\n }\n\n .button-mask.disabled-button {\n background: rgba(0, 0, 0, 0.1);\n }\n\n .secondary-button .button-mask:hover {\n background: transparent;\n }\n\n .submit-animation {\n padding: 1px 4px;\n }\n\n .submit-animation temba-loading {\n margin-bottom: -3px;\n line-height: normal;\n }\n `;\n }\n\n @property({ type: Boolean })\n primary: boolean;\n\n @property({ type: Boolean })\n secondary: boolean;\n\n @property({ type: Boolean })\n attention: boolean;\n\n @property({ type: Number })\n v = 1;\n\n @property({ type: Boolean })\n destructive: boolean;\n\n @property({ type: Boolean })\n light: boolean;\n\n @property()\n name: string;\n\n @property({ type: Boolean })\n disabled: boolean;\n\n @property({ type: Boolean })\n submitting: boolean;\n\n @property({ type: Boolean })\n active: boolean;\n\n @property({ type: Boolean })\n small: boolean;\n\n @property({ type: String })\n href: string;\n\n @property({ type: Number })\n index?: number;\n\n private handleClick(evt: MouseEvent) {\n if (this.disabled) {\n evt.preventDefault();\n evt.stopPropagation();\n }\n\n if (this.href && !this.disabled) {\n this.ownerDocument.location.href = this.href;\n evt.preventDefault();\n evt.stopPropagation();\n }\n }\n\n private handleKeyUp(event: KeyboardEvent): void {\n this.active = false;\n if (event.key === 'Enter') {\n this.click();\n }\n }\n\n private handleMouseDown(): void {\n if (!this.disabled && !this.submitting) {\n this.active = true;\n this.classList.add('active');\n }\n }\n\n private handleMouseUp(): void {\n this.active = false;\n this.classList.remove('active');\n }\n\n public render(): TemplateResult {\n const buttonName = this.submitting\n ? html`<div class=\"submit-animation\">\n <temba-loading units=\"3\" size=\"8\" color=\"#eee\"></temba-loading>\n </div>`\n : this.name;\n\n return html`\n <div\n class=\"button-container \n v-${this.v}\n ${getClasses({\n 'primary-button':\n this.primary ||\n (!this.primary &&\n !this.secondary &&\n !this.attention &&\n this.v == 1),\n 'secondary-button': this.secondary,\n 'disabled-button': this.disabled,\n 'active-button': this.active,\n 'attention-button': this.attention,\n 'destructive-button': this.destructive,\n 'light-button': this.light,\n small: this.small,\n })}\"\n tabindex=\"0\"\n @mousedown=${this.handleMouseDown}\n @mouseup=${this.handleMouseUp}\n @mouseleave=${this.handleMouseUp}\n @keyup=${this.handleKeyUp}\n @click=${this.handleClick}\n >\n <div class=\"button-mask\">\n <div class=\"button-name\">${buttonName}</div>\n </div>\n </div>\n `;\n }\n}\n"]}
@@ -5,6 +5,14 @@ import { RapidElement } from '../RapidElement';
5
5
  import { CustomEventType } from '../interfaces';
6
6
  import { styleMap } from 'lit-html/directives/style-map.js';
7
7
  import { getClasses } from '../utils';
8
+ export var ButtonType;
9
+ (function (ButtonType) {
10
+ ButtonType["PRIMARY"] = "primary";
11
+ ButtonType["SECONDARY"] = "secondary";
12
+ ButtonType["DESTRUCTIVE"] = "destructive";
13
+ })(ButtonType || (ButtonType = {}));
14
+ export class DialogButton {
15
+ }
8
16
  export class Dialog extends RapidElement {
9
17
  static get widths() {
10
18
  return {
@@ -22,6 +30,10 @@ export class Dialog extends RapidElement {
22
30
  background: white;
23
31
  }
24
32
 
33
+ .flex-grow {
34
+ flex-grow: 1;
35
+ }
36
+
25
37
  .flex {
26
38
  display: flex;
27
39
  flex-direction: column;
@@ -97,6 +109,9 @@ export class Dialog extends RapidElement {
97
109
  }
98
110
 
99
111
  .header-text {
112
+ display: flex;
113
+ flex-direction: row;
114
+ align-items: center;
100
115
  font-size: 20px;
101
116
  padding: 12px 20px;
102
117
  font-weight: 300;
@@ -104,11 +119,21 @@ export class Dialog extends RapidElement {
104
119
  background: var(--header-bg);
105
120
  }
106
121
 
122
+ .header-text .title {
123
+ flex-grow: 1;
124
+ }
125
+
126
+ .header-text .status {
127
+ font-size: 0.6em;
128
+ font-weight: bold;
129
+ }
130
+
107
131
  .dialog-footer {
108
132
  background: var(--color-primary-light);
109
133
  padding: 10px;
110
134
  display: flex;
111
- flex-flow: row-reverse;
135
+ flex-flow: row;
136
+ align-items: center;
112
137
  }
113
138
 
114
139
  temba-button {
@@ -154,8 +179,24 @@ export class Dialog extends RapidElement {
154
179
  this.cancelButtonName = 'Cancel';
155
180
  this.width = null;
156
181
  this.submittingName = 'Saving';
182
+ this.buttons = [];
157
183
  this.scrollOffset = 0;
158
184
  }
185
+ firstUpdated(changes) {
186
+ if (changes.has('cancelButtonName') && this.cancelButtonName) {
187
+ this.buttons.push({
188
+ name: this.cancelButtonName,
189
+ type: ButtonType.SECONDARY,
190
+ closes: true,
191
+ });
192
+ }
193
+ if (changes.has('primaryButtonName') && this.primaryButtonName) {
194
+ this.buttons.push({
195
+ name: this.primaryButtonName,
196
+ type: ButtonType.PRIMARY,
197
+ });
198
+ }
199
+ }
159
200
  updated(changedProperties) {
160
201
  if (changedProperties.has('open')) {
161
202
  const body = document.querySelector('body');
@@ -214,8 +255,12 @@ export class Dialog extends RapidElement {
214
255
  handleClick(evt) {
215
256
  const button = evt.currentTarget;
216
257
  if (!button.disabled) {
217
- this.fireCustomEvent(CustomEventType.ButtonClicked, { button });
218
- if (button.name === this.cancelButtonName) {
258
+ let detail = {};
259
+ if (button.index >= 0 && button.index < this.buttons.length) {
260
+ detail = this.buttons[button.index];
261
+ }
262
+ this.fireCustomEvent(CustomEventType.ButtonClicked, { button, detail });
263
+ if (button.name === this.cancelButtonName || (detail && detail.closes)) {
219
264
  this.open = false;
220
265
  }
221
266
  }
@@ -269,7 +314,9 @@ export class Dialog extends RapidElement {
269
314
  const header = this.header
270
315
  ? html `
271
316
  <div class="dialog-header">
272
- <div class="header-text">${this.header}</div>
317
+ <div class="header-text">
318
+ <div class="title">${this.header}</div>
319
+ </div>
273
320
  </div>
274
321
  `
275
322
  : null;
@@ -307,24 +354,21 @@ export class Dialog extends RapidElement {
307
354
  </div>
308
355
 
309
356
  <div class="dialog-footer">
310
- ${this.primaryButtonName
311
- ? html `
312
- <temba-button
313
- @click=${this.handleClick}
314
- .name=${this.primaryButtonName}
315
- ?destructive=${this.destructive}
316
- ?primary=${!this.destructive}
317
- ?submitting=${this.submitting}
318
- ?disabled=${this.disabled}
319
- >}</temba-button
320
- >
321
- `
322
- : null}
323
- <temba-button
324
- @click=${this.handleClick}
325
- name=${this.cancelButtonName}
326
- secondary
327
- ></temba-button>
357
+ <div class="flex-grow">
358
+ <slot name="gutter"></slot>
359
+ </div>
360
+ ${this.buttons.map((button, index) => html `
361
+ <temba-button
362
+ name=${button.name}
363
+ ?destructive=${button.type == 'primary' && this.destructive}
364
+ ?primary=${button.type == 'primary' && !this.destructive}
365
+ ?secondary=${button.type == 'secondary'}
366
+ ?submitting=${this.submitting}
367
+ ?disabled=${this.disabled}
368
+ index=${index}
369
+ @click=${this.handleClick}
370
+ ></temba-button>
371
+ `)}
328
372
  </div>
329
373
  </div>
330
374
  <div class="grow-bottom"></div>
@@ -382,6 +426,9 @@ __decorate([
382
426
  __decorate([
383
427
  property()
384
428
  ], Dialog.prototype, "ready", void 0);
429
+ __decorate([
430
+ property({ type: Array })
431
+ ], Dialog.prototype, "buttons", void 0);
385
432
  __decorate([
386
433
  property({ attribute: false })
387
434
  ], Dialog.prototype, "onButtonClicked", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/dialog/Dialog.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAkB,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,OAAO,MAAO,SAAQ,YAAY;IACtC,MAAM,KAAK,MAAM;QACf,OAAO;YACL,KAAK,EAAE,OAAO;YACd,MAAM,EAAE,OAAO;YACf,KAAK,EAAE,OAAO;SACf,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AE,KAAK,EAAE,CAAC;+CACW","sourcesContent":["import { property } from 'lit/decorators.js';\nimport { TemplateResult, html, css } from 'lit';\nimport { Button } from '../button/Button';\nimport { RapidElement } from '../RapidElement';\nimport { CustomEventType } from '../interfaces';\nimport { styleMap } from 'lit-html/directives/style-map.js';\nimport { getClasses } from '../utils';\n\nexport class Dialog extends RapidElement {\n static get widths(): { [size: string]: string } {\n return {\n small: '400px',\n medium: '600px',\n large: '655px',\n };\n }\n\n static get styles() {\n return css`\n :host {\n position: absolute;\n z-index: 10000;\n font-family: var(--font-family);\n background: white;\n }\n\n .flex {\n display: flex;\n flex-direction: column;\n width: 100%;\n position: relative;\n left: 0px;\n top: 0px;\n align-items: center;\n height: 100vh;\n }\n\n .grow-top {\n flex-grow: 1;\n }\n\n .grow-bottom {\n flex-grow: 3;\n }\n\n .bottom-padding {\n padding: 3rem;\n }\n\n .dialog-mask {\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.5);\n opacity: 0;\n position: fixed;\n top: 0px;\n left: 0px;\n transition: opacity linear calc(var(--transition-speed) / 2ms);\n pointer-events: none;\n }\n\n .dialog-mask .dialog-container {\n position: relative;\n transition: transform var(--transition-speed) var(--bounce),\n opacity ease-in-out calc(var(--transition-speed) - 50ms);\n border-radius: var(--curvature);\n box-shadow: 0px 0px 2px 4px rgba(0, 0, 0, 0.06);\n overflow: hidden;\n transform: scale(0.9) translatey(2em);\n background: white;\n margin: auto;\n }\n\n .dialog-body {\n background: #fff;\n max-height: 75vh;\n overflow-y: auto;\n }\n\n .dialog-mask.dialog-open {\n opacity: 1;\n pointer-events: auto;\n }\n\n .dialog-mask.dialog-open .dialog-container {\n top: inherit;\n }\n\n .dialog-mask.dialog-animation-end .dialog-container {\n transform: scale(1) !important;\n }\n\n .dialog-mask.dialog-ready .dialog-container {\n transform: none;\n }\n\n .dialog-mask.dialog-loading .dialog-container {\n margin-top: -10000px;\n }\n\n .header-text {\n font-size: 20px;\n padding: 12px 20px;\n font-weight: 300;\n color: var(--header-text);\n background: var(--header-bg);\n }\n\n .dialog-footer {\n background: var(--color-primary-light);\n padding: 10px;\n display: flex;\n flex-flow: row-reverse;\n }\n\n temba-button {\n margin-left: 10px;\n }\n\n .dialog-body temba-loading {\n position: absolute;\n right: 12px;\n margin-top: -30px;\n padding-bottom: 9px;\n display: none;\n }\n\n #page-loader {\n text-align: center;\n display: block;\n position: relative;\n opacity: 0;\n margin: auto;\n margin-top: 30px;\n width: 154px;\n transition: opacity calc(var(--transition-speed) * 5ms) ease-in\n calc(var(--transition-speed * 2));\n visibility: hidden;\n }\n\n .dialog-mask.dialog-loading #page-loader {\n opacity: 1;\n visibility: visible;\n }\n\n #submit-loader {\n flex-grow: 1;\n text-align: right;\n }\n `;\n }\n\n @property({ type: Boolean })\n open: boolean;\n\n @property()\n header: string;\n\n @property()\n body: string;\n\n @property({ type: Boolean })\n submitting: boolean;\n\n @property({ type: Boolean })\n destructive: boolean;\n\n @property({ type: Boolean })\n disabled: boolean;\n\n @property({ type: Boolean })\n loading: boolean;\n\n @property({ type: Boolean })\n hideOnClick: boolean;\n\n @property({ type: Boolean })\n noFocus: boolean;\n\n @property()\n size = 'medium';\n\n @property({ type: String })\n primaryButtonName = 'Ok';\n\n @property({ type: String })\n cancelButtonName = 'Cancel';\n\n @property({ type: String })\n width = null;\n\n @property()\n submittingName = 'Saving';\n\n @property()\n animationEnd: boolean;\n\n @property()\n ready: boolean;\n\n @property({ attribute: false })\n onButtonClicked: (button: Button) => void;\n\n scrollOffset: any = 0;\n\n public constructor() {\n super();\n }\n\n public updated(changedProperties: Map<string, any>) {\n if (changedProperties.has('open')) {\n const body = document.querySelector('body');\n\n if (this.open) {\n this.animationEnd = true;\n window.setTimeout(() => {\n this.ready = true;\n this.animationEnd = false;\n }, 400);\n\n this.scrollOffset = -document.documentElement.scrollTop;\n body.style.position = 'fixed';\n body.style.overflowY = 'scroll';\n body.style.top = this.scrollOffset + 'px';\n body.style.width = '100%';\n body.style.overflowY = 'hidden';\n } else {\n body.style.position = '';\n body.style.overflowY = '';\n body.style.width = '';\n body.style.marginRight = '';\n body.style.paddingRight = '0px';\n window.scrollTo(0, parseInt(this.scrollOffset || '0') * -1);\n }\n\n // make sure our buttons aren't in progress on show\n if (this.open && !changedProperties.get('open')) {\n this.shadowRoot\n .querySelectorAll('temba-button')\n .forEach((button: Button) => {\n if (button) button.submitting = false;\n });\n\n if (!this.noFocus) {\n this.focusFirstInput();\n }\n } else {\n window.setTimeout(() => {\n this.ready = false;\n }, 400);\n }\n }\n }\n\n public focusFirstInput(): void {\n window.setTimeout(() => {\n let input = this.querySelector(\n 'temba-textinput, temba-completion, input[type=\"text\"], textarea'\n ) as any;\n if (input) {\n input = input.textInputElement || input.inputElement || input;\n if (!input.readOnly) {\n input.focus();\n input.click();\n }\n }\n }, 100);\n }\n\n public handleClick(evt: MouseEvent) {\n const button = evt.currentTarget as Button;\n if (!button.disabled) {\n this.fireCustomEvent(CustomEventType.ButtonClicked, { button });\n if (button.name === this.cancelButtonName) {\n this.open = false;\n }\n }\n }\n\n private getDocumentHeight(): number {\n const body = document.body;\n const html = document.documentElement;\n return Math.max(\n body.scrollHeight,\n body.offsetHeight,\n html.clientHeight,\n html.scrollHeight,\n html.offsetHeight\n );\n }\n\n private clickCancel() {\n const cancel = this.getCancelButton();\n if (cancel) {\n cancel.click();\n }\n }\n\n public getCancelButton(): Button {\n return this.shadowRoot.querySelector(\n `temba-button[name='${this.cancelButtonName}']`\n );\n }\n\n public getPrimaryButton(): Button {\n return this.shadowRoot.querySelector(`temba-button[primary]`);\n }\n\n private handleKeyUp(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n this.clickCancel();\n }\n }\n\n private handleClickMask(event: MouseEvent) {\n if (this.hideOnClick) {\n const id = (event.target as HTMLElement).id;\n if (id === 'dialog-mask' || id === 'dialog-bg') {\n this.fireCustomEvent(CustomEventType.DialogHidden);\n this.clickCancel();\n }\n }\n }\n\n public show(): void {\n this.open = true;\n }\n\n public hide(): void {\n this.open = false;\n }\n\n public render(): TemplateResult {\n const dialogStyle = {\n width: this.width,\n minWidth: '250px',\n maxWidth: '600px',\n };\n if (!this.width) {\n dialogStyle['width'] = Dialog.widths[this.size];\n }\n\n const header = this.header\n ? html`\n <div class=\"dialog-header\">\n <div class=\"header-text\">${this.header}</div>\n </div>\n `\n : null;\n\n return html`\n <div\n id=\"dialog-mask\"\n @click=${this.handleClickMask}\n class=\"dialog-mask ${getClasses({\n 'dialog-open': this.open,\n 'dialog-loading': this.loading,\n 'dialog-animation-end': this.animationEnd,\n 'dialog-ready': this.ready,\n })}\"\n >\n <div style=\"position: absolute; width: 100%;\">\n <temba-loading\n id=\"page-loader\"\n units=\"6\"\n size=\"12\"\n color=\"#ccc\"\n ></temba-loading>\n </div>\n\n <div class=\"flex\">\n <div class=\"grow-top\"></div>\n <div\n @keyup=${this.handleKeyUp}\n style=${styleMap(dialogStyle)}\n class=\"dialog-container\"\n >\n ${header}\n <div class=\"dialog-body\" @keypress=${this.handleKeyUp}>\n ${this.body ? this.body : html`<slot></slot>`}\n <temba-loading units=\"6\" size=\"8\"></temba-loading>\n </div>\n\n <div class=\"dialog-footer\">\n ${\n this.primaryButtonName\n ? html`\n <temba-button\n @click=${this.handleClick}\n .name=${this.primaryButtonName}\n ?destructive=${this.destructive}\n ?primary=${!this.destructive}\n ?submitting=${this.submitting}\n ?disabled=${this.disabled}\n >}</temba-button\n >\n `\n : null\n }\n <temba-button\n @click=${this.handleClick}\n name=${this.cancelButtonName}\n secondary\n ></temba-button>\n </div>\n </div>\n <div class=\"grow-bottom\"></div>\n </div>\n </div>\n </div>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/dialog/Dialog.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAkB,IAAI,EAAE,GAAG,EAAoB,MAAM,KAAK,CAAC;AAElE,OAAO,EAAE,YA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;AAGhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDACF;AAGzB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDACC;AAG5B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCACd;AAGb;IADC,QAAQ,EAAE;8CACe;AAG1B;IADC,QAAQ,EAAE;4CACW;AAGtB;IADC,QAAQ,EAAE;qCACI;AAGf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;uCACG;AAG7B;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+CACW","sourcesContent":["import { property } from 'lit/decorators.js';\nimport { TemplateResult, html, css, PropertyValueMap } from 'lit';\nimport { Button } from '../button/Button';\nimport { RapidElement } from '../RapidElement';\nimport { CustomEventType } from '../interfaces';\nimport { styleMap } from 'lit-html/directives/style-map.js';\nimport { getClasses } from '../utils';\n\nexport enum ButtonType {\n PRIMARY = 'primary',\n SECONDARY = 'secondary',\n DESTRUCTIVE = 'destructive',\n}\nexport class DialogButton {\n name?: string;\n id?: string;\n details?: any;\n type?: string;\n closes?: boolean;\n}\n\nexport class Dialog extends RapidElement {\n static get widths(): { [size: string]: string } {\n return {\n small: '400px',\n medium: '600px',\n large: '655px',\n };\n }\n\n static get styles() {\n return css`\n :host {\n position: absolute;\n z-index: 10000;\n font-family: var(--font-family);\n background: white;\n }\n\n .flex-grow {\n flex-grow: 1;\n }\n\n .flex {\n display: flex;\n flex-direction: column;\n width: 100%;\n position: relative;\n left: 0px;\n top: 0px;\n align-items: center;\n height: 100vh;\n }\n\n .grow-top {\n flex-grow: 1;\n }\n\n .grow-bottom {\n flex-grow: 3;\n }\n\n .bottom-padding {\n padding: 3rem;\n }\n\n .dialog-mask {\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.5);\n opacity: 0;\n position: fixed;\n top: 0px;\n left: 0px;\n transition: opacity linear calc(var(--transition-speed) / 2ms);\n pointer-events: none;\n }\n\n .dialog-mask .dialog-container {\n position: relative;\n transition: transform var(--transition-speed) var(--bounce),\n opacity ease-in-out calc(var(--transition-speed) - 50ms);\n border-radius: var(--curvature);\n box-shadow: 0px 0px 2px 4px rgba(0, 0, 0, 0.06);\n overflow: hidden;\n transform: scale(0.9) translatey(2em);\n background: white;\n margin: auto;\n }\n\n .dialog-body {\n background: #fff;\n max-height: 75vh;\n overflow-y: auto;\n }\n\n .dialog-mask.dialog-open {\n opacity: 1;\n pointer-events: auto;\n }\n\n .dialog-mask.dialog-open .dialog-container {\n top: inherit;\n }\n\n .dialog-mask.dialog-animation-end .dialog-container {\n transform: scale(1) !important;\n }\n\n .dialog-mask.dialog-ready .dialog-container {\n transform: none;\n }\n\n .dialog-mask.dialog-loading .dialog-container {\n margin-top: -10000px;\n }\n\n .header-text {\n display: flex;\n flex-direction: row;\n align-items: center;\n font-size: 20px;\n padding: 12px 20px;\n font-weight: 300;\n color: var(--header-text);\n background: var(--header-bg);\n }\n\n .header-text .title {\n flex-grow: 1;\n }\n\n .header-text .status {\n font-size: 0.6em;\n font-weight: bold;\n }\n\n .dialog-footer {\n background: var(--color-primary-light);\n padding: 10px;\n display: flex;\n flex-flow: row;\n align-items: center;\n }\n\n temba-button {\n margin-left: 10px;\n }\n\n .dialog-body temba-loading {\n position: absolute;\n right: 12px;\n margin-top: -30px;\n padding-bottom: 9px;\n display: none;\n }\n\n #page-loader {\n text-align: center;\n display: block;\n position: relative;\n opacity: 0;\n margin: auto;\n margin-top: 30px;\n width: 154px;\n transition: opacity calc(var(--transition-speed) * 5ms) ease-in\n calc(var(--transition-speed * 2));\n visibility: hidden;\n }\n\n .dialog-mask.dialog-loading #page-loader {\n opacity: 1;\n visibility: visible;\n }\n\n #submit-loader {\n flex-grow: 1;\n text-align: right;\n }\n `;\n }\n\n @property({ type: Boolean })\n open: boolean;\n\n @property()\n header: string;\n\n @property()\n body: string;\n\n @property({ type: Boolean })\n submitting: boolean;\n\n @property({ type: Boolean })\n destructive: boolean;\n\n @property({ type: Boolean })\n disabled: boolean;\n\n @property({ type: Boolean })\n loading: boolean;\n\n @property({ type: Boolean })\n hideOnClick: boolean;\n\n @property({ type: Boolean })\n noFocus: boolean;\n\n @property()\n size = 'medium';\n\n @property({ type: String })\n primaryButtonName = 'Ok';\n\n @property({ type: String })\n cancelButtonName = 'Cancel';\n\n @property({ type: String })\n width = null;\n\n @property()\n submittingName = 'Saving';\n\n @property()\n animationEnd: boolean;\n\n @property()\n ready: boolean;\n\n @property({ type: Array })\n buttons: DialogButton[] = [];\n\n @property({ attribute: false })\n onButtonClicked: (button: Button) => void;\n\n scrollOffset: any = 0;\n\n public constructor() {\n super();\n }\n\n protected firstUpdated(\n changes: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n if (changes.has('cancelButtonName') && this.cancelButtonName) {\n this.buttons.push({\n name: this.cancelButtonName,\n type: ButtonType.SECONDARY,\n closes: true,\n });\n }\n\n if (changes.has('primaryButtonName') && this.primaryButtonName) {\n this.buttons.push({\n name: this.primaryButtonName,\n type: ButtonType.PRIMARY,\n });\n }\n }\n\n public updated(changedProperties: Map<string, any>) {\n if (changedProperties.has('open')) {\n const body = document.querySelector('body');\n\n if (this.open) {\n this.animationEnd = true;\n window.setTimeout(() => {\n this.ready = true;\n this.animationEnd = false;\n }, 400);\n\n this.scrollOffset = -document.documentElement.scrollTop;\n body.style.position = 'fixed';\n body.style.overflowY = 'scroll';\n body.style.top = this.scrollOffset + 'px';\n body.style.width = '100%';\n body.style.overflowY = 'hidden';\n } else {\n body.style.position = '';\n body.style.overflowY = '';\n body.style.width = '';\n body.style.marginRight = '';\n body.style.paddingRight = '0px';\n window.scrollTo(0, parseInt(this.scrollOffset || '0') * -1);\n }\n\n // make sure our buttons aren't in progress on show\n if (this.open && !changedProperties.get('open')) {\n this.shadowRoot\n .querySelectorAll('temba-button')\n .forEach((button: Button) => {\n if (button) button.submitting = false;\n });\n\n if (!this.noFocus) {\n this.focusFirstInput();\n }\n } else {\n window.setTimeout(() => {\n this.ready = false;\n }, 400);\n }\n }\n }\n\n public focusFirstInput(): void {\n window.setTimeout(() => {\n let input = this.querySelector(\n 'temba-textinput, temba-completion, input[type=\"text\"], textarea'\n ) as any;\n if (input) {\n input = input.textInputElement || input.inputElement || input;\n if (!input.readOnly) {\n input.focus();\n input.click();\n }\n }\n }, 100);\n }\n\n public handleClick(evt: MouseEvent) {\n const button = evt.currentTarget as Button;\n if (!button.disabled) {\n let detail: DialogButton = {};\n if (button.index >= 0 && button.index < this.buttons.length) {\n detail = this.buttons[button.index];\n }\n\n this.fireCustomEvent(CustomEventType.ButtonClicked, { button, detail });\n if (button.name === this.cancelButtonName || (detail && detail.closes)) {\n this.open = false;\n }\n }\n }\n\n private getDocumentHeight(): number {\n const body = document.body;\n const html = document.documentElement;\n return Math.max(\n body.scrollHeight,\n body.offsetHeight,\n html.clientHeight,\n html.scrollHeight,\n html.offsetHeight\n );\n }\n\n private clickCancel() {\n const cancel = this.getCancelButton();\n if (cancel) {\n cancel.click();\n }\n }\n\n public getCancelButton(): Button {\n return this.shadowRoot.querySelector(\n `temba-button[name='${this.cancelButtonName}']`\n );\n }\n\n public getPrimaryButton(): Button {\n return this.shadowRoot.querySelector(`temba-button[primary]`);\n }\n\n private handleKeyUp(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n this.clickCancel();\n }\n }\n\n private handleClickMask(event: MouseEvent) {\n if (this.hideOnClick) {\n const id = (event.target as HTMLElement).id;\n if (id === 'dialog-mask' || id === 'dialog-bg') {\n this.fireCustomEvent(CustomEventType.DialogHidden);\n this.clickCancel();\n }\n }\n }\n\n public show(): void {\n this.open = true;\n }\n\n public hide(): void {\n this.open = false;\n }\n\n public render(): TemplateResult {\n const dialogStyle = {\n width: this.width,\n minWidth: '250px',\n maxWidth: '600px',\n };\n if (!this.width) {\n dialogStyle['width'] = Dialog.widths[this.size];\n }\n\n const header = this.header\n ? html`\n <div class=\"dialog-header\">\n <div class=\"header-text\">\n <div class=\"title\">${this.header}</div>\n </div>\n </div>\n `\n : null;\n\n return html`\n <div\n id=\"dialog-mask\"\n @click=${this.handleClickMask}\n class=\"dialog-mask ${getClasses({\n 'dialog-open': this.open,\n 'dialog-loading': this.loading,\n 'dialog-animation-end': this.animationEnd,\n 'dialog-ready': this.ready,\n })}\"\n >\n <div style=\"position: absolute; width: 100%;\">\n <temba-loading\n id=\"page-loader\"\n units=\"6\"\n size=\"12\"\n color=\"#ccc\"\n ></temba-loading>\n </div>\n\n <div class=\"flex\">\n <div class=\"grow-top\"></div>\n <div\n @keyup=${this.handleKeyUp}\n style=${styleMap(dialogStyle)}\n class=\"dialog-container\"\n >\n ${header}\n <div class=\"dialog-body\" @keypress=${this.handleKeyUp}>\n ${this.body ? this.body : html`<slot></slot>`}\n <temba-loading units=\"6\" size=\"8\"></temba-loading>\n </div>\n\n <div class=\"dialog-footer\">\n <div class=\"flex-grow\">\n <slot name=\"gutter\"></slot>\n </div>\n ${this.buttons.map(\n (button: DialogButton, index) => html`\n <temba-button\n name=${button.name}\n ?destructive=${button.type == 'primary' && this.destructive}\n ?primary=${button.type == 'primary' && !this.destructive}\n ?secondary=${button.type == 'secondary'}\n ?submitting=${this.submitting}\n ?disabled=${this.disabled}\n index=${index}\n @click=${this.handleClick}\n ></temba-button>\n `\n )}\n </div>\n </div>\n <div class=\"grow-bottom\"></div>\n </div>\n </div>\n </div>\n `;\n }\n}\n"]}
@@ -3,8 +3,9 @@ import { html, css } from 'lit';
3
3
  import { property } from 'lit/decorators.js';
4
4
  import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
5
5
  import { RapidElement } from '../RapidElement';
6
- import { getUrl, serialize, postUrl } from '../utils';
6
+ import { getUrl, serialize, postUrl, getClasses } from '../utils';
7
7
  import { CustomEventType } from '../interfaces';
8
+ import { ButtonType } from './Dialog';
8
9
  export class Modax extends RapidElement {
9
10
  constructor() {
10
11
  super(...arguments);
@@ -14,6 +15,9 @@ export class Modax extends RapidElement {
14
15
  this.headers = {};
15
16
  this.body = this.getLoading();
16
17
  this.disabled = false;
18
+ this.buttons = [];
19
+ this.wizardStep = 0;
20
+ this.wizardStepCount = 0;
17
21
  this.suspendSubmit = false;
18
22
  }
19
23
  static get styles() {
@@ -32,6 +36,11 @@ export class Modax extends RapidElement {
32
36
  display: none;
33
37
  }
34
38
 
39
+ button[type='submit'],
40
+ input[type='submit'] {
41
+ display: none;
42
+ }
43
+
35
44
  .modax-body {
36
45
  padding: 20px;
37
46
  display: block;
@@ -75,6 +84,33 @@ export class Modax extends RapidElement {
75
84
  border-radius: 6px;
76
85
  font-weight: 300;
77
86
  }
87
+
88
+ .step-ball {
89
+ background: rgba(var(--primary-rgb), 0.2);
90
+ width: 1.2em;
91
+ height: 1.2em;
92
+ border-radius: 100%;
93
+ margin-right: 0.5em;
94
+ border: 0.15em solid transparent;
95
+ }
96
+
97
+ .step-ball.complete {
98
+ background: rgba(var(--primary-rgb), 0.7);
99
+ cursor: pointer;
100
+ }
101
+ .step-ball.complete:hover {
102
+ background: rgba(var(--primary-rgb), 0.8);
103
+ }
104
+
105
+ .step-ball.active {
106
+ border: 0.15em solid var(--color-primary-dark);
107
+ }
108
+
109
+ .wizard-steps {
110
+ display: flex;
111
+ flex-direction: row;
112
+ margin-left: 0.6em;
113
+ }
78
114
  `;
79
115
  }
80
116
  // private cancelToken: CancelTokenSource;
@@ -114,16 +150,24 @@ export class Modax extends RapidElement {
114
150
  return html `<temba-loading units="6" size="8"></temba-loading>`;
115
151
  }
116
152
  updatePrimaryButton() {
153
+ const wizard = this.shadowRoot.querySelector('#wizard-form');
154
+ if (wizard) {
155
+ this.wizardStep = parseInt(wizard.dataset.step);
156
+ this.wizardStepCount = parseInt(wizard.dataset.steps);
157
+ }
117
158
  if (!this.noSubmit) {
118
159
  this.updateComplete.then(() => {
119
- const submitButton = this.shadowRoot.querySelector("input[type='submit']");
160
+ const submitButton = this.shadowRoot.querySelector("input[type='submit'],button[type='submit']");
120
161
  if (submitButton) {
121
- this.primaryName = submitButton.value;
122
- this.cancelName = 'Cancel';
162
+ this.buttons = [
163
+ { type: ButtonType.SECONDARY, name: 'Cancel', closes: true },
164
+ { type: ButtonType.PRIMARY, name: submitButton.value },
165
+ ];
123
166
  }
124
167
  else {
125
- this.primaryName = null;
126
- this.cancelName = 'Ok';
168
+ this.buttons = [
169
+ { type: ButtonType.SECONDARY, name: 'Ok', closes: true },
170
+ ];
127
171
  }
128
172
  this.submitting = false;
129
173
  });
@@ -183,20 +227,35 @@ export class Modax extends RapidElement {
183
227
  this.fetching = true;
184
228
  this.body = this.getLoading();
185
229
  getUrl(this.endpoint, null, this.getHeaders()).then((response) => {
186
- this.setBody(response.body);
187
- this.fetching = false;
188
- this.updateComplete.then(() => {
189
- this.updatePrimaryButton();
190
- this.fireCustomEvent(CustomEventType.Loaded, {
191
- body: this.getBody(),
230
+ // if it's a full page, breakout of the modal
231
+ if (response.body.indexOf('<!DOCTYPE HTML>') == 0) {
232
+ document.location = response.url;
233
+ }
234
+ else {
235
+ this.setBody(response.body);
236
+ this.fetching = false;
237
+ this.updateComplete.then(() => {
238
+ this.updatePrimaryButton();
239
+ this.fireCustomEvent(CustomEventType.Loaded, {
240
+ body: this.getBody(),
241
+ });
192
242
  });
193
- });
243
+ }
194
244
  });
195
245
  }
196
- submit() {
246
+ submit(extra = {}) {
197
247
  this.submitting = true;
198
248
  const form = this.shadowRoot.querySelector('form');
199
- const postData = form ? serialize(form) : {};
249
+ let postData = form ? serialize(form) : '';
250
+ if (extra) {
251
+ Object.keys(extra).forEach(key => {
252
+ postData +=
253
+ (postData.length > 1 ? '&' : '') +
254
+ encodeURIComponent(key) +
255
+ '=' +
256
+ encodeURIComponent(extra[key]);
257
+ });
258
+ }
200
259
  postUrl(this.endpoint, postData, this.getHeaders(), 'application/x-www-form-urlencoded')
201
260
  .then((response) => {
202
261
  window.setTimeout(() => {
@@ -223,7 +282,9 @@ export class Modax extends RapidElement {
223
282
  else {
224
283
  // if we set the body, update our submit button
225
284
  if (this.setBody(response.body)) {
226
- this.updatePrimaryButton();
285
+ this.updateComplete.then(() => {
286
+ this.updatePrimaryButton();
287
+ });
227
288
  }
228
289
  }
229
290
  }, 1000);
@@ -234,14 +295,15 @@ export class Modax extends RapidElement {
234
295
  }
235
296
  handleDialogClick(evt) {
236
297
  const button = evt.detail.button;
298
+ const detail = evt.detail.detail;
237
299
  if (!button.disabled && !button.submitting) {
238
- if (button.name === this.primaryName) {
300
+ if (button.primary || button.destructive) {
239
301
  if (!this.suspendSubmit) {
240
302
  this.submit();
241
303
  }
242
304
  }
243
305
  }
244
- if (button.name === (this.cancelName || 'Cancel')) {
306
+ if (detail.closes) {
245
307
  this.open = false;
246
308
  this.fetching = false;
247
309
  this.cancelName = undefined;
@@ -255,15 +317,38 @@ export class Modax extends RapidElement {
255
317
  isDestructive() {
256
318
  return this.endpoint && this.endpoint.indexOf('delete') > -1;
257
319
  }
320
+ handleGotoStep(evt) {
321
+ const step = evt.target.dataset.gotoStep;
322
+ if (step) {
323
+ this.submit({ wizard_goto_step: step });
324
+ }
325
+ }
258
326
  getBody() {
259
327
  return this.shadowRoot.querySelector('.modax-body');
260
328
  }
261
329
  render() {
330
+ const wizardStepBalls = [];
331
+ const wizard = this.shadowRoot.querySelector('#wizard-form');
332
+ if (wizard) {
333
+ const completed = (wizard.getAttribute('data-completed') || '')
334
+ .split(',')
335
+ .filter(step => step.length > 0);
336
+ for (let i = 0; i < this.wizardStepCount; i++) {
337
+ wizardStepBalls.push(html `<div
338
+ data-goto-step=${completed[i]}
339
+ @click=${this.handleGotoStep.bind(this)}
340
+ class="${getClasses({
341
+ 'step-ball': true,
342
+ active: this.wizardStep - 1 === i,
343
+ complete: i < completed.length,
344
+ })}"
345
+ ></div>`);
346
+ }
347
+ }
262
348
  return html `
263
349
  <temba-dialog
264
- header=${this.header}
265
- .primaryButtonName=${this.noSubmit ? null : this.primaryName}
266
- .cancelButtonName=${this.cancelName || 'Cancel'}
350
+ .header=${this.header}
351
+ .buttons=${this.buttons}
267
352
  ?open=${this.open}
268
353
  ?loading=${this.fetching}
269
354
  ?submitting=${this.submitting}
@@ -277,6 +362,9 @@ export class Modax extends RapidElement {
277
362
  ${this.body}
278
363
  </div>
279
364
  <div class="scripts"></div>
365
+ <div slot="gutter">
366
+ <div class="wizard-steps">${wizardStepBalls}</div>
367
+ </div>
280
368
  </temba-dialog>
281
369
  <div class="slot-wrapper" @click=${this.handleSlotClicked}>
282
370
  <slot></slot>
@@ -320,6 +408,15 @@ __decorate([
320
408
  __decorate([
321
409
  property({ type: Boolean })
322
410
  ], Modax.prototype, "disabled", void 0);
411
+ __decorate([
412
+ property({ type: Array })
413
+ ], Modax.prototype, "buttons", void 0);
414
+ __decorate([
415
+ property({ type: Number })
416
+ ], Modax.prototype, "wizardStep", void 0);
417
+ __decorate([
418
+ property({ type: Number })
419
+ ], Modax.prototype, "wizardStepCount", void 0);
323
420
  __decorate([
324
421
  property({ type: Boolean })
325
422
  ], Modax.prototype, "suspendSubmit", void 0);