Fixed #5719 - Fieldset: #legend updates
parent
731951b0a9
commit
d4be481ec8
|
@ -177,8 +177,15 @@ export interface FieldsetSlots {
|
||||||
default: () => VNode[];
|
default: () => VNode[];
|
||||||
/**
|
/**
|
||||||
* Custom legend template.
|
* Custom legend template.
|
||||||
|
* @param {Object} scope - legend slot's params.
|
||||||
*/
|
*/
|
||||||
legend: () => VNode[];
|
legend(scope: {
|
||||||
|
/**
|
||||||
|
* Toggle function.
|
||||||
|
* @param {Event} event - Browser event
|
||||||
|
*/
|
||||||
|
toggleCallback: (event: Event) => void;
|
||||||
|
}): VNode[];
|
||||||
/**
|
/**
|
||||||
* @deprecated since v4.0. Use the 'toggleicon' slot instead.
|
* @deprecated since v4.0. Use the 'toggleicon' slot instead.
|
||||||
* Custom toggler icon template.
|
* Custom toggler icon template.
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<fieldset :class="cx('root')" v-bind="ptmi('root')">
|
<fieldset :class="cx('root')" v-bind="ptmi('root')">
|
||||||
<legend :class="cx('legend')" v-bind="ptm('legend')">
|
<legend :class="cx('legend')" v-bind="ptm('legend')">
|
||||||
<slot v-if="!toggleable" name="legend">
|
<slot name="legend" :toggleCallback="toggle">
|
||||||
<span :id="id + '_header'" :class="cx('legendLabel')" v-bind="ptm('legendLabel')">{{ legend }}</span>
|
<span v-if="!toggleable" :id="id + '_header'" :class="cx('legendLabel')" v-bind="ptm('legendLabel')">{{ legend }}</span>
|
||||||
</slot>
|
<button
|
||||||
<a
|
|
||||||
v-if="toggleable"
|
v-if="toggleable"
|
||||||
:id="id + '_header'"
|
:id="id + '_header'"
|
||||||
v-ripple
|
v-ripple
|
||||||
tabindex="0"
|
type="button"
|
||||||
role="button"
|
|
||||||
:aria-controls="id + '_content'"
|
:aria-controls="id + '_content'"
|
||||||
:aria-expanded="!d_collapsed"
|
:aria-expanded="!d_collapsed"
|
||||||
:aria-label="buttonAriaLabel"
|
:aria-label="buttonAriaLabel"
|
||||||
|
@ -21,10 +19,9 @@
|
||||||
<slot :name="$slots.toggleicon ? 'toggleicon' : 'togglericon'" :collapsed="d_collapsed">
|
<slot :name="$slots.toggleicon ? 'toggleicon' : 'togglericon'" :collapsed="d_collapsed">
|
||||||
<component :is="d_collapsed ? 'PlusIcon' : 'MinusIcon'" :class="cx('toggleIcon')" v-bind="ptm('toggleIcon')" />
|
<component :is="d_collapsed ? 'PlusIcon' : 'MinusIcon'" :class="cx('toggleIcon')" v-bind="ptm('toggleIcon')" />
|
||||||
</slot>
|
</slot>
|
||||||
<slot name="legend">
|
|
||||||
<span :class="cx('legendLabel')" v-bind="ptm('legendLabel')">{{ legend }}</span>
|
<span :class="cx('legendLabel')" v-bind="ptm('legendLabel')">{{ legend }}</span>
|
||||||
|
</button>
|
||||||
</slot>
|
</slot>
|
||||||
</a>
|
|
||||||
</legend>
|
</legend>
|
||||||
<transition name="p-toggleable-content" v-bind="ptm('transition')">
|
<transition name="p-toggleable-content" v-bind="ptm('transition')">
|
||||||
<div v-show="!d_collapsed" :id="id + '_content'" :class="cx('contentContainer')" role="region" :aria-labelledby="id + '_header'" v-bind="ptm('contentContainer')">
|
<div v-show="!d_collapsed" :id="id + '_content'" :class="cx('contentContainer')" role="region" :aria-labelledby="id + '_header'" v-bind="ptm('contentContainer')">
|
||||||
|
|
|
@ -12,7 +12,6 @@ const theme = ({ dt }) => `
|
||||||
|
|
||||||
.p-fieldset-legend {
|
.p-fieldset-legend {
|
||||||
background: ${dt('fieldset.legend.background')};
|
background: ${dt('fieldset.legend.background')};
|
||||||
font-weight: 600;
|
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
border: 0 none;
|
border: 0 none;
|
||||||
padding: 0.5rem 0.75rem;
|
padding: 0.5rem 0.75rem;
|
||||||
|
@ -23,7 +22,7 @@ const theme = ({ dt }) => `
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.p-fieldset-toggleable > .p-fieldset-legend > a {
|
.p-fieldset-toggleable > .p-fieldset-legend > button {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -34,12 +33,18 @@ const theme = ({ dt }) => `
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 0.5rem 0.75rem;
|
padding: 0.5rem 0.75rem;
|
||||||
|
background: transparent;
|
||||||
color: ${dt('fieldset.legend.color')};
|
color: ${dt('fieldset.legend.color')};
|
||||||
|
border: 0 none;
|
||||||
border-radius: ${dt('border.radius.md')};
|
border-radius: ${dt('border.radius.md')};
|
||||||
transition: background ${dt('transition.duration')}, color ${dt('transition.duration')}, outline-color ${dt('transition.duration')};
|
transition: background ${dt('transition.duration')}, color ${dt('transition.duration')}, outline-color ${dt('transition.duration')};
|
||||||
outline-color: transparent;
|
outline-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.p-fieldset-legend-label {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
.p-fieldset-toggleable > .p-fieldset-legend > a:focus-visible {
|
.p-fieldset-toggleable > .p-fieldset-legend > a:focus-visible {
|
||||||
outline: ${dt('focus.ring.width')} ${dt('focus.ring.style')} ${dt('focus.ring.color')};
|
outline: ${dt('focus.ring.width')} ${dt('focus.ring.style')} ${dt('focus.ring.color')};
|
||||||
outline-offset: ${dt('focus.ring.offset')};
|
outline-offset: ${dt('focus.ring.offset')};
|
||||||
|
|
|
@ -31719,16 +31719,22 @@
|
||||||
"readonly": false,
|
"readonly": false,
|
||||||
"type": "Function",
|
"type": "Function",
|
||||||
"default": ""
|
"default": ""
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "legend",
|
|
||||||
"optional": false,
|
|
||||||
"readonly": false,
|
|
||||||
"type": "Function",
|
|
||||||
"default": ""
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"methods": [
|
"methods": [
|
||||||
|
{
|
||||||
|
"name": "legend",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "scope",
|
||||||
|
"optional": false,
|
||||||
|
"type": "{\n \t <span class=\"ml-3 doc-option-parameter-name\">toggleCallback</span>: <span class=\"doc-option-parameter-type\">(<span class=\"doc-option-parameter-name\">event</span>: Event) ⇒ void</span>, <span class=\"doc-option-parameter-type\">// Toggle function.</span>\n}",
|
||||||
|
"description": "legend slot's params."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"returnType": "VNode<RendererNode, RendererElement, Object>[]",
|
||||||
|
"description": "Custom legend template."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "togglericon",
|
"name": "togglericon",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
|
@ -31918,7 +31924,7 @@
|
||||||
"description": "Defines methods that can be accessed by the component's reference.",
|
"description": "Defines methods that can be accessed by the component's reference.",
|
||||||
"values": [
|
"values": [
|
||||||
{
|
{
|
||||||
"name": "basicUpload",
|
"name": "upload",
|
||||||
"parameters": [],
|
"parameters": [],
|
||||||
"returnType": "void",
|
"returnType": "void",
|
||||||
"description": "Upload file."
|
"description": "Upload file."
|
||||||
|
|
Loading…
Reference in New Issue