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

3 lines
6.1 KiB
JavaScript
Raw Normal View History

import{jsx as l,jsxs as P}from"react/jsx-runtime";import*as u from"react";import{useState as R}from"react";import{r as N,s as U,_ as D,f as m,A as j,u as w,a as F,t as O,G as V,b as G,S as H,z as B,B as T,E as J,v as q,J as $,o as K,W as Q,U as X}from"./index-CmO9OReA.js";import{P as Y,s as Z,h as ee,i as te}from"./Page-0WGWoSmH.js";import{F as ae,A as ne}from"./Form-DzOsnxGQ.js";import"react-dom";const o={expandableSection:"pf-c-expandable-section",expandableSectionContent:"pf-c-expandable-section__content",expandableSectionToggle:"pf-c-expandable-section__toggle",expandableSectionToggleIcon:"pf-c-expandable-section__toggle-icon",expandableSectionToggleText:"pf-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",overpassFont:"pf-m-overpass-font"}},M={name:"--pf-c-expandable-section--m-truncate__content--LineClamp",value:"3",var:"var(--pf-c-expandable-section--m-truncate__content--LineClamp)"};var c;(function(t){t.default="default",t.truncate="truncate"})(c||(c={}));const W=(t,e)=>{!e||t<1||e.style.setProperty(M.name,t.toString())};class k extends u.Component{constructor(e){super(e),this.expandableContentRef=u.createRef(),this.observer=()=>{},this.checkToggleVisibility=()=>{var a;if(!((a=this.expandableContentRef)===null||a===void 0)&&a.current){const d=this.props.truncateMaxLines||parseInt(M.value),p=this.expandableContentRef.current.scrollHeight/parseInt(getComputedStyle(this.expandableContentRef.current).lineHeight);this.setState({hasToggle:p>d})}},this.resize=()=>{const{offsetWidth:a}=this.expandableContentRef.current;this.state.previousWidth!==a&&(this.setState({previousWidth:a}),this.checkToggleVisibility())},this.handleResize=N(this.resize,250),this.state={isExpanded:e.isExpanded,hasToggle:!0,previousWidth:void 0}}calculateToggleText(e,a,d,p){return p&&a!==""?a:!p&&d!==""?d:e}componentDidMount(){if(this.props.variant===c.truncate){const e=this.expandableContentRef.current;this.setState({previousWidth:e.offsetWidth}),this.observer=U(e,this.handleResize,!1),this.props.truncateMaxLines&&W(this.props.truncateMaxLines,e),this.checkToggleVisibility()}}componentDidUpdate(e){if(this.props.variant===c.truncate&&e.truncateMaxLines!==this.props.truncateMaxLines){const a=this.expandableContentRef.current;W(this.props.truncateMaxLines,a),this.checkToggleVisibility()}}componentWillUnmount(){this.props.variant===c.truncate&&this.observer()}render(){const e=this.props,{onToggle:a,isActive:d,className:p,toggleText:E,toggleTextExpanded:h,toggleTextCollapsed:S,toggleContent:f,children:C,isExpanded:x,isDetached:b,displaySize:L,isWidthLimited:_,isIndented:y,contentId:A,variant:g,truncateMaxLines:I}=e,n=D(e,["onToggle","isActive","className","toggleText","toggleTextExpanded","toggleTextCollapsed","toggleContent","children","isExpanded","isDetached","displaySize","isWidthLimited","isIndented","contentId","variant","truncateMaxLines"]);let r=a,i=x;x===void 0&&(i=this.state.isExpanded,r=z=>{this.setState({isExpanded:z},()=>a(this.state.isExpanded))});const s=this.calculateToggleText(E,h,S,i),v=!b&&u.createElement("button",{className:m(o.expandableSectionToggle),type:"button","aria-expanded":i,onClick:()=>r(!i)},g!==c.truncate&&u.createElement("span",{className:m(o.expandableSectionToggleIcon)},u.createElement(j,{"aria-hidden":!0})),u.createElement("span",{className:m(o.expandableSectionToggleText)},f||s));return u.createElement("div",Object.assign({className:m(o.expandableSection,i&&o.modifiers.expanded,d&&o.modifiers.active,b&&o.modifiers.detached,L==="large"&&o.modifiers.displayLg,_&&o.modifiers.limitWidth,y&&o.modifiers.indented,g===c.truncate&&o.modifiers.truncate,p)},n),g===c.default&&v,u.createElement("div",{ref:this.expandableContentRef,className:m(o.expandableSectionContent),hidden:g!==c.truncate&&!i,id:A},C),g===c.truncate&&this.state.hasToggle&&v)}}k.displayName="ExpandableSection";k.defaultProps={className:"",toggleText:"",toggle
//# sourceMappingURL=PersonalInfo-5w_t768h.js.map