UNPKG

primeng

Version:

PrimeNG is an open source UI library for Angular featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeB

1 lines 9.41 kB
{"version":3,"file":"primeng-floatlabel.mjs","sources":["../../src/floatlabel/style/floatlabelstyle.ts","../../src/floatlabel/floatlabel.ts","../../src/floatlabel/primeng-floatlabel.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { BaseStyle } from 'primeng/base';\n\nconst theme = ({ dt }) => `\n.p-floatlabel {\n display: block;\n position: relative;\n}\n\n.p-floatlabel label {\n position: absolute;\n pointer-events: none;\n top: 50%;\n transform: translateY(-50%);\n transition-property: all;\n transition-timing-function: ease;\n line-height: 1;\n font-weight: ${dt('floatlabel.font.weight')};\n inset-inline-start: ${dt('floatlabel.position.x')};\n color: ${dt('floatlabel.color')};\n transition-duration: ${dt('floatlabel.transition.duration')};\n}\n\n.p-floatlabel:has(.p-textarea) label {\n top: ${dt('floatlabel.position.y')};\n transform: translateY(0);\n}\n\n.p-floatlabel:has(.p-inputicon:first-child) label {\n inset-inline-start: calc((${dt('form.field.padding.x')} * 2) + ${dt('icon.size')});\n}\n\n.p-floatlabel:has(.ng-invalid.ng-dirty) label {\n color: ${dt('floatlabel.invalid.color')};\n}\n\n.p-floatlabel:has(input:focus) label,\n.p-floatlabel:has(input.p-filled) label,\n.p-floatlabel:has(input:-webkit-autofill) label,\n.p-floatlabel:has(textarea:focus) label,\n.p-floatlabel:has(textarea.p-filled) label,\n.p-floatlabel:has(.p-inputwrapper-focus) label,\n.p-floatlabel:has(.p-inputwrapper-filled) label {\n top: ${dt('floatlabel.over.active.top')};\n transform: translateY(0);\n font-size: ${dt('floatlabel.active.font.size')};\n font-weight: ${dt('floatlabel.label.active.font.weight')};\n}\n\n.p-floatlabel:has(input.p-filled) label,\n.p-floatlabel:has(textarea.p-filled) label,\n.p-floatlabel:has(.p-inputwrapper-filled) label {\n color: ${dt('floatlabel.active.color')};\n}\n\n.p-floatlabel:has(input:focus) label,\n.p-floatlabel:has(input:-webkit-autofill) label,\n.p-floatlabel:has(textarea:focus) label,\n.p-floatlabel:has(.p-inputwrapper-focus) label {\n color: ${dt('floatlabel.focus.color')};\n}\n\n.p-floatlabel-in .p-inputtext,\n.p-floatlabel-in .p-textarea,\n.p-floatlabel-in .p-select-label,\n.p-floatlabel-in .p-multiselect-label-container,\n.p-floatlabel-in .p-autocomplete-input-multiple,\n.p-floatlabel-in .p-cascadeselect-label,\n.p-floatlabel-in .p-treeselect-label {\n padding-top: ${dt('floatlabel.in.input.padding.top')};\n}\n\n.p-floatlabel-in:has(input:focus) label,\n.p-floatlabel-in:has(input.p-filled) label,\n.p-floatlabel-in:has(input:-webkit-autofill) label,\n.p-floatlabel-in:has(textarea:focus) label,\n.p-floatlabel-in:has(textarea.p-filled) label,\n.p-floatlabel-in:has(.p-inputwrapper-focus) label,\n.p-floatlabel-in:has(.p-inputwrapper-filled) label {\n top: ${dt('floatlabel.in.active.top')};\n}\n\n.p-floatlabel-on:has(input:focus) label,\n.p-floatlabel-on:has(input.p-filled) label,\n.p-floatlabel-on:has(input:-webkit-autofill) label,\n.p-floatlabel-on:has(textarea:focus) label,\n.p-floatlabel-on:has(textarea.p-filled) label,\n.p-floatlabel-on:has(.p-inputwrapper-focus) label,\n.p-floatlabel-on:has(.p-inputwrapper-filled) label {\n top: 0;\n transform: translateY(-50%);\n border-radius: ${dt('floatlabel.on.border.radius')};\n background: ${dt('floatlabel.on.active.background')};\n padding: ${dt('floatlabel.on.active.padding')};\n}\n`;\n\nconst classes = {\n root: ({ instance, props }) => [\n 'p-floatlabel',\n {\n 'p-floatlabel-over': props.variant === 'over',\n 'p-floatlabel-on': props.variant === 'on',\n 'p-floatlabel-in': props.variant === 'in'\n }\n ]\n};\n\n@Injectable()\nexport class FloatLabelStyle extends BaseStyle {\n name = 'floatlabel';\n\n theme = theme;\n\n classes = classes;\n}\n\n/**\n *\n * FloatLabel visually integrates a label with its form element.\n *\n * [Live Demo](https://www.primeng.org/floatlabel/)\n *\n * @module floatlabelstyle\n *\n */\nexport enum FloatLabelClasses {\n /**\n * Class name of the root element\n */\n root = 'p-floatlabel'\n}\n\nexport interface FloatLabelStyle extends BaseStyle {}\n","import { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, inject, Input, NgModule, ViewEncapsulation } from '@angular/core';\nimport { SharedModule } from 'primeng/api';\nimport { BaseComponent } from 'primeng/basecomponent';\nimport { FloatLabelStyle } from './style/floatlabelstyle';\n\n/**\n * FloatLabel appears on top of the input field when focused.\n * @group Components\n */\n@Component({\n selector: 'p-floatlabel, p-floatLabel, p-float-label',\n standalone: true,\n imports: [CommonModule, SharedModule],\n template: ` <ng-content></ng-content> `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [FloatLabelStyle],\n host: {\n '[class.p-floatlabel]': 'true',\n '[class.p-floatlabel-over]': \"variant === 'over'\",\n '[class.p-floatlabel-on]': \"variant === 'on'\",\n '[class.p-floatlabel-in]': \"variant === 'in'\"\n }\n})\nexport class FloatLabel extends BaseComponent {\n _componentStyle = inject(FloatLabelStyle);\n /**\n * Defines the positioning of the label relative to the input.\n * @group Props\n */\n @Input() variant: 'in' | 'over' | 'on' = 'over';\n}\n\n@NgModule({\n imports: [FloatLabel, SharedModule],\n exports: [FloatLabel, SharedModule]\n})\nexport class FloatLabelModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;AAGA,MAAM,KAAK,GAAG,CAAC,EAAE,EAAE,EAAE,KAAK;;;;;;;;;;;;;;mBAcP,EAAE,CAAC,wBAAwB,CAAC,CAAA;0BACrB,EAAE,CAAC,uBAAuB,CAAC,CAAA;aACxC,EAAE,CAAC,kBAAkB,CAAC,CAAA;2BACR,EAAE,CAAC,gCAAgC,CAAC,CAAA;;;;WAIpD,EAAE,CAAC,uBAAuB,CAAC,CAAA;;;;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