@paperless/core 1.12.0 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"input-group.component.js","sourceRoot":"","sources":["../../../../src/components/molecules/input-group/input-group.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,OAAO,EACP,CAAC,EACD,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,GACR,MAAM,eAAe,CAAC;AASvB,MAAM,OAAO,UAAU;;gBAIgB,QAAQ;;;;;;wBA8BH,OAAO;;;;;oBAyBF,KAAK;mBAKN,KAAK;uBAKR,OAAO;6BAOX,KAAK;;EAE1C,mBAAmB;IACf,IAAI,CAAC,gBAAgB,EAAE,CAAC;EAC5B,CAAC;EAED,MAAM;;IACF,MAAM,EACF,aAAa,EACb,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,yBAAyB,EACzB,YAAY,GACf,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IAExB,OAAO,CACH,EAAC,IAAI,IACD,KAAK,EAAE,iBAAiB,CAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,MAAM,KAAI,OAAO,IACjD,IAAI,CAAC,QAAQ,IAAI,UACrB,IAAI,IAAI,CAAC,OAAO,IAAI,SAAS,SAAS,IAAI,CAAC,IAAI,EAAE;MAEjD,WAAK,KAAK,EAAC,gCAAgC;QACtC,KAAK,IAAI,CACN,WACI,KAAK,EAAC,aAAa,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE;UAEhC,KAAK;UACL,IAAI,CAAC,QAAQ,IAAI,CACd,YAAM,KAAK,EAAC,oBAAoB,QAAS,CAC5C,CACC,CACT;QAEA,CAAC,MAAM,IAAI,aAAa,CAAC,IAAI,CAC1B,WAAK,KAAK,EAAC,cAAc;UACpB,aAAa,IAAI,YAAM,IAAI,EAAC,QAAQ,GAAG;UACvC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import {\n Component,\n Element,\n h,\n Host,\n Listen,\n Prop,\n State,\n} from '@stencil/core';\nimport { RotateOptions } from '../../../types/tailwind';\nimport { IconFlipOptions, IconVariant } from '../../atoms/icon/icon.component';\n\n@Component({\n tag: 'p-input-group',\n styleUrl: './input-group.component.scss',\n shadow: true,\n})\nexport class InputGroup {\n /**\n * The size of the input group\n */\n @Prop() size: 'small' | 'medium' = 'medium';\n\n /**\n * The prefix of the input group\n */\n @Prop() prefix: string;\n\n /**\n * The suffix of the input group\n */\n @Prop() suffix: string;\n\n /**\n * Icon of the input group\n */\n @Prop() icon: IconVariant;\n\n /**\n * Icon flip\n */\n @Prop() iconFlip: IconFlipOptions;\n\n /**\n * Icon rotate\n */\n @Prop() iconRotate: RotateOptions;\n\n /**\n * Icon position\n */\n @Prop() iconPosition: 'start' | 'end' = 'start';\n\n /**\n * The label of the input group\n */\n @Prop() label: string;\n\n /**\n * The helper of the input group\n */\n @Prop() helper: string;\n\n /**\n * Wether the field is required\n */\n @Prop({ reflect: true }) required: boolean;\n\n /**\n * The helper of the input group\n */\n @Prop({ reflect: true }) error: string;\n\n /**\n * Wether the input group is disabled\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /**\n * Wether the input group is focused\n */\n @Prop({ reflect: true }) focused: boolean = false;\n\n /**\n * The method to use when focusing the input\n */\n @Prop() focusMethod: 'focus' | 'click' = 'focus';\n\n /**\n * The host element\n */\n @Element() private _el: HTMLElement;\n\n @State() private _forceShowTooltip = false;\n\n componentWillRender() {\n this._setInputClasses();\n }\n\n render() {\n const {\n hasHeaderSlot,\n helper,\n label,\n prefix,\n suffix,\n errorAndErrorIsNotBoolean,\n errorVariant,\n } = this._getSlotInfo();\n\n return (\n <Host\n class={`p-input-group ${this.error?.length && 'error'} ${\n this.disabled && 'disabled'\n } ${this.focused && 'focused'} size-${this.size}`}\n >\n <div class=\"flex items-end justify-between\">\n {label && (\n <div\n class=\"input-label\"\n onClick={() => this._focusInput()}\n >\n {label}\n {this.required && (\n <span class=\"ml-1 text-negative\">*</span>\n )}\n </div>\n )}\n\n {(helper || hasHeaderSlot) && (\n <div class=\"input-header\">\n {hasHeaderSlot && <slot name=\"header\" />}\n {helper && (\n <p-helper\n class={`flex ${\n hasHeaderSlot ? 'ml-2' : ''\n }`}\n placement=\"top-end\"\n >\n {helper}\n </p-helper>\n )}\n </div>\n )}\n </div>\n <p-tooltip\n class=\"w-full\"\n variant=\"error-element\"\n content={this.error}\n show={\n errorAndErrorIsNotBoolean &&\n errorVariant === 'element' &&\n this._forceShowTooltip\n }\n enableUserInput={false}\n >\n <div class=\"content\" slot=\"trigger\">\n {(prefix ||\n (this.icon && this.iconPosition === 'start')) && (\n <div\n class={`prefix size-${this.size}`}\n onClick={() => this._focusInput()}\n >\n {this.icon && this.iconPosition === 'start' ? (\n <p-icon\n class=\"flex\"\n variant={this.icon}\n rotate={this.iconRotate}\n flip={this.iconFlip}\n />\n ) : (\n prefix\n )}\n </div>\n )}\n {(suffix ||\n (errorAndErrorIsNotBoolean &&\n errorVariant === 'icon') ||\n (this.icon && this.iconPosition === 'end')) && (\n <div\n class={`suffix size-${this.size}`}\n onClick={() => this._focusInput()}\n >\n {errorAndErrorIsNotBoolean &&\n errorVariant === 'icon' ? (\n <p-input-error\n error={this.error}\n forceShowTooltip={\n this._forceShowTooltip\n }\n />\n ) : this.icon && this.iconPosition === 'end' ? (\n <p-icon\n class=\"flex\"\n variant={this.icon}\n rotate={this.iconRotate}\n flip={this.iconFlip}\n />\n ) : (\n suffix\n )}\n </div>\n )}\n\n <slot name=\"input\" />\n </div>\n </p-tooltip>\n </Host>\n );\n }\n\n @Listen('focusin')\n handleFocusIn() {\n this._forceShowTooltip = true;\n }\n\n @Listen('focusout')\n handleFocusOut() {\n this._forceShowTooltip = false;\n }\n /* \n With this, we shall hack the system in ways no one would ever have thought.\n \n <div class=\"pl-0 pr-0 border-l-0 border-r-0 rounded-tl-none rounded-bl-none rounded-tr-none rounded-br-none\"></div>\n */\n private _setInputClasses() {\n const input = this._el.querySelector(':scope > [slot=\"input\"]');\n\n if (!input) {\n return;\n }\n\n if (!input.classList.contains('p-input')) {\n input.classList.add('p-input');\n }\n\n const { prefix, suffix, errorAndErrorIsNotBoolean, errorVariant } =\n this._getSlotInfo();\n\n if (\n suffix ||\n (errorAndErrorIsNotBoolean && errorVariant === 'icon') ||\n (this.icon && this.iconPosition === 'end')\n ) {\n input.classList.add(\n 'border-r-0',\n 'rounded-tr-none',\n 'rounded-br-none',\n 'pr-0'\n );\n } else {\n input.classList.remove(\n 'border-r-0',\n 'rounded-tr-none',\n 'rounded-br-none',\n 'pr-0'\n );\n }\n\n if (prefix || (this.icon && this.iconPosition === 'start')) {\n input.classList.add(\n 'border-l-0',\n 'rounded-tl-none',\n 'rounded-bl-none',\n 'pl-0'\n );\n } else {\n input.classList.remove(\n 'border-l-0',\n 'rounded-tl-none',\n 'rounded-bl-none',\n 'pl-0'\n );\n }\n\n if (this.size === 'small' && !input.classList.contains('size-small')) {\n input.classList.add('size-small');\n }\n\n if (this.size !== 'small' && input.classList.contains('size-small')) {\n input.classList.remove('size-small');\n }\n }\n\n private _getSlotInfo() {\n const hasHelperSlot = !!this._el.querySelector(\n ':scope > [slot=\"helper\"]'\n );\n const hasLabelSlot = !!this._el.querySelector(\n ':scope > [slot=\"label\"]'\n );\n const hasPrefixSlot = !!this._el.querySelector(\n ':scope > [slot=\"prefix\"]'\n );\n const hasSuffixSlot = !!this._el.querySelector(\n ':scope > [slot=\"suffix\"]'\n );\n const hasHeaderSlot = !!this._el.querySelector(\n ':scope > [slot=\"header\"]'\n );\n\n const helper = hasHelperSlot ? <slot name=\"helper\" /> : this.helper;\n const label = hasLabelSlot ? <slot name=\"label\" /> : this.label;\n const prefix = hasPrefixSlot ? <slot name=\"prefix\" /> : this.prefix;\n const suffix = hasSuffixSlot ? <slot name=\"suffix\" /> : this.suffix;\n\n const errorAndErrorIsNotBoolean =\n this.error &&\n typeof this.error === 'string' &&\n this.error !== 'true';\n\n return {\n hasHelperSlot,\n hasLabelSlot,\n hasPrefixSlot,\n hasSuffixSlot,\n hasHeaderSlot,\n helper,\n label,\n prefix,\n suffix,\n errorAndErrorIsNotBoolean,\n errorVariant: this._el.offsetWidth <= 72 ? 'element' : 'icon',\n };\n }\n\n private _focusInput() {\n const input = this._el.querySelector(':scope > [slot=\"input\"]');\n (input as HTMLElement)[this.focusMethod]();\n }\n}\n"]}
1
+ {"version":3,"file":"input-group.component.js","sourceRoot":"","sources":["../../../../src/components/molecules/input-group/input-group.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,OAAO,EACP,CAAC,EACD,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,GACR,MAAM,eAAe,CAAC;AASvB,MAAM,OAAO,UAAU;;IA8EX,qBAAgB,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;gBA1Ed,QAAQ;;;;;;wBA8BH,OAAO;;;;;oBAyBF,KAAK;mBAKN,KAAK;uBAKR,OAAO;6BAOX,KAAK;;EAI1C,mBAAmB;IACf,IAAI,CAAC,gBAAgB,EAAE,CAAC;EAC5B,CAAC;EAED,MAAM;;IACF,MAAM,EACF,aAAa,EACb,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,yBAAyB,EACzB,YAAY,GACf,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IAExB,OAAO,CACH,EAAC,IAAI,IACD,KAAK,EAAE,iBAAiB,CAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,MAAM,KAAI,OAAO,IACjD,IAAI,CAAC,QAAQ,IAAI,UACrB,IAAI,IAAI,CAAC,OAAO,IAAI,SAAS,SAAS,IAAI,CAAC,IAAI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yBAAyB;MACzB,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;KAChE,CAAC;EACN,CAAC;EAEO,WAAW;IACf,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC/D,KAAqB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;EAC/C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import {\n Component,\n Element,\n h,\n Host,\n Listen,\n Prop,\n State,\n} from '@stencil/core';\nimport { RotateOptions } from '../../../types/tailwind';\nimport { IconFlipOptions, IconVariant } from '../../atoms/icon/icon.component';\n\n@Component({\n tag: 'p-input-group',\n styleUrl: './input-group.component.scss',\n shadow: true,\n})\nexport class InputGroup {\n /**\n * The size of the input group\n */\n @Prop() size: 'small' | 'medium' = 'medium';\n\n /**\n * The prefix of the input group\n */\n @Prop() prefix: string;\n\n /**\n * The suffix of the input group\n */\n @Prop() suffix: string;\n\n /**\n * Icon of the input group\n */\n @Prop() icon: IconVariant;\n\n /**\n * Icon flip\n */\n @Prop() iconFlip: IconFlipOptions;\n\n /**\n * Icon rotate\n */\n @Prop() iconRotate: RotateOptions;\n\n /**\n * Icon position\n */\n @Prop() iconPosition: 'start' | 'end' = 'start';\n\n /**\n * The label of the input group\n */\n @Prop() label: string;\n\n /**\n * The helper of the input group\n */\n @Prop() helper: string;\n\n /**\n * Wether the field is required\n */\n @Prop({ reflect: true }) required: boolean;\n\n /**\n * The helper of the input group\n */\n @Prop({ reflect: true }) error: string;\n\n /**\n * Wether the input group is disabled\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /**\n * Wether the input group is focused\n */\n @Prop({ reflect: true }) focused: boolean = false;\n\n /**\n * The method to use when focusing the input\n */\n @Prop() focusMethod: 'focus' | 'click' = 'focus';\n\n /**\n * The host element\n */\n @Element() private _el: HTMLElement;\n\n @State() private _forceShowTooltip = false;\n\n private _whitelistedTags = ['input', 'textarea'];\n\n componentWillRender() {\n this._setInputClasses();\n }\n\n render() {\n const {\n hasHeaderSlot,\n helper,\n label,\n prefix,\n suffix,\n errorAndErrorIsNotBoolean,\n errorVariant,\n } = this._getSlotInfo();\n\n return (\n <Host\n class={`p-input-group ${this.error?.length && 'error'} ${\n this.disabled && 'disabled'\n } ${this.focused && 'focused'} size-${this.size}`}\n >\n <div class=\"flex items-end justify-between\">\n {label && (\n <div\n class=\"input-label\"\n onClick={() => this._focusInput()}\n >\n {label}\n {this.required && (\n <span class=\"ml-1 text-negative\">*</span>\n )}\n </div>\n )}\n\n {(helper || hasHeaderSlot) && (\n <div class=\"input-header\">\n {hasHeaderSlot && <slot name=\"header\" />}\n {helper && (\n <p-helper\n class={`flex ${\n hasHeaderSlot ? 'ml-2' : ''\n }`}\n placement=\"top-end\"\n >\n {helper}\n </p-helper>\n )}\n </div>\n )}\n </div>\n <p-tooltip\n class=\"w-full\"\n variant=\"error-element\"\n content={this.error}\n show={\n errorAndErrorIsNotBoolean &&\n errorVariant === 'element' &&\n this._forceShowTooltip\n }\n enableUserInput={false}\n >\n <div class=\"content\" slot=\"trigger\">\n {(prefix ||\n (this.icon && this.iconPosition === 'start')) && (\n <div\n class={`prefix size-${this.size}`}\n onClick={() => this._focusInput()}\n >\n {this.icon && this.iconPosition === 'start' ? (\n <p-icon\n class=\"flex\"\n variant={this.icon}\n rotate={this.iconRotate}\n flip={this.iconFlip}\n />\n ) : (\n prefix\n )}\n </div>\n )}\n {(suffix ||\n (errorAndErrorIsNotBoolean &&\n errorVariant === 'icon') ||\n (this.icon && this.iconPosition === 'end')) && (\n <div\n class={`suffix size-${this.size}`}\n onClick={() => this._focusInput()}\n >\n {errorAndErrorIsNotBoolean &&\n errorVariant === 'icon' ? (\n <p-input-error\n error={this.error}\n forceShowTooltip={\n this._forceShowTooltip\n }\n />\n ) : this.icon && this.iconPosition === 'end' ? (\n <p-icon\n class=\"flex\"\n variant={this.icon}\n rotate={this.iconRotate}\n flip={this.iconFlip}\n />\n ) : (\n suffix\n )}\n </div>\n )}\n\n <slot name=\"input\" />\n </div>\n </p-tooltip>\n </Host>\n );\n }\n\n @Listen('focusin')\n handleFocusIn() {\n this._forceShowTooltip = true;\n }\n\n @Listen('focusout')\n handleFocusOut() {\n this._forceShowTooltip = false;\n }\n /* \n With this, we shall hack the system in ways no one would ever have thought.\n \n <div class=\"pl-0 pr-0 border-l-0 border-r-0 rounded-tl-none rounded-bl-none rounded-tr-none rounded-br-none\"></div>\n */\n private _setInputClasses() {\n const input = this._el.querySelector(':scope > [slot=\"input\"]');\n\n if (!input) {\n return;\n }\n\n if (this._whitelistedTags.indexOf(input.tagName) === -1) {\n return;\n }\n\n if (!input.classList.contains('p-input')) {\n input.classList.add('p-input');\n }\n\n const { prefix, suffix, errorAndErrorIsNotBoolean, errorVariant } =\n this._getSlotInfo();\n\n if (\n suffix ||\n (errorAndErrorIsNotBoolean && errorVariant === 'icon') ||\n (this.icon && this.iconPosition === 'end')\n ) {\n input.classList.add(\n 'border-r-0',\n 'rounded-tr-none',\n 'rounded-br-none',\n 'pr-0'\n );\n } else {\n input.classList.remove(\n 'border-r-0',\n 'rounded-tr-none',\n 'rounded-br-none',\n 'pr-0'\n );\n }\n\n if (prefix || (this.icon && this.iconPosition === 'start')) {\n input.classList.add(\n 'border-l-0',\n 'rounded-tl-none',\n 'rounded-bl-none',\n 'pl-0'\n );\n } else {\n input.classList.remove(\n 'border-l-0',\n 'rounded-tl-none',\n 'rounded-bl-none',\n 'pl-0'\n );\n }\n\n if (this.size === 'small' && !input.classList.contains('size-small')) {\n input.classList.add('size-small');\n }\n\n if (this.size !== 'small' && input.classList.contains('size-small')) {\n input.classList.remove('size-small');\n }\n }\n\n private _getSlotInfo() {\n const hasHelperSlot = !!this._el.querySelector(\n ':scope > [slot=\"helper\"]'\n );\n const hasLabelSlot = !!this._el.querySelector(\n ':scope > [slot=\"label\"]'\n );\n const hasPrefixSlot = !!this._el.querySelector(\n ':scope > [slot=\"prefix\"]'\n );\n const hasSuffixSlot = !!this._el.querySelector(\n ':scope > [slot=\"suffix\"]'\n );\n const hasHeaderSlot = !!this._el.querySelector(\n ':scope > [slot=\"header\"]'\n );\n\n const helper = hasHelperSlot ? <slot name=\"helper\" /> : this.helper;\n const label = hasLabelSlot ? <slot name=\"label\" /> : this.label;\n const prefix = hasPrefixSlot ? <slot name=\"prefix\" /> : this.prefix;\n const suffix = hasSuffixSlot ? <slot name=\"suffix\" /> : this.suffix;\n\n const errorAndErrorIsNotBoolean =\n this.error &&\n typeof this.error === 'string' &&\n this.error !== 'true';\n\n return {\n hasHelperSlot,\n hasLabelSlot,\n hasPrefixSlot,\n hasSuffixSlot,\n hasHeaderSlot,\n helper,\n label,\n prefix,\n suffix,\n errorAndErrorIsNotBoolean,\n errorVariant: this._el.offsetWidth <= 72 ? 'element' : 'icon',\n };\n }\n\n private _focusInput() {\n const input = this._el.querySelector(':scope > [slot=\"input\"]');\n (input as HTMLElement)[this.focusMethod]();\n }\n}\n"]}
@@ -11,6 +11,7 @@ const InputGroup = /*@__PURE__*/ proxyCustomElement(class InputGroup extends HTM
11
11
  super();
12
12
  this.__registerHost();
13
13
  this.__attachShadow();
14
+ this._whitelistedTags = ['input', 'textarea'];
14
15
  this.size = 'medium';
15
16
  this.prefix = undefined;
16
17
  this.suffix = undefined;
@@ -58,6 +59,9 @@ const InputGroup = /*@__PURE__*/ proxyCustomElement(class InputGroup extends HTM
58
59
  if (!input) {
59
60
  return;
60
61
  }
62
+ if (this._whitelistedTags.indexOf(input.tagName) === -1) {
63
+ return;
64
+ }
61
65
  if (!input.classList.contains('p-input')) {
62
66
  input.classList.add('p-input');
63
67
  }
@@ -1 +1 @@
1
- {"file":"input-group.component.js","mappings":";;;;;;AAAA,MAAM,sBAAsB,GAAG,gtlDAAgtlD;;MCiBlulD,UAAU;;;;;gBAIgB,QAAQ;;;;;;wBA8BH,OAAO;;;;;oBAyBF,KAAK;mBAKN,KAAK;uBAKR,OAAO;6BAOX,KAAK;;EAE1C,mBAAmB;IACf,IAAI,CAAC,gBAAgB,EAAE,CAAC;GAC3B;EAED,MAAM;;IACF,MAAM,EACF,aAAa,EACb,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,yBAAyB,EACzB,YAAY,GACf,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IAExB,QACI,EAAC,IAAI,IACD,KAAK,EAAE,iBAAiB,CAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,MAAM,KAAI,OAAO,IACjD,IAAI,CAAC,QAAQ,IAAI,UACrB,IAAI,IAAI,CAAC,OAAO,IAAI,SAAS,SAAS,IAAI,CAAC,IAAI,EAAE,IAEjD,WAAK,KAAK,EAAC,gCAAgC,IACtC,KAAK,KACF,WACI,KAAK,EAAC,aAAa,EACnB,OAAO,EAAE,MAAM,IAAI,CAAC,WAAW,EAAE,IAEhC,KAAK,EACL,IAAI,CAAC,QAAQ,KACV,YAAM,KAAK,EAAC,oBAAoB,QAAS,CAC5C,CACC,CACT,EAEA,CAAC,MAAM,IAAI,aAAa,MACrB,WAAK,KAAK,EAAC,cAAc,IACpB,aAAa,IAAI,YAAM,IAAI,EAAC,QAAQ,GAAG,EACvC,MAAM,KACH,gBACI,KAAK,EAAE,QACH,aAAa,GAAG,MAAM,GAAG,EAC7B,EAAE,EACF,SAAS,EAAC,SAAS,IAElB,MAAM,CACA,CAC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AAC,MAAM,CAAC;IAEpE,MAAM,yBAAyB,GAC3B,IAAI,CAAC,KAAK;MACV,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;MAC9B,IAAI,CAAC,KAAK,KAAK,MAAM,CAAC;IAE1B,OAAO;MACH,aAAa;MACb,YAAY;MACZ,aAAa;MACb,aAAa;MACb,aAAa;MACb,MAAM;MACN,KAAK;MACL,MAAM;MACN,MAAM;MACN,yBAAyB;MACzB,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,GAAG,SAAS,GAAG,MAAM;KAChE,CAAC;GACL;EAEO,WAAW;IACf,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC/D,KAAqB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;GAC9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/molecules/input-group/input-group.component.scss?tag=p-input-group&encapsulation=shadow","src/components/molecules/input-group/input-group.component.tsx"],"sourcesContent":["@import '../../../style/form/mixins';\n\n@mixin slottedItems($prefix: false) {\n @include inputs($prefix, true) {\n @content;\n }\n}\n\n:host {\n @apply flex w-full flex-col;\n @apply outline-none #{!important};\n\n .input-label {\n @apply mb-[2px] text-xs font-semibold uppercase tracking-wider text-storm-vague;\n }\n\n .input-header {\n @apply mb-[2px] flex items-end gap-2;\n }\n\n .content {\n @apply flex w-full;\n\n .prefix,\n .suffix {\n @include inputDefaultState(false);\n @apply box-border flex-1 text-storm;\n @apply h-full;\n }\n\n .prefix {\n @apply rounded-br-none rounded-tr-none;\n @apply border-r-0 #{!important};\n @apply order-1;\n @apply pr-2;\n }\n\n .suffix {\n @apply rounded-bl-none rounded-tl-none;\n @apply order-3;\n @apply pl-2;\n @apply border-l-0 #{!important};\n }\n\n @include slottedItems() {\n @include inputDefaultState();\n @apply order-2;\n }\n\n @include slottedItems('.prefix') {\n @apply rounded-bl-none rounded-tl-none #{!important};\n @apply flex-auto;\n @apply border-l-0 pl-0 #{!important};\n }\n\n @include slottedItems('.suffix') {\n @apply rounded-br-none rounded-tr-none #{!important};\n @apply flex-auto;\n @apply border-r-0 pr-0 #{!important};\n }\n }\n}\n\n:host(.focused),\n:host([focused]),\n:host(:focus-within),\n:host(:focus) {\n @apply outline-none #{!important};\n\n .prefix,\n .suffix {\n @include inputFocusState();\n @apply text-indigo;\n }\n\n @include slottedItems() {\n @include inputFocusState();\n }\n}\n\n:host(.error),\n:host([error]) {\n .prefix,\n .suffix {\n @include inputErrorState();\n @apply text-negative;\n }\n\n .suffix {\n @apply items-start py-[calc(0.75rem-1px)];\n }\n\n @include slottedItems() {\n @include inputErrorState();\n\n &:focus,\n &:focus-within,\n &:focus-visible,\n &.focus,\n &[active],\n &.active {\n @include inputErrorState();\n }\n }\n}\n\n:host(.disabled),\n:host([disabled]) {\n .prefix,\n .suffix {\n @include inputDisabledState();\n }\n\n @include slottedItems() {\n @include inputDisabledState();\n pointer-events: none;\n }\n}\n\n:host(.size-small) {\n @include slottedItems() {\n @include inputSizeSmall();\n }\n}\n\n:host(.size-small.error),\n:host(.size-small[error]) {\n .suffix {\n @apply py-2;\n }\n}\n","import {\n Component,\n Element,\n h,\n Host,\n Listen,\n Prop,\n State,\n} from '@stencil/core';\nimport { RotateOptions } from '../../../types/tailwind';\nimport { IconFlipOptions, IconVariant } from '../../atoms/icon/icon.component';\n\n@Component({\n tag: 'p-input-group',\n styleUrl: './input-group.component.scss',\n shadow: true,\n})\nexport class InputGroup {\n /**\n * The size of the input group\n */\n @Prop() size: 'small' | 'medium' = 'medium';\n\n /**\n * The prefix of the input group\n */\n @Prop() prefix: string;\n\n /**\n * The suffix of the input group\n */\n @Prop() suffix: string;\n\n /**\n * Icon of the input group\n */\n @Prop() icon: IconVariant;\n\n /**\n * Icon flip\n */\n @Prop() iconFlip: IconFlipOptions;\n\n /**\n * Icon rotate\n */\n @Prop() iconRotate: RotateOptions;\n\n /**\n * Icon position\n */\n @Prop() iconPosition: 'start' | 'end' = 'start';\n\n /**\n * The label of the input group\n */\n @Prop() label: string;\n\n /**\n * The helper of the input group\n */\n @Prop() helper: string;\n\n /**\n * Wether the field is required\n */\n @Prop({ reflect: true }) required: boolean;\n\n /**\n * The helper of the input group\n */\n @Prop({ reflect: true }) error: string;\n\n /**\n * Wether the input group is disabled\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /**\n * Wether the input group is focused\n */\n @Prop({ reflect: true }) focused: boolean = false;\n\n /**\n * The method to use when focusing the input\n */\n @Prop() focusMethod: 'focus' | 'click' = 'focus';\n\n /**\n * The host element\n */\n @Element() private _el: HTMLElement;\n\n @State() private _forceShowTooltip = false;\n\n componentWillRender() {\n this._setInputClasses();\n }\n\n render() {\n const {\n hasHeaderSlot,\n helper,\n label,\n prefix,\n suffix,\n errorAndErrorIsNotBoolean,\n errorVariant,\n } = this._getSlotInfo();\n\n return (\n <Host\n class={`p-input-group ${this.error?.length && 'error'} ${\n this.disabled && 'disabled'\n } ${this.focused && 'focused'} size-${this.size}`}\n >\n <div class=\"flex items-end justify-between\">\n {label && (\n <div\n class=\"input-label\"\n onClick={() => this._focusInput()}\n >\n {label}\n {this.required && (\n <span class=\"ml-1 text-negative\">*</span>\n )}\n </div>\n )}\n\n {(helper || hasHeaderSlot) && (\n <div class=\"input-header\">\n {hasHeaderSlot && <slot name=\"header\" />}\n {helper && (\n <p-helper\n class={`flex ${\n hasHeaderSlot ? 'ml-2' : ''\n }`}\n placement=\"top-end\"\n >\n {helper}\n </p-helper>\n )}\n </div>\n )}\n </div>\n <p-tooltip\n class=\"w-full\"\n variant=\"error-element\"\n content={this.error}\n show={\n errorAndErrorIsNotBoolean &&\n errorVariant === 'element' &&\n this._forceShowTooltip\n }\n enableUserInput={false}\n >\n <div class=\"content\" slot=\"trigger\">\n {(prefix ||\n (this.icon && this.iconPosition === 'start')) && (\n <div\n class={`prefix size-${this.size}`}\n onClick={() => this._focusInput()}\n >\n {this.icon && this.iconPosition === 'start' ? (\n <p-icon\n class=\"flex\"\n variant={this.icon}\n rotate={this.iconRotate}\n flip={this.iconFlip}\n />\n ) : (\n prefix\n )}\n </div>\n )}\n {(suffix ||\n (errorAndErrorIsNotBoolean &&\n errorVariant === 'icon') ||\n (this.icon && this.iconPosition === 'end')) && (\n <div\n class={`suffix size-${this.size}`}\n onClick={() => this._focusInput()}\n >\n {errorAndErrorIsNotBoolean &&\n errorVariant === 'icon' ? (\n <p-input-error\n error={this.error}\n forceShowTooltip={\n this._forceShowTooltip\n }\n />\n ) : this.icon && this.iconPosition === 'end' ? (\n <p-icon\n class=\"flex\"\n variant={this.icon}\n rotate={this.iconRotate}\n flip={this.iconFlip}\n />\n ) : (\n suffix\n )}\n </div>\n )}\n\n <slot name=\"input\" />\n </div>\n </p-tooltip>\n </Host>\n );\n }\n\n @Listen('focusin')\n handleFocusIn() {\n this._forceShowTooltip = true;\n }\n\n @Listen('focusout')\n handleFocusOut() {\n this._forceShowTooltip = false;\n }\n /* \n With this, we shall hack the system in ways no one would ever have thought.\n \n <div class=\"pl-0 pr-0 border-l-0 border-r-0 rounded-tl-none rounded-bl-none rounded-tr-none rounded-br-none\"></div>\n */\n private _setInputClasses() {\n const input = this._el.querySelector(':scope > [slot=\"input\"]');\n\n if (!input) {\n return;\n }\n\n if (!input.classList.contains('p-input')) {\n input.classList.add('p-input');\n }\n\n const { prefix, suffix, errorAndErrorIsNotBoolean, errorVariant } =\n this._getSlotInfo();\n\n if (\n suffix ||\n (errorAndErrorIsNotBoolean && errorVariant === 'icon') ||\n (this.icon && this.iconPosition === 'end')\n ) {\n input.classList.add(\n 'border-r-0',\n 'rounded-tr-none',\n 'rounded-br-none',\n 'pr-0'\n );\n } else {\n input.classList.remove(\n 'border-r-0',\n 'rounded-tr-none',\n 'rounded-br-none',\n 'pr-0'\n );\n }\n\n if (prefix || (this.icon && this.iconPosition === 'start')) {\n input.classList.add(\n 'border-l-0',\n 'rounded-tl-none',\n 'rounded-bl-none',\n 'pl-0'\n );\n } else {\n input.classList.remove(\n 'border-l-0',\n 'rounded-tl-none',\n 'rounded-bl-none',\n 'pl-0'\n );\n }\n\n if (this.size === 'small' && !input.classList.contains('size-small')) {\n input.classList.add('size-small');\n }\n\n if (this.size !== 'small' && input.classList.contains('size-small')) {\n input.classList.remove('size-small');\n }\n }\n\n private _getSlotInfo() {\n const hasHelperSlot = !!this._el.querySelector(\n ':scope > [slot=\"helper\"]'\n );\n const hasLabelSlot = !!this._el.querySelector(\n ':scope > [slot=\"label\"]'\n );\n const hasPrefixSlot = !!this._el.querySelector(\n ':scope > [slot=\"prefix\"]'\n );\n const hasSuffixSlot = !!this._el.querySelector(\n ':scope > [slot=\"suffix\"]'\n );\n const hasHeaderSlot = !!this._el.querySelector(\n ':scope > [slot=\"header\"]'\n );\n\n const helper = hasHelperSlot ? <slot name=\"helper\" /> : this.helper;\n const label = hasLabelSlot ? <slot name=\"label\" /> : this.label;\n const prefix = hasPrefixSlot ? <slot name=\"prefix\" /> : this.prefix;\n const suffix = hasSuffixSlot ? <slot name=\"suffix\" /> : this.suffix;\n\n const errorAndErrorIsNotBoolean =\n this.error &&\n typeof this.error === 'string' &&\n this.error !== 'true';\n\n return {\n hasHelperSlot,\n hasLabelSlot,\n hasPrefixSlot,\n hasSuffixSlot,\n hasHeaderSlot,\n helper,\n label,\n prefix,\n suffix,\n errorAndErrorIsNotBoolean,\n errorVariant: this._el.offsetWidth <= 72 ? 'element' : 'icon',\n };\n }\n\n private _focusInput() {\n const input = this._el.querySelector(':scope > [slot=\"input\"]');\n (input as HTMLElement)[this.focusMethod]();\n }\n}\n"],"version":3}
1
+ {"file":"input-group.component.js","mappings":";;;;;;AAAA,MAAM,sBAAsB,GAAG,gtlDAAgtlD;;MCiBlulD,UAAU;;;;;IA8EX,qBAAgB,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;gBA1Ed,QAAQ;;;;;;wBA8BH,OA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AAa;MACb,aAAa;MACb,MAAM;MACN,KAAK;MACL,MAAM;MACN,MAAM;MACN,yBAAyB;MACzB,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,GAAG,SAAS,GAAG,MAAM;KAChE,CAAC;GACL;EAEO,WAAW;IACf,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC/D,KAAqB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;GAC9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/molecules/input-group/input-group.component.scss?tag=p-input-group&encapsulation=shadow","src/components/molecules/input-group/input-group.component.tsx"],"sourcesContent":["@import '../../../style/form/mixins';\n\n@mixin slottedItems($prefix: false) {\n @include inputs($prefix, true) {\n @content;\n }\n}\n\n:host {\n @apply flex w-full flex-col;\n @apply outline-none #{!important};\n\n .input-label {\n @apply mb-[2px] text-xs font-semibold uppercase tracking-wider text-storm-vague;\n }\n\n .input-header {\n @apply mb-[2px] flex items-end gap-2;\n }\n\n .content {\n @apply flex w-full;\n\n .prefix,\n .suffix {\n @include inputDefaultState(false);\n @apply box-border flex-1 text-storm;\n @apply h-full;\n }\n\n .prefix {\n @apply rounded-br-none rounded-tr-none;\n @apply border-r-0 #{!important};\n @apply order-1;\n @apply pr-2;\n }\n\n .suffix {\n @apply rounded-bl-none rounded-tl-none;\n @apply order-3;\n @apply pl-2;\n @apply border-l-0 #{!important};\n }\n\n @include slottedItems() {\n @include inputDefaultState();\n @apply order-2;\n }\n\n @include slottedItems('.prefix') {\n @apply rounded-bl-none rounded-tl-none #{!important};\n @apply flex-auto;\n @apply border-l-0 pl-0 #{!important};\n }\n\n @include slottedItems('.suffix') {\n @apply rounded-br-none rounded-tr-none #{!important};\n @apply flex-auto;\n @apply border-r-0 pr-0 #{!important};\n }\n }\n}\n\n:host(.focused),\n:host([focused]),\n:host(:focus-within),\n:host(:focus) {\n @apply outline-none #{!important};\n\n .prefix,\n .suffix {\n @include inputFocusState();\n @apply text-indigo;\n }\n\n @include slottedItems() {\n @include inputFocusState();\n }\n}\n\n:host(.error),\n:host([error]) {\n .prefix,\n .suffix {\n @include inputErrorState();\n @apply text-negative;\n }\n\n .suffix {\n @apply items-start py-[calc(0.75rem-1px)];\n }\n\n @include slottedItems() {\n @include inputErrorState();\n\n &:focus,\n &:focus-within,\n &:focus-visible,\n &.focus,\n &[active],\n &.active {\n @include inputErrorState();\n }\n }\n}\n\n:host(.disabled),\n:host([disabled]) {\n .prefix,\n .suffix {\n @include inputDisabledState();\n }\n\n @include slottedItems() {\n @include inputDisabledState();\n pointer-events: none;\n }\n}\n\n:host(.size-small) {\n @include slottedItems() {\n @include inputSizeSmall();\n }\n}\n\n:host(.size-small.error),\n:host(.size-small[error]) {\n .suffix {\n @apply py-2;\n }\n}\n","import {\n Component,\n Element,\n h,\n Host,\n Listen,\n Prop,\n State,\n} from '@stencil/core';\nimport { RotateOptions } from '../../../types/tailwind';\nimport { IconFlipOptions, IconVariant } from '../../atoms/icon/icon.component';\n\n@Component({\n tag: 'p-input-group',\n styleUrl: './input-group.component.scss',\n shadow: true,\n})\nexport class InputGroup {\n /**\n * The size of the input group\n */\n @Prop() size: 'small' | 'medium' = 'medium';\n\n /**\n * The prefix of the input group\n */\n @Prop() prefix: string;\n\n /**\n * The suffix of the input group\n */\n @Prop() suffix: string;\n\n /**\n * Icon of the input group\n */\n @Prop() icon: IconVariant;\n\n /**\n * Icon flip\n */\n @Prop() iconFlip: IconFlipOptions;\n\n /**\n * Icon rotate\n */\n @Prop() iconRotate: RotateOptions;\n\n /**\n * Icon position\n */\n @Prop() iconPosition: 'start' | 'end' = 'start';\n\n /**\n * The label of the input group\n */\n @Prop() label: string;\n\n /**\n * The helper of the input group\n */\n @Prop() helper: string;\n\n /**\n * Wether the field is required\n */\n @Prop({ reflect: true }) required: boolean;\n\n /**\n * The helper of the input group\n */\n @Prop({ reflect: true }) error: string;\n\n /**\n * Wether the input group is disabled\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /**\n * Wether the input group is focused\n */\n @Prop({ reflect: true }) focused: boolean = false;\n\n /**\n * The method to use when focusing the input\n */\n @Prop() focusMethod: 'focus' | 'click' = 'focus';\n\n /**\n * The host element\n */\n @Element() private _el: HTMLElement;\n\n @State() private _forceShowTooltip = false;\n\n private _whitelistedTags = ['input', 'textarea'];\n\n componentWillRender() {\n this._setInputClasses();\n }\n\n render() {\n const {\n hasHeaderSlot,\n helper,\n label,\n prefix,\n suffix,\n errorAndErrorIsNotBoolean,\n errorVariant,\n } = this._getSlotInfo();\n\n return (\n <Host\n class={`p-input-group ${this.error?.length && 'error'} ${\n this.disabled && 'disabled'\n } ${this.focused && 'focused'} size-${this.size}`}\n >\n <div class=\"flex items-end justify-between\">\n {label && (\n <div\n class=\"input-label\"\n onClick={() => this._focusInput()}\n >\n {label}\n {this.required && (\n <span class=\"ml-1 text-negative\">*</span>\n )}\n </div>\n )}\n\n {(helper || hasHeaderSlot) && (\n <div class=\"input-header\">\n {hasHeaderSlot && <slot name=\"header\" />}\n {helper && (\n <p-helper\n class={`flex ${\n hasHeaderSlot ? 'ml-2' : ''\n }`}\n placement=\"top-end\"\n >\n {helper}\n </p-helper>\n )}\n </div>\n )}\n </div>\n <p-tooltip\n class=\"w-full\"\n variant=\"error-element\"\n content={this.error}\n show={\n errorAndErrorIsNotBoolean &&\n errorVariant === 'element' &&\n this._forceShowTooltip\n }\n enableUserInput={false}\n >\n <div class=\"content\" slot=\"trigger\">\n {(prefix ||\n (this.icon && this.iconPosition === 'start')) && (\n <div\n class={`prefix size-${this.size}`}\n onClick={() => this._focusInput()}\n >\n {this.icon && this.iconPosition === 'start' ? (\n <p-icon\n class=\"flex\"\n variant={this.icon}\n rotate={this.iconRotate}\n flip={this.iconFlip}\n />\n ) : (\n prefix\n )}\n </div>\n )}\n {(suffix ||\n (errorAndErrorIsNotBoolean &&\n errorVariant === 'icon') ||\n (this.icon && this.iconPosition === 'end')) && (\n <div\n class={`suffix size-${this.size}`}\n onClick={() => this._focusInput()}\n >\n {errorAndErrorIsNotBoolean &&\n errorVariant === 'icon' ? (\n <p-input-error\n error={this.error}\n forceShowTooltip={\n this._forceShowTooltip\n }\n />\n ) : this.icon && this.iconPosition === 'end' ? (\n <p-icon\n class=\"flex\"\n variant={this.icon}\n rotate={this.iconRotate}\n flip={this.iconFlip}\n />\n ) : (\n suffix\n )}\n </div>\n )}\n\n <slot name=\"input\" />\n </div>\n </p-tooltip>\n </Host>\n );\n }\n\n @Listen('focusin')\n handleFocusIn() {\n this._forceShowTooltip = true;\n }\n\n @Listen('focusout')\n handleFocusOut() {\n this._forceShowTooltip = false;\n }\n /* \n With this, we shall hack the system in ways no one would ever have thought.\n \n <div class=\"pl-0 pr-0 border-l-0 border-r-0 rounded-tl-none rounded-bl-none rounded-tr-none rounded-br-none\"></div>\n */\n private _setInputClasses() {\n const input = this._el.querySelector(':scope > [slot=\"input\"]');\n\n if (!input) {\n return;\n }\n\n if (this._whitelistedTags.indexOf(input.tagName) === -1) {\n return;\n }\n\n if (!input.classList.contains('p-input')) {\n input.classList.add('p-input');\n }\n\n const { prefix, suffix, errorAndErrorIsNotBoolean, errorVariant } =\n this._getSlotInfo();\n\n if (\n suffix ||\n (errorAndErrorIsNotBoolean && errorVariant === 'icon') ||\n (this.icon && this.iconPosition === 'end')\n ) {\n input.classList.add(\n 'border-r-0',\n 'rounded-tr-none',\n 'rounded-br-none',\n 'pr-0'\n );\n } else {\n input.classList.remove(\n 'border-r-0',\n 'rounded-tr-none',\n 'rounded-br-none',\n 'pr-0'\n );\n }\n\n if (prefix || (this.icon && this.iconPosition === 'start')) {\n input.classList.add(\n 'border-l-0',\n 'rounded-tl-none',\n 'rounded-bl-none',\n 'pl-0'\n );\n } else {\n input.classList.remove(\n 'border-l-0',\n 'rounded-tl-none',\n 'rounded-bl-none',\n 'pl-0'\n );\n }\n\n if (this.size === 'small' && !input.classList.contains('size-small')) {\n input.classList.add('size-small');\n }\n\n if (this.size !== 'small' && input.classList.contains('size-small')) {\n input.classList.remove('size-small');\n }\n }\n\n private _getSlotInfo() {\n const hasHelperSlot = !!this._el.querySelector(\n ':scope > [slot=\"helper\"]'\n );\n const hasLabelSlot = !!this._el.querySelector(\n ':scope > [slot=\"label\"]'\n );\n const hasPrefixSlot = !!this._el.querySelector(\n ':scope > [slot=\"prefix\"]'\n );\n const hasSuffixSlot = !!this._el.querySelector(\n ':scope > [slot=\"suffix\"]'\n );\n const hasHeaderSlot = !!this._el.querySelector(\n ':scope > [slot=\"header\"]'\n );\n\n const helper = hasHelperSlot ? <slot name=\"helper\" /> : this.helper;\n const label = hasLabelSlot ? <slot name=\"label\" /> : this.label;\n const prefix = hasPrefixSlot ? <slot name=\"prefix\" /> : this.prefix;\n const suffix = hasSuffixSlot ? <slot name=\"suffix\" /> : this.suffix;\n\n const errorAndErrorIsNotBoolean =\n this.error &&\n typeof this.error === 'string' &&\n this.error !== 'true';\n\n return {\n hasHelperSlot,\n hasLabelSlot,\n hasPrefixSlot,\n hasSuffixSlot,\n hasHeaderSlot,\n helper,\n label,\n prefix,\n suffix,\n errorAndErrorIsNotBoolean,\n errorVariant: this._el.offsetWidth <= 72 ? 'element' : 'icon',\n };\n }\n\n private _focusInput() {\n const input = this._el.querySelector(':scope > [slot=\"input\"]');\n (input as HTMLElement)[this.focusMethod]();\n }\n}\n"],"version":3}
@@ -32,6 +32,7 @@ const inputGroupComponentCss = ".mb-\\[2px\\]{margin-bottom:2px!important}.box-b
32
32
  const InputGroup = class {
33
33
  constructor(hostRef) {
34
34
  registerInstance(this, hostRef);
35
+ this._whitelistedTags = ['input', 'textarea'];
35
36
  this.size = 'medium';
36
37
  this.prefix = undefined;
37
38
  this.suffix = undefined;
@@ -79,6 +80,9 @@ const InputGroup = class {
79
80
  if (!input) {
80
81
  return;
81
82
  }
83
+ if (this._whitelistedTags.indexOf(input.tagName) === -1) {
84
+ return;
85
+ }
82
86
  if (!input.classList.contains('p-input')) {
83
87
  input.classList.add('p-input');
84
88
  }
@@ -1 +1 @@
1
- {"file":"p-helper.p-input-error.p-input-group.entry.js","mappings":";;AAAA,MAAM,kBAAkB,GAAG,whBAAwhB;;MCQtiB,MAAM;;;qBAIgB,KAAK;;EAEpC,MAAM;IACF,QACI,EAAC,IAAI,IAAC,KAAK,EAAC,UAAU,IAClB,iBAAW,SAAS,EAAE,IAAI,CAAC,SAAS,IAChC,WAAK,IAAI,EAAC,SAAS,IACf,eAAQ,CACN,EAEN,WAAK,IAAI,EAAC,SAAS,EAAC,KAAK,EAAC,QAAQ,GAAO,CACjC,CACT,EACT;GACL;;;;MCpBQ,UAAU;;;;4BASQ,KAAK;wBAEA,KAAK;;EAErC,MAAM;IACF,QACI,EAAC,IAAI,IAAC,KAAK,EAAC,eAAe,IACvB,iBACI,OAAO,EAAC,OAAO,EACf,OAAO,EAAE,IAAI,CAAC,KAAK,EACnB,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAC3B,QAAQ,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC,MAAM,CAAC,IAEjD,cACI,KAAK,EAAE,GACH,IAAI,CAAC,YAAY;UACX,eAAe;UACf,qBACV,sBAAsB,EACtB,IAAI,EAAC,SAAS,EACd,OAAO,EAAC,aAAa,GACvB,CACM,CACT,EACT;GACL;;;ACxCL,MAAM,sBAAsB,GAAG,gtlDAAgtlD;;MCiBlulD,UAAU;;;gBAIgB,QAAQ;;;;;;wBA8BH,OAAO;;;;;oBAyBF,KAAK;mBAKN,KAAK;uBAKR,OAAO;6BAOX,KAAK;;EAE1C,mBAAmB;IACf,IAAI,CAAC,gBAAgB,EAAE,CAAC;GAC3B;EAED,MAAM;;IACF,MAAM,EACF,aAAa,EACb,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,yBAAyB,EACzB,YAAY,GACf,GAAG,IAAI,CAAC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per.component.scss?tag=p-helper&encapsulation=shadow","src/components/atoms/helper/helper.component.tsx","src/components/molecules/input-error/input-error.component.tsx","src/components/molecules/input-group/input-group.component.scss?tag=p-input-group&encapsulation=shadow","src/components/molecules/input-group/input-group.component.tsx"],"sourcesContent":[":host {\n .helper {\n @apply inline-block cursor-pointer bg-no-repeat bg-center w-3 h-3;\n background-image: url(/assets/images/helper/helper.svg);\n\n &:hover {\n background-image: url(/assets/images/helper/helper-hover.svg);\n }\n }\n}\n","import { Placement } from '@floating-ui/dom';\nimport { Component, h, Host, Prop } from '@stencil/core';\n\n@Component({\n tag: 'p-helper',\n styleUrl: 'helper.component.scss',\n shadow: true,\n})\nexport class Helper {\n /**\n * The placement of the helper popover\n */\n @Prop() placement: Placement = 'top';\n\n render() {\n return (\n <Host class=\"p-helper\">\n <p-tooltip placement={this.placement}>\n <div slot=\"content\">\n <slot />\n </div>\n\n <div slot=\"trigger\" class=\"helper\"></div>\n </p-tooltip>\n </Host>\n );\n }\n}\n","import { Component, h, Host, Prop, State } from '@stencil/core';\n\n@Component({\n tag: 'p-input-error',\n shadow: true,\n})\nexport class InputError {\n /**\n * The error to show\n */\n @Prop() error: string;\n\n /**\n * Wether to force show the tooltip\n */\n @Prop() forceShowTooltip = false;\n\n @State() private _showTooltip = false;\n\n render() {\n return (\n <Host class=\"p-input-error\">\n <p-tooltip\n variant=\"error\"\n content={this.error}\n show={this.forceShowTooltip}\n onIsOpen={(ev) => (this._showTooltip = ev.detail)}\n >\n <p-icon\n class={`${\n this._showTooltip\n ? 'text-negative'\n : 'text-negative-light'\n } hover:text-negative`}\n slot=\"trigger\"\n variant=\"explanation\"\n />\n </p-tooltip>\n </Host>\n );\n }\n}\n","@import '../../../style/form/mixins';\n\n@mixin slottedItems($prefix: false) {\n @include inputs($prefix, true) {\n @content;\n }\n}\n\n:host {\n @apply flex w-full flex-col;\n @apply outline-none #{!important};\n\n .input-label {\n @apply mb-[2px] text-xs font-semibold uppercase tracking-wider text-storm-vague;\n }\n\n .input-header {\n @apply mb-[2px] flex items-end gap-2;\n }\n\n .content {\n @apply flex w-full;\n\n .prefix,\n .suffix {\n @include inputDefaultState(false);\n @apply box-border flex-1 text-storm;\n @apply h-full;\n }\n\n .prefix {\n @apply rounded-br-none rounded-tr-none;\n @apply border-r-0 #{!important};\n @apply order-1;\n @apply pr-2;\n }\n\n .suffix {\n @apply rounded-bl-none rounded-tl-none;\n @apply order-3;\n @apply pl-2;\n @apply border-l-0 #{!important};\n }\n\n @include slottedItems() {\n @include inputDefaultState();\n @apply order-2;\n }\n\n @include slottedItems('.prefix') {\n @apply rounded-bl-none rounded-tl-none #{!important};\n @apply flex-auto;\n @apply border-l-0 pl-0 #{!important};\n }\n\n @include slottedItems('.suffix') {\n @apply rounded-br-none rounded-tr-none #{!important};\n @apply flex-auto;\n @apply border-r-0 pr-0 #{!important};\n }\n }\n}\n\n:host(.focused),\n:host([focused]),\n:host(:focus-within),\n:host(:focus) {\n @apply outline-none #{!important};\n\n .prefix,\n .suffix {\n @include inputFocusState();\n @apply text-indigo;\n }\n\n @include slottedItems() {\n @include inputFocusState();\n }\n}\n\n:host(.error),\n:host([error]) {\n .prefix,\n .suffix {\n @include inputErrorState();\n @apply text-negative;\n }\n\n .suffix {\n @apply items-start py-[calc(0.75rem-1px)];\n }\n\n @include slottedItems() {\n @include inputErrorState();\n\n &:focus,\n &:focus-within,\n &:focus-visible,\n &.focus,\n &[active],\n &.active {\n @include inputErrorState();\n }\n }\n}\n\n:host(.disabled),\n:host([disabled]) {\n .prefix,\n .suffix {\n @include inputDisabledState();\n }\n\n @include slottedItems() {\n @include inputDisabledState();\n pointer-events: none;\n }\n}\n\n:host(.size-small) {\n @include slottedItems() {\n @include inputSizeSmall();\n }\n}\n\n:host(.size-small.error),\n:host(.size-small[error]) {\n .suffix {\n @apply py-2;\n }\n}\n","import {\n Component,\n Element,\n h,\n Host,\n Listen,\n Prop,\n State,\n} from '@stencil/core';\nimport { RotateOptions } from '../../../types/tailwind';\nimport { IconFlipOptions, IconVariant } from '../../atoms/icon/icon.component';\n\n@Component({\n tag: 'p-input-group',\n styleUrl: './input-group.component.scss',\n shadow: true,\n})\nexport class InputGroup {\n /**\n * The size of the input group\n */\n @Prop() size: 'small' | 'medium' = 'medium';\n\n /**\n * The prefix of the input group\n */\n @Prop() prefix: string;\n\n /**\n * The suffix of the input group\n */\n @Prop() suffix: string;\n\n /**\n * Icon of the input group\n */\n @Prop() icon: IconVariant;\n\n /**\n * Icon flip\n */\n @Prop() iconFlip: IconFlipOptions;\n\n /**\n * Icon rotate\n */\n @Prop() iconRotate: RotateOptions;\n\n /**\n * Icon position\n */\n @Prop() iconPosition: 'start' | 'end' = 'start';\n\n /**\n * The label of the input group\n */\n @Prop() label: string;\n\n /**\n * The helper of the input group\n */\n @Prop() helper: string;\n\n /**\n * Wether the field is required\n */\n @Prop({ reflect: true }) required: boolean;\n\n /**\n * The helper of the input group\n */\n @Prop({ reflect: true }) error: string;\n\n /**\n * Wether the input group is disabled\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /**\n * Wether the input group is focused\n */\n @Prop({ reflect: true }) focused: boolean = false;\n\n /**\n * The method to use when focusing the input\n */\n @Prop() focusMethod: 'focus' | 'click' = 'focus';\n\n /**\n * The host element\n */\n @Element() private _el: HTMLElement;\n\n @State() private _forceShowTooltip = false;\n\n componentWillRender() {\n this._setInputClasses();\n }\n\n render() {\n const {\n hasHeaderSlot,\n helper,\n label,\n prefix,\n suffix,\n errorAndErrorIsNotBoolean,\n errorVariant,\n } = this._getSlotInfo();\n\n return (\n <Host\n class={`p-input-group ${this.error?.length && 'error'} ${\n this.disabled && 'disabled'\n } ${this.focused && 'focused'} size-${this.size}`}\n >\n <div class=\"flex items-end justify-between\">\n {label && (\n <div\n class=\"input-label\"\n onClick={() => this._focusInput()}\n >\n {label}\n {this.required && (\n <span class=\"ml-1 text-negative\">*</span>\n )}\n </div>\n )}\n\n {(helper || hasHeaderSlot) && (\n <div class=\"input-header\">\n {hasHeaderSlot && <slot name=\"header\" />}\n {helper && (\n <p-helper\n class={`flex ${\n hasHeaderSlot ? 'ml-2' : ''\n }`}\n placement=\"top-end\"\n >\n {helper}\n </p-helper>\n )}\n </div>\n )}\n </div>\n <p-tooltip\n class=\"w-full\"\n variant=\"error-element\"\n content={this.error}\n show={\n errorAndErrorIsNotBoolean &&\n errorVariant === 'element' &&\n this._forceShowTooltip\n }\n enableUserInput={false}\n >\n <div class=\"content\" slot=\"trigger\">\n {(prefix ||\n (this.icon && this.iconPosition === 'start')) && (\n <div\n class={`prefix size-${this.size}`}\n onClick={() => this._focusInput()}\n >\n {this.icon && this.iconPosition === 'start' ? (\n <p-icon\n class=\"flex\"\n variant={this.icon}\n rotate={this.iconRotate}\n flip={this.iconFlip}\n />\n ) : (\n prefix\n )}\n </div>\n )}\n {(suffix ||\n (errorAndErrorIsNotBoolean &&\n errorVariant === 'icon') ||\n (this.icon && this.iconPosition === 'end')) && (\n <div\n class={`suffix size-${this.size}`}\n onClick={() => this._focusInput()}\n >\n {errorAndErrorIsNotBoolean &&\n errorVariant === 'icon' ? (\n <p-input-error\n error={this.error}\n forceShowTooltip={\n this._forceShowTooltip\n }\n />\n ) : this.icon && this.iconPosition === 'end' ? (\n <p-icon\n class=\"flex\"\n variant={this.icon}\n rotate={this.iconRotate}\n flip={this.iconFlip}\n />\n ) : (\n suffix\n )}\n </div>\n )}\n\n <slot name=\"input\" />\n </div>\n </p-tooltip>\n </Host>\n );\n }\n\n @Listen('focusin')\n handleFocusIn() {\n this._forceShowTooltip = true;\n }\n\n @Listen('focusout')\n handleFocusOut() {\n this._forceShowTooltip = false;\n }\n /* \n With this, we shall hack the system in ways no one would ever have thought.\n \n <div class=\"pl-0 pr-0 border-l-0 border-r-0 rounded-tl-none rounded-bl-none rounded-tr-none rounded-br-none\"></div>\n */\n private _setInputClasses() {\n const input = this._el.querySelector(':scope > [slot=\"input\"]');\n\n if (!input) {\n return;\n }\n\n if (!input.classList.contains('p-input')) {\n input.classList.add('p-input');\n }\n\n const { prefix, suffix, errorAndErrorIsNotBoolean, errorVariant } =\n this._getSlotInfo();\n\n if (\n suffix ||\n (errorAndErrorIsNotBoolean && errorVariant === 'icon') ||\n (this.icon && this.iconPosition === 'end')\n ) {\n input.classList.add(\n 'border-r-0',\n 'rounded-tr-none',\n 'rounded-br-none',\n 'pr-0'\n );\n } else {\n input.classList.remove(\n 'border-r-0',\n 'rounded-tr-none',\n 'rounded-br-none',\n 'pr-0'\n );\n }\n\n if (prefix || (this.icon && this.iconPosition === 'start')) {\n input.classList.add(\n 'border-l-0',\n 'rounded-tl-none',\n 'rounded-bl-none',\n 'pl-0'\n );\n } else {\n input.classList.remove(\n 'border-l-0',\n 'rounded-tl-none',\n 'rounded-bl-none',\n 'pl-0'\n );\n }\n\n if (this.size === 'small' && !input.classList.contains('size-small')) {\n input.classList.add('size-small');\n }\n\n if (this.size !== 'small' && input.classList.contains('size-small')) {\n input.classList.remove('size-small');\n }\n }\n\n private _getSlotInfo() {\n const hasHelperSlot = !!this._el.querySelector(\n ':scope > [slot=\"helper\"]'\n );\n const hasLabelSlot = !!this._el.querySelector(\n ':scope > [slot=\"label\"]'\n );\n const hasPrefixSlot = !!this._el.querySelector(\n ':scope > [slot=\"prefix\"]'\n );\n const hasSuffixSlot = !!this._el.querySelector(\n ':scope > [slot=\"suffix\"]'\n );\n const hasHeaderSlot = !!this._el.querySelector(\n ':scope > [slot=\"header\"]'\n );\n\n const helper = hasHelperSlot ? <slot name=\"helper\" /> : this.helper;\n const label = hasLabelSlot ? <slot name=\"label\" /> : this.label;\n const prefix = hasPrefixSlot ? <slot name=\"prefix\" /> : this.prefix;\n const suffix = hasSuffixSlot ? <slot name=\"suffix\" /> : this.suffix;\n\n const errorAndErrorIsNotBoolean =\n this.error &&\n typeof this.error === 'string' &&\n this.error !== 'true';\n\n return {\n hasHelperSlot,\n hasLabelSlot,\n hasPrefixSlot,\n hasSuffixSlot,\n hasHeaderSlot,\n helper,\n label,\n prefix,\n suffix,\n errorAndErrorIsNotBoolean,\n errorVariant: this._el.offsetWidth <= 72 ? 'element' : 'icon',\n };\n }\n\n private _focusInput() {\n const input = this._el.querySelector(':scope > [slot=\"input\"]');\n (input as HTMLElement)[this.focusMethod]();\n }\n}\n"],"version":3}
1
+ {"file":"p-helper.p-input-error.p-input-group.entry.js","mappings":";;AAAA,MAAM,kBAAkB,GAAG,whBAAwhB;;MCQtiB,MAAM;;;qBAIgB,KAAK;;EAEpC,MAAM;IACF,QACI,EAAC,IAAI,IAAC,KAAK,EAAC,UAAU,IAClB,iBAAW,SAAS,EAAE,IAAI,CAAC,SAAS,IAChC,WAAK,IAAI,EAAC,SAAS,IACf,eAAQ,CACN,EAEN,WAAK,IAAI,EAAC,SAAS,EAAC,KAAK,EAAC,QAAQ,GAAO,CACjC,CACT,EACT;GACL;;;;MCpBQ,UAAU;;;;4BASQ,KAAK;wBAEA,KAAK;;EAErC,MAAM;IACF,QACI,EAAC,IAAI,IAAC,KAAK,EAAC,eAAe,IACvB,iBACI,OAAO,EAAC,OAAO,EACf,OAAO,EAAE,IAAI,CAAC,KAAK,EACnB,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAC3B,QAAQ,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC,MAAM,CAAC,IAEjD,cACI,KAAK,EAAE,GACH,IAAI,CAAC,YAAY;UACX,eAAe;UACf,qBACV,sBAAsB,EACtB,IAAI,EAAC,SAAS,EACd,OAAO,EAAC,aAAa,GACvB,CACM,CACT,EACT;GACL;;;ACxCL,MAAM,sBAAsB,GAAG,gtlDAAgtlD;;MCiBlulD,UAAU;;;IA8EX,qBAAgB,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;gBA1Ed,QAAQ;;;;;;wBA8BH,OAAO;;;;;oBAyBF,KAAK;mBAKN,KAAK;uBAKR,OAAO;6BAOX,KAAK;;EAI1C,mBAAmB;IACf,IAAI,CAAC,gBAAgB,EAAE,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AC,WAAW,IAAI,EAAE,GAAG,SAAS,GAAG,MAAM;KAChE,CAAC;GACL;EAEO,WAAW;IACf,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC/D,KAAqB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;GAC9C;;;;;;;","names":[],"sources":["src/components/atoms/helper/helper.component.scss?tag=p-helper&encapsulation=shadow","src/components/atoms/helper/helper.component.tsx","src/components/molecules/input-error/input-error.component.tsx","src/components/molecules/input-group/input-group.component.scss?tag=p-input-group&encapsulation=shadow","src/components/molecules/input-group/input-group.component.tsx"],"sourcesContent":[":host {\n .helper {\n @apply inline-block cursor-pointer bg-no-repeat bg-center w-3 h-3;\n background-image: url(/assets/images/helper/helper.svg);\n\n &:hover {\n background-image: url(/assets/images/helper/helper-hover.svg);\n }\n }\n}\n","import { Placement } from '@floating-ui/dom';\nimport { Component, h, Host, Prop } from '@stencil/core';\n\n@Component({\n tag: 'p-helper',\n styleUrl: 'helper.component.scss',\n shadow: true,\n})\nexport class Helper {\n /**\n * The placement of the helper popover\n */\n @Prop() placement: Placement = 'top';\n\n render() {\n return (\n <Host class=\"p-helper\">\n <p-tooltip placement={this.placement}>\n <div slot=\"content\">\n <slot />\n </div>\n\n <div slot=\"trigger\" class=\"helper\"></div>\n </p-tooltip>\n </Host>\n );\n }\n}\n","import { Component, h, Host, Prop, State } from '@stencil/core';\n\n@Component({\n tag: 'p-input-error',\n shadow: true,\n})\nexport class InputError {\n /**\n * The error to show\n */\n @Prop() error: string;\n\n /**\n * Wether to force show the tooltip\n */\n @Prop() forceShowTooltip = false;\n\n @State() private _showTooltip = false;\n\n render() {\n return (\n <Host class=\"p-input-error\">\n <p-tooltip\n variant=\"error\"\n content={this.error}\n show={this.forceShowTooltip}\n onIsOpen={(ev) => (this._showTooltip = ev.detail)}\n >\n <p-icon\n class={`${\n this._showTooltip\n ? 'text-negative'\n : 'text-negative-light'\n } hover:text-negative`}\n slot=\"trigger\"\n variant=\"explanation\"\n />\n </p-tooltip>\n </Host>\n );\n }\n}\n","@import '../../../style/form/mixins';\n\n@mixin slottedItems($prefix: false) {\n @include inputs($prefix, true) {\n @content;\n }\n}\n\n:host {\n @apply flex w-full flex-col;\n @apply outline-none #{!important};\n\n .input-label {\n @apply mb-[2px] text-xs font-semibold uppercase tracking-wider text-storm-vague;\n }\n\n .input-header {\n @apply mb-[2px] flex items-end gap-2;\n }\n\n .content {\n @apply flex w-full;\n\n .prefix,\n .suffix {\n @include inputDefaultState(false);\n @apply box-border flex-1 text-storm;\n @apply h-full;\n }\n\n .prefix {\n @apply rounded-br-none rounded-tr-none;\n @apply border-r-0 #{!important};\n @apply order-1;\n @apply pr-2;\n }\n\n .suffix {\n @apply rounded-bl-none rounded-tl-none;\n @apply order-3;\n @apply pl-2;\n @apply border-l-0 #{!important};\n }\n\n @include slottedItems() {\n @include inputDefaultState();\n @apply order-2;\n }\n\n @include slottedItems('.prefix') {\n @apply rounded-bl-none rounded-tl-none #{!important};\n @apply flex-auto;\n @apply border-l-0 pl-0 #{!important};\n }\n\n @include slottedItems('.suffix') {\n @apply rounded-br-none rounded-tr-none #{!important};\n @apply flex-auto;\n @apply border-r-0 pr-0 #{!important};\n }\n }\n}\n\n:host(.focused),\n:host([focused]),\n:host(:focus-within),\n:host(:focus) {\n @apply outline-none #{!important};\n\n .prefix,\n .suffix {\n @include inputFocusState();\n @apply text-indigo;\n }\n\n @include slottedItems() {\n @include inputFocusState();\n }\n}\n\n:host(.error),\n:host([error]) {\n .prefix,\n .suffix {\n @include inputErrorState();\n @apply text-negative;\n }\n\n .suffix {\n @apply items-start py-[calc(0.75rem-1px)];\n }\n\n @include slottedItems() {\n @include inputErrorState();\n\n &:focus,\n &:focus-within,\n &:focus-visible,\n &.focus,\n &[active],\n &.active {\n @include inputErrorState();\n }\n }\n}\n\n:host(.disabled),\n:host([disabled]) {\n .prefix,\n .suffix {\n @include inputDisabledState();\n }\n\n @include slottedItems() {\n @include inputDisabledState();\n pointer-events: none;\n }\n}\n\n:host(.size-small) {\n @include slottedItems() {\n @include inputSizeSmall();\n }\n}\n\n:host(.size-small.error),\n:host(.size-small[error]) {\n .suffix {\n @apply py-2;\n }\n}\n","import {\n Component,\n Element,\n h,\n Host,\n Listen,\n Prop,\n State,\n} from '@stencil/core';\nimport { RotateOptions } from '../../../types/tailwind';\nimport { IconFlipOptions, IconVariant } from '../../atoms/icon/icon.component';\n\n@Component({\n tag: 'p-input-group',\n styleUrl: './input-group.component.scss',\n shadow: true,\n})\nexport class InputGroup {\n /**\n * The size of the input group\n */\n @Prop() size: 'small' | 'medium' = 'medium';\n\n /**\n * The prefix of the input group\n */\n @Prop() prefix: string;\n\n /**\n * The suffix of the input group\n */\n @Prop() suffix: string;\n\n /**\n * Icon of the input group\n */\n @Prop() icon: IconVariant;\n\n /**\n * Icon flip\n */\n @Prop() iconFlip: IconFlipOptions;\n\n /**\n * Icon rotate\n */\n @Prop() iconRotate: RotateOptions;\n\n /**\n * Icon position\n */\n @Prop() iconPosition: 'start' | 'end' = 'start';\n\n /**\n * The label of the input group\n */\n @Prop() label: string;\n\n /**\n * The helper of the input group\n */\n @Prop() helper: string;\n\n /**\n * Wether the field is required\n */\n @Prop({ reflect: true }) required: boolean;\n\n /**\n * The helper of the input group\n */\n @Prop({ reflect: true }) error: string;\n\n /**\n * Wether the input group is disabled\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /**\n * Wether the input group is focused\n */\n @Prop({ reflect: true }) focused: boolean = false;\n\n /**\n * The method to use when focusing the input\n */\n @Prop() focusMethod: 'focus' | 'click' = 'focus';\n\n /**\n * The host element\n */\n @Element() private _el: HTMLElement;\n\n @State() private _forceShowTooltip = false;\n\n private _whitelistedTags = ['input', 'textarea'];\n\n componentWillRender() {\n this._setInputClasses();\n }\n\n render() {\n const {\n hasHeaderSlot,\n helper,\n label,\n prefix,\n suffix,\n errorAndErrorIsNotBoolean,\n errorVariant,\n } = this._getSlotInfo();\n\n return (\n <Host\n class={`p-input-group ${this.error?.length && 'error'} ${\n this.disabled && 'disabled'\n } ${this.focused && 'focused'} size-${this.size}`}\n >\n <div class=\"flex items-end justify-between\">\n {label && (\n <div\n class=\"input-label\"\n onClick={() => this._focusInput()}\n >\n {label}\n {this.required && (\n <span class=\"ml-1 text-negative\">*</span>\n )}\n </div>\n )}\n\n {(helper || hasHeaderSlot) && (\n <div class=\"input-header\">\n {hasHeaderSlot && <slot name=\"header\" />}\n {helper && (\n <p-helper\n class={`flex ${\n hasHeaderSlot ? 'ml-2' : ''\n }`}\n placement=\"top-end\"\n >\n {helper}\n </p-helper>\n )}\n </div>\n )}\n </div>\n <p-tooltip\n class=\"w-full\"\n variant=\"error-element\"\n content={this.error}\n show={\n errorAndErrorIsNotBoolean &&\n errorVariant === 'element' &&\n this._forceShowTooltip\n }\n enableUserInput={false}\n >\n <div class=\"content\" slot=\"trigger\">\n {(prefix ||\n (this.icon && this.iconPosition === 'start')) && (\n <div\n class={`prefix size-${this.size}`}\n onClick={() => this._focusInput()}\n >\n {this.icon && this.iconPosition === 'start' ? (\n <p-icon\n class=\"flex\"\n variant={this.icon}\n rotate={this.iconRotate}\n flip={this.iconFlip}\n />\n ) : (\n prefix\n )}\n </div>\n )}\n {(suffix ||\n (errorAndErrorIsNotBoolean &&\n errorVariant === 'icon') ||\n (this.icon && this.iconPosition === 'end')) && (\n <div\n class={`suffix size-${this.size}`}\n onClick={() => this._focusInput()}\n >\n {errorAndErrorIsNotBoolean &&\n errorVariant === 'icon' ? (\n <p-input-error\n error={this.error}\n forceShowTooltip={\n this._forceShowTooltip\n }\n />\n ) : this.icon && this.iconPosition === 'end' ? (\n <p-icon\n class=\"flex\"\n variant={this.icon}\n rotate={this.iconRotate}\n flip={this.iconFlip}\n />\n ) : (\n suffix\n )}\n </div>\n )}\n\n <slot name=\"input\" />\n </div>\n </p-tooltip>\n </Host>\n );\n }\n\n @Listen('focusin')\n handleFocusIn() {\n this._forceShowTooltip = true;\n }\n\n @Listen('focusout')\n handleFocusOut() {\n this._forceShowTooltip = false;\n }\n /* \n With this, we shall hack the system in ways no one would ever have thought.\n \n <div class=\"pl-0 pr-0 border-l-0 border-r-0 rounded-tl-none rounded-bl-none rounded-tr-none rounded-br-none\"></div>\n */\n private _setInputClasses() {\n const input = this._el.querySelector(':scope > [slot=\"input\"]');\n\n if (!input) {\n return;\n }\n\n if (this._whitelistedTags.indexOf(input.tagName) === -1) {\n return;\n }\n\n if (!input.classList.contains('p-input')) {\n input.classList.add('p-input');\n }\n\n const { prefix, suffix, errorAndErrorIsNotBoolean, errorVariant } =\n this._getSlotInfo();\n\n if (\n suffix ||\n (errorAndErrorIsNotBoolean && errorVariant === 'icon') ||\n (this.icon && this.iconPosition === 'end')\n ) {\n input.classList.add(\n 'border-r-0',\n 'rounded-tr-none',\n 'rounded-br-none',\n 'pr-0'\n );\n } else {\n input.classList.remove(\n 'border-r-0',\n 'rounded-tr-none',\n 'rounded-br-none',\n 'pr-0'\n );\n }\n\n if (prefix || (this.icon && this.iconPosition === 'start')) {\n input.classList.add(\n 'border-l-0',\n 'rounded-tl-none',\n 'rounded-bl-none',\n 'pl-0'\n );\n } else {\n input.classList.remove(\n 'border-l-0',\n 'rounded-tl-none',\n 'rounded-bl-none',\n 'pl-0'\n );\n }\n\n if (this.size === 'small' && !input.classList.contains('size-small')) {\n input.classList.add('size-small');\n }\n\n if (this.size !== 'small' && input.classList.contains('size-small')) {\n input.classList.remove('size-small');\n }\n }\n\n private _getSlotInfo() {\n const hasHelperSlot = !!this._el.querySelector(\n ':scope > [slot=\"helper\"]'\n );\n const hasLabelSlot = !!this._el.querySelector(\n ':scope > [slot=\"label\"]'\n );\n const hasPrefixSlot = !!this._el.querySelector(\n ':scope > [slot=\"prefix\"]'\n );\n const hasSuffixSlot = !!this._el.querySelector(\n ':scope > [slot=\"suffix\"]'\n );\n const hasHeaderSlot = !!this._el.querySelector(\n ':scope > [slot=\"header\"]'\n );\n\n const helper = hasHelperSlot ? <slot name=\"helper\" /> : this.helper;\n const label = hasLabelSlot ? <slot name=\"label\" /> : this.label;\n const prefix = hasPrefixSlot ? <slot name=\"prefix\" /> : this.prefix;\n const suffix = hasSuffixSlot ? <slot name=\"suffix\" /> : this.suffix;\n\n const errorAndErrorIsNotBoolean =\n this.error &&\n typeof this.error === 'string' &&\n this.error !== 'true';\n\n return {\n hasHelperSlot,\n hasLabelSlot,\n hasPrefixSlot,\n hasSuffixSlot,\n hasHeaderSlot,\n helper,\n label,\n prefix,\n suffix,\n errorAndErrorIsNotBoolean,\n errorVariant: this._el.offsetWidth <= 72 ? 'element' : 'icon',\n };\n }\n\n private _focusInput() {\n const input = this._el.querySelector(':scope > [slot=\"input\"]');\n (input as HTMLElement)[this.focusMethod]();\n }\n}\n"],"version":3}
package/dist/index.html CHANGED
@@ -1,4 +1,4 @@
1
- <!doctype html><html dir="ltr" lang="en"><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0"> <title>Stencil Component Starter</title> <script type="module" src="/build/paperless.esm.js" data-stencil data-resources-url="/build/" data-stencil-namespace="paperless"></script> <script nomodule="" src="/build/paperless.js" data-stencil></script> </head> <body> <p-button>Buttono</p-button> <script data-build="2023-11-23T13:20:09">
1
+ <!doctype html><html dir="ltr" lang="en"><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0"> <title>Stencil Component Starter</title> <script type="module" src="/build/paperless.esm.js" data-stencil data-resources-url="/build/" data-stencil-namespace="paperless"></script> <script nomodule="" src="/build/paperless.js" data-stencil></script> </head> <body> <p-button>Buttono</p-button> <script data-build="2023-11-27T15:02:14">
2
2
  if ('serviceWorker' in navigator && location.protocol !== 'file:') {
3
3
  window.addEventListener('load', function() {
4
4
  navigator.serviceWorker.register('/sw.js')