@3t-transform/threeteeui 0.0.13 → 0.0.15
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/package.json +7 -4
- package/dist/cjs/index-bf39be87.js +0 -1530
- package/dist/cjs/index.cjs.js +0 -2
- package/dist/cjs/loader.cjs.js +0 -22
- package/dist/cjs/tttx-button.cjs.entry.js +0 -28
- package/dist/cjs/tttx-checkbox.cjs.entry.js +0 -28
- package/dist/cjs/tttx-form.cjs.entry.js +0 -186
- package/dist/cjs/tttx-icon.cjs.entry.js +0 -1861
- package/dist/cjs/tttx-list.cjs.entry.js +0 -198
- package/dist/cjs/tttx-loading-spinner.cjs.entry.js +0 -26
- package/dist/cjs/tttx-popover-content.cjs.entry.js +0 -23
- package/dist/cjs/tttx-standalone-input.cjs.entry.js +0 -136
- package/dist/cjs/tttx.cjs.js +0 -23
- package/dist/collection/collection-manifest.json +0 -19
- package/dist/collection/components/atoms/tttx-button/tttx-button.css +0 -62
- package/dist/collection/components/atoms/tttx-button/tttx-button.js +0 -93
- package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +0 -27
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.css +0 -105
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +0 -114
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +0 -47
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.css +0 -48
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.js +0 -66
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +0 -17
- package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.css +0 -30
- package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.js +0 -96
- package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.stories.js +0 -23
- package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.css +0 -181
- package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.js +0 -101
- package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.stories.js +0 -13
- package/dist/collection/components/molecules/tttx-form/tttx-form.css +0 -230
- package/dist/collection/components/molecules/tttx-form/tttx-form.js +0 -249
- package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +0 -102
- package/dist/collection/components/molecules/tttx-list/tttx-list.css +0 -56
- package/dist/collection/components/molecules/tttx-list/tttx-list.js +0 -311
- package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +0 -37
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.css +0 -177
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +0 -569
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +0 -156
- package/dist/collection/components/palette.stories.js +0 -88
- package/dist/collection/docs/gettingstarted-developer.stories.js +0 -9
- package/dist/collection/icons.js +0 -2838
- package/dist/collection/index.js +0 -1
- package/dist/components/index.d.ts +0 -38
- package/dist/components/index.js +0 -9
- package/dist/components/tttx-button.d.ts +0 -11
- package/dist/components/tttx-button.js +0 -45
- package/dist/components/tttx-checkbox.d.ts +0 -11
- package/dist/components/tttx-checkbox.js +0 -46
- package/dist/components/tttx-form.d.ts +0 -11
- package/dist/components/tttx-form.js +0 -203
- package/dist/components/tttx-icon.d.ts +0 -11
- package/dist/components/tttx-icon.js +0 -6
- package/dist/components/tttx-icon2.js +0 -1875
- package/dist/components/tttx-list.d.ts +0 -11
- package/dist/components/tttx-list.js +0 -225
- package/dist/components/tttx-loading-spinner.d.ts +0 -11
- package/dist/components/tttx-loading-spinner.js +0 -6
- package/dist/components/tttx-loading-spinner2.js +0 -40
- package/dist/components/tttx-popover-content.d.ts +0 -11
- package/dist/components/tttx-popover-content.js +0 -42
- package/dist/components/tttx-standalone-input.d.ts +0 -11
- package/dist/components/tttx-standalone-input.js +0 -178
- package/dist/esm/index-63c4d25e.js +0 -1501
- package/dist/esm/index.js +0 -1
- package/dist/esm/loader.js +0 -18
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/tttx-button.entry.js +0 -24
- package/dist/esm/tttx-checkbox.entry.js +0 -24
- package/dist/esm/tttx-form.entry.js +0 -182
- package/dist/esm/tttx-icon.entry.js +0 -1857
- package/dist/esm/tttx-list.entry.js +0 -194
- package/dist/esm/tttx-loading-spinner.entry.js +0 -22
- package/dist/esm/tttx-popover-content.entry.js +0 -19
- package/dist/esm/tttx-standalone-input.entry.js +0 -132
- package/dist/esm/tttx.js +0 -18
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/tttx/index.esm.js +0 -0
- package/dist/tttx/p-1a4eb1f3.entry.js +0 -1
- package/dist/tttx/p-25953f82.entry.js +0 -1
- package/dist/tttx/p-2b6720ac.entry.js +0 -1
- package/dist/tttx/p-2d54f8aa.entry.js +0 -1
- package/dist/tttx/p-4c57bcbd.entry.js +0 -1
- package/dist/tttx/p-709246f5.entry.js +0 -1
- package/dist/tttx/p-95a29e09.entry.js +0 -1
- package/dist/tttx/p-ad0c3fe4.entry.js +0 -1
- package/dist/tttx/p-bec472d8.js +0 -2
- package/dist/tttx/tttx.esm.js +0 -1
- package/dist/types/components/atoms/tttx-button/tttx-button.d.ts +0 -9
- package/dist/types/components/atoms/tttx-button/tttx-button.stories.d.ts +0 -20
- package/dist/types/components/atoms/tttx-icon/tttx-icon.d.ts +0 -14
- package/dist/types/components/atoms/tttx-icon/tttx-icon.stories.d.ts +0 -21
- package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.d.ts +0 -6
- package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.d.ts +0 -17
- package/dist/types/components/atoms/tttx-popover-content/tttx-popover-content.d.ts +0 -7
- package/dist/types/components/atoms/tttx-popover-content/tttx-popover-content.stories.d.ts +0 -18
- package/dist/types/components/atoms/ttx-checkbox/tttx-checkbox.d.ts +0 -9
- package/dist/types/components/atoms/ttx-checkbox/tttx-checkbox.stories.d.ts +0 -6
- package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +0 -18
- package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +0 -6
- package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +0 -51
- package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +0 -13
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +0 -38
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +0 -106
- package/dist/types/components/palette.stories.d.ts +0 -6
- package/dist/types/components.d.ts +0 -236
- package/dist/types/docs/gettingstarted-developer.stories.d.ts +0 -5
- package/dist/types/icons.d.ts +0 -2
- package/dist/types/index.d.ts +0 -1
- package/dist/types/stencil-public-runtime.d.ts +0 -1637
- package/loader/cdn.js +0 -3
- package/loader/index.cjs.js +0 -3
- package/loader/index.d.ts +0 -21
- package/loader/index.es2017.js +0 -3
- package/loader/index.js +0 -4
- package/loader/package.json +0 -11
package/dist/collection/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/* tttx custom elements */
|
|
2
|
-
export { TttxButton as TttxButton } from '../types/components/atoms/tttx-button/tttx-button';
|
|
3
|
-
export { TttxCheckbox as TttxCheckbox } from '../types/components/atoms/ttx-checkbox/tttx-checkbox';
|
|
4
|
-
export { TttxForm as TttxForm } from '../types/components/molecules/tttx-form/tttx-form';
|
|
5
|
-
export { TttxIcon as TttxIcon } from '../types/components/atoms/tttx-icon/tttx-icon';
|
|
6
|
-
export { TttxList as TttxList } from '../types/components/molecules/tttx-list/tttx-list';
|
|
7
|
-
export { TttxLoadingSpinner as TttxLoadingSpinner } from '../types/components/atoms/tttx-loading-spinner/tttx-loading-spinner';
|
|
8
|
-
export { TttxPopoverContent as TttxPopoverContent } from '../types/components/atoms/tttx-popover-content/tttx-popover-content';
|
|
9
|
-
export { TttxInput as TttxStandaloneInput } from '../types/components/molecules/tttx-standalone-input/tttx-standalone-input';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Used to manually set the base path where assets can be found.
|
|
13
|
-
* If the script is used as "module", it's recommended to use "import.meta.url",
|
|
14
|
-
* such as "setAssetPath(import.meta.url)". Other options include
|
|
15
|
-
* "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
|
|
16
|
-
* dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
|
|
17
|
-
* But do note that this configuration depends on how your script is bundled, or lack of
|
|
18
|
-
* bundling, and where your assets can be loaded from. Additionally custom bundling
|
|
19
|
-
* will have to ensure the static assets are copied to its build directory.
|
|
20
|
-
*/
|
|
21
|
-
export declare const setAssetPath: (path: string) => void;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Used to specify a nonce value that corresponds with an application's CSP.
|
|
25
|
-
* When set, the nonce will be added to all dynamically created script and style tags at runtime.
|
|
26
|
-
* Alternatively, the nonce value can be set on a meta tag in the DOM head
|
|
27
|
-
* (<meta name="csp-nonce" content="{ nonce value here }" />) which
|
|
28
|
-
* will result in the same behavior.
|
|
29
|
-
*/
|
|
30
|
-
export declare const setNonce: (nonce: string) => void
|
|
31
|
-
|
|
32
|
-
export interface SetPlatformOptions {
|
|
33
|
-
raf?: (c: FrameRequestCallback) => number;
|
|
34
|
-
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
35
|
-
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
36
|
-
}
|
|
37
|
-
export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
|
|
38
|
-
export * from '../types';
|
package/dist/components/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
|
|
2
|
-
export { TttxButton, defineCustomElement as defineCustomElementTttxButton } from './tttx-button.js';
|
|
3
|
-
export { TttxCheckbox, defineCustomElement as defineCustomElementTttxCheckbox } from './tttx-checkbox.js';
|
|
4
|
-
export { TttxForm, defineCustomElement as defineCustomElementTttxForm } from './tttx-form.js';
|
|
5
|
-
export { TttxIcon, defineCustomElement as defineCustomElementTttxIcon } from './tttx-icon.js';
|
|
6
|
-
export { TttxList, defineCustomElement as defineCustomElementTttxList } from './tttx-list.js';
|
|
7
|
-
export { TttxLoadingSpinner, defineCustomElement as defineCustomElementTttxLoadingSpinner } from './tttx-loading-spinner.js';
|
|
8
|
-
export { TttxPopoverContent, defineCustomElement as defineCustomElementTttxPopoverContent } from './tttx-popover-content.js';
|
|
9
|
-
export { TttxStandaloneInput, defineCustomElement as defineCustomElementTttxStandaloneInput } from './tttx-standalone-input.js';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface TttxButton extends Components.TttxButton, HTMLElement {}
|
|
4
|
-
export const TttxButton: {
|
|
5
|
-
prototype: TttxButton;
|
|
6
|
-
new (): TttxButton;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
|
|
3
|
-
const tttxButtonCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.button{height:36px;padding:8px 16px;margin:0;background:transparent;color:#212121;border:1px solid #c8c8c8;border-radius:4px;text-transform:uppercase;display:flex;justify-content:left;align-items:center;font-size:14px;font-weight:400}.button:hover{background:#f0f0f0}.button:active{background:#e3e3e3}.primary-blue{background:#1479c6;border:1px solid #1479c6;color:white}.primary-blue:hover{background:#1169ba}.primary-blue:active{background:#0951a8}.secondary-white{background:white;border:1px solid #212121}:host{display:inline-block}.spacingleft{margin-left:8px}.font-white{color:white}.font-black{color:#212121}";
|
|
4
|
-
|
|
5
|
-
const TttxButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
-
constructor() {
|
|
7
|
-
super();
|
|
8
|
-
this.__registerHost();
|
|
9
|
-
this.__attachShadow();
|
|
10
|
-
this.clickEvent = createEvent(this, "clickEvent", 7);
|
|
11
|
-
this.fontColor = undefined;
|
|
12
|
-
this.buttonStyle = undefined;
|
|
13
|
-
}
|
|
14
|
-
onClick() {
|
|
15
|
-
this.clickEvent.emit('clicked');
|
|
16
|
-
}
|
|
17
|
-
onClicked(event) {
|
|
18
|
-
console.log('Picked up a clickEvent', event);
|
|
19
|
-
}
|
|
20
|
-
render() {
|
|
21
|
-
return (h(Host, null, h("button", { onClick: this.onClick.bind(this), class: `button ${this.fontColor} ${this.buttonStyle}` }, h("span", null, h("slot", null)))));
|
|
22
|
-
}
|
|
23
|
-
static get style() { return tttxButtonCss; }
|
|
24
|
-
}, [1, "tttx-button", {
|
|
25
|
-
"fontColor": [1, "font-color"],
|
|
26
|
-
"buttonStyle": [1, "button-style"]
|
|
27
|
-
}, [[0, "clickEvent", "onClicked"]]]);
|
|
28
|
-
function defineCustomElement$1() {
|
|
29
|
-
if (typeof customElements === "undefined") {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const components = ["tttx-button"];
|
|
33
|
-
components.forEach(tagName => { switch (tagName) {
|
|
34
|
-
case "tttx-button":
|
|
35
|
-
if (!customElements.get(tagName)) {
|
|
36
|
-
customElements.define(tagName, TttxButton$1);
|
|
37
|
-
}
|
|
38
|
-
break;
|
|
39
|
-
} });
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const TttxButton = TttxButton$1;
|
|
43
|
-
const defineCustomElement = defineCustomElement$1;
|
|
44
|
-
|
|
45
|
-
export { TttxButton, defineCustomElement };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface TttxCheckbox extends Components.TttxCheckbox, HTMLElement {}
|
|
4
|
-
export const TttxCheckbox: {
|
|
5
|
-
prototype: TttxCheckbox;
|
|
6
|
-
new (): TttxCheckbox;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
|
|
3
|
-
const tttxCheckboxCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}.icon-left,.icon-right{flex-basis:24px}.icon-left span,.icon-right span{font-size:24px;line-height:24px;text-align:center;display:block;width:24px;height:24px;margin-top:4px}.icon-left span{margin-left:4px}.icon-right span{margin-right:4px}.icon-right{margin-top:5px;margin-right:4px}.icon-left{margin-top:5px;margin-left:4px}.iconleft .input{padding-left:4px}.iconright .input{padding-right:4px}.focused{border-color:#1479c6}.errormsg{display:flex;justify-content:center;align-items:center;float:left;margin-bottom:16px;box-sizing:border-box;background-color:transparent;height:26px;font-size:14px;border-radius:none;z-index:2;color:#dc0000}.errormsg .validationicon{width:16px;height:16px;font-size:16px;margin-right:4px;vertical-align:middle;color:#dc0000}.danger{color:#dc0000}.optional{color:#757575;font-weight:normal}label.inputBlock{display:block;position:relative;line-height:21px}label{font-weight:500;font-size:16px}input:not([type=submit]){font-family:\"Roboto\", serif;box-sizing:border-box;width:100%;height:36px;padding:0 16px;font-size:16px;border:1px solid #d5d5d5;border-radius:4px;margin-top:4px}input[type=date]{background:white;display:block;min-width:calc(100% - 18px);line-height:37px}input.invalid:invalid,input.standalone.invalid{border:1px solid #dc0000}input~.errorBubble{min-height:27px;position:relative;font-size:14px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;display:flex;align-content:center;align-items:center;justify-items:center}input~.errorBubble:not(.visible){visibility:hidden}input~.errorBubble span{color:#dc0000;font-size:16px;margin-right:4px;height:16px}input.invalid:invalid~.errorBubble{position:relative;font-size:14px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;visibility:visible}input:focus{border-color:#1479c6}:host{display:block}.spacing{margin-bottom:16px}";
|
|
4
|
-
|
|
5
|
-
const TttxCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
-
constructor() {
|
|
7
|
-
super();
|
|
8
|
-
this.__registerHost();
|
|
9
|
-
this.__attachShadow();
|
|
10
|
-
this.valueChanged = createEvent(this, "valueChanged", 7);
|
|
11
|
-
this.value = undefined;
|
|
12
|
-
this.label = undefined;
|
|
13
|
-
this.required = undefined;
|
|
14
|
-
}
|
|
15
|
-
handleClick(event) {
|
|
16
|
-
const target = event.target;
|
|
17
|
-
this.value = target.checked;
|
|
18
|
-
this.valueChanged.emit(target.checked);
|
|
19
|
-
}
|
|
20
|
-
render() {
|
|
21
|
-
return (h(Host, null, h("div", { class: "field spacing" }, this.label && (h("label", { class: "label" }, this.label, !this.required ? h("span", { class: "optional" }, " (optional)") : '')), h("input", { type: "checkbox", class: "input", onChange: event => this.handleClick(event), checked: this.value }))));
|
|
22
|
-
}
|
|
23
|
-
static get style() { return tttxCheckboxCss; }
|
|
24
|
-
}, [1, "tttx-checkbox", {
|
|
25
|
-
"value": [4],
|
|
26
|
-
"label": [1],
|
|
27
|
-
"required": [4]
|
|
28
|
-
}]);
|
|
29
|
-
function defineCustomElement$1() {
|
|
30
|
-
if (typeof customElements === "undefined") {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const components = ["tttx-checkbox"];
|
|
34
|
-
components.forEach(tagName => { switch (tagName) {
|
|
35
|
-
case "tttx-checkbox":
|
|
36
|
-
if (!customElements.get(tagName)) {
|
|
37
|
-
customElements.define(tagName, TttxCheckbox$1);
|
|
38
|
-
}
|
|
39
|
-
break;
|
|
40
|
-
} });
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const TttxCheckbox = TttxCheckbox$1;
|
|
44
|
-
const defineCustomElement = defineCustomElement$1;
|
|
45
|
-
|
|
46
|
-
export { TttxCheckbox, defineCustomElement };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface TttxForm extends Components.TttxForm, HTMLElement {}
|
|
4
|
-
export const TttxForm: {
|
|
5
|
-
prototype: TttxForm;
|
|
6
|
-
new (): TttxForm;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
|
|
3
|
-
const tttxFormCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}.icon-left,.icon-right{flex-basis:24px}.icon-left span,.icon-right span{font-size:24px;line-height:24px;text-align:center;display:block;width:24px;height:24px;margin-top:4px}.icon-left span{margin-left:4px}.icon-right span{margin-right:4px}.icon-right{margin-top:5px;margin-right:4px}.icon-left{margin-top:5px;margin-left:4px}.iconleft .input{padding-left:4px}.iconright .input{padding-right:4px}.focused{border-color:#1479c6}.errormsg{display:flex;justify-content:center;align-items:center;float:left;margin-bottom:16px;box-sizing:border-box;background-color:transparent;height:26px;font-size:14px;border-radius:none;z-index:2;color:#dc0000}.errormsg .validationicon{width:16px;height:16px;font-size:16px;margin-right:4px;vertical-align:middle;color:#dc0000}.danger{color:#dc0000}.optional{color:#757575;font-weight:normal}label.inputBlock{display:block;position:relative;line-height:21px}label{font-weight:500;font-size:16px}input:not([type=submit]){font-family:\"Roboto\", serif;box-sizing:border-box;width:100%;height:36px;padding:0 16px;font-size:16px;border:1px solid #d5d5d5;border-radius:4px;margin-top:4px}input[type=date]{background:white;display:block;min-width:calc(100% - 18px);line-height:37px}input.invalid:invalid,input.standalone.invalid{border:1px solid #dc0000}input~.errorBubble{min-height:27px;position:relative;font-size:14px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;display:flex;align-content:center;align-items:center;justify-items:center}input~.errorBubble:not(.visible){visibility:hidden}input~.errorBubble span{color:#dc0000;font-size:16px;margin-right:4px;height:16px}input.invalid:invalid~.errorBubble{position:relative;font-size:14px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;visibility:visible}input:focus{border-color:#1479c6}.button{height:36px;padding:8px 16px;margin:0;background:transparent;color:#212121;border:1px solid #c8c8c8;border-radius:4px;text-transform:uppercase;display:flex;justify-content:left;align-items:center;font-size:14px;font-weight:400}.button:hover{background:#f0f0f0}.button:active{background:#e3e3e3}.primary-blue{background:#1479c6;border:1px solid #1479c6;color:white}.primary-blue:hover{background:#1169ba}.primary-blue:active{background:#0951a8}.secondary-white{background:white;border:1px solid #212121}:host{display:block}fieldset{margin:0;padding:0;border:none}input[type=submit]{margin-left:auto}";
|
|
4
|
-
|
|
5
|
-
const TttxForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
-
constructor() {
|
|
7
|
-
super();
|
|
8
|
-
this.__registerHost();
|
|
9
|
-
this.__attachShadow();
|
|
10
|
-
this.submitEvent = createEvent(this, "submitEvent", 7);
|
|
11
|
-
this.template = document.createElement('template');
|
|
12
|
-
this.formschema = undefined;
|
|
13
|
-
this.submitValue = undefined;
|
|
14
|
-
}
|
|
15
|
-
onFormSchemaChange(newValue) {
|
|
16
|
-
if (typeof newValue === 'string') {
|
|
17
|
-
this._formSchema = JSON.parse(newValue);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
this._formSchema = newValue;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
validityCheck(event) {
|
|
24
|
-
var _a, _b, _c, _d;
|
|
25
|
-
event.preventDefault();
|
|
26
|
-
const target = event.target;
|
|
27
|
-
let hasError = true;
|
|
28
|
-
let errorMessage = '';
|
|
29
|
-
// validity object on HTML5 inputs has the following options
|
|
30
|
-
// badInput
|
|
31
|
-
// customError
|
|
32
|
-
// patternMismatch
|
|
33
|
-
// rangeOverflow
|
|
34
|
-
// rangeUnderflow
|
|
35
|
-
// stepMismatch
|
|
36
|
-
// tooLong
|
|
37
|
-
// tooShort
|
|
38
|
-
// typeMismatch
|
|
39
|
-
// valid
|
|
40
|
-
// valueMissing
|
|
41
|
-
// customErrors can be set with
|
|
42
|
-
// target.setCustomValidity('custom error!');
|
|
43
|
-
// and cleared with
|
|
44
|
-
// target.setCustomValidity('');
|
|
45
|
-
if (target.validity.valueMissing) {
|
|
46
|
-
errorMessage = (_a = target.dataset.required) !== null && _a !== void 0 ? _a : 'This field is required';
|
|
47
|
-
}
|
|
48
|
-
else if (target.validity.patternMismatch) {
|
|
49
|
-
errorMessage = (_b = target.dataset.pattern) !== null && _b !== void 0 ? _b : 'Incorrect format';
|
|
50
|
-
}
|
|
51
|
-
else if (target.validity.badInput) {
|
|
52
|
-
// IE string in a number field
|
|
53
|
-
errorMessage = (_c = target.dataset.badinput) !== null && _c !== void 0 ? _c : 'Wrong input type';
|
|
54
|
-
}
|
|
55
|
-
else if (target.validity.rangeOverflow || target.validity.rangeUnderflow) {
|
|
56
|
-
// IE date or number is above or below value set in min or max tags
|
|
57
|
-
errorMessage = (_d = target.dataset.range) !== null && _d !== void 0 ? _d : 'Invalid value';
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
// no error
|
|
61
|
-
hasError = false;
|
|
62
|
-
}
|
|
63
|
-
if (hasError) {
|
|
64
|
-
target.className = 'invalid';
|
|
65
|
-
const errorIcon = document.createElement('span');
|
|
66
|
-
errorIcon.className = 'material-symbols-rounded';
|
|
67
|
-
errorIcon.textContent = 'warning';
|
|
68
|
-
target.parentElement.querySelector('.errorBubble').replaceChildren();
|
|
69
|
-
target.parentElement.querySelector('.errorBubble').append(errorIcon);
|
|
70
|
-
target.parentElement.querySelector('.errorBubble').append(errorMessage);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
target.className = '';
|
|
74
|
-
target.parentElement.querySelector('.errorBubble').replaceChildren();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
doSubmit(event) {
|
|
78
|
-
event.preventDefault();
|
|
79
|
-
const formData = new FormData(event.target);
|
|
80
|
-
// Key value pair matching the key names given by the JSON schema will be output line by line
|
|
81
|
-
// TODO: Emit an event so external components can handle the resulting form data
|
|
82
|
-
// let output = "";
|
|
83
|
-
// for (var [key, value] of formData.entries()) {
|
|
84
|
-
// output += `${key} -> ${value}\n`;
|
|
85
|
-
// }
|
|
86
|
-
// console.log(output);
|
|
87
|
-
this.submitEvent.emit(formData);
|
|
88
|
-
}
|
|
89
|
-
fieldsetChange(event) {
|
|
90
|
-
console.log(event.target.name + ' has changed');
|
|
91
|
-
// The correct input box will always be the target of the incoming event
|
|
92
|
-
// TODO: Emit an event so external components can change based on form values input
|
|
93
|
-
}
|
|
94
|
-
componentWillLoad() {
|
|
95
|
-
// set proper on initial render
|
|
96
|
-
this.onFormSchemaChange(this.formschema);
|
|
97
|
-
}
|
|
98
|
-
componentWillRender() {
|
|
99
|
-
this.template.content.replaceChildren(); // clear the template to account for a potential re-render scenario
|
|
100
|
-
this.populateFormFromSchema();
|
|
101
|
-
}
|
|
102
|
-
populateFormFromSchema() {
|
|
103
|
-
if (!this._formSchema)
|
|
104
|
-
return;
|
|
105
|
-
const properties = this._formSchema.properties;
|
|
106
|
-
const propertyKeys = Object.keys(properties);
|
|
107
|
-
propertyKeys.forEach(formKey => {
|
|
108
|
-
var _a, _b, _c;
|
|
109
|
-
const formItem = properties[formKey];
|
|
110
|
-
const formProperties = formItem.form;
|
|
111
|
-
const input = document.createElement('input');
|
|
112
|
-
input.name = formKey;
|
|
113
|
-
input.type = formProperties.type;
|
|
114
|
-
input.placeholder = (_a = formProperties.placeholder) !== null && _a !== void 0 ? _a : '';
|
|
115
|
-
input.autocomplete = 'off';
|
|
116
|
-
input.autocapitalize = 'off';
|
|
117
|
-
if (formProperties.validation) {
|
|
118
|
-
const validation = formProperties.validation;
|
|
119
|
-
if (validation.required) {
|
|
120
|
-
input.setAttribute('required', '');
|
|
121
|
-
input.setAttribute('data-required', (_b = validation.required.message) !== null && _b !== void 0 ? _b : '');
|
|
122
|
-
}
|
|
123
|
-
if (validation.pattern) {
|
|
124
|
-
input.setAttribute('pattern', validation.pattern.pattern);
|
|
125
|
-
input.setAttribute('data-pattern', (_c = validation.pattern.message) !== null && _c !== void 0 ? _c : '');
|
|
126
|
-
}
|
|
127
|
-
if (validation.badInput) {
|
|
128
|
-
input.setAttribute('data-badinput', validation.badInput.message);
|
|
129
|
-
}
|
|
130
|
-
if (validation.minmax) {
|
|
131
|
-
input.setAttribute('min', validation.minmax.min);
|
|
132
|
-
input.setAttribute('max', validation.minmax.max);
|
|
133
|
-
input.setAttribute('data-range', validation.minmax.message);
|
|
134
|
-
}
|
|
135
|
-
if (validation.maxlength) {
|
|
136
|
-
input.setAttribute('maxlength', validation.maxlength);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
const errorBubble = document.createElement('div');
|
|
140
|
-
errorBubble.className = 'errorBubble';
|
|
141
|
-
const label = document.createElement('label');
|
|
142
|
-
label.className = 'inputBlock';
|
|
143
|
-
label.innerText = formProperties.label;
|
|
144
|
-
if (!formProperties.validation) {
|
|
145
|
-
const optionalSpan = document.createElement('span');
|
|
146
|
-
optionalSpan.className = 'optional';
|
|
147
|
-
optionalSpan.innerHTML = ' (optional)';
|
|
148
|
-
label.appendChild(optionalSpan);
|
|
149
|
-
}
|
|
150
|
-
label.appendChild(input);
|
|
151
|
-
label.appendChild(errorBubble);
|
|
152
|
-
this.template.content.append(label);
|
|
153
|
-
});
|
|
154
|
-
const submitButton = document.createElement('input');
|
|
155
|
-
submitButton.type = 'submit';
|
|
156
|
-
submitButton.className = 'button primary-blue';
|
|
157
|
-
console.log(this.submitValue);
|
|
158
|
-
submitButton.value = 'Save';
|
|
159
|
-
this.template.content.append(submitButton);
|
|
160
|
-
}
|
|
161
|
-
componentDidRender() {
|
|
162
|
-
if (!this._formSchema)
|
|
163
|
-
return;
|
|
164
|
-
const formItems = this.template.content.cloneNode(true);
|
|
165
|
-
// bind to events here as you can't do it in a template in stencil
|
|
166
|
-
const properties = this._formSchema.properties;
|
|
167
|
-
const propertyKeys = Object.keys(properties);
|
|
168
|
-
propertyKeys.forEach(formKey => {
|
|
169
|
-
formItems.querySelector(`[name=${formKey}]`).oninvalid = this.validityCheck.bind(this);
|
|
170
|
-
formItems.querySelector(`[name=${formKey}]`).onblur = this.validityCheck.bind(this);
|
|
171
|
-
});
|
|
172
|
-
// append to the fieldset
|
|
173
|
-
this.fieldset.appendChild(formItems);
|
|
174
|
-
}
|
|
175
|
-
render() {
|
|
176
|
-
return (h(Host, null, h("form", { onSubmit: this.doSubmit.bind(this) }, h("fieldset", { onChange: this.fieldsetChange, ref: el => (this.fieldset = el) }))));
|
|
177
|
-
}
|
|
178
|
-
static get watchers() { return {
|
|
179
|
-
"formschema": ["onFormSchemaChange"]
|
|
180
|
-
}; }
|
|
181
|
-
static get style() { return tttxFormCss; }
|
|
182
|
-
}, [1, "tttx-form", {
|
|
183
|
-
"formschema": [8],
|
|
184
|
-
"submitValue": [8, "submit-value"]
|
|
185
|
-
}]);
|
|
186
|
-
function defineCustomElement$1() {
|
|
187
|
-
if (typeof customElements === "undefined") {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
const components = ["tttx-form"];
|
|
191
|
-
components.forEach(tagName => { switch (tagName) {
|
|
192
|
-
case "tttx-form":
|
|
193
|
-
if (!customElements.get(tagName)) {
|
|
194
|
-
customElements.define(tagName, TttxForm$1);
|
|
195
|
-
}
|
|
196
|
-
break;
|
|
197
|
-
} });
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const TttxForm = TttxForm$1;
|
|
201
|
-
const defineCustomElement = defineCustomElement$1;
|
|
202
|
-
|
|
203
|
-
export { TttxForm, defineCustomElement };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface TttxIcon extends Components.TttxIcon, HTMLElement {}
|
|
4
|
-
export const TttxIcon: {
|
|
5
|
-
prototype: TttxIcon;
|
|
6
|
-
new (): TttxIcon;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|