0.0.8 • Published 2 years ago

@marketplace-co/input-tel v0.0.8

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

src/InputTel.js:

class: InputTel, mpc-input-tel

Superclass

NameModulePackage
LitElementlit

Fields

NamePrivacyTypeDefaultDescriptionInherited From
input
labelpublicstring'Phone Number'The inputs label
disabledbooleanfalse
valuepublicstring''The inputs value
_placeholderpublicstring''
regionpublicstring'US'The inputs active region, this is used as a preference and can be overwritten by user input
namepublicstring'phone'The inputs name
preferredRegionspublicarray[]Array of preferred regions
allowedRegionspublicarray[]Array of allowed regions
invalidpublicbooleanfalseWhether the input is disabled `readonly`
_phoneUtilpublicDisables the input

Methods

NamePrivacyDescriptionParametersReturnInherited From
firename, value
computePlaceholder

Events

NameTypeDescriptionInherited From
value-changedCustomEvent
invalid-changedCustomEvent

Attributes

NameFieldInherited From
labellabel
valuevalue
regionregion
namename
preferredRegionspreferredRegions
allowedRegionsallowedRegions
invalidinvalid
_phoneUtil_phoneUtil
_placeholder_placeholder

Exports

KindNameDeclarationModulePackage
jsInputTelInputTelsrc/InputTel.js

src/InputTelDropdown.js:

class: InputTelDropdown, mpc-input-tel-dropdown

Superclass

NameModulePackage
LionInputTelDropdown@lion/input-tel-dropdown

Static Fields

NamePrivacyTypeDefaultDescriptionInherited From
templatesobject{
dropdown: templateDataForDropdown => {
  const { refs, data } = templateDataForDropdown;
  const renderOption = regionMeta =>
    html`${this.templates.dropdownOption(
      templateDataForDropdown,
      regionMeta
    )} `;

  // TODO: once spread directive available, use it per ref
  return html`         <select
      class="form-select transition w-16 focus:ring-primary-500 focus:border-primary-500 h-full py-0 pl-3 pr-7 border-transparent bg-transparent text-gray-500 sm:text-sm rounded-md"
      ${ref(refs?.dropdown?.ref)}
      aria-label="${refs?.dropdown?.labels?.selectCountry}"
      @change="${refs?.dropdown?.listeners?.change}"
      style="${refs?.dropdown?.props?.style}"         >
      ${data?.regionMetaListPreferred?.length
        ? html`
            ${data.regionMetaListPreferred.map(renderOption)}                 <option disabled>---------------</option>
            ${data?.regionMetaList?.map(renderOption)}               `
        : html` ${data?.regionMetaList?.map(renderOption)}`}         </select>       `;
},
/**      * @param {TemplateDataForDropdownInputTel} templateDataForDropdown      * @param {RegionMeta} contextData      */
// eslint-disable-next-line class-methods-use-this
dropdownOption: (
  templateDataForDropdown,
  { regionCode, countryCode, flagSymbol }
) => html`       <!-- <option value="${regionCode}">
    ${regionCode} (+${countryCode}) &nbsp; ${flagSymbol}       </option> -->       <option value="${regionCode}">${regionCode}</option>     `,

} | | |

Fields

NamePrivacyTypeDefaultDescriptionInherited From
public
initialRegionpublic

Methods

NamePrivacyDescriptionParametersReturnInherited From
__calculateActiveRegion

Events

NameTypeDescriptionInherited From
active-region-changedCustomEvent

Attributes

NameFieldInherited From
initialRegioninitialRegion

Exports

KindNameDeclarationModulePackage
jsInputTelDropdownInputTelDropdownsrc/InputTelDropdown.js
custom-element-definitionmpc-input-tel-dropdownInputTelDropdownsrc/InputTelDropdown.js

mpc-input-tel.js:

Exports

KindNameDeclarationModulePackage
custom-element-definitionmpc-input-telInputTel/src/InputTel.js
jsdefaultInputTelmpc-input-tel.js