keycloak-d4science-spi-parent/keycloak-d4science-theme/src/main/resources/theme/d4science/account/resources/assets/PersonalInfo-BTFeEdfO.js

3 lines
6.5 KiB
JavaScript
Raw Normal View History

import{jsx as r,jsxs as W}from"react/jsx-runtime";import*as u from"react";import{useState as N}from"react";import{p as q,q as O,_ as V,r as z,f as h,A as F,u as H,a as B,t as Q,Q as G,b as $,S as J,v as K,B as E,E as X,w as Y,x as Z,m as ee,y as te,z as ne}from"./index-Bw6oJPms.js";import{P as ae,s as ie,i as se,j as oe}from"./Page-Q00E4OWK.js";import{F as le,A as re}from"./Form-B6DnMtXK.js";import"react-dom";const s={dirRtl:"pf-v5-m-dir-rtl",expandableSection:"pf-v5-c-expandable-section",expandableSectionContent:"pf-v5-c-expandable-section__content",expandableSectionToggle:"pf-v5-c-expandable-section__toggle",expandableSectionToggleIcon:"pf-v5-c-expandable-section__toggle-icon",expandableSectionToggleText:"pf-v5-c-expandable-section__toggle-text",modifiers:{expanded:"pf-m-expanded",detached:"pf-m-detached",truncate:"pf-m-truncate",limitWidth:"pf-m-limit-width",displayLg:"pf-m-display-lg",indented:"pf-m-indented",active:"pf-m-active",expandTop:"pf-m-expand-top"}},D={name:"--pf-v5-c-expandable-section--m-truncate__content--LineClamp",value:"3",var:"var(--pf-v5-c-expandable-section--m-truncate__content--LineClamp)"};var d;(function(t){t.default="default",t.truncate="truncate"})(d||(d={}));const U=(t,e)=>{!e||t<1||e.style.setProperty(D.name,t.toString())};class R extends u.Component{constructor(e){super(e),this.expandableContentRef=u.createRef(),this.observer=()=>{},this.checkToggleVisibility=()=>{var n;if(!((n=this.expandableContentRef)===null||n===void 0)&&n.current){const c=this.props.truncateMaxLines||parseInt(D.value),p=this.expandableContentRef.current.scrollHeight/parseInt(getComputedStyle(this.expandableContentRef.current).lineHeight);this.setState({hasToggle:p>c})}},this.resize=()=>{const{offsetWidth:n}=this.expandableContentRef.current;this.state.previousWidth!==n&&(this.setState({previousWidth:n}),this.checkToggleVisibility())},this.handleResize=q(this.resize,250),this.state={isExpanded:e.isExpanded,hasToggle:!0,previousWidth:void 0}}calculateToggleText(e,n,c,p){return p&&n!==""?n:!p&&c!==""?c:e}componentDidMount(){if(this.props.variant===d.truncate){const e=this.expandableContentRef.current;this.setState({previousWidth:e.offsetWidth}),this.observer=O(e,this.handleResize,!1),this.props.truncateMaxLines&&U(this.props.truncateMaxLines,e),this.checkToggleVisibility()}}componentDidUpdate(e){if(this.props.variant===d.truncate&&(e.truncateMaxLines!==this.props.truncateMaxLines||e.children!==this.props.children)){const n=this.expandableContentRef.current;U(this.props.truncateMaxLines,n),this.checkToggleVisibility()}}componentWillUnmount(){this.props.variant===d.truncate&&this.observer()}render(){const e=this.props,{onToggle:n,isActive:c,className:p,toggleText:S,toggleTextExpanded:f,toggleTextCollapsed:C,toggleContent:x,children:L,isExpanded:b,isDetached:m,displaySize:_,isWidthLimited:y,isIndented:I,contentId:A,toggleId:v,variant:g,truncateMaxLines:i}=e,l=V(e,["onToggle","isActive","className","toggleText","toggleTextExpanded","toggleTextCollapsed","toggleContent","children","isExpanded","isDetached","displaySize","isWidthLimited","isIndented","contentId","toggleId","variant","truncateMaxLines"]);m&&!v&&console.warn("ExpandableSection: The toggleId value must be passed in and must match the toggleId of the ExpandableSectionToggle.");let o=n,a=b;const T=A||z("expandable-section-content"),M=v||z("expandable-section-toggle");b===void 0&&(a=this.state.isExpanded,o=(k,w)=>{this.setState({isExpanded:w},()=>n(k,this.state.isExpanded))});const j=this.calculateToggleText(S,f,C,a),P=!m&&u.createElement("button",{className:h(s.expandableSectionToggle),type:"button","aria-expanded":a,"aria-controls":T,id:M,onClick:k=>o(k,!a)},g!==d.truncate&&u.createElement("span",{className:h(s.expandableSectionToggleIcon)},u.createElement(F,{"aria-hidden":!0})),u.createElement("span",{className:h(s.expandableSectionToggleText)},x||j));return u.createElement("div",Object.assign({className:h(s.expandableSection,a&&s.modifiers.expanded,c&&s.modifiers.active,m&&s.modifiers.detached,_==="lg"&&s.modifiers.displayLg,y&&s.modifiers.limitWidth,I&&s.modifi
//# sourceMappingURL=PersonalInfo-BTFeEdfO.js.map