Wrap password content

pull/5806/head
Cagatay Civici 2024-05-26 01:37:01 +03:00
parent cb20a7b158
commit 63904d1784
7 changed files with 31 additions and 19 deletions

View File

@ -87,6 +87,10 @@ export interface PasswordPassThroughOptions {
* Used to pass attributes to the overlay's DOM element. * Used to pass attributes to the overlay's DOM element.
*/ */
overlay?: PasswordPassThroughOptionType; overlay?: PasswordPassThroughOptionType;
/**
* Used to pass attributes to the overlay's content DOM element.
*/
content?: PasswordPassThroughOptionType;
/** /**
* Used to pass attributes to the meter's DOM element. * Used to pass attributes to the meter's DOM element.
*/ */

View File

@ -49,10 +49,12 @@
> >
<slot name="header"></slot> <slot name="header"></slot>
<slot name="content"> <slot name="content">
<div :class="cx('content')" v-bind="ptm('content')">
<div :class="cx('meter')" v-bind="ptm('meter')"> <div :class="cx('meter')" v-bind="ptm('meter')">
<div :class="cx('meterLabel')" :style="{ width: meter ? meter.width : '' }" v-bind="ptm('meterLabel')"></div> <div :class="cx('meterLabel')" :style="{ width: meter ? meter.width : '' }" v-bind="ptm('meterLabel')"></div>
</div> </div>
<div :class="cx('info')" v-bind="ptm('info')">{{ infoText }}</div> <div :class="cx('info')" v-bind="ptm('info')">{{ infoText }}</div>
</div>
</slot> </slot>
<slot name="footer"></slot> <slot name="footer"></slot>
</div> </div>

View File

@ -51,9 +51,12 @@ const theme = ({ dt }) => `
border: 1px solid ${dt('password.overlay.border.color')}; border: 1px solid ${dt('password.overlay.border.color')};
box-shadow: ${dt('password.overlay.shadow')}; box-shadow: ${dt('password.overlay.shadow')};
border-radius: ${dt('password.overlay.border.radius')}; border-radius: ${dt('password.overlay.border.radius')};
}
.p-password-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: ${dt('password.overlay.gap')} gap: ${dt('password.content.gap')};
} }
.p-password-toggle-mask-icon { .p-password-toggle-mask-icon {
@ -87,6 +90,7 @@ const classes = {
maskIcon: 'p-password-toggle-mask-icon p-password-mask-icon', maskIcon: 'p-password-toggle-mask-icon p-password-mask-icon',
unmaskIcon: 'p-password-toggle-mask-icon p-password-unmask-icon', unmaskIcon: 'p-password-toggle-mask-icon p-password-unmask-icon',
overlay: 'p-password-overlay p-component', overlay: 'p-password-overlay p-component',
content: 'p-password-content',
meter: 'p-password-meter', meter: 'p-password-meter',
meterLabel: ({ instance }) => `p-password-meter-label ${instance.meter ? 'p-password-meter-' + instance.meter.strength : ''}`, meterLabel: ({ instance }) => `p-password-meter-label ${instance.meter ? 'p-password-meter-' + instance.meter.strength : ''}`,
meterText: 'p-password-meter-text' meterText: 'p-password-meter-text'

View File

@ -13,7 +13,9 @@ export default {
borderRadius: '{overlay.popover.border.radius}', borderRadius: '{overlay.popover.border.radius}',
color: '{overlay.popover.color}', color: '{overlay.popover.color}',
padding: '{overlay.popover.padding}', padding: '{overlay.popover.padding}',
shadow: '{overlay.popover.shadow}', shadow: '{overlay.popover.shadow}'
},
content: {
gap: '0.5rem' gap: '0.5rem'
}, },
colorScheme: { colorScheme: {

View File

@ -13,7 +13,9 @@ export default {
borderRadius: '{overlay.popover.border.radius}', borderRadius: '{overlay.popover.border.radius}',
color: '{overlay.popover.color}', color: '{overlay.popover.color}',
padding: '{overlay.popover.padding}', padding: '{overlay.popover.padding}',
shadow: '{overlay.popover.shadow}', shadow: '{overlay.popover.shadow}'
},
content: {
gap: '0.75rem' gap: '0.75rem'
}, },
colorScheme: { colorScheme: {

View File

@ -12,7 +12,9 @@ export default {
borderRadius: '{overlay.popover.border.radius}', borderRadius: '{overlay.popover.border.radius}',
color: '{overlay.popover.color}', color: '{overlay.popover.color}',
padding: '{overlay.popover.padding}', padding: '{overlay.popover.padding}',
shadow: '{overlay.popover.shadow}', shadow: '{overlay.popover.shadow}'
},
content: {
gap: '0.5rem' gap: '0.5rem'
}, },
colorScheme: { colorScheme: {

View File

@ -5,12 +5,11 @@
<div class="card flex justify-center"> <div class="card flex justify-center">
<Password v-model="value"> <Password v-model="value">
<template #header> <template #header>
<h6>Pick a password</h6> <div class="font-semibold text-xm mb-4">Pick a password</div>
</template> </template>
<template #footer> <template #footer>
<Divider /> <Divider />
<p class="mt-2">Suggestions</p> <ul class="pl-2 ml-2 my-0 leading-normal">
<ul class="pl-2 ml-2 mt-0" style="line-height: 1.5">
<li>At least one lowercase</li> <li>At least one lowercase</li>
<li>At least one uppercase</li> <li>At least one uppercase</li>
<li>At least one numeric</li> <li>At least one numeric</li>
@ -31,12 +30,11 @@ export default {
basic: ` basic: `
<Password v-model="value"> <Password v-model="value">
<template #header> <template #header>
<h6>Pick a password</h6> <div class="font-semibold text-xm mb-4">Pick a password</div>
</template> </template>
<template #footer> <template #footer>
<Divider /> <Divider />
<p class="mt-2">Suggestions</p> <ul class="pl-2 ml-2 my-0 leading-normal">
<ul class="pl-2 ml-2 mt-0" style="line-height: 1.5">
<li>At least one lowercase</li> <li>At least one lowercase</li>
<li>At least one uppercase</li> <li>At least one uppercase</li>
<li>At least one numeric</li> <li>At least one numeric</li>
@ -50,12 +48,11 @@ export default {
<div class="card flex justify-center"> <div class="card flex justify-center">
<Password v-model="value"> <Password v-model="value">
<template #header> <template #header>
<h6>Pick a password</h6> <div class="font-semibold text-xm mb-4">Pick a password</div>
</template> </template>
<template #footer> <template #footer>
<Divider /> <Divider />
<p class="mt-2">Suggestions</p> <ul class="pl-2 ml-2 my-0 leading-normal">
<ul class="pl-2 ml-2 style="line-height: 1.5">
<li>At least one lowercase</li> <li>At least one lowercase</li>
<li>At least one uppercase</li> <li>At least one uppercase</li>
<li>At least one numeric</li> <li>At least one numeric</li>
@ -81,12 +78,11 @@ export default {
<div class="card flex justify-center"> <div class="card flex justify-center">
<Password v-model="value"> <Password v-model="value">
<template #header> <template #header>
<h6>Pick a password</h6> <div class="font-semibold text-xm mb-4">Pick a password</div>
</template> </template>
<template #footer> <template #footer>
<Divider /> <Divider />
<p class="mt-2">Suggestions</p> <ul class="pl-2 ml-2 my-0 leading-normal">
<ul class="pl-2 ml-2 mt-0" style="line-height: 1.5">
<li>At least one lowercase</li> <li>At least one lowercase</li>
<li>At least one uppercase</li> <li>At least one uppercase</li>
<li>At least one numeric</li> <li>At least one numeric</li>