@zanichelli/albe-web-components 18.3.1 → 18.3.3-RC1
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/CHANGELOG.md +0 -7
- package/dist/cjs/z-app-header_12.cjs.entry.js +2 -2
- package/dist/cjs/z-app-header_12.cjs.entry.js.map +1 -1
- package/dist/cjs/z-toast-notification.cjs.entry.js +43 -7
- package/dist/cjs/z-toast-notification.cjs.entry.js.map +1 -1
- package/dist/collection/components/z-input/index.js +2 -2
- package/dist/collection/components/z-input/index.js.map +1 -1
- package/dist/collection/components/z-input/index.stories.js +52 -48
- package/dist/collection/components/z-input/index.stories.js.map +1 -1
- package/dist/collection/components/z-toast-notification/index.js +43 -7
- package/dist/collection/components/z-toast-notification/index.js.map +1 -1
- package/dist/collection/components/z-toast-notification/index.stories.js +2 -30
- package/dist/collection/components/z-toast-notification/index.stories.js.map +1 -1
- package/dist/collection/components/z-toast-notification/styles.css +34 -25
- package/dist/components/index11.js +2 -2
- package/dist/components/index11.js.map +1 -1
- package/dist/components/z-toast-notification.js +44 -8
- package/dist/components/z-toast-notification.js.map +1 -1
- package/dist/esm/z-app-header_12.entry.js +2 -2
- package/dist/esm/z-app-header_12.entry.js.map +1 -1
- package/dist/esm/z-toast-notification.entry.js +44 -8
- package/dist/esm/z-toast-notification.entry.js.map +1 -1
- package/dist/types/components/z-toast-notification/index.d.ts +10 -1
- package/dist/types/components/z-toast-notification/index.stories.d.ts +2 -10
- package/dist/web-components-library/p-72c07bbd.entry.js +7 -0
- package/dist/web-components-library/p-72c07bbd.entry.js.map +1 -0
- package/{www/build/p-93150ae0.entry.js → dist/web-components-library/p-957d4244.entry.js} +2 -2
- package/{www/build/p-93150ae0.entry.js.map → dist/web-components-library/p-957d4244.entry.js.map} +1 -1
- package/dist/web-components-library/web-components-library.esm.js +1 -1
- package/package.json +1 -1
- package/www/build/{p-28efbaa8.js → p-0f3b0c17.js} +1 -1
- package/www/build/p-72c07bbd.entry.js +7 -0
- package/www/build/p-72c07bbd.entry.js.map +1 -0
- package/{dist/web-components-library/p-93150ae0.entry.js → www/build/p-957d4244.entry.js} +2 -2
- package/{dist/web-components-library/p-93150ae0.entry.js.map → www/build/p-957d4244.entry.js.map} +1 -1
- package/www/build/web-components-library.esm.js +1 -1
- package/www/index.html +1 -1
- package/dist/web-components-library/p-1dd6dff4.entry.js +0 -7
- package/dist/web-components-library/p-1dd6dff4.entry.js.map +0 -1
- package/www/build/p-1dd6dff4.entry.js +0 -7
- package/www/build/p-1dd6dff4.entry.js.map +0 -1
|
@@ -173,7 +173,7 @@ export class ZInput {
|
|
|
173
173
|
if (this.icon || type === InputType.PASSWORD) {
|
|
174
174
|
Object.assign(attr.class, { "has-icon": true });
|
|
175
175
|
}
|
|
176
|
-
if (this.hasclearicon && type != InputType.NUMBER) {
|
|
176
|
+
if (this.hasclearicon && type != InputType.NUMBER && !!this.value) {
|
|
177
177
|
Object.assign(attr.class, { "has-clear-icon": true });
|
|
178
178
|
}
|
|
179
179
|
return (h("div", { class: "text-wrapper" }, this.renderLabel(), h("div", null, h("input", Object.assign({ type: type === InputType.PASSWORD && !this.passwordHidden ? InputType.TEXT : type }, attr, { ref: (el) => (this.inputRef = el) })), this.renderIcons()), this.renderMessage()));
|
|
@@ -259,7 +259,7 @@ export class ZInput {
|
|
|
259
259
|
default:
|
|
260
260
|
input = this.renderInputText(this.type);
|
|
261
261
|
}
|
|
262
|
-
return h(Host, { key: '
|
|
262
|
+
return h(Host, { key: 'ce7849a447e6f04ec2f7f7822362a0c55809686d' }, input);
|
|
263
263
|
}
|
|
264
264
|
static get is() { return "z-input"; }
|
|
265
265
|
static get encapsulation() { return "scoped"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/z-input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,MAAM,E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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {Component, Element, Event, EventEmitter, Listen, Method, Prop, State, h} from \"@stencil/core\";\nimport {Fragment, Host, JSXBase} from \"@stencil/core/internal\";\nimport {ControlSize, InputStatus, InputType, LabelPosition} from \"../../beans\";\nimport {boolean, randomId} from \"../../utils/utils\";\n\n@Component({\n tag: \"z-input\",\n styleUrl: \"styles.css\",\n shadow: false,\n scoped: true,\n})\nexport class ZInput {\n @Element() hostElement: HTMLZInputElement;\n\n /** the id of the input element */\n @Prop()\n htmlid = `id-${randomId()}`;\n\n /** input types */\n @Prop()\n type: InputType;\n\n /** the input name */\n @Prop()\n name?: string;\n\n /** the input label */\n @Prop()\n label?: string;\n\n /** the input aria-label */\n @Prop()\n ariaLabel = \"\";\n\n /** the input aria-expaded: available for text, password, number, email */\n @Prop()\n ariaExpanded = \"\";\n\n /** the input aria-controls (optional): available for text, password, number, email */\n @Prop()\n ariaControls?: string;\n\n /** the input aria-autocomplete (optional): available for text, password, number, email */\n @Prop()\n ariaAutocomplete?: string;\n\n /** the input aria-activedescendant (optional): available for text, password, number, email */\n @Prop()\n ariaActivedescendant?: string;\n\n /** the input value */\n @Prop({mutable: true})\n value?: string;\n\n /** the input is disabled */\n @Prop({reflect: true})\n disabled?: boolean = false;\n\n /** the input is readonly */\n @Prop()\n readonly?: boolean = false;\n\n /** the input is required (optional): available for text, password, number, email, textarea, checkbox */\n @Prop()\n required?: boolean = false;\n\n /** checked: available for checkbox, radio */\n @Prop({mutable: true})\n checked?: boolean = false;\n\n /** the input placeholder (optional) */\n @Prop()\n placeholder?: string;\n\n /** the input html title (optional) */\n @Prop()\n htmltitle?: string;\n\n /** the input status (optional): available for text, password, number, email, textarea */\n @Prop()\n status?: InputStatus;\n\n /** input helper message (optional): available for text, password, number, email, textarea - if set to `false` message won't be displayed */\n @Prop()\n message?: string | boolean = true;\n\n /** the input label position: available for checkbox, radio */\n @Prop()\n labelPosition?: LabelPosition = LabelPosition.RIGHT;\n\n /** the input has autocomplete option (optional): available for text, password, number, email */\n @Prop()\n autocomplete?: string;\n\n /** the input role */\n @Prop()\n role = \"\";\n\n /** render clear icon when typing (optional): available for text */\n @Prop()\n hasclearicon?: boolean = true;\n\n /** render icon (optional): available for text */\n @Prop()\n icon?: string;\n\n /** min number value (optional): available for number */\n @Prop()\n min?: number;\n\n /** Min length value (optional): available for text */\n @Prop()\n minlength?: number;\n\n /** max number value (optional): available for number */\n @Prop()\n max?: number;\n\n /** Max length value (optional): available for text */\n @Prop()\n maxlength?: number;\n\n /** step number value (optional): available for number */\n @Prop()\n step?: number;\n\n /** pattern value (optional): available for tel, text, search, url, email, password*/\n @Prop()\n pattern?: string;\n\n /** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */\n @Prop({reflect: true})\n size?: ControlSize = ControlSize.BIG;\n\n @State()\n isTyping = false;\n\n @State()\n passwordHidden = true;\n\n private timer;\n\n private typingtimeout = 300;\n\n private inputRef: HTMLInputElement;\n\n @Listen(\"inputCheck\", {target: \"document\"})\n inputCheckListener(e: CustomEvent): void {\n const data = e.detail;\n switch (this.type) {\n case InputType.RADIO:\n if (data.type === InputType.RADIO && data.name === this.name && data.id !== this.htmlid) {\n this.checked = false;\n }\n break;\n }\n }\n\n /** get checked status */\n @Method()\n async isChecked(): Promise<boolean> {\n switch (this.type) {\n case InputType.CHECKBOX:\n case InputType.RADIO:\n return this.checked;\n default:\n console.warn(\"`isChecked` method is only available for type `checkbox` and `radio`\");\n\n return false;\n }\n }\n\n /** Emitted on input value change, returns value, validity */\n @Event()\n inputChange: EventEmitter;\n\n private emitInputChange(value: string): void {\n if (!this.isTyping) {\n this.emitStartTyping();\n }\n\n let validity: ValidityState;\n if (this.type === InputType.TEXTAREA) {\n validity = this.getValidity(\"textarea\");\n } else {\n validity = this.getValidity(\"input\");\n }\n this.value = value;\n this.inputChange.emit({value, validity});\n\n clearTimeout(this.timer);\n this.timer = setTimeout(() => {\n this.emitStopTyping(this.value, validity);\n }, this.typingtimeout);\n }\n\n /** Emitted when user starts typing */\n @Event()\n startTyping: EventEmitter;\n\n private emitStartTyping(): void {\n this.isTyping = true;\n this.startTyping.emit();\n }\n\n /** Emitted when user stops typing, returns value, validity */\n @Event()\n stopTyping: EventEmitter;\n\n private emitStopTyping(value: string, validity: ValidityState): void {\n this.isTyping = false;\n this.stopTyping.emit({\n value: value,\n validity: validity,\n });\n }\n\n /** Emitted on checkbox check/uncheck, returns id, checked, type, name, value, validity */\n @Event()\n inputCheck: EventEmitter;\n\n private emitInputCheck(checked: boolean): void {\n this.inputCheck.emit({\n id: this.htmlid,\n checked: checked,\n type: this.type,\n name: this.name,\n value: this.value,\n validity: this.getValidity(\"input\"),\n });\n }\n\n /** Emitted on input focus */\n @Event()\n inputFocus: EventEmitter;\n\n private emitInputFocus(): void {\n this.inputFocus.emit({id: this.htmlid});\n }\n\n /** Emitted on input blur */\n @Event()\n inputBlur: EventEmitter;\n\n private emitInputBlur(): void {\n this.inputBlur.emit({id: this.htmlid});\n }\n\n private getValidity(type: string): ValidityState {\n const input = this.hostElement.querySelector(type) as HTMLInputElement;\n\n return input.validity;\n }\n\n /* START text/password/email/number */\n\n private getTextAttributes(): JSXBase.InputHTMLAttributes<HTMLInputElement | HTMLTextAreaElement> {\n return {\n id: this.htmlid,\n name: this.name,\n placeholder: this.placeholder,\n value: this.value,\n disabled: this.disabled,\n readonly: this.readonly,\n required: this.required,\n title: this.htmltitle,\n minlength: this.minlength,\n maxlength: this.maxlength,\n class: {\n [`input-${this.status}`]: !!this.status,\n },\n autocomplete: this.autocomplete,\n onInput: (e: InputEvent) => this.emitInputChange((e.target as HTMLInputElement).value),\n };\n }\n\n private getNumberAttributes(type: InputType): JSXBase.InputHTMLAttributes<HTMLInputElement> {\n if (type != InputType.NUMBER) {\n return;\n }\n\n return {\n min: this.min,\n max: this.max,\n step: this.step,\n };\n }\n\n private getPatternAttribute(type: InputType): JSXBase.InputHTMLAttributes<HTMLInputElement> {\n if (\n type != InputType.PASSWORD &&\n type != InputType.TEXT &&\n type != InputType.TEL &&\n type != InputType.SEARCH &&\n type != InputType.URL &&\n type != InputType.EMAIL\n ) {\n return;\n }\n\n return {\n pattern: this.pattern,\n };\n }\n\n private getRoleAttribute(): JSXBase.InputHTMLAttributes<HTMLInputElement | HTMLTextAreaElement> {\n return this.role ? {role: this.role} : {};\n }\n\n private getAriaAttrubutes(): Record<string, unknown> {\n const expanded = this.ariaExpanded ? {\"aria-expanded\": this.ariaExpanded} : {};\n const controls = this.ariaControls ? {\"aria-controls\": this.ariaControls} : {};\n const autocomplete = this.ariaAutocomplete ? {\"aria-autocomplete\": this.ariaAutocomplete} : {};\n const activedescendant = this.ariaActivedescendant ? {\"aria-activedescendant\": this.ariaActivedescendant} : {};\n\n return {\n ...expanded,\n ...controls,\n ...autocomplete,\n ...activedescendant,\n };\n }\n\n private getFocusBlurAttributes(): JSXBase.InputHTMLAttributes<HTMLInputElement | HTMLTextAreaElement> {\n return {\n onFocus: () => this.emitInputFocus(),\n onBlur: () => this.emitInputBlur(),\n };\n }\n\n private renderInputText(type: InputType = InputType.TEXT): HTMLDivElement {\n const ariaLabel = this.ariaLabel ? {\"aria-label\": this.ariaLabel} : {};\n const attr = {\n ...this.getTextAttributes(),\n ...this.getNumberAttributes(type),\n ...this.getPatternAttribute(type),\n ...ariaLabel,\n ...this.getRoleAttribute(),\n ...this.getAriaAttrubutes(),\n ...this.getFocusBlurAttributes(),\n };\n if (this.icon || type === InputType.PASSWORD) {\n Object.assign(attr.class, {\"has-icon\": true});\n }\n if (this.hasclearicon && type != InputType.NUMBER) {\n Object.assign(attr.class, {\"has-clear-icon\": true});\n }\n\n return (\n <div class=\"text-wrapper\">\n {this.renderLabel()}\n <div>\n <input\n type={type === InputType.PASSWORD && !this.passwordHidden ? InputType.TEXT : type}\n {...attr}\n ref={(el) => (this.inputRef = el)}\n />\n {this.renderIcons()}\n </div>\n {this.renderMessage()}\n </div>\n );\n }\n\n private renderLabel(): HTMLLabelElement {\n if (!this.label) {\n return;\n }\n\n return (\n <label\n class=\"input-label body-5-sb\"\n id={`${this.htmlid}_label`}\n htmlFor={this.htmlid}\n >\n {this.label}\n </label>\n );\n }\n\n private renderIcons(): HTMLSpanElement {\n return (\n <span class=\"icons-wrapper\">\n {this.renderResetIcon()}\n {this.renderIcon()}\n </span>\n );\n }\n\n private renderIcon(): HTMLButtonElement {\n if (this.type === InputType.PASSWORD) {\n return this.renderShowHidePassword();\n }\n\n if (!this.icon) {\n return;\n }\n\n return (\n <z-icon\n name={this.icon}\n class={{[this.size]: true, \"input-icon\": true}}\n />\n );\n }\n\n private renderResetIcon(): HTMLButtonElement {\n let hidden = false;\n if (!this.hasclearicon || !this.value || this.disabled || this.readonly || this.type == InputType.NUMBER) {\n hidden = true;\n }\n\n return (\n <button\n type=\"button\"\n class={{\"reset-icon\": true, \"input-icon\": true, hidden}}\n aria-label=\"cancella il contenuto dell'input\"\n onClick={() => {\n this.inputRef.value = \"\";\n this.emitInputChange(\"\");\n }}\n >\n <z-icon\n name=\"multiply\"\n class={this.size}\n />\n </button>\n );\n }\n\n private renderShowHidePassword(): HTMLButtonElement {\n return (\n <button\n type=\"button\"\n class=\"input-icon toggle-password-icon\"\n disabled={this.disabled}\n aria-label={this.passwordHidden ? \"mostra password\" : \"nascondi password\"}\n onClick={() => (this.passwordHidden = !this.passwordHidden)}\n >\n <z-icon\n name={this.passwordHidden ? \"view-filled\" : \"view-off-filled\"}\n class={this.size}\n />\n </button>\n );\n }\n\n private renderMessage(): HTMLZInputMessageElement {\n if (boolean(this.message) === false) {\n return;\n }\n\n return (\n <z-input-message\n message={boolean(this.message) === true ? undefined : (this.message as string)}\n status={this.status}\n class={this.size}\n disabled={this.disabled}\n />\n );\n }\n\n /* END text/password/email/number */\n\n /* START textarea */\n\n private renderTextarea(): HTMLDivElement {\n const attributes = this.getTextAttributes();\n\n return (\n <Fragment>\n {this.renderLabel()}\n <div\n class={{\n ...(attributes.class as {[className: string]: boolean}),\n \"textarea-wrapper\": true,\n \"readonly\": !!attributes.readonly,\n }}\n >\n <textarea\n {...attributes}\n class={{\n ...(attributes.class as {[className: string]: boolean}),\n \"z-scrollbar\": true,\n }}\n aria-label={this.ariaLabel || undefined}\n {...this.getRoleAttribute()}\n ></textarea>\n </div>\n {this.renderMessage()}\n </Fragment>\n );\n }\n\n /* END textarea */\n\n private handleCheck(ev: Event): void {\n this.checked = (ev.target as HTMLInputElement).checked;\n this.emitInputCheck(this.checked);\n }\n\n /* START checkbox */\n private renderCheckbox(): HTMLDivElement {\n return (\n <div class=\"checkbox-wrapper\">\n <input\n id={this.htmlid}\n type=\"checkbox\"\n name={this.name}\n checked={this.checked}\n disabled={this.disabled}\n readonly={this.readonly}\n required={this.required}\n onChange={this.handleCheck.bind(this)}\n value={this.value}\n {...this.getRoleAttribute()}\n {...this.getFocusBlurAttributes()}\n />\n\n <label\n htmlFor={this.htmlid}\n class={{\n \"checkbox-label\": true,\n \"after\": this.labelPosition === LabelPosition.RIGHT,\n \"before\": this.labelPosition === LabelPosition.LEFT,\n }}\n >\n <z-icon\n name={this.checked ? \"checkbox-checked\" : \"checkbox\"}\n class={this.size}\n />\n {this.label && <span innerHTML={this.label}></span>}\n </label>\n </div>\n );\n }\n\n /* END checkbox */\n\n /* START radio */\n private renderRadio(): HTMLDivElement {\n return (\n <div class=\"radio-wrapper\">\n <input\n id={this.htmlid}\n type=\"radio\"\n name={this.name}\n checked={this.checked}\n disabled={this.disabled}\n readonly={this.readonly}\n onChange={this.handleCheck.bind(this)}\n value={this.value}\n {...this.getRoleAttribute()}\n {...this.getFocusBlurAttributes()}\n />\n\n <label\n htmlFor={this.htmlid}\n class={{\n \"radio-label\": true,\n \"after\": this.labelPosition === LabelPosition.RIGHT,\n \"before\": this.labelPosition === LabelPosition.LEFT,\n }}\n >\n <z-icon\n name={this.checked ? \"radio-button-checked\" : \"radio-button\"}\n class={this.size}\n />\n {this.label && <span innerHTML={this.label} />}\n </label>\n </div>\n );\n }\n /* END radio */\n\n render(): HTMLInputElement | HTMLDivElement {\n let input;\n switch (this.type) {\n case InputType.TEXTAREA:\n input = this.renderTextarea();\n break;\n case InputType.CHECKBOX:\n input = this.renderCheckbox();\n break;\n case InputType.RADIO:\n input = this.renderRadio();\n break;\n default:\n input = this.renderInputText(this.type);\n }\n\n return <Host>{input}</Host>;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/z-input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAC,MAAM,eAAe,CAAC;AACtG,OAAO,EAAC,QAAQ,EAAE,IAAI,EAAU,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAC,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAC,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAQpD,MAAM,OAAO,MAAM;;QAmIT,kBAAa,GAAG,GAAG,CAAC;sBA9HnB,MAAM,QAAQ,EAAE,EAAE;;;;yBAgBf,EAAE;4BAIC,EAAE;;;;;wBAoBI,KAAK;wBAIL,KAAK;wBAIL,KAAK;uBAIN,KAAK;;;;uBAgBI,IAAI;6BAID,aAAa,CA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encil/core\";\nimport {Fragment, Host, JSXBase} from \"@stencil/core/internal\";\nimport {ControlSize, InputStatus, InputType, LabelPosition} from \"../../beans\";\nimport {boolean, randomId} from \"../../utils/utils\";\n\n@Component({\n tag: \"z-input\",\n styleUrl: \"styles.css\",\n shadow: false,\n scoped: true,\n})\nexport class ZInput {\n @Element() hostElement: HTMLZInputElement;\n\n /** the id of the input element */\n @Prop()\n htmlid = `id-${randomId()}`;\n\n /** input types */\n @Prop()\n type: InputType;\n\n /** the input name */\n @Prop()\n name?: string;\n\n /** the input label */\n @Prop()\n label?: string;\n\n /** the input aria-label */\n @Prop()\n ariaLabel = \"\";\n\n /** the input aria-expaded: available for text, password, number, email */\n @Prop()\n ariaExpanded = \"\";\n\n /** the input aria-controls (optional): available for text, password, number, email */\n @Prop()\n ariaControls?: string;\n\n /** the input aria-autocomplete (optional): available for text, password, number, email */\n @Prop()\n ariaAutocomplete?: string;\n\n /** the input aria-activedescendant (optional): available for text, password, number, email */\n @Prop()\n ariaActivedescendant?: string;\n\n /** the input value */\n @Prop({mutable: true})\n value?: string;\n\n /** the input is disabled */\n @Prop({reflect: true})\n disabled?: boolean = false;\n\n /** the input is readonly */\n @Prop()\n readonly?: boolean = false;\n\n /** the input is required (optional): available for text, password, number, email, textarea, checkbox */\n @Prop()\n required?: boolean = false;\n\n /** checked: available for checkbox, radio */\n @Prop({mutable: true})\n checked?: boolean = false;\n\n /** the input placeholder (optional) */\n @Prop()\n placeholder?: string;\n\n /** the input html title (optional) */\n @Prop()\n htmltitle?: string;\n\n /** the input status (optional): available for text, password, number, email, textarea */\n @Prop()\n status?: InputStatus;\n\n /** input helper message (optional): available for text, password, number, email, textarea - if set to `false` message won't be displayed */\n @Prop()\n message?: string | boolean = true;\n\n /** the input label position: available for checkbox, radio */\n @Prop()\n labelPosition?: LabelPosition = LabelPosition.RIGHT;\n\n /** the input has autocomplete option (optional): available for text, password, number, email */\n @Prop()\n autocomplete?: string;\n\n /** the input role */\n @Prop()\n role = \"\";\n\n /** render clear icon when typing (optional): available for text */\n @Prop()\n hasclearicon?: boolean = true;\n\n /** render icon (optional): available for text */\n @Prop()\n icon?: string;\n\n /** min number value (optional): available for number */\n @Prop()\n min?: number;\n\n /** Min length value (optional): available for text */\n @Prop()\n minlength?: number;\n\n /** max number value (optional): available for number */\n @Prop()\n max?: number;\n\n /** Max length value (optional): available for text */\n @Prop()\n maxlength?: number;\n\n /** step number value (optional): available for number */\n @Prop()\n step?: number;\n\n /** pattern value (optional): available for tel, text, search, url, email, password*/\n @Prop()\n pattern?: string;\n\n /** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */\n @Prop({reflect: true})\n size?: ControlSize = ControlSize.BIG;\n\n @State()\n isTyping = false;\n\n @State()\n passwordHidden = true;\n\n private timer;\n\n private typingtimeout = 300;\n\n private inputRef: HTMLInputElement;\n\n @Listen(\"inputCheck\", {target: \"document\"})\n inputCheckListener(e: CustomEvent): void {\n const data = e.detail;\n switch (this.type) {\n case InputType.RADIO:\n if (data.type === InputType.RADIO && data.name === this.name && data.id !== this.htmlid) {\n this.checked = false;\n }\n break;\n }\n }\n\n /** get checked status */\n @Method()\n async isChecked(): Promise<boolean> {\n switch (this.type) {\n case InputType.CHECKBOX:\n case InputType.RADIO:\n return this.checked;\n default:\n console.warn(\"`isChecked` method is only available for type `checkbox` and `radio`\");\n\n return false;\n }\n }\n\n /** Emitted on input value change, returns value, validity */\n @Event()\n inputChange: EventEmitter;\n\n private emitInputChange(value: string): void {\n if (!this.isTyping) {\n this.emitStartTyping();\n }\n\n let validity: ValidityState;\n if (this.type === InputType.TEXTAREA) {\n validity = this.getValidity(\"textarea\");\n } else {\n validity = this.getValidity(\"input\");\n }\n this.value = value;\n this.inputChange.emit({value, validity});\n\n clearTimeout(this.timer);\n this.timer = setTimeout(() => {\n this.emitStopTyping(this.value, validity);\n }, this.typingtimeout);\n }\n\n /** Emitted when user starts typing */\n @Event()\n startTyping: EventEmitter;\n\n private emitStartTyping(): void {\n this.isTyping = true;\n this.startTyping.emit();\n }\n\n /** Emitted when user stops typing, returns value, validity */\n @Event()\n stopTyping: EventEmitter;\n\n private emitStopTyping(value: string, validity: ValidityState): void {\n this.isTyping = false;\n this.stopTyping.emit({\n value: value,\n validity: validity,\n });\n }\n\n /** Emitted on checkbox check/uncheck, returns id, checked, type, name, value, validity */\n @Event()\n inputCheck: EventEmitter;\n\n private emitInputCheck(checked: boolean): void {\n this.inputCheck.emit({\n id: this.htmlid,\n checked: checked,\n type: this.type,\n name: this.name,\n value: this.value,\n validity: this.getValidity(\"input\"),\n });\n }\n\n /** Emitted on input focus */\n @Event()\n inputFocus: EventEmitter;\n\n private emitInputFocus(): void {\n this.inputFocus.emit({id: this.htmlid});\n }\n\n /** Emitted on input blur */\n @Event()\n inputBlur: EventEmitter;\n\n private emitInputBlur(): void {\n this.inputBlur.emit({id: this.htmlid});\n }\n\n private getValidity(type: string): ValidityState {\n const input = this.hostElement.querySelector(type) as HTMLInputElement;\n\n return input.validity;\n }\n\n /* START text/password/email/number */\n\n private getTextAttributes(): JSXBase.InputHTMLAttributes<HTMLInputElement | HTMLTextAreaElement> {\n return {\n id: this.htmlid,\n name: this.name,\n placeholder: this.placeholder,\n value: this.value,\n disabled: this.disabled,\n readonly: this.readonly,\n required: this.required,\n title: this.htmltitle,\n minlength: this.minlength,\n maxlength: this.maxlength,\n class: {\n [`input-${this.status}`]: !!this.status,\n },\n autocomplete: this.autocomplete,\n onInput: (e: InputEvent) => this.emitInputChange((e.target as HTMLInputElement).value),\n };\n }\n\n private getNumberAttributes(type: InputType): JSXBase.InputHTMLAttributes<HTMLInputElement> {\n if (type != InputType.NUMBER) {\n return;\n }\n\n return {\n min: this.min,\n max: this.max,\n step: this.step,\n };\n }\n\n private getPatternAttribute(type: InputType): JSXBase.InputHTMLAttributes<HTMLInputElement> {\n if (\n type != InputType.PASSWORD &&\n type != InputType.TEXT &&\n type != InputType.TEL &&\n type != InputType.SEARCH &&\n type != InputType.URL &&\n type != InputType.EMAIL\n ) {\n return;\n }\n\n return {\n pattern: this.pattern,\n };\n }\n\n private getRoleAttribute(): JSXBase.InputHTMLAttributes<HTMLInputElement | HTMLTextAreaElement> {\n return this.role ? {role: this.role} : {};\n }\n\n private getAriaAttrubutes(): Record<string, unknown> {\n const expanded = this.ariaExpanded ? {\"aria-expanded\": this.ariaExpanded} : {};\n const controls = this.ariaControls ? {\"aria-controls\": this.ariaControls} : {};\n const autocomplete = this.ariaAutocomplete ? {\"aria-autocomplete\": this.ariaAutocomplete} : {};\n const activedescendant = this.ariaActivedescendant ? {\"aria-activedescendant\": this.ariaActivedescendant} : {};\n\n return {\n ...expanded,\n ...controls,\n ...autocomplete,\n ...activedescendant,\n };\n }\n\n private getFocusBlurAttributes(): JSXBase.InputHTMLAttributes<HTMLInputElement | HTMLTextAreaElement> {\n return {\n onFocus: () => this.emitInputFocus(),\n onBlur: () => this.emitInputBlur(),\n };\n }\n\n private renderInputText(type: InputType = InputType.TEXT): HTMLDivElement {\n const ariaLabel = this.ariaLabel ? {\"aria-label\": this.ariaLabel} : {};\n const attr = {\n ...this.getTextAttributes(),\n ...this.getNumberAttributes(type),\n ...this.getPatternAttribute(type),\n ...ariaLabel,\n ...this.getRoleAttribute(),\n ...this.getAriaAttrubutes(),\n ...this.getFocusBlurAttributes(),\n };\n if (this.icon || type === InputType.PASSWORD) {\n Object.assign(attr.class, {\"has-icon\": true});\n }\n if (this.hasclearicon && type != InputType.NUMBER && !!this.value) {\n Object.assign(attr.class, {\"has-clear-icon\": true});\n }\n\n return (\n <div class=\"text-wrapper\">\n {this.renderLabel()}\n <div>\n <input\n type={type === InputType.PASSWORD && !this.passwordHidden ? InputType.TEXT : type}\n {...attr}\n ref={(el) => (this.inputRef = el)}\n />\n {this.renderIcons()}\n </div>\n {this.renderMessage()}\n </div>\n );\n }\n\n private renderLabel(): HTMLLabelElement {\n if (!this.label) {\n return;\n }\n\n return (\n <label\n class=\"input-label body-5-sb\"\n id={`${this.htmlid}_label`}\n htmlFor={this.htmlid}\n >\n {this.label}\n </label>\n );\n }\n\n private renderIcons(): HTMLSpanElement {\n return (\n <span class=\"icons-wrapper\">\n {this.renderResetIcon()}\n {this.renderIcon()}\n </span>\n );\n }\n\n private renderIcon(): HTMLButtonElement {\n if (this.type === InputType.PASSWORD) {\n return this.renderShowHidePassword();\n }\n\n if (!this.icon) {\n return;\n }\n\n return (\n <z-icon\n name={this.icon}\n class={{[this.size]: true, \"input-icon\": true}}\n />\n );\n }\n\n private renderResetIcon(): HTMLButtonElement {\n let hidden = false;\n if (!this.hasclearicon || !this.value || this.disabled || this.readonly || this.type == InputType.NUMBER) {\n hidden = true;\n }\n\n return (\n <button\n type=\"button\"\n class={{\"reset-icon\": true, \"input-icon\": true, hidden}}\n aria-label=\"cancella il contenuto dell'input\"\n onClick={() => {\n this.inputRef.value = \"\";\n this.emitInputChange(\"\");\n }}\n >\n <z-icon\n name=\"multiply\"\n class={this.size}\n />\n </button>\n );\n }\n\n private renderShowHidePassword(): HTMLButtonElement {\n return (\n <button\n type=\"button\"\n class=\"input-icon toggle-password-icon\"\n disabled={this.disabled}\n aria-label={this.passwordHidden ? \"mostra password\" : \"nascondi password\"}\n onClick={() => (this.passwordHidden = !this.passwordHidden)}\n >\n <z-icon\n name={this.passwordHidden ? \"view-filled\" : \"view-off-filled\"}\n class={this.size}\n />\n </button>\n );\n }\n\n private renderMessage(): HTMLZInputMessageElement {\n if (boolean(this.message) === false) {\n return;\n }\n\n return (\n <z-input-message\n message={boolean(this.message) === true ? undefined : (this.message as string)}\n status={this.status}\n class={this.size}\n disabled={this.disabled}\n />\n );\n }\n\n /* END text/password/email/number */\n\n /* START textarea */\n\n private renderTextarea(): HTMLDivElement {\n const attributes = this.getTextAttributes();\n\n return (\n <Fragment>\n {this.renderLabel()}\n <div\n class={{\n ...(attributes.class as {[className: string]: boolean}),\n \"textarea-wrapper\": true,\n \"readonly\": !!attributes.readonly,\n }}\n >\n <textarea\n {...attributes}\n class={{\n ...(attributes.class as {[className: string]: boolean}),\n \"z-scrollbar\": true,\n }}\n aria-label={this.ariaLabel || undefined}\n {...this.getRoleAttribute()}\n ></textarea>\n </div>\n {this.renderMessage()}\n </Fragment>\n );\n }\n\n /* END textarea */\n\n private handleCheck(ev: Event): void {\n this.checked = (ev.target as HTMLInputElement).checked;\n this.emitInputCheck(this.checked);\n }\n\n /* START checkbox */\n private renderCheckbox(): HTMLDivElement {\n return (\n <div class=\"checkbox-wrapper\">\n <input\n id={this.htmlid}\n type=\"checkbox\"\n name={this.name}\n checked={this.checked}\n disabled={this.disabled}\n readonly={this.readonly}\n required={this.required}\n onChange={this.handleCheck.bind(this)}\n value={this.value}\n {...this.getRoleAttribute()}\n {...this.getFocusBlurAttributes()}\n />\n\n <label\n htmlFor={this.htmlid}\n class={{\n \"checkbox-label\": true,\n \"after\": this.labelPosition === LabelPosition.RIGHT,\n \"before\": this.labelPosition === LabelPosition.LEFT,\n }}\n >\n <z-icon\n name={this.checked ? \"checkbox-checked\" : \"checkbox\"}\n class={this.size}\n />\n {this.label && <span innerHTML={this.label}></span>}\n </label>\n </div>\n );\n }\n\n /* END checkbox */\n\n /* START radio */\n private renderRadio(): HTMLDivElement {\n return (\n <div class=\"radio-wrapper\">\n <input\n id={this.htmlid}\n type=\"radio\"\n name={this.name}\n checked={this.checked}\n disabled={this.disabled}\n readonly={this.readonly}\n onChange={this.handleCheck.bind(this)}\n value={this.value}\n {...this.getRoleAttribute()}\n {...this.getFocusBlurAttributes()}\n />\n\n <label\n htmlFor={this.htmlid}\n class={{\n \"radio-label\": true,\n \"after\": this.labelPosition === LabelPosition.RIGHT,\n \"before\": this.labelPosition === LabelPosition.LEFT,\n }}\n >\n <z-icon\n name={this.checked ? \"radio-button-checked\" : \"radio-button\"}\n class={this.size}\n />\n {this.label && <span innerHTML={this.label} />}\n </label>\n </div>\n );\n }\n /* END radio */\n\n render(): HTMLInputElement | HTMLDivElement {\n let input;\n switch (this.type) {\n case InputType.TEXTAREA:\n input = this.renderTextarea();\n break;\n case InputType.CHECKBOX:\n input = this.renderCheckbox();\n break;\n case InputType.RADIO:\n input = this.renderRadio();\n break;\n default:\n input = this.renderInputText(this.type);\n }\n\n return <Host>{input}</Host>;\n }\n}\n"]}
|
|
@@ -64,58 +64,62 @@ const StoryMeta = {
|
|
|
64
64
|
export default StoryMeta;
|
|
65
65
|
export const AllProps = {
|
|
66
66
|
render: (args) => html `
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
67
|
+
<div style="width:50%">
|
|
68
|
+
<z-input
|
|
69
|
+
type=${args.type}
|
|
70
|
+
label=${args.label}
|
|
71
|
+
aria-label=${args.ariaLabel}
|
|
72
|
+
.labelPosition=${args.labelPosition}
|
|
73
|
+
placeholder=${args.placeholder}
|
|
74
|
+
value=${args.value}
|
|
75
|
+
name=${args.name}
|
|
76
|
+
status=${args.status}
|
|
77
|
+
message=${args.message}
|
|
78
|
+
icon=${args.icon}
|
|
79
|
+
.disabled=${args.disabled}
|
|
80
|
+
.readonly=${args.readonly}
|
|
81
|
+
.required=${args.required}
|
|
82
|
+
.checked=${args.checked}
|
|
83
|
+
hasclearicon=${args.hasclearicon}
|
|
84
|
+
htmlid=${args.htmlid}
|
|
85
|
+
htmltitle=${args.htmltitle}
|
|
86
|
+
.autocomplete=${args.autocomplete}
|
|
87
|
+
min=${args.min}
|
|
88
|
+
minlength=${args.minlength}
|
|
89
|
+
max=${args.max}
|
|
90
|
+
maxlength=${args.maxlength}
|
|
91
|
+
step=${args.step}
|
|
92
|
+
pattern=${args.pattern}
|
|
93
|
+
size=${args.size}
|
|
94
|
+
></z-input>
|
|
95
|
+
</div>
|
|
94
96
|
`,
|
|
95
97
|
};
|
|
96
98
|
export const ZInputText = {
|
|
97
99
|
render: (args) => html `
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
100
|
+
<div style="width:50%">
|
|
101
|
+
<z-input
|
|
102
|
+
type=${args.type}
|
|
103
|
+
label=${args.label}
|
|
104
|
+
aria-label=${args.ariaLabel}
|
|
105
|
+
placeholder=${args.placeholder}
|
|
106
|
+
value=${args.value}
|
|
107
|
+
name=${args.name}
|
|
108
|
+
status=${args.status}
|
|
109
|
+
message=${args.message}
|
|
110
|
+
icon=${args.icon}
|
|
111
|
+
.disabled=${args.disabled}
|
|
112
|
+
.readonly=${args.readonly}
|
|
113
|
+
.required=${args.required}
|
|
114
|
+
hasclearicon=${args.hasclearicon}
|
|
115
|
+
htmlid=${args.htmlid}
|
|
116
|
+
htmltitle=${args.htmltitle}
|
|
117
|
+
.autocomplete=${args.autocomplete}
|
|
118
|
+
size=${args.size}
|
|
119
|
+
minlength=${args.minlength}
|
|
120
|
+
maxlength=${args.maxlength}
|
|
121
|
+
></z-input>
|
|
122
|
+
</div>
|
|
119
123
|
`,
|
|
120
124
|
parameters: {
|
|
121
125
|
controls: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../../../src/components/z-input/index.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAAC,WAAW,EAAE,WAAW,EAAE,SAAS,E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F;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS,CAAC,KAAK;KACtB;IACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;;aAEX,IAAI,CAAC,IAAI;cACR,IAAI,CAAC,KAAK;mBACL,IAAI,CAAC,SAAS;uBACV,IAAI,CAAC,aAAa;aAC5B,IAAI,CAAC,IAAI;cACR,IAAI,CAAC,KAAK;kBACN,IAAI,CAAC,QAAQ;kBACb,IAAI,CAAC,QAAQ;kBACb,IAAI,CAAC,QAAQ;iBACd,IAAI,CAAC,OAAO;eACd,IAAI,CAAC,MAAM;kBACR,IAAI,CAAC,SAAS;aACnB,IAAI,CAAC,IAAI;;GAEnB;CACc,CAAC;AAElB,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,UAAU,EAAE;QACV,QAAQ,EAAE;YACR,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC;SACzD;KACF;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS,CAAC,MAAM;QACtB,KAAK,EAAE,GAAG;QACV,YAAY,EAAE,KAAK;KACpB;IACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;;aAEX,IAAI,CAAC,IAAI;cACR,IAAI,CAAC,KAAK;YACZ,IAAI,CAAC,GAAG;YACR,IAAI,CAAC,GAAG;aACP,IAAI,CAAC,IAAI;sBACA,IAAI,CAAC,YAAY;;GAEpC;CACc,CAAC","sourcesContent":["import {Meta, StoryObj} from \"@storybook/web-components\";\nimport {html} from \"lit\";\nimport {ZInput} from \".\";\nimport {ControlSize, InputStatus, InputType, LabelPosition} from \"../../beans\";\nimport \"./index\";\n\nconst StoryMeta = {\n title: \"ZInput\",\n component: \"z-input\",\n argTypes: {\n type: {\n control: {\n type: \"inline-radio\",\n },\n options: Object.values(InputType),\n },\n labelPosition: {\n control: {\n type: \"inline-radio\",\n },\n options: Object.values(LabelPosition),\n },\n size: {\n control: {\n type: \"inline-radio\",\n },\n options: Object.values(ControlSize),\n },\n status: {\n control: {\n type: \"inline-radio\",\n labels: {\n null: \"-\",\n },\n },\n options: [null, ...Object.values(InputStatus)],\n },\n },\n args: {\n type: InputType.TEXT,\n label: \"this is the input label\",\n ariaLabel: \"\",\n labelPosition: LabelPosition.RIGHT,\n placeholder: \"input placeholder text\",\n value: \"\",\n size: ControlSize.BIG,\n name: \"\",\n status: null,\n message: \"helper text\",\n icon: \"\",\n disabled: false,\n readonly: false,\n required: false,\n checked: false,\n hasclearicon: true,\n htmlid: \"input-id\",\n htmltitle: \"\",\n autocomplete: \"\",\n min: 1,\n minlength: 1,\n max: 10,\n maxlength: 10,\n step: 1,\n pattern: \"\",\n },\n} satisfies Meta<ZInput>;\n\nexport default StoryMeta;\n\ntype Story = StoryObj<ZInput>;\n\nexport const AllProps = {\n render: (args) => html`\n <z-input\n type=${args.type}\n label=${args.label}\n aria-label=${args.ariaLabel}\n .labelPosition=${args.labelPosition}\n placeholder=${args.placeholder}\n value=${args.value}\n name=${args.name}\n status=${args.status}\n message=${args.message}\n icon=${args.icon}\n .disabled=${args.disabled}\n .readonly=${args.readonly}\n .required=${args.required}\n .checked=${args.checked}\n hasclearicon=${args.hasclearicon}\n htmlid=${args.htmlid}\n htmltitle=${args.htmltitle}\n .autocomplete=${args.autocomplete}\n min=${args.min}\n minlength=${args.minlength}\n max=${args.max}\n maxlength=${args.maxlength}\n step=${args.step}\n pattern=${args.pattern}\n size=${args.size}\n ></z-input>\n `,\n} satisfies Story;\n\nexport const ZInputText = {\n render: (args) => html`\n <z-input\n type=${args.type}\n label=${args.label}\n aria-label=${args.ariaLabel}\n placeholder=${args.placeholder}\n value=${args.value}\n name=${args.name}\n status=${args.status}\n message=${args.message}\n icon=${args.icon}\n .disabled=${args.disabled}\n .readonly=${args.readonly}\n .required=${args.required}\n hasclearicon=${args.hasclearicon}\n htmlid=${args.htmlid}\n htmltitle=${args.htmltitle}\n .autocomplete=${args.autocomplete}\n size=${args.size}\n minlength=${args.minlength}\n maxlength=${args.maxlength}\n ></z-input>\n `,\n parameters: {\n controls: {\n include: [\n \"type\",\n \"label\",\n \"ariaLabel\",\n \"placeholder\",\n \"value\",\n \"name\",\n \"status\",\n \"message\",\n \"icon\",\n \"disabled\",\n \"readonly\",\n \"required\",\n \"hasclearicon\",\n \"htmlid\",\n \"htmltitle\",\n \"autocomplete\",\n \"size\",\n \"minlength\",\n \"maxlength\",\n ],\n },\n },\n argTypes: {\n type: {\n options: Object.values(InputType).filter((type) => [\"text\", \"password\", \"number\", \"email\"].includes(type)),\n },\n },\n} satisfies Story;\n\nexport const ZInputTextarea = {\n render: (args) => html`\n <z-input\n type=${args.type}\n label=${args.label}\n aria-label=${args.ariaLabel}\n placeholder=${args.placeholder}\n value=${args.value}\n name=${args.name}\n status=${args.status}\n message=${args.message}\n .disabled=${args.disabled}\n .readonly=${args.readonly}\n .required=${args.required}\n htmlid=${args.htmlid}\n htmltitle=${args.htmltitle}\n size=${args.size}\n ></z-input>\n `,\n parameters: {\n controls: {\n include: [\n \"type\",\n \"label\",\n \"ariaLabel\",\n \"placeholder\",\n \"value\",\n \"name\",\n \"status\",\n \"message\",\n \"disabled\",\n \"readonly\",\n \"required\",\n \"htmlid\",\n \"htmltitle\",\n \"size\",\n ],\n },\n },\n args: {\n type: InputType.TEXTAREA,\n },\n} satisfies Story;\n\nexport const ZInputCheckbox = {\n parameters: {\n controls: {\n include: [\n \"label\",\n \"ariaLabel\",\n \"labelPosition\",\n \"name\",\n \"disabled\",\n \"readonly\",\n \"required\",\n \"checked\",\n \"htmlid\",\n \"htmltitle\",\n \"size\",\n ],\n },\n },\n args: {\n type: InputType.CHECKBOX,\n },\n render: (args) => html`\n <z-input\n type=\"${args.type}\"\n label=${args.label}\n aria-label=${args.ariaLabel}\n .labelPosition=${args.labelPosition}\n name=${args.name}\n .disabled=${args.disabled}\n .readonly=${args.readonly}\n .required=${args.required}\n .checked=${args.checked}\n htmlid=${args.htmlid}\n htmltitle=${args.htmltitle}\n size=${args.size}\n ></z-input>\n `,\n} satisfies Story;\n\nexport const ZInputRadio = {\n parameters: {\n controls: {\n include: [\n \"label\",\n \"ariaLabel\",\n \"labelPosition\",\n \"name\",\n \"value\",\n \"disabled\",\n \"readonly\",\n \"required\",\n \"checked\",\n \"htmlid\",\n \"htmltitle\",\n \"size\",\n ],\n },\n },\n args: {\n type: InputType.RADIO,\n },\n render: (args) => html`\n <z-input\n type=${args.type}\n label=${args.label}\n aria-label=${args.ariaLabel}\n .labelPosition=${args.labelPosition}\n name=${args.name}\n value=${args.value}\n .disabled=${args.disabled}\n .readonly=${args.readonly}\n .required=${args.required}\n .checked=${args.checked}\n htmlid=${args.htmlid}\n htmltitle=${args.htmltitle}\n size=${args.size}\n ></z-input>\n `,\n} satisfies Story;\n\nexport const ZInputNumber = {\n parameters: {\n controls: {\n include: [\"min\", \"max\", \"step\", \"value\", \"hasclearicon\"],\n },\n },\n args: {\n type: InputType.NUMBER,\n value: \"1\",\n hasclearicon: false,\n },\n render: (args) => html`\n <z-input\n type=${args.type}\n value=${args.value}\n min=${args.min}\n max=${args.max}\n step=${args.step}\n .hasclearicon=${args.hasclearicon}\n ></z-input>\n `,\n} satisfies Story;\n"]}
|
|
1
|
+
{"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../../../src/components/z-input/index.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAAC,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAC,MAAM,aAAa,CAAC;AAC/E,OAAO,SAAS,CAAC;AAEjB,MAAM,SAAS,GAAG;IAChB,KAAK,EAAE,QAAQ;IACf,SAAS,EAAE,SAAS;IACpB,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,OAAO,EAAE;gBACP,IAAI,EAAE,cAAc;aACrB;YACD,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC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ACR,IAAI,CAAC,KAAK;kBACN,IAAI,CAAC,QAAQ;kBACb,IAAI,CAAC,QAAQ;kBACb,IAAI,CAAC,QAAQ;iBACd,IAAI,CAAC,OAAO;eACd,IAAI,CAAC,MAAM;kBACR,IAAI,CAAC,SAAS;aACnB,IAAI,CAAC,IAAI;;GAEnB;CACc,CAAC;AAElB,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,UAAU,EAAE;QACV,QAAQ,EAAE;YACR,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC;SACzD;KACF;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS,CAAC,MAAM;QACtB,KAAK,EAAE,GAAG;QACV,YAAY,EAAE,KAAK;KACpB;IACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;;aAEX,IAAI,CAAC,IAAI;cACR,IAAI,CAAC,KAAK;YACZ,IAAI,CAAC,GAAG;YACR,IAAI,CAAC,GAAG;aACP,IAAI,CAAC,IAAI;sBACA,IAAI,CAAC,YAAY;;GAEpC;CACc,CAAC","sourcesContent":["import {Meta, StoryObj} from \"@storybook/web-components\";\nimport {html} from \"lit\";\nimport {ZInput} from \".\";\nimport {ControlSize, InputStatus, InputType, LabelPosition} from \"../../beans\";\nimport \"./index\";\n\nconst StoryMeta = {\n title: \"ZInput\",\n component: \"z-input\",\n argTypes: {\n type: {\n control: {\n type: \"inline-radio\",\n },\n options: Object.values(InputType),\n },\n labelPosition: {\n control: {\n type: \"inline-radio\",\n },\n options: Object.values(LabelPosition),\n },\n size: {\n control: {\n type: \"inline-radio\",\n },\n options: Object.values(ControlSize),\n },\n status: {\n control: {\n type: \"inline-radio\",\n labels: {\n null: \"-\",\n },\n },\n options: [null, ...Object.values(InputStatus)],\n },\n },\n args: {\n type: InputType.TEXT,\n label: \"this is the input label\",\n ariaLabel: \"\",\n labelPosition: LabelPosition.RIGHT,\n placeholder: \"input placeholder text\",\n value: \"\",\n size: ControlSize.BIG,\n name: \"\",\n status: null,\n message: \"helper text\",\n icon: \"\",\n disabled: false,\n readonly: false,\n required: false,\n checked: false,\n hasclearicon: true,\n htmlid: \"input-id\",\n htmltitle: \"\",\n autocomplete: \"\",\n min: 1,\n minlength: 1,\n max: 10,\n maxlength: 10,\n step: 1,\n pattern: \"\",\n },\n} satisfies Meta<ZInput>;\n\nexport default StoryMeta;\n\ntype Story = StoryObj<ZInput>;\n\nexport const AllProps = {\n render: (args) => html`\n <div style=\"width:50%\">\n <z-input\n type=${args.type}\n label=${args.label}\n aria-label=${args.ariaLabel}\n .labelPosition=${args.labelPosition}\n placeholder=${args.placeholder}\n value=${args.value}\n name=${args.name}\n status=${args.status}\n message=${args.message}\n icon=${args.icon}\n .disabled=${args.disabled}\n .readonly=${args.readonly}\n .required=${args.required}\n .checked=${args.checked}\n hasclearicon=${args.hasclearicon}\n htmlid=${args.htmlid}\n htmltitle=${args.htmltitle}\n .autocomplete=${args.autocomplete}\n min=${args.min}\n minlength=${args.minlength}\n max=${args.max}\n maxlength=${args.maxlength}\n step=${args.step}\n pattern=${args.pattern}\n size=${args.size}\n ></z-input>\n </div>\n `,\n} satisfies Story;\n\nexport const ZInputText = {\n render: (args) => html`\n <div style=\"width:50%\">\n <z-input\n type=${args.type}\n label=${args.label}\n aria-label=${args.ariaLabel}\n placeholder=${args.placeholder}\n value=${args.value}\n name=${args.name}\n status=${args.status}\n message=${args.message}\n icon=${args.icon}\n .disabled=${args.disabled}\n .readonly=${args.readonly}\n .required=${args.required}\n hasclearicon=${args.hasclearicon}\n htmlid=${args.htmlid}\n htmltitle=${args.htmltitle}\n .autocomplete=${args.autocomplete}\n size=${args.size}\n minlength=${args.minlength}\n maxlength=${args.maxlength}\n ></z-input>\n </div>\n `,\n parameters: {\n controls: {\n include: [\n \"type\",\n \"label\",\n \"ariaLabel\",\n \"placeholder\",\n \"value\",\n \"name\",\n \"status\",\n \"message\",\n \"icon\",\n \"disabled\",\n \"readonly\",\n \"required\",\n \"hasclearicon\",\n \"htmlid\",\n \"htmltitle\",\n \"autocomplete\",\n \"size\",\n \"minlength\",\n \"maxlength\",\n ],\n },\n },\n argTypes: {\n type: {\n options: Object.values(InputType).filter((type) => [\"text\", \"password\", \"number\", \"email\"].includes(type)),\n },\n },\n} satisfies Story;\n\nexport const ZInputTextarea = {\n render: (args) => html`\n <z-input\n type=${args.type}\n label=${args.label}\n aria-label=${args.ariaLabel}\n placeholder=${args.placeholder}\n value=${args.value}\n name=${args.name}\n status=${args.status}\n message=${args.message}\n .disabled=${args.disabled}\n .readonly=${args.readonly}\n .required=${args.required}\n htmlid=${args.htmlid}\n htmltitle=${args.htmltitle}\n size=${args.size}\n ></z-input>\n `,\n parameters: {\n controls: {\n include: [\n \"type\",\n \"label\",\n \"ariaLabel\",\n \"placeholder\",\n \"value\",\n \"name\",\n \"status\",\n \"message\",\n \"disabled\",\n \"readonly\",\n \"required\",\n \"htmlid\",\n \"htmltitle\",\n \"size\",\n ],\n },\n },\n args: {\n type: InputType.TEXTAREA,\n },\n} satisfies Story;\n\nexport const ZInputCheckbox = {\n parameters: {\n controls: {\n include: [\n \"label\",\n \"ariaLabel\",\n \"labelPosition\",\n \"name\",\n \"disabled\",\n \"readonly\",\n \"required\",\n \"checked\",\n \"htmlid\",\n \"htmltitle\",\n \"size\",\n ],\n },\n },\n args: {\n type: InputType.CHECKBOX,\n },\n render: (args) => html`\n <z-input\n type=\"${args.type}\"\n label=${args.label}\n aria-label=${args.ariaLabel}\n .labelPosition=${args.labelPosition}\n name=${args.name}\n .disabled=${args.disabled}\n .readonly=${args.readonly}\n .required=${args.required}\n .checked=${args.checked}\n htmlid=${args.htmlid}\n htmltitle=${args.htmltitle}\n size=${args.size}\n ></z-input>\n `,\n} satisfies Story;\n\nexport const ZInputRadio = {\n parameters: {\n controls: {\n include: [\n \"label\",\n \"ariaLabel\",\n \"labelPosition\",\n \"name\",\n \"value\",\n \"disabled\",\n \"readonly\",\n \"required\",\n \"checked\",\n \"htmlid\",\n \"htmltitle\",\n \"size\",\n ],\n },\n },\n args: {\n type: InputType.RADIO,\n },\n render: (args) => html`\n <z-input\n type=${args.type}\n label=${args.label}\n aria-label=${args.ariaLabel}\n .labelPosition=${args.labelPosition}\n name=${args.name}\n value=${args.value}\n .disabled=${args.disabled}\n .readonly=${args.readonly}\n .required=${args.required}\n .checked=${args.checked}\n htmlid=${args.htmlid}\n htmltitle=${args.htmltitle}\n size=${args.size}\n ></z-input>\n `,\n} satisfies Story;\n\nexport const ZInputNumber = {\n parameters: {\n controls: {\n include: [\"min\", \"max\", \"step\", \"value\", \"hasclearicon\"],\n },\n },\n args: {\n type: InputType.NUMBER,\n value: \"1\",\n hasclearicon: false,\n },\n render: (args) => html`\n <z-input\n type=${args.type}\n value=${args.value}\n min=${args.min}\n max=${args.max}\n step=${args.step}\n .hasclearicon=${args.hasclearicon}\n ></z-input>\n `,\n} satisfies Story;\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
-
import {
|
|
2
|
+
import { ToastNotificationTransition } from "../../beans";
|
|
3
|
+
import { Breakpoints } from "../../constants/breakpoints";
|
|
3
4
|
import Hammer from "hammerjs";
|
|
4
5
|
export class ZToastNotification {
|
|
5
6
|
constructor() {
|
|
@@ -44,10 +45,12 @@ export class ZToastNotification {
|
|
|
44
45
|
this.toastClose.emit();
|
|
45
46
|
}
|
|
46
47
|
componentWillLoad() {
|
|
48
|
+
this.isMobile = window.innerWidth <= Breakpoints.MOBILE;
|
|
47
49
|
this.validateAutoclose();
|
|
48
50
|
this.percentage = 0;
|
|
49
51
|
}
|
|
50
52
|
componentDidLoad() {
|
|
53
|
+
this.isTextLong = this.detectWrap() || this.toastText.offsetHeight > 20;
|
|
51
54
|
this.startTime = Date.now();
|
|
52
55
|
if (this.autoclose && this.pauseonfocusloss) {
|
|
53
56
|
document.addEventListener("visibilitychange", this.visibilityChangeEventHandler);
|
|
@@ -128,23 +131,56 @@ export class ZToastNotification {
|
|
|
128
131
|
startClosingTimeout(time) {
|
|
129
132
|
this.timeoutHandle = window.setTimeout(() => this.emitToastClose(this.mapSlideOutClass()), time);
|
|
130
133
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
detectWrap() {
|
|
135
|
+
const parentWidth = this.container.offsetWidth;
|
|
136
|
+
const children = this.container.children;
|
|
137
|
+
let totalWidth = 0;
|
|
138
|
+
for (let i = 0; i < children.length; i++) {
|
|
139
|
+
totalWidth += children[i].offsetWidth;
|
|
140
|
+
}
|
|
141
|
+
return totalWidth > parentWidth;
|
|
142
|
+
}
|
|
143
|
+
renderText() {
|
|
144
|
+
return (h("div", { id: "text", ref: (el) => (this.toastText = el) }, this.heading && h("span", { class: "title" }, this.heading), h("span", { class: "message" }, this.message)));
|
|
145
|
+
}
|
|
146
|
+
renderButton() {
|
|
147
|
+
return (h("div", { id: "button" }, h("slot", { name: "button" })));
|
|
148
|
+
}
|
|
149
|
+
renderCloseIcon() {
|
|
150
|
+
if (!this.closebutton) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
return (h("div", { id: "icon" }, h("z-icon", { tabIndex: 0, name: "multiply-circled", width: 15, height: 15, onClick: () => this.emitToastClose(this.mapSlideOutClass()), onKeyPress: (e) => {
|
|
154
|
+
if (e.keyCode == 32 || e.keyCode == 13) {
|
|
134
155
|
e.preventDefault();
|
|
135
156
|
this.emitToastClose(this.mapSlideOutClass());
|
|
136
157
|
}
|
|
137
|
-
} })))
|
|
158
|
+
} })));
|
|
159
|
+
}
|
|
160
|
+
renderContainer() {
|
|
161
|
+
return (h("div", { tabIndex: 0, id: "external-container", class: {
|
|
162
|
+
[this.type]: !!this.type,
|
|
163
|
+
"several-lines-padding": this.isTextLong,
|
|
164
|
+
}, ref: (el) => (this.container = el) }, this.renderText(), this.renderButton(), this.renderCloseIcon()));
|
|
165
|
+
}
|
|
166
|
+
renderMobileContainer() {
|
|
167
|
+
return (h("div", { id: "external-container", class: {
|
|
168
|
+
[this.type]: !!this.type,
|
|
169
|
+
"several-lines-padding": this.isTextLong,
|
|
170
|
+
"mobile-wrapped": this.isTextLong,
|
|
171
|
+
} }, h("div", { id: "flex-container", ref: (el) => (this.container = el) }, this.renderText(), this.renderButton()), this.renderCloseIcon()));
|
|
138
172
|
}
|
|
139
173
|
render() {
|
|
140
|
-
return (h(Host, { key: '
|
|
174
|
+
return (h(Host, { key: '1fcfaf1bf2d6d6701eabab75ef95d956e2886fb3', style: {
|
|
175
|
+
"--percentuale": `${this.percentage}%`,
|
|
176
|
+
}, class: this.transition ? this.transition : ToastNotificationTransition.SLIDE_IN_DOWN, onAnimationEnd: (e) => {
|
|
141
177
|
if (this.autoclose && e.animationName.includes("slidein")) {
|
|
142
178
|
this.startClosingTimeout(this.autoclose);
|
|
143
179
|
}
|
|
144
180
|
if (e.animationName.includes("slideout")) {
|
|
145
181
|
this.hostElement.parentNode.removeChild(this.hostElement);
|
|
146
182
|
}
|
|
147
|
-
} }, this.
|
|
183
|
+
} }, this.isMobile ? this.renderMobileContainer() : this.renderContainer()));
|
|
148
184
|
}
|
|
149
185
|
static get is() { return "z-toast-notification"; }
|
|
150
186
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/z-toast-notification/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAC,MAAM,eAAe,CAAC;AACnG,OAAO,EAAC,YAAY,EAAE,iBAAiB,EAAE,2BAA2B,EAAC,MAAM,aAAa,CAAC;AAEzF,OAAO,MAAM,MAAM,UAAU,CAAC;AAO9B,MAAM,OAAO,kBAAkB;;QAkDrB,uBAAkB,GAAG,KAAK,CAAC;;;;;gCA7BN,IAAI;;2BAQT,IAA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AC,CAAiB,EAAE,EAAE;gBACpC,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;oBAC1D,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBAC3C,CAAC;gBACD,IAAI,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;oBACzC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBAC5D,CAAC;YACH,CAAC,IAEA,IAAI,CAAC,aAAa,EAAE,CAChB,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {Component, Element, Event, EventEmitter, Host, Prop, State, Watch, h} from \"@stencil/core\";\nimport {KeyboardCode, ToastNotification, ToastNotificationTransition} from \"../../beans\";\n\nimport Hammer from \"hammerjs\";\n\n@Component({\n tag: \"z-toast-notification\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZToastNotification {\n @Element() hostElement: HTMLZToastNotificationElement;\n\n /** toast notification's title */\n @Prop()\n heading?: string;\n\n /** toast notification's message */\n @Prop()\n message: string;\n\n /** toggles closing button rendering */\n @Prop()\n closebutton: boolean;\n\n /** toast notification closing timeout (ms) */\n @Prop()\n autoclose?: number;\n\n /** toast notification autoclose can be paused */\n @Prop()\n pauseonfocusloss?: boolean = true;\n\n /** toast notification type: dark, light, accent, error, success, warning */\n @Prop()\n type?: ToastNotification;\n\n /** toast notification can be draggable*/\n @Prop()\n isdraggable?: boolean = true;\n\n /** toast notification draggable percentage*/\n @Prop()\n draggablepercentage?: number = 80;\n\n /** toast notification animation type: slide-in-left, slide-in-right, slide-in-down, slide-in-up*/\n @Prop()\n transition?: ToastNotificationTransition;\n\n @State()\n percentage: number;\n\n private sliderManager: HammerManager;\n\n private elapsedTime: number;\n\n private timeoutHandle: number;\n\n private startTime: number;\n\n private isCloseEventCalled = false;\n\n @Watch(\"isdraggable\")\n watchPropIsdraggable(newValue: boolean): void {\n if (newValue) {\n this.sliderManager.get(\"pan\").set({enable: true});\n } else {\n this.sliderManager.get(\"pan\").set({enable: false});\n }\n }\n\n @Watch(\"autoclose\")\n watchPropAutoclose(newValue: number): void {\n clearTimeout(this.timeoutHandle);\n this.startClosingTimeout(newValue);\n }\n\n @Watch(\"pauseonfocusloss\")\n watchPropPauseonfocusloss(newValue: boolean): void {\n if (this.autoclose) {\n if (newValue) {\n document.addEventListener(\"visibilitychange\", this.visibilityChangeEventHandler);\n } else {\n document.removeEventListener(\"visibilitychange\", this.visibilityChangeEventHandler);\n }\n }\n }\n\n /** notification close event */\n @Event()\n toastClose: EventEmitter;\n\n private emitToastClose(cssClass: string): void {\n this.timeoutHandle = null;\n this.elapsedTime = null;\n this.hostElement.classList.add(cssClass);\n this.toastClose.emit();\n }\n\n componentWillLoad(): void {\n this.validateAutoclose();\n this.percentage = 0;\n }\n\n componentDidLoad(): void {\n this.startTime = Date.now();\n if (this.autoclose && this.pauseonfocusloss) {\n document.addEventListener(\"visibilitychange\", this.visibilityChangeEventHandler);\n }\n\n this.isdraggable && this.handleSlideOutDragAnimation();\n }\n\n private visibilityChangeEventHandler(): void {\n if (document.visibilityState === \"hidden\") {\n this.timeoutHandle && this.onBlur();\n } else {\n this.elapsedTime && this.onFocus();\n }\n }\n\n private validateAutoclose(): void {\n if (!this.autoclose && !this.closebutton) {\n console.error(\"At least one between autoclose and closebutton must be present\");\n }\n }\n\n private mapSlideOutClass(): ToastNotificationTransition {\n switch (this.transition) {\n case ToastNotificationTransition.SLIDE_IN_DOWN:\n return ToastNotificationTransition.SLIDE_OUT_UP;\n case ToastNotificationTransition.SLIDE_IN_UP:\n return ToastNotificationTransition.SLIDE_OUT_DOWN;\n case ToastNotificationTransition.SLIDE_IN_LEFT:\n return ToastNotificationTransition.SLIDE_OUT_RIGHT;\n case ToastNotificationTransition.SLIDE_IN_RIGHT:\n return ToastNotificationTransition.SLIDE_OUT_LEFT;\n }\n }\n\n private calculateDraggedPercentage(e): number {\n const bounding = this.hostElement.getBoundingClientRect();\n\n return Math.round((100 * e.deltaX) / bounding.width);\n }\n\n private handleSlideOutDragAnimation(): void {\n this.sliderManager = new Hammer(this.hostElement);\n this.sliderManager.get(\"pan\").set({\n direction: Hammer.DIRECTION_HORIZONTAL,\n });\n\n this.sliderManager.on(\"pan\", (e) => {\n this.percentage = this.calculateDraggedPercentage(e);\n this.hostElement.style.transition = \"none\";\n this.hostElement.classList.remove(this.transition);\n const translateObj = {\n translate: `translateX(${this.percentage}%)`,\n translateBack: \"translateX(0)\",\n };\n\n this.hostElement.style.opacity = `${100 - Math.abs(this.percentage)}%`;\n if (e.eventType === Hammer.DIRECTION_LEFT || e.eventType === Hammer.DIRECTION_RIGHT) {\n this.hostElement.style.transform = translateObj.translate;\n if (Math.abs(this.percentage) > this.draggablepercentage && !this.isCloseEventCalled) {\n this.isCloseEventCalled = true;\n this.emitToastClose(e.direction === Hammer.DIRECTION_LEFT ? \"slide-out-left\" : \"slide-out-right\");\n }\n }\n\n if (e.isFinal && Math.abs(this.percentage) < this.draggablepercentage) {\n this.hostElement.style.transform = translateObj.translateBack;\n this.hostElement.style.transition = \"all 1s\";\n this.hostElement.style.opacity = \"100%\";\n this.percentage = 0;\n }\n });\n }\n\n private onFocus(): void {\n let time = this.autoclose;\n if (this.elapsedTime) {\n time = this.autoclose - this.elapsedTime;\n }\n if (time > 0) {\n this.startClosingTimeout(time);\n }\n }\n\n private onBlur(): void {\n this.elapsedTime = Date.now() - this.startTime;\n clearTimeout(this.timeoutHandle);\n }\n\n private startClosingTimeout(time: number): void {\n this.timeoutHandle = window.setTimeout(() => this.emitToastClose(this.mapSlideOutClass()), time);\n }\n\n private renderContent(): HTMLDivElement {\n return (\n <div\n id=\"external-container\"\n tabIndex={0}\n class={{[this.type]: !!this.type}}\n >\n <div id=\"inner-container\">\n <div id=\"text\">\n {this.heading && <span class=\"title\">{this.heading}</span>}\n <span class=\"message\">{this.message}</span>\n </div>\n <div id=\"button\">\n <slot name=\"button\" />\n </div>\n </div>\n <div id=\"icon\">\n {this.closebutton && (\n <z-icon\n tabIndex={0}\n name=\"multiply-circled\"\n width={15}\n height={15}\n onClick={() => this.emitToastClose(this.mapSlideOutClass())}\n onKeyPress={(e) => {\n if (e.code == KeyboardCode.SPACE || e.code == KeyboardCode.ENTER) {\n e.preventDefault();\n this.emitToastClose(this.mapSlideOutClass());\n }\n }}\n />\n )}\n </div>\n </div>\n );\n }\n\n render(): HTMLZToastNotificationElement {\n return (\n <Host\n style={{\"--percentuale\": `${this.percentage}%`}}\n class={this.transition ? this.transition : ToastNotificationTransition.SLIDE_IN_DOWN}\n onAnimationEnd={(e: AnimationEvent) => {\n if (this.autoclose && e.animationName.includes(\"slidein\")) {\n this.startClosingTimeout(this.autoclose);\n }\n if (e.animationName.includes(\"slideout\")) {\n this.hostElement.parentNode.removeChild(this.hostElement);\n }\n }}\n >\n {this.renderContent()}\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/z-toast-notification/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAC,MAAM,eAAe,CAAC;AACnG,OAAO,EAAC,iBAAiB,EAAE,2BAA2B,EAAC,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAC,WAAW,EAAC,MAAM,6BAA6B,CAAC;AAExD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astNotification, ToastNotificationTransition} from \"../../beans\";\nimport {Breakpoints} from \"../../constants/breakpoints\";\n\nimport Hammer from \"hammerjs\";\n\n@Component({\n tag: \"z-toast-notification\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZToastNotification {\n @Element() hostElement: HTMLZToastNotificationElement;\n\n /** toast notification's title */\n @Prop()\n heading?: string;\n\n /** toast notification's message */\n @Prop()\n message: string;\n\n /** toggles closing button rendering */\n @Prop()\n closebutton: boolean;\n\n /** toast notification closing timeout (ms) */\n @Prop()\n autoclose?: number;\n\n /** toast notification autoclose can be paused */\n @Prop()\n pauseonfocusloss?: boolean = true;\n\n /** toast notification type: dark, light, accent, error, success, warning */\n @Prop()\n type?: ToastNotification;\n\n /** toast notification can be draggable*/\n @Prop()\n isdraggable?: boolean = true;\n\n /** toast notification draggable percentage*/\n @Prop()\n draggablepercentage?: number = 80;\n\n /** toast notification animation type: slide-in-left, slide-in-right, slide-in-down, slide-in-up*/\n @Prop()\n transition?: ToastNotificationTransition;\n\n @State()\n percentage: number;\n\n private isTextLong: boolean;\n\n private container!: HTMLElement;\n\n private toastText!: HTMLElement;\n\n private sliderManager: HammerManager;\n\n private elapsedTime: number;\n\n private timeoutHandle: number;\n\n private startTime: number;\n\n private isMobile: boolean;\n\n private isCloseEventCalled = false;\n\n @Watch(\"isdraggable\")\n watchPropIsdraggable(newValue: boolean): void {\n if (newValue) {\n this.sliderManager.get(\"pan\").set({enable: true});\n } else {\n this.sliderManager.get(\"pan\").set({enable: false});\n }\n }\n\n @Watch(\"autoclose\")\n watchPropAutoclose(newValue: number): void {\n clearTimeout(this.timeoutHandle);\n this.startClosingTimeout(newValue);\n }\n\n @Watch(\"pauseonfocusloss\")\n watchPropPauseonfocusloss(newValue: boolean): void {\n if (this.autoclose) {\n if (newValue) {\n document.addEventListener(\"visibilitychange\", this.visibilityChangeEventHandler);\n } else {\n document.removeEventListener(\"visibilitychange\", this.visibilityChangeEventHandler);\n }\n }\n }\n\n /** notification close event */\n @Event()\n toastClose: EventEmitter;\n\n private emitToastClose(cssClass: string): void {\n this.timeoutHandle = null;\n this.elapsedTime = null;\n this.hostElement.classList.add(cssClass);\n this.toastClose.emit();\n }\n\n componentWillLoad(): void {\n this.isMobile = window.innerWidth <= Breakpoints.MOBILE;\n this.validateAutoclose();\n this.percentage = 0;\n }\n\n componentDidLoad(): void {\n this.isTextLong = this.detectWrap() || this.toastText.offsetHeight > 20;\n this.startTime = Date.now();\n if (this.autoclose && this.pauseonfocusloss) {\n document.addEventListener(\"visibilitychange\", this.visibilityChangeEventHandler);\n }\n\n this.isdraggable && this.handleSlideOutDragAnimation();\n }\n\n private visibilityChangeEventHandler(): void {\n if (document.visibilityState === \"hidden\") {\n this.timeoutHandle && this.onBlur();\n } else {\n this.elapsedTime && this.onFocus();\n }\n }\n\n private validateAutoclose(): void {\n if (!this.autoclose && !this.closebutton) {\n console.error(\"At least one between autoclose and closebutton must be present\");\n }\n }\n\n private mapSlideOutClass(): ToastNotificationTransition {\n switch (this.transition) {\n case ToastNotificationTransition.SLIDE_IN_DOWN:\n return ToastNotificationTransition.SLIDE_OUT_UP;\n case ToastNotificationTransition.SLIDE_IN_UP:\n return ToastNotificationTransition.SLIDE_OUT_DOWN;\n case ToastNotificationTransition.SLIDE_IN_LEFT:\n return ToastNotificationTransition.SLIDE_OUT_RIGHT;\n case ToastNotificationTransition.SLIDE_IN_RIGHT:\n return ToastNotificationTransition.SLIDE_OUT_LEFT;\n }\n }\n\n private calculateDraggedPercentage(e): number {\n const bounding = this.hostElement.getBoundingClientRect();\n\n return Math.round((100 * e.deltaX) / bounding.width);\n }\n\n private handleSlideOutDragAnimation(): void {\n this.sliderManager = new Hammer(this.hostElement);\n this.sliderManager.get(\"pan\").set({\n direction: Hammer.DIRECTION_HORIZONTAL,\n });\n\n this.sliderManager.on(\"pan\", (e) => {\n this.percentage = this.calculateDraggedPercentage(e);\n this.hostElement.style.transition = \"none\";\n this.hostElement.classList.remove(this.transition);\n const translateObj = {\n translate: `translateX(${this.percentage}%)`,\n translateBack: \"translateX(0)\",\n };\n\n this.hostElement.style.opacity = `${100 - Math.abs(this.percentage)}%`;\n if (e.eventType === Hammer.DIRECTION_LEFT || e.eventType === Hammer.DIRECTION_RIGHT) {\n this.hostElement.style.transform = translateObj.translate;\n if (Math.abs(this.percentage) > this.draggablepercentage && !this.isCloseEventCalled) {\n this.isCloseEventCalled = true;\n this.emitToastClose(e.direction === Hammer.DIRECTION_LEFT ? \"slide-out-left\" : \"slide-out-right\");\n }\n }\n\n if (e.isFinal && Math.abs(this.percentage) < this.draggablepercentage) {\n this.hostElement.style.transform = translateObj.translateBack;\n this.hostElement.style.transition = \"all 1s\";\n this.hostElement.style.opacity = \"100%\";\n this.percentage = 0;\n }\n });\n }\n\n private onFocus(): void {\n let time = this.autoclose;\n if (this.elapsedTime) {\n time = this.autoclose - this.elapsedTime;\n }\n if (time > 0) {\n this.startClosingTimeout(time);\n }\n }\n\n private onBlur(): void {\n this.elapsedTime = Date.now() - this.startTime;\n clearTimeout(this.timeoutHandle);\n }\n\n private startClosingTimeout(time: number): void {\n this.timeoutHandle = window.setTimeout(() => this.emitToastClose(this.mapSlideOutClass()), time);\n }\n\n private detectWrap(): boolean {\n const parentWidth = this.container.offsetWidth;\n const children = this.container.children;\n let totalWidth = 0;\n\n for (let i = 0; i < children.length; i++) {\n totalWidth += (children[i] as HTMLElement).offsetWidth;\n }\n\n return totalWidth > parentWidth;\n }\n\n private renderText(): HTMLDivElement {\n return (\n <div\n id=\"text\"\n ref={(el) => (this.toastText = el as HTMLElement)}\n >\n {this.heading && <span class=\"title\">{this.heading}</span>}\n <span class=\"message\">{this.message}</span>\n </div>\n );\n }\n\n private renderButton(): HTMLDivElement {\n return (\n <div id=\"button\">\n <slot name=\"button\" />\n </div>\n );\n }\n\n private renderCloseIcon(): HTMLDivElement {\n if (!this.closebutton) {\n return;\n }\n\n return (\n <div id=\"icon\">\n <z-icon\n tabIndex={0}\n name=\"multiply-circled\"\n width={15}\n height={15}\n onClick={() => this.emitToastClose(this.mapSlideOutClass())}\n onKeyPress={(e) => {\n if (e.keyCode == 32 || e.keyCode == 13) {\n e.preventDefault();\n this.emitToastClose(this.mapSlideOutClass());\n }\n }}\n />\n </div>\n );\n }\n\n private renderContainer(): HTMLDivElement {\n return (\n <div\n tabIndex={0}\n id=\"external-container\"\n class={{\n [this.type]: !!this.type,\n \"several-lines-padding\": this.isTextLong,\n }}\n ref={(el) => (this.container = el as HTMLElement)}\n >\n {this.renderText()}\n {this.renderButton()}\n {this.renderCloseIcon()}\n </div>\n );\n }\n\n private renderMobileContainer(): HTMLDivElement {\n return (\n <div\n id=\"external-container\"\n class={{\n [this.type]: !!this.type,\n \"several-lines-padding\": this.isTextLong,\n \"mobile-wrapped\": this.isTextLong,\n }}\n >\n <div\n id=\"flex-container\"\n ref={(el) => (this.container = el as HTMLElement)}\n >\n {this.renderText()}\n {this.renderButton()}\n </div>\n {this.renderCloseIcon()}\n </div>\n );\n }\n\n render(): HTMLZToastNotificationElement {\n return (\n <Host\n style={{\n \"--percentuale\": `${this.percentage}%`,\n }}\n class={this.transition ? this.transition : ToastNotificationTransition.SLIDE_IN_DOWN}\n onAnimationEnd={(e: AnimationEvent) => {\n if (this.autoclose && e.animationName.includes(\"slidein\")) {\n this.startClosingTimeout(this.autoclose);\n }\n if (e.animationName.includes(\"slideout\")) {\n this.hostElement.parentNode.removeChild(this.hostElement);\n }\n }}\n >\n {this.isMobile ? this.renderMobileContainer() : this.renderContainer()}\n </Host>\n );\n }\n}\n"]}
|
|
@@ -2,7 +2,6 @@ import { html } from "lit";
|
|
|
2
2
|
import { ToastNotification, ToastNotificationTransition } from "../../beans";
|
|
3
3
|
import "../z-button/index";
|
|
4
4
|
import "./index";
|
|
5
|
-
const longText = "Testo decisamente lungo, che non sta su 1 sola riga. Questo testo occupa varie righe ed è un esempio di come vengono posizionati gli elementi in caso di testo lungo.";
|
|
6
5
|
const template = (args) => html `<div class="toast-container">
|
|
7
6
|
<z-toast-notification
|
|
8
7
|
heading="${args.heading}"
|
|
@@ -53,16 +52,14 @@ export const SlideInLeft = {
|
|
|
53
52
|
transition: ToastNotificationTransition.SLIDE_IN_LEFT,
|
|
54
53
|
},
|
|
55
54
|
};
|
|
56
|
-
export const
|
|
55
|
+
export const SlideInDown = {
|
|
57
56
|
args: {
|
|
58
57
|
transition: ToastNotificationTransition.SLIDE_IN_DOWN,
|
|
59
|
-
closebutton: false,
|
|
60
58
|
},
|
|
61
59
|
};
|
|
62
|
-
export const
|
|
60
|
+
export const SlideInUp = {
|
|
63
61
|
args: {
|
|
64
62
|
transition: ToastNotificationTransition.SLIDE_IN_UP,
|
|
65
|
-
message: longText,
|
|
66
63
|
},
|
|
67
64
|
};
|
|
68
65
|
export const SlottedButton = {
|
|
@@ -90,29 +87,4 @@ export const SlottedButton = {
|
|
|
90
87
|
</z-toast-notification>
|
|
91
88
|
</div>`,
|
|
92
89
|
};
|
|
93
|
-
export const SlottedButtonLongText = {
|
|
94
|
-
args: {
|
|
95
|
-
transition: ToastNotificationTransition.SLIDE_IN_DOWN,
|
|
96
|
-
},
|
|
97
|
-
render: (args) => html `<div class="toast-container slotted-button">
|
|
98
|
-
<z-toast-notification
|
|
99
|
-
heading="Titolo abbastanza lungo"
|
|
100
|
-
message=${longText}
|
|
101
|
-
closebutton="${args.closebutton}"
|
|
102
|
-
autoclose="${args.autoclose}"
|
|
103
|
-
pauseonfocusloss="${args.pauseonfocusloss}"
|
|
104
|
-
type="${args.type}"
|
|
105
|
-
isdraggable="${args.isdraggable}"
|
|
106
|
-
draggablepercentage="${args.draggablepercentage}"
|
|
107
|
-
transition="${args.transition}"
|
|
108
|
-
>
|
|
109
|
-
<z-button
|
|
110
|
-
slot="button"
|
|
111
|
-
size="small"
|
|
112
|
-
variant="tertiary"
|
|
113
|
-
>button</z-button
|
|
114
|
-
>
|
|
115
|
-
</z-toast-notification>
|
|
116
|
-
</div>`,
|
|
117
|
-
};
|
|
118
90
|
//# sourceMappingURL=index.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../../../src/components/z-toast-notification/index.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAsB,MAAM,KAAK,CAAC;AAE9C,OAAO,EAAC,iBAAiB,EAAE,2BAA2B,EAAC,MAAM,aAAa,CAAC;AAC3E,OAAO,mBAAmB,CAAC;AAC3B,OAAO,SAAS,CAAC;AAEjB,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../../../src/components/z-toast-notification/index.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAsB,MAAM,KAAK,CAAC;AAE9C,OAAO,EAAC,iBAAiB,EAAE,2BAA2B,EAAC,MAAM,aAAa,CAAC;AAC3E,OAAO,mBAAmB,CAAC;AAC3B,OAAO,SAAS,CAAC;AAEjB,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAkB,EAAE,CACxC,IAAI,CAAA;;iBAEW,IAAI,CAAC,OAAO;iBACZ,IAAI,CAAC,OAAO;qBACR,IAAI,CAAC,WAAW;mBAClB,IAAI,CAAC,SAAS;0BACP,IAAI,CAAC,gBAAgB;cACjC,IAAI,CAAC,IAAI;qBACF,IAAI,CAAC,WAAW;6BACR,IAAI,CAAC,mBAAmB;oBACjC,IAAI,CAAC,UAAU;;SAE1B,CAAC;AACV,MAAM,SAAS,GAAG;IAChB,KAAK,EAAE,oBAAoB;IAC3B,SAAS,EAAE,sBAAsB;IACjC,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;aACf;YACD,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC;SAC1C;QACD,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;aACf;YACD,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,2BAA2B,CAAC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nimport {html, type TemplateResult} from \"lit\";\nimport {type ZToastNotification} from \".\";\nimport {ToastNotification, ToastNotificationTransition} from \"../../beans\";\nimport \"../z-button/index\";\nimport \"./index\";\n\nconst template = (args): TemplateResult =>\n html`<div class=\"toast-container\">\n <z-toast-notification\n heading=\"${args.heading}\"\n message=\"${args.message}\"\n closebutton=\"${args.closebutton}\"\n autoclose=\"${args.autoclose}\"\n pauseonfocusloss=\"${args.pauseonfocusloss}\"\n type=\"${args.type}\"\n isdraggable=\"${args.isdraggable}\"\n draggablepercentage=\"${args.draggablepercentage}\"\n transition=\"${args.transition}\"\n ></z-toast-notification>\n </div>`;\nconst StoryMeta = {\n title: \"ZToastNotification\",\n component: \"z-toast-notification\",\n argTypes: {\n type: {\n control: {\n type: \"select\",\n },\n options: Object.values(ToastNotification),\n },\n transition: {\n control: {\n type: \"select\",\n },\n options: Object.values(ToastNotificationTransition),\n },\n },\n args: {\n heading: \"Titolo\",\n message: \"Questo è un messaggio di prova.\",\n closebutton: true,\n autoclose: null,\n pauseonfocusloss: false,\n type: ToastNotification.DARK,\n isdraggable: true,\n draggablepercentage: 80,\n transition: ToastNotificationTransition.SLIDE_IN_RIGHT,\n },\n render: (args) => template(args),\n} satisfies Meta<ZToastNotification>;\nexport default StoryMeta;\n\ntype Story = StoryObj<ZToastNotification>;\nexport const SlideInRight = {} satisfies Story;\n\nexport const SlideInLeft = {\n args: {\n transition: ToastNotificationTransition.SLIDE_IN_LEFT,\n },\n} satisfies Story;\n\nexport const SlideInDown = {\n args: {\n transition: ToastNotificationTransition.SLIDE_IN_DOWN,\n },\n} satisfies Story;\n\nexport const SlideInUp = {\n args: {\n transition: ToastNotificationTransition.SLIDE_IN_UP,\n },\n} satisfies Story;\n\nexport const SlottedButton = {\n args: {\n transition: ToastNotificationTransition.SLIDE_IN_DOWN,\n },\n render: (args) =>\n html`<div class=\"toast-container slotted-button\">\n <z-toast-notification\n heading=\"${args.heading}\"\n message=\"${args.message}\"\n closebutton=\"${args.closebutton}\"\n autoclose=\"${args.autoclose}\"\n pauseonfocusloss=\"${args.pauseonfocusloss}\"\n type=\"${args.type}\"\n isdraggable=\"${args.isdraggable}\"\n draggablepercentage=\"${args.draggablepercentage}\"\n transition=\"${args.transition}\"\n >\n <z-button\n slot=\"button\"\n size=\"small\"\n variant=\"tertiary\"\n >button</z-button\n >\n </z-toast-notification>\n </div>`,\n} satisfies Story;\n"]}
|