@substrate-system/input 0.0.19 → 0.0.21

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["// import Debug from '@substrate-system/debug'\n// const debug = Debug()\n\nexport abstract class Input extends HTMLElement {\n // for `attributeChangedCallback`\n static observedAttributes = ['autofocus', 'disabled']\n static TAG:string\n\n static define (this:((new (...args:any[]) => Input) & typeof Input)) {\n if (!('customElements' in window)) return\n if (customElements.get(this.TAG)) return // only define it once\n\n return customElements.define(this.TAG, this)\n }\n\n constructor () {\n super()\n const disabled = this.getAttribute('disabled')\n if (disabled !== null) {\n setTimeout(() => {\n // need to wait for it to render\n this.disabled = true\n }, 0)\n }\n\n // timeout b/c we need to render first\n setTimeout(() => {\n const attr = this.getAttribute('value')\n if (attr) this.value = attr\n\n const type = this.getAttribute('type')\n if (type) this.type = type\n }, 0)\n }\n\n get input ():HTMLInputElement|null {\n return this.querySelector('input')\n }\n\n get tabindex ():number {\n const i = this.input?.getAttribute('tabindex')\n if (!i) return 0\n return parseInt(i)\n }\n\n get name ():string|undefined|null {\n return this.getAttribute('name')\n }\n\n get placeholder ():string|null {\n return this.getAttribute('placeholder')\n }\n\n get autocomplete ():string|null {\n return this.getAttribute('autocomplete')\n }\n\n set name (newName:string) {\n this.setAttribute('name', newName)\n }\n\n /**\n * Remove from `this` element and also child.\n */\n _removeAttribute (name:string) {\n this.removeAttribute(name)\n this.input?.removeAttribute(name)\n }\n\n get disabled ():boolean {\n return !!(this.input?.hasAttribute('disabled'))\n }\n\n set disabled (disabledValue:boolean) {\n if (!disabledValue) {\n this._removeAttribute('disabled')\n this.input?.setAttribute('aria-disabled', 'false')\n } else {\n this.input?.setAttribute('disabled', '')\n this.input?.setAttribute('aria-disabled', 'true')\n }\n }\n\n /**\n * Handle 'example' attribute changes\n * @see {@link https://gomakethings.com/how-to-detect-when-attributes-change-on-a-web-component/#organizing-your-code Go Make Things article}\n *\n * @param {string|null} _oldValue The old attribute value\n * @param {string|null} newValue The new attribute value\n */\n handleChange_disabled (_oldValue:string, newValue:string) {\n if (!this.input) {\n setTimeout(() => {\n if (newValue === null || newValue === 'null') {\n this.disabled = false\n } else {\n this.disabled = true\n }\n }, 0) // wait to render\n } else {\n if (newValue === null || newValue === 'null') {\n this.disabled = false\n } else {\n this.disabled = true\n }\n }\n }\n\n /**\n * Runs when the value of an attribute is changed\n *\n * @param {string} name The attribute name\n * @param {string} oldValue The old attribute value\n * @param {string} newValue The new attribute value\n */\n attributeChangedCallback (name:string, oldValue:string, newValue:string) {\n const handler = this[`handleChange_${name}`];\n (handler && handler.call(this, oldValue, newValue))\n this.render()\n }\n\n connectedCallback () {\n this.render()\n }\n\n get type ():string|null|undefined {\n return this.input?.getAttribute('type')\n }\n\n set type (value:string) {\n this._setAttribute('type', value)\n }\n\n get value () {\n return this.input?.value\n }\n\n set value (text:string|undefined|null) {\n if (!text) this.input?.removeAttribute('value')\n else {\n this.input!.value = text\n }\n }\n\n /**\n * Set attributes on the internal input element.\n */\n _setAttribute (name:string, value:boolean|string|null):void {\n if (!value) {\n return this._removeAttribute(name)\n }\n\n if (value === true) {\n // true means set the attribute with no value\n return this.input?.setAttribute(name, '')\n }\n\n // else, set the value\n this.input?.setAttribute(name, value)\n }\n\n render ():string|void { // void for child class\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n value,\n name,\n placeholder,\n autocomplete\n } = this\n\n if (!name) throw new Error('not name')\n\n const classes:string[] = ['substrate-input']\n\n const btn = !!(this.type === 'submit' || this.type === 'button')\n\n const props = ([\n `class=\"${classes.filter(Boolean).join(' ')}\"`,\n disabled ? 'disabled' : '',\n disabled ? 'aria-disabled=\"true\"' : 'aria-disabled=\"false\"',\n autofocus ? 'autofocus' : '',\n type ? `type=\"${this.type}\"` : '',\n tabindex ? `tabindex=\"${tabindex}\"` : 'tabindex=\"0\"',\n btn ? 'role=\"button\"' : '',\n value ? `value=\"${value}\"` : '',\n name ? `name=\"${name}\"` : '',\n autocomplete ? `autocomplete=\"${autocomplete}\"` : '',\n placeholder ? `placeholder=\"${placeholder}\"` : ''\n ]).filter(Boolean).join(' ')\n\n return `<input ${props} />`\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAe,cAAc,YAAY;AAAA,EAHhD,OAGgD;AAAA;AAAA;AAAA;AAAA,EAE5C,OAAO,qBAAqB,CAAC,aAAa,UAAU;AAAA,EACpD,OAAO;AAAA,EAEP,OAAO,SAA8D;AACjE,QAAI,EAAE,oBAAoB,QAAS;AACnC,QAAI,eAAe,IAAI,KAAK,GAAG,EAAG;AAElC,WAAO,eAAe,OAAO,KAAK,KAAK,IAAI;AAAA,EAC/C;AAAA,EAEA,cAAe;AACX,UAAM;AACN,UAAM,WAAW,KAAK,aAAa,UAAU;AAC7C,QAAI,aAAa,MAAM;AACnB,iBAAW,MAAM;AAEb,aAAK,WAAW;AAAA,MACpB,GAAG,CAAC;AAAA,IACR;AAGA,eAAW,MAAM;AACb,YAAM,OAAO,KAAK,aAAa,OAAO;AACtC,UAAI,KAAM,MAAK,QAAQ;AAEvB,YAAM,OAAO,KAAK,aAAa,MAAM;AACrC,UAAI,KAAM,MAAK,OAAO;AAAA,IAC1B,GAAG,CAAC;AAAA,EACR;AAAA,EAEA,IAAI,QAA+B;AAC/B,WAAO,KAAK,cAAc,OAAO;AAAA,EACrC;AAAA,EAEA,IAAI,WAAmB;AACnB,UAAM,IAAI,KAAK,OAAO,aAAa,UAAU;AAC7C,QAAI,CAAC,EAAG,QAAO;AACf,WAAO,SAAS,CAAC;AAAA,EACrB;AAAA,EAEA,IAAI,OAA8B;AAC9B,WAAO,KAAK,aAAa,MAAM;AAAA,EACnC;AAAA,EAEA,IAAI,cAA2B;AAC3B,WAAO,KAAK,aAAa,aAAa;AAAA,EAC1C;AAA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e,iBAAiB,YAAY,MAAM;AAAA,MAClD,cAAc,gBAAgB,WAAW,MAAM;AAAA,IACnD,EAAG,OAAO,OAAO,EAAE,KAAK,GAAG;AAE3B,WAAO,UAAU,KAAK;AAAA,EAC1B;AACJ;",
6
- "names": []
4
+ "sourcesContent": ["import { WebComponent } from '@substrate-system/web-component'\nimport { define } from '@substrate-system/web-component/util'\nimport { ARIA_ATTRIBUTES, INPUT_ATTRIBUTES } from './util'\n\n// for document.querySelector\ndeclare global {\n interface HTMLElementTagNameMap {\n 'substrate-input': SubstrateInput\n }\n}\n\nexport class SubstrateInput extends WebComponent.create('substrate-input') {\n static TAG = 'substrate-input'\n static INPUT_ATTRIBUTES = INPUT_ATTRIBUTES\n static ARIA_ATTRIBUTES = ARIA_ATTRIBUTES\n\n static observedAttributes = (['label', 'id'])\n .concat(SubstrateInput.INPUT_ATTRIBUTES)\n .concat(SubstrateInput.ARIA_ATTRIBUTES)\n\n inputId:string|null = null\n inputAriaAttributes:Record<string, string> = {}\n ignoredAriaCallbackNames:Set<string> = new Set()\n ignoredIdCallback = false\n generatedInputId = `substrate-input-${Math.random().toString(36).slice(2, 10)}`\n\n handleChange_label (_oldValue, _newValue) {\n this.render()\n }\n\n handleChange_aria (\n name:string,\n _oldValue:string|null,\n newValue:string|null\n ) {\n if (this.ignoredAriaCallbackNames.has(name)) {\n this.ignoredAriaCallbackNames.delete(name)\n return\n }\n\n if (newValue === null) {\n delete this.inputAriaAttributes[name]\n this.querySelector('input')?.removeAttribute(name)\n return\n }\n\n this.inputAriaAttributes[name] = newValue\n this.querySelector('input')?.setAttribute(name, newValue)\n\n if (this.hasAttribute(name)) {\n this.ignoredAriaCallbackNames.add(name)\n this.removeAttribute(name)\n }\n }\n\n handleChange_id (_oldValue:string|null, newValue:string|null) {\n if (this.ignoredIdCallback) {\n this.ignoredIdCallback = false\n return\n }\n\n if (newValue === null) {\n this.inputId = null\n this.querySelector('input')?.removeAttribute('id')\n return\n }\n\n this.inputId = newValue\n this.querySelector('input')?.setAttribute('id', newValue)\n\n if (this.hasAttribute('id')) {\n this.ignoredIdCallback = true\n this.removeAttribute('id')\n }\n }\n\n handleChange_inputAttribute (name:string, newValue:string|null) {\n const input = this.querySelector('input')\n if (!input) return\n\n if (newValue === null) {\n input.removeAttribute(name)\n return\n }\n\n input.setAttribute(name, newValue)\n }\n\n async attributeChangedCallback (\n name:string,\n oldValue:string,\n newValue:string\n ) {\n if (name === 'id') {\n this.handleChange_id(oldValue, newValue)\n return\n }\n\n if (name.startsWith('aria-')) {\n this.handleChange_aria(name, oldValue, newValue)\n return\n }\n\n if (SubstrateInput.INPUT_ATTRIBUTES.includes(name)) {\n this.handleChange_inputAttribute(name, newValue)\n return\n }\n\n if (this[`handleChange_${name}`]) {\n this[`handleChange_${name}`](oldValue, newValue)\n }\n }\n\n connectedCallback () {\n this.render()\n }\n\n getInputIdForRender () {\n return this.inputId || this.generatedInputId\n }\n\n set label (value:string|null) {\n if (value === null) {\n this.removeAttribute('label')\n return\n }\n this.setAttribute('label', value)\n }\n\n get label ():string|null {\n return this.getAttribute('label')\n }\n\n render () {\n const label = this.getAttribute('label')\n const hostId = this.getAttribute('id')\n const hostAriaAttributes = Array.from(this.attributes)\n .filter(attr => attr.name.startsWith('aria-'))\n\n if (hostId !== null) {\n this.inputId = hostId\n }\n\n for (const attr of hostAriaAttributes) {\n this.inputAriaAttributes[attr.name] = attr.value\n }\n\n const name = this.getAttribute('name')\n const attrs = Array.from(this.attributes)\n .filter(attr =>\n attr.name !== 'label' &&\n attr.name !== 'id' &&\n !attr.name.startsWith('aria-')\n )\n .map(attr => attr.name + (attr.value === '' ?\n '' :\n ('=' + `\"${attr.value}\"`))\n )\n .join(' ')\n\n const classes = (this.getAttribute('class') ?? '').split(' ')\n .concat(['substrate', 'input', name || ''])\n .filter(Boolean)\n .join(' ')\n\n const inputId = this.getInputIdForRender()\n const renderedIdAttribute = `id=\"${inputId}\"`\n const ariaAttributes = Object.entries(this.inputAriaAttributes)\n .map(([attrName, attrValue]) => {\n return (attrName + (attrValue === '' ?\n '' :\n ('=' + `\"${attrValue}\"`)))\n })\n .join(' ')\n\n this.innerHTML = label ? `\n <div class=\"${classes}\">\n <label class=\"label-content\" for=\"${inputId}\">${label}</label>\n <input\n ${renderedIdAttribute}\n ${ariaAttributes}\n ${attrs}\n />\n </div>\n ` : `\n <div class=\"${classes}\">\n <input\n ${renderedIdAttribute}\n ${ariaAttributes}\n ${attrs}\n />\n </div>\n `\n\n if (this.hasAttribute('id')) {\n this.ignoredIdCallback = true\n this.removeAttribute('id')\n }\n for (const attr of hostAriaAttributes) {\n this.ignoredAriaCallbackNames.add(attr.name)\n this.removeAttribute(attr.name)\n }\n }\n}\n\ndefine(SubstrateInput.TAG, SubstrateInput)\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAA6B;AAC7B,kBAAuB;AACvB,IAAAA,eAAkD;AAS3C,MAAM,uBAAuB,kCAAa,OAAO,iBAAiB,EAAE;AAAA,EAX3E,OAW2E;AAAA;AAAA;AAAA,EACvE,OAAO,MAAM;AAAA,EACb,OAAO,mBAAmB;AAAA,EAC1B,OAAO,kBAAkB;AAAA,EAEzB,OAAO,qBAAsB,CAAC,SAAS,IAAI,EACtC,OAAO,eAAe,gBAAgB,EACtC,OAAO,eAAe,eAAe;AAAA,EAE1C,UAAsB;AAAA,EACtB,sBAA6C,CAAC;AAAA,EAC9C,2BAAuC,oBAAI,IAAI;AAAA,EAC/C,oBAAoB;AAAA,EACpB,mBAAmB,mBAAmB,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,GAAG,EAAE,CAAC;AAAA,EAE7E,mBAAoB,WAAW,WAAW;AACtC,SAAK,OAAO;AAAA,EAChB;AAAA,EAEA,kBACI,MACA,WACA,UACF;AACE,QAAI,KAAK,yBAAyB,IAAI,IAAI,GAAG;AACzC,WAAK,yBAAyB,OAAO,IAAI;AACzC;AAAA,IACJ;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AAsB,OAAO,OAAO;AAC1C,UAAM,iBAAiB,OAAO,QAAQ,KAAK,mBAAmB,EACzD,IAAI,CAAC,CAAC,UAAU,SAAS,MAAM;AAC5B,aAAQ,YAAY,cAAc,KAC9B,KACC,KAAU,SAAS;AAAA,IAC5B,CAAC,EACA,KAAK,GAAG;AAEb,SAAK,YAAY,QAAQ;AAAA,0BACP,OAAO;AAAA,gDACe,OAAO,KAAK,KAAK;AAAA;AAAA,cAEnD,mBAAmB;AAAA,cACnB,cAAc;AAAA,cACd,KAAK;AAAA;AAAA;AAAA,YAGP;AAAA,0BACc,OAAO;AAAA;AAAA,cAEnB,mBAAmB;AAAA,cACnB,cAAc;AAAA,cACd,KAAK;AAAA;AAAA;AAAA;AAKX,QAAI,KAAK,aAAa,IAAI,GAAG;AACzB,WAAK,oBAAoB;AACzB,WAAK,gBAAgB,IAAI;AAAA,IAC7B;AACA,eAAW,QAAQ,oBAAoB;AACnC,WAAK,yBAAyB,IAAI,KAAK,IAAI;AAC3C,WAAK,gBAAgB,KAAK,IAAI;AAAA,IAClC;AAAA,EACJ;AACJ;AAAA,IAEA,oBAAO,eAAe,KAAK,cAAc;",
6
+ "names": ["import_util"]
7
7
  }
package/dist/index.css CHANGED
@@ -1,5 +1,31 @@
1
- input {
2
- font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
1
+ substrate-input {
2
+ display: block;
3
+
4
+ & .substrate.input {
5
+ flex-wrap: wrap;
6
+ align-items: center;
7
+ min-width: 100%;
8
+ display: flex;
9
+
10
+ & .label-content {
11
+ width: 100%;
12
+ }
13
+
14
+ & input {
15
+ border: 1px solid;
16
+ border-radius: 0;
17
+ outline: 1px solid #0000;
18
+ width: 100%;
19
+ padding: 1rem 1rem .8rem;
20
+ transition: all .2s;
21
+
22
+ &:focus {
23
+ outline: 1px solid;
24
+ }
25
+ }
26
+ }
3
27
  }
4
28
 
5
- /*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9pbmRleC5jc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7SUFDSSw2RUFBNkU7QUFDakYiLCJmaWxlIjoic3JjL2luZGV4LmNzcyIsInNvdXJjZXNDb250ZW50IjpbImlucHV0IHtcbiAgICBmb250LWZhbWlseTogJ0dpbGwgU2FucycsICdHaWxsIFNhbnMgTVQnLCBDYWxpYnJpLCAnVHJlYnVjaGV0IE1TJywgc2Fucy1zZXJpZjtcbn1cbiJdfQ== */
29
+ substrate-input:not(:defined) {
30
+ visibility: hidden;
31
+ }
package/dist/index.d.ts CHANGED
@@ -1,45 +1,35 @@
1
- export declare abstract class Input extends HTMLElement {
2
- static observedAttributes: string[];
1
+ import { WebComponent } from '@substrate-system/web-component';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'substrate-input': SubstrateInput;
5
+ }
6
+ }
7
+ declare const SubstrateInput_base: typeof WebComponent & {
8
+ new (...args: any[]): WebComponent;
9
+ TAG: string;
10
+ define: typeof WebComponent.define;
11
+ event: typeof WebComponent.event;
12
+ };
13
+ export declare class SubstrateInput extends SubstrateInput_base {
3
14
  static TAG: string;
4
- static define(this: ((new (...args: any[]) => Input) & typeof Input)): void;
5
- constructor();
6
- get input(): HTMLInputElement | null;
7
- get tabindex(): number;
8
- get name(): string | undefined | null;
9
- get placeholder(): string | null;
10
- get autocomplete(): string | null;
11
- set name(newName: string);
12
- /**
13
- * Remove from `this` element and also child.
14
- */
15
- _removeAttribute(name: string): void;
16
- get disabled(): boolean;
17
- set disabled(disabledValue: boolean);
18
- /**
19
- * Handle 'example' attribute changes
20
- * @see {@link https://gomakethings.com/how-to-detect-when-attributes-change-on-a-web-component/#organizing-your-code Go Make Things article}
21
- *
22
- * @param {string|null} _oldValue The old attribute value
23
- * @param {string|null} newValue The new attribute value
24
- */
25
- handleChange_disabled(_oldValue: string, newValue: string): void;
26
- /**
27
- * Runs when the value of an attribute is changed
28
- *
29
- * @param {string} name The attribute name
30
- * @param {string} oldValue The old attribute value
31
- * @param {string} newValue The new attribute value
32
- */
33
- attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
15
+ static INPUT_ATTRIBUTES: string[];
16
+ static ARIA_ATTRIBUTES: string[];
17
+ static observedAttributes: string[];
18
+ inputId: string | null;
19
+ inputAriaAttributes: Record<string, string>;
20
+ ignoredAriaCallbackNames: Set<string>;
21
+ ignoredIdCallback: boolean;
22
+ generatedInputId: string;
23
+ handleChange_label(_oldValue: any, _newValue: any): void;
24
+ handleChange_aria(name: string, _oldValue: string | null, newValue: string | null): void;
25
+ handleChange_id(_oldValue: string | null, newValue: string | null): void;
26
+ handleChange_inputAttribute(name: string, newValue: string | null): void;
27
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): Promise<void>;
34
28
  connectedCallback(): void;
35
- get type(): string | null | undefined;
36
- set type(value: string);
37
- get value(): string | undefined | null;
38
- set value(text: string | undefined | null);
39
- /**
40
- * Set attributes on the internal input element.
41
- */
42
- _setAttribute(name: string, value: boolean | string | null): void;
43
- render(): string | void;
29
+ getInputIdForRender(): string;
30
+ set label(value: string | null);
31
+ get label(): string | null;
32
+ render(): void;
44
33
  }
34
+ export {};
45
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,8BAAsB,KAAM,SAAQ,WAAW;IAE3C,MAAM,CAAC,kBAAkB,WAA4B;IACrD,MAAM,CAAC,GAAG,EAAC,MAAM,CAAA;IAEjB,MAAM,CAAC,MAAM,CAAE,IAAI,EAAC,CAAC,CAAC,KAAK,GAAG,IAAI,EAAC,GAAG,EAAE,KAAK,KAAK,CAAC,GAAG,OAAO,KAAK,CAAC;;IA2BnE,IAAI,KAAK,IAAI,gBAAgB,GAAC,IAAI,CAEjC;IAED,IAAI,QAAQ,IAAI,MAAM,CAIrB;IAED,IAAI,IAAI,IAAI,MAAM,GAAC,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C,MAAM,CAAC,eAAe,WAAkB;IAExC,MAAM,CAAC,kBAAkB,WAEkB;IAE3C,OAAO,EAAC,MAAM,GAAC,IAAI,CAAO;IAC1B,mBAAmB,EAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAK;IAC/C,wBAAwB,EAAC,GAAG,CAAC,MAAM,CAAC,CAAY;IAChD,iBAAiB,UAAQ;IACzB,gBAAgB,SAA+D;IAE/E,kBAAkB,CAAE,SAAS,KAAA,EAAE,SAAS,KAAA;IAIxC,iBAAiB,CACb,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,MAAM,GAAC,IAAI,EACrB,QAAQ,EAAC,MAAM,GAAC,IAAI;IAsBxB,eAAe,CAAE,SAAS,EAAC,MAAM,GAAC,IAAI,EAAE,QAAQ,EAAC,MAAM,GAAC,IAAI;IAqB5D,2BAA2B,CAAE,IAAI,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,GAAC,IAAI;IAYxD,wBAAwB,CAC1B,IAAI,EAAC,MAAM,EACX,QAAQ,EAAC,MAAM,EACf,QAAQ,EAAC,MAAM;IAsBnB,iBAAiB;IAIjB,mBAAmB;IAInB,IAAI,KAAK,CAAE,KAAK,EAAC,MAAM,GAAC,IAAI,EAM3B;IAED,IAAI,KAAK,IAAI,MAAM,GAAC,IAAI,CAEvB;IAED,MAAM;CAsET"}
package/dist/index.js CHANGED
@@ -1,168 +1,152 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- class Input extends HTMLElement {
3
+ import { WebComponent } from "@substrate-system/web-component";
4
+ import { define } from "@substrate-system/web-component/util";
5
+ import { ARIA_ATTRIBUTES, INPUT_ATTRIBUTES } from "./util";
6
+ class SubstrateInput extends WebComponent.create("substrate-input") {
4
7
  static {
5
- __name(this, "Input");
6
- }
7
- // for `attributeChangedCallback`
8
- static observedAttributes = ["autofocus", "disabled"];
9
- static TAG;
10
- static define() {
11
- if (!("customElements" in window)) return;
12
- if (customElements.get(this.TAG)) return;
13
- return customElements.define(this.TAG, this);
14
- }
15
- constructor() {
16
- super();
17
- const disabled = this.getAttribute("disabled");
18
- if (disabled !== null) {
19
- setTimeout(() => {
20
- this.disabled = true;
21
- }, 0);
22
- }
23
- setTimeout(() => {
24
- const attr = this.getAttribute("value");
25
- if (attr) this.value = attr;
26
- const type = this.getAttribute("type");
27
- if (type) this.type = type;
28
- }, 0);
29
- }
30
- get input() {
31
- return this.querySelector("input");
32
- }
33
- get tabindex() {
34
- const i = this.input?.getAttribute("tabindex");
35
- if (!i) return 0;
36
- return parseInt(i);
37
- }
38
- get name() {
39
- return this.getAttribute("name");
40
- }
41
- get placeholder() {
42
- return this.getAttribute("placeholder");
43
- }
44
- get autocomplete() {
45
- return this.getAttribute("autocomplete");
46
- }
47
- set name(newName) {
48
- this.setAttribute("name", newName);
49
- }
50
- /**
51
- * Remove from `this` element and also child.
52
- */
53
- _removeAttribute(name) {
54
- this.removeAttribute(name);
55
- this.input?.removeAttribute(name);
8
+ __name(this, "SubstrateInput");
9
+ }
10
+ static TAG = "substrate-input";
11
+ static INPUT_ATTRIBUTES = INPUT_ATTRIBUTES;
12
+ static ARIA_ATTRIBUTES = ARIA_ATTRIBUTES;
13
+ static observedAttributes = ["label", "id"].concat(SubstrateInput.INPUT_ATTRIBUTES).concat(SubstrateInput.ARIA_ATTRIBUTES);
14
+ inputId = null;
15
+ inputAriaAttributes = {};
16
+ ignoredAriaCallbackNames = /* @__PURE__ */ new Set();
17
+ ignoredIdCallback = false;
18
+ generatedInputId = `substrate-input-${Math.random().toString(36).slice(2, 10)}`;
19
+ handleChange_label(_oldValue, _newValue) {
20
+ this.render();
56
21
  }
57
- get disabled() {
58
- return !!this.input?.hasAttribute("disabled");
22
+ handleChange_aria(name, _oldValue, newValue) {
23
+ if (this.ignoredAriaCallbackNames.has(name)) {
24
+ this.ignoredAriaCallbackNames.delete(name);
25
+ return;
26
+ }
27
+ if (newValue === null) {
28
+ delete this.inputAriaAttributes[name];
29
+ this.querySelector("input")?.removeAttribute(name);
30
+ return;
31
+ }
32
+ this.inputAriaAttributes[name] = newValue;
33
+ this.querySelector("input")?.setAttribute(name, newValue);
34
+ if (this.hasAttribute(name)) {
35
+ this.ignoredAriaCallbackNames.add(name);
36
+ this.removeAttribute(name);
37
+ }
59
38
  }
60
- set disabled(disabledValue) {
61
- if (!disabledValue) {
62
- this._removeAttribute("disabled");
63
- this.input?.setAttribute("aria-disabled", "false");
64
- } else {
65
- this.input?.setAttribute("disabled", "");
66
- this.input?.setAttribute("aria-disabled", "true");
39
+ handleChange_id(_oldValue, newValue) {
40
+ if (this.ignoredIdCallback) {
41
+ this.ignoredIdCallback = false;
42
+ return;
43
+ }
44
+ if (newValue === null) {
45
+ this.inputId = null;
46
+ this.querySelector("input")?.removeAttribute("id");
47
+ return;
48
+ }
49
+ this.inputId = newValue;
50
+ this.querySelector("input")?.setAttribute("id", newValue);
51
+ if (this.hasAttribute("id")) {
52
+ this.ignoredIdCallback = true;
53
+ this.removeAttribute("id");
67
54
  }
68
55
  }
69
- /**
70
- * Handle 'example' attribute changes
71
- * @see {@link https://gomakethings.com/how-to-detect-when-attributes-change-on-a-web-component/#organizing-your-code Go Make Things article}
72
- *
73
- * @param {string|null} _oldValue The old attribute value
74
- * @param {string|null} newValue The new attribute value
75
- */
76
- handleChange_disabled(_oldValue, newValue) {
77
- if (!this.input) {
78
- setTimeout(() => {
79
- if (newValue === null || newValue === "null") {
80
- this.disabled = false;
81
- } else {
82
- this.disabled = true;
83
- }
84
- }, 0);
85
- } else {
86
- if (newValue === null || newValue === "null") {
87
- this.disabled = false;
88
- } else {
89
- this.disabled = true;
90
- }
56
+ handleChange_inputAttribute(name, newValue) {
57
+ const input = this.querySelector("input");
58
+ if (!input) return;
59
+ if (newValue === null) {
60
+ input.removeAttribute(name);
61
+ return;
91
62
  }
63
+ input.setAttribute(name, newValue);
92
64
  }
93
- /**
94
- * Runs when the value of an attribute is changed
95
- *
96
- * @param {string} name The attribute name
97
- * @param {string} oldValue The old attribute value
98
- * @param {string} newValue The new attribute value
99
- */
100
- attributeChangedCallback(name, oldValue, newValue) {
101
- const handler = this[`handleChange_${name}`];
102
- handler && handler.call(this, oldValue, newValue);
103
- this.render();
65
+ async attributeChangedCallback(name, oldValue, newValue) {
66
+ if (name === "id") {
67
+ this.handleChange_id(oldValue, newValue);
68
+ return;
69
+ }
70
+ if (name.startsWith("aria-")) {
71
+ this.handleChange_aria(name, oldValue, newValue);
72
+ return;
73
+ }
74
+ if (SubstrateInput.INPUT_ATTRIBUTES.includes(name)) {
75
+ this.handleChange_inputAttribute(name, newValue);
76
+ return;
77
+ }
78
+ if (this[`handleChange_${name}`]) {
79
+ this[`handleChange_${name}`](oldValue, newValue);
80
+ }
104
81
  }
105
82
  connectedCallback() {
106
83
  this.render();
107
84
  }
108
- get type() {
109
- return this.input?.getAttribute("type");
85
+ getInputIdForRender() {
86
+ return this.inputId || this.generatedInputId;
110
87
  }
111
- set type(value) {
112
- this._setAttribute("type", value);
88
+ set label(value) {
89
+ if (value === null) {
90
+ this.removeAttribute("label");
91
+ return;
92
+ }
93
+ this.setAttribute("label", value);
113
94
  }
114
- get value() {
115
- return this.input?.value;
95
+ get label() {
96
+ return this.getAttribute("label");
116
97
  }
117
- set value(text) {
118
- if (!text) this.input?.removeAttribute("value");
119
- else {
120
- this.input.value = text;
98
+ render() {
99
+ const label = this.getAttribute("label");
100
+ const hostId = this.getAttribute("id");
101
+ const hostAriaAttributes = Array.from(this.attributes).filter((attr) => attr.name.startsWith("aria-"));
102
+ if (hostId !== null) {
103
+ this.inputId = hostId;
121
104
  }
122
- }
123
- /**
124
- * Set attributes on the internal input element.
125
- */
126
- _setAttribute(name, value) {
127
- if (!value) {
128
- return this._removeAttribute(name);
105
+ for (const attr of hostAriaAttributes) {
106
+ this.inputAriaAttributes[attr.name] = attr.value;
129
107
  }
130
- if (value === true) {
131
- return this.input?.setAttribute(name, "");
108
+ const name = this.getAttribute("name");
109
+ const attrs = Array.from(this.attributes).filter(
110
+ (attr) => attr.name !== "label" && attr.name !== "id" && !attr.name.startsWith("aria-")
111
+ ).map(
112
+ (attr) => attr.name + (attr.value === "" ? "" : `="${attr.value}"`)
113
+ ).join(" ");
114
+ const classes = (this.getAttribute("class") ?? "").split(" ").concat(["substrate", "input", name || ""]).filter(Boolean).join(" ");
115
+ const inputId = this.getInputIdForRender();
116
+ const renderedIdAttribute = `id="${inputId}"`;
117
+ const ariaAttributes = Object.entries(this.inputAriaAttributes).map(([attrName, attrValue]) => {
118
+ return attrName + (attrValue === "" ? "" : `="${attrValue}"`);
119
+ }).join(" ");
120
+ this.innerHTML = label ? `
121
+ <div class="${classes}">
122
+ <label class="label-content" for="${inputId}">${label}</label>
123
+ <input
124
+ ${renderedIdAttribute}
125
+ ${ariaAttributes}
126
+ ${attrs}
127
+ />
128
+ </div>
129
+ ` : `
130
+ <div class="${classes}">
131
+ <input
132
+ ${renderedIdAttribute}
133
+ ${ariaAttributes}
134
+ ${attrs}
135
+ />
136
+ </div>
137
+ `;
138
+ if (this.hasAttribute("id")) {
139
+ this.ignoredIdCallback = true;
140
+ this.removeAttribute("id");
141
+ }
142
+ for (const attr of hostAriaAttributes) {
143
+ this.ignoredAriaCallbackNames.add(attr.name);
144
+ this.removeAttribute(attr.name);
132
145
  }
133
- this.input?.setAttribute(name, value);
134
- }
135
- render() {
136
- const {
137
- type,
138
- autofocus,
139
- tabindex,
140
- disabled,
141
- value,
142
- name,
143
- placeholder,
144
- autocomplete
145
- } = this;
146
- if (!name) throw new Error("not name");
147
- const classes = ["substrate-input"];
148
- const btn = !!(this.type === "submit" || this.type === "button");
149
- const props = [
150
- `class="${classes.filter(Boolean).join(" ")}"`,
151
- disabled ? "disabled" : "",
152
- disabled ? 'aria-disabled="true"' : 'aria-disabled="false"',
153
- autofocus ? "autofocus" : "",
154
- type ? `type="${this.type}"` : "",
155
- tabindex ? `tabindex="${tabindex}"` : 'tabindex="0"',
156
- btn ? 'role="button"' : "",
157
- value ? `value="${value}"` : "",
158
- name ? `name="${name}"` : "",
159
- autocomplete ? `autocomplete="${autocomplete}"` : "",
160
- placeholder ? `placeholder="${placeholder}"` : ""
161
- ].filter(Boolean).join(" ");
162
- return `<input ${props} />`;
163
146
  }
164
147
  }
148
+ define(SubstrateInput.TAG, SubstrateInput);
165
149
  export {
166
- Input
150
+ SubstrateInput
167
151
  };
168
152
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["// import Debug from '@substrate-system/debug'\n// const debug = Debug()\n\nexport abstract class Input extends HTMLElement {\n // for `attributeChangedCallback`\n static observedAttributes = ['autofocus', 'disabled']\n static TAG:string\n\n static define (this:((new (...args:any[]) => Input) & typeof Input)) {\n if (!('customElements' in window)) return\n if (customElements.get(this.TAG)) return // only define it once\n\n return customElements.define(this.TAG, this)\n }\n\n constructor () {\n super()\n const disabled = this.getAttribute('disabled')\n if (disabled !== null) {\n setTimeout(() => {\n // need to wait for it to render\n this.disabled = true\n }, 0)\n }\n\n // timeout b/c we need to render first\n setTimeout(() => {\n const attr = this.getAttribute('value')\n if (attr) this.value = attr\n\n const type = this.getAttribute('type')\n if (type) this.type = type\n }, 0)\n }\n\n get input ():HTMLInputElement|null {\n return this.querySelector('input')\n }\n\n get tabindex ():number {\n const i = this.input?.getAttribute('tabindex')\n if (!i) return 0\n return parseInt(i)\n }\n\n get name ():string|undefined|null {\n return this.getAttribute('name')\n }\n\n get placeholder ():string|null {\n return this.getAttribute('placeholder')\n }\n\n get autocomplete ():string|null {\n return this.getAttribute('autocomplete')\n }\n\n set name (newName:string) {\n this.setAttribute('name', newName)\n }\n\n /**\n * Remove from `this` element and also child.\n */\n _removeAttribute (name:string) {\n this.removeAttribute(name)\n this.input?.removeAttribute(name)\n }\n\n get disabled ():boolean {\n return !!(this.input?.hasAttribute('disabled'))\n }\n\n set disabled (disabledValue:boolean) {\n if (!disabledValue) {\n this._removeAttribute('disabled')\n this.input?.setAttribute('aria-disabled', 'false')\n } else {\n this.input?.setAttribute('disabled', '')\n this.input?.setAttribute('aria-disabled', 'true')\n }\n }\n\n /**\n * Handle 'example' attribute changes\n * @see {@link https://gomakethings.com/how-to-detect-when-attributes-change-on-a-web-component/#organizing-your-code Go Make Things article}\n *\n * @param {string|null} _oldValue The old attribute value\n * @param {string|null} newValue The new attribute value\n */\n handleChange_disabled (_oldValue:string, newValue:string) {\n if (!this.input) {\n setTimeout(() => {\n if (newValue === null || newValue === 'null') {\n this.disabled = false\n } else {\n this.disabled = true\n }\n }, 0) // wait to render\n } else {\n if (newValue === null || newValue === 'null') {\n this.disabled = false\n } else {\n this.disabled = true\n }\n }\n }\n\n /**\n * Runs when the value of an attribute is changed\n *\n * @param {string} name The attribute name\n * @param {string} oldValue The old attribute value\n * @param {string} newValue The new attribute value\n */\n attributeChangedCallback (name:string, oldValue:string, newValue:string) {\n const handler = this[`handleChange_${name}`];\n (handler && handler.call(this, oldValue, newValue))\n this.render()\n }\n\n connectedCallback () {\n this.render()\n }\n\n get type ():string|null|undefined {\n return this.input?.getAttribute('type')\n }\n\n set type (value:string) {\n this._setAttribute('type', value)\n }\n\n get value () {\n return this.input?.value\n }\n\n set value (text:string|undefined|null) {\n if (!text) this.input?.removeAttribute('value')\n else {\n this.input!.value = text\n }\n }\n\n /**\n * Set attributes on the internal input element.\n */\n _setAttribute (name:string, value:boolean|string|null):void {\n if (!value) {\n return this._removeAttribute(name)\n }\n\n if (value === true) {\n // true means set the attribute with no value\n return this.input?.setAttribute(name, '')\n }\n\n // else, set the value\n this.input?.setAttribute(name, value)\n }\n\n render ():string|void { // void for child class\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n value,\n name,\n placeholder,\n autocomplete\n } = this\n\n if (!name) throw new Error('not name')\n\n const classes:string[] = ['substrate-input']\n\n const btn = !!(this.type === 'submit' || this.type === 'button')\n\n const props = ([\n `class=\"${classes.filter(Boolean).join(' ')}\"`,\n disabled ? 'disabled' : '',\n disabled ? 'aria-disabled=\"true\"' : 'aria-disabled=\"false\"',\n autofocus ? 'autofocus' : '',\n type ? `type=\"${this.type}\"` : '',\n tabindex ? `tabindex=\"${tabindex}\"` : 'tabindex=\"0\"',\n btn ? 'role=\"button\"' : '',\n value ? `value=\"${value}\"` : '',\n name ? `name=\"${name}\"` : '',\n autocomplete ? `autocomplete=\"${autocomplete}\"` : '',\n placeholder ? `placeholder=\"${placeholder}\"` : ''\n ]).filter(Boolean).join(' ')\n\n return `<input ${props} />`\n }\n}\n"],
5
- "mappings": ";;AAGO,MAAe,cAAc,YAAY;AAAA,EAHhD,OAGgD;AAAA;AAAA;AAAA;AAAA,EAE5C,OAAO,qBAAqB,CAAC,aAAa,UAAU;AAAA,EACpD,OAAO;AAAA,EAEP,OAAO,SAA8D;AACjE,QAAI,EAAE,oBAAoB,QAAS;AACnC,QAAI,eAAe,IAAI,KAAK,GAAG,EAAG;AAElC,WAAO,eAAe,OAAO,KAAK,KAAK,IAAI;AAAA,EAC/C;AAAA,EAEA,cAAe;AACX,UAAM;AACN,UAAM,WAAW,KAAK,aAAa,UAAU;AAC7C,QAAI,aAAa,MAAM;AACnB,iBAAW,MAAM;AAEb,aAAK,WAAW;AAAA,MACpB,GAAG,CAAC;AAAA,IACR;AAGA,eAAW,MAAM;AACb,YAAM,OAAO,KAAK,aAAa,OAAO;AACtC,UAAI,KAAM,MAAK,QAAQ;AAEvB,YAAM,OAAO,KAAK,aAAa,MAAM;AACrC,UAAI,KAAM,MAAK,OAAO;AAAA,IAC1B,GAAG,CAAC;AAAA,EACR;AAAA,EAEA,IAAI,QAA+B;AAC/B,WAAO,KAAK,cAAc,OAAO;AAAA,EACrC;AAAA,EAEA,IAAI,WAAmB;AACnB,UAAM,IAAI,KAAK,OAAO,aAAa,UAAU;AAC7C,QAAI,CAAC,EAAG,QAAO;AACf,WAAO,SAAS,CAAC;AAAA,EACrB;AAAA,E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Aa,QAAQ,MAAM;AAAA,MACtC,MAAM,kBAAkB;AAAA,MACxB,QAAQ,UAAU,KAAK,MAAM;AAAA,MAC7B,OAAO,SAAS,IAAI,MAAM;AAAA,MAC1B,eAAe,iBAAiB,YAAY,MAAM;AAAA,MAClD,cAAc,gBAAgB,WAAW,MAAM;AAAA,IACnD,EAAG,OAAO,OAAO,EAAE,KAAK,GAAG;AAE3B,WAAO,UAAU,KAAK;AAAA,EAC1B;AACJ;",
4
+ "sourcesContent": ["import { WebComponent } from '@substrate-system/web-component'\nimport { define } from '@substrate-system/web-component/util'\nimport { ARIA_ATTRIBUTES, INPUT_ATTRIBUTES } from './util'\n\n// for document.querySelector\ndeclare global {\n interface HTMLElementTagNameMap {\n 'substrate-input': SubstrateInput\n }\n}\n\nexport class SubstrateInput extends WebComponent.create('substrate-input') {\n static TAG = 'substrate-input'\n static INPUT_ATTRIBUTES = INPUT_ATTRIBUTES\n static ARIA_ATTRIBUTES = ARIA_ATTRIBUTES\n\n static observedAttributes = (['label', 'id'])\n .concat(SubstrateInput.INPUT_ATTRIBUTES)\n .concat(SubstrateInput.ARIA_ATTRIBUTES)\n\n inputId:string|null = null\n inputAriaAttributes:Record<string, string> = {}\n ignoredAriaCallbackNames:Set<string> = new Set()\n ignoredIdCallback = false\n generatedInputId = `substrate-input-${Math.random().toString(36).slice(2, 10)}`\n\n handleChange_label (_oldValue, _newValue) {\n this.render()\n }\n\n handleChange_aria (\n name:string,\n _oldValue:string|null,\n newValue:string|null\n ) {\n if (this.ignoredAriaCallbackNames.has(name)) {\n this.ignoredAriaCallbackNames.delete(name)\n return\n }\n\n if (newValue === null) {\n delete this.inputAriaAttributes[name]\n this.querySelector('input')?.removeAttribute(name)\n return\n }\n\n this.inputAriaAttributes[name] = newValue\n this.querySelector('input')?.setAttribute(name, newValue)\n\n if (this.hasAttribute(name)) {\n this.ignoredAriaCallbackNames.add(name)\n this.removeAttribute(name)\n }\n }\n\n handleChange_id (_oldValue:string|null, newValue:string|null) {\n if (this.ignoredIdCallback) {\n this.ignoredIdCallback = false\n return\n }\n\n if (newValue === null) {\n this.inputId = null\n this.querySelector('input')?.removeAttribute('id')\n return\n }\n\n this.inputId = newValue\n this.querySelector('input')?.setAttribute('id', newValue)\n\n if (this.hasAttribute('id')) {\n this.ignoredIdCallback = true\n this.removeAttribute('id')\n }\n }\n\n handleChange_inputAttribute (name:string, newValue:string|null) {\n const input = this.querySelector('input')\n if (!input) return\n\n if (newValue === null) {\n input.removeAttribute(name)\n return\n }\n\n input.setAttribute(name, newValue)\n }\n\n async attributeChangedCallback (\n name:string,\n oldValue:string,\n newValue:string\n ) {\n if (name === 'id') {\n this.handleChange_id(oldValue, newValue)\n return\n }\n\n if (name.startsWith('aria-')) {\n this.handleChange_aria(name, oldValue, newValue)\n return\n }\n\n if (SubstrateInput.INPUT_ATTRIBUTES.includes(name)) {\n this.handleChange_inputAttribute(name, newValue)\n return\n }\n\n if (this[`handleChange_${name}`]) {\n this[`handleChange_${name}`](oldValue, newValue)\n }\n }\n\n connectedCallback () {\n this.render()\n }\n\n getInputIdForRender () {\n return this.inputId || this.generatedInputId\n }\n\n set label (value:string|null) {\n if (value === null) {\n this.removeAttribute('label')\n return\n }\n this.setAttribute('label', value)\n }\n\n get label ():string|null {\n return this.getAttribute('label')\n }\n\n render () {\n const label = this.getAttribute('label')\n const hostId = this.getAttribute('id')\n const hostAriaAttributes = Array.from(this.attributes)\n .filter(attr => attr.name.startsWith('aria-'))\n\n if (hostId !== null) {\n this.inputId = hostId\n }\n\n for (const attr of hostAriaAttributes) {\n this.inputAriaAttributes[attr.name] = attr.value\n }\n\n const name = this.getAttribute('name')\n const attrs = Array.from(this.attributes)\n .filter(attr =>\n attr.name !== 'label' &&\n attr.name !== 'id' &&\n !attr.name.startsWith('aria-')\n )\n .map(attr => attr.name + (attr.value === '' ?\n '' :\n ('=' + `\"${attr.value}\"`))\n )\n .join(' ')\n\n const classes = (this.getAttribute('class') ?? '').split(' ')\n .concat(['substrate', 'input', name || ''])\n .filter(Boolean)\n .join(' ')\n\n const inputId = this.getInputIdForRender()\n const renderedIdAttribute = `id=\"${inputId}\"`\n const ariaAttributes = Object.entries(this.inputAriaAttributes)\n .map(([attrName, attrValue]) => {\n return (attrName + (attrValue === '' ?\n '' :\n ('=' + `\"${attrValue}\"`)))\n })\n .join(' ')\n\n this.innerHTML = label ? `\n <div class=\"${classes}\">\n <label class=\"label-content\" for=\"${inputId}\">${label}</label>\n <input\n ${renderedIdAttribute}\n ${ariaAttributes}\n ${attrs}\n />\n </div>\n ` : `\n <div class=\"${classes}\">\n <input\n ${renderedIdAttribute}\n ${ariaAttributes}\n ${attrs}\n />\n </div>\n `\n\n if (this.hasAttribute('id')) {\n this.ignoredIdCallback = true\n this.removeAttribute('id')\n }\n for (const attr of hostAriaAttributes) {\n this.ignoredAriaCallbackNames.add(attr.name)\n this.removeAttribute(attr.name)\n }\n }\n}\n\ndefine(SubstrateInput.TAG, SubstrateInput)\n"],
5
+ "mappings": ";;AAAA,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AACvB,SAAS,iBAAiB,wBAAwB;AAS3C,MAAM,uBAAuB,aAAa,OAAO,iBAAiB,EAAE;AAAA,EAX3E,OAW2E;AAAA;AAAA;AAAA,EACvE,OAAO,MAAM;AAAA,EACb,OAAO,mBAAmB;AAAA,EAC1B,OAAO,kBAAkB;AAAA,EAEzB,OAAO,qBAAsB,CAAC,SAAS,IAAI,EACtC,OAAO,eAAe,gBAAgB,EACtC,OAAO,eAAe,eAAe;AAAA,EAE1C,UAAsB;AAAA,EACtB,sBAA6C,CAAC;AAAA,EAC9C,2BAAuC,oBAAI,IAAI;AAAA,EAC/C,oBAAoB;AAAA,EACpB,mBAAmB,mBAAmB,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,GAAG,EAAE,CAAC;AAAA,EAE7E,mBAAoB,WAAW,WAAW;AACtC,SAAK,OAAO;AAAA,EAChB;AAAA,EAEA,kBACI,MACA,WACA,UACF;AAC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zYW5zLXNlcmlmO1xufVxuIl19 */
1
+ substrate-input{display:block;& .substrate.input{flex-wrap:wrap;align-items:center;min-width:100%;display:flex;& .label-content{width:100%}& input{border:1px solid;border-radius:0;outline:1px solid #0000;width:100%;padding:1rem 1rem .8rem;transition:all .2s;&:focus{outline:1px solid}}}}substrate-input:not(:defined){visibility:hidden}